import javax . print . DocFlavor ; import javax . swing . * ; import java . awt . image . BandedSampleModel ; import java . util . * ;   public class Example { static long [ ] [ ] dp ;

import java . util . Scanner ;    public class SubstringSort {   public static void main ( String [ ] args ) { boolean flag = true ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String str [ ] = new String [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) { str [ i ] = sc . nextLine ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { if ( str [ i ] . length ( ) > str [ j ] . length ( ) ) { String temp = str [ i ] ; str [ i ] = str [ j ] ; str [ j ] = temp ; } } } for ( int i = 1 ; i <= n ; i ++ ) { if ( ! str [ i ] . contains ( str [ i - 1 ] ) ) { flag = false ; break ; } } if ( flag == true ) { System . out . println ( " YES " ) ; for ( int i = 0 ; i <= n ; i ++ ) { System . out . println ( str [ i ] ) ; } } else { System . out . println ( " NO " ) ; } } }

import java . util . * ; public class Main { public static boolean isSubstring ( String a , String b ) { int a_size = a . length ( ) ; int b_size = b . length ( ) ; for ( int i = 0 ; i < b_size ; i ++ ) { boolean found = true ; if ( i + a_size > b_size ) { break ; } for ( int j = 0 ; j < a_size ; j ++ ) { if ( b . charAt ( i + j ) != a . charAt ( j ) ) { found = false ; break ; } } if ( found ) { return true ; } } return false ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String str [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { str [ i ] = scan . next ( ) ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = 0 ; j < n - i - 1 ; j ++ ) { if ( str [ j ] . length ( ) > str [ j + 1 ] . length ( ) ) { String temp = str [ j ] ; str [ j ] = str [ j + 1 ] ; str [ j + 1 ] = temp ; } } } boolean exist = true ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( isSubstring ( str [ i ] , str [ i + 1 ] ) == false ) { exist = false ; break ; } } if ( exist ) { System . out . println ( " YES " ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( str [ i ] ) ; } } else { System . out . println ( " NO " ) ; } } }

import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] arr = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . next ( ) ; for ( int i = 1 ; i < n ; i ++ ) { String temp = arr [ i ] ; int j = i - 1 ; while ( j >= 0 && temp . length ( ) < arr [ j ] . length ( ) ) { arr [ j + 1 ] = arr [ j ] ; j -- ; } arr [ j + 1 ] = temp ; } int c = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] . contains ( arr [ i - 1 ] ) ) c ++ ; } if ( c == n ) { System . out . println ( " YES " ) ; for ( int i = 0 ; i < n ; i ++ ) System . out . println ( arr [ i ] ) ; } else System . out . println ( " NO " ) ; } }

import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < String > list = new ArrayList < > ( ) ; int maxl = 0 ; String maxls = " " ; int index = 0 ; Map < Integer , List < String > > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; int l = s . length ( ) ; map . putIfAbsent ( l , new ArrayList < > ( ) ) ; List < String > y = map . get ( l ) ; y . add ( s ) ; map . put ( l , y ) ;

import sys , mathfrom collections import deque , defaultdictimport operator as opfrom functools import reducefrom itertools import permutations   NEW_LINE

def sort ( s , n ) : for i in range ( 1 , n ) : temp = s [ i ] j = i - 1 while j >= 0 and len ( temp ) < len ( s [ j ] ) : s [ j + 1 ] = s [ j ] j -= 1   s [ j + 1 ] = temp     n = int ( input ( ) ) strings = [ ] for _ in range ( n ) : s = input ( ) strings . append ( s )   check = Truesort ( strings , n ) NEW_LINE

t = int ( input ( ) ) a = sorted ( ( input ( ) for _ in range ( t ) ) , key = lambda res : len ( res ) ) ans = all ( a [ i ] in a [ i + 1 ] for i in range ( t - 1 ) ) print ( ' YES \n ' + " \n " . join ( a ) if ans else ' NO ' ) NEW_LINE

n = int ( input ( ) ) a = [ ] for i in range ( 1 , n + 1 ) : b = input ( ) a . append ( b ) a . sort ( key = len ) t = 0 for i in range ( 1 , n ) : if a [ i - 1 ] in a [ i ] : t = 0 else : t = 1 NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ; public class Solution { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; int ca = 0 ; int cb = 0 ; int d = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '0' ) { cb = 0 ; ca ++ ; if ( ca == 7 ) { d = 1 ; break ; } } else { ca = 0 ; cb ++ ; if ( cb == 7 ) { d = 1 ; break ; } } } if ( d == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

import java . util . Scanner ; public class FootBall { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; checkSituation ( str ) ; sc . close ( ) ; } private static void checkSituation ( String str ) { if ( str . contains ( "0000000" ) || str . contains ( "1111111" ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

import java . util . Scanner ; public class Football { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; sc . close ( ) ; if ( str . length ( ) <= 7 ) System . out . println ( " NO " ) ; else { String check1 = "1111111" ; String check2 = "0000000" ; if ( str . contains ( check1 ) || str . contains ( check2 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } catch ( Exception e ) { return ; } } }

import java . util . * ; import java . io . * ; public class A_Football { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader scan = new FastReader ( ) ; String str = scan . nextLine ( ) ; int countOne = 0 ; int countZero = 0 ; int i = 0 ; String output = " NO " ; while ( i < str . length ( ) ) { char ch = str . charAt ( i ) ; if ( ch == '1' ) { countOne ++ ; countZero = 0 ; if ( countOne == 7 ) { output = " YES " ; } } else { countZero ++ ; countOne = 0 ; if ( countZero == 7 ) { output = " YES " ; } } i ++ ; } System . out . println ( output ) ; } }

s = input ( ) NEW_LINE x = 7 * "1" NEW_LINE y = 7 * "0" NEW_LINE if x in s : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT elif y in s : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT

players = input ( ) NEW_LINE number = players [ 0 ] NEW_LINE counter = 0 NEW_LINE for i in players : NEW_LINE INDENT if ( number == i ) : NEW_LINE INDENT counter += 1 NEW_LINE DEDENT else : NEW_LINE INDENT number = i NEW_LINE counter = 1 NEW_LINE DEDENT if ( counter == 7 ) : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT if ( counter == 7 ) : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT

n = input ( ) NEW_LINE if '1111111' in n or '0000000' in n : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT

pos = input ( ) NEW_LINE if pos . find ( "0000000" ) != - 1 or pos . find ( "1111111" ) != - 1 : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT

s = input ( ) NEW_LINE f = 0 NEW_LINE if '0000000' in s : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE f = 1 NEW_LINE DEDENT if '1111111' in s : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE f = 1 NEW_LINE DEDENT if f == 0 : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT


import java . util . * ;   public class Main {   public static void main ( String [ ] args ) {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ; public class M { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int q = scanner . nextInt ( ) ; while ( q -- > 0 ) { int n = scanner . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = scanner . nextInt ( ) ; Arrays . sort ( a ) ; Set < Integer > set = new HashSet < Integer > ( ) ; Set < Integer > set2 = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! set . contains ( a [ i ] ) ) set . add ( a [ i ] ) ; else set2 . add ( a [ i ] ) ; } List < Integer > list = new ArrayList < Integer > ( ) ; list . addAll ( set ) ; Collections . sort ( list ) ; List < Integer > list2 = new ArrayList < Integer > ( ) ; list2 . addAll ( set2 ) ; Collections . sort ( list2 ) ; int x = - 1 , y = - 1 ; for ( int i : list ) { if ( i == x + 1 ) x = i ; else break ; } for ( int i : list2 ) { if ( i == y + 1 ) y = i ; else break ; }

import java . lang . * ; import java . util . * ;   public class Abhishek {   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int [ ] a = new int [ 101 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ sc . nextInt ( ) ] ++ ; } int mexA = - 1 , mexB = - 1 ; for ( int i = 0 ; i < a . length ; i ++ ) { if ( a [ i ] <= 1 && mexA == - 1 ) mexA = i ; if ( a [ i ] == 0 && mexB == - 1 ) mexB = i ; } System . out . println ( mexA + mexB ) ; }   } }

import java . math . BigInteger ; import java . util . * ;   public class Example { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int t = sc . nextInt ( ) ; while ( t > 0 ) { int n = sc . nextInt ( ) ; int [ ] ans = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) {    ans [ i ] = sc . nextInt ( ) ; } int [ ] frq = new int [ 101 ] ; for ( int i = 0 ; i < ans . length ; i ++ ) { frq [ ans [ i ] ] ++ ;   } int c1 = - 1 ; int c2 = - 1 ; int aa = 0 ; boolean onetime = true ; boolean tt = false ; for ( int i = 0 ; i <= 100 ; i ++ ) {   if ( frq [ i ] >= 2 && onetime ) { c1 ++ ; c2 ++ ;    } else if ( frq [ i ] == 0 ) { tt = true ; if ( c1 == c2 ) { aa = 2 * i ; } else { aa = ++ c2 + ++ c1 ; } break ; } else if ( frq [ i ] >= 1 ) { c1 ++ ; onetime = false ; }   } if ( tt ) { System . out . println ( aa ) ; } else { System . out . println ( ++ c1 + ++ c2 ) ; } t -- ; } } }

import java . util . * ; public class SubsetMex {   public static void main ( String [ ] args ) {

for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE s = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a = [ 0 ] * 102 NEW_LINE b = [ 0 ] * 102 NEW_LINE s . sort ( ) NEW_LINE for i in s : if NEW_LINE a [ i ] == 0 : a [ i ] += 1 else : b [ i ] += 1 NEW_LINE print ( a . index ( 0 ) + b . index ( 0 ) ) NEW_LINE

for _ in " ▁ " * int ( input ( ) ) : n = int ( input ( ) ) NEW_LINE lst = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE a , b = 0 , 0 NEW_LINE for i in lst : if NEW_LINE a == i : a += 1 elif b == i : b += 1 NEW_LINE print ( a + b ) NEW_LINE

t = int ( input ( ) ) NEW_LINE def mex1 ( arr ) : i = 0 NEW_LINE while ( 1 ) : if NEW_LINE i not in arr : NEW_LINE return i else : i += 1 NEW_LINE def mex2 ( arr ) : i = 0 NEW_LINE while ( 1 ) : if NEW_LINE arr . count ( i ) < 2 : NEW_LINE return i else : i += 1   for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE arr = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if 0 not in arr : NEW_LINE INDENT print ( 0 ) elif arr . count ( 0 ) == 1 : NEW_LINE print ( mex1 ( arr ) ) else : NEW_LINE print ( mex1 ( arr ) + mex2 ( arr ) ) NEW_LINE DEDENT

cases = int ( input ( ) ) NEW_LINE while cases : cases -= 1 NEW_LINE num = int ( input ( ) ) NEW_LINE arr = list ( map ( int , input ( ) . split ( ) ) )   st1 = - 1 NEW_LINE st2 = - 1 NEW_LINE broken = False NEW_LINE for i in range ( 101 ) : if NEW_LINE i not in arr : NEW_LINE break else : if arr . count ( i ) > 1 and not broken : st1 += 1 NEW_LINE st2 += 1 else : st1 += 1 NEW_LINE broken = True   print ( 2 + st1 + st2 ) NEW_LINE


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ;   public class _0726Emotes {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; List < Long > store = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { store . add ( sc . nextLong ( ) ) ; } Collections . sort ( store ) ; long first = store . get ( store . size ( ) - 1 ) ; long second = store . get ( store . size ( ) - 2 ) ; System . out . println ( ( m / ( k + 1 ) ) * 1L * ( ( k * first ) + second ) + ( m % ( k + 1 ) * first ) ) ; }   }

n , m , k = map ( int , input ( ) . split ( ) ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) arr . sort ( reverse = True )   base = arr [ 0 ] * k + arr [ 1 ] t = m // ( k + 1 ) base = base * t   t = m % ( k + 1 ) base += t * arr [ 0 ]     print ( int ( base ) ) NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( reverse = True ) p = a [ 0 ] * k + a [ 1 ] ans = p * ( m // ( k + 1 ) ) + a [ 0 ] * ( m % ( k + 1 ) ) print ( ans ) NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) )   emotes = [ int ( bruhh ) for bruhh in input ( ) . split ( ) ]   emotes . sort ( )   cycles = m // ( k + 1 ) leftover = m % ( k + 1 ) res = 0   res += ( ( k ) * emotes [ - 1 ] ) * ( cycles ) res += emotes [ - 2 ] * ( cycles )   res += emotes [ - 1 ] * leftover   print ( res )   NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) ) a = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) ans = m // ( k + 1 ) * ( a [ - 1 ] * k + a [ - 2 ] ) + m % ( k + 1 ) * a [ - 1 ] print ( ans ) NEW_LINE


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { int dis , step = 0 ; Scanner sc = new Scanner ( System . in ) ; dis = sc . nextInt ( ) ; if ( dis / 5 >= 1 ) { step = dis / 5 ; dis = dis % 5 ; } if ( dis / 4 >= 1 ) { step += dis / 4 ; dis = dis % 4 ; } if ( dis / 3 >= 1 ) { step += dis / 3 ; dis = dis % 3 ; } if ( dis / 2 >= 1 ) { step += dis / 2 ; dis = dis % 2 ; } step += dis ; System . out . println ( step ) ; } }

import java . util . Scanner ; public class Ex {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , count = 0 ; while ( n != 0 ) { if ( n >= 5 ) { n = n - 5 ; count ++ ; } else { n = n - n ; count ++ ; } } System . out . println ( count ) ; } }

import java . util . Scanner ;   public class Elephant { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ;   int res = 0 ; for ( int i = 5 ; i >= 1 ; i -- ) { res += n / i ; n = n % i ; }   System . out . println ( res ) ; } }

import java . util . Scanner ;   public class BigO {   public static void main ( String [ ] args ) { int x ;   Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; int step = 1 ; while ( x > 5 ) { x -= 5 ; step ++ ; } System . out . println ( step ) ; } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AElephant solver = new AElephant ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class AElephant { public void solve ( int testNumber , FastScanner fs , PrintWriter out ) { int x = fs . nextInt ( ) ; int ans = 0 ; for ( int i = 5 ; i >= 1 ; i -- ) { ans += x / i ; x = x % i ; } out . println ( ans ) ; }   }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }

a = int ( input ( ) ) i = 0 while a > 5 : a = a - 5 i = i + 1 i = i + 1 print ( i ) NEW_LINE

x = int ( input ( ) ) print ( ( x + 4 ) // 5 ) NEW_LINE

a = int ( input ( " " ) ) if a % 5 == 0 : print ( a // 5 ) else : print ( a // 5 + 1 ) NEW_LINE

x = 0 z = int ( input ( ) ) while z > 0 : if z >= 5 : z = z - 5 x += 1 elif z >= 4 : z = z - 4 x += 1 elif z >= 3 : z = z - 3 x += 1 elif z >= 2 : z = z - 2 x += 1 elif z >= 1 : z = z - 1 x += 1 print ( x ) NEW_LINE

a = int ( input ( ) ) i = 0 while a > 5 : a = a - 5 i = i + 1 print ( i + 1 ) NEW_LINE


import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . util . Stack ; import java . util . StringTokenizer ;    public class RedBlueBalls { public static void main ( String [ ] args ) throws IOException { MyScanner s = new MyScanner ( ) ; Print p = new Print ( ) ; int n = s . nextInt ( ) ; char [ ] att = s . nextLine ( ) . toCharArray ( ) ; Stack < Character > st = new Stack < > ( ) ; boolean ins = false ; for ( int i = 0 ; i < att . length ; i ++ ) { char ch = att [ att . length - 1 - i ] ; if ( ch == ' B ' ) ins = true ; if ( ins ) { st . push ( ch ) ; } } n = st . size ( ) ; long count = 0 ; for ( int i = 0 ; i < att . length ; i ++ ) { if ( att [ i ] == ' B ' ) { count += ( long ) Math . pow ( 2 , i ) ; } }

import java . util . Scanner ;   public class B_RedAndBlueBalls {

import java . util . * ; public class Main { static long count = 0 ; public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' B ' ) { count += ( long ) Math . pow ( 2 , i ) ; } } System . out . println ( count ) ; } }

n = int ( input ( ) ) s = input ( ) tot = 0 for i , ball in enumerate ( s ) : if ball == ' B ' : tot += ( 1 << i ) print ( tot )   NEW_LINE

size = int ( input ( ) ) stack = list ( input ( ) )   print ( sum ( [ 2 ** i for i in range ( size ) if stack [ i ] == ' B ' ] ) ) NEW_LINE

length , string = int ( input ( ) ) , input ( ) print ( sum ( [ 2 ** i if string [ i ] == " B " else 0 for i in range ( len ( string ) ) ] ) ) NEW_LINE

input ( ) print ( int ( input ( ) . replace ( ' R ' , '0' ) . replace ( ' B ' , '1' ) [ : : - 1 ] , 2 ) ) NEW_LINE


import java . io . File ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; double x = input . nextDouble ( ) ; double y = input . nextDouble ( ) ; int n = input . nextInt ( ) ; double ans [ ] = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { double Rr = input . nextDouble ( ) ; double Ry = input . nextDouble ( ) ; double speed = input . nextDouble ( ) ; double distance = Math . sqrt ( Math . pow ( x - Rr , 2 ) + Math . pow ( y - Ry , 2 ) ) ; ans [ i ] = distance / speed ; } Arrays . sort ( ans ) ; System . out . printf ( " % .6f \n " , ans [ 0 ] ) ; } }

import java . util . Scanner ;   public class BeruTaxi { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) , b = in . nextInt ( ) , n = in . nextInt ( ) , i ; double o = Double . MAX_VALUE ;   for ( i = 0 ; i < n ; i ++ ) { int x = in . nextInt ( ) , y = in . nextInt ( ) , v = in . nextInt ( ) ; double d = Math . sqrt ( Math . pow ( x - a , 2 ) + Math . pow ( y - b , 2 ) ) ; o = Math . min ( o , d / v ) ; } in . close ( ) ; System . out . println ( o ) ; } }

import java . util . Scanner ;    public class Main { public static void main ( String [ ] args ) {

import java . util . * ; import java . util . stream . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int n = scan . nextInt ( ) ; double minT = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; int v = scan . nextInt ( ) ; double s = Math . sqrt ( ( x - a ) * ( x - a ) + ( y - b ) * ( y - b ) ) ; double t = s / v ; if ( i == 0 ) { minT = t ; } else { minT = Math . min ( t , minT ) ; } } System . out . println ( minT ) ; } }

import mathx1 , y1 = ( int ( x ) for x in input ( ) . split ( ) ) n = int ( input ( ) ) t = 10 ** 9 + 7 for _ in range ( n ) : x2 , y2 , v = ( int ( x ) for x in input ( ) . split ( ) ) if abs ( math . sqrt ( ( x2 - x1 ) ** 2 + ( y2 - y1 ) ** 2 ) ) / v < t : t = abs ( math . sqrt ( ( x2 - x1 ) ** 2 + ( y2 - y1 ) ** 2 ) ) / vprint ( t ) NEW_LINE

import mathc = input ( ) . split ( ) x1 , y1 = int ( c [ 0 ] ) , int ( c [ 1 ] ) n = int ( input ( ) ) d = [ ] for i in range ( n ) : c = [ int ( i ) for i in input ( ) . split ( ) ] distance = math . sqrt ( ( c [ 0 ] - x1 ) ** 2 + ( c [ 1 ] - y1 ) ** 2 ) / c [ 2 ] d . append ( distance ) print ( min ( d ) ) NEW_LINE

import ioimport osimport mathinput = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline NEW_LINE

if __name__ == " _ _ main _ _ " : x , y = list ( map ( int , input ( ) . split ( ) ) ) n = int ( input ( ) ) m = n result = float ( ' inf ' ) while m : i , j , t = list ( map ( int , input ( ) . split ( ) ) ) result = min ( result , ( ( ( x - i ) ** 2 + ( y - j ) ** 2 ) ** 0.5 ) / t ) m = m - 1 print ( round ( result , 7 ) )         NEW_LINE

import matha , b = ( int ( x ) for x in input ( ) . split ( ) ) best = float ( ' INF ' ) for _ in range ( int ( input ( ) ) ) : x , y , v = ( int ( x ) for x in input ( ) . split ( ) ) best = min ( best , ( math . sqrt ( ( a - x ) ** 2 + ( b - y ) ** 2 ) ) / v ) print ( best ) NEW_LINE


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner x = new Scanner ( System . in ) ; int n = x . nextInt ( ) ; int a = x . nextInt ( ) ; int b = x . nextInt ( ) ; int y = ( ( a - 1 + b ) % n + n ) % n + 1 ; System . out . println ( y ) ; } }

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; if ( b > 0 ) { System . out . println ( ( a + b % n - 1 ) % n + 1 ) ; } else { System . out . println ( ( a + n - ( - b % n ) - 1 ) % n + 1 ) ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class RoundHouse { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ;   int n = Integer . parseInt ( st . nextToken ( ) ) ; int a = Integer . parseInt ( st . nextToken ( ) ) - 1 ; int b = Integer . parseInt ( st . nextToken ( ) ) ;   if ( b < 0 ) { b = Math . abs ( b ) ; b %= n ; a -= b ; if ( a < 0 ) a += n ; } else { b %= n ; a += b ; a %= n ; }   System . out . println ( a + 1 ) ; } }

import java . util . * ;   public class Absolutezero {     public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ;   int c = Math . abs ( b ) ; c = c % n ; if ( b < 0 ) { c = - c ; } if ( c < 0 ) { c = n - Math . abs ( c ) ; int d = a - 1 ; int f = Math . abs ( c ) ; f = f + d + 1 ; if ( f > n ) { f = f - n ; } System . out . println ( f ) ; } else if ( c > 0 ) { int d = a - 1 ; int f = Math . abs ( c ) ; f = f + d + 1 ; if ( f > n ) { f = f - n ; } System . out . println ( f ) ; } else { System . out . println ( a ) ; }   }       }

import java . util . Scanner ;   public class _0671RoundHouse {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( ( ( a - 1 + b ) % n + n ) % n + 1 ) ; }   }

n , a , b = map ( int , input ( ) . split ( ) ) if b < 0 : for x in range ( abs ( b ) ) : if a != 1 : a -= 1 else : a = nelif b >= 0 : for y in range ( b ) : if a == n : a = 1 else : a += 1   print ( a ) NEW_LINE

import mathdef solve ( n , a , b ) : if b < 0 : res = ( n - ( - 1 * b % n ) ) + a else : res = b % n + a return res if res <= n else res - n   def main ( ) : arr = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE

n , a , b = map ( int , input ( ) . split ( ) )   if b > 0 : for i in range ( b ) : a += 1   if a == n + 1 : a = 1 else : for i in range ( abs ( b ) ) : a -= 1   if a == 0 : a = n   print ( a ) NEW_LINE

n , a , b = map ( int , input ( ) . split ( ) )   s = 0 drctn = 1 if b >= 0 else - 1 while s < abs ( b ) : a += 1 * drctn s += 1   if a > n : a = 1 elif a <= 0 : a = n   print ( a ) NEW_LINE

I = lambda : map ( int , input ( ) . split ( ) ) INT = lambda : int ( input ( ) )   NEW_LINE


import java . math . BigInteger ; import java . util . Scanner ;   public class Practice { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; BigInteger a = new BigInteger ( "3" ) . pow ( 3 * n ) ; a = a . subtract ( new BigInteger ( "7" ) . pow ( n ) ) ; System . out . println ( a . mod ( new BigInteger ( "1000000007" ) ) ) ; } }

import java . util . Scanner ;   public class Practice { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long n = input . nextLong ( ) ; long a = 1 , b = 1 , mod = ( long ) ( 1E9 ) + 7 ; for ( int i = 0 ; i < 3 * n ; i ++ ) { a = ( a * 3 ) % mod ; } for ( int i = 0 ; i < n ; i ++ ) b = ( b * 7 ) % mod ; System . out . println ( ( a - b + mod ) % mod ) ; } }

import java . util . Scanner ;   public class CF584_D2_B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) * 3 ; long ans = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { ans *= 3 ; ans = ans % 1000000007 ; } long m = 1 ; for ( int i = 0 ; i < n / 3 ; i ++ ) { m *= 7 ; m = m % 1000000007 ; } System . out . println ( ( ans - m + 1000000007 ) % 1000000007 ) ; } }

import java . io . * ; import java . util . * ; import java . lang . * ;   public class Main {   public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; int MOD = ( int ) ( 1e9 + 7 ) ; long ans = 1 ; long diff = 1 ; for ( int i = 0 ; i < n ; i ++ ) { ans = ans * 27 ; diff = diff * 7 ; ans = ( ans ) % MOD ; diff = ( diff ) % MOD ; } ans = ans - diff ; if ( ans < 0 ) ans += MOD ; out . println ( ans ) ; out . close ( ) ; }   static final Random random = new Random ( ) ;

n = int ( input ( ) ) first = 3 ** ( 3 * n ) second = 7 ** nmod = 1000000007 print ( ( first - second ) % mod ) NEW_LINE

from sys import stdin , stdoutnmbr = lambda : int ( input ( ) ) lst = lambda : list ( map ( int , input ( ) . split ( ) ) ) N = 10 ** 5 + 5 M = 10 ** 9 + 7 p3 = [ 1 ] p7 = [ 1 ] for i in range ( 3 * N ) : p3 += [ ( p3 [ - 1 ] * 3 ) % M ] for i in range ( N ) : p7 += [ ( p7 [ - 1 ] * 7 ) % M ] for _ in range ( 1 ) : NEW_LINE

import sysfrom math import * from itertools import product   def ints_input ( ) : return [ int ( i ) for i in sys . stdin . readline ( ) . strip ( " \n " ) . split ( " ▁ " ) ]     def print_list ( arr ) : sys . stdout . writelines ( str ( x ) + " ▁ " for x in arr ) sys . stdout . write ( " \n " )     def fast_input ( type = str ) : return type ( sys . stdin . readline ( ) . strip ( " \n " ) ) n = fast_input ( int ) print ( int ( ( 3 ** ( 3 * n ) - 7 ** n ) % ( 10 ** 9 + 7 ) ) ) NEW_LINE

n = int ( input ( ) ) MOD = 1000000007 print ( ( pow ( 3 , 3 * n ) - pow ( 7 , n ) ) % MOD ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class CF1422_D2_B { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { solve ( scanner ) ; }   }   private static void solve ( FastScanner scanner ) { int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int [ ] [ ] matrix = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { int x = scanner . nextInt ( ) ; matrix [ i ] [ j ] = x ; } } long count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { int [ ] arr = { matrix [ i ] [ j ] , matrix [ n - i - 1 ] [ j ] , matrix [ i ] [ m - j - 1 ] , matrix [ n - i - 1 ] [ m - j - 1 ] } ; Arrays . sort ( arr ) ; long mid = 0 ; mid += ( arr [ 1 ] + arr [ 2 ] ) / 2 ; for ( int value : arr ) { count += Math . abs ( mid - value ) ; } } } System . out . println ( count / 4 ) ;

import java . util . Arrays ; import java . util . Scanner ;   public class B1422 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int R = in . nextInt ( ) ; int C = in . nextInt ( ) ; int [ ] [ ] A = new int [ R ] [ C ] ; for ( int r = 0 ; r < R ; r ++ ) { for ( int c = 0 ; c < C ; c ++ ) { A [ r ] [ c ] = in . nextInt ( ) ; } } long answer = 0 ; for ( int r = 0 ; r < R ; r ++ ) { for ( int c = 0 ; c < C ; c ++ ) { int target = findTarget ( A [ r ] [ c ] , A [ R - 1 - r ] [ c ] , A [ r ] [ C - 1 - c ] , A [ R - 1 - r ] [ C - 1 - c ] ) ;   answer += Math . abs ( target - A [ r ] [ c ] ) ; A [ r ] [ c ] = target ; answer += Math . abs ( target - A [ R - 1 - r ] [ c ] ) ; A [ R - 1 - r ] [ c ] = target ; answer += Math . abs ( target - A [ r ] [ C - 1 - c ] ) ; A [ r ] [ C - 1 - c ] = target ; answer += Math . abs ( target - A [ R - 1 - r ] [ C - 1 - c ] ) ; A [ R - 1 - r ] [ C - 1 - c ] = target ; } } System . out . println ( answer ) ; } }   static int findTarget ( int a , int b , int c , int d ) { int [ ] array = new int [ ] { a , b , c , d } ; Arrays . sort ( array ) ; return array [ 1 ] ; }   }

p = lambda : list ( map ( int , input ( ) . split ( ) ) )     T = int ( input ( ) ) NEW_LINE for _ in range ( T ) : N , M = p ( ) ; S = 0 NEW_LINE a = [ p ( ) for _ in range ( N ) ] NEW_LINE for i in range ( N // 2 ) : for NEW_LINE j in range ( M // 2 ) : x , y = N - i - 1 , M - j - 1 NEW_LINE l = sorted ( [ a [ i ] [ j ] , a [ i ] [ y ] , a [ x ] [ j ] , a [ x ] [ y ] ] ) NEW_LINE changeTo = round ( ( l [ 2 ] + l [ 1 ] ) / 2 ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE s = [ ] NEW_LINE for x in range ( n ) : k = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE s . append ( k ) NEW_LINE ans = 0 NEW_LINE for i in range ( n ) : for NEW_LINE j in range ( m ) : b = [ ] NEW_LINE b . append ( s [ i ] [ j ] ) NEW_LINE b . append ( s [ n - i - 1 ] [ j ] ) NEW_LINE b . append ( s [ i ] [ m - j - 1 ] ) NEW_LINE b . sort ( ) NEW_LINE s [ i ] [ j ] = s [ n - i - 1 ] [ j ] = s [ i ] [ m - j - 1 ] = b [ 1 ] NEW_LINE ans += int ( b [ 1 ] ) - int ( b [ 0 ] ) NEW_LINE ans += int ( b [ - 1 ] ) - int ( b [ 1 ] ) NEW_LINE print ( ans ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for q in range ( t ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE a = n * [ [ 0 for i in range ( m ) ] ] NEW_LINE for i in range ( n ) : a [ i ] = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE ans = 0 NEW_LINE for i in range ( ( n + 1 ) // 2 ) : for NEW_LINE j in range ( ( m + 1 ) // 2 ) : NEW_LINE if i == n - 1 - i : NEW_LINE INDENT x = [ a [ i ] [ j ] , a [ i ] [ m - 1 - j ] ] elif j == m - 1 - j : NEW_LINE x = [ a [ i ] [ j ] , a [ n - 1 - i ] [ j ] ] else : NEW_LINE x = [ a [ i ] [ j ] , a [ n - 1 - i ] [ j ] , a [ i ] [ m - 1 - j ] , a [ n - 1 - i ] [ m - 1 - j ] ] NEW_LINE DEDENT x = sorted ( x ) NEW_LINE ans += min ( sum ( [ abs ( v - x [ int ( len ( x ) / 2 ) - 1 ] ) for v in x ] ) , sum ( [ abs ( v - x [ int ( len ( x ) / 2 ) ] ) for v in x ] ) ) NEW_LINE print ( ans ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n , m = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE mat = [ ] NEW_LINE value = 0 NEW_LINE for i in range ( n ) : mat . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE for i in range ( n ) : for NEW_LINE j in range ( m ) : a = list ( sorted ( [ mat [ i ] [ j ] , mat [ n - i - 1 ] [ j ] , mat [ i ] [ m - j - 1 ] , mat [ n - i - 1 ] [ m - j - 1 ] ] ) ) NEW_LINE value += ( a [ 1 ] - a [ 0 ] ) + ( a [ 2 ] - a [ 1 ] ) + ( a [ 3 ] - a [ 1 ] )     print ( value // 4 ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ;   public class CF673ABearAndGame {   static BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static PrintWriter out = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) throws IOException { read ( ) ; int [ ] times = readArray ( ) ; int total = 15 ; for ( int time : times ) { if ( time <= total ) { total = time ; } else { break ; } total += 15 ; } out . print ( total > 90 ? 90 : total ) ; out . close ( ) ; }   private static String read ( ) throws IOException { return in . readLine ( ) ; }   private static int [ ] readArray ( ) throws IOException { String [ ] line = in . readLine ( ) . split ( " \\ s " ) ; int [ ] a = Arrays . stream ( line ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; return a ; }   }

import java . util . * ;   public class P3 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } if ( a [ 0 ] > 15 ) { System . out . println ( 15 ) ; return ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( a [ i + 1 ] - a [ i ] <= 15 ) { continue ; } else { System . out . println ( a [ i ] + 15 ) ; return ; } } if ( a [ n - 1 ] <= 75 ) { System . out . println ( a [ n - 1 ] + 15 ) ; } else { System . out . println ( 90 ) ; } } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int arr [ ] = new int [ 91 ] ; for ( int i = sc . nextInt ( ) ; i > 0 ; i -- ) arr [ sc . nextInt ( ) ] ++ ; int timer = 15 ; int i ; for ( i = 1 ; i < arr . length ; i ++ ) { if ( timer == 0 ) break ; if ( arr [ i ] == 1 ) timer = 15 ; else timer -- ; } System . out . println ( i - 1 ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; public class BearAndGame { static BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) throws IOException { read ( ) ; int [ ] times = readArray ( ) ; int total = 15 ; for ( int time : times ) { if ( time <= total ) { total = time ; } else { break ; } total += 15 ; } out . print ( total > 90 ? 90 : total ) ; out . close ( ) ; } private static String read ( ) throws IOException { return in . readLine ( ) ; } private static int [ ] readArray ( ) throws IOException { String [ ] line = in . readLine ( ) . split ( " \\ s " ) ; int [ ] a = Arrays . stream ( line ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; return a ; } }

import java . util . * ; public class f { public static void main ( String [ ] ta ) { Scanner sc = new Scanner ( System . in ) ; if ( sc . hasNext ( ) ) { int t = sc . nextInt ( ) ; int a [ ] = new int [ t ] ; int z = 0 ; int count = 0 ; for ( int i = 0 ; i < t ; i ++ ) { a [ i ] = sc . nextInt ( ) ; }   for ( int i = 0 ; i < t ; i ++ ) { if ( ( a [ i ] - z ) > 15 ) { System . out . println ( z + 15 ) ; break ; } else { z = a [ i ] ; } count ++ ; } if ( count == t ) { if ( a [ t - 1 ] < 75 ) { System . out . println ( a [ t - 1 ] + 15 ) ; } else { System . out . println ( 90 ) ; } } } } }

n = int ( input ( ) ) l = [ ] l . extend ( map ( int , input ( ) . split ( ) ) ) x = 0 for i in l : if x + 15 >= i : x = i else : breakprint ( min ( 90 , x + 15 ) ) NEW_LINE

intersting = int ( input ( ) )   l = list ( map ( int , input ( ) . split ( ) ) )   if l [ 0 ] > 15 : print ( 15 ) else : for i in range ( len ( l ) - 1 ) : if ( l [ i + 1 ] - l [ i ] ) > 15 : print ( l [ i ] + 15 ) break else : if 90 - l [ - 1 ] <= 15 : print ( 90 ) else : print ( l [ - 1 ] + 15 ) NEW_LINE

def solve ( arr ) : if arr [ 0 ] > 15 : return 15 for i in range ( len ( arr ) - 1 ) : if arr [ i + 1 ] - arr [ i ] > 15 : return arr [ i ] + 15 return 90 if arr [ - 1 ] + 15 > 90 else arr [ - 1 ] + 15                     def main ( ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) print ( solve ( arr ) ) main ( ) NEW_LINE

N = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) A . insert ( 0 , 0 ) T = 0 F = Truefor i in range ( N ) : if A [ i + 1 ] - A [ i ] <= 15 : T = A [ i + 1 ] else : T += 15 F = False breakif F : if T >= 75 : print ( 90 ) else : print ( T + 15 ) else : print ( T ) NEW_LINE

n = int ( input ( ) ) k = [ int ( i ) for i in input ( ) . split ( ' ▁ ' ) ]   if k [ 0 ] > 15 : print ( 15 ) else : i = 1 ; c = k [ 0 ] + 15 while i < n : if c >= k [ i ] and c != 90 : c = k [ i ] + 15 i += 1 if c >= 90 : print ( 90 ) else : print ( c ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Codeforces {   private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ;   public static int [ ] LPS ( String p ) { int [ ] lps = new int [ p . length ( ) ] ;   int i = 1 ; int j = 0 ; while ( i < p . length ( ) ) { if ( p . charAt ( i ) == p . charAt ( j ) ) { lps [ i ] = j + 1 ; i ++ ; j ++ ; } else { if ( j == 0 ) { lps [ i ] = 0 ; i ++ ; } else { j = lps [ j - 1 ] ; } } } return lps ; }   public static void KMP ( String text , String pattern ) { int [ ] lps = LPS ( pattern ) ; int i = 0 ; int j = 0 ; ArrayList < Integer > matches = new ArrayList < > ( ) ; while ( i < text . length ( ) ) { if ( text . charAt ( i ) == pattern . charAt ( j ) ) { i ++ ; j ++ ; } else { if ( j != 0 ) { j = lps [ j - 1 ] ; } else { i ++ ; } } if ( j == pattern . length ( ) ) { matches . add ( i - j ) ; j = lps [ j - 1 ] ; } } for ( int x : matches ) { System . out . println ( " Match ▁ at ▁ : ▁ " + x ) ; } }   private static class SegmentTree { private long [ ] st ; private int size ; private int n ; private long [ ] a ; SegmentTree ( long [ ] a , int n ) { this . size = 4 * n ; this . n = n ; this . a = a ; st = new long [ size ] ;

import java . io . * ; import java . util . * ;   public class B_1068 { static PrintWriter pw = new PrintWriter ( System . out ) ;   public static void main ( String arg [ ] ) throws IOException { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; StringTokenizer token = new StringTokenizer ( " ▁ " ) ;   long b = Long . parseLong ( br . readLine ( ) ) ;   pw . println ( getResult ( b ) ) ;   pw . close ( ) ;   }   private static long getResult ( long b ) { long i = 0 ; long count = 0 ; long total = 1 ; long m = b ;   while ( b % 2 == 0 ) { b = b / 2 ; count ++ ; } total = total * ( count + 1 ) ; count = 0 ;   for ( i = 3 ; i * i <= m ; i = i + 2 ) { count = 0 ; while ( b % i == 0 ) { b = b / i ; count ++ ; } total = total * ( count + 1 ) ; } if ( b > 1 ) { count = 1 ; total = total * ( count + 1 ) ; } return total ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ;   public class atcoderbg { static class Node { int key ; Node left ; Node right ; Node ( int k ) { key = k ; } }

import java . util . * ; public class contest14 { static Scanner scn = new Scanner ( System . in ) ; public static void main ( String [ ] args ) {

b = int ( input ( ) ) c = int ( b ** .5 ) print ( 2 * sum ( b % i == 0 for i in range ( 1 , c + 1 ) ) - ( c * c == b ) ) NEW_LINE

b = int ( input ( ) ) def make_divisors ( n ) : divisors = [ ] for i in range ( 1 , int ( n ** 0.5 ) + 1 ) : if n % i == 0 : divisors . append ( i ) if i != n // i : divisors . append ( n // i )   NEW_LINE

import sysdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( int , input ( ) . split ( ) ) ) x = iinput ( ) b = x ** 0.5 a = int ( b ) p = 0 if b == a : p -= 1 for i in range ( 1 , a + 1 ) : if x % i == 0 : p += 2 print ( p ) NEW_LINE

n = int ( input ( ) ) s = set ( ) for i in range ( 1 , int ( n ** .5 ) + 1 ) : if n % i == 0 : s . add ( i ) s . add ( n // i ) print ( len ( s ) ) NEW_LINE


import java . util . * ; public class p69 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; in . nextLine ( ) ; int a [ ] = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { a [ i ] = in . nextInt ( ) ; } int p [ ] = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { p [ i ] = a [ i ] ; } int sum1 = 0 ; int sum2 = 0 ; int maxp = - 1 ; for ( int j = 0 ; j < n ; j ++ ) { int max = Integer . MIN_VALUE ; for ( int i = 0 ; i < m ; i ++ ) { if ( a [ i ] > max ) { max = a [ i ] ; maxp = i ; } } sum1 = sum1 + max ; a [ maxp ] = a [ maxp ] - 1 ; } System . out . print ( sum1 + " ▁ " ) ; int minp = - 1 ; for ( int j = 0 ; j < n ; j ++ ) { int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < m ; i ++ ) { if ( p [ i ] < min && p [ i ] != 0 ) { min = p [ i ] ; minp = i ; } } sum2 = sum2 + min ; p [ minp ] = p [ minp ] - 1 ; } System . out . print ( sum2 ) ; }   }

import java . util . PriorityQueue ; import java . util . Scanner ;   public class Airport {

import java . util . Arrays ; import java . util . Scanner ;   public class Airport {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] min = new int [ m ] ; int [ ] max = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { min [ i ] = sc . nextInt ( ) ; max [ i ] = min [ i ] ; } Arrays . sort ( min ) ; Arrays . sort ( max ) ; int startIdx = 0 ; int minCost = 0 ; int rem = n ; while ( rem > 0 ) { minCost += min [ startIdx ] -- ; if ( min [ startIdx ] == 0 ) startIdx ++ ; rem -- ; } int endIdx = m - 1 ; int maxCost = 0 ; rem = n ; while ( rem > 0 ) { maxCost += max [ endIdx ] -- ; Arrays . sort ( max ) ; rem -- ; } System . out . println ( maxCost + " ▁ " + minCost ) ; sc . close ( ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class experiment { static int M = 1_000_000_007 ; static int INF = Integer . MAX_VALUE ; static final FastScanner fs = new FastScanner ( ) ;

from __future__ import division , print_function   import osimport sysfrom io import BytesIO , IOBase if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip def main ( ) : pass NEW_LINE

n , m = map ( int , input ( ) . split ( ) )   planes = [ int ( bruh ) for bruh in input ( ) . split ( ) ]   planesmax = sorted ( planes , reverse = True ) planesmin = sorted ( planes )   resmax = 0 resmin = 0   for x in range ( n ) : most = max ( planesmax ) resmax += most planesmax [ planesmax . index ( most ) ] -= 1   for y in range ( n ) : planesmin = [ orz for orz in planesmin if orz != 0 ] least = min ( planesmin ) resmin += least planesmin [ planesmin . index ( least ) ] -= 1   print ( resmax , resmin )   NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) arr0 = list ( map ( int , input ( ) . split ( ) ) ) arr = arr0 [ : ] mi_r = 0 ma_r = 0 for i in range ( n ) : mi = 10000000000000 mi_idx = - 10 for j in range ( m ) : if ( arr [ j ] < mi and arr [ j ] > 0 ) : mi_idx = j mi = arr [ j ] arr [ mi_idx ] -= 1 mi_r += mi   arr = arr0 [ : ] for i in range ( n ) : ma = - 1 ma_idx = - 1 for j in range ( m ) : if ( arr [ j ] > ma and arr [ j ] > 0 ) : ma_idx = j ma = arr [ j ] arr [ ma_idx ] -= 1 ma_r += maprint ( ma_r , mi_r ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) temp = p . copy ( ) p . sort ( ) nc = nnr = 0 r = 0 while n > 0 : n -= 1 r += p [ - 1 ] p [ - 1 ] -= 1   p . sort ( ) z = 0 temp . sort ( ) while nc > 0 : nc -= 1 nr += temp [ 0 ] temp [ 0 ] -= 1 if temp [ 0 ] == 0 : temp . remove ( temp [ 0 ] ) temp . sort ( )   print ( r , end = ' ▁ ' ) print ( nr ) NEW_LINE


import java . util . Scanner ;   public class PrisonTransfer {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; int count = 0 , ways = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] <= t ) count ++ ; else { if ( count >= c ) { ways += count - c + 1 ; } count = 0 ; } } if ( count >= c ) { ways += count - c + 1 ; } System . out . println ( ways ) ; sc . close ( ) ; } }

import java . util . Scanner ;   public class PrisonTransfer { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int nums = scanner . nextInt ( ) ; int con = scanner . nextInt ( ) ; int re = scanner . nextInt ( ) ; int counter = 0 ; int res = 0 ; for ( int i = 0 ; i < nums ; i ++ ) { int pr = scanner . nextInt ( ) ; if ( pr <= con ) counter ++ ; else counter = 0 ; if ( counter >= re ) res ++ ; } System . out . println ( res ) ; } }

n , t , c = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) ans = [ ] temp = [ ] for i in arr : if i <= t : temp . append ( i ) else : ans . append ( temp [ : ] ) temp = [ ] if temp : ans . append ( temp )   out = 0 for i in ans : if len ( i ) >= c : out += len ( i ) - c + 1 print ( out ) NEW_LINE

n , t , c = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) summ = 0 count = 0   for i in range ( n ) : if a [ i ] <= t : count += 1   else : if count >= c : summ += ( count - c + 1 ) count = 0   if count >= c : summ += ( count - c + 1 )     print ( summ ) NEW_LINE

s = 0 ans = 0 n , t , c = map ( int , input ( ) . split ( ) ) for i in map ( int , input ( ) . split ( ) ) : if i <= t : s += 1 else : s = 0 if s >= c : ans += 1 print ( ans ) NEW_LINE

n , t , c = map ( int , input ( ) . split ( ) ) k = 0 s = 0 for i in list ( map ( int , input ( ) . split ( ) ) ) : if i <= t : k += 1 if k >= c : s += 1 else : k = 0 print ( s ) NEW_LINE


import javax . swing . plaf . IconUIResource ; import java . awt . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ;

import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class a { static long [ ] count , count1 , count2 ; static int [ ] arr ; static char [ ] ch , ch1 ; static int [ ] darr , farr ; static Character [ ] [ ] mat , mat1 ; static long x , h ; static long maxl ; static double dec ; static String s ; static long minl ; static int mx = ( int ) 1e6 ; static long mod = 998244353l ;

def check ( a , k ) : for i in range ( k , len ( a ) ) : if a [ i ] != a [ i - k ] : return False return True     def solve ( a ) : n = len ( a ) b = [ ] for i in range ( n ) : t = a [ i ] if i : t -= a [ i - 1 ] b += [ t ] res = [ ] for i in range ( 1 , n + 1 ) : if check ( b , i ) : res += [ i ]   return res     NEW_LINE

n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] ans = [ ]   for k in range ( 1 , n + 1 ) : x = [ a [ 0 ] ] flag = True for j in range ( 1 , n ) : if len ( x ) < k : x . append ( a [ j ] - a [ j - 1 ] ) else : if x [ j % k ] != a [ j ] - a [ j - 1 ] : flag = False break if not flag : continue   ans . append ( k )     print ( len ( ans ) ) print ( * ans ) NEW_LINE

import sys , string   n = int ( sys . stdin . readline ( ) ) arr = [ 0 ] + list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) temp = [ ] ans = [ ] for i in range ( 1 , n + 1 ) : temp . append ( arr [ i ] - arr [ i - 1 ] )   for i in range ( 1 , n + 1 ) : p = True for j in range ( len ( temp ) ) : if j + i >= len ( temp ) : continue if temp [ j ] != temp [ j + i ] : p = False break if p : ans . append ( i ) print ( len ( ans ) ) print ( ' ▁ ' . join ( map ( str , ans ) ) ) NEW_LINE

n = int ( input ( ) ) a = [ 0 ] + [ int ( i ) for i in input ( ) . split ( ) ] x = [ ] for ind , a_i in enumerate ( a [ 1 : ] ) : x . append ( a_i - a [ ind ] ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Main { public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int tc = input . nextInt ( ) ; while ( tc -- > 0 ) { int n = input . nextInt ( ) ; long a [ ] = new long [ n ] ; long sum = 0 ; long mx = Long . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextLong ( ) ; sum += a [ i ] ; mx = Math . max ( mx , a [ i ] ) ; } long k = ( long ) Math . max ( mx , Math . ceil ( ( sum * 1.0 ) / ( n - 1 ) ) ) ;

import java . awt . Desktop ;    import java . io . BufferedReader ;    import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . net . URI ; import java . net . URISyntaxException ; import java . sql . Array ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . LinkedHashMap ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . util . StringTokenizer ; import java . util . TreeSet ; import java . util . Vector ;     public class codechef3 { static class comp implements Comparator < Integer > {   @ Override public int compare ( Integer o1 , Integer o2 ) { if ( Math . abs ( o1 ) > Math . abs ( o2 ) ) return - 1 ; else return 1 ; } }

import java . io . * ; import java . util . * ; import java . math . * ;   public class B1452 { public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Zad1452B {   public static void main ( String [ ] args ) {

import math , sys   input = sys . stdin . buffer . readline   NEW_LINE def read ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = read ( ) NEW_LINE suma = sum ( a ) NEW_LINE s = max ( max ( a ) , math . ceil ( suma / ( n - 1 ) ) ) NEW_LINE print ( s * ( n - 1 ) - suma ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE x = max ( l ) * ( n - 1 ) NEW_LINE total = sum ( l ) NEW_LINE val = total // ( n - 1 ) NEW_LINE if ( total <= x ) : NEW_LINE INDENT print ( x - total ) else : NEW_LINE if NEW_LINE ( val * ( n - 1 ) == total ) : print ( 0 ) else : print ( ( val + 1 ) * ( n - 1 ) - total ) NEW_LINE DEDENT

import sys , functools , collections , bisect , math , NEW_LINE INDENT heapqinput = sys . stdin . readline NEW_LINE DEDENT

import math   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE suma = sum ( a ) NEW_LINE s = max ( max ( a ) , math . ceil ( suma / ( n - 1 ) ) ) NEW_LINE print ( s * ( n - 1 ) - suma ) NEW_LINE


import java . util . Scanner ; public class Div2B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int sx = scanner . nextInt ( ) ; int sy = scanner . nextInt ( ) ; System . out . printf ( " % d ▁ % d \n " , sx , sy ) ; for ( int y = 1 ; y <= m ; y ++ ) { if ( y != sy ) { System . out . printf ( " % d ▁ % d \n " , sx , y ) ; } } int parity = 0 ; for ( int x = sx - 1 ; x >= 1 ; x -- ) { if ( parity % 2 == 0 ) { for ( int y = m ; y >= 1 ; y -- ) { System . out . printf ( " % d ▁ % d \n " , x , y ) ; } } else { for ( int y = 1 ; y <= m ; y ++ ) { System . out . printf ( " % d ▁ % d \n " , x , y ) ; } } parity ++ ; } parity = ( ( sx - 1 ) % 2 == 0 ) ? 1 : 0 ; for ( int x = sx + 1 ; x <= n ; x ++ ) { if ( parity % 2 == 0 ) { for ( int y = 1 ; y <= m ; y ++ ) { System . out . printf ( " % d ▁ % d \n " , x , y ) ; } } else { for ( int y = m ; y >= 1 ; y -- ) { System . out . printf ( " % d ▁ % d \n " , x , y ) ; } } parity ++ ; } scanner . close ( ) ; } }

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] tmp = reader . readLine ( ) . split ( " ▁ " ) ; int n = Integer . valueOf ( tmp [ 0 ] ) ; int m = Integer . valueOf ( tmp [ 1 ] ) ; int x = Integer . valueOf ( tmp [ 2 ] ) ; int y = Integer . valueOf ( tmp [ 3 ] ) ; int [ ] [ ] info = new int [ n + 1 ] [ m + 1 ] ; int prey = y ; for ( int i = x ; i >= 1 ; i -- ) { info [ i ] [ prey ] = 1 ; System . out . println ( i + " ▁ " + prey ) ; for ( int j = 1 ; j <= m ; j ++ ) { if ( info [ i ] [ j ] != 1 ) { prey = j ; System . out . println ( i + " ▁ " + j ) ; } } } for ( int i = x + 1 ; i <= n ; i ++ ) { info [ i ] [ prey ] = 1 ; System . out . println ( i + " ▁ " + prey ) ; for ( int j = 1 ; j <= m ; j ++ ) { if ( info [ i ] [ j ] != 1 ) { prey = j ; System . out . println ( i + " ▁ " + j ) ; } } } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . StringTokenizer ; public class BoboniuPlaysChess { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int sx = sc . nextInt ( ) ; int sy = sc . nextInt ( ) ; for ( int j = sy ; j <= m ; j ++ ) { System . out . println ( sx + " ▁ " + j ) ; } for ( int j = sy - 1 ; j >= 1 ; j -- ) { System . out . println ( sx + " ▁ " + j ) ; } boolean start = false ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i == sx ) { continue ; } if ( ! start ) { for ( int j = 1 ; j <= m ; j ++ ) { System . out . println ( i + " ▁ " + j ) ; } } else { for ( int j = m ; j >= 1 ; j -- ) { System . out . println ( i + " ▁ " + j ) ; } } start = ! start ; } } public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

import java . util . Scanner ; public class B1395 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int R = in . nextInt ( ) ; int C = in . nextInt ( ) ; int SR = in . nextInt ( ) ; int SC = in . nextInt ( ) ; StringBuilder output = new StringBuilder ( ) ; output . append ( SR ) . append ( ' ▁ ' ) . append ( SC ) . append ( ' \n ' ) ; for ( int c = 1 ; c <= C ; c ++ ) { if ( c != SC ) { output . append ( SR ) . append ( ' ▁ ' ) . append ( c ) . append ( ' \n ' ) ; } } int lastC = C ; for ( int r = 1 ; r <= R ; r ++ ) { if ( r != SR ) { if ( lastC == 1 ) { for ( int c = 1 ; c <= C ; c ++ ) { output . append ( r ) . append ( ' ▁ ' ) . append ( c ) . append ( ' \n ' ) ; } lastC = C ; } else { for ( int c = C ; c >= 1 ; c -- ) { output . append ( r ) . append ( ' ▁ ' ) . append ( c ) . append ( ' \n ' ) ; } lastC = 1 ; } } } System . out . print ( output ) ; } }

import sys NEW_LINE def answer ( n , m , Sx , Sy ) : NEW_LINE INDENT print ( Sx , Sy ) NEW_LINE rptr = 0 NEW_LINE cols = [ int ( i ) for i in range ( 1 , m + 1 , 1 ) ] NEW_LINE rows = [ int ( i ) for i in range ( Sx , 0 , - 1 ) ] NEW_LINE rows . extend ( [ int ( i ) for i in range ( Sx + 1 , n + 1 , 1 ) ] ) NEW_LINE for r in rows : NEW_LINE INDENT for c in cols : NEW_LINE INDENT if r == Sx and c == Sy : NEW_LINE INDENT pass NEW_LINE DEDENT else : NEW_LINE INDENT print ( r , c ) NEW_LINE DEDENT DEDENT cols . reverse ( ) NEW_LINE DEDENT return NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT n , m , Sx , Sy = [ int ( i ) for i in sys . stdin . readline ( ) . split ( ) ] NEW_LINE answer ( n , m , Sx , Sy ) NEW_LINE return NEW_LINE DEDENT main ( ) NEW_LINE

n , m , s1 , s2 = map ( int , input ( ) . split ( ) ) NEW_LINE g = - 1 NEW_LINE for i in range ( s2 , 0 , - 1 ) : NEW_LINE INDENT print ( s1 , i ) NEW_LINE k = 1 NEW_LINE DEDENT for i in range ( s2 + 1 , m + 1 ) : NEW_LINE INDENT print ( s1 , i ) NEW_LINE k = 0 NEW_LINE DEDENT h1 = s1 + 1 NEW_LINE while ( h1 <= n ) : NEW_LINE INDENT if k == 0 : NEW_LINE INDENT for i in range ( m , 0 , - 1 ) : NEW_LINE INDENT print ( h1 , i ) NEW_LINE g = i NEW_LINE DEDENT k = 1 NEW_LINE h1 += 1 NEW_LINE DEDENT elif k == 1 : NEW_LINE INDENT for i in range ( 1 , m + 1 ) : NEW_LINE INDENT print ( h1 , i ) NEW_LINE g = i NEW_LINE DEDENT k = 0 NEW_LINE h1 += 1 NEW_LINE DEDENT DEDENT h2 = s1 - 1 NEW_LINE if g == m : NEW_LINE INDENT k = 0 NEW_LINE DEDENT else : NEW_LINE INDENT k = 1 NEW_LINE DEDENT while ( h2 > 0 ) : NEW_LINE INDENT if k == 0 : NEW_LINE INDENT for i in range ( m , 0 , - 1 ) : NEW_LINE INDENT print ( h2 , i ) NEW_LINE DEDENT k = 1 NEW_LINE h2 -= 1 NEW_LINE DEDENT elif k == 1 : NEW_LINE INDENT for i in range ( 1 , m + 1 ) : NEW_LINE INDENT print ( h2 , i ) NEW_LINE DEDENT k = 0 NEW_LINE h2 -= 1 NEW_LINE DEDENT DEDENT

def canVisitCol ( visitY , x , y ) : NEW_LINE INDENT visitY -= 1 NEW_LINE visitY %= ( m ) NEW_LINE if board [ x - 1 ] [ visitY ] == 0 : NEW_LINE INDENT board [ x - 1 ] [ visitY ] = 1 NEW_LINE return visitY + 1 NEW_LINE DEDENT return 0 NEW_LINE DEDENT def canVisitRow ( visitX , x , y ) : NEW_LINE INDENT visitX -= 1 NEW_LINE visitX %= ( n ) NEW_LINE if board [ visitX ] [ y - 1 ] == 0 : NEW_LINE INDENT board [ visitX ] [ y - 1 ] = 1 NEW_LINE return visitX + 1 NEW_LINE DEDENT return 0 NEW_LINE DEDENT n , m , iniX , iniY = map ( int , input ( ) . split ( ) ) NEW_LINE board = [ ] NEW_LINE for _ in range ( n ) : NEW_LINE INDENT board . append ( [ 0 ] * m ) NEW_LINE DEDENT currX = iniX ; NEW_LINE currY = iniY NEW_LINE board [ currX - 1 ] [ currY - 1 ] = 1 NEW_LINE print ( currX , currY ) NEW_LINE while True : NEW_LINE INDENT tmp = canVisitCol ( currY + 1 , currX , currY ) NEW_LINE if tmp : NEW_LINE INDENT currY = tmp NEW_LINE print ( currX , currY ) NEW_LINE continue NEW_LINE DEDENT tmp = canVisitCol ( currY - 1 , currX , currY ) NEW_LINE if tmp : NEW_LINE INDENT currY = tmp NEW_LINE print ( currX , currY ) NEW_LINE continue NEW_LINE DEDENT tmp = canVisitRow ( currX + 1 , currX , currY ) NEW_LINE if tmp : NEW_LINE INDENT currX = tmp NEW_LINE print ( currX , currY ) NEW_LINE continue NEW_LINE DEDENT tmp = canVisitRow ( currX - 1 , currX , currY ) NEW_LINE if tmp : NEW_LINE INDENT currX = tmp NEW_LINE print ( currX , currY ) NEW_LINE continue NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT

n , m , x , y = map ( int , input ( ) . split ( ) ) NEW_LINE print ( x , y ) NEW_LINE print ( 1 , y ) NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT if ( i % 2 == 1 ) : NEW_LINE INDENT for j in range ( 1 , m + 1 ) : NEW_LINE INDENT if ( [ i , j ] != [ x , y ] and [ i , j ] != [ 1 , y ] ) : NEW_LINE INDENT print ( i , j ) NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT for j in range ( m , 0 , - 1 ) : NEW_LINE INDENT if ( [ i , j ] != [ x , y ] and [ i , j ] != [ 1 , y ] ) : NEW_LINE INDENT print ( i , j ) NEW_LINE DEDENT DEDENT DEDENT DEDENT

n , m , x , y = map ( int , input ( ) . split ( ) ) NEW_LINE inix = x NEW_LINE iniy = y NEW_LINE while x < n + 1 : NEW_LINE INDENT print ( x , y ) NEW_LINE x += 1 NEW_LINE DEDENT x = inix - 1 NEW_LINE while x > 0 : NEW_LINE INDENT print ( x , y ) NEW_LINE x -= 1 NEW_LINE DEDENT x = 1 NEW_LINE y = 1 NEW_LINE while y < iniy : NEW_LINE INDENT if y % 2 == 1 : NEW_LINE INDENT while x < n + 1 : NEW_LINE INDENT print ( x , y ) NEW_LINE x += 1 NEW_LINE DEDENT y += 1 NEW_LINE x -= 1 NEW_LINE DEDENT else : NEW_LINE INDENT while x > 0 : NEW_LINE INDENT print ( x , y ) NEW_LINE x -= 1 NEW_LINE DEDENT y += 1 NEW_LINE x += 1 NEW_LINE DEDENT DEDENT y += 1 NEW_LINE while y < m + 1 : NEW_LINE INDENT if y % 2 == 0 : NEW_LINE INDENT while x < n + 1 : NEW_LINE INDENT print ( x , y ) NEW_LINE x += 1 NEW_LINE DEDENT y += 1 NEW_LINE x -= 1 NEW_LINE DEDENT else : NEW_LINE INDENT while x > 0 : NEW_LINE INDENT print ( x , y ) NEW_LINE x -= 1 NEW_LINE DEDENT y += 1 NEW_LINE x += 1 NEW_LINE DEDENT DEDENT


import java . util . * ;   import javafx . util . Pair ; public class PFAST {

import java . util . * ;   public class B_PFAST114 { static ArrayList < String > names = new ArrayList < > ( ) ; static HashMap < String , Integer > nameToBitMask = new HashMap < > ( ) ; static ArrayList < Integer > refusedBitMasks = new ArrayList < > ( ) ;   static int countSetBits ( int n ) {

def check ( b ) : for i in b : for j in b : if ( a [ i ] , a [ j ] ) in pair or ( a [ j ] , a [ i ] ) in pair : return False return True   n , m = map ( int , input ( ) . split ( ) ) a = [ ] ind = { } for i in range ( n ) : a . append ( input ( ) ) ind [ a [ - 1 ] ] = igraph = [ [ ] for i in range ( n ) ] pair = { } for i in range ( m ) : x , y = input ( ) . split ( ) pair [ ( x , y ) ] = 1 graph [ ind [ x ] ] . append ( ind [ y ] ) graph [ ind [ y ] ] . append ( ind [ x ] ) if m == 0 : print ( n ) a . sort ( ) for i in a : print ( i ) exit ( )   ans = 0 string = " " for i in range ( 1 , 2 ** n ) : b = bin ( i ) [ 2 : ] b = "0" * ( n - len ( b ) ) + b temp = [ ] for j in range ( n ) : if b [ j ] == "1" : temp . append ( ind [ a [ j ] ] ) NEW_LINE

import sys , mathdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def tinput ( ) : return input ( ) . split ( ) def rinput ( ) : return map ( int , tinput ( ) ) def rlinput ( ) : return list ( rinput ( ) )   n , m = rinput ( ) names = [ ] for _ in range ( n ) : names . append ( input ( ) ) pairs = [ ] for _ in range ( m ) : pairs . append ( list ( input ( ) . split ( ) ) )   total_sets = int ( math . pow ( 2 , n ) ) max_set = [ ] for i in range ( 1 , total_sets ) : cur_set = [ ] for j in range ( n ) : if i & 1 << j : cur_set . append ( names [ j ] ) for p in pairs : if p [ 0 ] in cur_set and p [ 1 ] in cur_set : break else : if len ( cur_set ) > len ( max_set ) : max_set = cur_setmax_set . sort ( ) print ( len ( max_set ) ) print ( * max_set , sep = " \n " )     NEW_LINE

def GSB ( x ) : counter = 0 while x != 0 : counter += 1 x = x >> 1 return counter   def friends ( checker , enemy ) : for i in range ( len ( enemy ) ) : if enemy [ i ] [ 0 ] in checker and enemy [ i ] [ 1 ] in checker : return 0 return 1   people , conflict = [ int ( x ) for x in input ( ) . split ( ) ] person = [ ] enemy = [ ] highest = - 1 highestarray = [ ] for i in range ( people ) : person . append ( input ( ) ) for j in range ( conflict ) : enemy . append ( input ( ) . split ( ) ) combinations = [ int ( x ) for x in range ( ( 2 ** people ) ) ] for i in combinations : checker = [ ] j = 0 z = GSB ( i ) while j != z and i != 0 : if i & 1 == 1 : checker . append ( person [ j ] ) i = i >> 1 j += 1 if friends ( checker , enemy ) : if len ( checker ) > highest : highest = len ( checker ) highestarray = checkerprint ( highest ) highestarray . sort ( ) for i in range ( highest ) : print ( highestarray [ i ] ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) ID = { } name_from_ID = { } for i in range ( n ) : name = input ( ) ID [ name ] = i name_from_ID [ i ] = name   people_I_hate = [ set ( ) for i in range ( n ) ] for j in range ( m ) : name1 , name2 = input ( ) . split ( ) people_I_hate [ ID [ name1 ] ] . add ( ID [ name2 ] ) people_I_hate [ ID [ name2 ] ] . add ( ID [ name1 ] )   def conflict ( team , people_I_hate ) : for guy1 in team : for guy2 in team : if guy1 in people_I_hate [ guy2 ] or guy2 in people_I_hate : return True return False   ans = [ ] for mask in range ( 1 << n ) : team = [ ] for i in range ( n ) : if mask & ( 1 << i ) : team . append ( i )   if not conflict ( team , people_I_hate ) and len ( team ) > len ( ans ) : ans = [ name_from_ID [ x ] for x in team ]   print ( len ( ans ) ) for name in sorted ( ans ) : print ( name ) NEW_LINE


import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = 0 ; for ( int i = 0 ; i < a ; i ++ ) { b += Math . abs ( in . nextInt ( ) ) ; } System . out . println ( b ) ; } }

import java . io . * ; import java . util . * ; public class A implements Runnable { void solve ( ) throws Exception { int n = in . iInt ( ) ;   int [ ] arr = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = in . iInt ( ) ; } out . println ( sum ( arr ) ) ; } int sum ( int [ ] arr ) { int sum = 0 ; for ( int i = 0 ; i < arr . length ; i ++ ) { sum += Math . abs ( arr [ i ] ) ; } return sum ; } void show ( Comparable [ ] array ) { for ( Comparable x : array ) out . print ( x + " ▁ " ) ;   out . println ( ) ; } int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } int lcm ( int a , int b ) { return ( a * b ) / gcd ( a , b ) ; } String fileInName = " " ; FastReader in ; PrintWriter out ; public void run ( ) { try { if ( ! fileInName . isEmpty ( ) ) { in = new FastReader ( new BufferedReader ( new FileReader ( fileInName + " . in " ) ) ) ; out = new PrintWriter ( new BufferedWriter ( new FileWriter ( fileInName + " . out " ) ) ) ; } else { in = new FastReader ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; out = new PrintWriter ( System . out ) ; } int t = 1 ;

import java . util . * ; import java . io . * ;   public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; Scanner sc = new Scanner ( System . in ) ; int n = fr . nextInt ( ) ; ArrayList < Integer > a = new ArrayList < > ( ) , b = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = fr . nextInt ( ) ; if ( x >= 0 ) a . add ( x ) ; else b . add ( x ) ; } int A = 0 , B = 0 ; for ( Integer i : a ) A += i ; for ( Integer i : b ) B += i ; System . out . println ( A - B ) ; } }

def main_function ( ) : n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] sum_positive = 0 sum_negative = 0 for i in a : if i > 0 : sum_positive += i else : sum_negative += i return sum_positive - sum_negative                 print ( main_function ( ) ) NEW_LINE

n = int ( input ( ) ) d = list ( map ( int , input ( ) . split ( ) ) ) s1 = 0 s2 = 0 for i in d : if i > 0 : s1 += i else : s2 += iprint ( s1 - s2 ) NEW_LINE

import sys   def main ( ) : return sum ( abs ( int ( i ) ) for i in sys . stdin . read ( ) . strip ( ) . split ( ) [ 1 : ] )   print ( main ( ) ) NEW_LINE

n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ' ▁ ' ) ] output = 0 for i in range ( n ) : if ( a [ i ] >= 0 ) : output += a [ i ] else : output -= a [ i ] print ( output ) NEW_LINE


import java . util . * ;   public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int number = sc . nextInt ( ) ; int [ ] array = new int [ number + 1 ] ; for ( int i = 1 ; i <= number ; i ++ ) { int x = SinglePush ( ) ; if ( x == 1 ) array [ i ] = 1 ; } for ( int i = 1 ; i <= number ; i ++ ) { if ( array [ i ] == 0 ) { System . out . println ( " NO " ) ; } else if ( array [ i ] == 1 ) { System . out . println ( " YES " ) ; } } }   public static int SinglePush ( ) { int first = - 1 , end = - 1 ;   int s = sc . nextInt ( ) ; int s1 = 1 , s2 = s ; int [ ] a1 = new int [ s + 1 ] ; int [ ] a2 = new int [ s + 1 ] ; for ( int i = 1 ; i <= s ; i ++ ) { a1 [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i <= s ; i ++ ) { a2 [ i ] = sc . nextInt ( ) ; } if ( s == 1 ) { if ( a1 [ 1 ] <= a2 [ 1 ] ) return 1 ; else return 0 ; } else { while ( s1 <= s && first == - 1 ) { if ( a1 [ s1 ] != a2 [ s1 ] ) { first = s1 ; s1 = s + 1 ; } if ( s1 == s ) first ++ ; s1 ++ ; } while ( s2 > 0 && end == - 1 ) { if ( a1 [ s2 ] != a2 [ s2 ] ) { end = s2 ; s2 = 0 ; } if ( s2 == 1 ) end ++ ; s2 -- ; } int A , B = 0 , F = first ; if ( first == 0 )

import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Case = sc . nextInt ( ) ; while ( Case -- > 0 ) { int n = sc . nextInt ( ) ; int [ ] x = new int [ n ] ; int [ ] y = new int [ n ] ; int l = - 1 , r = 10000 ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { y [ i ] = sc . nextInt ( ) ; if ( l == - 1 && x [ i ] != y [ i ] ) l = i ; if ( x [ i ] != y [ i ] ) r = i ; } boolean can = false ; if ( l != - 1 && r != 10000 ) { int t = y [ l ] - x [ l ] ; for ( int i = l ; i <= r ; i ++ ) { int ch = y [ i ] - x [ i ] ; if ( ch <= 0 || ch != t ) { can = ! can ; break ; } } } System . out . println ( can ? " NO " : " YES " ) ; } } }

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] b = [ int ( x ) for x in input ( ) . split ( ) ] t = - 100 k = 0 cnt = 0 for i in range ( n ) : ss = b [ i ] - a [ i ] if ss < 0 : cnt = 3 break elif ss != k : k = ss if ss != 0 : cnt += 1 if cnt <= 1 : print ( " YES " ) else : print ( " NO " ) NEW_LINE

t = int ( input ( ) ) res = [ ] for i in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) d = [ ] for j in range ( n ) : d . append ( b [ j ] - a [ j ] ) d . insert ( 0 , 0 ) d . insert ( n + 1 , 0 ) c = 0 flag = 1 for j in range ( n + 1 ) : if ( d [ j ] < 0 ) : res . append ( " NO " ) flag = 0 break else : if ( d [ j ] != d [ j + 1 ] ) : c += 1 if ( flag == 1 ) : if ( c <= 2 ) : res . append ( " YES " ) else : res . append ( " NO " ) for i in res : print ( i ) NEW_LINE

ll = lambda : map ( int , input ( ) . split ( ) ) t = lambda : int ( input ( ) ) ss = lambda : input ( ) lx = lambda x : map ( int , input ( ) . split ( x ) ) NEW_LINE


import java . util . * ; public class Practice { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; long n = sc . nextLong ( ) ; long v [ ] = { x , y , y - x , - 1 * x , - 1 * y , x - y } ; n -- ; long M = 1000000007 ; System . out . print ( ( ( v [ ( int ) n % 6 ] % M ) + M ) % M ) ;   } }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class JzzhuAndSequences {   public static void main ( String [ ] args ) { FastReader ( ) ; int t = 1 ; while ( t > 0 ) { solve ( ) ; -- t ; } write . flush ( ) ; write . close ( ) ; } static void solve ( ) { int x = ni ( ) , y = ni ( ) ; int n = ni ( ) ; int k = 0 ; if ( ( n ) % 3 == 0 ) { k = y - x ; if ( n % 2 == 0 ) { k = - k ; } } else if ( ( n + 1 ) % 3 == 0 ) { k = y ; if ( ( n + 1 ) % 2 == 0 ) { k = - k ; } } else if ( ( n + 2 ) % 3 == 0 ) { k = x ; if ( ( n + 2 ) % 2 == 0 ) { k = - k ; } } if ( k >= 0 ) { out ( k % MOD ) ; } else { if ( k == - MOD ) { out ( "0" ) ; } else { k = k % MOD ; out ( k + MOD ) ; } } }

x , y = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) l = [ x , y ] for i in range ( 4 ) : a = y - x x = y y = a l . append ( y ) NEW_LINE

x , y = map ( int , input ( ) . split ( ) ) m = int ( input ( ) )   MOD = int ( 1e9 + 7 )   def matrix_multi ( a , b ) : n = len ( a ) c = [ [ 0 ] * n for _ in range ( n ) ] for i in range ( n ) : for j in range ( n ) : for k in range ( n ) : c [ i ] [ j ] = ( c [ i ] [ j ] + a [ i ] [ k ] * b [ k ] [ j ] ) % MOD return c   def fast_power ( a , k ) : if k == 1 : return a tmp = fast_power ( a , k // 2 ) if k % 2 : return matrix_multi ( matrix_multi ( tmp , tmp ) , a ) else : return matrix_multi ( tmp , tmp )   base_matrix = [ [ 1 , - 1 ] , [ 1 , 0 ] ]   if m == 1 : print ( ( x + MOD ) % MOD ) elif m == 2 : print ( ( y + MOD ) % MOD ) else : ans_matrix = fast_power ( base_matrix , m - 2 ) print ( ( y * ans_matrix [ 0 ] [ 0 ] + x * ans_matrix [ 0 ] [ 1 ] + MOD ) % MOD ) NEW_LINE

x , y = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) temp = n % 6 if temp == 0 : a = x - yelif temp == 1 : a = xelif temp == 2 : a = yelif temp == 3 : a = y - xelif temp == 4 : a = - xelif temp == 5 : a = - yprint ( a % 1000000007 ) NEW_LINE

def rec ( x , y , n ) : if n == 1 : return x if n == 2 : return y NEW_LINE

x , y = map ( int , input ( ) . split ( ) ) num = int ( input ( ) ) num %= 6 num = num if num != 0 else num + 6 t , l = x , yfor _ in range ( num - 2 ) : x , y = y , y - x x %= 10 ** 9 + 7 y %= 10 ** 9 + 7 if num == 1 : print ( t % ( 10 ** 9 + 7 ) ) elif num == 2 : print ( l % ( 10 ** 9 + 7 ) ) else :     print ( y ) NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;   public class First {   public static void process ( ) throws IOException { int n = ni ( ) ; int p [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = ni ( ) ; } int a = 0 , b = 0 , c = 0 ; boolean f = true ; for ( int i = 0 ; i < n ; i ++ ) { if ( p [ i ] == 25 ) { a ++ ; continue ; } else { if ( p [ i ] == 50 ) { if ( a > 0 ) { a -- ; b ++ ; continue ; } else { f = false ; break ; } } else { if ( b >= 1 && a >= 1 ) { b -- ; a -- ; c ++ ; continue ; } else if ( a >= 3 ) { a -= 3 ; c ++ ; continue ; } else { f = false ; break ; } } } }   if ( f ) { pn ( " YES " ) ; } else { pn ( " NO " ) ; }   }   static AnotherReader sc ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( System . out ) ; sc = new AnotherReader ( ) ; boolean oj = true ;

import java . util . Scanner ;   public class _0851CinemaLine {   public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count25 = 0 ; int count50 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int temp = sc . nextInt ( ) ; if ( temp == 25 ) { count25 ++ ; } else if ( temp == 50 ) { if ( count25 >= 1 ) { count25 -- ; count50 ++ ; } else { System . out . println ( " NO " ) ; return ; } } else { if ( count25 >= 1 && count50 >= 1 ) { count25 -- ; count50 -- ; } else if ( count25 >= 3 ) { count25 -= 3 ; } else { System . out . println ( " NO " ) ; return ; } } } System . out . println ( " YES " ) ; }   }

import java . util . * ; public class CinemaLine {   public static void main ( String [ ] args ) {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class codeforces { static int M = 1_000_000_007 ; static int INF = Integer . MAX_VALUE ; static final FastScanner fs = new FastScanner ( ) ;

a = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) l = [ 0 , 0 , 0 ] flag = Truefor i in b : if i == 25 : l [ 0 ] += 1 elif i == 50 : if l [ 0 ] > 0 : l [ 0 ] -= 1 l [ 1 ] += 1 else : print ( " NO " ) flag = False break elif i == 100 : if l [ 0 ] > 0 and l [ 1 ] > 0 : l [ 0 ] -= 1 l [ 1 ] -= 1 l [ 2 ] += 1 elif l [ 0 ] > 2 : l [ 0 ] -= 3 l [ 2 ] += 1 else : print ( " NO " ) flag = False breakif flag : print ( " YES " ) NEW_LINE

n = int ( input ( ) ) L = [ int ( X ) for X in input ( ) . split ( ) ] fifty , tfive = ( 0 , 0 ) flag = 0 for X in L : if X == 25 : tfive += 1 elif X == 50 : fifty += 1 if tfive == 0 : flag = 1 break else : tfive -= 1   else : if ( fifty == 0 and tfive < 3 ) or tfive == 0 : flag = 1 break elif tfive > 0 and fifty > 0 : tfive -= 1 fifty -= 1 elif fifty == 0 and tfive > 2 : tfive -= 3   if flag == 0 : print ( " YES " ) else : print ( " NO " ) NEW_LINE

import sysinput = sys . stdin . readline   '''   '''   n = int ( input ( ) )   def cashier ( money , payment ) : if payment == 25 : money [ 0 ] += 1 elif payment == 50 : if money [ 0 ] : money [ 0 ] -= 1 money [ 1 ] += 1 else : return False else : if money [ 0 ] and money [ 1 ] : money [ 0 ] -= 1 money [ 1 ] -= 1 money [ 2 ] += 1 elif money [ 0 ] > 2 : money [ 0 ] -= 3 money [ 2 ] += 1 else : return False return True   money = [ 0 ] * 3 for payment in map ( int , input ( ) . split ( ) ) : if cashier ( money , payment ) : continue else : print ( " NO " ) sys . exit ( ) print ( " YES " ) NEW_LINE

n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE


import java . util . Scanner ;   public class Task622A { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; System . out . println ( solve ( scanner . nextLong ( ) ) ) ; }   public static long solve ( long num ) { if ( num == 1 ) return 1 ; long i = ( long ) Math . sqrt ( 2 * num ) - 1 ; long n = 1 ; while ( n < num ) { i ++ ; n = i * ( i + 1 ) / 2 ; } return num - n + i ; } }

import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = true ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static long oo = ( long ) 1e18 ;   public static void solve ( ) throws Exception { long n = f . nl ( ) ; long k = 1 ; while ( true ) { if ( ( k * ( k + 1 ) ) / 2 >= n ) break ; ++ k ; } long ans = n - ( k * ( k - 1 ) / 2 ) ; pn ( ans ) ; } public static void main ( String [ ] args ) throws Exception { if ( memory ) new Thread ( null , new Runnable ( ) { public void run ( ) { try { new Main ( ) . run ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } } } , " " , 1 << 28 ) . start ( ) ; else new Main ( ) . run ( ) ; } void run ( ) throws Exception { if ( System . getProperty ( " ONLINE _ JUDGE " ) == null ) { f = new FastScanner ( " " ) ; pw = new PrintWriter ( System . out ) ; } else { f = new FastScanner ( ) ; pw = new PrintWriter ( System . out ) ;

import com . sun . org . apache . bcel . internal . generic . AALOAD ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ;   public class Main {   static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; } static int a [ ] ;   public static class Check { int a ; int b ;   public Check ( int a , int b ) { this . a = a ; this . b = b ; } }   public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ; long n = input . nextLong ( ) - 1 ; long i = 1 ; while ( n - i >= 0 ) { n -= i ; i ++ ; } System . out . println ( n + 1 ) ; }   }

import java . util . * ;   public class Solve {   static Scanner scan = new Scanner ( System . in ) ;   public static void solve ( long n ) { long i = 1 ; n -- ; long pos = 0 ; while ( n >= 0 ) { pos = n ; n -= i ; i ++ ; } System . out . println ( pos + 1 ) ; }   public static void main ( String [ ] args ) {   long n = scan . nextLong ( ) ; solve ( n ) ; } }

import mathn = int ( input ( ) ) NEW_LINE

n = int ( input ( ) )   n -= 1 count = 0 ans_pos = 0 i = 1 while n >= 0 : ans_pos = n n -= i NEW_LINE

n = int ( input ( ) ) k = 1 while n > k : n -= k k += 1 print ( n ) NEW_LINE


# include < bits / stdc ++ . h >   using namespace std ;   int main ( ) { ios_base :: sync_with_stdio ( 0 ) ; cin . tie ( ) ; cout . tie ( ) ;   long long n , m ; cin >> n >> m ; vector < long long > v ( n ) ; for ( long long i = 0 ; i < n ; i ++ ) cin >> v [ i ] ; vector < pair < pair < long long , long long > , long long > > e ( m ) ; for ( long long i = 0 ; i < m ; i ++ ) { long long a , b , c ; cin >> a >> b >> c ; a -- , b -- ; e [ i ] = { { a , b } , c } ; } long long resn = 0 , resd = 1 ; for ( long long i = 0 ; i < m ; i ++ ) { long long n = v [ e [ i ] . first . first ] + v [ e [ i ] . first . second ] , d = e [ i ] . second ; if ( resn * d < n * resd ) { resn = n ; resd = d ; } } cout . precision ( 12 ) ; cout << fixed << 1.0 * resn / resd << ' \n ' ;   return 0 ; }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int [ ] x = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { x [ i ] = in . nextInt ( ) ; } double ans = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; double cur = ( x [ a ] + x [ b ] ) ; cur /= c ; ans = Math . max ( ans , cur ) ; } out . println ( ans ) ; }   }   static class InputReader { private StringTokenizer tokenizer ; private BufferedReader reader ;   public InputReader ( InputStream inputStream ) { reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; }   private void fillTokenizer ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } }   public String next ( ) { fillTokenizer ( ) ; return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }

n , m = map ( int , raw_input ( ) . split ( ) ) a = map ( int , raw_input ( ) . split ( ) ) ans = 0.0f or i in range ( m ) : x , y , z = map ( int , raw_input ( ) . split ( ) ) ans = max ( ans , 1.0 * ( a [ x - 1 ] + a [ y - 1 ] ) / ( 1.0 * z ) ) print ( ' % .15f ' % ans )

n , m = map ( int , input ( ) . split ( ) )   nodes = list ( map ( int , input ( ) . split ( ) ) )   highest = 0   for i in range ( m ) : a , b , e = map ( int , input ( ) . split ( ) ) val = ( nodes [ a - 1 ] + nodes [ b - 1 ] ) / e if highest < val : highest = val   print ( " { 0 : . 9f } " . format ( highest ) ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) ; a = list ( map ( int , input ( ) . split ( ) ) ) ; o = 0.0   for i in range ( m ) :   x , y , c = map ( int , input ( ) . split ( ) ) ; o = max ( o , ( a [ x - 1 ] + a [ y - 1 ] ) / c )   print ( o )           NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) nodes = list ( map ( int , input ( ) . split ( ) ) )   max_density = 0 for i in range ( m ) : n1 , n2 , e = map ( int , input ( ) . split ( ) ) val = ( nodes [ n1 - 1 ] + nodes [ n2 - 1 ] ) / e if ( val > max_density ) : max_density = val   max_density = " { : . 16f } " . format ( max_density ) if ( max_density [ - 1 ] >= '5' ) : print ( max_density [ : - 2 ] , int ( max_density [ - 2 ] ) + 1 , sep = " " ) else : print ( max_density [ : - 1 ] ) NEW_LINE


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = input . nextInt ( ) ; } List < Integer > ListMin = new ArrayList < > ( ) ; List < Integer > ListMax = new ArrayList < > ( ) ; int min = arr [ 0 ] ; int max = arr [ n - 1 ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { ListMax . add ( Math . max ( Math . abs ( arr [ i ] - min ) , Math . abs ( arr [ i ] - max ) ) ) ; if ( i == 0 ) { ListMin . add ( Math . abs ( arr [ i ] - arr [ i + 1 ] ) ) ; } else if ( i == arr . length - 1 ) ListMin . add ( Math . abs ( arr [ i ] - arr [ i - 1 ] ) ) ; else ListMin . add ( Math . min ( Math . abs ( arr [ i ] - arr [ i + 1 ] ) , Math . abs ( arr [ i ] - arr [ i - 1 ] ) ) ) ;      } for ( int i = 0 ; i < ListMax . size ( ) ; i ++ ) { System . out . print ( ListMin . get ( i ) + " ▁ " + ListMax . get ( i ) ) ; System . out . println ( ) ;   }      } }

import java . util . * ; import java . lang . Math ;   public class NewClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , num [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) num [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int dmin , dmax ; if ( i == n - 1 ) { dmin = Math . abs ( num [ i ] - num [ i - 1 ] ) ; } else { dmin = Math . min ( Math . abs ( num [ i ] - num [ i + 1 ] ) , Math . abs ( num [ i ] - num [ Math . abs ( i - 1 ) ] ) ) ; } dmax = Math . max ( Math . abs ( num [ i ] - num [ n - 1 ] ) , Math . abs ( num [ i ] - num [ 0 ] ) ) ; System . out . println ( dmin + " ▁ " + dmax ) ; } } }

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner inter = new Scanner ( System . in ) ; int n = inter . nextInt ( ) ; int [ ] X = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { X [ i ] = inter . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { int min = 0 , max = 0 ; if ( i != 0 && i != n - 1 ) { min = Math . min ( Math . abs ( X [ i ] - X [ i - 1 ] ) , Math . abs ( X [ i ] - X [ i + 1 ] ) ) ; max = Math . max ( Math . abs ( X [ i ] - X [ 0 ] ) , Math . abs ( X [ i ] - X [ n - 1 ] ) ) ; } else if ( i == 0 ) { min = Math . abs ( X [ 0 ] - X [ 1 ] ) ; max = Math . abs ( X [ 0 ] - X [ n - 1 ] ) ; } else if ( i == n - 1 ) { min = Math . abs ( X [ n - 1 ] - X [ n - 2 ] ) ; max = Math . abs ( X [ n - 1 ] - X [ 0 ] ) ; } System . out . println ( min + " ▁ " + max ) ; }   } }

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } System . out . println ( ( arr [ 1 ] - arr [ 0 ] ) + " ▁ " + ( arr [ n - 1 ] - arr [ 0 ] ) ) ; for ( int i = 1 ; i < n - 1 ; i ++ ) { System . out . println ( Math . min ( Math . abs ( arr [ i ] - arr [ i - 1 ] ) , Math . abs ( arr [ i + 1 ] - arr [ i ] ) ) + " ▁ " + Math . max ( arr [ i ] - arr [ 0 ] , arr [ n - 1 ] - arr [ i ] ) ) ; } System . out . println ( ( arr [ n - 1 ] - arr [ n - 2 ] ) + " ▁ " + ( arr [ n - 1 ] - arr [ 0 ] ) ) ; } }

def solve ( ) : n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) print ( abs ( l [ 0 ] - l [ 1 ] ) , l [ len ( l ) - 1 ] - l [ 0 ] ) for i in range ( 1 , len ( l ) - 1 ) : print ( min ( l [ i + 1 ] - l [ i ] , l [ i ] - l [ i - 1 ] ) , max ( l [ len ( l ) - 1 ] - l [ i ] , l [ i ] - l [ 0 ] ) ) print ( abs ( l [ len ( l ) - 1 ] - l [ len ( l ) - 2 ] ) , l [ len ( l ) - 1 ] - l [ 0 ] ) solve ( ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : if i == 0 : print ( a [ i + 1 ] - a [ i ] , end = " ▁ " ) print ( a [ n - 1 ] - a [ i ] ) elif i == n - 1 : print ( a [ i ] - a [ i - 1 ] , end = " ▁ " ) print ( a [ i ] - a [ 0 ] ) else : mini = min ( a [ i ] - a [ i - 1 ] , a [ i + 1 ] - a [ i ] ) print ( mini , end = " ▁ " ) maxi = max ( a [ n - 1 ] - a [ i ] , a [ i ] - a [ 0 ] ) print ( maxi ) NEW_LINE

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) )   print ( abs ( l [ 0 ] - l [ 1 ] ) , " ▁ " , abs ( l [ 0 ] - l [ n - 1 ] ) ) for i in range ( 1 , n - 1 ) : c = l [ i ] s1 = abs ( c - l [ i + 1 ] ) s2 = abs ( c - l [ i - 1 ] ) b1 = abs ( c - l [ 0 ] ) b2 = abs ( c - l [ n - 1 ] ) print ( min ( s1 , s2 ) , " ▁ " , max ( b1 , b2 ) ) print ( abs ( l [ n - 1 ] - l [ n - 2 ] ) , " ▁ " , abs ( l [ 0 ] - l [ n - 1 ] ) ) NEW_LINE

def computeMinDist ( x , y ) : if x < 0 and y < 0 : return abs ( x ) - abs ( y ) else : return y - x     def computeMaxDist ( x , y ) : minVal = - 1 if x < 0 and y < 0 : return abs ( x ) - abs ( y ) else : return y - x   n = int ( input ( ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- != 0 ) { int n = s . nextInt ( ) ; long arr [ ] = new long [ n ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = s . nextLong ( ) ; sum += arr [ i ] ; } long curr = 0 , max = Long . MIN_VALUE ; int start = 0 , end = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( curr + arr [ i ] <= arr [ i ] ) { start = i ; } else { end = i ; } curr = Math . max ( curr + arr [ i ] , arr [ i ] ) ; if ( curr >= max ) { if ( start == 0 && end == n - 1 ) { continue ; } max = Math . max ( max , curr ) ; } } String ans = " NO " ; if ( sum > max ) { ans = " YES " ; } System . out . println ( ans ) ; } } }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } long l = 0 , r = 0 ; boolean a = false ; for ( int i = 0 ; i < n ; i ++ ) { l += arr [ i ] ; r += arr [ n - 1 - i ] ; if ( l <= 0 || r <= 0 ) { a = true ; break ; } } if ( ! a ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class CF1285_D2_B { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int t = scanner . nextInt ( ) ; StringBuilder out = new StringBuilder ( ) ; for ( int i = 0 ; i < t ; i ++ ) { solve ( scanner , out ) ; } System . out . print ( out ) ; }   private static void solve ( FastScanner scanner , StringBuilder out ) { int n = scanner . nextInt ( ) ; int [ ] arr = scanner . nextArray ( n ) ; long [ ] sums = new long [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { sums [ i + 1 ] = arr [ i ] + sums [ i ] ; }

import java . awt . Desktop ;    import java . io . BufferedReader ;    import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . net . URI ; import java . net . URISyntaxException ; import java . sql . Array ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . LinkedHashMap ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . util . StringTokenizer ; import java . util . TreeSet ; import java . util . Vector ;     public class codechef3 { static class comp implements Comparator < Integer > {   @ Override public int compare ( Integer o1 , Integer o2 ) { if ( Math . abs ( o1 ) > Math . abs ( o2 ) ) return - 1 ; else return 1 ; } }

import java . io . * ; import java . util . * ; public class A { public static void main ( String ar [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; long arr [ ] = new long [ n ] ; String str [ ] = br . readLine ( ) . split ( " ▁ " ) ; long totalSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Long . parseLong ( str [ i ] ) ; totalSum += arr [ i ] ; } long sum2 = Math . max ( KADENES ( arr , 0 , n - 2 ) , KADENES ( arr , 1 , n - 1 ) ) ; if ( totalSum > sum2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public static long KADENES ( long arr [ ] , int l , int r ) { long sum = 0 ; long max = Integer . MIN_VALUE ; for ( int i = l ; i <= r ; i ++ ) { if ( sum + arr [ i ] < arr [ i ] ) { sum = arr [ i ] ; } else sum += arr [ i ] ; max = Math . max ( sum , max ) ; } return max ; } }

t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) x , y = 0 , 0 for i in range ( n ) : x += a [ i ] y += a [ n - i - 1 ] if x <= 0 or y <= 0 : print ( " NO " ) break else : print ( " YES " ) NEW_LINE

def get_test ( ) : tmp = input ( ) . split ( ' ▁ ' ) return [ int ( i ) for i in tmp ]     def solve ( a ) : sum1 , sum2 = 0 , 0 for i in range ( len ( a ) ) : sum1 += a [ i ] sum2 += a [ len ( a ) - i - 1 ] if sum1 <= 0 : return False if sum2 <= 0 : return False return True     test_count = int ( input ( ) ) for _ in range ( test_count ) : input ( ) a = get_test ( )   if solve ( a ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

def happy ( n , a ) : p = [ ] m = [ ] m2 = [ ]   m . append ( 0 ) m2 . append ( 10 ** 9 ) p . append ( int ( 0 ) ) ans = 1 for i in range ( 1 , len ( a ) + 1 ) : p . append ( p [ i - 1 ] + a [ i - 1 ] )   for i in range ( 1 , n + 1 ) : m . append ( min ( m [ i - 1 ] , p [ i ] ) )     NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) k = sum ( a ) m = [ ] if ( max ( a ) < 0 ) : print ( " NO " ) else : maa = - 100000000 s = 0 size = len ( a ) c = 0 cc = 0 for i in range ( 0 , size ) : if ( a [ i ] >= 0 ) : s += a [ i ] c += 1 else : if ( maa < s ) : maa = s cc = c if ( s + a [ i ] <= 0 ) : s = 0 c = 0 else : s = s + a [ i ] c += 1 if ( maa < s ) : maa = s ; cc = c if ( a [ 0 ] == 0 and len ( set ( a ) ) == 1 ) : print ( " NO " ) elif ( maa == k ) : if ( cc == len ( a ) ) : print ( " YES " ) else : print ( " NO " ) elif ( maa < k ) : print ( " YES " ) else : print ( " NO " ) NEW_LINE