id
stringlengths
13
20
java
sequence
python
sequence
codeforces_1075_B
[ "  import java . io . File ; import java . io . FileNotFoundException ; import java . util . * ;    public class Main {   public static void main ( String [ ] args ) throws FileNotFoundException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int DorU [ ] = new int [ n + m ] ; TreeMap < Integer , Integer > map = new TreeMap < > ( ) ; int all [ ] = new int [ n + m ] ; for ( int i = 0 ; i < n + m ; i ++ ) { all [ i ] = input . nextInt ( ) ; } for ( int i = 0 ; i < n + m ; i ++ ) { DorU [ i ] = input . nextInt ( ) ; if ( DorU [ i ] == 1 ) { map . put ( all [ i ] , 0 ) ; } } for ( int i = 0 ; i < n + m ; i ++ ) { if ( DorU [ i ] == 0 ) { int res = - 1 ; if ( all [ i ] < map . firstKey ( ) ) { res = map . ceilingKey ( all [ i ] ) ; } else if ( all [ i ] > map . lastKey ( ) ) { res = map . floorKey ( all [ i ] ) ; } else { int left = map . floorKey ( all [ i ] ) ; int right = map . ceilingKey ( all [ i ] ) ; if ( Math . abs ( left - all [ i ] ) <= Math . abs ( right - all [ i ] ) ) { res = left ; } else res = right ; } map . put ( res , map . getOrDefault ( res , 0 ) + 1 ) ; } } for ( int i = 0 ; i < n + m ; i ++ ) { if ( DorU [ i ] == 1 ) { System . out . print ( map . get ( all [ i ] ) + \" ▁ \" ) ; } } System . out . println ( \" \" ) ; }   }  ", "import java . util . * ; import java . io . * ; public class A { public static void main ( String args [ ] ) { FastScanner in = new FastScanner ( ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; long a [ ] = new long [ n + m + 2 ] ; long b [ ] = new long [ n + m + 2 ] ; a [ 0 ] = ( int ) ( - Math . pow ( 10 , 15 ) ) ; a [ n + m + 1 ] = ( int ) ( Math . pow ( 10 , 15 ) ) ; b [ 0 ] = b [ n + m + 1 ] = 1 ; for ( int i = 1 ; i < n + m + 1 ; i ++ ) a [ i ] = in . nextLong ( ) ; for ( int i = 1 ; i < n + m + 1 ; i ++ ) b [ i ] = in . nextLong ( ) ; int ind = 0 ; long c [ ] = new long [ n + m + 2 ] ; long d [ ] = new long [ n + m + 2 ] ; d [ 0 ] = 1 ; for ( int i = 1 ; i < n + m + 2 ; i ++ ) { d [ i ] = d [ i - 1 ] + b [ i ] ; if ( b [ i ] == 1 ) { c [ ind ] = i ; ind = i ; } }", "import java . util . * ; 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 int [ ] arr ; static char [ ] ch , ch1 ; static int [ ] darr , farr ; static Character [ ] [ ] mat , mat1 ; static long x , h ; static long maxl ; static double dec ; static String s ; static long minl ; static int mx = ( int ) 1e6 ; static long mod = 998244353l ;", "   import java . io . File ; import java . io . FileNotFoundException ; import java . util . * ;    public class Main {   public static void main ( String [ ] args ) throws FileNotFoundException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int a [ ] = new int [ n + m ] ; int b [ ] = new int [ n + m ] ; TreeMap < Integer , Integer > map = new TreeMap < > ( ) ; for ( int i = 0 ; i < n + m ; i ++ ) { a [ i ] = input . nextInt ( ) ; } for ( int i = 0 ; i < n + m ; i ++ ) { b [ i ] = input . nextInt ( ) ; if ( b [ i ] == 1 ) map . put ( a [ i ] , 0 ) ; } for ( int i = 0 ; i < n + m ; i ++ ) { if ( b [ i ] == 0 ) { int res = - 1 ; if ( a [ i ] < map . firstKey ( ) ) { res = map . ceilingKey ( a [ i ] ) ; } else if ( a [ i ] > map . lastKey ( ) ) { res = map . floorKey ( a [ i ] ) ; } else { int left = map . floorKey ( a [ i ] ) ; int right = map . ceilingKey ( a [ i ] ) ; if ( Math . abs ( left - a [ i ] ) <= Math . abs ( right - a [ i ] ) ) { res = left ; } else res = right ; } map . put ( res , map . getOrDefault ( res , 0 ) + 1 ) ; } } for ( int i = 0 ; i < n + m ; i ++ ) { if ( b [ i ] == 1 ) System . out . print ( map . get ( a [ i ] ) + \" ▁ \" ) ; } System . out . println ( \" \" ) ; }   }  " ]
[ "n , m = map ( int , input ( ) . split ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) t = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in range ( n + m ) : if t [ i ] == 1 : d [ i ] = 0 aux = [ float ( ' inf ' ) ] * ( n + m ) c = - 1 for i in range ( n + m ) : if t [ i ] == 1 : c = i else : if c != - 1 : aux [ i ] = x [ i ] - x [ c ] c = - 1 left = 0 i1 = t . index ( 1 ) i2 = t [ : : - 1 ] . index ( 1 ) d [ i1 ] += i1d [ n + m - ( i2 + 1 ) ] += i2for i in range ( n + m - 1 , - 1 , - 1 ) : if t [ i ] == 1 : c = i d [ c ] += left left = 0 else : if c != - 1 : y = x [ c ] - x [ i ] if y < aux [ i ] and aux [ i ] != float ( ' inf ' ) : d [ c ] += 1 else : left += 1 ans = [ ] for i in d : ans . append ( d [ i ] ) print ( * ans ) NEW_LINE", "import sys , bisectn , m = map ( int , sys . stdin . readline ( ) . split ( ) ) arr = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) temp = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) taxi = [ ] rider = [ ] for i in range ( n + m ) : if temp [ i ] : taxi . append ( arr [ i ] ) else : rider . append ( arr [ i ] )   ans = [ 0 ] * mfor i in rider : idx = bisect . bisect_left ( taxi , i ) if idx == 0 : ans [ idx ] += 1 elif idx == m : ans [ idx - 1 ] += 1 else : left_dist = i - taxi [ idx - 1 ] right_dist = taxi [ idx ] - i if left_dist <= right_dist : ans [ idx - 1 ] += 1 else : ans [ idx ] += 1   print ( ' ▁ ' . join ( map ( str , ans ) ) ) NEW_LINE", "import sysn , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) b = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) d = dict ( ) p = [ ] if m == 1 : print ( n ) else : for j in range ( n + m ) : if b [ j ] == 1 : p . append ( a [ j ] ) d [ a [ j ] ] = 0 k = 0 for v in a : if v in d : continue while k < m and p [ k ] < v : k = k + 1 NEW_LINE", "''' https : / / codeforces . com / problemset / problem / 1075 / B '''     def solv ( coords , roles ) -> int : r_nearest = [ float ( ' inf ' ) ] * len ( coords ) l_nearest = [ float ( ' inf ' ) ] * len ( coords )   drivers = sum ( roles )   if roles [ 0 ] == 1 : l_nearest [ 0 ] = coords [ 0 ] for i in range ( 1 , len ( l_nearest ) ) : if roles [ i ] == 1 : l_nearest [ i ] = coords [ i ] else : l_nearest [ i ] = l_nearest [ i - 1 ]   last_idx = len ( coords ) - 1 if roles [ last_idx ] == 1 : r_nearest [ last_idx ] = coords [ last_idx ] for i in range ( last_idx - 1 , - 1 , - 1 ) : if roles [ i ] == 1 : r_nearest [ i ] = coords [ i ] else : r_nearest [ i ] = r_nearest [ i + 1 ]   idx_map = dict ( ) idx = 0 for i in range ( len ( coords ) ) : if roles [ i ] == 1 : idx_map [ coords [ i ] ] = idx idx += 1   rezult = [ - 1 ] * drivers for i in range ( len ( coords ) ) : if abs ( coords [ i ] - l_nearest [ i ] ) <= abs ( coords [ i ] - r_nearest [ i ] ) : rezult [ idx_map [ l_nearest [ i ] ] ] += 1 else : rezult [ idx_map [ r_nearest [ i ] ] ] += 1   return rezult     input ( ) coords_str = input ( ) roles_str = input ( )   coords = [ int ( v ) for v in coords_str . split ( ) ] roles = [ int ( v ) for v in roles_str . split ( ) ]   rez = solv ( coords , roles ) print ( ' ▁ ' . join ( map ( str , rez ) ) ) NEW_LINE", "n , m = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) x = list ( map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) ) t = list ( map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) ) l1 = [ ] l2 = [ ] for i in range ( n + m ) : if t [ i ] == 0 : l1 . append ( x [ i ] ) else : l2 . append ( x [ i ] ) l1 . sort ( ) l2 . sort ( ) if len ( l2 ) == 1 : print ( n ) else : l3 = [ 0 ] * m j = 0 i = 0 while ( i < n ) : if l1 [ i ] < l2 [ j ] : l3 [ j ] += 1 i += 1 elif j < m - 1 and l1 [ i ] > l2 [ j ] and l1 [ i ] < l2 [ j + 1 ] : if ( l1 [ i ] - l2 [ j ] ) <= ( l2 [ j + 1 ] - l1 [ i ] ) : l3 [ j ] += 1 i += 1 else : l3 [ j + 1 ] += 1 i += 1 elif j == m - 1 : l3 [ - 1 ] += 1 i += 1 else : j += 1 f = 0 while ( j < m ) : if l1 [ i ] > l2 [ j ] : j += 1 else : f = 1 break j -= 1 for j in range ( m ) : print ( l3 [ j ] , end = \" ▁ \" ) print ( ) NEW_LINE" ]
codeforces_420_B
[ "import java . awt . * ; import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . * ; import java . util . List ;   import static java . lang . Math . max ; import static java . lang . Math . min ;    public class B implements Runnable {  " ]
[ "n , m = map ( int , input ( ) . split ( ) ) covers_all = set ( range ( 1 , n + 1 ) ) in_there = set ( [ ] ) occurred = set ( [ ] ) minus_delete_candidates = set ( [ ] ) plus_delete_candidates = set ( [ ] ) for i in range ( m ) : a , b = input ( ) . split ( ) b = int ( b ) if a == ' + ' : in_there . add ( b ) covers_all -= ( plus_delete_candidates - in_there ) plus_delete_candidates = set ( [ ] ) if occurred and b not in occurred : covers_all . discard ( b ) else : if b in in_there : in_there . remove ( b ) else : covers_all -= minus_delete_candidates minus_delete_candidates = set ( [ ] ) if in_there : covers_all . discard ( b ) else : plus_delete_candidates . add ( b ) occurred . add ( b ) if b in covers_all : minus_delete_candidates . add ( b ) print ( len ( covers_all ) ) if covers_all : print ( ' ▁ ' . join ( map ( str , sorted ( list ( covers_all ) ) ) ) ) NEW_LINE" ]
codeforces_167_A
[ "import java . io . * ; import java . util . * ; public class Main implements Runnable { private void solve ( ) throws IOException { int n = nextInt ( ) ; int a = nextInt ( ) ; int d = nextInt ( ) ; int t [ ] = new int [ n + 1 ] ; int v [ ] = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { t [ i ] = nextInt ( ) ; v [ i ] = nextInt ( ) ; } double time = - 1 ; for ( int i = 1 ; i <= n ; i ++ ) { double x = ( double ) v [ i ] / a ; double y = Math . sqrt ( ( double ) ( 2 * d ) / a ) ; double curr = t [ i ] + Math . min ( x , y ) ; double z = d - ( double ) ( 1l * v [ i ] * v [ i ] ) / ( 2 * a ) ; if ( z > 0 ) curr += z / v [ i ] ; if ( curr <= time ) { curr = time ; } else time = curr ; out . println ( curr ) ; } }  ", "import java . io . BufferedReader ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;     public class p167a { public static void main ( String [ ] args ) { FS in = new FS ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; double a = in . nextInt ( ) ; double d = in . nextInt ( ) ; double time = 0.0 ; while ( n -- > 0 ) { double t = in . nextInt ( ) ; double v = in . nextInt ( ) ; double curr = 0 ; if ( v * v / ( 2.0 * a ) >= d ) { curr = Math . sqrt ( 2.0 * d / a ) ; } else { curr = 1.0 * v / a + ( d - v * v / ( 2.0 * a ) ) / v ; } curr = Math . max ( curr + t , time ) ; out . println ( curr ) ; time = curr ; } out . close ( ) ; } static class FS { BufferedReader in ; StringTokenizer t ; public FS ( InputStream i ) { in = new BufferedReader ( new InputStreamReader ( i ) ) ; } public String next ( ) { try { while ( t == null || ! t . hasMoreElements ( ) ) { t = new StringTokenizer ( in . readLine ( ) ) ; } } catch ( Exception e ) { } return t . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }", "import java . io . BufferedReader ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;     public class p167a { public static void main ( String [ ] args ) { FS in = new FS ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; double a = in . nextInt ( ) ; double d = in . nextInt ( ) ; double time = 0.0 ; while ( n -- > 0 ) { double t = in . nextInt ( ) ; double v = in . nextInt ( ) ; double curr = 0 ; if ( v * v / ( 2.0 * a ) >= d ) { curr = Math . sqrt ( 2.0 * d / a ) ; } else { curr = v / a + ( d - v * v / ( 2.0 * a ) ) / v ; } curr = Math . max ( curr + t , time ) ; out . println ( curr ) ; time = curr ; } out . close ( ) ; } static class FS { BufferedReader in ; StringTokenizer t ; public FS ( InputStream i ) { in = new BufferedReader ( new InputStreamReader ( i ) ) ; } public String next ( ) { try { while ( t == null || ! t . hasMoreElements ( ) ) { t = new StringTokenizer ( in . readLine ( ) ) ; } } catch ( Exception e ) { } return t . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }", "import java . io . * ; import java . util . * ;   public class test { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int a = Integer . parseInt ( st . nextToken ( ) ) ; int d = Integer . parseInt ( st . nextToken ( ) ) ; double [ ] timeToMax = new double [ n ] ; int [ ] leaveTime = new int [ n ] ; int [ ] maxSpeed = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { st = new StringTokenizer ( br . readLine ( ) ) ; leaveTime [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; maxSpeed [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; timeToMax [ i ] = ( double ) maxSpeed [ i ] / a ; } double [ ] normalTime = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( 0.5 * a * timeToMax [ i ] * timeToMax [ i ] < d ) { normalTime [ i ] = timeToMax [ i ] + ( d - 0.5 * a * timeToMax [ i ] * timeToMax [ i ] ) / maxSpeed [ i ] ; } else { normalTime [ i ] = Math . pow ( ( double ) 2 * d / a , 0.5 ) ; } normalTime [ i ] += leaveTime [ i ] ; } double [ ] actualTime = new double [ n ] ; actualTime [ 0 ] = normalTime [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( normalTime [ i ] >= actualTime [ i - 1 ] ) { actualTime [ i ] = normalTime [ i ] ; } else { actualTime [ i ] = actualTime [ i - 1 ] ; } } for ( int i = 0 ; i < n ; i ++ ) System . out . println ( actualTime [ i ] ) ; } }" ]
[ "n , a , d = map ( int , input ( ) . split ( ) ) p = [ 0 ] * nfor i in range ( n ) : t , v = map ( int , input ( ) . split ( ) ) x = v / a y = ( 2 * d / a ) ** 0.5 p [ i ] = t + y if y < x else t + d / v + x / 2 p [ i ] = max ( p [ i - 1 ] , p [ i ] ) print ( ' \\n ' . join ( map ( str , p ) ) ) NEW_LINE", "from sys import stdin , stdoutinput = stdin . readline   n , a , d = map ( int , input ( ) . split ( ) ) arr = [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( n ) ] res = [ 0 ] * nfor i in range ( n ) : t , v = arr [ i ] x = v / a y = ( 2 * d / a ) ** 0.5 res [ i ] = ( t + y if y < x else t + d / v + x / 2 ) res [ i ] = max ( res [ i - 1 ] , res [ i ] ) print ( ' \\n ' . join ( map ( str , res ) ) ) NEW_LINE" ]
codeforces_1030_A
[ "import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ar [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } int f = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ar [ i ] == 1 ) { System . out . println ( \" HARD \" ) ; f = 1 ; break ; } } if ( f == 0 ) { System . out . println ( \" EASY \" ) ; } } }", "import java . util . Scanner ;   public class In_Search_of_an_Easy_Problem {   static Scanner sc = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; boolean m = false ; while ( n > 0 ) { int k = sc . nextInt ( ) ; if ( k > 0 ) { m = true ; n = - 1 ; } n -- ; } if ( m ) { System . out . println ( \" HARD \" ) ; } else { System . out . println ( \" EASY \" ) ; } } }", "import java . util . Scanner ; public class CF800 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; boolean y = false ; int [ ] k = new int [ x ] ; for ( int i = 0 ; i < x ; i ++ ) { k [ i ] = input . nextInt ( ) ; if ( k [ i ] == 1 ) { y = true ; } } if ( y == true ) { System . out . println ( \" Hard \" ) ; } else { System . out . println ( \" Easy \" ) ; } } }", "import java . util . * ; public class easy { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = 0 , d = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; if ( x == 0 ) c ++ ; else d ++ ; } if ( d == 0 ) System . out . println ( \" EASY \" ) ; else System . out . println ( \" HARD \" ) ; } }" ]
[ "n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) li . sort ( ) if li [ n - 1 ] == 1 : print ( \" HARD \" ) else : print ( \" EASY \" ) NEW_LINE", "_ = input ( ) l = map ( int , input ( ) . split ( ) )   if any ( l ) : print ( \" HARD \" ) else : print ( \" EASY \" ) NEW_LINE", "import matht = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) [ : t ] h = 0 for i in a : if ( i == 1 ) : h = h + 1 if ( h > 0 ) : print ( \" HARD \" ) else : print ( \" EASY \" ) NEW_LINE", "n = int ( input ( ) ) ; p = str ( input ( ) . split ( ) ) ; c = 0 for i in p : if i == \"0\" : c += 1 if n - c == 0 : print ( \" EASY \" ) else : print ( \" HARD \" )       NEW_LINE", "n = int ( input ( ) ) s = input ( ) . split ( ) for i in s : if i == '1' : print ( ' HARD ' ) breakelse : print ( \" EASY \" ) NEW_LINE" ]
codeforces_1154_A
[ "import java . util . * ; public class Solution { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c , d ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; d = sc . nextInt ( ) ; int x = Math . max ( a , Math . max ( b , Math . max ( c , d ) ) ) ; if ( d != x ) System . out . print ( x - d + \" ▁ \" ) ; if ( c != x ) System . out . print ( x - c + \" ▁ \" ) ; if ( b != x ) System . out . print ( x - b + \" ▁ \" ) ; if ( a != x ) System . out . print ( x - a + \" ▁ \" ) ; } }", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int max = a [ 0 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( a [ i ] > max ) { max = a [ i ] ; } } for ( int i = 0 ; i < 4 ; i ++ ) { if ( max - a [ i ] != 0 ) { System . out . println ( max - a [ i ] + \" ▁ \" ) ; } }", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int max = a [ 0 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( a [ i ] > max ) { max = a [ i ] ; } } for ( int i = 0 ; i < 4 ; i ++ ) { if ( max - a [ i ] != 0 ) { System . out . println ( max - a [ i ] + \" ▁ \" ) ; } }   } }", "import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; int c = str . length ( ) ; int x = Integer . parseInt ( str . substring ( 0 , str . indexOf ( \" ▁ \" ) ) ) ; int y = Integer . parseInt ( str . substring ( str . indexOf ( \" ▁ \" ) + 1 , str . indexOf ( \" ▁ \" , str . indexOf ( \" ▁ \" ) + 1 ) ) ) ; int z = Integer . parseInt ( str . substring ( str . indexOf ( \" ▁ \" , str . indexOf ( \" ▁ \" ) + 2 ) + 1 , str . lastIndexOf ( \" ▁ \" ) ) ) ; int t = Integer . parseInt ( str . substring ( str . lastIndexOf ( \" ▁ \" ) + 1 , c ) ) ; int a = Math . max ( Math . max ( x , y ) , Math . max ( z , t ) ) ; if ( t == a ) { System . out . println ( ( a - x ) + \" ▁ \" + ( a - y ) + \" ▁ \" + ( a - z ) ) ; } if ( x == a ) { System . out . println ( ( a - y ) + \" ▁ \" + ( a - z ) + \" ▁ \" + ( a - t ) ) ; } if ( y == a ) { System . out . println ( ( a - x ) + \" ▁ \" + ( a - z ) + \" ▁ \" + ( a - t ) ) ; } if ( z == a ) { System . out . println ( ( a - x ) + \" ▁ \" + ( a - y ) + \" ▁ \" + ( a - t ) ) ; } } }", "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 > { long first , second ; public Pair ( long aa , long bb ) { first = aa ; second = bb ; } public int compareTo ( Pair o ) { return ( int ) ( o . first - this . 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 ;" ]
[ "l = list ( ( map ( int , input ( ) . split ( ) ) ) ) l = sorted ( l ) k_ = [ ]   for i in range ( 3 ) : k_ . append ( l [ 3 ] - l [ i ] ) print ( * k_ ) NEW_LINE", "a = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) mx = max ( a ) for i in list ( map ( lambda x : mx - x , a ) ) : if i : print ( i , end = \" ▁ \" ) print ( ) NEW_LINE", "numbers = list ( map ( int , input ( ) . split ( ) ) ) max_ = max ( numbers ) output = [ ]   for num in numbers : if num != max_ : print ( max_ - num , end = \" ▁ \" ) NEW_LINE", "s = [ int ( i ) for i in input ( ) . split ( ) ] s . sort ( )   a = s [ 0 ] b = s [ 1 ] c = s [ 2 ] d = s [ 3 ] NEW_LINE", "l = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) l = sorted ( l ) print ( abs ( l [ 3 ] - l [ 1 ] ) , abs ( l [ 3 ] - l [ 2 ] ) , abs ( l [ 3 ] - l [ 0 ] ) ) NEW_LINE" ]
codeforces_703_A
[ "import java . util . Scanner ;   public class MishkaAndGame { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int chris = 0 ; int mishka = 0 ; while ( n -- > 0 ) { int m = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( m > c ) mishka ++ ; else if ( m < c ) chris ++ ; } if ( mishka > chris ) System . out . println ( \" Mishka \" ) ; else if ( chris > mishka ) System . out . println ( \" Chris \" ) ; else System . out . println ( \" Friendship ▁ is ▁ magic ! ^ ^ \" ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Mishka_and_Game { 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 ( ) ; int n = sc . nextInt ( ) ; int countM = 0 , countC = 0 , countS = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a , b ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; if ( a < b ) { countC ++ ; } if ( a > b ) { countM ++ ; } if ( a == b ) { countS ++ ; } } if ( countM > countC ) { System . out . println ( \" Mishka \" ) ; } else if ( countM < countC ) { System . out . println ( \" Chris \" ) ; } else { System . out . println ( \" Friendship ▁ is ▁ magic ! ^ ^ \" ) ; }   } }", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = 0 , c = 0 , a , b ; for ( int i = 0 ; i < n ; i ++ ) { a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; if ( a > b ) m ++ ; else if ( b > a ) c ++ ; } if ( m > c ) { System . out . println ( \" Mishka \" ) ; } else if ( m < c ) { System . out . println ( \" Chris \" ) ; } else { System . out . println ( \" Friendship ▁ is ▁ magic ! ^ ^ \" ) ; } } }", "import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; import java . util . * ; import java . util . * ; import java . lang . * ; import java . io . * ; public class A703 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int mish [ ] = new int [ n ] ; int chris [ ] = new int [ n ] ; int ans , abc , xyz ; ans = abc = xyz = 0 ; for ( int i = 0 ; i < n ; i ++ ) { mish [ i ] = sc . nextInt ( ) ; chris [ i ] = sc . nextInt ( ) ; } for ( int a = 0 ; a < n ; a ++ ) { if ( mish [ a ] > chris [ a ] ) { ans ++ ; } else if ( mish [ a ] < chris [ a ] ) { abc ++ ; } else { xyz ++ ; } } if ( ans > abc ) { System . out . println ( \" Mishka \" ) ; } else if ( abc > ans ) { System . out . println ( \" Chris \" ) ; } else { System . out . println ( \" Friendship ▁ is ▁ magic ! ^ ^ \" ) ; } } }", "import java . util . Scanner ; import java . util . StringTokenizer ;   public class Mishka { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int rounds = Integer . parseInt ( scanner . nextLine ( ) ) ;   int m = 0 ; for ( int i = 0 ; i < rounds ; i ++ ) { String line = scanner . nextLine ( ) ; StringTokenizer tokenizer = new StringTokenizer ( line ) ; int r1 = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int r2 = Integer . parseInt ( tokenizer . nextToken ( ) ) ;   if ( r1 > r2 ) { m ++ ; } else if ( r1 < r2 ) { m -- ; } }   if ( m == 0 ) { System . out . println ( \" Friendship ▁ is ▁ magic ! ^ ^ \" ) ; } else if ( m > 0 ) { System . out . println ( \" Mishka \" ) ; } else { System . out . println ( \" Chris \" ) ; } } }" ]
[ "a = int ( input ( ) ) res = 0 for i in range ( a ) : r = list ( map ( int , input ( ) . split ( ) ) ) res = res + int ( r [ 0 ] > r [ 1 ] ) - int ( r [ 0 ] < r [ 1 ] ) print ( [ ' Friendship ▁ is ▁ magic ! ^ ^ ' , ' Mishka ' , ' Chris ' ] [ res if not ( res ) else abs ( res ) // res ] ) NEW_LINE", "n = int ( input ( ) ) c1 , c2 = 0 , 0 for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) if a > b : c1 += 1 elif a < b : c2 += 1 if c1 > c2 : print ( \" Mishka \" ) elif c1 < c2 : print ( \" Chris \" ) else : print ( \" Friendship ▁ is ▁ magic ! ^ ^ \" ) NEW_LINE", "n = int ( input ( ) ) c_score , m_score = 0 , 0 for i in range ( n ) : m , c = map ( int , input ( ) . split ( ) ) if c > m : c_score += 1 elif c < m : m_score += 1 else : continueif c_score > m_score : print ( \" Chris \" ) elif c_score < m_score : print ( \" Mishka \" ) else : print ( \" Friendship ▁ is ▁ magic ! ^ ^ \" ) NEW_LINE", "mishka = 0 chris = 0 for i in range ( int ( input ( ) ) ) : m , c = map ( int , input ( ) . split ( ) ) if m > c : mishka += 1 elif m < c : chris += 1 else : continue   if mishka > chris : print ( ' Mishka ' ) elif mishka < chris : print ( ' Chris ' ) else : print ( ' Friendship ▁ is ▁ magic ! ^ ^ ' ) NEW_LINE" ]
codeforces_681_B
[ "import java . io . * ; import java . util . * ; public class Asd { static PrintWriter w = new PrintWriter ( System . out ) ; static FastScanner s = new FastScanner ( ) ;   public static void main ( String [ ] args ) {", "import java . util . Scanner ;   public class MoneySpender { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ;   for ( int i = 0 ; i <= n ; i += 1234567 ) { for ( int j = 0 ; j <= n ; j += 123456 ) { int sum = i + j ;   if ( sum > n ) break ;   if ( ( n - sum ) % 1234 == 0 ) { System . out . println ( \" YES \" ) ; return ; } } }   System . out . println ( \" NO \" ) ; } }", "import static java . lang . Math . max ; import static java . lang . Math . min ; import static java . lang . Math . abs ; import java . util . * ; import java . io . * ; import java . math . * ;   public class B { public static final long A = 1234567 ; public static final long B = 123456 ; public static final long C = 1234 ; 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 ( ) ) ; for ( int v = 0 ; v <= 1000 ; v ++ ) { if ( A * v > N ) break ; long left = N - A * v ; for ( int b = 0 ; b <= 100000 ; b ++ ) { if ( B * b > left ) break ; if ( ( left - B * b ) % C == 0 ) { System . out . println ( \" YES \" ) ; return ; } } } System . out . println ( \" NO \" ) ; } public static long gcd ( long a , long b ) { if ( a > b ) { long t = a ; a = b ; b = t ; } if ( a == 0L ) return b ; return gcd ( b % a , a ) ; } }" ]
[ "n = int ( input ( ) )   a = 1234567 b = 123456 c = 1234   nat = ' NO ' for i in range ( n // a + 1 ) : n2 = n - a * i   for i2 in range ( n2 // b + 1 ) :   if ( n2 - b * i2 ) % c == 0 : nat = ' YES ' print ( nat )     NEW_LINE", "s = int ( input ( ) ) n = 0 l = [ ] for i in range ( 0 , s , 1234567 ) : for j in range ( 0 , s , 123456 ) : n = s - i - j l . append ( n ) if any ( i >= 0 and i % 1234 == 0 for i in l ) : print ( \" YES \" ) elif s % 1234567 == 0 or s % 123456 == 0 or s % 1234 == 0 : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "n = int ( input ( ) ) for i in range ( 0 , n + 1 , 1234567 ) : for j in range ( 0 , n + 1 , 123456 ) : if ( n - ( i + j ) ) % 1234 == 0 and i + j <= n : print ( ' YES ' ) exit ( ) print ( ' NO ' ) NEW_LINE" ]
codeforces_571_A
[ "import java . io . * ; import java . util . StringTokenizer ;   public class Main { public void solve ( ) { int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { a [ i ] = ni ( ) ; } long l = ni ( ) ;   long total = ( l + 1 ) * ( l + 2 ) * ( l + 3 ) / 6 ;", "import java . util . Scanner ;    public class Main { public static Scanner in = new Scanner ( System . in ) ; public static int a , b , c , L ; public static long cal ( int l ) { int ti [ ] = new int [ 3 ] ; ti [ 0 ] = ( l + a + b - c + 1 ) / 2 ; ti [ 1 ] = ( l + a + c - b + 1 ) / 2 ; ti [ 2 ] = ( l + c + b - a + 1 ) / 2 ; for ( int i = 0 ; i < 3 ; i ++ ) if ( ti [ i ] <= 0 ) return 0 ;", "import java . util . * ;   public class A {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long [ ] a = new long [ 3 ] ; a [ 0 ] = sc . nextLong ( ) ; a [ 1 ] = sc . nextLong ( ) ; a [ 2 ] = sc . nextLong ( ) ; long l = sc . nextLong ( ) ; long total = ( l + 1 ) * ( l + 2 ) * ( l + 3 ) / 6 ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( long la = 0L ; la <= l ; la ++ ) { long x = Math . min ( a [ i ] - a [ ( i + 1 ) % 3 ] - a [ ( i + 2 ) % 3 ] + la , l - la ) ; if ( x >= 0 ) { total -= ( x + 1 ) * ( x + 2 ) / 2 ; } } } System . out . println ( \" \" + total ) ; }   }" ]
[ "a , b , c , l = map ( int , input ( ) . split ( ) ) cnt = ( l + 3 ) * ( l + 2 ) * ( l + 1 ) // 3 for i in ( a , b , c ) : s = 2 * i - a - b - c for x in range ( max ( 0 , - s ) , l + 1 ) : m = min ( s + x , l - x ) cnt -= ( m + 1 ) * ( m + 2 ) print ( cnt // 2 )   NEW_LINE", "''' import ▁ syssys . stdin ▁ = ▁ open ( \" input . txt \" , ▁ \" r \" ) sys . stdout ▁ = ▁ open ( \" output . txt \" , ▁ \" w \" ) ''' def Solve ( a , b , c , l ) : delta = a - b - c if delta < 0 : return 0 k = min ( l , delta ) + 1 return k * ( k + 1 ) // 2   a , b , c , l = map ( int , input ( ) . split ( ) )   ans = ( l + 3 ) * ( l + 2 ) * ( l + 1 ) // 6   for d in range ( l + 1 ) : ans -= Solve ( a + d , b , c , l - d ) + Solve ( b + d , a , c , l - d ) + Solve ( c + d , a , b , l - d ) print ( ans ) NEW_LINE", "a , b , c , l = map ( int , input ( ) . split ( ) ) ans = ( l + 3 ) * ( l + 2 ) // 2 * ( l + 1 ) // 3 for z in ( a , b , c ) : s = 2 * z - a - b - c for x in range ( l + 1 ) : m = min ( s + x , l - x ) if m >= 0 : ans -= ( m + 1 ) * ( m + 2 ) >> 1 print ( ans ) NEW_LINE", "a , b , c , l = map ( int , input ( ) . split ( ) ) ans = ( l + 3 ) * ( l + 2 ) * ( l + 1 ) // 3 for z in ( a , b , c ) : s = 2 * z - a - b - c for x in range ( max ( 0 , - s ) , l + 1 ) : m = min ( s + x , l - x ) ans -= ( m + 1 ) * ( m + 2 ) print ( ans // 2 ) NEW_LINE" ]
codeforces_243_A
[ "n = int ( input ( ) ) a , b = set ( ) , set ( ) for i in list ( map ( int , input ( ) . split ( ) ) ) : a = { i | j for j in a } a . add ( i ) b . update ( a ) print ( len ( b ) )", "import java . io . * ; import java . util . * ; import java . lang . * ; import java . math . * ; import java . text . DecimalFormat ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . * ; public class Codeforces { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ;", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   void run ( FastScanner in , PrintWriter out ) {   int N = in . nextInt ( ) ; int [ ] a = new int [ N ] ; int allSet = 0 ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = in . nextInt ( ) ; allSet |= a [ i ] ; }   Set < Integer > s = new HashSet < > ( ) ; int [ ] prev = new int [ N ] ; Arrays . fill ( prev , - 1 ) ; for ( int l = 0 ; l < N ; l ++ ) { int x = 0 ; for ( int r = l ; r < N ; r ++ ) { x |= a [ r ] ; if ( x == prev [ r ] ) break ; s . add ( x ) ; prev [ r ] = x ; } }   out . println ( s . size ( ) ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( in ) ) ; st = null ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }" ]
[ "n , a , b = input ( ) , set ( ) , set ( ) for i in map ( int , input ( ) . split ( ) ) : b = set ( i | j for j in b ) b . add ( i ) a . update ( b ) print ( len ( a ) ) NEW_LINE", "import sys , math , osfrom io import BytesIO , IOBase NEW_LINE", "n = int ( input ( ) ) a , b = set ( ) , set ( ) for i in list ( map ( int , input ( ) . split ( ) ) ) : a = { i | j for j in a } a . add ( i ) b . update ( a ) print ( len ( b ) ) NEW_LINE", "n = input ( ) r = set ( ) s = set ( ) l = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) for i in l : s = { i | a for a in s } s . add ( i ) r |= sprint ( len ( r ) )   NEW_LINE" ]
codeforces_1340_A
[ "import java . math . BigInteger ; import java . sql . Array ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . InputMismatchException ; import java . util . Iterator ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; public class Main { static InputReader rd = new InputReader ( System . in ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; outer : while ( t -- > 0 ) { int n = sc . nextInt ( ) ; ArrayList < Helper > A = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { A . add ( new Helper ( sc . nextInt ( ) , i ) ) ; } Collections . sort ( A , new Comparator < Helper > ( ) { @ Override public int compare ( Helper o1 , Helper o2 ) {", "import java . io . * ; import java . util . * ;   public final class test { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ; StringBuilder result = new StringBuilder ( \" \" ) ;   int t = sc . nextInt ( ) ; while ( t -- != 0 ) { int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) p [ i ] = sc . nextInt ( ) ; boolean flag = false ;   for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( p [ i ] < p [ i + 1 ] && p [ i + 1 ] != 1 + p [ i ] ) { flag = true ; result . append ( \" No \\n \" ) ; break ; } }   if ( ! flag ) result . append ( \" Yes \\n \" ) ; }   System . out . println ( result ) ; } }   class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream stream ) { br = new BufferedReader ( new InputStreamReader ( stream ) ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   public String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   public int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } }", "import java . util . * ; import java . io . * ; import java . math . * ;   public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int cas = Integer . parseInt ( st . nextToken ( ) ) ; StringBuilder res = new StringBuilder ( ) ; while ( cas -- > 0 ) { st = new StringTokenizer ( infile . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; st = new StringTokenizer ( infile . readLine ( ) ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } int min = n , to = n , ok = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( min > arr [ i ] ) min = arr [ i ] ; if ( arr [ i ] != to ) { if ( i == n - 1 || arr [ i ] != arr [ i + 1 ] - 1 ) { ok = 0 ; } } else if ( arr [ i ] == to ) to = min - 1 ; } if ( ok == 1 ) res . append ( \" Yes \" ) ; else res . append ( \" No \" ) ; res . append ( ' \\n ' ) ; } System . out . println ( res ) ; } }" ]
[ "import java . math . * ; import java . io . * ; import java . util . * ; import java . awt . * ;   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 = sc . nextInt ( ) ; boolean flag = true ; for ( int i = 1 ; i < n ; i + + ) { int b = sc . nextInt ( ) ; if ( a < b & & b - a > 1 ) flag = false ; a = b ; } if ( flag ) System . out . println ( \" Yes \" ) ; else System . out . println ( \" No \" ) ; } } } NEW_LINE", "import sysinput = sys . stdin . buffer . readline NEW_LINE", "import sysinput = sys . stdin . buffer . readline NEW_LINE", "import math , string , itertools , fractions , heapq , collections , re , array , bisect , sys , copy , functools NEW_LINE", "from operator import itemgetter   t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) pi = list ( map ( int , input ( ) . split ( ) ) ) ans = [ \" Yes \" , \" No \" ] if n < 3 : print ( ans [ 0 ] ) continue pi2 = [ [ pi [ i ] , i ] for i in range ( n ) ] pi2 . sort ( key = itemgetter ( 0 ) ) i = 0 num = 0 while i < n : j = pi2 [ i ] [ 1 ] + 1 while j < n : if pi [ j ] > pi [ j - 1 ] + 1 : ans [ 0 ] = ans [ 1 ] i = n if pi [ j ] < pi [ j - 1 ] : break j += 1 i = pi [ j - 1 ] print ( ans [ 0 ] ) NEW_LINE" ]
codeforces_952_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class A_Map_of_the_Cat_1800 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String Response ; int numnos = 0 ; try { for ( int i = 0 ; i <= 9 ; i ++ ) { System . out . println ( i ) ; Response = br . readLine ( ) ; if ( Response . equals ( \" cool \" ) || Response . equals ( \" great ! \" ) || Response . equals ( \" not ▁ bad \" ) || Response . equals ( \" don ' t ▁ think ▁ so \" ) || Response . equals ( \" don ' t ▁ touch ▁ me ! \" ) ) { System . out . println ( \" normal \" ) ; break ; } else if ( Response . equals ( \" terrible \" ) || Response . equals ( \" worse \" ) || Response . equals ( \" no ▁ way \" ) || Response . equals ( \" don ' t ▁ even \" ) || Response . equals ( \" are ▁ you ▁ serious ? \" ) || Response . equals ( \" go ▁ die ▁ in ▁ a ▁ hole \" ) ) { System . out . println ( \" grumpy \" ) ; break ; } if ( Response . equals ( \" no \" ) ) { if ( ++ numnos > 3 ) { System . out . println ( \" normal \" ) ; } } } } catch ( Exception e ) { e . printStackTrace ( ) ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Scanner ;   public class Main {    public static String NORMALS [ ] = { \" cool \" , \" not ▁ bad \" , \" don ' t ▁ touch ▁ me \" , \" don ' t ▁ think ▁ so \" , \" great \" } ; public static String NO = \" no \" ; public static String NORMAL = \" normal \" ; public static String GRUMPY = \" grumpy \" ; public static void main ( String [ ] args ) throws IOException { BufferedReader bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( int i = 0 ; i <= 9 ; ++ i ) { System . out . println ( i ) ; System . out . flush ( ) ; String line = bufferedReader . readLine ( ) ; if ( ! line . startsWith ( NO ) ) { for ( String w : NORMALS ) { if ( line . startsWith ( w ) ) { System . out . println ( NORMAL ) ; System . out . flush ( ) ; return ; } } System . out . println ( GRUMPY ) ; System . out . flush ( ) ; return ; } }   } }", "import java . util . * ; public class name { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = 9 ; for ( int i = 0 ; i <= 9 ; i ++ ) { System . out . println ( i ) ; String x = scan . nextLine ( ) ; if ( x . equals ( \" worse \" ) || x . equals ( \" terrible \" ) || x . equals ( \" don ' t ▁ even \" ) || x . equals ( \" are ▁ you ▁ serious ? \" ) || x . equals ( \" go ▁ die ▁ in ▁ a ▁ hole \" ) || x . equals ( \" no ▁ way \" ) ) { System . out . println ( \" grumpy \" ) ; break ; } if ( x . equals ( \" great \" ) || x . equals ( \" cool \" ) || x . equals ( \" not ▁ bad \" ) || x . equals ( \" don ' t ▁ touch ▁ me ! \" ) || x . equals ( \" don ' t ▁ think ▁ so \" ) ) { System . out . println ( \" normal \" ) ; break ; } else System . out . flush ( ) ; } } }", "import java . util . * ; public class name { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = 9 ; for ( int i = 0 ; i <= 9 ; i ++ ) { System . out . println ( i ) ; String x = scan . nextLine ( ) ; if ( x . equals ( \" worse \" ) || x . equals ( \" terrible \" ) || x . equals ( \" don ' t ▁ even \" ) || x . equals ( \" are ▁ you ▁ serious ? \" ) || x . equals ( \" go ▁ die ▁ in ▁ a ▁ hole \" ) || x . equals ( \" no ▁ way \" ) ) { System . out . println ( \" grumpy \" ) ; break ; } if ( x . equals ( \" great \" ) || x . equals ( \" cool \" ) || x . equals ( \" not ▁ bad \" ) || x . equals ( \" don ' t ▁ touch ▁ me ! \" ) || x . equals ( \" don ' t ▁ think ▁ so \" ) ) { System . out . println ( \" normal \" ) ; break ; } } } }" ]
[ "from sys import stdout   def ask ( index ) : print ( index ) stdout . flush ( ) x = input ( ) return x   normal = [ \" cool \" , \" not ▁ bad \" , \" don ' t ▁ think ▁ so \" , \" don ' t ▁ touch ▁ me \" , \" great \" ] grumpy = [ \" terrible \" , \" worse \" , \" go ▁ die ▁ in ▁ a ▁ hole \" , \" are ▁ you ▁ serious \" , \" don ' t ▁ even \" , \" no ▁ way \" ] normal . sort ( ) grumpy . sort ( )   ans = [ ] for i in range ( 10 ) : s = ask ( i ) if s == \" no \" : continue if s in normal : ans = \" normal \" else : ans = \" grumpy \" breakprint ( ans ) NEW_LINE", "good = set ( [ ' great ' , ' great ! ' , \" don ' t ▁ think ▁ so \" , ' not ▁ bad ' , ' cool ' ] ) grumpy = set ( [ ' are ▁ you ▁ serious ' , ' are ▁ you ▁ serious ? ' , ' go ▁ die ▁ in ▁ a ▁ hole ' , ' worse ' , ' terrible ' , ' no ▁ way ' , \" don ' t ▁ even \" ] ) for i in range ( 10 ) : print ( i ) ans = input ( ) . lower ( ) . strip ( ) if ans in good : print ( ' normal ' ) break elif ans in grumpy : print ( ' grumpy ' ) break NEW_LINE", "normal = [ \" don ' t ▁ think ▁ so \" , \" don ' t ▁ touch ▁ me \" , \" not ▁ bad \" , \" cool \" , \" great \" ] grumpy = [ \" are ▁ you ▁ serious ? \" , \" go ▁ die ▁ in ▁ a ▁ hole \" , \" worse \" , ' terrible ' , \" don ' t ▁ even \" ] for i in range ( 0 , 10 ) : print ( i ) S = input ( ) if S in normal : print ( \" normal \" ) break elif S in grumpy : print ( \" grumpy \" ) break NEW_LINE", "for i in range ( 10 ) : print ( i ) s = input ( ) if s in [ \" great ! \" , \" don ' t ▁ think ▁ so \" , \" not ▁ bad \" , \" cool \" , \" don ' t ▁ touch ▁ me \" ] : print ( \" normal \" ) exit ( 0 ) if s in [ \" no ▁ way \" , \" don ' t ▁ even \" , \" are ▁ you ▁ serious ? \" , \" worse \" , \" terrible \" ] : print ( \" grumpy \" ) exit ( 0 ) NEW_LINE", "import sysa = [ ' cool ' , ' not ▁ bad ' , ' great ' , \" don ' t ▁ think ▁ so \" , \" don ' t ▁ touch ▁ me \" ] b = [ ' terrible ' , ' worse ' , ' go ▁ die ▁ in ▁ a ▁ hole ' , ' are ▁ you ▁ serious ' , \" don ' t ▁ even \" , ' no ▁ way ' ] i = 1 while i < 10 : print ( i ) sys . stdout . flush ( ) q = input ( ) if q == ' no ' : i += 1 elif q in a : print ( ' normal ' ) sys . stdout . flush ( ) exit ( ) elif q in b : print ( ' grumpy ' ) sys . stdout . flush ( ) exit ( ) NEW_LINE" ]
codeforces_464_B
[ "import java . awt . image . AreaAveragingScaleFilter ; import java . util . * ; import java . io . * ; import java . text . * ;   public class CF_464B {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . stream . LongStream ;   public class Solution { static int [ ] [ ] a ; static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ;" ]
[ "import itertoolsfrom itertools import permutations as perm   l = [ [ int ( x ) for x in input ( ) . split ( ) ] for i in range ( 8 ) ]   def dist2 ( p0 , p1 ) : return sum ( [ ( p0 [ i ] - p1 [ i ] ) ** 2 for i in range ( 3 ) ] )   def sub ( p0 , p1 ) : return [ p0 [ i ] - p1 [ i ] for i in range ( 3 ) ]   def add ( p0 , p1 ) : return [ p0 [ i ] + p1 [ i ] for i in range ( 3 ) ]   def div ( p0 , x ) : return [ p0 [ i ] // x for i in range ( 3 ) ]   def cross ( p0 , p1 ) : return [ p0 [ ( i + 1 ) % 3 ] * p1 [ ( i + 2 ) % 3 ] - p0 [ ( i + 2 ) % 3 ] * p1 [ ( i + 1 ) % 3 ] for i in range ( 3 ) ]   def match ( p0 , p1 ) : return sorted ( p0 ) == sorted ( p1 )   solved = Falsefor l2 in perm ( l , 3 ) : p0 = l2 [ 0 ] for p1 in perm ( l2 [ 1 ] ) : s2 = dist2 ( p0 , p1 ) if s2 == 0 : continue s = round ( s2 ** .5 ) NEW_LINE", "import itertoolsfrom itertools import permutations as permimport copy   def getPerm ( it , index ) : if index == 0 : return it elif index == 1 : return [ it [ 0 ] , it [ 2 ] , it [ 1 ] ] elif index == 2 : return [ it [ 1 ] , it [ 0 ] , it [ 2 ] ] elif index == 3 : return [ it [ 1 ] , it [ 2 ] , it [ 0 ] ] elif index == 4 : return [ it [ 2 ] , it [ 0 ] , it [ 1 ] ] elif index == 5 : return [ it [ 2 ] , it [ 1 ] , it [ 0 ] ]   def distance ( coord1 , coord2 ) : return ( ( coord2 [ 0 ] - coord1 [ 0 ] ) ** 2 + ( coord2 [ 1 ] - coord1 [ 1 ] ) ** 2 + ( coord2 [ 2 ] - coord1 [ 2 ] ) ** 2 )   dists = ( [ 0 ] * 6 ) * 7   pointList = [ [ int ( x ) for x in input ( ) . split ( ) ] for y in range ( 0 , 8 ) ]   p0 = pointList [ 0 ]   for x in range ( 0 , 7 ) : y = 0 for pt in perm ( pointList [ x + 1 ] , 3 ) : NEW_LINE", "from itertools import permutations as p       d = lambda a , b : sum ( ( i - j ) ** 2 for i , j in zip ( a , b ) )   f = lambda a , b : [ i + j - k for i , j , k in zip ( a , b , q ) ]   g = lambda t : sorted ( sorted ( q ) for q in t )       v = [ sorted ( map ( int , input ( ) . split ( ) ) ) for i in range ( 8 ) ]   q = v . pop ( )       def yes ( t , v ) :   print ( ' YES ' )   d = { }   for q in t :   s = str ( sorted ( q ) )   d [ s ] = d . get ( s , [ ] ) + [ q ]   for q in v :   i , j , k = d [ str ( q ) ] . pop ( )   print ( i , j , k )   exit ( )       u = g ( v )   for a , b , c in p ( v , 3 ) :   for x in p ( a ) :   s = 2 * d ( q , x )   if s == 0 : continue   for y in p ( b ) :   if not 2 * d ( q , y ) == d ( x , y ) == s : continue   for z in p ( c ) :   if not 2 * d ( q , z ) == d ( x , z ) == d ( y , z ) == s : continue   t = [ x , y , z ] + [ f ( x , y ) , f ( x , z ) , f ( y , z ) , f ( f ( x , y ) , z ) ]   if g ( t ) == u : yes ( t + [ q ] , v + [ q ] )       print ( ' NO ' )       NEW_LINE" ]
codeforces_374_B
[ "import java . io . * ; public class p374B { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; char s [ ] = in . readLine ( ) . toCharArray ( ) ; long c = 1 , a = 1 ; for ( int i = 1 ; i < s . length ; i ++ ) if ( s [ i ] + s [ i - 1 ] == ' i ' ) c ++ ; else { if ( c % 2 == 1 ) a *= c / 2 + 1 ; c = 1 ; } if ( c % 2 == 1 ) a *= ( c / 2 + 1 ) ; out . write ( a + \" \" ) ; out . flush ( ) ; } }", "import java . util . Scanner ;   public class A {   public static int MOD = 1_000_000_007 ; public static void main ( String [ ] args ) {   Scanner scanner = new Scanner ( System . in ) ; long ans = 1 ;   char [ ] a = scanner . next ( ) . toCharArray ( ) ; int n = a . length ; int count = 0 ; for ( int i = 0 ; i < n - 1 ; ++ i ) { if ( a [ i ] - '0' + a [ i + 1 ] - '0' == 9 ) { if ( count == 0 ) count += 2 ; else count ++ ; } else { if ( count % 2 == 1 ) ans *= ( 1 + count / 2 ) ; count = 0 ; } }   if ( count % 2 == 1 ) ans *= ( 1 + count / 2 ) ; System . out . println ( ans ) ; } }", "import java . io . * ; import java . util . * ; public final class code" ]
[ "a = input ( ) n = len ( a ) ans = 1 c = 0 for i in range ( n - 1 ) : if int ( a [ i + 1 ] ) + int ( a [ i ] ) == 9 : c += 1 else : if c % 2 == 0 and c != 0 : NEW_LINE", "s , a , c = input ( ) , 1 , 1 for i in range ( 1 , len ( s ) ) : if int ( s [ i ] ) + int ( s [ i - 1 ] ) == 9 : c += 1 elif c % 2 : a *= c // 2 + 1 ; c = 1 else : c = 1 if ( c % 2 ) : a *= c // 2 + 1 print ( a ) NEW_LINE", "p = 10 cnt = 0 r = 1 for c in input ( ) : c = int ( c ) if c + p == 9 : cnt += 1 else : if cnt > 0 and cnt % 2 == 0 : r *= cnt // 2 + 1 cnt = 0 p = cif cnt > 0 and cnt % 2 == 0 : r *= cnt // 2 + 1 print ( r ) NEW_LINE" ]
codeforces_231_B
[ "import java . util . * ; public class First { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ;   int n = s . nextInt ( ) ; int a [ ] = new int [ n ] ; int d = s . nextInt ( ) ; int l = s . nextInt ( ) ; int d1 = ( int ) Math . floor ( n * 1.0 / 2 ) , d2 = ( int ) Math . ceil ( n * 1.0 / 2 ) ; int temp1 = d2 * l - d1 ; int temp2 = d2 - d1 * l ; if ( temp1 < d || d < temp2 ) System . out . println ( - 1 ) ; else { for ( int i = 0 ; i < n ; i ++ ) { if ( d > 0 ) { a [ i ] = l ; d = a [ i ] - d ; } else { a [ i ] = 1 ; d = a [ i ] - d ; } } a [ n - 1 ] -= d ; for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( a [ i ] + \" ▁ \" ) ; } System . out . println ( ) ; } } }", "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;", "import java . util . * ; import java . io . * ; public class Main2 { 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 FastReader sc = new FastReader ( ) ; public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; int t = 1 ;" ]
[ "def magic ( n , d , l ) : NEW_LINE", "def magic ( n , d , l ) : arr = [ 1 ] * ( n ) odd = arr [ 0 : : 2 ] even = arr [ 1 : : 2 ] if d > 0 : val = d - ( sum ( odd ) - sum ( even ) ) while val : for i in range ( len ( odd ) ) : if val : odd [ i ] += 1 val -= 1 else : break if d <= 0 : val = abs ( d ) - ( sum ( even ) - sum ( odd ) ) while val : for i in range ( len ( even ) ) : if val : even [ i ] += 1 val -= 1 else : break if max ( odd ) > l or max ( even ) > l : return - 1 arr [ 0 : : 2 ] = odd arr [ 1 : : 2 ] = even print ( * arr ) return \" \" a , b , c = map ( int , input ( ) . strip ( ) . split ( ) ) print ( magic ( a , b , c ) ) NEW_LINE", "from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE", "def magic ( n , d , l ) : ans = [ d ] flag = 0 for i in range ( n - 1 ) : temp = ans [ i ] if temp < 1 : ans [ i ] = 1 ans . append ( 1 - temp ) else : ans [ i ] = l ans . append ( l - temp ) if not 1 <= ans [ n - 1 ] <= l : flag = 1 if flag == 0 : return ans else : return - 1     if __name__ == \" _ _ main _ _ \" : n , d , l = map ( int , input ( ) . split ( ) ) magic = magic ( n , d , l ) if magic != - 1 : for i in range ( n ) : print ( magic [ i ] , end = \" ▁ \" ) else : print ( - 1 ) NEW_LINE" ]
codeforces_1061_A
[ "import java . util . Scanner ; public class WayTooLongWords { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int num = in . nextInt ( ) ; int limit = in . nextInt ( ) ; int x = 0 ; while ( limit > 0 ) { limit = limit - num ; x ++ ; } System . out . println ( x ) ; } }", "import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . math . MathContext ; import java . util . ArrayList ; import java . util . Locale ; import java . util . Scanner ;   public class CodeForces { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int count = 0 ; int sum = 0 ;   for ( int i = n ; i >= 0 ; ) {   sum += i ; if ( sum <= s ) { count ++ ; if ( sum == s ) { System . out . println ( count ) ; break ; } } else { sum -= i ; i -- ; } }    } }", "import java . io . * ; import java . util . * ;   public class Codeforces { public static void main ( String [ ] args ) throws UnsupportedEncodingException , IOException , Exception { StringBuilder out = new StringBuilder ( ) ; StringTokenizer tk ; Reader . init ( System . in ) ; int n = Reader . nextInt ( ) ; int s = Reader . nextInt ( ) ; if ( s % n == 0 ) { System . out . println ( s / n ) ; } else { System . out . println ( ( s / n ) + 1 ) ; }   } }   class Reader {   static BufferedReader reader ; static StringTokenizer tokenizer ;   static void init ( InputStream input ) throws UnsupportedEncodingException { reader = new BufferedReader ( new InputStreamReader ( input , \" UTF - 8\" ) ) ; tokenizer = new StringTokenizer ( \" \" ) ; }   static String next ( ) throws IOException { while ( ! tokenizer . hasMoreTokens ( ) ) {", "import java . io . IOException ; import java . util . Scanner ;   public class Codeforce {   public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) , y = input . nextInt ( ) ; System . out . println ( ( x + y - 1 ) / x ) ; } }" ]
[ "import mathn , S = map ( int , input ( ) . split ( \" ▁ \" ) ) print ( math . ceil ( S / n ) ) NEW_LINE", "n , s = map ( int , input ( ) . split ( \" ▁ \" ) ) ans = 1 ans = ( s + n - 1 ) / nprint ( int ( ans ) ) NEW_LINE", "max_coin , aim = map ( int , input ( ) . split ( ) ) need_more = aimcoins_used = 0   while ( max_coin > 0 ) : coins_used += need_more // max_coin need_more = need_more % max_coin max_coin -= 1   print ( coins_used ) NEW_LINE", "n , s = map ( int , input ( ) . split ( ) ) count = s // nif ( s % n == 0 ) : print ( count ) else : print ( count + 1 ) NEW_LINE" ]
codeforces_992_B
[ "import java . util . * ; public class Test1 { public static int gcd ( int a , int b ) { while ( b != 0 ) { int p = a % b ; a = b ; b = p ; } return a ; } public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; int l = scan . nextInt ( ) ; int r = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; int v = 0 ; if ( y % x == 0 ) { y = y / x ; for ( int i = 1 ; i * i <= y ; i ++ ) { int p = y / i ; if ( y % i == 0 && gcd ( p , i ) == 1 && ( x * i ) >= l && ( x * i ) <= r && ( x * p ) >= l && ( x * p ) <= r ) { if ( p != i ) { v = v + 2 ; } else { v ++ ; } } } } System . out . println ( v ) ; } }", "import java . io . * ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( in . readLine ( ) ) ; long l = Integer . parseInt ( st . nextToken ( ) ) ; long r = Integer . parseInt ( st . nextToken ( ) ) ; long gcd = Integer . parseInt ( st . nextToken ( ) ) ; long lcm = Integer . parseInt ( st . nextToken ( ) ) ; long n = gcd * lcm ; long res = 0 ; long sqrt = ( long ) ( Math . sqrt ( n ) ) ; for ( long i = gcd ; i <= sqrt ; i += gcd ) { long j = n / i ; if ( i >= l && i <= r && j >= l && j <= r ) { if ( gcd ( i , j ) == gcd && lcm ( i , j ) == lcm ) { if ( i == j ) { res ++ ; } else { res += 2 ; } } } } System . out . println ( res ) ; } static long gcd ( long p , long q ) { if ( q == 0 ) return p ; else return gcd ( q , p % q ) ; } static long lcm ( long a , long b ) { return ( a * b ) / ( gcd ( a , b ) ) ; } }", "import java . io . ByteArrayInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashSet ; import java . util . InputMismatchException ; import java . util . Set ;   public class Main {   private static final int MAXN = 5000 ; private static final String NO = \" NO \" ; private static final String YES = \" YES \" ; InputStream is ; PrintWriter out ; String INPUT = \" \" ;   private static long MOD = 1000000009 ;   void solve ( ) { long l = nl ( ) ; long r = nl ( ) ; long gcd = nl ( ) ; long lcm = nl ( ) ;   long m = lcm / gcd ;   int ans = 0 ; if ( lcm % gcd == 0 ) for ( int a = 1 ; a <= Math . sqrt ( m ) ; a ++ ) { if ( m % a == 0 && a * gcd <= r && a * gcd >= l && m / a * gcd <= r && m / a * gcd >= l && gcd ( a , m / a ) == 1 ) {", "import java . util . * ;   public class CodeForces992B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int l = input . nextInt ( ) ; int r = input . nextInt ( ) ; int x = input . nextInt ( ) ; int y = input . nextInt ( ) ;    if ( y % x != 0 ) { System . out . println ( 0 ) ; } else { int ans = 0 ; int n = y / x ; for ( int d = 1 ; d * d <= n ; d ++ ) { if ( n % d == 0 ) { int c = n / d ; if ( l <= c * x && c * x <= r && l <= d * x && d * x <= r && gcd ( c , d ) == 1 ) { if ( d * d == n ) { ans ++ ; } else { ans += 2 ; } } } }   System . out . println ( ans ) ; } }   public static int gcd ( int a , int b ) { while ( b > 0 ) { int t = a % b ; a = b ; b = t ; } return a ; } }" ]
[ "from collections import defaultdict , deque , Counterfrom sys import stdin , stdoutfrom heapq import heappush , heappopimport mathimport ioimport osimport mathimport bisect   NEW_LINE", "def gcd ( a , b ) : while b : a %= b a , b = b , a return al , r , x , y = map ( int , input ( ) . split ( ) ) if y % x != 0 : print ( 0 ) exit ( ) ans = 0 n = y // xi = 1 while i * i <= n : if n % i == 0 : c = n // i if l <= c * x <= r and l <= i * x <= r and gcd ( i , c ) == 1 : if i * i == n : ans += 1 else : ans += 2 i += 1 print ( ans ) NEW_LINE", "def make_divisors ( n ) : divisors = [ ] for i in range ( 1 , int ( n ** 0.5 ) + 1 ) : if n % i == 0 : divisors . append ( i ) if i != n // i : divisors . append ( n // i )   NEW_LINE", "from math import * l , r , x , y = map ( int , input ( ) . split ( ) ) m = int ( sqrt ( y ) - 0.1 ) + 1 s = list ( i for i in range ( 1 , m ) if y % i == 0 ) s += list ( y // i for i in s ) if m * m == y : s += [ m ] print ( sum ( sum ( int ( l <= i <= r and l <= j <= r and i * j == x * y and gcd ( i , j ) == x ) for i in s ) for j in s ) ) NEW_LINE" ]
codeforces_1213_A
[ "import java . util . * ; import java . io . * ; public class A { public static FastReader sc = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void taskSolver ( ) { int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int num = arr [ i ] ; int coins = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( num % 2 == 0 ) { if ( arr [ j ] % 2 != 0 ) coins ++ ; } else { if ( arr [ j ] % 2 == 0 ) coins ++ ; } } min = Math . min ( min , coins ) ; } out . println ( min ) ; } public static void main ( String args [ ] ) throws java . lang . Exception { taskSolver ( ) ; 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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; public class c582a {", "import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ; long [ ] arr = new long [ n ] ; int cntO = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scan . nextLong ( ) ; if ( arr [ i ] % 2 != 0 ) cntO += 1 ; } System . out . println ( Math . min ( cntO , n - cntO ) ) ; } }" ]
[ "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) ev = 0 od = 0   for i in range ( len ( l ) ) : if ( l [ i ] % 2 == 0 ) : ev += 1 else : od += 1   print ( min ( ev , od ) ) NEW_LINE", "import sys , math , itertoolsfrom collections import Counter , deque , defaultdictfrom bisect import bisect_left , bisect_right from heapq import heappop , heappush , heapifyfrom copy import deepcopymod = 10 ** 9 + 7 INF = float ( ' inf ' ) def inp ( ) : return int ( sys . stdin . readline ( ) ) def inpl ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def inpl_1 ( ) : return list ( map ( lambda x : int ( x ) - 1 , sys . stdin . readline ( ) . split ( ) ) ) def inps ( ) : return sys . stdin . readline ( ) def inpsl ( x ) : tmp = sys . stdin . readline ( ) ; return list ( tmp [ : x ] ) def err ( x ) : print ( x ) ; exit ( )   n = inp ( ) a = inpl ( ) e = [ 0 , 0 ] for x in a : e [ x % 2 ] += 1 print ( min ( e ) ) NEW_LINE", "n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) k = 0 l = 0 for i in range ( len ( x ) ) : if x [ i ] % 2 == 0 : k = k + 1 else : l = l + 1 m = min ( k , l ) print ( m ) NEW_LINE", "import mathimport sysinput = sys . stdin . readlinedef inp ( ) : return ( int ( input ( ) ) ) def inlt ( ) : return ( list ( map ( int , input ( ) . split ( ) ) ) ) def insr ( ) : s = input ( ) . strip ( ) return ( list ( s [ : len ( s ) ] ) ) def invr ( ) : return ( map ( int , input ( ) . split ( ) ) ) n = inp ( ) l = inlt ( ) n_eve = 0 n_odd = 0 for i in range ( n ) : if l [ i ] % 2 == 0 : n_eve += 1 else : n_odd += 1 print ( min ( n_eve , n_odd ) ) NEW_LINE" ]
codeforces_1084_A
[ "import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n , sum = 0 , minsum = Integer . MAX_VALUE , man = 0 ; int [ ] a = new int [ 101 ] ; n = in . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } for ( int x = 1 ; x <= n ; x ++ ) { sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { man = 0 ; man += 2 * ( Math . abs ( i - x ) + Math . abs ( i - 1 ) + Math . abs ( 1 - x ) ) ; sum += man * a [ i ] ; } if ( sum < minsum ) { minsum = sum ; } } System . out . println ( minsum ) ; in . close ( ) ; } }", "import java . util . * ;   public class Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] a = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; }   int min = 0 ; for ( int i = 0 ; i < n ; i ++ ) {   int temp = 0 ; for ( int j = 0 ; j < n ; j ++ ) { temp += 2 * ( Math . abs ( i - j ) + i + j ) * a [ j ] ; } if ( i == 0 || temp < min ) { min = temp ; } } System . out . println ( min ) ; } }" ]
[ "n = int ( input ( ) ) a = [ 1 ] + [ int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ] res = 0 power = [ ] for i in range ( 1 , n + 1 ) : for j in range ( 1 , n + 1 ) : if j > i : res = a [ j ] * ( ( j - i ) * 2 + ( j - 1 ) * 2 ) * 2 + res else : res = a [ j ] * ( j - 1 ) * 2 * 2 + res power . append ( res ) res = 0   ans = min ( power ) print ( ans )   NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) pas = 0 for i in range ( n ) : pas += a [ i ] * i * 4 print ( pas ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 for i in range ( 1 , n ) : ans += 4 * a [ i ] * iprint ( ans ) NEW_LINE", "n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) ans = 10 ** 18 for i in range ( n ) : x = i + 1 temp = 0 for j in range ( n ) : k = j + 1 temp += ( abs ( k - x ) + abs ( k - 1 ) + abs ( x - 1 ) ) * A [ j ] temp += ( abs ( 1 - x ) + abs ( 1 - k ) + abs ( k - x ) ) * A [ j ] y = abs ( k - x ) + abs ( x - 1 ) + abs ( x - 1 ) + abs ( 1 - x ) + abs ( 1 - k ) + abs ( k - x ) NEW_LINE" ]
codeforces_1463_B
[ "  import java . util . * ; import java . lang . * ; import java . io . * ;   public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t != 0 ) { int n = sc . nextInt ( ) ; long s1 = 0 , s2 = 0 ; long arr [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( i % 2 == 0 ) s1 += arr [ i ] ; else s2 += arr [ i ] ; } if ( s1 < s2 ) { for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) arr [ i ] = 1 ; System . out . print ( arr [ i ] ) ; System . out . print ( \" ▁ \" ) ; } } else { for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 1 ) arr [ i ] = 1 ; System . out . print ( arr [ i ] ) ; System . out . print ( \" ▁ \" ) ; } } System . out . println ( ) ; t = t - 1 ; } } }", "import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; 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 tc = input . nextInt ( ) ; while ( tc -- > 0 ) { int n = input . nextInt ( ) ; long sum = 0 ; int a [ ] = new int [ n ] ; int max = 0 ; int maxIndex = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; sum += a [ i ] ; if ( max <= a [ i ] ) { max = a [ i ] ; maxIndex = i ; } } long total1 = 0 , total2 = 0 ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Zad1463B {   public static void main ( String [ ] args ) {", "import java . io . * ; import java . lang . * ; import java . util . * ; import java . io . * ; import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int t = scanner . nextInt ( ) ; while ( t -- > 0 ) { StringBuilder sb = new StringBuilder ( ) ; int n = scanner . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = scanner . nextInt ( ) ; int b [ ] = new int [ n ] , c [ ] = new int [ n ] ; long compare = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { compare += a [ i ] - 1 ; b [ i ] = 1 ; } else { b [ i ] = a [ i ] ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 1 ) { compare -= a [ i ] - 1 ; c [ i ] = 1 ; } else { c [ i ] = a [ i ] ; } } if ( compare < 0 ) { for ( int i = 0 ; i < n ; i ++ ) sb . append ( b [ i ] + \" ▁ \" ) ; } else { for ( int i = 0 ; i < n ; i ++ ) sb . append ( c [ i ] + \" ▁ \" ) ; } System . out . println ( sb ) ; } } }" ]
[ "import bisectimport NEW_LINE sysinput = sys . stdin . readline   t = int ( input ( ) ) NEW_LINE pow2 = [ 1 ] NEW_LINE for _ in range ( 32 ) : pow2 . append ( 2 * pow2 [ - 1 ] ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE b = [ ] NEW_LINE for i in a : j = bisect . bisect_left ( pow2 , i + 0.5 ) - 1 NEW_LINE if i - pow2 [ j ] <= pow2 [ j + 1 ] - i or j >= 29 : NEW_LINE INDENT b . append ( pow2 [ j ] ) else : NEW_LINE b . append ( pow2 [ j + 1 ] ) NEW_LINE DEDENT print ( * b ) NEW_LINE", "import math   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE print ( ' ▁ ' . join ( [ str ( 1 << int ( math . log2 ( x ) ) ) for x in a ] ) ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE sum_e = sum_o = 0 NEW_LINE for i in range ( n ) : if NEW_LINE i % 2 == 0 : sum_e += l [ i ] else : sum_o += l [ i ] NEW_LINE if sum_e < sum_o : NEW_LINE INDENT t = 1 else : NEW_LINE t = 0 NEW_LINE DEDENT ans = [ ] NEW_LINE for i in range ( n ) : if NEW_LINE i % 2 == t : ans . append ( l [ i ] ) else : ans . append ( 1 )   print ( * ans ) NEW_LINE", "def read ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = read ( ) NEW_LINE res = [ ] NEW_LINE t = 1 NEW_LINE for i in a : while NEW_LINE t <= i / 2 : t <<= 1 NEW_LINE while t >= i * 1.5 : t >>= 1 NEW_LINE res . append ( t ) NEW_LINE print ( * res ) NEW_LINE", "import sys , mathfrom NEW_LINE collections NEW_LINE import defaultdict , dequeinput = sys . stdin . readline   NEW_LINE def check ( arr ) : cur = 0 NEW_LINE for i in range ( n ) : cur += ( l [ i ] - arr [ i ] ) NEW_LINE return ( 2 * cur ) <= s   t = int ( input ( ) ) NEW_LINE while ( t > 0 ) : n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE s = sum ( l ) NEW_LINE b1 = [ 1 for _ in range ( n ) ] NEW_LINE b2 = [ 1 for _ in range ( n ) ] NEW_LINE for i in range ( 0 , n , 2 ) : b1 [ i ] = l [ i ] NEW_LINE for i in range ( 1 , n , 2 ) : b2 [ i ] = l [ i ] NEW_LINE if ( check ( b1 ) ) : NEW_LINE INDENT print ( * b1 ) else : NEW_LINE print ( * b2 ) NEW_LINE DEDENT t -= 1 NEW_LINE" ]
codeforces_1352_B
[ "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 . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BSameParitySummands solver = new BSameParitySummands ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class BSameParitySummands { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int t = in . nextInt ( ) ; while ( t -- > 0 ) { long n = in . nextLong ( ) ; int k = in . nextInt ( ) ;", "import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ;   public class Learn { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int t = cin . nextInt ( ) ; while ( t -- > 0 ) { int n , k ; n = cin . nextInt ( ) ; k = cin . nextInt ( ) ; if ( n % 2 == 0 && n >= 2 * k ) { int ans = n / 2 ; if ( ans >= k ) { System . out . println ( \" YES \" ) ; for ( int i = 1 ; i < k ; i ++ ) { System . out . print ( 2 + \" ▁ \" ) ; } System . out . println ( n - k * 2 + 2 ) ; continue ; } } if ( n >= k && k % 2 == n % 2 ) { System . out . println ( \" YES \" ) ; for ( int i = 1 ; i < k ; i ++ ) { System . out . print ( 1 + \" ▁ \" ) ; } System . out . println ( n - k + 1 ) ; continue ; } System . out . println ( \" NO \" ) ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class Main {   public static void main ( String [ ] args ) throws IOException { Solution solution = new Solution ( ) ; solution . solve ( ) ; } }   class Solution { Solution ( ) { }   void solve ( ) throws IOException { int t = Reader . nextInt ( ) ; int count = 0 ; while ( count < t ) { int n = Reader . nextInt ( ) ; int k = Reader . nextInt ( ) ; boolean flag = false ; ArrayList < Integer > arrayList = new ArrayList < > ( ) ; if ( n >= k ) { if ( ( n - ( k - 1 ) ) % 2 == 1 ) { flag = true ; arrayList . add ( n - ( k - 1 ) ) ; for ( int i = 0 ; i < k - 1 ; i ++ ) { arrayList . add ( 1 ) ; } } } if ( n >= k * 2 ) { if ( ( n - 2 * ( k - 1 ) ) % 2 == 0 ) { flag = true ; arrayList . add ( n - 2 * ( k - 1 ) ) ; for ( int i = 0 ; i < k - 1 ; i ++ ) { arrayList . add ( 2 ) ; } } }   if ( flag ) { System . out . println ( \" YES \" ) ; for ( int i = 0 ; i < k ; i ++ ) { System . out . print ( arrayList . get ( i ) + \" ▁ \" ) ; } System . out . println ( ) ; } else { System . out . println ( \" NO \" ) ; } count ++ ; } } }   class Reader { static BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringTokenizer tokenizer = new StringTokenizer ( \" \" ) ; static String nextLine ( ) throws IOException {" ]
[ "for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) if n < k : print ( \" NO \" ) continue if ( n // k + n % k ) % 2 == ( n // k ) % 2 : print ( \" YES \" ) print ( * ( [ n // k + n % k ] + [ n // k ] * ( k - 1 ) ) ) elif ( n // k > 1 ) & ( ( k - 1 ) % 2 == 0 ) : print ( \" YES \" ) print ( * ( [ n // k + n % k ] + [ n // k - 1 , n // k + 1 ] * ( ( k - 1 ) // 2 ) ) ) else : print ( \" NO \" ) NEW_LINE", "def answer ( n , k ) : if k > n : print ( ' NO ' ) return if k == n : print ( ' YES ' ) lst = [ '1' for i in range ( k ) ] print ( ' ▁ ' . join ( lst ) ) return NEW_LINE", "def p ( k , n ) : r = n // k print ( ' YES ' ) for _ in range ( k - 1 ) : print ( r , end = ' ▁ ' ) print ( r + ( n % k ) ) def raf ( ) : n , k = map ( int , input ( ) . split ( ) ) if n < k : print ( ' NO ' ) ; return if n % k == 0 : print ( ' YES ' ) for _ in range ( k ) : print ( n // k , end = ' ▁ ' ) print ( ) return if k % 2 == 1 : if n % 2 == 0 : if ( n // k ) % 2 == 0 : p ( k , n ) else : if n // k == 1 : print ( ' NO ' ) else : print ( ' YES ' ) r = ( n // k ) - 1 a = ( n // k ) + ( n % k ) + ( k - 1 ) for _ in range ( k - 1 ) : print ( r , end = \" ▁ \" ) print ( a ) else : if ( n // k ) % 2 == 0 : if n // k == 1 : print ( ' NO ' ) else : print ( ' YES ' ) r = ( n // k ) - 1 a = ( n // k ) + ( n % k ) + ( k - 1 ) for _ in range ( k - 1 ) : print ( r , end = \" ▁ \" ) print ( a ) else : p ( k , n ) else : if n % 2 == 0 : p ( k , n ) else : print ( ' NO ' ) def main ( ) : for _ in range ( int ( input ( ) ) ) : raf ( ) if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) a = [ 1 ] * ( k - 1 ) + [ ( n - k + 1 ) ] if a [ - 1 ] % 2 == 1 and a [ - 1 ] > 0 : print ( \" YES \" ) print ( * a ) continue a = [ 2 ] * ( k - 1 ) + [ n - 2 * ( k - 1 ) ] if a [ - 1 ] % 2 == 0 and a [ - 1 ] > 0 : print ( \" YES \" ) print ( * a ) continue print ( \" NO \" ) NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : n , k = map ( int , input ( ) . split ( ) ) if k > n : print ( \" NO \" ) elif ( ( n - k + 1 ) % 2 != 0 ) : print ( \" YES \" ) for i in range ( 1 , k ) : print ( 1 , end = ' ▁ ' ) print ( n - k + 1 ) elif ( ( n - 2 * ( k - 1 ) ) % 2 == 0 and ( n - 2 * ( k - 1 ) ) > 0 ) : print ( \" YES \" ) for i in range ( 1 , k ) : print ( 2 , end = ' ▁ ' ) print ( n - 2 * ( k - 1 ) ) else : print ( \" NO \" ) NEW_LINE" ]
codeforces_998_A
[ "import java . util . Scanner ;   public class Balloons {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } if ( n == 1 ) { System . out . println ( - 1 ) ; } else if ( n == 2 && a [ 0 ] == a [ 1 ] ) { System . out . println ( - 1 ) ; } else { int mn = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ mn ] > a [ i ] ) { mn = i ; } } System . out . println ( \"1\" ) ; System . out . println ( mn + 1 ) ; } } }", "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 int [ ] arr ; static char [ ] ch , ch1 ; static int [ ] darr , farr ; static Character [ ] [ ] mat , mat1 ; static long x , h ; static long maxl ; static double dec ; static String s ; static long minl ; static int mx = ( int ) 1e9 + 5 ; static long mod = 998244353l ;", "import java . util . * ; import java . io . * ; public class A { public static void main ( String args [ ] ) { FastScanner in = new FastScanner ( ) ; int n = in . nextInt ( ) ; int a [ ] = in . nextArray ( n ) ; int sum1 = 0 , sum2 = 0 ; int min = Integer . MAX_VALUE , ind = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] < min ) { min = a [ i ] ; ind = i ; } sum1 = sum1 + a [ i ] ; } sum1 = sum1 - a [ ind ] ; sum2 = a [ ind ] ; if ( sum1 != sum2 && sum1 != 0 && sum2 != 0 ) { System . out . println ( 1 ) ; System . out . println ( ind + 1 ) ; } else System . out . println ( - 1 ) ; }  ", "import java . util . Scanner ;   public class Balloons { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , a [ ] = new int [ n ] , s = 0 ;   for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; s += a [ i ] ; } in . close ( ) ;   for ( i = 0 ; i < n ; i ++ ) { if ( a [ i ] != s - a [ i ] && s != a [ i ] ) {   System . out . println ( 1 + \" \\n \" + ( i + 1 ) ) ; return ; } } System . out . println ( - 1 ) ; } }" ]
[ "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) total = sum ( a ) if n == 1 : print ( - 1 ) else : ans = - 1 for i in range ( n ) : if a [ i ] != total - a [ i ] : ans = i break if ans == - 1 : print ( - 1 ) else : print ( 1 ) print ( ans + 1 ) NEW_LINE", "import sysn = int ( input ( ) ) arr = list ( map ( int , sys . stdin . readline ( ) . rstrip ( ) . split ( \" ▁ \" ) ) ) l = len ( arr ) g = 0 a = 0 if n == 1 : print ( \" - 1\" ) elif n == 2 : for i in range ( l - 1 ) : if int ( arr [ i ] ) != int ( arr [ i + 1 ] ) : print ( \"1\" ) print ( \"1\" ) else : print ( \" - 1\" ) else : for i in range ( l - 1 ) : if int ( arr [ i ] <= arr [ i + 1 ] ) : print ( \"1\" ) print ( \"1\" ) break else : print ( \"1\" ) j = arr . index ( arr [ i + 1 ] ) print ( j + 1 ) break   NEW_LINE", "import sysn = int ( sys . stdin . readline ( ) . strip ( ) ) arr = list ( map ( int , sys . stdin . readline ( ) . rstrip ( ) . split ( \" ▁ \" ) ) ) a1 = [ ] a2 = [ ] s1 = s2 = 0 val = min ( arr ) index = arr . index ( val ) a1 . append ( index )   for i in range ( 0 , len ( arr ) ) : a2 . append ( i )   for j in a1 : s1 = s1 + arr [ int ( j ) ] for k in a2 : s2 = s2 + arr [ int ( k ) ] s2 = s2 - val   NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) g = d = 0 lst = [ ] for i in range ( n ) : if i % 2 == 0 : g += a [ i ] lst . append ( a [ i ] ) else : d += a [ i ] if d > 0 and g > 0 and g != d : print ( 1 ) print ( 2 ) elif g == d and n > 2 : print ( 1 ) print ( 1 ) else : print ( - 1 ) NEW_LINE" ]
codeforces_988_A
[ "import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; HashSet < Integer > h = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; h . add ( arr [ i ] ) ; } int p = 0 ; int [ ] a1 = new int [ n ] ; if ( h . size ( ) >= k ) { System . out . println ( \" YES \" ) ; HashMap < Integer , Integer > hm = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! hm . containsKey ( arr [ i ] ) ) { hm . put ( arr [ i ] , 1 ) ; a1 [ p ] = i + 1 ; p ++ ; } } for ( int i = 0 ; i < k ; i ++ ) System . out . print ( a1 [ i ] + \" ▁ \" ) ; } else System . out . println ( \" NO \" ) ; } }", "import java . util . ArrayList ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ;   public class DiverseTeam { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; ArrayList < Integer > a = new ArrayList < > ( ) ; int count = 0 ; Set < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( ! set . contains ( arr [ i ] ) ) { set . add ( arr [ i ] ) ; a . add ( i ) ; } } int [ ] arr1 = a . stream ( ) . mapToInt ( i -> i ) . toArray ( ) ; if ( set . size ( ) >= k ) { System . out . println ( \" YES \" ) ; for ( int i = 0 ; i < k ; i ++ ) { System . out . print ( arr1 [ i ] + 1 + \" ▁ \" ) ; } } else { System . out . println ( \" NO \" ) ; } } }", "import java . io . BufferedReader ; 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 Seg { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] a = sc . nextArr ( n ) ; boolean isHere [ ] = new boolean [ 101 ] ; int c = 0 ; int [ ] temp = new int [ n + 1 ] ; int j = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! isHere [ a [ i ] ] ) { c ++ ; isHere [ a [ i ] ] = true ; temp [ j ] = i + 1 ; j ++ ; if ( c >= k ) { break ; }   } }   if ( c >= k ) { System . out . println ( \" YES \" ) ; for ( int i = 0 ; i < j ; i ++ ) { System . out . print ( temp [ i ] + \" ▁ \" ) ; } } else { System . out . println ( \" NO \" ) ; }   pw . flush ( ) ; pw . close ( ) ; }   public static int findMaxSumSubarray ( int [ ] arr , int k ) { int maxValue = Integer . MIN_VALUE ; int currentRunningSum = 0 ; for ( int i = 0 ; i < arr . length ; i ++ ) { currentRunningSum += arr [ i ] ; if ( i >= k - 1 ) { maxValue = Math . max ( maxValue , currentRunningSum ) ; currentRunningSum -= arr [ i - ( k - 1 ) ] ;", "import java . util . ArrayList ; import java . util . Scanner ;    public class DiverseTeam {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; ArrayList < Integer > p1 = new ArrayList < > ( ) ; ArrayList < Integer > p2 = new ArrayList < > ( ) ; int a [ ] = new int [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( ! p1 . contains ( a [ i ] ) ) { p1 . add ( a [ i ] ) ; p2 . add ( i + 1 ) ; } } if ( p2 . size ( ) >= m ) { System . out . println ( \" YES \" ) ; for ( int i = 0 ; i < m ; i ++ ) { System . out . print ( p2 . get ( i ) + \" ▁ \" ) ; } } else { System . out . println ( \" NO \" ) ; } } }" ]
[ "R = lambda : map ( int , input ( ) . split ( ) ) n , k = R ( ) d = dict ( zip ( R ( ) , range ( 1 , n + 1 ) ) ) if len ( d ) < k : print ( ' NO ' ) else : print ( ' YES ' ) ; print ( * list ( d . values ( ) ) [ : k ] ) NEW_LINE", "n , k = list ( map ( int , input ( ) . split ( ) ) ) arreglo = list ( map ( int , input ( ) . split ( ) ) )   set1 = set ( arreglo )   if len ( set1 ) >= k : print ( \" YES \" ) for i in range ( k ) : print ( arreglo . index ( set1 . pop ( ) ) + 1 , end = \" ▁ \" ) else : print ( \" NO \" ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) s = list ( set ( a ) ) if len ( s ) >= k : print ( \" YES \" ) for r in range ( k ) : print ( a . index ( s [ r ] ) + 1 , end = ' ▁ ' ) else : print ( \" NO \" ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in l : if ( i in d ) : d [ i ] += 1 else : d [ i ] = 1 if ( len ( d ) < k ) : print ( ' NO ' ) else : print ( ' YES ' ) d1 = { } c = 0 for i in range ( n ) : if ( c < k and l [ i ] not in d1 ) : c += 1 print ( i + 1 , end = ' ▁ ' ) d1 [ l [ i ] ] = 1   NEW_LINE" ]
codeforces_810_A
[ "import java . util . * ;   public class Absolutezero {    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int sum = 0 ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int n1 = sc . nextInt ( ) ; list . add ( n1 ) ; sum += n1 ; } int u1 = ( int ) Math . round ( ( double ) sum / n ) ;", "import java . util . * ;   public class Absolutezero {    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int sum = 0 ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int n1 = sc . nextInt ( ) ; list . add ( n1 ) ; sum += n1 ; } int u1 = ( int ) Math . round ( ( double ) sum / n ) ;", "import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int k = input . nextInt ( ) ; int a [ ] = new int [ n ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; sum += a [ i ] ; } for ( int i = 0 ; ; i ++ ) { long rd = Math . round ( ( i * k + sum * 1.0 ) / ( i + n * 1.0 ) ) ; if ( rd == k ) { System . out . println ( i ) ; return ; } } }     }" ]
[ "a = [ int ( x ) for x in input ( ) . split ( ) ] b = [ int ( y ) for y in input ( ) . split ( ) ] sum1 = 0 for z in b : sum1 = sum1 + zavg = sum1 / a [ 0 ] if ( avg >= ( a [ 1 ] - 0.5 ) ) : print ( 0 ) else : print ( ( ( 2 * a [ 1 ] - 1 ) * a [ 0 ] ) - ( 2 * sum1 ) ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )     i = 0 avg = round ( sum ( a ) / n , 10 )   while avg < k - 0.5 : i += 1 avg = round ( ( sum ( a ) + i * k ) / ( n + i ) , 10 )   print ( i )   NEW_LINE", "n , k = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) temp = max ( a ) ans = 0 while sum ( a ) / len ( a ) < ( k - 0.5 ) : NEW_LINE", "import sys   n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) c = 0 sum_ = sum ( a ) len_ = len ( a ) while sum_ / len_ < k - 0.5 : sum_ += k len_ += 1 c += 1 print ( c ) NEW_LINE", "def grade ( ar ) : z = sum ( ar ) / len ( ar ) f = int ( z ) s = z - f if ( s >= 0.5 ) : return f + 1 else : return f   x , y = map ( int , input ( ' ' ) . split ( ) ) ar = list ( map ( int , input ( ' ' ) . split ( ) ) ) q = grade ( ar ) ct = 0 while ( q < y ) : ct = ct + 1 ar . append ( y ) q = grade ( ar )   print ( ct )   NEW_LINE" ]
codeforces_1056_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 = 1 ; while ( T -- > 0 ) { int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; long sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( ( i * i + j * j ) % m == 0 ) { int r = n % m ; int dif = r - i ; if ( dif < 0 ) { dif += m ; } int v = n - dif ; int x = i ; if ( x == 0 ) { x += m ; } int s1 = ( v - x ) / m + 1 ; dif = r - j ; if ( dif < 0 ) { dif += m ; } v = n - dif ; x = j ; if ( x == 0 ) { x += m ; } int s2 = ( v - x ) / m + 1 ; sum += ( long ) s1 * ( long ) s2 ; } } } out . println ( sum ) ; } 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 . io . IOException ; import java . io . InputStreamReader ; import java . io . BufferedReader ; import java . util . * ; import java . math . * ; import java . io . * ;   public class hacker {  " ]
[ "import sysfrom math import sqrt   input = lambda : sys . stdin . readline ( ) . rstrip ( \" \\n \" )   mod = 1000000007   n , m = map ( int , input ( ) . split ( ) ) t = n // mck = n % mans = 0 for i in range ( m ) : for j in range ( m ) : if ( i ** 2 + j ** 2 ) % m == 0 : a = b = t if i <= ck and i : a += 1 if j <= ck and j : b += 1 ans += a * bprint ( 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 , nlargest     def main ( ) : NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) mat = [ [ 0 for i in range ( m ) ] for j in range ( m ) ] for i in range ( m ) : for j in range ( m ) : mat [ i ] [ j ] = ( ( i + 1 ) ** 2 ) + ( ( j + 1 ) ** 2 ) mat [ i ] [ j ] %= mzeros = [ [ 0 for i in range ( m ) ] for j in range ( m ) ] for j in range ( m ) : if ( mat [ 0 ] [ j ] == 0 ) : zeros [ 0 ] [ j ] = 1 for i in range ( 1 , m ) : zeros [ i ] [ j ] = zeros [ i - 1 ] [ j ] if ( mat [ i ] [ j ] == 0 ) : zeros [ i ] [ j ] += 1 downExtend = [ 0 for i in range ( m ) ] for i in range ( m ) : downExtend [ i ] = zeros [ m - 1 ] [ i ] * ( n // m ) if ( n % m != 0 ) : downExtend [ i ] += zeros [ n % m - 1 ] [ i ] SUM = sum ( downExtend ) ans = SUM * ( n // m ) + sum ( downExtend [ : n % m ] ) print ( ans ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) ans = 0 for i in range ( 1 , m + 1 ) : for j in range ( 1 , m + 1 ) : if ( i ** 2 + j ** 2 ) % m == 0 : ans += ( ( n - i ) // m + 1 ) * ( ( n - j ) // m + 1 ) print ( ans ) NEW_LINE", "from collections import defaultdict , deque , Counterfrom sys import stdin , stdoutfrom heapq import heappush , heappopimport mathimport ioimport osimport mathimport bisect   NEW_LINE" ]
codeforces_404_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner input = new Scanner ( System . in ) ; double a = input . nextDouble ( ) ; double d = input . nextDouble ( ) ; long n = input . nextLong ( ) ; double s = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { s = Math . abs ( ( i * d ) - ( ( long ) ( ( i * d ) / ( 4 * a ) ) ) * ( 4 * a ) ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Marathon { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; double a = Double . parseDouble ( st . nextToken ( ) ) ; double d = Double . parseDouble ( st . nextToken ( ) ) % ( a * 4.0 ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int curEdge = 1 ; double x = 0.0 , y = 0.0 , dRemaining ; for ( int i = 0 ; i < n ; i ++ ) { dRemaining = d ; while ( true ) { if ( curEdge == 1 ) { if ( x + dRemaining > a ) { dRemaining -= a - x ; curEdge ++ ; x = a ; } else { x += dRemaining ; break ; } } else if ( curEdge == 2 ) { if ( y + dRemaining > a ) { dRemaining -= a - y ; curEdge ++ ; y = a ; } else { y += dRemaining ; break ; } } else if ( curEdge == 3 ) { if ( x < dRemaining ) { dRemaining -= x ; curEdge ++ ; x = 0.0 ; } else { x -= dRemaining ; break ; } } else { if ( y < dRemaining ) { dRemaining -= y ; curEdge = 1 ; y = 0.0 ; } else { y -= dRemaining ; break ; } } } pw . println ( x + \" ▁ \" + y ) ; } pw . flush ( ) ; pw . close ( ) ; } }" ]
[ "from math import ceila , d = map ( float , input ( ) . split ( ) ) n = int ( input ( ) ) s = a * 4 for i in range ( 1 , n + 1 ) : yy = ( d * i ) // s yy = ( d * i ) - ( yy * s ) NEW_LINE", "a , d = map ( float , input ( ) . split ( ) ) n = int ( input ( ) ) s = 0 for i in range ( 1 , n + 1 ) : s += d s %= 4 * a t = s // a if t % 4 == 0 : print ( s % a , 0 ) elif t % 4 == 1 : print ( a , s % a ) elif t % 4 == 2 : print ( a - s % a , a ) elif t % 4 == 3 : print ( 0 , a - s % a ) NEW_LINE", "a , m = map ( float , input ( ) . split ( ) ) n = int ( input ( ) ) x = 4 * a ; l = [ ] l . append ( m % x ) for i in range ( 1 , n ) : l . append ( ( l [ - 1 ] + m ) % x ) NEW_LINE" ]
codeforces_8_A
[ "import java . io . * ; import java . util . * ; import java . lang . * ; public class Test {   public static void main ( String [ ] args ) throws IOException {", "import java . io . * ; import java . util . * ; import java . math . * ;   public class A { public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;", "import java . io . * ;   public class Main { static String str , str1 , str2 ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ;   public static void main ( String [ ] args ) throws IOException {", "import java . io . * ;   public class Main { static String str , str1 , str2 ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ;   public static void main ( String [ ] args ) throws IOException {", "import java . util . Scanner ;   public class T8A {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String flags = in . nextLine ( ) ; String first = in . nextLine ( ) ; String second = in . nextLine ( ) ;   boolean isForward = checkOccurrenceTwoSubstring ( flags , first , second ) ; boolean isBack = checkOccurrenceTwoSubstring ( new StringBuilder ( flags ) . reverse ( ) . toString ( ) , first , second ) ;   if ( isForward && isBack ) { System . out . println ( \" both \" ) ; } else if ( isForward ) { System . out . println ( \" forward \" ) ; } else if ( isBack ) { System . out . println ( \" backward \" ) ; } else { System . out . println ( \" fantasy \" ) ; }   }   public static boolean checkOccurrenceTwoSubstring ( String str , String first , String second ) { boolean check = true ; int firstIndex = str . indexOf ( first ) ; if ( firstIndex >= 0 ) { int secondIndex = str . substring ( firstIndex + first . length ( ) ) . indexOf ( second ) ; if ( secondIndex < 0 ) { check = false ; } } else { check = false ; }   return check ; }   }" ]
[ "actual = input ( ) memorized1 = input ( ) memorized2 = input ( )   index1 = actual . find ( memorized1 ) index2 = actual . find ( memorized2 , index1 + len ( memorized1 ) ) index3 = actual [ : : - 1 ] . find ( memorized1 ) index4 = actual [ : : - 1 ] . find ( memorized2 , index3 + len ( memorized1 ) )   NEW_LINE", "def check ( flags , first , second ) : if first not in flags or second not in flags : return False f_f_ind , l_s_ind = flags . index ( first ) , flags . rindex ( second ) return f_f_ind + len ( first ) - 1 < l_s_ind     flags , first , second = input ( ) , input ( ) , input ( ) f = check ( flags , first , second ) flags = flags [ : : - 1 ] b = check ( flags , first , second ) if f and b : print ( ' both ' ) elif f : print ( ' forward ' ) elif b : print ( ' backward ' ) else : print ( ' fantasy ' )   ''' ▁ ▁ ▁ ▁ ▁ ▁ 0123456flags ▁ = ▁ ' aaacaaa ' first ▁ = ▁ ' aca ' second ▁ = ▁ ' aa '   ''' NEW_LINE", "def check ( flags : str , first : str , second : str ) -> bool : if first not in flags or second not in flags : return False f_f_ind = flags . index ( first ) l_s_ind = flags . rindex ( second ) return f_f_ind + len ( first ) - 1 < l_s_ind     flags , first , second = input ( ) , input ( ) , input ( ) f = check ( flags , first , second ) flags = flags [ : : - 1 ] b = check ( flags , first , second )   if f and b : print ( ' both ' ) elif f : print ( ' forward ' ) elif b : print ( ' backward ' ) else : print ( ' fantasy ' ) NEW_LINE", "def check ( flags : str , first : str , second : str ) -> bool : if first not in flags or second not in flags : return False f_f_index = flags . index ( first ) s_l_index = flags . rindex ( second ) return f_f_index + len ( first ) - 1 < s_l_index     flags , first , second = input ( ) , input ( ) , input ( ) f = check ( flags , first , second ) flags = flags [ : : - 1 ] b = check ( flags , first , second ) if f and b : print ( ' both ' ) elif f : print ( ' forward ' ) elif b : print ( ' backward ' ) else : print ( ' fantasy ' )   ''' ▁ ▁ ▁ ▁ ▁ ▁ ▁ 0123456flags = \" aaacaaa \" first = \" aca \" second = \" aa \" ''' NEW_LINE", "def main ( ) : s , a , b = input ( ) , input ( ) , input ( ) sh = pi = False la , ls , lb = len ( a ) , len ( s ) , len ( b ) fi = s . find ( a ) if fi != - 1 : if ls - ( fi + la ) >= lb and s . find ( b , fi + la ) != - 1 : sh = True s = ' ' . join ( reversed ( s ) ) fi = s . find ( a ) if fi != - 1 : if ls - ( fi + la ) >= lb and s . find ( b , fi + la ) != - 1 : pi = True if sh != True and pi != True : print ( ' fantasy ' ) elif sh == True and pi == True : print ( ' both ' ) elif sh == True : print ( ' forward ' ) elif pi == True : print ( ' backward ' ) if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE" ]
codeforces_1031_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 . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class _p001031A { static public void main ( final String [ ] args ) throws IOException { p001031A . _main ( args ) ; }", "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 _p001031A { static public void main ( final String [ ] args ) throws IOException { p001031A . _main ( args ) ; }", "import java . io . * ; import java . util . Scanner ; import java . util . Arrays ; public class Solution {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int h = in . nextInt ( ) ; int w = in . nextInt ( ) ; int x = in . nextInt ( ) ; int c = 0 ; if ( x == 1 ) { c = c + ( h * 2 + w * 2 ) ; c = c - 4 ; } else if ( x > 1 ) { for ( int i = 1 ; i <= x ; i ++ ) { c = c + ( h * 2 + w * 2 ) ; c = c - 4 ; h = h - 4 ; w = w - 4 ; } } System . out . println ( c ) ; } }", "import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int w = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int r = 0 ; for ( int i = 0 ; i < k ; i ++ ) { r += 2 * ( h ) ; r += 2 * ( w - 2 ) ; w -= 4 ; h -= 4 ; } System . out . println ( r ) ; } }" ]
[ "n , m , k = map ( int , input ( ) . split ( ) ) cells = 0 for i in range ( 0 , k ) : cells += 2 * ( m + n - 2 - i * ( 8 ) ) print ( cells ) NEW_LINE", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int w = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int res = 0 ; for ( int i = 0 ; i < k ; i + + ) { res = res + 2 * ( w + h - 2 ) ; w = w - 4 ; h = h - 4 ; } System . out . println ( res ) ; } } NEW_LINE", "w , h , k = map ( int , input ( ) . split ( ) ) print ( 2 * ( w + h ) * k - 8 * k * k + 4 * k ) NEW_LINE", "a , b , c = ( int ( x ) for x in input ( ) . split ( ) ) r = 0 for x in range ( c ) : r += ( ( ( a - x * 4 ) + ( b - x * 4 ) - 2 ) * 2 ) print ( r ) NEW_LINE" ]
codeforces_898_B
[ "  import java . util . * ; import java . lang . * ; import java . io . * ; import java . math . * ;    public class file {   ", "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 . io . * ;   public class pn {   public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; int a = Integer . parseInt ( in . readLine ( ) ) ; int b = Integer . parseInt ( in . readLine ( ) ) ; int num = 0 ; int f = 0 ; int ans = 0 ; int i = 0 ; boolean notfound = false ; boolean less = false ; while ( ! notfound ) { if ( i < 0 ) { less = true ; break ; } num = n - i * a ; if ( num < 0 ) { notfound = true ; } if ( num % b == 0 ) { f = 2 ; ans = i ; notfound = true ; } i ++ ; } if ( less || ( num / b ) < 0 ) { System . out . println ( \" NO \" ) ; } else if ( f == 2 ) { System . out . println ( \" YES \" ) ; System . out . println ( ans + \" ▁ \" + num / b ) ; } else { System . out . println ( \" NO \" ) ; } in . close ( ) ; out . close ( ) ; }   }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ; import static java . util . Arrays . sort ; import javafx . util . Pair ;   public class Main { public static void main ( String [ ] args ) {   FastScanner input = new FastScanner ( ) ; long n = input . nextLong ( ) ; long a = input . nextLong ( ) ; long b = input . nextLong ( ) ; for ( long i = 0 ; i <= n ; i ++ ) { if ( ( ( n - ( a * i ) ) / b ) >= 0 && ( n - ( a * i ) ) % b == 0 && ( i * a + ( ( ( n - ( a * i ) ) / b ) ) * b ) == n ) { System . out . println ( \" YES \" ) ; System . out . println ( i + \" ▁ \" + ( ( n - ( a * i ) ) / b ) ) ; return ; } } System . out . println ( \" NO \" ) ; }     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 nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }" ]
[ "n = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) )   for x in range ( n + 1 ) : if ( n - ( x * a ) ) % b == 0 and ( n - ( x * a ) ) // b >= 0 : print ( \" YES \" ) print ( x , ( n - ( x * a ) ) // b ) exit ( ) print ( \" NO \" )   NEW_LINE", "n = int ( input ( ) )   a = int ( input ( ) )   b = int ( input ( ) )   if n % 2 != 0 and a % 2 == 0 and b % 2 == 0 : print ( ' NO ' ) elif a == n or n % a == 0 : print ( ' YES ' ) print ( n // a , 0 , end = \" ▁ \" ) elif b == n or n % b == 0 : print ( ' YES ' ) print ( 0 , n // b , end = \" ▁ \" ) elif a == b : if n % a != 0 : print ( ' NO ' ) else : m = min ( n // a , n // b ) f = 0 for i in range ( 1 , m + 1 ) : if ( n - a * i ) % b == 0 : f = 1 print ( ' YES ' ) print ( i , ( n - a * i ) // b , end = ' ▁ ' ) break elif ( n - b * i ) % a == 0 : f = 1 print ( ' YES ' ) print ( ( n - b * i ) // a , i , end = ' ▁ ' ) break if f == 0 : print ( ' NO ' ) NEW_LINE", "n = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) ) import mathdef extgcd ( a , b ) : NEW_LINE", "import sys , os , iofrom sys import stdinfrom math import log , gcd , ceilfrom collections import defaultdict , deque , Counterfrom heapq import heappush , heappopfrom bisect import bisect_left , bisect_rightimport math     alphabets = list ( ' abcdefghijklmnopqrstuvwxyz ' )     def isPrime ( x ) : for i in range ( 2 , x ) : if i * i > x : break if ( x % i == 0 ) : return False return Truedef ncr ( n , r , p ) : num = den = 1 for i in range ( r ) : num = ( num * ( n - i ) ) % p den = ( den * ( i + 1 ) ) % p return ( num * pow ( den , p - 2 , p ) ) % pdef primeFactors ( n ) : l = [ ] while n % 2 == 0 : l . append ( 2 ) n = n / 2 for i in range ( 3 , int ( math . sqrt ( n ) ) + 1 , 2 ) : while n % i == 0 : l . append ( int ( i ) ) n = n / i if n > 2 : l . append ( n ) return list ( set ( l ) ) def power ( x , y , p ) : res = 1 x = x % p if ( x == 0 ) : return 0 while ( y > 0 ) : if ( ( y & 1 ) == 1 ) : res = ( res * x ) % p y = y >> 1 NEW_LINE" ]
codeforces_469_B
[ "import java . util . * ; public class Practice { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) , p = sc . nextInt ( ) , q = sc . nextInt ( ) ; int arr1 [ ] [ ] = new int [ n ] [ 2 ] ; int arr2 [ ] [ ] = new int [ m ] [ 2 ] ;   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { arr1 [ i ] [ j ] = sc . nextInt ( ) ; } }   for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { arr2 [ i ] [ j ] = sc . nextInt ( ) ; } }   int ans = 0 ;   for ( int k = p ; k <= q ; k ++ ) { z : for ( int i = 0 ; i < m ; i ++ ) { int aa = arr2 [ i ] [ 0 ] + k ; int bb = arr2 [ i ] [ 1 ] + k ; for ( int j = 0 ; j < n ; j ++ ) { if ( aa >= arr1 [ j ] [ 0 ] && bb <= arr1 [ j ] [ 1 ] || aa >= arr1 [ j ] [ 0 ] && aa <= arr1 [ j ] [ 1 ] || bb >= arr1 [ j ] [ 0 ] && bb <= arr1 [ j ] [ 1 ] || aa <= arr1 [ j ] [ 0 ] && bb >= arr1 [ j ] [ 1 ] ) { ans ++ ; break z ; } } } }   System . out . println ( ans ) ;   } }", "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 p = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int [ ] a = new int [ p ] ; int [ ] b = new int [ p ] ; int [ ] c = new int [ q ] ; int [ ] d = new int [ q ] ; for ( int i = 0 ; i < p ; i ++ ) { a [ i ] = sc . nextInt ( ) ; b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < q ; i ++ ) { c [ i ] = sc . nextInt ( ) ; d [ i ] = sc . nextInt ( ) ; } int count = 0 , strt , end ; boolean flag ; for ( int i = l ; i <= r ; i ++ ) { flag = false ; for ( int j = 0 ; j < q ; j ++ ) { strt = c [ j ] + i ; end = d [ j ] + i ; for ( int k = 0 ; k < p ; k ++ ) { if ( strt > b [ k ] || end < a [ k ] ) { continue ; } else { count ++ ; flag = true ; break ; } } if ( flag == true ) { break ; } } } System . out . println ( count ) ; } }", "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 p = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int [ ] a = new int [ p ] ; int [ ] b = new int [ p ] ; int [ ] c = new int [ q ] ; int [ ] d = new int [ q ] ; for ( int i = 0 ; i < p ; i ++ ) { a [ i ] = sc . nextInt ( ) ; b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < q ; i ++ ) { c [ i ] = sc . nextInt ( ) ; d [ i ] = sc . nextInt ( ) ; } int count = 0 , strt , end ; boolean flag ; for ( int i = l ; i <= r ; i ++ ) { flag = false ; for ( int j = 0 ; j < q ; j ++ ) { strt = c [ j ] + i ; end = d [ j ] + i ; for ( int k = 0 ; k < p ; k ++ ) { if ( strt > b [ k ] || end < a [ k ] ) { continue ; } else { count ++ ; flag = true ; break ; } } if ( flag == true ) { break ; } } } System . out . println ( count ) ; } }" ]
[ "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", "p , q , l , r = map ( int , input ( ) . split ( ) )   x = [ ] z = [ ] for i in range ( p ) : a , b = map ( int , input ( ) . split ( ) ) for i in range ( a , b + 1 ) : z . append ( i ) for i in range ( q ) : a , b = map ( int , input ( ) . split ( ) ) for i in range ( a , b + 1 ) : x . append ( i ) t = 0 for i in range ( l , r + 1 ) : for val in x : if val + i in z : t += 1 break     print ( t ) NEW_LINE", "def s ( a , b ) : return set ( range ( a , b + 1 ) )   p , q , l , r = map ( int , input ( ) . split ( ) )   fixed = set ( ) movable = set ( )   for i in range ( p ) : a , b = map ( int , input ( ) . split ( ) ) fixed = fixed . union ( s ( a , b ) )   for i in range ( q ) : a , b = map ( int , input ( ) . split ( ) ) movable = movable . union ( s ( a , b ) )   ans = 0   for i in range ( l , r + 1 ) : movable_new = set ( [ x + i for x in movable ] ) if movable_new . intersection ( fixed ) != set ( ) : ans += 1   print ( ans ) NEW_LINE", "x , z , t = set ( ) , set ( ) , 0 p , q , l , r = map ( int , input ( ) . split ( ) ) for i in range ( p ) : a , b = map ( int , input ( ) . split ( ) ) for i in range ( a , b + 1 ) : z . add ( i ) for j in range ( q ) : c , d = map ( int , input ( ) . split ( ) ) for i in range ( c , d + 1 ) : x . add ( i ) for i in range ( l , r + 1 ) : for j in x : if j + i in z : t += 1 breakprint ( t ) NEW_LINE" ]
codeforces_1065_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Test {", "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 VasyaChocolate1065A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int T = input . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { long s = input . nextLong ( ) ; long a = input . nextLong ( ) ; long b = input . nextLong ( ) ; long c = input . nextLong ( ) ;   long boughtChocolate = s / c ; long extraChoco = ( boughtChocolate / a ) * b ; System . out . println ( boughtChocolate + extraChoco ) ; }    } }", "import java . util . Scanner ;   public class problem40 {   public static void main ( String [ ] args ) {" ]
[ "def insertion_sort ( l ) : for i in range ( len ( l ) ) : for j in ( range ( i ) ) : k = i - j if l [ k ] >= l [ k - 1 ] : l [ k - 1 ] , l [ k ] = l [ k ] , l [ k - 1 ] else : break return l       def selection_sort ( l ) : for i in range ( len ( l ) ) : min_ind = i min_val = l [ i ] for j in range ( i , len ( l ) ) : if min_val > l [ j ] : min_val = l [ j ] min_ind = j l [ i ] , l [ min_ind ] = l [ min_ind ] , l [ i ] return l     def bubble_sort ( l ) : for i in range ( len ( l ) - 1 ) : for j in range ( len ( l ) - 1 - i ) : if l [ j ] > l [ j + 1 ] : l [ j ] , l [ j + 1 ] = l [ j + 1 ] , l [ j ] return l     NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : temp = [ int ( x ) for x in input ( ) . split ( ) ] s = temp [ 0 ] a = temp [ 1 ] b = temp [ 2 ] c = temp [ 3 ] print ( ( ( s // c ) // a ) * ( a + b ) + ( s // c ) % a ) NEW_LINE", "t = int ( input ( ) ) for i in range ( 0 , t ) : s , a , b , c = map ( int , input ( ) . split ( ) ) chocolates = 0 chocolates += s // c if s // c >= a : chocolates += ( chocolates // a ) * b print ( chocolates ) NEW_LINE", "import sys   def main ( ) : inp = sys . stdin . read ( ) . strip ( ) . split ( ' \\n ' ) out = [ ] for s in inp [ 1 : ] : s , a , b , c = map ( int , s . split ( ) ) out . append ( s // c + s // c // a * b ) return out print ( * main ( ) , sep = ' \\n ' ) NEW_LINE" ]
codeforces_152_B
[ "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 n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int x = sc . nextInt ( ) , y = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int r = Math . max ( n , m ) ; long count = 0 ; while ( k -- > 0 ) { int dx = sc . nextInt ( ) , dy = sc . nextInt ( ) ; int movx = Integer . MAX_VALUE ; int movy = Integer . MAX_VALUE ; if ( dx < 0 ) movx = ( 1 - x ) / dx ;   else if ( dx > 0 ) movx = ( n - x ) / dx ;   if ( dy < 0 ) movy = ( 1 - y ) / dy ;   else if ( dy > 0 ) movy = ( m - y ) / dy ;   int min = Math . min ( movx , movy ) ; count += min ; x += dx * min ; y += dy * min ; }   out . println ( count ) ; out . close ( ) ; } }   ", "import java . util . * ;   public class Main { public static class Pair { public long dx ; public long dy ;   public Pair ( int dx , int dy ) { this . dx = dx ; this . dy = dy ; }   @ Override public String toString ( ) { return dx + \" ▁ \" + dy ; } }   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long n = in . nextLong ( ) ; long m = in . nextLong ( ) ; long xc = in . nextLong ( ) ; long yc = in . nextLong ( ) ; long k = in . nextLong ( ) ; List < Pair > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < k ; i ++ ) { int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; Pair pair = new Pair ( x , y ) ; list . add ( pair ) ; } long ans = 0 ; for ( int i = 0 ; i < k ; i ++ ) { long dx = list . get ( i ) . dx ; long dy = list . get ( i ) . dy ;   long temp1 = Integer . MAX_VALUE ; long temp2 = Integer . MAX_VALUE ; long min ; if ( dx != 0 ) { if ( dx > 0 ) temp1 = ( n - xc ) / dx ; else temp1 = ( xc % dx == 0 ) ? ( xc / Math . abs ( dx ) ) - 1 : xc / Math . abs ( dx ) ; } if ( dy != 0 ) { if ( dy > 0 ) temp2 = ( m - yc ) / dy ; else temp2 = ( yc % Math . abs ( dy ) == 0 ) ? ( yc / Math . abs ( dy ) ) - 1 : yc / Math . abs ( dy ) ; } min = Math . min ( temp1 , temp2 ) ; ans += min ; xc += min * dx ; yc += min * dy ; } System . out . println ( ans ) ; in . close ( ) ;   } }        ", "import java . util . Scanner ;   public class B152 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int maxX = in . nextInt ( ) ; int maxY = in . nextInt ( ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; int K = in . nextInt ( ) ; long answer = 0 ; for ( int k = 0 ; k < K ; k ++ ) { int dx = in . nextInt ( ) ; int dy = in . nextInt ( ) ; int xSpace = dx > 0 ? ( maxX - x ) : ( x - 1 ) ; int ySpace = dy > 0 ? ( maxY - y ) : ( y - 1 ) ; int steps = Integer . MAX_VALUE ; if ( dx != 0 ) { steps = Math . min ( steps , xSpace / Math . abs ( dx ) ) ; } if ( dy != 0 ) { steps = Math . min ( steps , ySpace / Math . abs ( dy ) ) ; } x += steps * dx ; y += steps * dy ; answer += steps ; } System . out . println ( answer ) ; }   }" ]
[ "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", "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 \" ) )   def valid ( x , y ) : return 1 <= x <= n and 1 <= y <= m n , m = ints_input ( ) x , y = ints_input ( ) k = fast_input ( int ) ans = 0 for i in range ( k ) : c = 1100000000 dx , dy = ints_input ( ) while c > 0 : while valid ( x + c * dx , y + c * dy ) : x += c * dx y += c * dy ans += c c //= 2 print ( ans ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) x , y = map ( int , input ( ) . split ( ) ) k = int ( input ( ) ) ans = 0 for i in range ( k ) : x1 , y1 = map ( int , input ( ) . split ( ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) x , y = map ( int , input ( ) . split ( ) ) s = 0 for i in range ( int ( input ( ) ) ) : dx , dy = map ( int , input ( ) . split ( ) ) a , b = n , m if dy > 0 : a = ( m - y ) // dy elif dy < 0 : a = ( y - 1 ) // ( - dy ) if dx > 0 : b = ( n - x ) // dx elif dx < 0 : b = ( x - 1 ) // ( - dx ) d = min ( a , b ) x += d * dx y += d * dy s += dprint ( s ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) x , y = map ( int , input ( ) . split ( ) ) s = 0 for i in range ( int ( input ( ) ) ) : dx , dy = map ( int , input ( ) . split ( ) ) a , b = n , m if dy > 0 : a = ( m - y ) // dy elif dy < 0 : a = ( y - 1 ) // ( - dy ) if dx > 0 : b = ( n - x ) // dx elif dx < 0 : b = ( x - 1 ) // ( - dx ) d = min ( a , b ) x += d * dx y += d * dy s += dprint ( s ) NEW_LINE" ]
codeforces_377_B
[ "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   int numStudents ; int numBugs ; long budget ;   int [ ] [ ] bug ; int [ ] [ ] student ;   void run ( FastScanner in , PrintWriter out ) {   numStudents = in . nextInt ( ) ; numBugs = in . nextInt ( ) ; budget = in . nextLong ( ) ;   bug = new int [ numBugs ] [ 2 ] ; student = new int [ numStudents ] [ 3 ] ;   for ( int i = 0 ; i < numBugs ; i ++ ) { bug [ i ] [ 0 ] = in . nextInt ( ) ; bug [ i ] [ 1 ] = i ; }   for ( int i = 0 ; i < numStudents ; i ++ ) { student [ i ] [ 0 ] = in . nextInt ( ) ; student [ i ] [ 2 ] = i ; } for ( int i = 0 ; i < numStudents ; i ++ ) student [ i ] [ 1 ] = in . nextInt ( ) ;   Arrays . sort ( bug , ( a , b ) -> a [ 0 ] - b [ 0 ] ) ; Arrays . sort ( student , ( a , b ) -> a [ 0 ] - b [ 0 ] ) ;  ", "import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException , InterruptedException { Scanner sc = new Scanner ( System . in ) ;", "import java . util . * ; import java . util . PrimitiveIterator . OfDouble ; import java . util . concurrent . CountDownLatch ; import java . util . zip . ZipEntry ;   import javax . jws . Oneway ; import javax . swing . plaf . basic . BasicScrollPaneUI . HSBChangeListener ;   import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws Exception { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; HashMap < Integer , Integer > hs = new HashMap < Integer , Integer > ( ) ; pair [ ] bugs = new pair [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { bugs [ i ] = new pair ( sc . nextInt ( ) , i ) ; } Arrays . sort ( bugs ) ; tuble [ ] students = new tuble [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { students [ i ] = new tuble ( 0 , 0 , i + 1 ) ; students [ i ] . x = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { students [ i ] . y = sc . nextInt ( ) ; } Arrays . sort ( students ) ; int start = - 1 ; int end = 1000007000 ; int mid = ( start + end ) / 2 ;", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . PriorityQueue ; import java . util . Set ; import java . util . Stack ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; import java . util . function . Function ; import java . util . stream . Collectors ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;    public class Solution {   public static int INF = Integer . MAX_VALUE ; public static long MOD = 1000000000 + 7L ;   public static int WHITE = 0 ; public static int GRAY = 1 ; public static int BLACK = 2 ;   public static int rr [ ] = { 0 , - 1 , 0 , 1 } ; public static int cc [ ] = { - 1 , 0 , 1 , 0 } ;    static class Student { public int index ; public int cost ; public int ability ; public int count = 0 ;   Student ( int i , int c , int a ) { index = i ; cost = c ; ability = a ; } Student ( int i , int c , int a , int cc ) { index = i ; cost = c ; ability = a ; count = cc ; }   public int getCost ( ) { return cost ; } public int getAbility ( ) { return ability ; } } static class Bug { int index ; int complexity ; Bug ( int i , int c ) { index = i ; complexity = c ; } public int getComplexity ( ) { return complexity ; } }   static class Solver { public int [ ] can ( long s , List < Bug > bugs , List < Student > students , int k ) { long taken = 0 ;" ]
[ "from sys import stdinimport heapq   n , m , s = [ int ( x ) for x in stdin . readline ( ) . split ( ) ]   bugs = [ int ( x ) for x in stdin . readline ( ) . split ( ) ] bugs = sorted ( [ ( bugs [ x ] , x ) for x in range ( m ) ] )   order = [ x [ 1 ] for x in bugs ] bugs = [ x [ 0 ] for x in bugs ]   students = [ int ( x ) for x in stdin . readline ( ) . split ( ) ] rate = [ int ( x ) for x in stdin . readline ( ) . split ( ) ]   valid = Falsefor x in range ( n ) : if students [ x ] >= bugs [ - 1 ] and rate [ x ] <= s : valid = Trueif not valid : print ( ' NO ' ) else : print ( ' YES ' ) NEW_LINE" ]
codeforces_846_B
[ "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   int N , K ; long T ; long [ ] a ; void run ( FastScanner in , PrintWriter out ) { N = in . nextInt ( ) ; K = in . nextInt ( ) ; T = in . nextLong ( ) ; a = new long [ K ] ;   long tot = 0 ; for ( int i = 0 ; i < K ; i ++ ) { a [ i ] = in . nextLong ( ) ; tot += a [ i ] ; } Arrays . sort ( a ) ;  ", "import java . util . * ; import java . io . * ; import java . math . * ;   public class x846B { public static void main ( String omkar [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; int K = Integer . parseInt ( st . nextToken ( ) ) ; int M = Integer . parseInt ( st . nextToken ( ) ) ; int [ ] arr = new int [ K ] ; st = new StringTokenizer ( infile . readLine ( ) ) ; for ( int i = 0 ; i < K ; i ++ ) arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; Arrays . sort ( arr ) ; int res = 0 ; for ( int complete = 0 ; complete <= N ; complete ++ ) { long sum = 0L ; for ( int x : arr ) sum += x ; sum *= complete ; if ( sum > M ) break ; int temp = complete * ( K + 1 ) ;", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   int N , K ; long T ; long [ ] a ; long tot ; void run ( FastScanner in , PrintWriter out ) { N = in . nextInt ( ) ; K = in . nextInt ( ) ; T = in . nextLong ( ) ; a = new long [ K ] ;   tot = 0 ; for ( int i = 0 ; i < K ; i ++ ) { a [ i ] = in . nextLong ( ) ; tot += a [ i ] ; } Arrays . sort ( a ) ;  " ]
[ "def solve ( n , k , M , t ) : task_sum = sum ( t ) t = sorted ( t ) NEW_LINE", "import sys   n , k , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) total = sum ( a )   if n * total <= m : print ( n * ( k + 1 ) ) exit ( )   ans = 0   for complete in range ( n ) : if complete * total > m : break   items = a * ( n - complete ) dp = [ - 1 ] * ( len ( items ) + 1 ) dp [ 0 ] = m - complete * total   for x in items : for i in range ( len ( items ) - 1 , - 1 , - 1 ) : dp [ i + 1 ] = max ( dp [ i + 1 ] , dp [ i ] - x )   for i in range ( len ( items ) , - 1 , - 1 ) : if dp [ i ] >= 0 : ans = max ( ans , i + complete * ( k + 1 ) ) break   print ( ans ) NEW_LINE", "n , k , m = map ( int , input ( ) . split ( ) ) t = sorted ( map ( int , input ( ) . split ( ) ) , key = int ) s = sum ( t ) ans = 0   for i in range ( n + 1 ) : curr_ans = i * ( k + 1 ) tot = m - i * s if tot < 0 : break   for x in t : c = min ( n - i , tot // x ) if not c : break tot -= c * x curr_ans += c   ans = max ( ans , curr_ans )   print ( ans ) NEW_LINE", "def solve ( n , k , M , t ) : task_sum = sum ( t ) t = sorted ( t ) NEW_LINE", "def solve ( n , k , M , t ) : task_sum = sum ( t ) t = sorted ( t ) NEW_LINE" ]
codeforces_858_B
[ "import java . util . Scanner ;   public class Main { public static boolean judge ( int k , int arr [ ] [ ] , int m ) { for ( int i = 0 ; i < m ; i ++ ) { int t = arr [ i ] [ 0 ] % k ; if ( t == 0 ) { if ( arr [ i ] [ 0 ] / k != arr [ i ] [ 1 ] ) { return false ; } } else { if ( arr [ i ] [ 0 ] / k + 1 != arr [ i ] [ 1 ] ) { return false ; } } } return true ; } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s [ ] = scanner . nextLine ( ) . split ( \" ▁ \" ) ; int n = Integer . parseInt ( s [ 0 ] ) ; int m = Integer . parseInt ( s [ 1 ] ) ; int arr [ ] [ ] = new int [ m ] [ 2 ] ; for ( int i = 0 ; i < m ; i ++ ) { s = scanner . nextLine ( ) . split ( \" ▁ \" ) ; arr [ i ] [ 0 ] = Integer . parseInt ( s [ 0 ] ) ; arr [ i ] [ 1 ] = Integer . parseInt ( s [ 1 ] ) ; } int res = 0 ; for ( int i = 1 ; i <= 100 ; i ++ ) { if ( judge ( i , arr , m ) ) { int temp = n % i == 0 ? n / i : n / i + 1 ; if ( res == 0 ) { res = temp ; } else if ( temp != res ) { System . out . println ( - 1 ) ; return ; } } } if ( res == 0 ) res = - 1 ; System . out . println ( res ) ; }   }  ", "import java . util . Scanner ; import java . util . * ;   public class Solution {   public static void main ( String [ ] args ) { boolean debug = false ;   Scanner input = new Scanner ( System . in ) ;   int n = input . nextInt ( ) ; int m = input . nextInt ( ) ;   FlatToFloor [ ] flats = new FlatToFloor [ m + 1 ] ;   for ( int i = 1 ; i <= m ; i ++ ) { flats [ i ] = new FlatToFloor ( input . nextInt ( ) , input . nextInt ( ) ) ; }   int ans = - 1 ; int cf = - 1 ; int cf2 = - 1 ; int countOkay = 0 ; for ( int j = 1 ; j <= 100 ; j ++ ) { boolean ok = true ; for ( int i = 1 ; i <= m ; i ++ ) {", "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . TreeSet ;    public class vk18 { public static void main ( String [ ] stp ) throws Exception { Scanner scan = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) , m = Integer . parseInt ( st . nextToken ( ) ) , i , j , flat = 0 , floor = 0 ; Pair [ ] pair = new Pair [ m ] ; TreeSet < Integer > ts = new TreeSet < > ( ) ; for ( i = 0 ; i < m ; i ++ ) { st = new StringTokenizer ( br . readLine ( ) ) ; pair [ i ] = new Pair ( Integer . parseInt ( st . nextToken ( ) ) , Integer . parseInt ( st . nextToken ( ) ) ) ; } for ( i = 1 ; i <= 100 ; i ++ ) { boolean flag = true ; for ( j = 0 ; j < m ; j ++ ) { floor = ( pair [ j ] . d + i - 1 ) / i ; if ( floor != pair [ j ] . g ) { flag = false ; break ; } } if ( flag ) { ts . add ( ( int ) ( ( n + i - 1 ) / i ) ) ; if ( ts . size ( ) > 1 ) { pw . println ( - 1 ) ; pw . flush ( ) ; System . exit ( 0 ) ; } } } pw . println ( ts . pollFirst ( ) ) ; pw . flush ( ) ; } static class Pair implements Comparable < Pair > { int d , g ; public Pair ( int d , int g ) { this . d = d ; this . g = g ; } public int compareTo ( Pair p ) { return - Integer . compare ( this . d , p . d ) ; } }    }" ]
[ "t = 1   for qwe in range ( t ) : NEW_LINE", "n , m = [ int ( i ) for i in input ( ) . split ( ) ] a = [ ] for i in range ( m ) : k , l = [ int ( i ) for i in input ( ) . split ( ) ] a . append ( [ k , l ] ) b = set ( ) for x in range ( 1 , 105 ) : for i in range ( len ( a ) ) : q = ( a [ i ] [ 1 ] - 1 ) * x + 1 e = a [ i ] [ 1 ] * x if a [ i ] [ 0 ] < q or a [ i ] [ 0 ] > e : break else : b . add ( ( n + x - 1 ) // x ) if len ( b ) > 1 : print ( - 1 ) else : print ( * b ) NEW_LINE" ]
codeforces_1315_B
[ "import java . util . * ; import java . io . * ; import java . math . * ;     public class B {   private static long INF = 2000000000000000000L , M = 1000000007 , MM = 998244353 ; private static int N = 0 ;   public static void process ( ) throws IOException {   int a = sc . nextInt ( ) , b = sc . nextInt ( ) , curr = sc . nextInt ( ) ; String str = sc . next ( ) ; int i = str . length ( ) - 2 ; Deque < Integer > q = new LinkedList < Integer > ( ) ; while ( i >= 0 ) { if ( q . isEmpty ( ) ) { int cc = str . charAt ( i ) - ' A ' ; if ( cc == 0 ) { if ( curr >= a ) { q . add ( cc ) ; i -- ; curr -= a ; } else { break ; } } else { if ( curr >= b ) { q . add ( cc ) ; curr -= b ; i -- ; } else break ; } continue ; } int prev = q . peekLast ( ) ; int cc = str . charAt ( i ) - ' A ' ; if ( prev == cc ) { i -- ; continue ; } if ( cc == 0 ) { if ( curr >= a ) { q . add ( cc ) ; i -- ; curr -= a ; } else { break ; } } else { if ( curr >= b ) { q . add ( cc ) ; curr -= b ; i -- ; } else break ; } } if ( i == - 1 ) System . out . println ( 1 ) ; else { System . out . println ( i + 2 ) ; }   }  ", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;", "import java . util . * ; import java . io . * ; import java . math . * ;   public class First { public static void process ( ) throws IOException { int a = ni ( ) ; int b = ni ( ) ; int p = ni ( ) ; String s = nln ( ) ; char ch [ ] = s . toCharArray ( ) ; int n = ch . length ; int index = n - 1 ; int cost = 0 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( i == 0 ) { int x = ( ch [ i ] == ' A ' ) ? a : b ; if ( cost + x <= p ) { index = i ; } } else { int x = ( ch [ i ] == ' A ' ) ? a : b ; if ( ch [ i ] == ch [ i - 1 ] ) { continue ; } else { if ( cost + x > p ) { break ; } else if ( cost + x <= p ) { index = i ; cost += x ; } } } } pn ( index + 1 ) ;   }    static AnotherReader sc ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( System . out ) ; sc = new AnotherReader ( ) ; boolean oj = true ;  " ]
[ "for _ in range ( int ( input ( ) ) ) : a , b , c = map ( int , input ( ) . split ( ) ) s = input ( )   n = len ( s ) j = n for i in range ( n - 2 , - 1 , - 1 ) : if s [ i ] != s [ i + 1 ] or i == n - 2 : if s [ i ] == \" A \" : c -= a else : c -= b if c >= 0 : j -= 1 else : break print ( j ) NEW_LINE", "import sys , collections , math , itertools , random , bisectINF = sys . maxsizedef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_array ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def input ( ) : return sys . stdin . readline ( ) . strip ( ) mod = int ( 1e9 + 7 )   for _ in range ( int ( input ( ) ) ) : a , b , p = get_ints ( ) s = input ( ) sz = len ( s ) sum = 0 while sum <= p and sz > 0 : sz -= 1 if sz == len ( s ) - 1 or s [ sz - 1 ] != s [ sz ] : if s [ sz - 1 ] == ' A ' : sum += a else : sum += b print ( sz + 1 ) NEW_LINE", "for t in range ( int ( input ( ) ) ) : a , b , p = map ( int , input ( ) . split ( ) ) s = list ( input ( ) ) n = len ( s ) if ( p < a and p < b ) : print ( n ) continue dp = [ 0 ] * n st = [ ] exc = 0 loc = [ ] for i in range ( n ) : if ( i == 0 ) : if ( s [ i ] == ' A ' ) : dp [ 0 ] = a else : dp [ 0 ] = b st . append ( s [ i ] ) elif ( st [ - 1 ] == s [ i ] ) : dp [ i ] = dp [ i - 1 ] + exc exc = 0 else : loc . append ( i ) st . pop ( 0 ) st . append ( s [ i ] ) dp [ i ] = dp [ i - 1 ] + exc if ( st [ 0 ] == ' A ' ) : exc = a else : exc = b if ( dp [ - 1 ] <= p ) : print ( 1 ) continue for j in loc : if ( dp [ - 1 ] - dp [ j ] <= p ) : print ( j + 1 ) break else : print ( n ) NEW_LINE", "I = inputfor _ in [ 0 ] * int ( I ( ) ) : * a , p = map ( int , I ( ) . split ( ) ) ; s = I ( ) ; i = len ( s ) - 2 ; j = s [ i ] > ' A ' while - i < 1 > a [ j ] - p : p -= a [ j ] ; j ^= 1 ; i = s . rfind ( ' AB ' [ j ] , 0 , i ) print ( i + 2 ) NEW_LINE", "from sys import stdin , stdoutnmbr = lambda : int ( input ( ) ) lst = lambda : list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( nmbr ( ) ) : a , b , cc = lst ( ) s = input ( ) n = len ( s ) dp = [ 0 ] * n dp [ n - 2 ] = b if s [ n - 2 ] == ' B ' else a for i in range ( n - 3 , - 1 , - 1 ) : dp [ i ] = dp [ i + 1 ] if s [ i ] != s [ i + 1 ] : if s [ i ] == ' A ' : dp [ i ] += a else : dp [ i ] += b ans = n for i in range ( n ) : if dp [ i ] <= cc : ans = i + 1 break print ( ans ) NEW_LINE" ]
codeforces_1334_A
[ "import java . io . BufferedReader ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStreamReader ; import java . nio . file . Paths ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Main1 {   public Main1 ( ) throws FileNotFoundException {  ", "import java . awt . Desktop ;    import java . io . BufferedReader ;    import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . net . URI ; import java . net . URISyntaxException ; import java . sql . Array ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . LinkedHashMap ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . util . StringTokenizer ; import java . util . TreeSet ; import java . util . Vector ;     public class codechef3 { static class comp implements Comparator < Integer > {   @ Override public int compare ( Integer o1 , Integer o2 ) { if ( Math . abs ( o1 ) > Math . abs ( o2 ) ) return - 1 ; else return 1 ; } }", "import java . io . * ; import java . util . * ; public class levelstatistics { public static void main ( String [ ] args ) throws IOException { BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( f . readLine ( ) ) ; int t = Integer . parseInt ( st . nextToken ( ) ) ; while ( t > 0 ) { t -- ; int n = Integer . parseInt ( f . readLine ( ) ) ; int plays = 0 ; int clears = 0 ; boolean yes = true ; for ( int i = 0 ; i < n ; i ++ ) { st = new StringTokenizer ( f . readLine ( ) ) ; int nextPlays = Integer . parseInt ( st . nextToken ( ) ) ; int nextClears = Integer . parseInt ( st . nextToken ( ) ) ; if ( nextPlays - plays < nextClears - clears ) { yes = false ; } if ( nextPlays < plays || nextClears < clears ) { yes = false ; } plays = nextPlays ; clears = nextClears ; } if ( yes ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } } }" ]
[ "t = int ( input ( ) ) r = [ ] for i in range ( t ) : b = [ ] d = [ ] n = int ( input ( ) ) for j in range ( n ) : a = list ( map ( int , input ( ) . split ( ) ) ) b . append ( a [ 0 ] ) d . append ( a [ 1 ] ) if b [ 0 ] < d [ 0 ] : r . append ( \" NO \" ) else : p = [ x - b [ i - 1 ] for i , x in enumerate ( b ) if i > 0 ] c = [ x - d [ i - 1 ] for i , x in enumerate ( d ) if i > 0 ] s1 = sum ( 1 for number in p if number < 0 ) s2 = sum ( 1 for number in c if number < 0 ) if s1 != 0 or s2 != 0 : r . append ( \" NO \" ) else : q = 0 for j in range ( n - 1 ) : if p [ j ] != c [ j ] : if p [ j ] < c [ j ] : q = q + 1 if q != 0 : r . append ( \" NO \" ) else : r . append ( \" YES \" ) for i in range ( len ( r ) ) : print ( r [ i ] ) NEW_LINE", "for i in range ( int ( input ( ) ) ) : count = 0 for j in range ( int ( input ( ) ) ) : play , clear = map ( int , input ( ) . split ( ) ) if ( clear > play ) : play1 = play clear1 = clear count = 1 continue if ( j == 0 ) : play1 = play clear1 = clear continue else : if ( play < play1 ) : count = 1 play1 = play clear1 = clear continue elif ( clear < clear1 ) : count = 1 play1 = play clear1 = clear continue elif ( ( play - play1 ) < ( clear - clear1 ) ) : count = 1 play1 = play clear1 = clear continue else : play1 = play clear1 = clear if ( count == 1 ) : print ( \" No \" ) else : print ( \" Yes \" ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) p0 , c0 = 0 , 0 res = True for i in range ( 100 ) : h = p0 + c0 for i in range ( n ) : p , c = map ( int , input ( ) . split ( ) ) ap , ac , p0 , c0 = p - p0 , c - c0 , p , c res = res and ap >= ac and ac >= 0 and ap >= 0 print ( \" YES \" if res else \" NO \" ) NEW_LINE", "t = int ( input ( ) ) for j in range ( t ) : n = int ( input ( ) ) kol = [ ] f , g = map ( int , input ( ) . split ( ) ) kol . append ( [ f , g ] ) flag = 0 if g > f : print ( ' NO ' ) flag = 1 for i in range ( n - 1 ) : p , c = map ( int , input ( ) . split ( ) ) kol . append ( [ p , c ] )   if ( c > p or kol [ i ] [ 0 ] > p or kol [ i ] [ 1 ] > c or p - kol [ i ] [ 0 ] < c - kol [ i ] [ 1 ] ) and flag == 0 : print ( ' NO ' ) flag = 1 if flag == 0 : print ( ' YES ' ) NEW_LINE", "I = inputfor _ in [ 0 ] * int ( I ( ) ) : x = y = 0 ; f = 1 for _ in [ 0 ] * int ( I ( ) ) : p , c = map ( int , I ( ) . split ( ) ) ; f &= 0 <= c - y <= p - x ; x = p ; y = c print ( ' NYOE ▁ S ' [ f : : 2 ] ) NEW_LINE" ]
codeforces_122_B
[ "import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {", "import java . util . Scanner ;   public class LuckySubstring { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; int a4 = 0 , a7 = 0 , i ; in . close ( ) ;   for ( i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '4' ) a4 ++ ; if ( s . charAt ( i ) == '7' ) a7 ++ ; } System . out . println ( a4 + a7 > 0 ? a4 >= a7 ? 4 : 7 : - 1 ) ; } }", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; int c4 = 0 , c7 = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '4' ) c4 ++ ; else if ( s . charAt ( i ) == '7' ) c7 ++ ; } if ( c4 == 0 && c7 == 0 ) System . out . println ( \" - 1\" ) ; else if ( c7 > c4 ) System . out . println ( \"7\" ) ; else System . out . println ( \"4\" ) ; } }", "import java . util . * ;   public class LuckySubstring_B {   public static void main ( String [ ] args ) {" ]
[ "s = input ( ) x1 , y1 = s . count ( \"7\" ) , s . count ( \"4\" ) if x1 == 0 and y1 == 0 : print ( \" - 1\" )   elif x1 > y1 : print ( \"7\" ) else : print ( \"4\" ) NEW_LINE", "a = input ( ) count4 = 0 count7 = 0 for i in a : if i == '4' : count4 += 1 if i == '7' : count7 += 1   if count4 == 0 and count7 == 0 : print ( - 1 ) else : if count4 >= count7 : print ( 4 ) else : print ( 7 ) NEW_LINE", "n = ( input ( ) ) a = b = 0 a = n . count ( '4' ) b = n . count ( '7' ) if a == 0 and b == 0 : print ( - 1 ) elif a == b : print ( 4 ) elif a == 0 and b == 0 : print ( - 1 ) else : if a > b : print ( 4 ) else : print ( 7 ) NEW_LINE", "s = input ( ) s4 = s . count ( '4' ) s7 = s . count ( '7' ) if s4 == 0 and s7 == 0 : print ( ' - 1' ) elif s4 < s7 : print ( '7' ) elif s4 > s7 : print ( '4' ) else : print ( '4' ) NEW_LINE", "s = input ( )   if '4' not in s and '7' not in s : print ( - 1 ) else : if s . count ( '4' ) >= s . count ( '7' ) : print ( 4 ) else : print ( 7 ) NEW_LINE" ]
codeforces_1453_A
[ "  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 l = sc . nextInt ( ) , c = sc . nextInt ( ) ; int al [ ] = new int [ l ] ; for ( int i = 0 ; i < l ; i ++ ) al [ i ] = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < c ; i ++ ) { int x = sc . nextInt ( ) ; if ( Arrays . binarySearch ( al , x ) >= 0 ) count ++ ; } System . out . println ( count ) ; }", "import java . io . * ; import java . util . * ;   public class A {   public static void main ( String [ ] args ) throws FileNotFoundException { FastScanner fs = new FastScanner ( ) ; FastOutput fo = new FastOutput ( ) ; long initial_time = System . currentTimeMillis ( ) ; int testcases = fs . nextInt ( ) ; for ( int tt = 0 ; tt < testcases ; tt ++ ) {", "  import java . util . * ; import java . math . * ;   public class gfg { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int z = 1 ; z <= t ; z ++ ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] b = new int [ n ] ; int [ ] l = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) b [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < m ; i ++ ) l [ i ] = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( Arrays . binarySearch ( l , b [ i ] ) >= 0 ) count ++ ; } System . out . println ( count ) ; } } }", "import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ;   public class A1453 {   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 ( ) ; int M = in . nextInt ( ) ; Set < Integer > set = new HashSet < > ( ) ; for ( int n = 0 ; n < N ; n ++ ) { int train = in . nextInt ( ) ; set . add ( train ) ; } int answer = 0 ; for ( int m = 0 ; m < M ; m ++ ) { int train = in . nextInt ( ) ; if ( set . contains ( train ) ) { answer ++ ; } } System . out . println ( answer ) ; } }   }", "import java . util . * ; public class Main {   public static void main ( String [ ] args ) { int t , n , m , ans ;   Scanner sc = new Scanner ( System . in ) ;   t = sc . nextInt ( ) ;   while ( t -- > 0 ) { n = sc . nextInt ( ) ; m = sc . nextInt ( ) ;   int a [ ] = new int [ n ] ; int b [ ] = new int [ m ] ;   ans = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; }   for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = sc . nextInt ( ) ; }   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( a [ i ] == b [ j ] ) { ans ++ ; } } } System . out . println ( ans ) ; }" ]
[ "for _ in range ( int ( input ( ) ) ) : map ( int , input ( ) . split ( ) ) NEW_LINE print ( len ( set ( map ( int , input ( ) . split ( ) ) ) . intersection ( set ( map ( int , input ( ) . split ( ) ) ) ) ) ) NEW_LINE", "t = int ( input ( ) )   for tc in range ( t ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE bottom = [ int ( b ) for b in input ( ) . split ( ) ] NEW_LINE left = [ int ( l ) for l in input ( ) . split ( ) ]   print ( len ( bottom + left ) - len ( set ( bottom + left ) ) )   NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE x = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l = set ( l ) NEW_LINE x = set ( x ) NEW_LINE z = l | x NEW_LINE print ( abs ( len ( z ) - ( n + m ) ) ) NEW_LINE", "for i in range ( int ( input ( ) ) ) : input ( ) NEW_LINE n , m , count = input ( ) . split ( \" ▁ \" ) , input ( ) . split ( \" ▁ \" ) , 0 NEW_LINE if len ( n ) >= len ( m ) : for NEW_LINE i in m : NEW_LINE if i in n : NEW_LINE INDENT count += 1 else : NEW_LINE for NEW_LINE DEDENT i in n : NEW_LINE if i in m : count += 1 NEW_LINE print ( count ) NEW_LINE" ]
codeforces_815_A
[ "import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException {" ]
[ "n , m = map ( int , input ( ) . split ( ) ) grid = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] ans = [ ] if m > n : for i in range ( n ) : mini = min ( grid [ i ] ) for j in range ( m ) : grid [ i ] [ j ] -= mini for _ in range ( mini ) : ans . append ( \" row ▁ \" + str ( i + 1 ) ) for i in range ( m ) : mini = float ( ' inf ' ) for j in range ( n ) : mini = min ( grid [ j ] [ i ] , mini ) for j in range ( n ) : grid [ j ] [ i ] -= mini for _ in range ( mini ) : ans . append ( \" col ▁ \" + str ( i + 1 ) ) else : for i in range ( m ) : mini = float ( ' inf ' ) for j in range ( n ) : mini = min ( grid [ j ] [ i ] , mini ) for j in range ( n ) : grid [ j ] [ i ] -= mini for _ in range ( mini ) : ans . append ( \" col ▁ \" + str ( i + 1 ) ) for i in range ( n ) : mini = min ( grid [ i ] ) for j in range ( m ) : grid [ i ] [ j ] -= mini for _ in range ( mini ) : ans . append ( \" row ▁ \" + str ( i + 1 ) ) if all ( [ sum ( i ) == 0 for i in grid ] ) : print ( len ( ans ) ) for i in ans : print ( i ) else : print ( - 1 ) NEW_LINE" ]
codeforces_1017_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 . util . * ;   public class CodeForces1017B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; String a = input . next ( ) ; String b = input . next ( ) ; int [ ] sum = new int [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { sum [ a . charAt ( i ) - '0' ] ++ ; }   long count = 0 ; long one = 0 ; long zero = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( b . charAt ( i ) == '0' ) { if ( a . charAt ( i ) == '0' ) { count += sum [ 1 ] - one ; zero ++ ; } else { count += sum [ 0 ] - zero ; one ++ ; } } } System . out . println ( count ) ;   } }", "import java . math . * ; import java . util . * ; import java . lang . * ; import java . io . * ;       public class CodeChef {    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 ( ) ) ; long a1 = 0 , a0 = 0 , b1 = 0 , b0 = 0 ; String sr = br . readLine ( ) ; String ss = br . readLine ( ) ; long count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( sr . charAt ( i ) == '1' ) { a1 ++ ; if ( ss . charAt ( i ) == '1' ) b1 ++ ; } if ( sr . charAt ( i ) == '0' ) { a0 ++ ; if ( ss . charAt ( i ) == '0' ) b0 ++ ; }   } count += a1 * b0 ; count += ( a1 - b1 ) * ( a0 - b0 ) ; System . out . println ( count ) ;   }   }", "  import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Scanner ;   public class B {   public static void main ( String [ ] srgs ) { Scanner nik = new Scanner ( System . in ) ;   int n = nik . nextInt ( ) ; HashMap < String , Long > ht = new HashMap < > ( ) ;   String s = nik . next ( ) ; String s1 = nik . next ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { String temp = s . charAt ( i ) + \" $ \" + s1 . charAt ( i ) ; ht . put ( temp , ht . getOrDefault ( temp , 0L ) + 1 ) ; }   long res = 0 ; for ( String val : ht . keySet ( ) ) {   long g = ht . get ( val ) ; if ( val . endsWith ( \"0 $ 0\" ) ) {   long g1 = ht . getOrDefault ( \"1 $ 0\" , 0L ) ; long g2 = ht . getOrDefault ( \"1 $ 1\" , 0L ) ; res += ( g1 * g ) ; res += ( g2 * g ) ; }   if ( val . endsWith ( \"0 $ 1\" ) ) { long g1 = ht . getOrDefault ( \"1 $ 0\" , 0L ) ; res += ( g1 * g ) ; } } System . out . println ( res ) ; } }", "import java . util . Scanner ;   public class TheBits { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i ; String a = in . next ( ) , b = in . next ( ) ; in . close ( ) ; long z = 0 , oz = 0 , oo = 0 , zz = 0 ; for ( i = 0 ; i < n ; i ++ ) {   if ( a . charAt ( i ) == '0' ) z ++ ; if ( a . charAt ( i ) == '1' && b . charAt ( i ) == '0' ) oz ++ ; if ( a . charAt ( i ) == '1' && b . charAt ( i ) == '1' ) oo ++ ; if ( a . charAt ( i ) == '0' && b . charAt ( i ) == '0' ) zz ++ ; } System . out . println ( oo * zz + oz * z ) ; } }" ]
[ "import sys   inp = sys . stdin . readlines ( ) ; ii = 0   out = [ ]   t = int ( inp [ ii ] ) ii += 1   a = inp [ ii ] ii += 1 b = inp [ ii ] ii += 1   x , y = 0 , 0 for i in range ( t ) : if ( a [ i ] == '1' and b [ i ] == '0' ) : y += 1 if ( a [ i ] == '0' and b [ i ] == '0' ) : x += 1   sys . stdout . write ( str ( ( x * a . count ( '1' ) + ( a . count ( '0' ) - x ) * y ) ) )               NEW_LINE", "n = int ( input ( ) ) s1 = input ( ) s2 = input ( ) t00 , t10 , t11 , t01 = 0 , 0 , 0 , 0 for i in range ( n ) : if s1 [ i ] == '0' and s1 [ i ] == s2 [ i ] : t00 += 1 elif s1 [ i ] == '1' and s2 [ i ] == '0' : t10 += 1 elif s1 [ i ] == '1' and s2 [ i ] == '1' : t11 += 1 elif s1 [ i ] == '0' and s2 [ i ] == '1' : t01 += 1 ans = t00 * t10 + t00 * t11 + t01 * t10print ( ans ) NEW_LINE", "n = int ( input ( ) ) a = input ( ) b = input ( ) x = 0 y = 0 z = 0 for i in range ( n ) : if ( b [ i ] == '0' ) : if ( a [ i ] == '1' ) : x += 1 else : y += 1 else : if ( a [ i ] == '1' ) : z += 1 print ( y * z + x * a . count ( '0' ) ) NEW_LINE", "n = int ( input ( ) ) s = input ( ) r = input ( ) l = 0 z = 0 for i in range ( len ( s ) ) : if ( s [ i ] == '1' and r [ i ] == '0' ) : l += 1 if ( s [ i ] == '0' and r [ i ] == '0' ) : z += 1 print ( z * s . count ( '1' ) + ( s . count ( '0' ) - z ) * l ) NEW_LINE", "from sys import stdin , stdoutimport math , bisectfrom collections import Counter , deque , defaultdictL = lambda : list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) M = lambda : map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) I = lambda : int ( stdin . readline ( ) . strip ( ) ) S = lambda : stdin . readline ( ) . strip ( ) C = lambda : stdin . readline ( ) . strip ( ) . split ( ) def pr ( a ) : return ( \" ▁ \" . join ( list ( map ( str , a ) ) ) ) NEW_LINE" ]
codeforces_1494_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Stack ;   public class ABCString_1494A { public static boolean isBalanced ( StringBuilder sb ) { Stack < Character > stk = new Stack < > ( ) ; stk . add ( sb . charAt ( 0 ) ) ; for ( int i = 1 ; i < sb . length ( ) ; i ++ ) {   char c = sb . charAt ( i ) ; if ( c == ' ) ' ) { if ( ! stk . empty ( ) && stk . lastElement ( ) == ' ( ' ) { stk . pop ( ) ; continue ; } } stk . add ( c ) ; } return stk . empty ( ) ; }   public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { String a = br . readLine ( ) ; final int len = a . length ( ) ; if ( a . charAt ( 0 ) == a . charAt ( len - 1 ) ) System . out . println ( \" NO \" ) ; else { char start = a . charAt ( 0 ) ; char end = a . charAt ( len - 1 ) ; StringBuilder sb1 = new StringBuilder ( ) ; StringBuilder sb2 = new StringBuilder ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = a . charAt ( i ) ; if ( c == start ) { sb1 . append ( ' ( ' ) ; sb2 . append ( ' ( ' ) ; } else if ( c == end ) { sb1 . append ( ' ) ' ) ; sb2 . append ( ' ) ' ) ; } else { sb1 . append ( ' ( ' ) ; sb2 . append ( ' ) ' ) ; } } if ( isBalanced ( sb1 ) || isBalanced ( sb2 ) ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } } }", "import java . util . Scanner ;   public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = Integer . parseInt ( sc . nextLine ( ) ) ; for ( ; t > 0 ; t -- ) { String a = sc . nextLine ( ) ; int n = a . length ( ) ; if ( a . charAt ( 0 ) == a . charAt ( n - 1 ) ) { System . out . println ( \" NO \" ) ; continue ; } int [ ] countChars = new int [ 3 ] ; for ( int i = 0 ; i < n ; i ++ ) { char letra = a . charAt ( i ) ; countChars [ letra - 65 ] ++ ; } char [ ] equivalencias = new char [ 3 ] ; equivalencias [ a . charAt ( 0 ) - 65 ] = ' ( ' ; equivalencias [ a . charAt ( n - 1 ) - 65 ] = ' ) ' ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( equivalencias [ i ] == 0 ) { if ( countChars [ a . charAt ( 0 ) - 65 ] > countChars [ a . charAt ( n - 1 ) - 65 ] ) equivalencias [ i ] = ' ) ' ; else equivalencias [ i ] = ' ( ' ; } } int contador = 0 ; for ( int i = 0 ; i < n ; i ++ ) { char letra = a . charAt ( i ) ; if ( equivalencias [ letra - 65 ] == ' ( ' ) contador ++ ; else -- contador ; if ( contador < 0 ) break ; } System . out . println ( ( contador == 0 ? \" YES \" : \" NO \" ) ) ; } } }", "import java . util . Scanner ;   public class A1494 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; char [ ] [ ] variants = new char [ ] [ ] { { ' ) ' , ' ) ' , ' ) ' } , { ' ) ' , ' ) ' , ' ( ' } , { ' ) ' , ' ( ' , ' ) ' } , { ' ) ' , ' ( ' , ' ( ' } , { ' ( ' , ' ) ' , ' ) ' } , { ' ( ' , ' ) ' , ' ( ' } , { ' ( ' , ' ( ' , ' ) ' } , { ' ( ' , ' ( ' , ' ( ' } , } ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { char [ ] S = in . next ( ) . toCharArray ( ) ; boolean ok = false ; for ( char [ ] variant : variants ) { ok |= isValid ( S , variant ) ; } System . out . println ( ok ? \" YES \" : \" NO \" ) ; } }   static boolean isValid ( char [ ] S , char [ ] variant ) { int count = 0 ; for ( char c : S ) { char bracket = variant [ c - ' A ' ] ; if ( bracket == ' ) ' ) { count -- ; } else { count ++ ; } if ( count < 0 ) { return false ; } } return ( count == 0 ) ; }   }" ]
[ "for _ in range ( int ( input ( ) ) ) : s = input ( ) NEW_LINE x1 , x2 , x3 = 0 , 0 , 0 NEW_LINE c1 , c2 , c3 = True , True , True NEW_LINE nc1 , nc2 , nc3 = True , True , True NEW_LINE for i in s : if NEW_LINE i == ' A ' : x1 += 1 elif i == ' B ' : x2 += 1 elif i == ' C ' : x3 += 1   c3 = c3 & ( x1 + x2 >= x3 ) NEW_LINE c2 = c2 & ( x1 + x3 >= x2 ) NEW_LINE c1 = c1 & ( x2 + x3 >= x1 ) NEW_LINE nc3 = nc3 & ( x1 + x2 <= x3 ) NEW_LINE nc2 = nc2 & ( x1 + x3 <= x2 ) NEW_LINE nc1 = nc1 & ( x2 + x3 <= x1 ) NEW_LINE if x1 + x2 == x3 : if NEW_LINE c3 : print ( \" YES \" ) elif nc3 : print ( \" YES \" ) else : print ( \" NO \" )   elif x1 + x3 == x2 : NEW_LINE if c2 : NEW_LINE INDENT print ( \" YES \" ) elif nc2 : NEW_LINE print ( \" YES \" ) else : NEW_LINE print ( \" NO \" )   elif x2 + x3 == x1 : NEW_LINE DEDENT if c1 : NEW_LINE INDENT print ( \" YES \" ) elif nc1 : NEW_LINE print ( \" YES \" ) else : NEW_LINE print ( \" NO \" ) else : print ( \" NO \" )   NEW_LINE DEDENT", "for test in range ( int ( input ( ) ) ) : s = input ( ) NEW_LINE n = len ( s ) NEW_LINE a = [ ' ( ' , ' ) ' ] NEW_LINE ans = \" NO \" NEW_LINE for i in range ( 2 ) : for NEW_LINE j in range ( 2 ) : NEW_LINE for q in range ( 2 ) : s1 = s NEW_LINE s1 = s1 . replace ( ' A ' , a [ i ] ) NEW_LINE s1 = s1 . replace ( ' B ' , a [ j ] ) NEW_LINE s1 = s1 . replace ( ' C ' , a [ q ] ) NEW_LINE b = 0 NEW_LINE for p in range ( n ) : if NEW_LINE s1 [ p ] == ' ( ' : b += 1 else : b -= 1 NEW_LINE if b < 0 : break NEW_LINE if b == 0 : ans = \" YES \" NEW_LINE print ( ans ) NEW_LINE", "T_ON = 1 NEW_LINE DEBUG_ON = 0 NEW_LINE MOD = 998244353     NEW_LINE def solve ( ) : s = input ( ) NEW_LINE n = len ( s ) NEW_LINE G = Counter ( s ) NEW_LINE MAX = max ( G . values ( ) ) NEW_LINE if MAX != n // 2 : NO ( ) NEW_LINE return MAX_CH = ' ' NEW_LINE for k , v in G . items ( ) : if NEW_LINE v == MAX : MAX_CH = k NEW_LINE count = 0 NEW_LINE for c in s : if NEW_LINE c == s [ 0 ] : count += 1 NEW_LINE continue NEW_LINE if s [ 0 ] == MAX_CH : NEW_LINE INDENT count -= 1 elif c == MAX_CH : NEW_LINE count -= 1 else : NEW_LINE count += 1 NEW_LINE DEDENT if count < 0 : NO ( ) NEW_LINE return YES ( )     NEW_LINE def main ( ) : T = read_int ( ) if T_ON else 1 NEW_LINE for i in range ( T ) : solve ( )     NEW_LINE def debug ( * xargs ) : if NEW_LINE DEBUG_ON : print ( * xargs )     from collections import * NEW_LINE import NEW_LINE INDENT math     NEW_LINE DEDENT", "tcs = int ( input ( ) ) NEW_LINE l = [ [ - 1 , - 1 , 1 ] , [ - 1 , 1 , - 1 ] , [ - 1 , 1 , 1 ] , [ 1 , - 1 , - 1 ] , [ 1 , - 1 , 1 ] , [ 1 , 1 , - 1 ] ]   for tc in range ( tcs ) : s = input ( ) NEW_LINE for j in l : cnt = 0 NEW_LINE p = 1 NEW_LINE for i in s : cnt += j [ ord ( i ) - 65 ] NEW_LINE if cnt < 0 : p = 0 NEW_LINE if p == 1 and cnt == 0 : print ( \" YES \" ) NEW_LINE break else : print ( \" NO \" ) NEW_LINE" ]
codeforces_784_B
[ "import java . util . Scanner ;   public class source { public static void main ( String [ ] args ) { int n ; try ( Scanner s = new Scanner ( System . in ) ) { n = s . nextInt ( ) ; } String s = Integer . toHexString ( n ) . toUpperCase ( ) ; int k = 0 ; for ( char c : s . toCharArray ( ) ) { switch ( c ) { case '0' : case '4' : case '6' : case '9' : case ' A ' : case ' D ' : k ++ ; break ; case '8' : case ' B ' : k += 2 ; break ; } } System . out . println ( k ) ; } }", "        import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import static java . lang . System . in ; import java . lang . reflect . Array ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . AbstractList ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import static java . util . Collections . list ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedHashSet ; import java . util . List ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; import javax . xml . stream . events . Characters ;       public class main { public static boolean isPrime ( long n ) { if ( n < 2 ) return false ; if ( n == 2 || n == 3 ) return true ; if ( n % 2 == 0 || n % 3 == 0 ) return false ; long sqrtN = ( long ) Math . sqrt ( n ) + 1 ; for ( long i = 6L ; i <= sqrtN ; i += 6 ) { if ( n % ( i - 1 ) == 0 || n % ( i + 1 ) == 0 ) return false ; } return true ; }   private static long f ( long l ) { throw new UnsupportedOperationException ( \" Not ▁ supported ▁ yet . \" ) ;" ]
[ "o = [ '0' , '4' , '6' , '9' , ' a ' , ' d ' ] oo = [ '8' , ' b ' ] cnt = 0 n = list ( hex ( int ( input ( ) ) ) ) x = ' ' for i in range ( 2 , len ( n ) ) : x += n [ i ] x = str ( x ) for j in x : if j in o : cnt += 1 elif j in oo : cnt += 2 print ( cnt ) NEW_LINE", "a = int ( input ( ) ) b = str ( hex ( a ) ) . upper ( ) l = list ( b ) count = - 1 for i in l : if ( i == '8' or i == ' B ' ) : count += 2 continue if ( i == '0' or i == '4' or i == '6' or i == '9' or i == ' A ' or i == ' D ' ) : count += 1 continueif ( count < 0 ) : count = 0 print ( count ) NEW_LINE", "n = int ( input ( ) ) a = hex ( n ) b = ( a [ 2 : : ] ) . upper ( ) count = 0 for i in b : if i == '4' or i == '6' or i == '9' or i == '0' or i == ' A ' or i == ' D ' : count += 1 elif i == '8' or i == ' B ' : count += 2 print ( count ) NEW_LINE", "val = [ 1 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 2 , 1 , 1 , 2 , 0 , 1 , 0 , 0 ] n = int ( input ( ) ) x = hex ( n ) x = x [ 2 : ] ans = 0 for i in x : i = int ( i , 16 ) ans = ans + val [ i ] print ( ans ) NEW_LINE" ]
codeforces_390_B
[ "import java . io . Reader ; import java . util . InputMismatchException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . BufferedReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . io . Writer ; import java . io . IOException ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; FastPrinter out = new FastPrinter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } }   class TaskB { public void solve ( int testNumber , FastScanner in , FastPrinter out ) { int n = in . nextInt ( ) ; int [ ] a = in . readIntArray ( n ) ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = in . nextInt ( ) ; if ( x > 2 * a [ i ] || x == 1 ) { -- ans ; } else { ans += ( long ) ( x / 2 ) * ( ( x + 1 ) / 2 ) ; } } out . println ( ans ) ; } }   class FastScanner extends BufferedReader {   public FastScanner ( InputStream is ) { super ( new InputStreamReader ( is ) ) ; }   public int read ( ) { try { int ret = super . read ( ) ;", "import java . io . * ; import java . util . * ; public class b { public static void main ( String [ ] args ) throws IOException { input . init ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = input . nextInt ( ) ; int [ ] as = new int [ n ] , bs = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) as [ i ] = input . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) bs [ i ] = input . nextInt ( ) ; long res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( as [ i ] + as [ i ] < bs [ i ] || bs [ i ] == 1 ) res -- ; else { int a = bs [ i ] / 2 , b = bs [ i ] - a ; if ( b > as [ i ] ) { b = as [ i ] ; a = bs [ i ] - as [ i ] ; } res += ( long ) a * b ; } } out . println ( res ) ; out . close ( ) ; }   public static class input { static BufferedReader reader ; static StringTokenizer tokenizer ;   static void init ( InputStream input ) { reader = new BufferedReader ( new InputStreamReader ( input ) ) ; tokenizer = new StringTokenizer ( \" \" ) ; }   static String next ( ) throws IOException { while ( ! tokenizer . hasMoreTokens ( ) ) tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; return tokenizer . nextToken ( ) ; }   static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; }   static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; }   static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } }  " ]
[ "import mathn = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) result = 0 for i in range ( n ) : if b [ i ] < 2 or b [ i ] > 2 * a [ i ] : result -= 1 else : result += math . floor ( b [ i ] / 2 ) * math . ceil ( b [ i ] / 2 ) print ( result )     NEW_LINE", "n , a , b = input ( ) , map ( int , input ( ) . split ( ) ) , map ( int , input ( ) . split ( ) ) print ( sum ( ( y // 2 ) * ( y - y // 2 ) if y > 1 and 2 * x >= y else - 1 for x , y in zip ( a , b ) ) ) NEW_LINE", "n , a , b = input ( ) , map ( int , input ( ) . split ( ) ) , map ( int , input ( ) . split ( ) ) print ( sum ( ( y // 2 ) * ( y - y // 2 ) if y > 1 and 2 * x >= y else - 1 for x , y in zip ( a , b ) ) ) NEW_LINE", "n , a , b = input ( ) , map ( int , input ( ) . split ( ) ) , map ( int , input ( ) . split ( ) ) print ( sum ( ( y // 2 ) * ( y - y // 2 ) if y > 1 and 2 * x >= y else - 1 for x , y in zip ( a , b ) ) ) NEW_LINE", "n , a , b = input ( ) , map ( int , input ( ) . split ( ) ) , map ( int , input ( ) . split ( ) )   print ( sum ( ( y // 2 ) * ( y - y // 2 ) if y > 1 and 2 * x >= y else - 1 for x , y in zip ( a , b ) ) )       NEW_LINE" ]
codeforces_239_A
[ "import java . util . Scanner ;   public class bagsofpotato { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int y = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int n = sc . nextInt ( ) ;   int top = n - y ; int x = k - y % k ;   if ( x <= top ) { System . out . print ( x + \" ▁ \" ) ; x = x + k ; while ( x <= top ) { System . out . print ( x + \" ▁ \" ) ; x = x + k ; } } else System . out . println ( - 1 ) ; } }  ", "  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 . Scanner ;   public class P239A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long y = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; long n = sc . nextLong ( ) ; if ( y >= n ) { System . out . println ( - 1 ) ; System . exit ( 0 ) ; } long x = k - y % k , l = 0 ; while ( x + y <= n ) { System . out . print ( x + \" ▁ \" ) ; x += k ; l = 1 ; } System . out . println ( l == 0 ? - 1 : \" \" ) ; } }", "import java . util . * ; public class TwoBagsOfPotatoes { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int y = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; sc . close ( ) ; boolean falg = false ; int start = y / k + 1 ; for ( int i = start ; i <= n / k ; i ++ ) { falg = true ; System . out . print ( ( k * i - y ) + \" ▁ \" ) ; } if ( ! falg ) System . out . println ( - 1 ) ; } }" ]
[ "y , k , n = map ( int , input ( ) . split ( ) ) c = int ( y // k ) + 1 if y >= n or c * k not in range ( y , n + 1 ) : print ( - 1 ) else : c = int ( y // k ) + 1 arr = [ x - y for x in range ( c * k , n + 1 , k ) ] print ( * arr ) NEW_LINE", "y , k , n = map ( int , input ( ) . split ( ) ) flag = Truefor i in range ( y + ( k - ( y % k ) ) , n + 1 , k ) : print ( i - y , end = ' ▁ ' ) flag = Falseif flag : print ( - 1 ) NEW_LINE", "y , k , n = map ( int , input ( ) . split ( ) ) print ( - 1 ) if len ( [ print ( i - y , end = ' ▁ ' ) for i in range ( y + ( k - ( y % k ) ) , n + 1 , k ) ] ) == 0 else print ( ' ' )     NEW_LINE", "y , k , n = list ( map ( int , input ( ) . split ( ) ) )     if y == k : count = 0 elif y > k : count = ( ( y // k + 1 ) * k ) - yelse : count = k - y     if y >= n : print ( - 1 ) else : if y + count > n : print ( - 1 ) else :   while y + count <= n : if count == 0 : count += k continue print ( count , end = \" ▁ \" ) count += k     NEW_LINE", "y , k , n = map ( int , input ( ) . split ( ) ) x = k - y % kif x + y > n : print ( ' - 1' ) while x + y <= n : print ( x ) x += k NEW_LINE" ]
codeforces_842_A
[ "import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . util . TreeMap ; import java . util . TreeSet ;    public class Main {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long l = input . nextInt ( ) , r = input . nextInt ( ) , x = input . nextInt ( ) , y = input . nextInt ( ) , k = input . nextInt ( ) ; for ( long i = x ; i <= y ; i ++ ) { if ( i * k >= l && i * k <= r ) { System . out . println ( \" YES \" ) ; return ; } } System . out . println ( \" NO \" ) ; } }", "import sun . text . resources . fr . FormatData_fr ;   import java . io . * ; import java . math . BigInteger ; import java . util . * ;   public class Main { static class FastScanner {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class test { public static void main ( String ... args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int l = Integer . parseInt ( st . nextToken ( ) ) ; int r = Integer . parseInt ( st . nextToken ( ) ) ; int x = Integer . parseInt ( st . nextToken ( ) ) ; int y = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; int a = k ; int b = 1 ; while ( a <= r && b <= y ) { if ( a >= l && b >= x ) { System . out . println ( \" YES \" ) ; return ; } else { b ++ ; a = k * b ; } } System . out . println ( \" NO \" ) ; } }", "import java . util . * ;   public class CodeForces842A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int l = input . nextInt ( ) ; int r = input . nextInt ( ) ; int x = input . nextInt ( ) ; int y = input . nextInt ( ) ; int k = input . nextInt ( ) ; long c = 1 ; for ( int i = x ; i <= y ; i ++ ) { c = ( long ) k * i ; if ( c >= l && c <= r ) {" ]
[ "l , r , x , y , k = map ( int , input ( ) . split ( ) ) check = Trueif ( x * k > r or y * k < l ) : print ( \" NO \" ) else : for i in range ( x , y + 1 ) : if ( k * i <= r and k * i >= l ) : check = False break if ( check == True ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "l , r , x , y , k = ( int ( x ) for x in input ( ) . split ( ) ) for i in range ( x , y + 1 ) : if k * i <= r and k * i >= l : print ( \" YES \" ) exit ( 0 ) print ( \" NO \" ) NEW_LINE", "import sysdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( int , input ( ) . split ( ) ) ) l , r , x , y , k = minput ( ) answer = \" NO \" for i in range ( x , y + 1 ) : if l <= i * k <= r : answer = \" YES \" breakprint ( answer ) NEW_LINE", "l , r , x , y , k = map ( int , input ( ) . split ( ) ) for i in range ( x , y + 1 ) : if i * k <= r and i * k >= l : print ( \" YES \" ) breakelse : print ( \" NO \" ) NEW_LINE", "l , r , x , y , k = [ int ( a ) for a in input ( ) . split ( ) ] i = lj = xs = 0 while ( i <= r and j <= y ) : d = ( i / j ) if ( d == k ) : s = 1 break elif ( d < k ) : i = i + 1 else : j = j + 1 if ( s ) : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE" ]
codeforces_787_A
[ "import java . util . * ;   public class Monster { public static void main ( String [ ] args ) { int a = 2 ;", "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 . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  " ]
[ "def fun ( ls , lt ) : a , b = ls c , d = lt st = set ( ) for i in range ( 1 , 101 ) : first = b + ( i - 1 ) * a st . add ( first )   for i in range ( 1 , 101 ) : second = d + ( i - 1 ) * c if ( second in st ) : print ( second ) return print ( - 1 )   NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) c , d = map ( int , input ( ) . split ( ) ) s = set ( ) for i in range ( 101 ) : s . add ( b + a * i ) for i in range ( 101 ) : if d + ( c * i ) in s : print ( d + ( c * i ) ) ; exit ( ) print ( - 1 ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) c , d = map ( int , input ( ) . split ( ) ) for i in range ( 10 ** 5 + 1 ) : x = b + ( a * i ) if x >= d and ( x - d ) % c == 0 : print ( x ) ; exit ( ) print ( - 1 ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) c , d = map ( int , input ( ) . split ( ) )   for i in range ( 101 ) : for j in range ( 101 ) : if a * i + b == c * j + d : print ( a * i + b ) exit ( ) print ( - 1 ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) c , d = map ( int , input ( ) . split ( ) ) ans = \" - 1\" while b < 100000 : if b == d : ans = b break elif b > d : d += c else : b += aprint ( ans ) NEW_LINE" ]
codeforces_73_A
[ "import java . util . Arrays ; import java . util . Scanner ;   public class Test {   public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; long x [ ] = new long [ 3 ] ; x [ 0 ] = in . nextLong ( ) ; x [ 1 ] = in . nextLong ( ) ; x [ 2 ] = in . nextLong ( ) ; Arrays . sort ( x ) ; long k = in . nextLong ( ) ; if ( x [ 0 ] == x [ 1 ] && x [ 1 ] == x [ 2 ] && x [ 2 ] == 1 ) { System . out . println ( 1 ) ; return ; } long a = Math . min ( x [ 0 ] - 1 , k / 3 ) ; long b = Math . min ( x [ 1 ] - 1 , k / 3 ) ; long c = Math . min ( x [ 2 ] - 1 , k / 3 ) ; k = k - a - b - c ; if ( k == 0 ) { System . out . println ( ( a + 1 ) * ( b + 1 ) * ( c + 1 ) ) ; } else { if ( b == x [ 1 ] - 1 ) { c += Math . min ( k , x [ 2 ] - 1 - c ) ; } else { long d = Math . min ( k / 2 , x [ 1 ] - 1 - b ) ; b += d ; k -= d ; c += Math . min ( k , x [ 2 ] - 1 - c ) ; } System . out . println ( ( a + 1 ) * ( b + 1 ) * ( c + 1 ) ) ; } } }", "import java . io . BufferedReader ; 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 . Arrays ; import java . util . StringTokenizer ;   public class A {   public static void main ( String [ ] args ) throws IOException {   Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ;   int x [ ] = new int [ ] { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } , k = sc . nextInt ( ) ; Arrays . sort ( x ) ; long rem = k , ans = 1 ; for ( int i = 0 ; i < 3 ; ++ i ) { long kd = rem / ( 3 - i ) ; long s = Math . min ( x [ i ] , kd + 1 ) ; ans *= s ; rem -= s - 1 ; } out . println ( ans ) ; out . close ( ) ; }   static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; }   public Scanner ( String s ) throws FileNotFoundException { br = new BufferedReader ( new FileReader ( s ) ) ; }   public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; }   public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; }   public String nextLine ( ) throws IOException { return br . readLine ( ) ; }   public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; }   public boolean ready ( ) throws IOException { return br . ready ( ) ; } } }" ]
[ "I = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE x , y , z , k = I ( ) NEW_LINE a1 , a2 , a3 , q = 0 , 0 , 0 , 0 NEW_LINE while q < 3 : q = 0 NEW_LINE if a1 + a2 + a3 == k : break NEW_LINE if a1 < x - 1 : a1 += 1 NEW_LINE if a1 + a2 + a3 == k : NEW_LINE INDENT break else : NEW_LINE q += 1 NEW_LINE DEDENT if a2 < y - 1 : a2 += 1 NEW_LINE if a1 + a2 + a3 == k : NEW_LINE INDENT break else : NEW_LINE q += 1 NEW_LINE DEDENT if a3 < z - 1 : a3 += 1 NEW_LINE if a1 + a2 + a3 == k : NEW_LINE INDENT break else : NEW_LINE q += 1 NEW_LINE DEDENT print ( ( a1 + 1 ) * ( a2 + 1 ) * ( a3 + 1 ) ) NEW_LINE", "x , y , z , k = map ( int , input ( ) . split ( ) )   x , y , z = sorted ( ( x , y , z ) )   a = min ( k // 3 , x - 1 )   b = min ( ( k - a ) // 2 , y - 1 )   c = min ( k - a - b , z - 1 )   print ( ( a + 1 ) * ( b + 1 ) * ( c + 1 ) ) NEW_LINE", "xyzk = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE k = xyzk [ 3 ] NEW_LINE x , y , z = sorted ( [ xyzk [ 0 ] , xyzk [ 1 ] , xyzk [ 2 ] ] ) NEW_LINE x = min ( k // 3 + 1 , x ) NEW_LINE y = min ( ( k - x + 1 ) // 2 + 1 , y ) NEW_LINE z = min ( k - x - y + 3 , z ) NEW_LINE print ( x * y * z ) NEW_LINE", "x , y , z , k = [ int ( value ) for value in input ( ) . split ( ) ]   x , y , z = sorted ( [ x , y , z ] )   a = min ( k // 3 , x - 1 ) NEW_LINE k -= ab = min ( k // 2 , y - 1 ) NEW_LINE k -= bc = min ( k , z - 1 )   print ( ( a + 1 ) * ( b + 1 ) * ( c + 1 ) ) NEW_LINE" ]
codeforces_842_B
[ "import java . util . * ;   public class Absolutezero {    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int c = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int r1 = sc . nextInt ( ) ; double dis = Math . sqrt ( x * x + y * y ) ; if ( dis >= ( r - d ) && ( dis + ( r1 ) ) <= r && ( dis - r1 ) >= ( r - d ) ) { c ++ ; } } System . out . println ( c ) ;    }   }", "import java . util . * ;   public class Absolutezero {    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int c = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int r1 = sc . nextInt ( ) ; double dis = Math . sqrt ( x * x + y * y ) ; if ( dis >= ( r - d ) && ( dis + ( r1 ) ) <= r && ( dis - r1 ) >= ( r - d ) ) { c ++ ; } } System . out . println ( c ) ;    }   }", "import java . io . * ; import java . util . * ;   import static java . lang . Double . * ; import static java . lang . Integer . * ;   public class B { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; StringTokenizer st ; st = new StringTokenizer ( in . readLine ( ) ) ; int res = 0 ; double r = parseDouble ( st . nextToken ( ) ) , d = parseDouble ( st . nextToken ( ) ) ; int n = parseInt ( in . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { st = new StringTokenizer ( in . readLine ( ) ) ; double xi = parseDouble ( st . nextToken ( ) ) , yi = parseDouble ( st . nextToken ( ) ) , ri = parseDouble ( st . nextToken ( ) ) ; if ( solve ( r , d , xi , yi , ri ) ) res ++ ; } pw . println ( res ) ; pw . close ( ) ; }   static boolean solve ( double r , double d , double xi , double yi , double ri ) { double dis = Math . sqrt ( ( ( xi * xi ) + ( yi * yi ) ) ) ; if ( ( r - d ) <= ( dis - ri ) && r >= ( dis + ri ) ) return true ; return false ; } }", "import java . util . * ;   public class GlebPizza {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int R = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int tot = 0 ; int d = R - D ; while ( n -- > 0 ) { int x = sc . nextInt ( ) ; x = Math . abs ( x ) ; int y = sc . nextInt ( ) ; y = Math . abs ( y ) ; int r = sc . nextInt ( ) ; if ( 2 * r <= R - d ) { double f = max ( x , y ) ; if ( ( f <= R && f >= d ) ) { if ( ( R - f >= r && f - d >= r ) ) { tot ++ ; } } } }   System . out . println ( tot ) ;   } static double max ( int a , int b ) { return Math . sqrt ( a * a + b * b ) ; }   }" ]
[ "R , D = map ( int , input ( ) . split ( ) ) cnt = 0 for _ in range ( int ( input ( ) ) ) : x , y , r = map ( int , input ( ) . split ( ) ) d = ( x * x + y * y ) ** ( 0.5 ) if ( r + d <= R and d - r >= R - D ) : cnt += 1 print ( cnt ) NEW_LINE", "import math   pizza_info = list ( map ( int , input ( ) . split ( ) ) ) pizza_radius = pizza_info [ 0 ] crust_width = pizza_info [ 1 ] pieces_of_sausage = int ( input ( ) ) sausages_on_crust = 0 for sausage in range ( pieces_of_sausage ) : sausage_info = list ( map ( int , input ( ) . split ( ) ) ) sausage_x = sausage_info [ 0 ] sausage_y = sausage_info [ 1 ] sausage_radius = sausage_info [ 2 ] sausage_radial_pos = math . sqrt ( sausage_x * sausage_x + sausage_y * sausage_y ) if ( pizza_radius - crust_width <= sausage_radial_pos - sausage_radius and sausage_radial_pos + sausage_radius <= pizza_radius ) : sausages_on_crust += 1 print ( sausages_on_crust ) NEW_LINE", "r , d = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) ans = 0 for _ in range ( n ) : x , y , p = map ( int , input ( ) . split ( ) ) if x * x + y * y >= ( r - d + p ) * ( r - d + p ) and x * x + y * y <= ( r - p ) * ( r - p ) : ans += 1 print ( ans ) NEW_LINE", "r , d = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) ans = 0 for _ in range ( n ) : x , y , k = map ( int , input ( ) . split ( ) ) dc = ( x * x + y * y ) ** 0.5 if dc + k <= r and dc - k >= r - d : ans += 1 print ( ans ) NEW_LINE", "R , d = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) count = 0 for _ in range ( n ) : x , y , r = map ( int , input ( ) . split ( ) ) if 2 * r <= d : dis = ( ( x ** 2 ) + ( y ** 2 ) ) ** ( 1 / 2 ) mind = dis - r maxd = dis + r if mind >= R - d and maxd <= R : count += 1 print ( count ) NEW_LINE" ]
codeforces_590_B
[ "import java . util . * ; import java . io . * ; import java . awt . Point ; import java . awt . geom . Point2D ; import java . math . BigDecimal ; import java . math . BigInteger ;   import static java . lang . Math . * ;    public class B implements Runnable { final static Random rnd = new Random ( ) ;", "import java . io . * ; import java . math . * ; import java . text . DecimalFormat ; import java . util . * ;    public class Main {   private static double compute ( point v , point dnr , double vmax ) { double vp = v . dot ( dnr ) , vt = v . cross ( dnr ) ;" ]
[ "scan = lambda : map ( int , input ( ) . split ( ) ) x1 , y1 , x2 , y2 = scan ( ) vmx , t = scan ( ) vx , vy = scan ( ) wx , wy = scan ( ) lb , ub , EPS = 0 , 1e15 , 1e-8 while ub - lb > EPS : mid = ( lb + ub ) / 2 xx , yy = ( vx * mid , vy * mid ) if t - mid > EPS else ( vx * t + wx * ( mid - t ) , vy * t + wy * ( mid - t ) ) if vmx * mid - ( ( x2 - x1 - xx ) ** 2 + ( y2 - y1 - yy ) ** 2 ) ** .5 > EPS : ub = mid else : lb = midprint ( \" % .8f \" % ub ) NEW_LINE", "scan = lambda : map ( int , input ( ) . split ( ) ) x1 , y1 , x2 , y2 = scan ( ) vmx , t = scan ( ) vx , vy = scan ( ) wx , wy = scan ( ) lb , ub , EPS = 0 , 1e15 , 1e-8 while ub - lb > EPS : mid = ( lb + ub ) / 2 xx , yy = ( vx * mid , vy * mid ) if t - mid > EPS else ( vx * t + wx * ( mid - t ) , vy * t + wy * ( mid - t ) ) if vmx * mid - ( ( x2 - x1 - xx ) ** 2 + ( y2 - y1 - yy ) ** 2 ) ** .5 > EPS : ub = mid else : lb = midprint ( \" % .8f \" % ub ) NEW_LINE", "scan = lambda : map ( int , input ( ) . split ( ) ) x1 , y1 , x2 , y2 = scan ( ) vmx , t = scan ( ) vx , vy = scan ( ) wx , wy = scan ( ) lb , ub , EPS = 0 , 1e15 , 1e-8 while ub - lb > EPS : mid = ( lb + ub ) / 2 xx , yy = ( vx * mid , vy * mid ) if t - mid > EPS else ( vx * t + wx * ( mid - t ) , vy * t + wy * ( mid - t ) ) if vmx * mid - ( ( x2 - x1 - xx ) ** 2 + ( y2 - y1 - yy ) ** 2 ) ** .5 > EPS : ub = mid else : lb = midprint ( \" % .8f \" % ub ) NEW_LINE", "scan = lambda : map ( int , input ( ) . split ( ) ) x1 , y1 , x2 , y2 = scan ( ) vmx , t = scan ( ) vx , vy = scan ( ) wx , wy = scan ( ) lb , ub , EPS = 0 , 1e15 , 1e-8 while ub - lb > EPS : mid = ( lb + ub ) / 2 xx , yy = ( vx * mid , vy * mid ) if t - mid > EPS else ( vx * t + wx * ( mid - t ) , vy * t + wy * ( mid - t ) ) if vmx * mid - ( ( x2 - x1 - xx ) ** 2 + ( y2 - y1 - yy ) ** 2 ) ** .5 > EPS : ub = mid else : lb = midprint ( \" % .8f \" % ub ) NEW_LINE", "scan = lambda : map ( int , input ( ) . split ( ) ) x1 , y1 , x2 , y2 = scan ( ) vmx , t = scan ( ) vx , vy = scan ( ) wx , wy = scan ( ) lb , ub , EPS = 0 , 1e15 , 1e-8 while ub - lb > EPS : mid = ( lb + ub ) / 2 xx , yy = ( vx * mid , vy * mid ) if t - mid > EPS else ( vx * t + wx * ( mid - t ) , vy * t + wy * ( mid - t ) ) if vmx * mid - ( ( x2 - x1 - xx ) ** 2 + ( y2 - y1 - yy ) ** 2 ) ** .5 > EPS : ub = mid else : lb = midprint ( \" % .8f \" % ub ) NEW_LINE" ]
codeforces_229_A
[ "import java . util . * ;   public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; char [ ] [ ] t = new char [ n ] [ ] ; for ( int i = 0 ; i < n ; i ++ ) { t [ i ] = sc . next ( ) . toCharArray ( ) ; } int rec [ ] [ ] = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { int f = 0 ; while ( f < m && t [ i ] [ f ] != '1' ) { f ++ ; } if ( f == m ) { System . out . println ( - 1 ) ; return ; } int cnt = 1 ; for ( int j = ( f + 1 ) % m ; j != f ; j = ( j + 1 ) % m ) { if ( t [ i ] [ j ] == '1' ) cnt = 0 ; rec [ i ] [ j ] = cnt ++ ; } } for ( int i = 0 ; i < n ; i ++ ) { int f = m - 1 ; while ( f >= 0 && t [ i ] [ f ] != '1' ) { f -- ; } if ( f == - 1 ) { System . out . println ( - 1 ) ; return ; } int cnt = 1 ; for ( int j = ( f - 1 + m ) % m ; j != f ; j = ( j - 1 + m ) % m ) { if ( t [ i ] [ j ] == '1' ) cnt = 0 ; rec [ i ] [ j ] = Math . min ( cnt ++ , rec [ i ] [ j ] ) ; } } int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < m ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j < n ; j ++ ) { sum += rec [ j ] [ i ] ; } ans = Math . min ( sum , ans ) ; } System . out . println ( ans ) ; } }", "import java . util . * ; import java . io . * ; public class Main {   static BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringTokenizer st ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String [ ] args ) throws IOException { int n = readInt ( ) , m = readInt ( ) ; ArrayList < Integer > adj [ ] = new ArrayList [ n ] ; for ( int i = 0 ; i < n ; i ++ ) adj [ i ] = new ArrayList ( ) ; String [ ] arr = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = readLine ( ) ; boolean flag = true ; for ( int j = 0 ; j < m ; j ++ ) { if ( arr [ i ] . charAt ( j ) == '1' ) { flag = false ; adj [ i ] . add ( j ) ; } } if ( flag ) { System . out . println ( - 1 ) ; return ; } } int [ ] [ ] lft = new int [ n ] [ m ] , rit = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) {" ]
[ "n , m = map ( int , input ( ) . split ( ) ) memo = [ [ int ( 2e9 ) for j in range ( m ) ] for i in range ( n ) ] for i in range ( n ) : s = input ( ) if s . find ( '1' ) == - 1 : print ( - 1 ) exit ( ) memo [ i ] [ 0 ] = s [ : : - 1 ] . find ( '1' ) + 1 memo [ i ] [ m - 1 ] = s . find ( '1' ) + 1 for j in range ( m ) : if s [ j ] == '1' : memo [ i ] [ j ] = 0 else : memo [ i ] [ j ] = min ( memo [ i ] [ j ] , memo [ i ] [ j - 1 ] + 1 ) for j in range ( m - 2 , - 1 , - 1 ) : memo [ i ] [ j ] = min ( memo [ i ] [ j ] , memo [ i ] [ j + 1 ] + 1 ) print ( min ( [ sum ( [ memo [ i ] [ j ] for i in range ( n ) ] ) for j in range ( m ) ] ) ) NEW_LINE", "def binS ( a , x , n ) : l , r = - 1 , n while ( l + 1 < r ) : m = ( l + r ) // 2 if ( a [ m ] >= x ) : r = m else : l = m return min ( abs ( a [ r ] - x ) , abs ( a [ r - 1 ] - x ) ) def main ( ) : n , m = [ int ( i ) for i in input ( ) . split ( ) ] q = [ 0 ] * m for i in range ( n ) : s = input ( ) * 3 a = [ ] ln = 0 for j in range ( m * 3 ) : if s [ j ] == '1' : a += [ j ] ln += 1 if ln == 0 : q = [ - 1 ] break for x in range ( m , m * 2 ) : q [ x - m ] += binS ( a , x , ln ) print ( min ( q ) ) main ( ) NEW_LINE", "''' ▁ ▁ ▁ ▁ Auther : ▁ ghoshashis545 ▁ Ashis ▁ Ghosh ▁ ▁ ▁ ▁ College : ▁ jalpaiguri ▁ Govt ▁ Enggineering ▁ College  ''' from os import pathimport sysfrom heapq import heappush , heappopfrom functools import cmp_to_key as ctkfrom collections import deque , 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 ( ) def mi ( ) : return map ( int , input ( ) . split ( ) ) def li ( ) : return list ( mi ( ) ) abc = ' abcdefghijklmnopqrstuvwxyz ' NEW_LINE" ]
codeforces_91_A
[ "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 CF91A { public static void main ( String [ ] args ) throws IOException { FastScanner sc = new FastScanner ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   char [ ] s1 = sc . nextToken ( ) . toCharArray ( ) , s2 = sc . nextToken ( ) . toCharArray ( ) ; int [ ] [ ] nextPos = new int [ s1 . length ] [ 26 ] ; for ( int [ ] a : nextPos ) Arrays . fill ( a , - 1 ) ;  ", "import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;     public class NewsPaperHeadLine {   public static void main ( String [ ] args ) {   InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader sc = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Solver solver = new Solver ( ) ;", "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 void main ( String [ ] args ) { solve ( ) ; out . close ( ) ; }   private static void solve ( ) { char [ ] s1 = in . nextLine ( ) . toCharArray ( ) ; char [ ] s2 = in . nextLine ( ) . toCharArray ( ) ;   int [ ] [ ] charAfter = new int [ s1 . length ] [ 26 ] ;   for ( int i = 0 ; i < s1 . length ; i ++ ) Arrays . fill ( charAfter [ i ] , - 1 ) ;   for ( int i = s1 . length - 2 ; i >= 0 ; i -- ) {" ]
[ "from bisect import bisect_left as bla , b = input ( ) , input ( ) NEW_LINE f = dict ( ( c , [ i for i , x in enumerate ( a ) if x == c ] ) for c in set ( a ) ) NEW_LINE", "from math import * NEW_LINE from sys import stdin , stdout , setrecursionlimitfrom NEW_LINE bisect NEW_LINE import * from collections NEW_LINE import NEW_LINE * input = lambda : stdin . readline ( ) . strip ( ) NEW_LINE print = stdout . write   s1 = input ( ) NEW_LINE s2 = input ( )   al = defaultdict ( list ) NEW_LINE count = 1 ; NEW_LINE index = 0   for i in range ( len ( s1 ) ) : al [ s1 [ i ] ] . append ( i )   for i in range ( len ( s2 ) ) : if NEW_LINE INDENT ( len ( al [ s2 [ i ] ] ) == 0 ) : print ( str ( - 1 ) ) NEW_LINE DEDENT exit ( )   for i in range ( len ( s2 ) ) :   NEW_LINE r = bisect_left ( al [ s2 [ i ] ] , index ) NEW_LINE if ( r == len ( al [ s2 [ i ] ] ) ) : count += 1 NEW_LINE index = al [ s2 [ i ] ] [ 0 ] + 1 else : index = al [ s2 [ i ] ] [ r ] + 1   print ( str ( count ) ) NEW_LINE", "from bisect import bisect_righta , b , c = input ( ) , input ( ) , ' abcdefghijklmnopqrstuvwxyz ' NEW_LINE p = { i : [ ] for i in c } NEW_LINE for i , j in enumerate ( a ) : p [ j ] . append ( i ) NEW_LINE if any ( j in b and not p [ j ] for j in c ) : NEW_LINE INDENT print ( - 1 ) else : NEW_LINE k , s = - 1 , 1 NEW_LINE DEDENT for j in b : q = p [ j ] NEW_LINE if k < q [ - 1 ] : NEW_LINE INDENT k = q [ bisect_right ( q , k ) ] else : NEW_LINE k , s = q [ 0 ] , s + 1 NEW_LINE DEDENT print ( s ) NEW_LINE" ]
codeforces_1107_B
[ "import java . util . Scanner ;   public class _0707Digitalroot {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; for ( int i = 0 ; i < n ; i ++ ) { long k = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; System . out . println ( ( ( k - 1 ) * 9L ) + x ) ; } }   }", "import java . util . * ; import java . io . * ; public class EdE { static long [ ] mods = { 1000000007 , 998244353 , 1000000009 } ; static long mod = mods [ 0 ] ; public static MyScanner sc ; public static PrintWriter out ; public static void main ( String [ ] omkar ) throws Exception {", "  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 t , k , i ; long n ; t = sc . nextInt ( ) ; while ( t > 0 ) { t -- ; n = sc . nextLong ( ) ; k = sc . nextInt ( ) ; System . out . println ( k + ( n - 1 ) * 9 ) ; } } catch ( Exception e ) { } } }", "import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- != 0 ) { long k = s . nextLong ( ) ; long x = s . nextLong ( ) ; System . out . println ( x + ( 9 * ( k - 1 ) ) ) ; } } }" ]
[ "for _ in range ( int ( input ( ) ) ) : k , x = map ( int , input ( ) . split ( ) ) print ( 9 * ( k - 1 ) + x ) NEW_LINE", "n = int ( input ( ) ) for i in range ( n ) : k , x = input ( ) . split ( \" ▁ \" )   k = int ( k ) x = int ( x ) if k == 1 : print ( x ) else : sum = ( ( k - 1 ) * 9 ) + x print ( sum ) NEW_LINE", "for i in range ( int ( input ( ) ) ) : k , x = map ( int , input ( ) . split ( ) ) print ( 9 * ( k - 1 ) + x ) NEW_LINE", "def solve ( ) : k , x = map ( int , input ( ) . split ( ) ) print ( 9 * ( k - 1 ) + x )   t = int ( input ( ) ) for _ in range ( t ) : solve ( ) NEW_LINE", "t = int ( input ( ) ) lst = [ ] res = [ ] for i in range ( 0 , t ) : lst = [ int ( i ) for i in input ( ) . split ( ) ] ele = 9 * lst [ 0 ] + lst [ 1 ] - 9 res . append ( ele )   for i in range ( 0 , t ) : print ( res [ i ] ) NEW_LINE" ]
codeforces_289_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 ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int diff = 0 ; while ( n -- > 0 ) { int i = sc . nextInt ( ) , j = sc . nextInt ( ) ; diff += j - i + 1 ; }   int m = ( diff + k - 1 ) / k ; out . println ( k * m - diff ) ; out . close ( ) ; }      ", "import java . util . * ; import java . io . * ; public class Main { public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter so = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int l = in . nextInt ( ) ; int r = in . nextInt ( ) ; ans += r - l + 1 ; } if ( ans % k == 0 ) so . println ( \"0\" ) ; else so . println ( ( int ) Math . ceil ( ( double ) ans / k ) * k - ans ) ; so . flush ( ) ; } 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 ( ) ) ; }   int [ ] readIntArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   long [ ] readLongArray ( int n ) { long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }", "import java . util . * ;   public class Problems { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int k = input . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ 2 ] ; int i , i2 ; int covered = 0 ; for ( i = 0 ; i < n ; i ++ ) { for ( i2 = 0 ; i2 < 2 ; i2 ++ ) { a [ i ] [ i2 ] = input . nextInt ( ) ; } covered = covered + ( ( a [ i ] [ 1 ] - a [ i ] [ 0 ] ) + 1 ) ; } covered = covered % k ; if ( covered != 0 ) { covered = k - covered ; } System . out . println ( covered ) ; } }", "import java . util . * ; import java . math . * ; public class PoloPenguin { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int out = 0 ; while ( n -- > 0 ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; out += r - l + 1 ; } if ( out <= k ) System . out . println ( k - out ) ; else { int num = ( int ) Math . ceil ( ( double ) out / ( double ) k ) ; k *= num ; System . out . println ( k - out ) ; } } }" ]
[ "n , k = input ( ) . split ( ) n = int ( n ) k = int ( k ) seg = 0 for i in range ( n ) : l , r = input ( ) . split ( ) l = int ( l ) r = int ( r ) seg += ( ( r - l ) + 1 ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) ans = 0 for i in range ( n ) : l , r = map ( int , input ( ) . split ( ) ) ans += r - l + 1 if ans % k == 0 : print ( 0 ) else : print ( k - ans % k ) NEW_LINE", "from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for i in range ( 1 ) : NEW_LINE", "s = [ int ( s ) for s in input ( ) . split ( ) ] d = [ ] total = 0 total_init = 0 for i in range ( s [ 0 ] ) : d . append ( [ int ( d ) for d in input ( ) . split ( ) ] ) for i in d : total += i [ 1 ] - i [ 0 ] + 1 total_init = totalif total % s [ 1 ] == 0 : print ( 0 ) else : while total % s [ 1 ] != 0 : total += 1 print ( total - total_init ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) arr = [ ] c = 0 for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) c = c + b - a + 1   if c % k == 0 : print ( 0 ) else : print ( k - c % k ) NEW_LINE" ]
codeforces_788_A
[ "import java . util . * ; import java . io . * ;   public class Functions_Again {   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 shuffle ( int [ ] a ) { Random r = new Random ( ) ;   for ( int i = 0 ; i <= a . length - 2 ; i ++ ) { int j = i + r . nextInt ( a . length - i ) ;   swap ( a , i , j ) ; }   Arrays . sort ( a ) ; }   public static void swap ( int [ ] a , int i , int j ) { int temp = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = temp ; }   public static void main ( String [ ] args ) {" ]
[ "import sys , os , ioimport math , bisect , operatorinf , mod = float ( ' inf ' ) , 10 ** 9 + 7 NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) l = [ abs ( a [ i + 1 ] - a [ i ] ) for i in range ( n - 1 ) ] dp = [ [ 0 , 0 ] for i in range ( n - 1 ) ] dp [ 0 ] [ 0 ] = l [ 0 ] ans = max ( dp [ 0 ] ) for i in range ( 1 , n - 1 ) : dp [ i ] = [ max ( dp [ i - 1 ] [ 1 ] + l [ i ] , l [ i ] ) , max ( dp [ i - 1 ] [ 0 ] - l [ i ] , - l [ i ] ) ] ans = max ( ans , max ( dp [ i ] ) ) print ( ans ) NEW_LINE", "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) d = [ ] for i in range ( n - 1 ) : a = 1 if i % 2 : a = - 1 d . append ( a * ( abs ( l [ i ] - l [ i + 1 ] ) ) )   s , b = 0 , 0 sm , bm = 0 , 0 for i in range ( n - 1 ) : s = max ( d [ i ] , s + d [ i ] ) b = max ( s , b )   for i in range ( 1 , n - 1 ) : sm = min ( d [ i ] , sm + d [ i ] ) bm = min ( sm , bm ) print ( max ( abs ( bm ) , abs ( b ) ) ) NEW_LINE", "import sysinput = sys . stdin . readline   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) d = [ 0 ] * nc = [ 0 ] * ne = [ 0 ] * nx = 1 mx = 0   for i in range ( 1 , n ) : d [ i ] = abs ( a [ i ] - a [ i - 1 ] )   for i in range ( 1 , n ) : c [ i ] = max ( 0 , c [ i - 1 ] + d [ i ] * x ) e [ i ] = max ( 0 , e [ i - 1 ] + d [ i ] * ( - x ) ) mx = max ( mx , max ( c [ i ] , e [ i ] ) ) x = - x   print ( mx ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) new = [ ] c = 1 for i in range ( n - 1 ) : new . append ( abs ( arr [ i ] - arr [ i + 1 ] ) * c ) c *= - 1 s = 0 s1 = 0 m = 0 for i in range ( n - 1 ) : s += new [ i ] if s < 0 : s = 0 if i > 0 : s1 += - new [ i ] if s1 < 0 : s1 = 0 m = max ( m , s1 ) m = max ( m , s ) print ( m ) NEW_LINE" ]
codeforces_651_B
[ "import java . util . * ; import java . lang . * ; import java . math . BigInteger ;", "  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 . Map . Entry ; import java . util . Scanner ; import java . util . Set ; import java . util . StringTokenizer ;    @ SuppressWarnings ( \" unused \" ) public class A { public static FastScannerA scan = new FastScannerA ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; static void sort ( int [ ] a ) { ArrayList < Integer > l = new ArrayList < > ( ) ; for ( int i : a ) l . add ( i ) ; Collections . sort ( l ) ; for ( int i = 0 ; i < a . length ; i ++ ) a [ i ] = l . get ( i ) ; } public static void solve ( ) { int n = scan . nextInt ( ) ; int [ ] a = scan . readArray ( n ) ; int [ ] last = new int [ 1010 ] ; int cnt = 0 ; sort ( a ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j <= 1000 ; j ++ ) { if ( a [ i ] > last [ j ] ) { if ( last [ j ] > 0 ) { cnt ++ ; } last [ j ] = a [ i ] ; break ; } } }", "import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ;   public class beautifulpaintings {   public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;   int n = Integer . parseInt ( in . readLine ( ) ) ; StringTokenizer st = new StringTokenizer ( in . readLine ( ) ) ; ArrayList < Integer > nums = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int num = Integer . parseInt ( st . nextToken ( ) ) ; nums . add ( num ) ; } Collections . sort ( nums ) ; int last = nums . remove ( 0 ) ; int count = 0 ; for ( int i = 1 ; i < n ; i ++ ) { int next = - 1 ; for ( int j = 0 ; j < nums . size ( ) ; j ++ ) { if ( nums . get ( j ) > last ) { next = j ; break ; } } if ( next != - 1 ) { last = nums . remove ( next ) ; count ++ ; } else { last = nums . remove ( 0 ) ; } } out . println ( count ) ; in . close ( ) ; out . close ( ) ; } }", "import java . util . Scanner ;   public class BeautifulPaintings651 {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int count [ ] = new int [ 1001 ] ; int max = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { max = Math . max ( max , ++ count [ scan . nextInt ( ) ] ) ; } System . out . println ( n - max ) ; } }", "import java . util . Scanner ; import java . util . Arrays ; import java . util . HashSet ; public class Main { public static void main ( String [ ] args ) { Scanner puttingvaluesinside = new Scanner ( System . in ) ; int arr [ ] [ ] = new int [ 1001 ] [ 1001 ] ; int t = puttingvaluesinside . nextInt ( ) ; while ( t -- > 0 ) { int temp = puttingvaluesinside . nextInt ( ) ; for ( int i = 0 ; i < arr . length ; i ++ ) { if ( arr [ i ] [ temp ] == 0 ) { arr [ i ] [ temp ] = 1 ; break ; } } } int ans = 0 ; for ( int i = 0 ; i < arr . length ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < arr . length ; j ++ ) { if ( arr [ i ] [ j ] == 1 ) count ++ ; } if ( count == 0 ) break ; ans += count - 1 ; } System . out . println ( ans ) ; } }" ]
[ "n = int ( input ( ) ) A = [ int ( a ) for a in input ( ) . split ( ) ] A . sort ( ) last = A [ 0 ] c = 0 aux = 0 for i in range ( n ) : a = A [ i ] if a == last : aux += 1 else : aux = 1 last = A [ i ] c = max ( c , aux ) print ( n - c ) NEW_LINE", "import collectionsn = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) cs = collections . Counter ( arr ) ans = 0 while cs : ans += len ( cs ) - 1 for k in list ( cs . keys ( ) ) : cs [ k ] -= 1 if not cs [ k ] : del cs [ k ] print ( ans ) NEW_LINE", "n = int ( input ( ) ) arr = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) t = 0 i = 0j = 0 while i < len ( arr ) and j < len ( arr ) : if arr [ i ] < arr [ j ] : i += 1 t += 1 j += 1 elif arr [ i ] == arr [ j ] : j += 1 print ( t ) NEW_LINE", "'''   ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Online ▁ Python ▁ Compiler . ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Code , ▁ Compile , ▁ Run ▁ and ▁ Debug ▁ python ▁ program ▁ online . Write ▁ your ▁ code ▁ in ▁ this ▁ editor ▁ and ▁ press ▁ \" Run \" ▁ button ▁ to ▁ execute ▁ it .   ''' from collections import Countern = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) c = Counter ( l ) s = list ( set ( l ) ) s . sort ( ) cn = 0 while ( True ) : for i in range ( len ( s ) ) : if ( c [ s [ i ] ] != 0 ) : NEW_LINE" ]
codeforces_1239_A
[ "import java . io . * ; import java . util . StringTokenizer ;    public class ivanTheFool { public static long mod = 1000000007 ; public static void fout ( long x ) { System . out . println ( x ) ; } 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 long pmod ( long x , long y ) { long r = 1 ; while ( y > 0 ) { if ( y % 2 == 1 ) { r = ( r * x ) % mod ; } x = ( x * x ) % mod ; y >>= 1 ; } return r ; }   public static void main ( String [ ] args ) { FastReader rd = new FastReader ( ) ; long n , m ; n = rd . nextLong ( ) ; m = rd . nextLong ( ) ; long answer = 0 ; long [ ] fact = new long [ 200000 ] ; fact [ 0 ] = 1 ; for ( long i = 1 ; i < 200000 ; ++ i ) { fact [ ( int ) i ] = ( fact [ ( int ) i - 1 ] * i ) % mod ; } answer += 2 ;", "import java . io . File ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class p004 { 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 m = Integer . parseInt ( stok . nextToken ( ) ) ; long mod = ( long ) 1e9 + 7 ; long [ ] [ ] dp = new long [ 100005 ] [ 2 ] ; dp [ 1 ] [ 0 ] = 2 ; for ( int i = 2 ; i <= 100000 ; i ++ ) { dp [ i ] [ 0 ] = ( dp [ i - 1 ] [ 0 ] + dp [ i - 1 ] [ 1 ] ) % mod ; dp [ i ] [ 1 ] = dp [ i - 1 ] [ 0 ] ; } long tot = ( dp [ n ] [ 0 ] + dp [ n ] [ 1 ] + dp [ m ] [ 0 ] + dp [ m ] [ 1 ] + mod - 2 ) % mod ; System . out . println ( tot ) ; } }" ]
[ "import io , osinput = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readlinen , m = list ( map ( int , input ( ) . split ( ) ) ) z = ( 10 ** 9 ) + 7 fib = [ 0 , 1 , 2 ] for i in range ( 3 , max ( n , m ) + 1 ) : fib . append ( ( fib [ - 1 ] + fib [ - 2 ] ) % z ) print ( ( 2 * ( ( fib [ n ] + fib [ m ] - 1 ) % z ) ) % z ) NEW_LINE", "from sys import stdininput = lambda : stdin . readline ( ) . strip ( ) lin = lambda : list ( map ( int , input ( ) . split ( ) ) ) iin = lambda : int ( input ( ) ) main = lambda : map ( int , input ( ) . split ( ) ) from math import ceil , sqrt , factorial , logfrom collections import dequefrom bisect import bisect_leftmod = 998244353 mod = 1000000007 def gcd ( a , b ) : a , b = max ( a , b ) , min ( a , b ) while a % b != 0 : a , b = b , a % b return bdef moduloinverse ( a ) : return ( pow ( a , mod - 2 , mod ) ) def solve ( we ) : n , m = main ( ) fib = [ 1 , 1 ] for i in range ( max ( n , m ) + 3 ) : fib . append ( ( fib [ - 1 ] + fib [ - 2 ] ) % mod ) print ( ( 2 * ( fib [ n ] + fib [ m ] - 1 ) ) % mod ) qwe = 1 NEW_LINE" ]
codeforces_1443_A
[ "import java . util . Scanner ;   public class A1443 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; StringBuilder output = new StringBuilder ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; for ( int n = 1 ; n <= N ; n ++ ) { output . append ( 2 * ( N + n ) ) . append ( ' ▁ ' ) ; } output . append ( ' \\n ' ) ; } System . out . print ( output ) ; }   }", "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 ) {", "import java . util . * ;   public class Main { static boolean judge ( int a , int b ) { if ( a % b == 0 || b % a == 0 ) { return false ; } return true ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- != 0 ) { int n = sc . nextInt ( ) ; Queue < Integer > q = new LinkedList < > ( ) ; int i = 4 ; q . offer ( i ) ; while ( true ) { if ( q . size ( ) == n ) break ; i += 2 ; int mid = q . element ( ) ; if ( judge ( mid , i ) ) { q . add ( i ) ; } else { q . remove ( ) ; q . add ( i ) ; } } for ( int j = 0 ; j < n ; j ++ ) { System . out . print ( q . poll ( ) + \" ▁ \" ) ; } System . out . println ( ) ; } } }", "import java . util . Scanner ;   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 mid = 2 * n ; int count = n ; for ( int i = 4 * n ; i > mid && count > 0 ; i -= 2 ) { System . out . print ( i + \" ▁ \" ) ; count -- ; } System . out . println ( ) ; } sc . close ( ) ; }   }" ]
[ "for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE for i in range ( n ) : print ( 4 * n - 2 * i , end = ' ▁ ' ) NEW_LINE print ( ) NEW_LINE", "import sys   NEW_LINE def main ( ) : _ , * l = map ( int , sys . stdin . read ( ) . strip ( ) . split ( ) ) NEW_LINE out = [ ] NEW_LINE for n in l : out . append ( ' ▁ ' . join ( map ( str , range ( 4 * n , 2 * n , - 2 ) ) ) ) NEW_LINE return out NEW_LINE print ( * main ( ) , sep = ' \\n ' ) NEW_LINE", "import sys   input = sys . stdin . buffer . readlinet = int ( input ( ) )   for _ in range ( t ) : n = int ( input ( ) )   print ( * range ( 2 * n + 2 , 4 * n + 1 , 2 ) ) NEW_LINE", "import sys   input = sys . stdin . buffer . readlinet = int ( input ( ) )   for _ in range ( t ) : n = int ( input ( ) )   print ( \" ▁ \" . join ( list ( map ( str , list ( range ( 2 * n + 2 , 4 * n + 1 , 2 ) ) ) ) ) ) NEW_LINE", "def string_list ( s , char ) : output_list = [ ] NEW_LINE intermediator = \" \" NEW_LINE for i in range ( len ( s ) ) : if NEW_LINE s [ i ] != char : intermediator += s [ i ] NEW_LINE if i == len ( s ) - 1 : NEW_LINE INDENT output_list . append ( int ( intermediator ) ) else : NEW_LINE if NEW_LINE DEDENT intermediator : output_list . append ( int ( intermediator ) ) NEW_LINE intermediator = \" \" NEW_LINE return output_list     NEW_LINE def list_string ( l , char ) : output_str = \" \" NEW_LINE for i in range ( len ( l ) - 1 ) : output_str += str ( l [ i ] ) + char NEW_LINE output_str += str ( l [ len ( l ) - 1 ] ) NEW_LINE return output_str     NEW_LINE def merge_sort ( l ) : def NEW_LINE merge ( l1 , l2 ) : i , j = 0 , 0 NEW_LINE output_list = [ ] NEW_LINE while i < len ( l1 ) and j < len ( l2 ) : if NEW_LINE l1 [ i ] < l2 [ j ] : output_list . append ( l1 [ i ] ) NEW_LINE i += 1 else : output_list . append ( l2 [ j ] ) NEW_LINE j += 1 NEW_LINE if i == len ( l1 ) : NEW_LINE INDENT output_list += ( l2 [ j : ] ) else : NEW_LINE output_list += ( l1 [ i : ] ) NEW_LINE DEDENT return output_list   NEW_LINE def sorts ( l ) : if NEW_LINE len ( l ) < 2 : NEW_LINE return l else : mid = len ( l ) // 2 NEW_LINE left = sorts ( l [ : mid ] ) NEW_LINE right = sorts ( l [ mid : ] ) NEW_LINE return merge ( left , right ) NEW_LINE return sorts ( l )       NEW_LINE def main_function ( ) : output_list = [ ] NEW_LINE t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE output_list . append ( list_string ( [ 4 * n - i for i in range ( 2 * n ) if not i % 2 ] , \" ▁ \" ) ) NEW_LINE return list_string ( output_list , \" \\n \" )       print ( main_function ( ) )   NEW_LINE" ]
codeforces_158_B
[ "import javax . print . DocFlavor ; import javax . swing . * ; import java . awt . image . BandedSampleModel ; import java . util . * ;   public class Example { static long [ ] [ ] dp ;", "import java . io . * ; import java . util . * ; public class Solution { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] ip = br . readLine ( ) . split ( \" ▁ \" ) ; int c1 = 0 , c2 = 0 , c3 = 0 , c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( Integer . parseInt ( ip [ i ] ) == 4 ) c = c + 1 ; else if ( Integer . parseInt ( ip [ i ] ) == 1 ) c1 = c1 + 1 ; else if ( Integer . parseInt ( ip [ i ] ) == 2 ) c2 = c2 + 1 ; else if ( Integer . parseInt ( ip [ i ] ) == 3 ) c3 = c3 + 1 ; } c = c + c3 ; c1 = ( c3 >= c1 ) ? 0 : c1 - c3 ; if ( c2 % 2 == 0 ) { c = c + ( c2 / 2 ) ; c = c + ( c1 % 4 == 0 ? c1 / 4 : ( c1 / 4 ) + 1 ) ; } else { c2 = ( c2 * 2 ) + c1 ; c = c + ( c2 % 4 == 0 ? c2 / 4 : ( c2 / 4 ) + 1 ) ; } System . out . println ( c ) ; } }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { int count = 0 ; int count1 = 0 ; int count2 = 0 ; int count3 = 0 ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 4 ) { arr [ i ] = 0 ; count ++ ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 3 ) { count3 ++ ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 2 ) { count2 ++ ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 1 ) { count1 ++ ; } } if ( count3 > count1 ) { count = count1 + count ; count3 = count3 - count1 ; count1 = 0 ; count = count + count1 ; count = count + count3 ; count3 = 0 ; count1 = 0 ;   }   else { count = count3 + count ; count1 = count1 - count3 ; count3 = 0 ; } count = ( count2 / 2 ) + count ; if ( count2 % 2 != 0 ) { if ( count1 < 3 ) { count ++ ; count1 = 0 ; count2 = 0 ; } else { count1 = count1 - 2 ; count ++ ; count2 = 0 ; } } count = count + ( count1 / 4 ) ; if ( count1 % 4 > 0 ) { count ++ ; } System . out . println ( count ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;", "import javax . print . DocFlavor ; import javax . swing . * ; import java . awt . image . BandedSampleModel ; import java . util . * ;   public class Example { static long [ ] [ ] dp ;" ]
[ "input ( ) ; a , b , c , d = map ( input ( ) . count , ( '1' , '2' , '3' , '4' ) ) ; print ( d + c + ( b * 2 + max ( 0 , a - c ) + 3 ) // 4 ) NEW_LINE", "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) a = l . count ( 1 ) b = l . count ( 2 ) c = l . count ( 3 ) d = l . count ( 4 ) res = dres += ca -= cif b % 2 == 0 : res += b // 2 else : res += ( b // 2 ) + 1 a -= 2 if a > 0 : if a % 4 != 0 : res += ( a // 4 ) + 1 else : res += a // 4 print ( res ) NEW_LINE", "from math import ceil   n = int ( input ( ) ) s = [ int ( si ) for si in input ( ) . split ( ) ]   count = { 1 : 0 , 2 : 0 , 3 : 0 , 4 : 0 } for si in s : count [ si ] += 1   NEW_LINE", "a = [ * open ( 0 ) ] [ 1 ] . count ; print ( a ( '4' ) + a ( '3' ) + ( a ( '2' ) * 2 + max ( 0 , a ( '1' ) - a ( '3' ) ) + 3 ) // 4 ) NEW_LINE" ]
codeforces_1037_A
[ "import java . io . * ; import java . util . * ;   public class GFG { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int y = ( int ) ( ( double ) Math . log ( N ) / Math . log ( 2 ) ) ; System . out . println ( y + 1 ) ; } }", "import java . util . * ;   public class CodeForces1037A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; System . out . println ( ( long ) ( Math . log ( n ) / Math . log ( 2 ) ) + 1 ) ; } }", "import java . util . * ; import java . io . * ; public class Main { public static int mod = 1000000007 ; public static void solve ( InputReader in ) { int n = in . readInt ( ) ; int ans = 0 ; while ( n > 1 ) { ans ++ ; n /= 2 ; } System . out . println ( ans + 1 ) ; } public static void main ( String [ ] args ) {", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  ", "import java . util . Scanner ;    public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i <= 1000 ; i ++ ) { if ( Math . pow ( 2 , i ) > n ) { System . out . println ( i ) ; break ; } } }   }" ]
[ "a = int ( input ( ) )   n = acount = 0 arr = [ ]   while 1 : if 2 ** count <= a : arr . append ( 2 ** count ) n -= 2 ** count else : break if n <= 0 : break   count += 1   if n > 0 : arr . append ( n )   print ( len ( arr ) ) NEW_LINE", "print ( len ( bin ( int ( input ( ) ) ) [ 2 : ] ) ) NEW_LINE", "def solve ( num ) : ans = 0 power = 0 while ans < num : ans += 2 ** power power += 1 return power print ( solve ( int ( input ( ) ) ) )   NEW_LINE", "t = int ( input ( ) ) i = 1 k = 0 x = 0 while x < t : x = x + i i = i * 2 k = k + 1 print ( k ) NEW_LINE", "n = int ( input ( ) ) for i in range ( 1 , 35 ) : if 2 ** i - 1 >= n : print ( i ) ; break NEW_LINE" ]
codeforces_439_A
[ "import java . util . * ; public class SingerAndComedian {   public static void main ( String [ ] args ) {", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {", "import java . util . Scanner ;   public class sinngerjocker { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int event_num = sc . nextInt ( ) ; int toatl_time = sc . nextInt ( ) ; int sum = 0 ; int total_jokes = 0 ; int arr [ ] = new int [ event_num ] ; for ( int i = 0 ; i < event_num ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; sum = sum + arr [ i ] ;   }   if ( toatl_time < sum + ( event_num - 1 ) * 10 ) { System . out . println ( \" - 1\" ) ; return ; } else { total_jokes = ( ( ( event_num - 1 ) * 10 ) / 5 ) + ( toatl_time - ( sum + ( event_num - 1 ) * 10 ) ) / 5 ; System . out . println ( total_jokes ) ;   } }    }", "import java . util . * ; public class DevuTheSinger { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ;   int [ ] arr = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; sum += arr [ i ] ; } sc . close ( ) ;   if ( ( sum + ( n - 1 ) * 10 ) <= d ) { int ans = ( n - 1 ) * 2 ; ans = ans + ( d - ( sum + ( n - 1 ) * 10 ) ) / 5 ; System . out . println ( ans ) ; } else System . out . println ( - 1 ) ;    } }" ]
[ "import mathtotalTime = 0 n , d = input ( ) . split ( ) n = int ( n ) d = int ( d ) songList = list ( map ( int , input ( ) . split ( ) ) ) initialJokeCount = 0 for i in range ( n ) : if ( i != n - 1 ) : totalTime += songList [ i ] + 10 initialJokeCount += 2 else : totalTime += songList [ i ]   if ( totalTime > d ) : print ( - 1 ) else : remainingTime = d - totalTime ; remainingJokeCount = math . floor ( remainingTime / 5 ) print ( initialJokeCount + remainingJokeCount ) NEW_LINE", "n , d = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   if ( sum ( arr ) + ( n - 1 ) * 10 ) > d : print ( - 1 ) else : ans = ( d - sum ( arr ) ) // 5 print ( ans ) NEW_LINE", "n , d = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) s = sum ( l ) + ( n - 1 ) * 10   if ( s > d ) : print ( - 1 ) else : x = ( n - 1 ) * 2 x += ( d - s ) // 5 print ( x ) NEW_LINE", "import sysfrom os import pathif ( path . exists ( ' input . txt ' ) and path . exists ( ' output . txt ' ) ) : sys . stdout = open ( ' output . txt ' , ' w ' ) sys . stdin = open ( ' input . txt ' , ' r ' )     def main ( ) : N , D = map ( int , input ( ) . split ( ) ) times = list ( map ( int , input ( ) . split ( ) ) ) crack = 0 for i in range ( N ) : if i < N - 1 : D -= times [ i ] + 10 crack += 2 else : D -= times [ i ] crack += D // 5   if D < 0 : print ( - 1 ) else : print ( crack )       main ( ) NEW_LINE" ]
codeforces_2_A
[ "import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ;   public class MyClass { 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 ( ) ) ; String name [ ] = new String [ n ] ; int [ ] ar = new int [ n ] ; HashMap < String , Integer > m = new HashMap < String , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; name [ i ] = st . nextToken ( ) ; ar [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; m . put ( name [ i ] , m . getOrDefault ( name [ i ] , 0 ) + ar [ i ] ) ; } int max = - 10000000 ; for ( String s : m . keySet ( ) ) { max = Math . max ( max , m . get ( s ) ) ; } HashMap < String , Integer > map = ( HashMap ) m . clone ( ) ; m . clear ( ) ; for ( int i = 0 ; i < n ; i ++ ) { m . put ( name [ i ] , m . getOrDefault ( name [ i ] , 0 ) + ar [ i ] ) ; if ( m . get ( name [ i ] ) >= max && map . get ( name [ i ] ) == max ) { sb . append ( name [ i ] + \" \\n \" ) ; break ; } } System . out . print ( sb ) ; } }", "import java . util . * ;   public class P2A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Map < String , Integer > map = new HashMap < > ( ) ; int t = sc . nextInt ( ) ; int max = Integer . MIN_VALUE , k = 0 ; String ansName = \" \" ; String [ ] names = new String [ t ] ; int [ ] scores = new int [ t ] ; while ( t -- > 0 ) { String name = sc . next ( ) ; int score = sc . nextInt ( ) ; map . put ( name , map . getOrDefault ( name , 0 ) + score ) ; int curVal = map . get ( name ) ; names [ k ] = name ; scores [ k ] = map . get ( name ) ; k ++ ; } max = Collections . max ( map . values ( ) ) ; for ( int i = 0 ; i < names . length ; i ++ ) { if ( map . get ( names [ i ] ) == max && max <= scores [ i ] ) { ansName = names [ i ] ; break ; } } System . out . println ( ansName ) ; } }", "import java . util . HashSet ; import java . util . Scanner ; import java . util . HashMap ;   public class Winner { public static void main ( final String [ ] parameters ) { Scanner input = new Scanner ( System . in ) ; int totalLines = input . nextInt ( ) ; String [ ] players = new String [ totalLines ] ; int [ ] scores = new int [ totalLines ] ; HashMap < String , Integer > scoreBoard = new HashMap < > ( ) ;   for ( int index = 0 ; index < totalLines ; index ++ ) { players [ index ] = input . next ( ) ; scores [ index ] = input . nextInt ( ) ;   scoreBoard . put ( players [ index ] , scoreBoard . getOrDefault ( players [ index ] , 0 ) + scores [ index ] ) ; }   HashSet < String > winners = new HashSet < > ( ) ; int maximumScore = Integer . MIN_VALUE ;   for ( String key : scoreBoard . keySet ( ) ) { if ( scoreBoard . get ( key ) > maximumScore ) { winners . clear ( ) ; winners . add ( key ) ; maximumScore = scoreBoard . get ( key ) ; } else if ( scoreBoard . get ( key ) == maximumScore ) { winners . add ( key ) ; } }    scoreBoard . clear ( ) ; String result = \" \" ;   for ( int index = 0 ; index < totalLines ; index ++ ) { String player = players [ index ] ; int playerScore = scoreBoard . getOrDefault ( player , 0 ) + scores [ index ] ;   if ( playerScore >= maximumScore && winners . contains ( player ) ) { result = player ; break ; }   scoreBoard . put ( player , playerScore ) ; }   System . out . println ( result ) ;    } }" ]
[ "n = int ( input ( ) ) d = { } q = [ ]   for i in range ( n ) : x , y = input ( ) . split ( ) y = int ( y ) q . append ( [ x , y ] ) d [ x ] = d . get ( x , 0 ) + yans = max ( d . values ( ) ) ma = { } for x , y in q : ma [ x ] = ma . get ( x , 0 ) + y if ma [ x ] >= ans and d [ x ] == ans : print ( x ) break NEW_LINE", "from sys import * input = stdin . readlinet = int ( input ( ) ) l = { } level = [ ] for i in range ( t ) : s , p = map ( str , input ( ) . split ( ) ) p = int ( p ) l [ s ] = l . get ( s , 0 ) + p level . append ( [ l [ s ] , s ] ) res = list ( l . values ( ) ) maxp = max ( res ) name = [ ] for i in l : if ( l [ i ] == maxp ) : name . append ( i ) for i in level : if ( i [ 0 ] >= maxp and i [ 1 ] in name ) : print ( i [ 1 ] ) break   NEW_LINE", "      def main ( ) : n = int ( input ( ) ) scores = dict ( ) book = list ( ) for i in range ( n ) : name , score = input ( ) . split ( ) scores [ name ] = scores . setdefault ( name , 0 ) + int ( score ) book . append ( [ name , int ( score ) ] ) m = max ( scores . values ( ) ) winners = dict ( ) for k , v in scores . items ( ) : if v == m : winners . setdefault ( k , 0 ) for round in book : if round [ 0 ] in winners . keys ( ) : winners [ round [ 0 ] ] += round [ 1 ] if ( winners [ round [ 0 ] ] >= m ) : print ( round [ 0 ] ) break return   if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE" ]
codeforces_260_A
[ "import java . util . Scanner ;   public class AddingDigits { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) * 10 , b = in . nextInt ( ) , n = in . nextInt ( ) , i , j ; in . close ( ) ;   for ( i = 9 ; i >= 0 ; i -- ) { if ( ( a + i ) % b == 0 ) { System . out . print ( a + i ) ; for ( j = 0 ; j < n - 1 ; j ++ ) System . out . print ( 0 ) ; return ; } } System . out . println ( - 1 ) ; } }", "import java . util . * ; import java . io . * ; public class A { static FastReader in = new FastReader ( ) ; static final Random random = new Random ( ) ; static long mod = 1000000007L ; public static void main ( String args [ ] ) throws IOException { int t = 1 ;", "  import javax . swing . plaf . IconUIResource ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class codeforces { static int M = 1_000_000_007 ; static int INF = Integer . MAX_VALUE ; static final FastScanner fs = new FastScanner ( ) ;  " ]
[ "a , b , n = [ int ( x ) for x in input ( ) . split ( ) ] for i in range ( 10 ) : temp = str ( a ) + str ( i ) if ( int ( temp ) % b == 0 ) : a = temp breakif ( int ( a ) % b != 0 ) : a = - 1 else : a = a + ( '0' * ( n - 1 ) ) print ( a ) NEW_LINE", "a , b , n = map ( int , input ( ) . split ( ) ) x = str ( a ) flag = 0 for i in range ( 10 ) : if int ( str ( a ) + str ( i ) ) % b == 0 : x += str ( i ) flag = 1 breakif flag == 0 : print ( - 1 ) else : for i in range ( n - 1 ) : x += \"0\" print ( x ) NEW_LINE", "    def f ( a , b , c ) : res = None cnt = 0 for i in range ( 0 , 9 + 1 ) : if int ( str ( a ) + str ( i ) ) % b == 0 : res = str ( a ) + str ( i ) break     if res == None : return - 1 return res + ( c - 1 ) * \"0\"         a , b , c = map ( int , input ( ) . strip ( ) . split ( ) ) print ( f ( a , b , c ) ) NEW_LINE", "a , b , n = map ( int , input ( ) . split ( ) ) a = a * 10 + 9 mod = a % bif mod > 9 : print ( - 1 ) exit ( ) else : a -= moda = str ( a ) + '0' * ( n - 1 ) print ( a ) NEW_LINE", "a , b , n = map ( int , input ( ) . split ( \" ▁ \" ) ) fixed_length = len ( str ( a ) ) if a % b == 0 : print ( a * 10 ** n ) else : while len ( str ( a ) ) != fixed_length + n : flag = False for digit in range ( 10 ) : if int ( str ( a ) + str ( digit ) ) % b == 0 : a = int ( str ( a ) + str ( digit ) ) flag = True break if flag == False : print ( - 1 ) break if a % b == 0 : a *= 10 ** ( n - ( len ( str ( a ) ) - fixed_length ) ) breakif len ( str ( a ) ) == n + fixed_length : print ( a )   ''' brute ▁ force ▁ przeciez ▁ po ▁ osiagnieciu ▁ pierwszej ▁ podzielnoscimozesz ▁ dodac ▁ tylko ▁ zera ▁ i ▁ koniec ▁ algorytmu ''' NEW_LINE" ]
codeforces_394_B
[ "import java . util . * ; import java . io . * ; import static java . lang . System . out ; import static java . util . Arrays . * ; import static java . lang . Math . * ; public class ContestMain { private static Reader in = new Reader ( ) ; private static StringBuilder ans = new StringBuilder ( ) ; private static long MOD = 1000000007 ;", "import java . io . * ; import java . math . BigInteger ; import java . util . * ;   public class Template implements Runnable {   BufferedReader in ; PrintWriter out ; StringTokenizer tok = new StringTokenizer ( \" \" ) ;   void init ( ) throws FileNotFoundException { try { in = new BufferedReader ( new FileReader ( \" input . txt \" ) ) ; out = new PrintWriter ( \" output . txt \" ) ; } catch ( Exception e ) { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; } }   String readString ( ) throws IOException { while ( ! tok . hasMoreTokens ( ) ) { try { tok = new StringTokenizer ( in . readLine ( ) ) ; } catch ( Exception e ) { return null ; } } return tok . nextToken ( ) ; }   int readInt ( ) throws IOException { return Integer . parseInt ( readString ( ) ) ; }   int [ ] readIntArray ( int size ) throws IOException { int [ ] res = new int [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { res [ i ] = readInt ( ) ; } return res ; }   long readLong ( ) throws IOException { return Long . parseLong ( readString ( ) ) ; }   double readDouble ( ) throws IOException { return Double . parseDouble ( readString ( ) ) ; }   < T > List < T > [ ] createGraphList ( int size ) { List < T > [ ] list = new List [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { list [ i ] = new ArrayList < > ( ) ; } return list ; }   public static void main ( String [ ] args ) { new Template ( ) . run ( ) ;", "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class B394 { public static void main ( String [ ] args ) { InputReader in = new InputReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; final long start = System . currentTimeMillis ( ) ; new Task1 ( ) . solve ( in , out ) ; final long duration = System . currentTimeMillis ( ) - start ; out . close ( ) ; }   static class Task1 { public void solve ( InputReader in , PrintWriter out ) { int p = in . nextInt ( ) , x = in . nextInt ( ) ; int [ ] ans ; for ( int last = 1 ; last <= 9 ; last ++ ) { ans = new int [ p ] ; ans [ p - 1 ] = last ; int carry = 0 ;   for ( int i = p - 2 ; i >= 0 ; i -- ) { int temp = ( ans [ i + 1 ] * x + carry ) ; ans [ i ] = temp % 10 ; carry = temp / 10 ; }   if ( ( ans [ 0 ] * x + carry ) == ans [ p - 1 ] && ans [ 0 ] != 0 ) {" ]
[ "p , k = input ( ) . split ( )   p = int ( p ) k = int ( k )   y = 10 * k - 1 x = ( ( 10 ** ( p - 1 ) ) - k ) % y     b = True   for i in range ( k , 10 ) : if ( ( x * i % y ) == 0 ) : NEW_LINE", "p , k = map ( int , input ( ) . split ( ) ) u = 10 * k - 1 v = pow ( 10 , p - 1 , u ) - kfor y in range ( k , 10 ) : if ( y * v ) % u == 0 : q = d = 9 * y while q % u : q = 10 * q + d q = str ( q // u ) print ( q * ( p // len ( q ) ) ) breakelse : print ( ' Impossible ' ) NEW_LINE", "p , k = map ( int , input ( ) . split ( ) ) u = 10 * k - 1 v = pow ( 10 , p - 1 , u ) - kfor y in range ( k , 10 ) : if ( y * v ) % u == 0 : q = d = 9 * y while q % u : q = 10 * q + d q = str ( q // u ) print ( q * ( p // len ( q ) ) ) breakelse : print ( ' Impossible ' ) NEW_LINE", "p , k = map ( int , input ( ) . split ( ) ) u = 10 * k - 1 v = pow ( 10 , p - 1 , u ) - kfor y in range ( k , 10 ) : if ( y * v ) % u == 0 : q = d = 9 * y while q % u : q = 10 * q + d q = str ( q // u ) print ( q * ( p // len ( q ) ) ) breakelse : print ( ' Impossible ' )         NEW_LINE", "p , k = input ( ) . split ( )   p = int ( p ) k = int ( k )   y = 10 * k - 1 x = ( ( 10 ** ( p - 1 ) ) - k ) % y     b = True   for i in range ( k , 10 ) : if ( ( x * i % y ) == 0 ) : NEW_LINE" ]
codeforces_809_A
[ "import java . io . BufferedReader ; import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . nio . file . Paths ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . StringTokenizer ;   public class FindingBorders {   public static void main ( String [ ] args ) throws Exception {  " ]
[ "MOD = int ( 1e9 + 7 ) n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr . sort ( ) l = 1 ; r = 0 for i in range ( n ) : r = ( r + l * arr [ i ] ) % MOD l = l * 2 % MODl = 1 for i in range ( n - 1 , - 1 , - 1 ) : r = ( r - l * arr [ i ] ) % MOD l = l * 2 % MODprint ( r ) NEW_LINE", "n , x = int ( input ( ) ) , list ( sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) ) kk = 1 a = 0 for i in range ( len ( x ) ) : a += ( x [ i ] - x [ len ( x ) - i - 1 ] ) * kk kk *= 2 kk %= 1000000007 a %= 1000000007 print ( a ) NEW_LINE", "n = int ( input ( ) ) V = list ( map ( int , input ( ) . split ( ) ) ) V . sort ( ) Mod = int ( 1e9 + 7 ) Sum = 0 p = [ 1 ] for i in range ( n ) : p . append ( p [ i ] * 2 % Mod ) for i in range ( n - 1 ) : l = ( p [ i + 1 ] + Mod - 1 ) % Mod r = ( p [ n - i - 1 ] - 1 + Mod ) % Mod Sum = ( Sum + ( V [ i + 1 ] - V [ i ] ) * l * r ) % Modprint ( int ( Sum ) ) NEW_LINE", "import sysinput = sys . stdin . readline   n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) x . sort ( ) ans = 0 MOD = 10 ** 9 + 7   for i in range ( n - 1 ) : d = x [ i + 1 ] - x [ i ] l = pow ( 2 , i + 1 , MOD ) - 1 r = pow ( 2 , n - i - 1 , MOD ) - 1 ans += d * l * r ans %= MOD   print ( ans ) NEW_LINE", "n = int ( input ( ) ) ar = list ( map ( int , input ( ) . split ( ) ) ) ar . sort ( ) MOD = 10 ** 9 + 7 ans = 0 for i in range ( n ) : bef = i aft = n - i - 1 if bef < aft : ans -= ( ar [ i ] * ( pow ( 2 , aft , MOD ) - pow ( 2 , bef , MOD ) + MOD ) % MOD ) ans %= MOD elif aft < bef : ans += ( ar [ i ] * ( pow ( 2 , bef , MOD ) - pow ( 2 , aft , MOD ) + MOD ) % MOD ) ans %= MOD print ( ans ) NEW_LINE" ]
codeforces_319_B
[ "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   int N ; void run ( FastScanner in , PrintWriter out ) {   N = in . nextInt ( ) ;   ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class Solution { static final int inf = ( int ) 1e8 ; public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int tt = 1 ; while ( tt -- > 0 ) { int n = fs . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = fs . nextInt ( ) ;" ]
[ "n = int ( input ( ) ) A = [ int ( i ) for i in input ( ) . split ( ) ] ans = 0   st = [ 0 ]   tdeath = [ - 1 for i in range ( n ) ]   for i in range ( 1 , n ) : tdeath [ i ] = 0 while len ( st ) > 0 and A [ st [ - 1 ] ] < A [ i ] : tdeath [ i ] = max ( tdeath [ i ] , tdeath [ st [ - 1 ] ] + 1 ) st . pop ( ) if len ( st ) == 0 : tdeath [ i ] = - 1 st . append ( i ) ans = max ( ans , tdeath [ i ] + 1 ) print ( ans ) NEW_LINE", "n = int ( input ( ) ) A = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) [ : : - 1 ] p = 0 p_max = 0 X = [ ] for i in A : NEW_LINE", "N = int ( input ( ) ) psychos = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) time_of_death = [ 0 for i in range ( N ) ]   stack = [ ( psychos [ 0 ] , 0 ) ] for index , p in enumerate ( psychos ) : if index == 0 : continue if p < stack [ - 1 ] [ 0 ] : stack . append ( ( p , 1 ) ) time_of_death [ index ] = 1   elif p > stack [ - 1 ] [ 0 ] : max_time = - 1 while stack != [ ] and p > stack [ - 1 ] [ 0 ] : max_time = max ( max_time , stack [ - 1 ] [ 1 ] ) del stack [ - 1 ] if stack == [ ] : NEW_LINE", "def main ( ) :   from bisect import bisect_left as bl , bisect_right as br , insort import sys , math NEW_LINE" ]
codeforces_691_B
[ "import java . io . * ; import java . math . * ; import java . time . LocalDate ; import java . time . Month ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = Long . MAX_VALUE ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 100000007 ;   private static final int MAXN = 100 ; private static final int MAXA = 2000007 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;", "import java . io . * ; import java . math . * ; import java . time . LocalDate ; import java . time . Month ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = Long . MAX_VALUE ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 100000007 ;   private static final int MAXN = 100 ; private static final int MAXA = 2000007 ; 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 Main { public static void main ( String [ ] args ) throws java . lang . Exception {", "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 B691 {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;" ]
[ "def f ( a , b ) : kentuky = a + b in ( ' pq ' , ' qp ' , ' bd ' , ' db ' ) yo_bro = a == b and a in ' AHIMOoTUVvWwXxY ' return kentuky or yo_bro     s = input ( ) n = len ( s ) for i in range ( n ) : if not f ( s [ i ] , s [ n - i - 1 ] ) : print ( ' NIE ' ) breakelse : print ( ' TAK ' )   NEW_LINE", "import sys , os , iofrom sys import stdinfrom functools import cmp_to_keyfrom bisect import bisect_left , bisect_rightfrom collections import defaultdictdef ii ( ) : return int ( input ( ) ) def li ( ) : return list ( map ( int , input ( ) . split ( ) ) ) if ( os . path . exists ( ' input . txt ' ) ) : sys . stdin = open ( \" input . txt \" , \" r \" ) ; sys . stdout = open ( \" output . txt \" , \" w \" ) NEW_LINE", "a = { \" A \" : \" A \" , \" H \" : \" H \" , \" I \" : \" I \" , \" M \" : \" M \" , \" O \" : \" O \" , \" T \" : \" T \" , \" U \" : \" U \" , \" V \" : \" V \" , \" W \" : \" W \" , \" X \" : \" X \" , \" Y \" : \" Y \" , \" b \" : \" d \" , \" d \" : \" b \" , \" o \" : \" o \" , \" v \" : \" v \" , \" w \" : \" w \" , \" x \" : \" x \" , \" q \" : \" p \" , \" p \" : \" q \" } s = input ( ) . rstrip ( ) n = len ( s ) ans = \" TAK \" for i in range ( n // 2 ) : if a . get ( s [ i ] ) == None or a [ s [ i ] ] != s [ - ( i + 1 ) ] : ans = \" NIE \" breakif n % 2 and ( a . get ( s [ n // 2 ] ) == None or a [ s [ n // 2 ] ] != s [ n // 2 ] ) : ans = \" NIE \" print ( ans ) NEW_LINE" ]
codeforces_614_A
[ "import java . util . * ;   public class CodeForces614A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long l = input . nextLong ( ) ; long r = input . nextLong ( ) ; long k = input . nextLong ( ) ; long ans = 1 ; long c = 0 ; for ( int p = 0 ; p < 62 ; p ++ ) { if ( ans >= l && ans <= r ) { System . out . print ( ans + \" ▁ \" ) ; c ++ ; } if ( Math . log10 ( ans ) + Math . log10 ( k ) > 18 ) { break ; } else { ans *= k ; } } if ( c == 0 ) { System . out . println ( \" - 1\" ) ; } } }", "import java . io . File ; import java . math . BigInteger ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class p008 { public static void main ( String args [ ] ) throws Exception {", "import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . * ; import java . util . Comparator ;   public class scratch_25 { static class Reader { static BufferedReader reader ; static StringTokenizer tokenizer ;   static void init ( InputStream input ) { reader = new BufferedReader ( new InputStreamReader ( input ) ) ; tokenizer = new StringTokenizer ( \" \" ) ; }   static String next ( ) throws IOException { while ( ! tokenizer . hasMoreTokens ( ) ) {", "import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = true ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static int oo = ( int ) 2e9 ;" ]
[ "l , r , k = map ( int , input ( ) . split ( ) ) p = 1 while p < l : p = p * klis = [ ] while p >= l and p <= r : lis . append ( p ) p = p * kif not lis : print ( - 1 ) else : for i in lis : print ( i , end = ' ▁ ' ) NEW_LINE", "from math import logl , r , k = map ( int , input ( ) . split ( ) ) temp = int ( log ( l , k ) ) val = k ** tempif ( val < l ) : val *= kc = 0 while ( val <= r ) : print ( val , end = \" ▁ \" ) val *= k c += 1 if not c : print ( - 1 ) NEW_LINE", "l , r , k = map ( int , input ( ) . split ( ) ) ans = 1 ; c = 0 while ( ans < l ) : ans = ans * kwhile ( ans <= r ) : c = c + 1 print ( ans ) ans = ans * kif ( c == 0 ) : print ( - 1 ) NEW_LINE", "a = [ ] d = input ( ) . split ( ) l = int ( d [ 0 ] ) r = int ( d [ 1 ] ) k = int ( d [ 2 ] ) t = 1 ; a . append ( t ) ; while ( t < 10 ** 20 ) : t *= k ; a . append ( t ) ; cnt = 0 res = ' ' for i in range ( len ( a ) ) : if ( a [ i ] <= r and a [ i ] >= l ) : res += str ( a [ i ] ) + ' ▁ ' if ( len ( res ) <= 0 ) : print ( - 1 ) else : print ( res ) NEW_LINE", "  import math   l , r , k = map ( int , input ( ) . split ( ) )       h = 0 for j in range ( 10 ** 9 ) : if l <= k ** j <= r : print ( k ** j , end = ' ▁ ' ) h += 1 elif k ** j > r : break if h == 0 : print ( - 1 ) NEW_LINE" ]
codeforces_673_B
[ "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 ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BProblemsForRound solver = new BProblemsForRound ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class BProblemsForRound { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int low = 1 ; int high = n ; int a , b ; while ( m -- > 0 ) { a = in . nextInt ( ) ; b = in . nextInt ( ) ; if ( a > b ) { int temp = a ; a = b ; b = temp ; } low = Math . max ( low , a ) ; high = Math . min ( high , b ) ; } out . println ( Math . max ( 0 , high - low ) ) ; }   }   static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; }   public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }  ", "import sun . nio . cs . ext . MacThai ;   import java . io . * ; import java . util . * ; import java . lang . * ; import java . math . * ;    public class Main { static class sol { public static void solve ( InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int div2 = 1 , div1 = n ; int a , b ; for ( int i = 0 ; i < m ; i ++ ) { a = in . nextInt ( ) ; b = in . nextInt ( ) ; div2 = Math . max ( div2 , Math . min ( a , b ) ) ; div1 = Math . min ( div1 , Math . max ( a , b ) ) ; } if ( div1 - div2 >= 0 ) out . print ( div1 - div2 ) ; else out . print ( \"0\" ) ; } } public static void main ( String [ ] args ) throws FileNotFoundException { InputStream input = System . in ;", "import java . io . * ; import java . util . * ;   public class problemforround { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int low = 1 , high = n ; while ( m > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a > b ) { int c = a ; a = b ; b = c ; } low = Math . max ( low , a ) ; high = Math . min ( high , b ) ; -- m ; } System . out . println ( Math . max ( 0 , high - low ) ) ; } }", "import java . util . * ; import javafx . util . Pair ;   public class VisTrain {   public static Scanner in = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { ArrayList < Pair < Integer , Integer > > list = new ArrayList < Pair < Integer , Integer > > ( ) ; HashSet < Integer > a = new HashSet < Integer > ( ) ; HashSet < Integer > b = new HashSet < Integer > ( ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; boolean [ ] visited = new boolean [ n + 1 ] ; int maxA = - 1 ; int minB = Integer . MAX_VALUE ; int tmp = m ; while ( tmp -- > 0 ) { int u = in . nextInt ( ) ; int v = in . nextInt ( ) ; int min = Math . min ( u , v ) ; int max = Math . max ( u , v ) ; maxA = Math . max ( maxA , min ) ; minB = Math . min ( minB , max ) ; list . add ( new Pair ( min , max ) ) ; a . add ( min ) ; b . add ( max ) ; visited [ u ] = visited [ v ] = true ; } if ( m == 0 ) { System . out . println ( n - 1 ) ; } else { boolean ans = true ; for ( Pair p : list ) { if ( ( a . contains ( p . getKey ( ) ) && a . contains ( p . getValue ( ) ) ) || ( b . contains ( p . getKey ( ) ) && b . contains ( p . getValue ( ) ) ) ) { ans = false ; break ; } } if ( ans && maxA < minB ) { int count = 0 ; for ( int i = maxA ; i <= minB ; i ++ ) { if ( ! visited [ i ] ) { count ++ ; } } System . out . println ( count + 1 ) ; } else { System . out . println ( \"0\" ) ; } } }   }" ]
[ "a , b = map ( int , input ( ) . split ( ) ) l , r = 0 , a ; ans = 1 z = [ 0 ] * ( a + 1 ) for _ in \" ▁ \" * b : u , v = sorted ( map ( int , input ( ) . split ( ) ) ) if z [ u ] == 2 or z [ v ] == 1 : ans = 0 elif z [ u ] != 0 and z [ v ] != 0 and z [ u ] == z [ v ] : ans = 0 else : z [ u ] = 1 ; z [ v ] = 2 if u >= r : ans = 0 if v <= l : ans = 0 l = max ( l , u ) ; r = min ( r , v ) if ans == 0 : print ( ans ) elif l == 0 and r == a : print ( a - 1 ) else : print ( r - l ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) l , r = 1 , afor _ in \" ▁ \" * b : u , v = sorted ( map ( int , input ( ) . split ( ) ) ) ; l = max ( l , u ) ; r = min ( r , v ) print ( max ( r - l , 0 ) ) NEW_LINE" ]
codeforces_461_A
[ "import java . io . * ; import java . math . * ; import java . util . * ;      public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = Long . MAX_VALUE ; 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 int MAX = 1000005 ; private static final long MOD = 1000000007 ;   private static final int MAXN = 100007 ; private static final int MAXA = 10000009 ; private static final int MAXLOG = 22 ;   public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;", "import java . io . * ; import java . util . * ;   public class A { 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 file = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = file . nextInt ( ) ; Integer [ ] arr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = file . nextInt ( ) ; } Arrays . sort ( arr ) ; long [ ] pref = new long [ n ] ; for ( int i = n - 1 ; i > - 1 ; -- i ) { pref [ i ] = arr [ i ] + ( i + 1 < n ? pref [ i + 1 ] : 0l ) ; } long max = 0 ; max += pref [ 0 ] ; for ( int i = 0 ; i < pref . length - 1 ; i ++ ) { max += pref [ i ] ; } out . println ( max ) ; out . close ( ) ;   }   }", "import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class applemanandtoastman {   public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;   int n = Integer . parseInt ( in . readLine ( ) ) ; Long [ ] nums = new Long [ n ] ; StringTokenizer st = new StringTokenizer ( in . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { long num = Integer . parseInt ( st . nextToken ( ) ) ; nums [ i ] = num ; } Arrays . parallelSort ( nums ) ; long res = 0 ; for ( int i = 1 ; i < n ; i ++ ) { res += ( i + 1 ) * nums [ i - 1 ] ; } res += n * nums [ n - 1 ] ; out . println ( res ) ; in . close ( ) ; out . close ( ) ; } }", "import java . io . * ; import java . util . * ; import java . math . * ; import java . lang . * ;   public class Solution implements Runnable {   public void run ( ) { InputReader sc = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int i = 0 , j = 0 , k = 0 ; int testcase = 0 ;", "import java . util . * ;   public class CodeForces { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long arr [ ] = new long [ ( int ) n ] ; long score = 0 ; for ( int i = 0 ; i < ( int ) n ; i ++ ) { arr [ i ] = sc . nextLong ( ) ; score += arr [ i ] ; } Arrays . sort ( arr ) ; long s = 0 ; long sum [ ] = new long [ ( int ) n - 1 ] ; for ( int i = ( int ) n - 1 ; i >= 1 ; i -- ) { s += arr [ i ] ; sum [ i - 1 ] = s ; } for ( int i = 0 ; i < ( int ) n - 1 ; i ++ ) { score += arr [ i ] + sum [ i ] ; } System . out . println ( score ) ; } }" ]
[ "if __name__ == ' _ _ main _ _ ' : for _ in range ( 1 ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) ans = 0 for i in range ( n ) [ : n - 1 ] : ans += ( i + 2 ) * a [ i ] ans += n * a [ n - 1 ] print ( ans ) NEW_LINE", "n = int ( input ( ) ) l = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) s = [ l [ i ] * ( i + 2 ) for i in range ( n ) ] print ( sum ( s ) - l [ - 1 ] ) NEW_LINE", "n = int ( input ( ) ) a = sorted ( map ( int , input ( ) . split ( ) ) ) s = 0 for i in range ( n - 1 ) : s += a [ i ] * ( i + 2 ) print ( s + a [ - 1 ] * n ) NEW_LINE", "from sys import stdin   A = int ( stdin . readline ( ) ) B = list ( map ( int , stdin . readline ( ) . split ( ) ) ) K = 0   if A == 1 : print ( B [ 0 ] ) K = 1   if A == 2 : print ( 2 * ( B [ 0 ] + B [ 1 ] ) ) K = 1   if K == 0 : B . sort ( ) sum = B [ len ( B ) - 1 ] + B [ len ( B ) - 2 ] ans = sum   for t in range ( len ( B ) - 3 , - 1 , - 1 ) : sum += B [ t ] ans += sum   ans += sum   print ( ans ) NEW_LINE" ]
codeforces_1276_B
[ "import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . * ;   public class Main { 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 [ ( int ) ( 2e6 + 10 ) ] ;", "import java . io . DataInputStream ; import java . io . FileInputStream ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Scanner ;   public class Main { 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 B {   public static Reader sc = new Reader ( ) ;" ]
[ "def main ( ) : t = int ( input ( ) ) allans = [ ] for _ in range ( t ) : n , m , a , b = readIntArr ( ) adj = [ [ ] for __ in range ( n + 1 ) ] for __ in range ( m ) : u , v = readIntArr ( ) adj [ u ] . append ( v ) adj [ v ] . append ( u ) def reachableFromAWOPassingB ( a , b ) : st = [ a ] reachable = [ False for _ in range ( n + 1 ) ] reachable [ a ] = True while st : node = st . pop ( ) for nex in adj [ node ] : if nex != b and not reachable [ nex ] : reachable [ nex ] = True st . append ( nex ) reachable [ a ] = False return reachable vA = reachableFromAWOPassingB ( a , b ) vB = reachableFromAWOPassingB ( b , a ) aCnt = 0 bCnt = 0 for i in range ( 1 , n + 1 ) : if vA [ i ] and not vB [ i ] : aCnt += 1 if not vA [ i ] and vB [ i ] : bCnt += 1 ans = aCnt * bCnt allans . append ( ans ) multiLineArrayPrint ( allans ) return import sys NEW_LINE", "import sysinput = sys . stdin . buffer . readlinedef dfs ( start , end ) : visited = [ 0 for i in range ( n + 1 ) ] stack = [ start ] while stack : start = stack . pop ( ) if ( start == end or visited [ start ] ) : continue visited [ start ] = 1 for i in graph [ start ] : if ( visited [ i ] == 0 ) : stack . append ( i ) return visited       for _ in range ( int ( input ( ) ) ) : n , m , a , b = map ( int , input ( ) . split ( ) ) graph = [ [ ] for i in range ( n + 1 ) ] for i in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) graph [ x ] . append ( y ) graph [ y ] . append ( x ) vis = dfs ( a , b ) vis2 = dfs ( b , a ) ans1 , ans2 = 0 , 0 for i in range ( 1 , n + 1 ) : if i == a or i == b : continue if vis [ i ] and not vis2 [ i ] : ans1 += 1 if not vis [ i ] and vis2 [ i ] : ans2 += 1 print ( ans1 * ans2 ) 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", "def main ( ) : t = int ( input ( ) ) allans = [ ] for _ in range ( t ) : n , m , a , b = readIntArr ( ) adj = [ [ ] for __ in range ( n + 1 ) ] for __ in range ( m ) : u , v = readIntArr ( ) adj [ u ] . append ( v ) adj [ v ] . append ( u ) def reachableFromAWOPassingB ( a , b ) : st = [ a ] reachable = set ( ) reachable . add ( a ) while st : node = st . pop ( ) for nex in adj [ node ] : if nex != b and nex not in reachable : reachable . add ( nex ) st . append ( nex ) reachable . remove ( a ) return reachable vA = reachableFromAWOPassingB ( a , b ) vB = reachableFromAWOPassingB ( b , a ) NEW_LINE" ]
codeforces_15_B
[ "import java . util . Scanner ;   public class Solution { public static void main ( String [ ] args ) { Solution solution = new Solution ( ) ; solution . solve ( ) ; }   private void solve ( ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ;   while ( t -- > 0 ) { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int x1 = in . nextInt ( ) , y1 = in . nextInt ( ) ; int x2 = in . nextInt ( ) , y2 = in . nextInt ( ) ; long a = Math . max ( x1 , x2 ) - Math . min ( x1 , x2 ) ; long b = Math . max ( y1 , y2 ) - Math . min ( y1 , y2 ) ; if ( 2 * a <= n && 2 * b <= m ) System . out . println ( 2 * a * b ) ; else System . out . println ( 2 * a * b - ( 2 * a - n ) * ( 2 * b - m ) ) ; } } }", "import java . util . Scanner ; import java . lang . Math ;   public class main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; for ( int k = 0 ; k < t ; k ++ ) { int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; int x1 = s . nextInt ( ) ; int y1 = s . nextInt ( ) ; int x2 = s . nextInt ( ) ; int y2 = s . nextInt ( ) ; int x = Math . abs ( x1 - x2 ) ; int y = Math . abs ( y1 - y2 ) ; long sum = ( long ) n * m - ( long ) ( n - x ) * ( m - y ) * 2 ; x = n - 2 * x ; y = m - 2 * y ; if ( x > 0 && y > 0 ) sum += ( long ) x * y ; System . out . println ( sum ) ; } } }", "import java . io . BufferedInputStream ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; 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 . StringTokenizer ;   public class Main { public static void main ( String [ ] args ) throws FileNotFoundException , IOException { InputReader in = new InputReader ( new BufferedInputStream ( System . in ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( new BufferedOutputStream ( System . out ) ) ) ; TaskB solver = new TaskB ( ) ; long t1 = System . currentTimeMillis ( ) ; solver . solve ( 1 , in , out ) ; out . flush ( ) ; long t2 = System . currentTimeMillis ( ) ;" ]
[ "from sys import stdin   for case in range ( int ( stdin . readline ( ) ) ) : n , m , x1 , y1 , x2 , y2 = [ int ( x ) for x in stdin . readline ( ) . split ( ) ]   total = n * m   xDiff = abs ( x1 - x2 ) yDiff = abs ( y1 - y2 )   rectX = n - xDiff rectY = m - yDiff midSquare = ( rectX * 2 - n ) * ( rectY * 2 - m ) total -= 2 * ( n - xDiff ) * ( m - yDiff ) if rectX * 2 > n : total += max ( midSquare , 0 ) print ( total ) NEW_LINE", "t = int ( input ( ) ) for q in range ( t ) : n , m , x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ' ▁ ' ) ) print ( n * m - 2 * ( ( n - abs ( x1 - x2 ) ) * ( m - abs ( y1 - y2 ) ) ) + ( min ( 0 , ( n - 2 * ( n - abs ( x1 - x2 ) ) ) ) * min ( 0 , m - 2 * ( m - abs ( y1 - y2 ) ) ) ) ) NEW_LINE", "import sysdef its ( x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4 ) : x5 = max ( x1 , x3 ) ; y5 = max ( y1 , y3 ) x6 = min ( x2 , x4 ) ; y6 = min ( y2 , y4 ) if ( x5 <= x6 and y5 <= y6 ) : return ( x6 + 1 - x5 ) * ( y6 + 1 - y5 ) else : return 0   def main ( ) : t = int ( input ( ) ) for it in range ( 0 , t ) : n , m , x1 , y1 , x2 , y2 = [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] \"\"\" TABSYMBOL TABSYMBOL n = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL m = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL x1 = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL y1 = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL x2 = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL y2 = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL \"\"\" dr = min ( n - x1 , n - x2 ) dl = min ( x1 - 1 , x2 - 1 ) du = min ( y1 - 1 , y2 - 1 ) dd = min ( m - y1 , m - y2 ) x1p , y1p = x1 - dl , y1 - du x2p , y2p = x1 + dr , y1 + dd x3p , y3p = x2 - dl , y2 - du x4p , y4p = x2 + dr , y2 + dd NEW_LINE", "import sysdef its ( x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4 ) : x5 = max ( x1 , x3 ) ; y5 = max ( y1 , y3 ) x6 = min ( x2 , x4 ) ; y6 = min ( y2 , y4 ) if ( x5 <= x6 and y5 <= y6 ) : return ( x6 + 1 - x5 ) * ( y6 + 1 - y5 ) else : return 0   def main ( ) : t = int ( input ( ) ) it = 0 while ( it < t ) : n , m , x1 , y1 , x2 , y2 = [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] \"\"\" TABSYMBOL TABSYMBOL n = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL m = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL x1 = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL y1 = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL x2 = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL y2 = int ( sys . stdin ( ) . read ( ) ) TABSYMBOL TABSYMBOL \"\"\" dr = min ( n - x1 , n - x2 ) dl = min ( x1 - 1 , x2 - 1 ) du = min ( y1 - 1 , y2 - 1 ) dd = min ( m - y1 , m - y2 ) x1p , y1p = x1 - dl , y1 - du x2p , y2p = x1 + dr , y1 + dd x3p , y3p = x2 - dl , y2 - du x4p , y4p = x2 + dr , y2 + dd NEW_LINE", "for i in range ( int ( input ( ) ) ) : n , m , x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ) ) w , h = abs ( x2 - x1 ) , abs ( y2 - y1 ) if w * 2 > n or h * 2 > m : print ( n * m - 2 * ( n - w ) * ( m - h ) ) else : print ( 2 * w * h ) NEW_LINE" ]
codeforces_699_B
[ "import java . util . Scanner ;     public class Main { static final int M = 1010 ;   public static void main ( String [ ] args ) {", "import java . io . * ; import java . util . * ; import java . math . * ;   public class Main { static class Point { int x , y ; Point ( int x , int y ) { this . x = x ; this . y = y ; } } public static void main ( String [ ] args ) throws java . lang . Exception {", "import java . io . * ; import java . util . * ; import java . util . regex . * ; public class vk18 { public static void main ( String [ ] stp ) throws Exception { Scanner scan = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) , m = Integer . parseInt ( st . nextToken ( ) ) , i , j = 0 , max = 0 , count = 0 ; char [ ] [ ] c = new char [ n ] [ m ] ;" ]
[ "n , m = map ( int , input ( ) . split ( ) ) A = [ ] for i in range ( n ) : s = input ( ) X = [ char for char in s ] A . append ( X ) tot = 0 for i in range ( n ) : for j in range ( m ) : if A [ i ] [ j ] == ' * ' : tot += 1 row = [ ] col = [ ] for i in range ( n ) : row . append ( A [ i ] . count ( ' * ' ) ) t_A = list ( zip ( * A ) ) for j in range ( m ) : col . append ( t_A [ j ] . count ( ' * ' ) ) count = 0 ok = False for i in range ( n ) : if ok == True : break for j in range ( m ) : count = row [ i ] + col [ j ] if A [ i ] [ j ] == ' * ' : count -= 1 if count == tot : ok = True print ( \" YES \" ) print ( str ( i + 1 ) + \" ▁ \" + str ( j + 1 ) ) if ok == True : break if ok == False : print ( \" NO \" ) NEW_LINE", "from collections import Counterimport 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 , m = map ( int , input ( ) . split ( ) ) a = [ ] for i in range ( n ) : s = input ( ) a . append ( s ) r = [ 0 ] * nc = [ 0 ] * mf = 0 cnt = 0 for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] == ' * ' : r [ i ] += 1 c [ j ] += 1 cnt += 1 r1 = 0 c1 = 0 for i in range ( n ) : if ( f ) : break for j in range ( m ) : d = r [ i ] + c [ j ] if a [ i ] [ j ] == \" * \" : d -= 1 if d == cnt : f = 1 r1 = i c1 = j break NEW_LINE", "import math , sys , bisect , heapqfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulate NEW_LINE" ]
codeforces_284_B
[ "import java . util . * ; public class cowsAndPokerGame { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int a [ ] = new int [ 26 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { a [ s . charAt ( i ) - ' A ' ] ++ ; } if ( a [ 8 ] == 0 ) { System . out . println ( a [ 0 ] ) ; } else if ( a [ 8 ] == 1 ) { System . out . println ( \"1\" ) ; } else if ( a [ 8 ] > 1 ) { System . out . println ( \"0\" ) ; } } }", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class Cow_and_poker {   public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) , c1 = 0 , c2 = 0 , c3 = 0 ; char c [ ] = br . readLine ( ) . toCharArray ( ) ; for ( int i = 0 ; i < t ; i ++ ) { if ( c [ i ] == ' A ' ) ++ c1 ; else if ( c [ i ] == ' I ' ) ++ c2 ; } System . out . println ( c2 == 1 ? 1 : c2 > 1 ? 0 : c1 ) ; }   }", "import java . util . Scanner ;   public class Codeforces284B { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int kol = 0 ; int wrong = 0 ; in . nextLine ( ) ; String s = in . nextLine ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' I ' ) { wrong ++ ; } if ( s . charAt ( i ) == ' A ' ) { kol ++ ; } if ( wrong > 1 ) { break ; } } if ( wrong > 1 ) { System . out . println ( 0 ) ; } else { if ( wrong == 1 ) { System . out . println ( 1 ) ; } else { System . out . println ( kol ) ; } } } }", "import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . * ; import java . util . Comparator ;   public class scratch_25 { static class Reader { static BufferedReader reader ; static StringTokenizer tokenizer ;   static void init ( InputStream input ) { reader = new BufferedReader ( new InputStreamReader ( input ) ) ; tokenizer = new StringTokenizer ( \" \" ) ; }   static String next ( ) throws IOException { while ( ! tokenizer . hasMoreTokens ( ) ) {" ]
[ "def poker_cow ( n , seq ) : total = 0 ref = { \" A \" : 0 , \" I \" : 0 , \" F \" : 0 } for x in seq : ref [ x ] += 1 if ref [ \" I \" ] == 0 : return ref [ \" A \" ] elif ref [ \" I \" ] == 1 : return ref [ \" I \" ] else : return 0   n = int ( input ( ) ) seq = input ( )   print ( poker_cow ( n , seq ) ) NEW_LINE", "n = int ( input ( ) ) s = input ( )   A = 0 I = 0 for i in range ( n ) : if s [ i ] == ' A ' : A += 1 elif s [ i ] == ' I ' : I += 1   if I > 1 : print ( 0 ) elif I == 1 : print ( 1 ) else : print ( A ) NEW_LINE", "n = int ( input ( ) ) s = input ( ) a = s . count ( \" I \" ) if a == 1 : print ( 1 ) elif a > 1 : print ( 0 ) else : b = s . count ( \" A \" ) print ( b ) NEW_LINE", "from collections import Countert = int ( input ( ) ) arr = list ( input ( ) )   c = Counter ( arr ) if c [ ' I ' ] == 0 : res = c [ ' A ' ] elif c [ ' I ' ] == 1 : res = 1 else : res = 0 print ( res ) NEW_LINE", "n = int ( input ( ) ) s = input ( ) koli = 0 kola = 0 for i in range ( n ) : if s [ i ] == ' I ' : koli += 1 if s [ i ] == ' A ' : kola += 1 if koli > 1 : print ( 0 ) exit ( ) if koli == 1 : print ( 1 ) exit ( ) print ( kola ) NEW_LINE" ]
codeforces_686_A
[ "import java . util . Scanner ; import java . util . StringTokenizer ;   public class FreeIcecream { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ;   StringTokenizer tokenizer = new StringTokenizer ( line ) ; long rowCount = Long . parseLong ( tokenizer . nextToken ( ) ) ; long begin = Long . parseLong ( tokenizer . nextToken ( ) ) ;    long currentStock = begin ; long distressedKid = 0 ; for ( long i = 0 ; i < rowCount ; i ++ ) { String row = scanner . nextLine ( ) ;   String [ ] s = row . split ( \" ▁ \" ) ; long request = Long . parseLong ( s [ 1 ] ) ; if ( s [ 0 ] . equalsIgnoreCase ( \" + \" ) ) { currentStock += request ; } else { if ( currentStock < request ) { distressedKid ++ ; } else { currentStock -= request ; } } } System . out . println ( currentStock + \" ▁ \" + distressedKid ) ; } }", "import java . util . Scanner ; public class sol { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; long x = in . nextInt ( ) ; int distressed = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String q = in . next ( ) ; long d = in . nextInt ( ) ; if ( q . charAt ( 0 ) == ' + ' ) x += d ; else { if ( d > x ) { distressed ++ ; } else { x -= d ; } } } System . out . println ( x + \" ▁ \" + distressed ) ; } }", "import java . util . * ; import java . io . * ;   public class FreeIceCream { public static void main ( String [ ] args ) { FastReader reader = new FastReader ( ) ;   int n = reader . nextInt ( ) ; long x = reader . nextLong ( ) ; int distressedKids = 0 ; long total = x ;   for ( int i = 0 ; i < n ; i ++ ) { String charac = reader . next ( ) ; int iceCreams = reader . nextInt ( ) ;   if ( charac . equals ( \" + \" ) ) { total += iceCreams ; } else if ( charac . equals ( \" - \" ) ) { if ( total >= iceCreams ) { total -= iceCreams ; } else { distressedKids ++ ; } } } System . out . println ( total + \" ▁ \" + distressedKids ) ; }   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 . Scanner ;   public class A686 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; long x = scanner . nextLong ( ) , distress = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String sym = scanner . next ( ) ; int d = scanner . nextInt ( ) ; if ( sym . equals ( \" + \" ) ) { x += d ; } if ( sym . equals ( \" - \" ) ) { x -= d ; if ( x < 0 ) { x += d ; distress ++ ; } } } System . out . println ( x + \" ▁ \" + distress ) ; } }", "import java . math . BigInteger ; import java . util . Scanner ;   public class FreeIceCream { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; long x = scanner . nextInt ( ) ; scanner . nextLine ( ) ; BigInteger store = BigInteger . valueOf ( x ) ; int distCount = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String inst = scanner . nextLine ( ) ; char op = inst . charAt ( 0 ) ; long num = Integer . parseInt ( inst . substring ( 2 ) ) ; if ( op == ' - ' ) { if ( store . longValue ( ) >= num ) store = store . subtract ( BigInteger . valueOf ( num ) ) ; else distCount ++ ; } else store = store . add ( BigInteger . valueOf ( num ) ) ; } System . out . printf ( \" % d ▁ % d \" , store . longValue ( ) , distCount ) ; } }" ]
[ "n , x = map ( int , input ( ) . split ( ) ) a = 0   for i in range ( n ) : q , w = input ( ) . split ( ) w = int ( w ) if ( q == ' + ' ) : x += w else : if ( x >= w ) : x -= w else : a += 1   print ( x , a ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) )   dit = 0   for i in range ( n ) : val , ice = input ( ) . split ( ) ice = int ( ice ) if ( val == ' + ' ) : k += ice else : if ( ice > k ) : dit += 1 else : k -= ice   print ( k , dit ) NEW_LINE", "n , x = [ int ( i ) for i in input ( ) . split ( ) ] b = 0 for i in range ( n ) : a = input ( ) if ' + ' in a : x += int ( a [ 2 : ] ) else : if int ( a [ 2 : ] ) > x : b += 1 else : x -= int ( a [ 2 : ] ) print ( x , b ) NEW_LINE", "n , x = [ int ( i ) for i in input ( ) . split ( ) ] c = 0 for _ in range ( n ) : op , num = [ i for i in input ( ) . split ( ) ] num = int ( num ) if op == ' + ' : x += num elif x >= num : x -= num else : c += 1 print ( x , c ) NEW_LINE", "n , x = map ( int , input ( ) . split ( ) ) ; s = 0 for _ in ' ▁ ' * n : d = int ( input ( ) . replace ( ' ▁ ' , ' ' ) ) if x + d < 0 : s += 1 else : x += dprint ( x , s ) NEW_LINE" ]
codeforces_605_B
[ "import java . util . * ; import java . io . * ; public class albaaaai {   static ArrayList < point > adj [ ] ; static boolean visited [ ] ; static int distance [ ] [ ] ; static int n ; public static void Bfs ( int nn ) { visited = new boolean [ n ] ; Queue < Integer > q = new LinkedList < Integer > ( ) ; q . add ( nn ) ; visited [ nn ] = true ; while ( ! q . isEmpty ( ) ) { int node = q . poll ( ) ; for ( int i = 0 ; i < adj [ node ] . size ( ) ; i ++ ) { if ( ! visited [ adj [ node ] . get ( i ) . x ] ) { visited [ adj [ node ] . get ( i ) . x ] = true ; distance [ nn ] [ adj [ node ] . get ( i ) . x ] = distance [ nn ] [ node ] + adj [ node ] . get ( i ) . y ;", "import java . util . * ; import java . io . * ; public class albaaaai {   static ArrayList < point > adj [ ] ; static boolean visited [ ] ; static int distance [ ] [ ] ; static int n ; public static void Bfs ( int nn ) { visited = new boolean [ n ] ; Queue < Integer > q = new LinkedList < Integer > ( ) ; q . add ( nn ) ; visited [ nn ] = true ; while ( ! q . isEmpty ( ) ) { int node = q . poll ( ) ; for ( int i = 0 ; i < adj [ node ] . size ( ) ; i ++ ) { if ( ! visited [ adj [ node ] . get ( i ) . x ] ) { visited [ adj [ node ] . get ( i ) . x ] = true ; distance [ nn ] [ adj [ node ] . get ( i ) . x ] = distance [ nn ] [ node ] + adj [ node ] . get ( i ) . y ;", "import java . util . * ; import java . io . * ; public class albaaaai {   static ArrayList < point > adj [ ] ; static boolean visited [ ] ; static int distance [ ] [ ] ; static int n ; public static void Bfs ( int nn ) { visited = new boolean [ n ] ; Queue < Integer > q = new LinkedList < Integer > ( ) ; q . add ( nn ) ; visited [ nn ] = true ; while ( ! q . isEmpty ( ) ) { int node = q . poll ( ) ; for ( int i = 0 ; i < adj [ node ] . size ( ) ; i ++ ) { if ( ! visited [ adj [ node ] . get ( i ) . x ] ) { visited [ adj [ node ] . get ( i ) . x ] = true ; distance [ nn ] [ adj [ node ] . get ( i ) . x ] = distance [ nn ] [ node ] + adj [ node ] . get ( i ) . y ;" ]
[ "import sysfrom math import gcd , sqrt , ceil , log2from collections import defaultdict , Counter , dequefrom bisect import bisect_left , bisect_rightimport mathsys . setrecursionlimit ( 2 * 10 ** 5 + 10 ) import heapqfrom itertools import permutations   NEW_LINE", "f = lambda : map ( int , input ( ) . split ( ) ) n , m = f ( ) p = [ ] for i in range ( m ) : a , b = f ( ) p . append ( ( a , 1 - b , i ) ) p . sort ( ) k = j = 0 s = [ 0 ] * mu , v = 1 , 3 for a , b , i in p : if not b : k += j s [ i ] = ( j + 1 , j + 2 ) j += 1 elif k : k -= 1 s [ i ] = ( u , v ) if v - u - 2 : u += 1 else : u , v = 1 , v + 1 else : print ( - 1 ) exit ( 0 ) for x , y in s : print ( x , y ) NEW_LINE", "f = lambda : map ( int , input ( ) . split ( ) ) n , m = f ( ) p = [ ] for i in range ( m ) : a , b = f ( ) p . append ( ( a , 1 - b , i ) ) p . sort ( ) k = j = 0 s = [ 0 ] * mu , v = 1 , 3 for a , b , i in p : if not b : k += j s [ i ] = ( j + 1 , j + 2 ) j += 1 elif k : k -= 1 s [ i ] = ( u , v ) if v - u - 2 : u += 1 else : u , v = 1 , v + 1 else : print ( - 1 ) exit ( 0 ) for x , y in s : print ( x , y ) NEW_LINE", "f = lambda : map ( int , input ( ) . split ( ) ) n , m = f ( ) p = [ ] for i in range ( m ) : a , b = f ( ) p . append ( ( a , 1 - b , i ) ) p . sort ( ) k = j = 0 s = [ 0 ] * mu , v = 1 , 3 for a , b , i in p : if not b : k += j s [ i ] = ( j + 1 , j + 2 ) j += 1 elif k : k -= 1 s [ i ] = ( u , v ) if v - u - 2 : u += 1 else : u , v = 1 , v + 1 else : print ( - 1 ) exit ( 0 ) for x , y in s : print ( x , y ) NEW_LINE", "f = lambda : map ( int , input ( ) . split ( ) ) n , m = f ( ) p = [ ] for i in range ( m ) : a , b = f ( ) p . append ( ( a , 1 - b , i ) ) p . sort ( ) k = j = 0 s = [ 0 ] * mu , v = 1 , 3 for a , b , i in p : if not b : k += j s [ i ] = ( j + 1 , j + 2 ) j += 1 elif k : k -= 1 s [ i ] = ( u , v ) if v - u - 2 : u += 1 else : u , v = 1 , v + 1 else : print ( - 1 ) exit ( 0 ) for x , y in s : print ( x , y ) NEW_LINE" ]
codeforces_1394_A
[ "import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class pb1 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int d = in . nextInt ( ) ; int m = in . nextInt ( ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; ArrayList < Integer > b = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int v = in . nextInt ( ) ; if ( v <= m ) b . add ( v ) ; else a . add ( v ) ; } Collections . sort ( a ) ; Collections . sort ( b ) ; long [ ] apref = new long [ a . size ( ) + 1 ] ; long [ ] bpref = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i <= a . size ( ) ) { apref [ i ] = apref [ i - 1 ] + a . get ( a . size ( ) - i ) ; } if ( i <= b . size ( ) ) { bpref [ i ] = bpref [ i - 1 ] + b . get ( b . size ( ) - i ) ; } else bpref [ i ] = bpref [ i - 1 ] ; } if ( a . size ( ) == 0 ) System . out . println ( bpref [ n ] ) ; else { long ans = 0 ; for ( int ai = 1 ; ai <= a . size ( ) && ( ai - 1 ) * ( d + 1 ) + 1 <= n ; ai ++ ) { ans = Math . max ( ans , apref [ ai ] + bpref [ n - ( ai - 1 ) * ( d + 1 ) - 1 ] ) ; } System . out . println ( ans ) ; } in . close ( ) ; } }" ]
[ "def solve ( ) : NEW_LINE INDENT input_str = input ( ) . split ( ) NEW_LINE n , d , m = int ( input_str [ 0 ] ) , int ( input_str [ 1 ] ) , int ( input_str [ 2 ] ) NEW_LINE a = [ 0 ] + [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE a [ 1 : ] = sorted ( a [ 1 : ] , reverse = True ) NEW_LINE muzzle_days_cnt = 0 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT if a [ i ] > m : NEW_LINE INDENT muzzle_days_cnt += 1 NEW_LINE DEDENT a [ i ] += a [ i - 1 ] NEW_LINE DEDENT ans = 0 NEW_LINE if muzzle_days_cnt == 0 : NEW_LINE INDENT print ( a [ n ] ) NEW_LINE return 0 NEW_LINE DEDENT for i in range ( 1 , muzzle_days_cnt + 1 ) : NEW_LINE INDENT days_left = n - ( ( i - 1 ) * ( d + 1 ) + 1 ) NEW_LINE if days_left >= 0 : NEW_LINE INDENT ans = max ( ans , ( a [ min ( n , muzzle_days_cnt + days_left ) ] - a [ muzzle_days_cnt ] ) + a [ i ] ) NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE return 0 NEW_LINE DEDENT solve ( ) NEW_LINE", "n , d , m = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE days = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE days . sort ( reverse = True ) NEW_LINE smaller = [ i for i in days if i <= m ] NEW_LINE larger = [ i for i in days if i > m ] NEW_LINE highest = 0 NEW_LINE current = 0 NEW_LINE prefix_sums = [ 0 ] * ( 1 + len ( larger ) ) NEW_LINE for i in range ( 0 , len ( larger ) ) : NEW_LINE INDENT prefix_sums [ i + 1 ] = prefix_sums [ i ] + larger [ i ] NEW_LINE DEDENT prefix_sums2 = [ 0 ] * ( 1 + len ( smaller ) ) NEW_LINE for i in range ( 0 , len ( smaller ) ) : NEW_LINE INDENT prefix_sums2 [ i + 1 ] = prefix_sums2 [ i ] + smaller [ i ] NEW_LINE DEDENT if n == len ( smaller ) : NEW_LINE INDENT print ( sum ( smaller ) ) NEW_LINE DEDENT else : NEW_LINE INDENT for x in range ( 1 , len ( prefix_sums ) ) : NEW_LINE INDENT small_remaining = n - ( x - 1 ) * ( d + 1 ) - 1 NEW_LINE if small_remaining < 0 : NEW_LINE INDENT break NEW_LINE DEDENT if small_remaining >= len ( prefix_sums2 ) : NEW_LINE INDENT if small_remaining - len ( prefix_sums2 ) > d : NEW_LINE INDENT continue NEW_LINE DEDENT else : NEW_LINE INDENT highest = max ( highest , prefix_sums [ x ] + prefix_sums2 [ - 1 ] ) NEW_LINE continue NEW_LINE DEDENT DEDENT current = prefix_sums [ x ] + prefix_sums2 [ small_remaining ] NEW_LINE highest = max ( current , highest ) NEW_LINE DEDENT print ( highest ) NEW_LINE DEDENT", "def to_int ( s ) : NEW_LINE INDENT return int ( s ) NEW_LINE DEDENT ndm = list ( map ( to_int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE n = ndm [ 0 ] NEW_LINE d = ndm [ 1 ] NEW_LINE m = ndm [ 2 ] NEW_LINE values = list ( map ( to_int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE good = [ ] NEW_LINE bad = [ ] NEW_LINE for v in values : NEW_LINE INDENT if v <= m : NEW_LINE INDENT good . append ( v ) NEW_LINE DEDENT else : NEW_LINE INDENT bad . append ( v ) NEW_LINE DEDENT DEDENT good . sort ( reverse = True ) NEW_LINE bad . sort ( reverse = True ) NEW_LINE goodSums = [ 0 ] NEW_LINE for i in good : NEW_LINE INDENT goodSums . append ( goodSums [ - 1 ] + i ) NEW_LINE DEDENT if len ( bad ) == 0 : NEW_LINE INDENT print ( goodSums [ - 1 ] ) NEW_LINE exit ( ) NEW_LINE DEDENT badSums = [ 0 ] NEW_LINE for i in bad : NEW_LINE INDENT badSums . append ( badSums [ - 1 ] + i ) NEW_LINE DEDENT sum = 0 NEW_LINE minGood = n - ( ( len ( bad ) - 1 ) * ( d + 1 ) + 1 ) NEW_LINE if minGood < 0 : NEW_LINE INDENT minGood = 0 NEW_LINE DEDENT for i in range ( minGood , len ( goodSums ) ) : NEW_LINE INDENT nLeft = n - i NEW_LINE exceed = nLeft // ( d + 1 ) NEW_LINE if not nLeft % ( d + 1 ) == 0 : NEW_LINE INDENT exceed += 1 NEW_LINE DEDENT sum = max ( sum , goodSums [ i ] + badSums [ exceed ] ) NEW_LINE DEDENT print ( sum ) NEW_LINE", "import sys NEW_LINE input = sys . stdin . readline NEW_LINE def getInts ( ) : NEW_LINE INDENT return [ int ( s ) for s in input ( ) . split ( ) ] NEW_LINE DEDENT def getInt ( ) : NEW_LINE INDENT return int ( input ( ) ) NEW_LINE DEDENT def getStrs ( ) : NEW_LINE INDENT return [ s for s in input ( ) . split ( ) ] NEW_LINE DEDENT def getStr ( ) : NEW_LINE INDENT return input ( ) . strip ( ) NEW_LINE DEDENT def listStr ( ) : NEW_LINE INDENT return list ( input ( ) . strip ( ) ) NEW_LINE DEDENT import collections as col NEW_LINE import math NEW_LINE def solve ( ) : NEW_LINE INDENT N , D , M = getInts ( ) NEW_LINE A = getInts ( ) NEW_LINE A . sort ( reverse = True ) NEW_LINE if N == 1 or A [ 0 ] <= M : NEW_LINE INDENT return sum ( A ) NEW_LINE DEDENT safe , dangerous = [ ] , [ ] NEW_LINE for a in A : NEW_LINE INDENT if a <= M : NEW_LINE INDENT safe . append ( a ) NEW_LINE DEDENT else : NEW_LINE INDENT dangerous . append ( a ) NEW_LINE DEDENT DEDENT safe_pref = [ 0 ] NEW_LINE for s in safe : NEW_LINE INDENT safe_pref . append ( safe_pref [ - 1 ] + s ) NEW_LINE DEDENT dang_pref = [ 0 ] NEW_LINE for d in dangerous : NEW_LINE INDENT dang_pref . append ( dang_pref [ - 1 ] + d ) NEW_LINE DEDENT best = 0 NEW_LINE for x in range ( 1 , min ( ( N - 1 ) // ( D + 1 ) + 2 , len ( dang_pref ) ) ) : NEW_LINE INDENT safe_num = min ( N - x - ( x - 1 ) * D , len ( safe_pref ) - 1 ) NEW_LINE best = max ( best , dang_pref [ x ] + safe_pref [ safe_num ] ) NEW_LINE DEDENT return best NEW_LINE DEDENT print ( solve ( ) ) NEW_LINE", "def main ( ) : NEW_LINE INDENT n , day , mood = map ( int , input ( ) . split ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE out = [ ] NEW_LINE safe = [ ] NEW_LINE for v in a : NEW_LINE INDENT if v <= mood : NEW_LINE INDENT safe . append ( v ) NEW_LINE DEDENT else : NEW_LINE INDENT out . append ( v ) NEW_LINE DEDENT DEDENT safe . sort ( reverse = True ) NEW_LINE out . sort ( reverse = True ) NEW_LINE if not out : NEW_LINE INDENT print ( sum ( safe ) ) NEW_LINE return NEW_LINE DEDENT safe . insert ( 0 , 0 ) NEW_LINE out . insert ( 0 , 0 ) NEW_LINE for i in range ( 1 , len ( safe ) ) : NEW_LINE INDENT safe [ i ] += safe [ i - 1 ] NEW_LINE DEDENT for i in range ( 1 , len ( out ) ) : NEW_LINE INDENT out [ i ] += out [ i - 1 ] NEW_LINE DEDENT ans = 0 NEW_LINE for l in range ( len ( out ) ) : NEW_LINE INDENT if l == 0 : NEW_LINE INDENT ans = max ( ans , safe [ min ( n , len ( safe ) - 1 ) ] ) NEW_LINE DEDENT else : NEW_LINE INDENT possible = n - 1 - ( day + 1 ) * ( l - 1 ) NEW_LINE if possible >= 0 : NEW_LINE INDENT ans = max ( ans , safe [ min ( possible , len ( safe ) - 1 ) ] + out [ l ] ) NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE return NEW_LINE DEDENT if __name__ == \" _ _ main _ _ \" : NEW_LINE INDENT main ( ) NEW_LINE DEDENT" ]
codeforces_596_B
[ "import java . io . PrintWriter ; import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; int pre = 0 ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int input = in . nextInt ( ) ; sum += Math . abs ( input - pre ) ; pre = input ; } pw . println ( sum ) ;   pw . close ( ) ; }   }  ", "import java . io . * ; import java . util . * ;   import static java . lang . Math . * ;   public class Main {   public static void main ( String [ ] args ) throws IOException { FastReader in = new FastReader ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; long [ ] arr = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = in . nextLong ( ) ; pw . println ( solve ( arr , n ) ) ; pw . close ( ) ; }   static long solve ( long [ ] arr , int n ) { long res = abs ( arr [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { res += abs ( arr [ i ] - arr [ i - 1 ] ) ;", "import java . util . Scanner ;   public class WilburAndArray {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long prev , curr ; prev = sc . nextInt ( ) ; long count = Math . abs ( prev ) ; for ( int i = 1 ; i < n ; i ++ ) { curr = sc . nextInt ( ) ; count += Math . abs ( prev - curr ) ; prev = curr ; } System . out . println ( count ) ; sc . close ( ) ; } }", "import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class pblm3 { static int sum ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int m = sc . nextInt ( ) ; int [ ] ar = new int [ m ] ; sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) ar [ i ] = sc . nextInt ( ) ; System . out . println ( ( long ) findChange ( ar ) ) ; } public static long findChange ( int [ ] ar ) { long cur = 0 , steps = 0 ; for ( int i = 0 ; i < ar . length ; i ++ ) { long curchange = 0 ; if ( cur == 0 ) cur = curchange = - 1 * ar [ i ] ; else { curchange = cur + ar [ i ] ; if ( curchange == 0 ) continue ; else cur -= curchange ; }" ]
[ "n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] c = sorted ( a ) if c == a : print ( c [ n - 1 ] ) else : count = 0 for i in range ( n ) : if i == 0 : count += abs ( a [ 0 ] ) else : count += abs ( a [ i - 1 ] - a [ i ] ) print ( count ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) s = sum ( abs ( arr [ i ] - arr [ i - 1 ] ) for i in range ( 1 , n ) ) print ( s + abs ( arr [ 0 ] ) ) NEW_LINE", "n = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) a = [ 0 ] * ncount = abs ( b [ 0 ] ) for i in range ( 1 , n ) : count += abs ( b [ i ] - b [ i - 1 ] ) print ( count ) NEW_LINE", "n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] s = abs ( a [ 0 ] )   for i in range ( 1 , n ) : s += abs ( a [ i ] - a [ i - 1 ] )   print ( s ) NEW_LINE", "n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) st = Falseres = 0 for i in range ( n - 1 ) : if i == 0 : res += abs ( li [ i ] ) res += abs ( li [ i ] - li [ i + 1 ] ) print ( res ) NEW_LINE" ]
codeforces_116_B
[ "import java . util . * ;   public class LittlePigsAndWolves_B {   public static boolean isValid ( int n , int m , int x , int y ) { if ( x >= 0 && x <= n - 1 && y >= 0 && y <= m - 1 ) { return true ; } return false ; } public static void main ( String [ ] args ) {", "import java . lang . * ; import java . util . * ;   public class Abhishek {   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; char [ ] [ ] a = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . next ( ) . toCharArray ( ) ; } int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( a [ i ] [ j ] == ' P ' ) { if ( j != 0 ) { if ( a [ i ] [ j - 1 ] == ' W ' ) { c ++ ; a [ i ] [ j - 1 ] = ' . ' ; } } if ( j != m - 1 ) { if ( a [ i ] [ j + 1 ] == ' W ' ) { c ++ ; a [ i ] [ j + 1 ] = ' . ' ; } } if ( i != 0 ) { if ( a [ i - 1 ] [ j ] == ' W ' ) { c ++ ; a [ i - 1 ] [ j ] = ' . ' ; } } if ( i != n - 1 ) { if ( a [ i + 1 ] [ j ] == ' W ' ) { c ++ ; a [ i + 1 ] [ j ] = ' . ' ; } } } }   } System . out . println ( c ) ;   }   }", "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 m = sc . nextInt ( ) ; sc . nextLine ( ) ; char [ ] [ ] mat = new char [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { mat [ i ] = ( sc . nextLine ( ) ) . toCharArray ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( mat [ i ] [ j ] == ' P ' ) { if ( i > 0 ) { if ( mat [ i - 1 ] [ j ] == ' W ' ) { count ++ ; mat [ i - 1 ] [ j ] = ' . ' ; continue ; } } if ( i < n - 1 ) { if ( mat [ i + 1 ] [ j ] == ' W ' ) { count ++ ; mat [ i + 1 ] [ j ] = ' . ' ; continue ; } } if ( j > 0 ) { if ( mat [ i ] [ j - 1 ] == ' W ' ) { count ++ ; mat [ i ] [ j - 1 ] = ' . ' ; continue ; } } if ( j < m - 1 ) { if ( mat [ i ] [ j + 1 ] == ' W ' ) { count ++ ; mat [ i ] [ j + 1 ] = ' . ' ; continue ; } } } } } System . out . println ( count ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class WolfPigSlaughter { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( reader . readLine ( ) ) ;   int n = Integer . parseInt ( st . nextToken ( ) ) ; int m = Integer . parseInt ( st . nextToken ( ) ) ;   String [ ] pos = new String [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) pos [ i ] = reader . readLine ( ) ;   int death = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( pos [ i ] . charAt ( j ) == ' W ' ) { if ( i > 0 && pos [ i - 1 ] . charAt ( j ) == ' P ' ) death ++ ; else if ( i < n - 1 && pos [ i + 1 ] . charAt ( j ) == ' P ' ) death ++ ; else if ( j > 0 && pos [ i ] . charAt ( j - 1 ) == ' P ' ) death ++ ; else if ( j < m - 1 && pos [ i ] . charAt ( j + 1 ) == ' P ' ) death ++ ; } } }   System . out . println ( death ) ; } }", "import java . util . * ; public class LittlePigsAndWolves { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ;   char [ ] [ ] ar1 = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] line = sc . next ( ) . toCharArray ( ) ; for ( int j = 0 ; j < m ; j ++ ) { ar1 [ i ] [ j ] = line [ j ] ; } }   int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( ar1 [ i ] [ j ] == ' W ' ) { if ( j - 1 >= 0 && ar1 [ i ] [ j - 1 ] == ' P ' ) { ar1 [ i ] [ j - 1 ] = ' . ' ; res ++ ; } else if ( i - 1 >= 0 && ar1 [ i - 1 ] [ j ] == ' P ' ) { ar1 [ i - 1 ] [ j ] = ' . ' ; res ++ ; } else if ( j + 1 < m && ar1 [ i ] [ j + 1 ] == ' P ' ) { ar1 [ i ] [ j + 1 ] = ' . ' ; res ++ ; } else if ( i + 1 < n && ar1 [ i + 1 ] [ j ] == ' P ' ) { ar1 [ i + 1 ] [ j ] = ' . ' ; res ++ ; }   }   } }    System . out . println ( res ) ;    } }" ]
[ "n , m = map ( int , input ( ) . strip ( ) . split ( ) ) grid = [ list ( input ( ) . strip ( ) ) for _ in range ( n ) ] valid = lambda x , y : x >= 0 and y >= 0 and x < n and y < mans = 0 directions = [ [ 1 , 0 ] , [ 0 , 1 ] , [ - 1 , 0 ] , [ 0 , - 1 ] ] for i in range ( n ) : for j in range ( m ) : if grid [ i ] [ j ] == ' W ' : NEW_LINE", "n , m = list ( map ( int , input ( ) . split ( ) ) ) a = [ ] for i in range ( n ) : a . append ( [ ] ) c = input ( ) for j in range ( m ) : a [ i ] . append ( c [ j ] ) b = 0 for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] == ' P ' : if i > 0 and a [ i - 1 ] [ j ] == ' W ' : b += 1 a [ i - 1 ] [ j ] = ' . ' if i < n - 1 and a [ i + 1 ] [ j ] == ' W ' : b += 1 a [ i + 1 ] [ j ] = ' . ' if j > 0 and a [ i ] [ j - 1 ] == ' W ' : b += 1 a [ i ] [ j - 1 ] = ' . ' if j < m - 1 and a [ i ] [ j + 1 ] == ' W ' : b += 1 a [ i ] [ j + 1 ] = ' . ' print ( b ) NEW_LINE", "m , n = map ( int , input ( ) . split ( ) ) a = [ input ( ) for _ in [ 0 ] * m ] y = [ - 1 , 0 , 1 , 0 ] x = [ 0 , - 1 , 0 , 1 ] r = 0 for i in range ( m ) : for j in range ( n ) : if a [ i ] [ j ] == ' W ' : for k in range ( 4 ) : u = i + y [ k ] v = j + x [ k ] if u >= 0 and v >= 0 and u < m and v < n and a [ u ] [ v ] == ' P ' : r += 1 breakprint ( r ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) grid = [ ] res = 0 def findPig ( X , Y ) : global res point = grid [ Y ] [ X ] found = False px , py = - 1 , - 1 if Y + 1 < n : if grid [ Y + 1 ] [ X ] == \" P \" : found = True px , py = X , Y + 1 if not found and Y - 1 >= 0 : if grid [ Y - 1 ] [ X ] == \" P \" : found = True px , py = X , Y - 1 if not found and X + 1 < m : if grid [ Y ] [ X + 1 ] == \" P \" : found = True px , py = X + 1 , Y if not found and X - 1 >= 0 : if grid [ Y ] [ X - 1 ] == \" P \" : found = True px , py = X - 1 , Y if found : grid [ Y ] [ X ] = \" . \" grid [ py ] [ px ] = \" . \" res += 1 for i in range ( n ) : grid . append ( list ( input ( ) ) )   for y in range ( n ) : for x in range ( m ) : if grid [ y ] [ x ] == ' W ' : findPig ( x , y ) print ( res ) NEW_LINE" ]
codeforces_1415_B
[ "import java . util . Scanner ; public class Repainting_Streets { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String args [ ] ) { int tc = sc . nextInt ( ) ; for ( int i = 0 ; i < tc ; i ++ ) { int [ ] arr = new int [ 100 ] ; arr = findList ( ) ; System . out . println ( findMin ( arr ) ) ; } } static int [ ] findList ( ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] initial = new int [ n ] ; int output [ ] = new int [ 100 ] ; for ( int i = 0 ; i < n ; i ++ ) { initial [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i <= 100 ; i ++ ) { int days = 0 ; int j = 0 ; while ( true ) { if ( j >= n ) break ; if ( initial [ j ] == i ) { j ++ ; continue ; } else { j = j + k ; days ++ ; } } output [ i - 1 ] = days ; } return output ;   } static int findMin ( int [ ] array ) { int min = array [ 0 ] ; for ( int i = 1 ; i < array . length ; i ++ ) { if ( array [ i ] < min ) min = array [ i ] ; } return min ; }   }", "import java . util . * ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) {", "import java . util . Scanner ;   public class B1415 {   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 ( ) ; int K = in . nextInt ( ) ; int [ ] C = new int [ N ] ; for ( int n = 0 ; n < N ; n ++ ) { C [ n ] = in . nextInt ( ) ; } int min = Integer . MAX_VALUE ; for ( int c = 1 ; c <= 100 ; c ++ ) { int days = 0 ; int pos = 0 ; while ( pos < N ) { if ( C [ pos ] == c ) { pos ++ ; } else { pos += K ; days ++ ; } } min = Math . min ( days , min ) ; } System . out . println ( min ) ; } }   }" ]
[ "import java . util . Scanner ;   public NEW_LINE class B1415 {   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 ( ) ; int K = in . nextInt ( ) ; int [ ] C = new int [ N ] ; for ( int n = 0 ; n < N ; n + + ) { C [ n ] = in . nextInt ( ) ; } int min = Integer . MAX_VALUE ; for ( int c = 1 ; c <= 100 ; c + + ) { int days = 0 ; int pos = 0 ; while ( pos < N ) { if ( C [ pos ] == c ) { pos + + ; } else { pos += K ; days + + ; } } min = Math . min ( days , min ) ; } System . out . println ( min ) ; } }   } NEW_LINE", "import sysfor NEW_LINE _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) NEW_LINE li = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE tmp = 0 NEW_LINE res = sys . maxsize NEW_LINE mx = max ( li ) NEW_LINE for i in range ( 1 , mx + 1 ) : tmp = 0 NEW_LINE cnt = 0 NEW_LINE while cnt < n : if NEW_LINE li [ cnt ] != i : tmp += 1 NEW_LINE cnt += k else : cnt += 1 NEW_LINE if tmp < res : res = tmp NEW_LINE print ( res ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n , k = map ( int , input ( ) . split ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE res = [ ] NEW_LINE for i in range ( 1 , 101 ) : j = 0 NEW_LINE c = 0 NEW_LINE while j < n : if NEW_LINE a [ j ] == i : j += 1 else : j += k NEW_LINE c += 1 NEW_LINE res . append ( c ) NEW_LINE print ( min ( res ) ) NEW_LINE" ]
codeforces_265_B
[ "import java . util . * ; public class RoadsideTrees { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; int i = 0 ; for ( int j = 0 ; j < n ; j ++ ) arr [ j ] = sc . nextInt ( ) ;   int sum = 0 , level = arr [ 0 ] ; sum += arr [ 0 ] ; for ( ; i < n - 1 ; i ++ ) { if ( level == arr [ i ] ) sum ++ ;   if ( i + 1 < n && ( arr [ i ] - arr [ i + 1 ] > 0 ) ) { sum = sum + arr [ i ] - arr [ i + 1 ] + 1 ; level = arr [ i + 1 ] ; } else if ( i + 1 < n && ( arr [ i ] - arr [ i + 1 ] < 0 ) ) { sum = sum + 1 + arr [ i + 1 ] - arr [ i ] ; level = arr [ i + 1 ] ; } else { sum ++ ; } }   if ( level == arr [ i ] ) { sum ++ ; } else { sum = sum + ( arr [ i ] - level ) + 1 ; }   System . out . println ( sum ) ; } }", "import java . util . * ; public class Practice { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] += sc . nextInt ( ) ; } int ans = n + arr [ 0 ] ; for ( int i = 0 ; i < arr . length - 1 ; i ++ ) { ans += Math . abs ( arr [ i + 1 ] - arr [ i ] ) + 1 ; } System . out . println ( ans ) ; } }  ", "import java . util . * ; import java . io . * ;   public class Main {   public static void main ( String [ ] args ) throws IOException {   BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder out = new StringBuilder ( ) ; StringTokenizer tk ;   int oldN = 0 ; int n = Integer . parseInt ( in . readLine ( ) ) ; long minTime = 2 * n - 1 ;   for ( int i = 0 ; i < n ; i ++ ) { int h = Integer . parseInt ( in . readLine ( ) ) ; minTime += Math . abs ( oldN - h ) ; oldN = h ; }   System . out . println ( minTime ) ;   }   }", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {", "import java . util . * ; public class Roadside_Trees {   public static void main ( String [ ] args ) {" ]
[ "n = int ( input ( ) ) count = 0 g = int ( input ( ) ) count += g + 1 for i in range ( n - 1 ) : a = int ( input ( ) ) if ( a > g ) : count += a - g + 1 + 1 g = a else : count += g - a + 1 + 1 g = aprint ( count ) NEW_LINE", "from __future__ import division , print_functionfrom collections import * from math import * from itertools import * from time import timeimport osimport sysfrom io import BytesIO , IOBase if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip ''' Notes : ''' def main ( ) : n = int ( input ( ) ) curr = 1 time = 0 for _ in range ( n ) : height = int ( input ( ) ) time += 1 + abs ( height - curr ) + 1 curr = height print ( time )     NEW_LINE", "from __future__ import division , print_functionfrom collections import * from math import * from itertools import * import osimport sysfrom io import BytesIO , IOBase NEW_LINE", "for _ in range ( 1 ) : n = int ( input ( ) ) currH = 0 total = 0 for i in range ( n ) : h = int ( input ( ) ) if currH <= h : total += h - currH + 2 currH = h   else : total += currH - h + 2 currH = h   print ( total - 1 ) NEW_LINE", "n = int ( input ( ) ) l = [ ] for __ in range ( n ) : a = int ( input ( ) ) l . append ( a )   ans = 2 * n - 1 ans += l [ 0 ]   for i in range ( n - 1 ) : ans += abs ( l [ i + 1 ] - l [ i ] )   print ( ans ) NEW_LINE" ]
codeforces_14_B
[ "import java . util . * ;   public class FoxAndDots {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , x = sc . nextInt ( ) ; int [ ] a = new int [ n ] , b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int l = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; if ( l > q ) { int t = l ; l = q ; q = t ; } a [ i ] = l ; b [ i ] = q ; } int c = 0 ; int l = a [ 0 ] ; int r = b [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) {   if ( l > b [ i ] || r < a [ i ] ) { System . out . println ( - 1 ) ; System . exit ( 0 ) ; }   l = Math . max ( l , a [ i ] ) ; r = Math . min ( r , b [ i ] ) ; } if ( x < l ) { c = l - x ; } else if ( x > r ) { c = x - r ; } System . out . println ( c ) ; }   }", "import java . lang . * ; import java . util . * ;   public class Abhishek {   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] [ ] s = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a < b ) { s [ i ] [ 0 ] = a ; s [ i ] [ 1 ] = b ; } else { s [ i ] [ 0 ] = b ; s [ i ] [ 1 ] = a ; } } int maxStart = Integer . MIN_VALUE ; int minEnd = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] [ 0 ] > maxStart ) maxStart = s [ i ] [ 0 ] ; if ( s [ i ] [ 1 ] < minEnd ) minEnd = s [ i ] [ 1 ] ; } if ( maxStart > minEnd ) System . out . println ( - 1 ) ; else if ( maxStart < x && x < minEnd ) System . out . println ( 0 ) ; else if ( x <= maxStart ) { System . out . println ( maxStart - x ) ; } else { System . out . println ( x - minEnd ) ; } }   }" ]
[ "import sysimport mathclass DictList ( dict ) : def __setitem__ ( self , key , value ) : try : NEW_LINE", "import sysimport mathclass DictList ( dict ) : def __setitem__ ( self , key , value ) : try : NEW_LINE", "l = 0 ; r = 1E4 n , x = map ( int , input ( ) . split ( ) ) for _ in [ 0 ] * n : a , b = sorted ( map ( int , input ( ) . split ( ) ) ) l = max ( l , a ) r = min ( r , b ) print ( [ [ [ x - r , l - x ] [ x < l ] , 0 ] [ l <= x <= r ] , - 1 ] [ l > r ] ) NEW_LINE" ]
codeforces_1227_A
[ "# include < bits / stdc ++ . h > using namespace std ; void solve ( ) { int n ; cin >> n ; int mnX = 1e9 , mxY = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { int x , y ; cin >> x >> y ; mnX = min ( mnX , y ) , mxY = max ( mxY , x ) ; } cout << max ( 0 , mxY - mnX ) ; } int main ( ) { int t ; cin >> t ; while ( t -- ) { solve ( ) , cout << endl ; } return 0 ; }", "# include < iostream > # include < vector > # include < algorithm > # include < string > # include < cmath > # include < math . h > # define int long long using namespace std ;   int32_t main ( ) { # ifndef ONLINE_JUDGE freopen ( \" input . txt \" , \" r \" , stdin ) ; freopen ( \" output . txt \" , \" w \" , stdout ) ; # endif int t ; cin >> t ; while ( t -- ) { int n ; cin >> n ; vector < int > a ( n ) ; vector < int > b ( n ) ; for ( int i = 0 ; i < n ; i ++ ) { cin >> a [ i ] ; cin >> b [ i ] ; } sort ( a . begin ( ) , a . end ( ) ) ; sort ( b . begin ( ) , b . end ( ) ) ; int sum = a [ n - 1 ] - b [ 0 ] ; if ( sum > 0 ) cout << sum << endl ; else { cout << 0 << endl ; } } }", "import java . io . PrintWriter ; import java . util . Scanner ;   public class MathProblem { static Scanner sc = new Scanner ( System . in ) ; static PrintWriter pw = new PrintWriter ( System . out ) ;   public static void main ( String args [ ] ) { int t = sc . nextInt ( ) ; while ( t -- > 0 ) { solve ( ) ; } }   private static void solve ( ) { int n = sc . nextInt ( ) ; int leftEnd = Integer . MAX_VALUE ; int rightStart = Integer . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; leftEnd = Math . min ( leftEnd , r ) ; rightStart = Math . max ( rightStart , l ) ; }   int ans = 0 ; if ( leftEnd >= rightStart ) { ans = 0 ; } else { ans = rightStart - leftEnd ; }   System . out . println ( ans ) ; } }" ]
[ "for _ in range ( int ( input ( ) ) ) : mx = 1 mn = 10 ** 9 for o in range ( int ( input ( ) ) ) : l , r = map ( int , input ( ) . split ( ) ) mx = max ( mx , l ) mn = min ( mn , r ) print ( max ( 0 , mx - mn ) ) 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", "t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) maxl , minr = 1 , 10 ** 9 for i in range ( n ) : l , r = map ( int , input ( ) . split ( ) ) maxl , minr = max ( maxl , l ) , min ( minr , r ) if maxl <= minr : print ( 0 ) else : print ( maxl - minr ) NEW_LINE", "for _ in \" ▁ \" * int ( int ( input ( ) ) ) : z = 0 ; z1 = 10 ** 9 for i in range ( int ( input ( ) ) ) : a , b = map ( int , input ( ) . split ( ) ) ; z = max ( a , z ) ; z1 = min ( b , z1 ) print ( max ( 0 , z - z1 ) ) NEW_LINE", "t = int ( input ( ) ) left = [ ] right = [ ] for i in range ( t ) : n = int ( input ( ) ) for j in range ( n ) : l , r = map ( int , input ( ) . split ( ) ) left . append ( l ) right . append ( r ) if ( max ( left ) - min ( right ) ) > 0 : print ( max ( left ) - min ( right ) ) else : print ( 0 ) left . clear ( ) right . clear ( ) NEW_LINE" ]
codeforces_811_B
[ "import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int a [ ] = new int [ n ] ; StringBuilder ans = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { int l = input . nextInt ( ) ; int r = input . nextInt ( ) ; int x = input . nextInt ( ) ; int count = 0 ; for ( int j = l ; j <= r ; j ++ ) { if ( a [ j - 1 ] < a [ x - 1 ] ) count ++ ; } if ( count == x - l ) ans . append ( \" Yes \\n \" ) ; else ans . append ( \" No \\n \" ) ; } System . out . println ( ans ) ; } }", "import java . util . Arrays ; import java . util . Scanner ;   public class VladikandComplicatedBook {   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 ] ; for ( int i = 0 ; i < n ; i ++ ) { int in = scan . nextInt ( ) ; a [ i ] = in ;   } q : while ( m -- > 0 ) { int l = scan . nextInt ( ) ; int r = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; int p = a [ x - 1 ] ; int mn = 0 ; int mx = 0 ; for ( int i = l - 1 ; i < x - 1 ; i ++ ) { if ( a [ i ] > p ) { ++ mx ; } } for ( int i = x ; i < r ; i ++ ) { if ( a [ i ] < p ) { ++ mn ; } } if ( mx == mn ) { System . out . println ( \" Yes \" ) ; } else { System . out . println ( \" No \" ) ; } }   }   }", "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 ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BVladikAndComplicatedBook solver = new BVladikAndComplicatedBook ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class BVladikAndComplicatedBook { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = in . nextInt ( ) ; while ( m -- > 0 ) { int l = in . nextInt ( ) ; int r = in . nextInt ( ) ; int x = in . nextInt ( ) ; l -- ; r -- ; x -- ; int c = 0 ; for ( int i = l ; i <= r ; i ++ ) { if ( a [ i ] < a [ x ] ) c ++ ; }   if ( c == ( x - l ) ) { out . println ( \" Yes \" ) ; } else { out . println ( \" No \" ) ; } } }   }   static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; }   public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }  ", "import java . util . * ;   public class B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , q = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) p [ i ] = sc . nextInt ( ) - 1 ; while ( q -- > 0 ) { int l = sc . nextInt ( ) - 1 , r = sc . nextInt ( ) , pos = sc . nextInt ( ) - 1 ; int cnt = 0 ; for ( int i = l ; i < r ; i ++ ) if ( p [ i ] < p [ pos ] ) cnt ++ ; System . out . println ( cnt == pos - l ? \" Yes \" : \" No \" ) ; } } }" ]
[ "INDENT import mathfor _ in range ( 1 ) : n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( k ) : cnt = 0 a , b , c = map ( int , input ( ) . split ( ) ) for j in range ( a - 1 , b ) : if l [ j ] < l [ c - 1 ] : cnt += 1 if cnt + a == c : print ( \" Yes \" ) else : print ( \" No \" ) NEW_LINE DEDENT" ]
codeforces_159_B
[ "import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ;   public class B159 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int M = in . nextInt ( ) ; Map < Integer , Map < Integer , Integer > > map = new HashMap < > ( ) ; Map < Integer , Integer > countMap = new HashMap < > ( ) ; for ( int n = 0 ; n < N ; n ++ ) { int c = in . nextInt ( ) ; int d = in . nextInt ( ) ; Map < Integer , Integer > im = map . get ( d ) ; if ( im == null ) { im = new HashMap < > ( ) ; map . put ( d , im ) ; } int count = im . getOrDefault ( c , 0 ) ; im . put ( c , count + 1 ) ; count = countMap . getOrDefault ( d , 0 ) ; countMap . put ( d , count + 1 ) ; } int [ ] C = new int [ M ] ; int [ ] D = new int [ M ] ; for ( int m = 0 ; m < M ; m ++ ) { C [ m ] = in . nextInt ( ) ; D [ m ] = in . nextInt ( ) ; } int beautiful = 0 ; for ( int m = 0 ; m < M ; m ++ ) { Map < Integer , Integer > im = map . getOrDefault ( D [ m ] , Collections . emptyMap ( ) ) ; int count = im . getOrDefault ( C [ m ] , 0 ) ; if ( count != 0 ) { beautiful ++ ; im . put ( C [ m ] , count - 1 ) ; countMap . put ( D [ m ] , countMap . get ( D [ m ] ) - 1 ) ; D [ m ] = 0 ;", "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 ( ) , m = sc . nextInt ( ) ; int p [ ] = new int [ 2005 ] ; int q [ ] [ ] = new int [ 1001 ] [ 1001 ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) , y = sc . nextInt ( ) ; p [ y ] ++ ; q [ x ] [ y ] ++ ; } int ans1 = 0 , ans2 = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int x = sc . nextInt ( ) , y = sc . nextInt ( ) ; if ( p [ y ] > 0 ) { ans1 ++ ; p [ y ] -- ; } if ( q [ x ] [ y ] > 0 ) { ans2 ++ ; q [ x ] [ y ] -- ; } } System . out . printf ( \" % d ▁ % d \\n \" , ans1 , ans2 ) ; } 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 ( ) ) ; } } }" ]
[ "n , m = map ( int , input ( ) . split ( ) ) m1 = { } m2 = { } c1 = { } c2 = { } for i in range ( n ) : x , y = ( map ( int , input ( ) . split ( ) ) ) m1 [ y ] = m1 . get ( y , 0 ) + 1 m2 [ ( x , y ) ] = m2 . get ( ( x , y ) , 0 ) + 1 for i in range ( m ) : x , y = ( map ( int , input ( ) . split ( ) ) ) c1 [ y ] = c1 . get ( y , 0 ) + 1 c2 [ ( x , y ) ] = c2 . get ( ( x , y ) , 0 ) + 1 r1 = 0 r2 = 0 for i in m1 . keys ( ) : if i in c1 . keys ( ) : t1 = m1 [ i ] t2 = c1 [ i ] r1 = r1 + ( min ( t1 , t2 ) )   for i in m2 . keys ( ) : if i in c2 . keys ( ) : t1 = m2 [ i ] t2 = c2 [ i ] r2 = r2 + ( min ( t1 , t2 ) ) print ( r1 , r2 ) NEW_LINE", "import sysfrom collections import Countern , m = map ( int , input ( ) . split ( ) ) l1 = [ ] ; l2 = [ ] ; for i in range ( n ) : l1 . append ( input ( ) ) for i in range ( m ) : l2 . append ( input ( ) ) c1 = Counter ( l1 ) c2 = Counter ( l2 ) c = 0 ; s = 0 ; c3 = c1 & c2 NEW_LINE", "from collections import Counter   def read_ints ( ) : return tuple ( int ( x ) for x in input ( ) . split ( ) )   def parse_input ( size ) : data = [ read_ints ( ) for _ in range ( size ) ] by_diam = Counter ( size for diam , size in data ) by_color = Counter ( data ) return by_diam , by_color   n , m = read_ints ( ) pens_by_diam , pens_by_color = parse_input ( n ) caps_by_diam , caps_by_color = parse_input ( m ) closed = sum ( ( pens_by_diam & caps_by_diam ) . values ( ) ) beautiful = sum ( ( pens_by_color & caps_by_color ) . values ( ) ) print ( closed , beautiful ) NEW_LINE", "from functools import cmp_to_key     def main ( ) : n , m = map ( int , input ( ) . split ( ) ) markers = [ ] caps = [ ]   for _ in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) markers . append ( ( x , y ) )   for _ in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) caps . append ( ( x , y ) )   marker_sizes = dict ( ) cap_sizes = dict ( ) marker_dict = dict ( ) cap_dict = dict ( )   for m in markers : if marker_sizes . get ( m [ 1 ] ) : marker_sizes [ m [ 1 ] ] += 1 else : marker_sizes [ m [ 1 ] ] = 1 if marker_dict . get ( m ) : marker_dict [ m ] += 1 else : marker_dict [ m ] = 1 for c in caps : if cap_sizes . get ( c [ 1 ] ) : cap_sizes [ c [ 1 ] ] += 1 else : cap_sizes [ c [ 1 ] ] = 1 if cap_dict . get ( c ) : cap_dict [ c ] += 1 else : cap_dict [ c ] = 1 ans1 = 0 for s , c1 in marker_sizes . items ( ) : c2 = cap_sizes . get ( s ) if c2 : ans1 += min ( c1 , c2 ) ans2 = 0 for val , freq in marker_dict . items ( ) : x = cap_dict . get ( val ) if x : ans2 += min ( freq , x )   return ' { } ▁ { } ' . format ( ans1 , ans2 )     if __name__ == ' _ _ main _ _ ' : print ( main ( ) ) NEW_LINE" ]
codeforces_292_A
[ "import java . io . InputStreamReader ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . math . BigInteger ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } }   class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int qSize = 0 ; int maxQSize = 0 ; int timeLast = 0 ; int n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; ++ i ) { int time = in . nextInt ( ) ; int am = in . nextInt ( ) ; if ( timeLast <= time ) { qSize = 0 ; } else { qSize = timeLast - time ; } timeLast = Math . max ( time + am , timeLast + am ) ; qSize += am ; maxQSize = Math . max ( maxQSize , qSize ) ; } out . println ( timeLast + \" ▁ \" + maxQSize ) ; } }   class InputReader { private BufferedReader reader ; private StringTokenizer stt ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) ) ; }   public String nextLine ( ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { return null ; } }   public String nextString ( ) { while ( stt == null || ! stt . hasMoreTokens ( ) ) { stt = new StringTokenizer ( nextLine ( ) ) ; } return stt . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( nextString ( ) ) ; }   }  " ]
[ "pt , s , vs = 0 , 0 , 0 for i in range ( int ( input ( ) ) ) : t , c = map ( int , input ( ) . split ( ) ) s = max ( s - ( t - pt ) , 0 ) + c vs = max ( vs , s ) pt = tprint ( pt + s , vs ) NEW_LINE", "n = int ( input ( ) )   mt = 0 mq = 0   t = 0 q = 0   for i in range ( n ) : ( ti , ci ) = map ( int , input ( ) . split ( ) ) q = max ( 0 , q - ti + t ) t = ti q += ci mq = max ( mq , q ) mt = t + q   print ( mt , mq ) NEW_LINE", "n = int ( input ( ) ) q = max_q = t0 = 0 for i in range ( n ) : t , c = map ( int , input ( ) . split ( ) ) q = max ( 0 , q - t + t0 ) + c if q > max_q : max_q = q t0 = tprint ( t0 + q , max_q ) NEW_LINE", "n = int ( input ( ) ) ans , p , s = 0 , 0 , 0 for i in range ( n ) : t , c = map ( int , input ( ) . split ( ) ) s -= min ( s , t - p ) p = t s += c if s > ans : ans = sprint ( p + s , ans ) NEW_LINE", "import sysimport math   n = int ( input ( ) )   a , b = list ( map ( int , input ( ) . split ( ) ) ) vmax = bfor i in range ( 1 , n ) : c , d = list ( map ( int , input ( ) . split ( ) ) ) b = max ( 0 , b - ( c - a ) ) a = c b += d vmax = max ( b , vmax )   print ( a + b , vmax ) NEW_LINE" ]
codeforces_330_A
[ "import java . util . * ; import java . math . * ;   public class gfg { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String [ ] s = new String [ r ] ; for ( int i = 0 ; i < r ; i ++ ) s [ i ] = sc . next ( ) ; char [ ] [ ] a = new char [ r ] [ c ] ; for ( int i = 0 ; i < r ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) a [ i ] [ j ] = s [ i ] . charAt ( j ) ; } int er = 0 ; int ec = 0 ; for ( int i = 0 ; i < r ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < c ; j ++ ) { if ( a [ i ] [ j ] == ' . ' ) count ++ ; else break ; } if ( count == c ) er ++ ; } for ( int i = 0 ; i < c ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < r ; j ++ ) { if ( a [ j ] [ i ] == ' . ' ) count ++ ; else break ; } if ( count == r ) ec ++ ; }", "import java . io . * ; import java . lang . * ; import java . util . ArrayList ;   public class _temp2 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] st = br . readLine ( ) . split ( \" ▁ \" ) ; int n = Integer . parseInt ( st [ 0 ] ) ; int m = Integer . parseInt ( st [ 1 ] ) ; ArrayList < Integer > row = new ArrayList < > ( ) ; ArrayList < Integer > col = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { row . add ( i ) ; } for ( int i = 0 ; i < m ; i ++ ) { col . add ( i ) ; } for ( int i = 0 ; i < n ; i ++ ) { st = br . readLine ( ) . split ( \" \" ) ; for ( int j = 0 ; j < m ; j ++ ) { if ( st [ j ] . equals ( \" S \" ) ) { row . remove ( new Integer ( i ) ) ; col . remove ( new Integer ( j ) ) ; } } } System . out . println ( ( n * m ) - ( n - row . size ( ) ) * ( m - col . size ( ) ) ) ; } }", "import java . util . Scanner ; public class cakeminator { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int r = s . nextInt ( ) ; int c = s . nextInt ( ) ; int total = r * c ; boolean [ ] row = new boolean [ r ] ; boolean [ ] col = new boolean [ c ] ; s . nextLine ( ) ; int monsC = 0 ; int monsR = 0 ; int k = 0 ; while ( k < r ) { String p = s . nextLine ( ) ; for ( int i = 0 ; i < p . length ( ) ; i ++ ) { if ( p . charAt ( i ) == ' S ' ) { if ( ! row [ k ] ) { monsR ++ ; row [ k ] = true ; } if ( ! col [ i ] ) { monsC ++ ; col [ i ] = true ; } } } k ++ ; } if ( monsC * monsR >= total ) { System . out . println ( 0 ) ; } else { System . out . println ( total - monsC * monsR ) ; } } }" ]
[ "import sysimport itertoolsimport collections     def rs ( x = ' ' ) : return sys . stdin . readline ( ) . strip ( ) if len ( x ) == 0 else input ( x ) . strip ( ) def ri ( x = ' ' ) : return int ( rs ( x ) ) def rm ( x = ' ' ) : return map ( str , rs ( x ) . split ( ) ) def rl ( x = ' ' ) : return rs ( x ) . split ( ) def rmi ( x = ' ' ) : return map ( int , rs ( x ) . split ( ) ) def rli ( x = ' ' ) : return [ int ( x ) for x in rs ( x ) . split ( ) ] def println ( val ) : sys . stdout . write ( str ( val ) + ' \\n ' )     def solve ( testCase ) : r , c = rmi ( ) grid = [ list ( rs ( ) ) for _ in range ( r ) ] visited = [ [ False for _ in range ( c ) ] for _ in range ( r ) ] ans = 0 for i in range ( r ) : monster = False for j in range ( c ) : if grid [ i ] [ j ] == ' S ' : monster = True break if not monster : for j in range ( c ) : if not visited [ i ] [ j ] : ans += 1 visited [ i ] [ j ] = True for i in range ( c ) : monster = False for j in range ( r ) : if grid [ j ] [ i ] == ' S ' : monster = True break if not monster : for j in range ( r ) : if not visited [ j ] [ i ] : ans += 1 visited [ j ] [ i ] = True print ( ans )     for _ in range ( ri ( ) if 0 else 1 ) : solve ( _ + 1 ) NEW_LINE", "r , c = map ( int , input ( ) . split ( ) ) l = [ ] for x1 in range ( r ) : l . append ( list ( str ( input ( ) ) ) ) a = 0 e = [ ] for a1 in range ( r ) : s2 = 0 for a2 in range ( c ) : if l [ a1 ] [ a2 ] == \" . \" : s2 += 1 if s2 == c : a += s2 e . append ( a1 ) b = 0 f = [ ] for b1 in range ( c ) : s3 = 0 for b2 in range ( r ) : if l [ b2 ] [ b1 ] == \" . \" : s3 += 1 if s3 == r : b += s3 f . append ( b1 ) print ( a + b - len ( e ) * len ( f ) ) NEW_LINE", "row , col = map ( int , input ( ) . split ( ) ) tab = [ [ i for i in input ( ) ] for j in range ( row ) ] num_row = num_col = 0 tab_2 = [ ] for ind , i in enumerate ( tab ) : if ' S ' not in i : num_row += len ( i ) else : tab_2 . append ( i ) tmp = 0 if len ( tab_2 ) == 0 : print ( num_row ) else : for i in range ( len ( tab_2 [ 0 ] ) ) : if tmp == 1 : num_col += len ( tab_2 ) tmp = 0 for j in range ( len ( tab_2 ) ) : if tab_2 [ j ] [ i ] == ' S ' : tmp = 0 break tmp = 1 if tmp == 1 : num_col += len ( tab_2 ) print ( num_row + num_col ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) c = 0 s = set ( ) for i in range ( n ) : k = input ( ) if ' S ' not in k : c += 1 continue for j in range ( m ) : if k [ j ] == ' S ' : s . add ( j ) t = ( m - len ( s ) ) * n + c * m - c * ( m - len ( s ) ) print ( t ) NEW_LINE" ]
codeforces_919_B
[ "import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Long > list = new ArrayList < > ( ) ; for ( long i = 1 ; i <= 1e8 ; i ++ ) { long num = i ; long sum = 0 ; while ( num != 0 ) { long d = num % 10 ; sum += d ; num /= 10 ; } if ( sum == 10 ) { list . add ( i ) ; } if ( list . size ( ) > 10000 ) { break ; } }", "import java . util . Scanner ;   public class _0852PerfectNumber { static int countSum ( int n ) { int sum = 0 ; while ( n > 0 ) { sum += n % 10 ; n = n / 10 ; } return sum ; }   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int n = 0 ; int val = 19 ; int sum = countSum ( val ) ; while ( n < k ) { if ( sum == 10 ) { n ++ ; } val ++ ; sum = countSum ( val ) ; } System . out . println ( val - 1 ) ; }   }", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int i = 10 , sum = 0 , count = 0 , ans = 0 ; int k = s . nextInt ( ) ; while ( true ) { sum = 0 ; int j = i ; while ( j != 0 ) { int a = j % 10 ; sum = sum + a ; j = j / 10 ; } if ( sum == 10 ) { count ++ ; if ( count == k ) { ans = i ; break ; } } i ++ ; } System . out . println ( ans ) ; } }", "import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class absolute { static int k ; static String ans ; static void process ( char [ ] ch , int cur , int pos ) {", "import javax . print . DocFlavor ; import javax . swing . * ; import java . awt . image . BandedSampleModel ; import java . util . * ;   public class Example { static long [ ] [ ] dp ;" ]
[ "def cal ( n ) : s = 0 while n > 0 : s += ( n % 10 ) n //= 10 return s   n = int ( input ( ) ) curr = 1 while n > 0 : curr += 1 if cal ( curr ) == 10 : n -= 1 print ( curr ) NEW_LINE", "def find ( num ) : s = 0 while num > 0 : s = s + num % 10 num = num // 10 return sn = int ( input ( ) ) c = 1 num = 19 while c < n : num = num + 9 if find ( num ) == 10 : c = c + 1 print ( num )   NEW_LINE", "def is_good ( z ) : t = 0 while z : t += z % 10 z //= 10   return t == 10     n = int ( input ( ) ) dp = [ 0 ] * ndp [ 0 ] = 19   for i in range ( 1 , n ) : s = str ( dp [ i - 1 ] ) m = len ( s ) for j in range ( m - 1 , - 1 , - 1 ) : if s [ j ] != '0' : s = s [ : j ] + s [ j : ] [ : : - 1 ] break   f = 9 NEW_LINE", "def digit ( x ) : t = 0 while x : t += x % 10 x = x // 10 return t   k = int ( input ( ) ) x = 19 while k > 1 : x = x + 9 if digit ( x ) == 10 : k -= 1 print ( x ) NEW_LINE" ]
codeforces_1082_A
[ "import java . util . * ; 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 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 ) 1e6 ; static long mod = 998244353l ;", "import java . util . * ; import java . io . * ; public class A { public static void main ( String args [ ] ) { FastScanner in = new FastScanner ( ) ; int t = in . nextInt ( ) ; while ( -- t >= 0 ) { int n = in . nextInt ( ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; int d = in . nextInt ( ) ; int diff = Math . abs ( x - y ) ; if ( x != y && diff % d != 0 && ( y - 1 ) % d != 0 && ( n - y ) % d != 0 ) System . out . println ( - 1 ) ; else if ( diff % d == 0 ) System . out . println ( diff / d ) ; else { if ( ( y - 1 ) % d == 0 && ( n - y ) % d == 0 ) System . out . println ( Math . min ( ( y - 1 ) / d + ( x - 1 + d - 1 ) / d , ( n - y ) / d + ( n - x + d - 1 ) / d ) ) ; else if ( ( y - 1 ) % d == 0 ) System . out . println ( ( y - 1 ) / d + ( x - 1 + d - 1 ) / d ) ; else System . out . println ( ( n - y ) / d + ( n - x + d - 1 ) / d ) ; } } }  ", "import java . util . * ; import java . lang . * ; import java . io . * ; import java . math . * ;    public class file {   " ]
[ "def do ( ) : import math n , x , y , d = map ( int , input ( ) . split ( ) ) x -= 1 y -= 1 n -= 1 res = 10 ** 18 if x == y : print ( 0 ) return if ( y - x ) % d == 0 : print ( abs ( ( y - x ) ) // d ) return   cnt = 0 cnt = math . ceil ( x / d ) if y % d == 0 : cnt += abs ( y // d ) res = min ( res , cnt )   cnt = 0 cnt = math . ceil ( ( n - x ) / d ) if ( n - y ) % d == 0 : cnt += abs ( ( n - y ) // d ) res = min ( res , cnt )   if res == 10 ** 18 : print ( - 1 ) return else : print ( res ) return   qq = int ( input ( ) ) for _ in range ( qq ) : do ( ) NEW_LINE", "from math import ceilfor _ in range ( int ( input ( ) ) ) : n , x , y , d = map ( int , input ( ) . split ( ) ) if abs ( x - y ) % d == 0 : print ( abs ( x - y ) // d ) else : ans = 10 ** 18 if ( y - 1 ) % d == 0 : ans = min ( ans , ( y - 1 ) // d + ( x - 1 + d - 1 ) // d ) if ( n - y ) % d == 0 : ans = min ( ans , ( n - y ) // d + ( n - x + d - 1 ) // d ) if ans == 10 ** 18 : print ( - 1 ) else : print ( ans ) NEW_LINE", "from math import ceilfor _ in range ( int ( input ( ) ) ) : n , x , y , d = map ( int , input ( ) . split ( ) ) if abs ( x - y ) % d == 0 : print ( abs ( x - y ) // d ) else : ans = 10 ** 18 if ( y - 1 ) % d == 0 : ans = min ( ans , ( y - 1 ) // d + ceil ( ( x - 1 ) / d ) ) if ( n - y ) % d == 0 : ans = min ( ans , ( n - y ) // d + ceil ( ( n - x ) / d ) ) if ans == 10 ** 18 : print ( - 1 ) else : print ( ans ) NEW_LINE" ]
codeforces_560_A
[ "import java . util . * ;   public class Practise {   static int [ ] [ ] dp ;    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; boolean tt = false ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; if ( a == 1 ) { tt = true ; } } if ( tt ) System . out . println ( - 1 ) ; else System . out . println ( 1 ) ;     } }  ", "import java . util . * ;   public class StackBracket { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ;    for ( int i = 0 ; i < n ; i ++ ) { int num = sc . nextInt ( ) ; if ( num == 1 ) { ans = - 1 ;", "import java . util . * ; public class CurrencySysteminGeraldion {   public static void main ( String [ ] args ) {", "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 . util . * ; import java . io . * ; public class Main { static int gcd ( int a , int b ) { if ( b == 0 ) { return a ; } return gcd ( b , a % b ) ; } static boolean check ( int n ) { if ( n % 2 == 0 || n % 6 == 0 ) { return false ; } if ( n % 3 == 0 ) { return false ; } for ( int i = 6 ; i * i <= n ; i += 6 ) { if ( n % ( i - 1 ) == 0 || n % ( i + 1 ) == 0 ) return false ; } return true ; }   public static void main ( String [ ] args ) { FastScanner scan = new FastScanner ( ) ; int t = scan . nextInt ( ) ; int a [ ] = new int [ t ] ; for ( int i = 0 ; i < t ; ++ i ) { a [ i ] = scan . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] == 1 ) { System . out . print ( \" - 1\" ) ; } else { System . out . print ( 1 ) ; }        } } ; 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 = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   has_1 = False   for i in a : if i == 1 : has_1 = True breakprint ( - 1 if has_1 else 1 ) NEW_LINE", "import sysfrom math import sqrt , log , log2 , ceil , log10 , gcd , floor , pow , sin , cos , tan , pi , inf , factorialfrom copy import copy , deepcopyfrom sys import exit , stdin , stdoutfrom collections import Counter , defaultdict , dequefrom itertools import permutationsimport heapqfrom bisect import bisect_left from bisect import bisect_right NEW_LINE", "import sysfrom functools import lru_cache , cmp_to_keyfrom heapq import merge , heapify , heappop , heappushfrom math import * from collections import defaultdict as dd , deque , Counter as Cfrom itertools import combinations as comb , permutations as permfrom bisect import bisect_left as bl , bisect_right as br , bisect , insortfrom time import perf_counterfrom fractions import Fractionimport copyfrom copy import deepcopyimport timestarttime = time . time ( ) mod = int ( pow ( 10 , 9 ) + 7 ) mod2 = 998244353   def data ( ) : return sys . stdin . readline ( ) . strip ( ) def out ( * var , end = \" \\n \" ) : sys . stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) def L ( ) : return list ( sp ( ) ) def sl ( ) : return list ( ssp ( ) ) def sp ( ) : return map ( int , data ( ) . split ( ) ) def ssp ( ) : return map ( str , data ( ) . split ( ) ) def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] def l2d ( n , m , val = 0 ) : return [ l1d ( n , val ) for j in range ( m ) ] try : NEW_LINE", "a = input ( ) b = input ( ) . split ( ) if \"1\" in b : print ( \" - 1\" ) else : print ( \"1\" ) NEW_LINE", "n = int ( input ( ) ) notes = list ( map ( int , input ( ) . split ( ) ) ) print ( ( 1 , - 1 ) [ min ( notes ) == 1 ] ) NEW_LINE" ]
codeforces_68_B
[ "import java . io . * ; import java . util . * ;   public class practice68b { public static void main ( String [ ] args ) throws Exception {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Main { static double inc ; static double dec ; public static void main ( String [ ] arg ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; double per = ( ( 100 - k ) / 100.0 ) ; int max = 0 ; int [ ] arr = new int [ n ] ; int min = 10001 ; st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; max = Math . max ( max , arr [ i ] ) ; min = Math . min ( min , arr [ i ] ) ; } double lo = min ; double hi = max ; double ans = lo ; while ( hi - lo > ( double ) 1e-6 ) { double mid = lo + ( hi - lo ) / 2.0 ; check ( arr , mid ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Main { static double inc ; static double dec ; public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; double per = ( ( 100 - k ) / 100.0 ) ; int max = 0 ; int [ ] arr = new int [ n ] ; int min = 10001 ; st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; max = Math . max ( max , arr [ i ] ) ; min = Math . min ( min , arr [ i ] ) ; } double lo = min ; double hi = max ; double ans = lo ; while ( hi - lo > ( double ) 1e-6 ) { double mid = lo + ( hi - lo ) / 2.0 ; check ( arr , mid ) ;" ]
[ "n , k = map ( int , input ( ) . split ( ) ) NEW_LINE a = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE l = 0 NEW_LINE r = 1001 NEW_LINE while r - l > 0.0000001 : m = ( r + l ) / 2 ; plus = 0 NEW_LINE minus = 0 NEW_LINE for i in range ( n ) : if NEW_LINE a [ i ] <= m : plus += m - a [ i ] else : minus += a [ i ] - m NEW_LINE minus = minus * ( 100 - k ) / 100 NEW_LINE if minus >= plus : NEW_LINE INDENT l = m else : NEW_LINE r = mprint ( l ) NEW_LINE DEDENT", "n , k = map ( int , input ( ) . split ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l . sort ( reverse = True ) NEW_LINE s = sum ( l ) NEW_LINE s1 = 0 NEW_LINE s2 = sans = 0 NEW_LINE k = 100 - kfor NEW_LINE i in range ( n - 1 ) : NEW_LINE", "n , k = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE arr = list ( map ( int , input ( ) . split ( ) ) )   NEW_LINE def bins ( ) : l = 0 NEW_LINE r = 10000000000000 NEW_LINE for i in range ( 100 ) : mid = ( l + r ) / 2 NEW_LINE if f ( mid ) : NEW_LINE INDENT l = mid else : NEW_LINE r = mid NEW_LINE DEDENT print ( l )     NEW_LINE def f ( s ) : sent = 0 NEW_LINE sentR = 0 NEW_LINE for i in range ( n ) : if NEW_LINE arr [ i ] < s : sentR += ( ( s - arr [ i ] ) * 100 ) / ( 100 - k ) elif arr [ i ] > s : sent += arr [ i ] - s NEW_LINE return sent >= sentRbins ( ) NEW_LINE" ]
codeforces_1150_A
[ "import java . util . Scanner ;   public class Stock { public static void main ( String [ ] args ) {   Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int m = scn . nextInt ( ) ; int r = scn . nextInt ( ) ; int count = 0 ;   int [ ] a = new int [ n ] ; int [ ] b = new int [ m ] ;   for ( int i = 0 ; i < n ; i ++ ) a [ i ] = scn . nextInt ( ) ;   for ( int i = 0 ; i < m ; i ++ ) b [ i ] = scn . nextInt ( ) ;   int mina = a [ 0 ] ; int maxb = b [ 0 ] ;   for ( int i = 0 ; i < n ; i ++ ) mina = Math . min ( mina , a [ i ] ) ;   for ( int i = 0 ; i < m ; i ++ ) maxb = Math . max ( maxb , b [ i ] ) ; if ( maxb < mina ) System . out . println ( r ) ; else System . out . println ( maxb * ( r / mina ) + r % mina ) ;    } }", "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 _p001150A { static public void main ( final String [ ] args ) throws IOException { p001150A . _main ( args ) ; }", "  import java . util . * ; import java . lang . * ;", "import java . util . * ; import java . io . * ; import java . math . * ; public class Main { static void solve ( ) {", "import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int s [ ] = new int [ n ] ; int b [ ] = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } Arrays . sort ( s ) ; Arrays . sort ( b ) ; int f = 0 ; if ( s [ 0 ] >= b [ m - 1 ] ) { System . out . println ( r ) ; } else { int p = r / s [ 0 ] ; int k = r % s [ 0 ] ; f = b [ m - 1 ] * p ; f += k ; System . out . println ( f ) ; } } }" ]
[ "buy , sell , money = map ( int , input ( ) . split ( ) ) minPrice = min ( list ( map ( int , input ( ) . split ( ) ) ) ) maxPrice = max ( list ( map ( int , input ( ) . split ( ) ) ) ) print ( max ( money , ( money // minPrice ) * maxPrice + money % minPrice ) ) NEW_LINE", "i = lambda : map ( int , input ( ) . split ( ) ) _ , _ , r = i ( ) s = min ( i ( ) ) b = max ( s , * i ( ) ) print ( r % s + r // s * b ) NEW_LINE", "R = int ( input ( ) . split ( ) [ - 1 ] )   best_buy = min ( map ( int , input ( ) . split ( ) ) ) best_sell = max ( map ( int , input ( ) . split ( ) ) )   num_buy = R // best_buy   print ( max ( R , R + ( best_sell - best_buy ) * num_buy ) ) NEW_LINE", "N , M , R = map ( int , input ( ) . split ( ) ) S = list ( map ( int , input ( ) . split ( ) ) ) B = list ( map ( int , input ( ) . split ( ) ) ) ms = min ( S ) mb = max ( B ) print ( max ( mb * ( R // ms ) + R % ms , R ) ) NEW_LINE", "def solve ( ) : l = list ( map ( int , input ( ) . split ( ) ) ) l2 = list ( map ( int , input ( ) . split ( ) ) ) l3 = list ( map ( int , input ( ) . split ( ) ) ) l2 . sort ( ) l3 . sort ( ) if ( l2 [ 0 ] < l3 [ len ( l3 ) - 1 ] ) : x = int ( l [ 2 ] / l2 [ 0 ] ) * l3 [ len ( l3 ) - 1 ] + ( l [ 2 ] % l2 [ 0 ] ) print ( x ) else : print ( l [ 2 ] ) solve ( ) NEW_LINE" ]
codeforces_1411_B
[ "import java . util . * ; public class FairNumber { public static int check ( long n ) { long x = n ; while ( x != 0 ) { if ( x % 10 != 0 && n % ( x % 10 ) != 0 ) return - 1 ; x /= 10 ; } return 1 ; }   public static void main ( String [ ] args ) {", "import java . util . Scanner ;   public class B1411 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { long N = in . nextLong ( ) ; while ( ! isFair ( N ) ) N ++ ; System . out . println ( N ) ; } }   private static boolean isFair ( long N ) { long r = N ; while ( r != 0 ) { long digit = r % 10 ; r /= 10 ; if ( digit != 0 && N % digit != 0 ) { return false ; } } return true ; }   }", "import java . util . * ; import java . io . * ; import java . math . * ; public class Main {", "import java . util . Scanner ;   public class _0685FairNumbers { static long findFair ( long n ) { boolean flag = true ; while ( flag ) { long temp = n ; flag = false ; while ( temp > 0 ) { long val = temp % 10 ; if ( val == 0 ) { temp = temp / 10 ; continue ; } if ( n % val != 0 ) { flag = true ; n ++ ; break ; } temp = temp / 10 ; } } return n ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cases = sc . nextInt ( ) ; while ( cases > 0 ) { long n = sc . nextLong ( ) ; System . out . println ( findFair ( n ) ) ; cases -- ; } }   }", "import java . util . * ; public class fair {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { long n = in . nextLong ( ) ; boolean flag = true ; while ( flag ) { String s = String . valueOf ( n ) ; int x = 0 , y = 0 ; if ( s . indexOf ( \"2\" ) >= 0 ) { x ++ ; if ( n % 2 == 0 ) y ++ ; } if ( s . indexOf ( \"2\" ) >= 0 ) { x ++ ; if ( n % 2 == 0 ) y ++ ; } if ( s . indexOf ( \"3\" ) >= 0 ) { x ++ ; if ( n % 3 == 0 ) y ++ ; } if ( s . indexOf ( \"4\" ) >= 0 ) { x ++ ; if ( n % 4 == 0 ) y ++ ; } if ( s . indexOf ( \"5\" ) >= 0 ) { x ++ ; if ( n % 5 == 0 ) y ++ ; } if ( s . indexOf ( \"6\" ) >= 0 ) { x ++ ; if ( n % 6 == 0 ) y ++ ; } if ( s . indexOf ( \"7\" ) >= 0 ) { x ++ ; if ( n % 7 == 0 ) y ++ ; } if ( s . indexOf ( \"8\" ) >= 0 ) { x ++ ; if ( n % 8 == 0 ) y ++ ; } if ( s . indexOf ( \"9\" ) >= 0 ) { x ++ ; if ( n % 9 == 0 ) y ++ ; } if ( x == y ) { System . out . println ( n ) ; flag = false ; } else n ++ ; } }   }   }" ]
[ "import java . util . * ; public NEW_LINE class FairNumber { public static int check ( long n ) { long x = n ; while ( x != 0 ) { if ( x % 10 != 0 & & n % ( x % 10 ) != 0 ) return - 1 ; x /= 10 ; } return 1 ; }   public static void main ( String [ ] args ) { // TODO Auto - generated method stub Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t - -> 0 ) { long n = sc . nextLong ( ) ; while ( true ) { if ( check ( n ) == 1 ) { System . out . println ( n ) ; break ; } else n + + ; } } }   } NEW_LINE", "def is_fair ( n ) : nn = n NEW_LINE while n != 0 : d = n % 10 NEW_LINE if d != 0 and nn % d != 0 : return False NEW_LINE n //= 10 NEW_LINE return True   NEW_LINE def solve ( ) : n = int ( input ( ) ) NEW_LINE while not is_fair ( n ) : n += 1 NEW_LINE print ( n )   t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : solve ( ) NEW_LINE", "from sys import stdin , stdoutimport NEW_LINE math , bisectfrom NEW_LINE collections NEW_LINE import Counter , deque , defaultdictL = lambda : list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE M = lambda : map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) NEW_LINE I = lambda : int ( stdin . readline ( ) . strip ( ) ) NEW_LINE S = lambda : stdin . readline ( ) . strip ( ) NEW_LINE C = lambda : stdin . readline ( ) . strip ( ) . split ( ) NEW_LINE def pr ( a ) : return ( \" \" . join ( list ( map ( str , a ) ) ) ) NEW_LINE", "import java . util . * ; public NEW_LINE class sol { static Scanner scr = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { // TODO Auto - generated method stub int t = scr . nextInt ( ) ; while ( t - -> 0 ) { solve ( ) ; } } static void solve ( ) { long n = scr . nextLong ( ) ; while ( ! isValid ( n ) ) { n + + ; } System . out . println ( n ) ; } static boolean isValid ( long n ) { long x = n ; while ( x > 0 ) { long mod = x % 10 ; // System . out . print ( mod + \" ▁ \" ) ; if ( mod != 0 & & n % mod != 0 ) { return false ; } x /= 10 ; } return true ; } } NEW_LINE", "def is_just ( num ) : newnum = num NEW_LINE while newnum > 0 : if NEW_LINE newnum % 10 != 0 : NEW_LINE if num % ( newnum % 10 ) != 0 : return False NEW_LINE newnum //= 10 NEW_LINE return True   t = int ( input ( ) ) NEW_LINE for ti in range ( t ) : n = int ( input ( ) ) NEW_LINE x = n NEW_LINE while not is_just ( x ) : x += 1 NEW_LINE print ( x ) NEW_LINE" ]
codeforces_1038_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; String ans = \" \" ; if ( n == 1 || n == 2 ) { ans = \" No \" ; System . out . println ( ans ) ; } else { ans = \" Yes \" ; System . out . println ( ans ) ; System . out . print ( n / 2 + \" ▁ \" ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) System . out . print ( i + \" ▁ \" ) ; } System . out . println ( ) ; System . out . print ( n - n / 2 + \" ▁ \" ) ; for ( int j = 1 ; j <= n ; j ++ ) { if ( j % 2 != 0 ) System . out . print ( j + \" ▁ \" ) ; } } } }" ]
[ "n = int ( input ( ) ) if ( n < 3 ) : print ( \" No \" ) else : print ( \" Yes \" ) print ( n // 2 , end = \" ▁ \" ) for i in range ( 2 , n + 1 , 2 ) : print ( i , end = \" ▁ \" ) print ( ) print ( n - ( n // 2 ) , end = \" ▁ \" ) for i in range ( 1 , n + 1 , 2 ) : print ( i , end = \" ▁ \" ) NEW_LINE", "n = int ( input ( ) ) if n < 3 : print ( \" No \" ) else : print ( \" Yes \" ) print ( 1 , n ) print ( n - 1 , end = \" ▁ \" ) for i in range ( 1 , n ) : print ( i , end = \" ▁ \" ) NEW_LINE", "try : n = int ( input ( ) ) if n <= 2 : print ( \" No \" ) else : e = [ ] o = [ ] for i in range ( 1 , n + 1 ) : if i % 2 == 0 : e . append ( i ) else : o . append ( i ) print ( \" Yes \" ) print ( len ( e ) , * e ) print ( len ( o ) , * o ) except : pass NEW_LINE", "n = int ( input ( ) ) if n < 3 : print ( \" No \" ) else : print ( \" Yes \" ) print ( 1 , n ) print ( n - 1 , * range ( 1 , n ) ) NEW_LINE" ]
codeforces_1206_B
[ "import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; long ans = 0 , negative = 0 , zero = 0 ; for ( int i = 0 ; i < n ; i ++ ) { long k = s . nextLong ( ) ; if ( k > 1 ) { ans += k - 1 ; } else if ( k == 0 ) { ans ++ ; zero ++ ; } else if ( k < 0 ) { ans += Math . abs ( k ) - 1 ; negative ++ ; } } if ( negative % 2 == 1 && zero == 0 ) { ans = ans + 2 ; } System . out . println ( ans ) ;   } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class Solution { private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ; private static PrintWriter out = new PrintWriter ( System . out ) ;   static long getAns ( long [ ] a , int n , int prod , long [ ] [ ] dp ) { if ( n == 0 ) { return prod == 1 ? 0 : Long . MAX_VALUE / 2 ; } if ( dp [ n ] [ ( prod % 3 + 3 ) % 3 ] != - 1 ) { return dp [ n ] [ ( prod % 3 + 3 ) % 3 ] ; } long ans1 = Math . abs ( a [ n - 1 ] - 1 ) + getAns ( a , n - 1 , prod , dp ) ; long ans2 = Math . abs ( a [ n - 1 ] + 1 ) + getAns ( a , n - 1 , prod * - 1 , dp ) ; return dp [ n ] [ ( prod % 3 + 3 ) % 3 ] = Math . min ( ans1 , ans2 ) ; } public static void solve ( int T ) throws IOException { int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } int prod = 1 ; long [ ] [ ] dp = new long [ n + 1 ] [ 3 ] ; for ( long [ ] i : dp ) { Arrays . fill ( i , - 1 ) ; } long ans = getAns ( a , n , prod , dp ) ; System . out . println ( ans ) ; } public static void main ( String [ ] args ) throws IOException { int t ;", "import java . math . BigInteger ; import java . util . * ; import java . lang . * ; import java . util . Arrays ;     public class geek {   public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; try {       StringBuffer sb = new StringBuffer ( ) ; int n = s . nextInt ( ) ; long a [ ] = new long [ n ] ; long neg = 0 , zeroes = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = s . nextLong ( ) ; if ( a [ i ] < 0 ) { neg ++ ; } else if ( a [ i ] == 0 ) { zeroes ++ ; } } Arrays . sort ( a ) ; long ans = 0 ; if ( neg % 2 == 0 ) { for ( int i = 0 ; i < n ; i ++ ) { ans += Math . abs ( Math . abs ( a [ i ] ) - 1 ) ; } } else { for ( int i = 0 ; i < n ; i ++ ) { if ( neg > 1 ) { ans += Math . abs ( Math . abs ( a [ i ] ) - 1 ) ; neg -- ; } else if ( zeroes > 0 && neg == 1 ) {   ans += Math . abs ( Math . abs ( a [ i ] ) - 1 ) + 1 ; neg -- ; i ++ ;   } else { ans += Math . abs ( a [ i ] - 1 ) ;   }", "  import java . util . Scanner ;   public class MakeProductEqualOne {   public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long nCnt = 0 ; long ans = 0 ; long zeroCnt = 0 ; int n = s . nextInt ( ) ; long arr [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = s . nextLong ( ) ; if ( arr [ i ] < 0 ) nCnt ++ ; if ( arr [ i ] == 0 ) zeroCnt ++ ; ans += ( Math . abs ( ( Math . abs ( arr [ i ] ) - 1 ) ) ) % 1000000007 ; } if ( ( nCnt & 1 ) == 1 && zeroCnt == 0 ) ans += 2 ; System . out . println ( ans ) ; }   }" ]
[ "totalCost = 0 newArr = [ ] zeroCount = 0 negativeNumCount = 0 numCount = int ( input ( ) ) numArr = list ( map ( int , input ( ) . split ( ) ) ) for num in numArr : if ( num != 1 and num != - 1 ) : if ( num < 0 ) : negativeNumCount += 1 cost = abs ( num ) - 1 newArr . append ( num + cost ) totalCost += cost elif ( num > 0 ) : cost = num - 1 newArr . append ( num - cost ) totalCost += cost else : zeroCount += 1 else : if ( num == - 1 ) : negativeNumCount += 1 if ( zeroCount > 0 ) : totalCost += zeroCountelse : if ( negativeNumCount % 2 != 0 ) : totalCost += 2 print ( totalCost )   NEW_LINE", "n = int ( input ( ) ) arr = [ int ( x ) for x in input ( ) . split ( ) ] dp = [ [ 0 for _ in range ( 2 ) ] for _ in range ( n ) ] dp [ 0 ] [ 0 ] = abs ( 1 - arr [ 0 ] ) dp [ 0 ] [ 1 ] = abs ( - 1 - arr [ 0 ] ) for i in range ( 1 , n ) : plus1 = abs ( 1 - arr [ i ] ) minus1 = abs ( - 1 - arr [ i ] ) dp [ i ] [ 0 ] = min ( dp [ i - 1 ] [ 0 ] + plus1 , dp [ i - 1 ] [ 1 ] + minus1 ) dp [ i ] [ 1 ] = min ( dp [ i - 1 ] [ 0 ] + minus1 , dp [ i - 1 ] [ 1 ] + plus1 ) print ( dp [ n - 1 ] [ 0 ] ) NEW_LINE", "n = int ( input ( ) ) a = tuple ( map ( int , input ( ) . split ( ) ) ) x , y = abs ( a [ 0 ] - 1 ) , abs ( a [ 0 ] + 1 ) for i in a [ 1 : ] : x , y = min ( x + abs ( i - 1 ) , y + abs ( i + 1 ) ) , min ( y + abs ( i - 1 ) , x + abs ( i + 1 ) ) print ( x ) NEW_LINE", "n = int ( input ( ) ) seq = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) change_count = 0 product = 1 zero_count = 0 for i in seq : if i > 1 : change_count += i - 1 elif i < - 1 : change_count += - 1 - i product *= - 1 elif i == 0 : zero_count += 1 elif i == - 1 : product *= - 1   if zero_count > 0 : change_count += zero_count product = 1   if product == - 1 : change_count += 2 print ( change_count ) NEW_LINE" ]
codeforces_486_B
[ "import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ;   public class MyClass { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int m = Integer . parseInt ( st . nextToken ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int [ ] [ ] ar = new int [ m ] [ n ] ; for ( int i = 0 ; i < m ; i ++ ) { st = new StringTokenizer ( br . readLine ( ) ) ; for ( int j = 0 ; j < n ; j ++ ) { ar [ i ] [ j ] = Integer . parseInt ( st . nextToken ( ) ) ; } }", "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 m = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] [ ] arr = new int [ m ] [ n ] ; int [ ] [ ] res = new int [ m ] [ n ] ; int [ ] rows = new int [ m ] ; int [ ] cols = new int [ n ] ; Arrays . fill ( cols , 0 ) ; for ( int [ ] a : res ) { Arrays . fill ( a , 0 ) ; } int sum = 0 ; boolean flag = false ; for ( int i = 0 ; i < m ; i ++ ) { rows [ i ] = 0 ; for ( int j = 0 ; j < n ; j ++ ) { arr [ i ] [ j ] = sc . nextInt ( ) ; sum += arr [ i ] [ j ] ; cols [ j ] += arr [ i ] [ j ] ; rows [ i ] += arr [ i ] [ j ] ; } } if ( m == 1 && n == 1 ) { System . out . println ( \" YES \\n \" + arr [ 0 ] [ 0 ] ) ; return ; } else if ( m == 1 || n == 1 ) { if ( ( m == 1 && rows [ 0 ] == n ) || ( n == 1 && cols [ 0 ] == m ) ) { System . out . println ( \" YES \" ) ; for ( int i = 0 ; i < m ; i ++ ) {", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {", "import java . util . * ;   public class ORinMatrix_B { public static int checker ( int [ ] [ ] ans , int i , int j , int m , int n ) { int temp = 0 ; for ( int a = 0 ; a < m ; a ++ ) { temp += ans [ a ] [ j ] ; } for ( int a = 0 ; a < n ; a ++ ) { temp += ans [ i ] [ a ] ; } if ( temp == 0 ) { return 0 ; } else { return 1 ; } }   public static void main ( String [ ] args ) {" ]
[ "nums = input ( ) . split ( ) rows , colums = int ( nums [ 0 ] ) , int ( nums [ 1 ] ) matrix1 = [ [ 1 ] * colums ] * rowsinputMatrix = [ ] for _ in range ( rows ) : inputMatrix . append ( [ int ( i ) for i in input ( ) . split ( ) ] ) for rowIndex , row in enumerate ( inputMatrix ) : for columIndex , val in enumerate ( row ) : if val == 0 : matrix1 [ rowIndex ] = [ 0 ] * colums for j in range ( rows ) : matrix1 [ j ] [ columIndex ] = 0   def check ( ) : for rowIndex , row in enumerate ( inputMatrix ) : for columIndex , val in enumerate ( row ) : if val == 1 : dic = [ ] for j in range ( rows ) : dic . append ( matrix1 [ j ] [ columIndex ] ) if 1 not in matrix1 [ rowIndex ] and 1 not in dic : return \" NO \" return \" YES \" checkVal = check ( ) if checkVal == \" NO \" : print ( \" NO \" ) else : print ( \" YES \" ) for row in matrix1 : print ( \" ▁ \" . join ( str ( x ) for x in row ) ) NEW_LINE", "def check_col ( mat , c ) : for r in mat : if not r [ c ] : return 0 return 1   m , n = map ( int , input ( ) . split ( ) ) a = [ [ 0 ] * n for _ in range ( m ) ] b = [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( m ) ] rows , cols = [ ] , [ ] checkedCols = set ( ) for r in range ( m ) : if all ( b [ r ] ) : rows . append ( r ) else : for c in range ( n ) : if b [ r ] [ c ] and c not in checkedCols : checkedCols . add ( c ) if check_col ( b , c ) : cols . append ( c ) else : print ( ' NO ' ) exit ( ) if ( len ( rows ) and len ( rows ) != m and not len ( cols ) ) or ( len ( cols ) and len ( cols ) != n and not len ( rows ) ) : print ( \" NO \" ) exit ( ) if not len ( rows ) and not len ( cols ) : print ( \" YES \" ) for i in a : print ( * i ) exit ( ) i = j = 0 if not len ( cols ) : cols . append ( 0 ) while i < len ( rows ) and j < len ( cols ) : a [ rows [ i ] ] [ cols [ j ] ] = 1 i += 1 j += 1 for k in range ( i , len ( rows ) ) : a [ rows [ k ] ] [ cols [ 0 ] ] = 1 for l in range ( j , len ( cols ) ) : a [ rows [ 0 ] ] [ cols [ l ] ] = 1 print ( \" YES \" ) for i in a : print ( * i ) NEW_LINE", "m , n = map ( int , input ( ) . split ( ) ) A = [ [ 1 ] * n ] * mB = [ [ 0 ] * n ] * mC = [ ] for i in range ( m ) : L = list ( map ( int , input ( ) . split ( ) ) ) C . append ( L ) for j in range ( len ( L ) ) : if L [ j ] == 0 : A [ i ] = [ 0 ] * n for k in range ( m ) : A [ k ] [ j ] = 0 ''' for ▁ alpha ▁ in ▁ A : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( * alpha ) ▁ ▁ ▁ ▁ for ▁ alpha ▁ in ▁ C : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( * alpha ) ''' for p in range ( m ) : for w in range ( n ) : if A [ p ] [ w ] == 1 : B [ p ] = [ 1 ] * n for s in range ( m ) : B [ s ] [ w ] = 1 if B == C : print ( \" YES \" ) for i in A : print ( * i ) else : print ( \" NO \" ) NEW_LINE" ]
codeforces_157_A
[ "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 ( ) ; if ( n == 1 ) { int t = sc . nextInt ( ) ; System . out . println ( 0 ) ; } else { int a [ ] [ ] = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) a [ i ] [ j ] = sc . nextInt ( ) ; } int c [ ] = new int [ n ] ; int r [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int t = 0 ; for ( int j = 0 ; j < n ; j ++ ) t = t + a [ i ] [ j ] ; c [ i ] = t ; } for ( int i = 0 ; i < n ; i ++ ) { int t = 0 ; for ( int j = 0 ; j < n ; j ++ ) t = t + a [ j ] [ i ] ; r [ i ] = t ; } int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( r [ i ] > c [ j ] ) ans ++ ; } } System . out . println ( ans ) ; } } }", "import java . util . Scanner ;   public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int row [ ] = new int [ n ] ; int col [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) {", "  import java . util . * ; import java . lang . * ; import java . io . * ;   public class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class C { 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 [ ] nextArray ( 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 ( ) ) ; } } static class FastWriter extends PrintWriter { FastWriter ( ) { super ( System . out ) ; }   void println ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + \" ▁ \" ) ; } println ( ) ; }   void println ( long [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + \" ▁ \" ) ; } println ( ) ; } } public static void main ( String [ ] args ) {" ]
[ "def colsum ( matrix , col ) : ans = 0 for i in range ( len ( matrix ) ) : for j in range ( len ( matrix [ 0 ] ) ) : if j == col : ans += matrix [ i ] [ j ] return ans   def rowsum ( matrix , row ) : return sum ( matrix [ row ] )     cases = int ( input ( ) ) mx = [ ] while cases : cases -= 1 arr = list ( map ( int , input ( ) . split ( ) ) ) mx . append ( arr ) ans = 0 for i in range ( len ( mx ) ) : for j in range ( len ( mx [ 0 ] ) ) : if colsum ( mx , i ) > rowsum ( mx , j ) : ans += 1   print ( ans )   NEW_LINE", "def input_matrix ( n ) : matrix = [ ] for i in range ( n ) : matrix . append ( list ( map ( int , input ( ) . split ( ) ) ) ) return matrix   def get_sum_in_row ( a , i ) : return sum ( a [ i ] ) def get_sum_in_col ( a , j ) : return sum ( ( a [ i ] [ j ] for i in range ( len ( a ) ) ) )     n = int ( input ( ) ) a = input_matrix ( n ) row_sums = [ get_sum_in_row ( a , i ) for i in range ( n ) ] col_sums = [ get_sum_in_col ( a , j ) for j in range ( n ) ]   n_ceils = 0 for row_sum in row_sums : for col_sum in col_sums : if col_sum > row_sum : n_ceils += 1 print ( n_ceils ) NEW_LINE", "a = int ( input ( ) ) b = list ( ) for i in range ( a ) : b . append ( list ( map ( int , input ( ) . split ( ) ) ) ) h = 0 for i in range ( a ) : for j in range ( a ) : if ( sum ( b [ i ] [ j ] for i in range ( a ) ) > sum ( b [ i ] ) ) : h += 1 print ( h )   NEW_LINE", "def judge ( i , j , matrix : list ) :   col , row = 0 , 0   row = sum ( matrix [ i ] )   for k in range ( len ( matrix ) ) : col += matrix [ k ] [ j ]   if col > row : return True else : return False   def counter ( matrix : list ) :   lenth = len ( matrix ) count = 0 for i in range ( lenth ) : for j in range ( lenth ) : if judge ( i , j , matrix ) : count += 1   return count     if __name__ == ' _ _ main _ _ ' : lenth = int ( input ( ) )   matrix = [ list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) for i in range ( lenth ) ]   print ( counter ( matrix ) )     NEW_LINE", "n = int ( input ( ) ) arr = [ ] for i in range ( n ) : arr . append ( list ( map ( int , input ( ) . split ( ) ) ) ) row_sum = [ ] col_sum = [ ] for i in range ( n ) : row_sum . append ( sum ( arr [ i ] ) ) for i in range ( n ) : temp = 0 for j in range ( n ) : temp += arr [ j ] [ i ] col_sum . append ( temp ) ans = 0 for i in range ( n ) : for j in range ( n ) : if col_sum [ i ] > row_sum [ j ] : ans += 1 print ( ans ) NEW_LINE" ]
codeforces_822_B
[ "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 ( ) ; char [ ] s1 = sc . next ( ) . toCharArray ( ) ; char [ ] t1 = sc . next ( ) . toCharArray ( ) ; int min = n ;   String f = \" \" ; for ( int i = 0 ; i <= m - n ; i ++ ) { int c = 0 ; StringBuilder u = new StringBuilder ( ) ; for ( int j = 0 ; j < n ; j ++ ) {", "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 ( ) ; char [ ] s1 = sc . next ( ) . toCharArray ( ) ; char [ ] t1 = sc . next ( ) . toCharArray ( ) ; int min = n ;   String f = \" \" ; for ( int i = 0 ; i <= m - n ; i ++ ) { int c = 0 ; StringBuilder u = new StringBuilder ( ) ; for ( int j = 0 ; j < n ; j ++ ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Main { public static int match ( String s1 , String s2 , int start ) { int count = 0 ; int j = 0 ; for ( int i = start ; i < start + s1 . length ( ) && ( start + s1 . length ( ) ) <= s2 . length ( ) ; i ++ , j ++ ) { if ( s1 . charAt ( j ) == s2 . charAt ( i ) ) count ++ ; } return count ; }   public static void main ( String [ ] args ) throws IOException {   FastScanner input = new FastScanner ( ) ; int start = 0 ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; String s1 = input . next ( ) ; String s2 = input . next ( ) ; int minIndex = 0 ; int max = Integer . MIN_VALUE ; for ( int i = 0 ; i < s2 . length ( ) ; i ++ ) { int mat = match ( s1 , s2 , i ) ;", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; int b [ ] = new int [ n ] ; int c1 [ ] = new int [ n ] ; s . nextLine ( ) ; String s1 = s . nextLine ( ) ; String t = s . nextLine ( ) ; char c = s1 . charAt ( 0 ) ; int count = 0 , min = Integer . MAX_VALUE , k = 0 ; for ( int i = 0 ; i < m - n + 1 ; i ++ ) { int index = i ; count = 0 ; Arrays . fill ( b , 0 ) ; for ( int j = 0 ; j < n ; j ++ ) { if ( index < t . length ( ) && t . charAt ( index ) != s1 . charAt ( j ) ) { count ++ ; b [ j ] = j + 1 ; } index ++ ; } if ( count < min ) { min = count ; c1 = b . clone ( ) ;" ]
[ "import mathimport sysfrom collections import * import itertools def cint ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def cstr ( ) : return list ( map ( str , input ( ) . split ( ' ▁ ' ) ) )   def gcd ( a , b ) : if ( b == 0 ) : return a return gcd ( b , a % b )     def solve ( t ) : n , m = cint ( ) s1 = input ( ) s2 = input ( ) n1 = len ( s1 ) n2 = len ( s2 ) min_count = math . inf min_lst = [ ] for i in range ( n2 - n1 + 1 ) : count = 0 lst = [ ] for j in range ( n1 ) : if s1 [ j ] != s2 [ i + j ] : count += 1 lst . append ( j )   if count < min_count : min_count = count min_lst = lst . copy ( ) print ( min_count ) for item in min_lst : print ( item + 1 , end = ' ▁ ' ) print ( ' ' ) \t \t       if __name__ == \" _ _ main _ _ \" : NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) s = input ( ) t = input ( ) l = [ ]   for i in range ( len ( t ) - len ( s ) + 1 ) : l . append ( [ ] ) for j in range ( len ( s ) ) : if s [ j ] != t [ i + j ] : l [ - 1 ] . append ( j + 1 ) print ( len ( min ( l , key = lambda x : len ( x ) ) ) ) print ( * min ( l , key = lambda x : len ( x ) ) ) NEW_LINE", "def match ( a , b , startingpos ) : assert ( len ( a ) == len ( b ) ) c = [ None ] * ( len ( a ) ) for i in range ( len ( a ) ) : if ( a [ i ] == b [ i ] ) : c [ i ] = a [ i ] else : c [ i ] = ' ? ' return ( [ startingpos , c . count ( ' ? ' ) , c ] )   n , m = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] s = [ x for x in input ( ) ] t = [ x for x in input ( ) ]   poss = [ ]   for i in range ( m - n + 1 ) : poss . append ( match ( s , t [ i : i + n ] , i ) )   poss . sort ( key = ( lambda a : a [ 1 ] ) )   print ( poss [ 0 ] [ 1 ] ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) s = input ( ) t = input ( )   ans = float ( ' inf ' ) val = 0 for x in range ( b - a + 1 ) : sub = t [ x : x + a ] c = 0 for i , j in zip ( s , sub ) : if i != j : c += 1 if ( c < ans ) : ans = c val = x   print ( ans )     for x in range ( b - a + 1 ) : sub = t [ x : x + a ] c = 0 for i , j in zip ( s , sub ) : if i != j : c += 1 if ( c == ans ) : val = x break   sub = t [ val : val + a ] for i in range ( val , val + a ) : if t [ i ] != s [ i - val ] : print ( i - val + 1 , end = \" ▁ \" )                 NEW_LINE" ]
codeforces_1349_A
[ "import java . io . * ; import java . util . * ;   public class Main { private static long pow ( int a , int b ) { if ( b == 0 ) { return 1 ; } if ( b % 2 == 0 ) { long temp = pow ( a , b / 2 ) ; return temp * temp ; } return a * pow ( a , b - 1 ) ; } 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 . * ; public class divgame { public static ArrayList < Integer > getPrimes ( int n ) { ArrayList < Integer > primes = new ArrayList < > ( ) ; boolean first = true ; while ( n % 2 == 0 ) { n /= 2 ; if ( first ) { primes . add ( 2 ) ; first = false ; } } for ( int i = 3 ; i <= Math . sqrt ( n ) ; i ++ ) { first = true ; while ( n % i == 0 ) { n /= i ; if ( first ) { primes . add ( i ) ; first = false ; } } } if ( n > 1 ) primes . add ( n ) ; return primes ; } public static int maxPower ( int n , int p ) { int c = 0 ; while ( n % p == 0 ) { c ++ ; n /= p ; } return c ; } public static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;", "import java . util . * ; public class OracAndLCM { public static void main ( String [ ] args ) { boolean [ ] sieve = new boolean [ 200001 ] ; ArrayList < Integer > primes = new ArrayList < > ( ) ; for ( int i = 2 ; i <= 200000 ; i ++ ) { if ( ! sieve [ i ] ) { primes . add ( i ) ; for ( int j = i ; j <= 200000 ; j += i ) { sieve [ j ] = true ; } } } Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int [ ] arr = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] = in . nextInt ( ) ; } long res = 1 ; for ( int p : primes ) { int min = Integer . MAX_VALUE ; int min2 = Integer . MAX_VALUE ; for ( int i : arr ) { int count = count ( i , p ) ; if ( count < min2 ) { min2 = Math . max ( min , count ) ; } if ( count < min ) { min = count ; } if ( min2 == 0 ) { break ; } } res *= ( long ) Math . pow ( p , min2 ) ; } System . out . println ( res ) ; } public static int count ( int n , int p ) { int count = 0 ; while ( n % p == 0 ) { n /= p ; count ++ ; } return count ; } }" ]
[ "import sysmod = 1000000007 input = lambda : sys . stdin . readline ( ) . rstrip ( \" \\n \" )   from math import sqrtck = [ i for i in range ( 200001 ) ] i = 2 for i in range ( 2 , int ( sqrt ( 200001 ) ) + 1 ) : if ck [ i ] == i : t = i * i for j in range ( t , 200001 , i ) : ck [ j ] = i NEW_LINE", "def gcd ( a , b ) : while b : a %= b a , b = b , a return an = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) if n == 1 : print ( l [ 0 ] ) else : g = gcd ( l [ 0 ] , l [ 1 ] ) a = ( l [ 0 ] * l [ 1 ] ) // g for i in range ( 2 , n ) : a , g = gcd ( a , g * l [ i ] // gcd ( g , l [ i ] ) ) , gcd ( l [ i ] , g ) print ( a ) NEW_LINE", "from math import gcddef lcm ( a , b ) : return a * b // gcd ( a , b ) input ( ) a = list ( map ( int , input ( ) . split ( ) ) ) t = gcd ( a [ 0 ] , a [ 1 ] ) q = lcm ( a [ 0 ] , a [ 1 ] ) for i in range ( 2 , len ( a ) ) : q = gcd ( q , lcm ( a [ i ] , t ) ) t = gcd ( t , a [ i ] ) print ( q ) NEW_LINE", "from sys import stdinfrom collections import defaultdict     def get_prime_nums ( ) : prime_nums = [ 2 ] for i in range ( 3 , 500 ) : is_prime = True for num in prime_nums : if i % num == 0 : is_prime = False break if is_prime : prime_nums . append ( i ) return prime_nums     n = int ( stdin . buffer . readline ( ) )   input_nums = [ int ( _ ) for _ in stdin . buffer . readline ( ) . split ( ) ] prime_nums = get_prime_nums ( )   prime_stats = defaultdict ( lambda : [ 0 ] * 20 )   for input_num in input_nums : for prime_num in prime_nums : power = 1 while input_num % prime_num == 0 : prime_stats [ prime_num ] [ power ] += 1 power += 1 input_num = input_num // prime_num if input_num != 1 : prime_stats [ input_num ] [ 1 ] += 1   ans = 1 for prime_num , stat in prime_stats . items ( ) : i = 0 while stat [ i + 1 ] >= n - 1 : i += 1 ans *= prime_num ** i   print ( ans ) NEW_LINE" ]
codeforces_791_A
[ "import java . util . Scanner ;   public class BearAndBigBrother { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; short a = scanner . nextByte ( ) , b = scanner . nextByte ( ) ; byte count = 0 ; while ( a <= b ) { count ++ ; a *= 3 ; b *= 2 ; } System . out . println ( count ) ; } }", "import java . util . Scanner ;   public class main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int k = 0 ; while ( ! ( a > b ) ) { a *= 3 ; b *= 2 ; k ++ ; } System . out . println ( k ) ;   } }", "import java . util . Scanner ; public class MyClass { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int i = 0 ; while ( a <= b ) { a = a * 3 ; b = b * 2 ; i ++ ; } System . out . println ( i ) ; } }", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int l = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ;   int L = l ; int B = b ;   int counter = 0 ; while ( B >= L ) { L *= 3 ; B *= 2 ;   counter ++ ; }   System . out . println ( counter ) ; } }", "import java . util . * ;   public class test { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; short a = scanner . nextShort ( ) ; short b = scanner . nextShort ( ) ; short counter = 0 ;   while ( a <= b ) { a = ( short ) ( a * 3 ) ; b = ( short ) ( b * 2 ) ; counter ++ ; } System . out . println ( counter ) ;   }   }" ]
[ "a , b = map ( int , input ( ) . split ( ) ) Limak_age = aBob_age = bn_years = 0 while Limak_age <= Bob_age : Limak_age *= 3 Bob_age *= 2 n_years += 1 print ( n_years ) NEW_LINE", "l , b = map ( int , input ( ) . split ( ) ) years = 0 while l <= b : l *= 3 b *= 2 years += 1 print ( years ) NEW_LINE", "s , l = map ( int , input ( ) . split ( ) ) i = 0 while ( s <= l ) : s = s * 3 l = l * 2 i = i + 1 print ( i ) NEW_LINE", "small , big = map ( int , input ( ) . split ( ) ) count = 0 while small <= big : small *= 3 big *= 2 count += 1 print ( count ) NEW_LINE", "num_array = input ( ) . split ( ) b = int ( num_array [ 0 ] ) m = int ( num_array [ 1 ] ) c = 0 while ( b <= m ) : b = b * 3 m = m * 2 c += 1 print ( c ) NEW_LINE" ]
codeforces_1223_A
[ "# include < iostream >   using namespace std ;   long long a , i , n ; int main ( ) { cin >> a ;   for ( int i = 0 ; i < a ; ++ i ) {   cin >> n ; if ( n == 2 ) { cout << 2 ; } else if ( n % 2 ) cout << 1 ; else cout << 0 ; cout << endl ; } return 0 ; }", "import java . util . Scanner ;   public class CME { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int q = in . nextInt ( ) ; int n ; while ( q -- != 0 ) { n = in . nextInt ( ) ; if ( n == 2 ) System . out . println ( \"2\" ) ; else if ( n % 2 == 0 ) System . out . println ( \"0\" ) ; else System . out . println ( \"1\" ) ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Test {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Cv {" ]
[ "for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) if n < 4 : print ( 4 - n ) else : print ( [ 0 , 1 ] [ n % 2 ] ) NEW_LINE", "q = int ( input ( ) ) answer = 0 ch = [ ] for i in range ( q ) : n = int ( input ( ) ) if n == 2 : ch . append ( 2 ) if n % 2 == 0 and n != 2 : ch . append ( 0 ) if n % 2 != 0 : ch . append ( 1 ) for j in ch : print ( j , end = \" \\n \" ) NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) if ( n <= 3 ) : print ( 4 - n ) else : print ( n % 2 ) NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) if ( n <= 3 ) : print ( 4 - n ) else : print ( n % 2 ) NEW_LINE" ]