id
stringlengths
13
20
java
sequence
python
sequence
codeforces_255_A
[ "import java . util . * ; public class GregsWorkout { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String trains [ ] = { \" chest \" , \" biceps \" , \" back \" } ; int n = in . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = in . nextInt ( ) ; int sum [ ] = new int [ 3 ] ; for ( int i = 0 ; i < n ; i ++ ) { sum [ i % 3 ] += arr [ i ] ; } int maxI = 0 ; for ( int i = 1 ; i < sum . length ; i ++ ) if ( sum [ i ] > sum [ maxI ] ) maxI = i ; System . out . println ( trains [ maxI ] ) ; } }", "import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] a = new int [ n ] ; int chest = 0 , bicep = 0 , back = 0 , k = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; if ( k == 0 ) chest += a [ i ] ; else if ( k == 1 ) bicep += a [ i ] ; else { back += a [ i ] ; k = - 1 ; } k ++ ; } int max = Math . max ( chest , Math . max ( bicep , back ) ) ; if ( max == chest ) System . out . println ( \" chest \" ) ; else if ( max == bicep ) System . out . println ( \" biceps \" ) ; else System . out . println ( \" back \" ) ;   } }", "import java . util . Scanner ;   public class A255 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int i = 0 ; int a = 0 , b = 0 , c = 0 ; while ( i <= n ) { a += sc . nextInt ( ) ; i ++ ; if ( i == n ) break ; b += sc . nextInt ( ) ; i ++ ; if ( i == n ) break ; c += sc . nextInt ( ) ; i ++ ; if ( i == n ) break ; } if ( a > b && a > c ) System . out . println ( \" chest \" ) ; if ( b > a && b > c ) System . out . println ( \" biceps \" ) ; if ( c > a && c > b ) System . out . println ( \" back \" ) ; } }", "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 ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] st = br . readLine ( ) . split ( \" ▁ \" ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( st [ i ] ) ; } int chest = 0 , bicep = 0 , back = 0 ; int state = 0 ; for ( int i = 0 ; i < n ; i ++ ) { state = state % 3 ; if ( state == 0 ) { chest += a [ i ] ; } else if ( state == 1 ) { bicep += a [ i ] ; } else if ( state == 2 ) { back += a [ i ] ; } state ++ ; } if ( chest > bicep ) { if ( chest > back ) { System . out . println ( \" chest \" ) ; } else { System . out . println ( \" back \" ) ; } } else { if ( bicep > back ) { System . out . println ( \" biceps \" ) ; } else { System . out . println ( \" back \" ) ; } } } }", "import java . util . Scanner ;   public class A255 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) , ch = 0 , bic = 0 , back = 0 ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < n ; i += 3 ) { ch += a [ i ] ; } for ( int i = 1 ; i < n ; i += 3 ) { bic += a [ i ] ; } for ( int i = 2 ; i < n ; i += 3 ) { back += a [ i ] ; } int max = Math . max ( Math . max ( ch , bic ) , back ) ; if ( max == ch ) { System . out . println ( \" chest \" ) ; } else if ( max == bic ) { System . out . println ( \" biceps \" ) ; } else { System . out . println ( \" back \" ) ; } } }" ]
[ "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) l = [ sum ( a [ i : : 3 ] ) for i in [ 0 , 1 , 2 ] ] print ( [ \" chest \" , \" biceps \" , \" back \" ] [ l . index ( max ( l ) ) ] ) NEW_LINE", "n = int ( input ( ) ) array = list ( map ( int , input ( ) . split ( ) ) ) answer = [ \" chest \" , \" biceps \" , \" back \" , 0 , 0 , 0 ]   for i in range ( n ) : if i % 3 == 0 : answer [ 3 ] += array [ i ] elif i % 3 == 1 : answer [ 4 ] += array [ i ] elif i % 3 == 2 : answer [ 5 ] += array [ i ]   print ( answer [ answer . index ( max ( answer [ 3 : ] ) ) - 3 ] ) NEW_LINE", "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) a , b , c = 0 , 0 , 0 for i in range ( n ) : if i % 3 == 0 : a += l [ i ] elif i % 3 == 1 : b += l [ i ] else : c += l [ i ] if max ( a , b , c ) == a : print ( ' chest ' ) elif max ( a , b , c ) == b : print ( ' biceps ' ) else : print ( ' back ' ) NEW_LINE", "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) a , b , c = 0 , 0 , 0 for i in range ( n ) : if i % 3 == 0 : a += l [ i ] elif i % 3 == 1 : b += l [ i ] else : c += l [ i ] if a >= b and a >= c : print ( \" chest \" ) elif b >= a and b >= c : print ( \" biceps \" ) else : print ( \" back \" ) NEW_LINE" ]
codeforces_136_B
[ "import java . util . * ; public class TernaryLogic {   public static void main ( String [ ] args ) {", "import java . util . * ; public class ternary_logic { long ter ( int x ) { String s = \" \" ; if ( x == 0 ) s = \"0\" ; while ( x > 0 ) { s = x % 3 + s ; x /= 3 ; } return Long . valueOf ( s ) ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int c = in . nextInt ( ) ; ternary_logic ob = new ternary_logic ( ) ; long at = ob . ter ( a ) ; long ct = ob . ter ( c ) ;", "  import java . util . Scanner ; import java . util . Arrays ; public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception { try { Scanner sc = new Scanner ( System . in ) ; int a , b , i , n ; long k = 0 ; String s , w , c ; s = w = c = \" \" ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; while ( a > 0 ) { n = a % 3 ; s = n + s ; a = a / 3 ; } while ( b > 0 ) { n = b % 3 ; w = n + w ; b = b / 3 ; } n = s . length ( ) ; for ( i = 0 ; i < 20 - n ; i ++ ) s = \"0\" + s ; n = w . length ( ) ; for ( i = 0 ; i < 20 - n ; i ++ ) w = \"0\" + w ;" ]
[ "a , b = map ( int , input ( ) . split ( ) ) sum = 0 k = 1   while a or b : sum += k * ( ( ( b % 3 ) - ( a % 3 ) ) % 3 ) a //= 3 b //= 3 k *= 3 print ( sum ) NEW_LINE", "a , c = map ( int , input ( ) . split ( ) ) b , i = 0 , 1 while a > 0 or c > 0 : b += i * ( ( ( c % 3 ) - ( a % 3 ) ) % 3 ) i *= 3 a //= 3 c //= 3 print ( b ) NEW_LINE", "a , c = map ( int , input ( ) . split ( ) ) a1 = \" \" while a > 0 : a1 = str ( a % 3 ) + a1 a //= 3 if a1 == \" \" : a1 = \"0\" c1 = \" \" while c > 0 : c1 = str ( c % 3 ) + c1 c //= 3 if c1 == \" \" : c1 = \"0\" if len ( c1 ) > len ( a1 ) : a1 = '0' * ( len ( c1 ) - len ( a1 ) ) + a1else : c1 = '0' * ( len ( a1 ) - len ( c1 ) ) + c1i , b1 = len ( c1 ) - 1 , \" \" while i >= 0 : if c1 [ i ] == '0' : if a1 [ i ] == '0' : b1 = '0' + b1 elif a1 [ i ] == '1' : b1 = '2' + b1 else : b1 = '1' + b1 elif c1 [ i ] == '1' : if a1 [ i ] == '0' : b1 = '1' + b1 elif a1 [ i ] == '1' : b1 = '0' + b1 else : b1 = '2' + b1 else : if a1 [ i ] == '0' : b1 = '2' + b1 elif a1 [ i ] == '1' : b1 = '1' + b1 else : b1 = '0' + b1 i -= 1 print ( int ( b1 , 3 ) ) NEW_LINE" ]
codeforces_1217_B
[ "import java . io . * ; import java . util . * ;   public class E {   public static void main ( String [ ] args ) { FastScanner in = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { int n = in . nextInt ( ) , xx = in . nextInt ( ) ; int d = 0 , h = 0 ; int maxDiff = 0 , max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { d = in . nextInt ( ) ; h = in . nextInt ( ) ; maxDiff = Math . max ( maxDiff , d - h ) ; max = Math . max ( max , d ) ; } if ( maxDiff == 0 && max < xx ) out . println ( - 1 ) ; else if ( max >= xx ) out . println ( 1 ) ; else out . println ( 1 + ( ( xx - max ) + ( maxDiff - 1 ) ) / maxDiff ) ; } out . flush ( ) ; }  ", "import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException {", "import java . util . * ;    public class B_Zmei_Gorynich { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int q = sc . nextInt ( ) ; while ( q -- > 0 ) { int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; IntegerPair ar [ ] = new IntegerPair [ n ] ; int i = 0 ; int max = - 1 ; for ( i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; max = Math . max ( max , a ) ; IntegerPair temp = new IntegerPair ( a , b ) ; ar [ i ] = temp ; } Arrays . sort ( ar ) ; int dif = ar [ 0 ] . first ( ) - ar [ 0 ] . second ( ) ; if ( max >= x ) { System . out . println ( 1 ) ; continue ; } if ( dif <= 0 ) { System . out . println ( - 1 ) ; continue ; } int ans = ( ( x - 1 - max ) / dif ) + 2 ; System . out . println ( ans ) ; } } } class IntegerPair implements Comparable < IntegerPair > { Integer f ; Integer s ; Integer d ; public IntegerPair ( Integer first , Integer second ) { f = first ; s = second ; d = second - first ; } public int compareTo ( IntegerPair o ) { if ( this . diff ( ) . equals ( o . diff ( ) ) ) { return o . first ( ) - this . first ( ) ; } else { return this . diff ( ) - o . diff ( ) ; } } public Integer diff ( ) { return d ; } public Integer first ( ) { return f ; } public Integer second ( ) { return s ; } }" ]
[ "t = int ( input ( ) ) for _ in range ( t ) : n , l = map ( int , input ( ) . split ( ) ) a = [ ] m = 0 ans = 10 ** 10 for i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) m = max ( m , x ) a . append ( [ x , y ] ) d = 0 for i in range ( n ) : if a [ i ] [ 0 ] > a [ i ] [ 1 ] : d = max ( d , a [ i ] [ 0 ] - a [ i ] [ 1 ] ) if d == 0 : if m < l : print ( - 1 ) else : print ( 1 ) else : l = l - m ans = max ( l // d + bool ( l % d ) + 1 , 1 ) print ( ans ) NEW_LINE", "import mathfor _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) maxDH = - 10 ** 9 arr = [ ] for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) maxDH = max ( maxDH , a - b ) arr . append ( [ a , b ] ) res = 1 maxD = - 1 for i in arr : maxD = max ( maxD , i [ 0 ] ) m -= maxD if m > 0 : if maxDH <= 0 : res = - 1 else : res += ( m + maxDH - 1 ) // maxDH print ( res ) NEW_LINE", "from collections import defaultdict , deque , Counterfrom sys import stdin , stdoutfrom heapq import heappush , heappopimport mathimport ioimport osimport mathimport bisect   NEW_LINE", "import sys , os , ioimport math , bisect , operatorinf , mod = float ( ' inf ' ) , 10 ** 9 + 7 NEW_LINE", "import math , sys , bisect , heapq , osfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulatefrom functools import lru_cache NEW_LINE" ]
codeforces_34_B
[ "import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] arr = new int [ n ] ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = scan . nextInt ( ) ; if ( a < 0 ) { arr [ i ] = a ; c ++ ; } } int sum = 0 ; Arrays . sort ( arr ) ; if ( c >= m ) { for ( int i = 0 ; i < m ; i ++ ) { sum = sum + Math . abs ( arr [ i ] ) ; } } else { for ( int i = 0 ; i < arr . length ; i ++ ) { sum = sum + Math . abs ( arr [ i ] ) ; } } System . out . print ( sum ) ; } }", "import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ;   public class Sale { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; scanner . nextLine ( ) ;   int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; }   int [ ] ints = Arrays . stream ( arr ) . filter ( e -> e < 0 ) . sorted ( ) . limit ( m ) . toArray ( ) ;   int gain = 0 ; for ( int i = ints . length - 1 ; i >= 0 ; i -- ) { int item = ints [ i ] ; if ( item < 0 ) { gain += Math . abs ( item ) ; } }   System . out . println ( gain ) ;    } }", "import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; int s = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; for ( int i = 0 ; i < m ; i ++ ) { if ( arr [ i ] >= 0 ) break ; s = s + arr [ i ] ; } System . out . println ( - s ) ; } }", "import java . util . * ; public class Sale { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ;    for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; }   Arrays . sort ( ar ) ; int res = 0 ;   for ( int i = 0 ; i < m ; i ++ ) { if ( ar [ i ] < 0 ) res += ar [ i ] ; }   System . out . println ( Math . abs ( res ) ) ;   }   }" ]
[ "import sysfrom math import * input = sys . stdin . readline   def solve ( n , k , arr ) : arr . sort ( ) tot = 0 for i in range ( n ) : if i + 1 > k : print ( tot ) return else : if arr [ i ] <= 0 : tot += abs ( arr [ i ] ) else : print ( tot ) return else : print ( tot )   NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) lst = [ * map ( int , input ( ) . split ( ) ) ] lst . sort ( )   total = 0   for num in lst [ : m ] : if num > 0 : break else : total += numprint ( abs ( total ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) l = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) c = 0 s = 0 for i in l : if ( i < 0 and c < m ) : s += i c += 1 else : break print ( - s ) NEW_LINE", "import math   def solve ( ) : a , b = list ( map ( int , input ( ) . split ( ) ) ) arr = [ int ( i ) for i in input ( ) . split ( ) ] arr . sort ( )   sum = 0   for i in range ( b ) : if arr [ i ] > 0 : break sum += - 1 * arr [ i ]   return sum         print ( solve ( ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) count = mans = 0 for i in range ( len ( a ) ) : k = min ( a ) if k < 0 : ans = ans - k count -= 1 a [ a . index ( k ) ] = 1 else : break if count == 0 : breakprint ( ans ) NEW_LINE" ]
codeforces_471_B
[ "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 {   public static void main ( String [ ] args ) {   FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ;   int a [ ] [ ] = new int [ n ] [ 2 ] ; int freq [ ] = new int [ 2001 ] ; TreeSet < Integer > set = new TreeSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] [ 1 ] = input . nextInt ( ) ; a [ i ] [ 0 ] = i ; freq [ a [ i ] [ 1 ] ] ++ ; set . add ( a [ i ] [ 1 ] ) ;   }   long total = 1 ; for ( Integer integer : set ) {   total *= freq [ integer ] ; if ( total >= 3 ) { break ; } } Arrays . sort ( a , new Comparator < int [ ] > ( ) { @ Override public int compare ( int [ ] t , int [ ] t1 ) { return t [ 1 ] - t1 [ 1 ] ; }   } ) ;" ]
[ "a = int ( input ( ) ) b = [ [ ] for _ in \" ▁ \" * ( 2001 ) ] ok2 = 0 ; ok3 = 0 ; k5 , k6 , k7 = 0 , 1 , 1 for i , j in enumerate ( map ( int , input ( ) . split ( ) ) ) : b [ j ] . append ( i + 1 ) k = [ [ ] for _ in \" ▁ \" * 3 ] for i in range ( 2001 ) : if len ( b [ i ] ) : if len ( b [ i ] ) > 2 : ok3 = 1 k2 , k3 , k4 = 0 , 1 , 2 for j in range ( len ( b [ i ] ) ) : k [ 0 ] . append ( b [ i ] [ ( j + k2 ) % len ( b [ i ] ) ] ) k [ 1 ] . append ( b [ i ] [ ( j + k3 ) % len ( b [ i ] ) ] ) k [ 2 ] . append ( b [ i ] [ ( j + k4 ) % len ( b [ i ] ) ] ) elif len ( b [ i ] ) == 2 : ok2 += 1 for j in range ( len ( b [ i ] ) ) : k [ 0 ] . append ( b [ i ] [ ( j + k5 ) % len ( b [ i ] ) ] ) k [ 1 ] . append ( b [ i ] [ ( j + k6 ) % len ( b [ i ] ) ] ) k [ 2 ] . append ( b [ i ] [ ( j + k7 ) % len ( b [ i ] ) ] ) k5 , k6 , k7 = 1 , 1 , 0 else : k [ 0 ] . append ( b [ i ] [ 0 ] ) k [ 1 ] . append ( b [ i ] [ 0 ] ) k [ 2 ] . append ( b [ i ] [ 0 ] )   if ok3 or ok2 > 1 : print ( \" YES \" ) for i in k : print ( * i ) else : print ( \" NO \" ) NEW_LINE", "n , a , q , w , r = int ( input ( ) ) , list ( map ( int , input ( ) . split ( ) ) ) , [ ] , [ ] , [ 0 ] for i in range ( n ) : q . append ( [ a [ i ] , i + 1 ] ) q . sort ( ) for i in range ( 1 , n ) : if q [ i ] [ 0 ] == q [ i - 1 ] [ 0 ] : r [ 0 ] += 1 ; r . append ( i + 1 ) if r [ 0 ] == 2 : breakfor i in q : w . append ( i [ 1 ] ) if r [ 0 ] == 2 : print ( \" YES \" ) print ( * w ) for i in range ( 1 , 3 ) : w [ r [ i ] - 1 ] , w [ r [ i ] - 2 ] = w [ r [ i ] - 2 ] , w [ r [ i ] - 1 ] ; print ( * w ) else : print ( \" NO \" ) NEW_LINE", "from collections import Counter n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) counter = Counter ( a ) extra = 0 for i in counter : extra += counter [ i ] - 1 if extra <= 1 : print ( ' NO ' ) else : b = [ ( a [ i ] , i + 1 ) for i in range ( n ) ] b . sort ( ) print ( ' YES ' ) x = [ b [ i ] [ 1 ] for i in range ( n ) ] print ( ' ▁ ' . join ( map ( str , x ) ) ) times = 0 for i in range ( n - 1 ) : if b [ i ] [ 0 ] == b [ i + 1 ] [ 0 ] : tmp = b [ i ] b [ i ] = b [ i + 1 ] b [ i + 1 ] = tmp times += 1 x = [ b [ j ] [ 1 ] for j in range ( n ) ] print ( ' ▁ ' . join ( map ( str , x ) ) ) if times == 2 : break NEW_LINE", "n = int ( input ( ) ) arr = sorted ( enumerate ( map ( int , input ( ) . split ( ) ) , 1 ) , key = lambda x : x [ 1 ] ) ans = [ str ( x [ 0 ] ) for x in arr ] q = [ ' YES ' , ' ▁ ' . join ( ans ) ] for i in range ( n - 1 ) : if arr [ i ] [ 1 ] == arr [ i + 1 ] [ 1 ] : ans [ i ] , ans [ i + 1 ] = ans [ i + 1 ] , ans [ i ] q . append ( ' ▁ ' . join ( ans ) ) if len ( q ) > 3 : breakprint ( ' \\n ' . join ( q ) if len ( q ) > 3 else \" NO \" ) NEW_LINE" ]
codeforces_1249_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ; public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int t = fs . nextInt ( ) ; while ( t -- > 0 ) { int n = fs . nextInt ( ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int b = fs . nextInt ( ) ; a . add ( b ) ; } Collections . sort ( a ) ; int ans = 0 ; int prev = 0 ; if ( n > 0 ) prev = a . get ( 0 ) ; for ( int i : a ) { if ( prev + 1 == i ) { ans ++ ; } prev = i ; } if ( ans > 0 ) { ans = 2 ; } else ans = 1 ; 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 . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int q = sc . nextInt ( ) ; while ( q -- > 0 ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; int g = 1 ; for ( int i = n - 1 ; i > 0 ; i -- ) { if ( a [ i ] - a [ i - 1 ] == 1 ) g = 2 ; } System . out . println ( g ) ; } } }", "import java . util . Arrays ; import java . util . Scanner ;   public class A1249 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int q = scanner . nextInt ( ) ; for ( int i = 0 ; i < q ; i ++ ) { int n = scanner . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { a [ j ] = scanner . nextInt ( ) ; } Arrays . sort ( a ) ; boolean flag = false ; for ( int j = 1 ; j < n ; j ++ ) { if ( Math . abs ( a [ j - 1 ] - a [ j ] ) == 1 ) { flag = true ; break ; } else { flag = false ; } } System . out . println ( flag ? 2 : 1 ) ;   } } }" ]
[ "import sysinput = sys . stdin . readline   for test in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) ans = 1 for i in range ( n - 1 ) : if a [ i + 1 ] - a [ i ] == 1 : ans = 2 print ( ans ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] a . sort ( ) flag = 0 for i in range ( n - 1 ) : if a [ i + 1 ] == a [ i ] + 1 : flag = 1 break if flag : print ( 2 ) else : print ( 1 ) NEW_LINE", "n = int ( input ( ) ) for i in range ( n ) : _ = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) res = list ( ) for i in range ( len ( a ) ) : if len ( res ) == 0 : res . append ( [ a [ i ] ] ) continue if a [ i ] - res [ - 1 ] [ - 1 ] > 1 : res [ - 1 ] . append ( a [ i ] ) else : if len ( res ) == 1 : res . append ( [ a [ i ] ] ) else : res [ - 2 ] . append ( a [ i ] ) print ( len ( res ) ) NEW_LINE", "def teams_counter ( skills ) : res = 1 bucket_1 = [ skills [ 0 ] ] for i in range ( 1 , len ( skills ) ) : if abs ( skills [ i ] - bucket_1 [ - 1 ] ) > 1 : bucket_1 . append ( skills [ i ] ) else : res = 2 break return res   q = int ( input ( ) )   for i in range ( q ) : size = int ( input ( ) ) skills = sorted ( map ( int , input ( ) . split ( ) ) ) print ( teams_counter ( skills ) )   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_1198_A
[ "import java . io . File ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class p015 { 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 ( ) ) ; int I = ( Integer . parseInt ( stok . nextToken ( ) ) * 8 ) / n ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( stok . nextToken ( ) ) ; } Arrays . sort ( a ) ; int [ ] b = new int [ n ] ; int cnt = 0 ; int i = 0 ; while ( i < n ) { b [ i ] = cnt ; while ( ++ i < n && a [ i ] . intValue ( ) == a [ i - 1 ] . intValue ( ) ) b [ i ] = cnt ; cnt ++ ; } cnt = 0 ; int v = b [ n - 1 ] ; for ( ; v > 0 ; cnt ++ , v >>= 1 ) ; if ( cnt <= I ) System . out . println ( \"0\" ) ; else { i = 0 ; int min = Integer . MAX_VALUE ; while ( i < n ) { int lo = i , hi = n ; while ( lo != hi ) { int md = ( lo + hi ) / 2 ; if ( b [ md ] < b [ i ] + ( 1 << I ) ) lo = md + 1 ; else hi = md ; } min = Math . min ( min , i + n - lo ) ; while ( ++ i < n && a [ i ] == a [ i - 1 ] ) ; } System . out . println ( min ) ; } } }" ]
[ "from math import ceil , log2from collections import Counterdef read ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE", "import sys , os , iodef rs ( ) : return sys . stdin . readline ( ) . rstrip ( ) def ri ( ) : return int ( sys . stdin . readline ( ) ) def ria ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def ws ( s ) : sys . stdout . write ( s + ' \\n ' ) def wi ( n ) : sys . stdout . write ( str ( n ) + ' \\n ' ) def wia ( a ) : sys . stdout . write ( ' ▁ ' . join ( [ str ( x ) for x in a ] ) + ' \\n ' ) import math , datetime , functools , itertools , operator , bisect , fractions , statisticsfrom collections import deque , defaultdict , OrderedDict , Counterfrom fractions import Fractionfrom decimal import Decimalfrom sys import stdoutfrom heapq import heappush , heappop , heapify , _heapify_max , _heappop_max , nsmallest , nlargest   def main ( ) : NEW_LINE", "import osimport sysfrom io import BytesIO , IOBasefrom collections import Counterimport math NEW_LINE" ]
codeforces_368_A
[ "  import java . util . * ;    public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n , d , m ; n = input . nextInt ( ) ; d = input . nextInt ( ) ; int a [ ] = new int [ n ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } m = input . nextInt ( ) ; Arrays . sort ( a ) ; if ( m <= n ) { for ( int i = 0 ; i < m ; i ++ ) { sum += a [ i ] ; } System . out . println ( sum ) ; } else { for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; } sum = sum - ( ( m - n ) * d ) ; System . out . println ( sum ) ; } } }  ", "import java . util . Arrays ; import java . util . Scanner ;    public class SerejaAndCoatRack {   public static void main ( String [ ] args ) {", "import java . util . Arrays ; import java . util . Scanner ;   public class CoatRackProfit { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int [ ] price = new int [ n ] ;   int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { price [ i ] = scan . nextInt ( ) ; sum += price [ i ] ; }   int m = scan . nextInt ( ) ;   if ( m >= n ) { System . out . println ( sum - d * ( m - n ) ) ; } else { Arrays . sort ( price ) ;   sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { sum += price [ i ] ; } System . out . println ( sum ) ; } } }" ]
[ "datos_n_d = input ( ) . split ( ) n = int ( datos_n_d [ 0 ] ) d = int ( datos_n_d [ 1 ] )   costo_gancho = [ ] datos_gancho = input ( ) . split ( ) for dato in datos_gancho : costo_gancho . append ( int ( dato ) ) m = int ( input ( ) )   balance = 0 costo_gancho . sort ( ) if n >= m : for i in range ( m ) : balance = balance + costo_gancho [ i ] else : balance = sum ( costo_gancho ) - ( ( m - n ) * d )   print ( balance ) NEW_LINE", "n , d = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) if m == n : print ( sum ( a ) ) elif m < n : a = sorted ( a ) print ( sum ( a [ : m ] ) ) else : x = sum ( a ) print ( x - ( m - len ( a ) ) * d ) NEW_LINE", "n , d = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) a . sort ( ) k = 0 s = 0 for i in range ( m ) : if i < len ( a ) : k += a [ s ] s += 1 else : k -= dprint ( k )   NEW_LINE", "n , x = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) if m >= n : print ( sum ( l ) - ( m - n ) * x ) NEW_LINE" ]
codeforces_219_B
[ "import java . util . * ; public class SpecialOfferSuperPrice999Bourles { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long p = sc . nextLong ( ) ; long d = sc . nextLong ( ) ; String s = Long . toString ( p ) ; long temp ; for ( int i = s . length ( ) - 1 ; i >= 0 ; i -- ) { s = Long . toString ( p ) ; if ( s . charAt ( i ) != '9' ) { temp = ( long ) Math . pow ( 10 , s . length ( ) - i - 1 ) * ( Long . parseLong ( \" \" + s . charAt ( i ) ) + 1 ) ; if ( d >= temp ) { d -= temp ; p -= temp ; } } } System . out . println ( p ) ; } }  ", "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 . * ; public class abc { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long p = sc . nextLong ( ) ; long d = sc . nextLong ( ) , ans = ++ p ; for ( long t = 10 ; ; t *= 10 ) { if ( p % t > d ) break ; ans = p - p % t ; } System . out . println ( ans - 1 ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . StringTokenizer ;   public class A {   public static void main ( String [ ] args ) throws IOException {   FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; ArrayList < String > lis = new ArrayList < String > ( ) ; String str = sc . next ( ) ; long cost = Long . parseLong ( str ) ; char [ ] extra = str . toCharArray ( ) ; long p = sc . nextLong ( ) ; int n = str . length ( ) ; for ( int i = n - 1 ; i >= 1 ; i -- ) { if ( extra [ i ] != '9' ) { extra [ i ] = '9' ; int j = i - 1 ; while ( j >= 0 ) { if ( extra [ j ] == '0' ) { extra [ j ] = '9' ; j -- ; continue ; } else { String val = ( extra [ j ] - '0' - 1 ) + \" \" ; extra [ j ] = val . charAt ( 0 ) ; break ; } } } StringBuilder ans = new StringBuilder ( ) ; for ( char e : extra ) ans . append ( e ) ; lis . add ( ans . toString ( ) ) ; } if ( lis . size ( ) == 0 ) { System . out . println ( cost ) ; return ; }", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {" ]
[ "a , b = map ( int , input ( ) . split ( ) ) a = a + 1 n = ak = 10 while ( True ) : if ( ( a % k ) > b ) : break n = a - ( a % k ) k *= 10 print ( n - 1 ) NEW_LINE", "import mathimport sysimport collectionsimport bisectimport stringimport timedef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) def num ( arr ) : ans = \" \" for i in arr : ans += i return int ( ans ) for t in range ( 1 ) : n , m = get_ints ( ) ans = n no = str ( n ) pos = len ( no ) - 1 c = 0 while pos >= 0 : if no [ pos ] == \"9\" : c += 1 pos -= 1 else : break for k in range ( c + 1 , 20 ) : no = ( n ) - ( n % ( 10 ** k ) ) - 1 NEW_LINE", "n , p = map ( int , input ( ) . split ( ) )   ans = n   l = len ( str ( n ) ) for nine in range ( 0 , l ) : m = int ( str ( n ) [ : l - nine ] + '9' * nine ) while m > n : m -= 10 ** nine if n - m <= p : ans = m   print ( ans ) NEW_LINE", "p , d = ( int ( k ) for k in input ( ) . split ( ) )   test_price = presult = pmax_num_of_nines = 0 i = 1   while test_price >= p - d : test_price_size = len ( str ( test_price ) ) num_of_nines = 0 for c in range ( test_price_size ) : if str ( test_price ) [ - c - 1 ] == '9' : num_of_nines += 1 else : break if num_of_nines == test_price_size and num_of_nines > max_num_of_nines : result = test_price break else : if num_of_nines > max_num_of_nines : max_num_of_nines = num_of_nines result = test_price NEW_LINE" ]
codeforces_148_B
[ "import java . util . * ; public class Main { public static double calcTime ( double d , int vd , int vp ) { return d / ( vd - vp ) ; } public static void main ( String [ ] args ) throws java . lang . Exception { Scanner in = new Scanner ( System . in ) ;", "import java . util . Scanner ;   public class Run_Crazy {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; float vp , vd , t , f , c ; vp = in . nextFloat ( ) ; vd = in . nextFloat ( ) ; t = in . nextFloat ( ) ; f = in . nextFloat ( ) ; c = in . nextFloat ( ) ;   double posd , posp , time ; int cnt = 0 ; posp = vp * t ; posd = 0 ; if ( vp > vd ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } while ( true ) { time = Math . abs ( posd - posp ) / Math . abs ( vd - vp ) ; posp += vp * time ; if ( posp >= c ) break ; else cnt ++ ; posp += vp * ( time + f ) ; posd = 0 ; } System . out . println ( cnt ) ;   }   }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Escape { public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ; StringBuilder sb = new StringBuilder ( ) ; int vp = fs . nextInt ( ) ; int vd = fs . nextInt ( ) ; int t = fs . nextInt ( ) ; int f = fs . nextInt ( ) ; int c = fs . nextInt ( ) ; if ( vd <= vp ) { System . out . println ( 0 ) ; return ; } int bijous = 0 ; double distance = vp * t ; double time = 0 ; while ( Double . compare ( c , distance ) > 0 ) { time = distance / ( vd - vp ) ; distance = time * vd ; if ( Double . compare ( c , distance ) <= 0 ) break ; bijous ++ ; distance += ( ( distance / vd ) + f ) * vp ; } System . out . println ( bijous ) ; }   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 ( ) ) ; }   float nextFloat ( ) { return Float . parseFloat ( next ( ) ) ; } } }", "import java . util . * ; import java . io . * ;     public class A {    public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int vp = sc . nextInt ( ) , vd = sc . nextInt ( ) , t = sc . nextInt ( ) , f = sc . nextInt ( ) , c = sc . nextInt ( ) ; int count = 0 ; double pd = vp * t ;   if ( vd > vp ) { while ( pd < c ) { double tt = pd / ( vd - vp ) ; pd = vd * tt ; if ( pd >= c ) break ; count ++ ; tt += f ; pd += vp * tt ;   } }   out . println ( count ) ; out . close ( ) ; } }   " ]
[ "vp = int ( input ( ) ) vd = int ( input ( ) ) t = int ( input ( ) ) f = int ( input ( ) ) c = int ( input ( ) )   dist = 0 cnt = 0 if vd <= vp : print ( 0 ) else : while True : time = t + vp * t / ( vd - vp ) if time * vp >= c : print ( cnt ) break else : t = t + 2 * ( time - t ) + f cnt += 1 NEW_LINE", "vp = int ( input ( ) ) vd = int ( input ( ) ) t = int ( input ( ) ) f = int ( input ( ) ) c = int ( input ( ) )   pp = t * vpbijoux = 0 pd = 0 while ( pp < c ) : if vp >= vd : break pp = ( vd * pp ) / ( vd - vp ) if pp >= c : break bijoux += 1 pp += ( pp / vd + f ) * vpprint ( bijoux ) NEW_LINE", "import sysimport mathimport collectionsimport bisectdef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) princess = int ( input ( ) ) dragon = int ( input ( ) ) t = int ( input ( ) ) f = int ( input ( ) ) c = int ( input ( ) ) start = t * princesscount = 0 if dragon <= princess : print ( 0 ) quit ( ) while start < c : d1 = start + ( princess ) d2 = dragon time = start / ( dragon - princess ) start += princess * time if start < c : count += 1 start += princess * ( time + f ) print ( count ) NEW_LINE", "x , y , t , f , c = [ int ( input ( ) ) for i in range ( 5 ) ] a = x * t NEW_LINE", "p , vd , t , f , c = [ int ( input ( ) ) for i in range ( 5 ) ] if p >= vd : exit ( print ( 0 ) ) cur = ( p * t * vd ) / ( vd - p ) ans = 0 while c > cur : ans += 1 cur += p * ( 2 * cur + f * vd ) / ( vd - p ) print ( ans ) NEW_LINE" ]
codeforces_459_B
[ "  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 ( ) ;  ", "import java . util . Arrays ; import java . util . Scanner ;   public class PashmakAndFlowers { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] beauty = scanner . nextLine ( ) . split ( \" ▁ \" ) ; int [ ] bs = Arrays . stream ( beauty ) . mapToInt ( Integer :: parseInt ) . sorted ( ) . toArray ( ) ; long min = 0 , max = 0 ; for ( int i : bs ) { if ( i == bs [ 0 ] ) min ++ ; if ( i == bs [ n - 1 ] ) max ++ ; } if ( bs [ 0 ] != bs [ n - 1 ] ) { System . out . println ( ( bs [ n - 1 ] - bs [ 0 ] ) + \" ▁ \" + ( max * min ) ) ; } else { System . out . println ( \"0 ▁ \" + ( max * ( max - 1L ) ) / 2L ) ; } } }", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long minValue = Integer . MAX_VALUE ; long maxValue = Integer . MIN_VALUE ; long minCnt = 0 ; long maxCnt = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { long temp = sc . nextLong ( ) ; if ( temp < minValue ) { minValue = temp ; minCnt = 1 ; } else if ( temp == minValue ) { minCnt ++ ; } if ( temp > maxValue ) { maxValue = temp ; maxCnt = 1 ; } else if ( temp == maxValue ) { maxCnt ++ ; } }   if ( minValue == maxValue ) { System . out . println ( \"0 ▁ \" + n * ( n - 1 ) / 2 ) ; } else { System . out . println ( maxValue - minValue + \" ▁ \" + minCnt * maxCnt ) ; } } }", "import java . util . * ;   public class solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] flower = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { flower [ i ] = sc . nextInt ( ) ; } HashMap < Integer , Integer > map = new HashMap < > ( ) ; long min = Integer . MAX_VALUE ; long max = 0 ; for ( long i : flower ) { min = Math . min ( min , i ) ; max = Math . max ( max , i ) ; } long count_max = 0 ; long count_min = 0 ; for ( long i : flower ) { if ( i == max ) { count_max ++ ; } if ( i == min ) { count_min ++ ; } } if ( max == min ) { if ( count_max % 2 == 0 ) { System . out . println ( 0 + \" ▁ \" + ( count_max / 2 ) * ( count_max - 1 ) ) ; } else { System . out . println ( 0 + \" ▁ \" + ( ( count_max - 1 ) / 2 ) * count_max ) ; } } else { System . out . print ( ( max - min ) + \" ▁ \" ) ; System . out . println ( count_max * count_min ) ; } } }" ]
[ "from sys import stdin , stdoutfrom os import pathrd = lambda : stdin . readline ( ) . strip ( ) wr = stdout . writeif ( path . exists ( ' input . txt ' ) ) : stdin = open ( \" input . txt \" , \" r \" ) import time , math NEW_LINE", "def solution ( ) : n = int ( input ( ) ) count = { } arr = list ( map ( int , input ( ) . split ( ) ) )   for i in arr : if i not in count : count [ i ] = 1 else : count [ i ] += 1 \t   mx = max ( arr ) mn = min ( arr ) if mx == mn : print ( 0 , int ( count [ mx ] * ( count [ mx ] - 1 ) / 2 ) ) else : print ( mx - mn , count [ mx ] * count [ mn ] )       solution ( ) NEW_LINE", "n = int ( input ( ) ) flowers = list ( sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) ) madiff = flowers [ n - 1 ] - flowers [ 0 ] i = 0 count0 = countn = 0 while ( i < n and flowers [ i ] == flowers [ 0 ] ) : count0 += 1 i += 1 i = n - 1 while ( i >= 0 and flowers [ i ] == flowers [ n - 1 ] ) : countn += 1 i -= 1 if ( flowers [ 0 ] != flowers [ n - 1 ] ) : print ( madiff , count0 * countn ) else : print ( madiff , n * n - ( 1 + n ) * n // 2 ) NEW_LINE" ]
codeforces_37_A
[ "import java . util . Arrays ; import java . util . Scanner ;   public class _0633Towers {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ 1001 ] ; int max = 0 ; int pos = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ sc . nextInt ( ) ] ++ ; } int count = 0 ; for ( int i = 1 ; i < arr . length ; i ++ ) { if ( arr [ i ] != 0 ) { count ++ ; } max = Math . max ( max , arr [ i ] ) ; } System . out . println ( max + \" ▁ \" + count ) ; }   }", "import java . io . * ; import java . util . * ;   public class MAIN {   private static BufferedReader reader = null ; private static BufferedWriter writer = null ;   public static void main ( String [ ] args ) throws Exception {  ", "import java . util . Scanner ; import java . lang . Math ;   public class Day4_37A { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] A = new int [ n ] ; int max = Integer . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = scan . nextInt ( ) ; if ( A [ i ] > max ) max = A [ i ] ; }   int [ ] count = new int [ max + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) count [ A [ i ] ] ++ ;   int [ ] res = new int [ 2 ] ; for ( int i = 0 ; i < max + 1 ; i ++ ) { if ( count [ i ] > 0 ) res [ 1 ] ++ ;   if ( count [ i ] > res [ 0 ] ) res [ 0 ] = count [ i ] ; }   for ( int a : res ) System . out . print ( a + \" ▁ \" ) ;   }   }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;" ]
[ "n = int ( input ( ) ) m = list ( map ( int , input ( ) . split ( ) ) ) high = 0 x = [ ] for i in range ( n ) : if m [ i ] not in x : x . append ( m [ i ] ) if m . count ( m [ i ] ) > high : high = m . count ( m [ i ] ) print ( high , len ( x ) ) NEW_LINE", "import sysdef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_ints_lists ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) input ( ) li = get_ints_lists ( ) li1 = [ ] s = set ( li ) for i in s : p = li . count ( i ) li1 . append ( p ) print ( max ( li1 ) , len ( s ) )   NEW_LINE", "t = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE", "n = int ( input ( ) ) data = list ( map ( int , input ( ) . split ( ) ) )   uniqueness , great_l = [ ] , 0 for i in data : if i not in uniqueness : uniqueness . append ( i ) if data . count ( i ) > great_l : great_l = data . count ( i )   print ( great_l , len ( uniqueness ) )   NEW_LINE", "n = int ( input ( ) ) data = list ( map ( int , input ( ) . split ( ) ) )   uniqueness , great_l = [ ] , 0 for i in data : if i not in uniqueness : uniqueness . append ( i ) if data . count ( i ) > great_l : great_l = data . count ( i )   print ( great_l , len ( uniqueness ) ) NEW_LINE" ]
codeforces_1428_B
[ "import java . util . * ; import java . math . * ; public class BeltedRooms { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int size = sc . nextInt ( ) ; String s = sc . next ( ) ; char [ ] arr = s . toCharArray ( ) ; if ( ! ( s . contains ( \" > \" ) && s . contains ( \" < \" ) ) ) System . out . println ( size ) ; else { int count = 0 ; for ( int i = 0 ; i < size ; i ++ ) { if ( i == 0 ) { if ( arr [ size - 1 ] == ' - ' || arr [ i ] == ' - ' ) count ++ ; } else if ( i == size - 1 ) { if ( arr [ size - 2 ] == ' - ' || arr [ size - 1 ] == ' - ' ) count ++ ; } else { if ( arr [ i ] == ' - ' || arr [ i - 1 ] == ' - ' ) count ++ ; } } System . out . println ( count ) ; } } } }", "import java . util . * ; public class BeltedRooms {   public static void main ( String [ ] args ) {", "import java . util . * ; import java . io . * ; import java . lang . * ;    public class graph { static long mod = 10000_00007 ; public static void main ( String [ ] args ) throws Exception { InputStreamReader ip = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( ip ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; String str = ( br . readLine ( ) ) . trim ( ) ;   int cw = 0 , acw = 0 , bh = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( str . charAt ( i ) == ' - ' ) { if ( str . charAt ( ( ( i - 1 ) + n ) % n ) == str . charAt ( i ) ) { ans ++ ; } else { ans += 2 ; } bh ++ ; } else if ( str . charAt ( i ) == ' > ' ) { cw ++ ; } else { acw ++ ; } }   if ( acw == n || cw == n || bh == n ) { System . out . println ( n ) ; } else if ( ( acw + bh ) == n || ( cw + bh ) == n ) { System . out . println ( n ) ; } else { System . out . println ( ans ) ; } } }   }   ", "import java . util . Scanner ;   public class B1428 {   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 ( ) ; String S = in . next ( ) ; boolean cycle = ( S . indexOf ( ' > ' ) == - 1 ) || ( S . indexOf ( ' < ' ) == - 1 ) ; int answer ; if ( cycle ) { answer = N ; } else { answer = 0 ; for ( int n = 0 ; n < N ; n ++ ) { int next = ( n + 1 ) % N ; if ( S . charAt ( n ) == ' - ' || S . charAt ( next ) == ' - ' ) { answer ++ ; } } } System . out . println ( answer ) ; } }   }" ]
[ "t = int ( input ( ) ) NEW_LINE while t > 0 : n = int ( input ( ) ) NEW_LINE s = str ( input ( ) ) NEW_LINE flag1 = 1 NEW_LINE for i in range ( len ( s ) ) : if NEW_LINE s [ i ] == ' < ' : flag1 = 0 NEW_LINE break NEW_LINE flag2 = 1 NEW_LINE for i in range ( len ( s ) ) : if NEW_LINE s [ i ] == ' > ' : flag2 = 0 NEW_LINE break NEW_LINE if flag1 == 1 or flag2 == 1 : NEW_LINE INDENT ans = n else : NEW_LINE ans = 0 NEW_LINE DEDENT s = s + s [ 0 ] NEW_LINE for i in range ( 0 , n , + 1 ) : if NEW_LINE s [ i ] == ' - ' or s [ i + 1 ] == ' - ' : ans = ans + 1 NEW_LINE print ( ans )       t = t - 1 NEW_LINE", "T = int ( input ( ) ) NEW_LINE for _ in range ( T ) : N = int ( input ( ) ) NEW_LINE s = input ( ) NEW_LINE c = N NEW_LINE if ' < ' not in s : NEW_LINE INDENT print ( N ) elif ' > ' not in s : NEW_LINE print ( N ) else : NEW_LINE l = srt = s . index ( ' > ' ) NEW_LINE DEDENT C = 0 NEW_LINE for i in range ( N ) : r = s [ ( i + 1 ) % N ] NEW_LINE if ' - ' in [ s [ i ] , r ] : C += 1 NEW_LINE print ( C ) NEW_LINE", "from collections import defaultdict   for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE s = input ( )   d = \" . \" NEW_LINE ok = True NEW_LINE result = 0 NEW_LINE for i in range ( n ) : NEW_LINE", "t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE s = input ( ) NEW_LINE ans = 0 NEW_LINE if \" < \" not in s or \" > \" not in s : NEW_LINE INDENT ans = n else : NEW_LINE char = set ( ) NEW_LINE DEDENT i = 0 NEW_LINE while True : if NEW_LINE i == n : NEW_LINE break NEW_LINE i = i % n NEW_LINE if s [ i ] == \" - \" : char . add ( i ) NEW_LINE char . add ( ( i + 1 ) % n ) NEW_LINE i += 1 NEW_LINE ans = len ( char ) NEW_LINE print ( ans ) NEW_LINE", "import mathfrom NEW_LINE collections NEW_LINE import Countert = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE l = list ( input ( ) ) NEW_LINE if ( l . count ( ' > ' ) == 0 or l . count ( ' < ' ) == 0 ) : NEW_LINE INDENT print ( n ) else : NEW_LINE count = 0 NEW_LINE DEDENT for j in range ( n ) : if NEW_LINE INDENT ( l [ j ] == ' - ' or l [ j - 1 ] == ' - ' ) : count += 1 NEW_LINE DEDENT print ( count )   NEW_LINE" ]
codeforces_174_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class test6 {   public static final int mod = 1000000007 ; static LinkedList < Integer > idx = new LinkedList < > ( ) ; static int a , b , n ; static String s ; static int dp [ ] ; public static void main ( String [ ] args ) throws IOException { BufferedReader sc = new BufferedReader ( new InputStreamReader ( System . in ) ) ;", "import java . util . Scanner ;   public class CF174B {   static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String input = sc . nextLine ( ) ; StringBuilder output = new StringBuilder ( \" YES \\n \" ) ;   int pointer = 0 ; while ( pointer < input . length ( ) ) { int i = pointer ; while ( i < input . length ( ) && input . charAt ( i ) != ' . ' ) i ++ ; int noOfCharsInName = i - pointer ; if ( noOfCharsInName < 1 || noOfCharsInName > 8 || i >= input . length ( ) ) { System . out . println ( \" NO \" ) ; return ; }   pointer = i ++ ; int noOfCharsToConsiderAfterDot = 1 ; while ( i < input . length ( ) && input . charAt ( i ) != ' . ' && i < pointer + 4 ) i ++ ; if ( i >= input . length ( ) && i - pointer - 1 > 3 || i - pointer - 1 == 0 ) { System . out . println ( \" NO \" ) ; return ; }   if ( i >= input . length ( ) || input . charAt ( i ) != ' . ' ) noOfCharsToConsiderAfterDot = i - pointer - 1 ;   String completeFileName = input . substring ( pointer - noOfCharsInName , pointer + noOfCharsToConsiderAfterDot + 1 ) ; output . append ( completeFileName ) ; output . append ( \" \\n \" ) ;   pointer += noOfCharsToConsiderAfterDot + 1 ; }   System . out . println ( output ) ; } }" ]
[ "s = list ( input ( ) . split ( \" . \" ) ) if len ( s ) == 1 : print ( \" NO \" ) exit ( ) x = s [ 0 ] y = \" \" ans = [ ] for i in range ( 1 , len ( s ) - 1 ) : if not 1 <= len ( x ) <= 8 : print ( \" NO \" ) exit ( ) if 2 <= len ( s [ i ] ) <= 3 : y = s [ i ] [ : 1 ] ans . append ( x + \" . \" + y ) x = s [ i ] [ 1 : ] elif 4 <= len ( s [ i ] ) <= 11 : y = s [ i ] [ : 3 ] ans . append ( x + \" . \" + y ) x = s [ i ] [ 3 : ] else : print ( \" NO \" ) exit ( ) y = s [ - 1 ] if not ( 1 <= len ( x ) <= 8 and 1 <= len ( y ) <= 3 ) : print ( \" NO \" ) exit ( ) else : ans . append ( x + \" . \" + y ) print ( \" YES \" ) print ( * ans , sep = \" \\n \" ) NEW_LINE", "a = input ( ) . split ( \" . \" ) l = [ [ a [ 0 ] ] ] for i in a [ 1 : - 1 ] : m = min ( 3 , len ( i ) - 1 ) l [ - 1 ] += [ i [ : m ] ] l += [ [ i [ m : ] ] ] l [ - 1 ] += [ a [ - 1 ] ] if len ( a ) < 2 or any ( len ( i ) not in range ( 1 , 9 ) or len ( j ) not in range ( 1 , 4 ) for i , j in l ) : print ( \" NO \" ) else : print ( \" YES \" ) print ( \" \\n \" . join ( \" . \" . join ( i ) for i in l ) ) NEW_LINE", "import reimport sysexit = sys . exitfrom bisect import bisect_left as bsl , bisect_right as bsrfrom collections import Counter , defaultdict as ddict , dequefrom functools import lru_cachecache = lru_cache ( None ) from heapq import * from itertools import * from math import inffrom pprint import pprint as ppenum = enumerateri = lambda : int ( rln ( ) ) ris = lambda : list ( map ( int , rfs ( ) ) ) rln = sys . stdin . readlinerl = lambda : rln ( ) . rstrip ( ' \\n ' ) rfs = lambda : rln ( ) . split ( ) mod = 1000000007 d4 = [ ( 0 , - 1 ) , ( 1 , 0 ) , ( 0 , 1 ) , ( - 1 , 0 ) ] d8 = [ ( - 1 , - 1 ) , ( 0 , - 1 ) , ( 1 , - 1 ) , ( - 1 , 0 ) , ( 1 , 0 ) , ( - 1 , 1 ) , ( 0 , 1 ) , ( 1 , 1 ) ] NEW_LINE", "import reimport sysexit = sys . exitfrom bisect import bisect_left as bsl , bisect_right as bsrfrom collections import Counter , defaultdict as ddict , dequefrom functools import lru_cachecache = lru_cache ( None ) from heapq import * from itertools import * from math import inffrom pprint import pprint as ppenum = enumerateri = lambda : int ( rln ( ) ) ris = lambda : list ( map ( int , rfs ( ) ) ) rln = sys . stdin . readlinerl = lambda : rln ( ) . rstrip ( ' \\n ' ) rfs = lambda : rln ( ) . split ( ) mod = 1000000007 d4 = [ ( 0 , - 1 ) , ( 1 , 0 ) , ( 0 , 1 ) , ( - 1 , 0 ) ] d8 = [ ( - 1 , - 1 ) , ( 0 , - 1 ) , ( 1 , - 1 ) , ( - 1 , 0 ) , ( 1 , 0 ) , ( - 1 , 1 ) , ( 0 , 1 ) , ( 1 , 1 ) ] NEW_LINE" ]
codeforces_940_A
[ "import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n , d ; n = scanner . nextInt ( ) ; d = scanner . nextInt ( ) ; int [ ] nums = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { nums [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( nums ) ; int ans = n ; for ( int i = 0 , j = 0 ; j < n ; ++ i ) { for ( ; j < n && nums [ j ] - nums [ i ] <= d ; ++ j ) ; ans = Math . min ( ans , n - ( j - i ) ) ; } System . out . println ( \" \" + ans ) ; } }" ]
[ "n , d = ( int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ) a = [ int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ] a . sort ( ) res = nout = [ ] for i in range ( n ) : for j in range ( i , n ) : if abs ( a [ j ] - a [ i ] ) <= d : res = res - 1 out . append ( res ) res = n   print ( min ( out ) ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) l = [ int ( i ) for i in input ( ) . split ( ) ] l . sort ( ) if max ( l ) - min ( l ) <= k : print ( 0 ) exit ( ) maxlen = 0 for i in range ( n ) : for j in range ( i , n ) : if max ( l [ i : j + 1 ] ) - min ( l [ i : j + 1 ] ) <= k : maxlen = max ( maxlen , j - i + 1 ) print ( n - maxlen ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr = sorted ( arr ) ; d = [ 0 ] * ( 101 ) for i in arr : d [ i ] += 1 ans = 10 ** 18 for i in range ( 0 , 101 ) : if i + k + 1 > 101 : break else : ans = min ( n - sum ( d [ i : i + k + 1 ] ) , ans ) print ( ans ) NEW_LINE", "n , d = map ( int , input ( ) . split ( ) ) a = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) if n == 1 : print ( 0 ) exit ( ) ans = nfor i in range ( n ) : for j in range ( i , n ) : if a [ j ] - a [ i ] <= d : ans = min ( ans , i + n - j - 1 ) print ( ans ) NEW_LINE" ]
codeforces_33_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   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 ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Main { static class FastReader { BufferedReader br ; 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 static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; Graph grafo = new Graph ( ) ; int respostaFinal = 0 ; StringBuilder sentençaFinal = new StringBuilder ( ) ; String str1 = in . next ( ) ; String str2 = in . next ( ) ; if ( str1 . length ( ) == str2 . length ( ) ) { for ( int contador = in . nextInt ( ) ; contador > 0 ; contador -- ) { String vertice1 = in . next ( ) ; String vertice2 = in . next ( ) ; int peso = in . nextInt ( ) ; grafo . setEdge ( vertice1 . charAt ( 0 ) , vertice2 . charAt ( 0 ) , peso ) ; }   int [ ] [ ] matriz = grafo . floydWarshall ( ) ;   for ( int contador = 0 ; contador < str1 . length ( ) ; contador ++ ) {", "import java . util . HashMap ; import java . util . Map ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Main { public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ;   String line1 = fs . nextLine ( ) ; String line2 = fs . nextLine ( ) ;   int n = fs . nextInt ( ) ;   int graph [ ] [ ] = new int [ 26 ] [ 26 ] ;" ]
[ "import osimport sysfrom math import * from collections import * NEW_LINE", "s = input ( ) t = input ( )   if ( len ( s ) != len ( t ) ) : print ( - 1 ) exit ( )   dist = [ [ 10 ** 15 for j in range ( 26 ) ] for i in range ( 26 ) ]   for i in range ( 26 ) : dist [ i ] [ i ] = 0   n = int ( input ( ) ) for i in range ( n ) : a = input ( ) . split ( ) x = ord ( a [ 0 ] ) - 97 y = ord ( a [ 1 ] ) - 97 w = int ( a [ - 1 ] )   dist [ x ] [ y ] = min ( dist [ x ] [ y ] , w )   for k in range ( 26 ) : for i in range ( 26 ) : for j in range ( 26 ) : dist [ i ] [ j ] = min ( dist [ i ] [ j ] , dist [ i ] [ k ] + dist [ k ] [ j ] )   ans = ' ' res = 0   n = len ( s )   for i in range ( n ) : if ( s [ i ] == t [ i ] ) : ans += s [ i ] continue cost = 10 ** 15 pos = - 1   x = ord ( s [ i ] ) - 97 y = ord ( t [ i ] ) - 97   for j in range ( 26 ) : if ( dist [ x ] [ j ] + dist [ y ] [ j ] < cost ) : cost = dist [ x ] [ j ] + dist [ y ] [ j ] pos = j   if ( pos == - 1 ) : print ( - 1 ) exit ( ) res += cost ans += chr ( pos + 97 )   print ( res ) print ( ans ) NEW_LINE", "def code ( c ) : return ord ( c ) - ord ( ' a ' )   def main ( ) : a = input ( ) b = input ( ) m = int ( input ( ) ) n = 26 d = [ [ 10 ** 9 for i in range ( n ) ] for j in range ( n ) ] for i in range ( n ) : d [ i ] [ i ] = 0 for i in range ( m ) : s , t , w = input ( ) . split ( ) w = int ( w ) s = code ( s ) t = code ( t ) d [ s ] [ t ] = min ( d [ s ] [ t ] , w )   for k in range ( n ) : for i in range ( n ) : for j in range ( n ) : d [ i ] [ j ] = min ( d [ i ] [ j ] , d [ i ] [ k ] + d [ k ] [ j ] )   if len ( a ) != len ( b ) : print ( - 1 ) else : ans = 0 res = [ ] for i in range ( len ( a ) ) : x = code ( a [ i ] ) y = code ( b [ i ] ) min_c = ' a ' min_cost = 10 ** 9 for j in range ( n ) : cur = d [ x ] [ j ] + d [ y ] [ j ] if cur < min_cost : min_cost = cur min_c = chr ( j + ord ( ' a ' ) ) res . append ( min_c ) ans += min_cost if ans >= 10 ** 9 : print ( - 1 ) else : print ( ans ) for j in res : print ( j , end = ' ' ) print ( )   main ( ) NEW_LINE" ]
codeforces_1038_A
[ "import java . util . * ; public class contest14 { static Scanner scn = new Scanner ( System . in ) ; public static void main ( String [ ] args ) {", "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 Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; s . nextLine ( ) ; String s1 = s . nextLine ( ) ; int min = Integer . MAX_VALUE ; HashMap < Character , Integer > h = new HashMap < > ( ) ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { if ( h . containsKey ( s1 . charAt ( i ) ) ) { h . put ( s1 . charAt ( i ) , h . get ( s1 . charAt ( i ) ) + 1 ) ; } else { h . put ( s1 . charAt ( i ) , 1 ) ; } } for ( Map . Entry e : h . entrySet ( ) ) { int a = ( int ) e . getValue ( ) ; if ( a < min ) min = a ; } int y = 0 ; if ( h . size ( ) == k ) y = min * k ; System . out . println ( y ) ; } }", "import java . io . * ; import java . util . * ; import javax . print . attribute . standard . Finishings ;   import java . math . * ;   public class Equality { 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 {" ]
[ "def main_function ( ) : n , m = [ int ( i ) for i in input ( ) . split ( \" ▁ \" ) ] s = list ( input ( ) ) d = { } for i in s : if i in d : d [ i ] += 1 else : d [ i ] = 1 if len ( d ) < m : return 0 f = min ( d , key = lambda i : d [ i ] ) return d [ f ] * m       print ( main_function ( ) ) NEW_LINE", "n , k = map ( int , input ( ) . split ( \" ▁ \" ) ) s = input ( ) l = [ ] for i in range ( k ) : l . append ( s . count ( chr ( i + ord ( \" A \" ) ) ) ) print ( min ( l ) * k ) NEW_LINE", "n , k = map ( int , input ( ) . split ( \" ▁ \" ) ) s = input ( ) l = [ ] a = 0 for i in range ( k ) : NEW_LINE", "n , k = map ( int , input ( ) . split ( \" ▁ \" ) ) s = input ( ) l = [ ] a = 0 for i in range ( k ) : NEW_LINE" ]
codeforces_112_B
[ "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n , x , y , r ; int i , j ; n = in . nextInt ( ) ; x = in . nextInt ( ) ; y = in . nextInt ( ) ; r = n / 2 ; if ( ( x == r || x == r + 1 ) && ( y == r || y == r + 1 ) ) System . out . println ( \" NO \" ) ; else System . out . println ( \" YES \" ) ; } }", "import java . util . * ; public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( ( x == n / 2 || x == n / 2 + 1 ) && ( y == n / 2 || y == n / 2 + 1 ) ) System . out . println ( \" NO \" ) ; else System . out . println ( \" YES \" ) ; }   }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int side = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( side == 2 ) System . out . println ( \" NO \" ) ; else { if ( ( x == side / 2 && y == side / 2 ) || ( x == side / 2 && y == side / 2 + 1 ) || ( x == side / 2 + 1 && y == side / 2 ) || ( x == side / 2 + 1 && y == side / 2 + 1 ) ) System . out . println ( \" NO \" ) ; else System . out . println ( \" YES \" ) ; } } }", "import java . util . * ;   public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , x = sc . nextInt ( ) , y = sc . nextInt ( ) ; int h = n / 2 ; if ( x == h && y == h || x == h && y == h + 1 || x == h + 1 && y == h || x == h + 1 && y == h + 1 ) System . out . println ( \" NO \" ) ; else System . out . println ( \" YES \" ) ; } }", "import java . util . Scanner ; public class Codeforces112B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , x , y ; n = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; boolean ok = true ; int row = n / 2 ; int col = n / 2 ; if ( ( row == x && col == y ) || ( row + 1 == x && col == y ) || ( row == x && col + 1 == y ) || ( row + 1 == x && col + 1 == y ) ) ok = false ; if ( ok ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } }" ]
[ "x , y , z = list ( map ( int , input ( ) . split ( ) ) ) if x == 2 : print ( ' NO ' ) elif x > 2 : p = x // 2 if y in [ p , p + 1 ] and z in [ p , p + 1 ] : print ( ' NO ' ) else : print ( ' YES ' ) NEW_LINE", "l = input ( ) . split ( \" ▁ \" ) n = int ( l [ 0 ] ) x = int ( l [ 1 ] ) y = int ( l [ 2 ] ) h = n / 2 if ( ( x == h ) & ( y == h ) ) : print ( \" NO \" ) elif ( ( x == h ) & ( y == h + 1 ) ) : print ( \" NO \" ) elif ( ( x == h + 1 ) & ( y == h ) ) : print ( \" NO \" ) elif ( ( x == h + 1 ) & ( y == h + 1 ) ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "a , b , c = map ( int , input ( ) . split ( ' ▁ ' ) ) if ( b == a // 2 or b == a // 2 + 1 ) and ( c == a // 2 or c == a // 2 + 1 ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "x , y , z = [ int ( x ) for x in input ( \" \" ) . split ( ) ]   n = x / 2   if ( ( y == n or y == n + 1 ) and ( z == n or z == n + 1 ) ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "import mathn , x , y = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) NEW_LINE" ]
codeforces_1183_B
[ "import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = input . nextInt ( ) ; while ( T -- > 0 ) { int n = input . nextInt ( ) ; int k = input . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } Arrays . sort ( a ) ; int v = a [ 0 ] + k ; int flag = 0 ; for ( int i = 1 ; i < n ; i ++ ) { int d = Math . abs ( v - a [ i ] ) ; if ( d > k ) { flag = 1 ; break ; } } if ( flag == 1 ) { out . println ( - 1 ) ; } else { out . println ( v ) ; } } out . close ( ) ; } 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 . util . * ; public class EqualizePrices {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; if ( arr [ 0 ] + k >= arr [ n - 1 ] - k ) { System . out . println ( arr [ 0 ] + k ) ; } else { System . out . println ( - 1 ) ; } } }   }", "import java . util . Scanner ;   public class problem85 {   public static void main ( String [ ] args ) {" ]
[ "T_ON = 1 DEBUG_ON = 0 MOD = 998244353     def solve ( ) : n , k = read_ints ( ) A = read_ints ( ) MIN = min ( A ) MAX = max ( A ) if 2 * k < MAX - MIN : print ( - 1 ) return print ( MIN + k )     def main ( ) : T = read_int ( ) if T_ON else 1 for i in range ( T ) : solve ( )     def debug ( * xargs ) : if DEBUG_ON : print ( * xargs )     from collections import * import math     NEW_LINE", "def check ( a , x ) : for i in a : if ( abs ( i - x ) > k ) : return False return True     for i in range ( int ( input ( ) ) ) : n , k = [ int ( u ) for u in input ( ) . split ( \" ▁ \" ) ] a = [ int ( u ) for u in input ( ) . split ( \" ▁ \" ) ] ans = - 1 low = max ( a ) - k high = min ( a ) + k while ( low <= high ) : mid = low + ( ( high - low ) // 2 ) if ( check ( a , mid ) ) : ans = mid low = mid + 1 else : high = mid - 1 print ( ans ) NEW_LINE", "cases = int ( input ( ) ) while cases : cases -= 1 a , b = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   mn = min ( arr ) mx = max ( arr ) if mx - mn > 2 * b : print ( - 1 ) else : print ( mn + b ) NEW_LINE" ]
codeforces_460_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 FileWriter fw ; static long oo = Long . MAX_VALUE ;", "import java . io . DataInputStream ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class a1 { static class Reader { final private int BUFFER_SIZE = 1 << 16 ; private DataInputStream din ; private byte [ ] buffer ; private int bufferPointer , bytesRead ;   public Reader ( ) { din = new DataInputStream ( System . in ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; }   public Reader ( String file_name ) throws IOException { din = new DataInputStream ( new FileInputStream ( file_name ) ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; }   public String readLine ( ) throws IOException { byte [ ] buf = new byte [ 64 ] ;", "import java . io . * ; import java . util . * ; public class test1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; long x = 1 , counter = 0 ; List < Long > result = new ArrayList < > ( ) ; for ( int digitSum = 1 ; digitSum <= 81 ; digitSum ++ ) { x = b * ( ( long ) Math . pow ( digitSum , a ) ) + c ;" ]
[ "def getSum ( n ) : ans = 0 while ( n != 0 ) : ans += int ( n % 10 ) n = int ( n // 10 ) return ansa , b , c = map ( int , input ( ) . split ( ) ) ans = [ ] for i in range ( 82 ) : x = b * ( i ** a ) + c if x > 0 and x < 1e9 and i == getSum ( x ) : ans . append ( x ) print ( len ( ans ) ) if len ( ans ) != 0 : print ( * ans ) NEW_LINE", "a , b , c = map ( int , input ( ) . split ( ) ) ans = [ ] for i in range ( 1 , 82 ) : t = b * i ** a + c if t > 0 and t <= 10 ** 9 : k = t s = 0 while k : s += k % 10 k //= 10 if s == i : ans . append ( t ) print ( len ( ans ) ) print ( * ans ) NEW_LINE", "import sys , os , iodef rs ( ) : return sys . stdin . readline ( ) . rstrip ( ) def ri ( ) : return int ( sys . stdin . readline ( ) ) def ria ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def ws ( s ) : sys . stdout . write ( s + ' \\n ' ) def wi ( n ) : sys . stdout . write ( str ( n ) + ' \\n ' ) def wia ( a ) : sys . stdout . write ( ' ▁ ' . join ( [ str ( x ) for x in a ] ) + ' \\n ' ) import math , datetime , functools , itertools , operator , bisect , fractions , statisticsfrom collections import deque , defaultdict , OrderedDict , Counterfrom fractions import Fractionfrom decimal import Decimalfrom sys import stdoutfrom heapq import heappush , heappop , heapify , _heapify_max , _heappop_max , nsmallest , nlargestsys . setrecursionlimit ( 111111 ) INF = 99999999999999999999999999999999   def main ( ) :   mod = 1000000007 NEW_LINE", "def sumDigit ( n ) : n = str ( n ) answer = 0 for i in n : answer += int ( i ) return answer s = input ( ) . strip ( ) . split ( ) a , b , c = int ( s [ 0 ] ) , int ( s [ 1 ] ) , int ( s [ 2 ] ) answer = list ( ) for i in range ( 1 , 82 ) : _sum = i temp = _sum ** a x = temp * b + c if x < 0 or x > 10 ** 9 : continue if _sum == sumDigit ( x ) : answer . append ( x )   print ( len ( answer ) ) if len ( answer ) != 0 : for i in answer : print ( i , end = ' ▁ ' ) NEW_LINE", "a , b , c = map ( int , input ( ) . split ( \" ▁ \" ) )     ans = [ ] for s in range ( 1 , 81 ) : x = b * s ** a + c if x < 1 or x >= 10 ** 9 : continue z = len ( str ( x ) ) d = 0 for i in range ( z ) : d += int ( str ( x ) [ i ] ) if d == s : ans . append ( x )   print ( len ( ans ) ) for i in range ( len ( ans ) ) : print ( ans [ i ] , end = \" ▁ \" ) NEW_LINE" ]
codeforces_1009_A
[ "import java . util . Scanner ;   public class GameShopping { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , m = in . nextInt ( ) , a [ ] = new int [ n ] , b [ ] = new int [ m ] , i , j = 0 , c = 0 ;   for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } for ( i = 0 ; i < m ; i ++ ) { b [ i ] = in . nextInt ( ) ; } in . close ( ) ; for ( i = 0 ; i < n ; i ++ ) { if ( j < m && b [ j ] >= a [ i ] ) { c ++ ; j ++ ; } } System . out . println ( c ) ; } }", "import java . util . Scanner ;   public class GameShoping {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = scan . nextInt ( ) ; } int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( c < b . length && b [ c ] >= a [ i ] ) { c += 1 ; } } System . out . println ( c ) ;   }   }", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; int [ ] arr = new int [ n ] ; int [ ] brr = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = s . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { brr [ i ] = s . nextInt ( ) ; } int count = 0 ; int ptr = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] <= brr [ ptr ] ) { count ++ ; ptr ++ ; } if ( ptr == m ) break ; } System . out . println ( count ) ; } }", "  import java . util . Scanner ;   public class main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int [ ] a = new int [ 1001 ] ; int [ ] b = new int [ 1001 ] ; int j = 0 ;   int o = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] <= b [ j ] ) { j ++ ; } } System . out . println ( j ) ; }   }" ]
[ "import sys   def main ( ) : inp = sys . stdin . read ( ) . strip ( ) . split ( ' \\n ' ) w = list ( map ( int , inp [ 2 ] . split ( ) ) ) c , j = 0 , 0 for i in map ( int , inp [ 1 ] . split ( ) ) : if j == len ( w ) : break if w [ j ] >= i : c += 1 ; j += 1 return c   print ( main ( ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) j = count = 0 for i in range ( n ) : if c [ i ] <= a [ j ] : j += 1 count += 1 else : continue if j == m : breakprint ( count ) NEW_LINE", "import sysfrom array import array     def readline ( ) : return sys . stdin . buffer . readline ( ) . decode ( ' utf - 8' )     n , m = map ( int , readline ( ) . split ( ) ) c = list ( map ( int , readline ( ) . split ( ) ) ) a = list ( map ( int , readline ( ) . split ( ) ) ) i , ans = 0 , 0   for bill in a : while i < n and bill < c [ i ] : i += 1 if i < n : ans += 1 i += 1   print ( ans ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) j = 0 ans = 0 for i in c : if i <= a [ j ] : j += 1 ans += 1 if j == m : breakprint ( ans ) NEW_LINE", "inp = input ( ) . split ( ' ▁ ' ) n , m = int ( inp [ 0 ] ) , int ( inp [ 1 ] ) c = input ( ) . split ( ' ▁ ' ) a = input ( ) . split ( ' ▁ ' ) bill = 0 for i in range ( n ) : if bill == len ( a ) : break if int ( a [ bill ] ) >= int ( c [ i ] ) : bill += 1 print ( bill ) NEW_LINE" ]
codeforces_1294_B
[ "import javafx . collections . transformation . SortedList ; import javafx . util . Pair ;   import java . io . IOException ; import java . net . Inet4Address ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; while ( n -- > 0 ) { int s = scanner . nextInt ( ) ; Pair [ ] pairs = new Pair [ s ] ; for ( int i = 0 ; i < s ; i ++ ) { pairs [ i ] = new Pair ( scanner . nextInt ( ) , scanner . nextInt ( ) ) ; } Arrays . sort ( pairs ) ; int x = 0 , y = 0 ; boolean can = true ; String res = \" \" ; for ( int i = 0 ; i < s ; i ++ ) { if ( x <= pairs [ i ] . first && y <= pairs [ i ] . second ) { for ( int j = 0 ; j < pairs [ i ] . first - x ; j ++ ) { res += \" R \" ; } for ( int j = 0 ; j < pairs [ i ] . second - y ; j ++ ) { res += \" U \" ; } x = pairs [ i ] . first ; y = pairs [ i ] . second ; } else { can = false ; break ; } } if ( can ) { println ( \" YES \\n \" + res ) ; } else { println ( \" NO \" ) ; } } } static class Pair implements Comparable < Pair > { int first ; int second ;   public Pair ( int first , int second ) { this . first = first ; this . second = second ; }   public int compareTo ( Pair o ) { if ( first != o . first ) return Integer . compare ( first , o . first ) ; return Integer . compare ( second , o . second ) ; } }", "import java . util . * ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ;    public class Sol { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int robots = sc . nextInt ( ) ; TreeSet < Integer > xpoints = new TreeSet < > ( ) ; TreeSet < Integer > ypoints = new TreeSet < > ( ) ; HashMap < Integer , HashSet < Integer > > map = new HashMap < > ( ) ; for ( int i = 0 ; i < robots ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( map . containsKey ( x ) ) { map . get ( x ) . add ( y ) ; } else { HashSet < Integer > temp = new HashSet < > ( ) ; temp . add ( y ) ; map . put ( x , temp ) ; } xpoints . add ( x ) ; ypoints . add ( y ) ; } int count = 0 ; int max_x = 0 ; int max_y = 0 ; String direction = \" \" ; for ( int y : ypoints ) { for ( int x : xpoints ) { if ( map . containsKey ( x ) && map . get ( x ) . contains ( y ) && max_x <= x && max_y <= y ) { count ++ ; int i = x - max_x ; int j = y - max_y ; while ( i > 0 ) { direction += \" R \" ; i -- ; } while ( j > 0 ) { direction += \" U \" ; j -- ; } max_x = x ; max_y = y ; } } } if ( count == robots ) { System . out . println ( \" YES \" ) ; System . out . println ( direction ) ; } else { System . out . println ( \" NO \" ) ; } } } }" ]
[ "t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) li = [ ] for i in range ( n ) : x = list ( map ( int , input ( ) . split ( ) ) ) li . append ( x ) li . sort ( ) s = ' R ' * li [ 0 ] [ 0 ] + ' U ' * li [ 0 ] [ 1 ] for i in range ( 1 , n ) : if li [ i - 1 ] [ 0 ] > li [ i ] [ 0 ] or li [ i - 1 ] [ 1 ] > li [ i ] [ 1 ] : print ( \" NO \" ) break x = li [ i ] [ 0 ] - li [ i - 1 ] [ 0 ] y = li [ i ] [ 1 ] - li [ i - 1 ] [ 1 ] s = s + ( ' R ' * x ) + ' U ' * y else : print ( \" YES \" ) print ( s )   NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) s = \" \" shan = 0 sree = [ ] for i in range ( n ) : l , k = map ( int , input ( ) . split ( ) ) sree . append ( [ l , k ] ) sree . sort ( ) NEW_LINE", "from sys import stdininput = stdin . readlinefrom heapq import heapify , heappush , heappop , heappushpopfrom collections import defaultdict as dd , deque as dq , Counter as Cfrom math import factorial as f , ceil , gcd , sqrt , logfrom bisect import bisect_left as bl , bisect_right as brfrom itertools import combinations as c , permutations as pfrom math import factorial as f , ceil , gcd , sqrt , logmp = lambda : map ( int , input ( ) . split ( ) ) it = lambda : int ( input ( ) ) ls = lambda : list ( input ( ) . strip ( ) . split ( ) ) mt = lambda r : [ list ( mp ( ) ) for _ in range ( r ) ] lcm = lambda a , b : ( a * b ) // gcd ( a , b ) def fibo_n ( n ) : return ( ( ( 1 + sqrt ( 5 ) ) / 2 ) ** n ) / sqrt ( 5 ) mod = 1000000007 for _ in range ( it ( ) ) : a = it ( ) v = [ ] for i in range ( a ) : v . append ( list ( mp ( ) ) ) v . sort ( ) x , y = 0 , 0 flag = 0 ans = \" \" v = dq ( v ) while v : x1 , y1 = v . popleft ( ) if x1 >= x and y1 >= y : k = x1 - x ans += \" R \" * k l = y1 - y ans += \" U \" * l x += k y += l else : flag = 1 break if flag : print ( \" NO \" ) else : print ( \" YES \" ) print ( ans ) NEW_LINE", "import sysfrom collections import defaultdict   t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE" ]
codeforces_109_A
[ "  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 c705a {", "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 A109 {   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 syscoins = [ 4 , 7 ] sum = int ( input ( ) ) def minCoins ( coins , m , n ) : dp = [ [ 1e9 , 0 ] for i in range ( n + 1 ) ] dp [ 0 ] [ 0 ] = 0 for i in range ( n + 1 ) : for j in range ( 2 ) : NEW_LINE", "n = int ( input ( ) ) x = n % 7 while x % 4 : x = x + 7 if ( x > n ) : print ( - 1 ) else : print ( '4' * ( x // 4 ) + '7' * ( ( n - x ) // 7 ) ) NEW_LINE", "n = int ( input ( ) ) count = n // 7 ans = float ( ' inf ' ) val = Nonefor i in range ( count , - 1 , - 1 ) : remaining = n - 7 * i if remaining % 4 == 0 : if ans > i + remaining // 4 : ans = i + remaining // 4 val = ( remaining // 4 , i ) NEW_LINE", "n = int ( input ( ) ) base = ( n // 4 + 1 ) * '9' ans = basei = j = 1 f = Truefor i in range ( 0 , n + 1 ) : j = 0 while i * 4 + j * 7 < n : j += 1 if i * 4 + j * 7 == n : x = ( '4' * i + '7' * j ) print ( x ) f = False break     if f : print ( - 1 )     NEW_LINE" ]
codeforces_667_A
[ "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 ) ; double d = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double v = sc . nextDouble ( ) ; double e = sc . nextDouble ( ) ;   double v1 = 4 * v / ( Math . PI * d * d ) ; out . println ( e > v1 ? \" NO \" : \" YES \\n \" + h / ( v1 - e ) ) ; out . close ( ) ; }       ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ;   public class PouringRain_CodeForces {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; String [ ] r = br . readLine ( ) . split ( \" ▁ \" ) ; double d = Double . parseDouble ( r [ 0 ] ) ; double h = Double . parseDouble ( r [ 1 ] ) ; double v = Double . parseDouble ( r [ 2 ] ) ; double e = Double . parseDouble ( r [ 3 ] ) ; double t = ( Math . PI * d * d * h ) / ( 4 * v - Math . PI * d * d * e ) ; out . println ( t >= 0 ? \" YES \" + \" \\n \" + t : \" NO \" ) ; out . flush ( ) ; out . close ( ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class PouringRain {   public static void main ( String [ ] args ) { FastReader reader = new FastReader ( ) ;   int d = reader . nextInt ( ) ; int h = reader . nextInt ( ) ; int v = reader . nextInt ( ) ; int e = reader . nextInt ( ) ;   double area = ( Math . PI * d * d ) / 4.0 ; double drinking = v / area ;   if ( drinking < e ) { System . out . println ( \" NO \" ) ; } else { double time = h / ( drinking - e ) ; System . out . println ( \" YES \" ) ; System . out . printf ( \" % .4f \\n \" , time ) ; } }   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 . Scanner ; import java . util . StringTokenizer ; import java . util . * ; public class test { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader scan = new FastReader ( ) ; int d = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int v = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; double speed = ( double ) v / ( ( Math . PI * d * d ) / 4 ) ; if ( speed > ( double ) e ) { double seconds = ( double ) h / ( ( 4 * v ) / ( Math . PI * d * d ) - e ) ; if ( seconds > 0.0000 ) { System . out . println ( \" YES \" ) ; System . out . printf ( \" % .12f \" , seconds ) ; } else System . out . println ( \" NO \" ) ; } else System . out . println ( \" NO \" ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class PouringRain { public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ; StringBuilder sb = new StringBuilder ( ) ; int d = fs . nextInt ( ) ; int h = fs . nextInt ( ) ; int v = fs . nextInt ( ) ; double e = ( fs . nextInt ( ) * Math . PI * d * d ) / 4.0 ; if ( Double . compare ( e , v ) >= 0 ) { System . out . println ( \" NO \" ) ; return ; } else { double startAmount = Math . PI * d * d * h / 4.0 ; System . out . println ( \" YES \" ) ; System . out . println ( startAmount / ( v - e ) ) ; } }   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 ( ) ) ; }   float nextFloat ( ) { return Float . parseFloat ( next ( ) ) ; } } }" ]
[ "import mathd , h , v , e = tuple ( [ int ( num ) for num in input ( ) . split ( ) ] ) NEW_LINE", "s = input ( ) . split ( ) pi = 3.141592653589 for i in range ( 4 ) : s [ i ] = float ( s [ i ] ) if s [ 2 ] / ( pi * ( ( s [ 0 ] / 2 ) ** 2 ) ) <= s [ 3 ] : print ( ' NO ' ) else : print ( ' YES ' ) print ( s [ 1 ] / ( s [ 2 ] / ( pi * ( ( s [ 0 ] / 2 ) ** 2 ) ) - s [ 3 ] ) ) NEW_LINE", "from math import pid , h , v , e = list ( map ( int , input ( ) . split ( ) ) ) a = ( d ** 2 / 4 ) * pi * hve = ( d ** 2 / 4 ) * pi * eif ( v > ve ) : print ( \" YES \" ) print ( a / ( v - ve ) ) else : print ( \" NO \" ) NEW_LINE", "import sysimport math   d , h , v , e = ( map ( float , input ( ) . strip ( ) . split ( ) ) )   if not h : print ( \" YES \\n 0\" ) else : drink_speed = v / ( math . pi * d ** 2 / 4 ) if drink_speed < e : print ( \" NO \" ) else : print ( f \" YES \\n { h ▁ / ▁ - ( e ▁ - ▁ drink _ speed ) } \" ) NEW_LINE" ]
codeforces_1136_A
[ "import java . util . Scanner ;   public class Problem37 {   public static void main ( String [ ] args ) {", "import java . util . * ; public class program { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] f = new int [ n ] ; int [ ] l = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { f [ i ] = sc . nextInt ( ) ; l [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( l [ i ] >= k ) { count ++ ; } } System . out . println ( count ) ; } }", "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 int dx1 [ ] = { 1 , 1 , 0 , - 1 , - 1 , - 1 , 0 , 1 } ; private static int dy1 [ ] = { 0 , - 1 , - 1 , - 1 , 0 , 1 , 1 , 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 = 1000004 ; 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 . util . * ; import java . math . * ;   public class Natasha { 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 {", "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 array [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; array [ i ] = r ; } int a = 0 ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( k - 1 >= array [ i ] ) { a ++ ; } }" ]
[ "n = int ( input ( ) ) check = [ 0 ] * 10005 for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) for j in range ( a , b + 1 ) : check [ j ] = ic = int ( input ( ) ) print ( n - check [ c ] ) NEW_LINE", "n = int ( input ( ) ) d = [ ] while ( n > 0 ) : l , r = map ( int , input ( ) . split ( ) ) n -= 1 z = [ l , r ] d . append ( z ) m = int ( input ( ) ) a = 0 for i in range ( len ( d ) ) : d1 = d [ i ] [ 0 ] d2 = d [ i ] [ 1 ] if ( m >= d1 or m <= d2 ) and m <= d2 : a += 1   print ( a ) NEW_LINE", "import sys   def main ( ) : inp = sys . stdin . read ( ) . strip ( ) . split ( ' \\n ' ) p = int ( inp [ - 1 ] ) n = int ( inp [ 0 ] ) for i in range ( 1 , n + 1 ) : x , y = map ( int , inp [ i ] . split ( ) ) if x <= p <= y : return n - i + 1   print ( main ( ) ) NEW_LINE", "n = int ( input ( ) ) m = [ ] while n != 0 : l , r = map ( int , input ( ) . split ( ) ) m . append ( l ) m . append ( r ) n -= 1 k = int ( input ( ) ) for i in range ( len ( m ) ) : if k <= m [ i ] : print ( int ( ( ( len ( m ) - i ) + 1 ) / 2 ) ) break NEW_LINE", "def string_list ( s , char ) : output_list = [ ] intermediator = \" \" for i in range ( len ( s ) ) : if s [ i ] != char : intermediator += s [ i ] if i == len ( s ) - 1 : output_list . append ( int ( intermediator ) ) else : if intermediator : output_list . append ( int ( intermediator ) ) intermediator = \" \" return output_list     def list_string ( l , char ) : output_str = \" \" for i in range ( len ( l ) - 1 ) : output_str += str ( l [ i ] ) + char output_str += str ( l [ len ( l ) - 1 ] ) return output_str     def merge_sort ( l ) : def merge ( l1 , l2 ) : i , j = 0 , 0 output_list = [ ] while i < len ( l1 ) and j < len ( l2 ) : if l1 [ i ] < l2 [ j ] : output_list . append ( l1 [ i ] ) i += 1 else : output_list . append ( l2 [ j ] ) j += 1 if i == len ( l1 ) : output_list += ( l2 [ j : ] ) else : output_list += ( l1 [ i : ] ) return output_list   def sorts ( l ) : if len ( l ) < 2 : return l else : mid = len ( l ) // 2 left = sorts ( l [ : mid ] ) right = sorts ( l [ mid : ] ) return merge ( left , right ) return sorts ( l )       def main_function ( ) : output_list = [ ] t = int ( input ( ) ) chapters = [ ] for i in range ( t ) : chapter = string_list ( input ( ) , \" ▁ \" ) chapters . append ( chapter ) page = int ( input ( ) ) already_red = 0 for i in range ( len ( chapters ) ) : if page > chapters [ i ] [ 1 ] : already_red += 1 else : break return len ( chapters ) - already_red   return list_string ( output_list , \" ▁ \" )       print ( main_function ( ) )   NEW_LINE" ]
codeforces_465_B
[ "import javax . print . DocFlavor ; import javax . swing . * ; import java . awt . image . BandedSampleModel ; import java . util . * ;   public class Example { static long [ ] [ ] dp ;", "import java . util . Scanner ;   public class Inbox { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int squSize = scanner . nextInt ( ) ; int [ ] numbers = new int [ squSize ] ; int ones = 0 ; for ( int i = 0 ; i < squSize ; i ++ ) { numbers [ i ] = scanner . nextInt ( ) ; if ( numbers [ i ] == 1 ) { ones ++ ; } } int counter = 0 ; for ( int i = 0 ; i < squSize - 1 ; i ++ ) { if ( numbers [ i ] == 1 ) { ones -- ; if ( ones > 0 ) { counter += 2 ; if ( numbers [ i + 1 ] == 1 ) { counter -- ; } } else { counter ++ ; } } } if ( numbers [ squSize - 1 ] == 1 ) { counter ++ ; } System . out . println ( counter ) ; } }  ", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int a [ ] = new int [ n ] ; int prev = - 1 , c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; if ( prev != - 1 && a [ i ] == 1 ) { if ( i - prev <= 2 ) c = c + ( i - prev ) ; else c = c + 2 ; prev = i ; } if ( prev == - 1 && a [ i ] == 1 ) { prev = i ; c = c + 1 ; } } System . out . println ( c ) ; } }", "import java . util . Scanner ;   public class Inbox100500 { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , d = 0 , c = 0 ; boolean b = false ; for ( i = 0 ; i < n ; i ++ ) { int x = in . nextInt ( ) ; if ( x == 1 ) { b = true ; c += d == 0 ? 1 : 2 ; d = 0 ; } else if ( b ) { d ++ ; } } in . close ( ) ; System . out . println ( c ) ; } }", "import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; int lastin = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; if ( ar [ i ] == 1 ) { lastin = i ; } } long c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i < n - 1 ) { if ( ar [ i ] == 1 ) { c ++ ; if ( ar [ i + 1 ] != 1 && ( i + 1 ) <= lastin ) { c ++ ; } } } else { if ( ar [ i ] == 1 ) { c ++ ; } } } System . out . println ( c ) ;    }   public static void Mybfs ( List < List < Integer > > lists , int source , int [ ] dist , boolean [ ] visited ) { dist [ source ] = 0 ;" ]
[ "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) prev = 1 ans = 0 for x in a : if x == 1 : if ans == 0 or prev == 1 : ans += 1 else : ans += 2 prev = xprint ( ans ) NEW_LINE", "import mathimport osimport randomimport reimport sysimport functoolsfrom operator import itemgetter , attrgetterfrom collections import Counter   if __name__ == ' _ _ main _ _ ' : Y = lambda : list ( map ( int , input ( ) . split ( ) ) ) P = lambda : map ( int , input ( ) . split ( ) ) N = lambda : int ( input ( ) )   n = N ( ) a = Y ( ) f , cnt = 0 , 0 for i in a : if i : cnt += 1 f = 1 else : if f : cnt += 1 f = 0 print ( cnt if ( a [ n - 1 ] or not cnt ) else cnt - 1 ) NEW_LINE", "n = int ( input ( ) ) arr = [ int ( i ) for i in input ( ) . split ( ) ] i = 0 while ( i < n and arr [ i ] == 0 ) : arr [ i ] = - 1 i = i + 1 i = n - 1 while ( arr [ i ] == 0 ) : arr [ i ] = - 1 i = i - 1 i , c = 0 , 0 while ( i < n ) : if arr [ i ] == 1 : c = c + 1 i = i + 1 elif arr [ i ] == 0 : c = c + 1 while ( arr [ i ] == 0 ) : i = i + 1 else : i = i + 1 print ( c ) NEW_LINE", "import sysinput = sys . stdin . readlinen = int ( input ( ) ) l = input ( ) . split ( ) li = [ int ( i ) for i in l ] l = [ ] for i in range ( n ) : if ( li [ i ] == 1 ) : l . append ( i ) ans = 0 for i in range ( len ( l ) - 1 ) : ans += min ( l [ i + 1 ] - l [ i ] , 2 ) if ( l != [ ] ) : ans += 1 print ( ans ) 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" ]
codeforces_145_A
[ "import java . util . Scanner ;   public class StringEqualiser { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   String a = scanner . nextLine ( ) ; String b = scanner . nextLine ( ) ;   int seven = 0 , four = 0 , count = 0 ;   for ( int i = 0 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) != b . charAt ( i ) ) { if ( a . charAt ( i ) == '4' ) four ++ ; else seven ++ ;   count ++ ; } }   System . out . println ( count - Math . min ( four , seven ) ) ; } }", "import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) , b = sc . next ( ) ; int dif = 0 , dif2 = 0 , q = 0 , w = 0 , temp = 0 ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { q = Integer . parseInt ( String . valueOf ( a . charAt ( i ) ) ) ; w = Integer . parseInt ( String . valueOf ( b . charAt ( i ) ) ) ; temp = q - w ; if ( temp > 0 ) { dif ++ ; } else if ( temp < 0 ) { dif2 ++ ; } } if ( dif >= dif2 ) { System . out . println ( dif ) ; } else { System . out . println ( dif2 ) ; } } }  ", "  import java . util . Scanner ;    public class Main {   public static void main ( String [ ] args ) { Scanner leer = new Scanner ( System . in ) ; String C1 ; String C2 ; int pos = 0 ; int neg = 0 ; C1 = leer . nextLine ( ) ; C2 = leer . nextLine ( ) ; char A [ ] = C1 . toCharArray ( ) ; char B [ ] = C2 . toCharArray ( ) ; if ( ! C1 . equals ( C2 ) ) for ( int i = 0 ; i < ( C1 . length ( ) ) ; i ++ ) { if ( ( ( ( int ) A [ i ] ) - ( ( int ) B [ i ] ) ) < 0 ) neg ++ ; else if ( ( ( ( int ) A [ i ] ) - ( ( int ) B [ i ] ) ) > 0 ) pos ++ ; } if ( pos == neg ) System . out . print ( pos ) ; else if ( pos < neg ) System . out . print ( pos + ( neg - pos ) ) ; else System . out . print ( neg + ( pos - neg ) ) ;   } }   ", "  import java . util . Scanner ;    public class Main {   public static void main ( String [ ] args ) { Scanner leer = new Scanner ( System . in ) ; String C1 ; String C2 ; int pos = 0 ; int neg = 0 ; C1 = leer . nextLine ( ) ; C2 = leer . nextLine ( ) ; char A [ ] = C1 . toCharArray ( ) ; char B [ ] = C2 . toCharArray ( ) ; if ( ! C1 . equals ( C2 ) ) for ( int i = 0 ; i < ( C1 . length ( ) ) ; i ++ ) { if ( ( ( ( int ) A [ i ] ) - ( ( int ) B [ i ] ) ) < 0 ) neg ++ ; else if ( ( ( ( int ) A [ i ] ) - ( ( int ) B [ i ] ) ) > 0 ) pos ++ ; } if ( pos == neg ) System . out . print ( pos ) ; else if ( pos < neg ) System . out . print ( pos + ( neg - pos ) ) ; else System . out . print ( neg + ( pos - neg ) ) ;   } }   " ]
[ "a = list ( input ( ) ) b = list ( input ( ) )   a_copy = a [ : ] a_copy . sort ( ) b_copy = b [ : ] b_copy . sort ( )   replace_counter = 0 swap_counter = 0   for i in range ( len ( a_copy ) ) : if ( a_copy [ i ] != b_copy [ i ] ) : replace_counter += 1   for i in range ( len ( a ) ) : if ( a [ i ] != b [ i ] ) : swap_counter += 1   swap_counter = ( swap_counter - replace_counter ) // 2 print ( replace_counter + swap_counter ) NEW_LINE", "a , b = input ( ) , input ( ) ; l = [ a [ i ] + b [ i ] for i in range ( len ( a ) ) ] ; print ( max ( l . count ( '47' ) , l . count ( '74' ) ) ) NEW_LINE", "a = list ( map ( int , input ( ) ) ) b = list ( map ( int , input ( ) ) ) c = 0 ; z = 0 for i in range ( len ( a ) ) : if a [ i ] != b [ i ] : if a [ i ] == 4 : c += 1 else : z += 1 print ( max ( c , z ) )   NEW_LINE", "from collections import Counter   string1 = input ( ) string2 = input ( )   x1 = Counter ( string1 ) x2 = Counter ( string2 )   string1 = list ( string1 ) string2 = list ( string2 ) q = Counter ( ) q [ '4' ] = abs ( x1 [ '4' ] - x2 [ '4' ] ) q [ '7' ] = abs ( x1 [ '7' ] - x2 [ '7' ] ) if q [ '4' ] < q [ '7' ] : w = '4' else : w = '7' ans = 0 dp = 0 for i in range ( len ( string1 ) ) : if string1 [ i ] != string2 [ i ] : if q [ w ] > 0 : ans += 1 q [ w ] -= 1 else : dp += 1 dp //= 2 print ( ans + dp ) NEW_LINE", "from collections import Counter   string1 = input ( ) string2 = input ( )   x1 = Counter ( string1 ) x2 = Counter ( string2 )   string1 = list ( string1 ) string2 = list ( string2 ) mn = min ( abs ( x1 [ '4' ] - x2 [ '4' ] ) , abs ( x1 [ '7' ] - x2 [ '7' ] ) )   ans = 0 dp = 0 for i in range ( len ( string1 ) ) : if string1 [ i ] != string2 [ i ] : if mn > 0 : ans += 1 mn -= 1 else : dp += 1 dp //= 2 print ( ans + dp ) NEW_LINE" ]
codeforces_346_A
[ "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 ; Student ( int x , int y ) { this . x = x ; this . y = y ;", "import java . io . BufferedReader ; import java . io . * ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; 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 ) throws java . lang . Exception { int test = 1 ; FastReader sc = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ;", "import java . io . * ; import java . util . * ; public class Solution { static Scanner sc = new Scanner ( System . in ) ; static PrintWriter out = new PrintWriter ( System . out ) ;", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws Exception { FastReader sc = new FastReader ( ) ; StringBuilder sb = new StringBuilder ( ) ; int n = sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int d = max ; for ( int i = 1 ; i < n ; i ++ ) { int temp = sc . nextInt ( ) ; max = Math . max ( max , temp ) ; d = gcd ( d , temp ) ; } System . out . println ( ( ( max / d ) - n ) % 2 == 1 ? \" Alice \" : \" Bob \" ) ; } static int gcd ( int a , int b ) { if ( b == 0 ) return a ; else return gcd ( b , a % b ) ; } } 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 . util . * ; public class Solution {   static int gcd ( int a , int b ) { if ( a % b == 0 ) return b ; return gcd ( b , a % b ) ; } public static String gameWinner ( int [ ] ar , int n ) {" ]
[ "import mathfor _ in range ( 1 ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) g = 0 for i in range ( 0 , len ( a ) ) : g = math . gcd ( a [ i ] , g ) maxi = max ( a ) // g if ( n - maxi ) % 2 == 0 : print ( \" Bob \" ) else : print ( \" Alice \" ) NEW_LINE", "from math import * n = int ( input ( ) ) ls = [ int ( x ) for x in input ( ) . split ( ) ] g = 0 for i in ls : g = gcd ( g , i ) x = max ( ls ) // gif ( x - n ) & 1 : print ( ' Alice ' ) else : print ( ' Bob ' ) NEW_LINE", "import math as mtimport sys , stringinput = sys . stdin . readlinefrom collections import defaultdictL = lambda : list ( map ( int , input ( ) . split ( ) ) ) Ls = lambda : list ( input ( ) . split ( ) ) M = lambda : map ( int , input ( ) . split ( ) ) I = lambda : int ( input ( ) )   n = I ( ) l = L ( ) m = 0 g = l [ 0 ] for i in l : g = mt . gcd ( g , i ) m = max ( m , i ) ans = ( m // g - n ) if ( ans % 2 ) : print ( \" Alice \" ) else : print ( \" Bob \" ) NEW_LINE", "n , listo2 , c = int ( input ( ) ) , [ ] , 0 import mathlisto = list ( map ( int , input ( ) . split ( ) ) ) listo . sort ( ) obaa = listo [ 0 ]   def gcd ( x , y ) : while ( y ) : x , y = y , x % y return x   for i in range ( 1 , n ) : GCD = gcd ( listo [ i ] , obaa ) obaa = GCDbomba = int ( listo [ n - 1 ] / GCD ) - n if bomba % 2 == 0 : print ( \" Bob \" ) else : print ( \" Alice \" ) NEW_LINE", "from fractions import gcdn = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) d = max ( a ) c = 0 for i in range ( len ( a ) ) : c = gcd ( c , a [ i ] ) result = d // c - nif result % 2 == 0 : print ( \" Bob \" ) else : print ( \" Alice \" ) NEW_LINE" ]
codeforces_311_A
[ "import java . awt . Point ; import java . util . * ; import java . io . * ; import static java . lang . Math . * ;   public class PracticeProblem { public 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 FastReader in = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static final int MOD = ( int ) 1e9 + 7 ;   public static void main ( String [ ] args ) { solve ( ) ;   out . close ( ) ; }   public static void solve ( ) { long n = in . nextInt ( ) , k = in . nextInt ( ) ;   if ( ( n * ( n - 1 ) ) / 2 <= k ) { out . println ( \" no ▁ solution \" ) ; return ; }   for ( int i = 0 ; i < n ; i ++ ) { out . println ( 0 + \" ▁ \" + i ) ; }   }   }", "import java . awt . Point ; import java . util . * ; import java . io . * ; import static java . lang . Math . * ;   public class PracticeProblem { public 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 FastReader in = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static final int MOD = ( int ) 1e9 + 7 ;   public static void main ( String [ ] args ) { solve ( ) ;   out . close ( ) ; }   public static void solve ( ) { long n = in . nextInt ( ) , k = in . nextInt ( ) ;   if ( ( n * ( n - 1 ) ) / 2 <= k ) { out . println ( \" no ▁ solution \" ) ; return ; }   for ( int i = 0 ; i < n ; i ++ ) { out . println ( 0 + \" ▁ \" + i ) ; }   }   }", "import java . awt . Point ; import java . util . * ; import java . io . * ; import static java . lang . Math . * ;   public class PracticeProblem { public 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 FastReader in = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static final int MOD = ( int ) 1e9 + 7 ;   public static void main ( String [ ] args ) { solve ( ) ;   out . close ( ) ; }   public static void solve ( ) { long n = in . nextInt ( ) , k = in . nextInt ( ) ;   if ( ( n * ( n - 1 ) ) / 2 <= k ) { out . println ( \" no ▁ solution \" ) ; return ; }   for ( int i = 0 ; i < n ; i ++ ) { out . println ( 0 + \" ▁ \" + i ) ; }   }   }", "import java . awt . Point ; import java . util . * ; import java . io . * ; import static java . lang . Math . * ;   public class PracticeProblem { public 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 FastReader in = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static final int MOD = ( int ) 1e9 + 7 ;   public static void main ( String [ ] args ) { solve ( ) ;   out . close ( ) ; }   public static void solve ( ) { long n = in . nextInt ( ) , k = in . nextInt ( ) ;   if ( ( n * ( n - 1 ) ) / 2 <= k ) { out . println ( \" no ▁ solution \" ) ; return ; }   for ( int i = 0 ; i < n ; i ++ ) { out . println ( 0 + \" ▁ \" + i ) ; }   }   }", "import java . io . BufferedReader ; import java . util . Collections ; import java . io . FileNotFoundException ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class hh { public static void hanoitower ( int n , char from , char to , char aux ) { if ( n == 1 ) { System . out . println ( n + \" ▁ \" + from + \" to \" + to ) ; return ; } hanoitower ( n - 1 , from , aux , to ) ; System . out . println ( n + \" ▁ \" + from + \" to \" + to ) ; hanoitower ( n - 1 , aux , to , from ) ; } public static double factorial ( int n ) { if ( n == 0 ) { return 1 ; } else { return n * factorial ( n - 1 ) ; } } public static void main ( String [ ] args ) throws IOException , InterruptedException { PrintWriter pw = new PrintWriter ( System . out ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; long fac = 0 ; fac = ( n ) * ( n - 1 ) ; fac /= 2 ;" ]
[ "n , k = map ( int , input ( ) . split ( ) )   fac = n * ( n - 1 ) / 2 ; if ( fac > k ) : i = 0 while ( i < n ) : print ( 1 , \" ▁ \" , i ) i = i + 1 else : print ( \" no ▁ solution \" ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) if k * 2 >= ( n - 1 ) * n : print ( ' no ▁ solution ' ) else : [ print ( 0 , i ) for i in range ( n ) ] NEW_LINE", "r = lambda x : ( x * ( x + 1 ) ) // 2 a , b = map ( int , input ( ) . split ( ) ) if r ( a - 1 ) <= b : exit ( print ( \" no ▁ solution \" ) ) for i in range ( a ) : print ( 0 , 0 + i ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) tot = ( ( n * ( n - 1 ) ) / 2 )   if tot <= k : print ( \" no ▁ solution \" ) else : for i in range ( 1 , n + 1 ) : print ( 0 , i ) NEW_LINE" ]
codeforces_1396_A
[ "import java . util . * ; public class A_Multiples_of_Length { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int i = 0 ; int ar [ ] = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } System . out . println ( 1 + \" ▁ \" + n ) ; for ( i = 0 ; i < n ; i ++ ) { System . out . print ( ( ( long ) - 1 * ( long ) ar [ i ] * ( long ) n ) + \" ▁ \" ) ; } System . out . println ( ) ; System . out . println ( 1 + \" ▁ \" + 1 ) ; System . out . println ( ( long ) ( n - 1 ) * ( long ) ar [ 0 ] ) ; if ( n == 1 ) { System . out . println ( 1 + \" ▁ \" + 1 ) ; System . out . println ( 0 ) ; return ; } System . out . println ( 2 + \" ▁ \" + n ) ; for ( i = 1 ; i < n ; i ++ ) { System . out . print ( ( long ) ( n - 1 ) * ( long ) ar [ i ] + \" ▁ \" ) ; } } }" ]
[ "from sys import stdin , stdout NEW_LINE input = stdin . readline NEW_LINE def main ( ) : NEW_LINE INDENT t = 1 NEW_LINE for i in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE ai = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( int ( - ai [ 0 ] ) ) NEW_LINE return NEW_LINE DEDENT print ( 1 , n ) NEW_LINE n2 = n * ( n - 1 ) NEW_LINE ai2 = [ n * ( n - 1 - i % ( n - 1 ) ) for i in ai ] NEW_LINE print ( * ai2 ) NEW_LINE ai = [ ai [ i ] + ai2 [ i ] for i in range ( n ) ] NEW_LINE print ( 1 , 1 ) NEW_LINE print ( int ( - ai [ 0 ] ) ) NEW_LINE print ( 2 , n ) NEW_LINE print ( * [ int ( - ai [ i ] ) for i in range ( 1 , n ) ] ) NEW_LINE DEDENT DEDENT main ( ) NEW_LINE", "from bisect import bisect_left NEW_LINE n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( - 1 * l [ 0 ] ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 , n ) NEW_LINE x = n - 1 NEW_LINE for i in range ( n ) : NEW_LINE INDENT t = l [ i ] NEW_LINE if l [ i ] % x : NEW_LINE INDENT l [ i ] += ( x + 1 ) * ( x - t % x ) NEW_LINE DEDENT print ( l [ i ] - t , end = \" ▁ \" ) NEW_LINE DEDENT x = x - 1 NEW_LINE print ( ) NEW_LINE print ( 2 , n ) NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT print ( - 1 * l [ i ] , end = \" ▁ \" ) NEW_LINE DEDENT print ( ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( - 1 * l [ 0 ] ) NEW_LINE DEDENT", "n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( - a [ 0 ] ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE DEDENT elif n == 2 : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( - a [ 0 ] ) NEW_LINE print ( 2 , 2 ) NEW_LINE print ( - a [ 1 ] ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( - a [ 0 ] ) NEW_LINE a [ 0 ] = 0 NEW_LINE b = [ ] NEW_LINE for i in range ( 1 , len ( a ) ) : NEW_LINE INDENT moda = a [ i ] % n NEW_LINE c = moda * ( n - 1 ) NEW_LINE b . append ( c ) NEW_LINE a [ i ] += c NEW_LINE DEDENT print ( 2 , n ) NEW_LINE print ( ' ▁ ' . join ( list ( map ( str , b ) ) ) ) NEW_LINE print ( 1 , n ) NEW_LINE b = [ ] NEW_LINE for i in a : NEW_LINE INDENT b . append ( - i ) NEW_LINE DEDENT print ( ' ▁ ' . join ( list ( map ( str , b ) ) ) ) NEW_LINE DEDENT", "n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( - a [ 0 ] ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE DEDENT elif n == 2 : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( - a [ 0 ] ) NEW_LINE print ( 2 , 2 ) NEW_LINE print ( - a [ 1 ] ) NEW_LINE print ( 1 , 1 ) NEW_LINE print ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 , 1 ) NEW_LINE print ( - a [ 0 ] ) NEW_LINE a [ 0 ] = 0 NEW_LINE b = [ ] NEW_LINE for i in range ( 1 , len ( a ) ) : NEW_LINE INDENT moda = a [ i ] % n NEW_LINE c = moda * ( n - 1 ) NEW_LINE b . append ( c ) NEW_LINE a [ i ] += c NEW_LINE DEDENT print ( 2 , n ) NEW_LINE print ( ' ▁ ' . join ( list ( map ( str , b ) ) ) ) NEW_LINE print ( 1 , n ) NEW_LINE b = [ ] NEW_LINE for i in a : NEW_LINE INDENT b . append ( - i ) NEW_LINE DEDENT print ( ' ▁ ' . join ( list ( map ( str , b ) ) ) ) NEW_LINE DEDENT" ]
codeforces_552_A
[ "import java . math . BigInteger ; import java . text . DecimalFormat ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; @ SuppressWarnings ( \" unused \" ) public class B { public static Scanner scan = new Scanner ( System . in ) ; public static void solve ( ) { int n = scan . nextInt ( ) ; int [ ] [ ] a = new int [ 1005 ] [ 1005 ] ; int cnt = 0 ; for ( int i = 0 ; i < 1000 ; i ++ ) { for ( int j = 0 ; j < 1000 ; j ++ ) { a [ i ] [ j ] = 0 ; } } for ( int k = 0 ; k < n ; k ++ ) { int x1 = scan . nextInt ( ) ; int y1 = scan . nextInt ( ) ; int x2 = scan . nextInt ( ) ; int y2 = scan . nextInt ( ) ; for ( int i = x1 ; i <= x2 ; i ++ ) { for ( int j = y1 ; j <= y2 ; j ++ ) { a [ i ] [ j ] ++ ; } } } for ( int i = 0 ; i <= 100 ; i ++ ) { for ( int j = 0 ; j <= 100 ; j ++ ) { cnt += a [ i ] [ j ] ; } } System . out . println ( cnt ) ; } public static void main ( String [ ] args ) { solve ( ) ; scan . close ( ) ; }   }", "import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; ans = ans + ( Math . abs ( a - c ) + 1 ) * ( Math . abs ( d - b ) + 1 ) ; } System . out . println ( ans ) ; } }", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x1 = in . nextInt ( ) ; int y1 = in . nextInt ( ) ; int x2 = in . nextInt ( ) ; int y2 = in . nextInt ( ) ; ans += ( x2 - x1 + 1 ) * ( y2 - y1 + 1 ) ; } System . out . println ( ans ) ; } }" ]
[ "n = int ( input ( ) ) ans = 0 for _ in range ( n ) : x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ) ) ans += ( x2 - x1 + 1 ) * ( y2 - y1 + 1 ) print ( ans ) NEW_LINE", "n = int ( input ( ) ) r = 0 for i in range ( n ) : x1 , y1 , x2 , y2 = list ( map ( int , input ( ) . split ( ) ) ) r += ( x2 - x1 + 1 ) * ( y2 - y1 + 1 ) print ( r ) NEW_LINE", "r = 0 for i in range ( int ( input ( ) ) ) : x1 , y1 , x2 , y2 = list ( map ( int , input ( ) . split ( ) ) ) r = r + ( x2 - x1 + 1 ) * ( y2 - y1 + 1 ) print ( r ) NEW_LINE", "n = int ( input ( ) ) s = 0 for _ in range ( n ) : x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ) ) s = s + abs ( x2 - x1 + 1 ) * abs ( y2 - y1 + 1 ) print ( s ) NEW_LINE", "def build ( ) : arr = [ ] for i in range ( 100 ) : arr . append ( [ 0 ] * 100 ) return arr       def solve ( arr ) : res = build ( ) for i , v in enumerate ( arr ) : for row in range ( v [ 2 ] - ( v [ 0 ] - 1 ) ) : for col in range ( v [ 3 ] - ( v [ 1 ] - 1 ) ) : res [ row ] [ col ] += 1 tot = 0 for i in res : tot += sum ( i ) return tot       def main ( ) : n = int ( input ( ) ) arr = [ ] for _ in range ( n ) : i = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) arr . append ( i ) print ( solve ( arr ) ) main ( ) NEW_LINE" ]
codeforces_1007_A
[ "# include < bits / stdc ++ . h > # define it register int # define ct const int # define il inlineusing namespace std ; typedef long long ll ; # define rll register ll # define cll const ll # define P 998244353 const int N = 1000005 ; int n , a [ N ] , ans ; multiset < int > S ; namespace io { il char nc ( ) { static char buf [ 100000 ] , * p1 = buf , * p2 = buf ; return p1 == p2 && ( p2 = ( p1 = buf ) + fread ( buf , 1 , 100000 , stdin ) , p1 == p2 ) ? EOF : * p1 ++ ; } template < class I > il void fr ( I & num ) { num = 0 ; register char c = nc ( ) ; it p = 1 ; while ( c < '0' || c > '9' ) c == ' - ' ? p = - 1 , c = nc ( ) : c = nc ( ) ; while ( c >= '0' && c <= '9' ) num = num * 10 + c - '0' , c = nc ( ) ; num *= p ; } } using namespace io ; map < int , int > cn ; int main ( ) { fr ( n ) ; it i ; for ( i = 1 ; i <= n ; ++ i ) fr ( a [ i ] ) , ++ cn [ a [ i ] ] , cn [ a [ i ] ] > ans ? ans = cn [ a [ i ] ] : 0 ;", "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 . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  ", "# include < bits / stdc ++ . h > # define it register int # define ct const int # define il inlineusing namespace std ; typedef long long ll ; # define rll register ll # define cll const ll # define P 998244353 const int N = 1000005 ; int n , a [ N ] , ans ; multiset < int > S ; namespace io { il char nc ( ) { static char buf [ 100000 ] , * p1 = buf , * p2 = buf ; return p1 == p2 && ( p2 = ( p1 = buf ) + fread ( buf , 1 , 100000 , stdin ) , p1 == p2 ) ? EOF : * p1 ++ ; } template < class I > il void fr ( I & num ) { num = 0 ; register char c = nc ( ) ; it p = 1 ; while ( c < '0' || c > '9' ) c == ' - ' ? p = - 1 , c = nc ( ) : c = nc ( ) ; while ( c >= '0' && c <= '9' ) num = num * 10 + c - '0' , c = nc ( ) ; num *= p ; } } using namespace io ; map < int , int > cn ; int main ( ) { fr ( n ) ; it i ; for ( i = 1 ; i <= n ; ++ i ) fr ( a [ i ] ) , ++ cn [ a [ i ] ] , cn [ a [ i ] ] > ans ? ans = cn [ a [ i ] ] : 0 ;" ]
[ "import sysinput = sys . stdin . readline   '''   '''   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( reverse = True ) count = 0 l , r = 0 , 1   while l < n and r < n : if a [ l ] > a [ r ] : l += 1 r += 1 count += 1 else : r += 1   print ( count ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) map = { } for i in arr : if i not in map : map [ i ] = 1 else : map [ i ] += 1 max = 0 for i in map : if map [ i ] > max : max = map [ i ] print ( n - max ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) map = { } for i in arr : if i not in map : map [ i ] = 1 else : map [ i ] += 1 max = 0 for i in map : if map [ i ] > max : max = map [ i ] print ( n - max ) 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 )   NEW_LINE" ]
codeforces_253_B
[ "import java . io . BufferedWriter ; import java . io . ByteArrayInputStream ; import java . io . FileInputStream ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ;   public class Main { private static final long MOD = ( long ) 1e9 + 7 ; static InputStream is ; static PrintWriter out ; static String INPUT = \" \" ; static int lenbuf = 0 , ptrbuf = 0 ; private static byte [ ] inbuf = new byte [ 1024 ] ; static boolean readFile = true ;", "import java . io . BufferedWriter ; import java . io . ByteArrayInputStream ; import java . io . FileInputStream ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ;   public class Main { private static final long MOD = ( long ) 1e9 + 7 ; static InputStream is ; static PrintWriter out ; static String INPUT = \" \" ; static int lenbuf = 0 , ptrbuf = 0 ; private static byte [ ] inbuf = new byte [ 1024 ] ; static boolean readFile = true ;", "import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . FileReader ; import java . io . FileWriter ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Deque ; import java . util . LinkedList ; import java . util . StringTokenizer ;   public class Main { static StringTokenizer st ; static BufferedReader in ;   public static void main ( String [ ] args ) throws IOException { in = new BufferedReader ( new FileReader ( \" input . txt \" ) ) ; PrintWriter pw = new PrintWriter ( new BufferedWriter ( new FileWriter ( \" output . txt \" ) ) ) ; int n = nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = nextInt ( ) ; } Arrays . sort ( a ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int j = upper_bound ( a , i , 2 * a [ i ] ) ; min = Math . min ( min , i + n - j ) ; } pw . println ( min ) ;   pw . close ( ) ; }   private static int upper_bound ( int [ ] a , int l , int target ) { int r = a . length ; while ( l < r ) { int mid = l + ( r - l ) / 2 ; if ( a [ mid ] > target ) { r = mid ; } else { l = mid + 1 ; } } return l ; }   private static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; }   private static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; }   private static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; }   private static String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( in . readLine ( ) ) ; } return st . nextToken ( ) ; } }" ]
[ "file = open ( ' input . txt ' , ' r ' ) n = int ( file . readline ( ) ) - 1 lis = sorted ( list ( map ( int , file . readline ( ) . split ( ) ) ) ) i , j = 0 , 0 for i in range ( n + 1 ) : if lis [ i ] <= lis [ j ] * 2 : continue j += 1 open ( \" output . txt \" , \" w \" ) . write ( str ( j ) ) NEW_LINE", "from math import ceil as cefrom collections import Counter as cc   import syssys . stdin = open ( \" input . txt \" ) sys . stdout = open ( \" output . txt \" , ' w ' )   n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) d = dict ( cc ( l ) ) l = sorted ( list ( d . items ( ) ) , key = lambda x : x [ 0 ] )   co = [ 0 ] * 5001j = 0       for i in range ( 1 , 5001 ) : if j < len ( l ) and l [ j ] [ 0 ] == i : co [ i ] += l [ j ] [ 1 ] j += 1 co [ i ] += co [ i - 1 ] NEW_LINE", "f = open ( ' input . txt ' , ' r ' ) n = int ( f . readline ( ) ) c = sorted ( map ( int , f . readline ( ) . split ( ) ) ) j , v = 0 , n - 1 for i in range ( n ) : while j < n - 1 and 2 * c [ i ] >= c [ j + 1 ] : j += 1 v = min ( v , n + i - j - 1 ) open ( ' output . txt ' , ' w ' ) . write ( str ( v ) ) NEW_LINE", "import bisectimport syssys . stdin = open ( ' input . txt ' , ' r ' ) sys . stdout = open ( ' output . txt ' , ' w ' ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) ans = 10 ** 18 for i in range ( n ) : x = a [ i ] * 2 idx = bisect . bisect_right ( a , x ) cnt = i + ( n - idx ) ans = min ( ans , cnt ) print ( ans ) NEW_LINE", "file = open ( ' input . txt ' , ' r ' ) n = int ( file . readline ( ) ) - 1 lis = sorted ( list ( map ( int , file . readline ( ) . split ( ) ) ) ) i , j = 0 , 0 for i in range ( n + 1 ) : if lis [ i ] <= lis [ j ] * 2 : continue j += 1 out = n - i + jprint ( out ) open ( \" output . txt \" , \" w \" ) . write ( str ( out ) ) NEW_LINE" ]
codeforces_922_A
[ "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ;   public class CloningToys { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] input = br . readLine ( ) . split ( \" ▁ \" ) ; int copied = Integer . parseInt ( input [ 0 ] ) ; int original = Integer . parseInt ( input [ 1 ] ) ; if ( original <= 0 ) { System . out . println ( \" No \" ) ; } else if ( original == 1 ) { if ( copied == 0 ) { System . out . println ( \" Yes \" ) ; } else { System . out . println ( \" No \" ) ; } } else { original -- ; copied -= original ; if ( copied % 2 == 0 && copied >= 0 ) { System . out . println ( \" Yes \" ) ; } else { System . out . println ( \" No \" ) ; } } } }", "import java . util . * ;   public class CodeForces922A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; int y = input . nextInt ( ) ; y -- ; x -= y ; if ( x % 2 == 0 && x >= 0 && y > 0 || y == 0 && x == 0 ) { System . out . println ( \" Yes \" ) ; } else { System . out . println ( \" No \" ) ; } } }", "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 P922A {   public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long desiredClones = s . nextLong ( ) ; long desiredOriginals = s . nextLong ( ) ; long startingClones = desiredOriginals - 1 ; long neededClones = desiredClones - startingClones ; if ( neededClones != 0 ) { if ( neededClones > 0 && neededClones % 2 == 0 && startingClones >= 1 ) { System . out . println ( \" Yes \" ) ; } else { System . out . println ( \" No \" ) ; } } else { if ( desiredOriginals >= 1 ) { System . out . println ( \" Yes \" ) ; } else { System . out . println ( \" No \" ) ; } } } }", "import java . util . Scanner ;   public class CloningToys { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) , y = in . nextInt ( ) - 1 ;   in . close ( ) ; System . out . println ( ( y > 0 && x >= y && ( x - y ) % 2 == 0 ) || ( y == 0 && x == y ) ? \" Yes \" : \" No \" ) ; } }" ]
[ "x , y = map ( int , input ( ) . split ( ) ) if ( y == 0 ) or ( y == 1 and x != 0 ) : print ( \" No \" ) else : if ( x - ( y - 1 ) ) % 2 == 0 and x >= ( y - 1 ) and y != 0 : print ( \" Yes \" ) else : print ( \" No \" ) NEW_LINE", "x , y = map ( int , input ( ) . split ( ) ) a = 1 b = 0   if ( y == 0 or ( y == 1 and x > 0 ) ) : print ( \" No \" ) exit ( )   else : a = a + a * ( y - 1 ) b = b + y - 1   x = x - b   if ( x % 2 == 0 and x >= 0 ) : print ( \" Yes \" )   else : print ( \" No \" ) NEW_LINE", "x , y = map ( int , input ( ) . split ( ) ) if y == 0 : print ( ' No ' ) exit ( 0 ) if y == 1 : if x == 0 : print ( ' Yes ' ) else : print ( ' No ' ) exit ( 0 ) print ( ' Yes ' if x - y + 1 >= 0 and ( x - y + 1 ) % 2 == 0 else ' No ' ) NEW_LINE", "x , y = map ( int , input ( ) . split ( ) )   if y == 0 : print ( ' No ' ) exit ( 0 )   if y == 1 : if x == 0 : print ( ' Yes ' ) else : print ( ' No ' ) exit ( 0 )   print ( ' Yes ' if x >= y - 1 and ( x - y + 1 ) % 2 == 0 else ' No ' ) NEW_LINE" ]
codeforces_209_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class R {   public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; long a [ ] = new long [ 3 ] ; a [ 0 ] = fr . nextLong ( ) ; a [ 1 ] = fr . nextLong ( ) ; a [ 2 ] = fr . nextLong ( ) ; Arrays . parallelSort ( a ) ; long result = 0 ; if ( a [ 0 ] == 0 && a [ 1 ] == 1 ) { System . out . println ( a [ 2 ] ) ; } else if ( a [ 0 ] == a [ 1 ] ) { System . out . println ( a [ 0 ] ) ; } else if ( a [ 2 ] == a [ 1 ] ) { System . out . println ( a [ 2 ] ) ; } else if ( ( a [ 1 ] - a [ 0 ] ) % 2 == 1 ) { result += a [ 2 ] - a [ 1 ] ; result += a [ 1 ] ; System . out . println ( result ) ; } else { result += ( a [ 1 ] - a [ 0 ] ) / 2 ; result += ( a [ 1 ] + a [ 0 ] ) / 2 ; System . out . println ( result ) ; } }    static class FastReader { BufferedReader bf ; StringTokenizer st ;   public FastReader ( ) { bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ;", "import java . util . Scanner ;   public class Pixel { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long i , j , k , n , a , b , c , big , middle , small , sum ; boolean is ; while ( input . hasNext ( ) ) { a = input . nextLong ( ) ; b = input . nextLong ( ) ; c = input . nextLong ( ) ; sum = 0 ; is = false ;   big = ( a >= b ) ? ( ( a >= c ) ? a : c ) : ( ( b >= c ) ? b : c ) ; small = ( a >= b ) ? ( ( b >= c ) ? c : b ) : ( ( a >= c ) ? c : a ) ; middle = a > b ? ( c > a ? a : ( b > c ) ? b : c ) : ( c > b ? b : a > c ? a : c ) ;  ", "import java . util . Arrays ; import java . util . Scanner ;   public class Main { static Scanner input = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { long [ ] data = new long [ 3 ] ; data [ 0 ] = input . nextLong ( ) ; data [ 1 ] = input . nextLong ( ) ; data [ 2 ] = input . nextLong ( ) ; Arrays . sort ( data ) ; if ( ( data [ 1 ] - data [ 0 ] ) % 2 == 0 ) { System . out . println ( data [ 1 ] ) ; } else { System . out . println ( data [ 2 ] ) ; } } }", "import java . util . Arrays ; import java . util . Scanner ;   public class Main { static long [ ] a = new long [ 3 ] ; public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; a [ 0 ] = reader . nextLong ( ) ; a [ 1 ] = reader . nextLong ( ) ; a [ 2 ] = reader . nextLong ( ) ; Arrays . sort ( a ) ; System . out . println ( ( a [ 1 ] - a [ 0 ] ) % 2 == 0 ? a [ 1 ] : a [ 2 ] ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class R {   public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; long a [ ] = new long [ 3 ] ; a [ 0 ] = fr . nextLong ( ) ; a [ 1 ] = fr . nextLong ( ) ; a [ 2 ] = fr . nextLong ( ) ; Arrays . parallelSort ( a ) ; long result = 0 ; if ( a [ 0 ] == 0 && a [ 1 ] == 1 ) { System . out . println ( a [ 2 ] ) ; } else if ( a [ 0 ] == a [ 1 ] ) { System . out . println ( a [ 0 ] ) ; } else if ( a [ 2 ] == a [ 1 ] ) { System . out . println ( a [ 2 ] ) ; } else if ( ( a [ 1 ] - a [ 0 ] ) % 2 == 1 ) { result += a [ 2 ] - a [ 1 ] ; result += a [ 1 ] ; System . out . println ( result ) ; } else { result += ( a [ 1 ] - a [ 0 ] ) / 2 ; result += ( a [ 1 ] + a [ 0 ] ) / 2 ; System . out . println ( result ) ; } }    static class FastReader { BufferedReader bf ; StringTokenizer st ;   public FastReader ( ) { bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ;" ]
[ "import sysinput = sys . stdin . readlinel = input ( ) . split ( ) li = [ int ( i ) for i in l ] maxa = 10 ** 18 li . sort ( ) if ( ( li [ 2 ] - li [ 1 ] ) % 2 == 0 ) : maxa = min ( maxa , li [ 2 ] ) if ( ( li [ 2 ] - li [ 0 ] ) % 2 == 0 ) : maxa = min ( maxa , li [ 2 ] ) if ( ( li [ 1 ] - li [ 0 ] ) % 2 == 0 ) : maxa = min ( maxa , li [ 1 ] ) if ( maxa == 10 ** 18 ) : print ( - 1 ) else : print ( maxa ) NEW_LINE", "a = list ( map ( int , input ( ) . split ( ) ) ) def calc ( a ) : return int ( ( ( ( a [ 1 ] - a [ 0 ] ) + ( a [ 1 ] + a [ 0 ] ) ) / 2 ) ) a . sort ( ) if a [ 1 ] % 2 == 0 and a [ 0 ] % 2 == 0 : print ( calc ( a ) ) elif a [ 1 ] % 2 == 0 or a [ 0 ] % 2 == 0 : print ( a [ 2 ] ) else : print ( calc ( a ) ) NEW_LINE", "a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) if int ( a [ 1 ] % 2 == 0 ) + int ( a [ 0 ] % 2 == 0 ) == 1 : print ( a [ 2 ] ) else : print ( int ( ( ( ( a [ 1 ] - a [ 0 ] ) + ( a [ 1 ] + a [ 0 ] ) ) / 2 ) ) ) NEW_LINE", "def pixel ( input ) : red , green , blue = input . split ( ) red = int ( red ) green = int ( green ) blue = int ( blue )   plist = [ red , green , blue ] plist . sort ( )   lowestChet = is_chet ( plist [ 0 ] ) midChet = is_chet ( plist [ 1 ] )   if ( ( midChet + lowestChet ) == 2 ) or ( ( midChet + lowestChet ) == 0 ) : return plist [ 1 ] else : return plist [ 2 ]     def is_chet ( n ) : return 1 if n % 2 == 0 else 0 print ( pixel ( input ( ) ) ) NEW_LINE" ]
codeforces_117_A
[ "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . StringTokenizer ;   public class Main { public static void main ( String [ ] args )", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Aorangy1 {   static int m ;   static long f ( long v , int floor ) { if ( floor == 1 ) { return ( v - 1 ) * ( m - 1 ) * 2 ; } if ( floor == m ) { return ( m - 1 ) + ( ( v - 1 ) * ( m - 1 ) * 2 ) ; } long ret = 0 ; long even = v / 2 ; long odd = v / 2 ; if ( v % 2 == 0 ) even -- ; long sumEven = even * ( m - floor ) * 2 ; long sumOdd = odd * ( floor - 1 ) * 2 ; sumOdd = sumOdd - ( floor - 1 ) ; ret = sumEven + sumOdd ; return ret ; }   public static void main ( String [ ] args ) throws IOException {", "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . StringTokenizer ;   public class Main {   public static void main ( String [ ] args ) { InputReader in = new InputReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;  " ]
[ "n , m = map ( int , input ( ) . split ( ) ) k = 2 * ( m - 1 ) p = [ 0 ] * nfor i in range ( n ) : s , f , t = map ( int , input ( ) . split ( ) ) d = t % k if s < f : p [ i ] = ( k if s <= d else 0 ) + f - 1 + t - d elif f < s : p [ i ] = ( k if d + s > k + 1 else 0 ) + k + 1 - f + t - d else : p [ i ] = tprint ( ' \\n ' . join ( map ( str , p ) ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) k = 2 * ( m - 1 ) for i in range ( n ) : s , f , t = map ( int , input ( ) . split ( ) ) d = t % k if s < f : print ( k * ( s <= d ) + f - 1 + t - d ) elif f < s : print ( k * ( d + s > k + 1 ) + k + 1 - f + t - d ) else : print ( t ) NEW_LINE" ]
codeforces_425_B
[ "import java . util . * ; import java . io . * ; public class Bdiv1 { public static void main ( String ... thegame ) { FastScanner sc = new FastScanner ( ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] [ ] map = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { map [ i ] [ j ] = sc . nextInt ( ) ; } } if ( n > 10 ) { int res = k + 1 ; for ( int t = 0 ; t < n ; t ++ ) {", "import java . io . * ; import java . util . * ; import java . util . stream . * ;   public class a implements Runnable { public static void main ( String [ ] args ) { new Thread ( null , new a ( ) , \" process \" , 1 << 26 ) . start ( ) ; } public void run ( ) { FastReader scan = new FastReader ( ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ;", "import java . io . ByteArrayInputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . nio . charset . StandardCharsets ; import java . util . Arrays ; import java . util . InputMismatchException ;   public class B425 {   static class Solver {   int N , M , K , grid [ ] [ ] , g2 [ ] [ ] ;   int fix ( int [ ] model , int [ ] cand , int cap ) {" ]
[ "from functools import * read_line = lambda : [ int ( i ) for i in input ( ) . split ( ) ] n , m , k = read_line ( ) a = [ read_line ( ) for i in range ( n ) ] if n < m : n , m , a = m , n , zip ( * a ) xs = [ reduce ( lambda x , b : 2 * x + b , y ) for y in a ] minm = lambda a : min ( a , m - a ) work = lambda y : sum ( minm ( bin ( x ^ y ) . count ( '1' ) ) for x in xs ) ans = min ( map ( work , xs if m > k else range ( 1 << m ) ) ) print ( ans if ans <= k else - 1 ) NEW_LINE", "from functools import *   read_line = lambda : [ int ( i ) for i in input ( ) . split ( ) ]   n , m , k = read_line ( ) a = [ read_line ( ) for i in range ( n ) ] if n < m : n , m , a = m , n , zip ( * a )   xs = [ reduce ( lambda x , b : 2 * x + b , y ) for y in a ] minm = lambda a : min ( a , m - a ) work = lambda y : sum ( minm ( bin ( x ^ y ) . count ( '1' ) ) for x in xs ) ans = min ( map ( work , xs if m > k else range ( 1 << m ) ) )   print ( ans if ans <= k else - 1 )   NEW_LINE", "from functools import *   read_line = lambda : [ int ( i ) for i in input ( ) . split ( ) ]   n , m , k = read_line ( ) a = [ read_line ( ) for i in range ( n ) ] if n < m : n , m , a = m , n , zip ( * a )   xs = [ reduce ( lambda x , b : 2 * x + b , y ) for y in a ] minm = lambda a : min ( a , m - a ) work = lambda y : sum ( minm ( bin ( x ^ y ) . count ( '1' ) ) for x in xs ) ans = min ( map ( work , xs if m > k else range ( 1 << m ) ) )   print ( ans if ans <= k else - 1 )   NEW_LINE", "from functools import *   read_line = lambda : [ int ( i ) for i in input ( ) . split ( ) ]   n , m , k = read_line ( ) a = [ read_line ( ) for i in range ( n ) ] if n < m : n , m , a = m , n , zip ( * a )   xs = [ reduce ( lambda x , b : 2 * x + b , y ) for y in a ] minm = lambda a : min ( a , m - a ) work = lambda y : sum ( minm ( bin ( x ^ y ) . count ( '1' ) ) for x in xs ) ans = min ( map ( work , xs if m > k else range ( 1 << m ) ) )   print ( ans if ans <= k else - 1 )   NEW_LINE", "from functools import *   read_line = lambda : [ int ( i ) for i in input ( ) . split ( ) ]   n , m , k = read_line ( ) a = [ read_line ( ) for i in range ( n ) ] if n < m : n , m , a = m , n , zip ( * a )   xs = [ reduce ( lambda x , b : 2 * x + b , y ) for y in a ] minm = lambda a : min ( a , m - a ) work = lambda y : sum ( minm ( bin ( x ^ y ) . count ( '1' ) ) for x in xs ) ans = min ( map ( work , xs if m > k else range ( 1 << m ) ) )   print ( ans if ans <= k else - 1 )         NEW_LINE" ]
codeforces_1195_B
[ "import java . util . * ;   public class CF102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; long low = 0 ; long high = n ; while ( low <= high ) { long mid = low + ( high - low ) / 2 ;", "  import java . sql . SQLOutput ; import java . util . * ; import java . lang . * ; import java . io . * ;   public class codeforces { 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 ( ) ; long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; long x = ( long ) ( - 3 + ( Math . sqrt ( 9 + 8 * ( n + k ) ) ) ) / 2 ; System . out . println ( n - x ) ;   } }", "import java . util . * ; public class Sport_Mafia { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; long sum = 0 ; long i = 1 ; for ( i = 1 ; i <= n ; i ++ ) { sum = i * ( i + 1 ) ; sum = sum / 2 ; sum -= ( n - i ) ; if ( sum == k ) { System . out . println ( n - i ) ; break ; } } } }", "import java . util . * ; import java . io . * ; public class main { public static void main ( String [ ] args ) { FastScanner scan = new main ( ) . new FastScanner ( ) ; long a = scan . nextLong ( ) ; long b = scan . nextLong ( ) ; long ans = ( long ) ( - 3 + Math . sqrt ( 9 + 8 * ( a + b ) ) ) / 2 ; System . out . print ( a - ans ) ; } 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 ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }" ]
[ "n , k = map ( int , input ( ) . split ( ) ) i = 0j = nwhile ( i <= j ) : a = ( i + j ) // 2 s = ( n - a ) * ( n - a + 1 ) // 2 if ( s - a == k ) : print ( a ) break elif ( s - a > k ) : i = a else : j = a NEW_LINE", "n , k = map ( int , input ( ) . split ( ) )   c = 0 i = 1 while 1 : c += i if n - i == c - k : print ( n - i ) break i += 1   NEW_LINE", "n , k = list ( map ( int , input ( ) . split ( ) ) )   for t in range ( 1 , n + 1 ) : total = t * ( t + 1 ) // 2 eat = total - k if eat + t == n : print ( eat ) break NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) for r in range ( 1 , 10 ** 5 ) : if ( r * ( r + 1 ) ) // 2 + r == k + n : print ( n - r ) exit ( ) NEW_LINE", "def bs ( l , h ) : while l <= h : m = ( l + h ) // 2 if gf ( m ) == 0 : return m if gf ( m ) == 1 : l = m + 1 else : h = m - 1   def gf ( x ) : if ( n - x ) * ( n - x + 1 ) // 2 - x == k : return 0 if ( n - x ) * ( n - x + 1 ) / 2 - x > k : return 1 return - 1     n , k = map ( int , input ( ) . split ( ) ) print ( bs ( 0 , n ) ) NEW_LINE" ]
codeforces_1063_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Deque ; import java . util . LinkedList ; import java . util . StringTokenizer ;   public class CF1063B { static final int [ ] dx = { + 1 , - 1 , 0 , 0 } ; static final int [ ] dy = { 0 , 0 , + 1 , - 1 } ;   public static void main ( String [ ] args ) throws IOException { FastScanner sc = new FastScanner ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int xS = sc . nextInt ( ) - 1 , yS = sc . nextInt ( ) - 1 ; int l = sc . nextInt ( ) , r = sc . nextInt ( ) ; boolean [ ] g = new boolean [ n * m ] ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] line = sc . nextToken ( ) . toCharArray ( ) ; for ( int j = 0 ; j < m ; j ++ ) if ( line [ j ] == ' . ' ) g [ i * m + j ] = true ; }  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Deque ; import java . util . LinkedList ; import java . util . StringTokenizer ;   public class CF1063B { static final int [ ] dx = { + 1 , - 1 , 0 , 0 } ; static final int [ ] dy = { 0 , 0 , + 1 , - 1 } ;   public static void main ( String [ ] args ) throws IOException { FastScanner sc = new FastScanner ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int xS = sc . nextInt ( ) - 1 , yS = sc . nextInt ( ) - 1 ; int l = sc . nextInt ( ) , r = sc . nextInt ( ) ; boolean [ ] [ ] g = new boolean [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] line = sc . nextToken ( ) . toCharArray ( ) ; for ( int j = 0 ; j < m ; j ++ ) if ( line [ j ] == ' . ' ) g [ i ] [ j ] = true ; }  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Deque ; import java . util . LinkedList ; import java . util . StringTokenizer ;   public class CF1063B { static final int [ ] dx = { + 1 , - 1 , 0 , 0 } ; static final int [ ] dy = { 0 , 0 , + 1 , - 1 } ;   public static void main ( String [ ] args ) throws IOException { FastScanner sc = new FastScanner ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int xS = sc . nextInt ( ) - 1 , yS = sc . nextInt ( ) - 1 ; int l = sc . nextInt ( ) , r = sc . nextInt ( ) ; boolean [ ] [ ] grid = new boolean [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] line = sc . nextToken ( ) . toCharArray ( ) ; for ( int j = 0 ; j < m ; j ++ ) if ( line [ j ] == ' . ' ) grid [ i ] [ j ] = true ; }  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Deque ; import java . util . LinkedList ; import java . util . StringTokenizer ;   public class CF1063B { static final int [ ] dx = { + 1 , - 1 , 0 , 0 } ; static final int [ ] dy = { 0 , 0 , + 1 , - 1 } ;   public static void main ( String [ ] args ) throws IOException { FastScanner sc = new FastScanner ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int xS = sc . nextInt ( ) - 1 , yS = sc . nextInt ( ) - 1 ; int l = sc . nextInt ( ) , r = sc . nextInt ( ) ; boolean [ ] g = new boolean [ n * m ] ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] line = sc . nextToken ( ) . toCharArray ( ) ; for ( int j = 0 ; j < m ; j ++ ) if ( line [ j ] == ' . ' ) g [ i * m + j ] = true ; }  " ]
[ "from collections import dequen , m = [ int ( x ) for x in input ( ) . split ( ) ] x , y = [ int ( x ) for x in input ( ) . split ( ) ] left , right = [ int ( x ) for x in input ( ) . split ( ) ] s = [ ] ans = 0 d = [ None ] * 2007 for i in range ( 0 , 2007 ) : d [ i ] = [ 0 for j in range ( 0 , 2007 ) ]   for i in range ( 0 , n ) : s . append ( input ( ) )   q = deque ( )   q . append ( [ x - 1 , y - 1 , left , right ] )   while ( len ( q ) ) : v = q [ 0 ] q . popleft ( ) if ( v [ 0 ] < 0 or v [ 0 ] >= n or v [ 1 ] < 0 or v [ 1 ] >= m or d [ v [ 0 ] ] [ v [ 1 ] ] == 1 or v [ 2 ] < 0 or v [ 3 ] < 0 or s [ v [ 0 ] ] [ v [ 1 ] ] == ' * ' ) : continue d [ v [ 0 ] ] [ v [ 1 ] ] = 1 q . appendleft ( [ v [ 0 ] + 1 , v [ 1 ] , v [ 2 ] , v [ 3 ] ] ) q . appendleft ( [ v [ 0 ] - 1 , v [ 1 ] , v [ 2 ] , v [ 3 ] ] ) q . append ( [ v [ 0 ] , v [ 1 ] + 1 , v [ 2 ] , v [ 3 ] - 1 ] ) q . append ( [ v [ 0 ] , v [ 1 ] - 1 , v [ 2 ] - 1 , v [ 3 ] ] ) for i in range ( 0 , n ) : for j in range ( 0 , m ) : ans += d [ i ] [ j ]   print ( ans ) NEW_LINE", "import sysimport mathfrom collections import defaultdictfrom collections import deque   MAXNUM = math . infMINNUM = - 1 * math . infASCIILOWER = 97 ASCIIUPPER = 65     def getInt ( ) : return int ( sys . stdin . readline ( ) . rstrip ( ) )     def getInts ( ) : return map ( int , sys . stdin . readline ( ) . rstrip ( ) . split ( \" ▁ \" ) )     def getString ( ) : return sys . stdin . readline ( ) . rstrip ( )     def printOutput ( ans ) : sys . stdout . write ( ) pass     def successors ( grid , curPos , moves ) : r , c = curPos x , y = moves   succStates = [ ] for a , b in [ ( 1 , 0 ) , ( - 1 , 0 ) ] : if ( 0 <= r + a < len ( grid ) and 0 <= c + b <= len ( grid [ 0 ] ) and grid [ r + a ] [ c + b ] != \" * \" ) : succStates . append ( ( ( r + a , c + b ) , moves ) )   NEW_LINE" ]
codeforces_1120_A
[ "import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { PrintWriter out = new PrintWriter ( System . out ) ;" ]
[ "import sysfrom collections import Counterinput = sys . stdin . buffer . readline   m , k , n , s = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = Counter ( map ( int , input ( ) . split ( ) ) )   counts = Counter ( ) unsatisfied = len ( b ) to_remove = m + 1 mn_len = m + 1 remove_idx = - 1   j = 0 for i in range ( m ) : while j < m and unsatisfied != 0 : counts [ a [ j ] ] += 1 if counts [ a [ j ] ] == b [ a [ j ] ] : unsatisfied -= 1   j += 1   if unsatisfied == 0 : curr_remove = i % k + max ( 0 , j - i - k ) if curr_remove < to_remove : to_remove = curr_remove mn_len = j - i remove_idx = i   if counts [ a [ i ] ] == b [ a [ i ] ] : unsatisfied += 1   counts [ a [ i ] ] -= 1   if m - to_remove < n * k : print ( - 1 ) else : print ( to_remove )   indexes = { } for i in range ( remove_idx , remove_idx + mn_len ) : if a [ i ] in indexes : indexes [ a [ i ] ] . append ( i + 1 ) else : indexes [ a [ i ] ] = [ i + 1 ]   removed = list ( range ( 1 , remove_idx % k + 1 ) ) to_remove -= remove_idx % k   for i in indexes : if to_remove == 0 : break else : removed . extend ( indexes [ i ] [ : min ( len ( indexes [ i ] ) - b [ i ] , to_remove ) ] ) to_remove -= min ( len ( indexes [ i ] ) - b [ i ] , to_remove )   print ( * removed )             NEW_LINE", "def main ( ) : m , k , n , s = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE" ]
codeforces_908_A
[ "import java . util . * ;   public class Main {   public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; String cards = sc . next ( ) ; sc . close ( ) ;   char [ ] str = cards . toCharArray ( ) ;   int min = 0 ;   for ( int i = 0 ; i < str . length ; i ++ ) { if ( str [ i ] == ' a ' || str [ i ] == ' e ' || str [ i ] == ' i ' || str [ i ] == ' u ' || str [ i ] == ' o ' ) { min ++ ; } else if ( str [ i ] == '1' || str [ i ] == '3' || str [ i ] == '5' || str [ i ] == '7' || str [ i ] == '9' ) { min ++ ; } }   System . out . println ( min ) ;   }   }", "import java . util . Scanner ;   public class NewYearAndCountingCards {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; int c = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' a ' || s . charAt ( i ) == ' e ' || s . charAt ( i ) == ' i ' || s . charAt ( i ) == ' o ' || s . charAt ( i ) == ' u ' || s . charAt ( i ) == '1' || s . charAt ( i ) == '3' || s . charAt ( i ) == '5' || s . charAt ( i ) == '7' || s . charAt ( i ) == '9' ) { c ++ ; } } System . out . println ( c ) ; }   }", "import java . util . Scanner ;   public class CountCards { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; in . close ( ) ; int c = 0 , i ;   for ( i = 0 ; i < s . length ( ) ; i ++ ) { char v = s . charAt ( i ) ; if ( v == ' a ' || v == ' e ' || v == ' i ' || v == ' o ' || v == ' u ' || ( Character . isDigit ( v ) && Integer . parseInt ( String . valueOf ( v ) ) % 2 != 0 ) ) { c ++ ; } } System . out . println ( c ) ; } }", "import java . lang . * ; import java . util . * ; import java . io . * ; public class test { Scanner sc = new Scanner ( System . in ) ; PrintWriter pr = new PrintWriter ( System . out , true ) ; public static void main ( String ... args ) { test c = new test ( ) ; c . prop ( ) ; } public void prop ( ) { String s = sc . next ( ) ; int n = s . length ( ) , count = 0 , count2 = 0 ; for ( int i = 0 ; i < n ; ++ i ) { char c = s . charAt ( i ) ; if ( c == ' a ' || c == ' e ' || c == ' i ' || c == ' o ' || c == ' u ' || c == '1' || c == '3' || c == '5' || c == '7' || c == '9' ) ++ count ; } pr . println ( count ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ;    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 ( in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( InputReader in , PrintWriter out ) { String s = in . next ( ) ; int ans = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( pd ( s . charAt ( i ) ) ) ans ++ ; } out . println ( ans ) ; } static boolean pd ( char c ) { if ( c <= '9' && c >= '0' ) { if ( ( int ) ( c - '0' ) % 2 == 1 ) return true ; } if ( c == ' a ' || c == ' e ' || c == ' i ' || c == ' o ' || c == ' u ' ) return true ; return false ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreElements ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }" ]
[ "import math   def main_function ( ) : output_list = [ ] s = input ( ) count = 0 vowels = [ \" a \" , \" e \" , \" o \" , \" i \" , \" u \" , \"1\" , \"3\" , \"5\" , \"7\" , \"9\" ] hash_list = [ 0 for i in vowels ] dict = { } for i in range ( len ( vowels ) ) : dict [ vowels [ i ] ] = i for i in s : if i in vowels : hash_list [ dict [ i ] ] += 1 return sum ( hash_list )               print ( main_function ( ) ) NEW_LINE", "vowels_and_even_numbers = [ '1' , '3' , '5' , '7' , '9' , ' a ' , ' e ' , ' i ' , ' o ' , ' u ' ] minimum = 0 s = input ( )   for char in s : if char in vowels_and_even_numbers : minimum += 1   print ( minimum ) NEW_LINE", "cards = input ( ) numbers = \"0123456789\" even = \"02468\" vowals = \" aeiou \" count = 0   for s in range ( len ( cards ) ) : if cards [ s ] in vowals : count += 1 else : if cards [ s ] in numbers and cards [ s ] not in even : count += 1   print ( count ) NEW_LINE", "a = input ( )   lista = [ '1' , '3' , '5' , '7' , '9' , ' a ' , ' e ' , ' i ' , ' o ' , ' u ' ]   i = 0   for x in range ( len ( a ) ) : if a [ x ] in lista : i = i + 1   print ( i ) NEW_LINE", "import sys   def main ( ) : s = sys . stdin . read ( ) . strip ( ) return sum ( i in set ( ' aeiou13579' ) for i in s ) print ( main ( ) ) NEW_LINE" ]
codeforces_1490_B
[ "import java . util . Arrays ; import java . util . Scanner ; public class _0640BalancedRemainders { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cases = sc . nextInt ( ) ; while ( cases > 0 ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ sc . nextInt ( ) % 3 ] ++ ; } int count = 0 ; while ( arr [ 0 ] != arr [ 1 ] || arr [ 0 ] != arr [ 2 ] ) { for ( int i = 0 ; i < 3 ; i ++ ) { if ( arr [ i ] > n / 3 ) { arr [ i ] -- ; arr [ ( i + 1 ) % 3 ] ++ ; count ++ ; } } } System . out . println ( count ) ; cases -- ; } } }", "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; int res = 0 ; int [ ] cnt = new int [ 3 ] ; for ( int i = 0 ; i < n ; i ++ ) cnt [ a [ i ] % 3 ] ++ ; while ( Math . min ( cnt [ 0 ] , Math . min ( cnt [ 1 ] , cnt [ 2 ] ) ) != n / 3 ) { for ( int i = 0 ; i < 3 ; i ++ ) if ( cnt [ i ] > n / 3 ) { res ++ ; cnt [ i ] -- ; cnt [ ( i + 1 ) % 3 ] ++ ; } } System . out . println ( res ) ; } } }", "import java . util . * ; public class S { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t -- != 0 ) { int n = scan . nextInt ( ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < n ; i ++ ) { int num = scan . nextInt ( ) ; arr [ num % 3 ] ++ ; } int maxi = - 1 , max = - 1 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( arr [ i ] > max ) { maxi = i ; max = arr [ i ] ; } } int ans = ( arr [ maxi ] - ( n / 3 ) ) ; arr [ ( maxi + 1 ) % 3 ] += ans ; if ( arr [ ( maxi + 1 ) % 3 ] > arr [ ( maxi + 2 ) % 3 ] ) ans += ( ( n / 3 ) - arr [ ( maxi + 2 ) % 3 ] ) ; else ans += 2 * ( ( arr [ ( maxi + 2 ) % 3 ] ) - ( n / 3 ) ) ; System . out . println ( ans ) ; } } }", "import java . util . Scanner ; public class Solution_2 { public static void main ( String [ ] args ) { int t , n ; Scanner sc = new Scanner ( System . in ) ; t = sc . nextInt ( ) ; while ( t -- > 0 ) { n = sc . nextInt ( ) ; int [ ] c = new int [ 3 ] ; for ( int i = 0 ; i < n ; i ++ ) { c [ sc . nextInt ( ) % 3 ] ++ ; } System . out . println ( solve ( c , n / 3 ) ) ; } } static int solve ( int [ ] c , int b ) { int res = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { if ( c [ 0 ] > b ) { res += c [ 0 ] - b ; c [ 1 ] += c [ 0 ] - b ; c [ 0 ] = b ; } if ( c [ 1 ] > b ) { res += c [ 1 ] - b ; c [ 2 ] += c [ 1 ] - b ; c [ 1 ] = b ; } if ( c [ 2 ] > b ) { res += c [ 2 ] - b ; c [ 0 ] += c [ 2 ] - b ; c [ 2 ] = b ; } } return res ; } }", "import java . util . * ; public class CodeForces1490B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ; for ( int j = 0 ; j < t ; j ++ ) { int n = input . nextInt ( ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < n ; i ++ ) { int c = input . nextInt ( ) ; a [ c % 3 ] ++ ; } int count = 0 ; n /= 3 ; for ( int i = 0 ; i < 5 ; i ++ ) { if ( a [ i % 3 ] > n ) { a [ ( i + 1 ) % 3 ] += a [ i % 3 ] - n ; count += a [ i % 3 ] - n ; a [ i % 3 ] = n ; } } System . out . println ( count ) ; } } }" ]
[ "for s in [ * open ( 0 ) ] [ 2 : : 2 ] : NEW_LINE INDENT c = [ 0 ] * 3 NEW_LINE for x in s . split ( ) : c [ int ( x ) % 3 ] += 1 NEW_LINE print ( max ( c [ i ] - c [ i - 1 ] for i in ( 0 , 1 , 2 ) ) ) NEW_LINE DEDENT", "for s in [ * open ( 0 ) ] [ 2 : : 2 ] : NEW_LINE INDENT c = [ 0 ] * 3 ; NEW_LINE r = i = 0 NEW_LINE for x in s . split ( ) : c [ int ( x ) % 3 ] += 1 NEW_LINE while len ( { * c } ) > 1 : j = ( i + 1 ) % 3 ; f = c [ i ] > c [ j ] ; c [ i ] -= f ; c [ j ] += f ; r += f ; i = j NEW_LINE print ( r ) NEW_LINE DEDENT", "for i in [ * open ( 0 ) ] [ 2 : : 2 ] : NEW_LINE INDENT q = [ 0 ] * 3 NEW_LINE for _ in map ( int , i . split ( ) ) : q [ _ % 3 ] += 1 NEW_LINE print ( max ( q [ i ] - q [ i - 1 ] for i in ( 0 , 1 , 2 ) ) ) NEW_LINE DEDENT", "for s in [ * open ( 0 ) ] [ 2 : : 2 ] : NEW_LINE INDENT c = [ 0 ] * 3 NEW_LINE for x in s . split ( ) : c [ int ( x ) % 3 ] += 1 NEW_LINE print ( max ( c [ i ] - c [ i - 1 ] for i in range ( 3 ) ) ) NEW_LINE DEDENT", "for s in [ * open ( 0 ) ] [ 2 : : 2 ] : NEW_LINE INDENT c = [ 0 ] * 3 NEW_LINE for x in s . split ( ) : c [ int ( x ) % 3 ] += 1 NEW_LINE print ( max ( c [ i ] - c [ i - 1 ] for i in range ( 3 ) ) ) NEW_LINE DEDENT" ]
codeforces_116_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class A_Tram { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) , ans = 0 , total = 0 , a , b ; for ( int i = 0 ; i < n ; i ++ ) { a = fs . nextInt ( ) ; b = fs . nextInt ( ) ; total = total - a + b ; ans = max ( ans , total ) ; }   System . out . println ( ans ) ; }   static int min ( int a , int b ) { return Math . min ( a , b ) ; }   static int max ( int a , int b ) { return Math . max ( a , b ) ; }   static long min ( long a , long b ) { return Math . min ( a , b ) ; }   static long max ( long a , long b ) { return Math . max ( a , b ) ; }   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 ( ) ) ; } char nextChar ( ) { return next ( ) . charAt ( 0 ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }", "import java . util . Scanner ;   public class BigO {   public static void main ( String [ ] args ) { int a , b , n ; int minCapacity = 0 ; int du = 0 ; int peopleAtStop = 0 ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; peopleAtStop = b - a + du ; du = peopleAtStop ; if ( peopleAtStop > minCapacity ) { minCapacity = peopleAtStop ; } } System . out . println ( minCapacity ) ;   }   }", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ATram solver = new ATram ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class ATram { public void solve ( int testNumber , FastScanner fs , PrintWriter out ) { int n = fs . nextInt ( ) ; int a , b , ans = 0 , total = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a = fs . nextInt ( ) ; b = fs . nextInt ( ) ; total -= a ; total += b ; ans = Utilities . max ( ans , total ) ; } out . println ( ans ) ; }   }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   }   static class Utilities { public static int max ( int a , int b ) { return Math . max ( a , b ) ; }   } }  ", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int tran = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = scan . nextInt ( ) ;", "import java . io . * ; import java . lang . * ; import java . util . * ;    public class Main {   static Main . MyScanner sc = new Main . MyScanner ( ) ; static PrintStream out = System . out ;   public static void main ( String [ ] args ) throws Exception { int n = sc . nextInt ( ) , count = 0 , x = 0 , y = 0 , temp = 0 ; for ( int i = 0 ; i < n ; i ++ ) { x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; temp += y - x ; if ( count < temp ) count = temp ; } out . print ( count ) ; out . close ( ) ; } static private class MyScanner { BufferedReader br ; StringTokenizer st ;   public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   public long mod ( long x ) {" ]
[ "p = q = 0 for x in [ 0 ] * int ( input ( ) ) : q -= eval ( input ( ) . replace ( ' ▁ ' , ' - ' ) ) ; p = max ( p , q ) print ( p ) NEW_LINE", "n = int ( input ( ) ) x = 0 y = 0 for i in range ( 0 , n ) : z = list ( map ( int , input ( ) . rstrip ( ) . split ( ) ) ) x = x - z [ 0 ] x = x + z [ 1 ] if y < x : y = xprint ( y ) NEW_LINE", "stop_n = int ( input ( ) ) in_tram = [ ] out_tram = [ ] for i in range ( stop_n ) : exit_a , enter_b = map ( int , input ( ) . split ( ) ) in_tram . append ( enter_b ) out_tram . append ( exit_a )   NEW_LINE", "n = int ( input ( ) ) li = list ( ) for i in range ( n ) : a , b = input ( ) . split ( ) a = int ( a ) ; b = int ( b ) if ( i == 0 ) : npass = b li . append ( npass ) else : cpss = npass - a + b npass = cpss li . append ( cpss ) print ( max ( li ) ) NEW_LINE", "n = int ( input ( ) ) stop = [ ] person = 0 count = 0 for i in range ( n ) : a = list ( map ( int , input ( ) . split ( ) ) ) stop . append ( a )   for i in stop : person = person - i [ 0 ] + i [ 1 ] if count < person : count = person print ( count ) NEW_LINE" ]
codeforces_263_B
[ "import java . util . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; List < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { a . add ( scan . nextInt ( ) ) ; } Collections . sort ( a ) ; String result = ( n < k ) ? \" - 1\" : a . get ( n - k ) + \" ▁ \" + a . get ( n - k ) ; System . out . println ( result ) ; } }", "import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , k = sc . nextInt ( ) ; Integer [ ] ar = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } if ( k > n ) { System . out . println ( - 1 ) ; } else { Arrays . sort ( ar , Collections . reverseOrder ( ) ) ; System . out . println ( ar [ k - 1 ] + \" ▁ \" + ar [ k - 1 ] ) ; } } }", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = in . nextInt ( ) ; Arrays . sort ( a ) ; if ( k == n ) System . out . println ( a [ 0 ] + \" ▁ \" + a [ 0 ] ) ; else { int i = n - 1 ; while ( k -- > 0 ) { i -- ; } if ( i < 0 ) System . out . println ( \" - 1\" ) ; else System . out . println ( a [ i ] + 1 + \" ▁ \" + a [ i ] ) ; } } }", "import java . util . Arrays ; import java . util . Scanner ;   public class SquareChecker { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; long [ ] a = new long [ n ] ;   if ( k > n ) System . out . println ( - 1 ) ; else { for ( int i = 0 ; i < n ; i ++ ) a [ i ] = scan . nextInt ( ) ;   Arrays . sort ( a ) ;   System . out . println ( a [ n - k ] + \" ▁ \" + a [ n - k ] ) ; } } }", "import java . util . Arrays ; import java . util . Scanner ;   public class problem106 {   public static void main ( String [ ] args ) {" ]
[ "n , k = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) )   if k <= n : a . sort ( reverse = True ) print ( f \" { a [ k ▁ - ▁ 1 ] } ▁ { a [ k ▁ - ▁ 1 ] } \" ) else : print ( - 1 ) NEW_LINE", "n , k = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) if ( k > n ) : print ( - 1 ) elif ( k == n ) : print ( 0 , 0 ) else : a . sort ( reverse = True ) for i in range ( k ) : if ( i == k - 1 ) : print ( a [ i ] , 0 ) break NEW_LINE", "import sys   def input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def rinput ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) )     n , k = rinput ( ) a = get_list ( )   if ( k > n ) : print ( - 1 ) else : a . sort ( ) a = list ( reversed ( a ) ) print ( a [ k - 1 ] , 0 ) NEW_LINE", "from sys import stdin   def read_lines ( sep = ' ▁ ' , input_type = None ) : NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) arr = [ int ( i ) for i in input ( ) . split ( ) ] arr . sort ( ) if k > n : print ( - 1 ) else : print ( arr [ n - k ] , arr [ n - k ] ) NEW_LINE" ]
codeforces_129_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 B129 {   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 ) ) ) ; static ArrayList < HashSet < Integer > > al ; static boolean vis [ ] ; public static void main ( String args [ ] ) {   int tc = 1 ;", "import java . util . * ; import java . io . * ;   public class B {   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] edge = new int [ 101 ] [ 101 ] ; while ( m -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; edge [ a ] [ b ] = 1 ; edge [ b ] [ a ] = 1 ; edge [ a ] [ 0 ] ++ ; edge [ b ] [ 0 ] ++ ; }   Queue < Integer > queue = new LinkedList < > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) if ( edge [ i ] [ 0 ] == 1 ) queue . offer ( i ) ;   int count = 0 ; while ( ! queue . isEmpty ( ) ) { int size = queue . size ( ) ; for ( int j = 0 ; j < size ; j ++ ) { int a = queue . poll ( ) ; for ( int i = 1 ; i < 101 ; i ++ ) { if ( edge [ a ] [ i ] == 1 ) { edge [ a ] [ i ] = 0 ; edge [ i ] [ a ] = 0 ; edge [ i ] [ 0 ] -- ; edge [ a ] [ 0 ] -- ; } } }   for ( int i = 1 ; i <= n ; i ++ ) if ( edge [ i ] [ 0 ] == 1 ) queue . offer ( i ) ;   count ++ ; } System . out . println ( count ) ; }   }", "import java . util . LinkedList ; import java . util . Queue ; import java . util . Scanner ; public class Section { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c = 0 , c1 = 0 ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] l = new int [ 101 ] [ 101 ] ; while ( m -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; l [ a ] [ b ] = 1 ; l [ b ] [ a ] = 1 ; l [ a ] [ 0 ] ++ ; l [ b ] [ 0 ] ++ ; } Queue < Integer > q = new LinkedList < > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) if ( l [ i ] [ 0 ] == 1 ) q . offer ( i ) ; while ( ! q . isEmpty ( ) ) { int size = q . size ( ) ; for ( int j = 0 ; j < size ; j ++ ) { int a = q . poll ( ) ; for ( int i = 0 ; i < 101 ; i ++ ) { if ( l [ a ] [ i ] == 1 ) { l [ a ] [ i ] = 0 ; l [ i ] [ a ] = 0 ; l [ i ] [ 0 ] -- ; l [ a ] [ 0 ] -- ; } } } for ( int i = 1 ; i <= n ; i ++ ) { if ( l [ i ] [ 0 ] == 1 ) { q . offer ( i ) ; } } c ++ ; } System . out . println ( c ) ; } }" ]
[ "import sysinput = sys . stdin . readlineimport math   def inpit ( ) : NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) g = [ set ( ) for i in range ( n ) ] for _ in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) g [ a - 1 ] . add ( b - 1 ) g [ b - 1 ] . add ( a - 1 ) cnt = 0 while True : p = set ( ) for i in range ( n ) : if len ( g [ i ] ) == 1 : p . add ( i ) g [ i ] = set ( ) if len ( p ) == 0 : break cnt += 1 for i in range ( n ) : g [ i ] -= pprint ( cnt ) NEW_LINE", "def mingrid ( ) : for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) segcost = input ( ) . split ( ) minodd = int ( segcost [ 0 ] ) mineven = int ( segcost [ 1 ] ) sumodd = minodd sumeven = mineven codd = 1 ceven = 1 res = sumodd + minodd * ( n - codd ) + sumeven + mineven * ( n - ceven ) for i in range ( 2 , n ) : now = int ( segcost [ i ] ) if ( i + 1 ) % 2 : NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) arr = [ ] for i in range ( m ) : arr . append ( list ( map ( int , input ( ) . split ( ) ) ) ) s = set ( ) ans = 0 while True : count = [ 0 ] * ( n ) for a , b in arr : if a not in s and b not in s : count [ a - 1 ] += 1 count [ b - 1 ] += 1 flag = False for i in range ( n ) : if count [ i ] == 1 : flag = True s . add ( i + 1 ) if flag is False : print ( ans ) exit ( ) ans += 1 NEW_LINE" ]
codeforces_328_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class ArithmeticOrGeometric {   private static BufferedReader bufferedReader ; private static StringTokenizer st ;   public static void main ( String [ ] args ) throws IOException {   bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a1 = Integer . parseInt ( next ( ) ) ; int a2 = Integer . parseInt ( next ( ) ) ; int a3 = Integer . parseInt ( next ( ) ) ; int a4 = Integer . parseInt ( next ( ) ) ;   int d = a2 - a1 ;   if ( d == a3 - a2 && d == a4 - a3 ) { System . out . println ( a4 + d ) ; } else if ( a1 * a3 == a2 * a2 && a2 * a4 == a3 * a3 && a4 * a4 % a3 == 0 ) { System . out . println ( ( a4 * a4 ) / a3 ) ; } else { System . out . println ( 42 ) ; }   }   static String next ( ) throws IOException {   while ( st == null || ! st . hasMoreElements ( ) ) { st = new StringTokenizer ( bufferedReader . readLine ( ) ) ; }   return st . nextToken ( ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . text . DecimalFormat ; import java . util . StringTokenizer ;   public class ArithmeticOrGeometric {   private static BufferedReader bufferedReader ; private static StringTokenizer st ;   public static void main ( String [ ] args ) throws IOException {   bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a1 = Integer . parseInt ( next ( ) ) ; int a2 = Integer . parseInt ( next ( ) ) ; int a3 = Integer . parseInt ( next ( ) ) ; int a4 = Integer . parseInt ( next ( ) ) ;   int d = a2 - a1 ; double r = ( double ) a2 / a1 ;   if ( d == a3 - a2 && d == a4 - a3 ) { System . out . println ( a4 + d ) ; } else if ( a1 * a3 == a2 * a2 && a2 * a4 == a3 * a3 && a4 * a4 % a3 == 0 ) { DecimalFormat decimalFormat = new DecimalFormat ( \" # # # # # # \" ) ; System . out . println ( decimalFormat . format ( a4 * r ) ) ; } else { System . out . println ( 42 ) ; }   }   static String next ( ) throws IOException {   while ( st == null || ! st . hasMoreElements ( ) ) { st = new StringTokenizer ( bufferedReader . readLine ( ) ) ; }   return st . nextToken ( ) ; } }", "import java . io . * ; import java . util . * ; public class Main {   public static void main ( String [ ] args ) { InputReader sc = new InputReader ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; Random gen = new Random ( ) ; int test = 1 ;", "import java . util . Scanner ;   public class IQTestTwo {    public static void main ( String [ ] args ) {   Scanner z = new Scanner ( System . in ) ; String line = z . nextLine ( ) ;   String [ ] arrayOfNumberString = line . split ( \" ▁ \" ) ;      int [ ] a = new int [ 4 ] ;    a [ 0 ] = Integer . valueOf ( arrayOfNumberString [ 0 ] ) ; a [ 1 ] = Integer . valueOf ( arrayOfNumberString [ 1 ] ) ; a [ 2 ] = Integer . valueOf ( arrayOfNumberString [ 2 ] ) ; a [ 3 ] = Integer . valueOf ( arrayOfNumberString [ 3 ] ) ;     int d = a [ 1 ] - a [ 0 ] ;   if ( a [ 2 ] - a [ 1 ] == d && a [ 3 ] - a [ 2 ] == d ) System . out . println ( a [ 3 ] + d ) ; else if ( ( a [ 0 ] * a [ 2 ] == a [ 1 ] * a [ 1 ] ) && ( a [ 1 ] * a [ 3 ] == a [ 2 ] * a [ 2 ] ) && ( a [ 3 ] * a [ 3 ] % a [ 2 ] == 0 ) ) System . out . println ( a [ 3 ] * a [ 3 ] / a [ 2 ] ) ; else System . out . println ( 42 ) ; }   }" ]
[ "def test_arithmetic ( in_list ) : arithmetic = True current_nr = in_list [ 0 ] dif = in_list [ 1 ] - in_list [ 0 ] for nr in in_list [ 1 : ] : if nr - current_nr != dif : arithmetic = False else : current_nr = nr if arithmetic : next = nr + dif return next else : return 42     def test_geometric ( in_list ) : geometric = True for nr in in_list : if nr == 0 : return False else : quotient = in_list [ 1 ] / in_list [ 0 ] current_nr = in_list [ 0 ] for nr in in_list [ 1 : ] : if nr / current_nr != quotient : geometric = False else : current_nr = nr if geometric : next = nr * quotient if int ( next ) == 0 or int ( next ) / nr != quotient : return 42 else : return next else : return 42     if __name__ == \" _ _ main _ _ \" : in_numbers = list ( map ( int , input ( ) . split ( ) ) ) answer_ari = test_arithmetic ( in_numbers ) answer_geo = test_geometric ( in_numbers ) if answer_ari != 42 : print ( int ( answer_ari ) ) else : print ( int ( answer_geo ) ) NEW_LINE", "def main ( ) : a , b , c , d = [ int ( i ) for i in input ( ) . split ( ) ] p1 , p2 , p3 = b - a , c - b , d - c q1 , q2 , q3 = b / a , c / b , d / c if ( p1 == p2 == p3 ) : print ( d + p3 ) elif ( q1 == q2 == q3 and q1 != 1 and int ( d * q3 ) == d * q3 ) : print ( int ( d * q3 ) ) else : print ( 42 ) main ( ) NEW_LINE", "import sysn = input ( ) . split ( ) a = int ( n [ 0 ] ) b = int ( n [ 1 ] ) c = int ( n [ 2 ] ) d = int ( n [ 3 ] ) if ( b - a == c - b == d - c ) : print ( 2 * d - c ) sys . exit ( ) if ( b * b == a * c and c * c == b * d ) : if ( d * d % c == 0 ) : print ( d * d // c ) else : print ( 42 ) sys . exit ( ) print ( 42 ) NEW_LINE", "  a , b , c , d = list ( map ( int , input ( ) . split ( ) ) )   a1 = b - aa2 = c - ba3 = d - c   g1 = b / ag2 = c / bg3 = d / c NEW_LINE" ]
codeforces_1181_A
[ "import java . util . Scanner ;   public class _0718ChungaChanga {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; long z = sc . nextLong ( ) ; if ( x % z == 0 && y % z == 0 ) { System . out . print ( ( x / z + y / z ) + \" ▁ \" + 0 ) ; } else { System . out . print ( ( x + y ) / z + \" ▁ \" ) ; if ( ( x % z + y % z ) >= z ) { System . out . print ( z - Math . max ( x % z , y % z ) ) ; } else { System . out . print ( 0 ) ; } } }   }", "import java . util . * ;   public class CodeForces1181A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long x = input . nextLong ( ) ; long y = input . nextLong ( ) ; long z = input . nextLong ( ) ;   long count = x / z + y / z ; x = x % z ; y = y % z ; long min = Long . MAX_VALUE ; if ( y >= z - x ) { min = z - x ; } if ( x >= z - y ) { min = Math . min ( min , z - y ) ; }   if ( min == Long . MAX_VALUE ) { System . out . println ( count + \" ▁ \" + 0 ) ; } else { count ++ ; System . out . println ( count + \" ▁ \" + min ) ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   import static java . lang . Integer . * ;   public class Example {   public static void main ( String [ ] args ) {    Scanner sc = new Scanner ( System . in ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; long z = sc . nextLong ( ) ; long ans = x / z + y / z ; long re = x % z + y % z ; if ( re / z >= 1 ) { long ans2 = 0 ; long xre = x % z ; long yre = y % z ; if ( xre > yre ) { ans2 = z - xre ; } else { ans2 = z - yre ; } System . out . println ( ++ ans + \" ▁ \" + ans2 ) ; } else { System . out . println ( ans + \" ▁ \" + 0 ) ; }   }   }    ", "import java . util . * ;   public class CF102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; long z = sc . nextLong ( ) ;   long case1coco1 = x / z ; long exc1 = x % z ; long case1coco2 = ( y + exc1 ) / z ; long diff1 = ( y + exc1 ) % z ; if ( diff1 >= exc1 ) { exc1 = 0 ; } else { exc1 = exc1 - diff1 ; }   long sum1 = case1coco1 + case1coco2 ;   long cas2coco2 = y / z ; long exc2 = y % z ; long case2coco1 = ( x + exc2 ) / z ; long diff2 = ( x + exc2 ) % z ; if ( diff2 >= exc2 ) { exc2 = 0 ; } else { exc2 = exc2 - diff2 ; }   long sum2 = cas2coco2 + case2coco1 ;   if ( exc1 == 0 || exc2 == 0 ) { if ( exc1 == 0 && exc2 != 0 ) { System . out . println ( sum1 + \" ▁ \" + exc1 ) ; } else if ( exc1 != 0 && exc2 == 0 ) { System . out . println ( sum2 + \" ▁ \" + exc2 ) ; } else { if ( ( sum1 ) >= ( sum2 ) ) { System . out . println ( sum1 + \" ▁ \" + exc1 ) ; } else { System . out . println ( sum2 + \" ▁ \" + exc2 ) ; } }   } else { if ( ( ( sum1 * exc2 ) ) > ( ( sum2 * exc1 ) ) ) { System . out . println ( sum1 + \" ▁ \" + exc1 ) ; } else if ( ( ( sum1 * exc2 ) ) < ( ( sum2 * exc1 ) ) ) { System . out . println ( sum2 + \" ▁ \" + exc2 ) ; } else { if ( ( sum1 ) >= ( sum2 ) ) { System . out . println ( sum1 + \" ▁ \" + exc1 ) ; } else { System . out . println ( sum2 + \" ▁ \" + exc2 ) ; } } }    } }  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Chunga_Changa { static class RealScanner { 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 ( ) ) ; } } public static void main ( String [ ] args ) { RealScanner sc = new RealScanner ( ) ; long x , y , z ; x = sc . nextLong ( ) ; y = sc . nextLong ( ) ; z = sc . nextLong ( ) ; long sum = 0 ; if ( x % z == 0 && y % z == 0 ) { sum += ( x / z ) + ( y / z ) ; } else { sum += ( x / z ) + ( y / z ) + ( ( x % z + y % z ) / z ) ;" ]
[ "x , y , z = map ( int , input ( ) . split ( ) ) total = x // z + y // zif total == ( x + y ) // z : print ( total , 0 ) else : print ( total + 1 , min ( ( z - x % z ) , ( z - y % z ) ) ) NEW_LINE", "n , m , k = map ( int , input ( ) . split ( ) ) a = n % kif a : a = k - ab = m % kif b : b = k - bif ( ( n + a ) // k + ( m - a ) // k ) > ( ( n - b ) // k + ( m + b ) // k ) : if ( ( n + a ) // k + ( m - a ) // k ) == ( n // k + m // k ) : print ( ( ( n + a ) // k + ( m - a ) // k ) , 0 ) else : print ( ( ( n + a ) // k + ( m - a ) // k ) , a ) elif ( ( n + a ) // k + ( m - a ) // k ) == ( ( n - b ) // k + ( m + b ) // k ) : if ( n + a ) // k + ( m - a ) // k == ( n // k + m // k ) : print ( ( n // k + m // k ) , 0 ) elif a > b : print ( ( ( n - b ) // k + ( m + b ) // k ) , b ) else : print ( ( ( n - b ) // k + ( m + b ) // k ) , a ) else : if ( n // k + m // k ) == ( ( n - b ) // k + ( m + b ) // k ) : print ( ( ( n - b ) // k + ( m + b ) // k ) , 0 ) else : print ( ( ( n - b ) // k + ( m + b ) // k ) , b ) NEW_LINE", "import sysinput = sys . stdin . readlinefrom collections import defaultdict as dcfrom collections import Counterfrom bisect import bisect_right , bisect_leftimport mathfrom operator import itemgetterfrom heapq import heapify , heappop , heappushfrom queue import PriorityQueue as pqx , y , z = map ( int , input ( ) . split ( ) ) c = ( x + y ) // zp = ( x + y ) % zx = x % zy = y % z NEW_LINE", "x , y , z = map ( int , input ( ) . split ( ) ) n = ( x + y ) // zans = 0 if x // z + y // z < n : print ( n , min ( z - x % z , z - y % z ) ) else : print ( n , 0 ) NEW_LINE", "x , y , z = map ( int , input ( ) . split ( ) ) cnt = ( x + y ) // zif x % z + y % z < z : given = 0 else : given = min ( z - x % z , z - y % z ) print ( cnt , given ) NEW_LINE" ]
codeforces_1304_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . LinkedList ; import java . util . Locale ; import java . util . Objects ; import java . util . Queue ; import java . util . Scanner ; import java . util . Stack ; import java . util . TreeSet ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . lang . reflect . Array ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Map ; import java . util . Vector ;   public class Main {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int casos = Integer . parseInt ( br . readLine ( ) ) ; while ( casos > 0 ) { String [ ] entry = br . readLine ( ) . split ( \" ▁ \" ) ; long x = Long . parseLong ( entry [ 0 ] ) ; long y = Long . parseLong ( entry [ 1 ] ) ; long a = Long . parseLong ( entry [ 2 ] ) ; long b = Long . parseLong ( entry [ 3 ] ) ; long up = y - x ; long down = a + b ; if ( up % down != 0 ) { System . out . println ( \" - 1\" ) ; } else { System . out . println ( up / down ) ; }   casos -- ; } } }  ", "import java . util . Scanner ;   public class Nk { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int t = input . nextInt ( ) ; int m = 0 ;   while ( t -- > 0 ) {   int x = input . nextInt ( ) ; int y = input . nextInt ( ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ;   if ( ( y - x ) % ( a + b ) == 0 ) { System . out . println ( ( y - x ) / ( a + b ) ) ; }   else { System . out . println ( - 1 ) ; } } } }", "import java . util . * ; import java . io . * ; import java . math . * ;     public class A {   private static long INF = 2000000000000000000L , M = 1000000007 , MM = 998244353 ; private static int N = 0 ;   public static void process ( ) throws IOException {   long x = sc . nextLong ( ) , y = sc . nextLong ( ) , a = sc . nextLong ( ) , b = sc . nextLong ( ) ; long l = 0 , r = Integer . MAX_VALUE ; while ( l <= r ) { long mid = ( l + r ) / 2 ; long curr = mid * a + x ; long other = y - mid * b ; if ( curr > other ) { r = mid - 1 ; } else if ( curr < other ) { l = mid + 1 ; } else { System . out . println ( mid ) ; return ; } } System . out . println ( - 1 ) ;   }  ", "import java . util . Scanner ;   public class A1304 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int x = scanner . nextInt ( ) , y = scanner . nextInt ( ) , a = scanner . nextInt ( ) , b = scanner . nextInt ( ) ; int distance = y - x , oneSecond = a + b ; System . out . println ( distance % oneSecond == 0 ? distance / oneSecond : - 1 ) ; } } }" ]
[ "t = int ( input ( ) ) while t > 0 : x = list ( map ( int , input ( ) . split ( ) ) ) if ( x [ 1 ] - x [ 0 ] ) % ( x [ 2 ] + x [ 3 ] ) == 0 : print ( int ( ( x [ 1 ] - x [ 0 ] ) / ( x [ 2 ] + x [ 3 ] ) ) ) else : print ( - 1 ) t -= 1 NEW_LINE", "def main ( ) : allans = [ ] t = int ( input ( ) ) for _ in range ( t ) : x , y , a , b = readIntArr ( ) relativeV = a + b d = y - x if d % relativeV == 0 : allans . append ( d // relativeV ) else : allans . append ( - 1 ) multiLineArrayPrint ( allans ) return import sysinput = sys . stdin . buffer . readline NEW_LINE", "t = int ( input ( ) ) lst = [ ] for i in range ( t ) : var = list ( map ( int , input ( ) . split ( ) ) ) lst . append ( var ) for i in range ( t ) : x , y , a , b = lst [ i ] n = ( x - y ) % ( a + b ) if n == 0 : print ( abs ( int ( ( x - y ) / ( a + b ) ) ) ) else : print ( - 1 )       NEW_LINE", "t = input ( ) t = int ( t ) while t != 0 : res = input ( ) res = res . split ( ) x = int ( res [ 0 ] ) y = int ( res [ 1 ] ) a = int ( res [ 2 ] ) b = int ( res [ 3 ] ) res = ( y - x ) % ( a + b ) if res == 0 : print ( ( y - x ) // ( a + b ) ) else : print ( - 1 ) t = t - 1 NEW_LINE", "exec ( int ( input ( ) ) * ' x , y , a , b = map ( int , input ( ) . split ( ) ) ; y - = x ; a + = b ; print ( ( y / / a , -1 ) [ y % a > 0 ] ) ; ' ) NEW_LINE" ]
codeforces_1286_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . List ; import java . util . Random ; import java . util . StringTokenizer ;   public class Main implements Runnable {   int INF = ( int ) 1e9 ; int sz [ ] ; int id [ ] ; List < Integer > edges [ ] ;   private void solve ( ) throws IOException { int n = nextInt ( ) ; int a [ ] = new int [ n ] ; int ev = 0 ; for ( int i = 0 ; i < n ; ++ i ) { a [ i ] = nextInt ( ) ; if ( ( ( i + 1 ) & 1 ) == 0 ) ev ++ ; } int dp [ ] [ ] [ ] = new int [ n + 1 ] [ n + 1 ] [ 2 ] ;" ]
[ "def main ( ) : n = int ( input ( ) ) a = readIntArr ( ) arr = [ ] NEW_LINE", "a = int ( input ( ) ) z = list ( map ( int , input ( ) . split ( ) ) ) import math   odd = 0 eve = 0 for i in range ( len ( z ) ) : if ( z [ i ] % 2 == 1 ) : odd += 1 elif ( z [ i ] % 2 == 0 and z [ i ] > 0 ) : eve += 1   odd = ( a // 2 ) + ( a % 2 ) - oddeve = ( a // 2 ) - eve + ( ( a % 2 ) ) cnt = 0   dp = [ [ [ math . inf for i in range ( 2 ) ] for i in range ( odd + 2 ) ] for i in range ( len ( z ) ) ]   NEW_LINE", "def abc ( l , odd , even , i , x ) : try : return dp [ i , odd , even , x ] except : pass if i == len ( l ) : return 0 if l [ i ] : c = 0 if x != l [ i ] % 2 : c += 1 return c + abc ( l , odd , even , i + 1 , l [ i ] % 2 ) ans = n if odd : c = 0 if not x % 2 : c += 1 ans = min ( ans , c + abc ( l , odd - 1 , even , i + 1 , 1 ) ) if even : c = 0 if x % 2 : c += 1 ans = min ( ans , c + abc ( l , odd , even - 1 , i + 1 , 0 ) ) dp [ i , odd , even , x ] = ans return ansn = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) dp = { } odd = 0 even = 0 d = [ 0 ] * ( n + 1 ) for i in l : d [ i ] += 1 for i in range ( 1 , n + 1 ) : if i % 2 and not d [ i ] : odd += 1 if not i % 2 and not d [ i ] : even += 1 if l [ 0 ] : print ( abc ( l , odd , even , 1 , l [ 0 ] % 2 ) ) else : ans = n if odd : ans = min ( ans , abc ( l , odd - 1 , even , 1 , 1 ) ) if even : ans = min ( ans , abc ( l , odd , even - 1 , 1 , 0 ) ) print ( ans ) NEW_LINE", "n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) odd = ( n + 1 ) // 2 memo = { } def best ( i , odd_count , last ) : if i == n : return 0 key = ( i , odd_count , last ) if key in memo : return memo [ key ] poss = range ( 2 ) if p [ i ] == 0 else [ p [ i ] % 2 ] res = 10 ** 9 for parity in poss : new_odd_count = odd_count - parity new_even_count = n - i - odd_count - ( parity ^ 1 ) if new_odd_count < 0 or new_even_count < 0 : continue res = min ( res , best ( i + 1 , new_odd_count , parity ) + ( 1 if i > 0 and last != parity else 0 ) ) memo [ key ] = res return resprint ( best ( 0 , odd , 0 ) ) NEW_LINE" ]
codeforces_1367_B
[ "import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; int arr [ ] = new int [ n ] ; String s [ ] = br . readLine ( ) . split ( \" ▁ \" ) ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = Integer . parseInt ( s [ i ] ) ; int even = 0 , odd = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 != 0 && i % 2 == 0 ) odd ++ ; else if ( arr [ i ] % 2 == 0 && i % 2 != 0 ) even ++ ; } if ( odd == even ) System . out . println ( even ) ; else if ( odd == 0 && even == 0 ) System . out . println ( \"0\" ) ; else System . out . println ( \" - 1\" ) ; } } }", "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 N = ( int ) ( 1e5 + 100 ) ; 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 . * ; public class Main { public static void main ( String ared [ ] ) { Scanner sc = new Scanner ( System . in ) ; int test = sc . nextInt ( ) ; while ( test -- > 0 ) { int n = sc . nextInt ( ) ; int b [ ] = new int [ 2 ] ; int a [ ] = new int [ n ] ; b [ 0 ] = 0 ; b [ 1 ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] % 2 != i % 2 ) b [ i % 2 ] ++ ; } if ( b [ 0 ] == b [ 1 ] ) System . out . println ( b [ 0 ] ) ; else System . out . println ( \" - 1\" ) ; } } }", "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 ) { int n = sc . nextInt ( ) ; int ar [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } int odd = 0 , even = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ar [ i ] % 2 != i % 2 ) { if ( ar [ i ] % 2 == 1 ) odd ++ ; else even ++ ; } } if ( odd != even ) System . out . println ( \" - 1\" ) ; else System . out . println ( even ) ; t -- ; } } }" ]
[ "t = int ( input ( ) ) while t : t -= 1 n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) o = 0 e = 0 for i in range ( n ) : if i % 2 != l [ i ] % 2 : if i % 2 == 0 : e += 1 else : o += 1 if e == o : print ( e ) else : print ( - 1 ) NEW_LINE", "t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) o = 0 e = 0 for i in range ( 0 , len ( l ) , 2 ) : if i % 2 != l [ i ] % 2 : e += 1 for j in range ( 1 , len ( l ) , 2 ) : if j % 2 != l [ j ] % 2 : o += 1 if e == o : print ( e ) else : print ( - 1 ) NEW_LINE", "def main ( ) : t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) o_cnt = 0 e_cnt = 0 for i in range ( n ) : if i % 2 != 0 and arr [ i ] % 2 == 0 : e_cnt += 1 elif i % 2 == 0 and arr [ i ] % 2 != 0 : o_cnt += 1 if e_cnt == o_cnt : print ( e_cnt ) else : print ( - 1 )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) e , o = 0 , 0 for x in range ( n ) : if x % 2 == 0 and a [ x ] % 2 != 0 : e += 1 if x % 2 != 0 and a [ x ] % 2 == 0 : o += 1 if e != o : print ( - 1 ) else : print ( e ) NEW_LINE", "def evenArray ( arr , n ) : evenIdxOddCount = 0 oddIdxEvenCount = 0 for i in range ( 0 , n ) : if i % 2 == 0 : if arr [ i ] & 1 : evenIdxOddCount += 1 else : if not ( arr [ i ] & 1 ) : oddIdxEvenCount += 1 if evenIdxOddCount == oddIdxEvenCount : print ( evenIdxOddCount ) else : print ( - 1 ) returntc = int ( input ( ) ) for _ in range ( 0 , tc ) : n = int ( input ( ) ) arr = [ int ( i ) for i in input ( ) . split ( ) ] [ : n ] evenArray ( arr , n ) NEW_LINE" ]
codeforces_157_B
[ "import java . util . * ;   public class Trace_B {   public static void main ( String [ ] args ) {", "import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . lang . Math ; public class Account { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] rad = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { rad [ i ] = sc . nextInt ( ) ; } Arrays . sort ( rad ) ; int mul = 1 , sum = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { sum += rad [ i ] * rad [ i ] * mul ; mul *= - 1 ; } System . out . println ( Math . PI * sum ) ; } }", "  import java . io . * ; import java . util . * ;   public class TheFibonacciSegment { 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 ( ) ; List < Integer > arr = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { arr . add ( ni ( ) ) ; } Collections . sort ( arr ) ; if ( n % 2 != 0 ) { int k = 0 ; long sum = 0 ; for ( int i = 0 ; i < n ; i = i + 2 ) { sum = sum + arr . get ( i ) * arr . get ( i ) - k * k ; if ( i != n - 1 ) { k = arr . get ( i + 1 ) ; } } double ans = Math . PI * ( double ) sum ; out ( ans ) ; } else { int k = arr . get ( 0 ) ; long sum = 0 ; for ( int i = 1 ; i < n ; i = i + 2 ) { sum = sum + arr . get ( i ) * arr . get ( i ) - k * k ; if ( i != n - 1 ) { k = arr . get ( i + 1 ) ; } } double ans = Math . PI * ( double ) sum ; out ( ans ) ; } }", "import java . util . Arrays ; import java . util . Scanner ;   public class _0734Trace {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean flag = true ; if ( n % 2 == 0 ) { flag = false ; } int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; double area = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( flag ) { if ( i == 0 ) { area += Math . PI * arr [ i ] * arr [ i ] * 1d ; } else { area += Math . PI * arr [ i ] * arr [ i ] * 1d - Math . PI * arr [ i - 1 ] * arr [ i - 1 ] * 1d ; } } flag = ! flag ; } System . out . println ( area ) ; }   }", "import java . util . * ; public class Trace { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n == 1 ) { int temp = sc . nextInt ( ) ; System . out . println ( Math . PI * temp * temp ) ; System . exit ( 0 ) ; }    int [ ] ar = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; }   int res = 0 ; Arrays . sort ( ar ) ; for ( int i = n - 1 ; i > 0 ; i = i - 2 ) { res += ( ar [ i ] * ar [ i ] - ar [ i - 1 ] * ar [ i - 1 ] ) ; }   if ( n % 2 != 0 ) { res += ar [ 0 ] * ar [ 0 ] ; }    System . out . println ( Math . PI * res ) ;   } }" ]
[ "import math   n = int ( input ( ) )   a = [ int ( x ) for x in input ( ) . split ( ) ] a . sort ( reverse = True )   area = 0 mult = 1   for i in range ( 0 , n ) : area += mult * ( a [ i ] ** 2 ) mult *= - 1   print ( area * math . pi ) NEW_LINE", "import mathI = lambda : list ( map ( int , input ( ) . split ( ) ) ) n = int ( input ( ) ) a = sorted ( I ( ) , reverse = True ) area = 0 for i in range ( len ( a ) ) : if i % 2 == 0 : area += a [ i ] ** 2 * math . pi else : area -= a [ i ] ** 2 * math . piprint ( area ) NEW_LINE", "import math   n = int ( input ( ) ) a = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) ans = 0 for i in range ( n ) : if i % 2 != n % 2 : if i == 0 : ans += math . pi * a [ i ] ** 2 else : ans += math . pi * ( a [ i ] ** 2 - a [ i - 1 ] ** 2 ) print ( ans ) NEW_LINE", "from math import pi   n = int ( input ( ) ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) arr . sort ( reverse = True ) arr . append ( 0 ) ans = 0.0 i = 0 while i < n : ans += pi * ( arr [ i ] ** 2 - arr [ i + 1 ] ** 2 ) i += 2   print ( f \" { ans : .10f } \" ) NEW_LINE" ]
codeforces_1364_A
[ "import java . util . * ; import java . math . * ; public class XXXXX { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int sum = 0 ; int ans = - 1 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( ( sum += sc . nextInt ( ) ) % x != 0 ) ans = Math . max ( ans , Math . max ( i , n - i ) ) ; } System . out . println ( ans ) ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Main implements Runnable { int n , m , k ; static boolean use_n_tests = true ; long [ ] res ;   void solve ( FastScanner in , PrintWriter out , int testNumber ) { n = in . nextInt ( ) ; int x = in . nextInt ( ) ; int [ ] a = in . nextArray ( n ) ; int s = 0 ; int c = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] %= x ; s += a [ i ] ; s %= x ; if ( a [ i ] == 0 ) { c ++ ; } } if ( s != 0 ) { out . println ( n ) ; return ; } if ( c == n ) { out . println ( - 1 ) ; return ; } s = 0 ; int ans = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { s += a [ i ] ; if ( s % x != 0 ) { ans = Math . max ( ans , i + 1 ) ; ans = Math . max ( ans , n - i - 1 ) ; } } out . println ( ans ) ;   }  ", "  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 . System . * ; import static java . util . Arrays . fill ; import static java . lang . Math . log ; import static java . lang . Math . abs ; import static java . lang . Math . pow ; import static java . lang . Math . sqrt ; import static java . lang . Math . floor ; import static java . lang . Math . ceil ; import static java . lang . Math . sin ; import static java . lang . Math . cos ; import static java . lang . Math . tan ; 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 = 998244353 ; private static final int N = ( int ) ( 2e5 + 7 ) ;", "  import java . util . * ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class sol { 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 x = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; sum += ar [ i ] ; } int max = Integer . MIN_VALUE ;   int sum1 = sum ; for ( int i = 0 ; i < n ; i ++ ) { if ( sum % x != 0 ) { max = n - i ; break ; } else { sum -= ar [ i ] ; } } for ( int j = n - 1 ; j >= 0 ; j -- ) { if ( sum1 % x != 0 ) { if ( j + 1 > max ) { max = j + 1 ; break ; } } else { sum1 -= ar [ j ] ; } } if ( max == Integer . MIN_VALUE ) { System . out . println ( - 1 ) ; } else { System . out . println ( max ) ; } } } }" ]
[ "t = int ( input ( ) ) for i in range ( t ) : n , x = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) s = 0 left = - 1 for i in range ( n ) : if l [ i ] % x != 0 : if left == - 1 : left = i   r = i s = s + l [ i ] if s % x != 0 : print ( n ) elif left == - 1 : print ( - 1 ) else : pre = left + 1 suf = n - r print ( n - min ( pre , suf ) ) NEW_LINE", "def answer ( n , x , a ) : if sum ( a ) % x != 0 : return n NEW_LINE", "def longestNonDivisibleSubArray ( arr , n , x ) : s , individual = 0 , True   for i in range ( n ) : if arr [ i ] % x != 0 : individual = False s += arr [ i ] if individual : return - 1 if s % x != 0 : return n ;   s = 0 index = - 1 for i in range ( n ) : s += arr [ i ] if s % x != 0 : index = i prefix = index + 1   s = 0 index = n for i in range ( n - 1 , - 1 , - 1 ) : s += arr [ i ] if s % x != 0 : index = i suffix = n - index   return max ( prefix , suffix ) t = int ( input ( ) ) for i in range ( t ) : [ n , x ] = list ( map ( int , input ( ) . split ( ) ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) print ( longestNonDivisibleSubArray ( arr , n , x ) ) NEW_LINE", "t = int ( input ( ) ) for _ in range ( t ) : n , x = map ( int , input ( ) . split ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] ok = False for i in a : ok |= ( i % x ) if ( not ok ) : print ( - 1 ) elif ( sum ( a ) % x ) : print ( n ) else : ans = n for i in range ( n ) : if ( a [ i ] % x ) : ans = i + 1 break for i in range ( n - 1 , 0 , - 1 ) : if ( a [ i ] % x ) : ans = min ( ans , n - i ) break print ( n - ans ) NEW_LINE", "t = int ( input ( ) ) b = [ ] for k in range ( t ) : n , x = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a1 = list ( reversed ( a ) ) suma = sum ( a ) count = 0 if suma % x != 0 : b . append ( n ) else : for i in range ( n ) : number1 = suma - a [ i ] number2 = suma - a1 [ i ] if number1 % x != 0 or number2 % x != 0 : count += 1 b . append ( n - i - 1 ) break if count == 0 : b . append ( - 1 ) for i in b : print ( i )   NEW_LINE" ]
codeforces_447_B
[ "import java . util . * ; public class DZYLovesStrings {   public static void main ( String [ ] args ) {", "import java . util . * ; public class Practice { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char inp [ ] = sc . next ( ) . toCharArray ( ) ; int k = sc . nextInt ( ) ; int max = 0 ; int num [ ] = new int [ 26 ] ; for ( int i = 0 ; i < num . length ; i ++ ) { num [ i ] = sc . nextInt ( ) ; if ( i == 0 ) { max = num [ i ] ; } else { if ( max < num [ i ] ) { max = num [ i ] ; } } } int ans = 0 ; for ( int i = 0 ; i < inp . length ; i ++ ) { ans += num [ inp [ i ] - ' a ' ] * ( i + 1 ) ; } for ( int i = 1 ; i <= k ; i ++ ) { ans += max * ( inp . length + i ) ; } System . out . println ( ans ) ; } }   ", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {", "import java . util . * ; public class DZY_loveStrings { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; String st = sc . nextLine ( ) ; int n = sc . nextInt ( ) ; int [ ] w = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { w [ i ] = sc . nextInt ( ) ; } int max = w [ 0 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( max < w [ i ] ) max = w [ i ] ; } int sum = 0 ; int i ; for ( i = 0 ; i < st . length ( ) ; i ++ ) { sum += ( i + 1 ) * w [ st . charAt ( i ) - ' a ' ] ; }   for ( int j = 0 ; j < n ; j ++ ) { sum += ( i + 1 ) * max ; i ++ ; }   System . out . println ( sum ) ; } }" ]
[ "a = input ( ) k = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) t = max ( arr ) count = 0 for i in range ( 1 , len ( a ) + 1 ) : count += arr [ ( ord ( a [ i - 1 ] ) - 97 ) ] * ( i ) for i in range ( 1 , k + 1 ) : count += ( i + len ( a ) ) * tprint ( count ) NEW_LINE", "try : s = input ( ) k = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) x = max ( c ) cost = 0 for i in range ( len ( s ) ) : cost += c [ ord ( s [ i ] ) - 97 ] * ( i + 1 ) for i in range ( len ( s ) , len ( s ) + k ) : cost += ( i + 1 ) * max ( c ) print ( cost ) except : pass NEW_LINE", "s = input ( ) k = int ( input ( ) ) lst = list ( map ( int , input ( ) . split ( ) ) ) lst2 = [ chr ( i ) for i in range ( 97 , 123 ) ] dct = { } for i in range ( len ( lst2 ) ) : dct [ lst2 [ i ] ] = lst [ i ] value = 0 alpha = max ( dct . values ( ) )   for i in range ( len ( s ) ) : value += ( i + 1 ) * dct [ s [ i ] ] NEW_LINE", "s = input ( ) k = int ( input ( ) ) w = list ( map ( int , input ( ) . split ( ) ) ) fs = 0 for i in range ( len ( s ) ) : fs += w [ ord ( s [ i ] ) - 97 ] * ( i + 1 ) m = max ( w ) for i in range ( len ( s ) , len ( s ) + k ) : fs += m * ( i + 1 ) print ( fs ) NEW_LINE", "str1 = input ( ' ' ) k = int ( input ( ' ' ) ) w = list ( map ( int , input ( ) . split ( ) ) ) p = max ( w ) pidx = w . index ( p ) + 97 q = chr ( pidx ) str2 = k * qstr3 = str1 + str2f = 0 for i in range ( 0 , len ( str3 ) ) : a = ord ( str3 [ i ] ) - 97 f = f + ( i + 1 ) * w [ a ] print ( f ) NEW_LINE" ]
codeforces_571_B
[ "import java . util . * ; import java . io . * ; public class MainClass { static long INF = Long . MAX_VALUE / 2 ; public static void main ( String [ ] args ) throws IOException { Reader in = new Reader ( ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; long [ ] A = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) A [ i ] = in . nextLong ( ) ; new MergeSortLong ( ) . sort ( A , 0 , n - 1 ) ; int full = n % k ; if ( full == 0 ) full = k ; int half = k - full ; int fullLength = ( n + k - 1 ) / k ; int halfLength = fullLength - 1 ; long [ ] [ ] dp = new long [ k + 1 ] [ k + 1 ] ; for ( int i = 0 ; i <= k ; i ++ ) Arrays . fill ( dp [ i ] , INF ) ; dp [ 0 ] [ 0 ] = 0L ; for ( int i = 0 ; i <= k ; i ++ ) { for ( int j = 0 ; j <= k ; j ++ ) { int totalLen = i * fullLength + j * halfLength ; if ( totalLen > n ) continue ; if ( i > 0 ) { long mm = A [ totalLen - 1 ] - A [ totalLen - fullLength ] + dp [ i - 1 ] [ j ] ; dp [ i ] [ j ] = Math . min ( dp [ i ] [ j ] , mm ) ; } if ( j > 0 ) { long mm = A [ totalLen - 1 ] - A [ totalLen - halfLength ] + dp [ i ] [ j - 1 ] ; dp [ i ] [ j ] = Math . min ( dp [ i ] [ j ] , mm ) ; } } } System . out . println ( dp [ full ] [ half ] ) ; } } class MergeSortLong {", "import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . io . Reader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . StringTokenizer ;   public class B2 {   static final long MODULO = ( long ) ( 1e9 + 7 ) ; private static final long INF = Long . MAX_VALUE / 2 ; private static int n , k ; private static int [ ] a ; private static int minLen ;   public static void main ( String [ ] args ) { BufferedScanner scanner = new BufferedScanner ( ) ; PrintWriter writer = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;   int t = 1 ;", "import java . util . * ; import java . io . * ; public class Solution { static void merge ( long arr [ ] , int l , int m , int r ) {" ]
[ "f = lambda : map ( int , input ( ) . split ( ) ) n , k = f ( ) p = sorted ( f ( ) ) m , d = n // k , n % ku , v = d + 1 , k - d + 1 g = [ 0 ] * u * v i = 0 for a in range ( u ) : j = a * m + a - 1 for b in range ( v ) : x = g [ i - 1 ] + p [ j ] - p [ j - m + 1 ] if b else 9e9 y = g [ i - v ] + p [ j ] - p [ j - m ] if a else 9e9 if i : g [ i ] = min ( x , y ) i += 1 j += mprint ( g [ - 1 ] ) NEW_LINE", "f = lambda : map ( int , input ( ) . split ( ) ) n , k = f ( ) p = sorted ( f ( ) )   m , d = n // k , n % ku , v = d + 1 , k - d + 1 g = [ 0 ] * u * v   i = 0 for a in range ( u ) : j = a * m + a - 1 for b in range ( v ) : x = g [ i - 1 ] + p [ j ] - p [ j - m + 1 ] if b else 9e9 y = g [ i - v ] + p [ j ] - p [ j - m ] if a else 9e9 if i : g [ i ] = min ( x , y ) i += 1 j += mprint ( g [ - 1 ] ) NEW_LINE", "f = lambda : map ( int , input ( ) . split ( ) ) n , k = f ( ) p = sorted ( f ( ) )   m , d = n // k , n % ku , v = d + 1 , k - d + 1 g = [ 0 ] * u * v   i = 0 for a in range ( u ) : j = a * m + a - 1 for b in range ( v ) : x = g [ i - 1 ] + p [ j ] - p [ j - m + 1 ] if b else 9e9 y = g [ i - v ] + p [ j ] - p [ j - m ] if a else 9e9 if i : g [ i ] = min ( x , y ) i += 1 j += mprint ( g [ - 1 ] ) NEW_LINE", "f = lambda : map ( int , input ( ) . split ( ) ) n , k = f ( ) p = sorted ( f ( ) )   m , d = n // k , n % ku , v = d + 1 , k - d + 1 g = [ 0 ] * u * v   i = 0 for a in range ( u ) : j = a * m + a - 1 for b in range ( v ) : x = g [ i - 1 ] + p [ j ] - p [ j - m + 1 ] if b else 9e9 y = g [ i - v ] + p [ j ] - p [ j - m ] if a else 9e9 if i : g [ i ] = min ( x , y ) i += 1 j += mprint ( g [ - 1 ] ) NEW_LINE", "f = lambda : map ( int , input ( ) . split ( ) ) n , k = f ( ) p = sorted ( f ( ) )   m , d = n // k , n % ku , v = d + 1 , k - d + 1 g = [ 0 ] * u * v   i = 0 for a in range ( u ) : j = a * m + a - 1 for b in range ( v ) : x = g [ i - 1 ] + p [ j ] - p [ j - m + 1 ] if b else 9e9 y = g [ i - v ] + p [ j ] - p [ j - m ] if a else 9e9 if i : g [ i ] = min ( x , y ) i += 1 j += mprint ( g [ - 1 ] ) NEW_LINE" ]
codeforces_363_A
[ "import java . util . * ;   public class P3 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; if ( t == 0 ) System . out . println ( \" O - | - OOOO \" ) ; while ( t > 0 ) { int n = t % 10 ; if ( n == 1 ) { System . out . println ( \" O - | O - OOO \" ) ; } else if ( n == 2 ) { System . out . println ( \" O - | OO - OO \" ) ; } else if ( n == 3 ) { System . out . println ( \" O - | OOO - O \" ) ; } else if ( n == 4 ) { System . out . println ( \" O - | OOOO - \" ) ; } else if ( n == 5 ) { System . out . println ( \" - O | - OOOO \" ) ; } else if ( n == 6 ) { System . out . println ( \" - O | O - OOO \" ) ; } else if ( n == 7 ) { System . out . println ( \" - O | OO - OO \" ) ; } else if ( n == 8 ) { System . out . println ( \" - O | OOO - O \" ) ; } else if ( n == 9 ) { System . out . println ( \" - O | OOOO - \" ) ; } else if ( n == 0 ) { System . out . println ( \" O - | - OOOO \" ) ; } t /= 10 ; } } }", "import com . sun . org . apache . bcel . internal . generic . AALOAD ; import com . sun . org . apache . bcel . internal . generic . GOTO ; 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 ; import static jdk . nashorn . internal . runtime . regexp . joni . Syntax . Java ;   public class Main { public static String setNumber ( char n ) { if ( n == '0' ) { return \" O - | - OOOO \" ; } else if ( n == '1' ) { return \" O - | O - OOO \" ; } else if ( n == '2' ) { return \" O - | OO - OO \" ; } else if ( n == '3' ) { return \" O - | OOO - O \" ; } else if ( n == '4' ) { return \" O - | OOOO - \" ; } else if ( n == '5' ) { return \" - O | - OOOO \" ; } else if ( n == '6' ) { return \" - O | O - OOO \" ; } else if ( n == '7' ) { return \" - O | OO - OO \" ; } else if ( n == '8' ) { return \" - O | OOO - O \" ; } else if ( n == '9' ) { return \" - O | OOOO - \" ; } return \" \" ; } public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ; String n = input . next ( ) ; StringBuilder ans = new StringBuilder ( ) ; for ( int i = n . length ( ) - 1 ; i >= 0 ; i -- ) { ans . append ( setNumber ( n . charAt ( i ) ) + \" \\n \" ) ; } System . out . println ( ans ) ; }     }", "import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import java . util . concurrent . * ; import java . util . regex . * ; import java . util . Arrays ; import java . util . ArrayList ; import java . lang . Math ; public class project { 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 ; } }     static int binarySearch ( long a [ ] , long k , int l , int h ) { int min = Integer . MAX_VALUE ; while ( l <= h ) { int mid = ( l + h ) / 2 ; if ( a [ mid ] == k ) return mid ; else if ( a [ mid ] > k ) h = mid - 1 ; else if ( a [ mid ] < k ) l = mid + 1 ; } return min ; } static int gcd ( int a , int b ) {", "import java . util . * ; public class Soroban {   public static void main ( String [ ] args ) {" ]
[ "chot = { 0 : \" O - | - OOOO \" , 1 : \" O - | O - OOO \" , 2 : \" O - | OO - OO \" , 3 : \" O - | OOO - O \" , 4 : \" O - | OOOO - \" , 5 : \" - O | - OOOO \" , 6 : \" - O | O - OOO \" , 7 : \" - O | OO - OO \" , 8 : \" - O | OOO - O \" , 9 : \" - O | OOOO - \" }   num = int ( input ( ) )   divs = [ ]   if num == 0 : print ( chot [ 0 ] ) exit ( )   while num > 0 : divs . append ( ( num % 10 ) ) num //= 10   for i in divs : print ( chot [ i ] ) NEW_LINE", "n = input ( ) [ : : - 1 ]   for i in range ( len ( n ) ) : if n [ i ] >= '5' : print ( ' - O | ' , end = ' ' ) print ( ( int ( n [ i ] ) - 5 ) * ' O ' + ' - ' + ( 9 - int ( n [ i ] ) ) * ' O ' ) else : print ( ' O - | ' , end = ' ' ) print ( int ( n [ i ] ) * ' O ' + ' - ' + ( 4 - int ( n [ i ] ) ) * ' O ' ) NEW_LINE", "for i in input ( ) [ : : - 1 ] : if int ( i ) - 5 < 0 : print ( ' O - | ' , int ( i ) * ' O ' , ' - ' , ' O ' * ( 4 - int ( i ) ) , sep = ' ' ) else : print ( ' - O | ' , ( int ( i ) - 5 ) * ' O ' , ' - ' , ' O ' * ( 4 - ( int ( i ) - 5 ) ) , sep = ' ' )   NEW_LINE", "n = int ( input ( ) ) def pp ( t ) : res = [ ' O ' ] * 8 res [ 2 ] = ' | ' res [ t % 5 + 3 ] = ' - ' res [ 1 - t // 5 ] = ' - ' print ( \" \" . join ( res ) ) if n == 0 : pp ( n ) while n != 0 : t = n % 10 pp ( t ) n //= 10 NEW_LINE" ]
codeforces_139_A
[ "import java . util . Scanner ;   public class Task139A { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; int [ ] w = new int [ 7 ] ; int sum = 0 ; for ( int i = 0 ; i < w . length ; i ++ ) { w [ i ] = scanner . nextInt ( ) ; sum += w [ i ] ; } int days = 0 ; if ( t % sum != 0 ) t = t % sum ; else t = sum ; if ( t != 0 ) for ( int i : w ) { t -= i ; days ++ ; if ( t <= 0 ) { break ; } } System . out . println ( days ) ; } }", "import java . util . Scanner ;   public class PetrandBook { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] numbers = new int [ 7 ] ;   for ( int i = 0 ; i < 7 ; i ++ ) { numbers [ i ] = scanner . nextInt ( ) ; } System . out . println ( solve ( n , numbers ) ) ;   }   public static int solve ( int n , int [ ] nums ) { while ( n >= 0 ) { for ( int i = 0 ; i < nums . length ; i ++ ) { if ( n > 0 ) { n -= nums [ i ] ; if ( n <= 0 ) { return i + 1 ; } } } } return 0 ; } }  ", "import java . util . Arrays ; import java . util . Scanner ;   public class A139 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n ; int [ ] y = new int [ 8 ] ; n = scanner . nextInt ( ) ; for ( int i = 1 ; i <= 7 ; ++ i ) { y [ i ] = scanner . nextInt ( ) ; y [ i ] += y [ i - 1 ] ; } n = ( n - 1 ) % y [ 7 ] + 1 ; for ( int i = 1 ; i <= 7 ; ++ i ) { if ( y [ i ] >= n ) { System . out . print ( i ) ; System . out . print ( \" \\n \" ) ; break ; }   } } }", "import java . util . Scanner ;   public class PetrBook { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int length = scanner . nextInt ( ) ; int a [ ] = new int [ 7 ] ; for ( int i = 0 ; i < 7 ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; } while ( length > 0 ) { for ( int j = 0 ; j < 7 ; j ++ ) { length -= a [ j ] ; if ( length <= 0 ) { System . out . println ( j + 1 ) ; return ; } } } } }" ]
[ "pages = int ( input ( ) ) page_sum = 0 lst = [ * map ( int , input ( ) . split ( ) ) ] for idx , daily_pages in enumerate ( lst ) : page_sum += daily_pages pages -= daily_pages if pages <= 0 : print ( idx + 1 ) breakelse : if page_sum == 1 : print ( lst . index ( 1 ) + 1 ) else : pages = pages % page_sum if pages > page_sum else pages for idx , daily_pages in enumerate ( lst ) : pages -= daily_pages if pages <= 0 : print ( idx + 1 ) break NEW_LINE", "n = int ( input ( ) ) w = list ( map ( int , input ( ) . split ( ) ) ) i = 0 s = 0 while ( 1 ) : s += w [ i ] if ( s >= n ) : print ( i + 1 ) break i = ( i + 1 ) % 7 NEW_LINE", "n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) t = A [ 0 ] i = 0 while t < n : i += 1 i %= 7 t += A [ i ] print ( i + 1 ) NEW_LINE", "sum = 0   count = 0   n = int ( input ( ) )   things = [ int ( x ) for x in input ( ) . split ( ) ] while sum < n : sum += things [ count ] count = ( count + 1 ) % 7   if count == 0 : print ( 7 ) else : print ( count ) NEW_LINE" ]
codeforces_219_A
[ "  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 ( ) ;  ", "import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; String s = sc . next ( ) ; int [ ] count = new int [ 26 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { count [ s . charAt ( i ) - ' a ' ] ++ ; } for ( int i : count ) { if ( i % k != 0 ) { System . out . println ( \" - 1\" ) ; return ; } } StringBuilder ans = new StringBuilder ( s . length ( ) ) ; for ( char c = ' a ' ; c <= ' z ' ; c ++ ) { int times = count [ c - ' a ' ] / k ; while ( times -- > 0 ) { ans . append ( c ) ; } } String appender = ans . toString ( ) ; for ( int i = 1 ; i < k ; i ++ ) { ans . append ( appender ) ; } System . out . println ( ans ) ; } }", "import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; scan . nextLine ( ) ; String s = scan . nextLine ( ) ; char [ ] temp = s . toCharArray ( ) ; Arrays . sort ( temp ) ; String l = String . valueOf ( temp ) ;" ]
[ "k = int ( input ( ) ) s = str ( input ( ) ) s = list ( s ) d = { } for i in s : d [ i ] = s . count ( i ) cnt = 0 s1 = ' ' for j in d : if d [ j ] % k == 0 : cnt += 1 s1 += ( j * int ( d [ j ] / k ) ) if cnt != len ( d ) : print ( - 1 ) else : print ( s1 * k ) NEW_LINE", "def solution ( ) : k = int ( input ( ) )   st = input ( )   cnt = [ 0 ] * 26   for i in st : cnt [ ord ( i ) - ord ( ' a ' ) ] += 1 for cnts in cnt : if cnts % k != 0 : print ( - 1 ) return ans = ' '   for i in range ( 26 ) : ans += chr ( 97 + i ) * ( cnt [ i ] // k ) print ( ans * k )     return         if __name__ == ' _ _ main _ _ ' : solution ( ) NEW_LINE", "k = int ( input ( ) ) st = input ( ) s = list ( st ) e = [ ] ec = [ ] f = 0 for i in s : if i not in e : e . append ( i ) ec . append ( s . count ( i ) ) j = 0 while j < len ( ec ) : temp = ec [ j ] if temp % k != 0 : print ( - 1 ) f = 1 break ec [ j ] = int ( ec [ j ] / k ) j += 1 if f != 1 : q = 0 a = ' ' while q < len ( e ) : temp = ec [ q ] while temp > 0 : a += str ( e [ q ] ) temp -= 1 q += 1 print ( a * k ) NEW_LINE", "def solve ( s , n ) : d = { } for i in s : if not d . get ( i ) : d [ i ] = 1 else : d [ i ] += 1 res = ' ' for i in d : if d [ i ] % n != 0 : return - 1 for i in d : res += i * ( d [ i ] // n ) return res * n   def main ( ) : NEW_LINE" ]
codeforces_769_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 . 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 _p000769A { static public void main ( final String [ ] args ) throws IOException { p000769A . _main ( args ) ; }", "import java . util . Arrays ; import java . util . Scanner ;   public class UniversityEntrance { 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 ( ) ;   Arrays . sort ( arr ) ; System . out . println ( arr [ n / 2 ] ) ; } }", "import java . util . Scanner ; import java . util . Arrays ; import java . util . * ; import java . lang . * ;   public class Code {   public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; HashSet < Integer > hash = new HashSet < > ( ) ; int result = 0 ; int n = cin . nextInt ( ) ; cin . nextLine ( ) ;   int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = cin . nextInt ( ) ; } if ( n == 1 ) { System . out . println ( arr [ 0 ] ) ; return ; }   Arrays . sort ( arr ) ;  \t\t  System . out . println ( arr [ n / 2 ] ) ;  \t\t\t\t   cin . close ( ) ; } }   ", "import java . util . * ; public class P2 {   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 ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ n / 2 ] ) ; } }" ]
[ "n = int ( input ( ) ) arr = sorted ( map ( int , input ( ) . split ( ) ) )   print ( arr [ n // 2 ] ) NEW_LINE", "''' ▁ ▁ ▁ ▁ ▁ Design ▁ by ▁ Dinh ▁ Viet ▁ Anh ( JOKER ) / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ $ $ _ _ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ $ $ $ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ _ _ _ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ _ _ _ _ $ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ $ $ $ $ _ _ $ $ $ $ $ $ $ $ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ $ $ $ $ $ $ _ _ _ $ $ $ $ $ $ $ $ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ _ _ _ $ _ _ _ _ _ _ $ $ $ $ $ $ $ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ $ _ _ $ $ $ $ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ $ _ _ $ $ $ $ _ _ $ $ $ $ $ $ $ $ $ $ $ _ _ _ _ _ $ _ _ _ _ $ $ $ / / _ _ _ _ _ _ _ _ _ _ $ $ $ _ _ _ $ $ $ $ _ _ _ $ $ $ $ $ $ $ $ $ $ $ _ _ $ $ $ $ _ _ $ $ $ $ / / _ _ _ _ _ _ _ _ _ $ $ $ $ _ _ _ $ $ $ $ $ _ _ _ $ $ $ $ $ $ $ $ $ $ _ _ $ $ $ $ $ $ $ $ $ / / _ _ _ _ $ _ _ _ _ $ $ $ _ _ _ _ _ $ $ $ $ _ _ _ _ _ _ _ _ _ _ $ $ $ _ _ _ $ $ $ $ $ $ $ / / _ _ $ $ $ $ _ _ $ $ $ $ _ _ _ _ _ $ $ $ $ _ _ _ _ _ $ _ _ _ _ $ $ $ _ _ _ _ _ $ / / _ _ $ $ $ $ _ _ $ $ $ _ _ _ _ _ _ _ $ $ $ $ _ _ $ $ $ $ $ $ $ $ $ $ / / _ _ _ $ $ $ $ $ $ $ $ $ _ _ _ _ _ _ $ $ $ $ _ _ $ $ $ $ $ $ $ $ $ / / _ _ _ $ $ $ $ $ $ $ $ $ $ _ _ _ _ _ $ $ $ $ _ _ _ $ $ $ $ $ $ / / _ _ _ $ $ $ $ $ $ $ $ $ $ $ _ _ _ _ _ $ $ $ / / _ _ _ _ $ $ $ $ $ $ $ $ $ $ $ _ _ _ _ $ $ $ $ / / _ _ _ _ $ $ $ $ $ _ _ $ $ $ $ $ _ _ _ $ $ $ / / _ _ _ _ $ $ $ $ $ _ _ _ $ $ $ $ $ $ / / _ _ _ _ $ $ $ $ $ _ _ _ _ $ $ $ / / _ _ _ _ _ $ $ $ $ / / _ _ _ _ _ $ $ $ $ / / _ _ _ _ _ $ $ $ $ ''' from math import * from cmath import * from itertools import * from decimal import * NEW_LINE", "nennum = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr . sort ( ) print ( arr [ ( len ( arr ) - 1 ) // 2 ] ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr . sort ( ) print ( arr [ len ( arr ) // 2 ] ) NEW_LINE", "a = int ( input ( ) ) b = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) if a == 1 : print ( b [ 0 ] ) if a == 3 : print ( b [ 1 ] ) if a == 5 : print ( b [ 2 ] ) NEW_LINE" ]
codeforces_527_B
[ "import java . util . * ; public final class Ideone { private static int [ ] solve ( String s , String t ) {", "import java . util . HashMap ; import java . util . Scanner ;   public class WorkFile { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; char [ ] s = scanner . next ( ) . toCharArray ( ) ; char [ ] t = scanner . next ( ) . toCharArray ( ) ; HashMap < Character , Integer > d = new HashMap < > ( ) ; int changes = 0 ; HashMap < String , Integer > dict = new HashMap < > ( ) ; int res = 0 , r1 = - 1 , r2 = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { char x = s [ i ] , y = t [ i ] ; if ( x != y ) { changes ++ ; d . putIfAbsent ( x , i ) ; if ( res == 2 ) continue ; String s1 = String . valueOf ( y ) + String . valueOf ( x ) ; if ( dict . get ( s1 ) != null ) { res = 2 ; r1 = dict . get ( s1 ) + 1 ; r2 = i + 1 ; } dict . putIfAbsent ( String . valueOf ( x ) + String . valueOf ( y ) , i ) ; } } if ( res == 2 ) { System . out . println ( changes - res ) ; System . out . println ( r1 + \" ▁ \" + r2 ) ; System . exit ( 0 ) ; } for ( int i = 0 ; i < n ; i ++ ) { char x = s [ i ] , y = t [ i ] ; if ( x != y ) { if ( d . get ( y ) != null ) { res = 1 ; r1 = i + 1 ; r2 = d . get ( y ) + 1 ; break ; } } } System . out . println ( changes - res ) ; System . out . println ( r1 + \" ▁ \" + r2 ) ; } }", "import java . util . * ; import java . io . * ; import java . text . * ; public class Main {" ]
[ "from sys import stdin , stdoutfrom collections import Counterdef ai ( ) : return list ( map ( int , stdin . readline ( ) . split ( ) ) ) def ei ( ) : return map ( int , stdin . readline ( ) . split ( ) ) def ip ( ) : return int ( stdin . readline ( ) . strip ( ) ) def op ( ans ) : return stdout . write ( str ( ans ) + ' \\n ' )   n = ip ( ) s = input ( ) t = input ( ) value = { } li = [ ] res1 = 0 res2 = res3 = - 1 for i in range ( n ) : if s [ i ] != t [ i ] : value [ t [ i ] ] = i res1 += 1 li . append ( i ) p = sq = Falsefor i in li : if s [ i ] in value : p = True res2 = i + 1 f = value [ s [ i ] ] res3 = f + 1 if s [ f ] == t [ i ] : sq = True breakprint ( res1 - ( 2 if sq else 1 if p else 0 ) ) print ( res2 , res3 ) NEW_LINE", "num = int ( input ( ) )   a = input ( )   b = input ( )   dic = { }   lis = [ ]   ham = 0   swap1 = - 1   swap2 = - 1   p = False   q = False   for i in range ( num ) :   if a [ i ] != b [ i ] :   ham += 1   lis . append ( i )   dic [ b [ i ] ] = i   for i in lis :   if a [ i ] in dic :   p = True   swap1 = i + 1   f = dic [ a [ i ] ]   swap2 = f + 1   if a [ f ] == b [ i ] :   q = True   break   print ( ham - ( 2 if q else 1 if p else 0 ) )   print ( swap1 , swap2 )       NEW_LINE", "n = int ( input ( ) ) s = input ( ) t = input ( ) dic , diff = { } , [ ] res , res1 , res2 = 0 , - 1 , - 1 for i in range ( n ) : if s [ i ] != t [ i ] : res += 1 diff . append ( i ) dic [ t [ i ] ] = iswap1 , swap2 = False , Falsefor i in diff : if s [ i ] in dic : swap1 = True res1 = i + 1 j = dic [ s [ i ] ] res2 = j + 1 if s [ j ] == t [ i ] : swap2 = True breakprint ( res - ( 2 if swap2 else 1 if swap1 else 0 ) ) print ( res1 , res2 ) NEW_LINE", "__author__ = ' ruckus '   n = int ( input ( ) ) s = input ( ) t = input ( ) dif = { } hem = 0 for i in range ( n ) : if s [ i ] != t [ i ] : dif [ i ] = [ s [ i ] , t [ i ] ] hem += 1   change = [ ] probed = [ ] k = 0 for i in dif . keys ( ) : if dif [ i ] in probed : continue probed . append ( dif [ i ] ) k += 1 for j in list ( dif . keys ( ) ) [ k : ] : if dif [ i ] == dif [ j ] [ : : - 1 ] : print ( hem - 2 ) print ( i + 1 , j + 1 ) quit ( ) if not change and ( dif [ i ] [ 0 ] == dif [ j ] [ 1 ] or dif [ j ] [ 0 ] == dif [ i ] [ 1 ] ) : change = [ i , j ]   if change : print ( hem - 1 ) print ( change [ 0 ] + 1 , change [ 1 ] + 1 ) else : print ( hem ) print ( ' - 1 ▁ - 1' ) NEW_LINE", "n = int ( input ( ) ) s = list ( input ( ) ) t = list ( input ( ) ) d = { } ans = 0 x , y = - 1 , - 1 for i in range ( n ) : if s [ i ] != t [ i ] : d [ ( s [ i ] , t [ i ] ) ] = i ans += 1 l = [ chr ( i + 97 ) for i in range ( 26 ) ] for i in l : for j in l : if ( i , j ) in d and ( j , i ) in d : ans -= 2 x = d [ ( i , j ) ] + 1 y = d [ ( j , i ) ] + 1 break if x != - 1 : breakif x == y == - 1 : for i in l : for j in l : for k in l : if ( i , j ) in d and ( j , k ) in d : ans -= 1 x = d [ ( i , j ) ] + 1 y = d [ ( j , k ) ] + 1 break if x != - 1 : breakprint ( ans ) print ( x , y ) NEW_LINE" ]
codeforces_355_B
[ "import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . FileReader ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ;   public class v_tranport {   public static void main ( String [ ] args ) throws IOException { BufferedReader ob = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String c [ ] = ob . readLine ( ) . split ( \" ▁ \" ) ; int c1 = Integer . parseInt ( c [ 0 ] ) ; int c2 = Integer . parseInt ( c [ 1 ] ) ; int c3 = Integer . parseInt ( c [ 2 ] ) ; int c4 = Integer . parseInt ( c [ 3 ] ) ; String nm [ ] = ob . readLine ( ) . split ( \" ▁ \" ) ; int n = Integer . parseInt ( nm [ 0 ] ) ; int m = Integer . parseInt ( nm [ 1 ] ) ; String s [ ] = ob . readLine ( ) . split ( \" ▁ \" ) ; int total = 0 ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int temp = Integer . parseInt ( s [ i ] ) ; int cst = temp * c1 ;", "  import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) {   Scanner s = new Scanner ( System . in ) ; int c [ ] = new int [ 4 ] ; int m = 0 ; int bus = 0 , tro = 0 ; for ( int i = 0 ; i < c . length ; i ++ ) { c [ i ] = s . nextInt ( ) ; }", "import java . util . * ; import java . lang . * ; import java . math . BigInteger ; import java . io . * ; import java . io . * ; import java . util . * ;   public class CodeChef {   public static void main ( String args [ ] ) throws IOException {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] sr = br . readLine ( ) . split ( \" ▁ \" ) ; int c1 , c2 , c3 , c4 ; c1 = Integer . parseInt ( sr [ 0 ] ) ; c2 = Integer . parseInt ( sr [ 1 ] ) ; c3 = Integer . parseInt ( sr [ 2 ] ) ; c4 = Integer . parseInt ( sr [ 3 ] ) ; String [ ] ss = br . readLine ( ) . split ( \" ▁ \" ) ; int n = Integer . parseInt ( ss [ 0 ] ) ; int m = Integer . parseInt ( ss [ 1 ] ) ; int [ ] arr = new int [ n ] ; int [ ] arr1 = new int [ m ] ; int sum1 = 0 , sum2 = 0 ; String [ ] st = br . readLine ( ) . split ( \" ▁ \" ) ; String [ ] su = br . readLine ( ) . split ( \" ▁ \" ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( st [ i ] ) ; sum1 += Math . min ( c1 * arr [ i ] , c2 ) ; } for ( int i = 0 ; i < m ; i ++ ) { arr1 [ i ] = Integer . parseInt ( su [ i ] ) ; sum2 += Math . min ( c1 * arr1 [ i ] , c2 ) ; } int sum3 = Math . min ( Math . min ( Math . min ( sum1 + c3 , sum2 + c3 ) , sum1 + sum2 ) , 2 * c3 ) ; sum3 = Math . min ( sum3 , c4 ) ; System . out . println ( sum3 ) ; }   }" ]
[ "c1 , c2 , c3 , c4 = map ( int , input ( ) . split ( ) ) n , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 for i in range ( 0 , len ( a ) ) : ans += min ( c2 , a [ i ] * c1 ) ans = min ( ans , c3 ) ans1 = 0 for i in range ( 0 , len ( b ) ) : ans1 += min ( c2 , b [ i ] * c1 ) ans1 = min ( c3 , ans1 ) print ( min ( c4 , ans1 + ans ) ) NEW_LINE", "c1 , c2 , c3 , c4 = map ( int , input ( ) . split ( ) ) n , m = map ( int , input ( ) . split ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) t = list ( map ( int , input ( ) . split ( ) ) ) a = 0 for i in range ( n ) : a += min ( c1 * b [ i ] , c2 ) ans = min ( a , c3 ) b = 0 for i in range ( m ) : b += min ( c1 * t [ i ] , c2 ) ans += min ( b , c3 ) print ( min ( ans , c4 ) ) NEW_LINE", "c1 , c2 , c3 , c4 = map ( int , input ( ) . split ( ) ) n , m = map ( int , input ( ) . split ( ) ) n1 = list ( map ( int , input ( ) . split ( ) ) ) m1 = list ( map ( int , input ( ) . split ( ) ) ) s1 = 0 r = [ ] for i in range ( n ) : if ( ( n1 [ i ] * c1 ) > ( c2 ) ) : s1 = s1 + c2 else : s1 = s1 + n1 [ i ] * c1r . append ( s1 + c3 ) s2 = 0 for i in range ( m ) : if ( ( m1 [ i ] * c1 ) > ( c2 ) ) : s2 = s2 + c2 else : s2 = s2 + m1 [ i ] * c1r . append ( s2 + c3 ) r . append ( s1 + s2 ) r . append ( 2 * c3 ) r . append ( c4 ) print ( min ( r ) ) NEW_LINE", "import sysinput = sys . stdin . readlinel = input ( ) . split ( ) c1 = int ( l [ 0 ] ) c2 = int ( l [ 1 ] ) c3 = int ( l [ 2 ] ) c4 = int ( l [ 3 ] ) l = input ( ) . split ( ) n = int ( l [ 0 ] ) m = int ( l [ 1 ] ) l = input ( ) . split ( ) ai = [ int ( i ) for i in l ] l = input ( ) . split ( ) bi = [ int ( i ) for i in l ] maxa = c4sumi = 0 for i in ai : sumi += min ( i * c1 , c2 ) sumi = min ( sumi , c3 ) sumi1 = 0 for i in bi : sumi1 += min ( i * c1 , c2 ) sumi1 = min ( sumi1 , c3 ) print ( min ( maxa , sumi + sumi1 ) ) NEW_LINE" ]
codeforces_859_B
[ "  import java . util . Scanner ; import java . util . Arrays ; public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception { try { Scanner sc = new Scanner ( System . in ) ; int n , m , i , c ; n = sc . nextInt ( ) ; for ( i = 1 ; i * i <= n ; i ++ ) { if ( i * i > n ) break ; } i -- ; c = 3 * i ; n = n - i * i ; c = c + 2 * ( n / i ) ; if ( n % i == 0 ) c = c + i ; else c = c + i + 2 ; System . out . println ( c ) ; } catch ( Exception e ) { } } }", "import java . util . Scanner ;   public class B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( 2 * ( ( int ) Math . ceil ( 2 * Math . sqrt ( sc . nextInt ( ) ) ) ) ) ; } }", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class a { static int [ ] count , count1 , count2 ; static Node [ ] nodes ; static long [ ] arr ; static char [ ] ch , ch1 ; static long [ ] 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 ) 1e9 + 5 ; static long mod = 998244353l ;", "import java . util . * ; public class test { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int numberOfBlocks = scanner . nextInt ( ) ; int circuit = - 1 ; int findThatHasSquare = numberOfBlocks ; if ( Math . sqrt ( findThatHasSquare ) % 1 == 0 ) { circuit = ( int ) Math . sqrt ( findThatHasSquare ) * 4 ; } else { findThatHasSquare = numberOfBlocks ; while ( true ) { if ( Math . sqrt ( findThatHasSquare ) % 1 == 0 ) { break ; } findThatHasSquare -- ; } } if ( circuit == - 1 ) { int sqrt = ( int ) Math . sqrt ( findThatHasSquare ) ; circuit = sqrt * 4 ; int restBlocks = numberOfBlocks - findThatHasSquare ; while ( true ) { if ( restBlocks - sqrt > 0 ) { restBlocks = - sqrt ; circuit += 2 ; } else { circuit += 2 ; break ; } } } System . out . println ( circuit ) ; } }" ]
[ "import mathnum = int ( input ( ) )   side = math . ceil ( num ** 0.5 )   if ( side - 1 ) * side >= num : ans = ( side * 2 - 1 ) * 2 else : ans = side * 4 print ( ans )                     NEW_LINE", "import math   n = int ( input ( ) )   a = int ( math . sqrt ( n ) ) b = math . ceil ( n / a )   print ( 2 * ( a + b ) ) NEW_LINE", "import mathn = int ( input ( ) ) if ( math . sqrt ( n ) ) . is_integer ( ) : print ( int ( math . sqrt ( n ) * 4 ) ) else : n1 = int ( math . sqrt ( n ) ) if ( n - ( math . pow ( n1 , 2 ) ) ) > n1 : print ( n1 * 4 + 4 ) else : print ( n1 * 4 + 2 ) NEW_LINE", "n = int ( input ( ) ) x = 1 while x ** 2 < n : x += 1 if x ** 2 > n : x -= 1 t = n - x ** 2 ans = 4 * xif ( t != 0 ) : b = t // x z = t % x ans += ( 2 * b ) if z > 0 : ans += 2 print ( ans ) NEW_LINE", "def solve ( n ) : a = n ** 0.5 b = int ( a ) if a == int ( a ) : return 4 * int ( a ) else : if n > b * b and n <= b * ( b + 1 ) : return 4 * b + 2 else : return 4 * ( b + 1 )     n = int ( input ( ) ) print ( solve ( n ) ) NEW_LINE" ]
codeforces_361_A
[ "import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i == j ) System . out . print ( k + \" ▁ \" ) ; else System . out . print ( 0 + \" ▁ \" ) ; } System . out . println ( ) ; } } }", "import java . util . Scanner ;   public class LevkoandTable {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i == j ) { System . out . print ( k + \" ▁ \" ) ; } else { System . out . print ( 0 + \" ▁ \" ) ; } } System . out . println ( ) ; } } }", "import java . util . * ; import java . io . * ; import java . math . * ;   public class Main { public static void main ( String ... args ) throws IOException { Scanner sc = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < n ; ++ j ) out . print ( i == j ? m + \" ▁ \" : \"0 ▁ \" ) ; out . println ( ) ; } out . flush ( ) ; out . close ( ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; import java . util . StringTokenizer ;   public class code { public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ )   { for ( int j = 0 ; j < n ; j ++ ) { if ( i == j ) { System . out . print ( m + \" ▁ \" ) ; } else System . out . print ( 0 + \" ▁ \" ) ; } System . out . println ( ) ; }   } 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 ; } } } class Pair { int x , y ; public Pair ( int x , int y ) { this . x = x ; this . y = y ; } public String toString ( ) { return x + \" ▁ \" + y ; } }   " ]
[ "n , k = map ( int , input ( ) . split ( ) ) for i in range ( n ) : for j in range ( n ) : if ( i == j ) : print ( k , end = \" ▁ \" ) else : print ( 0 , end = \" ▁ \" ) print ( ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) arr = [ [ 0 ] * n for i in range ( n ) ] for i in range ( n ) : arr [ i ] [ i ] = kfor i in range ( n ) : print ( * arr [ i ] ) NEW_LINE", "n , m = [ int ( x ) for x in input ( ) . split ( ) ] n -= 1 for i in range ( n + 1 ) : print ( '0 ▁ ' * i + str ( m ) + ' ▁ 0' * ( n - i ) ) NEW_LINE", "from itertools import permutationsn , k = map ( int , input ( ) . split ( ) ) arr = [ ] count = 0 for m in range ( n ) : lst = [ 0 ] * n lst [ count ] = k count += 1 arr . append ( lst ) for x in arr : print ( * x ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) a = k - n + 1 for i in range ( n ) : for j in range ( n ) : if i == j : print ( a , end = \" ▁ \" ) else : print ( 1 , end = \" ▁ \" ) print ( \" \" ) NEW_LINE" ]
codeforces_367_B
[ "import java . awt . * ; import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . * ; import java . util . List ; import java . util . Queue ;   import static java . lang . Math . max ; import static java . lang . Math . min ;    public class B implements Runnable {  " ]
[ "from collections import Counter   n , m , p = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) )     def try_from ( start , a , b ) : result = [ ] seq = a [ start : : p ] i = 0 if len ( seq ) < len ( b ) : return [ ]   counts_a = Counter ( seq [ : len ( b ) ] ) counts_b = Counter ( b ) if counts_a == counts_b : result . append ( start )   for i in range ( 1 , len ( seq ) - len ( b ) + 1 ) : counts_a [ seq [ i - 1 ] ] -= 1 counts_a [ seq [ i + len ( b ) - 1 ] ] += 1 if not counts_a [ seq [ i - 1 ] ] : del counts_a [ seq [ i - 1 ] ]   ok = counts_a == counts_b NEW_LINE" ]
codeforces_1236_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 FileWriter fw ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static long oo = Long . MAX_VALUE ;", "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 AliceAndListOfPresents { 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 ( ) ; Helper hp = new Helper ( ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; long sol = hp . pow ( 2 , m , MOD ) - 1 ; p . println ( hp . pow ( sol , n , MOD ) ) ; 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 ) {", "import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { PrintWriter out ; FastReader sc ; long mod = ( long ) ( 1e9 + 7 ) ; long maxlong = Long . MAX_VALUE ; long minlong = Long . MIN_VALUE ; long pow ( long a , long b ) { if ( b == 0 ) { return 1 ; } long p = pow ( a , b / 2 ) ; if ( b % 2 == 0 ) return ( p * p ) % mod ; else return ( ( ( p * p ) % mod ) * a ) % mod ; } public void sol ( ) { long a = ni ( ) , b = ni ( ) ; pl ( pow ( pow ( 2 , b ) - 1 , a ) ) ; } public static void main ( String [ ] args ) { Main g = new Main ( ) ; g . out = new PrintWriter ( System . out ) ; g . sc = new FastReader ( ) ; int t = 1 ;" ]
[ "arr = list ( map ( int , input ( ) . split ( ) ) ) n = arr [ 0 ] m = arr [ 1 ] k = ( 10 ** 9 ) + 7 print ( pow ( 2 ** m - 1 , n , k ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) mod = pow ( 10 , 9 ) + 7 ans = ( pow ( 2 , m , mod ) - 1 ) % mod   ans = pow ( ans , n , mod )   print ( ans ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) mod = 10 ** 9 + 7 print ( pow ( ( pow ( 2 , m , mod ) + mod - 1 ) % mod , n , 10 ** 9 + 7 ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) r = { }   def PsevdoBin ( base , x ) : if x in r : return r [ x ] mod = 10 ** 9 + 7   if x <= 2 : return ( base ** x ) % mod else : a = x // 2 ; b = ( x + 1 ) // 2 r [ x ] = ( PsevdoBin ( base , a ) * PsevdoBin ( base , b ) ) % mod return ( PsevdoBin ( base , a ) * PsevdoBin ( base , b ) ) % mod   one_box = ( PsevdoBin ( 2 , m ) + 10 ** 9 + 7 - 1 ) % ( 10 ** 9 + 7 ) r = { } for_all = PsevdoBin ( one_box , n )   print ( for_all % ( 10 ** 9 + 7 ) ) NEW_LINE" ]
codeforces_1290_B
[ "import java . io . * ; import java . util . * ;   public class Task1290B { private static InputReader in ; private static PrintWriter out ; private static boolean autoFlush = false ; static final int inf = ( int ) 1e9 + 7 ;   static class Testcase { public void solve ( int test ) { StringBuilder s = new StringBuilder ( in . next ( ) ) ; int n = s . length ( ) ; int [ ] [ ] cnt = new int [ n + 1 ] [ 26 ] ; Arrays . fill ( cnt [ 0 ] , 0 ) ; for ( int i = 1 ; i <= n ; i ++ ) { int c = s . charAt ( i - 1 ) - ' a ' ; for ( int j = 0 ; j < 26 ; j ++ ) cnt [ i ] [ j ] = cnt [ i - 1 ] [ j ] ; cnt [ i ] [ c ] ++ ; } int m = in . nextInt ( ) ; for ( int i = 0 ; i < m ; i ++ ) { int l = in . nextInt ( ) ; int r = in . nextInt ( ) ; boolean yes = false ; int count = 0 ; for ( int j = 0 ; j < 26 ; j ++ ) if ( cnt [ r ] [ j ] - cnt [ l - 1 ] [ j ] > 0 ) count ++ ; if ( r == l ) yes = true ; else if ( s . charAt ( l - 1 ) != s . charAt ( r - 1 ) ) yes = true ; else if ( count > 2 ) yes = true ; out . println ( yes ? \" Yes \" : \" No \" ) ; } } }   public static void main ( String [ ] args ) { in = new InputReader ( System . in ) ; out = new PrintWriter ( System . out , autoFlush ) ; int t = 1 ;", "import java . io . ByteArrayInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . * ; import java . math . * ; public class Main { InputStream is ; PrintWriter out ; String INPUT = \" \" ;", "import java . util . * ; import java . io . * ; public class EdD {   public static void main ( String [ ] args ) throws Exception { int num = 998244353 ;  " ]
[ "def diff ( a , b ) : ans = [ ] for i in range ( len ( a ) ) : ans . append ( a [ i ] - b [ i ] ) return ans   a = input ( ) n = len ( a ) q = int ( input ( ) ) count = [ [ 0 for i in range ( 26 ) ] for j in range ( n ) ] count [ 0 ] [ ord ( a [ 0 ] ) - 97 ] += 1 for i in range ( 1 , n ) : for j in range ( 26 ) : count [ i ] [ j ] = count [ i - 1 ] [ j ] count [ i ] [ ord ( a [ i ] ) - 97 ] += 1   NEW_LINE", "def zip_sorted ( a , b ) :   NEW_LINE" ]
codeforces_884_A
[ "import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int day = 0 , time = 0 ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { time += ( 86400 - a [ i ] ) ; day ++ ; if ( time >= t && day <= n ) { System . out . println ( day ) ; return ; } } System . out . println ( n ) ;   } }", "import java . io . * ; import java . util . StringTokenizer ;", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long t = sc . nextLong ( ) ; long [ ] arr = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextLong ( ) ; }", "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 t = sc . nextInt ( ) , rem = 0 , res = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int num = sc . nextInt ( ) ; rem += ( 86400 - num ) ; if ( rem >= t && res == 0 ) res = i ; } System . out . println ( res ) ; sc . close ( ) ; } }", "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; short n = scan . nextShort ( ) , day = 0 ; int [ ] a = new int [ n ] ; int t = scan . nextInt ( ) , i ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; t -= 86400 - a [ i ] ; day ++ ; if ( t <= 0 ) break ; } System . out . println ( day ) ; } }" ]
[ "n , t = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : if 86400 - a [ i ] >= t : print ( i + 1 ) break else : t -= 86400 - a [ i ] NEW_LINE", "n , t = map ( int , input ( ) . split ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) D = 86400 for i in range ( n ) : if D - A [ i ] >= t : print ( i + 1 ) break else : t -= ( D - A [ i ] ) NEW_LINE", "from sys import stdininput = stdin . readline   n , t = [ int ( x ) for x in input ( ) . split ( ) ] a = [ int ( x ) for x in input ( ) . split ( ) ] for i in range ( n ) : t -= 86400 - a [ i ] if t <= 0 : print ( i + 1 ) break NEW_LINE", "num , t = map ( int , ( input ( ) . split ( ) ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   ct = 0 i = 0 while t > 0 : t -= ( 86400 - arr [ i ] ) i += 1 ct += 1   print ( ct ) NEW_LINE", "n , t = map ( int , input ( ) . split ( ) ) lst = [ int ( i ) for i in input ( ) . split ( ) ]   for i , val in enumerate ( lst ) : t -= 86400 - val   if t <= 0 : print ( i + 1 ) break NEW_LINE" ]
codeforces_1119_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Zad1119B {   public static void main ( String [ ] args ) {", "import java . util . Scanner ; import java . util . Arrays ; import java . util . Vector ; import java . util . Collections ;    public class Problem_Solving1 { public static void main ( String [ ] args ) {", "import java . util . * ; import java . io . * ;   public class AnyolaFridge {    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 ( ) ; int n = fr . nextInt ( ) ; long h = fr . nextLong ( ) ; long [ ] arr = new long [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = fr . nextLong ( ) ;   int ans = 1 ;   for ( int i = 0 ; i < n ; i ++ ) { ArrayList < Long > temp = new ArrayList < > ( ) ; for ( int j = 0 ; j <= i ; j ++ ) { temp . add ( arr [ j ] ) ; } Collections . sort ( temp , Collections . reverseOrder ( ) ) ; long need = 0 ; for ( int j = 0 ; j < temp . size ( ) ; j += 2 ) { need += temp . get ( j ) ; } if ( need <= h ) { ans = Math . max ( ans , i + 1 ) ; } } System . out . println ( ans ) ;   } }", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  " ]
[ "def bs ( l , h ) : while l < h : m = ( l + h + 1 ) // 2 if gf ( m ) : l = m else : h = m - 1 return l   def gf ( x ) : if x % 2 : return sum ( sorted ( a [ : x + 1 ] ) [ 1 : : 2 ] ) <= h else : return sum ( sorted ( a [ : x + 1 ] ) [ 0 : : 2 ] ) <= h     n , h = map ( int , input ( ) . split ( ) ) a = tuple ( map ( int , input ( ) . split ( ) ) ) print ( bs ( 0 , n - 1 ) + 1 ) NEW_LINE", "def check ( k ) : g = h x = sorted ( l [ : k + 1 ] , reverse = True ) for i in range ( 0 , k + 1 , 2 ) : if g < x [ i ] : return False g -= x [ i ] return True   n , h = list ( map ( int , input ( ) . split ( ) ) ) l = list ( map ( int , input ( ) . split ( ) ) ) for j in range ( n - 1 , - 1 , - 1 ) : if check ( j ) : print ( j + 1 ) break NEW_LINE", "def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counter , defaultdictfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE", "def getInput ( ) : temp = input ( ) . split ( \" ▁ \" ) n , h = int ( temp [ 0 ] ) , int ( temp [ 1 ] ) heights = input ( ) . split ( \" ▁ \" ) for i in range ( len ( heights ) ) : heights [ i ] = int ( heights [ i ] ) return n , h , heights   def fits ( i ) : height_left = h p = 0 while p < i : if heights [ p ] <= height_left : height_left -= heights [ p ] p += 1 if p < i : p += 1 else : return False return True n , h , heights = getInput ( ) k = nfor i in range ( 1 , n + 1 ) : heights [ : i ] = sorted ( heights [ : i ] , reverse = True ) NEW_LINE", "def solve ( n , k , arr ) : final = 0 for x in range ( 1 , n + 1 ) : dup = k times = 0 temp = sorted ( arr [ : x ] , reverse = True ) for ele in range ( 0 , x , 2 ) : if temp [ ele ] <= dup : dup -= temp [ ele ] if ele + 1 < x : times += 2 else : times += 1 else : break if times > final : final = times return final   n , k = list ( map ( int , input ( ) . split ( ) ) ) seq = list ( map ( int , input ( ) . split ( ) ) ) print ( solve ( n , k , seq ) ) NEW_LINE" ]
codeforces_23_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class CF23A { public static void main ( String [ ] args ) throws IOException { FastScanner sc = new FastScanner ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; char [ ] s = sc . nextToken ( ) . toCharArray ( ) ; pw . println ( solve ( s ) ) ; pw . flush ( ) ; }   static int solve ( char [ ] s ) { for ( int len = s . length - 1 ; len > 0 ; len -- ) for ( int i = 0 ; i <= s . length - len ; i ++ ) for ( int k = i + 1 ; k <= s . length - len ; k ++ ) if ( match ( s , k , i , len ) ) { return len ; } return 0 ; }   static boolean match ( char [ ] s , int st1 , int st2 , int len ) { for ( int i = 0 ; i < len ; i ++ ) if ( s [ st1 + i ] != s [ st2 + i ] ) return false ; return true ; }   static class FastScanner { BufferedReader in ; StringTokenizer st ;   public FastScanner ( ) { this . in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   public String nextToken ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( in . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( nextToken ( ) ) ; }   public long nextLong ( ) { return Long . parseLong ( nextToken ( ) ) ; }   public double nextDouble ( ) { return Double . parseDouble ( nextToken ( ) ) ; }   public void close ( ) throws IOException { in . close ( ) ; } } }", "import java . util . * ; public class LongestRepeatingSequence {", "import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ;   public class Main { static Map < String , Integer > map = new HashMap < > ( ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { for ( int j = 1 ; j < s . length ( ) ; j ++ ) { if ( i + j <= s . length ( ) ) { String t = s . substring ( i , i + j ) ; if ( ! map . containsKey ( t ) ) map . put ( t , 1 ) ; else map . put ( t , map . get ( t ) + 1 ) ; } } } int ans = 0 ; for ( Map . Entry < String , Integer > entry : map . entrySet ( ) ) { int k = entry . getValue ( ) ; String t = entry . getKey ( ) ; if ( k >= 2 && t . length ( ) > ans ) ans = t . length ( ) ; } System . out . println ( ans ) ; } }", "import java . util . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String str = s . next ( ) ; int max = 0 ; for ( int k = str . length ( ) ; k >= 0 ; k -- ) { for ( int start = 0 ; start < str . length ( ) - k ; start ++ ) { String substr = str . substring ( start , start + k ) ; if ( str . substring ( start + 1 ) . contains ( substr ) ) { max = substr . length ( ) ; break ; } } if ( max != 0 ) break ; }   System . out . println ( max ) ; s . close ( ) ; } }" ]
[ "import sysfrom random import * from bisect import * from heapq import * NEW_LINE", "def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counterfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE", "S = input ( ) best = 0 for i in range ( len ( S ) ) : for j in range ( i + 1 , len ( S ) + 1 ) : s = S [ i : j ] c = 0 for k in range ( len ( S ) ) : if S [ k : ] . startswith ( s ) : c += 1 if c >= 2 : best = max ( best , len ( s ) ) print ( best ) NEW_LINE", "s = input ( ) n = len ( s ) m = 0   for i in range ( n - 1 ) : for j in range ( 1 , n - i ) : if s [ i : i + j ] in s [ i + 1 : ] : if j > m : m = j   print ( m ) NEW_LINE", "cadena = input ( ) n = len ( cadena )   rpta = 0   for i in range ( n - 1 ) : tamanho_cadena = n - i - 1 for j in range ( n - tamanho_cadena ) : subcadena = cadena [ j : j + tamanho_cadena ] contador = 1 for k in range ( n - tamanho_cadena - j ) : if subcadena == cadena [ j + k + 1 : j + k + 1 + tamanho_cadena ] : contador = contador + 1 if contador >= 2 and rpta == 0 : rpta = tamanho_cadena if rpta != 0 : break   print ( rpta ) NEW_LINE" ]
codeforces_471_A
[ "import java . io . * ; import java . lang . * ; import java . util . * ;   public class A471 { 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 ( ) ) ; ArrayList < Integer > arr = new ArrayList < > ( ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < 6 ; i ++ ) { arr . add ( Integer . parseInt ( st . nextToken ( ) ) ) ; if ( ! map . containsKey ( arr . get ( i ) ) ) { map . put ( arr . get ( i ) , 0 ) ; } map . put ( arr . get ( i ) , map . get ( arr . get ( i ) ) + 1 ) ; } f . close ( ) ; boolean flag = false ; int keep = - 1 ; for ( int i = 0 ; i < 6 ; i ++ ) { if ( map . get ( arr . get ( i ) ) >= 4 ) { keep = arr . get ( i ) ; flag = true ; } } if ( ! flag ) { System . out . println ( \" Alien \" ) ; return ; } arr . remove ( ( Integer ) keep ) ; arr . remove ( ( Integer ) keep ) ; arr . remove ( ( Integer ) keep ) ; arr . remove ( ( Integer ) keep ) ; int first = arr . get ( 0 ) ; int second = arr . get ( 1 ) ; if ( second == first ) { System . out . println ( \" Elephant \" ) ; } else { System . out . println ( \" Bear \" ) ; }     System . out . println ( ans ) ; }   }", "import java . util . * ; import java . math . * ; public class MuhAndSticks { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i ++ ) arr [ i ] = sc . nextInt ( ) ; Arrays . sort ( arr ) ; int count = 0 ; boolean works = false ; int start = 0 ; int end = 3 ;   outer : for ( int i = 0 ; i < 3 ; i ++ ) { start = end - 3 ; for ( int j = start ; j <= end ; j ++ ) { if ( arr [ j ] != arr [ j + 1 ] ) break ; if ( arr [ j ] == arr [ j + 1 ] && j + 1 == end ) { works = true ; break outer ; }   } end ++ ; } int [ ] nums = new int [ 2 ] ; int dex = 0 ; for ( int i = 0 ; i < 6 ; i ++ ) { if ( i < start || i > end ) { nums [ dex ] = arr [ i ] ; dex ++ ; } } if ( ! works ) System . out . println ( \" Alien \" ) ; else { if ( nums [ 0 ] == nums [ 1 ] ) System . out . println ( \" Elephant \" ) ; else System . out . println ( \" Bear \" ) ; }    } }", "import java . util . Scanner ;   public class StickAnimal { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int [ ] sticks = new int [ 9 ] ; boolean flag = false ;   for ( int i = 0 ; i < 6 ; i ++ ) { if ( sticks [ scanner . nextInt ( ) - 1 ] ++ == 3 ) flag = true ; }   if ( flag ) { for ( int i = 0 ; i < 9 ; i ++ ) { if ( sticks [ i ] == 1 ) { System . out . println ( \" Bear \" ) ; return ; } } System . out . println ( \" Elephant \" ) ; } else System . out . println ( \" Alien \" ) ; } }" ]
[ "sticks = [ int ( asd ) for asd in input ( ) . split ( ) ] if len ( set ( sticks ) ) > 3 : print ( \" Alien \" ) exit ( ) res = max ( set ( sticks ) , key = sticks . count ) if sticks . count ( res ) < 4 : print ( \" Alien \" ) exit ( ) sticks2 = [ ] cnt = 4 for x in range ( sticks . count ( res ) - 4 ) : sticks2 . append ( res )   for bruh in sticks : if bruh != res : sticks2 . append ( bruh )   if len ( set ( sticks2 ) ) == 1 : print ( \" Elephant \" ) elif len ( set ( sticks2 ) ) == 2 : print ( \" Bear \" ) else : print ( \" Alien \" ) NEW_LINE", "if __name__ == ' _ _ main _ _ ' : Y = lambda : list ( map ( int , input ( ) . split ( ) ) ) P = lambda : map ( int , input ( ) . split ( ) )   a = Y ( ) a = sorted ( a , key = a . count )   if a [ 2 ] != a [ - 1 ] : print ( \" Alien \" ) elif a [ 0 ] == a [ 1 ] : print ( \" Elephant \" ) else : print ( \" Bear \" ) NEW_LINE", "from sys import stdin , stdoutfrom collections import Counternmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE", "a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 6 ) : if a . count ( a [ i ] ) >= 4 : v = a [ i ] breakelse : print ( \" Alien \" ) exit ( ) for i in range ( 4 ) : a . remove ( v ) a . sort ( ) if a [ 0 ] < a [ 1 ] : print ( \" Bear \" ) elif a [ 0 ] == a [ 1 ] : print ( \" Elephant \" ) else : print ( \" Alien \" ) NEW_LINE", "t = list ( map ( int , input ( ) . split ( ) ) )   c_max = 0 c_min = 6 for x in range ( 6 ) : c_max = max ( c_max , t . count ( t [ x ] ) ) c_min = min ( c_min , t . count ( t [ x ] ) )   if c_max < 4 : print ( ' Alien ' ) elif c_max == 4 : if c_min == 1 : print ( ' Bear ' ) else : print ( ' Elephant ' ) elif c_max == 5 : print ( ' Bear ' ) elif c_max == 6 : print ( ' Elephant ' ) NEW_LINE" ]
codeforces_1501_A
[ "import java . util . Scanner ; public class eqaution { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int t = scn . nextInt ( ) ; while ( t -- > 0 ) { int n = scn . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; int [ ] b = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = scn . nextInt ( ) ; b [ i ] = scn . nextInt ( ) ; } int [ ] tm = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { tm [ i ] = scn . nextInt ( ) ; } int last = 0 ; int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int arrival = a [ i ] - b [ i - 1 ] + last + tm [ i ] ; ans = arrival ; if ( arrival == a [ i ] ) { last = arrival + b [ i ] - a [ i ] ; } else { last = arrival + ( int ) Math . ceil ( ( b [ i ] - a [ i ] ) / 2.0 ) ; } } System . out . println ( ans ) ; } } }", "import java . util . * ; public class temp { public static void main ( String str [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; int dep [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; dep [ i ] = sc . nextInt ( ) ; } int del [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { del [ i ] = sc . nextInt ( ) ; } int curr = arr [ 0 ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) { int tem = ( int ) Math . ceil ( ( double ) ( dep [ i ] - arr [ i ] ) / 2 ) ; int ariv = curr + del [ i ] ; curr = arr [ i + 1 ] - dep [ i ] + Math . max ( ariv + tem , dep [ i ] ) ; } System . out . println ( curr + del [ n - 1 ] ) ; } } }", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int tc = sc . nextInt ( ) ; while ( tc -- > 0 ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n + 1 ] ; int b [ ] = new int [ n + 1 ] ; int tm [ ] = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; b [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i <= n ; i ++ ) { tm [ i ] = sc . nextInt ( ) ; } int prev = 0 ; int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { prev += a [ i ] - b [ i - 1 ] + tm [ i ] ; ans = prev ; prev += Math . ceil ( 1.0 * ( b [ i ] * 1.0 - a [ i ] * 1.0 ) / 2.0 ) ; prev = Math . max ( prev , b [ i ] ) ; } System . out . println ( ans ) ; } } }", "import java . util . * ; public class Test { static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int t = Integer . parseInt ( sc . next ( ) ) ; while ( t -- > 0 ) { solve ( ) ; } } public static void solve ( ) { int n = sc . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; int [ ] b = new int [ n + 1 ] ; int [ ] extra = new int [ n + 1 ] ; long curr_time = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; b [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i <= n ; i ++ ) { extra [ i ] = sc . nextInt ( ) ; } int i = 0 ; for ( i = 1 ; i < n ; i ++ ) { curr_time += ( a [ i ] - b [ i - 1 ] + extra [ i ] ) ; int staying = ( int ) Math . ceil ( ( b [ i ] - a [ i ] ) / 2.0 ) ; curr_time += staying ; if ( curr_time < b [ i ] ) curr_time = b [ i ] ; } curr_time += ( a [ i ] - b [ i - 1 ] + extra [ i ] ) ; System . out . println ( curr_time ) ; } }", "import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; int [ ] b = new int [ n + 1 ] ; int [ ] tm = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; b [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i <= n ; i ++ ) { tm [ i ] = sc . nextInt ( ) ; } int ans = 0 , at = 0 , dt = 0 ; for ( int i = 1 ; i < n ; i ++ ) { int rt = a [ i ] - b [ i - 1 ] ; int wt = ( b [ i ] - a [ i ] + 1 ) / 2 ; at = dt + rt + tm [ i ] ; if ( b [ i ] - at >= wt ) dt = b [ i ] ; else dt = at + wt ; } ans = a [ n ] - b [ n - 1 ] + dt + tm [ n ] ; System . out . println ( ans ) ; } sc . close ( ) ; } }" ]
[ "R = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE t , = R ( ) NEW_LINE while t : NEW_LINE INDENT t -= 1 ; NEW_LINE n , = R ( ) ; NEW_LINE a , b = zip ( * ( R ( ) for _ in [ 0 ] * n ) ) ; NEW_LINE s = 0 NEW_LINE for x , y , z , w in zip ( a , b , ( 0 , * b ) , R ( ) ) : p = s + x - z + w ; s = p + max ( y - x + 1 >> 1 , y - p ) NEW_LINE print ( p ) NEW_LINE DEDENT", "T = int ( input ( ) ) NEW_LINE for t in range ( T ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = [ ] NEW_LINE b = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT ai , bi = map ( int , input ( ) . split ( ) ) NEW_LINE a . append ( ai ) NEW_LINE b . append ( bi ) NEW_LINE DEDENT tm = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE t = a [ 0 ] + tm [ 0 ] NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT dep = max ( b [ i ] , t + ( b [ i ] - a [ i ] + 1 ) // 2 ) NEW_LINE t = dep + a [ i + 1 ] - b [ i ] + tm [ i + 1 ] NEW_LINE DEDENT print ( t ) NEW_LINE DEDENT", "for time in range ( int ( input ( ) ) ) : NEW_LINE INDENT n , a , b = int ( input ( ) ) , [ ] , [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT ai , bi = map ( int , input ( ) . split ( ) ) NEW_LINE a . append ( ai ) NEW_LINE b . append ( bi ) NEW_LINE DEDENT tm = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE time = a [ 0 ] + tm [ 0 ] NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT dep = max ( b [ i ] , time + ( b [ i ] - a [ i ] + 1 ) // 2 ) NEW_LINE time = dep + a [ i + 1 ] - b [ i ] + tm [ i + 1 ] NEW_LINE DEDENT print ( time ) NEW_LINE DEDENT", "for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = [ ] NEW_LINE b = [ ] NEW_LINE for _ in range ( n ) : NEW_LINE INDENT i , j = map ( int , input ( ) . split ( ) ) NEW_LINE a += [ i ] NEW_LINE b += [ j ] NEW_LINE DEDENT t = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE c = a [ 0 ] + t [ 0 ] NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT c = max ( c + ( b [ i ] - a [ i ] + 1 ) // 2 , b [ i ] ) NEW_LINE c += a [ i + 1 ] - b [ i ] + t [ i + 1 ] NEW_LINE DEDENT print ( c ) NEW_LINE DEDENT", "R = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE t , = R ( ) NEW_LINE while t : NEW_LINE INDENT t -= 1 ; NEW_LINE n , = R ( ) ; NEW_LINE a = [ ] ; NEW_LINE b = [ ] ; NEW_LINE s = 0 NEW_LINE for _ in [ 0 ] * n : x , y = R ( ) ; a += x , ; b += y , NEW_LINE for x , y , z , w in zip ( a , b , [ 0 ] + b , R ( ) ) : p = s + x - z + w ; s = p + max ( y - x + 1 >> 1 , y - p ) NEW_LINE print ( p ) NEW_LINE DEDENT" ]
codeforces_820_A
[ "import java . util . Scanner ;   public class MisterB { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int c = scanner . nextInt ( ) ; int v = scanner . nextInt ( ) ; int v1 = scanner . nextInt ( ) ; int a = scanner . nextInt ( ) ; int l = scanner . nextInt ( ) ;   System . out . println ( solve ( c , v , v1 , a , l ) ) ;   }   public static int solve ( int c , int v , int v1 , int a , int l ) { int counter = 0 ; for ( int i = 0 ; i < c ; i += v ) { if ( i != 0 ) { if ( v + a < v1 ) { v += a ; } else { v = v1 ; } i -= l ; } counter ++ ; } return counter ; } }", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) {    Scanner scanner = new Scanner ( System . in ) ;   int pages = scanner . nextInt ( ) ; int initialSpeed = scanner . nextInt ( ) ; int maxSpeed = scanner . nextInt ( ) ; int accelerate = scanner . nextInt ( ) ; int late = scanner . nextInt ( ) ;   System . out . println ( solve ( pages , initialSpeed , maxSpeed , accelerate , late ) ) ;   }   public static int solve ( int pages , int initialSpeed , int maxSpeed , int accelerate , int late ) {   int days = 0 ; int pageCounter = 0 ;   while ( pageCounter < pages ) { pageCounter += initialSpeed ; days ++ ;   if ( days > 1 ) pageCounter -= late ;   initialSpeed += accelerate ;   if ( initialSpeed > maxSpeed ) initialSpeed = maxSpeed ; }   return days ; } }  ", "  import java . util . Scanner ;   public class JavaApplication168 < T > {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c = sc . nextInt ( ) ; int v0 = sc . nextInt ( ) ; int v1 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int xx = v0 ; int pos = v0 ; int t = 1 ; while ( pos < c ) { xx = Math . min ( v1 , xx + a ) ; pos += xx - l ; t ++ ;   } System . out . println ( t ) ;    } }", "import java . io . * ; import java . util . * ; public class C421A { static PrintWriter out = new PrintWriter ( ( System . out ) ) ; public static void main ( String args [ ] ) throws IOException { Reader sc = new Reader ( ) ; int c = sc . nextInt ( ) ; int v0 = sc . nextInt ( ) ; int v1 = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int d = 1 ; int t = c ; c -= v0 ; if ( c > 0 ) { c = Math . min ( t , c + l ) ; int s = Math . min ( v0 + d * a , v1 ) ; while ( c > 0 ) { c -= s ; d ++ ; if ( c <= 0 ) { break ; } s = Math . min ( v0 + d * a , v1 ) ; c = Math . min ( t , c + l ) ; } } out . println ( d ) ; out . close ( ) ; }   static class Reader { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; public String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception 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 ( ) { try { return br . readLine ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return null ; }   public boolean hasNext ( ) { String next = null ; try { next = br . readLine ( ) ; } catch ( Exception e ) { } if ( next == null ) { return false ; } st = new StringTokenizer ( next ) ; return true ; } } }", "import java . util . Scanner ;   public class problem104 {   public static void main ( String [ ] args ) {" ]
[ "def solve ( c , v0 , v1 , a , l ) : count = 0 c -= v0 count += 1 if c <= 0 : return count d = 1 c += l while True : val = d * a + v0 if val > v1 : val = v1 c -= val count += 1 d += 1 if c <= 0 : return count c += l     def main ( ) : arr = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE", "c , v , max , a , l = map ( int , input ( ) . split ( ) )   i = 1 days = 1 page = v   while page < c : if v + i * a <= max : page = page - l + v + i * a else : page = page - l + max days += 1   i += 1   print ( days ) NEW_LINE", "c , v0 , v1 , a , l = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 tmp = 0 fa = 0 while True : temp = ( v0 + ( fa * a ) ) if ( temp >= v1 ) : tmp += v1 else : tmp += temp ans += 1 if ( tmp >= c ) : break fa += 1 tmp -= l NEW_LINE", "c , v0 , v1 , a , l = map ( int , input ( ) . split ( ) ) ans = 0 now = 0 while now < c : if now > 0 : now -= l now += v0 v0 = min ( v0 + a , v1 ) ans += 1 print ( ans ) NEW_LINE", "c , v0 , v1 , a , l = map ( int , input ( ) . split ( ) )   count = 0 days = 0     while ( 1 ) : if ( days == 0 ) : days += 1 count += v0 index = 0 else : count += min ( v0 + ( ( days ) * a ) , v1 ) - l days += 1 if ( count >= c ) : break ;   print ( days ) NEW_LINE" ]
codeforces_420_A
[ "# include < iostream > # include < iomanip > # include < vector > # include < math . h > # include < string > # include < sstream > # include < stdlib . h > # include < algorithm > # include < unordered_map > # include < unordered_set > # include < cstdlib > # include < climits > # include < cstring > # include < cmath > # include < map > # include < set > # include < stack > # include < queue >  # define fi ( x , y ) for ( size_t i ( x ) ; i < y ; i ++ )", "import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Comparator ; import java . util . InputMismatchException ; import java . util . Scanner ;   public class MainTest { public static void main ( String [ ] args ) {" ]
[ "valid = ' AHIMOTUVWXY '   s = input ( )   f = Truefor i in s : if i not in valid : f = False break   if s != s [ : : - 1 ] : f = False   print ( \" YES \" if f else \" NO \" ) NEW_LINE", "nama = input ( ) status = Falsenama = list ( nama ) for i in nama : if i == \" A \" or i == \" I \" or i == \" M \" or i == \" H \" or i == \" O \" or i == \" V \" or i == \" U \" or i == \" W \" or i == \" X \" or i == \" Y \" or i == \" T \" : ind = nama . index ( i ) a = ind + 1 if i != nama [ - a ] : status = False break else : status = True else : status = False break   if status : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "def tetap_identik ( nama ) : char_list = [ \" A \" , \" H \" , \" I \" , \" M \" , \" O \" , \" T \" , \" U \" , \" V \" , \" W \" , \" X \" , \" Y \" ] matched_list = [ characters in char_list for characters in nama ] if all ( matched_list ) : if nama == nama [ : : - 1 ] : return \" YES \" else : return \" NO \" else : return \" NO \"   nama = input ( ) . upper ( ) print ( tetap_identik ( nama ) ) NEW_LINE", "s = input ( ) def solve ( string ) : for i in s : if i not in \" AHIMOTUVWXY \" : return ( \" NO \" ) if s [ : : - 1 ] == s : return ( \" YES \" ) else : return ( \" NO \" ) print ( solve ( s ) ) NEW_LINE", "apa = input ( ) ha = [ \" A \" , \" H \" , ' I ' , ' M ' , ' O ' , ' T ' , ' U ' , ' V ' , ' W ' , ' X ' , ' Y ' ] for i in apa : if i not in ha : print ( \" NO \" ) breakelse : if apa == apa [ : : - 1 ] : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE" ]
codeforces_1227_B
[ "import java . util . ArrayList ; import java . util . Scanner ;   public class Box {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; k : while ( t -- > 0 ) { int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } int [ ] res = new int [ n ] ; int mx = 0 ; int [ ] b = new int [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( mx < a [ i ] ) { res [ i ] = a [ i ] ; ++ b [ a [ i ] ] ; } else if ( mx > a [ i ] ) { System . out . println ( \" - 1\" ) ; continue k ; } mx = Math . max ( mx , a [ i ] ) ; } ArrayList < Integer > ar = new ArrayList < Integer > ( ) ;   for ( int i = 1 ; i <= n ; i ++ ) { if ( b [ i ] == 0 ) { ar . add ( i ) ; } } int k = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( res [ i ] == 0 ) { res [ i ] = ar . get ( k ) ; ++ k ; } } mx = 0 ; for ( int i = 0 ; i < n ; i ++ ) { mx = Math . max ( mx , res [ i ] ) ; if ( mx != a [ i ] ) { System . out . println ( \" - 1\" ) ; continue k ; } }   for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( res [ i ] + \" ▁ \" ) ; } System . out . println ( ) ;   } } }", "import java . util . Scanner ; import java . util . TreeSet ; 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 ( ) ; TreeSet < Integer > pq = new TreeSet < > ( ) ; int arr [ ] = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = s . nextInt ( ) ; if ( arr [ i ] < i + 1 ) { ans = - 1 ; } pq . add ( i + 1 ) ; } if ( ans == - 1 ) { System . out . println ( ans ) ; } else { System . out . print ( arr [ 0 ] + \" ▁ \" ) ; pq . remove ( arr [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] > arr [ i - 1 ] ) { System . out . print ( arr [ i ] + \" ▁ \" ) ; pq . remove ( arr [ i ] ) ; } else { System . out . print ( pq . pollFirst ( ) + \" ▁ \" ) ; } } System . out . println ( ) ; } } } }" ]
[ "n = int ( input ( ) ) for i in range ( n ) : length = int ( input ( ) ) content = [ int ( k ) for k in input ( ) . split ( ) ] anslist = [ 0 ] * length poss = [ 1 ] * length index = 0 fail = 0 for j in range ( length ) : if j == 0 : anslist [ j ] = content [ j ] poss [ content [ j ] - 1 ] = 0 elif j != 0 and content [ j ] > content [ j - 1 ] : anslist [ j ] = content [ j ] poss [ content [ j ] - 1 ] = 0 else : while poss [ index ] == 0 : index += 1 if index == length : break if index < length and index + 1 <= content [ j ] : anslist [ j ] = index + 1 poss [ index ] = 0 else : fail = 1 break NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = [ ] cond = 0 d = { } e = { } for i in range ( n ) : if ( d . get ( a [ i ] ) == None ) : d [ a [ i ] ] = 1 else : d [ a [ i ] ] += 1 i = 0 cond1 = 0 k = 1 while ( i < n ) : if ( d [ a [ i ] ] <= a [ i ] ) : b . append ( a [ i ] ) e [ a [ i ] ] = 1 o = d [ a [ i ] ] d [ a [ i ] ] -= 1 while ( d [ a [ i ] ] != 0 ) : if ( e . get ( k ) == None ) : b . append ( k ) e [ k ] = 1 d [ a [ i ] ] -= 1 k += 1 if ( k > a [ i ] ) : cond1 = 1 break i += o if ( cond1 ) : cond = 1 break else : cond = 1 break if ( cond ) : print ( - 1 ) else : print ( * b ) NEW_LINE", "ll = lambda : map ( int , input ( ) . split ( ) ) t = lambda : int ( input ( ) ) ss = lambda : input ( ) NEW_LINE", "a = int ( input ( ) ) for x in range ( a ) : b = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) j = [ ] t = 1 s = { } ma = 0 g = 0 for y in range ( b ) : if y == 0 : s [ c [ y ] ] = 1 j . append ( c [ y ] ) ma = c [ y ]   else : if c [ y ] > ma : s [ c [ y ] ] = 1 j . append ( c [ y ] ) ma = c [ y ]   else : l = 0 while ( t < ma ) : if s . get ( t ) == None : s [ t ] = 1 j . append ( t ) l = - 1 break else : t += 1   if l != - 1 : g = - 1 break     if g == - 1 : print ( - 1 ) else : print ( * j )           NEW_LINE", "a = int ( input ( ) ) for x in range ( a ) : b = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) j = [ ] t = 1 s = { } ma = 0 g = 0 for y in range ( b ) : if y == 0 : s [ c [ y ] ] = 1 j . append ( c [ y ] ) ma = c [ y ]   else : if c [ y ] > ma : s [ c [ y ] ] = 1 j . append ( c [ y ] ) ma = c [ y ]   else : l = 0 while ( t < ma ) : if s . get ( t ) == None : s [ t ] = 1 j . append ( t ) l = - 1 break else : t += 1   if l != - 1 : g = - 1 break     if g == - 1 : print ( - 1 ) else : print ( * j )           NEW_LINE" ]
codeforces_189_B
[ "import java . util . * ; import java . io . * ; public class Counting_Rhombi {   public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int w = Integer . parseInt ( st . nextToken ( ) ) , h = Integer . parseInt ( st . nextToken ( ) ) ; long c = ( long ) ( Math . floor ( w / 2.0 ) * Math . ceil ( w / 2.0 ) * Math . floor ( h / 2.0 ) * Math . ceil ( h / 2.0 ) ) ; System . out . println ( c ) ; }   }", "import java . io . BufferedReader ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class counting {   public static void main ( String [ ] args ) {", "import java . util . * ; import java . io . * ;   public class Solution { public static PrintWriter w = new PrintWriter ( System . out ) ; public static void main ( String args [ ] ) throws Exception { Reader in = new Reader ( ) ; long w = in . nextLong ( ) ; long h = in . nextLong ( ) ; long ans = 0 ; long a = ( h / 2 ) * ( h - h / 2 ) ; for ( int i = 1 ; i <= w ; i ++ ) ans += ( Math . min ( i , w - i ) * a ) ; System . out . println ( ans ) ;", "import java . util . Scanner ; import java . util . Arrays ; public class Ishu { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int w , h , x , y ; long ans = 0 , ax , ay ; w = scan . nextInt ( ) ; h = scan . nextInt ( ) ; for ( x = 1 ; x < w ; ++ x ) { ax = ( x - 0 ) <= ( w - x ) ? ( x - 0 ) : ( w - x ) ; for ( y = 1 ; y < h ; ++ y ) { ay = ( y - 0 ) <= ( h - y ) ? ( y - 0 ) : ( h - y ) ; ans += ax * ay ; } } System . out . println ( ans ) ; } }", "import java . util . * ;    public class Main { private static Scanner in = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) {" ]
[ "x , y = map ( int , input ( ) . split ( ) ) x = x ** 2 y = y ** 2 ans = ( x // 4 ) * ( y // 4 )   print ( ans ) NEW_LINE", "x , y = map ( int , input ( ) . split ( ) ) ; ans = 0 for i in range ( 2 , x + 1 , 2 ) : for j in range ( 2 , y + 1 , 2 ) : ans += ( x - i + 1 ) * ( y - j + 1 ) print ( ans ) NEW_LINE", "n , w = map ( int , input ( ) . split ( ) ) ans = 0 for x in range ( 1 , n ) : for y in range ( w - 1 ) : ans += ( ( w - y ) // 2 ) * min ( x , n - x ) print ( ans ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) ; s = 0 for i in range ( 2 , a + 1 , 2 ) : for j in range ( 2 , b + 1 , 2 ) : s += ( a - i + 1 ) * ( b - j + 1 ) print ( s ) NEW_LINE" ]
codeforces_1481_A
[ "import java . util . * ; import java . lang . * ; public class A1481 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int px = sc . nextInt ( ) ; int py = sc . nextInt ( ) ; String s = sc . next ( ) ; int x = 0 , y = 0 ; char ch = ' ▁ ' , ch2 = ' ▁ ' ; char ch3 = ' ▁ ' ; if ( px > 0 ) ch = ' R ' ; else ch = ' L ' ; if ( py > 0 ) ch2 = ' U ' ; else ch2 = ' D ' ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { ch3 = s . charAt ( i ) ; if ( ch3 == ch ) x += 1 ; if ( ch3 == ch2 ) y += 1 ; } if ( ( Math . abs ( px ) <= x ) && ( Math . abs ( py ) <= y ) ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } } }", "import java . util . * ; public class SpaceNavigation { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t , x , y , u , d , r , l ; String s = \" \" ; x = y = u = d = r = l = 0 ; t = sc . nextInt ( ) ; while ( t -- > 0 ) { x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' U ' ) u ++ ; else if ( s . charAt ( i ) == ' D ' ) d -- ; else if ( s . charAt ( i ) == ' R ' ) r ++ ; else l -- ; } if ( ( y >= d && y <= u ) && ( x >= l && x <= r ) ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; l = d = r = u = 0 ; } } }", "import java . util . * ; public class CodeForces1481A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ; for ( int j = 0 ; j < t ; j ++ ) { int px = input . nextInt ( ) ; int py = input . nextInt ( ) ; String s = input . next ( ) ; char x = ' L ' ; char y = ' D ' ; if ( px > 0 ) { x = ' R ' ; } if ( py > 0 ) { y = ' U ' ; } int count_x = 0 ; int count_y = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == x ) { count_x ++ ; } else if ( s . charAt ( i ) == y ) { count_y ++ ; } } if ( count_x >= Math . abs ( px ) && count_y >= Math . abs ( py ) ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; public class Practice { public static void main ( String [ ] args ) throws NumberFormatException , IOException { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( ( t -- ) > 0 ) { int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; String str = s . next ( ) ; int u = 0 , d = 0 , l = 0 , r = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' U ' ) { u ++ ; } else if ( str . charAt ( i ) == ' D ' ) { d -- ; } else if ( str . charAt ( i ) == ' L ' ) { l -- ; } else { r ++ ; } } if ( n >= l && n <= r && m >= d && m <= u ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } } }", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int tt = sc . nextInt ( ) ; while ( tt -- > 0 ) { int x = sc . nextInt ( ) , y = sc . nextInt ( ) ; char [ ] str = sc . next ( ) . toCharArray ( ) ; int maxx = 0 , maxy = 0 , minx = 0 , miny = 0 ; for ( char c : str ) { if ( c == ' R ' ) maxx ++ ; else if ( c == ' L ' ) minx -- ; else if ( c == ' U ' ) maxy ++ ; else miny -- ; } System . out . println ( maxx >= x && minx <= x && maxy >= y && miny <= y ? \" Yes \" : \" No \" ) ; } sc . close ( ) ; } }" ]
[ "I = input NEW_LINE exec ( int ( I ( ) ) * \" x , y = map ( int , I ( ) . split ( ) ) ; u , d , r , l = map ( I ( ) . count , ' UDRL ' ) ; print ( ' NYOE ▁ S ' [ - d < = y < = u ▁ and - l < = x < = r : :2 ] ) ; \" ) NEW_LINE", "I = input NEW_LINE for _ in [ 0 ] * int ( I ( ) ) : x , y = map ( int , I ( ) . split ( ) ) ; f = I ( ) . count ; print ( ' YNEOS ' [ f ( ' UD ' [ y < 0 ] ) < abs ( y ) or f ( ' RL ' [ x < 0 ] ) < abs ( x ) : : 2 ] ) NEW_LINE", "I = input NEW_LINE exec ( int ( I ( ) ) * \" x , y = map ( int , I ( ) . split ( ) ) ; f = I ( ) . count ; print ( ' YNEOS ' [ y > f ( ' U ' ) or - y > f ( ' D ' ) or ▁ x > f ( ' R ' ) or - x > f ( ' L ' ) : :2 ] ) ; \" ) NEW_LINE", "I = input NEW_LINE exec ( int ( I ( ) ) * \" x , y = map ( int , I ( ) . split ( ) ) ; f = I ( ) . count ; print ( ' YNEOS ' [ f ( ' UD ' [ y < 0 ] ) < abs ( y ) or ▁ f ( ' RL ' [ x < 0 ] ) < abs ( x ) : : 2 ] ) ; \" ) NEW_LINE", "I = input NEW_LINE exec ( int ( I ( ) ) * \" x , y = map ( int , I ( ) . split ( ) ) ; u , d , r , l = map ( I ( ) . count , ' UDRL ' ) ; print ( ' NYOE ▁ S ' [ - d < = y < = u ▁ and - l < = x < = r : :2 ] ) ; \" ) NEW_LINE" ]
codeforces_584_A
[ "import java . util . * ; import java . io . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String x = sc . next ( ) ; if ( n == 1 & x . equals ( \"10\" ) ) { System . out . println ( - 1 ) ; return ; } if ( x . equals ( \"10\" ) ) { while ( n -- > 2 ) { x += \"0\" ; } } else { while ( n -- > 1 ) { x += \"0\" ; } } System . out . println ( x ) ; } }", "import java . math . * ; import java . util . * ;   public class olesyaNRodion { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; String s = \" \" ; if ( t == 10 && n < 2 ) System . out . println ( \" - 1\" ) ; else if ( t == 10 && n >= 2 ) { for ( int i = 0 ; i < n - 1 ; ++ i ) s += Integer . toString ( 1 ) ; s += Integer . toString ( 0 ) ; System . out . println ( s ) ; } else { for ( int i = 0 ; i < n ; ++ i ) s += Integer . toString ( t ) ; System . out . println ( s ) ; } } }", "import java . util . Scanner ; import java . lang . Math ;   public class p584a_Olesya_and_Rodion { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int n = input . nextInt ( ) ; int t = input . nextInt ( ) ; if ( n == 1 ) { if ( t == 10 ) { System . out . print ( - 1 ) ; } else { System . out . print ( t ) ; } } else { if ( t == 10 ) { t -- ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . print ( t ) ; } System . out . print ( 0 ) ; } } }", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ;" ]
[ "def func1 ( n , t , ) : NEW_LINE", "x , y = map ( int , input ( ) . split ( ) ) if y < 10 : for i in range ( x ) : print ( y , end = \" \" ) else : if x == 1 : print ( - 1 ) else : s = 10 ** ( x - 1 ) print ( s ) NEW_LINE", "n , t = map ( int , input ( ) . split ( \" ▁ \" ) )   for i in range ( 10 ** ( n - 1 ) , 10 ** ( n ) ) : if ( i % t == 0 ) : print ( i ) breakelse : print ( - 1 ) NEW_LINE", "n , t = map ( int , input ( ) . split ( ) ) if t == 10 : if n == 1 : print ( - 1 ) else : print ( '1' + '0' * ( n - 1 ) ) else : print ( str ( t ) * n ) NEW_LINE" ]
codeforces_222_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 . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Main {", "import java . io . * ; import java . util . * ; import java . util . stream . Collectors ;   public class cpp { 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 ( ) ) ; } char nextChar ( ) { return next ( ) . charAt ( 0 ) ; } 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 ) throws IOException {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class B222 {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( br . readLine ( ) ) ; int R = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int C = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int Q = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int [ ] [ ] A = new int [ R ] [ C ] ; for ( int r = 0 ; r < R ; r ++ ) { tokenizer = new StringTokenizer ( br . readLine ( ) ) ; for ( int c = 0 ; c < C ; c ++ ) { A [ r ] [ c ] = Integer . parseInt ( tokenizer . nextToken ( ) ) ; } } int [ ] rows = new int [ R ] ; int [ ] columns = new int [ C ] ; for ( int r = 0 ; r < R ; r ++ ) { rows [ r ] = r ; } for ( int c = 0 ; c < C ; c ++ ) { columns [ c ] = c ; } StringBuilder output = new StringBuilder ( ) ; for ( int q = 0 ; q < Q ; q ++ ) { tokenizer = new StringTokenizer ( br . readLine ( ) ) ; char type = tokenizer . nextToken ( ) . charAt ( 0 ) ; int x = Integer . parseInt ( tokenizer . nextToken ( ) ) - 1 ; int y = Integer . parseInt ( tokenizer . nextToken ( ) ) - 1 ; if ( type == ' c ' ) { int temp = columns [ x ] ; columns [ x ] = columns [ y ] ; columns [ y ] = temp ; } else if ( type == ' r ' ) { int temp = rows [ x ] ; rows [ x ] = rows [ y ] ; rows [ y ] = temp ; } else { int answer = A [ rows [ x ] ] [ columns [ y ] ] ; output . append ( answer ) . append ( ' \\n ' ) ; } } System . out . print ( output ) ; }   }" ]
[ "n , m , k = list ( map ( int , input ( ) . split ( ) ) ) matrix = [ input ( ) . split ( ) for i in range ( n ) ] row = [ i for i in range ( n ) ] col = [ i for i in range ( m ) ]   ans = [ ] for i in range ( k ) : s , x , y = input ( ) . split ( ) x , y = int ( x ) - 1 , int ( y ) - 1 if s == \" c \" : col [ x ] , col [ y ] = col [ y ] , col [ x ] elif s == \" r \" : row [ x ] , row [ y ] = row [ y ] , row [ x ] else : ans . append ( matrix [ row [ x ] ] [ col [ y ] ] )   print ( \" \\n \" . join ( ans ) ) NEW_LINE", "n , m , k = map ( int , input ( ) . split ( ) ) a = [ input ( ) . split ( ) for _ in ' ▁ ' * n ] r = { str ( i ) : i - 1 for i in range ( 1 , n + 1 ) } c = { str ( i ) : i - 1 for i in range ( 1 , m + 1 ) } ans = [ ] for _ in range ( k ) : ch , x , y = input ( ) . split ( ) if ch == ' c ' : c [ x ] , c [ y ] = c [ y ] , c [ x ] elif ch == ' r ' : r [ x ] , r [ y ] = r [ y ] , r [ x ] else : ans . append ( a [ r [ x ] ] [ c [ y ] ] ) print ( ' \\n ' . join ( ans ) ) NEW_LINE", "row , col , k = map ( int , input ( ) . split ( \" ▁ \" ) ) li = [ ] res = [ ] for x in range ( row ) : li . append ( input ( ) . split ( \" ▁ \" ) )     rowchange = [ x for x in range ( row ) ] colchange = [ x for x in range ( col ) ]     for x in range ( k ) : type , i1 , i2 = input ( ) . split ( ) i1 = int ( i1 ) - 1 i2 = int ( i2 ) - 1 if type == \" r \" : rowchange [ i2 ] , rowchange [ i1 ] = rowchange [ i1 ] , rowchange [ i2 ] elif type == ' c ' :   colchange [ i1 ] , colchange [ i2 ] = colchange [ i2 ] , colchange [ i1 ]   else : NEW_LINE", "n , m , k = map ( int , input ( ) . split ( ) ) R = { str ( i ) : i - 1 for i in range ( n + 1 ) } C = { str ( i ) : i - 1 for i in range ( m + 1 ) } ans = [ ] l = [ input ( ) . split ( ) for i in range ( n ) ] for i in range ( k ) : q , x , y = input ( ) . split ( ) if q == ' c ' : C [ x ] , C [ y ] = C [ y ] , C [ x ] elif q == ' r ' : R [ x ] , R [ y ] = R [ y ] , R [ x ] else : ans . append ( l [ R [ x ] ] [ C [ y ] ] ) print ( ' \\n ' . join ( ans ) ) NEW_LINE" ]
codeforces_499_B
[ "import java . util . ArrayList ; import java . util . HashMap ; import java . util . Scanner ;   public class Lecture { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; short n = Short . parseShort ( scanner . next ( ) ) ; short m = Short . parseShort ( scanner . next ( ) ) ; HashMap < String , String > words = new HashMap < > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { words . put ( scanner . next ( ) , scanner . next ( ) ) ; } ArrayList < String > lecture = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { lecture . add ( scanner . next ( ) ) ; } solve ( lecture , words ) ; }   public static void solve ( ArrayList < String > lecture , HashMap < String , String > words ) { for ( int i = 0 ; i < lecture . size ( ) ; i ++ ) { if ( words . get ( lecture . get ( i ) ) . length ( ) < lecture . get ( i ) . length ( ) ) lecture . set ( i , words . get ( lecture . get ( i ) ) ) ; } for ( int i = 0 ; i < lecture . size ( ) - 1 ; i ++ ) { System . out . print ( lecture . get ( i ) + \" ▁ \" ) ; } System . out . println ( lecture . get ( lecture . size ( ) - 1 ) ) ; } }", "import java . util . HashMap ; import java . util . Scanner ;   public class Lecture { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; HashMap < String , String > words = new HashMap < > ( ) ; String [ ] lecture = new String [ n ] ; String res = \" \" ;   for ( int i = 0 ; i < m ; i ++ ) { words . put ( scanner . next ( ) , scanner . next ( ) ) ; } for ( int i = 0 ; i < n ; i ++ ) { lecture [ i ] = scanner . next ( ) ; }   for ( int i = 0 ; i < n ; i ++ ) { if ( lecture [ i ] . length ( ) > words . get ( lecture [ i ] ) . length ( ) ) { res = res . concat ( words . get ( lecture [ i ] ) ) ; res = res . concat ( \" ▁ \" ) ; } else { res = res . concat ( lecture [ i ] ) ; res = res . concat ( \" ▁ \" ) ; } }   System . out . println ( res ) ;    } }", "import java . util . * ;   public class Solve {   static Scanner scan = new Scanner ( System . in ) ;    public static void solve ( int n , int m , String [ ] lang1 , String [ ] lang2 , String [ ] c ) {   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( c [ i ] . equals ( lang1 [ j ] ) ) { if ( lang1 [ j ] . length ( ) == lang2 [ j ] . length ( ) ) { System . out . print ( lang1 [ j ] + \" ▁ \" ) ; } else if ( lang1 [ j ] . length ( ) > lang2 [ j ] . length ( ) ) { System . out . print ( lang2 [ j ] + \" ▁ \" ) ; } else { System . out . print ( lang1 [ j ] + \" ▁ \" ) ; } } } } }   public static void main ( String [ ] args ) {   int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ;   String [ ] lang1 = new String [ m ] ; String [ ] lang2 = new String [ m ] ;   String [ ] c = new String [ n ] ;   for ( int i = 0 ; i < m ; i ++ ) { lang1 [ i ] = scan . next ( ) ; lang2 [ i ] = scan . next ( ) ; }   for ( int i = 0 ; i < n ; i ++ ) { c [ i ] = scan . next ( ) ; } solve ( n , m , lang1 , lang2 , c ) ; } }" ]
[ "a , b = map ( int , input ( ) . split ( ) ) l = { } for i in range ( b ) : p , q = input ( ) . split ( ) if ( len ( q ) >= len ( p ) ) : l [ p ] = p else : l [ p ] = qk = input ( ) . split ( ) for i in k : print ( l [ i ] ) NEW_LINE", "list1 = [ int ( i ) for i in input ( \" \" ) . split ( \" ▁ \" ) ] list2 = [ ] list3 = [ ] n = list1 [ 1 ] while n : list3 = [ i for i in input ( \" \" ) . split ( \" ▁ \" ) ] for i in list3 : list2 . append ( i ) n -= 1 s = input ( \" \" ) . split ( \" ▁ \" ) for i in s : if i in list2 : ind = list2 . index ( i ) if len ( list2 [ ind + 1 ] ) < len ( list2 [ ind ] ) : print ( list2 [ ind + 1 ] , end = \" ▁ \" ) else : print ( list2 [ ind ] , end = \" ▁ \" ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) arr = { } for _ in range ( b ) : x , y = input ( ) . split ( ) arr [ x ] = y       s = input ( ) . split ( )   for i in s : val = arr [ i ] if len ( val ) < len ( i ) : print ( val , end = \" ▁ \" ) else : print ( i , end = \" ▁ \" ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) l1 = [ ] l2 = [ ]   for i in range ( m ) : s1 , s2 = input ( ) . split ( ) l1 . append ( s1 ) l2 . append ( s2 ) k = list ( input ( ) . split ( ) )   for i in range ( len ( k ) ) : l = l1 . index ( k [ i ] ) if ( len ( l2 [ l ] ) < len ( l1 [ l ] ) ) : k [ i ] = l2 [ l ] print ( * k ) NEW_LINE", "a , b = ( map ( int , input ( ) . split ( ) ) ) dic = { } for i in range ( b ) : a = input ( ) . split ( ' ▁ ' ) if ( len ( a [ 0 ] ) > len ( a [ 1 ] ) ) : dic [ a [ 0 ] ] = a [ 1 ] dic [ a [ 1 ] ] = a [ 1 ] else : dic [ a [ 0 ] ] = a [ 0 ] dic [ a [ 1 ] ] = a [ 0 ] t = input ( ) . split ( ) for i in range ( len ( t ) ) : print ( dic [ t [ i ] ] , end = ' ▁ ' ) NEW_LINE" ]
codeforces_205_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; int n = sc . nextInt ( ) ; Long a [ ] = sc . readArray ( n ) ; Long maxi = 0L , ans = 0L ; for ( int i = 0 ; i < n ; i ++ ) { maxi = Math . max ( maxi , a [ i ] ) ; a [ i ] = maxi - a [ i ] ; } Long prev = 0L ; for ( int i = 0 ; i < n ; i ++ ) if ( a [ i ] >= prev ) prev = a [ i ] ; else { ans += prev - a [ i ] ; prev = a [ i ] ; } System . out . println ( ans + prev ) ; } 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 ( ) ) ; } Long [ ] readArray ( int n ) { Long [ ] a = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }", "import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException {", "import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException {", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {" ]
[ "n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) c = 0 s = 0 for i in range ( 1 , n ) : x [ i ] += c if x [ i ] < x [ i - 1 ] : c += x [ i - 1 ] - x [ i ] x [ i ] = x [ i - 1 ] print ( c ) NEW_LINE", "m = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) t = 0 print ( sum ( l [ i ] - l [ i + 1 ] for i in range ( m - 1 ) if l [ i ] > l [ i + 1 ] ) ) NEW_LINE", "from sys import stdin , stdoutfrom os import pathrd = lambda : stdin . readline ( ) . strip ( ) wr = stdout . writeif ( path . exists ( ' input . txt ' ) ) : stdin = open ( \" input . txt \" , \" r \" ) import time NEW_LINE" ]
codeforces_1323_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 ( ) {", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . util . ArrayList ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BCountSubrectangles solver = new BCountSubrectangles ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class BCountSubrectangles { public void solve ( int testNumber , FastReader in , PrintWriter out ) { int n = in . nextInt ( ) , m = in . nextInt ( ) , k = in . nextInt ( ) ; int [ ] a = in . readArray ( n ) , b = in . readArray ( m ) ; ArrayList < Integer > divisors = func . getDivisors ( k ) ; long ans = 0 ; for ( Integer row : divisors ) { int cnt = 0 , rowCnt = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( a [ i ] == 1 ) { cnt ++ ; } else { if ( cnt >= row ) { rowCnt += cnt - row + 1 ; } cnt = 0 ; } } if ( cnt >= row ) { rowCnt += cnt - row + 1 ; } int col = k / row , colCnt = 0 ; cnt = 0 ; for ( int i = 0 ; i < m ; ++ i ) { if ( b [ i ] == 1 ) { cnt ++ ; } else { if ( cnt >= col ) { colCnt += cnt - col + 1 ; } cnt = 0 ; } } if ( cnt >= col ) { colCnt += cnt - col + 1 ; } ans += ( long ) rowCnt * colCnt ; } out . println ( ans ) ; }   }   static class func { public static ArrayList < Integer > getDivisors ( int n ) {" ]
[ "''' ▁ ▁ ▁ ▁ Auther : ▁ ghoshashis545 ▁ Ashis ▁ Ghosh ▁ ▁ ▁ ▁ College : ▁ jalpaiguri ▁ Govt ▁ Enggineering ▁ College  ''' from os import pathfrom io import BytesIO , IOBaseimport sysfrom heapq import heappush , heappopfrom functools import cmp_to_key as ctkfrom collections import deque , Counter , defaultdict as dd from bisect import bisect , bisect_left , bisect_right , insort , insort_left , insort_rightfrom itertools import permutationsfrom datetime import datetimefrom math import ceil , sqrt , log , gcddef ii ( ) : return int ( input ( ) ) def si ( ) : return input ( ) . rstrip ( ) def mi ( ) : return map ( int , input ( ) . split ( ) ) def li ( ) : return list ( mi ( ) ) abc = ' abcdefghijklmnopqrstuvwxyz ' mod = 1000000007 NEW_LINE", "from collections import defaultdict   t = 1 for _ in range ( t ) : n , m , k = [ int ( i ) for i in input ( ) . split ( ) ] a = [ int ( i ) for i in input ( ) . split ( ) ] b = [ int ( i ) for i in input ( ) . split ( ) ] cont_ones = [ ] count = 0 for i in range ( n ) : if a [ i ] == 1 : count += 1 else : cont_ones . append ( count ) count = 0 if count > 0 : cont_ones . append ( count ) Dict_a = defaultdict ( int ) for i in range ( len ( cont_ones ) ) : for j in range ( 1 , min ( k + 1 , cont_ones [ i ] + 1 ) ) : Dict_a [ j ] += ( cont_ones [ i ] - j + 1 ) cont_ones = [ ] count = 0 for i in range ( m ) : if b [ i ] == 1 : count += 1 else : cont_ones . append ( count ) count = 0 if count > 0 : cont_ones . append ( count ) Dict_b = defaultdict ( int ) for i in range ( len ( cont_ones ) ) : for j in range ( 1 , min ( k + 1 , cont_ones [ i ] + 1 ) ) : Dict_b [ j ] += ( cont_ones [ i ] - j + 1 ) vals = list ( Dict_b . keys ( ) ) ans = 0 for i in vals : needed = k / i ans += ( Dict_b [ i ] * Dict_a [ needed ] ) print ( ans )         NEW_LINE", "import os , sysfrom io import IOBase , BytesIOpy2 = round ( 0.5 ) if py2 : from future_builtins import ascii , filter , hex , map , oct , zip range = xrangeBUFSIZE = 8192 class FastIO ( BytesIO ) : newlines = 0 def __init__ ( self , file ) : self . _file = file self . _fd = file . fileno ( ) self . writable = ' x ' in file . mode or ' w ' in file . mode self . write = super ( FastIO , self ) . write if self . writable else None def _fill ( self ) : s = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) self . seek ( ( self . tell ( ) , self . seek ( 0 , 2 ) , super ( FastIO , self ) . write ( s ) ) [ 0 ] ) return s def read ( self ) : while self . _fill ( ) : pass return super ( FastIO , self ) . read ( ) def readline ( self ) : while self . newlines == 0 : s = self . _fill ( ) ; self . newlines = s . count ( b ' \\n ' ) + ( not s ) self . newlines -= 1 return super ( FastIO , self ) . readline ( ) def flush ( self ) : if self . writable : os . write ( self . _fd , self . getvalue ( ) ) self . truncate ( 0 ) , self . seek ( 0 ) class IOWrapper ( IOBase ) : def __init__ ( self , file ) : self . buffer = FastIO ( file ) self . flush = self . buffer . flush self . writable = self . buffer . writable if py2 : self . write = self . buffer . write self . read = self . buffer . read self . readline = self . buffer . readline else : self . write = lambda s : self . buffer . write ( s . encode ( ' ascii ' ) ) self . read = lambda : self . buffer . read ( ) . decode ( ' ascii ' ) self . readline = lambda : self . buffer . readline ( ) . decode ( ' ascii ' ) sys . stdin , sys . stdout = IOWrapper ( sys . stdin ) , IOWrapper ( sys . stdout ) input = lambda : sys . stdin . readline ( ) . rstrip ( ' \\n ' ) NEW_LINE", "def gen_tbl ( a ) : n = len ( a ) ans = [ 0 ] * ( n + 1 ) so_far = 0 for i in range ( n ) : if a [ i ] == 0 : for j in range ( 1 , so_far + 1 ) : ans [ j ] += ( so_far - j + 1 ) so_far = 0 else : so_far += 1 for j in range ( 1 , so_far + 1 ) : ans [ j ] += ( so_far - j + 1 ) so_far = 0 return ans   n , m , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) )   ans = 0 tbl_a = gen_tbl ( a ) tbl_b = gen_tbl ( b ) for i in range ( 1 , n + 1 ) : j = k // i if k != i * j : continue if j <= m : ans += tbl_a [ i ] * tbl_b [ j ] print ( ans ) NEW_LINE", "def getd ( a , n ) : d = { i : 0 for i in range ( 1 , n + 1 ) } s = 0 a . append ( 0 ) for i in range ( n + 1 ) : if a [ i ] == 1 : s += 1 else : for j in range ( 1 , s + 1 ) : d [ j ] += ( s - j + 1 ) s = 0 return d   n , m , k = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) v = int ( k ** 0.5 ) + 1 divs = [ ] for i in range ( 1 , v ) : if k % i == 0 : divs . append ( ( i , k // i ) ) da = getd ( a , n ) db = getd ( b , m ) s = 0 for i , j in divs : if i <= n and j <= m : s += da [ i ] * db [ j ] if i != j : if j <= n and i <= m : s += da [ j ] * db [ i ] print ( s ) NEW_LINE" ]
codeforces_1279_A
[ "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 . util . * ;   public class Absolutezero {    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 1 ; i <= t ; i ++ ) { int r = sc . nextInt ( ) ; int g = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] ar = new int [ 3 ] ; ar [ 0 ] = r ; ar [ 1 ] = g ; ar [ 2 ] = b ; Arrays . sort ( ar ) ; if ( ( ar [ 0 ] + ar [ 1 ] ) >= ( ar [ 2 ] - 1 ) ) { System . out . println ( \" Yes \" ) ; } else { System . out . println ( \" No \" ) ; }     }     }   }", "import java . util . * ;   public class Absolutezero {    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 1 ; i <= t ; i ++ ) { int r = sc . nextInt ( ) ; int g = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] ar = new int [ 3 ] ; ar [ 0 ] = r ; ar [ 1 ] = g ; ar [ 2 ] = b ; Arrays . sort ( ar ) ; if ( ( ar [ 0 ] + ar [ 1 ] ) >= ( ar [ 2 ] - 1 ) ) { System . out . println ( \" Yes \" ) ; } else { System . out . println ( \" No \" ) ; }     }     }   }" ]
[ "t = int ( input ( ) ) for i in range ( t ) : r , g , b = sorted ( map ( int , input ( ) . split ( ) ) ) if ( b > g + r + 1 ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "n = int ( input ( ) ) for i in range ( n ) : a , b , c = [ int ( x ) for x in input ( ) . split ( ) ] if max ( a , b , c ) == a : if b + c < a - 1 : print ( \" NO \" ) else : print ( \" YES \" ) elif max ( a , b , c ) == b : if a + c < b - 1 : print ( \" NO \" ) else : print ( \" YES \" ) else : if a + b < c - 1 : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "def max3 ( a , b , c ) : if max ( b , c ) == b : if max ( a , b ) == a : return a else : return b else : if max ( a , c ) == a : return a else : return cdef garland ( a , b , c ) : first = max3 ( a , b , c ) if first == a : second = max ( b , c ) third = min ( b , c ) elif first == b : second = max ( a , c ) third = min ( a , c ) else : second = max ( a , b ) third = min ( a , b ) if first > second + third + 1 : return ' No ' else : return ' Yes ' x = int ( input ( ) ) m = [ ] for i in range ( x ) : y = input ( ) z = y . split ( ' ▁ ' ) k = [ int ( t ) for t in z ] m . append ( k ) for j in range ( x ) : print ( garland ( m [ j ] [ 0 ] , m [ j ] [ 1 ] , m [ j ] [ 2 ] ) ) NEW_LINE", "t = int ( input ( ) ) while ( t > 0 ) :   a , b , c = map ( int , input ( ) . split ( ) ) n = a + b + c if ( a >= b and a >= c ) : d = a elif ( b >= a and b >= c ) : d = b else : d = c   if ( n % 2 == 0 ) : if ( d <= n / 2 ) : print ( \" Yes \" ) else : print ( \" No \" ) else :   if ( d <= ( n / 2 ) + 1 ) : print ( \" Yes \" )   else : print ( \" No \" ) t -= 1   NEW_LINE", "cases = int ( input ( ) ) while cases : cases -= 1 arr = sorted ( map ( int , input ( ) . split ( ) ) )   if arr [ 0 ] + arr [ 1 ] + 1 >= arr [ 2 ] : print ( \" Yes \" ) else : print ( \" No \" ) NEW_LINE" ]
codeforces_424_A
[ "import java . util . * ; import java . io . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; scan . nextLine ( ) ; String s = scan . nextLine ( ) ; int Xnum = 0 ; int xnum = 0 ; StringBuilder result = new StringBuilder ( ) ; for ( int j = 0 ; j < n ; j ++ ) { char ch = s . charAt ( j ) ; if ( ch == ' X ' ) { Xnum ++ ; } else { xnum ++ ; } } if ( Xnum == xnum ) { result . append ( \"0 \\n \" + s ) ; } else { int r = Math . max ( Xnum - n / 2 , xnum - n / 2 ) ; StringBuilder sr = new StringBuilder ( ) ; for ( int j = 0 ; j < n ; j ++ ) { char ch = s . charAt ( j ) ; if ( ch == ' X ' && Xnum > xnum && r > 0 ) { sr . append ( ' x ' ) ; r -- ; } else if ( ch == ' x ' && Xnum < xnum && r > 0 ) { sr . append ( ' X ' ) ; r -- ; } else { sr . append ( ch ) ; } } result . append ( Math . max ( Xnum - n / 2 , xnum - n / 2 ) + \" \\n \" + sr ) ; } System . out . println ( result ) ; } }", "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 . * ; import java . lang . * ; import java . io . * ;   public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception {", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; String s = in . next ( ) ; int cx = 0 , cX = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' x ' ) cx ++ ; else cX ++ ; } System . out . println ( Math . abs ( n / 2 - cx ) ) ; String str = \" \" ; int x = cx - n / 2 ; for ( int i = 0 ; i < n && x > 0 ; i ++ ) { if ( s . charAt ( i ) == ' x ' ) { s = s . substring ( 0 , i ) + ( char ) ( s . charAt ( i ) - 32 ) + s . substring ( i + 1 , n ) ; x -- ; } } x = cX - n / 2 ; for ( int i = 0 ; i < n && x > 0 ; i ++ ) { if ( s . charAt ( i ) == ' X ' ) { s = s . substring ( 0 , i ) + ( char ) ( s . charAt ( i ) + 32 ) + s . substring ( i + 1 , n ) ; x -- ; } } System . out . println ( s ) ; } }", "import java . util . * ; import java . io . * ; import java . lang . * ; import java . math . BigInteger ;   public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ;" ]
[ "n = int ( input ( ) )   s = input ( )   a = s . count ( ' X ' ) b = s . count ( ' x ' )   if a == b : print ( 0 ) print ( s ) else : if a > b : c = a - n // 2 s = s . replace ( ' X ' , ' x ' , c ) print ( c ) else : c = b - n // 2 print ( c ) s = s . replace ( ' x ' , ' X ' , c )   print ( s ) NEW_LINE", "def solve ( s ) : u = 0 d = 0 for c in s : if c == ' X ' : u += 1 else : d += 1 res = abs ( d - u ) // 2 s = list ( s ) i = 0 while res > 0 : if s [ i ] == ' x ' and d > u : s [ i ] = ' X ' res -= 1 elif s [ i ] == ' X ' and u > d : s [ i ] = ' x ' res -= 1 i += 1 print ( abs ( d - u ) // 2 ) print ( \" \" . join ( s ) )     def main ( ) : n = int ( input ( ) ) s = input ( ) NEW_LINE", "n = input ( ) s = input ( ) X = s . count ( ' X ' ) x = s . count ( ' x ' ) c = abs ( ( X - x ) // 2 ) print ( c ) if X > x : s = s . replace ( ' X ' , ' x ' , c ) else : s = s . replace ( ' x ' , ' X ' , c ) print ( s ) NEW_LINE", "n = int ( input ( ) ) s = input ( ) cnt = s . count ( ' x ' ) - s . count ( ' X ' ) print ( abs ( cnt // 2 ) ) s = list ( s ) for i in range ( len ( s ) ) : if cnt > 0 and s [ i ] == ' x ' : s [ i ] = ' X ' cnt -= 2 elif cnt < 0 and s [ i ] == ' X ' : s [ i ] = ' x ' cnt += 2 print ( ' ' . join ( s ) ) NEW_LINE", "n = int ( input ( ) ) s = input ( ) ans = [ ] c , C = 0 , 0 for i in s : if i == \" x \" : c += 1 else : C += 1 NEW_LINE" ]
codeforces_1440_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ;   public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int t = fs . nextInt ( ) ; while ( t -- > 0 ) { int n = fs . nextInt ( ) ; int a = fs . nextInt ( ) ; int b = fs . nextInt ( ) ; int h = fs . nextInt ( ) ; String ans = fs . next ( ) ; int one = 0 ; int zero = 0 ; for ( char c : ans . toCharArray ( ) ) { if ( c == '0' ) zero ++ ; else one ++ ; } int an = 0 ; if ( a == b ) an = a * n ; else if ( a + h < b ) an = a * zero + ( a + h ) * one ; else if ( b + h < a ) an = ( b + h ) * zero + b * one ; else an = a * zero + b * one ; System . out . println ( an ) ; } } 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 . * ; public class cc { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int c0 = sc . nextInt ( ) ; int c1 = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; char a [ ] = sc . next ( ) . toCharArray ( ) ; int cnt0 = 0 , cnt1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == '0' ) cnt0 ++ ; } cnt1 = n - cnt0 ; int ans = 0 ; if ( c0 >= c1 + h ) { ans = c1 * cnt1 + ( c1 + h ) * cnt0 ; } else if ( c1 >= c0 + h ) { ans = c0 * cnt0 + ( c0 + h ) * cnt1 ; } else ans = c0 * cnt0 + c1 * cnt1 ; System . out . println ( ans ) ; } } }", "import java . util . Scanner ;   public class A1440 {   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 ( ) ; int C0 = in . nextInt ( ) ; int C1 = in . nextInt ( ) ; int H = in . nextInt ( ) ; int zeros = 0 ; int ones = 0 ; String S = in . next ( ) ; for ( char c : S . toCharArray ( ) ) { if ( c == '0' ) { zeros ++ ; } else { ones ++ ; } } int cost = 0 ; if ( C0 > C1 + H ) { cost += H * zeros ; ones += zeros ; zeros = 0 ; } if ( C1 > C0 + H ) { cost += H * ones ; zeros += ones ; ones = 0 ; } cost += C0 * zeros + C1 * ones ; System . out . println ( cost ) ; } }   }", "import java . util . * ; import java . util . Collections ; public class HelloWorld { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; String st = sc . next ( ) ; int f = 0 ; int s = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( st . charAt ( i ) == '0' ) f ++ ; else s ++ ; } if ( h + b < a ) { ans += h * f + b * f + b * s ; }   else if ( h + a < b ) { ans += h * s + a * f + a * s ; } else ans = a * f + b * s ; System . out . println ( ans ) ; } } }", "import java . util . * ; import java . io . * ; public class Solution {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . valueOf ( br . readLine ( ) ) ; while ( t -- > 0 ) { String all = br . readLine ( ) ; String [ ] an = all . split ( \" ▁ \" ) ; int n = Integer . valueOf ( an [ 0 ] ) ; int co = Integer . valueOf ( an [ 1 ] ) ; int ci = Integer . valueOf ( an [ 2 ] ) ; int k = Integer . valueOf ( an [ 3 ] ) ; int cost = 0 ; int count = 0 ; String s = br . readLine ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '0' ) count ++ ; } int cos = ( count * co ) + ( ( n - count ) * ci ) ; int cos1 = ( count * k ) + ( n * ci ) ; int cos2 = ( ( n - count ) * k ) + ( n * co ) ; cost = Math . min ( cos1 , Math . min ( cos , cos2 ) ) ; System . out . println ( cost ) ; } } }" ]
[ "t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n , c0 , c1 , h = map ( int , input ( ) . split ( ) ) NEW_LINE s = [ int ( x ) for x in str ( input ( ) [ : n ] ) ] NEW_LINE ori = c0 * s . count ( 0 ) + c1 * s . count ( 1 ) NEW_LINE x = ( h * ( s . count ( 0 ) ) ) + ( n * c1 ) NEW_LINE y = ( h * ( s . count ( 1 ) ) ) + ( n * c0 ) NEW_LINE print ( min ( ori , x , y ) ) NEW_LINE", "I = inputfor NEW_LINE _ in [ 0 ] * int ( I ( ) ) : n , c , d , h = map ( int , I ( ) . split ( ) ) ; NEW_LINE k = I ( ) . count ( '0' ) ; NEW_LINE print ( min ( a * ( h - c + d ) + b * ( h + c - d ) + k * ( c - d ) + n * dfor a in ( 0 , k ) for b in ( 0 , n - k ) ) ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n , c0 , c1 , h = input ( ) . split ( ' ▁ ' ) NEW_LINE n , c0 , c1 , h = int ( n ) , int ( c0 ) , int ( c1 ) , int ( h ) NEW_LINE digits = input ( ) NEW_LINE digit0 = digits . count ( '0' ) NEW_LINE digit1 = n - digit0 NEW_LINE if ( h >= c0 and h >= c1 ) : NEW_LINE INDENT print ( digit0 * c0 + digit1 * c1 ) elif ( c0 <= h and c1 > h ) : NEW_LINE if NEW_LINE DEDENT ( c0 + h < c1 ) : print ( digit0 * c0 + digit1 * ( c0 + h ) ) else : print ( digit0 * c0 + digit1 * c1 ) elif ( c0 > h and c1 <= h ) : NEW_LINE if ( c1 + h < c0 ) : NEW_LINE INDENT print ( digit0 * ( c1 + h ) + digit1 * c1 ) else : NEW_LINE print ( digit0 * c0 + digit1 * c1 ) else : if ( c1 < c0 and ( c1 + h ) < c0 ) : NEW_LINE print ( digit0 * ( h + c1 ) + digit1 * c1 ) elif ( c0 < c1 and ( c0 + h ) < c1 ) : NEW_LINE print ( digit0 * c0 + digit1 * ( h + c0 ) ) else : NEW_LINE print ( digit0 * c0 + digit1 * c1 ) NEW_LINE DEDENT" ]
codeforces_680_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class BearAndFindingCriminals { public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ; int n = fs . nextInt ( ) ; int location = fs . nextInt ( ) ; boolean [ ] cities = new boolean [ n ] ; int criminals = 0 ; for ( int i = 0 ; i < n ; i ++ ) { cities [ i ] = fs . nextInt ( ) == 1 ; } if ( n == 1 ) { System . out . println ( cities [ 0 ] ? 1 : 0 ) ; return ; } if ( cities [ location - 1 ] ) { criminals ++ ; } int left = location - 2 ; int right = location ; while ( true ) { if ( left >= 0 && right < n ) { if ( cities [ left ] && cities [ right ] ) { criminals += 2 ; } left -- ; right ++ ; } else if ( left == - 1 && right < n ) { criminals += cities [ right ++ ] ? 1 : 0 ; } else if ( left >= 0 && right == n ) { criminals += cities [ left -- ] ? 1 : 0 ; } else { break ; } } System . out . println ( criminals ) ; }   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 . util . * ;    public class Practise {  ", "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 l = sc . nextInt ( ) ; int m = sc . nextInt ( ) - 1 ; int mas [ ] = new int [ l ] ; for ( int i = 0 ; i < l ; i ++ ) { mas [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int i = 0 ; i < l ; i ++ ) { if ( mas [ i ] == 1 ) { if ( Math . abs ( i - m ) == 0 || 2 * m - i < 0 || 2 * m - i >= l || mas [ 2 * m - i ] == 1 ) { ans ++ ; } } } System . out . println ( ans ) ; } }" ]
[ "import sys   n , a = map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) t = list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) a = a - 1   res = 0 for i in range ( len ( t ) ) : if ( a - i ) >= 0 and ( a + i ) < len ( t ) : res += ( 1 if i == 0 else 2 ) * ( t [ a - i ] * t [ a + i ] ) elif not ( ( a - i ) >= 0 or ( a + i ) < len ( t ) ) : break elif ( a - i ) < 0 : res += t [ a + i ] else : res += t [ a - i ] print ( res )   NEW_LINE", "n , a = map ( int , input ( ) . split ( ) ) criminals = [ int ( i ) for i in input ( ) . split ( ) ] if ( n == 1 or n == 2 ) : print ( criminals . count ( 1 ) ) else : if ( a - 1 < n - a ) : x = a - 1 c1 = criminals [ : 2 * a - 1 ] c2 = criminals [ 2 * a - 1 : ] else : x = n - a c2 = criminals [ : n - 2 * ( n - a ) - 1 ] c1 = criminals [ n - 2 * ( n - a ) - 1 : ] NEW_LINE", "n , a = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) )   c = 0 if ( l [ a - 1 ] == 1 ) : c = c + 1 if ( len ( l ) == 1 ) : print ( c ) exit ( ) i = 0j = nwhile True : if ( abs ( j - a ) > abs ( a - i - 1 ) ) : if ( l [ j - 1 ] == 1 ) : c = c + 1 j = j - 1 elif ( abs ( j - a ) < abs ( a - i - 1 ) ) : if ( l [ i ] == 1 ) : c = c + 1 i = i + 1 elif ( abs ( j - a ) == abs ( a - i - 1 ) ) : if ( l [ i ] == 1 and l [ j - 1 ] == 1 or l [ j - 1 ] == 1 and l [ i ] == 1 ) : c = c + 2 i += 1 j -= 1   if ( i == a - 1 and j == a ) : breakprint ( c ) NEW_LINE", "import pdb   def solve ( ) : m , n = map ( int , input ( ) . split ( ) ) criminals = list ( map ( int , input ( ) . split ( ) ) ) l = n - 1 r = n - 1 acc = 0 while l >= 0 or r < len ( criminals ) : if l == r : acc += criminals [ l ] else : if l >= 0 and r < len ( criminals ) : if criminals [ l ] == criminals [ r ] : acc += 2 * criminals [ l ] elif l >= 0 : acc += criminals [ l ] elif r < len ( criminals ) : acc += criminals [ r ] l -= 1 r += 1 print ( acc )   if __name__ == ' _ _ main _ _ ' : solve ( ) NEW_LINE" ]
codeforces_1088_A
[ "import java . util . * ; import java . util . stream . IntStream ;   public class twonos {   public static void main ( String [ ] args ) {", "import java . util . Scanner ;   public class Race3 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int x = in . nextInt ( ) ; for ( int i = 1 ; i <= x ; i ++ ) { for ( int j = 1 ; j <= x ; j ++ ) { if ( i % j == 0 && i * j > x && i / j < x ) { System . out . println ( i + \" ▁ \" + j ) ; System . exit ( 0 ) ; } } } System . out . println ( - 1 ) ; } }", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = n , b = 1 , c = 0 ; while ( a >= b ) { if ( a % b == 0 ) { if ( a * b > n ) { if ( a / b < n ) { c ++ ; break ; } } else { b ++ ; } } else { a -- ; } } if ( c > 0 ) { System . out . println ( a + \" ▁ \" + b ) ; } else { System . out . println ( \" - 1\" ) ; } } }", "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int x ; Boolean exsit = false ; Scanner input = new Scanner ( System . in ) ; x = input . nextInt ( ) ; for ( int a = 1 ; a <= x ; a ++ ) { for ( int b = 1 ; a % b == 0 ; b ++ ) { if ( a * b > x && a / b < x ) { System . out . println ( a + \" ▁ \" + b ) ; exsit = true ; break ; } } if ( exsit ) break ; } if ( ! exsit ) System . out . println ( - 1 ) ; } }", "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 ( ) ; if ( n == 1 ) System . out . println ( - 1 ) ; else if ( n == 2 | n == 3 ) System . out . println ( 2 + \" ▁ \" + 2 ) ; else if ( n > 3 ) { if ( ( n & 1 ) == 0 ) System . out . println ( n + \" ▁ \" + 2 ) ; if ( ( n & 1 ) == 1 ) System . out . println ( n - 1 + \" ▁ \" + 2 ) ; } } }" ]
[ "x = int ( input ( ) ) a = b = xif a * b > x : print ( a , b ) else : print ( - 1 ) NEW_LINE", "import sys   def main ( ) : n = int ( sys . stdin . read ( ) . strip ( ) ) return n != 1 and ( n , n ) or ( - 1 , ) print ( * main ( ) ) NEW_LINE", "x = int ( input ( ) )   flag = Falsefor a in range ( 1 , x + 1 ) : for b in range ( 1 , x + 1 ) : if a % b == 0 and a * b > x and a / b < x : flag = True break if flag : breakif not flag : print ( ' - 1' ) if flag : print ( a , b ) NEW_LINE", "n = int ( input ( ) ) l = [ ] for a in range ( 1 , n + 1 ) : for b in range ( 1 , n + 1 ) : if a % b == 0 and a * b > n and a / b < n : l . append ( a ) l . append ( b ) if len ( l ) > 0 : print ( l [ 0 ] , l [ 1 ] ) else : print ( - 1 )   NEW_LINE", "def main_function ( ) : x = int ( input ( ) ) for a in range ( 1 , x + 1 ) : i = 1 while i * a <= x : if i * a ** 2 > x and i < x : return f \" { i ▁ * ▁ a } ▁ { a } \" i += 1 return \" - 1\"         print ( main_function ( ) ) NEW_LINE" ]
codeforces_430_A
[ "import java . util . * ; import java . io . * ; import java . math . * ;   public class x430A { public static void main ( String hi [ ] ) 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 ( ) ) ; Pair [ ] arr = new Pair [ N ] ; st = new StringTokenizer ( infile . readLine ( ) ) ; for ( int i = 0 ; i < N ; i ++ ) arr [ i ] = new Pair ( Integer . parseInt ( st . nextToken ( ) ) , i ) ; Arrays . sort ( arr ) ; int tag = 0 ; int [ ] res = new int [ N ] ; for ( Pair p : arr ) { res [ p . dex ] = tag ; tag = 1 - tag ; } for ( int x : res ) System . out . print ( x + \" ▁ \" ) ; } } class Pair implements Comparable < Pair > { int val ; int dex ; public Pair ( int a , int b ) { val = a ; dex = b ; } public int compareTo ( Pair oth ) { return val - oth . val ; } }", "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 ; Student ( int x , int y ) { this . x = x ; this . y = y ;", "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 ;" ]
[ "from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE", "n , m = [ int ( i ) for i in input ( ) . split ( ) ] p = list ( map ( int , input ( ) . split ( ) ) ) s = [ input ( ) . split ( ) for _ in range ( m ) ] ps , result = sorted ( p ) , [ - 1 ] * nfor i in range ( n ) : if i % 2 == 0 : c = 1 else : c = 0 result [ p . index ( ps [ i ] ) ] = cprint ( * result ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : arr [ i ] = ( arr [ i ] , i ) arr . sort ( ) res = [ 0 ] * nfor i in range ( n ) : res [ arr [ i ] [ 1 ] ] = i % 2 print ( * res ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) X = [ int ( x ) for x in input ( ) . split ( ) ] segs = [ [ int ( x ) for x in input ( ) . split ( ) ] for _ in range ( m ) ]   D = { e : i % 2 for i , e in enumerate ( sorted ( X ) ) }   for i in range ( n ) : X [ i ] = D [ X [ i ] ] print ( * X ) NEW_LINE" ]
codeforces_1385_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . stream . Collectors ;   public class CF1385B { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] hash = new int [ n + 1 ] ; int [ ] a = Arrays . stream ( br . readLine ( ) . split ( \" \\\\ s + \" ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; List < Integer > perm = new ArrayList < > ( ) ; for ( final int value : a ) { if ( hash [ value ] == 0 ) { perm . add ( value ) ; hash [ value ] = 1 ; } } System . out . println ( perm . stream ( ) . map ( String :: valueOf ) . collect ( Collectors . joining ( \" ▁ \" ) ) ) ; } } }", "import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int t = scn . nextInt ( ) ;   while ( t -- > 0 ) { int n = scn . nextInt ( ) ;   int [ ] arr = new int [ 2 * n ] ; HashSet < Integer > hs = new HashSet < > ( ) ;   boolean [ ] mark = new boolean [ n ] ; ArrayList < Integer > al = new ArrayList < > ( ) ; for ( int i = 0 ; i < 2 * n ; i ++ ) { arr [ i ] = scn . nextInt ( ) ; if ( ! mark [ arr [ i ] - 1 ] ) { al . add ( arr [ i ] ) ; mark [ arr [ i ] - 1 ] = true ; } }   for ( int i = 0 ; i < n ; i ++ ) System . out . print ( al . get ( i ) + \" ▁ \" ) ;   System . out . println ( ) ; } } }", "import static java . lang . Math . abs ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Codeforces {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < String > all_val = new ArrayList < > ( ) ; int big_loop = sc . nextInt ( ) ; for ( int loop = 0 ; loop < big_loop ; loop ++ ) { int num = sc . nextInt ( ) * 2 ; ArrayList < String > input = new ArrayList < > ( ) ; String ans = \" \" ; for ( int i = 0 ; i < num ; i ++ ) { String val = sc . nextInt ( ) + \" \" ; if ( input . contains ( val ) ) { ans += val + \" ▁ \" ; } else { input . add ( val ) ; } } all_val . add ( ans ) ; } for ( String an : all_val ) { System . out . println ( an ) ; } } }", "import java . util . LinkedHashSet ; import java . util . Scanner ;   public class B1383 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int t = scanner . nextInt ( ) ; LinkedHashSet < Integer > set = new LinkedHashSet < > ( ) ;   for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) ; for ( int j = 0 ; j < 2 * n ; j ++ ) { int b = scanner . nextInt ( ) ; set . add ( b ) ; } for ( Integer integer : set ) { System . out . print ( integer + \" ▁ \" ) ; } set . clear ( ) ; System . out . println ( ) ; } } }", "import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; int arr [ ] = new int [ n * 2 ] ; String s [ ] = br . readLine ( ) . split ( \" ▁ \" ) ; for ( int i = 0 ; i < 2 * n ; i ++ ) arr [ i ] = Integer . parseInt ( s [ i ] ) ; HashSet < Integer > hs = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < 2 * n ; i ++ ) { if ( ! hs . contains ( arr [ i ] ) ) { System . out . print ( arr [ i ] + \" ▁ \" ) ; hs . add ( arr [ i ] ) ; } } System . out . println ( ) ; } } }" ]
[ "for _ in range ( int ( input ( ) ) ) : input ( ) ; print ( * set ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE", "t = int ( input ( ) ) answer = [ ] for i in range ( t ) : n = int ( input ( ) ) li = [ int ( j ) for j in input ( ) . split ( ) ] ans = [ ] for item in li : if item not in ans : ans . append ( item ) answer . append ( ans )   for x in answer : print ( * x ) NEW_LINE", "for s in [ * open ( 0 ) ] [ 2 : : 2 ] : a = list ( map ( int , s . split ( ) ) ) ans = [ ] ; used = set ( ) for n in a : if n in used : continue ans . append ( n ) ; used . add ( n ) print ( * ans ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = [ ] for i in a : if i not in b : b . append ( i ) print ( * b , sep = \" ▁ \" ) NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : a = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) u = [ ] for k in x : if k not in u : u . append ( k ) print ( * u ) NEW_LINE" ]
codeforces_899_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 . 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 _p000899A { static public void main ( final String [ ] args ) throws IOException { p000899A . _main ( args ) ; }", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class Problem { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; String line = br . readLine ( ) ; int [ ] ar = Arrays . stream ( line . split ( \" ▁ \" ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int one = 0 , two = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ar [ i ] == 1 ) one ++ ; else two ++ ; } int sum = 0 ; if ( two == one ) sum += two ; else if ( two < one ) { sum += two ; one -= two ; sum += one / 3 ; } else { sum += one ; } System . out . println ( sum ) ; } }", "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 ( ) ; int one = 0 , two = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = fr . nextInt ( ) ; if ( x == 1 ) one ++ ; else two ++ ; } if ( one == two ) System . out . print ( two ) ; else if ( one < two ) System . out . print ( one ) ; else { int ans = two ; one -= two ; ans += one / 3 ; System . out . print ( ans ) ; } } }  " ]
[ "a = int ( input ( ) ) b = input ( ) c2 = b . count ( '2' ) c1 = b . count ( '1' ) sum = 0 sum += min ( c2 , c1 ) c1 -= c2if c1 > 0 : sum += c1 // 3 print ( sum ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) ris = 0 num2 = arr . count ( 2 ) num1 = arr . count ( 1 ) if num1 >= num2 : ris += num2 num1 -= num2 ris += num1 // 3 elif num1 <= num2 and 1 in arr : ris += num1print ( ris ) NEW_LINE", "n = int ( input ( ) ) T = list ( map ( int , input ( ) . split ( ) ) ) one = T . count ( 1 ) two = T . count ( 2 ) if one == 0 or two == 0 : print ( one // 3 ) elif one <= two : print ( one ) else : print ( two + ( one - two ) // 3 ) NEW_LINE", "num = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   ones = sum ( 1 for i in arr if i == 1 ) twos = num - ones   ans = max ( ones // 3 + min ( ones % 3 , twos ) , min ( ones , twos ) + ( ones - min ( ones , twos ) ) // 3 )   print ( ans ) NEW_LINE", "n = int ( input ( ) ) nums = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) one = nums . count ( 1 ) two = nums . count ( 2 ) if one == 0 : print ( 0 ) elif two == 0 : print ( one // 3 ) else : discard = max ( one , two ) - min ( one , two ) form = len ( nums ) - discard if discard > 2 and one > two : discard = discard // 3 print ( ( form // 2 ) + discard ) else : print ( form // 2 ) NEW_LINE" ]
codeforces_81_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintStream ;   public class _81B implements Runnable { private BufferedReader in ;   private Object solve ( ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; String s = nextToken ( ) ; for ( int i = 0 , q = 0 , n = s . length ( ) ; i < n ; i ++ ) { char x = s . charAt ( i ) ; switch ( q ) { case 0 : if ( x == ' . ' ) { sb . append ( sb . length ( ) == 0 ? \" . . . \" : \" ▁ . . . \" ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( ' , ' ) ; q = 1 ; } else if ( x != ' ▁ ' ) { sb . append ( x ) ; q = 4 ; } break ; case 1 : if ( x == ' . ' ) { sb . append ( \" ▁ . . . \" ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( \" ▁ , \" ) ; } else if ( x != ' ▁ ' ) { sb . append ( ' ▁ ' ) . append ( x ) ; q = 4 ; } break ; case 2 : q = 3 ; break ; case 3 : q = 0 ; break ; case 4 : if ( x == ' . ' ) { sb . append ( \" ▁ . . . \" ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( ' , ' ) ; q = 1 ; } else if ( x == ' ▁ ' ) { q = 5 ; } else { sb . append ( x ) ; } break ; default : if ( x == ' . ' ) { sb . append ( \" ▁ . . . \" ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( ' , ' ) ; q = 1 ; } else if ( x != ' ▁ ' ) { sb . append ( ' ▁ ' ) . append ( x ) ; q = 4 ; } }   } return sb ; }  ", "import java . io . * ; import java . util . * ;   public class B implements Runnable {   private static final boolean ONLINE_JUDGE = System . getProperty ( \" ONLINE _ JUDGE \" ) != null ;   private BufferedReader in ; private PrintWriter out ; private StringTokenizer tok = new StringTokenizer ( \" \" ) ;   private void init ( ) throws FileNotFoundException { Locale . setDefault ( Locale . US ) ; String fileName = \" \" ; if ( ONLINE_JUDGE && fileName . isEmpty ( ) ) { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; } else { if ( fileName . isEmpty ( ) ) { in = new BufferedReader ( new FileReader ( \" input . txt \" ) ) ; out = new PrintWriter ( \" output . txt \" ) ; } else { in = new BufferedReader ( new FileReader ( fileName + \" . in \" ) ) ; out = new PrintWriter ( fileName + \" . out \" ) ; } } }   String readString ( ) { while ( ! tok . hasMoreTokens ( ) ) { try { tok = new StringTokenizer ( in . readLine ( ) ) ; } catch ( Exception e ) { return null ; } } return tok . nextToken ( ) ; }   int readInt ( ) { return Integer . parseInt ( readString ( ) ) ; }   long readLong ( ) { return Long . parseLong ( readString ( ) ) ; }   double readDouble ( ) { return Double . parseDouble ( readString ( ) ) ; }   int [ ] readIntArray ( int size ) { int [ ] a = new int [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { a [ i ] = readInt ( ) ; } return a ; }   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 . 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 ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String s = in . nextLine ( ) ;   s = s . replaceAll ( \" ▁ { 2 , } \" , \" ▁ \" )" ]
[ "a = input ( ) NEW_LINE b = ' ' NEW_LINE c = 0 NEW_LINE n = len ( a ) NEW_LINE d = 0 NEW_LINE e = 0 NEW_LINE for i in range ( n ) : if NEW_LINE a [ i ] == ' . ' : NEW_LINE if c % 3 == 0 and i != 0 and ( e == 0 or b [ - 1 ] != ' ▁ ' ) : b += ' ▁ ' NEW_LINE e += 1 NEW_LINE b += a [ i ] NEW_LINE e += 1 NEW_LINE c += 1 NEW_LINE d = 0 elif a [ i ] == ' , ' : b += a [ i ] NEW_LINE e += 1 NEW_LINE if i != n - 1 : b += ' ▁ ' NEW_LINE e += 1 NEW_LINE d = 0 elif a [ i ] != ' ▁ ' : NEW_LINE if d == 2 : b += ' ▁ ' NEW_LINE e += 1 NEW_LINE b += a [ i ] NEW_LINE e += 1 NEW_LINE d = 1 else : if d == 1 : d = 2 NEW_LINE print ( b ) NEW_LINE", "from sys import stdin , stdoutfrom NEW_LINE math NEW_LINE import gcd , ceil , sqrtii1 = lambda : int ( stdin . readline ( ) . strip ( ) ) NEW_LINE is1 = lambda : stdin . readline ( ) . strip ( ) NEW_LINE iia = lambda : list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE isa = lambda : stdin . readline ( ) . strip ( ) . split ( ) NEW_LINE mod = 1000000007   s = is1 ( ) NEW_LINE res = \" \" NEW_LINE for j , i in enumerate ( s ) : if NEW_LINE i == ' , ' : res += \" , ▁ \" elif i . isdigit ( ) : NEW_LINE if s [ j - 1 ] == \" ▁ \" and res [ - 1 ] . isdigit ( ) : res += \" ▁ \" NEW_LINE res += i elif i == \" . \" : NEW_LINE if len ( res ) > 0 and res [ - 1 ] != \" ▁ \" and res [ - 1 ] != \" . \" : res += \" ▁ \" NEW_LINE if len ( res ) >= 3 and res [ - 1 ] == \" . \" and res [ - 2 ] == ' . ' and res [ - 3 ] == ' . ' : res += \" ▁ \" NEW_LINE res += \" . \" elif i == \" ▁ \" : NEW_LINE if len ( res ) > 0 and res [ - 1 ] not in \"0123456789 ▁ . \" : res += \" ▁ \" NEW_LINE print ( res . strip ( ) ) NEW_LINE", "s = input ( ) NEW_LINE ans = ' ▁ ' . join ( s . split ( ) ) NEW_LINE ans = ans . replace ( ' , ▁ ' , ' , ' ) NEW_LINE ans = ans . replace ( ' ▁ , ' , ' , ' ) NEW_LINE ans = ans . replace ( ' , ' , ' , ▁ ' ) NEW_LINE ans = ans . replace ( ' . . . ▁ ' , ' . . . ' ) NEW_LINE ans = ans . replace ( ' ▁ . . . ' , ' . . . ' ) NEW_LINE ans = ans . replace ( ' . . . ' , ' ▁ . . . ' ) NEW_LINE if ans [ 0 ] == ' ▁ ' : ans = ans [ : 0 ] + ans [ 1 : ] NEW_LINE if ans [ - 1 ] == ' ▁ ' : ans = ans [ : - 1 ] NEW_LINE print ( ans ) NEW_LINE" ]
codeforces_679_B
[ "import java . util . Scanner ; import java . math . * ;   public class Main { static long mul [ ] = new long [ 100010 ] ; static long res = 0 ; static long ans = 0 ;   static void dfs ( long x , int len , long s ) { if ( x <= 7 ) { if ( res < len + x ) { res = len + x ; ans = s + x ; } else if ( res == len + x && ans < s + x ) ans = s + x ; return ; } int lb = 1 , ub = 100000 ; int ans = 1 ; while ( ub >= lb ) { int mid = ub + lb >> 1 ; if ( mul [ mid ] > x ) { ub = mid - 1 ; } else { lb = mid + 1 ; ans = mid ; } } dfs ( x - mul [ ans ] , len + 1 , s + mul [ ans ] ) ; dfs ( mul [ ans ] - mul [ ans - 1 ] - 1 , len + 1 , s + mul [ ans - 1 ] ) ; }   public static void main ( String args [ ] ) { Scanner cin = new Scanner ( System . in ) ; for ( int i = 1 ; i <= 100000 ; i ++ ) mul [ i ] = ( long ) i * i * i ; long m = cin . nextLong ( ) ; dfs ( m , 0 , 0 ) ; System . out . println ( res + \" ▁ \" + ans ) ; } }" ]
[ "import math   def steps ( m , dct ) : if m <= 7 : return m if dct . get ( m ) : return dct [ m ] x = math . floor ( m ** ( 1 / 3 ) ) dct [ m ] = 1 + steps ( max ( m - x ** 3 , ( x ** 3 - 1 ) - ( x - 1 ) ** 3 ) , dct ) return dct [ m ]   if __name__ == \" _ _ main _ _ \" : m = int ( input ( ) ) total_blocks_used = 0 total_vol = 0 steps_dct = { } while ( m > 0 ) : x = math . floor ( m ** ( 1 / 3 ) ) if steps ( m , steps_dct ) == 1 + steps ( m - x ** 3 , steps_dct ) : m -= x ** 3 total_vol += x ** 3 else : m = x ** 3 - 1 - ( x - 1 ) ** 3 total_vol += ( x - 1 ) ** 3 total_blocks_used += 1 print ( f \" { total _ blocks _ used } ▁ { total _ vol } \" ) NEW_LINE", "import math   def root ( m ) : ret = m ** ( 1.0 / 3.0 ) if ( math . ceil ( ret ) ** 3 == m ) : ret = math . ceil ( ret ) else : ret = math . floor ( ret ) return ret   F = { }   def f ( m ) : if ( m < 0 ) : return [ - 1e5 - 10 , - 1e15 - 1 ] if ( m <= 7 ) : return [ m , m ] rootm = root ( m ) ans1 = [ 0 , 0 ] ans2 = [ 0 , 0 ] ans1 = f ( m - rootm ** 3 ) if ( rootm != 1 ) : ans2 = f ( rootm ** 3 - 1 - ( rootm - 1 ) ** 3 ) ; ans2 [ 1 ] += ( rootm - 1 ) ** 3 ; ans2 [ 0 ] += 1 ; ans1 [ 1 ] += rootm ** 3 ; ans1 [ 0 ] += 1 ; if ( ans1 [ 0 ] > ans2 [ 0 ] ) : return ans1 elif ( ans1 [ 0 ] < ans2 [ 0 ] ) : return ans2 else : if ( ans1 [ 1 ] > ans2 [ 1 ] ) : return ans1 else : return ans2   m = int ( input ( ) ) ans = f ( m ) print ( ans [ 0 ] , ans [ 1 ] )   NEW_LINE", "def cube ( a ) : return a ** 3     def steps ( m ) : if m <= 7 : return m x = 1 while cube ( x + 1 ) <= m : x += 1 return 1 + steps ( max ( m - cube ( x ) , cube ( x ) - 1 - cube ( x - 1 ) ) )     class CodeforcesTask679BSolution : def __init__ ( self ) : self . result = ' ' self . m = 0   def read_input ( self ) : self . m = int ( input ( ) )   def process_task ( self ) : sub = 0 ste = 0 while self . m : ste += 1 x = 1 while cube ( x + 1 ) <= self . m : x += 1 if steps ( self . m ) == 1 + steps ( self . m - cube ( x ) ) : self . m -= cube ( x ) sub += cube ( x ) else : self . m = cube ( x ) - 1 - cube ( x - 1 ) sub += cube ( x - 1 ) self . result = \" { 0 } ▁ { 1 } \" . format ( ste , sub )   def get_result ( self ) : return self . result     if __name__ == \" _ _ main _ _ \" : Solution = CodeforcesTask679BSolution ( ) Solution . read_input ( ) Solution . process_task ( ) print ( Solution . get_result ( ) ) NEW_LINE", "B1 = 0 B2 = 0 def solve ( rem , step , sub ) : global B1 , B2 if rem == 0 : if ( step == B1 ) : B2 = max ( B2 , sub ) if ( step > B1 ) : B1 = step B2 = sub return cnt = 1 while ( ( cnt + 1 ) ** 3 <= rem ) : cnt += 1 solve ( rem - cnt ** 3 , step + 1 , sub + cnt ** 3 ) if ( cnt > 0 ) : solve ( cnt ** 3 - 1 - ( cnt - 1 ) ** 3 , step + 1 , sub + ( cnt - 1 ) ** 3 )     x = int ( input ( ) ) solve ( x , 0 , 0 ) print ( B1 , B2 ) NEW_LINE", "B = ( 0 , 0 ) def solve ( rem , step , sub ) : global B if rem == 0 : B = max ( B , ( step , sub ) ) return cnt = 1 while ( ( cnt + 1 ) ** 3 <= rem ) : cnt += 1 solve ( rem - cnt ** 3 , step + 1 , sub + cnt ** 3 ) if ( cnt > 0 ) : solve ( cnt ** 3 - 1 - ( cnt - 1 ) ** 3 , step + 1 , sub + ( cnt - 1 ) ** 3 )     x = int ( input ( ) ) solve ( x , 0 , 0 ) print ( B [ 0 ] , B [ 1 ] ) NEW_LINE" ]
codeforces_702_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 FileWriter fw ; static long oo = Long . MAX_VALUE ;", "import java . io . FileInputStream ; import java . io . InputStream ; import java . util . * ;    public class powersoftwo {   public static void main ( String [ ] args ) throws Exception { FastIO sc = new FastIO ( System . in ) ; int N = sc . nextInt ( ) ; TreeSet < Integer > powersOfTwo = new TreeSet < Integer > ( ) ; int val = 1 ; for ( int i = 0 ; i < 31 ; i ++ ) { powersOfTwo . add ( val ) ; val *= 2 ; } HashMap < Integer , Integer > hmap = new HashMap < Integer , Integer > ( ) ; int [ ] arr = new int [ N ] ; long pairs = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int a = sc . nextInt ( ) ; Iterator < Integer > iter = powersOfTwo . tailSet ( a ) . iterator ( ) ; while ( iter . hasNext ( ) ) { int pow = iter . next ( ) ; if ( hmap . containsKey ( pow - a ) ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class PowersOfTwo { public static TreeMap < Integer , Integer > tm = new TreeMap < > ( ) ;   public static long matches ( int x ) { int ans = 0 ;   int sum = 2 ; for ( int i = 1 ; i <= 30 ; i ++ ) { int y = sum - x ; if ( tm . containsKey ( y ) ) ans += tm . get ( y ) ; sum <<= 1 ; } return ans ; }   public static void addToTreeMap ( int x ) { int freq = 0 ; if ( tm . containsKey ( x ) ) freq = tm . get ( x ) ;   tm . put ( x , freq + 1 ) ; }   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   int n = Integer . parseInt ( br . readLine ( ) ) ;   long ans = 0 ;   StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ;    for ( int i = 0 ; i < n ; i ++ ) { int a = Integer . parseInt ( st . nextToken ( ) ) ; ans += matches ( a ) ; addToTreeMap ( a ) ; }   System . out . println ( ans ) ; } }", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . util . HashMap ; 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 ) ; EPowersOfTwo solver = new EPowersOfTwo ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class EPowersOfTwo { int n ; int [ ] arr ;   public void readInput ( Scanner sc ) { n = sc . nextInt ( ) ; arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; }   public void solve ( int testNumber , Scanner sc , PrintWriter pw ) { readInput ( sc ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 1 ; j < 31 ; j ++ ) { ans += map . getOrDefault ( ( 1 << j ) - arr [ i ] , 0 ) ; } map . put ( arr [ i ] , map . getOrDefault ( arr [ i ] , 0 ) + 1 ) ; } pw . println ( ans ) ; }   }   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 . io . * ; import java . util . * ; import java . math . BigInteger ; import java . lang . Object ;    public class Main { static class sort implements Comparator < int [ ] > { public int compare ( int [ ] a , int [ ] b ) {" ]
[ "lst = [ 2 ** i for i in range ( 1 , 34 ) ] s = dict ( ) n = int ( input ( ) ) ss = [ int ( i ) for i in input ( ) . split ( ) ] sss = 0 for i in range ( 0 , n ) : for j in lst : if j - ss [ i ] in s : sss += s [ j - ss [ i ] ] if ss [ i ] in s : s [ ss [ i ] ] += 1 else : s [ ss [ i ] ] = 1 print ( sss ) NEW_LINE", "from collections import Counter     def solve ( a ) : res = 0 c = Counter ( a ) for e in a : for p in range ( 31 ) : power = 2 ** p r = power - e if r in c : res += c [ r ] - ( 1 if r == e else 0 ) assert res % 2 == 0 return res // 2     input ( ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( solve ( a ) ) NEW_LINE", "from math import log2 , ceildef powerof2 ( k ) : if ( 2 ** ( ceil ( log2 ( k ) ) ) == k ) : return ceil ( log2 ( k ) + 1 ) return ceil ( log2 ( k ) ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in a : try : d [ i ] += 1 except : d [ i ] = 1 c = 0 y = max ( a ) for i in a : r = powerof2 ( i ) for j in range ( r , 33 ) : if ( 2 ** j - i > y ) : break if ( 2 ** j - i == i ) : try : if ( d [ i ] >= 2 ) : NEW_LINE", "from math import logfrom collections import defaultdictn = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) dic = defaultdict ( lambda : 0 ) ans = 0 for el in a : i = int ( log ( el * 2 , 2 ) ) temp = 2 ** i while temp > 0 : if dic [ temp - el ] != 0 : ans += dic [ temp - el ] temp //= 2 dic [ el ] += 1 print ( ans ) NEW_LINE" ]
codeforces_400_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ;   public class InnaAndChooseOptions { public static boolean isValid ( String s , int rows , int cols ) { int pointer = 0 ; char [ ] [ ] grid = new char [ rows ] [ cols ] ; for ( int i = 0 ; i < rows ; i ++ ) { for ( int j = 0 ; j < cols ; j ++ ) grid [ i ] [ j ] = s . charAt ( pointer ++ ) ; }   for ( int j = 0 ; j < cols ; j ++ ) { boolean allX = true ; for ( int i = 0 ; i < rows ; i ++ ) if ( grid [ i ] [ j ] == ' O ' ) allX = false ; if ( allX ) return true ; } return false ; } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; int rows [ ] = { 1 , 2 , 3 , 4 , 6 , 12 } ; int cols [ ] = { 12 , 6 , 4 , 3 , 2 , 1 } ; String ans [ ] = { \" ▁ 1x12\" , \" ▁ 2x6\" , \" ▁ 3x4\" , \" ▁ 4x3\" , \" ▁ 6x2\" , \" ▁ 12x1\" } ; for ( int i = 0 ; i < t ; i ++ ) { String s = br . readLine ( ) ; StringBuilder sb = new StringBuilder ( ) ; int ansCount = 0 ; for ( int j = 0 ; j < 6 ; j ++ ) { if ( isValid ( s , rows [ j ] , cols [ j ] ) ) { ansCount ++ ; sb . append ( ans [ j ] ) ; } }   pw . print ( ansCount ) ; pw . println ( sb ) ; }   pw . flush ( ) ; pw . close ( ) ; } }" ]
[ "def ok ( s , a , b ) : mat = [ ] for i in range ( 0 , len ( s ) , b ) : mat . append ( s [ i : i + b ] )   for j in range ( b ) : c = 0 for i in range ( a ) : if mat [ i ] [ j ] == ' O ' : c += 1 if not c : return True   return False       t = int ( input ( ) ) for _ in range ( t ) : s = input ( ) x = s . count ( ' X ' ) pos = [ [ 1 , 12 ] , [ 2 , 6 ] , [ 3 , 4 ] , [ 4 , 3 ] , [ 6 , 2 ] , [ 12 , 1 ] ]   ans = 0 for i , j in pos : if ( ok ( s , i , j ) ) : ans += 1   print ( ans , end = \" ▁ \" )   for i , j in pos : if ( ok ( s , i , j ) ) : print ( f \" { i } x { j } \" , end = \" ▁ \" )   print ( ) NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : s = input ( ) lst = [ ] if ' X ' in s : lst . append ( '1x12' ) for i in range ( 6 ) : if s [ i ] == s [ i + 6 ] == ' X ' : lst . append ( '2x6' ) break for i in range ( 4 ) : if s [ i ] == s [ i + 4 ] == s [ i + 8 ] == ' X ' : lst . append ( '3x4' ) break for i in range ( 3 ) : if s [ i ] == s [ i + 3 ] == s [ i + 6 ] == s [ i + 9 ] == ' X ' : lst . append ( '4x3' ) break for i in range ( 2 ) : if s [ i ] == s [ i + 2 ] == s [ i + 4 ] == s [ i + 6 ] == s [ i + 8 ] == s [ i + 10 ] == ' X ' : lst . append ( '6x2' ) break if ' O ' not in s : lst . append ( '12x1' ) print ( len ( lst ) , * lst ) NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : n = input ( ) ab = [ ] if n . find ( ' X ' ) != - 1 : ab . append ( '1x12' ) for i in range ( 0 , 6 ) : if n [ i ] == ' X ' : if n [ 6 + i ] == ' X ' : ab . append ( '2x6' ) break for i in range ( 0 , 4 ) : if n [ i ] == ' X ' and n [ i + 4 ] == ' X ' and n [ i + 8 ] == ' X ' : ab . append ( '3x4' ) break for i in range ( 0 , 3 ) : if n [ i ] == ' X ' and n [ i + 3 ] == ' X ' and n [ i + 6 ] == ' X ' and n [ i + 9 ] == ' X ' : ab . append ( '4x3' ) break if ( n [ 0 ] == ' X ' and n [ 2 ] == ' X ' and n [ 4 ] == ' X ' and n [ 6 ] == ' X ' and n [ 8 ] == ' X ' and n [ 10 ] == ' X ' ) or ( n [ 1 ] == ' X ' and n [ 3 ] == ' X ' and n [ 5 ] == ' X ' and n [ 7 ] == ' X ' and n [ 9 ] == ' X ' and n [ 11 ] == ' X ' ) : ab . append ( '6x2' )   if n . find ( ' XXXXXXXXXXXX ' ) != - 1 : ab . append ( '12x1' ) print ( len ( ab ) , end = ' ▁ ' ) for i in range ( len ( ab ) ) : print ( ab [ i ] , end = ' ▁ ' ) print ( ) NEW_LINE", "import mathimport osimport randomimport reimport sysimport functoolsimport datetime as dtfrom operator import itemgetter , attrgetterfrom collections import Counter   if __name__ == ' _ _ main _ _ ' : N = lambda : int ( input ( ) )   t = N ( ) a , r = [ 1 , 2 , 3 , 4 , 6 , 12 ] , list ( )   while t > 0 : s = input ( ) for i in a : for j in range ( 12 // i ) : if s [ j : : 12 // i ] . count ( \" X \" ) == i : r . append ( \" % sx % s \" % ( i , 12 // i ) ) break print ( len ( r ) , * r ) r . clear ( ) t -= 1 NEW_LINE", "def isMatch ( n , s ) : x = 12 // n res = [ ] for i in range ( 0 , len ( s ) , x ) : res . append ( s [ i : i + x ] ) for col in range ( x ) : for row in range ( len ( res ) ) : if res [ row ] [ col ] != ' X ' : break elif res [ row ] [ col ] == ' X ' and row == len ( res ) - 1 : return True return False   def solve ( s ) : res = [ ] if ' X ' in s : res . append ( \"1x12\" ) for i in [ 2 , 3 , 4 , 6 ] : if isMatch ( i , s ) : res . append ( f ' { i } x { 12 / / i } ' ) if s == 12 * ' X ' : res . append ( \"12x1\" ) print ( len ( res ) , sep = \" ▁ \" , end = \" ▁ \" ) print ( * res )     def main ( ) : NEW_LINE" ]
codeforces_439_B
[ "import java . util . Arrays ; import java . util . Scanner ; public class Section { static Scanner sc = new Scanner ( System . in ) ; static int n ; static long m ; static long s = 0 ; public static void main ( String [ ] args ) { n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ;   for ( int i = 0 ; i < n ; i ++ ) { s += a [ i ] * m ; if ( m > 1 ) { m -= 1 ; } } System . out . println ( s ) ; } }  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class DevuTheDumbGuy {   public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; long x = fs . nextInt ( ) ; Integer [ ] c = fs . nextArray ( n ) ; Arrays . sort ( c ) ; long minTime = 0 ; for ( int i = 0 ; i < n ; i ++ ) { minTime += c [ i ] * x ; if ( x > 1 ) x -- ; } System . out . println ( minTime ) ; }   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 ; }   Integer [ ] nextArray ( int n ) { Integer [ ] arr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class CF439_D2_B { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int n = scanner . nextInt ( ) ; long x = scanner . nextInt ( ) ; Integer [ ] arr = scanner . nextArray ( n ) ; Arrays . sort ( arr ) ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += x * arr [ i ] ; if ( x > 1 ) x -- ; } System . out . println ( sum ) ; }   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 ; }   Integer [ ] nextArray ( int n ) { Integer [ ] arr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; } } }", "import java . util . Arrays ; import java . util . Scanner ;   public class DumDum { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; long x = scanner . nextInt ( ) ;   Integer [ ] chapters = new Integer [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) chapters [ i ] = scanner . nextInt ( ) ; Arrays . sort ( chapters ) ;   long total = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { total += x * chapters [ i ] ;   if ( x > 1 ) x -- ; }   System . out . println ( total ) ; } }", "import java . util . Arrays ; import java . util . Scanner ; public class Section { static Scanner sc = new Scanner ( System . in ) ; static int n ; static long m ; static long s = 0 ; public static void main ( String [ ] args ) { n = sc . nextInt ( ) ; m = sc . nextLong ( ) ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ;   for ( int i = 0 ; i < n ; i ++ ) { s += a [ i ] * m ; if ( m > 1 ) { m -= 1 ; } } System . out . println ( s ) ; } }  " ]
[ "inp = input ( ) . split ( ' ▁ ' ) n = int ( inp [ 0 ] ) hrs = int ( inp [ 1 ] ) order = input ( ) . split ( ' ▁ ' ) order = [ int ( x ) for x in order ]   order = sorted ( order ) time = 0 for chapters in order : tps = chapters * hrs if hrs > 1 : hrs -= 1 time += tps   print ( time ) NEW_LINE", "import sys     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 , x = ints_input ( ) a = ints_input ( ) a . sort ( ) ans = 0 for i in range ( n ) : ans += a [ i ] * x if x > 1 : x -= 1 print ( ans ) NEW_LINE", "n , x = [ int ( j ) for j in input ( ) . split ( ) ] nums = [ int ( j ) for j in input ( ) . split ( ) ] def sort ( l , r ) : size = r - l if size < 2 : return mid = int ( size / 2 + l ) sort ( l , mid ) sort ( mid , r ) decoy , p1 , p2 = [ ] , l , mid while p1 < mid and p2 < r : if nums [ p1 ] < nums [ p2 ] : decoy . append ( nums [ p1 ] ) p1 += 1 else : decoy . append ( nums [ p2 ] ) p2 += 1 while p1 < mid : decoy . append ( nums [ p1 ] ) p1 += 1 while p2 < r : decoy . append ( nums [ p2 ] ) p2 += 1 for j in range ( l , r ) : nums [ j ] = decoy [ j - l ] total = 0 sort ( 0 , n ) for j in range ( n ) : total += nums [ j ] * x x = max ( x - 1 , 1 ) print ( total ) NEW_LINE", "import osimport sysfrom io import BytesIO , IOBase BUFSIZE = 8192 class FastIO ( IOBase ) : newlines = 0 def __init__ ( self , file ) : self . _fd = file . fileno ( ) self . buffer = BytesIO ( ) self . writable = \" x \" in file . mode or \" r \" not in file . mode self . write = self . buffer . write if self . writable else None def read ( self ) : while True : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) if not b : break ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines = 0 return self . buffer . read ( ) def readline ( self ) : while self . newlines == 0 : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) self . newlines = b . count ( b \" \\n \" ) + ( not b ) ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines -= 1 return self . buffer . readline ( ) def flush ( self ) : if self . writable : os . write ( self . _fd , self . buffer . getvalue ( ) ) self . buffer . truncate ( 0 ) , self . buffer . seek ( 0 ) class IOWrapper ( IOBase ) : def __init__ ( self , file ) : self . buffer = FastIO ( file ) self . flush = self . buffer . flush self . writable = self . buffer . writable self . write = lambda s : self . buffer . write ( s . encode ( \" ascii \" ) ) self . read = lambda : self . buffer . read ( ) . decode ( \" ascii \" ) self . readline = lambda : self . buffer . readline ( ) . decode ( \" ascii \" ) sys . stdin , sys . stdout = IOWrapper ( sys . stdin ) , IOWrapper ( sys . stdout ) input = lambda : sys . stdin . readline ( ) . rstrip ( \" \\n \" ) NEW_LINE", "n , x = map ( int , input ( ) . split ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) li . sort ( ) t = 0 for i in range ( len ( li ) ) : t += li [ i ] * x if x > 1 : x -= 1 elif x == 0 : x = 1 elif x == 1 : continueprint ( t ) NEW_LINE" ]
codeforces_794_A
[ "import java . util . * ; public class P2 {   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 n = sc . nextInt ( ) ; int aa [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { aa [ i ] = sc . nextInt ( ) ; } Arrays . sort ( aa ) ; int cnt = 0 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( aa [ i ] > b && aa [ i ] < c ) { cnt ++ ; } } System . out . println ( cnt ) ; } }", "import java . util . Scanner ;   public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int result = 0 , a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; if ( x > b && x < c ) { result ++ ; } } System . out . println ( result ) ;   } }", "import java . util . * ; public class CodeForces { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int oleg = input . nextInt ( ) ; int first = input . nextInt ( ) ; int second = input . nextInt ( ) ; int n = input . nextInt ( ) ; int [ ] safes = new int [ n ] ; int count = 0 ; for ( int i = 0 ; i < safes . length ; i ++ ) { safes [ i ] = input . nextInt ( ) ; } Arrays . sort ( safes ) ; for ( int i = 0 ; i < safes . length ; i ++ ) { if ( safes [ i ] > first && safes [ i ] < second ) { count ++ ; } } System . out . println ( count ) ; } }", "import java . util . Scanner ;   public class BankRobbery { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; long a = in . nextLong ( ) , b = in . nextLong ( ) , c = in . nextLong ( ) , t = 0 ; int n = in . nextInt ( ) , i ;   for ( i = 0 ; i < n ; i ++ ) { long x = in . nextLong ( ) ; if ( x > b && x < c ) { t ++ ; } } in . close ( ) ; System . out . println ( t ) ; } }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; in . nextInt ( ) ; int l = in . nextInt ( ) , r = in . nextInt ( ) , n = in . nextInt ( ) , out = 0 ; for ( ; n > 0 ; n -- ) { int x = in . nextInt ( ) ; if ( ( l < x ) && ( x < r ) ) { out ++ ; } } System . out . println ( out ) ; in . close ( ) ; } }" ]
[ "a , b , c = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] n = int ( input ( ) ) s = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] print ( sum ( [ int ( b < x and x < c ) for x in s ] ) ) NEW_LINE", "s = input ( ) p = s . split ( ) a = int ( p [ 0 ] ) b = int ( p [ 1 ] ) c = int ( p [ 2 ] ) f = input ( ) ans = [ ] notes = [ int ( i ) for i in input ( ) . split ( ) ] for i in notes : i = int ( i ) if i > b and i < c : ans . append ( i ) print ( len ( ans ) ) NEW_LINE", "a , b , c = [ int ( s ) for s in input ( ) . split ( ' ▁ ' ) ] n = int ( input ( ) ) notes = [ int ( s ) for s in input ( ) . split ( ' ▁ ' ) ] answer = len ( [ note for note in notes if b < note < c ] ) print ( answer ) NEW_LINE", "s , l , r = [ int ( i ) for i in input ( ) . split ( \" ▁ \" ) ] input ( )   temp = [ 1 for i in input ( ) . split ( \" ▁ \" ) if l < int ( i ) < r ] print ( sum ( temp ) )   NEW_LINE", "a , b , c = map ( int , input ( ) . split ( ) ) num = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   ct = 0 for n in arr : if b < n < c : ct += 1   print ( ct ) NEW_LINE" ]
codeforces_437_B
[ "import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {", "import java . util . * ; public class TheChildAndSet { static int lowbit ( double x ) { String s = Integer . toBinaryString ( ( int ) x ) ; int i ; for ( i = s . length ( ) - 1 ; i >= 0 ; i -- ) { if ( s . charAt ( i ) == '1' ) break ; } return ( int ) Math . pow ( 2 , s . length ( ) - i - 1 ) ; } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; double sum = sc . nextDouble ( ) ; double limit = sc . nextDouble ( ) ; double temp = Math . min ( sum , limit ) ; ArrayList < Integer > al = new ArrayList < > ( ) ; for ( double i = temp ; i > 1 ; i -- ) { if ( Math . log ( i ) / Math . log ( 2 ) == Math . floor ( Math . log ( i ) / Math . log ( 2 ) ) ) { if ( sum - i >= 0 ) { sum -= i ; al . add ( ( int ) i ) ; } } }", "import java . util . Scanner ;   public class Lowbit { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int sum = scanner . nextInt ( ) ; int limit = scanner . nextInt ( ) ;   int count = 0 ; int k = 0 ; StringBuilder ans = new StringBuilder ( ) ;   for ( int i = limit ; i > 0 ; i -- ) { int lowbit = Integer . lowestOneBit ( i ) ;   if ( lowbit + k <= sum ) { count ++ ; k += lowbit ; ans . append ( i ) . append ( \" ▁ \" ) ; } }   if ( k < sum ) { System . out . println ( - 1 ) ; } else { System . out . println ( count ) ; System . out . println ( ans ) ; } } }" ]
[ "sum , limit = map ( int , input ( ) . split ( ) )   ans = [ ] while limit > 0 and sum > 0 : if ( limit & - limit ) <= sum : sum -= ( limit & - limit ) ans . append ( limit ) limit -= 1   if sum > 0 : print ( - 1 ) else : print ( len ( ans ) ) print ( * ans ) NEW_LINE", "import mathimport sysimport collectionsimport bisectimport stringdef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) for t in range ( 1 ) : s , l = get_ints ( ) ans = dict ( ) for i in range ( 1 , l + 1 ) : val = i c = 0 while val & 1 != 1 : val >>= 1 c += 1 number = 2 ** c if number not in ans : ans [ number ] = [ i ] else : ans [ number ] . append ( i ) key = list ( ans . keys ( ) ) key . sort ( reverse = True ) sol = [ ] for i in key : val = min ( len ( ans [ i ] ) , s // i ) for j in range ( val ) : sol . append ( ans [ i ] [ j ] ) s -= val * i NEW_LINE", "def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counter , defaultdictfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE" ]
codeforces_1016_A
[ "  import java . util . * ;    public class Practise {  ", "  import java . util . * ;    public class Practise {  ", "import java . util . * ;   public class CF102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; long sum = 0 ; long [ ] count = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; sum = sum + ar [ i ] ; count [ i ] = sum ; } long [ ] ans = new long [ n ] ; ans [ 0 ] = ( count [ 0 ] / m ) ; long sum2 = ans [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { ans [ i ] = count [ i ] / m - sum2 ; sum2 += ans [ i ] ;   }   for ( Long integer : ans ) { System . out . print ( integer + \" ▁ \" ) ; } System . out . println ( ) ; }    public static int getAns ( int [ ] ar , int bigger , int i , int [ ] dp ) {   if ( i < 0 ) { return 0 ; } if ( i == 0 ) { return 1 ; } if ( dp [ i ] != - 1 ) { return dp [ i ] ; } int ans1 = 0 , ans2 ; if ( ar [ i ] < bigger ) { ans1 = 1 + getAns ( ar , ar [ i ] , i - 1 , dp ) ;  ", "import java . util . * ;   public class CF102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; long sum = 0 ; long [ ] count = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; sum = sum + ar [ i ] ; count [ i ] = sum ; } long [ ] ans = new long [ n ] ; ans [ 0 ] = ( count [ 0 ] / m ) ; long sum2 = ans [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { ans [ i ] = count [ i ] / m - sum2 ; sum2 += ans [ i ] ;   }   for ( Long integer : ans ) { System . out . print ( integer + \" ▁ \" ) ; } System . out . println ( ) ; }    public static int getAns ( int [ ] ar , int bigger , int i , int [ ] dp ) {   if ( i < 0 ) { return 0 ; } if ( i == 0 ) { return 1 ; } if ( dp [ i ] != - 1 ) { return dp [ i ] ; } int ans1 = 0 , ans2 ; if ( ar [ i ] < bigger ) { ans1 = 1 + getAns ( ar , ar [ i ] , i - 1 , dp ) ;  ", "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 ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ADeathNote solver = new ADeathNote ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class ADeathNote { int n ; int m ;   public void readInput ( Scanner sc ) { n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; }   public void solve ( int testNumber , Scanner sc , PrintWriter pw ) { int q = 1 ; while ( q -- > 0 ) { readInput ( sc ) ; long prev = 0 ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += sc . nextInt ( ) ; pw . print ( sum / m - prev + \" ▁ \" ) ; prev += sum / m - prev ; } } }   }   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 ( ) ) ; }   } }  " ]
[ "n , m = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) curr = 0 ans = [ ] for n in arr : curr += n turned = curr // m ans . append ( turned ) curr %= m   print ( * ans ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a = [ int ( item ) for item in input ( ) . split ( ) ] name_remains = 0 for j in range ( n ) : print ( ( name_remains + a [ j ] ) // m , end = \" ▁ \" ) name_remains = ( name_remains + a [ j ] ) % m NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) cur = mans = [ 0 ] * nfor i , a in enumerate ( A ) : if a < cur : cur -= a ans [ i ] = 0 else : q = ( a - cur + m - 1 ) // m r = q * m - ( a - cur ) NEW_LINE" ]
codeforces_1183_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 ans = 0 ; int b = n ; int sum = 0 ; while ( b > 0 ) { sum += b % 10 ; b /= 10 ; } int to = ( 4 - sum % 4 ) % 4 ; if ( to == 0 ) ans = n ; else if ( to + n % 10 <= 9 ) ans = n + to ; else { ans = ( n / 10 + 1 ) * 10 ; b = ans ; sum = 0 ; while ( b > 0 ) { sum += b % 10 ; b /= 10 ; } to = ( 4 - sum % 4 ) % 4 ; ans = ans + to ; } 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 . Scanner ;   public class Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ;   short j = input . nextShort ( ) ;   while ( ( ( j / 1000 ) + ( j % 1000 / 100 ) + ( j % 100 / 10 ) + ( j % 10 ) ) % 4 != 0 ) { j ++ ; }   System . out . println ( j ) ; } }", "import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; while ( ! check ( a ) ) { a ++ ; } System . out . println ( a ) ; } public static boolean check ( int a ) { int sum = 0 ; while ( a > 0 ) { sum += a % 10 ; a = a / 10 ; } return sum % 4 == 0 ;   } }", "import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class _p001183A { static public void main ( final String [ ] args ) throws IOException { p001183A . _main ( args ) ; }", "import java . util . Scanner ;   public class NearestInterestingNumber {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; for ( int i = n ; i <= 10000 ; i ++ ) { String s = String . valueOf ( i ) ; int sum = 0 ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { sum += s . charAt ( j ) - '0' ; } if ( sum % 4 == 0 ) { System . out . println ( i ) ; break ; } } }   }" ]
[ "n = int ( input ( ) ) s = str ( n ) sum = 1 while ( sum % 4 != 0 ) : s = str ( n ) sum = 0 for i in s : sum += int ( i ) n += 1 print ( n - 1 ) NEW_LINE", "n = int ( input ( ) ) while sum ( [ int ( x ) for x in str ( n ) ] ) % 4 != 0 : n += 1 print ( n ) NEW_LINE", "m = int ( input ( ) ) while sum ( [ int ( m ) for m in str ( m ) ] ) % 4 != 0 : m = m + 1 print ( m ) NEW_LINE", "n = int ( input ( ) )   while True : if sum ( map ( int , list ( str ( n ) ) ) ) % 4 == 0 : rep = n break else : n += 1 print ( rep ) NEW_LINE", "def string_to_list ( s , char ) : collector = \" \" output_list = [ ] for i in range ( len ( s ) ) : if s [ i ] != char : collector += s [ i ] if i == len ( s ) - 1 : output_list . append ( int ( collector ) ) else : output_list . append ( int ( collector ) ) collector = \" \" return output_list     def list_to_string ( l , char ) : output_string = \" \" for i in range ( len ( l ) - 1 ) : output_string += str ( l [ i ] ) + char output_string += str ( l [ - 1 ] ) return output_string     def merge_sort ( l ) : def merge ( l1 , l2 ) : output_list = [ ] i , j = 0 , 0 while i < len ( l1 ) and j < len ( l2 ) : if l1 [ i ] < l2 [ j ] : output_list . append ( l1 [ i ] ) i += 1 else : output_list . append ( l2 [ j ] ) j += 1 if i == len ( l1 ) : output_list += l2 [ j : ] else : output_list += l1 [ i : ] return output_list     def recursion_part ( l ) : if len ( l ) < 2 : return l else : mid = len ( l ) // 2 left = recursion_part ( l [ : mid ] ) right = recursion_part ( l [ mid : ] ) return merge ( left , right ) return recursion_part ( l )     def list_reverse ( l ) : def recursion ( l , start , end ) : if start >= end : return l else : l [ start ] , l [ end ] = l [ end ] , l [ start ] return recursion ( l , start + 1 , end - 1 ) return recursion ( l , 0 , len ( l ) - 1 )     def divisibility ( n ) : sum = 0 for i in n : sum += int ( i ) return not sum % 4     def recursive_solution ( x ) : if divisibility ( x ) : return int ( x ) else : return recursive_solution ( str ( int ( x ) + 1 ) )     def main_function ( ) : inp = input ( ) return recursive_solution ( inp )                         print ( main_function ( ) ) NEW_LINE" ]
codeforces_1039_A
[ "import java . awt . List ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStreamWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . HashSet ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . TreeSet ;       public final class CF_507_D1_A {   static boolean verb = true ; static void log ( Object X ) { if ( verb ) System . err . println ( X ) ; } static void log ( Object [ ] X ) { if ( verb ) { for ( Object U : X ) System . err . print ( U + \" ▁ \" ) ; System . err . println ( \" \" ) ; } } static void log ( int [ ] X ) { if ( verb ) { for ( int U : X ) System . err . print ( U + \" ▁ \" ) ; System . err . println ( \" \" ) ; } } static void log ( int [ ] X , int L ) { if ( verb ) { for ( int i = 0 ; i < L ; i ++ ) System . err . print ( X [ i ] + \" ▁ \" ) ; System . err . println ( \" \" ) ; } } static void log ( long [ ] X ) { if ( verb ) { for ( long U : X ) System . err . print ( U + \" ▁ \" ) ; System . err . println ( \" \" ) ; } }   static void logWln ( Object X ) { if ( verb ) System . err . print ( X ) ; } static void info ( Object o ) { System . out . println ( o ) ; } static void output ( Object o ) { outputWln ( \" \" + o + \" \\n \" ) ; } static void outputWln ( Object o ) { try { out . write ( \" \" + o ) ; } catch ( Exception e ) { } }    " ]
[ "n , t = map ( int , input ( ) . split ( ' ▁ ' ) ) aa = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) xx = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) )   res = [ 0 ] * n   prevX = 0 prevV = - 10   for i , ( a , x ) in enumerate ( zip ( aa , xx ) ) : x -= 1 if x < prevX or x < i : print ( ' No ' ) exit ( 0 )   curV = max ( aa [ i + 1 ] + t if x > i else aa [ i ] + t , prevV + 1 ) res [ i ] = curV   prevX = x prevV = curV   for i , ( a , x ) in enumerate ( zip ( aa , xx ) ) : x -= 1 if x + 1 < n : if res [ x ] >= aa [ x + 1 ] + t : print ( ' No ' ) exit ( 0 )   print ( ' Yes ' ) print ( * res ) NEW_LINE", "def read ( ) : return list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) def fail ( ) : print ( ' No ' ) exit ( 0 )   n , t = read ( ) aa = read ( ) xx = read ( )   res = [ 0 ] * nprevX = 0 prevV = - 10   for i in range ( n ) : x = xx [ i ] - 1 if x < prevX or x < i : fail ( )   prevX = x res [ i ] = prevV = max ( aa [ i + 1 ] + t if x > i else aa [ i ] + t , prevV + 1 )   for i in range ( n ) : x = xx [ i ] - 1 if x + 1 < n and res [ x ] >= aa [ x + 1 ] + t : fail ( )   print ( ' Yes ' ) print ( * res ) NEW_LINE", "def read ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def fail ( ) : print ( \" No \" ) exit ( 0 )   n , t = read ( ) aa = read ( ) xx = read ( )   bb = [ 0 ] * nprevX = 0 prevV = - 10   for i in range ( n ) : x = xx [ i ] - 1 if x < prevX or x < i : fail ( ) prevX = x bb [ i ] = prevV = max ( aa [ i + 1 ] + t if x > i else aa [ i ] + t , prevV + 1 ) for i in range ( n ) : x = xx [ i ] - 1 if x < n - 1 and bb [ x ] >= aa [ x + 1 ] + t : fail ( )   print ( \" Yes \" ) print ( * bb ) NEW_LINE" ]
codeforces_351_A
[ "import java . io . * ; import java . util . * ;   final public class A {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; Double [ ] arr = new Double [ 2 * n ] ; int non_int = 0 ; double sum_before = 0 , sum = 0 ; for ( int i = 0 ; i < 2 * n ; i ++ ) { double num = Double . parseDouble ( st . nextToken ( ) ) ; sum_before += num ; if ( num != Math . floor ( num ) ) non_int ++ ; sum += Math . floor ( num ) ; arr [ i ] = num ; } double max_sum = Math . min ( n , non_int ) + sum ; double min_sum = Math . max ( 0 , non_int - n ) + sum ; double ans ; if ( min_sum > sum_before ) ans = ( min_sum - sum_before ) ; else if ( max_sum < sum_before ) ans = ( sum_before - max_sum ) ; else { double x = sum_before - Math . floor ( sum_before ) ; ans = Math . min ( 1 - x , x ) ; } System . out . printf ( \" % .3f \" , ans ) ; } }", "import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Main { public static void main ( String [ ] args ) throws FileNotFoundException , IOException {", "import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Main { public static void main ( String [ ] args ) throws FileNotFoundException , IOException {", "import java . io . ByteArrayInputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . nio . charset . StandardCharsets ; import java . util . Arrays ; import java . util . InputMismatchException ;   public class A351 { static class Solver { int N , M , Z , down [ ] , sum , best ; boolean used [ ] ; void solve ( int testNumber , FastScanner s , PrintWriter out ) { N = s . nextInt ( ) ; down = new int [ 2 * N ] ; for ( int i = 0 ; i < 2 * N ; i ++ ) { int spl = Integer . parseInt ( s . next ( ) . split ( \" \\\\ . \" ) [ 1 ] ) ; if ( spl == 0 ) Z ++ ; else sum += ( down [ M ++ ] = spl ) ; } int lo = max ( N - Z , 0 ) , hi = min ( N , 2 * N - Z ) ; best = 69_420_1337 ; for ( int i = lo ; i <= hi ; i ++ ) best = min ( best , Math . abs ( sum - 1000 * i ) ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Solution2 { private static int MIN = Integer . MIN_VALUE + 5 , MAX = Integer . MAX_VALUE - 5 ; public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; int N = 2 * n ; StringTokenizer sToken = new StringTokenizer ( reader . readLine ( ) ) ; int [ ] down = new int [ N ] ; int [ ] up = new int [ N ] ; BigDecimal d1000 = new BigDecimal ( \"1000.0\" ) ; for ( int i = 0 ; i < N ; i ++ ) { double x = Double . parseDouble ( sToken . nextToken ( ) ) ; BigDecimal decimal = new BigDecimal ( x ) ; BigDecimal d = decimal . multiply ( d1000 ) ; d = d . setScale ( 1 , BigDecimal . ROUND_HALF_UP ) ;" ]
[ "from sys import * import mathdef numline ( f = int ) : return map ( f , input ( ) . split ( ) ) n = int ( input ( ) ) a = list ( filter ( lambda x : x != 0 , numline ( lambda s : int ( s . split ( ' . ' ) [ 1 ] ) ) ) ) NEW_LINE", "n = int ( input ( ) ) l = list ( map ( float , input ( ) . split ( ) ) ) l = sorted ( [ x - int ( x ) for x in l if x - int ( x ) != 0 ] ) o = 2 * n - len ( l ) su = sum ( l ) ans = 0xFFFFFFFFFFFFFFFf or i in range ( n + 1 ) : if i + o >= n : ans = min ( ans , abs ( i - su ) ) print ( \" % .3f \" % ans ) NEW_LINE", "n = int ( input ( ) )   l = list ( map ( float , input ( ) . split ( ) ) )   l = sorted ( [ x - int ( x ) for x in l if x - int ( x ) != 0 ] )   o = 2 * n - len ( l )   su = sum ( l )   ans = 0xFFFFFFFFFFFFFFF   for i in range ( n + 1 ) :   if i + o >= n :   ans = min ( ans , abs ( i - su ) )   print ( \" % .3f \" % ans ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( float , input ( ) . split ( ) ) ) arr = sorted ( [ x - int ( x ) for x in arr if x - int ( x ) != 0 ] ) o = 2 * n - len ( arr ) arr_sum = sum ( arr ) res = int ( 2e9 ) for i in range ( n + 1 ) : if i + o >= n : res = min ( res , abs ( i - arr_sum ) ) print ( \" % .3f \" % res ) NEW_LINE" ]
codeforces_280_A
[ "import java . util . * ; import java . io . * ; import java . math . * ;   public class x280A { public static void main ( String hi [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; double W = Double . parseDouble ( st . nextToken ( ) ) ; double H = Double . parseDouble ( st . nextToken ( ) ) ; if ( W < H ) { double t = W ; W = H ; H = t ; } int alpha = Integer . parseInt ( st . nextToken ( ) ) ; if ( alpha == 0 || alpha == 180 ) System . out . println ( W * H ) ; else if ( alpha == 90 ) System . out . println ( H * H ) ; else { alpha = Math . min ( alpha , 180 - alpha ) ; double a = rad ( 1.0 * alpha ) ; double b = Math . atan ( 2 * W * H / ( W * W - H * H ) ) ; if ( a >= b ) System . out . println ( H / Math . sin ( a ) * H ) ; else { double ca = Math . cos ( a ) ; double sa = Math . sin ( a ) ; double aa = ( H * ca * ( ca + 1 ) - W * sa * ca ) / ( ( ca + 1 ) * ( ca + 1 ) - sa * sa ) ; double c = H - aa * ( 1 + 1 / ca ) ; double d = c * ca / sa ; double e = c / sa ; double f = aa * sa / ca ; double t1 = aa * f ; double t2 = c * d ; System . out . println ( W * H - t1 - t2 ) ; } } } public static double rad ( double deg ) { return deg * Math . PI / 180 ; } }", "from math import cos , pi , sin , atanW , H , b = map ( float , input ( ) . split ( ) ) a = ( b / 180 ) * pi   if ( W < H ) : X = W W = H H = X   if ( a > 0.5 * pi ) : a = 0.5 * pi - ( a - 0.5 * pi )   opp = W * Hif ( a == 0 ) : eindopp = W * Helse : if a > ( atan ( H / W ) * 2 ) : Schuin = H / sin ( a ) eindopp = Schuin * H else : y = - 2 * cos ( a ) - cos ( a ) * * 2 - 1 + sin ( a ) * * 2 hks = ( W * sin ( a ) - H * cos ( a ) - H ) / y hgs = ( H - hks - hks * cos ( a ) ) / sin ( a ) eindopp = opp - hks * sin ( a ) * hks * cos ( a ) - hgs * sin ( a ) * hgs * cos ( a )    print ( round ( eindopp , 9 ) )", "import java . io . * ; import java . util . * ;   public class practice { 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 scn = new FastReader ( ) ; double l = scn . nextDouble ( ) , b = scn . nextDouble ( ) , a = scn . nextDouble ( ) , sol , t , pi = Math . acos ( - 1.0 ) ; if ( l > b ) { t = l ; l = b ; b = t ; } if ( a == 90 ) { sol = l * l ; System . out . println ( sol ) ; return ; } sol = l * b ; l = l / 2.0 ; b = b / 2.0 ; if ( a > 90 ) a = 180.0 - a ; a = a * pi / 180.0 ; double c = ( pi - a ) / 2 ; double t1 = l - b / Math . tan ( c ) ; sol -= t1 * t1 * Math . tan ( a ) ; double t2 = b - l / Math . tan ( c ) ; sol -= t2 * t2 * Math . tan ( a ) ; if ( t1 < 0 ) { sol = ( l / Math . tan ( a ) + l / Math . tan ( c ) ) * l * 4.0 ; } System . out . println ( sol ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . text . DecimalFormat ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . StringTokenizer ;   public class _501 {   public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; double w = fs . nextInt ( ) , h = fs . nextInt ( ) ; int aDeg = fs . nextInt ( ) ; if ( aDeg == 0 || aDeg == 180 ) { System . out . println ( w * h ) ; return ; } if ( aDeg == 90 ) { System . out . println ( Math . min ( w , h ) * Math . min ( h , w ) ) ; return ; } if ( aDeg > 90 ) { aDeg = 180 - aDeg ; }   Seg top = new Seg ( new Vec ( - w / 2 , h / 2 ) , new Vec ( w / 2 , h / 2 ) ) ; Seg bottom = new Seg ( new Vec ( - w / 2 , - h / 2 ) , new Vec ( w / 2 , - h / 2 ) ) ; Seg left = new Seg ( new Vec ( - w / 2 , - h / 2 ) , new Vec ( - w / 2 , h / 2 ) ) ; Seg right = new Seg ( new Vec ( w / 2 , - h / 2 ) , new Vec ( w / 2 , h / 2 ) ) ; Seg [ ] segs = { top , left , bottom , right } ; ArrayList < Vec > all = new ArrayList < > ( ) ; for ( Seg s : segs ) { for ( Seg t : segs ) {" ]
[ "import sysimport math     def read_input ( input_path = None ) : if input_path is None : f = sys . stdin else : f = open ( input_path , ' r ' )   w , h , a = map ( int , f . readline ( ) . split ( ) )   return w , h , a     def sol ( w , h , a ) : if h > w : w , h = h , w   if a > 90 : a = 90 - ( a - 90 )   a = math . radians ( a )   if a < 2 * math . atan2 ( h , w ) : area = w * h   s = ( w / 2 ) - ( h / 2 * math . tan ( a / 2 ) ) bigger_area = 0.5 * s * s * math . tan ( a )   s = ( h / 2 ) - ( w / 2 * math . tan ( a / 2 ) ) lower_area = 0.5 * s * s * math . tan ( a )   res = area - 2 * bigger_area - 2 * lower_area else : res = h * h / math . sin ( a )   return [ f \" { res } \" ]     def solve ( input_path = None ) : return sol ( * read_input ( input_path ) )     def main ( ) : for line in sol ( * read_input ( ) ) : print ( f \" { line } \" )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "from math import * w , h , alpha = [ int ( x ) for x in input ( ) . strip ( ) . split ( ) ] if alpha > 90 : alpha = 180 - alphaif w < h : w , h = h , wc = cos ( alpha * pi / 180.0 ) s = sin ( alpha * pi / 180.0 ) t = tan ( alpha * pi / 360.0 ) print ( h * h / s ) if t > h / w else print ( ( w * h - ( w * w + h * h ) / 2 * tan ( alpha * pi / 360.0 ) ) / ( c ) ) NEW_LINE", "from math import * from sys import stdin , stdout   io = stdin . readline ( ) . split ( )   w = float ( io [ 0 ] ) h = float ( io [ 1 ] ) a = float ( io [ 2 ] )   if ( a > 90 ) : a = 180 - a   if ( a == 0 ) : print ( w * h ) elif ( a == 90 ) : print ( min ( w , h ) ** 2 ) else : a = a * pi / 180.0 if ( w < h ) : w , h = h , w corner_x = cos ( a ) * ( w / 2.0 ) + sin ( a ) * ( h / 2.0 ) if ( corner_x >= w / 2 ) : x0 = w / 2.0 + ( h / 2.0 - ( h / 2.0 ) / cos ( a ) ) * ( cos ( a ) / sin ( a ) ) y0 = h / 2.0 - ( tan ( a ) * ( - w / 2.0 ) + ( h / 2.0 ) / cos ( a ) ) x1 = w / 2.0 - ( h / 2.0 - ( w / 2.0 ) / sin ( a ) ) * ( - tan ( a ) ) y1 = h / 2.0 - ( ( - cos ( a ) / sin ( a ) ) * ( w / 2.0 ) + ( w / 2.0 ) / sin ( a ) )   print ( w * h - x1 * y1 - x0 * y0 ) else : y = tan ( a ) * ( w / 2.0 ) - ( h / 2.0 ) / cos ( a ) + h / 2.0 y0 = y - h x0 = y * tan ( pi / 2.0 - a ) print ( w * h - ( y0 * tan ( pi / 2.0 - a ) + x0 ) * h )     NEW_LINE", "from math import cos , pi , sin , atanW , H , b = map ( float , input ( ) . split ( ) ) a = ( b / 180 ) * pi   if ( W < H ) : X = W W = H H = X   if ( a > 0.5 * pi ) : a = 0.5 * pi - ( a - 0.5 * pi )   opp = W * Hif ( a == 0 ) : eindopp = W * Helse : if a > ( atan ( H / W ) * 2 ) : Schuin = H / sin ( a ) eindopp = Schuin * H else : y = - 2 * cos ( a ) - cos ( a ) ** 2 - 1 + sin ( a ) ** 2 hks = ( W * sin ( a ) - H * cos ( a ) - H ) / y hgs = ( H - hks - hks * cos ( a ) ) / sin ( a ) eindopp = opp - hks * sin ( a ) * hks * cos ( a ) - hgs * sin ( a ) * hgs * cos ( a )     print ( round ( eindopp , 9 ) ) NEW_LINE" ]