id
stringlengths
13
20
java
sequence
python
sequence
codeforces_399_B
[ "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 ) ; } }", "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" ]
codeforces_706_A
[ "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" ]
codeforces_659_A
[ "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" ]
codeforces_584_B
[ "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", "n = int ( input ( ) ) print ( ( ( 3 ** ( 3 * n ) ) - 7 ** n ) % 1000000007 ) 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" ]
codeforces_1422_B
[ "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" ]
codeforces_673_A
[ "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" ]
codeforces_1068_B
[ "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", "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" ]
codeforces_218_B
[ "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", "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" ]
codeforces_427_B
[ "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" ]
codeforces_1043_B
[ "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" ]
codeforces_1452_B
[ "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 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" ]
codeforces_1395_B
[ "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" ]
codeforces_114_B
[ "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" ]
codeforces_946_A
[ "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 . 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" ]
codeforces_1253_A
[ "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" ]
codeforces_450_B
[ "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" ]
codeforces_349_A
[ "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", "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" ]
codeforces_622_A
[ "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" ]
codeforces_444_A
[ "# 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", "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", "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" ]
codeforces_567_A
[ "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" ]
codeforces_1285_B
[ "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" ]
codeforces_1060_A
[ "import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) , c = 0 ; String str = s . next ( ) ; char [ ] ch = str . toCharArray ( ) ; for ( int i = 0 ; i < ch . length ; i ++ ) if ( ch [ i ] == '8' ) c ++ ; if ( c >= ( n / 11 ) ) System . out . println ( n / 11 ) ; else if ( c < ( n / 11 ) && n > 11 ) System . out . println ( c ) ; else System . out . println ( 0 ) ; } }", "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner lol = new Scanner ( System . in ) ;   int n = lol . nextInt ( ) ; int num8 = 0 ; String nn = lol . next ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( '8' == nn . charAt ( i ) ) { num8 ++ ; } } int Fina_res = 0 ; for ( int i = 0 ; i < n / 11 ; i ++ ) { if ( num8 == 0 ) break ; Fina_res ++ ; num8 -- ; } System . out . println ( Fina_res ) ; } }", "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 . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { int n , c = 0 , i , m , k ; String s ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; s = sc . next ( ) ; for ( i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '8' ) { c ++ ; } } m = n / 11 ; k = m > c ? c : m ; System . out . println ( k ) ; } }" ]
[ "n = int ( input ( ) ) str = input ( ) solution = 0 eights = str . count ( \"8\" )   while n >= 11 and eights > 0 : if n >= 11 and eights > 0 : solution += 1 eights -= 1 n -= 11 else : break   print ( solution ) NEW_LINE", "n = int ( input ( ) ) s = input ( )   m = s . count ( \"8\" ) n   if m == 0 or n < 11 : print ( 0 )   else : lo , hi = 1 , m while lo <= hi : mid = ( lo + hi ) // 2 if mid * 10 <= n - mid : lo = mid + 1 else : hi = mid - 1 print ( hi )   NEW_LINE", "n = int ( input ( ) ) s = input ( ) if s . count ( '8' ) == 0 : print ( 0 ) elif len ( s ) < 11 : print ( 0 ) else : x = n // 11 y = s . count ( '8' ) if x <= y : print ( x ) else : print ( y ) NEW_LINE" ]
codeforces_931_A
[ "import java . util . Scanner ;   public class problem51 {   public static void main ( String [ ] args ) {", "import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c , count = 0 , i = 0 ; if ( b > a ) { c = b - a ; } else { c = a - b ; } if ( c == 1 ) { System . out . println ( \"1\" ) ; } else { while ( c != 0 ) { i ++ ; if ( c == 1 ) { count = count + i ; c -- ; } else { count = count + ( 2 * i ) ; c = c - 2 ; } } System . out . println ( count ) ; } } }", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int sum = 0 , sum1 = 0 , i = 0 , j = 1 , k = 0 ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; if ( a > b ) { int temp = a ; a = b ; b = temp ; } int diff = b - a ; if ( diff % 2 != 0 ) { int d = ( 0 + diff ) / 2 ; for ( i = a ; i < a + d ; i ++ ) { sum = sum + ( j ) ; j ++ ; } sum = sum * 2 ; System . out . println ( sum + ( j ) ) ; } else { sum = 0 ; int d = ( 0 + diff ) / 2 ; for ( k = a ; k < a + d ; k ++ ) { sum = sum + ( j ) ; j ++ ; } sum = sum * 2 ; System . out . println ( sum ) ; } } }", "    import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner puttingvaluesinside = new Scanner ( System . in ) ; int a = puttingvaluesinside . nextInt ( ) ; int b = puttingvaluesinside . nextInt ( ) ; int diff = ( int ) Math . abs ( a - b ) ; int step = diff / 2 ; step *= step + 1 ; if ( diff % 2 == 1 ) step += diff / 2 + 1 ; System . out . println ( step ) ; } }", "import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a > b ) { a = a ^ b ; b = a ^ b ; a = a ^ b ; } int rem = b - a ; int n = rem / 2 ; int x = n * ( n + 1 ) ; if ( rem % 2 == 1 ) x += ( n + 1 ) ; System . out . println ( x ) ; } }" ]
[ "print ( ( abs ( int ( input ( ) ) - int ( input ( ) ) ) + 1 ) ** 2 // 4 ) NEW_LINE", "a = int ( input ( ) ) b = int ( input ( ) )   if a < b : small = a large = b d = b - aelse : small = b large = a d = a - b   center = small + d // 2   s1 = 0 s2 = 0   for i in range ( 1 , ( d // 2 ) + 1 ) : s1 += i   for i in range ( 1 , ( large - center ) + 1 ) : s2 += i   print ( s1 + s2 ) NEW_LINE", "n = int ( input ( ) ) m = int ( input ( ) ) c = abs ( m - n ) d = c // 2 e = d + c % 2 print ( ( 1 + e ) * e // 2 + ( 1 + d ) * d // 2 ) NEW_LINE", "n = int ( input ( ) ) m = int ( input ( ) )   if n - m == 1 or n - m == - 1 : print ( 1 ) else : i = 1 s = 0 while ( n != m ) : if n > m : n -= 1 s += i if n == m : break m += 1 s += i else : n += 1 s += i if n == m : break m -= 1 s += i i += 1 print ( s ) NEW_LINE", "a = int ( input ( ) ) b = int ( input ( ) ) c = abs ( b - a ) e = c // 2 d = c % 2 print ( e * ( e + 1 ) + d * ( d + e ) ) NEW_LINE" ]
codeforces_994_A
[ "  import java . util . * ; public class f { public static void main ( String [ ] ta ) { Scanner sc = new Scanner ( System . in ) ; if ( sc . hasNext ( ) ) { int n = sc . nextInt ( ) ;", "import java . util . Scanner ;   public class nineteen {   public static void main ( String [ ] args ) {", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . HashSet ; 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 ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AFingerprints solver = new AFingerprints ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class AFingerprints { int n ; int m ; int [ ] arr ; HashSet < Integer > set ;   public void readInput ( Scanner sc ) { n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; set = new HashSet < > ( ) ; for ( int i = 0 ; i < m ; i ++ ) set . add ( sc . nextInt ( ) ) ; }   public void solve ( int testNumber , Scanner sc , PrintWriter pw ) { int q = 1 ; while ( q -- > 0 ) { readInput ( sc ) ; for ( int x : arr ) if ( set . contains ( x ) ) pw . print ( x + \" ▁ \" ) ; pw . println ( ) ; } }   }   static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; }   public String next ( ) { try { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }  ", "import java . util . * ;   public class password {   public static void main ( String [ ] args ) {", "import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ m ] ; Arrays . fill ( b , Integer . MAX_VALUE ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; a [ i ] = x ; } for ( int i = 0 ; i < m ; i ++ ) { int y = sc . nextInt ( ) ; for ( int j = 0 ; j < n ; j ++ ) { if ( y == a [ j ] ) { b [ i ] = j ; } } }   Arrays . sort ( b ) ; for ( int i = 0 ; i < b . length ; i ++ ) { if ( b [ i ] != Integer . MAX_VALUE ) System . out . print ( a [ b [ i ] ] + \" ▁ \" ) ; } } }" ]
[ "n , m = map ( int , input ( ) . split ( ) ) z = list ( map ( int , input ( ) . split ( ) ) ) x = list ( map ( int , input ( ) . split ( ) ) ) l = [ ] for i in z : if ( i in x ) : l . append ( i ) print ( * l ) NEW_LINE", "import sys   def main ( ) : inp = sys . stdin . read ( ) . strip ( ) . split ( ' \\n ' ) return ( i for i in inp [ 1 ] . split ( ) if i in set ( inp [ 2 ] . split ( ) ) ) print ( * main ( ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) numbers = list ( map ( int , input ( ) . split ( ) ) ) fingerprints = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : if numbers [ i ] in fingerprints : print ( numbers [ i ] , end = \" ▁ \" ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) l1 = list ( map ( int , input ( ) . split ( ) ) ) l2 = list ( map ( int , input ( ) . split ( ) ) ) d2 = { } for i in l2 : if ( i in d2 ) : d2 [ i ] += 1 else : d2 [ i ] = 1 for i in l1 : if ( i in d2 ) : print ( i , end = ' ▁ ' ) d2 [ i ] -= 1 if ( d2 [ i ] <= 0 ) : del ( d2 [ i ] ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l1 = list ( map ( int , input ( ) . split ( ) ) ) d = dict . fromkeys ( l1 ) for i in l : if ( i in d ) : print ( i , end = ' ▁ ' ) NEW_LINE" ]
codeforces_166_A
[ "import java . util . * ; import java . io . * ; import java . math . * ;   public class First {   public static void process ( ) throws IOException { int n = ni ( ) ; int k = ni ( ) ; HashMap < String , Integer > map = new HashMap < String , Integer > ( ) ; ArrayList < Node > list = new ArrayList < Node > ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { int a = ni ( ) ; int b = ni ( ) ; String key = Integer . toString ( a ) + \" _ \" + Integer . toString ( b ) ; if ( map . isEmpty ( ) || ! map . containsKey ( key ) ) { map . put ( key , 1 ) ; } else { int current = map . get ( key ) ; map . put ( key , current + 1 ) ; } Node node = new Node ( a , b ) ; list . add ( node ) ; }   Collections . sort ( list , new SortNode ( ) ) ; Node node = list . get ( k - 1 ) ; String key = Integer . toString ( node . a ) + \" _ \" + Integer . toString ( node . b ) ; pn ( map . get ( key ) ) ;  ", "import java . util . * ;   public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] [ 0 ] = sc . nextInt ( ) ; a [ i ] [ 1 ] = sc . nextInt ( ) ; } Arrays . sort ( a , new Comparator < int [ ] > ( ) { @ Override public int compare ( int [ ] A , int [ ] B ) { if ( A [ 0 ] != B [ 0 ] ) return B [ 0 ] - A [ 0 ] ; return A [ 1 ] - B [ 1 ] ; } } ) ; String key = Arrays . toString ( a [ k - 1 ] ) ; int count = 0 ; for ( int [ ] A : a ) { String temp = Arrays . toString ( A ) ; if ( temp . equals ( key ) ) { count ++ ; } } System . out . println ( count ) ; } }", "import java . io . * ; import java . lang . * ; import java . util . * ;   public class A166 { public static void main ( String [ ] args ) throws IOException { StringBuffer ans = new StringBuffer ( ) ; StringTokenizer st ; BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; st = new StringTokenizer ( f . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; point [ ] arr = new point [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { st = new StringTokenizer ( f . readLine ( ) ) ; arr [ i ] = new point ( Integer . parseInt ( st . nextToken ( ) ) , Integer . parseInt ( st . nextToken ( ) ) ) ; } f . close ( ) ; Arrays . sort ( arr ) ; point curr = arr [ k - 1 ] ; int op = 0 ;", "  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 ( ) ;  " ]
[ "import functoolsn , k = input ( ) . split ( ) n = int ( n ) k = int ( k ) d = { } a = [ ] for i in range ( n ) : x , y = input ( ) . split ( ) x = int ( x ) y = int ( y ) a . append ( [ x , y ] ) if ( x , y ) in d . keys ( ) : d [ ( x , y ) ] += 1 else : d [ ( x , y ) ] = 1 def cmp ( item1 , item2 ) : if ( item1 [ 0 ] > item2 [ 0 ] ) : return 1 if item2 [ 0 ] > item1 [ 0 ] : return - 1 if ( item1 [ 0 ] == item2 [ 0 ] ) : if item1 [ 1 ] > item2 [ 1 ] : return - 1 elif item1 [ 1 ] < item2 [ 1 ] : return 1 return 0 a = sorted ( a , key = functools . cmp_to_key ( cmp ) , reverse = True ) rank_n = a [ k - 1 ] print ( d [ ( rank_n [ 0 ] , rank_n [ 1 ] ) ] ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) a2 = [ ] d2 = { } for i in range ( n ) : p , t = map ( int , input ( ) . split ( ) ) a2 . append ( ( p , t ) ) try : d2 [ ( p , t ) ] += 1 except : d2 [ ( p , t ) ] = 1 a2 = ( sorted ( a2 , key = lambda x : ( - x [ 0 ] , x [ 1 ] ) ) ) ( pk , tk ) = a2 [ k - 1 ] print ( d2 [ pk , tk ] ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) arr = [ ] for _ in range ( n ) : c , p = map ( int , input ( ) . split ( ) ) arr . append ( ( c , - p ) ) arr . sort ( ) arr = arr [ : : - 1 ] e = arr [ m - 1 ] print ( arr . count ( e ) ) NEW_LINE", "d = [ ] n , k = map ( int , input ( ) . split ( ) ) for _ in range ( n ) : p , t = map ( int , input ( ) . split ( ) ) d . append ( ( p , - t ) ) d . sort ( reverse = True ) print ( d . count ( d [ k - 1 ] ) ) NEW_LINE", "try : n , k = map ( int , input ( ) . split ( ) ) j = [ ] for i in range ( n ) : f = [ ] p , t = map ( int , input ( ) . split ( ) ) f . append ( p ) f . append ( t ) j . append ( f ) final = sorted ( j , key = lambda x : ( x [ 0 ] , - x [ 1 ] ) , reverse = True ) print ( final . count ( final [ k - 1 ] ) ) except : pass NEW_LINE" ]
codeforces_102_A
[ "import java . util . * ; public class A102 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int clothes = scan . nextInt ( ) , num = scan . nextInt ( ) , a , b , help , min = 3000000 ; int [ ] price = new int [ clothes + 1 ] ; boolean match = false ; boolean [ ] [ ] graph = new boolean [ 101 ] [ 101 ] ; for ( int i = 1 ; i <= clothes ; i ++ ) price [ i ] = scan . nextInt ( ) ; for ( int i = 0 ; i < num ; i ++ ) { a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; graph [ a ] [ 0 ] = true ; graph [ b ] [ 0 ] = true ; graph [ a ] [ b ] = true ; graph [ b ] [ a ] = true ; } for ( int i = 1 ; i <= clothes ; i ++ ) for ( int j = 1 ; j <= clothes && graph [ i ] [ 0 ] ; j ++ ) if ( graph [ i ] [ j ] ) for ( int k = 1 ; k <= clothes && graph [ j ] [ 0 ] ; k ++ ) if ( graph [ j ] [ k ] && graph [ i ] [ k ] ) { match = true ; help = price [ i ] + price [ j ] + price [ k ] ; if ( min > help ) min = help ; } System . out . println ( ! match ? - 1 : min ) ; } }", "import java . util . * ; import java . io . * ;    public class A102 { public static void main ( String args [ ] ) throws IOException { Scanner sc = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int arr [ ] = new int [ n + 1 ] ; ArrayList < Set < Integer > > dp = new ArrayList < > ( n + 1 ) ; dp . add ( new HashSet < Integer > ( ) ) ; for ( int i = 1 ; i <= n ; i ++ ) { dp . add ( new HashSet < Integer > ( ) ) ; arr [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; Set < Integer > c = dp . get ( b ) ; c . add ( a ) ; c = dp . get ( a ) ; c . add ( b ) ; } long min = 10000000000L ; for ( int i = 1 ; i <= n ; i ++ ) { Set < Integer > a = dp . get ( i ) ; for ( int b : a ) { Set < Integer > c = dp . get ( b ) ; for ( int d : c ) { if ( a . contains ( d ) ) { min = Math . min ( min , arr [ i ] + arr [ b ] + arr [ d ] ) ; } } } } if ( min == 10000000000L ) pw . println ( - 1 ) ; else pw . println ( min ) ; pw . close ( ) ; } }" ]
[ "from math import *     class graph : NEW_LINE", "from itertools import combinations     def solve ( n , m , prices , ms ) : combs = list ( combinations ( range ( 1 , n + 1 ) , r = 3 ) ) sums = [ ] for x in combs : pairs = set ( combinations ( x , r = 2 ) ) if pairs . issubset ( ms ) : s = 0 for i in x : s += prices [ i - 1 ] sums . append ( s )   return min ( sums ) if sums else - 1     if __name__ == ' _ _ main _ _ ' : n , m = tuple ( map ( int , input ( ) . split ( ) ) ) an = list ( map ( int , input ( ) . split ( ) ) ) ms = set ( ) for _ in range ( m ) : ms . add ( tuple ( sorted ( map ( int , input ( ) . split ( ) ) ) ) ) print ( solve ( n , m , an , ms ) ) NEW_LINE", "I = lambda : map ( int , input ( ) . split ( ) )   n , m = I ( ) A = list ( I ( ) ) C = set ( )   for i in range ( m ) : x , y = sorted ( I ( ) ) C . add ( ( x - 1 , y - 1 ) )   print ( min ( ( A [ i ] + A [ j ] + A [ k ] for i in range ( n ) for j in range ( i ) for k in range ( j ) if { ( j , i ) , ( k , i ) , ( k , j ) } <= C ) , default = - 1 ) ) NEW_LINE", "temp_numbers = list ( map ( int , input ( ) . split ( ) ) ) n , m = temp_numbers [ 0 ] , temp_numbers [ 1 ]   cost = list ( map ( int , input ( ) . split ( ) ) )   min_cost = 3.1 * 10 ** 6   adj = [ [ 0 for i in range ( n ) ] for j in range ( n ) ]   for i in range ( m ) : temp_input = list ( map ( int , input ( ) . split ( ) ) ) adj [ temp_input [ 0 ] - 1 ] [ temp_input [ 1 ] - 1 ] = 1 adj [ temp_input [ 1 ] - 1 ] [ temp_input [ 0 ] - 1 ] = 1   for i in range ( n - 2 ) : for j in range ( i + 1 , n - 1 ) : for k in range ( j + 1 , n ) : if adj [ i ] [ j ] == adj [ j ] [ k ] == adj [ k ] [ i ] == 1 : min_cost = min ( min_cost , cost [ i ] + cost [ j ] + cost [ k ] )     if min_cost <= 3 * 10 ** 6 : print ( min_cost ) else : print ( - 1 ) NEW_LINE" ]
codeforces_75_B
[ "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  ", "import java . io . * ; import java . util . * ; public class CodeForces { static int min = 0 ; public static void main ( String [ ] args ) throws Exception {", "import java . io . * ; import java . util . * ;   public class Solution {   public static void main ( String [ ] args ) {" ]
[ "class pair : def NEW_LINE __init__ ( self , f , s ) : self . f = f NEW_LINE self . s = s   me = input ( ) NEW_LINE n = int ( input ( ) )   mp = { } NEW_LINE for i in range ( n ) : a = list ( map ( str , input ( ) . split ( ) ) )   if a [ 1 ] == \" likes \" : NEW_LINE INDENT ot = a [ 2 ] else : NEW_LINE ot = a [ 3 ]   NEW_LINE DEDENT", "name = input ( ) NEW_LINE n = int ( input ( ) )   priority = { } NEW_LINE nomes = [ ]   for i in range ( n ) : txt = input ( ) . split ( ) NEW_LINE a = txt [ 0 ] NEW_LINE b = txt [ 3 ] [ : - 2 ] NEW_LINE action = txt [ 1 ] NEW_LINE if action == ' likes ' : b = txt [ 2 ] [ : - 2 ] NEW_LINE if b not in priority and b != name : priority [ b ] = 0 NEW_LINE if a not in priority and a != name : priority [ a ] = 0 NEW_LINE if a == name : if NEW_LINE action == ' posted ' : priority [ b ] += 15 elif action == ' commented ' : priority [ b ] += 10 elif action == ' likes ' : priority [ b ] += 5 elif b == name : NEW_LINE if action == ' posted ' : NEW_LINE INDENT priority [ a ] += 15 elif action == ' commented ' : NEW_LINE priority [ a ] += 10 elif action == ' likes ' : NEW_LINE priority [ a ] += 5   for ele in priority : nomes . append ( ( ele , priority [ ele ] ) ) NEW_LINE DEDENT nomes = sorted ( nomes , key = lambda element : ( - element [ 1 ] , element [ 0 ] ) )   for i in nomes : print ( i [ 0 ] )   NEW_LINE", "a = input ( ) NEW_LINE n = int ( input ( ) ) NEW_LINE d = [ ] NEW_LINE for i in range ( n ) : s = list ( map ( str , input ( ) . split ( ) ) ) NEW_LINE if s [ 1 ] == \" likes \" : NEW_LINE INDENT s [ 2 ] = s [ 2 ] [ : len ( s [ 2 ] ) - 2 ] else : NEW_LINE s [ 3 ] = s [ 3 ] [ : len ( s [ 3 ] ) - 2 ] NEW_LINE DEDENT d . append ( s ) NEW_LINE dic = { } NEW_LINE for i in d : dic [ i [ 0 ] ] = 0 NEW_LINE if i [ 1 ] == \" likes \" : NEW_LINE INDENT dic [ i [ 2 ] ] = 0 else : NEW_LINE dic [ i [ 3 ] ] = 0 NEW_LINE DEDENT if a in dic : dic . pop ( a ) NEW_LINE for i in d : if NEW_LINE a in i : NEW_LINE if i [ 1 ] == \" likes \" : if NEW_LINE i [ 0 ] == a : dic [ i [ 2 ] ] += 5 else : dic [ i [ 0 ] ] += 5 elif i [ 1 ] == \" commented \" : NEW_LINE if i [ 0 ] == a : NEW_LINE INDENT dic [ i [ 3 ] ] += 10 else : NEW_LINE dic [ i [ 0 ] ] += 10 else : if i [ 0 ] == a : NEW_LINE dic [ i [ 3 ] ] += 15 else : NEW_LINE dic [ i [ 0 ] ] += 15 NEW_LINE DEDENT res = [ ] NEW_LINE for i in dic : res . append ( [ dic [ i ] , i ] ) NEW_LINE res = sorted ( res , reverse = True ) NEW_LINE c = [ ] NEW_LINE for i in range ( len ( res ) - 1 ) : if NEW_LINE res [ i ] [ 0 ] > res [ i + 1 ] [ 0 ] : print ( res [ i ] [ 1 ] ) NEW_LINE c . sort ( ) NEW_LINE for i in c : print ( i ) NEW_LINE c = [ ] else : c . append ( res [ i ] [ 1 ] ) NEW_LINE c . append ( res [ len ( res ) - 1 ] [ 1 ] ) NEW_LINE c . sort ( ) NEW_LINE for i in c : print ( i ) NEW_LINE", "class pair : def NEW_LINE __init__ ( self , f , s ) : self . f = f NEW_LINE self . s = s   me = input ( ) NEW_LINE n = int ( input ( ) )   mp = { } NEW_LINE for i in range ( n ) : a = list ( map ( str , input ( ) . split ( ) ) )   if a [ 1 ] == \" likes \" : NEW_LINE INDENT ot = a [ 2 ] else : NEW_LINE ot = a [ 3 ]   NEW_LINE DEDENT" ]
codeforces_105_A
[ "import java . io . * ; import java . util . * ;   public class practice105a { public static void main ( String [ ] args ) throws Exception {", "import java . io . * ; import java . util . * ;   public class TestClass { 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 m = Integer . parseInt ( st . nextToken ( ) ) ; double kd = Double . parseDouble ( st . nextToken ( ) ) ; int k = ( int ) ( Math . round ( kd * 100 ) ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Map ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class Transmigration { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int m = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) . substring ( 2 ) ) ;   TreeMap < String , Integer > skills = new TreeMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { st = new StringTokenizer ( br . readLine ( ) ) ; String skillName = st . nextToken ( ) ; int skillScore = Integer . parseInt ( st . nextToken ( ) ) ; int newSkillScore = skillScore * k / 100 ; if ( newSkillScore < 100 ) continue ; skills . put ( skillName , newSkillScore ) ; }   for ( int i = 0 ; i < m ; i ++ ) { String skillName = br . readLine ( ) ; if ( skills . containsKey ( skillName ) ) continue ; skills . put ( skillName , 0 ) ; }   pw . println ( skills . size ( ) ) ;   for ( Map . Entry < String , Integer > skill : skills . entrySet ( ) ) pw . println ( skill . getKey ( ) + \" ▁ \" + skill . getValue ( ) ) ;   pw . flush ( ) ; pw . close ( ) ; } }" ]
[ "n , m , k = map ( float , input ( ) . split ( ) ) n , m , k = round ( n ) , round ( m ) , round ( k * 100 ) D = dict ( ) for i in range ( n ) : x = input ( ) . split ( ) F = int ( x [ 1 ] ) * k // 100 if ( F >= 100 ) : D [ x [ 0 ] ] = F for i in range ( m ) : x = input ( ) if x not in D : D [ x ] = 0 print ( len ( D ) ) for x in sorted ( D ) : print ( x , D [ x ] ) NEW_LINE", "from collections import Countern , m , k = input ( ) . split ( ) k , c = int ( k . split ( ' . ' ) [ 1 ] ) , Counter ( ) for i in range ( int ( n ) ) : s , e = input ( ) . split ( ) e = int ( e ) * k // 100 if e >= 100 : c [ s ] = efor i in range ( int ( m ) ) : c [ input ( ) ] += 0 print ( len ( c ) ) print ( ' \\n ' . join ( sorted ( x + ' ▁ ' + str ( c [ x ] ) for x in c ) ) ) NEW_LINE", "from collections import Counter   n , m , k = input ( ) . split ( )   k , c = int ( k . split ( ' . ' ) [ 1 ] ) , Counter ( )   for i in range ( int ( n ) ) :   s , e = input ( ) . split ( )   e = int ( e ) * k // 100   if e >= 100 :   c [ s ] = e   for i in range ( int ( m ) ) :   c [ input ( ) ] += 0   print ( len ( c ) )   print ( ' \\n ' . join ( sorted ( x + ' ▁ ' + str ( c [ x ] ) for x in c ) ) ) NEW_LINE", "n , m , k = input ( ) . split ( ) n , m = int ( n ) , int ( m ) k = int ( k [ 2 : ] ) d = { } d2 = { } ans = [ ] for i in range ( n ) : a , b = input ( ) . split ( ) NEW_LINE", "import mathn , m , k = input ( ) . split ( ) n = int ( n ) ; m = int ( m ) ; k = float ( k ) ans = [ ] ; re = [ ] for i in range ( n ) : q = 0 x , y = input ( ) . split ( ) q += ( .99999 <= ( math . modf ( int ( y ) * k ) [ 0 ] ) ) if int ( int ( y ) * k ) + q > 99 : ans . append ( [ x , int ( int ( y ) * k ) + q ] ) re . append ( x ) for j in range ( m ) : c = input ( ) if c not in re : ans . append ( [ c , 0 ] ) ans . sort ( ) print ( len ( ans ) ) for s , i in ans : print ( s , i ) NEW_LINE" ]
codeforces_651_A
[ "import java . util . Scanner ;   public class _0855Joysticks {   static int letsgame ( int x , int y , int count ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Scanner ;   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 ) ; private static PrintWriter out = new PrintWriter ( System . out ) ;   public static void solve ( int T ) throws IOException { int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; if ( a1 == 1 && a2 == 1 ) { System . out . println ( 0 ) ; return ; } int ans = 0 ; int charging = a1 < a2 ? 0 : 1 ; while ( a1 > 0 && a2 > 0 ) { if ( charging == 0 ) { a1 += 1 ; a2 -= 2 ; } else { a1 -= 2 ; a2 += 1 ; } if ( a1 < a2 ) { charging = 0 ; } else { charging = 1 ; } ans ++ ; } System . out . println ( ans ) ; }   public static void main ( String [ ] args ) throws IOException { int t ;", "import java . util . * ; public class Joysticks { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a1 = in . nextInt ( ) , a2 = in . nextInt ( ) ; System . out . println ( a1 + a2 - ( ( Math . abs ( a1 - a2 ) % 3 == 0 && a1 * a2 != 1 ) ? 3 : 2 ) ) ; } }", "import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ;   public class A651 {   static int mod = ( int ) ( 1e9 + 7 ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;", "import java . io . FileNotFoundException ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Random ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int minutes = 0 ; if ( a == 1 && b == 1 ) { System . out . println ( 0 ) ; return ; } for ( ; a > 0 && b > 0 ; minutes ++ ) { if ( a > b ) { a = a - 2 ; b ++ ; } else { b = b - 2 ; a ++ ; } } System . out . println ( minutes ) ; } }" ]
[ "import sysfrom functools import lru_cache , cmp_to_keyfrom heapq import merge , heapify , heappop , heappushfrom math import * from collections import defaultdict as dd , deque , Counter as Cfrom itertools import combinations as comb , permutations as permfrom bisect import bisect_left as bl , bisect_right as br , bisect , insortfrom time import perf_counterfrom fractions import Fractionimport copyfrom copy import deepcopyimport timestarttime = time . time ( ) mod = int ( pow ( 10 , 9 ) + 7 ) mod2 = 998244353   def data ( ) : return sys . stdin . readline ( ) . strip ( ) def out ( * var , end = \" \\n \" ) : sys . stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) def L ( ) : return list ( sp ( ) ) def sl ( ) : return list ( ssp ( ) ) def sp ( ) : return map ( int , data ( ) . split ( ) ) def ssp ( ) : return map ( str , data ( ) . split ( ) ) def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] def l2d ( n , m , val = 0 ) : return [ l1d ( n , val ) for j in range ( m ) ] try : NEW_LINE", "a1 , a2 = [ int ( x ) for x in input ( ) . split ( ) ]   t = 0 while ( ( a1 > 0 ) and ( a2 > 0 ) ) :   if a1 < a2 : NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) ans = 0 if a < 2 and b < 2 : print ( 0 ) exit ( ) while a > 0 and b > 0 : ans += 1 if a < b : a += 1 b -= 2 else : a -= 2 b += 1 print ( ans ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) count = 0 while max ( a , b ) > 1 and min ( a , b ) > 0 : a , b = max ( a , b ) - 2 , min ( a , b ) + 1 count += 1 print ( count ) NEW_LINE", "a1 , a2 = map ( int , input ( ) . split ( ) )   minute = 0 while True : if a1 < a2 : a1 += 1 a2 -= 2 minute += 1 elif a2 < a1 : a2 += 1 a1 -= 2 minute += 1 else : if a1 == 1 : a1 -= 1 else : a1 += 1 a2 -= 2 minute += 1 if a1 <= 0 or a2 <= 0 : break   print ( minute ) NEW_LINE" ]
codeforces_609_B
[ "import java . io . * ;    import java . util . * ;      public class Main { static PrintWriter out = new PrintWriter ( System . out ) ;   public static void solve ( ) throws Exception { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int freq [ ] = new int [ m ] ;   for ( int i = 0 ; i < n ; ++ i ) freq [ in . nextInt ( ) - 1 ] ++ ;     long ans = ( ( long ) n * ( n - 1 ) ) / 2 ;   for ( int i = 0 ; i < m ; ++ i ) { ans -= ( ( long ) freq [ i ] * ( freq [ i ] - 1 ) ) / 2 ; }   out . println ( ans ) ; }   public static void main ( String args [ ] ) throws Exception { in . init ( System . in ) ; solve ( ) ; out . close ( ) ; }   public static class in { static BufferedReader reader ; static StringTokenizer tokenizer ;   static void init ( InputStream input ) { reader = new BufferedReader ( new InputStreamReader ( input ) ) ; tokenizer = new StringTokenizer ( \" \" ) ; }   static String next ( ) throws IOException { while ( ! tokenizer . hasMoreTokens ( ) ) tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; return tokenizer . nextToken ( ) ; }   static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; }   static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; }   static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } }        ", "import java . io . * ;    import java . util . * ;      public class Main { public static Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) , 640000 ) ) ; public static PrintWriter out = new PrintWriter ( System . out ) ;        public static void solve ( ) throws Exception { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int freq [ ] = new int [ m ] ;   for ( int i = 0 ; i < n ; ++ i ) freq [ in . nextInt ( ) - 1 ] ++ ;    long ans = ( ( long ) n * ( n - 1 ) ) / 2 ;   for ( int i = 0 ; i < m ; ++ i ) { ans -= ( ( long ) freq [ i ] * ( freq [ i ] - 1 ) ) / 2 ; }   out . println ( ans ) ; }   public static void main ( String args [ ] ) throws Exception {   solve ( ) ; out . close ( ) ; } }      ", "import java . io . * ;    import java . util . * ;      public class Main { public static Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) , 640000 ) ) ; public static PrintWriter out = new PrintWriter ( System . out ) ;        public static void solve ( ) throws Exception { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int freq [ ] = new int [ m ] ;   long totalBooks = 0 ; for ( int i = 0 ; i < n ; ++ i ) { freq [ in . nextInt ( ) - 1 ] ++ ; totalBooks ++ ; }    long ans = ( totalBooks * ( totalBooks - 1 ) ) / 2 ;   for ( int i = 0 ; i < m ; ++ i ) { ans -= ( ( long ) freq [ i ] * ( freq [ i ] - 1 ) ) / 2 ; }   out . println ( ans ) ; }   public static void main ( String args [ ] ) throws Exception {   solve ( ) ; out . close ( ) ; } }      ", "import java . util . Scanner ;   public class ques2 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int arr [ ] = new int [ n ] ; int gen [ ] = new int [ 11 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = in . nextInt ( ) ; gen [ arr [ i ] ] ++ ; } long ans = 0 ; for ( int i = 1 ; i <= m ; i ++ ) { for ( int k = 1 ; k <= m ; k ++ ) { if ( i != k ) { ans += ( long ) gen [ i ] * gen [ k ] ; } } } System . out . println ( ans / 2 ) ; } }" ]
[ "n , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) result = 0 for i in range ( m ) : count = a . count ( i + 1 ) result += count * ( n - count ) print ( result // 2 ) NEW_LINE", "from collections import * n , m = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) d = defaultdict ( int ) for i in l : d [ i ] += 1 x = list ( d . values ( ) ) s = sum ( x ) k = len ( x ) c = 0 for i in range ( k - 1 ) : s = s - x [ i ] c = c + s * x [ i ] print ( c ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in set ( l ) : d [ i ] = 0 c = 0 d [ l [ - 1 ] ] = 1 NEW_LINE", "import sysimport os . pathfrom collections import * import mathimport bisect   if ( os . path . exists ( ' input . txt ' ) ) : sys . stdin = open ( \" input . txt \" , \" r \" ) sys . stdout = open ( \" output . txt \" , \" w \" ) else : input = sys . stdin . readline     NEW_LINE" ]
codeforces_1165_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . StringTokenizer ; public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; int x = fs . nextInt ( ) ; int y = fs . nextInt ( ) ; int rem = y % x ; int ans = 0 ; String s = fs . next ( ) ; int i = 0 ; while ( i < n && i < x ) { if ( i < rem && s . charAt ( n - i - 1 ) != '0' ) ans ++ ; else if ( i == rem && s . charAt ( n - i - 1 ) != '1' ) ans ++ ; else if ( i > rem && s . charAt ( n - i - 1 ) != '0' ) ans ++ ; i ++ ; } System . out . println ( ans ) ; } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }", "import java . util . * ; import java . math . * ; public class Remainder { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; char [ ] arr = sc . next ( ) . toCharArray ( ) ; int out = 0 ; for ( int i = n - x ; i < n ; i ++ ) { if ( i == n - y - 1 ) { if ( arr [ i ] != '1' ) out ++ ; } else { if ( arr [ i ] != '0' ) out ++ ; } } System . out . println ( out ) ; } }", "import java . util . Scanner ;   public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; String s = sc . next ( ) ; int xVal = ( int ) Math . pow ( 10 , x ) ; int yVal = ( int ) Math . pow ( 10 , y ) ;" ]
[ "n , x , y = [ int ( x ) for x in input ( ) . split ( ) ] s = input ( ) [ : : - 1 ] c = 0 c = sum ( [ 1 for i in s [ 0 : y ] if i == '1' ] ) c += sum ( [ 1 for i in s [ y + 1 : x ] if i == '1' ] ) if s [ y ] == '0' : c += 1 print ( c ) NEW_LINE", "def solve ( bin_str , x , y ) : target = ( '0' * ( x - y - 1 ) ) + ( str ( 10 ** y ) ) trimmed = bin_str [ - x : ] return sum ( [ 1 if target_i != trim_i else 0 for target_i , trim_i in zip ( target , trimmed ) ] )   if __name__ == ' _ _ main _ _ ' : n , x , y = list ( map ( int , input ( ) . split ( ) ) ) bin_str = input ( ) print ( solve ( bin_str , x , y ) )   NEW_LINE", "from sys import stdin , stdoutstdin . readlinedef mp ( ) : return list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) def it ( ) : return int ( stdin . readline ( ) . strip ( ) ) from math import ceilfrom collections import defaultdict as ddfrom collections import Counter as C   n , x , y = mp ( ) l = list ( input ( ) ) ans = 0 NEW_LINE", "import mathn , x , y = map ( int , input ( ) . split ( ) ) num = input ( ) num = num [ n - x : ] ans = 0 mid = len ( num ) - y - 1 if num [ mid ] == '0' : ans += 1 ans = ans + num [ 0 : mid ] . count ( '1' ) + num [ mid + 1 : ] . count ( '1' ) print ( ans ) NEW_LINE", "n , x , y = map ( int , input ( ) . split ( ) ) s = input ( ) i = 0 ; n = n - 1 ; ans = 0 while i < x : if s [ n - i ] == '1' and i != y : ans += 1 i += 1 if s [ n - y ] == '0' : print ( ans + 1 ) else : print ( ans )   NEW_LINE" ]
codeforces_34_A
[ "import java . util . Scanner ;   public class Reconnaissance2 { 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 ( ) ; } sc . close ( ) ; int diff = Math . abs ( arr [ n - 1 ] - arr [ 0 ] ) ; int prev = n - 1 , curr = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( diff > Math . abs ( arr [ i ] - arr [ i - 1 ] ) ) { diff = Math . abs ( arr [ i ] - arr [ i - 1 ] ) ; prev = i - 1 ; curr = i ; } } System . out . print ( ( prev + 1 ) + \" ▁ \" + ( curr + 1 ) ) ; }   }", "import java . util . Scanner ;   public class Reconnaissance { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int min = Integer . MAX_VALUE ; int [ ] soldiers = new int [ n ] ; for ( int k = 0 ; k < n ; k ++ ) { soldiers [ k ] = scan . nextInt ( ) ; } int man = 0 ; int woman = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { int a = soldiers [ i ] ; if ( i == 0 && Math . abs ( a - soldiers [ n - 1 ] ) < min ) { min = Math . abs ( a - soldiers [ n - 1 ] ) ; man = i + 1 ; woman = n ; } if ( i != 0 && Math . abs ( a - soldiers [ i - 1 ] ) < min ) { min = Math . abs ( a - soldiers [ i - 1 ] ) ; man = i + 1 ; woman = i ; } if ( i != 0 && Math . abs ( a - soldiers [ i + 1 ] ) < min ) { min = Math . abs ( a - soldiers [ i + 1 ] ) ; man = i + 1 ; woman = i + 2 ; } } System . out . println ( man + \" ▁ \" + woman ) ; } }", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = input . nextInt ( ) ; int minIndex = 0 , min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { if ( Math . abs ( a [ i ] - a [ ( i + 1 ) % n ] ) < min ) { minIndex = i ; min = Math . abs ( a [ i ] - a [ ( i + 1 ) % n ] ) ; } }   System . out . println ( minIndex + 1 + \" ▁ \" + ( ( minIndex + 1 ) % n + 1 ) ) ; input . close ( ) ; } }", "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ;   public class Reconnaissance2 { public static int [ ] solve ( int [ ] heights ) { int n = heights . length ; int min = Math . abs ( heights [ n - 1 ] - heights [ 0 ] ) ; int idx1 = 0 ; int idx2 = n - 1 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( Math . abs ( heights [ i ] - heights [ i + 1 ] ) < min ) { min = Math . abs ( heights [ i ] - heights [ i + 1 ] ) ; idx1 = i ; idx2 = i + 1 ; } } return new int [ ] { idx1 , idx2 } ; }   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] input = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { input [ i ] = sc . nextInt ( ) ; } int [ ] res = solve ( input ) ; System . out . print ( res [ 0 ] + 1 ) ; System . out . print ( \" ▁ \" ) ; System . out . println ( res [ 1 ] + 1 ) ; } }" ]
[ "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) m = abs ( l [ 0 ] - l [ - 1 ] ) a , b = 1 , nfor i in range ( n - 1 ) : if m > abs ( l [ i ] - l [ i + 1 ] ) : m = abs ( l [ i ] - l [ i + 1 ] ) a , b = i + 1 , i + 2 print ( a , b ) NEW_LINE", "n = int ( input ( ) )   min_a = Nonemin_b = Noneminimal = None   arr = [ int ( i ) for i in input ( ) . split ( ) ]   for i in range ( len ( arr ) - 1 ) : if minimal == None or abs ( arr [ i ] - arr [ i + 1 ] ) < minimal : minimal = abs ( arr [ i ] - arr [ i + 1 ] ) min_a = i + 1 min_b = i + 2   if abs ( arr [ - 1 ] - arr [ 0 ] ) < minimal : min_a = 1 min_b = n   print ( min_a , min_b ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = abs ( a [ 0 ] - a [ n - 1 ] ) l = [ 1 , n ] for i in range ( n - 1 ) : if abs ( a [ i ] - a [ i + 1 ] ) < m : m = abs ( a [ i ] - a [ i + 1 ] ) l . append ( i ) if len ( l ) == 2 : print ( * l ) else : print ( l [ len ( l ) - 1 ] + 1 , l [ len ( l ) - 1 ] + 2 ) NEW_LINE", "import sysn = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) k , l = 0 , 0 min = sys . maxsizefor i in range ( n ) : for j in range ( i , n + 1 ) : mi1 = abs ( arr [ ( j + 1 ) % n ] - arr [ j % n ] ) if mi1 < min : min = mi1 k , l = j % n , ( j + 1 ) % nprint ( k + 1 , l + 1 ) NEW_LINE", "def reconnaissance ( heights ) : l = [ ] m = [ ] for i in range ( len ( heights ) ) : l . append ( abs ( heights [ i ] - heights [ i - 1 ] ) ) minimum = min ( l ) for j in range ( len ( heights ) ) : if ( abs ( heights [ j ] - heights [ j - 1 ] ) == minimum ) : if ( ( j - 1 ) == - 1 ) : m . append ( ( len ( heights ) - 1 ) - ( j - 1 ) ) m . append ( j + 1 ) break else : m . append ( ( j - 1 ) + 1 ) m . append ( j + 1 ) break return ( m )   n = int ( input ( ) ) heights = list ( map ( int , input ( ) . split ( ) ) ) result = reconnaissance ( heights ) for i in result : print ( i , end = \" ▁ \" ) NEW_LINE" ]
codeforces_4_A
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int something = intInput ( \" \" ) ; if ( something == 2 ) { System . out . println ( \" NO \" ) ; } else if ( something % 2 == 0 ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } public static int intInput ( String n1 ) { Scanner something = new Scanner ( System . in ) ; System . out . print ( n1 ) ; int something2 = something . nextInt ( ) ; return something2 ; } }", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int w = sc . nextInt ( ) ; if ( w % 2 == 0 && w != 2 ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } }", "import java . util . Scanner ;   public class Watermelon { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int w = sc . nextInt ( ) ; if ( w > 2 ) { if ( w % 2 == 0 ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } else System . out . println ( \" NO \" ) ; sc . close ( ) ; } }", "import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int w = sc . nextInt ( ) ; if ( w % 2 == 0 && w != 2 ) out . println ( \" YES \" ) ; else out . println ( \" NO \" ) ;", "import java . util . * ;   public class watermelon { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int w = sc . nextInt ( ) ; if ( w > 0 && w <= 100 && w % 2 == 0 && w > 2 ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } }" ]
[ "n = int ( input ( ) ) if n <= 2 or ( ( n - 2 ) % 2 != 0 ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "kg = int ( input ( ) ) if kg <= 2 : print ( \" NO \" ) else : for n in range ( 2 , kg , 2 ) : if ( kg - n ) % 2 == 0 : print ( \" YES \" ) break elif n == kg - 1 or n == kg - 2 : print ( \" NO \" ) NEW_LINE", "kg = int ( input ( ) ) if kg <= 2 : print ( \" NO \" ) else : for n in range ( 2 , round ( kg / 2 ) + 1 , 2 ) : if ( kg - n ) % 2 == 0 : print ( \" YES \" ) break elif n == round ( kg / 2 ) or n == round ( kg / 2 ) - 1 : print ( \" NO \" ) NEW_LINE", "n = int ( input ( ) ) if n % 2 == 0 and n != 2 : print ( \" YES \" ) else : print ( \" NO \" )   NEW_LINE", "n = int ( input ( ) ) if n <= 2 or ( ( n - 2 ) % 2 != 0 ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE" ]
codeforces_1051_B
[ "import java . math . BigInteger ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigInteger n1 = sc . nextBigInteger ( ) ; BigInteger n2 = sc . nextBigInteger ( ) ; if ( n2 . subtract ( n1 ) . remainder ( new BigInteger ( \"2\" ) ) . intValue ( ) == 0 ) { System . out . println ( \" NO \" ) ; return ; } else { System . out . println ( \" YES \" ) ; } for ( BigInteger i = n1 ; i . compareTo ( n2 ) == - 1 ; i = i . add ( new BigInteger ( \"1\" ) ) ) { System . out . print ( i + \" ▁ \" ) ; i = i . add ( new BigInteger ( \"1\" ) ) ; System . out . print ( i + \" \\n \" ) ; } }   }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; System . out . println ( \" YES \" ) ; for ( long i = a ; i < b ; i += 2 ) { System . out . println ( Long . toString ( i ) + \" ▁ \" + Long . toString ( i + 1 ) ) ; }   } }", "import java . util . * ; public class Output { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; System . out . println ( \" YES \" ) ; for ( long i = a ; i < b ; i += 2 ) { System . out . println ( Long . toString ( i ) + \" ▁ \" + Long . toString ( i + 1 ) ) ; }   } }", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; long a = scn . nextLong ( ) ; long b = scn . nextLong ( ) ; System . out . println ( \" YES \" ) ; for ( long i = a ; i <= b ; i += 2 ) { System . out . println ( i + \" ▁ \" + ( i + 1 ) ) ; } } }", "import java . math . BigInteger ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigInteger l = sc . nextBigInteger ( ) ; BigInteger r = sc . nextBigInteger ( ) ; if ( ( r . add ( l ) . add ( new BigInteger ( \"1\" ) ) ) . mod ( new BigInteger ( \"2\" ) ) . equals ( new BigInteger ( \"0\" ) ) ) { System . out . println ( \" YES \" ) ; for ( BigInteger i = l ; i . compareTo ( r . add ( new BigInteger ( \"1\" ) ) ) < 0 ; i = i . add ( new BigInteger ( \"2\" ) ) ) { System . out . println ( i + \" ▁ \" + i . add ( new BigInteger ( \"1\" ) ) ) ; } } else { System . out . println ( \" NO \" ) ; } } }" ]
[ "l , r = ( int ( i ) for i in input ( ) . split ( ) ) print ( ' YES ' ) for i in range ( l , r , 2 ) : print ( i , i + 1 ) NEW_LINE", "l , r = list ( map ( int , input ( ) . split ( ) ) )   a = [ ] i = lwhile i <= r - 1 : a . append ( [ i , i + 1 ] ) i += 2   if a : print ( ' YES ' ) for i in a : print ( f ' { i [ 0 ] } ▁ { i [ 1 ] } ' ) else : print ( ' NO ' ) NEW_LINE", "import itertoolsimport bisectimport mathfrom collections import * import osimport sysfrom io import BytesIO , IOBase   ii = lambda : int ( input ( ) ) lmii = lambda : list ( map ( int , input ( ) . split ( ) ) ) slmii = lambda : sorted ( map ( int , input ( ) . split ( ) ) ) li = lambda : list ( input ( ) ) mii = lambda : map ( int , input ( ) . split ( ) ) msi = lambda : map ( str , input ( ) . split ( ) )     def main ( ) : NEW_LINE", "l , r = map ( int , input ( ) . split ( ) ) print ( ' YES ' ) for i in range ( l , r + 1 , 2 ) : print ( i , i + 1 ) NEW_LINE", "l , r = map ( int , input ( ) . split ( ) ) print ( ' YES ' ) for i in range ( r - l + 1 ) : if i % 2 == 0 : print ( l + i , l + i + 1 ) NEW_LINE" ]
codeforces_686_B
[ "import java . io . BufferedReader ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class robber {   public static void main ( String [ ] args ) {", "import java . util . * ; import java . io . * ;   public class B686 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) array [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n - i - 1 ; j ++ ) if ( array [ j + 1 ] < array [ j ] ) { int temp = array [ j + 1 ] ; array [ j + 1 ] = array [ j ] ; array [ j ] = temp ; pw . println ( ( j + 1 ) + \" ▁ \" + ( j + 2 ) ) ; } } pw . flush ( ) ; }   public static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream system ) { br = new BufferedReader ( new InputStreamReader ( system ) ) ; }   public Scanner ( String file ) throws Exception { br = new BufferedReader ( new FileReader ( file ) ) ; }   public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; }   public String nextLine ( ) throws IOException { return br . readLine ( ) ; }   public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; }   public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; }   public char nextChar ( ) throws IOException { return next ( ) . charAt ( 0 ) ; }   public Long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; }   public boolean ready ( ) throws IOException { return br . ready ( ) ; }   public void waitForInput ( ) throws InterruptedException { Thread . sleep ( 3000 ) ; } } }", "import java . util . Scanner ;   public class Contest { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int test = input . nextInt ( ) ; int a [ ] = new int [ test ] ; for ( int i = 0 ; i < test ; i ++ ) { a [ i ] = input . nextInt ( ) ; } boolean swap = true ; while ( swap ) { swap = false ; for ( int i = 0 ; i < test - 1 ; i ++ ) { if ( a [ i ] > a [ i + 1 ] ) { int temp = a [ i ] ; a [ i ] = a [ i + 1 ] ; a [ i + 1 ] = temp ; System . out . println ( ( i + 1 ) + \" ▁ \" + ( i + 2 ) ) ; swap = true ; } } } } }", "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 . 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 ) ; }   public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } if ( n == 1 ) { System . out . println ( \" \" ) ; } else if ( check ( a ) ) { System . out . println ( \" \" ) ; } else { StringBuilder ans = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n - 1 ; j ++ ) { if ( a [ j ] > a [ j + 1 ] ) { ans . append ( ( j + 1 ) + \" ▁ \" + ( j + 2 ) + \" \\n \" ) ; int temp = a [ j ] ; a [ j ] = a [ j + 1 ] ; a [ j + 1 ] = temp ; } } } System . out . println ( ans ) ; } }   private static boolean check ( int [ ] a ) { boolean ok = true ; for ( int i = 0 ; i < a . length - 1 ; i ++ ) { if ( a [ i ] > a [ i + 1 ] ) { ok = false ; break ; } } return ok ; }   }" ]
[ "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   for i in range ( n - 1 , 0 , - 1 ) : for j in range ( i ) : if a [ j ] > a [ j + 1 ] : a [ j ] , a [ j + 1 ] = a [ j + 1 ] , a [ j ] print ( j + 1 , j + 2 ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : for j in range ( n - 1 ) : if ( a [ j ] > a [ j + 1 ] ) : a [ j ] , a [ j + 1 ] = a [ j + 1 ] , a [ j ] print ( j + 1 , j + 2 ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n - 1 , 0 , - 1 ) : for j in range ( i ) : if a [ j + 1 ] < a [ j ] : a [ j ] , a [ j + 1 ] = a [ j + 1 ] , a [ j ] print ( j + 1 , j + 2 ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )     for i in reversed ( range ( len ( arr ) ) ) : for j in range ( 1 , i + 1 ) : if arr [ j - 1 ] > arr [ j ] : print ( j , j + 1 ) arr [ j - 1 ] , arr [ j ] = arr [ j ] , arr [ j - 1 ]       NEW_LINE", "def solve ( n , seq ) : outer = 0 while outer < n : inner = 0 while inner < n - outer - 1 : if seq [ inner ] > seq [ inner + 1 ] : seq [ inner ] , seq [ inner + 1 ] = seq [ inner + 1 ] , seq [ inner ] print ( inner + 1 , inner + 2 ) inner += 1 outer += 1       n = int ( input ( ) ) seq = list ( map ( int , input ( ) . split ( ) ) )     solve ( n , seq ) NEW_LINE" ]
codeforces_1442_A
[ "  import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws java . lang . Exception {", "import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) throws Exception { String yes = \" YES \" ; String no = \" NO \" ; Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ;   for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int [ ] nums = new int [ n ] ; int max = 0 ;   for ( int j = 0 ; j < n ; j ++ ) { nums [ j ] = sc . nextInt ( ) ;   if ( j > 0 ) { max += Math . max ( 0 , nums [ j - 1 ] - nums [ j ] ) ; } }   System . out . println ( ( max <= nums [ 0 ] ) ? yes : no ) ; } } }", "import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . util . ArrayList ; import java . util . Random ; import java . util . StringTokenizer ;   public class ExtremeSub { static final int MAXN = 1000_006 ; static final long MOD = ( long ) 1e9 + 7 ; public static void main ( String [ ] args ) throws IOException { MyScanner s = new MyScanner ( ) ; Print p = new Print ( ) ; int t = s . nextInt ( ) ; while ( t -- > 0 ) { int n = s . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = s . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { sum += Math . max ( 0 , arr [ i ] - arr [ i + 1 ] ) ; } if ( sum <= arr [ 0 ] ) p . println ( \" YES \" ) ; else p . println ( \" NO \" ) ; } p . close ( ) ; } public static class Pair implements Comparable < Pair > { int first ; int second ; public Pair ( int a , int b ) { this . first = a ; this . second = b ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + first ; result = prime * result + second ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) return true ; if ( obj == null ) return false ; if ( getClass ( ) != obj . getClass ( ) ) return false ; Pair other = ( Pair ) obj ; if ( first != other . first ) return false ; if ( second != other . second ) return false ; return true ; } @ Override public int compareTo ( Pair o ) {" ]
[ "inf = 10 ** 9 NEW_LINE def solve ( ) : l = inf NEW_LINE r = - 1 NEW_LINE for a in aa : l = min ( a , l , a - r ) NEW_LINE r = a - l NEW_LINE if l < 0 or r < 0 : return \" NO \" NEW_LINE return \" YES \" NEW_LINE for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE aa = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( solve ( ) ) NEW_LINE", "import java . util . Scanner ;   public NEW_LINE class Main {   public static void main ( String [ ] args ) throws Exception { String yes = \" YES \" ; String no = \" NO \" ; Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ;   for ( int i = 0 ; i < t ; i + + ) { int n = sc . nextInt ( ) ; int [ ] nums = new int [ n ] ; int max = 0 ;   for ( int j = 0 ; j < n ; j + + ) { nums [ j ] = sc . nextInt ( ) ;   if ( j > 0 ) { max += Math . max ( 0 , nums [ j - 1 ] - nums [ j ] ) ; } }   System . out . println ( ( max <= nums [ 0 ] ) ? yes : no ) ; } } } NEW_LINE", "from sys import stdin   t = int ( stdin . readline ( ) )   for case in range ( t ) : n = int ( stdin . readline ( ) ) NEW_LINE a = [ int ( x ) for x in stdin . readline ( ) . split ( ) ]   left = [ a [ 0 ] ] NEW_LINE right = [ a [ - 1 ] ]   for x in range ( 1 , n ) : left . append ( min ( left [ - 1 ] , a [ x ] ) ) NEW_LINE right . append ( min ( right [ - 1 ] , a [ - x - 1 ] ) )   right = right [ : : - 1 ]   NEW_LINE", "import sysfrom NEW_LINE bisect NEW_LINE import bisect_left   input = lambda : sys . stdin . readline ( ) . rstrip ( \" \\n \" )     for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE rd = 0 NEW_LINE ld = 0 NEW_LINE for i in range ( 1 , n ) : if NEW_LINE a [ i ] > a [ i - 1 ] : rd += a [ i ] - a [ i - 1 ] else : ld += a [ i - 1 ] - a [ i ] NEW_LINE if ld <= a [ 0 ] and rd <= a [ - 1 ] : print ( ' YES ' )   else : print ( ' NO ' ) NEW_LINE", "import sysfrom NEW_LINE bisect NEW_LINE import bisect_left   input = lambda : sys . stdin . readline ( ) . rstrip ( \" \\n \" )     for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE rd = 0 NEW_LINE ld = 0 NEW_LINE for i in range ( 1 , n ) : if NEW_LINE a [ i ] > a [ i - 1 ] : rd += a [ i ] - a [ i - 1 ] else : ld += a [ i - 1 ] - a [ i ] NEW_LINE if ld <= a [ 0 ] and rd <= a [ - 1 ] : print ( ' YES ' )   else : print ( ' NO ' ) NEW_LINE" ]
codeforces_16_B
[ "import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ;   public class B16 {   static int mod = ( int ) ( 1e9 + 7 ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader in = new FastReader ( ) ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String args [ ] ) {   int tc = 1 ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class newprac { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tt = 1 ;", "import java . util . * ;   public class StackBracket { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;", "import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ;   public class BurglarAndMatches { public static void main ( String [ ] args ) {" ]
[ "''' Jana ▁ Goodman 16B ▁ Burglar    ''' SPACE = ' ▁ '   def answer ( n , arr ) : matches , boxes = 0 , n for b , a in arr : if a <= boxes : matches += a * b boxes -= a else : return matches + boxes * b return matches   if __name__ == ' _ _ main _ _ ' : n , m = map ( int , input ( ) . split ( SPACE ) ) containers = [ ] for _ in range ( 0 , m ) : a , b = map ( int , input ( ) . split ( SPACE ) ) containers . append ( ( b , a ) ) containers . sort ( ) containers . reverse ( ) print ( answer ( n , containers ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) lst = [ ] for i in range ( m ) : lst . append ( list ( map ( int , input ( ) . split ( ) ) ) ) lst . sort ( key = lambda x : x [ 1 ] ) lst . reverse ( ) count = 0 for i in lst : if n <= i [ 0 ] : count += ( n * i [ 1 ] ) break else : count += ( i [ 0 ] * i [ 1 ] ) n -= i [ 0 ] if n == 0 : break print ( count ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) ai = [ ] k = 0 v = 0 for i in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) ai . append ( [ b , a ] ) ai = sorted ( ai ) [ : : - 1 ] for i in ai : v = min ( i [ 1 ] , n ) n -= v k += ( v * i [ 0 ] ) print ( k ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) arr = [ ] for i in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) arr . append ( ( a , b ) ) arr . sort ( key = lambda x : x [ 1 ] , reverse = True ) rem = nres = 0 for i , j in arr : if rem < 1 : break if i >= rem : res += rem * j rem -= n else : res += i * j rem -= iprint ( res ) NEW_LINE" ]
codeforces_490_B
[ "import java . io . * ; import java . math . * ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 100000007 ;   private static final int MAXN = 300005 ; private static final int MAXA = 1000007 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;", "import java . io . * ; import java . math . * ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 100000007 ;   private static final int MAXN = 300005 ; private static final int MAXA = 1000007 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;", "  import java . util . Arrays ; import java . util . Scanner ;   import java . util . Hashtable ; import java . util . List ; import java . util . Map ;   public class Queue_B {   public static void main ( String [ ] args ) {   Scanner console = new Scanner ( System . in ) ;   int n = console . nextInt ( ) ; int [ ] pArr = new int [ n ] ;   int secN = 1 , lsecN = 0 , beforeN = 0 , lbeforeN = 0 , i , j ; Hashtable < Integer , Integer > hashtableF = new Hashtable < > ( ) ; Hashtable < Integer , Integer > hashtableB = new Hashtable < > ( ) ;   while ( n -- > 0 ) { i = console . nextInt ( ) ; j = console . nextInt ( ) ; hashtableF . put ( i , j ) ; hashtableB . put ( j , i ) ; } for ( Map . Entry < Integer , Integer > entry : hashtableF . entrySet ( ) ) { if ( ! hashtableB . containsKey ( entry . getKey ( ) ) ) { lbeforeN = entry . getKey ( ) ; pArr [ lsecN ] = lbeforeN ; lsecN += 2 ; break ; } } for ( int x = 0 ; x <= pArr . length - 1 ; x += 2 ) { if ( lsecN <= pArr . length - 1 ) { pArr [ lsecN ] = hashtableF . get ( lbeforeN ) ; lbeforeN = pArr [ lsecN ] ; } if ( secN <= pArr . length - 1 ) { pArr [ secN ] = hashtableF . get ( beforeN ) ; beforeN = pArr [ secN ] ; }   secN += 2 ; lsecN += 2 ; System . out . print ( pArr [ x ] ) ; if ( x + 1 <= pArr . length - 1 ) { System . out . print ( \" ▁ \" + pArr [ x + 1 ] ) ; } if ( x != pArr . length - 1 ) { System . out . print ( \" ▁ \" ) ; } } } }" ]
[ "n = int ( input ( ) ) dic = { } for i in range ( n ) : ( a , b ) = [ int ( j ) for j in input ( ) . split ( ' ▁ ' ) ] dic [ a ] = b ans = [ ] ans . append ( 0 ) val = set ( dic . values ( ) ) NEW_LINE", "n = int ( input ( ) ) s = dict ( ) for i in range ( n ) : ( a , b ) = [ int ( element ) for element in input ( ) . split ( ' ▁ ' ) ] s [ a ] = b v = [ ] v . append ( 0 ) t = set ( s . values ( ) ) for key in s . keys ( ) : if ( key not in t ) : v . append ( key ) breakfor i in range ( n - 1 ) : v . append ( s [ v [ - 2 ] ] ) v = [ str ( elem ) for elem in v ] print ( ' ▁ ' . join ( v [ 1 : ] ) ) NEW_LINE", "n = int ( input ( ) ) s = dict ( ) for i in range ( n ) : ( a , b ) = [ int ( element ) for element in input ( ) . split ( ' ▁ ' ) ] s [ a ] = b v = [ ] v . append ( 0 ) t = set ( s . values ( ) ) for key in s . keys ( ) : if ( key not in t ) : v . append ( key ) breakfor i in range ( n - 1 ) : v . append ( s [ v [ - 2 ] ] ) v = [ str ( elem ) for elem in v ] print ( ' ▁ ' . join ( v [ 1 : ] ) ) NEW_LINE", "import sys , os , ioinput = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readlinen = int ( input ( ) ) d = { } ddd = { } dd = { } for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) d [ a ] = b dd [ b ] = a if ( a in ddd ) : ddd . pop ( a ) else : ddd [ a ] = 1 if ( b in ddd ) : ddd . pop ( b ) else : ddd [ b ] = - 1   temp = 0 ind = 1 a = [ 0 ] * nwhile ( temp in d ) : temp = d [ temp ] if ( temp == 0 ) : break a [ ind ] = temp ind += 2 if ( len ( a ) & 1 ) : ind = len ( a ) - 1 temp = 0 tempp = 0 for x in ddd : if ( ddd [ x ] == - 1 ) : temp = x else : tempp = x NEW_LINE" ]
codeforces_551_B
[ "import java . awt . * ; import java . io . * ; import java . util . * ;   public class Abc { public static void main ( String [ ] args ) throws Exception { FastReader sc = new FastReader ( ) ; String a = sc . next ( ) , b = sc . next ( ) , c = sc . next ( ) ; int cnta [ ] = new int [ 26 ] , cntb [ ] = new int [ 26 ] , cntc [ ] = new int [ 26 ] ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { cnta [ a . charAt ( i ) - ' a ' ] ++ ; } for ( int i = 0 ; i < b . length ( ) ; i ++ ) { cntb [ b . charAt ( i ) - ' a ' ] ++ ; } for ( int i = 0 ; i < c . length ( ) ; i ++ ) { cntc [ c . charAt ( i ) - ' a ' ] ++ ; } int maxb = Integer . MAX_VALUE ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( cntb [ i ] == 0 ) continue ; maxb = Math . min ( cnta [ i ] / cntb [ i ] , maxb ) ; } int ansb = 0 , ansc = 0 ; for ( int i = 0 ; i <= maxb ; i ++ ) { int cc = Integer . MAX_VALUE ; for ( int j = 0 ; j < 26 ; j ++ ) { if ( cntc [ j ] > 0 ) { cc = Math . min ( cc , ( cnta [ j ] - i * cntb [ j ] ) / cntc [ j ] ) ; } } if ( ansb + ansc < i + cc ) { ansb = i ; ansc = cc ; } } StringBuilder sb = new StringBuilder ( ) ;" ]
[ "from collections import defaultdict     def find_max_possible_substring ( a , a_char_counts , char_counts ) : max_count_of_sub = len ( a ) for char , count in char_counts . items ( ) : max_count_of_sub = min ( max_count_of_sub , a_char_counts [ char ] // char_counts [ char ] )   return max_count_of_sub     def get_optimal_count ( a , a_orig_char_counts , max_count_of_first , first_char_counts , second_char_counts ) : max = 0 count_of_first = 0 count_of_second = 0 for i in range ( max_count_of_first + 1 ) : a_char_counts = a_orig_char_counts . copy ( ) for char , count in first_char_counts . items ( ) : a_char_counts [ char ] -= count * i   remaining_count_of_second = find_max_possible_substring ( a , a_char_counts , second_char_counts )   count = remaining_count_of_second + i if max < count : max = count count_of_first = i count_of_second = remaining_count_of_second   return count_of_first , count_of_second     def get_result ( a , a_char_counts , first , max_count_of_first , first_char_counts , second , second_char_counts ) : optimal_count_of_first , optimal_count_of_second = get_optimal_count ( a , a_char_counts , max_count_of_first , first_char_counts , second_char_counts ) result = \" \" result += first * optimal_count_of_first   for char , count in first_char_counts . items ( ) : a_char_counts [ char ] -= count * optimal_count_of_first   if optimal_count_of_second : result += second * optimal_count_of_second for char , count in second_char_counts . items ( ) : a_char_counts [ char ] -= count * optimal_count_of_second   for char , count in a_char_counts . items ( ) : result += char * count   return result     def find_k ( a , b , c ) : a_char_counts = defaultdict ( lambda : 0 ) b_char_counts = defaultdict ( lambda : 0 ) c_char_counts = defaultdict ( lambda : 0 )   for char in a : a_char_counts [ char ] += 1   for char in b : b_char_counts [ char ] += 1   for char in c : c_char_counts [ char ] += 1   max_count_of_b = find_max_possible_substring ( a , a_char_counts , b_char_counts )   max_count_of_c = find_max_possible_substring ( a , a_char_counts , c_char_counts )   if max_count_of_b >= max_count_of_c : result = get_result ( a , a_char_counts , b , max_count_of_b , b_char_counts , c , c_char_counts ) else : result = get_result ( a , a_char_counts , c , max_count_of_c , c_char_counts , b , b_char_counts )   return result     if __name__ == ' _ _ main _ _ ' : a_in = input ( ) b_in = input ( ) c_in = input ( )   print ( find_k ( a_in , b_in , c_in ) ) NEW_LINE", "contest = Trueif not contest : fin = open ( \" in \" , \" r \" ) inp = input if contest else lambda : fin . readline ( ) [ : - 1 ] read = lambda : tuple ( map ( int , inp ( ) . split ( ) ) )   cstr = lambda s : dict ( [ [ v , s . count ( v ) ] for v in set ( s ) ] )   s , a , b = inp ( ) , inp ( ) , inp ( ) ks , ka , kb = cstr ( s ) , cstr ( a ) , cstr ( b )   def suka ( ks , kx , minusV , minusK ) : ans = \" \" d = 10 ** 10 for k in kx : if not k in ks : return 0 c = ks [ k ] if k in minusV : c -= minusV [ k ] * minusK d = min ( max ( c , 0 ) // kx [ k ] , d ) return d   da = suka ( ks , ka , { } , 0 ) mx = 0 ans = ( - 1 , - 1 ) for dai in range ( 0 , da + 1 ) : db = suka ( ks , kb , ka , dai ) if dai + db >= mx : ans = ( dai , db ) mx = dai + dbfor k in ks : if k in ka : ks [ k ] -= ans [ 0 ] * ka [ k ] if k in kb : ks [ k ] -= ans [ 1 ] * kb [ k ] print ( ans [ 0 ] * a + ans [ 1 ] * b + \" \" . join ( [ str ( k * ks [ k ] ) for k in ks ] ) ) NEW_LINE", "from collections import Counterfrom copy import deepcopy   def getMax ( c1 , c2 ) : ret = 1 << 32 for k in c2 . keys ( ) : ret = min ( ret , c1 [ k ] // c2 [ k ] ) return ret   a , b , c = input ( ) , input ( ) , input ( ) counterA , counterB , counterC = Counter ( a ) , Counter ( b ) , Counter ( c )   cntB , cntC = 0 , getMax ( counterA , counterC ) counterAA = deepcopy ( counterA ) cntBB = 0 while counterAA & counterB == counterB : cntBB += 1 counterAA -= counterB cntCC = getMax ( counterAA , counterC ) if cntB + cntC < cntBB + cntCC : cntB , cntC = cntBB , cntCC   ans = b * cntB + c * cntCans += ' ' . join ( ( counterA - Counter ( ans ) ) . elements ( ) ) print ( ans )         NEW_LINE", "alpha = \" abcdefghijklmnopqrstuvwxyz \" dict_alpha = { j : i for i , j in enumerate ( alpha ) }   def freq ( s ) : d = [ 0 ] * len ( alpha ) for c in s : d [ dict_alpha [ c ] ] += 1 return d   sa = input ( ) sb = input ( ) sc = input ( )   cntA = freq ( sa ) cpy_cntA = cntA . copy ( ) cntB = freq ( sb ) cntC = freq ( sc )   def highest ( d ) : m = len ( sa ) for i in range ( 26 ) : if d [ i ] == 0 : continue m = min ( m , cntA [ i ] // d [ i ] ) return m   m = ( 0 , 0 ) n = highest ( cntB ) for i in range ( n + 1 ) : add = highest ( cntC ) if i + add > sum ( m ) : m = ( i , add ) for j in range ( 26 ) : cntA [ j ] -= cntB [ j ]   res = [ sb * m [ 0 ] ] + [ sc * m [ 1 ] ] for i in range ( 26 ) : cpy_cntA [ i ] -= cntB [ i ] * m [ 0 ] + cntC [ i ] * m [ 1 ] res . append ( alpha [ i ] * cpy_cntA [ i ] ) print ( \" \" . join ( res ) ) NEW_LINE", "from collections import Counterfrom collections import defaultdictimport randomimport string     a = input ( ) b = input ( ) c = input ( )   NEW_LINE" ]
codeforces_999_A
[ "import java . util . ArrayList ; import java . util . Scanner ;   public class twentyone {   public static void main ( String [ ] args ) {", "import java . util . * ; public class cc { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; int p1 = 0 , p2 = n - 1 , c = 0 ; while ( p1 <= p2 ) { if ( p1 == n || p2 == - 1 || ( a [ p1 ] > k && a [ p2 ] > k ) ) break ; if ( p1 < n && a [ p1 ] <= k ) { c ++ ; p1 ++ ; } else if ( p2 > 0 && a [ p2 ] <= k ) { c ++ ; p2 -- ; } } System . out . println ( c ) ; } }", "import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } if ( arr [ 0 ] > k && arr [ n - 1 ] > k ) System . out . println ( \"0\" ) ; else { int i = 0 , j = n - 1 ; while ( i < j ) { if ( arr [ i ] > k && arr [ j ] > k ) { break ; } if ( arr [ i ] <= k ) { i ++ ; count ++ ; } else if ( arr [ j ] <= k ) { j -- ; count ++ ; } } if ( arr [ i ] <= k || arr [ j ] <= k ) count ++ ; System . out . println ( count ) ; } } }", "import java . util . Scanner ;   public class Manisha {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count1 = 0 ; int count2 = 0 ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int low = 0 ; int high = n - 1 ; while ( low <= high ) { if ( a [ low ] <= k ) { count1 ++ ; low ++ ; } else if ( a [ high ] <= k ) { count2 ++ ; high -- ; } else { break ; } } System . out . println ( count1 + count2 ) ; } }" ]
[ "n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) i = 0j = n - 1 c = 0 while ( i <= j and ( a [ i ] <= k or a [ j ] <= k ) ) : if ( a [ i ] <= k ) : i += 1 c += 1 if ( a [ j ] <= k and i < j ) : j -= 1 c += 1 print ( c ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) solved = 0   while a [ 0 ] <= k or a [ len ( a ) - 1 ] <= k : if a [ 0 ] <= k : solved += 1 a = a [ 1 : len ( a ) ] elif a [ - 1 ] <= k : solved += 1 a = a [ 0 : len ( a ) - 1 ] if len ( a ) == 0 : a = [ k + 1 ] print ( solved ) NEW_LINE", "N , S = map ( int , input ( ) . split ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) Score = 0 while ( len ( A ) > 0 and ( A [ 0 ] <= S or A [ len ( A ) - 1 ] <= S ) ) : if A [ 0 ] <= S : Score += 1 A . pop ( 0 ) else : Score += 1 A . pop ( ) print ( Score ) NEW_LINE", "n , k = ( int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ) weight = [ int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ] sum = 0 for i in range ( 0 , n ) : if weight [ i ] <= k : sum = sum + 1 else : breakif sum == n : print ( sum ) else : for i in range ( n - 1 , 0 , - 1 ) : if weight [ i ] <= k : sum = sum + 1 else : break print ( sum )   NEW_LINE", "import renumber1 = str ( input ( ) ) arr = str ( input ( ) ) z = re . findall ( r \" \\d + \" , number1 ) c = [ int ( b ) for b in z ] x = re . findall ( r \" \\d + \" , arr ) y = [ int ( a ) for a in x ] lr = 0 rl = 0 for i in range ( len ( y ) ) : if y [ i ] <= c [ 1 ] : lr += 1 else : breakfor i in reversed ( range ( len ( y ) ) ) : if y [ i ] <= c [ 1 ] : rl += 1 else : break   print ( min ( lr + rl , c [ 0 ] ) ) NEW_LINE" ]
codeforces_1256_A
[ "import java . util . * ;   public class Solve {   static Scanner scan = new Scanner ( System . in ) ;   public static void solve ( long a , long b , long n , long s ) {   if ( ( a * n ) + b >= s ) { if ( s % n <= b ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } else { System . out . println ( \" NO \" ) ; } }   public static void main ( String [ ] args ) {   int t = scan . nextInt ( ) ;   while ( t -- > 0 ) {   long n = scan . nextLong ( ) ; long a = scan . nextLong ( ) ; long b = scan . nextLong ( ) ; long s = scan . nextLong ( ) ;   solve ( n , a , b , s ) ; } } }", "import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int q = sc . nextInt ( ) ; while ( q -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int k = Math . min ( s / n , a ) ; k = s - k * n ; if ( k <= b ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } } }" ]
[ "for _ in range ( int ( input ( ) ) ) : L = list ( map ( int , input ( ) . split ( ) ) ) x = L [ - 1 ] y = L [ - 2 ] if ( x // y ) <= L [ 0 ] : if ( x % y ) <= L [ 1 ] : print ( \" YES \" ) else : print ( \" NO \" ) else : if ( y * ( ( x // y ) - L [ 0 ] ) ) + ( x % y ) > L [ 1 ] : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "for i in range ( int ( input ( ) ) ) : a , b , n , s = map ( int , input ( ) . split ( ) ) if ( s <= a * n + b and s % n <= b ) : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : a , b , n , s = map ( int , input ( ) . split ( ) ) if s <= b : print ( \" YES \" ) else : if ( n * a ) >= s : if s % n <= b : print ( \" YES \" ) else : print ( \" NO \" ) else : if ( s - n * a ) <= b : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "q = int ( input ( ) ) for line in range ( q ) : a , b , n , s = list ( map ( int , input ( ) . split ( ) ) ) ans = s // n if ans <= a : s -= ans * n else : s -= a * n if s <= b : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE" ]
codeforces_908_B
[ "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class cf908b {", "import java . util . * ; import java . io . * ; import java . math . * ;   public class B { public static void main ( String omkar [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; int M = Integer . parseInt ( st . nextToken ( ) ) ; char [ ] [ ] grid = new char [ N ] [ M ] ; for ( int i = 0 ; i < N ; i ++ ) grid [ i ] = infile . readLine ( ) . toCharArray ( ) ; String input = infile . readLine ( ) ; int [ ] arr = new int [ input . length ( ) ] ; int Nn = arr . length ; for ( int i = 0 ; i < Nn ; i ++ ) arr [ i ] = Integer . parseInt ( input . substring ( i , i + 1 ) ) ;", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  " ]
[ "n , m = map ( int , input ( ) . split ( ) ) p = [ list ( input ( ) ) for _ in range ( n ) ] x , y = 0 , 0 for i in range ( n ) : for j in range ( m ) : if p [ i ] [ j ] == ' S ' : x = i y = j   st = input ( ) command = ( ' D ' , ' L ' , ' U ' , ' R ' ) d_x = { ' D ' : lambda x : x , ' L ' : lambda x : x - 1 , ' R ' : lambda x : x + 1 , ' U ' : lambda x : x , }   d_y = { ' D ' : lambda y : y + 1 , ' L ' : lambda y : y , ' R ' : lambda y : y , ' U ' : lambda y : y - 1 , } count = 0 for el1 in command : NEW_LINE", "def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( )   from heapq import heappop , heappushfrom bisect import * from collections import dequefrom math import * from itertools import permutationsdx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE", "def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) from heapq import heappop , heappushfrom bisect import * from collections import dequefrom math import * from itertools import permutationsdx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE", "def Diff ( li1 , li2 ) : li_dif = [ i for i in li1 + li2 if i not in li1 or i not in li2 ] return li_difn , m = list ( map ( int , input ( ) . split ( ) ) ) g = [ ] for i in range ( n ) : g . append ( input ( ) ) p = input ( ) x , y , f = 0 , 0 , 0 for i in range ( n ) : for j in range ( m ) : if g [ i ] [ j ] == ' S ' : x , y = i , j f = 1 break if f : breakans = 0 d = { } l = [ ' l ' , ' r ' , ' u ' , ' d ' ] for i in l : d [ '0' ] = i l1 = Diff ( l , [ i ] ) for j in l1 : d [ '1' ] = j l2 = Diff ( l , [ i , j ] ) for k in l2 : d [ '2' ] = k l3 = Diff ( l , [ i , j , k ] ) for t in l3 : d [ '3' ] = t f = 0 a , b = x , y for pt in p : if d [ pt ] == ' l ' : a = a - 1 elif d [ pt ] == ' r ' : a = a + 1 elif d [ pt ] == ' u ' : b = b + 1 elif d [ pt ] == ' d ' : b = b - 1 if ( a < 0 ) or ( a >= n ) or ( b < 0 ) or ( b >= m ) : break elif g [ a ] [ b ] == ' # ' : break elif g [ a ] [ b ] == ' E ' : f = 1 break if f : ans = ans + 1 print ( ans ) NEW_LINE", "from itertools import * n , m = map ( int , input ( ) . split ( ) ) p = [ [ 0 ] * ( m + 1 ) for i in range ( n ) ] + [ [ 0 ] * m ] for i in range ( n ) : for j , q in enumerate ( input ( ) ) : if q == ' S ' : a , b = i , j p [ i ] [ j ] = ' # E ' . find ( q ) s = list ( map ( int , input ( ) ) ) def f ( d ) : x , y = a , b for k in s : i , j = d [ k ] x += i y += j if p [ x ] [ y ] + 1 : return p [ x ] [ y ] return 0 t = [ ( 1 , 0 ) , ( - 1 , 0 ) , ( 0 , 1 ) , ( 0 , - 1 ) ] print ( sum ( f ( d ) for d in permutations ( t ) ) ) NEW_LINE" ]
codeforces_1215_B
[ "  import java . lang . reflect . Array ; import java . text . CollationElementIterator ; import java . util . * ; import java . util . Map . Entry ; import java . io . * ; import java . lang . Math . * ; import java . math . BigInteger ;   import static java . lang . Math . * ; import static java . lang . System . * ; import static java . util . Arrays . fill ; import static java . util . Arrays . spliterator ; public class ContestMain implements Runnable { private static Reader in = new Reader ( ) ; private static StringBuilder ans = new StringBuilder ( ) ; private static long MOD = ( long ) ( 1e9 + 7 ) ; private static final int N = ( int ) ( 2e5 + 7 ) ;", "import java . util . * ; import java . io . * ; import java . math . * ;   public class First {   public static void process ( ) throws IOException { int n = ni ( ) ; int dp [ ] [ ] = new int [ n + 1 ] [ 2 ] ; long pp = 0l ; long np = 0l ; for ( int i = 1 ; i <= n ; i ++ ) { int a = ni ( ) ; if ( a > 0 ) { dp [ i ] [ 0 ] = 1 + dp [ i - 1 ] [ 0 ] ; dp [ i ] [ 1 ] = dp [ i - 1 ] [ 1 ] ;   } else { dp [ i ] [ 0 ] = dp [ i - 1 ] [ 1 ] ; dp [ i ] [ 1 ] = 1 + dp [ i - 1 ] [ 0 ] ; } pp += dp [ i ] [ 0 ] ; np += dp [ i ] [ 1 ] ; } pn ( np + \" ▁ \" + pp ) ;    }     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 TheNumberOfProducts { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] nums = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { nums [ i ] = scanner . nextInt ( ) ; } scanner . close ( ) ; long totalCount = 0 ; for ( int i = 1 ; i <= nums . length ; i ++ ) { totalCount += i ; } long negativeCount = findSolution ( nums ) ; long positiveCount = totalCount - negativeCount ; System . out . print ( negativeCount + \" ▁ \" + positiveCount ) ; } private static long findSolution ( int [ ] nums ) { long [ ] prevValues = new long [ 2 ] ; int prevPointer = 0 ; long count = 0 ; int precedingCount = 0 ; for ( int i = 0 ; i < nums . length ; i ++ ) { int val = nums [ i ] ; if ( val > 0 ) { precedingCount ++ ; count += prevValues [ prevPointer ] ; continue ; } long thisCount = 1 + precedingCount + prevValues [ ( prevPointer + 1 ) % 2 ] ; count += thisCount ; precedingCount = 0 ; prevValues [ ( prevPointer + 1 ) % 2 ] = thisCount ; prevPointer = ( prevPointer + 1 ) % 2 ; } return count ; } }", "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 n = input . nextInt ( ) ; long a [ ] = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { long value = input . nextLong ( ) ; a [ i ] = ( value < 0 ) ? 1L : 0 ; } for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] += a [ i - 1 ] ; }" ]
[ "from sys import stdininput = stdin . readlinen = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) e , z , ans , o = 1 , 0 , 0 , 0 for i in range ( n ) : z += ( a [ i ] < 0 ) if z % 2 : ans += e else : ans += o e += z % 2 == 0 o += z % 2 print ( ans , n * ( n + 1 ) // 2 - ans ) NEW_LINE", "import sysinput = sys . stdin . readline   '''   '''   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a = [ 1 if ai > 0 else - 1 for ai in a ]   pre_prod = [ 1 if a [ 0 ] > 0 else - 1 ] pre_sum_pos = [ 1 if a [ 0 ] > 0 else 0 ] for i in range ( 1 , n ) : pre_prod . append ( pre_prod [ - 1 ] * a [ i ] ) if pre_prod [ - 1 ] > 0 : pre_sum_pos . append ( pre_sum_pos [ - 1 ] + 1 ) else : pre_sum_pos . append ( pre_sum_pos [ - 1 ] )   count_neg = n - pre_sum_pos [ - 1 ] count_pos = pre_sum_pos [ - 1 ]   for l in range ( 1 , n ) : if a [ l ] == pre_prod [ l ] : x = pre_sum_pos [ - 1 ] - pre_sum_pos [ l - 1 ] count_pos += x count_neg += n - l - x else : x = pre_sum_pos [ - 1 ] - pre_sum_pos [ l - 1 ] count_neg += x count_pos += n - l - x   print ( count_neg , count_pos )     NEW_LINE", "n = int ( input ( ) ) pos = 1 neg = 0 k = 1 l = list ( map ( int , input ( ) . split ( ) ) ) for t in l : if ( t < 0 ) : k *= - 1 if ( k < 0 ) : neg += 1 else : pos += 1 print ( pos * neg , ( n * ( n + 1 ) // 2 ) - ( pos * neg ) ) NEW_LINE", "from sys import stdin , stdout   input = stdin . readline   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) p = 1 l = 0 pr = 1 for i in range ( n ) : if a [ i ] < 0 : pr *= - 1 if pr > 0 : p += 1 else : l += 1 print ( l * p , ( n * ( n + 1 ) ) // 2 - ( l * p ) ) NEW_LINE", "n , a , b = int ( input ( ) ) , 0 , 0 d = { - 1 : 0 , 1 : 1 } s = 1 arr = list ( map ( int , input ( ) . split ( ) ) ) for c in arr : c //= abs ( c ) s *= c a += d [ s ] b += d [ - s ] d [ s ] += 1 print ( b , a ) NEW_LINE" ]
codeforces_776_A
[ "import java . io . * ; import java . lang . reflect . Array ; import java . nio . Buffer ; import java . util . * ;   public class Pair {   static class FastReader { private BufferedReader br ; private StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   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 ( ) ) ; }   public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   public String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }    public static void main ( String [ ] args ) throws Exception { try { FastReader sc = new FastReader ( ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int n = sc . nextInt ( ) ; System . out . println ( a + \" ▁ \" + b ) ; while ( n != 0 ) { String c = sc . next ( ) ; String d = sc . next ( ) ; if ( c . equals ( a ) ) { a = d ; } else { b = d ; } System . out . println ( a + \" ▁ \" + b ) ; }   } catch ( Exception e ) { } } }", "  import java . util . HashSet ; import java . util . Scanner ;   public class AserialKiller {   public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; HashSet < String > set = new HashSet < String > ( ) ; set . add ( reader . next ( ) ) ; set . add ( reader . next ( ) ) ; String print = \" \" ; for ( String i : set ) print += i + \" ▁ \" ; System . out . println ( print ) ; int t = reader . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { print = \" \" ; set . remove ( reader . next ( ) ) ; set . add ( reader . next ( ) ) ; for ( String j : set ) print += j + \" ▁ \" ; System . out . println ( print ) ; }   }   }", "import java . util . Scanner ; public class Reconnaissance2 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String a = s . next ( ) , b = s . next ( ) , c , d ; int loop = s . nextInt ( ) ; System . out . println ( a + \" ▁ \" + b ) ; for ( int i = 0 ; i < loop ; i ++ ) { c = s . next ( ) ; d = s . next ( ) ; if ( a . equalsIgnoreCase ( c ) ) a = d ; else b = d ; System . out . println ( a + \" ▁ \" + b ) ; } } }", "import java . util . Scanner ;   public class ASerialKiller_776A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String a = input . next ( ) ; String b = input . next ( ) ; int n = input . nextInt ( ) ; System . out . println ( a + \" ▁ \" + b ) ; for ( int i = 0 ; i < n ; i ++ ) { String c = input . next ( ) ; if ( a . equals ( c ) ) a = input . next ( ) ; else b = input . next ( ) ; System . out . println ( a + \" ▁ \" + b ) ; } input . close ( ) ; } }", "import java . io . * ; import java . util . * ; import java . util . StringTokenizer ;   public class SerialKiller implements Runnable { public static void main ( String [ ] args ) { new Thread ( null , new SerialKiller ( ) , \" whatever \" , 1 << 26 ) . start ( ) ; }   public void run ( ) { Scanner scanner = new Scanner ( System . in ) ; StringBuilder answers = new StringBuilder ( ) ; ArrayList < String > currentPair = new ArrayList < > ( ) ; String start = scanner . nextLine ( ) ; answers . append ( start + \" \\n \" ) ; for ( String name : start . split ( \" ▁ \" ) ) { currentPair . add ( name ) ; } int n = scanner . nextInt ( ) ; scanner . nextLine ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String line = scanner . nextLine ( ) ; String [ ] names = line . split ( \" ▁ \" ) ; currentPair . remove ( currentPair . indexOf ( names [ 0 ] ) ) ; currentPair . add ( names [ 1 ] ) ; answers . append ( currentPair . get ( 0 ) + \" ▁ \" + currentPair . get ( 1 ) + \" \\n \" ) ; } System . out . println ( answers ) ; }   }" ]
[ "v1 , v2 = map ( str , input ( ) . split ( ) ) days = int ( input ( ) ) victims = [ [ v1 , v2 ] ]   while days > 0 : killed , new = map ( str , input ( ) . split ( ) ) if killed == v1 : v1 = new else : v2 = new victims . append ( [ v1 , v2 ] )   days -= 1     for i in victims : print ( ' ▁ ' . join ( i ) ) NEW_LINE", "initial = input ( ) . split ( ) n = int ( input ( ) )   victims = [ ] m = nwhile m > 0 : s , t = input ( ) . split ( ) victims . append ( [ s , t ] ) m -= 1   answer = initial [ 0 ] + \" ▁ \" + initial [ 1 ]   for i in range ( len ( victims ) ) : if initial [ 0 ] == victims [ i ] [ 0 ] : initial [ 0 ] = victims [ i ] [ 1 ] answer += \" \\n \" + initial [ 0 ] + \" ▁ \" + initial [ 1 ] elif initial [ 1 ] == victims [ i ] [ 0 ] : initial [ 1 ] = victims [ i ] [ 1 ] answer += \" \\n \" + initial [ 0 ] + \" ▁ \" + initial [ 1 ]   print ( answer ) NEW_LINE", "a = input ( ) . split ( ) n = int ( input ( ) ) print ( * a ) for _ in range ( n ) : b = input ( ) . split ( ) a . remove ( b [ 0 ] ) a . append ( b [ 1 ] ) print ( * a ) NEW_LINE", "one , other = [ str ( x ) for x in input ( ) . split ( ) ]   murders = int ( input ( ) )   for i in range ( murders ) : killed , replaced_by = [ str ( x ) for x in input ( ) . split ( ) ]   print ( f ' { one } ▁ { other } ' ) if ( killed == one ) : one = replaced_by else : other = replaced_byprint ( f ' { one } ▁ { other } ' ) NEW_LINE", "one , two = input ( ) . split ( ) n = int ( input ( ) ) L = [ ] for _ in range ( n ) : kill , new = input ( ) . split ( ) L . append ( ( kill , new ) ) NEW_LINE" ]
codeforces_305_B
[ "import java . math . * ; import java . util . * ; public class Main { static long a [ ] = new long [ 500 ] ; public static int n ; public static BigDecimal f ( int index ) { if ( index == n ) return BigDecimal . valueOf ( a [ index ] ) . divide ( BigDecimal . ONE , 45 , BigDecimal . ROUND_HALF_DOWN ) ; else return BigDecimal . valueOf ( a [ index ] ) . add ( BigDecimal . ONE . divide ( f ( index + 1 ) , 45 , BigDecimal . ROUND_HALF_DOWN ) ) ; } public static void main ( final String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; BigDecimal p , q ; p = cin . nextBigDecimal ( ) ; q = cin . nextBigDecimal ( ) ; n = cin . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = cin . nextLong ( ) ; } BigDecimal s1 = p . divide ( q , 45 , BigDecimal . ROUND_HALF_DOWN ) ; BigDecimal s2 = f ( 1 ) ; if ( s1 . equals ( s2 ) ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } }   }", "import java . math . BigDecimal ; import java . util . * ; public class Main { static long a [ ] = new long [ 500 ] ; public static int n ; public static BigDecimal f ( int index ) { if ( index == n ) return BigDecimal . valueOf ( a [ index ] ) . divide ( BigDecimal . ONE , 45 , BigDecimal . ROUND_HALF_DOWN ) ; else return BigDecimal . valueOf ( a [ index ] ) . add ( BigDecimal . ONE . divide ( f ( index + 1 ) , 45 , BigDecimal . ROUND_HALF_DOWN ) ) ; } public static void main ( final String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; BigDecimal p , q ; p = cin . nextBigDecimal ( ) ; q = cin . nextBigDecimal ( ) ; n = cin . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = cin . nextLong ( ) ; BigDecimal s1 = p . divide ( q , 45 , BigDecimal . ROUND_HALF_DOWN ) ; BigDecimal s2 = f ( 1 ) ; if ( s1 . equals ( s2 ) ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; cin . close ( ) ; } }", "import java . math . * ; import java . util . Scanner ; public class Main { static long a [ ] = new long [ 500 ] ; public static int n ; public static BigDecimal f ( int index ) { if ( index == n ) return BigDecimal . valueOf ( a [ index ] ) . divide ( BigDecimal . ONE , 45 , BigDecimal . ROUND_HALF_DOWN ) ; else return BigDecimal . valueOf ( a [ index ] ) . add ( BigDecimal . ONE . divide ( f ( index + 1 ) , 45 , BigDecimal . ROUND_HALF_DOWN ) ) ; } public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; BigDecimal p , q ; p = cin . nextBigDecimal ( ) ; q = cin . nextBigDecimal ( ) ; n = cin . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = cin . nextLong ( ) ; } BigDecimal s1 = p . divide ( q , 45 , BigDecimal . ROUND_HALF_DOWN ) ; BigDecimal s2 = f ( 1 ) ; if ( s1 . equals ( s2 ) ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } }   }", "import java . math . BigDecimal ; import java . util . Scanner ; public class Main { static long a [ ] = new long [ 500 ] ; public static int n ; public static BigDecimal f ( int index ) { if ( index == n ) return BigDecimal . valueOf ( a [ index ] ) . divide ( BigDecimal . ONE , 45 , BigDecimal . ROUND_HALF_DOWN ) ; else return BigDecimal . valueOf ( a [ index ] ) . add ( BigDecimal . ONE . divide ( f ( index + 1 ) , 45 , BigDecimal . ROUND_HALF_DOWN ) ) ; } public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; BigDecimal p , q ; p = cin . nextBigDecimal ( ) ; q = cin . nextBigDecimal ( ) ; n = cin . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = cin . nextLong ( ) ; } BigDecimal s1 = p . divide ( q , 45 , BigDecimal . ROUND_HALF_DOWN ) ; BigDecimal s2 = f ( 1 ) ;", "import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ;" ]
[ "def solve ( p , q , a , st , n ) : if st == n - 1 : return p == q * a [ st ] return solve ( q , p - a [ st ] * q , a , st + 1 , n ) ;     p , q = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   if solve ( p , q , a , 0 , n ) : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "from math import gcdq , p = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) a = [ * map ( int , input ( ) . split ( ) ) ] d = gcd ( p , q ) p //= dq //= dm , b = 1 , a [ - 1 ] i = n - 2 while ( i >= 0 ) : m = b * a [ i ] + m d = gcd ( m , b ) m //= d b //= d i -= 1 m , b = b , mprint ( \" YES \" if ( m == p and b == q ) else \" NO \" ) NEW_LINE", "from math import gcdq , p = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) t = [ * map ( int , input ( ) . split ( ) ) ] d = gcd ( p , q ) p //= dq //= da = int ( 1 ) b = int ( t [ n - 1 ] ) i = n - 2 while i >= 0 : a = b * t [ i ] + a d = gcd ( a , b ) a //= d b //= d i -= 1 c = a a = b b = cif a == p and q == b : print ( \" YES \" ) else : print ( \" NO \" )   NEW_LINE", "P , Q = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] p = [ ] q = [ ] p . append ( a [ 0 ] ) q . append ( 1 ) if ( n == 1 ) : if ( p [ 0 ] * Q == q [ 0 ] * P ) : print ( \" YES \" ) else : print ( \" NO \" ) else : p . append ( a [ 1 ] * a [ 0 ] + 1 ) q . append ( a [ 1 ] ) for i in range ( 2 , n ) : p . append ( a [ i ] * p [ i - 1 ] + p [ i - 2 ] ) q . append ( a [ i ] * q [ i - 1 ] + q [ i - 2 ] ) if ( p [ n - 1 ] * Q == q [ n - 1 ] * P ) : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE" ]
codeforces_1320_B
[ "import sys   input = sys . stdin . readlinefrom collections import deque    def bfs ( root ) : visit = [ 0 ] * ( n + 1 ) queue = [ root , - 1 ] queue = deque ( queue ) visit [ root ] = 1 d = 0 while len ( queue ) != 1 : element = queue . popleft ( ) if element == - 1 : queue . append ( - 1 ) d += 1 continue visit [ element ] = 1 store [ element ] = d for i in r_graph [ element ] : if not visit [ i ] : queue . append ( i ) visit [ i ] = 1    n , m = map ( int , input ( ) . split ( ) ) r_graph = [ [ ] for i in range ( n + 1 ) ] graph = [ [ ] for i in range ( n + 1 ) ] for i in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) graph [ a ] . append ( b ) r_graph [ b ] . append ( a ) k = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) store = [ 0 ] * ( n + 1 ) bfs ( c [ - 1 ] ) maxi , mini , count = 0 , 0 , 0f or i in range ( k - 1 ) : if ( store [ c [ i ] ] < store [ c [ i + 1 ] ] + 1 ) : maxi += 1 mini += 1 else : count = 0 for j in graph [ c [ i ] ] : if ( store [ c [ i ] ] == store [ j ] + 1 ) : count += 1 if ( count >= 2 ) : maxi += 1 print ( mini , maxi )", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   int N ; List < Integer > [ ] adj ; List < Integer > [ ] radj ; int M ; int [ ] dist ; int [ ] distCount ;   int K ; int [ ] path ; void run ( FastScanner in , PrintWriter out ) {   N = in . nextInt ( ) ; adj = new List [ N + 1 ] ; radj = new List [ N + 1 ] ; dist = new int [ N + 1 ] ; multipleOptionsForShortestPath = new boolean [ N + 1 ] ; distCount = new int [ N + 1 ] ; for ( int i = 0 ; i <= N ; i ++ ) { adj [ i ] = new ArrayList < > ( ) ; radj [ i ] = new ArrayList < > ( ) ; }   M = in . nextInt ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int u = in . nextInt ( ) ; int v = in . nextInt ( ) ;   adj [ u ] . add ( v ) ; radj [ v ] . add ( u ) ; }   K = in . nextInt ( ) ; path = new int [ K ] ; for ( int i = 0 ; i < K ; i ++ ) path [ i ] = in . nextInt ( ) ;    bfs ( path [ K - 1 ] ) ;   int min = 0 ; int max = 0 ;   for ( int i = 1 ; i < K ; i ++ ) { int prevDist = dist [ path [ i - 1 ] ] ; int currDist = dist [ path [ i ] ] ; if ( prevDist - 1 != currDist ) { min ++ ; max ++ ; } else {", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   int N ; List < Integer > [ ] adj ; List < Integer > [ ] radj ; int M ; int [ ] dist ; int [ ] distCount ;   int K ; int [ ] path ; void run ( FastScanner in , PrintWriter out ) {   N = in . nextInt ( ) ; adj = new List [ N + 1 ] ; radj = new List [ N + 1 ] ; dist = new int [ N + 1 ] ; distCount = new int [ N + 1 ] ; for ( int i = 0 ; i <= N ; i ++ ) { adj [ i ] = new ArrayList < > ( ) ; radj [ i ] = new ArrayList < > ( ) ; }   M = in . nextInt ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int u = in . nextInt ( ) ; int v = in . nextInt ( ) ;   adj [ u ] . add ( v ) ; radj [ v ] . add ( u ) ; }   K = in . nextInt ( ) ; path = new int [ K ] ; for ( int i = 0 ; i < K ; i ++ ) path [ i ] = in . nextInt ( ) ;    bfs ( path [ K - 1 ] ) ;   int min = 0 ; int max = 0 ;   for ( int i = 1 ; i < K ; i ++ ) { int prevDist = dist [ path [ i - 1 ] ] ; int currDist = dist [ path [ i ] ] ; if ( prevDist - 1 != currDist ) { min ++ ; max ++ ; } else {", "import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException {" ]
[ "import sys   input = sys . stdin . readlinefrom collections import deque     def bfs ( root ) : visit = [ 0 ] * ( n + 1 ) queue = [ root , - 1 ] queue = deque ( queue ) visit [ root ] = 1 d = 0 while len ( queue ) != 1 : element = queue . popleft ( ) if element == - 1 : queue . append ( - 1 ) d += 1 continue visit [ element ] = 1 store [ element ] = d for i in r_graph [ element ] : if not visit [ i ] : queue . append ( i ) visit [ i ] = 1     n , m = map ( int , input ( ) . split ( ) ) r_graph = [ [ ] for i in range ( n + 1 ) ] graph = [ [ ] for i in range ( n + 1 ) ] for i in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) graph [ a ] . append ( b ) r_graph [ b ] . append ( a ) k = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) store = [ 0 ] * ( n + 1 ) bfs ( c [ - 1 ] ) maxi , mini , count = 0 , 0 , 0 for i in range ( k - 1 ) : if ( store [ c [ i ] ] < store [ c [ i + 1 ] ] + 1 ) : maxi += 1 mini += 1 else : count = 0 for j in graph [ c [ i ] ] : if ( store [ c [ i ] ] == store [ j ] + 1 ) : count += 1 if ( count >= 2 ) : maxi += 1 print ( mini , maxi ) NEW_LINE", "from collections import defaultdictfrom collections import deque   n , m = map ( int , input ( ) . split ( ) ) adj = defaultdict ( list ) rev = defaultdict ( list ) dist = { } for _ in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) adj [ u ] . append ( v ) rev [ v ] . append ( u )   k = int ( input ( ) ) path = list ( map ( int , input ( ) . split ( ) ) )   dt = { }     def bfs ( t ) : q = deque ( [ t ] ) dt [ t ] = 0   while q : c = q . popleft ( ) for y in rev [ c ] : if y not in dt : dt [ y ] = dt [ c ] + 1 q . append ( y )     min_rebuild = 0 max_rebuild = 0 bfs ( path [ k - 1 ] )   for i in range ( 1 , k - 1 ) : v = path [ i - 1 ] u = path [ i ]   if dt [ u ] + 1 > dt [ v ] : min_rebuild += 1 max_rebuild += 1   elif dt [ u ] + 1 == dt [ v ] : for w in adj [ v ] : if u != w and dt [ u ] == dt [ w ] : max_rebuild += 1 break     print ( min_rebuild , max_rebuild ) NEW_LINE", "import sysinput = sys . stdin . buffer . readline NEW_LINE", "import sysinput = sys . stdin . buffer . readline NEW_LINE", "from types import GeneratorType   INF = 1e10     def bootstrap ( f , stack = [ ] ) : def wrappedfunc ( * args , ** kwargs ) : if stack : return f ( * args , ** kwargs ) else : to = f ( * args , ** kwargs ) while True : if type ( to ) is GeneratorType : stack . append ( to ) to = next ( to ) else : stack . pop ( ) if not stack : break to = stack [ - 1 ] . send ( to ) return to   return wrappedfunc     class Graph :   def __init__ ( self , V ) : self . V = V self . adj = [ [ ] for i in range ( V ) ]   def addEdge ( self , v , w ) : self . adj [ v ] . append ( w )     import sys   input = sys . stdin . readlinen , m = list ( map ( int , input ( ) . split ( ) ) ) G = Graph ( n ) G_transpose = Graph ( n ) for _ in range ( m ) : u , v = list ( map ( int , input ( ) . split ( ) ) ) G . addEdge ( u - 1 , v - 1 ) G_transpose . addEdge ( v - 1 , u - 1 ) minimums = [ 0 for _ in range ( n ) ] mini = [ 0 for _ in range ( n ) ]   from collections import dequedef BFS_SP ( graph , start ) : explored = set ( ) queue = deque ( [ start ] ) dz = set ( )   while queue : node = queue . popleft ( )   if node not in explored : neighbours = graph . adj [ node ] NEW_LINE" ]
codeforces_276_A
[ "  import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class A { public static void main ( String [ ] args ) { FastReader ( ) ; int t = 1 ; while ( t > 0 ) { solve ( ) ; -- t ; } write . flush ( ) ; write . close ( ) ; } static void solve ( ) { int n = ni ( ) , k = ni ( ) ; int f [ ] = new int [ n ] ; int t [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { f [ i ] = ni ( ) ; t [ i ] = ni ( ) ; } long max = 0 ; if ( t [ 0 ] > k ) { max = f [ 0 ] - t [ 0 ] + k ; } else { max = f [ 0 ] ; } for ( int i = 0 ; i < n ; ++ i ) { if ( t [ i ] > k ) { long p = f [ i ] - t [ i ] + k ; if ( p > max ) { max = p ; } } else { long p = f [ i ] ; if ( p > max ) { max = p ; } } } out ( max ) ; }", "import java . lang . * ; import java . util . * ; import java . io . * ;   public class _temp2 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] st = br . readLine ( ) . split ( \" ▁ \" ) ; int n = Integer . parseInt ( st [ 0 ] ) ; int k = Integer . parseInt ( st [ 1 ] ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { st = br . readLine ( ) . split ( \" ▁ \" ) ; a [ i ] = Integer . parseInt ( st [ 0 ] ) ; b [ i ] = Integer . parseInt ( st [ 1 ] ) ; } int count = Integer . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { if ( b [ i ] > k ) { count = Math . max ( count , a [ i ] - b [ i ] + k ) ; } else { count = Math . max ( count , a [ i ] ) ; } } System . out . println ( count ) ; } }", "import java . util . * ; import java . math . * ;   public class gfg { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int maxJoy = - 1000000000 ; for ( int i = 0 ; i < n ; i ++ ) { int f = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; if ( t < k ) { if ( maxJoy < f ) maxJoy = f ; } else { if ( maxJoy < ( f - ( t - k ) ) ) maxJoy = f - ( t - k ) ; } } System . out . println ( maxJoy ) ; } }" ]
[ "import sysinput = sys . stdin . readlinerr = lambda : sys . stdin . readline ( ) . strip ( ) restaurants , givenTime = map ( int , rr ( ) . split ( ) ) restDetails = [ tuple ( map ( int , rr ( ) . split ( ) ) ) for _ in range ( restaurants ) ] restDetails . sort ( )   ans = - 10 ** 69 for f , t in restDetails : cur = f if t > givenTime : cur = f - ( t - givenTime ) ans = max ( cur , ans ) print ( ans ) NEW_LINE", "cases , k = map ( int , input ( ) . split ( ) ) mx = float ( \" - inf \" ) while cases : cases -= 1 fi , ti = map ( int , input ( ) . split ( ) ) if ti > k : mx = max ( fi + k - ti , mx ) else : mx = max ( mx , fi )   print ( mx ) NEW_LINE", "import sysfrom os import pathif ( path . exists ( ' input . txt ' ) and path . exists ( ' output . txt ' ) ) : sys . stdout = open ( ' output . txt ' , ' w ' ) sys . stdin = open ( ' input . txt ' , ' r ' )   NEW_LINE", "n = [ int ( x ) for x in input ( ) . split ( ) ] t = n [ 1 ] j = [ ] for i in range ( n [ 0 ] ) : x = [ int ( x ) for x in input ( ) . split ( ) ] if x [ 1 ] > t : j . append ( ( x [ 0 ] - ( x [ 1 ] - t ) ) ) else : j . append ( x [ 0 ] )   print ( max ( j ) ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) )   joy = int ( )   for i in range ( n ) :   f , t = map ( int , input ( ) . split ( ) )   if i == 0 : if t > k : joy = f - t + k   else : joy = f   else : if t > k : joy = max ( joy , f - t + k )   else : joy = max ( joy , f )   print ( joy ) NEW_LINE" ]
codeforces_755_B
[ "import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ; public class Cat_Furrier { public static void main ( String [ ] args ) {", "  import java . util . * ; import java . io . * ; import java . math . * ;   public class Practice   { static FastReader sc = new FastReader ( ) ; static int mod = ( int ) Math . pow ( 10 , 9 ) + 7 ; public static void main ( String [ ] args ) {", "  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 b755 {" ]
[ "n , m = map ( int , input ( ) . split ( ) ) a = { input ( ) for _ in range ( n ) } b = { input ( ) for _ in range ( m ) } u = len ( a . intersection ( b ) ) print ( \" NO \" ) if m - u + u // 2 >= n - u + ( u + 1 ) // 2 else print ( \" YES \" ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a = { input ( ) for x in range ( n ) } b = { input ( ) for y in range ( m ) } t = n + m - len ( a | b ) print ( ' YES ' if n + t % 2 > m else ' NO ' )   NEW_LINE", "temp = input ( ) . split ( \" ▁ \" ) n = int ( temp [ 0 ] ) m = int ( temp [ 1 ] )   nli = [ ] mli = [ ]   for _ in range ( n ) : nli . append ( input ( ) )   for _ in range ( m ) : mli . append ( input ( ) )   res = n - mcount = 0 for x in mli : if x in nli : count += 1   res = res + ( count % 2 ) if res > 0 : print ( \" YES \" )   else : print ( \" NO \" ) NEW_LINE", "def solve ( ) : n , m = [ int ( x ) for x in input ( ) . split ( ) ] if m > n : print ( \" NO \" ) return elif n > m : print ( \" YES \" ) return a = [ ] for _ in range ( n ) : a . append ( input ( ) ) a . sort ( ) counter = 0 for _ in range ( m ) : if input ( ) in a : counter += 1 if counter & 1 : if n + 1 > m : print ( \" YES \" ) else : print ( \" NO \" )   else : if m >= n : print ( \" NO \" ) else : print ( \" YES \" )     solve ( ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a = { input ( ) for x in range ( n ) } b = { input ( ) for y in range ( m ) } t = n + m - len ( a | b ) print ( ' YES ' if n + t % 2 > m else ' NO ' ) NEW_LINE" ]
codeforces_334_B
[ "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 = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static int maxN = ( int ) 1e6 ;", "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ;   public class main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x [ ] = new int [ 8 ] ; int y [ ] = new int [ 8 ] ; for ( int i = 0 ; i < 8 ; ++ i ) { x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; }   TreeSet < Integer > setX = new TreeSet < > ( ) ; TreeSet < Integer > setY = new TreeSet < > ( ) ; for ( int i = 0 ; i < 8 ; ++ i ) { setX . add ( x [ i ] ) ; setY . add ( y [ i ] ) ; }   if ( setX . size ( ) != 3 || setY . size ( ) != 3 ) { System . out . println ( \" ugly \" ) ; return ; }   Integer [ ] arrX = setX . toArray ( new Integer [ 3 ] ) ; Integer [ ] arrY = setY . toArray ( new Integer [ 3 ] ) ;   for ( int i = 0 ; i < 3 ; ++ i ) { for ( int j = 0 ; j < 3 ; ++ j ) { boolean found = false ; for ( int k = 0 ; k < 8 ; ++ k ) { if ( arrX [ i ] == x [ k ] && arrY [ j ] == y [ k ] ) { found = true ; break ; } }   if ( found == ( i == 1 && j == 1 ) ) { System . out . println ( \" ugly \" ) ; return ; } } }   System . out . println ( \" respectable \" ) ; } }  ", "import java . util . Arrays ; import java . util . Scanner ;   public class EightPointSets { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 8 ] ; int [ ] y = new int [ 8 ] ; for ( int i = 0 ; i < 8 ; i ++ ) { x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 8 ; i ++ ) { for ( int j = i + 1 ; j < 8 ; j ++ ) { if ( x [ i ] == x [ j ] && y [ i ] == y [ j ] ) { System . out . println ( \" ugly \" ) ; return ; } } } int [ ] cntx = new int [ 1000000 + 1 ] ; int [ ] cnty = new int [ 1000000 + 1 ] ; for ( int i = 0 ; i < 8 ; i ++ ) { cntx [ x [ i ] ] ++ ; cnty [ y [ i ] ] ++ ; } boolean isRespectable = false ; Arrays . sort ( x ) ; Arrays . sort ( y ) ; if ( cntx [ x [ 0 ] ] == 3 && cntx [ x [ 3 ] ] == 2 && cntx [ x [ 5 ] ] == 3 && cnty [ y [ 0 ] ] == 3 && cnty [ y [ 3 ] ] == 2 && cnty [ y [ 5 ] ] == 3 ) { isRespectable = true ; } System . out . println ( isRespectable ? \" respectable \" : \" ugly \" ) ; } }" ]
[ "from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE", "x , y = [ ] , [ ] xx , yy = { } , { } for i in range ( 8 ) : a , b = map ( int , input ( ) . split ( ) ) x . append ( a ) y . append ( b ) if a not in xx : xx [ a ] = [ b ] else : xx [ a ] . append ( b ) if b not in yy : yy [ b ] = [ a ] else : yy [ b ] . append ( a ) if len ( set ( x ) ) != 3 or len ( set ( y ) ) != 3 : print ( ' ugly ' ) exit ( ) xxx , yyy = sorted ( set ( x ) ) , sorted ( set ( y ) ) if set ( xx [ xxx [ 1 ] ] ) != { yyy [ 0 ] , yyy [ 2 ] } : print ( ' ugly ' ) exit ( ) if set ( yy [ yyy [ 1 ] ] ) != { xxx [ 0 ] , xxx [ 2 ] } : print ( ' ugly ' ) exit ( ) if len ( set ( xx [ xxx [ 0 ] ] ) ) != 3 or 3 != len ( set ( xx [ xxx [ 2 ] ] ) ) or len ( set ( yy [ yyy [ 0 ] ] ) ) != 3 or 3 != len ( set ( yy [ yyy [ 2 ] ] ) ) : print ( ' ugly ' ) exit ( ) print ( ' respectable ' ) NEW_LINE", "a = [ ] xDistinct = [ ] yDistinct = [ ]   for i in range ( 0 , 8 ) : [ n1 , n2 ] = map ( int , input ( ) . split ( ) ) a . append ( [ n1 , n2 ] )   if ( n1 not in xDistinct ) : xDistinct . append ( n1 )   if ( n2 not in yDistinct ) : yDistinct . append ( n2 )     countDistinctX = len ( xDistinct ) countDistinctY = len ( yDistinct )   if ( countDistinctX != 3 and countDistinctY != 3 ) : print ( \" ugly \" ) exit ( )   xDistinct . sort ( ) yDistinct . sort ( ) a . sort ( )   index = 0   for i in range ( 3 ) : for j in range ( 3 ) : if i == j == 1 : continue   if xDistinct [ i ] != a [ index ] [ 0 ] or yDistinct [ j ] != a [ index ] [ 1 ] : print ( ' ugly ' ) exit ( )   index = index + 1   print ( ' respectable ' ) NEW_LINE", "class coor : def __init__ ( self , x , y ) : self . x = x self . y = y def __lt__ ( self , other ) : if ( self . x < other . x ) : return True elif ( self . x > other . x ) : return False else : if ( self . y < other . y ) : return True else : return Falsea = [ ] first = set ( ) second = set ( ) for i in range ( 0 , 8 ) : x , y = ( map ( int , input ( ) . split ( ) ) ) first . add ( x ) second . add ( y ) a . append ( coor ( x , y ) )   NEW_LINE", "class coor : def __init__ ( self , x , y ) : self . x = x self . y = y def __lt__ ( self , other ) : if ( self . x < other . x ) : return True elif ( self . x > other . x ) : return False else : if ( self . y < other . y ) : return True else : return Falsea = [ ] first = set ( ) second = set ( ) for i in range ( 0 , 8 ) : x , y = ( map ( int , input ( ) . split ( ) ) ) first . add ( x ) second . add ( y ) a . append ( coor ( x , y ) )   NEW_LINE" ]
codeforces_982_B
[ "import java . io . * ; import java . util . * ;   public class prog { static class pr { int id , w ;   pr ( int id , int w ) { this . id = id ; this . w = w ; } }   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; pr mas [ ] = new pr [ n ] ; for ( int i = 0 ; i < n ; i ++ ) mas [ i ] = new pr ( i + 1 , in . nextInt ( ) ) ; Arrays . sort ( mas , new Comparator < pr > ( ) { public int compare ( pr a , pr b ) { return a . w - b . w ; } } ) ; String s = in . next ( ) ; Stack < Integer > order = new Stack < > ( ) ; int id = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '1' ) out . print ( order . pop ( ) + \" ▁ \" ) ; else { out . print ( mas [ id ] . id + \" ▁ \" ) ; order . push ( mas [ id ++ ] . id ) ; } } in . close ( ) ; out . close ( ) ; } }", "import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import javafx . util . Pair ;   public class CodeForce { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringBuilder sb = new StringBuilder ( ) ;   static boolean flag = false ; static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static int next ( String [ ] sr , int ind ) { return Integer . parseInt ( sr [ ind ] ) ; }   public static void main ( String [ ] args ) throws IOException {", "import java . util . * ; import java . io . * ;   public class Div688A {" ]
[ "n = int ( input ( ) ) a = [ int ( a ) for a in input ( ) . split ( ) ]   code = [ ]   for i in range ( 1 , n + 1 ) : d = dict ( x = a [ i - 1 ] , y = i ) code . append ( d ) code = sorted ( code , key = lambda i : i [ \" x \" ] , reverse = True ) intro = [ ] extro = [ ]   for i in range ( 1 , n + 1 ) : intro . append ( code [ i - 1 ] [ ' y ' ] )   inp = input ( )   for i in inp : if i == '0' : intro_seat = intro . pop ( ) print ( intro_seat , end = ' ▁ ' ) extro . append ( intro_seat )   else : print ( extro . pop ( ) , end = ' ▁ ' )   print ( ) NEW_LINE", "z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) fast = lambda : stdin . readline ( ) . strip ( ) zzz = lambda : [ int ( i ) for i in fast ( ) . split ( ) ] szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) ) from string import * from re import * from collections import * from queue import * from sys import * from collections import * from math import * from heapq import * from itertools import * from bisect import * from collections import Counter as ccfrom math import factorial as ffrom bisect import bisect as bsfrom bisect import bisect_left as bslfrom itertools import accumulate as acdef lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) def prime ( x ) : p = ceil ( x ** .5 ) + 1 for i in range ( 2 , p ) : if ( x % i == 0 and x != 2 ) or x == 0 : return 0 return 1 def dfs ( u , visit , graph ) : visit [ u ] = 1 for i in graph [ u ] : if not visit [ i ] : dfs ( i , visit , graph ) def output ( answer ) : stdout . write ( str ( answer ) ) NEW_LINE", "from _collections import dequen = int ( input ( ) ) m = list ( map ( int , input ( ) . split ( ) ) ) a = [ ] b = deque ( ) i = 1 for x in m : a . append ( ( x , i ) ) i += 1 a . sort ( key = lambda p : - p [ 0 ] ) s = input ( ) ans = [ ] for x in s : if x == \"1\" : v = b . pop ( ) ans . append ( v [ 1 ] ) else : v = a . pop ( ) ans . append ( v [ 1 ] ) b . append ( v ) print ( * ans ) NEW_LINE", "from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : n = nmbr ( ) l = sorted ( zip ( lst ( ) , range ( n ) ) ) p = 0 ; ans = [ 0 ] * ( 2 * n ) st = [ 0 ] * n ; ln = 0 s = input ( ) for i in range ( 2 * n ) : ch = s [ i ] if ch == '0' : st [ ln ] = p ans [ i ] = l [ p ] [ 1 ] + 1 ln += 1 p += 1 else : ans [ i ] = l [ st [ ln - 1 ] ] [ 1 ] + 1 ln -= 1 print ( * ans ) NEW_LINE", "from collections import dequen = int ( input ( ) ) orderedli = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) )     indexof = { } for i , x in enumerate ( orderedli ) : indexof [ x ] = i + 1   sortedli = list ( sorted ( orderedli ) ) i = 0   s = input ( )   st = deque ( )   for x in s : if x == \"0\" : st . append ( sortedli [ i ] ) print ( indexof [ sortedli [ i ] ] , end = \" ▁ \" ) i += 1 else : NEW_LINE" ]
codeforces_594_A
[ "# include < bits / stdc ++ . h > using namespace std ;  # define ll long long", "import java . util . * ;   public class WarriorAndArcher {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = scan . nextInt ( ) ; Arrays . sort ( arr ) ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i + n / 2 < n ; i ++ ) { ans = Math . min ( arr [ i + n / 2 ] - arr [ i ] , ans ) ; } System . out . println ( ans ) ; } }", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; 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 ( ) ; Integer [ ] x = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = in . nextInt ( ) ; } Arrays . sort ( x ) ; int m = n / 2 ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < m ; i ++ ) { ans = Math . min ( ans , x [ i + m ] - x [ i ] ) ; } 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 ( ) ) ; }   } }  ", "import java . io . * ; import java . util . * ;   public class Main {    public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int N = in . nextInt ( ) ;   int [ ] vals = new int [ N ] ;   for ( int i = 0 ; i < N ; i ++ ) vals [ i ] = in . nextInt ( ) ;   Arrays . sort ( vals ) ;   if ( N == 2 ) { System . out . println ( vals [ 1 ] - vals [ 0 ] ) ; return ; }   int interval = N / 2 ;   int min1 = 0 ; int min2 = 0 ; int min = 0 ;   for ( int i = 0 ; i + interval < N ; i ++ ) { if ( min == 0 || vals [ i + interval ] - vals [ i ] < min ) { min1 = i ; min2 = i + interval ; min = vals [ i + interval ] - vals [ i ] ;   } }    System . out . println ( min ) ;    } }" ]
[ "n = int ( input ( ) )   x = sorted ( list ( map ( int , input ( ) . split ( ) ) ) )   print ( min ( [ x [ i + n // 2 ] - x [ i ] for i in range ( n // 2 ) ] ) )             NEW_LINE", "n = int ( input ( ) ) x = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) print ( min ( [ x [ i + n // 2 ] - x [ i ] for i in range ( n // 2 ) ] ) )   NEW_LINE", "n = int ( input ( ) ) x = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) print ( min ( [ x [ i + n // 2 ] - x [ i ] for i in range ( n // 2 ) ] ) )   NEW_LINE", "n = int ( input ( ) ) x = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) print ( min ( [ x [ i + n // 2 ] - x [ i ] for i in range ( n // 2 ) ] ) )   NEW_LINE", "n = int ( input ( ) ) x = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) print ( min ( [ x [ i + n // 2 ] - x [ i ] for i in range ( n // 2 ) ] ) )   NEW_LINE" ]
codeforces_16_A
[ "import java . io . * ;   public class Main { static final int N = 110 ; static int n , m ; static String [ ] input ; static char [ ] [ ] g = new char [ N ] [ N ] ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ;   public static void main ( String [ ] args ) throws IOException { input = br . readLine ( ) . split ( \" ▁ \" ) ; n = Integer . parseInt ( input [ 0 ] ) ; m = Integer . parseInt ( input [ 1 ] ) ; for ( int i = 0 ; i < n ; ++ i ) { g [ i ] = br . readLine ( ) . toCharArray ( ) ; } char t = ' ▁ ' ; boolean flag = true ; for ( int i = 0 ; i < n ; ++ i ) { if ( i != 0 && t == g [ i ] [ 0 ] ) { flag = false ; break ; } t = g [ i ] [ 0 ] ; for ( int j = 1 ; j < m ; ++ j ) { if ( t != g [ i ] [ j ] ) { flag = false ; break ; } } if ( ! flag ) { break ; } } bw . write ( flag ? \" YES \" : \" NO \" ) ; bw . close ( ) ; } }", "import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Scanner ; import java . util . TreeSet ; import java . util . function . Function ; import java . util . stream . Collectors ; public class _p000016A { static public void main ( final String [ ] args ) throws IOException { p000016A . _main ( args ) ; }", "public class Flag { public static void main ( String [ ] args ) { try ( java . util . Scanner sc = new java . util . Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ;   int [ ] [ ] mm = new int [ n ] [ m ] ;   for ( int i = 0 ; i < n ; i ++ ) { String [ ] aa = sc . next ( ) . split ( \" \" ) ; for ( int j = 0 ; j < aa . length ; j ++ ) { mm [ i ] [ j ] = Integer . parseInt ( aa [ j ] ) ; } }   boolean isOK = true ;   for ( int i = 1 ; i < n ; i ++ ) { for ( int j = 1 ; j < m ; j ++ ) { if ( mm [ i - 1 ] [ j ] == mm [ i ] [ j ] ) { isOK = false ; } } }   if ( isOK ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 1 ; j < m ; j ++ ) { if ( mm [ i ] [ j - 1 ] != mm [ i ] [ j ] ) { isOK = false ; } } } } System . out . println ( isOK ? \" YES \" : \" NO \" ) ; } } }", "import java . awt . Label ; import java . util . * ;   public class JavaApplication23 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   boolean check = true ; int n , m , index = 0 ; n = in . nextInt ( ) ; m = in . nextInt ( ) ;   String [ ] a = new String [ n ] ; int integer [ ] = new int [ n ] ;   while ( n != 0 ) { a [ index ] = in . next ( ) ; for ( int i = 0 ; i < a [ index ] . length ( ) - 1 ; i ++ ) { if ( a [ index ] . charAt ( i ) != a [ index ] . charAt ( i + 1 ) ) { check = false ; break ; } } index ++ ; n -- ; } if ( check ) { ConvertStringToInteger ( a , integer ) ; for ( int i = 1 ; i < integer . length - 1 ; i ++ ) { if ( ! ( integer [ i - 1 ] != integer [ i ] && integer [ i ] != integer [ i + 1 ] ) ) { check = false ; break ; } }   }   if ( check ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } }   public static void ConvertStringToInteger ( String [ ] a , int [ ] num ) { for ( int i = 0 ; i < a . length ; i ++ ) { for ( int j = 0 ; j < a [ i ] . length ( ) ; j ++ ) { num [ i ] += ( int ) a [ i ] . charAt ( j ) ; } } } }  " ]
[ "''' Jana ▁ Goodman6 16A ▁ Flag n ▁ x ▁ m ▁ squares ▁ ( 1 . . 100)10 ▁ colors horizontal ▁ rows ▁ all ▁ same ▁ coloradjacent ▁ rows ▁ different ▁ colors   ''' SPACE = ' ▁ '   def all_same ( s ) : return s . count ( s [ 0 ] ) == len ( s )   def answer ( stripes , height , width ) : prev = ' x ' for s in stripes : if s [ 0 ] == prev or not all_same ( s ) : return ' NO ' prev = s [ 0 ] return ' YES '   if __name__ == ' _ _ main _ _ ' : rows , cols = map ( int , input ( ) . split ( SPACE ) ) stripes = [ ] for _ in range ( 0 , rows ) : stripes . append ( input ( ) . strip ( ) )   print ( answer ( stripes , rows , cols ) ) NEW_LINE", "n , m = [ int ( j ) for j in input ( ) . split ( ) ] output = \" YES \" prev = str ( input ( ) ) if prev . count ( prev [ 0 ] ) != m : output = \" NO \" for j in range ( n - 1 ) : s = str ( input ( ) ) if s . count ( s [ 0 ] ) != m or s [ 0 ] == prev [ 0 ] : output = \" NO \" prev = sprint ( output ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) li = [ ] for i in range ( n ) : li . append ( list ( map ( int , input ( ) ) ) )   if li [ 0 ] . count ( li [ 0 ] [ 0 ] ) != m : print ( ' NO ' ) else : for row in range ( 1 , len ( li ) ) :   if li [ row ] . count ( li [ row ] [ 0 ] ) != m : print ( ' NO ' ) break if li [ row - 1 ] == li [ row ] : print ( ' NO ' ) break else : print ( ' YES ' ) NEW_LINE", "''' n , ▁ m ▁ = ▁ [ int ( item ) ▁ for ▁ item ▁ in ▁ input ( ) . split ( ' ▁ ' ) ] ans ▁ = ▁ ' YES ' cont ▁ = ▁ [ ]   def ▁ check ( s ) : ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( len ( s ) ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s [ 0 ] ▁ ! = ▁ s [ i ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ return ▁ False ▁ ▁ ▁ ▁ return ▁ True  for ▁ i ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ cont . append ( input ( ) ) ▁ ▁ ▁ ▁ if ▁ not ▁ check ( cont [ i ] ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ans ▁ = ▁ ' NO ' ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break if ▁ ans ▁ ! = ▁ ' NO ' : ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( n ▁ - ▁ 1 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s1 ▁ = ▁ cont [ j ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s2 ▁ = ▁ cont [ j ▁ + ▁ 1 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s1[0:1 ] ▁ = = ▁ s2[0:1 ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ans ▁ = ▁ ' NO ' ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break print ( ans ) ''' n , m = [ int ( item ) for item in input ( ) . split ( ' ▁ ' ) ] prev , ans = ' ' , ' YES ' for i in range ( n ) : current = input ( ) if current == prev or current . count ( current [ 0 ] ) != m : ans = ' NO ' break prev = current   print ( ans ) NEW_LINE", "def all_same ( s ) : return len ( set ( s ) ) == 1   def solve ( flag ) :   for row in flag : if not all_same ( row ) : return \" NO \" for i in range ( len ( flag ) - 2 ) : if flag [ i ] == flag [ i + 1 ] : return \" NO \" return \" YES \"   rows , cols = map ( int , input ( ) . split ( ) ) flag = [ ] for row in range ( rows ) : row = input ( ) flag . append ( row )   print ( solve ( flag ) ) NEW_LINE" ]
codeforces_1446_A
[ "import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = s . nextInt ( ) ; long w = s . nextLong ( ) ; pair [ ] arr = new pair [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { long val = s . nextLong ( ) ; pair p = new pair ( val , j ) ; arr [ j ] = p ; } Arrays . sort ( arr , new comp ( ) ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; long sum = 0 ; for ( int j = n - 1 ; j >= 0 ; j -- ) { if ( sum + arr [ j ] . data <= w ) { sum = sum + arr [ j ] . data ; list . add ( arr [ j ] . index + 1 ) ; } } long limit = w / 2 ; if ( w % 2 != 0 ) limit ++ ; if ( sum >= limit ) { System . out . println ( list . size ( ) ) ; for ( int j = 0 ; j < list . size ( ) ; j ++ ) { System . out . print ( list . get ( j ) + \" ▁ \" ) ; } System . out . println ( ) ; } else { System . out . println ( - 1 ) ; } } } }   class pair { long data ; int index ; public pair ( long data , int index ) { this . data = data ; this . index = index ; } }   class comp implements Comparator < pair > { public int compare ( pair a , pair b ) { return ( int ) ( a . data - b . data ) ; } }", "import java . util . * ; import java . io . * ;   public class cf_6 { public static void main ( String [ ] args ) { new Solution ( ) . solve ( ) ; } }   class Solution { public void solve ( ) { FastScanner fs = new FastScanner ( ) ; int tests = fs . nextInt ( ) ; testcase : for ( int t = 0 ; t < tests ; t ++ ) { int n = fs . nextInt ( ) ; long w = fs . nextLong ( ) ; int [ ] weights = fs . readIntArray ( n ) ; long minRequired = ( w + 1 ) / 2 ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class KnapSack { 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 ( ) ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } }   public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int t = in . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; long w = in . nextLong ( ) ; Pair arr [ ] = new Pair [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { long temp = in . nextLong ( ) ; arr [ i ] = new Pair ( i + 1 , temp ) ; } Arrays . sort ( arr , new Sort ( ) ) ; ArrayList < Integer > ans = new ArrayList < > ( ) ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( sum + arr [ i ] . val <= w ) { ans . add ( arr [ i ] . ind ) ; sum += arr [ i ] . val ; } }", "import java . awt . Point ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . Scanner ;   public class A1446 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; long W = in . nextLong ( ) ; Point [ ] P = new Point [ N ] ; for ( int n = 0 ; n < N ; n ++ ) { int a = in . nextInt ( ) ; P [ n ] = new Point ( a , n + 1 ) ; } Collections . sort ( Arrays . asList ( P ) , new Comparator < Point > ( ) { @ Override public int compare ( Point o1 , Point o2 ) { return o2 . x - o1 . x ; } } ) ; long weight = 0 ; int count = 0 ; StringBuilder indices = new StringBuilder ( ) ; for ( Point p : P ) { long nextWeight = weight + p . x ; if ( nextWeight <= W ) { count ++ ; indices . append ( p . y ) . append ( ' ▁ ' ) ; weight = nextWeight ; } } if ( 2 * weight >= W ) { System . out . println ( count ) ; System . out . println ( indices ) ; } else { System . out . println ( \" - 1\" ) ; } } }   }" ]
[ "import sys , functools , collections , bisect , math , NEW_LINE INDENT heapqinput = sys . stdin . readline NEW_LINE DEDENT", "import mathfor NEW_LINE _ in range ( int ( input ( ) ) ) : n , w = map ( int , input ( ) . split ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE f = 0 NEW_LINE s = 0 NEW_LINE t = [ ] NEW_LINE for i in range ( n ) : if NEW_LINE l [ i ] >= math . ceil ( w / 2 ) and l [ i ] <= w : t = [ i + 1 ] NEW_LINE s = l [ i ] NEW_LINE break else : s += l [ i ] NEW_LINE if s > w : NEW_LINE INDENT s -= l [ i ] else : NEW_LINE t . append ( i + 1 ) NEW_LINE DEDENT if s >= math . ceil ( w / 2 ) : break NEW_LINE if s >= math . ceil ( w / 2 ) : print ( len ( t ) ) NEW_LINE print ( * t ) else : print ( - 1 ) NEW_LINE", "import sys , mathfrom NEW_LINE collections NEW_LINE import defaultdict , dequeinput = sys . stdin . readline     t = int ( input ( ) ) NEW_LINE while ( t > 0 ) : n , w = map ( int , input ( ) . split ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE", "import sys , mathfrom NEW_LINE collections NEW_LINE import defaultdict , dequeinput = sys . stdin . readline     t = int ( input ( ) ) NEW_LINE while ( t > 0 ) : n , w = map ( int , input ( ) . split ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ll = [ ] NEW_LINE f = 0 NEW_LINE mini = math . ceil ( w / 2 ) NEW_LINE cursum = 0 NEW_LINE for i in range ( n ) : cur = l [ i ] NEW_LINE if ( cur >= mini and cur <= w ) : print ( 1 ) NEW_LINE print ( i + 1 ) NEW_LINE f = 1 NEW_LINE break elif ( cur < mini ) : ll . append ( i + 1 ) NEW_LINE if ( f == 0 ) : ans = [ ] NEW_LINE for i in ll : cursum += l [ i - 1 ] NEW_LINE ans . append ( i ) NEW_LINE if ( cursum >= mini ) : break NEW_LINE if ( cursum >= mini ) : print ( len ( ans ) ) NEW_LINE print ( * ans ) else : print ( - 1 ) NEW_LINE t -= 1   NEW_LINE" ]
codeforces_514_A
[ "import java . util . * ; import java . io . * ;   public class Chewbacca { public static void main ( String [ ] args ) { FastReader reader = new FastReader ( ) ;   String num = reader . nextLine ( ) ; String f = \" \" ; for ( int i = 0 ; i < num . length ( ) ; ++ i ) { if ( i == 0 ) { if ( '5' <= num . charAt ( 0 ) && num . charAt ( 0 ) <= '8' ) System . out . print ( ( char ) ( '0' + 9 - num . charAt ( 0 ) + '0' ) ) ; else System . out . print ( num . charAt ( 0 ) ) ; } else { if ( '5' <= num . charAt ( i ) && num . charAt ( i ) <= '9' ) System . out . print ( ( char ) ( '0' + 9 - num . charAt ( i ) + '0' ) ) ; else System . out . print ( num . charAt ( i ) ) ; } } }   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 ; } } }  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . io . PrintWriter ;       public class A {     public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; String str = sc . next ( ) ; int n = Character . getNumericValue ( str . charAt ( 0 ) ) ; out . print ( ( n != 9 && n >= 5 ) ? ( 9 - n ) : n ) ;    for ( int i = 1 ; i < str . length ( ) ; i ++ ) { n = Character . getNumericValue ( str . charAt ( i ) ) ; if ( n >= 5 ) out . print ( 9 - n ) ;   else out . print ( n ) ; }   out . close ( ) ; }      ", "import java . io . * ; import java . util . * ; import static java . lang . Math . * ;   public class Solution { FastReader sc ; int M = ( int ) ( 1e9 + 7 ) ; boolean tc = false ;   void solver ( int tc ) { try { while ( tc -- != 0 ) { char [ ] ch = sc . next ( ) . toCharArray ( ) ; for ( int i = 0 ; i < ch . length ; i ++ ) { char c = ch [ i ] ; int x = Character . getNumericValue ( c ) ; if ( i == 0 && x == 9 ) System . out . print ( 9 ) ; else System . out . print ( Math . min ( 9 - x , x ) ) ; } } } catch ( Throwable ex ) { ex . printStackTrace ( System . out ) ; } }   void runner ( ) throws IOException { try { sc = new FastReader ( ) ; solver ( tc ? sc . nextInt ( ) : 1 ) ; } catch ( Exception ex ) {   } }   public static void main ( String [ ] args ) { try { new Solution ( ) . runner ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }   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 ; }   } }" ]
[ "s = input ( ) sl = [ ] for j in s : sl . append ( int ( j ) ) i = 0 while i < len ( sl ) : if sl [ i ] >= 5 : if i == 0 and sl [ i ] == 9 : s += ' bruh ' else : sl [ i ] = 9 - sl [ i ] i += 1   k = len ( sl ) p = 1 num = 0 while k > 0 : k -= 1 num += p * sl [ k ] p *= 10 print ( num ) NEW_LINE", "n = str ( input ( ) )   i = 0 store = 0 if n [ i ] == '9' : store = store * 10 + ( ord ( n [ i ] ) - ord ( '0' ) ) i += 1   while i < len ( n ) : if n [ i ] >= '5' : a = ord ( '9' ) - ord ( n [ i ] ) NEW_LINE", "s = input ( ) ans = ' '   if s [ 0 ] == '9' and len ( s ) == 1 : print ( '9' ) else : for i in range ( 0 , len ( s ) ) : check = int ( s [ i ] ) if ( i == 0 and s [ i ] == '9' ) : ans += '9' continue elif check >= 5 : num = 9 - int ( s [ i ] ) ans += str ( num ) else : ans += s [ i ] print ( ans ) NEW_LINE", "def digitList ( n ) : lst = [ ] while n > 0 : lst . append ( n % 10 ) n //= 10 lst . reverse ( ) return lst   def answer ( x ) : lst = digitList ( x ) NEW_LINE", "n = input ( ) s = ' ' for i in n : x = int ( i ) if x > 4 : s = s + str ( 9 - x ) else : s = s + str ( x ) if s [ 0 ] == '0' : print ( '9' + s [ 1 : ] ) else : print ( s ) NEW_LINE" ]
codeforces_479_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . lang . Math . * ; import java . text . DecimalFormat ; import java . util . * ;    public class Main { static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { 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 ; } } static long gcd ( long a , long b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static long sumofdigits ( long x ) { long sum = 0 ; while ( x > 0 ) { sum = sum + x % 10 ; x /= 10 ; } return sum ; } public static void main ( String [ ] args ) throws java . lang . Exception { FastScanner fs = new FastScanner ( ) ; ArrayList < Integer > al = new ArrayList < > ( ) ; int a = fs . nextInt ( ) ; int b = fs . nextInt ( ) ; int c = fs . nextInt ( ) ; al . add ( a + b * c ) ; al . add ( a * ( b + c ) ) ; al . add ( a * b * c ) ; al . add ( a + b + c ) ; al . add ( ( a * b ) + c ) ; al . add ( ( a + b ) * c ) ; int max = Collections . max ( al ) ; System . out . println ( max ) ; } }", "import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int max = Integer . MIN_VALUE ; int ans = a + b + c ; max = Math . max ( ans , max ) ; ans = a + ( b * c ) ; max = Math . max ( ans , max ) ; ans = a * ( b + c ) ; max = Math . max ( ans , max ) ; ans = a * b * c ; max = Math . max ( ans , max ) ; ans = ( a + b ) * c ; max = Math . max ( ans , max ) ; ans = ( a * b ) + c ; max = Math . max ( ans , max ) ; System . out . println ( max ) ; } }", "  import java . util . Scanner ;   public class expreession { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a == 1 && b == 1 && c != 1 ) { System . out . println ( ( a + b ) * c ) ; } else if ( a == 1 && b != 1 && c != 1 ) { System . out . println ( ( a + b ) * c ) ; } else if ( a == 1 && b == 1 && c == 1 ) { System . out . println ( a + b + c ) ; } else if ( a == 1 && b != 1 && c == 1 ) { System . out . println ( a + b + c ) ; } else if ( a != 1 && b == 1 && c == 1 ) { System . out . println ( a * ( b + c ) ) ; } else if ( a != 1 && b == 1 && c != 1 ) { if ( a > c ) { System . out . println ( a * ( b + c ) ) ; } else { System . out . println ( ( a + b ) * c ) ; } } else if ( a != 1 && b != 1 && c == 1 ) { System . out . println ( a * ( b + c ) ) ; } else { System . out . println ( a * b * c ) ; } } }", "import java . io . FileNotFoundException ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ;   public class Main {    public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = a + b + c ; ans = Math . max ( ans , ( a + b ) * c ) ; ans = Math . max ( ans , a * ( b + c ) ) ; ans = Math . max ( ans , a * b * c ) ; System . out . println ( ans ) ; } }" ]
[ "a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) res = max ( a * b * c , a + b + c , ( a + b ) * c , a + ( b * c ) , ( a * b ) + c , a * ( b + c ) ) print ( res ) NEW_LINE", "a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) print ( max ( a + b + c , ( a + b ) * c , a * ( b + c ) , a * b * c ) ) NEW_LINE", "number1 = int ( input ( ) ) number2 = int ( input ( ) ) number3 = int ( input ( ) )   one = number1 + number2 + number3two = number1 * number2 * number3three = ( number1 + number2 ) * number3four = number1 * ( number2 + number3 )   list1 = [ one , two , three , four ]   print ( max ( list1 ) ) NEW_LINE", "a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) print ( max ( a + b + c , a + b * c , ( a + b ) * c , a * b + c , a * ( b + c ) , a * b * c ) ) NEW_LINE" ]
codeforces_432_A
[ "import java . util . Arrays ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class ChoosingTeams { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   String line = scanner . nextLine ( ) ; StringTokenizer tokenizer = new StringTokenizer ( line ) ; int n = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int k = Integer . parseInt ( tokenizer . nextToken ( ) ) ;   int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; }   int [ ] ints = Arrays . stream ( arr ) . filter ( e -> e + k <= 5 ) . toArray ( ) ;   System . out . println ( ints . length / 3 ) ;   } }", "import java . util . Scanner ;   public class A432 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) , k = scanner . nextInt ( ) , count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int y = scanner . nextInt ( ) ; if ( 5 - y >= k ) { count ++ ; } } System . out . println ( count / 3 ) ; } }", "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 ; import java . util . * ; public class A432 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int np = sc . nextInt ( ) ; int nto = sc . nextInt ( ) ; int arr [ ] = new int [ np ] ; for ( int i = 0 ; i < np ; i ++ ) { arr [ i ] = sc . nextInt ( ) + nto ; } int ans = 0 ; for ( int j = 0 ; j < np ; j ++ ) { if ( arr [ j ] <= 5 ) { ans ++ ; } } if ( ans >= 3 ) { ans = ans / 3 ; System . out . println ( ans ) ; } else System . out . println ( 0 ) ; } }", "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 k = sc . nextInt ( ) ; int count = 0 ; int tot = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int m = sc . nextInt ( ) ; if ( 5 - m >= k ) { count ++ ; } if ( count == 3 ) { tot ++ ; count = 0 ; } } System . out . println ( tot ) ; } } ;", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = 0 ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( a [ i ] + k ) <= 5 ) count ++ ; } System . out . println ( count / 3 ) ; } }" ]
[ "n , k = map ( int , input ( ) . split ( ) )   y = [ int ( i ) for i in input ( ) . split ( ) ]   y = [ 5 - i for i in y ]   y . sort ( reverse = True )   NEW_LINE", "from collections import Counterimport math   def solve ( ) : n , k = list ( map ( int , input ( ) . split ( ) ) ) array = list ( map ( int , input ( ) . split ( ) ) ) array . sort ( ) if ( n % 3 == 0 ) : end = n else : end = n - n % 3   i , count = 0 , 0   while i < end - 2 : if array [ i ] + k <= 5 and array [ i + 1 ] + k <= 5 and array [ i + 2 ] + k <= 5 : count += 1 else : break i += 3 return count     print ( solve ( ) ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) count = 0 teams = 0 for num in arr : if num + k <= 5 : count += 1 print ( count // 3 ) NEW_LINE", "s = input ( ) . split ( ' ▁ ' ) n = int ( s [ 0 ] ) k = int ( s [ 1 ] ) s = input ( ) . split ( ' ▁ ' ) l = len ( s ) count = 0 for i in range ( l ) : if ( k + int ( s [ i ] ) <= 5 ) : count = count + 1   print ( int ( count / 3 ) ) NEW_LINE", "a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) )   k = [ ] for i in range ( len ( b ) ) : if 5 - b [ i ] >= a [ 1 ] : k . append ( b [ i ] )   print ( len ( k ) // 3 ) NEW_LINE" ]
codeforces_893_A
[ "import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int [ ] ar = new int [ t ] ; for ( int i = 0 ; i < t ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } int spectator = 3 ; int op1 = 1 ; int op2 = 2 ; boolean ans = true ; for ( int i = 0 ; i < t ; i ++ ) { if ( ar [ i ] != spectator ) { if ( ar [ i ] == op1 ) { int temp = op2 ; op2 = spectator ; spectator = temp ; } else { int temp = op1 ; op1 = spectator ; spectator = temp ; } } else { ans = false ; break ; } } if ( ans ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; }         }     public static long power ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = ans * a ; ans %= c ; } a = a * a ; a %= c ; b /= 2 ; } return ans ; }   public static long power1 ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = multiply ( ans , a , c ) ; } a = multiply ( a , a , c ) ; b /= 2 ;   } return ans ;   }   public static long multiply ( long a , long b , long c ) { long res = 0 ; a %= c ; while ( b > 0 ) { if ( b % 2 == 1 ) { res = ( res + a ) % c ; } a = ( a + a ) % c ; b /= 2 ; }   return res % c ;   }   public static long totient ( long n ) { long result = n ; for ( long i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) {", "import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int [ ] ar = new int [ t ] ; for ( int i = 0 ; i < t ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } int spectator = 3 ; int op1 = 1 ; int op2 = 2 ; boolean ans = true ; for ( int i = 0 ; i < t ; i ++ ) { if ( ar [ i ] != spectator ) { if ( ar [ i ] == op1 ) { int temp = op2 ; op2 = spectator ; spectator = temp ; } else { int temp = op1 ; op1 = spectator ; spectator = temp ; } } else { ans = false ; break ; } } if ( ans ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; }         }     public static long power ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = ans * a ; ans %= c ; } a = a * a ; a %= c ; b /= 2 ; } return ans ; }   public static long power1 ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = multiply ( ans , a , c ) ; } a = multiply ( a , a , c ) ; b /= 2 ;   } return ans ;   }   public static long multiply ( long a , long b , long c ) { long res = 0 ; a %= c ; while ( b > 0 ) { if ( b % 2 == 1 ) { res = ( res + a ) % c ; } a = ( a + a ) % c ; b /= 2 ; }   return res % c ;   }   public static long totient ( long n ) { long result = n ; for ( long i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) {", "import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ; import java . util . jar . JarOutputStream ;   public class Practise {    public static void main ( String [ ] args ) {", "import java . util . * ; public class ChessForThree { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int winner [ ] = new int [ n ] ; int loser [ ] = new int [ n ] ; int spectator [ ] = new int [ n ] ; boolean flag = true ; int first = 1 ; for ( int i = 0 ; i < n ; i ++ ) { winner [ i ] = sc . nextInt ( ) ; } spectator [ 0 ] = 3 ; loser [ 0 ] = winner [ 0 ] == 1 ? 2 : 1 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( winner [ i ] != winner [ i + 1 ] ) { loser [ i + 1 ] = winner [ i ] ; spectator [ i + 1 ] = loser [ i ] ; } else { spectator [ i + 1 ] = loser [ i ] ; loser [ i + 1 ] = spectator [ i ] ; } if ( ( spectator [ i + 1 ] == winner [ i + 1 ] ) || ( winner [ 0 ] == 3 ) ) flag = false ; } if ( flag && winner [ 0 ] != 3 ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } }", "import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ;   public class A893 {       static int mod = ( int ) ( 1e9 + 7 ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader in = new FastReader ( ) ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String args [ ] ) {   int tc = 1 ;" ]
[ "n = int ( input ( ) ) cur = 1 NEW_LINE", "n = int ( input ( ) ) now = [ 1 , 2 ] for i in range ( n ) : a = int ( input ( ) ) if a == now [ 0 ] : now [ 1 ] = 6 - sum ( now ) elif a == now [ 1 ] : now [ 0 ] = 6 - sum ( now ) else : print ( \" NO \" ) breakelse : print ( \" YES \" ) NEW_LINE", "n = int ( input ( ) ) a , b , c = 1 , 2 , 3 for _ in range ( n ) : x = int ( input ( ) ) if x == c : print ( \" NO \" ) exit ( ) t1 = x t2 = a + b - x t3 = c a = t1 b = t3 c = t2   print ( \" YES \" ) NEW_LINE", "n = int ( input ( ) ) spectator = 3 flag = Truefor i in range ( n ) : winner = int ( input ( ) ) if winner == spectator : flag = False break if 1 != spectator and 1 != winner : spectator = 1 elif 2 != spectator and 2 != winner : spectator = 2 elif 3 != spectator and 3 != winner : spectator = 3 if flag : print ( \" YES \" ) else : print ( \" NO \" )   NEW_LINE", "n = int ( input ( ) ) spectator = 3 flag = Truefor i in range ( n ) : winner = int ( input ( ) ) if winner == spectator : flag = False break spectator = 6 - winner - spectatorif flag : print ( \" YES \" ) else : print ( \" NO \" )   NEW_LINE" ]
codeforces_1138_B
[ "import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class C { static BufferedReader br ; static int cin ( ) throws Exception { return Integer . valueOf ( br . readLine ( ) ) ; } static int [ ] split ( ) throws Exception { String [ ] cmd = br . readLine ( ) . split ( \" ▁ \" ) ; int [ ] ans = new int [ cmd . length ] ; for ( int i = 0 ; i < cmd . length ; i ++ ) { ans [ i ] = Integer . valueOf ( cmd [ i ] ) ; } return ans ; } static long p = 1000000007 ; static long power ( long x , long y ) { long res = 1 ; x = x % p ; if ( x == 0 ) return 0 ; while ( y > 0 ) { if ( ( y & 1 ) == 1 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } public static void main ( String [ ] args ) throws Exception {", "import java . util . * ; import java . io . * ;   public class Circus {  " ]
[ "\"\"\" 400110101 \"\"\"     def calc ( s , n , d ) : cnts = [ len ( v ) for v in d . values ( ) ]   half = n // 2 for a in range ( 0 , cnts [ 0 ] + 1 ) : for b in range ( 0 , cnts [ 1 ] + 1 ) : c = n - 2 * a - b - s d = a + s - half   if 0 <= c <= cnts [ 2 ] and 0 <= d <= cnts [ 3 ] and a + b + c + d == half and b + c + 2 * d == s : return True , a , b , c , d return False ,     def main ( ) : n = int ( input ( ) ) c_arr = list ( map ( int , list ( input ( ) ) ) ) a_arr = list ( map ( int , list ( input ( ) ) ) )   s = 0 kinds = [ ( 0 , 0 ) , ( 0 , 1 ) , ( 1 , 0 ) , ( 1 , 1 ) ] d = { kind : [ ] for kind in kinds } for i in range ( n ) : if a_arr [ i ] == 1 : s += 1   d [ ( c_arr [ i ] , a_arr [ i ] ) ] . append ( i )   result , * params = calc ( s , n , d )   if not result : print ( - 1 ) else : flags = [ False ] * n   for i , kind in enumerate ( kinds ) : for j in range ( params [ i ] ) : ix = d [ kind ] [ j ] flags [ ix ] = True   for i in range ( n ) : if flags [ i ] : print ( i + 1 , end = ' ▁ ' )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "\"\"\" 400110101 \"\"\"     def calc ( s , n , d ) : cnts = [ len ( v ) for v in d . values ( ) ]   half = n // 2 for a in range ( 0 , cnts [ 0 ] + 1 ) : for b in range ( 0 , cnts [ 1 ] + 1 ) : c = n - 2 * a - b - s d = a + s - half   if 0 <= c <= cnts [ 2 ] and 0 <= d <= cnts [ 3 ] and a + b + c + d == half and b + c + 2 * d == s : return True , a , b , c , d return False ,     def main ( ) : n = int ( input ( ) ) c_arr = list ( map ( int , list ( input ( ) ) ) ) a_arr = list ( map ( int , list ( input ( ) ) ) )   s = 0 kinds = [ ( 0 , 0 ) , ( 0 , 1 ) , ( 1 , 0 ) , ( 1 , 1 ) ] d = { kind : [ ] for kind in kinds } for i in range ( n ) : if a_arr [ i ] == 1 : s += 1   d [ ( c_arr [ i ] , a_arr [ i ] ) ] . append ( i )   result , * params = calc ( s , n , d )   if not result : print ( - 1 ) else : ans = [ ] for i , kind in enumerate ( kinds ) : for j in range ( params [ i ] ) : ix = d [ kind ] [ j ] ans . append ( str ( ix + 1 ) ) print ( ' ▁ ' . join ( ans ) )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "\"\"\" 400110101 \"\"\" import sysinput = sys . stdin . readline     def calc ( s , n , d ) : cnts = [ len ( v ) for v in d . values ( ) ]   half = n // 2 for a in range ( 0 , cnts [ 0 ] + 1 ) : for b in range ( 0 , cnts [ 1 ] + 1 ) : c = n - 2 * a - b - s d = a + s - half   if 0 <= c <= cnts [ 2 ] and 0 <= d <= cnts [ 3 ] and a + b + c + d == half and b + c + 2 * d == s : return True , a , b , c , d return False ,     def main ( ) : n = int ( input ( ) ) c_arr = list ( map ( int , list ( input ( ) . rstrip ( ) ) ) ) a_arr = list ( map ( int , list ( input ( ) . rstrip ( ) ) ) )   s = 0 kinds = [ ( 0 , 0 ) , ( 0 , 1 ) , ( 1 , 0 ) , ( 1 , 1 ) ] d = { kind : [ ] for kind in kinds } for i in range ( n ) : if a_arr [ i ] == 1 : s += 1   d [ ( c_arr [ i ] , a_arr [ i ] ) ] . append ( i )   result , * params = calc ( s , n , d )   if not result : print ( - 1 ) else : ans = [ ] for i , kind in enumerate ( kinds ) : for j in range ( params [ i ] ) : ix = d [ kind ] [ j ] ans . append ( str ( ix + 1 ) ) print ( ' ▁ ' . join ( ans ) )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE" ]
codeforces_1372_A
[ "import java . util . Arrays ; import java . util . Locale ; import java . util . Scanner ; import java . lang . String ; import java . util . Random ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; for ( int j = 0 ; j < a ; j ++ ) {   int n = sc . nextInt ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( 1 + \" ▁ \" ) ; } System . out . println ( ) ; } } }", "import java . util . * ;   public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- != 0 ) { long m , s = 0 , d , x , y , a , b ; x = sc . nextInt ( ) ; for ( int i = 0 ; i < x ; i ++ ) System . out . print ( 1 + \" ▁ \" ) ; System . out . println ( ) ; } } }", "import java . util . Scanner ;   public class OmkarAndComp {   public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t > 0 ) { int natasha = s . nextInt ( ) ; for ( int i = natasha ; i > 0 ; i -- ) { System . out . print ( 1 + \" ▁ \" ) ; } System . out . println ( ) ; t -- ; }   }   }", "import java . util . Scanner ;   public class DigestThread {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = in . nextInt ( ) ; for ( int j = 0 ; j < n ; j ++ ) { System . out . print ( \"1 ▁ \" ) ; } System . out . println ( \" \" ) ; } } }" ]
[ "t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) for j in range ( n ) : print ( '1' , end = \" ▁ \" ) print ( ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : print ( * [ 1 ] * int ( input ( ) ) , sep = \" ▁ \" ) NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : a = int ( input ( ) ) print ( '1 ▁ ' * a ) NEW_LINE", "def create_array ( n ) : a = [ ] up = 0 c = 0 while ( n ) : up = c * 2 + 1 a . append ( up ) if up > 0 else - 1 n -= 1 if n == 0 : break down = 1000 - up a . append ( down ) if down > 0 else - 1 n -= 1 c += 1 print ( \" ▁ \" . join ( map ( str , a ) ) )     for _ in range ( int ( input ( ) ) ) : create_array ( int ( input ( ) ) ) NEW_LINE", "from collections import Counter   def solve ( ) : n = int ( input ( ) ) array = [ 1 for i in range ( n ) ] return array     for i in range ( int ( input ( ) ) ) : for i in solve ( ) : print ( i , end = \" ▁ \" ) print ( ) NEW_LINE" ]
codeforces_1267_B
[ "import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ;   public class _0589BallsOfBuma {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; int left = 0 ; int right = 0 ; int count = 0 ; List < Integer > length = new ArrayList < > ( ) ; List < Character > letter = new ArrayList < > ( ) ; int len = 1 ; for ( int i = 0 ; i < s . length ( ) - 1 ; i ++ ) { if ( s . charAt ( i ) == s . charAt ( i + 1 ) ) { len ++ ; } else {", "import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . security . AccessControlException ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; public class _p001267B { static public void main ( final String [ ] args ) throws IOException { p001267B . _main ( args ) ; }", "  import java . util . * ;   public class Main { public static int solve ( String str ) { int ans , i , j ; i = 0 ; j = str . length ( ) - 1 ; while ( true ) { ans = 1 ; if ( str . charAt ( i ) != str . charAt ( j ) || i == j ) return - 1 ; while ( i < str . length ( ) - 1 ) { if ( str . charAt ( i ++ ) != str . charAt ( i ) ) break ; ans ++ ; } if ( i >= j ) return ans ; while ( j >= 1 ) { if ( str . charAt ( j -- ) != str . charAt ( j ) ) break ; ans ++ ; } if ( ans < 2 ) return - 1 ; } } public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String str = input . next ( ) ; System . out . println ( solve ( str ) < 2 ? 0 : solve ( str ) + 1 ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class Main { static BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   public static void main ( String [ ] args ) throws IOException { String text = input . readLine ( ) ;   int len = 1 ; for ( int i = 1 ; i < text . length ( ) ; i ++ ) if ( text . charAt ( i ) != text . charAt ( i - 1 ) ) len ++ ;   if ( len % 2 == 0 ) { System . out . println ( 0 ) ; return ; }   String [ ] tokens = new String [ len ] ; int current = 0 ; int last = 0 ; for ( int i = 1 ; i < text . length ( ) ; i ++ ) if ( text . charAt ( i ) != text . charAt ( i - 1 ) ) { tokens [ current ] = text . substring ( last , i ) ; last = i ; current ++ ; } tokens [ current ] = text . substring ( last ) ;   for ( int i = 0 ; i < tokens . length / 2 ; i ++ ) if ( tokens [ i ] . charAt ( 0 ) != tokens [ len - i - 1 ] . charAt ( 0 ) || tokens [ i ] . length ( ) + tokens [ len - i - 1 ] . length ( ) <= 2 ) { System . out . println ( 0 ) ; return ; }   if ( tokens [ len / 2 ] . length ( ) <= 1 ) { System . out . println ( 0 ) ; return ; }   System . out . println ( tokens [ len / 2 ] . length ( ) + 1 ) ; } }" ]
[ "li = list ( input ( ) ) i = 0j = len ( li ) - 1 while i <= j : tmp = li [ i ] res = 0 if li [ i ] != li [ j ] : print ( 0 ) exit ( ) while i <= j and li [ i ] == tmp : res += 1 i += 1 while i <= j and li [ j ] == tmp : res += 1 j -= 1 if res <= 2 and i < j : print ( 0 ) exit ( ) if res > 1 : print ( res + 1 ) else : print ( 0 ) NEW_LINE", "s = input ( ) j = len ( s ) - 1 i = 0 while i <= j : c = 0 p = s [ i ] if p != s [ j ] : exit ( print ( 0 ) ) while i <= j and s [ i ] == p : i += 1 c += 1 while i <= j and s [ j ] == p : j -= 1 c += 1 if c <= 2 and i < j : exit ( print ( 0 ) ) if c > 1 : print ( c + 1 ) else : print ( 0 ) NEW_LINE", "i = input ( ) i += \" $ \" current = i [ 0 ] mapped = [ ] c = 0 ris = 0   for x in i : if x == current : c += 1 else : mapped . append ( ( c , current ) ) current = x c = 1 n = len ( mapped ) if n % 2 == 0 : print ( 0 ) elif mapped [ n // 2 ] [ 0 ] < 2 : print ( 0 ) else : for x in range ( ( n // 2 ) + 1 ) : if mapped [ x ] [ 0 ] + mapped [ n - x - 1 ] [ 0 ] < 3 or mapped [ x ] [ 1 ] != mapped [ n - x - 1 ] [ 1 ] : print ( 0 ) break else : print ( mapped [ n // 2 ] [ 0 ] + 1 ) NEW_LINE", "def run ( ) : s = input ( ) i = 0 j = len ( s ) - 1 count = 0 while i <= j : if s [ i ] != s [ j ] : return 0 c = s [ i ] count = 0 while i < len ( s ) and s [ i ] == c and i <= j : i += 1 count += 1 while j >= 0 and s [ j ] == c and i <= j : j -= 1 count += 1 if i > j : count += 1 if count >= 3 : return count else : return 0 elif count < 3 : return 0 print ( run ( ) ) NEW_LINE", "if __name__ == \" _ _ main _ _ \" : colours = input ( ) temp = [ ] i = 0 n = len ( colours ) while i < n : current = colours [ i ] start = i while i + 1 < n and colours [ i + 1 ] == current : if i + 1 < n : i = i + 1 else : break end = i temp . append ( [ end - start + 1 , current ] ) i = i + 1 NEW_LINE" ]
codeforces_246_A
[ "import java . util . * ; public class BuggySorting {   public static void main ( String [ ] args ) {", "import java . util . * ; public class BuggySorting {   public static void main ( String [ ] args ) {", "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 = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static int oo = ( int ) 1e7 ;", "import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; if ( n == 1 || n == 2 ) System . out . println ( - 1 ) ; else { for ( int i = n ; i >= 1 ; i -- ) { System . out . print ( i + \" ▁ \" ) ; } }   } }" ]
[ "n = int ( input ( ) ) if n <= 2 : print ( \" - 1\" ) else : for i in range ( n , 0 , - 1 ) : print ( i , end = \" ▁ \" ) NEW_LINE", "n = int ( input ( ) ) if n == 1 or n == 2 : print ( - 1 ) else : arr = [ int ( i ) for i in range ( n , 0 , - 1 ) ] print ( * arr ) NEW_LINE", "n = int ( input ( ) )   if n == 1 or n == 2 : print ( - 1 ) else : print ( * range ( n , 0 , - 1 ) ) NEW_LINE", "import mathdef solve ( n ) : if n <= 2 : return [ - 1 ] return [ i for i in range ( n , 0 , - 1 ) ] def main ( ) : n = int ( input ( ) ) NEW_LINE", "n = int ( input ( ) )   if n > 2 : for i in range ( n , 0 , - 1 ) : print ( i , end = ' ▁ ' ) else : print ( - 1 ) NEW_LINE" ]
codeforces_1266_B
[ "import java . util . Scanner ;   public class _0709DiceTower {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { long n = sc . nextLong ( ) ; if ( n <= 14 ) { System . out . println ( \" NO \" ) ; } else if ( n % 14 <= 6 && n % 14 >= 1 ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } }   }", "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; long [ ] x = new long [ t ] ; for ( int i = 0 ; i < t ; i ++ ) { x [ i ] = sc . nextLong ( ) ; } int [ ] a = { 15 , 16 , 17 , 18 , 19 , 20 } ; boolean f ; for ( int i = 0 ; i < t ; i ++ ) { if ( x [ i ] < 15 ) { System . out . println ( \" NO \" ) ; } else { f = false ; for ( int j = 0 ; j < 6 ; j ++ ) { if ( ( x [ i ] - a [ j ] ) % 14 == 0 ) { System . out . println ( \" YES \" ) ; f = true ; break ; } } if ( ! f ) System . out . println ( \" NO \" ) ; } } } }  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;" ]
[ "t = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) for x in a : if x > 14 and x % 14 in range ( 1 , 7 ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE", "t = int ( input ( ) ) s = [ int ( x ) for x in input ( ) . split ( ) ] for i in s : if i > 14 : if ( i - 1 ) % 14 == 0 : print ( ' YES ' ) elif ( i - 2 ) % 14 == 0 : print ( ' YES ' ) elif ( i - 3 ) % 14 == 0 : print ( ' YES ' ) elif ( i - 4 ) % 14 == 0 : print ( ' YES ' ) elif ( i - 5 ) % 14 == 0 : print ( ' YES ' ) elif ( i - 6 ) % 14 == 0 : print ( ' YES ' ) else : print ( ' NO ' ) else : print ( ' NO ' ) NEW_LINE", "t = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) for i in x : if i % 14 > 0 and i % 14 < 7 and i >= 15 : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "t = int ( input ( \" \" ) ) x = [ int ( n ) for n in input ( ' ' ) . split ( ' ▁ ' ) [ : t ] ] ans = [ ' NO ' , ' YES ' ]   for n in x : print ( ans [ int ( n % 14 != 0 and n % 14 < 7 and n > 14 ) ] ) NEW_LINE", "n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) for i in li : tmp = i % 14 dc = i // 14 if 6 >= tmp >= 1 and dc >= 1 : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE" ]
codeforces_1339_B
[ "import java . util . * ; import java . io . * ;   public class CFA { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; private static final long MOD = 1000L * 1000L * 1000L + 7 ; private static final int [ ] dx = { 0 , - 1 , 0 , 1 } ; private static final int [ ] dy = { 1 , 0 , - 1 , 0 } ; private static final String yes = \" Yes \" ; private static final String no = \" No \" ;   void solve ( ) { int T = nextInt ( ) ;", "import java . io . * ; import java . util . * ;   public class B_1339 { 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 ( \" ▁ \" ) ;   int i = 0 ; int j = 0 ; int n = 0 ; int arr [ ] ; int t = 0 ;   t = Integer . parseInt ( br . readLine ( ) ) ;   for ( i = 0 ; i <= t - 1 ; i ++ ) { n = Integer . parseInt ( br . readLine ( ) ) ;   arr = new int [ n ] ;   token = new StringTokenizer ( br . readLine ( ) ) ; for ( j = 0 ; j <= n - 1 ; j ++ ) arr [ j ] = Integer . parseInt ( token . nextToken ( ) ) ;   getResult ( n , arr ) ; }   pw . close ( ) ;   }   private static void getResult ( int n , int arr [ ] ) { Arrays . sort ( arr ) ;   int i = 0 ; int newarr [ ] = new int [ n ] ; int count = 0 ;   while ( i <= n - 1 ) { newarr [ i ] = arr [ n - 1 - count ] ; i ++ ; if ( i <= n - 1 ) { newarr [ i ] = arr [ count ] ; i ++ ; } count ++ ; }   for ( i = n - 1 ; i >= 0 ; i -- ) pw . print ( newarr [ i ] + \" ▁ \" ) ; pw . println ( ) ;     } }", "import java . util . * ; import java . io . * ; public class MyClass { public static void main ( String args [ ] ) { 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 ( ) ; } Arrays . sort ( arr ) ; int mid = n / 2 , st = 0 ; if ( n % 2 != 0 ) { System . out . print ( arr [ mid ] + \" ▁ \" ) ; st += 1 ; } for ( int i = mid - 1 ; i >= 0 ; i -- ) { System . out . print ( arr [ mid + st ++ ] + \" ▁ \" + arr [ i ] + \" ▁ \" ) ; } System . out . println ( ) ; } sc . close ( ) ; } }" ]
[ "def min_adj ( ) : for i in range ( int ( input ( ) ) ) : length = int ( input ( ) ) lst = list ( map ( int , input ( ) . split ( ) ) ) lst . sort ( ) new = [ ] while lst != [ ] : if len ( lst ) == 1 : new . append ( lst [ 0 ] ) break new . append ( lst . pop ( ) ) new . append ( lst [ 0 ] ) lst . pop ( 0 ) print ( * new [ : : - 1 ] ) min_adj ( ) NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) arr = [ int ( x ) for x in input ( ) . split ( ) ] arr . sort ( ) if ( n % 2 == 0 ) : ki = n // 2 - 1 ka = n // 2 while ( ki >= 0 and ka < n ) : print ( arr [ ka ] , arr [ ki ] , end = \" ▁ \" ) ka += 1 ki -= 1 print ( ) else : ki = n // 2 - 1 ka = n // 2 + 1 print ( arr [ n // 2 ] , end = \" ▁ \" ) while ( ki >= 0 and ka < n ) : print ( arr [ ka ] , arr [ ki ] , end = \" ▁ \" ) ka += 1 ki -= 1 print ( )   NEW_LINE", "import sys   def answer ( n , a ) : lst = [ ] a . sort ( ) for i in range ( n // 2 ) : lst . append ( a [ i ] ) lst . append ( a [ n - i - 1 ] ) if n % 2 == 1 : lst . append ( a [ n // 2 ] ) lst . reverse ( ) return lst   def main ( ) : t = int ( input ( ) ) while t : n = int ( input ( ) ) a = [ int ( i ) for i in sys . stdin . readline ( ) . split ( ) ] print ( ' ▁ ' . join ( map ( str , answer ( n , a ) ) ) ) t -= 1 returnmain ( ) NEW_LINE", "from collections import dequecases = int ( input ( ) ) while cases : cases -= 1 num = int ( input ( ) ) arr = sorted ( map ( int , input ( ) . split ( ) ) ) ans = [ ] arr = deque ( arr ) while arr : ans . append ( arr . pop ( ) )   if arr : ans . append ( arr . popleft ( ) ) print ( * ans [ : : - 1 ] ) NEW_LINE" ]
codeforces_267_A
[ "import java . util . * ; import java . io . * ;   public class Subtractions { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int n = reader . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = reader . nextInt ( ) ; int b = reader . nextInt ( ) ; int max = Math . max ( a , b ) ; int min = Math . min ( a , b ) ; int count = 0 ; while ( min > 0 && max >= 0 && min != max ) { count += max / min ; max = max % min ;", "import java . io . * ; import java . util . * ; public class Solution { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sum = 0 ; while ( a > 0 && b > 0 ) { if ( a > b ) { sum += a / b ; a = a % b ; } else { sum += b / a ; b = b % a ; } } out . println ( sum ) ; }", "import java . util . Scanner ;   public class Subtractions {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans ;   if ( b < a ) { ans = a / b ; a = a % b ; while ( a != 0 && b != 0 ) { ans += ( a == 0 ) ? 0 : b / a ; b = ( a == 0 ) ? 0 : b % a ; ans += ( b == 0 ) ? 0 : a / b ; a = ( b == 0 ) ? 0 : a % b ; } } else { ans = b / a ; b = b % a ; while ( a != 0 && b != 0 ) { ans += ( b == 0 ) ? 0 : a / b ; a = ( b == 0 ) ? 0 : a % b ; ans += ( a == 0 ) ? 0 : b / a ; b = ( a == 0 ) ? 0 : b % a ; } }   System . out . println ( ans ) ; } } }", "import java . util . Scanner ;   public class Subtractions {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( b < a ) { int ans = a / b ; a = a % b ; while ( a != 0 && b != 0 ) { ans += ( a == 0 ) ? 0 : b / a ; b = ( a == 0 ) ? 0 : b % a ; ans += ( b == 0 ) ? 0 : a / b ; a = ( b == 0 ) ? 0 : a % b ; }   System . out . println ( ans ) ; } else { int ans = b / a ; b = b % a ; while ( a != 0 && b != 0 ) { ans += ( b == 0 ) ? 0 : a / b ; a = ( b == 0 ) ? 0 : a % b ; ans += ( a == 0 ) ? 0 : b / a ; b = ( a == 0 ) ? 0 : b % a ; }    System . out . println ( ans ) ; } } } }", "import java . io . * ; import java . util . * ;   public class Solution {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; for ( int i = 0 ; i < num ; i ++ ) { int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int counter = 0 ; while ( a > 0 && b > 0 ) { int smaller = Math . min ( a , b ) ; if ( a == smaller ) { counter += ( b / a ) ; b %= a ; continue ; } counter += ( a / b ) ; a %= b ; } System . out . println ( counter ) ; } } }" ]
[ "import sys   def num_ops ( low , high ) : if high % low == 0 : return high // low else : return ( high // low ) + num_ops ( high % low , low )   def main ( ) : n = int ( sys . stdin . readline ( ) . strip ( ) ) for _ in range ( n ) : low , high = [ int ( i ) for i in sys . stdin . readline ( ) . strip ( ) . split ( ) ] print ( num_ops ( low , high ) )         if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "def max1 ( a , b ) : if a >= b : return a , b else : return b , adef minus ( a , b ) : p = a // b cnt = p return b , ( a - ( b * cnt ) ) , cntn = int ( input ( ) ) for _ in range ( n ) : a , b = input ( ) . split ( ) a = int ( a ) b = int ( b ) cnt = 0   while a > 0 and b > 0 : a , b = max1 ( a , b ) a , b , p = minus ( a , b ) cnt += p   print ( cnt ) NEW_LINE", "n = input ( ) n1 = int ( n ) c = [ ] for i in range ( 0 , n1 ) : z4 = 0 p , q = input ( ) . split ( ) a = int ( p ) b = int ( q ) while a != 0 and b != 0 : z1 = z3 = 0 if a <= b : z = ( b / a ) z1 = int ( z ) b = b - ( z1 * a ) if b <= a and b != 0 : z2 = a / b z3 = int ( z2 ) a = a - ( z3 * b ) z4 = z4 + z1 + z3 c . append ( z4 ) l = len ( c ) for j in range ( 0 , l ) : print ( c [ j ] ) NEW_LINE", "def substraction ( a , b ) : if a == 0 or b == 0 : return 0 else : if a > b : count = a // b return substraction ( a % b , b ) + count else : count = b // a return substraction ( a , b % a ) + count   t = int ( input ( ) ) lst = [ ] res = [ ] for i in range ( 0 , t ) : lst = [ int ( i ) for i in input ( ) . split ( ) ] ele = substraction ( lst [ 0 ] , lst [ 1 ] ) res . append ( ele )   for i in range ( 0 , t ) : print ( res [ i ] ) NEW_LINE" ]
codeforces_1454_A
[ "import java . util . Scanner ;   public class A1454 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) {   int n = scanner . nextInt ( ) ; if ( n == 1 ) System . out . println ( 1 ) ; else for ( int j = 1 ; j <= n ; j ++ ) { if ( j != n ) System . out . print ( ( j + 1 ) + \" ▁ \" ) ; else System . out . print ( 1 + \" ▁ \" ) ; } System . out . println ( ) ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Set ;   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 sc = new FastReader ( ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a = sc . nextInt ( ) ; if ( a % 2 == 0 ) { for ( int i = a ; i > 0 ; i -- ) System . out . print ( i + \" ▁ \" ) ; } else { for ( int i = a ; i > a / 2 + 1 ; i -- ) System . out . print ( i + \" ▁ \" ) ; for ( int i = 1 ; i <= a / 2 ; i ++ ) System . out . print ( i + \" ▁ \" ) ; System . out . print ( a / 2 + 1 ) ; } System . out . println ( ) ; }   }   }", "import java . io . * ; import java . util . * ;   public class A { public static void main ( String [ ] args ) throws IOException { FastReader fr = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; int t = fr . nextInt ( ) ;   while ( t -- > 0 ) { int n = fr . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i == n ) pr . print ( \"1 ▁ \" ) ; else pr . print ( ( i + 1 ) + \" ▁ \" ) ; } pr . println ( ) ; }   pr . close ( ) ; }   static class Pair { int x , y ; public Pair ( int x , int y ) { this . x = x ; this . y = y ; } }   static int toInt ( String s ) { return Integer . parseInt ( s ) ; }   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) throws FileNotFoundException { 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 . * ; public class permutation { public static void main ( String [ ] args ) { int t , n , i ;   Scanner sc = new Scanner ( System . in ) ;   t = sc . nextInt ( ) ;   while ( t -- > 0 ) { n = sc . nextInt ( ) ;   for ( i = 0 ; i < n ; i ++ ) { System . out . println ( ( i + 1 ) % n + 1 ) ; } } } }" ]
[ "for _ in range ( int ( input ( ) ) ) :   NEW_LINE n = int ( input ( ) )   for i in range ( 2 , n + 1 ) : print ( i , end = \" ▁ \" )   print ( 1 ) NEW_LINE", "for s in [ * open ( 0 ) ] [ 1 : ] : n = int ( s ) ; print ( n , * range ( 1 , n ) ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE l = [ ] NEW_LINE for i in range ( 1 , n + 1 ) : l . append ( i ) NEW_LINE for i in l [ 1 : ] : print ( i , end = \" ▁ \" ) NEW_LINE print ( l [ 0 ] ) NEW_LINE", "from collections import Counter   NEW_LINE def solve ( ) : array = [ int ( i ) for i in range ( int ( input ( ) ) , 0 , - 1 ) ] NEW_LINE if len ( array ) % 2 : temp = array [ len ( array ) // 2 ] NEW_LINE array [ len ( array ) // 2 ] = 1 NEW_LINE array [ - 1 ] = temp NEW_LINE return array   for i in range ( int ( input ( ) ) ) : for NEW_LINE i in solve ( ) : print ( i , end = \" ▁ \" ) NEW_LINE print ( ) NEW_LINE", "for i in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE l = [ ] NEW_LINE for j in range ( n ) : l . append ( j + 1 ) NEW_LINE l . reverse ( ) NEW_LINE if n % 2 == 0 : for NEW_LINE k in l : print ( k ) else : x = n // 2 NEW_LINE l [ x ] , l [ 0 ] = l [ 0 ] , l [ x ] NEW_LINE for k in l : print ( k ) NEW_LINE" ]
codeforces_1363_B
[ "import java . util . Scanner ;   public class SubsequenceHate {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t -- > 0 ) { String s = scan . next ( ) ; int n = s . length ( ) ; char [ ] a = s . toCharArray ( ) ; int one = 0 ; int zero = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == '0' ) { ++ zero ; } else { ++ one ; } } int c = 0 ; int k = 0 ; int res = 1000000000 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == '1' ) { ++ c ; } else { ++ k ; } res = Math . min ( res , one - c + k ) ;   } c = 0 ; k = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == '0' ) { ++ c ; } else { ++ k ; } res = Math . min ( res , zero - c + k ) ; } System . out . println ( res ) ; } } }", "import java . io . * ;   import java . util . * ; public class Solution { public static void main ( String [ ] args ) throws Exception { FastReader fr = new FastReader ( ) ; int t = fr . nextInt ( ) ; while ( t -- > 0 ) { String s = fr . next ( ) ; int n = s . length ( ) ; int one = 0 ; int zero = 0 ; for ( char c : s . toCharArray ( ) ) { if ( c == '0' ) zero ++ ; else one ++ ; } int min = Integer . MAX_VALUE ; int prefz = 0 ; int prefo = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '0' ) { prefz ++ ; } else { prefo ++ ; } if ( s . charAt ( i ) == '0' ) zero -- ; else one -- ; min = Math . min ( min , Math . min ( prefz + one , prefo + zero ) ) ; } System . out . println ( min ) ; } } public static boolean check ( String s ) {", "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 ) { String str = s . next ( ) ; int n = str . length ( ) ; int prefix0 [ ] = new int [ n ] ; int prefix1 [ ] = new int [ n ] ; int suffix0 [ ] = new int [ n ] ; int suffix1 [ ] = new int [ n ] ; prefix0 [ 0 ] = str . charAt ( 0 ) == '0' ? 1 : 0 ; prefix1 [ 0 ] = str . charAt ( 0 ) - '0' ; for ( int i = 1 ; i < str . length ( ) ; i ++ ) { prefix0 [ i ] = prefix0 [ i - 1 ] ; prefix1 [ i ] = prefix1 [ i - 1 ] ; if ( str . charAt ( i ) == '0' ) { prefix0 [ i ] ++ ; } else { prefix1 [ i ] ++ ; } } suffix0 [ n - 1 ] = str . charAt ( n - 1 ) == '0' ? 1 : 0 ; suffix1 [ n - 1 ] = str . charAt ( n - 1 ) - '0' ; for ( int i = n - 2 ; i >= 0 ; i -- ) { suffix0 [ i ] = suffix0 [ i + 1 ] ; suffix1 [ i ] = suffix1 [ i + 1 ] ; if ( str . charAt ( i ) == '0' ) { suffix0 [ i ] ++ ; } else { suffix1 [ i ] ++ ; } } int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int opt = Math . min ( n - prefix0 [ i ] - suffix1 [ i ] , n - prefix1 [ i ] - suffix0 [ i ] ) ; ans = Math . min ( ans , opt ) ; } System . out . println ( ans ) ; } } }" ]
[ "import timestartTimeProblem = time . time ( )   import fileinput , sys , itertools , functools , mathfrom bisect import * from heapq import * from collections import *     MOD = 10 ** 9 + 7 NEW_LINE", "for _ in range ( int ( input ( ) ) ) : s = input ( ) pre = [ int ( s [ 0 ] ) ] suf = [ int ( s [ - 1 ] ) == 0 ] n = len ( s ) for i in range ( 1 , n ) : if s [ i ] == '1' : pre . append ( pre [ - 1 ] + 1 ) else : pre . append ( pre [ - 1 ] )   if s [ n - i - 1 ] == '0' : suf . insert ( 0 , suf [ 0 ] + 1 ) else : suf . insert ( 0 , suf [ 0 ] ) NEW_LINE" ]
codeforces_1312_A
[ "import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ;", "import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a , b ; int t = input . nextInt ( ) ; while ( t != 0 ) { a = input . nextInt ( ) ; b = input . nextInt ( ) ; if ( a % b == 0 ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } t -- ; } } }", "import java . util . Scanner ;   public class A1312 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; System . out . println ( n % m == 0 ? \" YES \" : \" NO \" ) ; } } }" ]
[ "t = int ( input ( ) ) for i in range ( t ) : a , b = map ( int , input ( ) . split ( ) ) if a % b == 0 : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "import sysimport bisectdef gcd ( a , b ) : if ( a == 0 ) : return b return gcd ( b % a , a ) def input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( str , input ( ) . split ( ) ) ) for _ in range ( iinput ( ) ) : a , b = minput ( ) if a % b : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "from sys import stdininput = stdin . readline   t = int ( input ( ) ) for _ in range ( t ) : n , m = [ int ( x ) for x in input ( ) . split ( ) ] print ( [ \" NO \" , \" YES \" ] [ n % m == 0 ] ) NEW_LINE", "def tworegularpolygons ( n , m ) : return ' YES ' if ( n % m == 0 ) else ' NO '   if __name__ == ' _ _ main _ _ ' : T = int ( input ( ) ) for t in range ( T ) : n , m = tuple ( map ( int , input ( ) . split ( ) ) ) print ( tworegularpolygons ( n , m ) ) NEW_LINE", "t = int ( input ( ) ) for _ in range ( t ) : n , m = list ( map ( int , input ( ) . split ( ) ) ) if n % m == 0 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE" ]
codeforces_739_A
[ "import java . io . * ; import java . math . * ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 1000000007 ;   private static final int MAXN = 200001 ; private static final int MAXA = 1000007 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < m ; i ++ ) { int j = in . nextInt ( ) ; int k = in . nextInt ( ) ; int ans = k - j + 1 ; if ( ans < min ) min = ans ; } System . out . println ( min ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( ( i % min ) + \" ▁ \" ) ; } } }", "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . StringTokenizer ; public class Solution { public static void main ( String [ ] args ) { try ( BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { StringTokenizer s = new StringTokenizer ( in . readLine ( ) ) ; int n = Integer . parseInt ( s . nextToken ( ) ) ; int m = Integer . parseInt ( s . nextToken ( ) ) ; int min_sub = Integer . MAX_VALUE ;", "import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException {" ]
[ "n , m = map ( int , input ( ) . split ( ) ) ans = n + 1 for i in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) ans = min ( ans , b - a + 1 ) print ( ans ) arr = [ 0 ] * nput = 0 for i in range ( n ) : arr [ i ] = put put += 1 if ( put == ans ) : put = 0 print ( * arr ) NEW_LINE", "from math import * from collections import * from random import * from decimal import Decimalfrom heapq import * from bisect import * import sysinput = sys . stdin . readlinesys . setrecursionlimit ( 10 ** 5 ) def lis ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def ma ( ) : return map ( int , input ( ) . split ( ) ) def inp ( ) : return int ( input ( ) ) def st ( ) : return input ( ) . rstrip ( ' \\n ' ) d = 100000000000 n , m = ma ( ) for i in range ( m ) : x , y = ma ( ) d = min ( d , y - x ) r = [ i for i in range ( d + 1 ) ] i = 0 print ( d + 1 ) while ( i < n ) : print ( r [ i % ( d + 1 ) ] , end = \" ▁ \" ) i += 1   NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) mexi = 1e9 for i in range ( m ) : r , l = map ( int , input ( ) . split ( ) ) mexi = min ( mexi , l - r + 1 ) print ( mexi ) d = [ str ( j % mexi ) for j in range ( n ) ] print ( ' ▁ ' . join ( d ) ) NEW_LINE" ]
codeforces_1265_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import static java . lang . Math . * ; import static java . lang . System . out ; import java . util . * ; import java . io . PrintStream ; import java . io . PrintWriter ; public class A { static final int mod = 1000000007 ; static final long temp = 998244353 ; static final long MOD = 1000000007 ; static final long M = ( long ) 1e9 + 7 ; static class Pair implements Comparable < Pair > { int first , second ; public Pair ( int aa , int bb ) { first = aa ; second = bb ; } public int compareTo ( Pair o ) { if ( this . second < o . second ) return - 1 ; if ( this . second > o . second ) return + 1 ; return this . first - o . first ; } } static class Tuple implements Comparable < Tuple > { long first , second , third ; public Tuple ( long first , long second , long third ) { this . first = first ; this . second = second ; this . third = third ; } public int compareTo ( Tuple o ) { return ( int ) ( o . third - this . third ) ; } } public static class DSU { int [ ] parent ; int [ ] rank ;", "import java . util . Scanner ;   public class _0686BeautifulString { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c = sc . nextInt ( ) ; sc . nextLine ( ) ; while ( c > 0 ) { String s = sc . nextLine ( ) ; s = \" . \" + s + \" . \" ; boolean flag = true ; char [ ] arr = s . toCharArray ( ) ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( arr [ i ] != arr [ i - 1 ] && arr [ i ] != ' ? ' ) { continue ; } if ( arr [ i ] == ' ? ' ) { for ( int x = 97 ; x < 100 ; x ++ ) { if ( arr [ i - 1 ] != x && arr [ i + 1 ] != x ) { arr [ i ] = ( char ) x ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import static java . lang . Math . * ; import static java . lang . System . out ; import java . util . * ; import java . io . PrintStream ; import java . io . PrintWriter ; public class A { static final int mod = 1000000007 ; static final long temp = 998244353 ; static final long MOD = 1000000007 ; static final long M = ( long ) 1e9 + 7 ; static class Pair implements Comparable < Pair > { int first , second ; public Pair ( int aa , int bb ) { first = aa ; second = bb ; } public int compareTo ( Pair o ) { if ( this . second < o . second ) return - 1 ; if ( this . second > o . second ) return + 1 ; return this . first - o . first ; } } static class Tuple implements Comparable < Tuple > { long first , second , third ; public Tuple ( long first , long second , long third ) { this . first = first ; this . second = second ; this . third = third ; } public int compareTo ( Tuple o ) { return ( int ) ( o . third - this . third ) ; } } public static class DSU { int [ ] parent ; int [ ] rank ;" ]
[ "n = int ( input ( ) ) possible = Truefor _ in range ( n ) : s = list ( str ( input ( ) ) ) for i in range ( 0 , len ( s ) ) : if i == 0 : if s [ i ] == ' ? ' : if i + 1 != len ( s ) : s [ i ] = ' a ' if s [ i + 1 ] != ' a ' else ' b ' if s [ i + 1 ] != ' b ' else ' c ' else : s [ i ] = ' a ' elif i == len ( s ) - 1 and s [ i ] == ' ? ' : s [ i ] = ' a ' if s [ i - 1 ] != ' a ' else ' b ' if s [ i - 1 ] != ' b ' else ' c ' else : if s [ i ] == s [ i - 1 ] : possible = False break else : if s [ i ] == ' ? ' : if s [ i - 1 ] == ' a ' : s [ i ] = ' b ' if s [ i + 1 ] != ' b ' else ' c ' elif s [ i - 1 ] == ' b ' : s [ i ] = ' c ' if s [ i + 1 ] != ' c ' else ' a ' else : s [ i ] = ' b ' if s [ i + 1 ] != ' b ' else ' a ' print ( \" \" . join ( map ( str , s ) ) if possible else - 1 ) possible = True NEW_LINE", "for _ in range ( int ( input ( ) ) ) : s = [ \" - \" ] + list ( input ( ) ) + [ \" - \" ] p = True for i in range ( 1 , len ( s ) - 1 ) : if s [ i ] == s [ i + 1 ] and s [ i ] != \" ? \" : print ( - 1 ) p = False break elif s [ i ] == \" ? \" : s [ i ] = \" abc \" . replace ( s [ i + 1 ] , \" \" ) . replace ( s [ i - 1 ] , \" \" ) [ 0 ] if p : print ( \" \" . join ( s [ 1 : ] [ : - 1 ] ) ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : li = list ( map ( str , input ( ) ) ) li . append ( '0' ) li . insert ( 0 , '0' ) n = len ( li ) st = True for i in range ( 1 , n - 1 ) : if li [ i ] == li [ i + 1 ] and li [ i ] != ' ? ' : print ( - 1 ) st = False break elif li [ i ] == ' ? ' : if li [ i - 1 ] != ' a ' and li [ i + 1 ] != ' a ' : li [ i ] = ' a ' elif li [ i - 1 ] != ' b ' and li [ i + 1 ] != ' b ' : li [ i ] = ' b ' else : li [ i ] = ' c '   if st : print ( ' ' . join ( li ) . strip ( '0' ) ) NEW_LINE", "T = int ( input ( ) ) for tc in range ( T ) : s = [ c for c in input ( ) ] n = len ( s ) i = 0 while ( i < n ) : if ( s [ i ] == ' ? ' ) : prv = ' d ' if i == 0 else s [ i - 1 ] nxt = ' e ' if i + 1 >= n else s [ i + 1 ] for x in [ ' a ' , ' b ' , ' c ' ] : if ( x != prv ) and ( x != nxt ) : s [ i ] = x break else : i += 1 ok = True for i in range ( n - 1 ) : if ( s [ i ] == s [ i + 1 ] ) : print ( \" - 1\" ) ok = False break if ( ok == True ) : print ( \" \" . join ( s ) ) NEW_LINE", "  t = int ( input ( ) ) for i in range ( t ) : f = 0 s = input ( ) s = list ( s ) l = [ ' a ' , ' b ' , ' c ' ] for i in range ( len ( s ) - 1 ) : if ( s [ i ] == ' ? ' ) : for j in range ( len ( l ) ) : if ( s [ i + 1 ] != l [ j ] and s [ i - 1 ] != l [ j ] ) : s [ i ] = l [ j ] if s [ - 1 ] == ' ? ' : if len ( s ) > 1 : if s [ - 2 ] == ' a ' : s [ - 1 ] = ' b ' elif s [ - 2 ] == ' b ' : s [ - 1 ] = ' c ' elif s [ - 2 ] == ' c ' : s [ - 1 ] = ' a ' else : s [ - 1 ] = ' a ' s = \" \" . join ( s ) for i in range ( len ( s ) - 1 ) : if ( s [ i ] == s [ i + 1 ] ) : f = 1 if ( f == 1 ) : print ( - 1 ) if ( f == 0 ) : print ( s ) NEW_LINE" ]
codeforces_65_B
[ "import java . util . * ; import java . io . * ;   public class HarryPotterAndHistoryOfMagic65B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] dates = new String [ N ] ; for ( int i = 0 ; i < N ; ++ i ) { dates [ i ] = sc . next ( ) ; }   String correctedDates = correctDates ( dates ) ; System . out . println ( correctedDates ) ; }   public static String correctDates ( String [ ] dates ) { if ( dates . length == 0 ) { return \" \" ; } StringBuilder sb = new StringBuilder ( \" \" ) ; String res = makeDateCorrect ( dates [ dates . length - 1 ] , \"2011\" ) ; if ( res == null ) { return \" No ▁ solution \" ; } sb . append ( res ) ; dates [ dates . length - 1 ] = res ;", "import java . math . BigDecimal ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ;   public class Main { private static int fixDigit ( int num , int index , int digit ) { switch ( index ) { case - 1 : return num ; case 0 : return 1000 * digit + ( num % 1000 ) ; case 1 : return 100 * digit + ( num / 1000 ) * 1000 + ( num % 100 ) ; case 2 : return 10 * digit + ( num / 100 ) * 100 + ( num % 10 ) ; case 3 : return digit + ( num / 10 ) * 10 ; default : return 0 ; } }   private static int changeMinimunValue ( int oldVlaue , int minValue , int maxValue ) { int newValue = 9999 ; for ( int index = 0 ; index <= 3 ; ++ index ) { for ( int digit = 0 ; digit <= 9 ; ++ digit ) { int temp = fixDigit ( oldVlaue , index , digit ) ; if ( minValue <= temp && temp <= maxValue && temp < newValue ) { newValue = temp ; } } } return newValue ; }   public static void main ( String arg [ ] ) {", "import java . util . * ;   public class HarryPotterAndTheHistoryOfMagic { static boolean valid ( int [ ] dates ) { for ( int i = 0 ; i < dates . length ; i ++ ) { if ( dates [ i ] < 1000 || dates [ i ] > 2011 ) return false ; if ( i > 0 && dates [ i - 1 ] > dates [ i ] ) return false ; } return true ; } static int changeDate ( int currentDate , int previousDate ) { char [ ] dateChars = String . valueOf ( currentDate ) . toCharArray ( ) ; int min = 9999 ; for ( int i = 0 ; i < dateChars . length ; i ++ ) { char tmp = dateChars [ i ] ; for ( char c = '0' ; c <= '9' ; c ++ ) { dateChars [ i ] = c ; int year = Integer . parseInt ( String . valueOf ( dateChars ) ) ; if ( year <= 2011 && year >= previousDate && year < min ) { min = year ; } } dateChars [ i ] = tmp ; } return min ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] dates = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { dates [ i ] = in . nextInt ( ) ; } int [ ] newDates = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { newDates [ i ] = changeDate ( dates [ i ] , i == 0 ? 1000 : newDates [ i - 1 ] ) ; } if ( ! valid ( newDates ) ) { System . out . println ( \" No ▁ solution \" ) ; } else { for ( int date : newDates ) { System . out . println ( date ) ; } } in . close ( ) ; System . exit ( 0 ) ; } }" ]
[ "n = int ( input ( ) ) NEW_LINE a = [ ] NEW_LINE for _ in range ( n ) : a . append ( input ( ) )   prev = \"1000\" NEW_LINE z = 1 NEW_LINE for i in range ( n ) : l = ' ' NEW_LINE for j in range ( 4 ) : x = list ( a [ i ] [ : ] ) NEW_LINE for k in range ( 10 ) : x [ j ] = chr ( k + ord ( '0' ) ) NEW_LINE check = ' ' . join ( r for r in x ) NEW_LINE if int ( check ) >= int ( prev ) : if NEW_LINE len ( l ) == 0 : l = check else : if int ( check ) < int ( l ) : l = check   a [ i ] = ' ' . join ( r for r in l ) NEW_LINE if int ( a [ i ] ) > 2011 or int ( a [ i ] ) < int ( prev ) : z = 0 NEW_LINE break ; NEW_LINE prev = a [ i ] NEW_LINE if z == 1 : for NEW_LINE i in a : print ( i ) NEW_LINE", "import sys   n = int ( input ( ) ) NEW_LINE d = [ ] NEW_LINE for i in range ( n ) : d . append ( input ( ) ) NEW_LINE ans = [ ]   bad = ' No ▁ solution ' NEW_LINE low = 1000 NEW_LINE for date in d : lowest = 100500 NEW_LINE for i in range ( 10 ) : for NEW_LINE j in range ( i == 0 , 5 ) : changed = date [ : j ] + str ( i ) + date [ j + 1 : ] NEW_LINE if lowest > int ( changed ) >= low : lowest = int ( changed ) NEW_LINE if lowest > 2011 : print ( bad ) NEW_LINE sys . exit ( 0 ) NEW_LINE ans . append ( str ( lowest ) ) NEW_LINE low = lowest   print ( ' \\n ' . join ( ans ) ) NEW_LINE", "n = int ( input ( ) )   l = [ ] NEW_LINE for i in range ( n ) : l . append ( int ( input ( ) ) )   NEW_LINE def repair ( x , y , r ) : if NEW_LINE INDENT ( r == 0 ) : NEW_LINE DEDENT return x NEW_LINE z = ( x % ( 10 * r ) ) // r - ( y % ( 10 * r ) ) // r NEW_LINE if ( z == 0 ) : return repair ( x , y , r // 10 ) NEW_LINE if ( x % r >= y % r ) : NEW_LINE INDENT return x - z * r else : NEW_LINE if NEW_LINE ( z != 1 ) : NEW_LINE DEDENT return x - z * r + r NEW_LINE return x - x % r + ( x % r ) % ( 10 ** ( len ( str ( x % r ) ) - 1 ) )   y = 1000 NEW_LINE try : for NEW_LINE i in range ( n ) : l [ i ] = repair ( l [ i ] , y , 1000 ) NEW_LINE if ( l [ i ] > 2011 ) : raise Exception ( ) NEW_LINE y = l [ i ] NEW_LINE for i in l : print ( i ) except : print ( \" No ▁ solution \" ) NEW_LINE", "n , a , ans , last = int ( input ( ) ) , [ ] , [ ] , 1000 NEW_LINE for i in range ( n ) : a . append ( input ( ) ) NEW_LINE for d in a : minoverd = 10000000 NEW_LINE for i in range ( 10 ) : for NEW_LINE j in range ( i == 0 , 5 ) : t = int ( d [ : j ] + str ( i ) + d [ j + 1 : ] ) NEW_LINE if minoverd > t >= last : minoverd = t NEW_LINE ans . append ( str ( minoverd ) ) NEW_LINE if minoverd > 2011 : break NEW_LINE last = minoverdif NEW_LINE minoverd > 2011 : print ( \" No ▁ solution \" ) else : print ( * ans ) NEW_LINE" ]
codeforces_887_B
[ "import java . io . * ; import java . util . * ;    public class Solution { public static void main ( String [ ] args ) throws Exception { int n = in . readInt ( ) ; int [ ] [ ] cube = new int [ 3 ] [ 6 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { Arrays . fill ( cube [ i ] , - 1 ) ; } for ( int i = 0 ; i < n ; i ++ ) { cube [ i ] = in . readA ( ) ; Arrays . sort ( cube [ i ] ) ; } int [ ] digit = new int [ 10 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 6 ; j ++ ) { digit [ cube [ i ] [ j ] ] ++ ; } } for ( int i = 1 ; i < 100 ; i ++ ) { if ( ! check ( i , digit , cube ) ) { System . out . println ( i - 1 ) ; return ; } } } public static boolean check ( int x , int [ ] digit , int [ ] [ ] cube ) { int t = x , c = 0 ; while ( x > 0 ) { c ++ ; x /= 10 ; } x = t ; if ( c == 1 ) return digit [ x ] > 0 ; else { int d10 = x / 10 , d1 = x % 10 ; for ( int i = 1 ; i <= 3 ; i ++ ) { for ( int j = i + 1 ; j <= 3 ; j ++ ) { if ( ( Arrays . binarySearch ( cube [ i - 1 ] , d10 ) > - 1 && Arrays . binarySearch ( cube [ j - 1 ] , d1 ) > - 1 ) || ( Arrays . binarySearch ( cube [ i - 1 ] , d1 ) > - 1 && Arrays . binarySearch ( cube [ j - 1 ] , d10 ) > - 1 ) ) {", "import java . io . * ; import java . util . * ; import java . util . regex . * ; public class vk18 { public static void main ( String [ ] stp ) throws Exception { Scanner scan = new Scanner ( System . in ) ;", "import java . util . Collections ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ;   public class B887 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int [ ] [ ] cubes = new int [ N ] [ 6 ] ; for ( int cubeNo = 0 ; cubeNo < N ; cubeNo ++ ) { for ( int i = 0 ; i < 6 ; i ++ ) { cubes [ cubeNo ] [ i ] = in . nextInt ( ) ; } } Set < Integer > set = new HashSet < > ( ) ; for ( int cubeIdx1 = 0 ; cubeIdx1 < N ; cubeIdx1 ++ ) { for ( int sideIdx1 = 0 ; sideIdx1 < 6 ; sideIdx1 ++ ) { int side1 = cubes [ cubeIdx1 ] [ sideIdx1 ] ; set . add ( side1 ) ; for ( int cubeIdx2 = 0 ; cubeIdx2 < N ; cubeIdx2 ++ ) { if ( cubeIdx1 == cubeIdx2 ) { continue ; } for ( int sideIdx2 = 0 ; sideIdx2 < 6 ; sideIdx2 ++ ) { int side2 = cubes [ cubeIdx2 ] [ sideIdx2 ] ; set . add ( 10 * side1 + side2 ) ; set . add ( 10 * side2 + side1 ) ; for ( int cubeIdx3 = 0 ; cubeIdx3 < N ; cubeIdx3 ++ ) { if ( cubeIdx3 == cubeIdx1 || cubeIdx3 == cubeIdx2 ) { continue ; } for ( int sideIdx3 = 0 ; sideIdx3 < 6 ; sideIdx3 ++ ) { int side3 = cubes [ cubeIdx3 ] [ sideIdx3 ] ; set . add ( 100 * side1 + 10 * side2 + side3 ) ; set . add ( 100 * side1 + 10 * side3 + side2 ) ; set . add ( 100 * side2 + 10 * side1 + side3 ) ; set . add ( 100 * side2 + 10 * side3 + side1 ) ; set . add ( 100 * side3 + 10 * side1 + side2 ) ; set . add ( 100 * side3 + 10 * side2 + side1 ) ; } } } } } } int max = 1 ; while ( set . contains ( max ) ) { max ++ ; } System . out . println ( max - 1 ) ; }   }" ]
[ "def check ( cubes , n ) : if len ( str ( n ) ) == 1 : for cube in cubes : if n in cube : return True return False elif len ( str ( n ) ) == 2 : for c1 in range ( len ( cubes ) ) : for c2 in range ( len ( cubes ) ) : if c1 == c2 : pass elif int ( str ( n ) [ 0 ] ) in cubes [ c1 ] and int ( str ( n ) [ 1 ] ) in cubes [ c2 ] : return True return False         n = int ( input ( ) ) cubes = [ [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] for i in range ( n ) ] i = 1 while check ( cubes , i ) : i += 1 print ( i - 1 ) NEW_LINE", "n = int ( input ( ) ) a = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( n ) ] for ai in a : ai . insert ( 0 , ' ' ) dic = { } for k in range ( 1 , 7 ** n ) : tmp = k i = 0 arr = [ ] while 0 < tmp : arr . append ( str ( a [ i ] [ tmp % 7 ] ) ) tmp //= 7 i += 1 arr . sort ( ) dic [ ' ' . join ( arr ) ] = True ans = 0 while ' ' . join ( sorted ( list ( str ( ans + 1 ) ) ) ) in dic : ans += 1 print ( ans ) NEW_LINE" ]
codeforces_14_A
[ "import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; scan . nextLine ( ) ; boolean [ ] [ ] grid = new boolean [ n ] [ m ] ; int minJ = m , maxJ = - 1 , minI = n , maxI = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { String line = scan . nextLine ( ) ; for ( int j = 0 ; j < m ; j ++ ) { grid [ i ] [ j ] = line . charAt ( j ) == ' * ' ; if ( grid [ i ] [ j ] ) { minJ = Math . min ( j , minJ ) ; maxJ = Math . max ( j , maxJ ) ; minI = Math . min ( i , minI ) ; maxI = Math . max ( i , maxI ) ; } } } for ( int i = minI ; i <= maxI ; i ++ ) { for ( int j = minJ ; j <= maxJ ; j ++ ) System . out . print ( grid [ i ] [ j ] ? ' * ' : ' . ' ) ; System . out . println ( ) ; } } } }", "import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = sc . next ( ) ; } int sr = 0 ; int sco = 0 ; int lr = 0 ; int lc = 0 ; List < Integer > alr = new ArrayList < > ( ) ; List < Integer > alc = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < s [ i ] . length ( ) ; j ++ ) { if ( s [ i ] . charAt ( j ) == ' * ' ) { lr = i ; lc = j ; alr . add ( i ) ; alc . add ( j ) ;", "import java . util . * ;   public class Main { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int y = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; char arr [ ] [ ] = new char [ y ] [ x ] ; for ( int i = 0 ; i < y ; i ++ ) { arr [ i ] = sc . next ( ) . toCharArray ( ) ; } int top = Integer . MAX_VALUE ; int bottom = - 1 ; int left = Integer . MAX_VALUE ; int right = - 1 ; for ( int i = 0 ; i < y ; i ++ ) { for ( int j = 0 ; j < x ; j ++ ) { if ( arr [ i ] [ j ] == ' * ' ) { top = Math . min ( i , top ) ; bottom = Math . max ( bottom , i ) ; left = Math . min ( left , j ) ; right = Math . max ( right , j ) ; } } } for ( int i = top ; i <= bottom ; i ++ ) { for ( int j = left ; j <= right ; j ++ ) { System . out . print ( arr [ i ] [ j ] ) ; } System . out . println ( ) ; } } }" ]
[ "n , m = map ( int , input ( ) . split ( ) ) s = [ None ] * nfor i in range ( n ) : s [ i ] = input ( ) while True : if s [ 0 ] . count ( ' * ' ) != 0 : break s . pop ( 0 ) while True : if s [ len ( s ) - 1 ] . count ( ' * ' ) != 0 : break s . pop ( ) x = m - 1 d = m - 1 n = len ( s ) for i in range ( n ) : if s [ i ] . count ( ' * ' ) == 0 : continue s [ i ] = s [ i ] [ : : - 1 ] c = s [ i ] . index ( ' * ' ) if c < d : d = c s [ i ] = s [ i ] [ : : - 1 ] c = s [ i ] . index ( ' * ' ) if c < x : x = cfor i in range ( n ) : print ( s [ i ] [ x : m - d ] ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a = [ ] xmin , xmax = m , 0 for i in range ( n ) : a . append ( input ( ) ) for i in range ( n ) : x1 , x2 = a [ i ] . find ( \" * \" ) , a [ i ] . rfind ( \" * \" ) if x1 >= 0 : xmin = min ( xmin , x1 ) if x2 >= 0 : xmax = max ( xmax , x2 ) for i in range ( len ( a ) - 1 , - 1 , - 1 ) : if a [ i ] == \" . \" * m : a . pop ( i ) else : breaka = a [ : : - 1 ] for i in range ( len ( a ) - 1 , - 1 , - 1 ) : if a [ i ] == \" . \" * m : a . pop ( i ) else : breaka = a [ : : - 1 ] for i in range ( len ( a ) ) : print ( a [ i ] [ xmin : xmax + 1 ] ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) )   cases = a   matrix = [ ] while cases : cases -= 1 matrix . append ( list ( input ( ) ) ) an = matrix [ : ] for row in matrix : if row . count ( \" * \" ) == 0 : an . pop ( 0 ) else : breakfor row in matrix [ : : - 1 ] : if row . count ( \" * \" ) == 0 : an . pop ( ) else : breakx = an [ : ]   matrix2 = [ [ x [ j ] [ i ] for j in range ( len ( x ) ) ] for i in range ( len ( x [ 0 ] ) ) ]   ans = matrix2 [ : ] for row in matrix2 : if row . count ( \" * \" ) == 0 : ans . pop ( 0 ) else : breakfor row in matrix2 [ : : - 1 ] : if row . count ( \" * \" ) == 0 : ans . pop ( ) else : break   x = ans [ : ]   matrix3 = [ [ x [ j ] [ i ] for j in range ( len ( x ) ) ] for i in range ( len ( x [ 0 ] ) ) ]   for i in matrix3 : print ( \" \" . join ( i ) )   NEW_LINE", "n , m = map ( int , input ( ) . split ( ) )   min_i = 51 max_i = 0 min_j = 51 max_j = 0   pattern = list ( )   for i in range ( n ) : s = input ( ) pattern . append ( s )   temp = s . find ( \" * \" ) if temp != - 1 : min_j = min ( temp , min_j ) max_j = max ( max_j , s . rfind ( \" * \" ) ) min_i = min ( i , min_i ) max_i = max ( i , max_i )   for i in range ( n ) : if min_i <= i <= max_i : print ( pattern [ i ] [ min_j : max_j + 1 ] ) NEW_LINE" ]
codeforces_607_A
[ "import java . util . Scanner ; public class ChainReaction {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] [ ] beacons = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < beacons . length ; i ++ ) { beacons [ i ] [ 0 ] = scanner . nextInt ( ) ; beacons [ i ] [ 1 ] = scanner . nextInt ( ) ; } scanner . close ( ) ; sortBeacons ( beacons ) ; int [ ] savedNum = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) {", "  import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 1_000_005 ; int [ ] present = new int [ max ] ; for ( int i = 0 ; i < n ; i ++ ) { present [ sc . nextInt ( ) ] = sc . nextInt ( ) ; } int [ ] dp = new int [ max ] ; if ( present [ 0 ] > 0 ) { dp [ 0 ] = 1 ; } int mx = 0 ; for ( int i = 1 ; i < max ; i ++ ) { if ( present [ i ] == 0 ) { dp [ i ] = dp [ i - 1 ] ; } else { if ( present [ i ] >= i ) { dp [ i ] = 1 ; } else { dp [ i ] = dp [ i - present [ i ] - 1 ] + 1 ; } } mx = Math . max ( mx , dp [ i ] ) ; } System . out . println ( n - mx ) ; sc . close ( ) ; } }" ]
[ "import sys , os , iofrom sys import stdinfrom bisect import bisect_left , bisect_rightdef ii ( ) : return int ( input ( ) ) def li ( ) : return list ( map ( int , input ( ) . split ( ) ) ) if ( os . path . exists ( ' input . txt ' ) ) : sys . stdin = open ( \" input . txt \" , \" r \" ) ; sys . stdout = open ( \" output . txt \" , \" w \" ) else : input = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline   n = ii ( ) ; l = [ ] for i in range ( n ) : l . append ( tuple ( li ( ) ) ) l . sort ( ) ; DP = [ 0 ] * ( n ) for i in range ( n ) : x = bisect_left ( l , ( l [ i ] [ 0 ] - l [ i ] [ 1 ] , 0 ) ) if x == 0 : DP [ i ] = 1 else : DP [ i ] = DP [ x - 1 ] + 1 print ( n - max ( DP ) ) NEW_LINE", "import bisectn = int ( input ( ) ) b = [ ] p = [ ] a = [ ] for i in range ( n ) : a . append ( list ( map ( int , input ( ) . split ( ) ) ) ) a . sort ( ) for i in range ( n ) : b . append ( a [ i ] [ 0 ] ) p . append ( a [ i ] [ 1 ] ) dp = [ 0 ] * nfor i in range ( n ) : j = bisect . bisect_left ( b , b [ i ] - p [ i ] ) dp [ i ] = i - j + dp [ j - 1 ] ans = 10 ** 9 c = 1 for j in range ( n - 1 , - 1 , - 1 ) : ans = min ( ans , dp [ j - 1 ] + c , dp [ j ] + c - 1 ) c = c + 1 print ( ans ) NEW_LINE", "import bisectfrom math import infa = [ ] b = [ ] maxi = 10 ** 6 ind = [ - 1 ] * ( maxi + 1 ) n = int ( input ( ) ) for _ in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) a . append ( [ x , y ] ) b . append ( x ) a . sort ( ) b . sort ( ) for i in range ( len ( b ) ) : ind [ b [ i ] ] = idp = [ 0 ] * ( n ) dp [ 0 ] = 0 NEW_LINE", "import sys , os , iofrom sys import stdinfrom math import log , gcd , ceilfrom collections import defaultdict , deque , Counterfrom heapq import heappush , heappop , heapifyfrom bisect import bisect_left , bisect_rightimport math def ii ( ) : return int ( input ( ) ) def li ( ) : return list ( map ( int , input ( ) . split ( ) ) ) if ( os . path . exists ( ' input . txt ' ) ) : sys . stdin = open ( \" input . txt \" , \" r \" ) ; sys . stdout = open ( \" output . txt \" , \" w \" ) else : input = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline   no = \" NO \" yes = \" YES \"   def solve ( ) : n = ii ( ) NEW_LINE" ]
codeforces_1132_B
[ "import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintStream ; import java . io . PrintWriter ; import java . security . AccessControlException ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Objects ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; import java . util . stream . LongStream ; import java . util . stream . Stream ; public class _p001132B { static public void main ( final String [ ] args ) throws IOException { p001132B . _main ( args ) ; }", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { PrintWriter out = new PrintWriter ( System . out ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tok = new StringTokenizer ( \" \" ) ; String next ( ) throws IOException { if ( ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) ) ; } return tok . nextToken ( ) ; } int ni ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } long nl ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } long mod = 1000000007 ; void solve ( ) throws IOException { int n = ni ( ) ; Integer [ ] A = new Integer [ n ] ; long s = 0 ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = ni ( ) ; s += A [ i ] ; } Arrays . sort ( A , ( a , b ) -> Integer . compare ( b , a ) ) ; int m = ni ( ) ; for ( int i = 0 ; i < m ; i ++ ) out . println ( s - A [ ni ( ) - 1 ] ) ; out . flush ( ) ; } int gcd ( int a , int b ) { return ( b == 0 ? a : gcd ( b , a % b ) ) ; } long gcd ( long a , long b ) { return ( b == 0 ? a : gcd ( b , a % b ) ) ; } long mp ( long a , long p ) { long r = 1 ; while ( p > 0 ) { if ( ( p & 1 ) == 1 ) r = ( r * a ) % mod ; p >>= 1 ; a = ( a * a ) % mod ; } return r ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) . solve ( ) ; } }", "import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . security . acl . LastOwnerException ; 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 . LinkedList ; import java . util . List ; import java . util . Queue ; import java . util . Set ; import java . util . SortedSet ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; import javax . sound . midi . Soundbank ; import org . omg . PortableInterceptor . LOCATION_FORWARD ;    public class Main {   public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;   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 [ ] nextSArray ( ) { String sr [ ] = null ; try { sr = br . readLine ( ) . trim ( ) . split ( \" ▁ \" ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return sr ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; }   return str ; } }  ", "import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . security . acl . LastOwnerException ; 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 . LinkedList ; import java . util . List ; import java . util . Queue ; import java . util . Set ; import java . util . SortedSet ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; import javax . sound . midi . Soundbank ; import org . omg . PortableInterceptor . LOCATION_FORWARD ;    public class Main {   public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;   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 [ ] nextSArray ( ) { String sr [ ] = null ; try { sr = br . readLine ( ) . trim ( ) . split ( \" ▁ \" ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return sr ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; }   return str ; } }  " ]
[ "n = int ( input ( ) ) arr = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) summa = sum ( arr ) m = int ( input ( ) ) marr = list ( map ( int , input ( ) . split ( ) ) ) for x in marr : print ( summa - arr [ len ( arr ) - x ] ) NEW_LINE", "a = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) b . sort ( reverse = True ) res = sum ( b ) n = int ( input ( ) ) mas = list ( map ( int , input ( ) . split ( ) ) ) for k in mas : print ( res - b [ k - 1 ] ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) )   a . sort ( ) s = sum ( a )   for i in q : print ( s - a [ - i ] )   NEW_LINE", "n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] m = int ( input ( ) ) a . sort ( reverse = True ) s = sum ( a ) q = [ s - a [ int ( i ) - 1 ] for i in input ( ) . split ( ) ] print ( * q , sep = ' \\n ' ) NEW_LINE", "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) add = sum ( l ) l . sort ( reverse = True ) m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( m ) : sum1 = add sum1 = sum1 - l [ q [ i ] - 1 ] print ( sum1 ) NEW_LINE" ]
codeforces_529_B
[ "  import java . io . * ; import java . util . * ;   public class Main { class E implements Comparable < E > { int v ; int id ; E ( int v , int id ) { this . v = v ; this . id = id ; }   @ Override public int compareTo ( E o ) { return Integer . compare ( v , o . v ) ; } } void solve ( ) { int n = in . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] [ 0 ] = in . nextInt ( ) ;", "import java . util . * ;   public class CF529B { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] w = new int [ n ] ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { w [ i ] = scan . nextInt ( ) ; h [ i ] = scan . nextInt ( ) ; } int ans = - 1 ; for ( int H = 1 ; H <= 1000 ; ++ H ) { int W = 0 , rem = ( int ) n / 2 , ok = 1 ; List < Integer > delta = new ArrayList < > ( ) ; ; for ( int i = 0 ; i < n ; ++ i ) { if ( h [ i ] > H && w [ i ] > H ) {" ]
[ "from operator import negn = int ( input ( ) ) a = [ tuple ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ]   def check ( max_h ) : k = n // 2 b = [ ] for w , h in a : if h > max_h : if k <= 0 or w > max_h : return 1 << 60 b . append ( ( h , w ) ) k -= 1 else : b . append ( ( w , h ) ) b . sort ( key = lambda t : t [ 1 ] - t [ 0 ] ) r = 0 for w , h in b : if k > 0 and w <= max_h and h < w : r += h k -= 1 else : r += w return r * max_h   print ( min ( check ( h ) for h in range ( 1 , 1001 ) ) ) NEW_LINE" ]
codeforces_27_A
[ "import java . util . * ;   public class NextTest { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scan . nextInt ( ) ; }   Arrays . sort ( arr ) ;   for ( int i = 1 ; i < arr [ 0 ] ; i ++ ) { if ( i < arr [ 0 ] ) { System . out . println ( i ) ; return ; } }   for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( arr [ i ] != arr [ i + 1 ] - 1 ) { System . out . println ( arr [ i ] + 1 ) ; return ; } }   System . out . println ( arr [ n - 1 ] + 1 ) ; } }", "import javax . print . attribute . HashAttributeSet ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . TreeMap ;   public class Template { private static BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static String readln ( ) throws IOException { String line = input . readLine ( ) ; return line ; }   public static void main ( String [ ] args ) throws IOException { solution ( ) ; }    public static void solution ( ) throws IOException { int n = Integer . parseInt ( readln ( ) ) ; String aa [ ] = readln ( ) . split ( \" ▁ \" ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( aa [ i ] ) ; } Arrays . sort ( a ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i + 1 == a [ i ] ) { } else { System . out . println ( i + 1 ) ; return ; } } System . out . println ( n + 1 ) ; } }  ", "  import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class er10a {", "  import java . util . * ; import java . lang . * ; import java . io . * ;   public class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class CF27_D2_A { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int n = scanner . nextInt ( ) ; int [ ] arr = new int [ 3009 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ scanner . nextInt ( ) ] ++ ; } for ( int i = 1 ; i < arr . length ; i ++ ) { if ( arr [ i ] == 0 ) { System . out . println ( i ) ; return ; } } }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { 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 ; }   int [ ] nextArray ( int n ) { int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; }   Integer [ ] nextArray ( int n , boolean object ) { Integer [ ] arr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; } } }" ]
[ "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) i = 1 while i in l : i += 1   print ( i ) NEW_LINE", "  n = int ( input ( ) ) indices_str = input ( ) . split ( ) indices = [ ]   for i in range ( n ) : indices . append ( int ( indices_str [ i ] ) )   mayor = indices [ 0 ] menor = indices [ 0 ]   for i in range ( n - 1 ) : if indices [ i + 1 ] > mayor : mayor = indices [ i + 1 ] if indices [ i + 1 ] < menor : menor = indices [ i + 1 ] if menor != 1 : print ( 1 ) elif mayor == n : print ( n + 1 ) else : for i in range ( mayor - 1 ) : if not ( i + 1 ) in indices : print ( i + 1 ) break ; NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr = sorted ( arr ) for i in range ( 1 , n + 1 ) : if i != arr [ i - 1 ] : print ( i ) breakelse : print ( n + 1 ) NEW_LINE", "def func ( n , a ) : i = 1 while 1 : if i not in a : return i break i += 1   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( func ( n , a ) ) NEW_LINE", "n = int ( input ( ) ) a = [ int ( y ) for y in input ( ) . split ( ) ] a . sort ( ) ans = - 1 for i in range ( 1 , n + 1 ) : if a [ i - 1 ] != i : ans = i breakif ans == - 1 : print ( n + 1 ) else : print ( ans ) NEW_LINE" ]
codeforces_1059_B
[ "import java . io . * ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) throws Exception { int [ ] nm = in . readA ( ) ; int n = nm [ 0 ] , m = nm [ 1 ] ;", "  import java . util . Scanner ;   public class Main { static int m ; static int n ; static int sx [ ] = { 1 , - 1 , 0 , 0 , - 1 , - 1 , 1 , 1 } ; static int sy [ ] = { 0 , 0 , 1 , - 1 , - 1 , 1 , 1 , - 1 } ; static char map [ ] [ ] ; static char now [ ] [ ] ; public static void main ( String [ ] args ) {" ]
[ "n , m = map ( int , input ( ) . split ( ) ) S = [ input ( ) for i in range ( n ) ]   T = [ [ ' . ' ] * m for i in range ( n ) ]   for i in range ( n - 2 ) : for j in range ( m - 2 ) : if S [ i ] [ j ] == ' # ' and S [ i ] [ j + 1 ] == ' # ' and S [ i ] [ j + 2 ] == ' # ' and \\ S [ i + 1 ] [ j ] == ' # ' and S [ i + 1 ] [ j + 2 ] == ' # ' \\ and S [ i + 2 ] [ j ] == ' # ' and S [ i + 2 ] [ j + 1 ] == ' # ' and S [ i + 2 ] [ j + 2 ] == ' # ' : T [ i ] [ j ] = ' # ' T [ i ] [ j + 1 ] = ' # ' T [ i ] [ j + 2 ] = ' # ' T [ i + 1 ] [ j ] = ' # ' T [ i + 1 ] [ j + 2 ] = ' # ' T [ i + 2 ] [ j ] = ' # ' T [ i + 2 ] [ j + 1 ] = ' # ' T [ i + 2 ] [ j + 2 ] = ' # '   for i in range ( n ) : for j in range ( m ) : if S [ i ] [ j ] != T [ i ] [ j ] : print ( ' NO ' ) exit ( ) else : print ( ' YES ' ) NEW_LINE", "def check ( a , b ) : for i in range ( 3 ) : for j in range ( 3 ) : if i == 1 and j == 1 : continue elif l [ a + i ] [ b + j ] == \" . \" : return False return Truedef make ( a , b ) : for i in range ( 3 ) : for j in range ( 3 ) : if i == 1 and j == 1 : continue else : l1 [ a + i ] [ b + j ] = \" # \" l = [ ] l1 = [ ] for _ in range ( 1 ) : n , m = map ( int , input ( ) . split ( ) ) for i in range ( n ) : l . append ( list ( input ( ) ) ) l1 . append ( [ \" . \" ] * m ) for i in range ( n - 2 ) : for j in range ( m - 2 ) : if check ( i , j ) : make ( i , j ) if l == l1 : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) tab = [ ] mat = [ ]   for _ in range ( n ) : tab . append ( list ( input ( ) ) )   for i in range ( n ) : mat . append ( list ( [ ' . ' ] * m ) )   n -= 2 m -= 2   for i in range ( n ) : for ii in range ( m ) : if ( tab [ i ] [ ii ] == ' # ' and tab [ i + 1 ] [ ii ] == ' # ' and tab [ i + 2 ] [ ii ] == ' # ' and tab [ i + 2 ] [ ii + 1 ] == ' # ' and tab [ i + 2 ] [ ii + 2 ] == ' # ' and tab [ i + 1 ] [ ii + 2 ] == ' # ' and tab [ i ] [ ii + 2 ] == ' # ' and tab [ i ] [ ii + 1 ] == ' # ' ) : mat [ i ] [ ii ] = ' # ' mat [ i + 1 ] [ ii ] = ' # ' mat [ i + 2 ] [ ii ] = ' # ' mat [ i + 2 ] [ ii + 1 ] = ' # ' mat [ i + 2 ] [ ii + 2 ] = ' # ' mat [ i + 1 ] [ ii + 2 ] = ' # ' mat [ i ] [ ii + 1 ] = ' # ' mat [ i ] [ ii + 2 ] = ' # '   print ( ' YES ' if ( tab == mat ) else ' NO ' ) NEW_LINE", "def bidui ( ) : for i in range ( n ) : for j in range ( m ) : if mp [ i ] [ j ] != v [ i ] [ j ] : return 0 return 1   if __name__ == ' _ _ main _ _ ' : n , m = map ( int , input ( ) . strip ( ) . split ( ) ) mp = [ ] for i in range ( n ) : tmp = input ( ) . strip ( ) . split ( ) [ 0 ] mp . append ( list ( tmp ) ) v = [ [ ' . ' ] * m for i in range ( n ) ] dx = [ 0 , 0 , - 1 , - 1 , - 1 , 1 , 1 , 1 ] dy = [ - 1 , 1 , - 1 , 0 , 1 , - 1 , 0 , 1 ] for i in range ( n ) : for j in range ( m ) : tag = 1 for k in range ( 8 ) : nx = i + dx [ k ] ny = j + dy [ k ] if nx < 0 : tag = 0 break if nx >= n : tag = 0 break if ny < 0 : tag = 0 break if ny >= m : tag = 0 break NEW_LINE", "import sysinput = sys . stdin . readlinen , m = map ( int , input ( ) . split ( ) ) grid = [ ] ansgrid = [ ] for i in range ( n ) : grid . append ( input ( ) ) ansgrid . append ( [ 0 ] * m ) for i in range ( n - 2 ) : for j in range ( m - 2 ) : if grid [ i ] [ j ] == ' # ' and grid [ i + 1 ] [ j ] == ' # ' and grid [ i + 2 ] [ j ] == ' # ' and grid [ i ] [ j + 1 ] == ' # ' and grid [ i ] [ j + 2 ] == ' # ' and grid [ i + 2 ] [ j + 1 ] == ' # ' and grid [ i + 2 ] [ j + 2 ] == ' # ' and grid [ i + 1 ] [ j + 2 ] == ' # ' : ansgrid [ i ] [ j ] = 1 ansgrid [ i + 1 ] [ j ] = 1 ansgrid [ i + 2 ] [ j ] = 1 ansgrid [ i + 1 ] [ j + 2 ] = 1 ansgrid [ i + 2 ] [ j + 2 ] = 1 ansgrid [ i + 2 ] [ j + 1 ] = 1 ansgrid [ i ] [ j + 2 ] = 1 ansgrid [ i ] [ j + 1 ] = 1 flag = 0 for i in range ( n ) : for j in range ( m ) : if grid [ i ] [ j ] == ' # ' and ansgrid [ i ] [ j ] == 0 or grid [ i ] [ j ] == ' . ' and ansgrid [ i ] [ j ] == 1 : flag = 1 if flag : print ( ' NO ' ) else : print ( ' YES ' ) NEW_LINE" ]
codeforces_85_B
[ "import java . util . * ; import java . io . * ; import java . math . * ; public class Solution { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; long k1 = Long . parseLong ( st . nextToken ( ) ) ; long k2 = Long . parseLong ( st . nextToken ( ) ) ; long k3 = Long . parseLong ( st . nextToken ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; long t1 = Long . parseLong ( st . nextToken ( ) ) ; long t2 = Long . parseLong ( st . nextToken ( ) ) ; long t3 = Long . parseLong ( st . nextToken ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Long . parseLong ( st . nextToken ( ) ) ; b [ i ] = a [ i ] ; }", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   void run ( FastScanner in , PrintWriter out ) {   long [ ] K = new long [ 3 ] ; long [ ] T = new long [ 3 ] ; K [ 0 ] = in . nextLong ( ) ; K [ 1 ] = in . nextLong ( ) ; K [ 2 ] = in . nextLong ( ) ;   T [ 0 ] = in . nextLong ( ) ; T [ 1 ] = in . nextLong ( ) ; T [ 2 ] = in . nextLong ( ) ;   int N = in . nextInt ( ) ; long [ ] c = new long [ N ] ;   for ( int i = 0 ; i < N ; i ++ ) c [ i ] = in . nextLong ( ) ;   long [ ] timeWaited = new long [ N ] ; long [ ] timePutInQueue = new long [ N ] ; PriorityQueue < Integer > [ ] pq = new PriorityQueue [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { pq [ i ] = new PriorityQueue < > ( 10 , ( a , b ) -> { long ta = timeWaited [ a ] ; long tb = timeWaited [ b ] ;  " ]
[ "from heapq import heappush , heappopk = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE t = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = 0 NEW_LINE n = int ( input ( ) ) NEW_LINE l = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE X = list ( l ) NEW_LINE for i in range ( 3 ) : for NEW_LINE j in range ( n ) : NEW_LINE if j >= k [ i ] and X [ j - k [ i ] ] > X [ j ] : X [ j ] += X [ j - k [ i ] ] - X [ j ] NEW_LINE X [ j ] += t [ i ] NEW_LINE for i in range ( n ) : ans = max ( ans , X [ i ] - l [ i ] ) NEW_LINE print ( ans ) NEW_LINE" ]
codeforces_1162_A
[ "import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int sum = 0 ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = 100 ; } for ( int i = 0 ; i < m ; i ++ ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; for ( int j = l - 1 ; j < r ; j ++ ) { a [ j ] = Math . min ( a [ j ] , x ) ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == 100 ) { sum += h * h ; } else { sum += a [ i ] * a [ i ] ; } } System . out . println ( sum ) ; } }" ]
[ "n , h , m = map ( int , input ( ) . split ( ) ) X = [ h ] * nfor i in range ( m ) : l , r , x = map ( int , input ( ) . split ( ) ) l , r = l - 1 , r - 1 for j in range ( l , r + 1 ) : X [ j ] = min ( X [ j ] , x ) ans = 0 for i in range ( n ) : ans += X [ i ] ** 2 print ( ans ) NEW_LINE", "n , h , m = list ( map ( int , input ( ) . split ( ) ) ) doma = [ h ] * n   for _ in range ( m ) : l , r , x = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( l , r + 1 ) : if doma [ i - 1 ] > x : doma [ i - 1 ] = x   summ = 0 for i in doma : summ += i ** 2   print ( summ ) NEW_LINE", "n , h , m = map ( int , input ( ) . split ( ) ) l = [ h ] * nfor i in range ( 0 , m ) : p , r , x = map ( int , input ( ) . split ( ) ) for j in range ( p - 1 , r ) : if ( l [ j ] > x ) : l [ j ] = x else : passc = 0 for i in range ( n ) : c = c + l [ i ] * l [ i ] print ( c ) NEW_LINE", "from collections import defaultdict as diccn , h , cases = map ( int , input ( ) . split ( ) )   dic = dicc ( )   while cases : cases -= 1 l , r , x = map ( int , input ( ) . split ( ) )   for i in range ( l , r + 1 ) : if i not in dic or dic [ i ] > x : dic [ i ] = x   profit = 0   for spot in range ( 1 , n + 1 ) : if spot not in dic : profit += h ** 2 else : profit += ( min ( h , dic [ spot ] ) ) ** 2   print ( profit ) NEW_LINE" ]
codeforces_408_A
[ "import java . util . * ; import java . util . Arrays ; import java . util . Collections ; public class LineToCashier {   public static void main ( String [ ] args ) {", "import java . util . * ; public class LinetoCashier {   public static void main ( String [ ] args ) {", "import java . util . Scanner ;   public class LineToCashier { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , j , a [ ] = new int [ n ] , b [ ] = new int [ n ] , m = Integer . MAX_VALUE ;   for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; b [ i ] = a [ i ] * 15 ; } for ( i = 0 ; i < n ; i ++ ) { for ( j = 0 ; j < a [ i ] ; j ++ ) { b [ i ] += in . nextInt ( ) * 5 ; } } in . close ( ) ; for ( i = 0 ; i < n ; i ++ ) m = Math . min ( m , b [ i ] ) ; System . out . println ( m ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . util . StringTokenizer ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( newInputStreamReader ( 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 fs = new FastReader ( ) ; int n = fs . nextInt ( ) ;   int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = fs . nextInt ( ) ; }   int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int cur = 0 ; for ( int j = 0 ; j < a [ i ] ; j ++ ) { cur += fs . nextInt ( ) * 5 ; } cur += a [ i ] * 15 ; min = Math . min ( cur , min ) ; }   System . out . println ( min ) ;    } }", "import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int casher = sc . nextInt ( ) ; int peopleNumber [ ] = new int [ casher + 1 ] ;   for ( int i = 1 ; i <= casher ; i ++ ) { peopleNumber [ i ] = sc . nextInt ( ) ; }   int min = Integer . MAX_VALUE ; for ( int i = 1 ; i <= casher ; i ++ ) { int queueTime = 0 ; for ( int j = 1 ; j <= peopleNumber [ i ] ; j ++ ) { int temp = sc . nextInt ( ) ; queueTime += ( temp * 5 ) ; } queueTime += ( peopleNumber [ i ] * 15 ) ;" ]
[ "n = int ( input ( ) ) ks = [ int ( i ) for i in input ( ) . split ( ) ]   mi = 10 ** 9 for k in range ( n ) : mi = min ( mi , sum ( [ 5 * int ( i ) + 15 for i in input ( ) . split ( ) ] ) ) print ( mi ) NEW_LINE", "import sysn = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) min1 = sys . maxsizefor i in range ( n ) : temp = list ( map ( int , input ( ) . split ( ) ) ) temp2 = 0 temp2 += sum ( temp ) * 5 + arr [ i ] * 15 if min1 > temp2 : min1 = temp2print ( min1 ) NEW_LINE", "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) ans = 10000000000000 for i in range ( n ) : l1 = list ( map ( int , input ( ) . split ( ) ) ) t = 0 for j in range ( len ( l1 ) ) : t = l1 [ j ] * 5 + t t = t + ( len ( l1 ) * 15 ) NEW_LINE", "n = int ( input ( ) ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) ans = float ( ' inf ' ) for i in range ( n ) : x = r ( ) c = sum ( x ) * 5 + 15 * len ( x ) ans = min ( ans , c )     print ( ans )   NEW_LINE", "n = int ( input ( ) ) fodac = input ( ) val = 100000 for i in range ( n ) : val = min ( val , sum ( int ( x ) * 5 + 15 for x in input ( ) . split ( ) ) ) print ( val ) NEW_LINE" ]
codeforces_48_B
[ "import java . util . Scanner ; public class Ishu { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , m , i , j , k , l , a , b ; int sum = 0 , min = 0 , x = 0 ; int [ ] [ ] g = new int [ 50 ] [ 50 ] ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; for ( i = 0 ; i < n ; ++ i ) for ( j = 0 ; j < m ; ++ j ) g [ i ] [ j ] = sc . nextInt ( ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; for ( i = 0 ; i + a - 1 < n ; ++ i ) for ( j = 0 ; j + b - 1 < m ; ++ j ) { sum = 0 ; for ( l = i ; l <= i + a - 1 ; ++ l ) for ( k = j ; k <= j + b - 1 ; ++ k ) if ( g [ l ] [ k ] == 1 ) ++ sum ; if ( x == 0 ) { min = sum ; ++ x ; } else if ( sum < min ) min = sum ; } for ( i = 0 ; i + b - 1 < n ; ++ i ) for ( j = 0 ; j + a - 1 < m ; ++ j ) { sum = 0 ; for ( l = i ; l <= i + b - 1 ; ++ l ) for ( k = j ; k <= j + a - 1 ; ++ k ) if ( g [ l ] [ k ] == 1 ) ++ sum ; if ( x == 0 ) { min = sum ; ++ x ; } else if ( sum < min ) min = sum ; } System . out . println ( min ) ; } }", "import java . nio . file . Paths ; import java . util . * ; import java . io . * ; public class Main {", "import java . util . Scanner ; public class Ishu { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n , m , i , j , k , l , a , b , sum = 0 , min = 0 , x = 0 ; int [ ] [ ] garden = new int [ 50 ] [ 50 ] ; n = scan . nextInt ( ) ; m = scan . nextInt ( ) ; for ( i = 0 ; i < n ; ++ i ) for ( j = 0 ; j < m ; ++ j ) garden [ i ] [ j ] = scan . nextInt ( ) ; a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; for ( i = 0 ; i + a - 1 < n ; ++ i ) for ( j = 0 ; j + b - 1 < m ; ++ j ) { sum = 0 ; for ( l = i ; l <= i + a - 1 ; ++ l ) for ( k = j ; k <= j + b - 1 ; ++ k ) if ( garden [ l ] [ k ] == 1 ) ++ sum ; if ( x == 0 ) { min = sum ; ++ x ; } else if ( sum < min ) min = sum ; } for ( i = 0 ; i + b - 1 < n ; ++ i ) for ( j = 0 ; j + a - 1 < m ; ++ j ) { sum = 0 ; for ( l = i ; l <= i + b - 1 ; ++ l ) for ( k = j ; k <= j + a - 1 ; ++ k ) if ( garden [ l ] [ k ] == 1 ) ++ sum ; if ( x == 0 ) { min = sum ; ++ x ; } else if ( sum < min ) min = sum ; } System . out . println ( min ) ; } }", "  import java . lang . * ; import java . util . * ; import java . io . * ;   public class Codeforces {   public void solve ( ) throws IOException { FastScanner fs = new FastScanner ( ) ; StringBuilder print = new StringBuilder ( ) ; int n = fs . nextInt ( ) , m = fs . nextInt ( ) ; int [ ] [ ] mat = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < m ; j ++ ) mat [ i ] [ j ] = fs . nextInt ( ) ;   int a = fs . nextInt ( ) , b = fs . nextInt ( ) ; int cnt = a * b ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { int tmp = 0 , area = 0 ; for ( int k = i ; k < Math . min ( i + a , n ) ; k ++ ) { for ( int l = j ; l < Math . min ( j + b , m ) ; l ++ ) { area ++ ; if ( mat [ k ] [ l ] == 1 ) tmp ++ ; } } if ( area == a * b ) { cnt = Math . min ( tmp , cnt ) ; } area = 0 ; tmp = 0 ; for ( int k = i ; k < Math . min ( i + b , n ) ; k ++ ) { for ( int l = j ; l < Math . min ( j + a , m ) ; l ++ ) { area ++ ; if ( mat [ k ] [ l ] == 1 ) tmp ++ ; } } if ( area == a * b ) { cnt = Math . min ( tmp , cnt ) ; } } } System . out . println ( cnt ) ; }   public static void main ( String [ ] args ) throws IOException { try { new Codeforces ( ) . solve ( ) ; } catch ( Exception e ) {" ]
[ "def calc_trees ( cont , start_row , start_col , a , b ) : counter = 0 for i in range ( start_row , start_row + a ) : for j in range ( start_col , start_col + b ) : counter += cont [ i ] [ j ] return counter     n , m = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) )   cont = [ ] for i in range ( n ) : cont . append ( list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) )   a , b = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) ans , helper = n * m , 0 for i in range ( n ) : for j in range ( m ) : if i + a <= n and j + b <= m : helper = calc_trees ( cont , i , j , a , b ) if helper < ans : ans = helper if i + b <= n and j + a <= m : helper = calc_trees ( cont , i , j , b , a ) if helper < ans : ans = helperprint ( ans ) NEW_LINE", "I = lambda : map ( int , input ( ) . split ( ) )   n , m = I ( ) A = [ [ * I ( ) ] for _ in range ( n ) ] a , b = I ( )   print ( min ( sum ( A [ i ] [ j ] for i in range ( x , x + dx ) for j in range ( y , y + dy ) ) for dx , dy in ( ( a , b ) , ( b , a ) ) for x in range ( n - dx + 1 ) for y in range ( m - dy + 1 ) ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) c = [ ] for i in range ( n ) : c . append ( [ ] ) for j in input ( ) . split ( ) : c [ i ] . append ( int ( j ) ) a , b = map ( int , input ( ) . split ( ) ) ans = n * mfor i in range ( n - a + 1 ) : for j in range ( m - b + 1 ) : s = 0 for k in range ( i , i + a ) : s += sum ( c [ k ] [ j : j + b ] ) ans = min ( s , ans ) for i in range ( n - b + 1 ) : for j in range ( m - a + 1 ) : s = 0 for k in range ( i , i + b ) : s += sum ( c [ k ] [ j : j + a ] ) ans = min ( s , ans ) print ( ans ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) x = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] a , b = map ( int , input ( ) . split ( ) ) def solve ( n , m , x ) : y = [ [ 0 ] * ( m + 1 ) for i in range ( n + 1 ) ] for i in range ( n ) : for j in range ( m ) : y [ i + 1 ] [ j + 1 ] = y [ i + 1 ] [ j ] + x [ i ] [ j ] for j in range ( m ) : y [ i + 1 ] [ j + 1 ] += y [ i ] [ j + 1 ] ans = n * m for i in range ( a , n + 1 ) : for j in range ( b , m + 1 ) : ans = min ( ans , y [ i ] [ j ] - y [ i - a ] [ j ] - y [ i ] [ j - b ] + y [ i - a ] [ j - b ] ) return ansprint ( min ( solve ( n , m , x ) , solve ( m , n , list ( map ( list , zip ( * x ) ) ) ) ) ) NEW_LINE", "    n , m = map ( int , input ( ) . split ( ) )     t = [ ]   for j in range ( n ) : t . append ( list ( map ( int , input ( ) . split ( ) ) ) )       a , b = map ( int , input ( ) . split ( ) ) ans = 99999999   for i in range ( n - a + 1 ) : for j in range ( m - b + 1 ) : u = 0 for x in range ( i , i + a ) : for y in range ( j , j + b ) : u += t [ x ] [ y ]   ans = min ( ans , u )   f = [ ]   for j in range ( m ) : y = [ ] for k in range ( n ) : y . append ( t [ k ] [ j ] ) f . append ( y )   for i in range ( m - a + 1 ) : for j in range ( n - b + 1 ) : u = 0 for x in range ( i , i + a ) : for y in range ( j , j + b ) : u += f [ x ] [ y ]   ans = min ( ans , u )   print ( ans ) NEW_LINE" ]
codeforces_1411_A
[ "import java . util . * ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ;   public class ChatInGame {   public static void main ( String [ ] args ) {   List < String > inputs = new ArrayList ( ) ; int nroCharactersToEnd = 0 ; int nroRemainingCharacters = 0 ; StringBuilder result = new StringBuilder ( ) ; Scanner keyboard = new Scanner ( System . in ) ; while ( true ) { try { String text = keyboard . nextLine ( ) ; if ( text . isEmpty ( ) ) break ; else { inputs . add ( text ) ; } } catch ( Exception e ) { break ; } }   for ( String text : inputs ) { for ( int i = text . length ( ) - 1 ; i >= 0 ; i -- ) { if ( text . charAt ( i ) == ' ) ' ) { nroCharactersToEnd ++ ; } else { break ; } }   boolean containNumbers = text . contains ( \"0\" ) || text . contains ( \"1\" ) || text . contains ( \"2\" ) || text . contains ( \"3\" ) || text . contains ( \"4\" ) || text . contains ( \"5\" ) || text . contains ( \"6\" ) || text . contains ( \"7\" ) || text . contains ( \"8\" ) || text . contains ( \"9\" ) ;   if ( ! text . matches ( \" [ + - ] ? \\\\ d * ( \\\\ . \\\\ d + ) ? \" ) || ! containNumbers ) { if ( text . length ( ) / 2 >= nroCharactersToEnd ) { result . append ( \" No \\n \" ) ; } else result . append ( \" Yes \\n \" ) ; }   nroCharactersToEnd = 0 ;   }    System . out . println ( result ) ;   }   }", "import java . util . Scanner ;   public class chat {   public static void main ( String [ ] args ) { Scanner userInput = new Scanner ( System . in ) ; int t = userInput . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = userInput . nextInt ( ) ; String S = userInput . next ( ) ; int count = 0 ; for ( int j = n - 1 ; j >= 0 ; j -- , count ++ ) { if ( S . charAt ( j ) != ' ) ' ) break ; } if ( 2 * count > n ) System . out . println ( \" Yes \" ) ; else System . out . println ( \" No \" ) ; } }   }", "import java . util . Scanner ;   public class A1411 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { in . nextInt ( ) ; String S = in . next ( ) ; int count = 0 ; for ( char c : S . toCharArray ( ) ) { if ( c == ' ) ' ) { count ++ ; } else { count = 0 ; } } boolean bad = count > ( S . length ( ) - count ) ; System . out . println ( bad ? \" Yes \" : \" No \" ) ; } }   }", "import java . util . Scanner ;   public class Nk { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int t = input . nextInt ( ) ;   while ( t -- > 0 ) {   int a = input . nextInt ( ) ; String s = input . next ( ) ; int n = 0 ;   for ( int i = s . length ( ) - 1 ; i > - 1 ; i -- ) {   char c = s . charAt ( i ) ;   if ( c == ' ) ' ) { n ++ ;   if ( n == s . length ( ) ) { System . out . println ( \" Yes \" ) ; } }   else {   if ( n > s . length ( ) - n ) { System . out . println ( \" Yes \" ) ; break ; }   else { System . out . println ( \" No \" ) ; break ; } } } } } }", "import java . io . * ; import java . math . BigInteger ; import java . util . * ; import static java . lang . Math . PI ; import static java . lang . System . in ; import static java . lang . System . out ; import static java . lang . System . err ;   public class A { public static void main ( String [ ] args ) throws Exception { Foster sc = new Foster ( ) ; PrintWriter p = new PrintWriter ( out ) ; int t = sc . nextInt ( ) ; while ( t -- != 0 ) { int n = sc . nextInt ( ) ; char a [ ] = sc . next ( ) . toCharArray ( ) ; int count = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( a [ i ] == ' ) ' ) count ++ ; else break ; } p . println ( count > n - count ? \" Yes \" : \" No \" ) ; } p . close ( ) ; } static long [ ] sort ( long a [ ] ) { ArrayList < Long > arr = new ArrayList < > ( ) ; for ( long i : a ) { arr . add ( i ) ; } Collections . sort ( arr ) ; for ( int i = 0 ; i < arr . size ( ) ; i ++ ) { a [ i ] = arr . get ( i ) ; } return a ; } static int [ ] sort ( int a [ ] ) { ArrayList < Integer > arr = new ArrayList < > ( ) ; for ( int i : a ) { arr . add ( i ) ; } Collections . sort ( arr ) ;" ]
[ "t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE s = input ( ) NEW_LINE b = - 1 NEW_LINE c = 0 NEW_LINE while b >= - n and s [ b ] == ' ) ' : c += 1 NEW_LINE b -= 1 NEW_LINE print ( \" YES \" if c > n - c else \" NO \" ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE for ti in range ( t ) : n = int ( input ( ) ) NEW_LINE str = input ( ) NEW_LINE i = n - 1 NEW_LINE c = 0 NEW_LINE while i >= 0 and str [ i ] == ' ) ' : i -= 1 NEW_LINE c += 1 NEW_LINE if c > n - c : NEW_LINE INDENT print ( ' Yes ' ) else : NEW_LINE print ( ' No ' ) NEW_LINE DEDENT" ]
codeforces_106_B
[ "import java . util . * ; public class laptop {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int a [ ] [ ] = new int [ n ] [ 4 ] ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < 4 ; j ++ ) a [ i ] [ j ] = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) if ( a [ i ] [ 0 ] < a [ j ] [ 0 ] && a [ i ] [ 1 ] < a [ j ] [ 1 ] && a [ i ] [ 2 ] < a [ j ] [ 2 ] ) a [ i ] [ 3 ] = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int ctr = 0 ; for ( int j = 0 ; j < n ; j ++ ) if ( i != j && a [ i ] [ 3 ] < a [ j ] [ 3 ] ) ctr ++ ;   if ( ctr == n - 1 ) { System . out . println ( i + 1 ) ; break ; } }   }   }", "import java . util . Arrays ; import java . util . Scanner ;   public class problemB { private static final Scanner in = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { int n = in . nextInt ( ) ; int a [ ] [ ] = new int [ n ] [ 4 ] , b [ ] = new int [ n ] , c [ ] = new int [ n ] ; Arrays . fill ( c , 0 ) ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < 3 ; ++ j ) { a [ i ] [ j ] = in . nextInt ( ) ; } b [ i ] = in . nextInt ( ) ; }", "import java . util . * ; import java . lang . * ; import java . io . * ; public class Vasya_and_choose_laptop {   public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) , a [ ] [ ] = new int [ n ] [ 4 ] ; for ( int i = 0 ; i < n ; i ++ ) { StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; for ( int j = 0 ; j < 4 ; j ++ ) { a [ i ] [ j ] = Integer . parseInt ( st . nextToken ( ) ) ; } } int no = Integer . MAX_VALUE , po = 0 ; boolean b [ ] = new boolean [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int s = a [ i ] [ 0 ] , r = a [ i ] [ 1 ] , hdd = a [ i ] [ 2 ] ; for ( int j = 0 ; j < n ; j ++ ) { if ( s < a [ j ] [ 0 ] && r < a [ j ] [ 1 ] && hdd < a [ j ] [ 2 ] && ! b [ i ] ) { b [ i ] = true ;" ]
[ "from sys import * input = stdin . readlinet = int ( input ( ) ) l = [ ] cost = [ ] for i in range ( t ) : a , b , c , d = map ( int , input ( ) . split ( ) ) l . append ( [ a , b , c ] ) cost . append ( d ) for i in range ( t ) : for j in range ( t ) : if ( i != j ) : if ( l [ i ] [ 0 ] < l [ j ] [ 0 ] and l [ i ] [ 1 ] < l [ j ] [ 1 ] and l [ i ] [ 2 ] < l [ j ] [ 2 ] ) : cost [ i ] = 10000 breakprint ( cost . index ( min ( cost ) ) + 1 )   NEW_LINE", "from itertools import compressarr = [ ] yo = lenfor i in range ( int ( input ( ) ) ) : NEW_LINE", "a = int ( input ( ) ) l = [ ] for x in range ( a ) : b = list ( map ( int , input ( ) . split ( ) ) ) l . append ( b )   ma = 9999999999999 s = 0 t = - 1 for x in range ( a ) : for y in range ( a ) : if x == y : s += 1 continue   else : if l [ x ] [ 0 ] >= l [ y ] [ 0 ] or l [ x ] [ 1 ] >= l [ y ] [ 1 ] or l [ x ] [ 2 ] >= l [ y ] [ 2 ] : s += 1   if s == a : if ma > l [ x ] [ 3 ] : ma = l [ x ] [ 3 ] t = x + 1   s = 0 else : s = 0 continue   print ( t ) NEW_LINE", "n = int ( input ( ) ) li = [ ] f = [ ] p = [ ] for i in range ( n ) : l1 = list ( map ( int , input ( ) . split ( ) ) ) li . append ( l1 )   pr = [ li [ i ] [ 3 ] for i in range ( n ) ]   for i in range ( n ) : for j in range ( n ) : if li [ i ] [ 0 ] < li [ j ] [ 0 ] and li [ i ] [ 1 ] < li [ j ] [ 1 ] and li [ i ] [ 2 ] < li [ j ] [ 2 ] : pr [ i ] = 0 break   for i in range ( n ) : if pr [ i ] > 0 : f . append ( i ) p . append ( pr [ i ] )   print ( f [ p . index ( min ( p ) ) ] + 1 ) NEW_LINE", "n = int ( input ( ) ) a = 0 b = 0 c = 0 g = [ ] v = [ 0 ] * nfor _ in range ( n ) : l = list ( map ( int , input ( ) . split ( ) ) ) g . append ( l ) l = [ ] for i in range ( n ) : f = 0 for j in range ( n ) : if ( g [ i ] [ 1 ] < g [ j ] [ 1 ] and g [ i ] [ 2 ] < g [ j ] [ 2 ] and g [ i ] [ 0 ] < g [ j ] [ 0 ] ) : f = 1 break if ( f == 0 ) : l . append ( ( g [ i ] [ 3 ] , i + 1 ) ) l . sort ( key = lambda x : ( x [ 0 ] , x [ 1 ] ) )   print ( l [ 0 ] [ 1 ] ) NEW_LINE" ]
codeforces_441_B
[ "import java . util . * ;   public class Codeforces { static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int t = 1 ;   while ( t -- > 0 ) { solve ( ) ; }   sc . close ( ) ; }   private static void solve ( ) {   int n = sc . nextInt ( ) ; int v = sc . nextInt ( ) ;   int [ ] arr = new int [ 3001 ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ sc . nextInt ( ) ] += sc . nextInt ( ) ;   int op = helper ( arr , v ) ; System . out . println ( op ) ; }   private static int helper ( int [ ] arr , int v ) { int prev = 0 ; int count = 0 ; for ( int i = 1 ; i <= 3000 ; i ++ ) { int curr = v ; if ( prev >= v ) { count += curr ; prev = arr [ i ] ; } else { count += prev ; curr -= prev ; if ( arr [ i ] >= curr ) { count += curr ; prev = arr [ i ] - curr ; } else { count += arr [ i ] ; prev = 0 ; } } } if ( prev >= v ) { count += v ; } else { count += prev ; } return count ; }    public static void sort2dArray ( long [ ] [ ] arr ) { Arrays . sort ( arr , ( a , b ) -> { if ( a [ 1 ] == b [ 1 ] ) return ( int ) ( a [ 0 ] - b [ 0 ] ) ; return ( int ) ( a [ 1 ] - b [ 1 ] ) ; } ) ; }   }", "import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ;    public class B441M2 {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main {" ]
[ "n , v = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] a_dict = { } m = 0 p = 0 for tree in range ( n ) : a , b = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] m = max ( a , m ) if a in a_dict . keys ( ) : a_dict [ a ] += b else : a_dict [ a ] = b   for day in range ( m + 2 ) : if day not in a_dict . keys ( ) : a_dict [ day ] = 0     for day in range ( 1 , m + 2 ) :   y = min ( v , a_dict [ day - 1 ] ) a_dict [ day - 1 ] -= y z = min ( v - y , a_dict [ day ] ) a_dict [ day ] -= z   p += z + y   print ( p ) NEW_LINE", "from sys import stdin , stdoutinput = stdin . readline import math , bisect   n , v = map ( int , input ( ) . split ( ) ) l = [ 0 ] * ( 3002 ) for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) l [ a ] += b   ans = 0 rem = 0 for i in range ( 1 , 3002 ) : if l [ i ] + rem <= v : ans += ( l [ i ] + rem ) rem = 0 else : if rem >= v : ans += v rem = l [ i ] else : ans += rem if l [ i ] >= v - rem : ans += v - rem rem = l [ i ] - ( v - rem ) else : ans += l [ i ] rem = 0 print ( ans + min ( v , rem ) )   NEW_LINE", "n , v = map ( int , input ( ) . split ( ) ) l = [ ] for j in range ( 3001 ) : l += [ 0 ] for k in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) l [ x - 1 ] += ysum = 0 for kl in range ( 3001 ) : if kl == 0 : if v <= l [ kl ] : sum += v l [ kl ] -= v else : sum += l [ kl ] l [ kl ] = 0 else : v1 = v if v1 <= l [ kl - 1 ] : sum += v1 l [ kl - 1 ] -= v1 else : sum += l [ kl - 1 ] v1 -= l [ kl - 1 ] l [ kl - 1 ] = 0 if v1 > 0 : if v1 <= l [ kl ] : sum += v1 l [ kl ] -= v1 else : sum += l [ kl ] l [ kl ] = 0 print ( sum ) NEW_LINE", "n , v = map ( int , input ( ) . split ( ) ) lst = [ 0 ] * 3002 for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) lst [ a ] += b   ans = 0 prev = 0 for i in range ( 1 , len ( lst ) ) : available = min ( v , prev + lst [ i ] ) ans += available if prev >= v : prev = lst [ i ] else : prev = max ( 0 , lst [ i ] - ( v - prev ) )   print ( ans ) NEW_LINE" ]
codeforces_455_A
[ "import java . io . * ; import java . util . StringTokenizer ;", "import java . io . * ; import java . util . StringTokenizer ;", "import java . io . * ; import java . util . * ;   public class Main { static int n ; static int [ ] arr ; static final int MAXN = ( int ) 1e5 + 7 ;", "import java . util . * ; import java . io . * ;    public class C_Div1_A_Boredom { public static void main ( String args [ ] ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] sarr = br . readLine ( ) . split ( \" ▁ \" ) ; long [ ] arr = new long [ 100001 ] ; for ( int i = 0 ; i < n ; i ++ ) { int val = Integer . parseInt ( sarr [ i ] ) ; arr [ val ] ++ ; } long [ ] dp = new long [ 100001 ] ; dp [ 1 ] = arr [ 1 ] ; for ( int i = 2 ; i < arr . length ; i ++ ) { dp [ i ] = Math . max ( dp [ i - 1 ] , dp [ i - 2 ] + i * arr [ i ] ) ; } System . out . println ( dp [ 100000 ] ) ; } }   " ]
[ "from collections import defaultdict , deque , Counterfrom sys import stdin , stdoutfrom heapq import heappush , heappopimport mathimport ioimport osimport mathimport bisect   NEW_LINE", "from collections import * from itertools import * from string import * from bisect import * from queue import * from heapq import * from math import * from sys import * from re import * def fast ( ) : return stdin . readline ( ) . strip ( ) def zzz ( ) : return [ int ( i ) for i in fast ( ) . split ( ) ]     z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) )     def lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) def output ( answer ) : stdout . write ( str ( answer ) )     dx = [ - 1 , 1 , 0 , 0 , 1 , - 1 , 1 , - 1 ] dy = [ 0 , 0 , 1 , - 1 , 1 , - 1 , - 1 , 1 ]     NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( reverse = True ) b = [ ] idx = 0 cnt = 1 while idx < n : while idx + 1 < n and a [ idx ] == a [ idx + 1 ] : idx += 1 cnt += 1 b . append ( [ a [ idx ] , cnt ] ) cnt = 1 idx += 1 ans = 0 m = len ( b ) dp = [ 0 ] * mdp [ - 1 ] = b [ m - 1 ] [ 0 ] * b [ m - 1 ] [ 1 ] for i in range ( m - 1 ) [ : : - 1 ] : if b [ i ] [ 0 ] == b [ i + 1 ] [ 0 ] + 1 and i + 2 < m : dp [ i ] = max ( dp [ i + 1 ] , dp [ i + 2 ] + b [ i ] [ 0 ] * b [ i ] [ 1 ] ) elif b [ i ] [ 0 ] == b [ i + 1 ] [ 0 ] + 1 : dp [ i ] = max ( dp [ i + 1 ] , b [ i ] [ 0 ] * b [ i ] [ 1 ] ) else : dp [ i ] = dp [ i + 1 ] + b [ i ] [ 0 ] * b [ i ] [ 1 ] print ( max ( dp ) ) NEW_LINE", "import sys , mathfrom itertools import permutations , combinationsfrom collections import defaultdict , dequeinput = sys . stdin . readline   n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) d = defaultdict ( int ) maxi = 0 for i in l : maxi = max ( maxi , i ) d [ i ] += 1 dp = [ 0 for i in range ( maxi + 1 ) ] dp [ 1 ] = d [ 1 ] for i in range ( 2 , maxi + 1 ) : dp [ i ] = max ( d [ i ] * i + dp [ i - 2 ] , dp [ i - 1 ] ) print ( dp [ - 1 ] ) NEW_LINE", "import osimport sysfrom io import BytesIO , IOBaseimport mathimport itertoolsimport bisectimport heapq NEW_LINE" ]
codeforces_573_B
[ "import java . io . File ; import java . util . Arrays ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class p023 { public static void main ( String args [ ] ) throws Exception { StringTokenizer stok = new StringTokenizer ( new Scanner ( System . in ) . useDelimiter ( \" \\\\ A \" ) . next ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; int n = Integer . parseInt ( stok . nextToken ( ) ) ; long [ ] a = new long [ n + 2 ] ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = Long . parseLong ( stok . nextToken ( ) ) ; long [ ] l = new long [ n + 2 ] ; long [ ] r = new long [ n + 2 ] ; for ( int i = 1 ; i <= n ; i ++ ) l [ i ] = Math . min ( l [ i - 1 ] + 1 , a [ i ] ) ; for ( int i = n ; i >= 1 ; i -- ) r [ i ] = Math . min ( r [ i + 1 ] + 1 , a [ i ] ) ; for ( int i = 1 ; i <= n ; i ++ ) l [ i ] = Math . min ( l [ i ] , r [ i ] ) ; System . out . println ( Arrays . stream ( l ) . max ( ) . getAsLong ( ) ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Solution { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; int [ ] array = new int [ n ] ; int [ ] farward = new int [ n ] ; StringTokenizer stoken = new StringTokenizer ( reader . readLine ( ) ) ; array [ 0 ] = Integer . parseInt ( stoken . nextToken ( ) ) ; farward [ 0 ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) { array [ i ] = Integer . parseInt ( stoken . nextToken ( ) ) ; farward [ i ] = Math . min ( farward [ i - 1 ] + 1 , array [ i ] ) ; } int [ ] backward = new int [ n ] ; backward [ n - 1 ] = 1 ; int res = Math . min ( farward [ n - 1 ] , backward [ n - 1 ] ) ; for ( int i = n - 2 ; i > - 1 ; i -- ) { backward [ i ] = Math . min ( backward [ i + 1 ] + 1 , array [ i ] ) ; res = Math . max ( res , Math . min ( farward [ i ] , backward [ i ] ) ) ; } System . out . println ( res ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Solution { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; int [ ] array = new int [ n ] ; int [ ] farward = new int [ n ] ; StringTokenizer stoken = new StringTokenizer ( reader . readLine ( ) ) ; array [ 0 ] = Integer . parseInt ( stoken . nextToken ( ) ) ; farward [ 0 ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) { array [ i ] = Integer . parseInt ( stoken . nextToken ( ) ) ; farward [ i ] = Math . min ( farward [ i - 1 ] + 1 , array [ i ] ) ; } int [ ] backward = new int [ n ] ; backward [ n - 1 ] = 1 ; int res = Math . min ( farward [ n - 1 ] , backward [ n - 1 ] ) ; for ( int i = n - 2 ; i > - 1 ; i -- ) { backward [ i ] = Math . min ( backward [ i + 1 ] + 1 , array [ i ] ) ; res = Math . max ( res , Math . min ( farward [ i ] , backward [ i ] ) ) ; } System . out . println ( res ) ; } }" ]
[ "from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) PI = float ( ' inf ' ) for _ in range ( 1 ) : NEW_LINE", "from math import infn = int ( input ( ) ) l = [ int ( i ) for i in input ( ) . split ( ) ] l . append ( 0 ) l . insert ( 0 , 0 ) minus = [ v - i for i , v in enumerate ( l ) ] plus = [ v + i for i , v in enumerate ( l ) ]   lminus , rplus = [ minus [ 0 ] ] , [ plus [ - 1 ] ] for i in range ( 1 , n + 1 ) : lminus . append ( min ( lminus [ - 1 ] , minus [ i ] ) ) lminus . append ( inf )   for i in range ( n , 0 , - 1 ) : rplus . append ( min ( rplus [ - 1 ] , plus [ i ] ) ) rplus . append ( inf ) rplus . reverse ( ) m = 0   for i in range ( 1 , n + 1 ) : x = min ( lminus [ i ] + i , rplus [ i ] - i ) m = max ( m , x ) print ( m ) NEW_LINE", "import sysfrom math import gcd , sqrt , ceil , log2from collections import defaultdict , Counter , dequefrom bisect import bisect_left , bisect_rightimport mathsys . setrecursionlimit ( 2 * 10 ** 5 + 10 ) import heapqfrom itertools import permutations   NEW_LINE" ]
codeforces_301_A
[ "import java . util . * ; import java . io . * ;   public class Yaroslav_and_Sequence {   static int mod = ( int ) ( 1e9 + 7 ) ;   public static void main ( String [ ] args ) throws java . lang . Exception { long start = System . nanoTime ( ) ;", "import static java . lang . System . out ;   import java . util . * ;   public class Test {   Test ( ) { Scanner in = new Scanner ( System . in ) ; int initNumber = in . nextInt ( ) ; List < Integer > numbers = new ArrayList < > ( ) ; boolean hasZero = false ; int minuses = 0 ; int sum = 0 ; for ( int index = 0 ; index < 2 * initNumber - 1 ; index ++ ) { int number = in . nextInt ( ) ; if ( number < 0 ) { minuses ++ ; number *= - 1 ; } else if ( number == 0 ) { hasZero = true ; } sum += number ; numbers . add ( number ) ; } if ( hasZero ) { out . println ( sum ) ; return ; } if ( initNumber % 2 == 1 ) { out . println ( sum ) ; return ; } if ( minuses % 2 == 0 ) { out . println ( sum ) ; return ; } Collections . sort ( numbers ) ; out . println ( sum - 2 * numbers . get ( 0 ) ) ; }   public static void main ( String [ ] args ) { new Test ( ) ; } }", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   int N ; int [ ] a ; void run ( FastScanner in , PrintWriter out ) {  " ]
[ "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) neg = 0   for i in range ( len ( a ) ) : if ( a [ i ] < 0 ) : neg += 1 a [ i ] = - a [ i ] if ( neg % 2 == 0 or n % 2 == 1 ) : print ( sum ( a ) ) else : print ( sum ( a ) - min ( a ) * 2 ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) t = 0 for i in range ( len ( a ) ) : if a [ i ] < 0 : t += 1 a [ i ] = - a [ i ] if t % 2 == 0 or n % 2 == 1 : print ( sum ( a ) ) else : print ( sum ( a ) - min ( a ) * 2 ) NEW_LINE", "/ * Author - - Vishwas Agrawal * // * Author - - Vishwas Agrawal * / NEW_LINE" ]
codeforces_1363_A
[ "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int scene = sc . nextInt ( ) ; for ( int k = 0 ; k < scene ; k ++ ) { int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int list1Cnt = 0 ; int list2Cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int temp = sc . nextInt ( ) ; if ( temp % 2 != 0 ) { list1Cnt ++ ; } else { list2Cnt ++ ; } }   boolean result = false ; if ( list2Cnt >= x - 1 ) { result = list1Cnt >= 1 ; } else { if ( ( x - list2Cnt ) % 2 == 1 ) { result = list1Cnt >= x - list2Cnt ; } else { if ( list2Cnt == 0 ) { result = false ; } else { result = list1Cnt >= x - list2Cnt + 1 ; } } } System . out . println ( result ? \" YES \" : \" NO \" ) ; } } }", "import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class Bit_year { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int T = sc . nextInt ( ) ; while ( T -- > 0 ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; List < Integer > even = new ArrayList < Integer > ( ) ; List < Integer > odd = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int num = sc . nextInt ( ) ; if ( num % 2 == 0 ) even . add ( num ) ; else odd . add ( num ) ; } int sum = 0 ; if ( odd . size ( ) > 0 ) { sum += odd . get ( 0 ) ; odd . remove ( 0 ) ; k -- ; while ( k > 1 && odd . size ( ) > 1 ) { sum += odd . get ( 0 ) ; odd . remove ( 0 ) ; sum += odd . get ( 0 ) ; odd . remove ( 0 ) ; k -= 2 ; } while ( k > 0 && even . size ( ) > 0 ) { sum += even . get ( 0 ) ; even . remove ( 0 ) ; k -- ; } } System . out . println ( ( k > 0 || sum == 0 || sum % 2 == 0 ) ? \" NO \" : \" YES \" ) ; } } }" ]
[ "t = int ( input ( ) )   for i in range ( t ) : n , x = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) odd = 0 even = 0 for j in range ( n ) : if a [ j ] % 2 == 1 : odd += 1 else : even += 1 m = min ( even , x - 1 ) d = x - m   if d % 2 == 0 : d += 1 if odd >= d and d <= x : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "t = int ( input ( ) )   def odd_sum ( n , l ) : eve = 0 odd = 0 t = 0 for i in l : if i % 2 == 0 : eve += 1 else : odd += 1   m = min ( eve , n - 1 ) fill = n - m if fill % 2 == 0 : fill += 1 if odd >= fill and fill <= n : return ' Yes ' else : return ' No '     for i in range ( t ) : n , x = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) print ( odd_sum ( x , l ) )             NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , x = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) e = 0 o = 0 for i in l : if i % 2 == 0 : e += 1 else : o += 1 if e + o == x : if o % 2 != 0 : print ( \" Yes \" ) else : print ( \" No \" ) else : if o >= x and x % 2 != 0 : print ( \" Yes \" ) elif o >= 1 and e >= 1 : print ( \" YES \" ) else : print ( \" No \" ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , x = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   ce = 0 co = 0 summ = 0 for i in a : if i % 2 == 0 : ce += 1 else : co += 1 summ += i if n == x : if summ % 2 == 0 : print ( \" No \" ) else : print ( \" Yes \" ) elif x % 2 == 0 : if ce > 0 and co > 0 : print ( \" Yes \" ) else : print ( \" No \" ) else : if co > 0 : print ( \" Yes \" ) else : print ( \" No \" ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , x = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) odd = 0 even = 0 for i in l : if ( i % 2 == 0 ) : even += 1 else : odd += 1 if ( odd == 0 ) : print ( \" No \" ) else : if ( odd % 2 == 0 ) : if ( x < odd ) : if ( x % 2 == 0 ) : rem = 1 else : rem = 0 else : rem = x - ( odd - 1 ) else : if ( x < odd ) : if ( x % 2 == 0 ) : rem = 1 else : rem = 0 else : rem = x - odd print ( ' Yes ' if even >= rem else ' No ' ) NEW_LINE" ]
codeforces_51_A
[ "import java . util . * ; public class A51 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; boolean [ ] table = new boolean [ 6667 ] ; int num = scan . nextInt ( ) , a , b , number , result = 1 , j = 0 ; a = scan . nextInt ( ) * 100 ; b = scan . nextInt ( ) ; number = b % 10 * 10 + ( b / 10 ) + a ; for ( int i = 0 ; i < 4 ; i ++ ) { number = rotate ( number ) ; table [ number ] = true ; } for ( int i = 1 ; i < num ; i ++ ) { scan . next ( ) ; a = scan . nextInt ( ) * 100 ; b = scan . nextInt ( ) ; number = b % 10 * 10 + ( b / 10 ) + a ; j = 0 ; if ( ! table [ number ] ) for ( j = 0 ; j < 4 ; j ++ ) { number = rotate ( number ) ; table [ number ] = true ; } if ( j != 0 ) result ++ ; } System . out . println ( result ) ; }   public static int rotate ( int number ) { int help = number % 10 * 1000 ; number /= 10 ; return number + help ; } }", "import java . util . Arrays ; import java . util . Scanner ;   public class AA {   public static void main ( String [ ] args ) { int n , temp , min , x ; int c [ ] = new int [ 10 ] ; boolean w [ ] = new boolean [ 10010 ] ; Arrays . fill ( w , false ) ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { in . nextLine ( ) ; for ( int j = 0 ; j < 4 ; j += 2 ) { String a = in . nextLine ( ) ; c [ j ] = a . charAt ( 0 ) - '0' ; c [ j + 1 ] = a . charAt ( 1 ) - '0' ; } temp = c [ 2 ] ; c [ 2 ] = c [ 3 ] ; c [ 3 ] = temp ; min = 99999 ; for ( int j = 0 ; j < 4 ; j ++ ) c [ j + 4 ] = c [ j ] ; for ( int j = 0 ; j < 4 ; j ++ ) { x = 0 ; for ( int r = j ; r < j + 4 ; r ++ ) { x = x * 10 + c [ r ] ; } if ( x < min ) { min = x ; } } w [ min ] = true ;   } int ans = 0 ; for ( int i = 0 ; i <= 9999 ; i ++ ) { if ( w [ i ] ) ans ++ ; } System . out . println ( ans ) ;   }   }", "import java . util . ArrayList ; import java . util . Scanner ;     public class ASD {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; ArrayList < Domino > dominoes = new ArrayList < Domino > ( ) ;   while ( n > 0 ) { in . nextLine ( ) ; String a = in . nextLine ( ) ; String b = in . nextLine ( ) ; Domino B = new Domino ( ) ; B . a [ 0 ] = ( int ) ( a . charAt ( 0 ) - '0' ) ; B . a [ 1 ] = ( int ) ( a . charAt ( 1 ) - '0' ) ; B . a [ 2 ] = ( int ) ( b . charAt ( 1 ) - '0' ) ; B . a [ 3 ] = ( int ) ( b . charAt ( 0 ) - '0' ) ; dominoes . add ( B ) ;   for ( int i = 0 ; i < dominoes . size ( ) - 1 ; i ++ ) { if ( B . is_equal ( dominoes . get ( i ) ) ) { dominoes . remove ( i ) ; }   }   n -- ; } System . out . println ( dominoes . size ( ) ) ; }   }   class Domino { int [ ] a = new int [ 4 ] ;   boolean is_equal ( Domino A ) { for ( int i = 0 ; i < 4 ; i ++ ) { if ( this . a [ i ] == A . a [ 0 ] && this . a [ ( i + 1 ) % 4 ] == A . a [ 1 ] && this . a [ ( i + 2 ) % 4 ] == A . a [ 2 ] && this . a [ ( i + 3 ) % 4 ] == A . a [ 3 ] ) return true ; } return false ;   }   }" ]
[ "def rotate ( item : str ) -> str : NEW_LINE", "n = int ( input ( ) ) a = [ ] for i in range ( n ) : s = input ( ) s += input ( ) [ : : - 1 ] if i != n - 1 : input ( ) add = True for x in a : if s in x : add = False break if add : a . append ( s + s ) print ( len ( a ) ) NEW_LINE", "d = dict ( ) ; o = int ( input ( ) ) for t in range ( o ) : x , y = input ( ) . replace ( ' ' , ' ▁ ' ) . split ( ) i , j = input ( ) . replace ( ' ' , ' ▁ ' ) . split ( ) if t != o - 1 : input ( ) if not ( ( x , y , i , j ) in d or ( y , j , x , i ) in d or ( j , i , y , x ) in d or ( i , x , j , y ) in d ) : d [ ( x , y , i , j ) ] = 1 print ( len ( d ) ) NEW_LINE", "n = int ( input ( ) ) d = { } for i in range ( n ) : s = ' ' found = False s = input ( ) + input ( ) if i != n - 1 : input ( ) t = s [ 2 ] + s [ 0 ] + s [ 3 ] + s [ 1 ] p = s [ 3 ] + s [ 2 ] + s [ 1 ] + s [ 0 ] q = s [ 1 ] + s [ 3 ] + s [ 0 ] + s [ 2 ] for key in d . keys ( ) : for var in d [ key ] . keys ( ) : if s == var : found = True d [ key ] [ var ] += 1 if not found : d [ s ] = { } d [ s ] [ s ] = 1 d [ s ] [ t ] = 0 d [ s ] [ p ] = 0 d [ s ] [ q ] = 0 print ( len ( d ) ) NEW_LINE", "nro_amu = int ( input ( ) )   amu = [ ] for i in range ( nro_amu ) : fila1 = list ( input ( ) ) fila2 = list ( input ( ) ) fila1 . extend ( fila2 ) amu . append ( fila1 ) if i + 1 != nro_amu : _ = input ( ) pilas = [ ] nro_pilas = 0   for a in amu : existe = False for i in range ( nro_pilas ) : for j in range ( 4 ) : if pilas [ i ] [ j ] == a : existe = True if not existe : pilas . append ( [ a , [ a [ 2 ] , a [ 0 ] , a [ 3 ] , a [ 1 ] ] , [ a [ 3 ] , a [ 2 ] , a [ 1 ] , a [ 0 ] ] , [ a [ 1 ] , a [ 3 ] , a [ 0 ] , a [ 2 ] ] ] ) nro_pilas = nro_pilas + 1 print ( nro_pilas ) NEW_LINE" ]
codeforces_49_A
[ "import java . util . * ; public class Sleuth {   public static void main ( String [ ] args ) {", "import java . util . * ; public class Sleuth {   public static void main ( String [ ] args ) {", "import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; for ( int i = s . length ( ) - 1 ; i >= 0 ; i -- ) { char c = s . charAt ( i ) ; if ( c == ' ? ' || c == ' ▁ ' ) continue ; if ( c == ' A ' || c == ' E ' || c == ' I ' || c == ' O ' || c == ' U ' || c == ' Y ' || c == ' a ' || c == ' e ' || c == ' i ' || c == ' o ' || c == ' u ' || c == ' y ' ) { System . out . println ( \" YES \" ) ; return ; } else { System . out . println ( \" NO \" ) ; return ; } } } }" ]
[ "if input ( ) . lower ( ) . strip ( ' ? ▁ ' ) [ - 1 ] in ' aeiouy ' : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "pregunta = input ( ) n = len ( pregunta ) vocales = [ ' A ' , ' E ' , ' I ' , ' O ' , ' U ' , ' Y ' , ' a ' , ' e ' , ' i ' , ' o ' , ' u ' , ' y ' ] rpta = ' '   i = 2 while i <= n and rpta == ' ' : if pregunta [ n - i ] != ' ▁ ' : for j in range ( len ( vocales ) ) : if pregunta [ n - i ] == vocales [ j ] : rpta = ' YES ' break if rpta == ' ' : rpta = ' NO ' i = i + 1 print ( rpta ) NEW_LINE", "s = input ( ) v = \" AEIOUYaeiouy \" l = [ ] for i in s [ : : - 1 ] : if i != \" ▁ \" and i != \" ? \" : if i in v : print ( \" YES \" ) exit ( ) else : print ( \" NO \" ) exit ( ) NEW_LINE", "x = [ \" a \" , \" e \" , \" i \" , \" o \" , \" u \" , \" y \" , \" A \" , \" E \" , \" I \" , \" O \" , \" U \" , \" Y \" ] a = input ( ) a = a . replace ( \" ▁ \" , \" \" ) if a [ - 2 ] in x : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "str1 = list ( map ( str , input ( ) . split ( ) ) ) if ( str1 [ len ( str1 ) - 1 ] == ' ? ' ) : k = str1 [ len ( str1 ) - 2 ] k_len = len ( k ) m = k [ k_len - 1 ] if ( m == ' a ' or m == ' e ' or m == ' i ' or m == ' o ' or m == ' u ' or m == ' y ' or m == ' A ' or m == ' E ' or m == ' I ' or m == ' O ' or m == ' U ' or m == ' Y ' ) : print ( ' YES ' ) else : print ( ' NO ' ) else : k = str1 [ len ( str1 ) - 1 ] k_len = len ( k ) m = k [ k_len - 2 ] if ( m == ' a ' or m == ' e ' or m == ' i ' or m == ' o ' or m == ' u ' or m == ' y ' or m == ' A ' or m == ' E ' or m == ' I ' or m == ' O ' or m == ' U ' or m == ' Y ' ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE" ]
codeforces_899_B
[ "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 . util . * ; public class contest10 { static Scanner scn = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = scn . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = scn . nextInt ( ) ; String input = \" \" ; for ( int val : arr ) input += \" , \" + val ; n = input . length ( ) ;", "import java . io . * ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) throws Exception { int n = in . readInt ( ) ; int [ ] A = in . readA ( ) ; int [ ] days = { 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; boolean l = false ;   for ( int i = 0 ; i < 12 ; i ++ ) { int j = 0 , leap = 0 ; for ( ; j < n ; j ++ ) { if ( days [ ( j + i ) % 12 ] != A [ j ] ) { if ( ( j + i ) % 12 == 1 && A [ j ] == 29 ) leap ++ ; else break ; } } if ( j == n && leap < 2 ) l = true ; }   if ( l ) System . out . println ( \" Yes \" ) ; else System . out . println ( \" No \" ) ;", "import java . util . Scanner ;   public class App {   public static void main ( String [ ] args ) { Scanner inp = new Scanner ( System . in ) ; int n = inp . nextInt ( ) ; String a = \"312831303130313130313031\" ; String b = \" \" ; int t ; boolean lp = false ; for ( int i = 0 ; i < n ; i ++ ) { t = inp . nextInt ( ) ; if ( t == 29 ) { if ( lp ) { System . out . println ( \" NO \" ) ; inp . close ( ) ; return ; } b += 28 ; lp = true ; } else { b += t ; } } String tmp = a ; if ( tmp . contains ( b ) ) { System . out . println ( \" YES \" ) ; } else if ( ( tmp += a ) . contains ( b ) ) { System . out . println ( \" YES \" ) ; } else if ( ( tmp += a ) . contains ( b ) ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } inp . close ( ) ; }   }" ]
[ "a = '31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31 , ' a = a * 10 c = input ( ) b = input ( ) . replace ( ' ▁ ' , ' , ' ) if b in a : print ( ' Yes ' ) else : print ( ' No ' ) NEW_LINE", "if __name__ == ' _ _ main _ _ ' : cin = input d = \"31 ▁ 28 ▁ 31 ▁ 30 ▁ 31 ▁ 30 ▁ 31 ▁ 31 ▁ 30 ▁ 31 ▁ 30 ▁ 31 ▁ \" y = \"31 ▁ 29 ▁ 31 ▁ 30 ▁ 31 ▁ 30 ▁ 31 ▁ 31 ▁ 30 ▁ 31 ▁ 30 ▁ 31 ▁ \" s = d * 3 + y + d + \"31\" n = int ( input ( ) ) a = \" ▁ \" . join ( input ( ) . split ( ) ) print ( \" YNEOS \" [ not a in s : : 2 ] ) NEW_LINE", "normal = '312831303130313130313031' leap = '312931303130313130313031' years_5 = normal * 2 + leap + normal * 2 n = int ( input ( ) ) A = [ a for a in input ( ) . split ( ) ] A = ' ' . join ( A ) if ( A in years_5 ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE", "n = int ( input ( ) )   monthsnofeb = [ 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 , 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 ] monthsnofeblazy = [ str ( bruhh ) for bruhh in monthsnofeb ] bruh = [ str ( wow ) for wow in input ( ) . split ( ) ]   if ( ' ' . join ( bruh ) in ' ' . join ( monthsnofeblazy ) ) == True : print ( \" yes \" ) exit ( ) print ( \" no \" ) NEW_LINE", "import sysimport mathfrom collections import OrderedDictdef 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 ( ) ) ) temp1 = '312831303130313130313031312831303130313130313031312831303130313130313031312831303130313130313031' temp2 = '312831303130313130313031312831303130313130313031312931303130313130313031312831303130313130313031312831303130313130313031' n = iinput ( ) l = listinput ( ) temp3 = ' ' . join ( map ( str , l ) ) if temp3 in temp1 or temp3 in temp2 : print ( ' Yes ' ) else : print ( ' No ' ) NEW_LINE" ]
codeforces_837_A
[ "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   void run ( FastScanner in , PrintWriter out ) throws IOException { int N = in . nextInt ( ) ; char [ ] ca = in . br . readLine ( ) . toCharArray ( ) ;   int max = 0 ; for ( int i = 0 ; i < N ; ) { if ( ! alpha ( ca [ i ] ) ) { i ++ ; continue ; }   int vol = 0 ; while ( i < N && alpha ( ca [ i ] ) ) { if ( ca [ i ] >= ' A ' && ca [ i ] <= ' Z ' ) vol ++ ; i ++ ; } max = Math . max ( vol , max ) ; } out . println ( max ) ;   } boolean alpha ( char c ) { return ( c >= ' A ' && c <= ' Z ' ) || ( c >= ' a ' && c <= ' z ' ) ;   }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( in ) ) ; st = null ; }   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 ( ) ) ; } } }", "import java . util . * ;   public class P3 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ;   int c = 0 ; int max = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) >= ' A ' && s . charAt ( i ) <= ' Z ' ) { c ++ ; max = Math . max ( c , max ) ; } if ( s . charAt ( i ) == ' ▁ ' ) { c = 0 ; } } System . out . println ( max ) ; } }", "import java . io . * ; import java . util . * ;   public class A1008 { public static void main ( String [ ] args ) { InputStream inputReader = System . in ; OutputStream outputReader = System . out ; InputReader in = new InputReader ( inputReader ) ;", "import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; public class _p000837A { static public void main ( final String [ ] args ) throws IOException { p000837A . _main ( args ) ; }", "import java . util . * ; public class test { public static void main ( String [ ] agrs ) { int n ; String s ; Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; s = scan . nextLine ( ) ;" ]
[ "n = input ( ) S = list ( map ( str , input ( ) . split ( ) ) ) Max = 0 for i in range ( len ( S ) ) : C = 0 for j in range ( len ( S [ i ] ) ) : if S [ i ] [ j ] . isupper ( ) : C += 1 if C > Max : Max = Cprint ( Max ) NEW_LINE", "if __name__ == \" _ _ main _ _ \" : text_length = int ( input ( ) ) words = list ( input ( ) . split ( ) ) max_volume = 0 for word in words : max_volume = max ( max_volume , sum ( [ 1 for letter in word if str ( letter ) . isupper ( ) ] ) ) print ( max_volume ) NEW_LINE", "num = input ( )   arr = input ( ) . split ( )   mx = 0 ct = 0 for word in arr : for char in word : if char . isupper ( ) : ct += 1 mx = max ( mx , ct ) ct = 0   print ( mx )   NEW_LINE", "import string   uppercased_letters = string . ascii_uppercase   def find_volume ( word ) : volume = 0 for character in word : if character in uppercased_letters : volume += 1 return volume   _ = int ( input ( ) ) text = input ( )   volumes = [ ] words = text . split ( )   for word in words : volumes . append ( find_volume ( word ) )   volume_of_text = max ( volumes ) print ( volume_of_text ) NEW_LINE", "n = int ( input ( ) ) s = input ( ) . split ( ) ans = 0 for i in s : now = 0 for j in i : now += j <= ' Z ' ans = max ( ans , now )   print ( ans ) NEW_LINE" ]
codeforces_1506_A
[ "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; int testCount = Integer . parseInt ( in . next ( ) ) ; for ( int i = 1 ; i <= testCount ; i ++ ) solver . solve ( i , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long n = in . nextLong ( ) ; long m = in . nextLong ( ) ; long x = in . nextLong ( ) ; long col = ( x / n ) ; if ( x % n > 0 ) col ++ ; long row = ( x - 1 ) % n ; out . println ( m * row + col ) ; } } }", "import java . util . Scanner ; public class StrangeTable { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int testCase = sc . nextInt ( ) ; while ( testCase > 0 ) { String input = sc . next ( ) ; input += sc . nextLine ( ) ; int i = 0 ; String [ ] split = input . split ( \" ▁ \" ) ; long m = Long . parseLong ( split [ i ++ ] ) ; long n = Long . parseLong ( split [ i ++ ] ) ; long x = Long . parseLong ( split [ i ] ) ; long p = x % m == 0 ? x / m : x / m + 1 ; long q = x % m == 0 ? m : x % m ; long y = ( q - 1 ) * n + p ; System . out . println ( y ) ; testCase -- ; } } }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; solve ( n , m , x ) ; } } public static void solve ( long n , long m , long x ) { x -- ; long row = x % n ; long col = x / n ; System . out . println ( row * m + col + 1 ) ; } }", "import java . io . IOException ; import java . util . * ; public class Main5 { static int [ ] t ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long col = x / n ; long row = x % n ; if ( row == 0 ) { col -- ; row = n - 1 ; } else { row -- ; } long val = row * m + col + 1 ; System . out . println ( val ) ; } } }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t > 0 ) { long n = scan . nextLong ( ) ; long m = scan . nextLong ( ) ; long x = scan . nextLong ( ) ; long row = ( x - 1 ) % n + 1 ; long col = ( x - 1 ) / n + 1 ; System . out . println ( ( row - 1 ) * m + col ) ; t -- ; } } }" ]
[ "from sys import stdin , setrecursionlimit , stdout NEW_LINE from math import sqrt , floor , ceil , log , log2 , log10 , pi , gcd , sin , cos , asin NEW_LINE def ii ( ) : return int ( stdin . readline ( ) ) NEW_LINE def fi ( ) : return float ( stdin . readline ( ) ) NEW_LINE def mi ( ) : return map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE def fmi ( ) : return map ( float , stdin . readline ( ) . split ( ) ) NEW_LINE def li ( ) : return list ( mi ( ) ) NEW_LINE def si ( ) : return stdin . readline ( ) . rstrip ( ) NEW_LINE def lsi ( ) : return list ( si ( ) ) NEW_LINE mod = 1000000007 NEW_LINE res = [ ' NO ' , ' YES ' ] NEW_LINE test , test_case = 0 , 1 NEW_LINE test_case = ii ( ) NEW_LINE while test < test_case : NEW_LINE INDENT test += 1 NEW_LINE n , m , x = mi ( ) NEW_LINE c = ceil ( x / n ) NEW_LINE r = x % n NEW_LINE if not r : NEW_LINE INDENT r = n NEW_LINE DEDENT print ( m * ( r - 1 ) + c ) NEW_LINE DEDENT", "import math NEW_LINE cases = int ( input ( ) ) NEW_LINE for c in range ( cases ) : NEW_LINE INDENT n , m , pos = map ( int , input ( ) . split ( ) ) NEW_LINE row = pos % n if pos % n != 0 else n NEW_LINE col = ( pos - 1 ) // n + 1 NEW_LINE answ = ( row - 1 ) * m + col NEW_LINE print ( answ ) NEW_LINE DEDENT", "import math NEW_LINE def main ( ) : NEW_LINE INDENT t = int ( input ( ) ) NEW_LINE cases = [ ] NEW_LINE for i in range ( t ) : NEW_LINE INDENT cases . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE DEDENT for case in cases : NEW_LINE INDENT if case [ 2 ] % case [ 0 ] == 0 : NEW_LINE INDENT row = case [ 0 ] NEW_LINE DEDENT else : NEW_LINE INDENT row = case [ 2 ] % case [ 0 ] NEW_LINE DEDENT col = math . ceil ( case [ 2 ] / case [ 0 ] ) NEW_LINE x = row * case [ 1 ] - ( case [ 1 ] - col ) NEW_LINE print ( x ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT", "import math as m NEW_LINE def findClosest ( arr , n , target ) : NEW_LINE INDENT if ( target <= arr [ 0 ] ) : NEW_LINE INDENT return arr [ 0 ] , 0 NEW_LINE DEDENT if ( target >= arr [ n - 1 ] ) : NEW_LINE INDENT return arr [ n - 1 ] , n - 1 NEW_LINE DEDENT i = 0 ; NEW_LINE j = n ; NEW_LINE mid = 0 NEW_LINE while ( i < j ) : NEW_LINE INDENT mid = ( i + j ) // 2 NEW_LINE if ( arr [ mid ] == target ) : NEW_LINE INDENT return arr [ mid ] , mid NEW_LINE DEDENT if ( target < arr [ mid ] ) : NEW_LINE INDENT if ( mid > 0 and target > arr [ mid - 1 ] ) : NEW_LINE INDENT return getClosest ( arr [ mid - 1 ] , arr [ mid ] , target ) , 0 NEW_LINE DEDENT j = mid NEW_LINE DEDENT else : NEW_LINE INDENT if ( mid < n - 1 and target < arr [ mid + 1 ] ) : NEW_LINE INDENT return getClosest ( arr [ mid ] , arr [ mid + 1 ] , target ) , 0 NEW_LINE DEDENT i = mid + 1 NEW_LINE DEDENT DEDENT return arr [ mid ] , mid NEW_LINE DEDENT def getClosest ( val1 , val2 , target ) : NEW_LINE INDENT if ( target - val1 <= val2 - target ) : NEW_LINE INDENT return val1 NEW_LINE DEDENT else : NEW_LINE INDENT return val2 NEW_LINE DEDENT DEDENT test_Cases = int ( input ( ) ) NEW_LINE for i in range ( 0 , test_Cases ) : NEW_LINE INDENT row , column , cell_by_column = input ( ) . split ( ) NEW_LINE row = int ( row ) NEW_LINE column = int ( column ) NEW_LINE cell_by_column = int ( cell_by_column ) NEW_LINE cell_by_column_temp = cell_by_column NEW_LINE count = 0 NEW_LINE r = cell_by_column_temp / row NEW_LINE if cell_by_column_temp % row != 0 : NEW_LINE INDENT r = r + 1 NEW_LINE DEDENT r = int ( r ) NEW_LINE count = row - ( r * row - cell_by_column ) NEW_LINE x_coordinate = r NEW_LINE y_coordinates = count NEW_LINE t1 = ( y_coordinates - 1 ) * column NEW_LINE t2 = x_coordinate NEW_LINE print ( t1 + t2 ) NEW_LINE DEDENT", "for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n , m , x = map ( int , input ( ) . split ( ) ) NEW_LINE if ( x % n == 0 ) : NEW_LINE INDENT column_x = x // n NEW_LINE DEDENT else : NEW_LINE INDENT column_x = x // n + 1 NEW_LINE DEDENT row_x = x - abs ( ( ( column_x - 1 ) * n ) ) NEW_LINE if ( row_x == 1 ) : NEW_LINE INDENT v = column_x NEW_LINE DEDENT else : NEW_LINE INDENT v = ( row_x - 1 ) * m + column_x NEW_LINE DEDENT print ( v ) NEW_LINE DEDENT" ]
codeforces_495_B
[ "import java . util . Scanner ; public class JavaApplication1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; if ( a == b ) { System . out . println ( \" infinity \" ) ; return ; } long cont = 0 ; long semresto = a - b ; long meio = ( long ) ( Math . sqrt ( semresto ) + 1 ) ; for ( int i = 1 ; i < meio ; i ++ ) { if ( semresto % i == 0 ) { if ( i > b ) cont ++ ; if ( ( semresto / i ) != i && ( semresto / i ) > b ) cont ++ ; } } System . out . println ( cont ) ; } }", "import java . util . Scanner ;   public class Teste { public static void main ( String args [ ] ) {", "import static java . lang . Math . sqrt ; import java . util . Scanner ; public class modularEquations { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int count = 0 ; int end = a - b ; if ( a == b ) { System . out . println ( \" infinity \" ) ; return ; } for ( int i = 1 ; i <= Math . sqrt ( end ) ; i ++ ) { if ( a % i == b ) count ++ ; if ( ( end % i ) == 0 ) { if ( i > end ) count ++ ;   if ( ( end / i ) != i && ( end / i ) > b ) count ++ ; } } System . out . println ( Integer . toString ( count ) ) ; } }  ", "import java . util . * ; import java . math . * ;   public class Main { private static Scanner s ; public static void main ( String [ ] args ) { s = new Scanner ( System . in ) ; int num = s . nextInt ( ) ; int resp = s . nextInt ( ) ; int mod = 0 ; int count = 0 ; if ( num == resp ) { System . out . println ( \" infinity \" ) ; return ; } if ( resp > num ) { System . out . println ( \"0\" ) ; return ; } int diff = num - resp ; for ( int i = 1 ; i * i <= diff ; i ++ ) { if ( diff % i == 0 ) { if ( diff / i == i && i > resp ) { count ++ ; } else { if ( i > resp ) count ++ ; if ( diff / i > resp ) count ++ ; } } } System . out . println ( count ) ; s . close ( ) ; } }  ", "import java . util . * ; import java . lang . * ; import java . math . * ; import java . awt . image . ConvolveOp ; import java . io . * ; import java . text . DecimalFormat ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . * ; public class Codeforces { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader sc = new FastReader ( ) ; static int pInf = Integer . MAX_VALUE ; static int nInf = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { int test = 1 ;" ]
[ "l1 = input ( ) . split ( ) NEW_LINE", "from math import sqrtn_to_mod , remainder = input ( ) . split ( )   n_to_mod = int ( n_to_mod ) remainder = int ( remainder )     def verify_n_divisors ( array_div_population ) : if array_div_population == [ ] : return 0 n_of_divisors = 1 for idx_div in range ( len ( array_div ) ) : n_of_divisors *= ( array_div_population [ idx_div ] + 1 ) return n_of_divisors     def is_at_array_div ( divisor , array_div , array_div_population ) : for div_idx in range ( len ( array_div ) ) : if divisor == array_div [ div_idx ] : array_div_population [ div_idx ] += 1 return array_div_population . append ( 1 ) array_div . append ( divisor )     def get_divisors ( array_div , array_div_population ) : divisors = [ 1 ]   for div_idx in range ( len ( array_div ) ) :   divisors = multiply_fact_n_times ( divisors , array_div [ div_idx ] , array_div_population [ div_idx ] ) return divisors     def multiply_fact_n_times ( divisors , factor , n_times ) : new_divisors = [ ] for div in divisors : result = div * factor new_divisors . append ( result ) divisors = divisors + new_divisors   while n_times - 1 > 0 : final_divisors = [ ] for div in new_divisors : result = div * factor final_divisors . append ( result ) divisors = divisors + final_divisors new_divisors = final_divisors n_times -= 1   return divisors   if n_to_mod == remainder : print ( ' infinity ' ) elif n_to_mod <= remainder : print ( 0 ) else : array_div = [ ] array_div_population = [ ] factor_count = 2 plus_two = False   first_module = n_to_mod - remainder max_size = sqrt ( first_module ) count_modular_times = 0 module_controller = 2 while first_module != 1 : if first_module % factor_count == 0 : first_module //= factor_count is_at_array_div ( factor_count , array_div , array_div_population )   else : if not plus_two : factor_count += 1 plus_two = True else : factor_count += 2   if factor_count > max_size : factor_count = first_module   divisors = list ( sorted ( get_divisors ( array_div , array_div_population ) ) ) for divisor in divisors : if divisor > remainder : count_modular_times += 1 print ( count_modular_times )   NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) if a == b : print ( ' infinity ' ) exit ( 0 ) x = abs ( a - b ) ans = 0 for xx in range ( 1 , int ( x ** 0.5 ) + 1 ) : if x % xx == 0 : if a % xx == b : ans += 1 if xx * xx != x : if a % ( x // xx ) == b : ans += 1 print ( ans ) NEW_LINE", "arr = [ int ( x ) for x in input ( ) . split ( ) ] a = arr [ 0 ] b = arr [ 1 ] resp = 0 if a == b : resp = ' infinity ' if resp != ' infinity ' : x = a - b i = 1 c = 0 while i ** 2 < x : c += 1 if x % i == 0 : if i > b : resp += 1 if x / i > b : resp += 1 i += 1 if i ** 2 == x and i > b : resp += 1 print ( resp )   NEW_LINE" ]
codeforces_313_A
[ "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean is = false ; if ( n < 0 ) { n = n * - 1 ; is = true ; } int last , lastSecond ; if ( is ) { last = n % 10 ; lastSecond = n % 100 ; lastSecond = lastSecond / 10 ; if ( last >= lastSecond ) { n = n / 10 ; } else { n = n / 100 ; n = n * 10 ; n = n + last ; } n = n * - 1 ; } System . out . println ( n ) ; } }", "import java . util . * ;   public class Codeforces { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; if ( n >= 0 ) { System . out . println ( n ) ; } else { int max = Math . max ( n / 10 , n / 100 * 10 + n % 10 ) ; System . out . println ( max ) ; } System . out . println ( ) ;   }   }", "  import java . io . * ; import java . util . StringTokenizer ;   public class A313 { public static void main ( String [ ] args ) throws IOException { PrintWriter out = new PrintWriter ( System . out ) ; FastScanner fs = new FastScanner ( ) ; long N ; N = fs . nextInt ( ) ; if ( N > 0 ) { out . println ( N ) ; } else { out . println ( Math . max ( ( int ) ( N / 10 ) , ( int ) ( ( N / 100 ) * 10 ) + ( N % 10 ) ) ) ; } out . close ( ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   public FastScanner ( String filePath ) throws FileNotFoundException { try { br = new BufferedReader ( new FileReader ( filePath ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } }   String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw e ; } } return st . nextToken ( ) ; }   String nextLine ( ) throws IOException { String str ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw e ; } return str ; }   int nextInt ( ) throws IOException { return Integer . parseInt ( this . next ( ) ) ; }   long nextLong ( ) throws IOException { return Long . parseLong ( this . next ( ) ) ; } } }", "import java . util . * ; public class lyaandBankAccount {   public static void main ( String [ ] args ) {" ]
[ "n = input ( ) n = int ( n )   if n >= 0 : print ( n ) else : n = str ( n ) print ( max ( int ( n [ 0 : - 2 ] + n [ - 1 : ] ) , int ( n [ 0 : - 1 ] ) ) ) NEW_LINE", "n = int ( input ( ) ) if n < 0 : print ( max ( int ( str ( n ) [ : - 1 ] ) , int ( str ( n ) [ : - 2 ] + str ( n ) [ - 1 ] ) ) ) else : print ( n ) NEW_LINE", "n = int ( input ( ) ) a = abs ( n ) % 10 b = abs ( n ) // 10 % 10 if n > 0 : print ( n ) elif a > b : print ( int ( str ( n ) [ 0 : - 1 ] ) ) else : n = str ( n ) print ( int ( n [ 0 : - 2 ] + n [ - 1 ] ) ) NEW_LINE", "s1 = input ( ) n = int ( s1 ) if n > 0 : print ( n ) else : b = s1 [ len ( s1 ) - 1 ] a = s1 [ len ( s1 ) - 2 ] s2 = s1 [ 0 : len ( s1 ) - 2 ] aa = s2 + a bb = s2 + b n1 = int ( aa ) n2 = int ( bb ) if n1 >= n2 : print ( n1 ) else : print ( n2 ) NEW_LINE" ]
codeforces_120_A
[ "import java . util . * ; import java . io . * ;   public class A_Elevator {   public static void main ( String [ ] args ) throws Exception { Scanner in = new Scanner ( new File ( \" input . txt \" ) ) ; PrintWriter pw = new PrintWriter ( new File ( \" output . txt \" ) ) ;", "import java . io . PrintWriter ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . Scanner ; import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . BufferedWriter ; import java . io . DataInputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . OutputStreamWriter ; import java . util . InputMismatchException ; import jdk . nashorn . internal . codegen . CompilerConstants ; public class Solution { public static void main ( String [ ] args ) throws IOException {", "import java . io . PrintWriter ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . Scanner ; import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . BufferedWriter ; import java . io . DataInputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . OutputStreamWriter ; import java . util . InputMismatchException ; import jdk . nashorn . internal . codegen . CompilerConstants ;   public class Solution { public static void main ( String [ ] args ) throws IOException {", "import java . io . * ; import java . util . * ; public class kuchBhi { public static void main ( String [ ] args ) throws Throwable {" ]
[ "import syssys . stdin = open ( ' input . txt ' , ' r ' ) sys . stdout = open ( ' output . txt ' , ' w ' ) s = input ( ) n = input ( ) if s == \" front \" and n == '1' : print ( ' L ' ) elif s == \" front \" and n == '2' : print ( ' R ' ) elif s == \" back \" and n == '1' : print ( \" R \" ) elif s == \" back \" and n == '2' : print ( \" L \" ) NEW_LINE", "import syssys . stdin = open ( \" input . txt \" , \" r \" ) sys . stdout = open ( \" output . txt \" , \" w \" ) match = input ( ) rail = int ( input ( ) ) if match == \" front \" : if rail == 1 : print ( \" L \" ) else : print ( \" R \" ) else : if rail == 1 : print ( \" R \" ) else : print ( \" L \" ) NEW_LINE", "input_file = open ( \" input . txt \" , \" r \" ) door = input_file . readline ( ) [ : - 1 ] rail_no = int ( input_file . readline ( ) )   if ( door == \" front \" ) : d_num = 1 else : d_num = 2   output_file = open ( \" output . txt \" , \" w \" ) if ( ( rail_no + d_num ) % 2 == 0 ) : output_file . write ( \" L \" ) else : output_file . write ( \" R \" ) NEW_LINE", "a = open ( \" input . txt \" , \" r \" ) . read ( ) . split ( ) f = open ( \" output . txt \" , \" w \" ) if a [ 0 ] [ 0 ] == \" f \" and a [ 1 ] == \"1\" or a [ 0 ] [ 0 ] == \" b \" and a [ 1 ] == \"2\" : f . write ( \" L \" ) else : f . write ( \" R \" ) f . close ( ) NEW_LINE", "f = open ( ' input . txt ' , ' r ' ) n1 = f . readline ( ) n2 = f . readline ( ) n2 = int ( n2 ) n1 = n1 [ : n1 . index ( ' \\n ' ) ] g = open ( ' output . txt ' , ' w ' ) if n1 == ' front ' and n2 == 1 : g . write ( ' L ' ) elif n1 == ' back ' and n2 == 1 : g . write ( ' R ' ) elif n1 == ' back ' and n2 == 2 : g . write ( ' L ' ) elif n1 == ' front ' and n2 == 2 : g . write ( ' R ' ) NEW_LINE" ]
codeforces_1451_A
[ "import java . util . * ; public class Main {   public static void main ( String [ ] args ) { int t , n ;   Scanner sc = new Scanner ( System . in ) ;   t = sc . nextInt ( ) ;   while ( t -- > 0 ) { n = sc . nextInt ( ) ;   System . out . println ( ( n <= 3 ) ? n - 1 : 2 + ( n & 1 ) ) ; }", "import java . util . * ;   import static java . lang . Math . * ;   public class WayTooLongWords { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; while ( x > 0 ) { x -- ; int n = in . nextInt ( ) ; if ( n == 1 ) System . out . println ( 0 ) ; else if ( n == 2 ) System . out . println ( 1 ) ; else if ( n == 3 ) System . out . println ( 2 ) ; else if ( n > 3 && n % 2 == 0 ) System . out . println ( 2 ) ; else System . out . println ( 3 ) ; } } }", "import java . util . Scanner ;    public class JavaApplication71 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int size = in . nextInt ( ) ; for ( int i = 0 ; i < size ; i ++ ) { int n = in . nextInt ( ) ; if ( n == 1 ) { System . out . println ( 0 ) ; continue ; } if ( n == 2 ) { System . out . println ( 1 ) ; continue ; } if ( n == 3 ) { System . out . println ( 2 ) ; continue ; } if ( n % 2 == 0 ) { System . out . println ( 2 ) ; continue ; } else { System . out . println ( 3 ) ; continue ; } } } }", "import java . util . * ; public class Array {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) a [ j ] = in . nextInt ( ) ; for ( int j = 0 ; j < n ; j ++ ) { if ( a [ j ] == 1 ) System . out . println ( 0 ) ; else if ( a [ j ] == 2 ) System . out . println ( 1 ) ; else if ( a [ j ] == 3 ) System . out . println ( 2 ) ; else if ( a [ j ] % 2 == 0 ) System . out . println ( 2 ) ; else System . out . println ( 3 ) ; } } }", "import java . util . Scanner ;   public class A1451 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) ; if ( n == 1 ) { System . out . println ( 0 ) ; continue ; } else if ( n == 2 ) { System . out . println ( 1 ) ; } else if ( n == 3 ) { System . out . println ( 2 ) ; } else { System . out . println ( n % 2 == 1 ? 3 : 2 ) ; } } } }" ]
[ "def solve ( n ) : if NEW_LINE n == 1 : NEW_LINE return 0 elif n == 2 : NEW_LINE return 1 elif n == 3 : NEW_LINE return 2 else : if n % 2 == 0 : NEW_LINE INDENT return 2 else : NEW_LINE return 3   t = int ( input ( ) ) NEW_LINE DEDENT for tc in range ( t ) : n = int ( input ( ) ) NEW_LINE print ( solve ( n ) ) NEW_LINE", "for i in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 0 ) elif n == 2 : NEW_LINE print ( 1 ) elif n == 3 : NEW_LINE print ( 2 ) elif n % 2 == 0 : NEW_LINE print ( 2 ) else : NEW_LINE print ( 3 ) NEW_LINE DEDENT", "for i in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 0 ) elif n == 2 : NEW_LINE print ( 1 ) elif n == 3 : NEW_LINE print ( 2 ) elif n % 2 == 0 : NEW_LINE print ( 2 ) else : NEW_LINE print ( 3 ) NEW_LINE DEDENT", "for _ in range ( int ( input ( ) ) ) : n = input ( ) NEW_LINE if n == \"1\" : NEW_LINE INDENT count = 0 elif n == \"2\" : NEW_LINE count = 1 elif int ( n [ - 1 ] ) % 2 == 0 or n == \"3\" : NEW_LINE count = 2 else : NEW_LINE count = 3 NEW_LINE DEDENT print ( count ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE while t > 0 : t = t - 1 NEW_LINE n = int ( input ( ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 0 ) elif n == 2 : NEW_LINE print ( 1 ) elif n == 3 : NEW_LINE print ( 2 ) elif n % 2 == 0 : NEW_LINE print ( 2 ) else : NEW_LINE print ( 3 ) NEW_LINE DEDENT" ]
codeforces_1106_B
[ "import java . util . * ; import java . io . * ; import java . math . * ; public class Main { static BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringTokenizer st ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String [ ] args ) throws IOException { int n = readInt ( ) , q = readInt ( ) , a [ ] = new int [ n ] ; Set < Integer > s = new HashSet ( ) ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = readInt ( ) ; edge [ ] arr = new edge [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int b = readInt ( ) ; arr [ i ] = new edge ( i , b , a [ i ] ) ; s . add ( i ) ; } Arrays . sort ( arr ) ; Map < Integer , Integer > mp = new HashMap ( ) ; for ( int i = 0 ; i < n ; i ++ ) { mp . put ( arr [ i ] . v , i ) ; } int cur = 0 ;" ]
[ "import sysinput = sys . stdin . readlinen , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) c = list ( map ( int , input ( ) . split ( ) ) ) l = [ ] for i in range ( len ( c ) ) : l . append ( ( c [ i ] , i ) )   l . sort ( ) ptr = 0 NEW_LINE", "import math , sys , bisect , heapqfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulate NEW_LINE", "import sysfrom collections import dequeinput_ = lambda : sys . stdin . readline ( ) . strip ( \" \\n \" ) ii = lambda : int ( input_ ( ) ) il = lambda : list ( map ( int , input_ ( ) . split ( ) ) ) ilf = lambda : list ( map ( float , input ( ) . split ( ) ) ) ip = lambda : input ( ) fi = lambda : float ( input ( ) ) li = lambda : list ( input ( ) ) pr = lambda x : print ( x )   n , m = il ( ) a = il ( ) c = il ( )   z = [ [ c [ i ] , i ] for i in range ( n ) ]   z . sort ( ) z = deque ( z )   for _ in range ( m ) : x , y = il ( )   ans = 0   x -= 1   t = min ( y , a [ x ] ) a [ x ] -= t ans += t * c [ x ] y -= t   while y > 0 and z : f = z [ 0 ] t = min ( a [ f [ 1 ] ] , y ) a [ f [ 1 ] ] -= t y -= t ans += f [ 0 ] * t   if a [ f [ 1 ] ] == 0 : z . popleft ( )   if y == 0 : print ( ans ) else : print ( 0 ) NEW_LINE", "import sys , math , itertoolsfrom collections import Counter , deque , defaultdictfrom bisect import bisect_left , bisect_right from heapq import heappop , heappush , heapify , nlargestfrom copy import deepcopymod = 10 ** 9 + 7 INF = float ( ' inf ' ) def inp ( ) : return int ( sys . stdin . readline ( ) ) def inpl ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def inpl_1 ( ) : return list ( map ( lambda x : int ( x ) - 1 , sys . stdin . readline ( ) . split ( ) ) )   MM = 10 ** 10 n , m = inpl ( ) a = inpl ( ) c = inpl ( ) q = [ ] NEW_LINE" ]
codeforces_1243_A
[ "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = s . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) a [ j ] = s . nextInt ( ) ; Arrays . sort ( a ) ; int c [ ] = new int [ n ] ; int p = 0 ; for ( int g = n - 1 ; g >= 0 ; g -- ) { c [ p ] = a [ g ] ; p ++ ; } int b [ ] = new int [ n ] ; for ( int k = 0 ; k < n ; k ++ ) { b [ k ] = Math . min ( c [ k ] , ( k + 1 ) ) ; } int max = b [ 0 ] ; for ( int y = 0 ; y < n ; y ++ ) { if ( b [ y ] > max ) max = b [ y ] ; } System . out . println ( max ) ; } } }", "import java . util . * ; import java . util . Arrays ; public class program { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { a [ j ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int k = 0 , count = 0 ; for ( int j = n - 1 ; j >= 0 ; j -- ) { if ( a [ j ] >= k + 1 ) { count ++ ; } k ++ ; } System . out . println ( count ) ; } } }", "import java . io . * ; import java . util . * ; import javax . print . attribute . standard . Finishings ;   import java . math . * ;   public class Square { static final Random random = new Random ( ) ; static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Reader sc = new Reader ( ) ;   public static void main ( String args [ ] ) throws IOException { int t = sc . nextInt ( ) ; while ( t -- > 0 ) {  ", "import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < k ; i ++ ) { int n = sc . nextInt ( ) ; int x [ ] = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { x [ j ] = sc . nextInt ( ) ; }   int res = 0 ; for ( int j = 1 ; j <= n ; j ++ ) { int check = 0 ; int c = 0 ; for ( int l = 0 ; l < n ; l ++ ) { c ++ ; if ( j <= x [ l ] ) check ++ ; }" ]
[ "for _ in range ( int ( input ( ) ) ) : n , A = int ( input ( ) ) , sorted ( ( int ( _ ) for _ in input ( ) . split ( ) ) ) print ( next ( ( i for i , a in enumerate ( A [ : : - 1 ] ) if i >= a ) , n ) ) NEW_LINE", "k = int ( input ( ) )   for _ in range ( k ) :   n = int ( input ( ) ) planks_in = input ( ) planks = planks_in . split ( ) planks = list ( map ( int , planks ) ) planks . sort ( )   for i in range ( n ) : if planks [ i ] >= ( n - i ) : print ( n - i ) break NEW_LINE", "def main_function ( ) : output_list = [ ] t = int ( input ( ) ) for i in range ( t ) : hash_list = [ 0 for i in range ( 1002 ) ] n = int ( input ( ) ) l = [ int ( i ) for i in input ( ) . split ( \" ▁ \" ) ] for i in range ( len ( l ) ) : hash_list [ l [ i ] ] += 1 count = 0 for i in range ( len ( hash_list ) ) : j = len ( hash_list ) - 1 - i NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) l = [ int ( i ) for i in input ( ) . split ( ) ] mx = max ( l ) mxsq = 0 for i in range ( 1 , mx + 1 ) : c = 0 for j in l : if j >= i : c += 1 if c >= i : mxsq = max ( mxsq , i ) print ( mxsq ) NEW_LINE", "def sol ( a : list ) : n = len ( a ) a . sort ( reverse = True ) ans = 0   for i in range ( n ) : if a [ i ] >= i + 1 : ans = i + 1 else : break print ( ans )     n = int ( input ( ) ) for i in range ( n ) : z = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) sol ( x ) NEW_LINE" ]
codeforces_929_A
[ "import java . util . Scanner ;    public class Bicycle { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int k = input . nextInt ( ) ; input . nextLine ( ) ; int [ ] x = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) x [ i ] = input . nextInt ( ) ; int count = 1 ; int d = k ; boolean flag = true ; for ( int i = 1 ; ( i < n ) && flag ; i ++ ) { d -= x [ i ] - x [ i - 1 ] ; if ( d < 0 ) flag = false ; else if ( i != n - 1 && d >= ( x [ i + 1 ] - x [ i ] ) ) { continue ; } else { count ++ ; d = k ; } } count -- ; if ( flag ) System . out . println ( count ) ;   else System . out . println ( \" - 1\" ) ;   }   }  ", "import java . io . BufferedInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . LinkedList ; import java . util . List ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . TreeSet ;   public class Main extends Thread {  " ]
[ "n , k = [ int ( i ) for i in input ( ) . split ( ) ] X = [ int ( i ) for i in input ( ) . split ( ) ] rem = kcnt = 1 for i in range ( len ( X ) - 1 ) : if X [ i + 1 ] - X [ i ] > rem : rem = k cnt += 1 if X [ i + 1 ] - X [ i ] > rem : print ( - 1 ) break rem -= X [ i + 1 ] - X [ i ] else : print ( cnt ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) t = list ( map ( int , input ( ) . split ( ) ) ) l = [ 0 ] ch = 1 i = 0 p2 = 0 while i < n - 1 : pepe = 0 j = i + 1 while j < n : if t [ j ] - t [ i ] <= k : j += 1 else : c1 = j - 1 ch += 1 pepe = 5 break if pepe == 5 : i = j - 1 else : i += 1 if i in l : p2 = 5 break else : l . append ( i ) print ( ch if p2 == 0 else \" - 1\" ) NEW_LINE", "n , k = ( int ( x ) for x in input ( ) . split ( ) ) x = [ int ( x ) for x in input ( ) . split ( ) ] flag = Trueif flag : for i in range ( 1 , n ) : if x [ i ] - x [ i - 1 ] > k : print ( - 1 ) flag = False breakif flag : ans = 1 stop = x [ - 1 ] - k i = 2 while i < n + 1 : if stop <= x [ 0 ] : break if x [ - i ] > stop : i += 1 elif x [ - i ] == stop : ans += 1 stop = x [ - i ] - k i += 1 else : ans += 1 stop = x [ - i + 1 ] - k   print ( ans ) NEW_LINE", "n , k = map ( int , input ( ) . split ( \" ▁ \" ) )   x = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) )   r = 1   cK = k   for i in range ( n ) :   try :   rr = x [ i + 1 ] - x [ i ]   if k < rr :   r = - 1   break   if rr <= cK :   cK -= rr   else :   r += 1   cK = k - rr   except :   break ;   print ( r )       NEW_LINE", "n , k = list ( map ( int , input ( ) . split ( ) ) ) x = list ( map ( int , input ( ) . split ( ) ) ) dists = [ x [ i ] - x [ i - 1 ] for i in range ( 1 , n ) ] if max ( dists ) > k : print ( - 1 ) else : cnt , rest = 0 , 0 for dist in dists : if rest < dist : cnt += 1 rest = k - dist else : rest -= dist print ( cnt ) NEW_LINE" ]