id
stringlengths
13
20
java
sequence
python
sequence
codeforces_151_A
[ "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int g = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int a1 = ( b * c ) / g ; int a2 = d * e ; int a3 = f / h ; int ans1 = Math . min ( a1 , a2 ) ; int ans = Math . min ( ans1 , a3 ) ; System . out . println ( ans / a ) ; } }", "import java . util . Scanner ;   public class A151 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) , k = scanner . nextInt ( ) , l = scanner . nextInt ( ) , c = scanner . nextInt ( ) , d = scanner . nextInt ( ) , p = scanner . nextInt ( ) , nl = scanner . nextInt ( ) , np = scanner . nextInt ( ) ;   int millDrToast = k * l / nl , limesToast = c * d , saltToast = p / np ; System . out . println ( ( Math . min ( millDrToast , Math . min ( limesToast , saltToast ) ) ) / n ) ; } }", "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 ( ) ;  " ]
[ "n , k , l , c , d , p , nl , np = map ( int , input ( ) . split ( ) ) x = min ( c * d , ( k * l ) // nl , p // np ) print ( x // n ) NEW_LINE", "n , k , l , c , d , p , nl , np = map ( int , input ( ) . split ( ) ) a = k * lx = a // nly = c * dz = p // npprint ( min ( x , y , z ) // n ) NEW_LINE", "n , k , l , c , d , p , nl , np = map ( int , input ( ) . split ( ) ) NEW_LINE", "n , k , l , c , d , p , a , b = map ( int , input ( ) . split ( ) ) print ( min ( k * l // a , c * d , p // b ) // n ) NEW_LINE" ]
codeforces_1338_B
[ "import java . util . * ; import java . lang . * ; import java . io . * ; import java . awt . Point ;  ", "import java . io . * ; import java . util . * ; public class Main { public static PrintWriter out ; public static ArrayList < Integer > [ ] adjacencyList ; public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ; adjacencyList = new ArrayList [ n ] ; for ( int i = 0 ; i < n ; i ++ ) adjacencyList [ i ] = new ArrayList < > ( ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { int u = sc . nextInt ( ) , v = sc . nextInt ( ) ; u -- ; v -- ; adjacencyList [ u ] . add ( v ) ; adjacencyList [ v ] . add ( u ) ; } int minn = 1 , maxx = n - 1 ; int root = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( adjacencyList [ i ] . size ( ) == 1 ) { root = i ; break ; } } if ( dfs ( root , root , 0 ) ) minn = 3 ; int c = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( adjacencyList [ i ] . size ( ) == 1 ) continue ; c = 0 ; for ( int j : adjacencyList [ i ] ) { if ( adjacencyList [ j ] . size ( ) == 1 ) c ++ ; } if ( c > 0 ) maxx -= ( c - 1 ) ; } out . println ( minn + \" ▁ \" + maxx ) ; out . close ( ) ; } public static boolean dfs ( int root , int prnt , int ht ) { boolean flg = false ; boolean haschild = false ; for ( int i = 0 ; i < adjacencyList [ root ] . size ( ) ; i ++ ) { if ( adjacencyList [ root ] . get ( i ) == prnt ) continue ; haschild = true ; flg = flg || dfs ( adjacencyList [ root ] . get ( i ) , root , ht + 1 ) ; } if ( ! haschild ) flg = flg || ( ht % 2 == 1 ) ; return flg ; }", "import java . util . * ; import java . io . * ; public class Mamo { static long mod = 998244353 ; static Reader in = new Reader ( ) ; static List < Integer > G [ ] ; static boolean B = true ; static StringBuilder Sd = new StringBuilder ( ) ; public static void main ( String [ ] args ) {" ]
[ "n = int ( input ( ) ) g = [ [ ] for i in range ( n ) ] for i in range ( n - 1 ) : u , v = [ int ( i ) - 1 for i in input ( ) . split ( ) ] g [ u ] . append ( v ) g [ v ] . append ( u )   leaf = [ len ( i ) == 1 for i in g ] root = - 1 mx = n - 1 for i in range ( n ) : if leaf [ i ] : root = i leafs = 0 for j in g [ i ] : if leaf [ j ] : leafs += 1 if leafs > 1 : mx -= leafs - 1   stack = [ ( root , - 1 , 0 ) ] even = Truewhile len ( stack ) > 0 : i , j , d = stack . pop ( ) if leaf [ i ] and d % 2 == 1 : even = False break for k in g [ i ] : if k != j : stack . append ( ( k , i , d + 1 ) ) mn = 1 if even else 3   print ( mn , mx ) NEW_LINE", "from types import GeneratorTypedef bootstrap ( f , stack = [ ] ) : def wrappedfunc ( * args , ** kwargs ) : if stack : return f ( * args , ** kwargs ) else : to = f ( * args , ** kwargs ) while True : if type ( to ) is GeneratorType : stack . append ( to ) to = next ( to ) else : stack . pop ( ) if not stack : break to = stack [ - 1 ] . send ( to ) return to return wrappedfunc   def main ( ) : NEW_LINE", "from collections import defaultdict , dequefrom sys import * input = stdin . readline   n = int ( input ( ) ) graph = defaultdict ( list ) deg = [ 0 ] * nfor _ in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) graph [ a - 1 ] . append ( b - 1 ) graph [ b - 1 ] . append ( a - 1 ) deg [ a - 1 ] += 1 deg [ b - 1 ] += 1   childLeaves = defaultdict ( int ) idx = 0 for i in range ( n ) : if deg [ i ] == 1 : idx = i childLeaves [ graph [ i ] [ 0 ] ] += 1   mAx = n - 1 + ( len ( childLeaves ) ) - sum ( childLeaves . values ( ) )   dis = defaultdict ( int ) dis [ idx ] = 0 stack = deque ( ) stack . append ( idx ) visited = [ 0 ] * nvisited [ idx ] = 1 mIn = 1   while stack : node = stack . pop ( ) if not visited [ node ] : visited [ node ] = 1 for i in graph [ node ] : if not visited [ i ] : dis [ i ] = dis [ node ] + 1 stack . append ( i ) if deg [ i ] == 1 and dis [ i ] % 2 : mIn = 3   print ( mIn , mAx ) NEW_LINE" ]
codeforces_698_B
[ "import java . io . * ; import java . util . * ;   public class Main { private static int root ( int [ ] parentIds , int c ) { while ( c != parentIds [ c ] ) { parentIds [ c ] = parentIds [ parentIds [ c ] ] ; c = parentIds [ c ] ; } return c ; } private static boolean union ( int [ ] parentIds , int [ ] groupSizes , int a , int b ) { int rootA = root ( parentIds , a ) ; int rootB = root ( parentIds , b ) ; if ( rootA == rootB ) { return false ; } if ( groupSizes [ rootA ] < groupSizes [ rootB ] ) { parentIds [ rootA ] = rootB ; groupSizes [ rootB ] += groupSizes [ rootA ] ; } else { parentIds [ rootB ] = rootA ; groupSizes [ rootA ] += groupSizes [ rootB ] ; } return true ; } public static void main ( String [ ] args ) throws IOException {", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   int N ; List < Integer > [ ] adj ; void run ( FastScanner in , PrintWriter out ) {   N = in . nextInt ( ) ;   LinkedList < Integer > freeSet = new LinkedList < > ( ) ; int [ ] a = new int [ N + 1 ] ; UnionFind uf = new UnionFind ( N ) ; int count = 0 ;   int root = - 1 ; for ( int u = 1 ; u <= N ; u ++ ) { int v = in . nextInt ( ) ; a [ u ] = v ;   if ( uf . findParent ( u ) != uf . findParent ( v ) ) { uf . merge ( u , v ) ; continue ; }   if ( u == v && root == - 1 ) { root = u ; continue ; }   count ++ ;" ]
[ "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) par = [ ] for i in range ( n ) : if a [ i ] == i + 1 : par . append ( i ) v = [ False for i in range ( n ) ] for i in par : v [ i ] = Trueccl = [ ] for i in range ( n ) : if v [ i ] : continue s = [ i ] v [ i ] = True p = set ( s ) t = True while s and t : x = s . pop ( ) j = a [ x ] - 1 if j in p : ccl . append ( j ) t = False else : s . append ( j ) p . add ( j ) if v [ j ] : t = False else : v [ j ] = Trueif len ( par ) == 0 : print ( len ( ccl ) ) c = ccl [ 0 ] a [ c ] = c + 1 for i in range ( 1 , len ( ccl ) ) : a [ ccl [ i ] ] = c + 1 print ( * a ) else : print ( len ( ccl ) + len ( par ) - 1 ) c = par [ 0 ] for i in range ( 1 , len ( par ) ) : a [ par [ i ] ] = c + 1 for i in range ( len ( ccl ) ) : a [ ccl [ i ] ] = c + 1 print ( * a ) NEW_LINE" ]
codeforces_1196_B
[ "import java . util . * ; import java . io . * ; public class A { static FastReader in = new FastReader ( ) ; static final Random random = new Random ( ) ; static long mod = 1000000007L ; static HashMap < Integer , Integer > map = new HashMap < > ( ) ;   public static void main ( String args [ ] ) throws IOException { int t = in . nextInt ( ) ; StringBuilder res = new StringBuilder ( ) ; loop : while ( t -- > 0 ) { StringBuilder temp = new StringBuilder ( ) ; Queue < Integer > q = new LinkedList < > ( ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = in . nextInt ( ) ; if ( x % 2 != 0 ) { q . add ( i + 1 ) ; } } if ( q . size ( ) < k ) { res . append ( \" NO \\n \" ) ; continue loop ; } k -- ; while ( k -- > 0 ) { temp . append ( q . poll ( ) + \" ▁ \" ) ; } if ( q . size ( ) % 2 != 0 ) { temp . append ( n ) ; res . append ( \" YES \\n \" ) ;", "  import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class er10a {", "import java . util . * ; import java . util . * ; 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 oddz { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] a = sc . nextArr ( n ) ; int c1 = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { if ( a [ i ] % 2 != 0 ) { c1 ++ ; } } if ( ( ( c1 % 2 == 0 && k % 2 == 0 ) || ( c1 % 2 != 0 && k % 2 != 0 ) ) && c1 >= k ) { System . out . println ( \" YES \" ) ; c1 = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { if ( ( c1 + 1 ) == k ) { System . out . print ( a . length ) ; break ; } else if ( a [ i ] % 2 != 0 && ( c1 + 1 ) != k ) { System . out . print ( ( i + 1 ) + \" ▁ \" ) ; c1 ++ ; }   } System . out . println ( ) ;   }   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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class B { public static void main ( String [ ] args ) { RealScanner sc = new RealScanner ( ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n , k ; n = sc . nextInt ( ) ; k = sc . nextInt ( ) ; List < Integer > l = new ArrayList < > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { int val = sc . nextInt ( ) ; if ( val % 2 != 0 ) { l . add ( i ) ; } } if ( l . size ( ) >= k && ( l . size ( ) - k ) % 2 == 0 ) { System . out . println ( \" YES \" ) ; for ( int i = 0 ; i < k - 1 ; i ++ ) { System . out . print ( l . get ( i ) + \" ▁ \" ) ; } System . out . println ( n ) ; } else { System . out . println ( \" NO \" ) ; } } } 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 ( ) ) ; } } }  " ]
[ "import sys , math , itertoolsfrom collections import Counter , deque , defaultdictfrom bisect import bisect_left , bisect_right from heapq import heappop , heappush , heapifymod = 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 ( )   for _ in range ( inp ( ) ) : n , k = inpl ( ) a = inpl ( ) cnt = 0 for i in range ( n ) : NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) ; ans = [ ] ; idx = 0 ; summ = 0 arr = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : summ += arr [ i ] if summ % 2 == 1 and len ( ans ) != k - 1 : ans . append ( i + 1 ) ; summ = 0 ; if summ % 2 == 1 and len ( ans ) == k - 1 : print ( \" YES \" ) ; ans . append ( n ) ; print ( * ans ) else : print ( \" NO \" ) NEW_LINE", "q = int ( input ( ) ) while q > 0 : q -= 1 n_k = input ( ) n_k = n_k . split ( ) n = int ( n_k [ 0 ] ) k = int ( n_k [ 1 ] ) s = 0 list_a = input ( ) list_a = list_a . split ( \" ▁ \" ) for i in range ( n ) : list_a [ i ] = int ( list_a [ i ] ) s = s + list_a [ i ] if ( s % 2 == 0 and k % 2 != 0 ) or ( s % 2 != 0 and k % 2 == 0 ) : print ( \" NO \" ) continue border = [ ] temp_sum = 0 if k != 1 : for i in range ( n ) : temp_sum = temp_sum + list_a [ i ] if temp_sum % 2 != 0 : border . append ( i + 1 ) temp_sum = 0 if len ( border ) == k - 1 : break temp_len = len ( border ) if temp_len == k - 1 : print ( \" YES \" ) else : print ( \" NO \" ) continue for i in range ( temp_len ) : print ( border [ i ] , end = \" ▁ \" ) print ( n ) else : print ( \" YES \" ) print ( n ) NEW_LINE", "t = int ( input ( ) ) for _ in range ( t ) : n , k = map ( int , input ( ) . split ( ) ) lst = list ( map ( int , input ( ) . split ( ) ) ) [ : n ] r = 0 ind = [ ] for i in range ( n ) : if lst [ i ] % 2 != 0 : r = r + 1 ind . append ( i + 1 ) if r == k : print ( \" YES \" ) for i in range ( k - 1 ) : print ( ind [ i ] , end = \" ▁ \" ) print ( n ) elif r >= k : if ( r - ( k - 1 ) ) % 2 != 0 : print ( \" YES \" ) for i in range ( k - 1 ) : print ( ind [ i ] , end = \" ▁ \" ) print ( n ) else : print ( \" NO \" ) else : print ( \" NO \" ) NEW_LINE" ]
codeforces_1419_B
[ "import java . util . * ;   public class Stairs {   public static void main ( String [ ] args ) {", "  import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scn = new Scanner ( System . in ) ; int t = scn . nextInt ( ) ; while ( t -- > 0 ) { long n = scn . nextLong ( ) ; long x = 1 ; long ans = 0 ; long stair = 1 ; while ( n - x >= 0 ) { n = n - x ; ans ++ ; stair = stair * 2 + 1 ; x = stair * ( stair + 1 ) / 2 ; } System . out . println ( ans ) ; } } }" ]
[ "arr = [ 1 ] NEW_LINE for j in range ( 1 , 30 ) : arr . append ( arr [ - 1 ] + 2 ** j ) NEW_LINE new_arr = [ ] NEW_LINE for j in arr : new_arr . append ( ( j * ( j + 1 ) ) // 2 ) NEW_LINE for j in range ( 1 , len ( arr ) ) : new_arr [ j ] += new_arr [ j - 1 ]   import bisectt = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE x = bisect . bisect ( new_arr , n ) NEW_LINE print ( x )   NEW_LINE", "for i in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE j = 0 NEW_LINE while n >= 0 : j += 1 NEW_LINE c = 2 ** j - 1 NEW_LINE n -= ( c * ( c + 1 ) ) // 2 NEW_LINE print ( j - 1 ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE sum1 = 0 NEW_LINE base = 1 NEW_LINE ans = 0 NEW_LINE while sum1 <= n : sum1 += ( base * ( base + 1 ) ) // 2 NEW_LINE base = ( base * 2 ) + 1 NEW_LINE ans += 1 NEW_LINE print ( ans - 1 ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = - 1 NEW_LINE x = 0 NEW_LINE while x <= n : a += 1 NEW_LINE k = 2 ** ( a + 1 ) - 1 NEW_LINE x += k * ( k + 1 ) // 2 NEW_LINE print ( a ) NEW_LINE", "def fun ( x ) : i = 1 ; ct = 0 NEW_LINE while i < 32 and x > 0 : x -= ( 2 ** ( i - 1 ) ) * ( ( 2 ** i ) - 1 ) NEW_LINE i += 1 ; NEW_LINE ct += 1 NEW_LINE return ct if x == 0 else ct - 1 NEW_LINE for _ in range ( int ( input ( ) ) ) : x = int ( input ( ) )   print ( fun ( x ) ) NEW_LINE" ]
codeforces_1234_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int q = scan . nextInt ( ) ; while ( q > 0 ) { int n = scan . nextInt ( ) ; q -- ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; } if ( sum % n == 0 ) { System . out . println ( sum / n ) ; } else { System . out . println ( sum / n + 1 ) ; } } } }", "import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = Integer . valueOf ( scanner . nextLine ( ) ) ; while ( t -- > 0 ) { long n = scanner . nextLong ( ) ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += scanner . nextLong ( ) ; } System . out . println ( sum / n + Math . min ( 1 , sum % n ) ) ; } } }", "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 A { public static FastReader sc = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void taskSolver ( ) { int n = sc . nextInt ( ) ; long sum = 0 ; Integer arr [ ] = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; sum += arr [ i ] ; } out . println ( ( sum + n - 1 ) / n ) ; } public static void main ( String args [ ] ) throws java . lang . Exception { int t = sc . nextInt ( ) ; while ( t -- > 0 ) 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 . * ; import java . math . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastReader scan = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; Task solver = new Task ( ) ; ans = new StringBuilder ( ) ; int T = 1 ; for ( int tt = 0 ; tt < T ; tt ++ ) solver . solve ( tt , scan , out ) ; out . close ( ) ; }   static StringBuilder ans ;   static class Task { public void solve ( int testNumber , FastReader scan , PrintWriter out ) { int q = scan . nextInt ( ) ; while ( q -- > 0 ) { int n = scan . nextInt ( ) ; double s = 0 ; for ( int i = 0 ; i < n ; i ++ ) s += scan . nextDouble ( ) ; out . println ( ( int ) Math . ceil ( s / n ) ) ; } } }   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   public FastReader ( String s ) throws FileNotFoundException { br = new BufferedReader ( new FileReader ( new File ( s ) ) ) ; }   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 ; } } }" ]
[ "for i in range ( int ( input ( ) ) ) : n = int ( input ( ) ) items = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) a = sum ( items ) ans = a // n if a % n != 0 : ans += 1 print ( ans ) NEW_LINE", "t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) s = sum ( x ) if s % n == 0 : k = s // n else : k = s // n + 1 print ( k ) NEW_LINE", "'''  351 ▁ 2 ▁ 3 ▁ 4 ▁ 531 ▁ 2 ▁ 241 ▁ 1 ▁ 1 ▁ 1   '''     n = int ( input ( ) )   for i in range ( 0 , n ) : o = int ( input ( ) ) p = input ( ) . rstrip ( ) . split ( ' ▁ ' ) sums = 0 ; for j in range ( 0 , len ( p ) ) : sums += int ( p [ j ] ) ; I = sums // o ; J = 10000000005 ; maxi = 100000000000000000000000000000000000000000000000000000000000 ; while ( I <= J ) : m = ( I + J ) // 2 ; A = m * o ; if A < sums : I = m + 1 ; else : ans = m ; J = m - 1 ; print ( ans ) NEW_LINE", "import mathfor t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( math . ceil ( sum ( a ) / n ) ) NEW_LINE" ]
codeforces_570_B
[ "import java . io . PrintWriter ; import java . util . * ; import java . lang . * ; public class Main { static int po ( int n ) { int a = 2 ; int res = 1 ; while ( n > 0 ) { if ( n % 2 == 0 ) { res *= a ; n -- ; } else { a *= a ; n /= 2 ; } } return res ; } static long f ( long num ) { HashSet < Long > h = new HashSet < > ( ) ; int res = 0 , flag = 1 ; while ( num > 0 ) { long n = num % 10 ; if ( ! h . contains ( n ) ) { h . add ( n ) ; num /= 10 ; res += n ; } else { flag = 0 ; break ; } } if ( flag == 0 ) { return - 1 ; } return res ; } public static void main ( String [ ] args ) { PrintWriter out1 = new PrintWriter ( System . out ) ; Scanner sc = new Scanner ( System . in ) ;", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { try ( Scanner input = new Scanner ( System . in ) ) { long n = input . nextLong ( ) ; long m = input . nextLong ( ) ; long a = 0 ; long largestInterval = getLargestInterval ( n , m ) ; if ( largestInterval == 0 ) { a = 1 ; } else if ( largestInterval == m - 1 ) { a = m - 1 ; } else { a = m + 1 ; } System . out . println ( a ) ; } }   private static long getLargestInterval ( long n , long m ) { return Math . max ( n - m , m - 1 ) ; } }", "import java . util . Scanner ;   public class P570B { public static void main ( String [ ] args ) {   Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; if ( n == 1 ) { System . out . println ( 1 ) ; } else { if ( n - m > m - 1 ) { System . out . println ( m + 1 ) ; } else { System . out . println ( m - 1 ) ; } }   }   }", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  " ]
[ "n , m = map ( int , input ( ) . split ( ) ) if n == 1 : print ( 1 ) else : print ( m - 1 if m - 1 >= n - m else m + 1 ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) if n == 1 : print ( 1 ) elif m - 1 < n - m : print ( m + 1 ) else : print ( m - 1 ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a = min ( m + 1 , n ) b = max ( m - 1 , 1 ) a = ( n - a + 1 ) - ( m == n ) b = b - ( m == 1 ) if b >= a : print ( max ( m - 1 , 1 ) ) else : print ( min ( m + 1 , n ) ) NEW_LINE", "arr = list ( map ( int , input ( ) . split ( ) ) ) n = arr [ 0 ] m = arr [ 1 ] if ( n == 1 ) : print ( 1 ) elif ( n % 2 == 0 ) : if ( m == n / 2 ) : print ( m + 1 ) elif ( m == ( n / 2 + 1 ) ) : print ( m - 1 ) elif ( m < ( n / 2 ) ) : print ( m + 1 ) else : print ( m - 1 ) else : k = ( n + 1 ) / 2 if ( m == k ) : print ( m - 1 ) elif ( m < k ) : print ( m + 1 ) else : print ( m - 1 ) NEW_LINE" ]
codeforces_916_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int c = 0 ; while ( h % 10 != 7 && m % 10 != 7 ) { c ++ ; m -= x ; if ( m < 0 ) { m += 60 ; h -= 1 ; } if ( h < 0 ) h = 23 ; } System . out . println ( c ) ; } }", "import java . util . Scanner ;   public class NewMain6 {   public static void main ( String [ ] args ) {", "import java . util . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; int hh = scan . nextInt ( ) ; int mm = scan . nextInt ( ) ; int result = 0 ; while ( ! happy ( hh , mm ) ) { if ( mm >= x ) { mm -= x ; } else { mm = 60 - ( x - mm ) ; if ( hh > 0 ) { hh -- ; } else { hh = 23 ; } } result ++ ; } System . out . println ( result ) ; } private static boolean happy ( Integer hh , Integer mm ) { return hh . toString ( ) . contains ( \"7\" ) || mm . toString ( ) . contains ( \"7\" ) ; } }" ]
[ "import datetime   n = int ( input ( ) ) a , b = input ( ) . split ( )   x = datetime . timedelta ( hours = int ( a ) , minutes = int ( b ) ) c = 0 while '7' not in str ( x ) : x -= datetime . timedelta ( hours = 0 , minutes = n ) c += 1   print ( c ) NEW_LINE", "def decrease ( h , m , x ) : if m >= x : m -= x else : m = 60 - ( x - m ) if h == 0 : h = 23 elif h <= 1 : h = 24 - ( h - 1 ) else : h -= 1 return [ h , m ]       def solve ( h , m , x ) : count = 0 v = [ 7 , 17 , 27 , 37 , 47 , 57 ] while True : if h in v or m in v : return count h , m = decrease ( h , m , x ) count += 1     def main ( ) : x = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE", "x = int ( input ( ) ) h , m = map ( int , input ( ) . split ( ) )   y = 0 while 1 : if str ( h ) . find ( '7' ) >= 0 or str ( m ) . find ( '7' ) >= 0 : break   y += 1 m -= x if m < 0 : h -= 1 m += 60 if h < 0 : h += 24   print ( y ) NEW_LINE", "x = int ( input ( ) ) h , m = map ( int , input ( ) . split ( ) ) c = 0   if '7' in str ( h ) or '7' in str ( m ) : print ( 0 ) else : while True : if ( m - x ) >= 0 : m = m - x c = c + 1 else : m = 60 - ( abs ( m - x ) ) if h == 0 : h = 23 else : h = h - 1 c = c + 1 d = str ( h ) f = str ( m ) if '7' in d or '7' in f : break print ( c ) NEW_LINE" ]
codeforces_1401_A
[ "import java . util . * ;   public class Solution {    public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int testCases = in . nextInt ( ) ; in . nextLine ( ) ; for ( int i = 0 ; i < testCases ; i ++ ) { int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; in . nextLine ( ) ; int result = 0 ; if ( n < k ) { result = k - n ; } else { result = ( ( n - k ) % 2 == 0 ) ? 0 : 1 ; } System . out . println ( result ) ; } } }", "import java . util . * ; import java . io . * ; import java . lang . Math ;    public class A { public static void main ( String args [ ] ) { PrintWriter out = new PrintWriter ( System . out ) ; FastScanner fs = new FastScanner ( ) ; int t = fs . nextInt ( ) ; for ( int test_case = 1 ; test_case <= t ; test_case ++ ) { int n = fs . nextInt ( ) , k = fs . nextInt ( ) ; if ( n < k ) { System . out . println ( k - n ) ; } else { if ( k % 2 == 0 && n % 2 == 0 ) { System . out . println ( 0 ) ; } else if ( k % 2 == 1 && n % 2 == 1 ) { System . out . println ( 0 ) ; } else { System . out . println ( 1 ) ; } } } out . close ( ) ; } static class Pair implements Comparable < Pair > { int first , second ; public Pair ( int x , int y ) { first = x ; second = y ; } public int compareTo ( Pair x ) { if ( this . first < x . first ) return - 1 ; if ( this . first == x . first ) return this . second < x . second ? - 1 : ( this . second == x . second ? 0 : 1 ) ; return 1 ; } } static class RangeMin { long logs [ ] , st [ ] [ ] ; int N , K ; public RangeMin ( int n ) { N = n ; K = ( int ) ( ( double ) ( Math . log10 ( ( double ) n ) / ( double ) Math . log10 ( ( double ) 2 ) ) ) ; st = new long [ N + 2 ] [ K + 2 ] ; logs = new long [ N + 2 ] ; } void init ( ArrayList < Integer > A ) { for ( int i = 0 ; i < N ; i ++ ) { Arrays . fill ( st [ i ] , ( long ) 1e18 ) ; st [ i ] [ 0 ] = ( long ) A . get ( i ) ; }", "import java . util . Scanner ;   public class A1401 {   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 answer = 0 ; if ( ( N % 2 == 0 ) != ( K % 2 == 0 ) ) { N ++ ; answer ++ ; } answer += Math . max ( 0 , K - N ) ; System . out . println ( answer ) ; } }   }", "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 . Scanner ; public class CodeForces { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( n > m ) { System . out . println ( ( n - m ) % 2 ) ; } else { System . out . println ( m - n ) ; } } } }" ]
[ "t = int ( input ( ) ) for _ in range ( t ) : n , k = list ( map ( int , input ( ) . split ( ) ) ) if n <= k : print ( k - n ) else : if ( n + k ) % 2 == 0 : print ( 0 ) else : print ( 1 ) NEW_LINE", "num_times = int ( input ( ) ) for i in range ( num_times ) : n , k = input ( ) . split ( ) n = int ( n ) k = int ( k ) if n % 2 == 0 : if k > n : print ( k - n ) elif k <= n and k % 2 == 0 : print ( 0 ) elif k <= n and k % 2 != 0 : print ( 1 ) elif n % 2 != 0 : if k > n : print ( k - n ) if k % 2 != 0 and k <= n : print ( 0 ) elif k % 2 == 0 and k <= n : print ( 1 )         NEW_LINE", "from sys import stdin , stdout   def main ( ) : for _ in range ( int ( stdin . readline ( ) ) ) : n , k = map ( int , stdin . readline ( ) . split ( ' ▁ ' ) ) if n <= k : stdout . write ( str ( k - n ) + ' \\n ' ) else : stdout . write ( str ( ( n - k ) % 2 ) + ' \\n ' )   if __name__ == \" _ _ main _ _ \" : main ( ) NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : a , b = map ( int , input ( ) . split ( ) ) if ( a < b ) : print ( b - a ) else : print ( ( a - b ) % 2 ) NEW_LINE" ]
codeforces_1335_B
[ "import java . util . * ;   public class Main {   public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; String alph = \" abcdefghijklmnopqrstuvwxyz \" ; int t = in . nextInt ( ) ;", "import java . util . * ;   public class Try { public static void main ( String args [ ] ) { Scanner br = new Scanner ( System . in ) ; int t = br . nextInt ( ) ; while ( t -- > 0 ) { int n = br . nextInt ( ) ; int a = br . nextInt ( ) ; int b = br . nextInt ( ) ; int ch = 96 ; while ( n -- != 0 ) { ++ ch ; System . out . print ( ( char ) ch ) ; if ( 96 + b == ch ) ch = 96 ; } System . out . println ( ) ; } } }", "import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; String s = \" abcdefghijklmnopqrstuvwxyz \" ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a == b ) { String m = \" \" ; for ( int j = 0 ; j < n ; j ++ ) { m += s . charAt ( j % 26 ) ; } System . out . println ( m ) ; } else if ( n == a ) { String f = \" \" ; for ( int i = 0 ; i < n - b + 1 ; i ++ ) { f += ' a ' ; } f += s . substring ( 1 , b ) ; System . out . println ( f ) ; } else if ( b == 1 ) { String f = \" \" ; for ( int i = 0 ; i < n ; i ++ ) { f += ' a ' ; } System . out . println ( f ) ; } else { String m = \" \" ; for ( int j = 0 ; j < a ; j ++ ) { m += s . charAt ( j % 26 ) ; } String ret = \" \" ; for ( int i = 0 ; i < a - b + 1 ; i ++ ) { ret += ' a ' ; } ret += m . substring ( 1 , b ) ;   String f = ret ; for ( int i = 0 ; i < n - ret . length ( ) ; i ++ ) { f += ret . charAt ( i % a ) ; } System . out . println ( f ) ;   } } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ;   public class CF1335B { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int [ ] nab = Arrays . stream ( br . readLine ( ) . split ( \" \\\\ s + \" ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int i = 0 ; while ( i < nab [ 0 ] ) { System . out . print ( ( char ) ( ' a ' + ( i ++ % nab [ 2 ] ) ) ) ; } System . out . println ( ) ; }   } }" ]
[ "t = int ( input ( ) ) for j in range ( t ) : n , a , b = map ( int , input ( ) . split ( ) ) x , res = ord ( ' a ' ) , ' ' for i in range ( a - b + 1 ) : res += chr ( x ) for i in range ( b - 1 ) : x += 1 res += chr ( x ) NEW_LINE", "for i in range ( int ( input ( ) ) ) : n , a , b = map ( int , input ( ) . split ( ) ) s1 = ' qwertyuiopasdfghjklzxcvbnm ' s2 = s1 [ : b ] s3 = s2 * ( n // b ) + s2 [ : n % b ] print ( s3 ) NEW_LINE", "from math import ceil   t = int ( input ( ) )   l = ' zyxwvutsrqponmlkjihgfedcba ' for i in range ( t ) : n , a , b = map ( int , input ( ) . split ( ) )   x = l [ : b ] x = ( x * ceil ( a / b ) ) [ : a ] x = ( x * ceil ( n / a ) ) [ : n ]   print ( x ) NEW_LINE", "for i in range ( int ( input ( ) ) ) : n , a , b = map ( int , input ( ) . split ( ) ) s = ' abcdefghijklmnopqrstuvwxyz ' res = s [ 0 : b ] * ( n // b ) c = n - len ( res ) print ( res + s [ 0 : c ] ) NEW_LINE", "for t in range ( int ( input ( ) ) ) : n , a , b = map ( int , input ( ) . split ( ) ) alpha = [ ' a ' , ' b ' , ' c ' , ' d ' , ' e ' , ' f ' , ' g ' , ' h ' , ' i ' , ' j ' , ' k ' , ' l ' , ' m ' , ' n ' , ' o ' , ' p ' , ' q ' , ' r ' , ' s ' , ' t ' , ' u ' , ' v ' , ' w ' , ' x ' , ' y ' , ' z ' ] s = ' a ' * ( a - b + 1 ) for i in range ( 1 , b ) : s += alpha [ i ] s += ( s * ( ( n - a ) // a ) + s [ : ( n - a ) % a ] ) print ( s ) NEW_LINE" ]
codeforces_384_A
[ "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; StringBuilder SB = new StringBuilder ( ) ; int n = in . nextInt ( ) ; if ( n % 2 == 0 ) { int k = n / 2 ; System . out . println ( ( k ) * n ) ;   for ( int i = 1 ; i <= k ; i ++ ) {   for ( int j = 1 ; j <= k ; j ++ ) { SB . append ( \" C . \" ) ;   } SB . append ( \" \\r \\n \" ) ;    for ( int j = 1 ; j <= k ; j ++ ) { SB . append ( \" . C \" ) ; } SB . append ( \" \\r \\n \" ) ;   } } else { int k = n / 2 ; System . out . println ( ( k + 1 ) * ( ( k ) + 1 ) + ( k ) * ( k ) ) ; for ( int i = 1 ; i <= k ; i ++ ) { for ( int j = 1 ; j <= k ; j ++ ) { SB . append ( \" C . \" ) ; } SB . append ( \" C \" ) ; SB . append ( \" \\r \\n \" ) ; for ( int j = 1 ; j <= k ; j ++ ) { SB . append ( \" . C \" ) ; } SB . append ( \" . \" ) ; SB . append ( \" \\r \\n \" ) ; }   for ( int j = 1 ; j <= k ; j ++ ) { SB . append ( \" C . \" ) ; } SB . append ( \" C \" ) ; SB . append ( \" \\r \\n \" ) ; } System . out . println ( SB ) ; } }  ", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; System . out . println ( ( n * n + 1 ) / 2 ) ; for ( int i = 0 ; i < n ; i ++ ) { StringBuilder sb = new StringBuilder ( ) ; for ( int j = 0 ; j < n ; j ++ ) { if ( ( i + j ) % 2 == 0 ) sb . append ( \" C \" ) ; else sb . append ( \" . \" ) ; } System . out . println ( sb ) ; } in . close ( ) ; } }", "     import java . util . Scanner ;   public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int n = in . nextInt ( ) ; int code = ( n * n + 1 ) / 2 ; System . out . println ( code ) ; for ( int i = 0 ; i < n ; i ++ ) { StringBuffer stringBuffer = new StringBuffer ( ) ; for ( int j = 0 ; j < n ; j ++ ) { if ( ( i + j + 2 ) % 2 == 0 ) stringBuffer . append ( ' C ' ) ; else stringBuffer . append ( ' . ' ) ; } System . out . println ( stringBuffer ) ; } } }   }                ", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception {", "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 ( ) ;   int j = 0 , ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { j = 0 ; if ( i % 2 == 0 ) {   while ( j < n ) { sb . append ( \" C \" ) ; ans ++ ; j ++ ; if ( j < n ) { sb . append ( \" . \" ) ; j ++ ; } } } else {    while ( j < n ) { sb . append ( \" . \" ) ; j ++ ; if ( j < n ) { sb . append ( \" C \" ) ; ans ++ ; j ++ ; } } } sb . append ( \" \\n \" ) ;   } System . out . println ( ans + \" \\n \" + sb ) ;           " ]
[ "n = int ( input ( ) )     if ( n % 2 ) != 0 : print ( ( n * n // 2 ) + 1 ) else : print ( n * n // 2 ) for i in range ( n ) : rep = ' ' for j in range ( n ) : if i % 2 == 0 : if j % 2 == 0 : rep += ' C ' else : rep += ' . ' else : if j % 2 != 0 : rep += ' C ' else : rep += ' . ' print ( rep ) NEW_LINE", "n = int ( input ( ) ) if n % 2 == 0 : print ( n ** 2 // 2 ) for i in range ( n ) : if i % 2 == 0 : print ( ' C . ' * ( n // 2 ) ) else : print ( ' . C ' * ( n // 2 ) ) else : print ( n ** 2 // 2 + 1 ) for i in range ( n ) : if i % 2 == 0 : print ( ' C . ' * ( n // 2 ) + ' C ' ) else : print ( ' . C ' * ( n // 2 ) + ' . ' ) NEW_LINE", "import sysfrom math import ceil   def main ( ) : n = int ( sys . stdin . read ( ) . strip ( ) ) t = int ( ceil ( n / 2 ) ) return t * n - n % t , ' \\n ' . join ( ' ' . join ( ' . C ' [ not ( i + j ) % 2 ] for j in range ( n ) ) for i in range ( n ) ) print ( * main ( ) , sep = ' \\n ' ) NEW_LINE", "def main_function ( ) : n = int ( input ( ) ) output_list = [ ] count = 0 for i in range ( n ) : lis = [ ] if not i % 2 : for j in range ( n ) : if not j % 2 : lis . append ( \" C \" ) count += 1 else : lis . append ( \" . \" ) else : for j in range ( n ) : if not j % 2 : lis . append ( \" . \" ) else : lis . append ( \" C \" ) count += 1 s = \" \" . join ( lis ) output_list . append ( s ) return str ( count ) + \" \\n \" + \" \\n \" . join ( output_list )           print ( main_function ( ) ) NEW_LINE", "n = int ( input ( ) ) if n % 2 == 0 : print ( n * n // 2 ) for i in range ( n // 2 ) : print ( ' C . ' * ( n // 2 ) ) print ( ' . C ' * ( n // 2 ) ) else : ans = ( n // 2 ) ** 2 + ( n // 2 + 1 ) ** 2 print ( ans ) for i in range ( n // 2 ) : print ( ' C . ' * ( n // 2 ) + ' C ' ) print ( ' . C ' * ( n // 2 ) + ' . ' ) print ( ' C . ' * ( n // 2 ) + ' C ' ) NEW_LINE" ]
codeforces_553_B
[ "import java . util . * ; import java . io . * ; import java . math . * ; public class Solution { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; long k = Long . parseLong ( st . nextToken ( ) ) ; if ( n == 1 ) out . println ( \"1\" ) ; else { long [ ] tab = new long [ n ] ; tab [ 0 ] = ( long ) 0 ; tab [ 1 ] = ( long ) 0 ; for ( int i = 2 ; i < n ; i ++ ) {", "import java . io . * ; import java . util . * ;   public class cf553B {   public static void main ( String [ ] args ) {", "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 . HashMap ; import java . util . Objects ; import java . util . Random ; import java . util . StringTokenizer ; import java . util . TreeSet ;   public class Solution { static final int maxn = ( int ) 1e5 + 10 ; 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 ( ) ; long k = fs . nextLong ( ) ; long [ ] fib = new long [ n + 1 ] ; fib [ 0 ] = 1 ; fib [ 1 ] = 1 ; for ( int i = 2 ; i <= n ; i ++ ) fib [ i ] = fib [ i - 1 ] + fib [ i - 2 ] ; int idx = 0 ; int [ ] res = new int [ n ] ; while ( idx < n ) { if ( k <= fib [ n - idx - 1 ] ) { res [ idx ] = idx + 1 ; idx ++ ; } else { k -= fib [ n - idx - 1 ] ; res [ idx ] = idx + 2 ; res [ idx + 1 ] = idx + 1 ; idx += 2 ; } } for ( int i = 0 ; i < n ; i ++ ) out . print ( res [ i ] + \" ▁ \" ) ; out . println ( ) ; } out . close ( ) ; } static final Random random = new Random ( ) ; static void ruffleSort ( int [ ] a ) { int n = a . length ;" ]
[ "n , k = map ( int , input ( ) . split ( ) ) a = [ 0 for i in range ( n + 1 ) ] a [ 0 ] , a [ 1 ] = 1 , 1 for i in range ( 2 , n + 1 ) : a [ i ] = a [ i - 1 ] + a [ i - 2 ] p = [ i + 1 for i in range ( n ) ] i = 0 while i < n : if k > a [ n - 1 - i ] : p [ i ] , p [ i + 1 ] = p [ i + 1 ] , p [ i ] k -= a [ n - 1 - i ] i += 2 else : i += 1 p = [ str ( i ) for i in p ] print ( ' ▁ ' . join ( p ) )   NEW_LINE", "n , m = [ int ( x ) for x in input ( ) . split ( ) ] F = [ 1 , 1 ] for i in range ( 2 , n ) : F . append ( F [ - 1 ] + F [ - 2 ] ) perm = [ i + 1 for i in range ( n ) ] for i in range ( n ) : if m > F [ n - 1 - i ] : m -= F [ n - 1 - i ] perm [ i ] , perm [ i + 1 ] = perm [ i + 1 ] , perm [ i ] for k in perm : print ( k , end = ' ▁ ' ) NEW_LINE", "n , k = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE", "n , m = [ int ( x ) for x in input ( ) . split ( ) ] F = [ 1 , 1 ] for i in range ( 2 , n ) : F . append ( F [ - 1 ] + F [ - 2 ] ) perm = [ i + 1 for i in range ( n ) ] for i in range ( n ) : if m > F [ n - 1 - i ] : m -= F [ n - 1 - i ] perm [ i ] , perm [ i + 1 ] = perm [ i + 1 ] , perm [ i ] for k in perm : print ( k , end = ' ▁ ' )         NEW_LINE" ]
codeforces_306_A
[ "import java . util . Scanner ;   public class problem65 {   public static void main ( String [ ] args ) {", "import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int a [ ] = new int [ m ] ; if ( n % m == 0 ) { for ( int i = 0 ; i < m ; i ++ ) System . out . print ( n / m + \" ▁ \" ) ; return ; } while ( true ) { for ( int i = m - 1 ; i >= 0 ; i -- ) { a [ i ] += 1 ; -- n ; if ( n == 0 ) { for ( int k = 0 ; k < m ; k ++ ) System . out . print ( a [ k ] + \" ▁ \" ) ; return ; } } } } }", "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 ( ) ; while ( n % m != 0 ) { int p = n / m ; System . out . print ( p + \" ▁ \" ) ; n -= p ; m -- ; } for ( int i = 0 ; i < m ; i ++ ) { System . out . print ( n / m + \" ▁ \" ) ; } } }", "import java . util . * ; public class Sol { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) , m = s . nextInt ( ) , t = m ; for ( int i = 0 ; i < t ; i ++ ) { System . out . print ( n / m + \" ▁ \" ) ; n -= n / m ; -- m ; } } }" ]
[ "n , m = list ( map ( int , input ( ) . split ( ) ) ) print ( * ( [ n // m ] * ( m - n % m ) + [ n // m + 1 ] * ( n % m ) ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) )   if n >= m : m_list = [ 0 ] * m adding = n // m sub_adding = n % m for i in range ( adding ) : for j in range ( len ( m_list ) ) : m_list [ j ] += 1 for k in range ( sub_adding ) : m_list [ k ] += 1 for l in m_list : print ( l , sep = \" ▁ \" , end = \" ▁ \" ) NEW_LINE", "from sys import stdin , stdout   def main ( ) : n , m = map ( int , stdin . readline ( ) . split ( ' ▁ ' ) ) q , r = n // m , n % m s = [ q for i in range ( m - r ) ] s . extend ( [ ( q + 1 ) for i in range ( m - r , m ) ] ) print ( * s , sep = ' ▁ ' )   if __name__ == \" _ _ main _ _ \" : main ( ) NEW_LINE", "n , m = input ( ) . split ( ) n = int ( n ) m = int ( m ) q = n // mr = n % mlst = [ ] for i in range ( m ) : if ( i < m - r ) : lst . append ( q ) else : lst . append ( q + 1 ) print ( * lst ) NEW_LINE" ]
codeforces_747_B
[ "import java . util . Scanner ; public class MammothSGenomeDecoding {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int arr [ ] = new int [ 5 ] ;", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  " ]
[ "n = int ( input ( ) )   s = input ( )   a = s . count ( ' A ' ) g = s . count ( ' G ' ) c = s . count ( ' C ' ) t = s . count ( ' T ' )     if n % 4 != 0 or a > n // 4 or g > n // 4 or c > n // 4 or t > n // 4 : print ( \" = = = \" ) else : a = n // 4 - a g = n // 4 - g c = n // 4 - c t = n // 4 - t     s = list ( s ) for i in range ( n ) : if s [ i ] == ' ? ' : if a : s [ i ] = ' A ' a -= 1 elif g : s [ i ] = ' G ' g -= 1 elif c : s [ i ] = ' C ' c -= 1 else : s [ i ] = ' T ' t -= 1     print ( ' ' . join ( s ) ) NEW_LINE", "n = int ( input ( ) ) s = input ( ) f = 0 if ( n % 4 != 0 ) : print ( ' = = = ' ) else : gnm = { } gnm [ ' A ' ] = s . count ( ' A ' ) gnm [ ' C ' ] = s . count ( ' C ' ) gnm [ ' G ' ] = s . count ( ' G ' ) gnm [ ' T ' ] = s . count ( ' T ' ) num = n // 4 for i in gnm : if gnm . get ( i ) > num and i != ' ? ' : f = 1 print ( ' = = = ' ) break else : gnm [ i ] = num - gnm . get ( i ) if f == 0 : s = s . replace ( ' ? ' , ' A ' , gnm [ ' A ' ] ) . replace ( ' ? ' , ' C ' , gnm [ ' C ' ] ) . replace ( ' ? ' , ' G ' , gnm [ ' G ' ] ) . replace ( ' ? ' , ' T ' , gnm [ ' T ' ] ) print ( s ) NEW_LINE", "n = int ( input ( ) ) genomes = list ( input ( ) ) if n % 4 != 0 or any ( [ genomes . count ( x ) > n // 4 for x in ' ACGT ' ] ) : print ( ' = = = ' ) else : cnt = { } for x in ' ACGT ' : cnt [ x ] = n // 4 - genomes . count ( x ) for i in range ( n ) : if genomes [ i ] == ' ? ' : for x in ' ACGT ' : if cnt [ x ] > 0 : genomes [ i ] = x cnt [ x ] -= 1 break print ( ' ' . join ( genomes ) ) NEW_LINE" ]
codeforces_1073_A
[ "import java . util . Scanner ;   public class _0700DiverseSubstring {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; int val = n / 2 ; char prev = ' # ' ; for ( int i = 0 ; i < n ; i ++ ) { char curr = s . charAt ( i ) ; if ( i == 0 ) { prev = curr ; continue ; } else if ( prev != curr ) { System . out . println ( \" YES \" ) ; System . out . println ( prev + \" \" + curr ) ; return ; } prev = curr ; } System . out . println ( \" NO \" ) ; }   }", "import java . util . Scanner ;   public class DiverseSubS { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i ; String s = in . next ( ) , o = \" NO \" ; in . close ( ) ;   for ( i = 0 ; i < n - 1 ; i ++ ) if ( s . charAt ( i ) != s . charAt ( i + 1 ) ) { o = \" YES \\n \" + s . substring ( i , i + 2 ) ; break ; } System . out . println ( o ) ; } }", "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; String str = s . next ( ) ; for ( int i = 1 ; i < n ; i ++ ) { if ( str . charAt ( i ) != str . charAt ( i - 1 ) ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( str . charAt ( i - 1 ) ) ; sb . append ( str . charAt ( i ) ) ; System . out . println ( \" YES \" ) ; System . out . println ( sb ) ; return ; } } System . out . println ( \" NO \" ) ; } }", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) throws java . lang . Exception { FastScanner fs = new FastScanner ( ) ;" ]
[ "n = int ( input ( ) ) s = input ( ) ans = \" \"   for i in range ( n - 1 ) : if s [ i ] != s [ i + 1 ] : ans = s [ i : i + 2 ] break     if ans : print ( \" YES \" ) print ( ans )   else : print ( \" NO \" ) NEW_LINE", "x = int ( input ( ) ) s = input ( ) N = 0 for i in range ( x - 1 ) : if s [ i ] != s [ i + 1 ] : print ( \" YES \" ) print ( s [ i ] + s [ i + 1 ] ) N = 1 breakif N == 0 : print ( \" NO \" ) NEW_LINE", "import sysinput = sys . stdin . readline   n = int ( input ( ) ) s = input ( ) for i in range ( n - 1 ) : if s [ i ] != s [ i + 1 ] : print ( \" YES \" ) print ( s [ i ] , s [ i + 1 ] , sep = \" \" ) exit ( ) print ( \" NO \" ) NEW_LINE", "import sysinput = sys . stdin . readline   n = int ( input ( ) ) s = input ( ) for i in range ( n - 1 ) : if s [ i ] != s [ i + 1 ] : print ( \" YES \" ) print ( s [ i ] , s [ i + 1 ] , sep = \" \" ) sys . exit ( ) print ( \" NO \" ) NEW_LINE", "n = int ( input ( ) ) s = input ( )   for i in range ( n - 1 ) : if s [ i ] != s [ i + 1 ] : print ( \" YES \" ) print ( s [ i ] + s [ i + 1 ] ) exit ( 0 ) print ( \" NO \" ) NEW_LINE" ]
codeforces_1416_B
[ "import java . io . * ; import java . util . * ; public class Solution { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t > 0 ) { t -- ; int n = Integer . parseInt ( br . readLine ( ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int [ ] a = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; sum += a [ i ] ; } if ( sum % n != 0 ) { out . println ( - 1 ) ; continue ; } out . println ( ( 3 * n - 3 ) ) ; for ( int i = 1 ; i < n ; i ++ ) { int need = a [ i ] % ( i + 1 ) ; if ( need > 0 ) need = ( i + 1 ) - need ; a [ 0 ] -= need ; a [ i ] += need ; out . println ( 1 + \" ▁ \" + ( i + 1 ) + \" ▁ \" + need ) ; need = a [ i ] ; a [ 0 ] += need ; out . println ( ( i + 1 ) + \" ▁ \" + 1 + \" ▁ \" + ( need / ( i + 1 ) ) ) ; } int fact = a [ 0 ] / n ; for ( int i = 1 ; i < n ; i ++ ) { out . println ( 1 + \" ▁ \" + ( i + 1 ) + \" ▁ \" + fact ) ; } } out . close ( ) ; } }" ]
[ "import sys , math   t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE arr = list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE S = sum ( arr ) NEW_LINE if S % n : NEW_LINE INDENT print ( - 1 ) else : NEW_LINE out = [ ] NEW_LINE DEDENT for i in range ( 1 , n ) : if NEW_LINE arr [ i ] % ( i + 1 ) == 0 : x = arr [ i ] // ( i + 1 ) NEW_LINE arr [ i ] -= ( x * ( i + 1 ) ) NEW_LINE arr [ 0 ] += ( x * ( i + 1 ) ) NEW_LINE out . append ( \" { } ▁ { } ▁ { } \\n \" . format ( i + 1 , 1 , x ) ) NEW_LINE", "import osimport NEW_LINE sysfrom NEW_LINE io NEW_LINE import BytesIO , IOBase NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE s = sum ( a ) NEW_LINE if s % n != 0 : print ( - 1 ) ; continue NEW_LINE t = s // n NEW_LINE print ( 3 * ( n - 1 ) ) NEW_LINE for i in range ( 1 , n ) : x = ( i + 1 ) - a [ i ] % ( i + 1 ) NEW_LINE if a [ i ] % ( i + 1 ) == 0 : x = 0 NEW_LINE a [ i ] += x NEW_LINE print ( 1 , i + 1 , x ) NEW_LINE print ( i + 1 , 1 , a [ i ] // ( i + 1 ) ) NEW_LINE for i in range ( 1 , n ) : print ( 1 , i + 1 , t ) NEW_LINE", "def main ( ) : t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE a = [ 0 ] + readIntArr ( ) NEW_LINE", "import sys , math   t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE arr = list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE S = sum ( arr ) NEW_LINE if S % n : NEW_LINE INDENT print ( - 1 ) else : NEW_LINE out = [ ] NEW_LINE DEDENT for i in range ( 1 , n ) : if NEW_LINE arr [ i ] % ( i + 1 ) == 0 : x = arr [ i ] // ( i + 1 ) NEW_LINE arr [ i ] -= ( x * ( i + 1 ) ) NEW_LINE arr [ 0 ] += ( x * ( i + 1 ) ) NEW_LINE out . append ( \" { } ▁ { } ▁ { } \\n \" . format ( i + 1 , 1 , x ) ) NEW_LINE" ]
codeforces_278_A
[ "import java . util . Scanner ;   public class practice { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] distances = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) distances [ i ] = input . nextInt ( ) ; int s = input . nextInt ( ) ; int t = input . nextInt ( ) ; int countForward = 0 , countBackward = 0 ; if ( s < t ) { for ( int i = s ; i < t ; i ++ ) countForward += distances [ i ] ; for ( int i = t ; i != s ; i ++ ) { countBackward += distances [ i ] ; if ( i == n ) i = 0 ; } } if ( s > t ) { for ( int i = t ; i < s ; i ++ ) countBackward += distances [ i ] ; for ( int i = s ; i != t ; i ++ ) { countForward += distances [ i ] ; if ( i == n ) i = 0 ; } } System . out . println ( ( countBackward > countForward ) ? countForward : countBackward ) ; }   }", "import java . util . Scanner ;   public class CircleLine { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , d [ ] = new int [ n ] , i , d1 = 0 , d2 = 0 ;   for ( i = 0 ; i < n ; i ++ ) { d [ i ] = in . nextInt ( ) ; } int s = in . nextInt ( ) - 1 , t = in . nextInt ( ) - 1 , j = s ; while ( j != t ) { d1 += d [ j ] ; j ++ ; if ( j >= n ) { j = 0 ; } } while ( s != t ) { s -- ; if ( s < 0 ) { s = n - 1 ; } d2 += d [ s ] ; } in . close ( ) ; System . out . println ( Math . min ( d1 , d2 ) ) ; } }", "import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ;   import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . StringTokenizer ;     public class Main {   public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;   static class FastReader {   BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String [ ] nextSArray ( ) { String sr [ ] = null ; try { sr = br . readLine ( ) . trim ( ) . split ( \" ▁ \" ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return sr ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; }   return str ; } }  ", "import java . lang . * ; import java . util . * ; import java . io . * ; public class test { int d [ ] ; Scanner sc = new Scanner ( System . in ) ; PrintWriter pr = new PrintWriter ( System . out , true ) ; public static void main ( String ... args ) { test c = new test ( ) ; c . prop ( ) ; } public void prop ( ) { int n , s , t , min = 0 ; n = sc . nextInt ( ) ; d = new int [ n ] ; for ( int i = 2 ; i <= n + 1 ; ++ i ) { d [ i % n ] = sc . nextInt ( ) ; } s = sc . nextInt ( ) ; t = sc . nextInt ( ) ; int sum = 0 ; if ( t == n ) t = 0 ; if ( s == n ) s = 0 ; if ( s != t ) { for ( int i = s + 1 ; ; ++ i ) { sum += d [ i % n ] ; if ( i % n == t ) break ; } min = sum ; sum = 0 ; for ( int i = s ; ; -- i ) { if ( i < 0 ) sum += d [ ( n + i ) % n ] ; else sum += d [ i % n ] ;   if ( ( n + ( i - 1 ) ) % n == t ) break ; } if ( min > sum ) min = sum ; pr . println ( min ) ; } else pr . println ( 0 ) ; } }", "import java . util . Scanner ;   public class practice { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] distances = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { distances [ i ] = input . nextInt ( ) + distances [ i - 1 ] ; } int s = input . nextInt ( ) ; int t = input . nextInt ( ) ; if ( s > t ) { int temp = s ; s = t ; t = temp ; } int dis = Math . min ( distances [ t - 1 ] - distances [ s - 1 ] , distances [ n ] - distances [ t - 1 ] + distances [ s - 1 ] ) ; System . out . println ( dis ) ; }   }" ]
[ "n = int ( input ( ) ) d = list ( map ( int , input ( ) . split ( ) ) ) s , t = sorted ( map ( int , input ( ) . split ( ) ) ) result1 = 0 result2 = d [ n - 1 ] for i in range ( s - 1 , t - 1 ) : result1 += d [ i ] for i in range ( s - 1 ) : result2 += d [ i ] for i in range ( t - 1 , n - 1 ) : result2 += d [ i ] print ( min ( result1 , result2 ) ) NEW_LINE", "n = int ( input ( ) ) d = [ int ( item ) for item in input ( ) . split ( ) ] s , t = [ int ( item ) for item in input ( ) . split ( ) ] ss = min ( s , t ) - 1 tt = max ( s , t ) - 1 dist1 = sum ( d [ ss : tt ] )   print ( min ( sum ( d ) - dist1 , dist1 ) ) NEW_LINE", "a = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) c , d = sorted ( map ( int , input ( ) . split ( ) ) ) x = sum ( b [ c - 1 : d - 1 ] ) cnt = 0 print ( min ( x , sum ( b ) - x ) ) NEW_LINE", "import sysimport collections   input = sys . stdin . readline   def printnl ( val ) : sys . stdout . write ( str ( val ) + ' \\n ' )   n = int ( input ( ) ) d = list ( map ( int , input ( ) . split ( ) ) ) res = sum ( d ) s , t = map ( int , input ( ) . split ( ) ) s -= 1 t -= 1   ans1 , ans2 = 0 , 0   if s == t : print ( 0 ) elif s < t : now = 0 for i in range ( s , t ) : now += d [ i ] if now < res - now : print ( now ) else : print ( res - now ) else : now = 0 for i in range ( t , s ) : now += d [ i ] if now < res - now : print ( now ) else : print ( res - now ) NEW_LINE" ]
codeforces_771_B
[ "import java . io . * ; import java . math . * ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 1000000007 ;   private static final int MAXN = 300005 ; private static final int MAXA = 1000007 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;", "  import java . io . * ; import java . util . * ; import java . util . stream . Collectors ; import java . util . stream . Stream ;   import static java . lang . Integer . * ; import static java . lang . Math . * ;   public class CF771B { public static void main ( String args [ ] ) throws Throwable { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( String ln ; ( ln = in . readLine ( ) ) != null && ! ln . equals ( \" \" ) ; ) { StringTokenizer st = new StringTokenizer ( ln ) ; int N = parseInt ( st . nextToken ( ) ) , K = parseInt ( st . nextToken ( ) ) ; String [ ] result = new String [ N ] ; st = new StringTokenizer ( in . readLine ( ) ) ; for ( int i = 0 ; i < N - K + 1 ; i ++ ) { if ( st . nextToken ( ) . equals ( \" YES \" ) ) { for ( int j = i ; j < i + K ; j ++ ) if ( result [ j ] == null ) result [ j ] = getName ( j ) ; } else { if ( result [ i ] == null ) { result [ i ] = getName ( i ) ; result [ i + K - 1 ] = getName ( i ) ; } else result [ i + K - 1 ] = result [ i ] ; } } for ( int i = 0 ; i < N ; i ++ ) if ( result [ i ] == null ) result [ i ] = getName ( i ) ; System . out . println ( Stream . of ( result ) . collect ( Collectors . joining ( \" ▁ \" ) ) ) ; } }   static String getName ( int p ) { if ( p < 26 ) return ( char ) ( p + ' A ' ) + \" \" ; return ( char ) ( p / 26 + ' A ' ) + \" \" + ( char ) ( p % 26 + ' a ' ) ; } }", "import java . util . Arrays ; import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , k = sc . nextInt ( ) ; boolean [ ] rp = new boolean [ n ] ; String [ ] arr = new String [ n ] ; for ( int i = 0 ; i < n - k + 1 ; ++ i ) { rp [ i ] = sc . next ( ) . equals ( \" NO \" ) ; } for ( int i = 0 ; i < n ; ++ i ) { if ( arr [ i ] == null ) arr [ i ] = ( i < 25 ? \" A \" : \" B \" ) + ( char ) ( ' a ' + i % 25 ) ; if ( rp [ i ] ) { arr [ i + k - 1 ] = arr [ i ] ; } } for ( String s : arr ) System . out . print ( s + \" ▁ \" ) ; } }", "import java . io . * ; import java . math . * ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 1000000007 ;   private static final int MAXN = 300005 ; private static final int MAXA = 1000007 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;" ]
[ "n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( str , input ( ) . split ( ) ) ) A = [ ' A ' , ' B ' , ' C ' , ' D ' , ' E ' , ' F ' , ' G ' , ' H ' , ' I ' , ' J ' , ' K ' , ' L ' , ' M ' , ' N ' , ' O ' , ' P ' , ' Q ' , ' R ' , ' S ' , ' T ' , ' U ' , ' V ' , ' W ' , ' X ' , ' Y ' , ' Z ' , ' Aa ' , ' Ab ' , ' Ac ' , ' Ad ' , ' Ae ' , ' Af ' , ' Ag ' , ' Ah ' , ' Ai ' , ' Aj ' , ' Ak ' , ' Al ' , ' Am ' , ' An ' , ' Ao ' , ' Ap ' , ' Aq ' , ' Ar ' , ' As ' , ' At ' , ' Au ' , ' Av ' , ' Aw ' , ' Ax ' , ' Ay ' , ' Az ' ] ans = [ ] for i in range ( k - 1 ) : ans . append ( A [ i ] ) temp1 = 0 temp2 = k - 1 for i in range ( len ( l ) ) : if l [ i ] == \" YES \" : ans . append ( A [ temp2 ] ) temp2 += 1 else : ans . append ( ans [ - k + 1 ] ) print ( * ans ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) s = input ( ) . split ( ) ans = [ ] for i in range ( 26 ) : ans . append ( chr ( 65 + i ) + \" a \" ) for i in range ( 24 ) : ans . append ( chr ( 65 + i ) + \" b \" ) for i in range ( n - k + 1 ) : if s [ i ] == \" NO \" : ans [ i + k - 1 ] = ans [ i ] ans = ans [ : n ] print ( * ans ) NEW_LINE", "import sys import mathfrom collections import Counterfrom operator import itemgetterimport queue   def IO ( ) : sys . stdin = open ( \" pyinput . txt \" , ' r ' ) sys . stdout = open ( \" pyoutput . txt \" , ' w ' )   def GCD ( a , b ) : if ( b == 0 ) : return a else : return GCD ( b , a % b )   def LCM ( a , b ) : return a * ( b // GCD ( a , b ) )   def scan ( TYPE_1 , TYPE_2 = 0 ) : if ( TYPE_1 == int ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) elif ( TYPE_1 == float ) : return map ( float , sys . stdin . readline ( ) . strip ( ) . split ( ) ) elif ( TYPE_1 == list and TYPE_2 == float ) : return list ( map ( float , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) elif ( TYPE_1 == list and TYPE_2 == int ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) elif ( TYPE_1 == str ) : return sys . stdin . readline ( ) . strip ( ) else : print ( \" ERROR ! ! ! ! \" )       def main ( ) : s = [ ] for i in range ( 65 , 91 ) : s . append ( chr ( i ) ) for i in range ( 97 , 123 ) : s . append ( ' A ' + chr ( i ) )   n , k = scan ( int ) a = scan ( str ) . split ( ) ans = [ ] idx = 0   for i in range ( k - 1 ) : ans . append ( s [ idx ] ) idx += 1   for i in range ( n - k + 1 ) : if ( a [ i ] == ' NO ' ) : ans . append ( ans [ - k + 1 ] ) else : ans . append ( s [ idx ] ) idx += 1   print ( * ans )       NEW_LINE", "''' input8 ▁ 3NO ▁ NO ▁ YES ▁ YES ▁ YES ▁ NO ''' n , k = map ( int , input ( ) . split ( ) ) s = input ( ) . split ( ) names = [ chr ( ord ( ' A ' ) + ( i // 26 ) ) + chr ( ord ( ' a ' ) + ( i % 26 ) ) for i in range ( 1 , n + 1 ) ] for i in range ( len ( s ) ) : if ( s [ i ] == ' NO ' ) : names [ i + k - 1 ] = names [ i ] for name in names : print ( name , end = ' ▁ ' ) NEW_LINE" ]
codeforces_236_A
[ "import java . util . * ;   public class Main {   public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ;   String s1 = sc . next ( ) ; char [ ] a = s1 . toCharArray ( ) ; int len = a . length ;   HashSet < Character > set = new HashSet < Character > ( ) ; int count = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( ! set . contains ( a [ i ] ) ) { set . add ( a [ i ] ) ; count ++ ; } }", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner read = new Scanner ( System . in ) ; String username = read . nextLine ( ) ; String distinctCharacters = \" \" ; for ( int i = 0 ; i < username . length ( ) ; i ++ ) { char current = username . charAt ( i ) ; if ( distinctCharacters . indexOf ( current ) < 0 ) distinctCharacters += current ; } if ( distinctCharacters . length ( ) % 2 == 0 ) { System . out . println ( \" CHAT ▁ WITH ▁ HER ! \" ) ; } else { System . out . println ( \" IGNORE ▁ HIM ! \" ) ; } read . close ( ) ; } }", "import java . io . * ; import java . lang . * ; import java . util . * ;    public class Main {   static Main . MyScanner sc = new Main . MyScanner ( ) ; static PrintStream out = System . out ;   public static void main ( String [ ] args ) throws Exception { String input = sc . next ( ) ; if ( uniqueChar ( input ) . length ( ) % 2 == 0 ) out . print ( \" CHAT ▁ WITH ▁ HER ! \" ) ; else out . print ( \" IGNORE ▁ HIM ! \" ) ; out . close ( ) ; } public static String uniqueChar ( String input ) { String temp = \" \" ; for ( int i = 0 ; i < input . length ( ) ; i ++ ) { if ( temp . indexOf ( input . charAt ( i ) ) == - 1 ) temp += input . charAt ( i ) ; } return temp ; } static private class MyScanner { BufferedReader br ; StringTokenizer st ;   public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   public long mod ( long x ) {", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . HashSet ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ABoyOrGirl solver = new ABoyOrGirl ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class ABoyOrGirl { public void solve ( int testNumber , FastScanner fs , PrintWriter out ) { String s = fs . next ( ) ; HashSet < Character > chars = new HashSet < > ( ) ;   for ( int i = 0 ; i < s . length ( ) ; i ++ ) { chars . add ( s . charAt ( i ) ) ; }   out . println ( chars . size ( ) % 2 == 1 ? \" IGNORE ▁ HIM ! \" : \" CHAT ▁ WITH ▁ HER ! \" ) ; }   }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   } }  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . StringTokenizer ;   public class A_Boy_or_Girl { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; char [ ] s = fs . next ( ) . toCharArray ( ) ; HashSet < Character > dist = new HashSet < > ( ) ;   for ( char c : s ) { dist . add ( c ) ; }   if ( dist . size ( ) % 2 == 0 ) { System . out . println ( \" CHAT ▁ WITH ▁ HER ! \" ) ; } else { System . out . println ( \" IGNORE ▁ HIM ! \" ) ; } }   static int min ( int a , int b ) { return Math . min ( a , b ) ; }   static int max ( int a , int b ) { return Math . max ( a , b ) ; }   static long min ( long a , long b ) { return Math . min ( a , b ) ; }   static long max ( long a , long b ) { return Math . max ( a , b ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } char nextChar ( ) { return next ( ) . charAt ( 0 ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }" ]
[ "s = list ( input ( ) ) d = set ( s ) if len ( d ) % 2 != 0 : print ( ' IGNORE ▁ HIM ! ' ) else : print ( \" CHAT ▁ WITH ▁ HER ! \" ) NEW_LINE", "print ( [ \" CHAT ▁ WITH ▁ HER ! \" , \" IGNORE ▁ HIM ! \" ] [ len ( { * input ( ) } ) % 2 ] ) NEW_LINE", "print ( [ \" CHAT ▁ WITH ▁ HER ! \" , \" IGNORE ▁ HIM ! \" ] [ len ( { * input ( ) } ) % 2 ] ) NEW_LINE", "print ( [ \" CHAT ▁ WITH ▁ HER ! \" , \" IGNORE ▁ HIM ! \" ] [ len ( { * input ( ) } ) % 2 ] ) NEW_LINE", "s = input ( ) n = len ( set ( list ( s ) ) )   if ( n % 2 == 0 ) : print ( \" CHAT ▁ WITH ▁ HER ! \" ) else : print ( \" IGNORE ▁ HIM ! \" ) NEW_LINE" ]
codeforces_1064_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class test { public static void main ( String ... args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < t ; i ++ ) { long n = Long . parseLong ( br . readLine ( ) ) ; int j = 0 ; int count = 0 ; while ( j < 64 ) { if ( ( ( n >> j ) & 1 ) == 1 ) { count ++ ; } j ++ ; } System . out . println ( ( long ) Math . pow ( 2 , count ) ) ; } } }", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  " ]
[ "n = int ( input ( \" \" ) ) l = [ ] for k in range ( n ) : b = int ( input ( \" \" ) ) l . append ( b ) final = [ ] for i in l : c = 0 while i > 0 : if i % 2 == 1 : c = c + 1 i = int ( i / 2 ) final . append ( c ) for j in final : print ( 2 ** j ) NEW_LINE", "t = int ( input ( ) )   while t : print ( 2 ** bin ( int ( input ( ) ) ) . count ( '1' ) ) t -= 1 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 = 1000000007   for _ in range ( int ( input ( ) ) ) : a = int ( input ( ) ) print ( 1 << ( bin ( a ) [ 2 : ] . count ( '1' ) ) ) NEW_LINE", "t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) a = 0 for i in range ( 30 ) : if n & 1 << i : a += 1 print ( 2 ** a ) NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : a = int ( input ( ) ) b = format ( a , ' b ' ) NEW_LINE" ]
codeforces_48_A
[ "import java . util . Scanner ;   public class Main {   static String [ ] str = new String [ 3 ] ; static boolean flag ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i ++ ) { str [ i ] = in . next ( ) ; } fun ( str [ 0 ] , str [ 1 ] , str [ 2 ] , \" F \" ) ; fun ( str [ 1 ] , str [ 0 ] , str [ 2 ] , \" M \" ) ; fun ( str [ 2 ] , str [ 1 ] , str [ 0 ] , \" S \" ) ; if ( flag == false ) { System . out . println ( \" ? \" ) ; }   in . close ( ) ; }   private static void fun ( String a , String b , String c , String res ) { if ( a . equals ( \" rock \" ) ) { if ( b . equals ( \" scissors \" ) && c . equals ( \" scissors \" ) ) { System . out . println ( res ) ; flag = true ; } } if ( a . equals ( \" paper \" ) ) { if ( b . equals ( \" rock \" ) && c . equals ( \" rock \" ) ) { System . out . println ( res ) ; flag = true ; } } if ( a . equals ( \" scissors \" ) ) { if ( b . equals ( \" paper \" ) && c . equals ( \" paper \" ) ) { System . out . println ( res ) ; flag = true ; } } } }", "import java . util . Scanner ;    public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] s = new String [ 3 ] ; int [ ] flag = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { s [ i ] = sc . next ( ) ; if ( s [ i ] . equals ( \" rock \" ) ) flag [ i ] = 1 ; if ( s [ i ] . equals ( \" scissors \" ) ) flag [ i ] = 10 ; if ( s [ i ] . equals ( \" paper \" ) ) flag [ i ] = 100 ; } if ( flag [ 0 ] != flag [ 1 ] && flag [ 1 ] != flag [ 2 ] && flag [ 0 ] != flag [ 2 ] ) { System . out . println ( \" ? \" ) ; System . exit ( 0 ) ; } if ( flag [ 0 ] == flag [ 1 ] && flag [ 1 ] == flag [ 2 ] && flag [ 0 ] == flag [ 2 ] ) { System . out . println ( \" ? \" ) ; System . exit ( 0 ) ; } int ans = flag [ 0 ] + flag [ 1 ] + flag [ 2 ] ; if ( ans == 21 ) { int a = find ( 1 , flag ) ; print ( a ) ; } if ( ans == 210 ) { int a = find ( 10 , flag ) ; print ( a ) ; } if ( ans == 102 ) { int a = find ( 100 , flag ) ; print ( a ) ; } if ( ans == 12 || ans == 120 || ans == 201 ) System . out . println ( \" ? \" ) ; }   private static void print ( int a ) {", "   import java . util . * ;   public class Main { public static void main ( String [ ] args ) {   Scanner scanner = new Scanner ( System . in ) ;    String F = scanner . nextLine ( ) , M = scanner . nextLine ( ) , S = scanner . nextLine ( ) ;   if ( beats ( F , M ) && beats ( F , S ) ) System . out . println ( \" F \" ) ; else if ( beats ( M , S ) && beats ( M , F ) ) System . out . println ( \" M \" ) ; else if ( beats ( S , F ) && beats ( S , M ) ) System . out . println ( \" S \" ) ; else System . out . println ( \" ? \" ) ;   scanner . close ( ) ; } static boolean beats ( String s , String s2 ) { if ( s . equals ( \" rock \" ) && s2 . equals ( \" scissors \" ) ) return true ; else if ( s . equals ( \" scissors \" ) && s2 . equals ( \" paper \" ) ) return true ; else if ( s . equals ( \" paper \" ) && s2 . equals ( \" rock \" ) ) return true ; else return false ; } }", "import java . util . Scanner ;   public class main {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int [ ] players = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { String s = scan . next ( ) ; switch ( s ) { case \" rock \" : players [ i ] = 1 ; break ; case \" paper \" : players [ i ] = 2 ; break ; case \" scissors \" : players [ i ] = 3 ; break ; } } int winner = check ( players ) ; if ( winner == 3 ) { System . out . println ( \" ? \" ) ; } else if ( winner == 0 ) { System . out . println ( \" F \" ) ; } else if ( winner == 1 ) { System . out . println ( \" M \" ) ; } else { System . out . println ( \" S \" ) ; }    }   public static int check ( int [ ] players ) { for ( int i = 0 ; i < 3 ; i ++ ) { if ( winAll ( players [ i ] , players ) ) { return i ; } } return 3 ; }   public static boolean winAll ( int a , int [ ] others ) { int count = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( isWin ( a , others [ i ] ) ) { count ++ ; } }   return count == 2 ; }   public static boolean isWin ( int a , int b ) { if ( a == 1 && b == 3 ) { return true ; } else if ( a == 2 && b == 1 ) { return true ; } else if ( a == 3 && b == 2 ) { return true ; } else { return false ; } } }", "import java . util . Scanner ;   public class Main {   static boolean flag ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String a = in . next ( ) ; String b = in . next ( ) ; String c = in . next ( ) ; fun ( a , b , c , \" F \" ) ; fun ( b , a , c , \" M \" ) ; fun ( c , a , b , \" S \" ) ; if ( flag == false ) System . out . println ( \" ? \" ) ; in . close ( ) ; } private static void fun ( String a , String b , String c , String ans ) { if ( a . equals ( \" rock \" ) && b . equals ( \" scissors \" ) && c . equals ( \" scissors \" ) ) { System . out . println ( ans ) ; flag = true ; return ; } if ( a . equals ( \" scissors \" ) && b . equals ( \" paper \" ) && c . equals ( \" paper \" ) ) { System . out . println ( ans ) ; flag = true ; return ; } if ( a . equals ( \" paper \" ) && b . equals ( \" rock \" ) && c . equals ( \" rock \" ) ) { System . out . println ( ans ) ; flag = true ; return ; } } }" ]
[ "f = input ( ) m = input ( ) s = input ( ) r1 = 0 r2 = 0 r3 = 0 r4 = 0 r5 = 0 r6 = 0 r7 = 0 r8 = 0 r9 = 0 r10 = 0 r11 = 0 r12 = 0 r13 = 0 r14 = 0 r15 = 0 r16 = 0 r17 = 0 r18 = 0 r19 = 0 r20 = 0 r21 = 0 r22 = 0 r23 = 0 r24 = 0 r25 = 0 r26 = 0 r27 = 0 def p ( fi , mi , si ) : person = { ' first ' : fi , ' second ' : mi , ' third ' : si } return ( person ) y = p ( f , m , s ) for k , j in y . items ( ) : if k == ' first ' : if j == ' rock ' : r1 = r1 + 1 if k == ' second ' : if j == ' rock ' : r1 = r1 + 1 if k == ' third ' : if j == ' rock ' : r1 = r1 + 1 if r1 == 3 : print ( ' ? ' )     for k , j in y . items ( ) : if k == ' first ' : if j == ' paper ' : r15 = r15 + 1 if k == ' second ' : if j == ' paper ' : r15 = r15 + 1 if k == ' third ' : if j == ' rock ' : r15 = r15 + 1 if r15 == 3 : print ( ' ? ' )   for k , j in y . items ( ) : if k == ' first ' : if j == ' paper ' : r3 = r3 + 1 if k == ' second ' : if j == ' rock ' : r3 = r3 + 1 if k == ' third ' : if j == ' rock ' : r3 = r3 + 1 if r3 == 3 : print ( ' F ' ) NEW_LINE", "f = \" \" m = \" \" s = \" \"   paper = \" paper \" rock = \" rock \" scissors = \" scissors \"   def compare ( f , s , m ) : if f == s and s == m : return \" ? \" NEW_LINE", "f = input ( ) . lower ( ) m = input ( ) . lower ( ) s = input ( ) . lower ( ) if ( f == \" rock \" and m == \" scissors \" and s == \" scissors \" ) or ( f == \" paper \" and m == \" rock \" and s == \" rock \" ) or ( f == \" scissors \" and m == \" paper \" and s == \" paper \" ) : print ( \" F \" ) elif ( m == \" rock \" and f == \" scissors \" and s == \" scissors \" ) or ( m == \" paper \" and f == \" rock \" and s == \" rock \" ) or ( m == \" scissors \" and f == \" paper \" and s == \" paper \" ) : print ( \" M \" ) elif ( s == \" rock \" and m == \" scissors \" and f == \" scissors \" ) or ( s == \" paper \" and m == \" rock \" and f == \" rock \" ) or ( s == \" scissors \" and m == \" paper \" and f == \" paper \" ) : print ( \" S \" ) else : print ( \" ? \" ) NEW_LINE", "manos = [ input ( ) , input ( ) , input ( ) ]   indice_ganador = Nonejugadores = [ ' F ' , ' M ' , ' S ' ] NEW_LINE", "if __name__ == \" _ _ main _ _ \" : t = 3 info = [ ] R = 0 P = 0 S = 0 while t : x = input ( ) if x == ' rock ' : R = R + 1 elif x == \" scissors \" : S = S + 1 else : P = P + 1 info . append ( x ) t -= 1 d = { info [ 0 ] : ' F ' , info [ 1 ] : ' M ' , info [ 2 ] : ' S ' } if ( R == 1 and S == 1 and P == 1 ) or ( R == 3 or S == 3 or P == 3 ) : print ( ' ? ' ) else : if R == 1 and S == 2 : print ( d [ ' rock ' ] ) elif S == 1 and P == 2 : print ( d [ ' scissors ' ] ) elif P == 1 and R == 2 : print ( d [ ' paper ' ] ) else : print ( \" ? \" )   NEW_LINE" ]
codeforces_47_B
[ "import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ;   public class B47 {   static int mod = ( int ) ( 1e9 + 7 ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader in = new FastReader ( ) ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String args [ ] ) {   int tc = 1 ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class newprac { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tt = 1 ;" ]
[ "a = input ( ) b = input ( ) c = input ( ) cntA = 0 cntB = 0 cntC = 0 lst = [ ] lst . append ( a ) lst . append ( b ) lst . append ( c ) for i in lst : if i == ' A > B ' or i == ' A > C ' or i == ' C < A ' or i == ' B < A ' : cntA += 1 elif i == ' B > A ' or i == ' B > C ' or i == ' C < B ' or i == ' A < B ' : cntB += 1 elif i == ' C > A ' or i == ' C > B ' or i == ' B < C ' or i == ' A < C ' : cntC += 1 if cntA > cntB and cntA > cntC : if cntB > cntC : print ( ' CBA ' ) else : print ( ' BCA ' ) elif cntB > cntA and cntB > cntC : if cntA > cntC : print ( ' CAB ' ) else : print ( ' ACB ' ) elif cntC > cntA and cntC > cntB : if cntA > cntB : print ( ' BAC ' ) else : print ( ' ABC ' ) else : print ( ' Impossible ' ) NEW_LINE", "s = input ( ) , input ( ) , input ( ) t = 0 , 1 , 2 d = { } r = ' Impossible ' for A in t : for B in t : for C in t : if all ( eval ( x ) for x in s ) : d [ A ] = ' A ' d [ B ] = ' B ' d [ C ] = ' C ' r = d [ 0 ] + d [ 1 ] + d [ 2 ] print ( r )   NEW_LINE", "d = { ' A ' : ' ' , ' B ' : ' ' , ' C ' : ' ' } l = [ ] l += [ input ( ) ] l += [ input ( ) ] l += [ input ( ) ]   NEW_LINE", "def main ( ) : d = { } for s in range ( 3 ) : s = input ( ) if ( s [ 1 ] == ' > ' ) : if ( f ' { s [ 0 ] } g ' not in d ) : d [ f ' { s [ 0 ] } g ' ] = 1 else : d [ f ' { s [ 0 ] } g ' ] += 1   if ( f ' { s [ 2 ] } s ' not in d ) : d [ f ' { s [ 2 ] } s ' ] = 1 else : d [ f ' { s [ 2 ] } s ' ] += 1   if ( s [ 1 ] == ' < ' ) : if ( f ' { s [ 0 ] } s ' not in d ) : d [ f ' { s [ 0 ] } s ' ] = 1 else : d [ f ' { s [ 0 ] } s ' ] += 1   if ( f ' { s [ 2 ] } g ' not in d ) : d [ f ' { s [ 2 ] } g ' ] = 1 else : d [ f ' { s [ 2 ] } g ' ] += 1   if ( len ( d ) != 4 ) : print ( ' Impossible ' ) return arr = [ ' ' ] * 3 for k , v in d . items ( ) :   if ( v == 2 ) : if k [ 1 ] == ' s ' : arr [ 0 ] = k [ 0 ] else : arr [ 2 ] = k [ 0 ] if ( v == 1 ) : if arr [ 1 ] == ' ' : arr [ 1 ] = k [ 0 ] else : if arr [ 1 ] != k [ 0 ] : print ( ' Impossible ' ) return print ( ' ' . join ( arr ) )   if __name__ == \" _ _ main _ _ \" : main ( ) NEW_LINE", "dict = { \" A \" : 0 , \" B \" : 0 , \" C \" : 0 } for i in range ( 3 ) : s = input ( ) if ( s [ 1 ] == \" > \" ) : dict [ s [ 0 ] ] += 1 else : dict [ s [ 2 ] ] += 1 if dict [ \" A \" ] == dict [ \" B \" ] or dict [ \" B \" ] == dict [ \" C \" ] or dict [ \" C \" ] == dict [ \" A \" ] : print ( ' Impossible ' ) else : if dict [ \" A \" ] == 0 : print ( \" A \" , end = \" \" ) elif dict [ \" B \" ] == 0 : print ( \" B \" , end = \" \" ) elif dict [ \" C \" ] == 0 : print ( \" C \" , end = \" \" ) if dict [ \" A \" ] == 1 : print ( \" A \" , end = \" \" ) elif dict [ \" B \" ] == 1 : print ( \" B \" , end = \" \" ) elif dict [ \" C \" ] == 1 : print ( \" C \" , end = \" \" ) if dict [ \" A \" ] == 2 : print ( \" A \" , end = \" \" ) elif dict [ \" B \" ] == 2 : print ( \" B \" , end = \" \" ) elif dict [ \" C \" ] == 2 : print ( \" C \" , end = \" ▁ \" ) NEW_LINE" ]
codeforces_1487_B
[ "import java . util . * ; public class CodeForces1487B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = input . nextInt ( ) ; int k = input . nextInt ( ) - 1 ; if ( n % 2 == 0 ) { System . out . println ( ( k % n ) + 1 ) ; } else { int m = k / ( n / 2 ) ; System . out . println ( ( k + m ) % n + 1 ) ; } } } }", "import java . util . * ; public class CodeForces1487B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = input . nextInt ( ) ; int k = input . nextInt ( ) - 1 ; if ( n % 2 == 0 ) { System . out . println ( ( k % n ) + 1 ) ; } else { int m = k / ( n / 2 ) ; System . out . println ( ( k + m ) % n + 1 ) ; } } } }", "import java . util . * ; import java . lang . * ; import java . io . * ; import java . math . BigInteger ; public class Test { public static void main ( String [ ] args ) { int T ; Scanner in = new Scanner ( System . in ) ; T = in . nextInt ( ) ; while ( T -- > 0 ) { int n = in . nextInt ( ) , k = in . nextInt ( ) ; k -- ; int ans ; if ( n % 2 == 0 ) ans = ( k % n ) + 1 ; else ans = ( k + ( k / ( n / 2 ) ) ) % n + 1 ; System . out . println ( ans ) ; } } }", "import java . util . * ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; k -- ; if ( n % 2 == 0 ) { long ans = k % n ; System . out . println ( ans + 1 ) ; } else { long mid = n / 2 ; long ans = ( ( k / mid ) + k ) % n ; System . out . println ( ans + 1 ) ; } } } }", "import java . util . * ; import java . math . * ; public class CatCycle { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) - 1 ; int f = n / 2 ; int out = ( k + ( n % 2 ) * k / f ) % n + 1 ; System . out . println ( out ) ; } } }" ]
[ "for s in [ * open ( 0 ) ] [ 1 : ] : n , k = map ( int , s . split ( ) ) ; k -= 1 ; print ( ( k + n % 2 * k // ( n // 2 ) ) % n + 1 ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n , k = [ int ( e ) for e in input ( ) . split ( ) ] NEW_LINE k -= 1 NEW_LINE print ( ( k + n % 2 * k // ( n // 2 ) ) % n + 1 ) NEW_LINE DEDENT", "for __ in range ( int ( input ( ) ) ) : n , k = [ int ( e ) for e in input ( ) . split ( ) ] ; k -= 1 ; print ( ( k + n % 2 * k // ( n // 2 ) ) % n + 1 ) NEW_LINE", "for __ in range ( int ( input ( ) ) ) : n , k = [ int ( e ) for e in input ( ) . split ( ) ] ; k -= 1 ; print ( ( k + n % 2 * k // ( n // 2 ) ) % n + 1 ) NEW_LINE", "for s in [ * open ( 0 ) ] [ 1 : ] : n , t , = [ * map ( int , s . split ( ) ) ] ; t -= 1 ; print ( ( t + ( n & 1 ) * t // ( n // 2 ) ) % n + 1 ) NEW_LINE" ]
codeforces_626_A
[ "import java . util . * ;   public class CodeForces626A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; String s = input . next ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { int v = 0 ; int h = 0 ; for ( int k = i ; k <= j ; k ++ ) { switch ( s . charAt ( k ) ) { case ' U ' : v ++ ; break ; case ' D ' : v -- ; break ; case ' R ' : h ++ ; break ; case ' L ' : h -- ; break ; } } if ( v == 0 && h == 0 ) { ans ++ ; } } }   System . out . println ( ans ) ; } }", "import com . sun . org . apache . bcel . internal . generic . AALOAD ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ;   public class Main {   static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; }   public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; String s = input . next ( ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { int x = 0 , y = 0 ; for ( int k = j ; k <= i ; k ++ ) {" ]
[ "n = int ( input ( ) ) s = input ( ) ans = 0 for i in range ( n ) : x = s [ i ] for j in range ( i + 1 , n ) : x += s [ j ] if x . count ( ' D ' ) == x . count ( ' U ' ) and x . count ( ' L ' ) == x . count ( ' R ' ) : ans += 1     print ( ans ) NEW_LINE", "n = int ( input ( ) )   moves = list ( input ( ) )   mapping = { ' U ' : 1 , ' D ' : - 1 , ' R ' : 1 , ' L ' : - 1 }   ans = 0   for i in range ( n ) :   hor = 0 vert = 0   for j in range ( i , n ) :     move = moves [ j ]   if move == ' U ' or move == ' D ' :   vert += mapping [ move ]   else :   hor += mapping [ move ]     if hor == 0 and vert == 0 :   ans += 1   print ( ans ) NEW_LINE", "dic = { ' vert ' : 0 , ' horz ' : 0 } copydic = dic . copy ( ) n = int ( input ( ) ) s = input ( ) count = 0 dics = { ' U ' : 1 , ' D ' : - 1 , ' L ' : - 1 , ' R ' : 1 } for i in range ( n ) : for j in range ( i , n ) : if s [ j ] == ' U ' or s [ j ] == ' D ' : dic [ ' vert ' ] += dics [ s [ j ] ] else : dic [ ' horz ' ] += dics [ s [ j ] ] if dic [ ' vert ' ] == dic [ ' horz ' ] == 0 : count += 1 dic = copydic . copy ( ) print ( count ) NEW_LINE", "n = int ( input ( ) ) s = input ( ) ans = 0 for i in range ( n ) : k = s [ i : ] d = [ 0 , 0 ] for j in range ( len ( k ) ) : if k [ j ] == \" U \" : d [ 1 ] += 1 elif k [ j ] == \" D \" : d [ 1 ] -= 1 elif k [ j ] == \" L \" : d [ 0 ] -= 1 else : d [ 0 ] += 1 if d == [ 0 , 0 ] : ans += 1 print ( ans ) NEW_LINE", "n = int ( input ( ) ) s = str ( input ( ) ) count = 0 for j in range ( n ) : x , y = 0 , 0 for k in range ( j , n ) : if s [ k ] == ' D ' : y -= 1 elif s [ k ] == ' U ' : y += 1 elif s [ k ] == ' R ' : x += 1 else : x -= 1 if x == 0 and y == 0 : count += 1 print ( count ) NEW_LINE" ]
codeforces_645_B
[ "import java . util . * ; import java . math . * ; import java . io . * ; import java . lang . * ; public class reorder { 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 ; } int [ ] nextIntArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( next ( ) ) ; } return a ; } } private static long startTime = System . currentTimeMillis ( ) ; public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; long n = sc . nextInt ( ) ; long k = sc . nextInt ( ) ; long temp = Math . max ( n - 2 * k , 0 ) ; System . out . println ( ( n * ( n - 1 ) / 2 ) - ( temp * ( temp - 1 ) / 2 ) ) ;    } }", "import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ;    public class CodeForce { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class B { public static void main ( String [ ] args ) throws IOException { MyScanner sc = new MyScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; long ans = 0 , cur = 2 * n - 3 ; for ( int i = 0 ; i < k && cur > 0 ; i ++ ) { ans += cur ; cur -= 4 ; } out . println ( ans ) ; out . flush ( ) ; } static class MyScanner { private BufferedReader br ; private StringTokenizer tokenizer ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  " ]
[ "n , s = map ( int , input ( ) . rstrip ( ) . split ( \" ▁ \" ) ) if s == 0 or n == 1 : print ( 0 ) elif s >= n // 2 : print ( ( n - 1 ) * ( n ) // 2 ) else : t = 0 for i in range ( s ) : t += ( n - 1 - i ) for i in range ( s , n - s ) : t += s for i in range ( s ) : t += i print ( t ) NEW_LINE", "n , s = map ( int , input ( ) . rstrip ( ) . split ( \" ▁ \" ) ) if s == 0 or n == 1 : print ( 0 ) elif s >= n // 2 : print ( ( n - 1 ) * ( n ) // 2 ) else : t = 0 for i in range ( s ) : t += ( n - 1 - i ) for i in range ( s , n - s ) : t += s for i in range ( s ) : t += i print ( t ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) p = n // 2 p = min ( p , k ) s = 0 for j in range ( p * 2 ) : s = s + n - 1 n = n - 1 print ( s ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) if k == 0 or n == 1 : print ( 0 ) elif k >= n // 2 : print ( ( ( n - 1 ) * n ) // 2 ) else : ans = 0 for i in range ( 1 , n + 1 ) : if i <= k : ans += n - i elif i <= n - k : ans += k for j in range ( k - 1 , - 1 , - 1 ) : ans += j print ( ans ) NEW_LINE" ]
codeforces_1093_B
[ "import com . sun . security . jgss . GSSUtil ;   import javax . swing . table . AbstractTableModel ; import java . io . * ; import java . util . * ; import java . util . concurrent . atomic . AtomicReferenceFieldUpdater ;  ", "import java . util . Scanner ; import java . util . * ; public class sol { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t > 0 ) { String s = sc . next ( ) ; int ar [ ] = new int [ 26 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { ar [ s . charAt ( i ) - ' a ' ] ++ ; }  ", "import java . util . * ; import java . io . * ; public class MainClass { public static void main ( String [ ] args ) throws IOException {" ]
[ "for _ in range ( int ( input ( ) ) ) : s = input ( ) if s == s [ : : - 1 ] : if s . count ( s [ 0 ] ) == len ( s ) : print ( - 1 ) else : s = list ( s ) x = s . pop ( ) print ( x + ' ' . join ( s ) ) else : print ( s ) NEW_LINE", "r = lambda : list ( map ( int , input ( ) . split ( ) ) ) t = int ( input ( ) ) for _ in range ( t ) : s = list ( input ( ) ) if ( len ( set ( s ) ) == 1 ) : print ( - 1 ) else : print ( ' ' . join ( sorted ( s ) ) ) NEW_LINE", "n = int ( input ( ) ) for i in range ( n ) : s = input ( ) if s != s [ : : - 1 ] : print ( s ) else : t = s [ 1 : ] + s [ 0 ] if s == t : print ( \" - 1\" ) else : print ( t ) NEW_LINE", "cases = int ( input ( ) ) while cases : cases -= 1 s = sorted ( input ( ) )   if s == s [ : : - 1 ] : print ( - 1 ) else : print ( \" \" . join ( s ) )       NEW_LINE" ]
codeforces_1213_B
[ "import java . util . * ;   public class StackBracket { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { ar [ j ] = sc . nextInt ( ) ; } int [ ] minar = new int [ n ] ;", "import java . util . * ;   public class StackBracket { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { ar [ j ] = sc . nextInt ( ) ; } int [ ] minar = new int [ n ] ;", "import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- != 0 ) { int n = s . nextInt ( ) ; long arr [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = s . nextLong ( ) ; } long suffix [ ] = new long [ n ] ; suffix [ n - 1 ] = arr [ n - 1 ] ; int count = 0 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { suffix [ i ] = Math . min ( suffix [ i + 1 ] , arr [ i ] ) ; if ( arr [ i ] > suffix [ i ] ) { count ++ ; } } System . out . println ( count ) ; } } }", "import java . io . * ; import java . util . * ; public class B { static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String args [ ] ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int tc = sc . nextInt ( ) ; while ( tc -- > 0 ) { int n = sc . nextInt ( ) ; PriorityQueue < Integer > pq = new PriorityQueue < > ( ) ; int c = 0 ; int arr [ ] = sc . nextIntArr ( n ) ; for ( int i = n - 1 ; i > - 1 ; i -- ) { int a = arr [ i ] ; if ( i < n - 1 ) { if ( pq . peek ( ) < a ) c ++ ; } pq . add ( a ) ; } out . println ( c ) ; } out . close ( ) ; } static class Scanner { StringTokenizer st ; BufferedReader br ; public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public Scanner ( String file ) throws FileNotFoundException { br = new BufferedReader ( new FileReader ( file ) ) ; } public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public 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 ( ) ; } public int [ ] nextIntArr ( int n ) throws IOException { int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = nextInt ( ) ; return arr ; } } }", "import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; int min = arr [ n - 1 ] ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( arr [ i ] > min ) { c ++ ; } min = Math . min ( arr [ i ] , min ) ; } System . out . println ( c ) ; } } }" ]
[ "from sys import * input = stdin . readlinet = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) m = [ - 1 ] * n least = l [ - 1 ] for i in range ( n - 2 , - 1 , - 1 ) : if ( least >= l [ i ] ) : least = l [ i ] else : m [ i ] = least bad = n - m . count ( - 1 ) NEW_LINE", "t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 mm = a [ n - 1 ] for i in range ( n - 1 , - 1 , - 1 ) : if ( a [ i ] < mm ) : mm = a [ i ] if ( a [ i ] > mm ) : ans += 1 print ( ans ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) if n == 1 : print ( 0 ) else : res = [ li [ 0 ] ] ans = 0 for i in range ( 1 , n ) : if res != [ ] : if li [ i ] >= res [ - 1 ] : res . append ( li [ i ] ) else : while ( 1 ) : if res != [ ] : if res [ - 1 ] > li [ i ] : res . pop ( ) ans += 1 else : res . append ( li [ i ] ) break else : res . append ( li [ i ] ) break else : res . append ( li [ i ] ) print ( ans ) NEW_LINE", "t = int ( input ( ) )   for p in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) mini = 10000000 c = 0 for i in range ( n - 1 , - 1 , - 1 ) : if a [ i ] <= mini : mini = a [ i ] else : c += 1 print ( c ) 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 ( )   for _ in range ( inp ( ) ) : n = inp ( ) a = inpl ( ) res = 0 mi = INF for i in range ( n ) [ : : - 1 ] : mi = min ( mi , a [ i ] ) if i == 0 : break if a [ i - 1 ] > mi : res += 1 print ( res ) NEW_LINE" ]
codeforces_1207_B
[ "import java . util . * ; import java . io . * ; import java . math . * ;  " ]
[ "q , w = map ( int , input ( ) . split ( ) ) e = [ 0 ] * qr = [ 0 ] * qans = [ ] for i in range ( q ) : e [ i ] = list ( map ( int , input ( ) . split ( ) ) ) r [ i ] = [ 0 ] * wfor i in range ( q - 1 ) : for j in range ( w - 1 ) : if e [ i ] [ j ] and e [ i + 1 ] [ j ] and e [ i ] [ j + 1 ] and e [ i + 1 ] [ j + 1 ] : ans . append ( ( i + 1 , j + 1 ) ) r [ i ] [ j ] = 1 r [ i + 1 ] [ j ] = 1 r [ i ] [ j + 1 ] = 1 r [ i + 1 ] [ j + 1 ] = 1 if e == r : print ( len ( ans ) ) for i in ans : print ( * i ) else : print ( - 1 ) NEW_LINE", "def fill_square ( r , c , l ) : m = [ [ 0 ] * c for _ in range ( r ) ] k = [ ] for i in range ( r - 1 ) : for j in range ( c - 1 ) : if l [ i ] [ j ] and l [ i + 1 ] [ j ] and l [ i ] [ j + 1 ] and l [ i + 1 ] [ j + 1 ] : m [ i ] [ j ] = m [ i + 1 ] [ j ] = m [ i ] [ j + 1 ] = m [ i + 1 ] [ j + 1 ] = 1 k . append ( [ i + 1 , j + 1 ] ) if l == m : print ( len ( k ) ) for i in k : print ( * i ) else : print ( - 1 )       r , c = map ( int , input ( ) . split ( ) ) l = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( r ) ] fill_square ( r , c , l ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) lst , ans , f = [ ] , [ ] , 0 for i in range ( n ) : lst . append ( list ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( n ) : for j in range ( m ) : if lst [ i ] [ j ] == 1 : if not ( ( i - 1 >= 0 and j - 1 >= 0 and lst [ i - 1 ] [ j - 1 ] == lst [ i - 1 ] [ j ] == lst [ i ] [ j - 1 ] == 1 ) or ( i + 1 <= n - 1 and j + 1 <= m - 1 and lst [ i + 1 ] [ j + 1 ] == lst [ i + 1 ] [ j ] == lst [ i ] [ j + 1 ] == 1 ) or ( i + 1 <= n - 1 and j - 1 >= 0 and lst [ i ] [ j - 1 ] == lst [ i + 1 ] [ j - 1 ] == lst [ i + 1 ] [ j ] == 1 ) or ( i - 1 >= 0 and j + 1 <= m - 1 and lst [ i - 1 ] [ j + 1 ] == lst [ i ] [ j + 1 ] == lst [ i - 1 ] [ j ] == 1 ) ) : f = 1 ; break if i + 1 <= n - 1 and j + 1 <= m - 1 and lst [ i + 1 ] [ j + 1 ] == lst [ i + 1 ] [ j ] == lst [ i ] [ j + 1 ] == 1 : ans . append ( [ i + 1 , j + 1 ] ) if f == 1 : breakif f == 1 : print ( - 1 ) else : print ( len ( ans ) ) for i in ans : print ( * i ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) A = [ ] B = [ ] x = 0 y = 0 ans = [ ] for i in range ( n ) : A . append ( input ( ) . split ( ) ) B . append ( [ '0' ] * len ( A [ i ] ) ) while x < n - 1 : y = 0 while y < m - 1 : if y + 1 <= m - 1 and x + 1 <= n - 1 : if A [ x ] [ y ] == '1' and A [ x + 1 ] [ y ] == '1' and A [ x ] [ y + 1 ] == '1' and A [ x + 1 ] [ y + 1 ] == '1' : ans . append ( [ x + 1 , y + 1 ] ) B [ x ] [ y ] = '1' B [ x + 1 ] [ y ] = '1' B [ x ] [ y + 1 ] = '1' B [ x + 1 ] [ y + 1 ] = '1' y += 1 x += 1 error = 0 for i in range ( n ) : A [ i ] = ' ' . join ( A [ i ] ) B [ i ] = ' ' . join ( B [ i ] ) if A [ i ] . count ( '1' ) != B [ i ] . count ( '1' ) : error = 1 breakif error == 0 : print ( len ( ans ) ) for i in range ( len ( ans ) ) : print ( * ans [ i ] ) else : print ( - 1 ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) lst , ans , f = [ ] , [ ] , 0 for i in range ( n ) : lst . append ( list ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( n ) : for j in range ( m ) : if lst [ i ] [ j ] == 1 : if not ( ( i - 1 >= 0 and j - 1 >= 0 and lst [ i - 1 ] [ j - 1 ] == lst [ i - 1 ] [ j ] == lst [ i ] [ j - 1 ] == 1 ) or ( i + 1 <= n - 1 and j + 1 <= m - 1 and lst [ i + 1 ] [ j + 1 ] == lst [ i + 1 ] [ j ] == lst [ i ] [ j + 1 ] == 1 ) or ( i + 1 <= n - 1 and j - 1 >= 0 and lst [ i ] [ j - 1 ] == lst [ i + 1 ] [ j - 1 ] == lst [ i + 1 ] [ j ] == 1 ) or ( i - 1 >= 0 and j + 1 <= m - 1 and lst [ i - 1 ] [ j + 1 ] == lst [ i ] [ j + 1 ] == lst [ i - 1 ] [ j ] == 1 ) ) : f = 1 ; break if i + 1 <= n - 1 and j + 1 <= m - 1 and lst [ i + 1 ] [ j + 1 ] == lst [ i + 1 ] [ j ] == lst [ i ] [ j + 1 ] == 1 : ans . append ( [ i + 1 , j + 1 ] ) if f == 1 : breakif f == 1 : print ( - 1 ) else : print ( len ( ans ) ) for i in ans : print ( * i ) NEW_LINE" ]
codeforces_1075_A
[ "import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; if ( a + b <= n + 1 ) { System . out . println ( \" White \" ) ; } else { System . out . println ( \" Black \" ) ; } } }", "import java . io . * ; import java . util . * ; import javax . print . attribute . standard . Finishings ;   import java . math . * ;   public class Exam { static final Random random = new Random ( ) ; static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Reader sc = new Reader ( ) ;   public static void main ( String args [ ] ) throws IOException {", "import java . util . * ; import java . io . * ; import java . lang . * ; public class MainClass { private static BufferedReader br = null ; private static StringTokenizer st = null ; static { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } private static String str ( ) throws IOException { return br . readLine ( ) ; } private static int ints ( ) throws IOException { return Integer . parseInt ( br . readLine ( ) ) ; } private static int [ ] ints ( int N ) throws IOException { st = new StringTokenizer ( br . readLine ( ) ) ; int [ ] nums = new int [ N ] ; for ( int i = 0 ; i < N ; i += 1 ) { nums [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } return nums ; } public static void main ( String [ ] args ) throws IOException { long N = Long . parseLong ( br . readLine ( ) ) ; String [ ] arr = br . readLine ( ) . split ( \" ▁ \" ) ; long x = Long . parseLong ( arr [ 0 ] ) , y = Long . parseLong ( arr [ 1 ] ) ; Solution obj = new Solution ( ) ; System . out . println ( obj . whoIsWinner ( x , y , N ) ) ; br . close ( ) ; } } class Solution { public String whoIsWinner ( long x , long y , long N ) { if ( x == 1 && y == 1 ) return \" White \" ; if ( x == N && y == N ) return \" Black \" ; return Math . max ( N - x , N - y ) < Math . max ( x - 1 , y - 1 ) ? \" Black \" : \" White \" ; } }", "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 _p001075A { static public void main ( final String [ ] args ) throws IOException { p001075A . _main ( args ) ; }", "import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; long wm = 0 ; long bm = 0 ; long min = Math . min ( x , y ) ; long max = Math . max ( x , y ) ; wm = min - 1 ; wm += ( max - min ) ; bm = n - max ; bm += ( max - min ) ; if ( wm == bm ) { System . out . println ( \" White \" ) ; } else if ( wm > bm ) { System . out . println ( \" Black \" ) ; } else { System . out . println ( \" White \" ) ; } } }" ]
[ "def pasos ( w , m ) : w = [ abs ( m [ 0 ] - w [ 0 ] ) , abs ( m [ 1 ] - w [ 1 ] ) ] minimo = min ( w ) w [ 0 ] -= minimo w [ 1 ] -= minimo return sum ( w ) + minimo def chess ( n , x , y ) : m = [ x , y ] wk = [ 1 , 1 ] bk = [ n , n ] if ( x + y == 2 ) : print ( \" White \" ) elif ( x == n and y == n ) : print ( \" Black \" ) else : pasosW = pasos ( wk , m ) pasosB = pasos ( bk , m ) if pasosB < pasosW : print ( \" Black \" ) else : print ( \" White \" ) def prueba ( ) : n = int ( input ( ) ) x , y = [ int ( i ) for i in input ( ) . split ( \" ▁ \" ) ] chess ( n , x , y ) prueba ( ) NEW_LINE", "n = int ( input ( ) ) x , y = list ( map ( int , input ( ) . split ( ) ) ) wm = max ( x - 1 , y - 1 ) bm = max ( n - x , n - y ) print ( \" Black \" if bm < wm else \" White \" ) NEW_LINE", "n = int ( input ( ) ) x , y = map ( int , input ( ) . split ( ) )   distance_w = min ( abs ( x - 1 ) , abs ( y - 1 ) ) distance_b = min ( abs ( n - x ) , abs ( n - y ) )   cur_w_x = cur_w_y = 1 + distance_w cur_b_y = cur_b_x = n - distance_b   if ( cur_w_x == x ) : distance_w = distance_w + abs ( cur_w_y - y ) else : distance_w = distance_w + abs ( cur_w_x - x ) if ( cur_b_x == x ) : distance_b = distance_b + abs ( cur_b_y - y ) else : distance_b = distance_b + abs ( cur_b_x - x ) if ( distance_w <= distance_b ) : print ( \" white \" ) else : print ( \" black \" ) NEW_LINE", "n = int ( input ( ) ) x , y = map ( int , input ( ) . split ( ) ) min = x if x < y else ymax = x if x > y else yif min - 1 <= n - max : print ( \" White \" ) else : print ( \" Black \" ) NEW_LINE", "n = int ( input ( ) ) x , y = map ( int , input ( ) . split ( \" ▁ \" ) ) if x + y > n + 1 : print ( \" Black \" ) else : print ( \" White \" ) NEW_LINE" ]
codeforces_411_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ;   public class CF411B { public static int [ ] processor ( int [ ] [ ] instructions , int n , int m , int k ) { int [ ] lockedCycle = new int [ n ] ; int [ ] cells = new int [ k ] ; reset ( cells ) ;   for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { int cell = instructions [ j ] [ i ] - 1 ; if ( cell == - 1 )", "import java . util . * ; public class Watermelon { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int mem [ ] = new int [ k + 1 ] ; int memf [ ] = new int [ k + 1 ] ; int p [ ] [ ] = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { p [ i ] [ j ] = sc . nextInt ( ) ; } } HashMap < Integer , Integer > hm = new HashMap < > ( ) ; int cnt = 1 ; for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( hm . get ( j + 1 ) == null ) { if ( p [ j ] [ i ] == 0 ) {   } else if ( mem [ p [ j ] [ i ] ] == - 1 ) { hm . put ( j + 1 , i ) ; } else if ( mem [ p [ j ] [ i ] ] == cnt ) { hm . put ( j + 1 , i ) ; hm . put ( memf [ p [ j ] [ i ] ] , i ) ; mem [ p [ j ] [ i ] ] = - 1 ; } else { mem [ p [ j ] [ i ] ] = cnt ; memf [ p [ j ] [ i ] ] = j + 1 ; } } } cnt ++ ; } for ( int i = 1 ; i <= n ; i ++ ) { if ( hm . get ( i ) == null ) { System . out . println ( 0 ) ; } else { System . out . println ( hm . get ( i ) + 1 ) ; } } }   }", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] [ ] memoryAccess = new int [ n ] [ m ] ;   for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < m ; ++ j ) { memoryAccess [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] deadlock = new int [ n ] ; int [ ] blockedCores = new int [ n ] ; for ( int i = 0 ; i < m ; ++ i ) { int [ ] counter = new int [ k + 1 ] ;   for ( int j = 0 ; j < n ; ++ j ) { if ( deadlock [ j ] > 0 ) { memoryAccess [ j ] [ i ] = deadlock [ j ] ; } ++ counter [ memoryAccess [ j ] [ i ] ] ; } for ( int j = 0 ; j < n ; ++ j ) { if ( memoryAccess [ j ] [ i ] > 0 && counter [ memoryAccess [ j ] [ i ] ] > 1 && deadlock [ j ] < 1 ) { blockedCores [ j ] = i + 1 ; deadlock [ j ] = memoryAccess [ j ] [ i ] ; } } } for ( int i = 0 ; i < n ; ++ i ) { System . out . println ( blockedCores [ i ] ) ; } } }" ]
[ "from collections import defaultdictn , m , k = [ int ( i ) for i in input ( ) . split ( ) ] cell = [ 0 for i in range ( k + 1 ) ] core = [ 0 for i in range ( n + 1 ) ]   NEW_LINE", "from collections import Countern , m , k = map ( int , input ( ) . split ( ) ) a = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] v , l = [ 0 ] * n , [ False ] * kfor j in range ( m ) : c = Counter ( a [ i ] [ j ] for i in range ( n ) ) for i in range ( n ) : if not v [ i ] and a [ i ] [ j ] and ( l [ a [ i ] [ j ] - 1 ] or c [ a [ i ] [ j ] ] > 1 ) : v [ i ] = j + 1 l [ a [ i ] [ j ] - 1 ] = True a [ i ] = [ 0 ] * mprint ( * v , sep = ' \\n ' ) NEW_LINE", "from collections import Countern , m , k = map ( int , input ( ) . split ( ) ) a = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] v , l = [ 0 ] * n , [ False ] * kfor j in range ( m ) : c = Counter ( a [ i ] [ j ] for i in range ( n ) ) for i in range ( n ) : if not v [ i ] and a [ i ] [ j ] and ( l [ a [ i ] [ j ] - 1 ] or c [ a [ i ] [ j ] ] > 1 ) : v [ i ] = j + 1 l [ a [ i ] [ j ] - 1 ] = True a [ i ] = [ 0 ] * mprint ( * v , sep = ' \\n ' ) NEW_LINE", "def adds ( memtoproc , mem , proc ) : if mem in memtoproc : memtoproc [ mem ] . append ( proc ) else : memtoproc [ mem ] = [ proc ]   def corr ( arr , n , m ) : brokemems = set ( ) stopprocs = [ 0 ] * n for c in range ( m ) : memtoproc = dict ( ) usemems = set ( ) locmems = set ( ) for d in range ( n ) : if not arr [ d ] [ c ] or stopprocs [ d ] : continue adds ( memtoproc , arr [ d ] [ c ] , d ) if arr [ d ] [ c ] in usemems : locmems . add ( arr [ d ] [ c ] ) usemems . add ( arr [ d ] [ c ] ) if arr [ d ] [ c ] in brokemems : if not stopprocs [ d ] : stopprocs [ d ] = c + 1 for d in locmems : brokemems . add ( d ) procs = memtoproc [ d ] for x in procs : if not stopprocs [ x ] : stopprocs [ x ] = c + 1 return stopprocs   n , m , k = map ( int , input ( ) . split ( ' ▁ ' ) ) arr = [ ] for c in range ( n ) : arr . append ( tuple ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) ) procs = corr ( arr , n , m ) for c in procs : print ( c )   NEW_LINE", "from collections import Counter   n , m , k = map ( int , input ( ) . split ( ) )   a = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ]   v , l = [ 0 ] * n , [ False ] * k   for j in range ( m ) :   c = Counter ( a [ i ] [ j ] for i in range ( n ) )   for i in range ( n ) :   if not v [ i ] and a [ i ] [ j ] and ( l [ a [ i ] [ j ] - 1 ] or c [ a [ i ] [ j ] ] > 1 ) :   v [ i ] = j + 1   l [ a [ i ] [ j ] - 1 ] = True   a [ i ] = [ 0 ] * m   print ( * v , sep = ' \\n ' )           NEW_LINE" ]
codeforces_347_B
[ "import javax . swing . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   import static java . lang . Integer . * ;   public class Example {   public static void main ( String [ ] args ) {    Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int sum = 0 ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; if ( a == i ) sum ++ ; else map . put ( i , a ) ;   } List < Integer > list = new ArrayList < > ( map . keySet ( ) ) ; boolean tt = false ; for ( Integer integer : list ) {    int v1 = map . get ( integer ) ; int v2 = map . get ( v1 ) ; if ( v2 == integer ) { tt = true ; break ; }   }", "import java . util . * ;   public class CF10 { public static void main ( String [ ] args ) {", "import java . util . * ;   public class CF10 { public static void main ( String [ ] args ) {" ]
[ "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) c = 0 i = 0 while i < n : if arr [ i ] == i : c += 1 i += 1j = 0 flag = Falsewhile j < n : temp = arr [ j ] if arr [ temp ] == j and temp != j : flag = True break j += 1   if flag == False : if c + 1 > n : print ( n ) else : print ( c + 1 )   elif flag == True : if c + 2 > n : print ( n ) else : print ( c + 2 ) NEW_LINE", "n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) )   indexes = [ 0 ] * n   i = 0 while i < len ( li ) : indexes [ li [ i ] ] = i i += 1   swapped = Falseallequal = Truei = 0 count = 0 while i < len ( li ) : if li [ i ] == i : count += 1 else : allequal = False if swapped == False : if indexes [ i ] == li [ i ] : count += 2 swapped = True i += 1 if swapped == False and allequal == False : count += 1 print ( count ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) c = 0 for i in range ( n ) : if i == a [ i ] : c += 1 if c == n : print ( n ) else : for i in range ( n ) : if i != a [ i ] and a [ a [ i ] ] == i : print ( c + 2 ) break else : print ( c + 1 ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) d = { } ans = 0 flag = Falsefor i , x in enumerate ( arr ) : d [ i ] = x if i == x : ans += 1 for i in d : if i != d [ i ] and d [ d [ i ] ] == i : ans += 2 flag = True breakif flag : print ( ans ) else : if ans == len ( arr ) : print ( ans ) else : print ( ans + 1 ) NEW_LINE", "n = int ( input ( ) ) c = 0 cc = 0 l = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : if l [ i ] == i : c += 1 elif i == l [ l [ i ] ] : cc = 1 print ( c + cc + int ( c != n ) ) NEW_LINE" ]
codeforces_932_B
[ "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . BufferedReader ; import java . io . InputStreamReader ;   public class First {   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 ( ) ;", "  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 c701b {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;    public class Main { public static int [ ] [ ] ans = new int [ 10 ] [ 1000005 ] ; public static int check ( int x , int y ) { while ( true ) { if ( y < 10 ) { if ( y == x ) return 1 ; else return 0 ; } else { int temp = 1 ; while ( y > 0 ) { int rem = y % 10 ; y /= 10 ; if ( rem > 0 ) temp *= rem ; } y = temp ; } } }   public static void init ( ) { for ( int i = 1 ; i < 10 ; i ++ ) for ( int j = 1 ; j < 1000002 ; j ++ ) ans [ i ] [ j ] = ans [ i ] [ j - 1 ] + check ( i , j ) ; }   public static void main ( String args [ ] ) throws IOException { init ( ) ; BufferedReader BR = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer ST ; PrintWriter out = new PrintWriter ( System . out ) ; int q , l , r , k ; q = Integer . parseInt ( BR . readLine ( ) ) ; while ( q -- > 0 ) { ST = new StringTokenizer ( BR . readLine ( ) ) ; l = Integer . parseInt ( ST . nextToken ( ) ) ; r = Integer . parseInt ( ST . nextToken ( ) ) ; k = Integer . parseInt ( ST . nextToken ( ) ) ; out . println ( ans [ k ] [ r ] - ans [ k ] [ l - 1 ] ) ; } out . close ( ) ; } }", "  import java . util . * ; import java . lang . * ; import java . io . * ;   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 . util . * ; import java . io . * ; import java . math . * ; public class A { static FastReader sc = new FastReader ( ) ; public static void main ( String [ ] args ) {" ]
[ "from sys import stdindef g ( t ) : t = str ( t ) s = 1 for i in range ( len ( t ) ) : if t [ i ] != \"0\" : s *= int ( t [ i ] ) return sdef main ( ) : memo = [ - 1 ] * ( 10 ** 6 + 1 ) for i in range ( 10 ) : memo [ i ] = i for i in range ( 10 , 10 ** 6 + 1 ) : x = i while x > 9 : if memo [ x ] > 0 : x = memo [ x ] x = g ( x ) memo [ i ] = x cnt = [ [ 0 ] * 10 for i in range ( 10 ** 6 + 1 ) ] for i in range ( 1 , 10 ** 6 + 1 ) : cnt [ i ] [ memo [ i ] ] += 1 for j in range ( 10 ) : cnt [ i ] [ j ] += cnt [ i - 1 ] [ j ] Q = int ( input ( ) ) for _ in range ( Q ) : l , r , k = map ( int , stdin . readline ( ) . split ( ) ) print ( cnt [ r ] [ k ] - cnt [ l - 1 ] [ k ] ) main ( ) NEW_LINE", "z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) fast = lambda : stdin . readline ( ) . strip ( ) zzz = lambda : [ int ( i ) for i in fast ( ) . split ( ) ] szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) ) from string import * from re import * from collections import * from queue import * from sys import * from collections import * from math import * from heapq import * from itertools import * from bisect import * from collections import Counter as ccfrom math import factorial as ffrom bisect import bisect as bsfrom bisect import bisect_left as bslfrom itertools import accumulate as acdef lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) def prime ( x ) : p = ceil ( x ** .5 ) + 1 for i in range ( 2 , p ) : if ( x % i == 0 and x != 2 ) or x == 0 : return 0 return 1 def dfs ( u , visit , graph ) : visit [ u ] = 1 for i in graph [ u ] : if not visit [ i ] : dfs ( i , visit , graph )   NEW_LINE", "z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) fast = lambda : stdin . readline ( ) . strip ( ) zzz = lambda : [ int ( i ) for i in fast ( ) . split ( ) ] szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) ) from string import * from re import * from collections import * from queue import * from sys import * from collections import * from math import * from heapq import * from itertools import * from bisect import * from collections import Counter as ccfrom math import factorial as ffrom bisect import bisect as bsfrom bisect import bisect_left as bslfrom itertools import accumulate as acdef lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) def prime ( x ) : p = ceil ( x ** .5 ) + 1 for i in range ( 2 , p ) : if ( x % i == 0 and x != 2 ) or x == 0 : return 0 return 1 def dfs ( u , visit , graph ) : visit [ u ] = 1 for i in graph [ u ] : if not visit [ i ] : dfs ( i , visit , graph )   NEW_LINE", "fast = lambda : stdin . readline ( ) . strip ( ) zzz = lambda : [ int ( i ) for i in fast ( ) . split ( ) ] z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) ) from re import * from sys import * from math import * from heapq import * from queue import * from bisect import * from string import * from itertools import * from collections import * from math import factorial as ffrom bisect import bisect as bsfrom bisect import bisect_left as bslfrom collections import Counter as ccfrom itertools import accumulate as acdef lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) def prime ( x ) : p = ceil ( x ** .5 ) + 1 for i in range ( 2 , p ) : if ( x % i == 0 and x != 2 ) or x == 0 : return 0 return 1 def dfs ( u , visit , graph ) : visit [ u ] = 1 for i in graph [ u ] : if not visit [ i ] : dfs ( i , visit , graph ) def output ( answer ) : stdout . write ( str ( answer ) ) NEW_LINE", "from sys import stdin , stdoutans = ' ' ; z1 = [ [ ] ] def gh ( x ) : if x < 10 : return x p = 1 while x : if x % 10 : p *= ( x % 10 ) x //= 10 return gh ( p ) for i in range ( 9 ) : z1 += [ [ 0 ] * ( 1000001 ) ] for i in range ( 1 , 1000001 ) : z1 [ gh ( i ) ] [ i ] += 1 for i in range ( 1 , 10 ) : for j in range ( 1 , 1000001 ) : z1 [ i ] [ j ] += z1 [ i ] [ j - 1 ] for _ in \" ▁ \" * int ( stdin . readline ( ) ) : a , b , c = map ( int , stdin . readline ( ) . split ( ) ) ; print ( z1 [ c ] [ b ] - z1 [ c ] [ a - 1 ] ) NEW_LINE" ]
codeforces_1041_A
[ "import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , m ; n = sc . nextInt ( ) ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a , new Comparator < Integer > ( ) { @ Override public int compare ( Integer o1 , Integer o2 ) { return o1 - o2 ; } } ) ; int cnt = 0 ; for ( int i = 1 ; i < n ; i ++ ) {", "import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ;   Arrays . sort ( a ) ; int sum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) sum += a [ i + 1 ] - a [ i ] - 1 ; System . out . println ( sum ) ; } }", "import java . util . Arrays ; import java . util . Scanner ;   public class Heist { 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 ( ) ; } Arrays . sort ( arr ) ; int count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = arr [ i ] + 1 ; j < arr [ i + 1 ] ; j ++ ) { count ++ ; } } System . out . println ( count ) ; } }", "import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class temp4 { 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 class Print { private final BufferedWriter bw ; public Print ( ) { bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; } public void print ( String str ) throws IOException { bw . append ( str ) ; } public void println ( String str ) throws IOException { print ( str ) ; bw . append ( \" \\n \" ) ; } public void close ( ) throws IOException { bw . close ( ) ; } } public static void main ( String [ ] args ) throws IOException { FastReader scn = new FastReader ( ) ;", "import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , m ; n = sc . nextInt ( ) ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a , new Comparator < Integer > ( ) { @ Override public int compare ( Integer o1 , Integer o2 ) { return o1 - o2 ; } } ) ; int cnt = 0 ; for ( int i = 1 ; i < n ; i ++ ) {" ]
[ "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) print ( ( max ( l ) - min ( l ) ) - n + 1 ) NEW_LINE", "n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) a = min ( x ) b = max ( x )   print ( b - a + 1 - n ) NEW_LINE", "a = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) print ( max ( b ) - min ( b ) + 1 - a ) NEW_LINE", "n = int ( input ( ) ) arr = [ int ( num ) for num in input ( ) . split ( ) ]   arr = sorted ( arr )   x = arr [ 0 ]   ans = 0   for num in arr : ans += num - x x = num + 1 print ( ans ) NEW_LINE" ]
codeforces_1269_B
[ "import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { PrintWriter out ; FastReader sc ; long mod = ( long ) ( 1e9 + 7 ) ; int maxint = Integer . MAX_VALUE ; int minint = Integer . MIN_VALUE ; long maxlong = Long . MAX_VALUE ; long minlong = Long . MIN_VALUE ; public void sol ( ) { int n = ni ( ) , m = ni ( ) ; int [ ] a = new int [ n ] , b = new int [ n ] ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = ni ( ) ; for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = ni ( ) ; map . put ( b [ i ] , map . getOrDefault ( b [ i ] , 0 ) + 1 ) ; } sort ( a ) ; sort ( b ) ; int ans = maxint ; for ( int i = 0 ; i < n ; i ++ ) { int x = ( ( b [ i ] - a [ 0 ] ) % m + m ) % m ; HashMap < Integer , Integer > has = new HashMap < > ( ) ; for ( int j = 0 ; j < n ; j ++ ) { int q = ( a [ j ] + x ) % m ; has . put ( q , has . getOrDefault ( q , 0 ) + 1 ) ; } boolean f = true ; for ( Map . Entry < Integer , Integer > m1 : map . entrySet ( ) ) { int k = m1 . getKey ( ) , v = m1 . getValue ( ) ; if ( has . get ( k ) == null || has . get ( k ) != v ) { f = ! f ; break ; } } if ( f ) { ans = min ( ans , x ) ; } } pl ( ans ) ; } public static void main ( String [ ] args ) { Main g = new Main ( ) ; g . out = new PrintWriter ( System . out ) ; g . sc = new FastReader ( ) ; int t = 1 ;" ]
[ "  def solve ( a , b , m ) : n = len ( a ) a . sort ( ) b . sort ( ) best = None for d in range ( n ) : x = ( b [ 0 ] - a [ d ] ) % m if ( best is None or best > x ) and all ( ( a [ ( d + i ) % n ] + x ) % m == b [ i ] for i in range ( n ) ) : best = x return best     n , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) print ( solve ( a , b , m ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) b . sort ( ) a . sort ( ) ans = 100000000000000 for i in range ( n ) : if a [ i ] <= b [ 0 ] : x = b [ 0 ] - a [ i ] else : x = ( m - a [ i ] + b [ 0 ] ) if x < ans : f = True for j in range ( n ) : if ( a [ ( i + j + 1 ) % n ] + x ) % m != b [ ( j + 1 ) % n ] : f = False break if f == True : ans = xprint ( ans ) NEW_LINE", "import itertoolsimport bisectimport mathfrom collections import * import osimport sysfrom io import BytesIO , IOBase   ii = lambda : int ( input ( ) ) lmii = lambda : list ( map ( int , input ( ) . split ( ) ) ) li = lambda : list ( input ( ) ) mii = lambda : map ( int , input ( ) . split ( ) ) msi = lambda : map ( str , input ( ) . split ( ) )     def main ( ) : NEW_LINE" ]
codeforces_1172_B
[ "import java . io . * ; import java . util . * ; import java . math . * ;     public class Main { public static final Long mod = Long . valueOf ( 998244353 ) ; public static final int N = 200020 ; public static Long [ ] ch = new Long [ N ] ; public static int [ ] deg = new int [ N ] ; public static void main ( String args [ ] ) { Scanner in ; PrintStream out ;", "import java . io . * ; import java . util . * ; import java . math . * ;     public class Main { public static final Long mod = Long . valueOf ( 998244353 ) ; public static final int N = 200020 ; public static Long [ ] ch = new Long [ N ] ; public static int [ ] deg = new int [ N ] ; public static void main ( String args [ ] ) { Scanner in ; PrintStream out ; try { in = new Scanner ( new FileInputStream ( \" java . in \" ) ) ; out = new PrintStream ( \" java . out \" ) ; } catch ( FileNotFoundException e ) { in = new Scanner ( new BufferedInputStream ( System . in ) ) ; out = System . out ; } ch [ 0 ] = Long . valueOf ( 1 ) ; for ( int i = 1 ; i < N ; i ++ ) { ch [ i ] = ( ch [ i - 1 ] * i ) % mod ; } int n = in . nextInt ( ) ; Long ans = Long . valueOf ( n ) ; for ( int i = 1 , u , v ; i < n ; i ++ ) { u = in . nextInt ( ) ; v = in . nextInt ( ) ; deg [ u ] ++ ; deg [ v ] ++ ; } for ( int i = 1 ; i <= n ; i ++ ) { ans = ans * ch [ deg [ i ] ] % mod ; } out . println ( ans ) ; } }" ]
[ "g = [ 0 ] * 200005 r = int ( input ( ) ) n = r for i in range ( 1 , n ) : u , v = map ( int , input ( ) . split ( ) ) g [ u ] += 1 g [ v ] += 1 r *= g [ u ] * g [ v ] r %= 998244353     print ( r ) NEW_LINE", "n = int ( input ( ) ) r = n ; MAX = 998244353 arr = [ 0 ] * ( n + 1 ) for i in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) arr [ a ] += 1 ; arr [ b ] += 1 r *= arr [ a ] * arr [ b ] r %= MAXprint ( r ) NEW_LINE" ]
codeforces_761_A
[ "import java . util . Scanner ;    public class Dasha_Stairs_761A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ;   if ( a == 0 && b == 0 ) { System . out . println ( \" NO \" ) ; } else { int diff = Math . abs ( a - b ) ; if ( diff == 1 || a == b ) { System . out . println ( \" YES \" ) ; } else System . out . println ( \" NO \" ) ;   } } }", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  ", "import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a == 0 & b == 0 || Math . abs ( a - b ) > 1 ) System . out . println ( \" NO \" ) ; else System . out . println ( \" YES \" ) ; } }" ]
[ "from __future__ import division , print_functionfrom collections import * from math import * from itertools import * import osimport sysfrom io import BytesIO , IOBaseimport math   if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip       def main ( ) : a , b = map ( int , input ( ) . split ( ) ) if a == 0 and b == 0 : print ( \" NO \" ) else : if abs ( a - b ) > 1 : print ( \" NO \" ) else : print ( \" YES \" )         NEW_LINE", "a , b = [ int ( i ) for i in input ( ) . split ( ) ] if ( abs ( a - b ) > 1 or ( a == 0 and b == 0 ) ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "import mathdef solve ( a , b ) : if a == 0 and b == 0 : return ' NO ' if abs ( a - b ) <= 1 : return ' YES ' return ' NO '   def main ( ) : arr = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) if abs ( a - b ) > 1 or ( a == b == 0 ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "from __future__ import division , print_functionfrom collections import * from math import * from itertools import * from time import timeimport osimport stringimport sysfrom io import BytesIO , IOBase   if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip     def main ( ) : a , b = map ( int , input ( ) . split ( ) ) if b == a and b == 0 : print ( ' NO ' ) return if b - 1 == a or b + 1 == a or b == a : print ( ' YES ' ) else : print ( ' NO ' )             NEW_LINE" ]
codeforces_1023_A
[ "import java . util . Scanner ;   public class Main { static int n , m ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; n = scanner . nextInt ( ) ; m = scanner . nextInt ( ) ; String s1 = scanner . next ( ) ; String s2 = scanner . next ( ) ; if ( ! s1 . contains ( \" * \" ) ) { if ( ! s1 . equals ( s2 ) ) System . out . println ( \" NO \" ) ; else System . out . println ( \" YES \" ) ; } else {", "import java . util . Scanner ;   public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String s = sc . next ( ) ; String t = sc . next ( ) ;   int i = 0 ; while ( i < n && i < m && s . charAt ( i ) == t . charAt ( i ) ) { i ++ ; }   if ( n - m > 1 ) { System . out . println ( \" NO \" ) ; } else if ( i == n ) { if ( i == m ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } else if ( s . charAt ( i ) == ' * ' ) { i ++ ; while ( i < n && s . charAt ( i ) == t . charAt ( i + m - n ) ) { i ++ ; } if ( i == n ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } else { System . out . println ( \" NO \" ) ; } } }", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  ", "import java . util . Scanner ; import java . io . BufferedInputStream ; public class Solution { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( new BufferedInputStream ( System . in ) ) ; int lengthOfN = scanner . nextInt ( ) ; int lengthOfM = scanner . nextInt ( ) ; String n = scanner . next ( ) ; String m = scanner . next ( ) ; boolean flag = true ; int index = 0 ; for ( int i = 0 ; i < n . length ( ) ; i ++ ) { if ( n . charAt ( i ) == ' * ' ) { index = i ; flag = false ; break ; } }   if ( flag ) { if ( n . equals ( m ) ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } else { String temp1 = n . substring ( 0 , index ) ; String temp2 = n . substring ( index + 1 ) ; if ( temp1 . length ( ) + temp2 . length ( ) > m . length ( ) ) { System . out . println ( \" NO \" ) ; return ; } String temp3 = m . substring ( 0 , temp1 . length ( ) ) ; String temp4 = m . substring ( m . length ( ) - temp2 . length ( ) ) ; if ( temp3 . equals ( temp1 ) && temp4 . equals ( temp2 ) ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } } }", "import java . io . * ;   import java . util . * ; public class Solution { public static void main ( String [ ] args ) throws Exception { FastReader fr = new FastReader ( ) ; int n = fr . nextInt ( ) ; int m = fr . nextInt ( ) ; String s = fr . next ( ) ; String t = fr . next ( ) ; boolean contains = false ; int idx = - 1 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' * ' ) { contains = true ; idx = i ; } } if ( ! contains ) { if ( n != m || ! s . equals ( t ) ) System . out . println ( \" NO \" ) ; else System . out . println ( \" YES \" ) ; } else { if ( m < ( n - 1 ) ) System . out . println ( \" NO \" ) ; else { if ( m == n - 1 ) { int j = 0 ; boolean pos = true ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' * ' ) continue ; if ( s . charAt ( i ) != t . charAt ( j ) ) { pos = false ; break ; } j ++ ; } if ( pos ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } else { boolean pos = true ; for ( int i = 0 ; i < idx ; i ++ ) { if ( s . charAt ( i ) != t . charAt ( i ) ) { pos = false ; break ; } } if ( pos == false ) System . out . println ( \" NO \" ) ; else { int j = m - 1 ; for ( int i = n - 1 ; i > idx ; i -- ) { if ( s . charAt ( i ) != t . charAt ( j ) ) { pos = false ; break ; } j -- ; } if ( pos == true ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } } } } } public static boolean check ( String s ) {" ]
[ "n , m = map ( int , input ( ) . split ( ) ) s = str ( input ( ) ) t = str ( input ( ) ) if ' * ' in s : a , b = s . split ( ' * ' ) s1 = t . startswith ( a ) s2 = t [ len ( a ) : ] . endswith ( b ) if s1 and s2 : print ( \" YES \" ) else : print ( \" NO \" ) else : if s == t : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) s = input ( ) t = input ( ) if n == 1 : if s == t or s == ' * ' : print ( ' YES ' ) else : print ( ' NO ' ) elif s . count ( ' * ' ) == 0 : if s == t : print ( ' YES ' ) else : print ( ' NO ' ) elif n > m + 1 : print ( ' NO ' ) else : l = s . split ( ' * ' ) x = t [ : len ( l [ 0 ] ) ] y = t [ - len ( l [ 1 ] ) : ] if ( l [ 0 ] == x and l [ 1 ] == y ) or ( s [ : 1 ] == ' * ' and l [ 1 ] == y ) or ( l [ 0 ] == x and s [ - 1 : ] == ' * ' ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE", "a , b = [ * open ( 0 ) ] [ 1 : ] if ' * ' in a : x , y = a . split ( ' * ' ) r = b . startswith ( x ) and b [ len ( x ) : ] . endswith ( y ) else : r = a == bprint ( ' NYOE ▁ S ' [ r : : 2 ] ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) s = input ( ) t = input ( ) if m >= n - 1 and s [ : s . find ( ' * ' ) ] == t [ : s . find ( ' * ' ) ] and s [ s . find ( ' * ' ) + 1 : ] == t [ len ( t ) - len ( s ) + s . find ( ' * ' ) + 1 : ] : print ( ' YES ' ) else : print ( ' NO ' ) 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_142_B
[ "import java . io . * ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . StringTokenizer ; public class realfast implements Runnable { private static final int INF = ( int ) 1e9 ; public void solve ( ) throws IOException { int n = readInt ( ) ; int m = readInt ( ) ; if ( n > m ) { int val = n ; n = m ; m = val ; } if ( n != 2 && n % 2 == 0 ) { out . println ( ( n / 2 ) * ( m ) ) ; } else if ( n != 1 && n % 2 == 1 ) { long val = n / 2 ; long val1 = ( m ) ; val = val * val1 ; val = val + ( m + 1 ) / 2 ; out . println ( val ) ; } else { if ( n == 1 ) out . println ( m ) ; else if ( n == 2 ) { if ( m % 2 == 0 ) { if ( m % 4 == 0 ) out . println ( m ) ; else out . println ( m + 2 ) ; } else out . println ( m + 1 ) ; } }   }", "import java . io . * ; import java . util . * ;   public class MainClass { public static void main ( String [ ] args ) throws IOException { Reader in = new Reader ( ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int ans = 0 ; int min = Math . min ( m , n ) ; int max = Math . max ( m , n ) ; if ( min == 1 ) ans = max ; else if ( min == 2 ) ans = ( max / 4 ) * 4 + Math . min ( max % 4 , 2 ) * 2 ; else ans = ( m * n ) - ( m * n ) / 2 ; System . out . println ( ans ) ; } } 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 ] ;" ]
[ "s = input ( ) . split ( ) n = int ( s [ 0 ] ) m = int ( s [ 1 ] ) if ( n > m ) : a = n n = m m = aif ( n == 1 ) : print ( m ) elif ( n == 2 ) : if ( m % 4 <= 2 ) : print ( m + m % 4 ) else : print ( m + 1 ) else : print ( ( n * m + 1 ) // 2 ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) )   if n > m :   n , m = m , n   if n > 2 and m > 2 :   print ( ( ( n * m ) + 1 ) // 2 )   elif n == 1 :   print ( m )   else :   print ( 2 * ( ( ( m // 4 ) * 2 ) + min ( m % 4 , 2 ) ) )           NEW_LINE", "def voevoda ( n , m ) : if n == 1 : return m if n == 2 : return ( m - m % 4 ) + 2 * min ( m % 4 , 2 ) return ( n * m + 1 ) // 2     N , M = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) print ( voevoda ( N , M ) ) NEW_LINE", "def li ( ) : return list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) n , m = li ( ) if n < m : t = n n = m m = tif m == 1 : print ( n ) elif m == 2 : print ( 2 * ( 2 * ( n // 4 ) + min ( n % 4 , 2 ) ) ) else : print ( ( n * m ) - ( n * m ) // 2 ) NEW_LINE" ]
codeforces_641_B
[ "# include < iostream > # include < string > # include < algorithm > # include < cmath > # include < queue > # define iof ios :: sync_with_stdio ( false ) using namespace std ; const int maxn = 105 ; int X [ maxn ] [ maxn ] ; int n , m , k ; struct op { int a , b , c , d ; } q [ maxn * maxn ] ; void cl ( int x ) { int te = X [ x ] [ m ] ; for ( int i = m ; i >= 2 ; i -- ) X [ x ] [ i ] = X [ x ] [ i - 1 ] ; X [ x ] [ 1 ] = te ; } void cr ( int x ) { int te = X [ n ] [ x ] ; for ( int i = n ; i >= 2 ; i -- ) X [ i ] [ x ] = X [ i - 1 ] [ x ] ; X [ 1 ] [ x ] = te ; } void ad ( int x , int y , int z ) { X [ x ] [ y ] = z ; } int main ( ) { cin >> n >> m >> k ; for ( int i = 1 ; i <= k ; i ++ ) { cin >> q [ i ] . a ; if ( q [ i ] . a == 1 || q [ i ] . a == 2 ) cin >> q [ i ] . b ; if ( q [ i ] . a == 3 ) cin >> q [ i ] . b >> q [ i ] . c >> q [ i ] . d ; } for ( int i = k ; i >= 1 ; i -- ) { switch ( q [ i ] . a ) { case 1 : cl ( q [ i ] . b ) ; break ; case 2 : cr ( q [ i ] . b ) ; break ; case 3 : ad ( q [ i ] . b , q [ i ] . c , q [ i ] . d ) ; } } for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= m ; j ++ ) printf ( \" % d ▁ \" , X [ i ] [ j ] ) ; printf ( \" \\n \" ) ; } return 0 ; }", "f = lambda : map ( int , input ( ) . split ( ) )   n , m , q = f ( )   p = [ [ 0 ] * m for j in range ( n ) ]   for t in [ list ( f ( ) ) for k in range ( q ) ] [ :: - 1 ] :   j = t [ 1 ] - 1   if t [ 0 ] == 1 : p [ j ] . insert ( 0 , p [ j ] . pop ( ) )   elif t [ 0 ] == 2 :   s = p [ - 1 ] [ j ]   for i in range ( n - 1 , 0 , - 1 ) : p [ i ] [ j ] = p [ i - 1 ] [ j ]   p [ 0 ] [ j ] = s   else : p [ j ] [ t [ 2 ] - 1 ] = t [ 3 ]   for d in p : print ( * d )     # Made By Mostafa_Khaled", "import java . util . Scanner ;   public class LittleArtemandMatrix {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) , m = scan . nextInt ( ) , q = scan . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] [ ] c = new int [ q ] [ 4 ] ; for ( int i = 0 ; i < q ; i ++ ) { int cc = scan . nextInt ( ) ; c [ i ] [ 0 ] = cc ; if ( cc < 3 ) c [ i ] [ 1 ] = scan . nextInt ( ) ; else for ( int j = 1 ; j <= 3 ; j ++ ) c [ i ] [ j ] = scan . nextInt ( ) ; } for ( int i = q - 1 ; i >= 0 ; i -- ) { if ( c [ i ] [ 0 ] < 3 ) { if ( c [ i ] [ 0 ] == 1 ) {" ]
[ "f = lambda : map ( int , input ( ) . split ( ) ) n , m , q = f ( ) p = [ [ 0 ] * m for j in range ( n ) ] for t in [ list ( f ( ) ) for k in range ( q ) ] [ : : - 1 ] : j = t [ 1 ] - 1 if t [ 0 ] == 1 : p [ j ] . insert ( 0 , p [ j ] . pop ( ) ) elif t [ 0 ] == 2 : s = p [ - 1 ] [ j ] for i in range ( n - 1 , 0 , - 1 ) : p [ i ] [ j ] = p [ i - 1 ] [ j ] p [ 0 ] [ j ] = s else : p [ j ] [ t [ 2 ] - 1 ] = t [ 3 ] for d in p : print ( * d ) NEW_LINE", "f = lambda : map ( int , input ( ) . split ( ) ) n , m , q = f ( ) p = [ [ 0 ] * m for j in range ( n ) ] for t in [ list ( f ( ) ) for k in range ( q ) ] [ : : - 1 ] : j = t [ 1 ] - 1 if t [ 0 ] == 1 : p [ j ] . insert ( 0 , p [ j ] . pop ( ) ) elif t [ 0 ] == 2 : s = p [ - 1 ] [ j ] for i in range ( n - 1 , 0 , - 1 ) : p [ i ] [ j ] = p [ i - 1 ] [ j ] p [ 0 ] [ j ] = s else : p [ j ] [ t [ 2 ] - 1 ] = t [ 3 ] for d in p : print ( * d ) NEW_LINE", "f = lambda : map ( int , input ( ) . split ( ) )   n , m , q = f ( )   p = [ [ 0 ] * m for j in range ( n ) ]   for t in [ list ( f ( ) ) for k in range ( q ) ] [ : : - 1 ] :   j = t [ 1 ] - 1   if t [ 0 ] == 1 : p [ j ] . insert ( 0 , p [ j ] . pop ( ) )   elif t [ 0 ] == 2 :   s = p [ - 1 ] [ j ]   for i in range ( n - 1 , 0 , - 1 ) : p [ i ] [ j ] = p [ i - 1 ] [ j ]   p [ 0 ] [ j ] = s   else : p [ j ] [ t [ 2 ] - 1 ] = t [ 3 ]   for d in p : print ( * d )         NEW_LINE", "f = lambda : map ( int , input ( ) . split ( ) )   n , m , q = f ( )   p = [ [ 0 ] * m for j in range ( n ) ]   for t in [ list ( f ( ) ) for k in range ( q ) ] [ : : - 1 ] :   j = t [ 1 ] - 1   if t [ 0 ] == 1 : p [ j ] . insert ( 0 , p [ j ] . pop ( ) )   elif t [ 0 ] == 2 :   s = p [ - 1 ] [ j ]   for i in range ( n - 1 , 0 , - 1 ) : p [ i ] [ j ] = p [ i - 1 ] [ j ]   p [ 0 ] [ j ] = s   else : p [ j ] [ t [ 2 ] - 1 ] = t [ 3 ]   for d in p : print ( * d )         NEW_LINE" ]
codeforces_611_B
[ "import java . util . * ; import java . io . * ;   public class New_Year_And_Old_Property {   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   }   public static void main ( String [ ] args ) {", "import java . util . * ; import java . io . * ;    public class Solution { public static void solve ( long a , long b ) { int i = 0 ; long count = 0 ; while ( ( 1l << i ) / 2 <= b ) { int j = 0 ; while ( ( 1l << j ) < ( 1l << i ) / 2 ) { long x = ( ( 1l << i ) - 1 ) - ( 1l << j ) ; if ( x >= a && x <= b ) count ++ ; j ++ ; } i ++ ; } System . out . println ( count ) ; } public static void main ( String args [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] in = br . readLine ( ) . trim ( ) . split ( \" ▁ \" ) ; solve ( Long . parseLong ( in [ 0 ] ) , Long . parseLong ( in [ 1 ] ) ) ; } }", "import java . util . * ; import java . lang . * ; import java . math . * ; import java . io . * ; import java . util . HashSet ; import java . util . Arrays ; import java . util . Scanner ; import java . util . Set ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . text . DecimalFormat ; import java . lang . Math ; import java . util . Iterator ; import java . util . TreeSet ; 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 D1343 { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader sc = new FastReader ( ) ; static int pInf = Integer . MAX_VALUE ; static int nInf = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { int test = 1 ; while ( test -- > 0 ) { long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long p = 0 ; long t = b ; while ( t > 0 ) { p ++ ; t = t >> 1 ; } int count = 0 ; boolean flag = false ; for ( long i = p ; i >= 0 ; i -- ) { for ( long j = 0 ; j < i - 1 ; j ++ ) { long x = ( ( 1L << i ) - 1 ) - ( 1L << j ) ; if ( x >= a && x <= b ) { count ++ ; } } } out . println ( count ) ; } out . close ( ) ; } public static long mul ( long a , long b ) { return ( ( a % MOD ) * ( b % MOD ) ) % MOD ; } public static long add ( long a , long b ) { return ( ( a % MOD ) + ( b % MOD ) ) % MOD ; }", "import java . io . IOException ; import java . util . * ; import java . util . Arrays ; import java . util . Scanner ;   public class Bit_year { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; String s1 = Long . toBinaryString ( n ) ; String s2 = Long . toBinaryString ( m ) ; int diff = s2 . length ( ) - s1 . length ( ) ;   int ans = 0 ; while ( diff >= 0 ) { char [ ] a1 = new char [ s1 . length ( ) + diff ] ; Arrays . fill ( a1 , '1' ) ; for ( int i = a1 . length - 1 ; i > 0 ; i -- ) { a1 [ i ] = '0' ; if ( a1 . length > 16 ) { long k = Long . parseLong ( new String ( a1 ) , 2 ) ;" ]
[ "a , b = map ( int , input ( ) . split ( ) ) print ( len ( [ ( 2 ** i - 1 ) - 2 ** j for i in range ( 65 ) for j in range ( i - 1 ) if a <= 2 ** i - 1 - 2 ** j <= b ] ) ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) cnt = 0 for i in range ( 2 , 65 ) : num = ( 1 << i ) - 1 pow = 1 for j in range ( i - 1 ) : cur = num - pow if cur >= a and cur <= b : cnt += 1 pow <<= 1 print ( cnt ) NEW_LINE", "from math import logfrom math import ceila , b = map ( int , input ( ) . split ( ) ) chislo = 1 mno = 1 ans = 0 flag = 1 while flag : flag = 0 chi = 1 m = 1 if chislo <= b : flag = 1 for _ in range ( 1 , ceil ( log ( chislo , 2 ) ) ) : m *= 2 if chislo - chi <= b or chislo - chi <= a : flag = 1 if chislo - chi >= a and chislo - chi <= b : ans += 1 chi += m - m // 2 mno *= 2 chislo += mnoprint ( ans ) NEW_LINE", "def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counter , defaultdictfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE" ]
codeforces_297_B
[ "import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ; Student ( int x , int y ) { this . x = x ; this . y = y ;", "import java . io . * ; import java . util . * ; import java . math . * ; public class Main {   public void solve ( ) throws IOException {   int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int k = in . nextInt ( ) ;   int [ ] aa = new int [ n ] ; int [ ] bb = new int [ m ] ;   for ( int i = 0 ; i < n ; i ++ ) { aa [ i ] = in . nextInt ( ) ; }   for ( int i = 0 ; i < m ; i ++ ) { bb [ i ] = in . nextInt ( ) ; }  ", "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 FistWeight {   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 ( ) ;" ]
[ "from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE", "n , m , k = map ( int , input ( ) . split ( ) ) a = sorted ( map ( int , input ( ) . split ( ) ) , reverse = True ) b = sorted ( map ( int , input ( ) . split ( ) ) , reverse = True ) cou = ind = 0 l = min ( m , n ) aa = max ( b ) for i in range ( l ) : if a [ i ] > b [ i ] : cou += 1 ind = max ( ind , a [ i ] )   if m >= n and cou > 0 : print ( \" YES \" ) elif m < n : print ( \" YES \" ) else : print ( \" NO \" )       NEW_LINE", "import sysfrom math import gcd , sqrt , ceilfrom collections import defaultdict , Counter , dequefrom bisect import bisect_left , bisect_rightimport mathfrom itertools import permutations   NEW_LINE" ]
codeforces_254_A
[ "import java . io . * ; import java . util . StringTokenizer ;   public class CardsNumber { public static void main ( String [ ] args ) throws IOException { File f = new File ( \" input . txt \" ) ; FileReader fileReader = new FileReader ( f ) ; BufferedReader reader = new BufferedReader ( fileReader ) ;   int n = Integer . parseInt ( reader . readLine ( ) ) ; StringBuilder sb = new StringBuilder ( ) ;   StringTokenizer st = new StringTokenizer ( reader . readLine ( ) ) ;   int [ ] [ ] number = new int [ 5001 ] [ 2 ] ;   for ( int i = 1 ; i <= 2 * n ; i ++ ) { int temp = Integer . parseInt ( st . nextToken ( ) ) ;   if ( number [ temp ] [ 0 ] > 0 ) { sb . append ( number [ temp ] [ 1 ] + \" ▁ \" + i + \" \\n \" ) ; number [ temp ] [ 0 ] = 0 ; } else { number [ temp ] [ 0 ] ++ ; number [ temp ] [ 1 ] = i ; } }   FileWriter writer = new FileWriter ( \" output . txt \" ) ;   for ( int i = 1 ; i < 5001 ; i ++ ) { if ( number [ i ] [ 0 ] > 0 ) { sb = new StringBuilder ( ) ; sb . append ( \" - 1\" ) ; break ; } }   writer . write ( String . valueOf ( sb ) ) ;   writer . close ( ) ; } }", "import java . io . * ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class CardsNumber { public static void main ( String [ ] args ) throws IOException { File f = new File ( \" input . txt \" ) ; FileReader fileReader = new FileReader ( f ) ; BufferedReader reader = new BufferedReader ( fileReader ) ;   int n = Integer . parseInt ( reader . readLine ( ) ) ; String s = \" \" ;   StringTokenizer st = new StringTokenizer ( reader . readLine ( ) ) ;   int [ ] [ ] number = new int [ 5001 ] [ 2 ] ; ArrayList < Integer > pair = new ArrayList < > ( ) ;   for ( int i = 1 ; i <= 2 * n ; i ++ ) { int temp = Integer . parseInt ( st . nextToken ( ) ) ;   if ( number [ temp ] [ 0 ] > 0 ) { pair . add ( number [ temp ] [ 1 ] ) ; pair . add ( i ) ; number [ temp ] [ 0 ] = 0 ; } else { number [ temp ] [ 0 ] ++ ; number [ temp ] [ 1 ] = i ; } }   FileWriter writer = new FileWriter ( \" output . txt \" ) ;   boolean flag = true ; for ( int i = 1 ; i < 5001 ; i ++ ) { if ( number [ i ] [ 0 ] > 0 ) { flag = false ; break ; } }   if ( flag ) { for ( int i = 0 ; i < 2 * n ; i += 2 ) { writer . write ( pair . get ( i ) + \" ▁ \" + pair . get ( i + 1 ) + \" \\n \" ) ; } } else writer . write ( \" - 1\" ) ;   writer . close ( ) ; } }", "import java . io . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . util . * ;   public class A254 { public static void main ( String [ ] args ) throws IOException { FileReader fin = new FileReader ( \" input . txt \" ) ; BufferedReader bin = new BufferedReader ( fin ) ; FileWriter fout = new FileWriter ( \" output . txt \" ) ; BufferedWriter bout = new BufferedWriter ( fout ) ; PrintWriter pout = new PrintWriter ( bout ) ; String num = bin . readLine ( ) ; int n = Integer . valueOf ( num ) ; String txt = bin . readLine ( ) ; String [ ] val = txt . split ( \" \\\\ s + \" ) ;", "import java . io . BufferedReader ; import java . io . File ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . StringTokenizer ;   public class A254 {   public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new FileReader ( \" input . txt \" ) ) ; int N = Integer . parseInt ( reader . readLine ( ) ) ; Map < Integer , List < Integer > > map = new HashMap < Integer , List < Integer > > ( ) ; StringTokenizer tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; for ( int n = 0 ; n < 2 * N ; n ++ ) { int a = Integer . parseInt ( tokenizer . nextToken ( ) ) ; map . computeIfAbsent ( a , key -> new ArrayList < Integer > ( ) ) . add ( n + 1 ) ; } PrintWriter out = new PrintWriter ( new File ( \" output . txt \" ) ) ; StringBuilder output = new StringBuilder ( ) ; for ( List < Integer > list : map . values ( ) ) { if ( list . size ( ) % 2 == 0 ) { int i = 0 ; while ( i < list . size ( ) ) { output . append ( list . get ( i ++ ) ) . append ( ' ▁ ' ) . append ( list . get ( i ++ ) ) . append ( ' \\n ' ) ; } } else { out . println ( \" - 1\" ) ; out . close ( ) ; return ; } } out . print ( output ) ; out . close ( ) ; }   }", "import java . io . BufferedReader ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Scanner ; import java . util . Vector ; public class A { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; in = new BufferedReader ( new InputStreamReader ( new FileInputStream ( \" input . txt \" ) ) ) ; out = new PrintWriter ( new FileOutputStream ( \" output . txt \" ) ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; String [ ] inp = in . readLine ( ) . split ( \" ▁ \" ) ; Vector < Vector < Integer > > mas = new Vector < Vector < Integer > > ( ) ; for ( int i = 0 ; i < 5001 ; i ++ ) { mas . add ( new Vector < Integer > ( ) ) ; } for ( int i = 0 ; i < n * 2 ; i ++ ) { mas . get ( Integer . parseInt ( inp [ i ] ) ) . add ( i + 1 ) ; } boolean check = true ; for ( int i = 1 ; i < 5001 ; i ++ ) { if ( mas . get ( i ) . size ( ) % 2 == 1 ) { check = false ; break ; } } if ( ! check ) { out . println ( - 1 ) ; } else { for ( int i = 1 ; i < 5001 ; i ++ ) { for ( int j = 0 ; j < mas . get ( i ) . size ( ) ; j += 2 ) { out . println ( mas . get ( i ) . get ( j ) + \" ▁ \" + mas . get ( i ) . get ( j + 1 ) ) ; } } } out . close ( ) ; } }" ]
[ "f = open ( \" input . txt \" , \" r \" ) text = f . readlines ( ) f . close ( )   n = int ( text [ 0 ] )   cards = [ int ( c ) for c in text [ 1 ] . split ( ) ]   f = open ( \" output . txt \" , \" w \" )   dicti = { }   for bruh in sorted ( set ( cards ) ) : dicti [ bruh ] = [ ]   for i , j in enumerate ( cards ) : dicti [ j ] . append ( str ( i + 1 ) )   for k in dicti : v = dicti [ k ] if len ( v ) % 2 == 1 : f . write ( str ( - 1 ) ) exit ( ) for k1 in dicti : v1 = dicti [ k1 ] f . write ( ' ▁ ' . join ( v1 ) ) f . write ( ' \\n ' )   f . close ( )     NEW_LINE", "l = list ( map ( int , open ( \" input . txt \" ) . read ( ) . split ( ) [ 1 : ] ) ) s = set ( l ) f = open ( \" output . txt \" , ' w ' ) ans = [ ] dict = { } for i in range ( len ( l ) ) : if l [ i ] not in dict . keys ( ) : dict [ l [ i ] ] = i + 1 else : ans . append ( str ( dict [ l [ i ] ] ) + \" ▁ \" + str ( i + 1 ) ) del dict [ l [ i ] ] if len ( dict ) == 0 : f . write ( ' \\n ' . join ( ans ) ) else : f . write ( \" - 1\" ) NEW_LINE", "inf = open ( \" input . txt \" , ' r ' ) ouf = open ( \" output . txt \" , ' w ' ) n = int ( inf . readline ( ) ) l = list ( map ( int , inf . readline ( ) . split ( ) ) ) d = dict ( )   for j , i in enumerate ( l ) : if i in d : d [ i ] += [ j + 1 ] else : d [ i ] = [ j + 1 ]   ans = [ ]   for i in d : if len ( d [ i ] ) % 2 != 0 : ouf . write ( str ( - 1 ) + \" \\n \" ) break ans += d [ i ] else : for i in range ( 0 , len ( ans ) , 2 ) : ouf . write ( str ( ans [ i ] ) + \" ▁ \" + str ( ans [ i + 1 ] ) + \" \\n \" ) NEW_LINE", "inp , out = open ( ' input . txt ' , ' r ' ) , open ( ' output . txt ' , ' w ' ) n = int ( inp . readline ( ) ) a = inp . readline ( ) . split ( ) b = { } s = [ ] for i in range ( 1 , 2 * n + 1 ) : e = int ( a [ i - 1 ] ) if not e in b : b [ e ] = i else : s . append ( str ( b [ e ] ) + ' ▁ ' + str ( i ) ) del ( b [ e ] ) if len ( b ) == 0 : out . write ( ' \\n ' . join ( s ) ) else : out . write ( ' - 1' ) out . close ( ) NEW_LINE" ]
codeforces_1145_A
[ "import java . util . * ; import java . io . * ;   public class A1145 { private StreamTokenizer in ; private PrintWriter out ;   public static void main ( String [ ] args ) throws IOException { new A1145 ( ) . run ( ) ; }   private void run ( ) throws IOException { in = new StreamTokenizer ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; out = new PrintWriter ( System . out ) ;   execute ( ) ;   out . flush ( ) ; }   private void execute ( ) throws IOException { final int n = nextInt ( ) ; final int [ ] arr = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; }   final int length = solve ( arr , 0 , arr . length ) ; out . print ( length ) ; }   public int solve ( int [ ] arr , int start , int end ) throws IOException { if ( end - start < 2 ) { return 1 ; }   if ( isSorted ( arr , start , end ) ) { return end - start ; }   final int middle = start + ( end - start ) / 2 ;   final int leftLength = solve ( arr , start , middle ) ; final int rightLength = solve ( arr , middle , end ) ;   return Math . max ( leftLength , rightLength ) ; }   private boolean isSorted ( int [ ] arr , int start , int end ) { final int [ ] original = Arrays . copyOfRange ( arr , start , end ) ; final int [ ] subArray = Arrays . copyOf ( original , original . length ) ;   Arrays . sort ( subArray ) ;   return Arrays . equals ( original , subArray ) ; }    private String nextString ( ) throws IOException { in . nextToken ( ) ;   return in . sval ; }   private long nextLong ( ) throws IOException { in . nextToken ( ) ;   return ( long ) in . nval ; }   private int nextInt ( ) throws IOException { in . nextToken ( ) ;   return ( int ) in . nval ; } }", "import java . util . Scanner ;   public class p1145A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; boolean ok = false ; for ( int len = n ; len > 0 ; len /= 2 ) { for ( int c = 0 ; c < n ; c += len ) { boolean sorted = true ; for ( int i = 1 ; i < len ; ++ i ) if ( a [ c + i ] < a [ c + i - 1 ] ) sorted = false ; if ( sorted ) { System . out . println ( len ) ; ok = true ; break ; } } if ( ok ) break ; }   } }", "import java . util . * ; import java . io . * ; public class Main { private static int thanos ( int [ ] input ) { if ( input . length == 1 ) { return 1 ; } if ( sorted ( input ) ) { return input . length ; } int l [ ] = new int [ input . length / 2 ] ; int r [ ] = new int [ input . length / 2 ] ; for ( int i = 0 ; i < input . length / 2 ; i ++ ) { l [ i ] = input [ i ] ; } for ( int i = input . length / 2 ; i < input . length ; i ++ ) { r [ i - input . length / 2 ] = input [ i ] ; } int left = thanos ( l ) ; int right = thanos ( r ) ; return left > right ? left : right ; }    private static boolean sorted ( int [ ] input ) { for ( int i = 0 ; i < input . length - 1 ; i ++ ) { if ( input [ i ] > input [ i + 1 ] ) { return false ; } } return true ; }   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int j = 0 ; j < arr . length ; j ++ ) { arr [ j ] = sc . nextInt ( ) ; } System . out . println ( thanos ( arr ) ) ; } }", "import java . util . * ;   public class file {   private static final Scanner sc = new Scanner ( System . in ) ;   private static void foo ( ) { int n = sc . nextInt ( ) , count1 = 0 , max = 1 , istrue = 0 ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } System . out . println ( maxsort ( arr , 0 , n - 1 ) ) ; }   private static int maxsort ( int [ ] arr , int i , int j ) { int count = 1 ; for ( int k = i ; k <= j ; ) { if ( k + 1 <= j && arr [ k ] <= arr [ k + 1 ] ) { k ++ ; count ++ ; } else { break ; } } if ( count == j - i + 1 ) return count ; else return Math . max ( maxsort ( arr , i + ( j - i + 1 ) / 2 , j ) , maxsort ( arr , i , j - ( j - i + 1 ) / 2 ) ) ; }    public static void main ( String [ ] args ) {", "import java . util . * ;   public class Main { public static int size ;   public static void main ( String [ ] args ) {" ]
[ "from sys import stdin , stdoutfrom math import floor , gcd , fabs , factorial , fmod , sqrt , inf , logfrom collections import defaultdict as dd , dequefrom heapq import merge , heapify , heappop , heappush , nsmallestfrom bisect import bisect_left as bl , bisect_right as br , bisect mod = pow ( 10 , 9 ) + 7 mod2 = 998244353 def inp ( ) : return stdin . readline ( ) . strip ( ) def iinp ( ) : return int ( inp ( ) ) def out ( var , end = \" \\n \" ) : stdout . write ( str ( var ) + \" \\n \" ) def outa ( * var , end = \" \\n \" ) : stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) def lmp ( ) : return list ( mp ( ) ) def mp ( ) : return map ( int , inp ( ) . split ( ) ) def smp ( ) : return map ( str , inp ( ) . split ( ) ) def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] def l2d ( n , m , val = 0 ) : return [ l1d ( m , val ) for j in range ( n ) ] def remadd ( x , y ) : return 1 if x % y else 0 def ceil ( a , b ) : return ( a + b - 1 ) // b def isprime ( x ) : if x <= 1 : return False if x in ( 2 , 3 ) : return True if x % 2 == 0 : return False for i in range ( 3 , int ( sqrt ( x ) ) + 1 , 2 ) : if x % i == 0 : return False return True n = iinp ( ) arr = lmp ( ) tn = nflg = Truewhile flg : for i in range ( 0 , n , tn ) : if arr [ i : i + tn ] == sorted ( arr [ i : i + tn ] ) : flg = False break if flg : tn //= 2 print ( tn ) NEW_LINE", "ans = 0   def is_sorted ( array , l , r ) : for i in range ( l , r ) : if array [ i ] > array [ i + 1 ] : return False return True   def check_array ( array , l , r ) : if is_sorted ( array , l , r ) : global ans ans = max ( ans , r - l + 1 ) return   mid = ( l + r ) // 2 check_array ( array , l , mid ) check_array ( array , mid + 1 , r )   n = int ( input ( ) ) array = list ( map ( ( int ) , input ( ) . strip ( ) . split ( ) ) ) size = len ( array ) check_array ( array , 0 , size - 1 ) print ( ans ) NEW_LINE", "def sol ( a , i , j ) : if ( len ( a ) == 1 ) : return True for i in range ( i + 1 , j + 1 ) : if ( a [ i ] < a [ i - 1 ] ) : return False return Truedef solve ( a , i , j ) : if ( i > j ) : return 0 ; if ( sol ( a , i , j ) ) : return j - i + 1 mid = ( j + i ) // 2 return max ( solve ( a , i , mid ) , solve ( a , mid + 1 , j ) ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( solve ( a , 0 , len ( a ) - 1 ) ) NEW_LINE", "def check_thanossort ( arr , x , y ) : t = 0 for i in range ( x + 1 , y + 1 ) : if ( arr [ i ] >= arr [ i - 1 ] ) : t += 1 if ( t == y - x ) : p = 1 else : p = 0 return pa = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) j = awhile ( j >= 1 ) : k = 0 brk = False while ( k < a ) : if ( check_thanossort ( arr , k , k + j - 1 ) == 1 ) : ans = j ; brk = True ; break k += j if ( brk ) : break j //= 2 print ( ans ) NEW_LINE", "import sysinput = sys . stdin . readline   def is_sorted ( a , n ) : if n == 1 : return 1 flag = 1 for i in range ( 1 , n ) : if a [ i - 1 ] > a [ i ] : flag = 0 return flag   def f ( a , n ) : if is_sorted ( a , n ) : return n return max ( f ( a [ : n // 2 ] , n // 2 ) , f ( a [ n // 2 : ] , n // 2 ) )   t = 1   for _ in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = f ( a , n ) print ( ans ) NEW_LINE" ]
codeforces_1034_B
[ "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class B { static PrintWriter out = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) { FS in = new FS ( ) ; long R = in . nextLong ( ) ; long C = in . nextLong ( ) ; long res = solve ( Math . min ( R , C ) , Math . max ( R , C ) ) ; out . println ( res ) ; out . close ( ) ; } static long solve ( long r , long c ) { if ( r < 3 && c < 3 ) return 0 ; if ( r == 1 ) { long res = c ; long m = c % 6 ; if ( m != 0 ) { if ( m <= 3 ) res -= m ; if ( m == 4 ) res -= 2 ; if ( m == 5 ) res -= 1 ; } return res ; } if ( r == 2 ) { if ( c == 3 || c == 7 ) return r * ( c - 1 ) ; return r * c ; } long res = r * c ; if ( res % 2 == 0 ) return res ; return res - 1 ; }", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; }   FastReader in = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; void run ( ) { work ( ) ; out . flush ( ) ; } long mod = 1000000007 ; long gcd ( long a , long b ) { return b == 0 ? a : gcd ( b , a % b ) ; } void work ( ) { long n = in . nextInt ( ) ; long m = in . nextInt ( ) ; if ( n > m ) { long t = m ; m = n ; n = t ; } long v = 0 ; if ( n == 1 ) { v = m / 6 * 6 ; if ( m % 6 == 4 ) v += 2 ; if ( m % 6 == 5 ) v += 4 ; } else if ( n <= 2 && m <= 2 ) { v = 0 ; } else if ( n == 2 && m == 3 ) { v = 4 ; } else if ( n == 2 && m == 7 ) { v = 12 ; } else if ( n % 2 == 0 ) {", "import java . util . * ; import java . math . * ;   public class Main { public static void main ( String ards [ ] ) { Scanner cin = new Scanner ( System . in ) ; while ( cin . hasNext ( ) ) { long n = cin . nextLong ( ) ; long m = cin . nextLong ( ) ; if ( n > m ) { long x = n ; n = m ; m = x ; } if ( n == 1 ) { if ( m % 6 == 0 ) System . out . println ( m ) ; else if ( m % 6 <= 3 ) System . out . println ( m - ( m % 6 ) ) ; else System . out . println ( m - ( 6 - m % 6 ) ) ; } else if ( n == 2 && m == 2 ) System . out . println ( 0 ) ; else if ( n == 2 && m == 3 ) System . out . println ( 4 ) ; else if ( n == 2 && m == 7 ) System . out . println ( 12 ) ; else { if ( n % 2 == 1 && m % 2 == 1 ) System . out . println ( n * m - 1 ) ; else System . out . println ( n * m ) ; } } } }" ]
[ "def main ( ) : n , m = map ( int , input ( ) . split ( ) ) if m > n : n , m = m , n if n + m <= 4 : print ( 0 ) return if m == 1 : q = n // 6 ; r = n % 6 if r == 4 : print ( n - 2 ) elif r == 5 : print ( n - 1 ) else : print ( q * 6 ) return if ( n , m ) in [ ( 7 , 2 ) , ( 3 , 2 ) ] : print ( n * m - 2 ) return if n % 2 == 0 or m % 2 == 0 : print ( n * m ) return print ( n * m - 1 ) main ( ) NEW_LINE", "import mathimport sysn , m = map ( int , input ( ) . split ( ) ) if n > m : n , m = m , nif n == 1 : print ( 6 * ( m // 6 ) + 2 * max ( 0 , ( m % 6 ) - 3 ) ) elif n == 2 : if m == 2 : print ( 0 ) elif m in ( 1 , 3 , 7 ) : print ( n * m - 2 ) else : print ( n * m ) else : print ( ( n * m // 2 ) * 2 ) NEW_LINE", "import mathimport sysn , m = map ( int , input ( ) . split ( ) ) if n > m : n , m = m , nif n == 1 : print ( 6 * ( m // 6 ) + 2 * max ( 0 , ( m % 6 ) - 3 ) ) elif n == 2 : if m == 2 : print ( 0 ) elif m in ( 1 , 3 , 7 ) : print ( n * m - 2 ) else : print ( n * m ) else : print ( ( n * m // 2 ) * 2 ) NEW_LINE", "known = [ [ 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 2 , 4 ] , [ 0 , 0 , 0 , 4 , 8 , 10 ] , [ 0 , 0 , 4 , 8 , 12 , 14 ] , [ 0 , 2 , 8 , 12 , 16 , 20 ] , [ 0 , 4 , 10 , 14 , 20 , 24 ] ] n , m = map ( int , input ( ) . split ( \" ▁ \" ) ) if n > m : n , m = m , nif n <= 5 and m <= 5 : print ( known [ m ] [ n ] ) elif n == 1 : print ( 6 * ( m // 6 ) + [ 0 , 0 , 0 , 0 , 2 , 4 ] [ m % 6 ] ) elif n == 2 : if m == 7 : print ( 12 ) else : print ( 2 * m ) else : print ( 2 * int ( ( m * n ) // 2 ) ) NEW_LINE" ]
codeforces_689_B
[ "import java . util . * ; import java . io . * ;", "import java . io . * ; import java . util . * ;   public class MikeandShortcuts {   public static void main ( String args [ ] ) throws Exception { Scanner cin = new Scanner ( System . in ) ; int N = cin . nextInt ( ) ; int a [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = cin . nextInt ( ) ; } Queue < Integer > queue = new LinkedList < Integer > ( ) ; int [ ] dis = new int [ N ] ; boolean [ ] visited = new boolean [ N ] ;   for ( int i = 0 ; i < N ; i ++ ) { dis [ i ] = - 1 ; visited [ 0 ] = false ; } visited [ 0 ] = true ; dis [ 0 ] = 0 ; queue . add ( 0 ) ;   while ( ! queue . isEmpty ( ) ) { int e = queue . poll ( ) ; int ahead = e + 1 , back = e - 1 ; if ( ahead >= 0 && ahead < N && ! visited [ ahead ] ) { queue . add ( ahead ) ; visited [ ahead ] = true ; dis [ ahead ] = dis [ e ] + 1 ; } if ( back >= 0 && back < N && ! visited [ back ] ) { if ( back >= 0 && back < N && ! visited [ back ] ) { queue . add ( back ) ; visited [ back ] = true ; dis [ back ] = dis [ e ] + 1 ; } } int target = a [ e ] - 1 ; if ( ! visited [ target ] ) { if ( ! visited [ target ] ) { queue . add ( target ) ; visited [ target ] = true ; dis [ target ] = dis [ e ] + 1 ; } } }   for ( int i = 0 ; i < N ; i ++ ) { if ( i == N ) System . out . println ( dis [ i ] ) ; System . out . print ( dis [ i ] + \" ▁ \" ) ; }   }   }", "import java . util . * ; import java . io . * ; public class Solution { 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 ] ;" ]
[ "from collections import deque   intersections = int ( input ( ) ) shortcuts = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) costs = [ float ( ' inf ' ) ] * ( intersections + 1 ) costs [ 1 ] = 0 queue = deque ( [ 1 ] )   while queue : t = queue . popleft ( )   if t + 1 <= intersections and costs [ t ] + 1 < costs [ t + 1 ] : costs [ t + 1 ] = costs [ t ] + 1 queue . append ( t + 1 )   if t - 1 >= 1 and costs [ t ] + 1 < costs [ t - 1 ] : costs [ t - 1 ] = costs [ t ] + 1 queue . append ( t - 1 )   if costs [ t ] + 1 < costs [ shortcuts [ t ] ] : costs [ shortcuts [ t ] ] = costs [ t ] + 1 queue . append ( shortcuts [ t ] )   print ( ' ▁ ' . join ( str ( i ) for i in costs [ 1 : ] ) ) NEW_LINE", "from collections import deque   intersections = int ( input ( ) ) shortcuts = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) costs = [ float ( ' inf ' ) ] * ( intersections + 1 ) costs [ 1 ] = 0 queue = deque ( [ 1 ] )   while queue : t = queue . popleft ( )   if t + 1 <= intersections and costs [ t ] + 1 < costs [ t + 1 ] : costs [ t + 1 ] = costs [ t ] + 1 queue . append ( t + 1 )   if t - 1 >= 1 and costs [ t ] + 1 < costs [ t - 1 ] : costs [ t - 1 ] = costs [ t ] + 1 queue . append ( t - 1 )   if costs [ t ] + 1 < costs [ shortcuts [ t ] ] : costs [ shortcuts [ t ] ] = costs [ t ] + 1 queue . append ( shortcuts [ t ] )   print ( ' ▁ ' . join ( str ( i ) for i in costs [ 1 : ] ) ) NEW_LINE", "n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) )   for i in range ( n ) : A [ i ] -= 1   dist = [ - 1 for i in range ( n ) ] dist [ 0 ] = 0   Q = [ 0 ]   while len ( Q ) != 0 : k = 0 u = Q . pop ( 0 ) if dist [ A [ u ] ] == - 1 : dist [ A [ u ] ] = dist [ u ] + 1 k += 1 if A [ u ] not in Q : Q . append ( A [ u ] ) elif dist [ A [ u ] ] > dist [ u ] + 1 : dist [ A [ u ] ] = dist [ u ] + 1 k += 1 if A [ u ] not in Q : Q . append ( A [ u ] ) for v in range ( u - 1 , u + 2 ) : if v < 0 or v >= n : continue if dist [ v ] == - 1 : dist [ v ] = dist [ u ] + abs ( u - v ) if v not in Q : Q . append ( v ) elif dist [ u ] + abs ( u - v ) < dist [ v ] : dist [ v ] = dist [ u ] + abs ( u - v ) k += 1 if v not in Q : Q . append ( v ) print ( ' ▁ ' . join ( map ( str , dist ) ) ) NEW_LINE", "def solve ( N , nums ) : ans = [ float ( ' inf ' ) ] * N ans [ 0 ] = str ( 0 )   for i in range ( N ) : v = nums [ i ] nums [ i ] = set ( [ min ( N - 1 , i + 1 ) , max ( 0 , i - 1 ) , v - 1 , ] ) d = 0 q = set ( [ 0 ] ) while q : next_q = set ( ) d += 1 for node in q : for next_node in nums [ node ] : if ans [ next_node ] == float ( ' inf ' ) : ans [ next_node ] = str ( d ) next_q . add ( next_node ) q = next_q   return ans   N = int ( input ( ) ) nums = list ( map ( int , input ( ) . split ( ) ) ) ans = solve ( N , nums ) print ( ( \" ▁ \" ) . join ( ans ) ) NEW_LINE" ]
codeforces_675_A
[ "import java . util . * ; public class f {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long c = sc . nextInt ( ) ; if ( c == 0 ) System . out . println ( ( a == b ) ? \" YES \" : \" NO \" ) ; else System . out . println ( ( ( b - a ) % c == 0 && ( b - a ) / c >= 0 ) ? \" YES \" : \" NO \" ) ;   }   }", "import java . io . * ; import java . util . * ;   public class practice675a { public static void main ( String [ ] args ) throws Exception {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ;    public class CF675AInfiniteSequence {   static BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static PrintWriter out = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) throws IOException { int [ ] p = readArray ( ) ; int a = p [ 0 ] ; int b = p [ 1 ] ; int c = p [ 2 ] ;   if ( c == 0 ) { out . print ( a == b ? \" YES \" : \" NO \" ) ; } else if ( c > 0 ) { if ( b < a ) { out . print ( \" NO \" ) ; } else { out . print ( ( b - a ) % c == 0 ? \" YES \" : \" NO \" ) ; } } else if ( c < 0 ) { if ( b > a ) { out . print ( \" NO \" ) ; } else { out . print ( ( b - a ) % c == 0 ? \" YES \" : \" NO \" ) ; } } out . close ( ) ; }   private static String read ( ) throws IOException { return in . readLine ( ) ; }   private static int readInt ( ) throws IOException { return Integer . parseInt ( in . readLine ( ) ) ; }   private static int [ ] readArray ( ) throws IOException { String [ ] line = in . readLine ( ) . split ( \" \\\\ s \" ) ; int [ ] a = Arrays . stream ( line ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; return a ; }   private static int [ ] readSortedArray ( ) throws IOException { String [ ] line = in . readLine ( ) . split ( \" \\\\ s \" ) ; int [ ] a = Arrays . stream ( line ) . mapToInt ( Integer :: parseInt ) . sorted ( ) . toArray ( ) ; return a ; } }" ]
[ "''' a = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] x = a [ 0 ] y = a [ 1 ] z = a [ 2 ] if ▁ y = = x ▁ and ▁ z = = 0 : ▁ ▁ ▁ ▁ print ( '0 ' ) elif ▁ x > y + z : ▁ ▁ ▁ ▁ print ( ' + ' ) elif ▁ y > x + z : ▁ ▁ ▁ ▁ print ( ' - ' ) else : ▁ ▁ ▁ ▁ print ( ' ? ' ) n = int ( input ( ) ) z = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] x = [ ] d = 0v = ' ' for ▁ i ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ c = 0 ▁ ▁ ▁ ▁ e = 0 ▁ ▁ ▁ ▁ for ▁ f ▁ in ▁ range ( len ( z ) ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ z [ f ] > c ▁ and ▁ f + 1 ▁ not ▁ in ▁ x : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ c = z [ f ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ e = f + 1 ▁ ▁ ▁ ▁ d + = ( i * c ) + 1 ▁ ▁ ▁ ▁ x . append ( e ) print ( d ) for ▁ i ▁ in ▁ x : ▁ ▁ ▁ ▁ v + = str ( i ) ▁ ▁ ▁ ▁ v + = ' ▁ ' print ( v )  f = int ( input ( ) ) g = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] for ▁ i ▁ in ▁ range ( len ( g ) -1 ) : ▁ ▁ ▁ ▁ for ▁ f ▁ in ▁ range ( len ( g ) -1 - i ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ g [ f ] > g [ f + 1 ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ g [ f ] , g [ f + 1 ] = g [ f + 1 ] , g [ f ] if ▁ g [ 0 ] * g [ 1 ] > g [ -2 ] * g [ -3 ] ▁ and ▁ g [ -1 ] > 0 : ▁ ▁ ▁ ▁ print ( g [ -1 ] * g [ 0 ] * g [ 1 ] ) else : ▁ ▁ ▁ ▁ print ( g [ -1 ] * g [ -2 ] * g [ -3 ] ) for ▁ u ▁ in ▁ range ( int ( input ( ) ) ) : ▁ ▁ ▁ ▁ z = int ( input ( ) ) ▁ ▁ ▁ ▁ y = [ int ( f ) ▁ for ▁ f ▁ in ▁ input ( ) . split ( ) ] ▁ ▁ ▁ ▁ y . sort ( ) ▁ ▁ ▁ ▁ d = 0 ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ y : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ d + = i ▁ ▁ ▁ ▁ if ▁ d < 2048 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' No ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ continue ▁ ▁ ▁ ▁ if ▁ 2048 ▁ in ▁ y : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' yes ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ continue ▁ ▁ ▁ ▁ for ▁ x ▁ in ▁ range ( z + 1 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ 2048 ▁ in ▁ y : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' yes ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( len ( y ) -1 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ y [ i ] = = y [ i + 1 ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ y [ i + 1 ] = y [ i ] *2 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ y . pop ( i ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ i > len ( y ) -3 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ y . sort ( ) ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' no ' ) n = int ( input ( ) ) x = [ ] for ▁ i ▁ in ▁ range ( 1 , ( ( n * *2 ) / /2 ) + 1 ) : ▁ ▁ ▁ ▁ x . append ( n * *2 + 1 - i ) ▁ ▁ ▁ ▁ x . append ( i ) ▁ ▁ ▁ ▁ if ▁ len ( x ) = = n : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( * x ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ x = [ ] for ▁ z ▁ in ▁ range ( int ( input ( ) ) ) : ▁ ▁ ▁ ▁ z = int ( input ( ) ) ▁ ▁ ▁ ▁ x = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] ▁ ▁ ▁ ▁ f = 0 ▁ ▁ ▁ ▁ o = 0 ▁ ▁ ▁ ▁ t = 0 ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( z ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ x [ i ] %3 = = 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ f + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ elif ▁ x [ i ] %3 = = 1 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ o + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t + = 1 ▁ ▁ ▁ ▁ if ▁ o < t : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( f + o + ( t - o ) / / 3 ) ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( f + t + ( o - t ) / / 3 ) n = int ( input ( ) ) if ▁ n % 2 = = 1 : ▁ ▁ ▁ ▁ print ( 0 ) elif ▁ n % 4 = = 0 : ▁ ▁ ▁ ▁ print ( ( n / /4 ) - 1 ) else : ▁ ▁ ▁ ▁ print ( n / /4 ) ''' n = [ int ( i ) for i in input ( ) . split ( ) ] if n [ 2 ] >= 0 and n [ 0 ] > n [ 1 ] : print ( ' NO ' ) elif n [ 2 ] <= 0 and n [ 0 ] < n [ 1 ] : print ( ' NO ' ) elif n [ 2 ] == 0 : if n [ 0 ] == n [ 1 ] : print ( ' YES ' ) else : print ( ' NO ' ) elif ( n [ 1 ] - n [ 0 ] ) % n [ 2 ] == 0 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE", "a , b , d = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) if d == 0 : if a == b : print ( ' yes ' ) else : print ( ' no ' ) elif a == b : print ( ' yes ' ) elif ( b - a ) % d == 0 and ( b - a ) * d > 0 : print ( ' yes ' ) else : print ( ' no ' ) NEW_LINE", "a , b , c = map ( int , input ( ) . split ( ) ) ; s = 0 if c == 0 : if a == b : print ( \" YES \" ) else : print ( \" NO \" ) elif c < 0 : if a < b : print ( \" NO \" ) else : if abs ( a - b ) % c == 0 : print ( \" YES \" ) else : print ( \" NO \" ) else : if a > b : print ( \" NO \" ) else : if abs ( a - b ) % c == 0 : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "a , b , c = map ( int , input ( ) . split ( ) ) if ( a != b and c == 0 ) : print ( \" NO \" ) else : print ( \" YES \" ) if ( a == b or ( ( b - a ) % c == 0 and ( abs ( b - a ) / abs ( c ) ) == ( ( b - a ) / c ) ) ) else print ( \" NO \" ) NEW_LINE", "a , b , c = map ( int , input ( ) . split ( ) )   if a == b : print ( ' YES ' ) elif c == 0 or b > a and c < 0 or b < a and c > 0 : print ( ' NO ' ) else : c = abs ( c )   if ( b - a ) % c == 0 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE" ]
codeforces_984_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Codeforces {   private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ;   public static int [ ] LPS ( String p ) { int [ ] lps = new int [ p . length ( ) ] ;   int i = 1 ; int j = 0 ; while ( i < p . length ( ) ) { if ( p . charAt ( i ) == p . charAt ( j ) ) { lps [ i ] = j + 1 ; i ++ ; j ++ ; } else { if ( j == 0 ) { lps [ i ] = 0 ; i ++ ; } else { j = lps [ j - 1 ] ; } } } return lps ; }   public static void KMP ( String text , String pattern ) { int [ ] lps = LPS ( pattern ) ; int i = 0 ; int j = 0 ; ArrayList < Integer > matches = new ArrayList < > ( ) ; while ( i < text . length ( ) ) { if ( text . charAt ( i ) == pattern . charAt ( j ) ) { i ++ ; j ++ ; } else { if ( j != 0 ) { j = lps [ j - 1 ] ; } else { i ++ ; } } if ( j == pattern . length ( ) ) { matches . add ( i - j ) ; j = lps [ j - 1 ] ; } } for ( int x : matches ) { System . out . println ( \" Match ▁ at ▁ : ▁ \" + x ) ; } }   private static class SegmentTree { private long [ ] st ; private int size ; private int n ; private long [ ] a ; SegmentTree ( long [ ] a , int n ) { this . size = 4 * n ; this . n = n ; this . a = a ; st = new long [ size ] ;", "import java . io . * ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) throws Exception { int nm [ ] = in . readA ( ) ; int n = nm [ 0 ] , m = nm [ 1 ] ; char [ ] [ ] board = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] line = in . readLine ( ) . toCharArray ( ) ; for ( int j = 0 ; j < m ; j ++ ) { board [ i ] [ j ] = line [ j ] ; } } boolean possible = true ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { possible = possible && check ( i , j , board [ i ] [ j ] , board ) ; } } if ( ! possible ) System . out . println ( \" NO \" ) ; else System . out . println ( \" YES \" ) ; } static int [ ] [ ] direction = { { - 1 , - 1 } , { - 1 , 0 } , { - 1 , 1 } , { 0 , - 1 } , { 0 , 1 } , { 1 , - 1 } , { 1 , 0 } , { 1 , 1 } } ; public static boolean check ( int x , int y , char val , char [ ] [ ] board ) { if ( board [ x ] [ y ] == ' * ' ) return true ; int mines = 0 ; for ( int [ ] dir : direction ) { int nx = x + dir [ 0 ] , ny = y + dir [ 1 ] ; if ( nx < 0 || nx >= board . length || ny < 0 || ny >= board [ 0 ] . length ) continue ; if ( board [ nx ] [ ny ] == ' * ' ) mines ++ ; }", "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 ( ) ; s . nextLine ( ) ; String [ ] s1 = new String [ n ] ; for ( int j1 = 0 ; j1 < n ; j1 ++ ) s1 [ j1 ] = s . nextLine ( ) ; int count = 0 , found = 0 , count1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { count = 0 ; count1 = 0 ; if ( Character . isDigit ( s1 [ i ] . charAt ( j ) ) ) { int digit = Character . getNumericValue ( s1 [ i ] . charAt ( j ) ) ; if ( i > 0 && s1 [ i - 1 ] . charAt ( j ) == ' * ' ) count ++ ; if ( i < n - 1 && s1 [ i + 1 ] . charAt ( j ) == ' * ' ) count ++ ; if ( j > 0 && s1 [ i ] . charAt ( j - 1 ) == ' * ' ) count ++ ; if ( j < m - 1 && s1 [ i ] . charAt ( j + 1 ) == ' * ' ) count ++ ; if ( i > 0 && j > 0 && s1 [ i - 1 ] . charAt ( j - 1 ) == ' * ' ) count ++ ; if ( i > 0 && j < m - 1 && s1 [ i - 1 ] . charAt ( j + 1 ) == ' * ' ) count ++ ; if ( i < n - 1 && j > 0 && s1 [ i + 1 ] . charAt ( j - 1 ) == ' * ' ) count ++ ; if ( i < n - 1 && j < m - 1 && s1 [ i + 1 ] . charAt ( j + 1 ) == ' * ' ) count ++ ; if ( digit != count ) {" ]
[ "n , m = map ( int , input ( ) . split ( ) ) S = [ input ( ) for i in range ( n ) ]   res = [ [ 0 ] * m for i in range ( n ) ] d = [ ( - 1 , - 1 ) , ( - 1 , 0 ) , ( - 1 , 1 ) , ( 0 , - 1 ) , ( 0 , 1 ) , ( 1 , - 1 ) , ( 1 , 0 ) , ( 1 , 1 ) ] for i in range ( n ) : for j in range ( m ) : if S [ i ] [ j ] == ' * ' : for di , dj in d : ni , nj = i + di , j + dj if 0 <= ni < n and 0 <= nj < m : if S [ ni ] [ nj ] != ' * ' : res [ ni ] [ nj ] += 1 NEW_LINE", "from itertools import product   I = lambda : map ( int , input ( ) . split ( ) )   n , m = I ( ) A = [ input ( ) . replace ( ' . ' , '0' ) for _ in range ( n ) ]   for x , y in product ( range ( n ) , range ( m ) ) : if ( A [ x ] [ y ] != ' * ' and sum ( A [ x + dx ] [ y + dy ] == ' * ' for dx in range ( - 1 , 2 ) for dy in range ( - 1 , 2 ) if 0 <= x + dx < n and 0 <= y + dy < m ) != int ( A [ x ] [ y ] ) ) : print ( ' NO ' ) breakelse : print ( ' YES ' ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a = [ input ( ) . replace ( ' . ' , '0' ) for i in range ( n ) ] for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] != ' * ' and int ( a [ i ] [ j ] ) != sum ( map ( lambda b : b [ max ( 0 , j - 1 ) : j + 2 ] . count ( ' * ' ) , a [ max ( 0 , i - 1 ) : i + 2 ] ) ) : print ( ' NO ' ) exit ( ) print ( ' YES ' ) NEW_LINE" ]
codeforces_61_A
[ "import java . util . Scanner ;   public class UltrafastMath { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String word1 = scanner . nextLine ( ) . trim ( ) ; String word2 = scanner . nextLine ( ) . trim ( ) ;   StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < word1 . length ( ) ; i ++ ) { sb . append ( word1 . charAt ( i ) == word2 . charAt ( i ) ? \"0\" : \"1\" ) ; }   System . out . println ( sb . toString ( ) ) ; } }", "import java . util . Scanner ;   public class Ultra_Fast_Mathematician {   static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; StringBuilder sum = new StringBuilder ( ) ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { int n = s1 . charAt ( i ) - '0' ; int m = s2 . charAt ( i ) - '0' ; if ( ( n + m ) == 1 ) { sum . append ( \"1\" ) ; } else { sum . append ( \"0\" ) ; } } System . out . println ( sum . toString ( ) ) ; } }", "import java . util . * ;   public class Main { public static void main ( String [ ] args ) {   Scanner scn = new Scanner ( System . in ) ; String num = scn . nextLine ( ) ; String num2 = scn . nextLine ( ) ; String str = \" \" ; for ( int i = 0 ; i < num . length ( ) ; i ++ ) { if ( num . charAt ( i ) == num2 . charAt ( i ) ) { str = str + 0 ; } else { str = str + 1 ; } } System . out . print ( str ) ;   } }", "import java . util . Scanner ;    public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . nextLine ( ) ; String b = sc . nextLine ( ) ; char [ ] c = new char [ a . length ( ) ] ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) == b . charAt ( i ) ) { c [ i ] = '0' ; } else { c [ i ] = '1' ; } } System . out . println ( c ) ; }   }", "import java . io . * ; import java . util . * ; public class MyClass { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = br . readLine ( ) ; String b = br . readLine ( ) ; String rs = \" \" ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { int ch1 = a . charAt ( i ) - '0' ; int ch2 = b . charAt ( i ) - '0' ; rs += ( ch1 ^ ch2 ) ; } System . out . println ( rs ) ; } }" ]
[ "first = input ( ) NEW_LINE second = input ( )     res = \" \" NEW_LINE for u , v in zip ( first , second ) : if NEW_LINE u == v : res += \"0\" else : res += \"1\" NEW_LINE print ( res ) NEW_LINE", "a = input ( ) NEW_LINE b = input ( ) NEW_LINE a = [ x for x in a ] NEW_LINE b = [ y for y in b ]   x = [ '0' if i1 == i2 else '1' for ( i1 , i2 ) in zip ( a , b ) ] NEW_LINE print ( ' ' . join ( x ) ) NEW_LINE", "a , b = input ( ) , input ( ) NEW_LINE c = [ 0 ] * len ( a ) NEW_LINE for i in range ( len ( a ) ) : if NEW_LINE a [ i ] != b [ i ] : c [ i ] = 1 NEW_LINE print ( * c , sep = ' ' ) NEW_LINE", "m = input ( ) NEW_LINE n = input ( ) NEW_LINE for i in range ( len ( m ) ) : if NEW_LINE INDENT ( m [ i ] == n [ i ] ) : print ( '0' , end = ' ' ) else : print ( '1' , end = ' ' ) NEW_LINE DEDENT" ]
codeforces_337_B
[ "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 int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } public static int lcm ( int a , int b ) { return ( a / gcd ( a , b ) ) * b ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int A = a , B = b , C = c , D = d ; int num , p , q ; if ( c > d ) { num = lcm ( c , a ) ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; if ( b < d ) { a = A ; b = B ; c = C ; d = D ; num = lcm ( d , b ) ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; } } else { num = lcm ( d , b ) ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; if ( a < c ) { a = A ; b = B ; c = C ; d = D ; num = lcm ( c , a ) ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; } } if ( p == 0 ) { q = 1 ; }", "import java . util . * ;   public class RoutineProblem { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long a = in . nextLong ( ) ; long b = in . nextLong ( ) ; long c = in . nextLong ( ) ; long d = in . nextLong ( ) ;   double A = ( double ) a , B = ( double ) b , C = ( double ) c , D = ( double ) d ;   if ( Math . abs ( A / B - C / D ) <= 1e-9 ) { System . out . println ( \"0/1\" ) ; } else if ( C / D > A / B ) { long ans1 = b * c - a * d ; long ans2 = b * c ; long cp = gcd ( ans1 , ans2 ) ; System . out . println ( ans1 / cp + \" / \" + ans2 / cp ) ; } else if ( C / D < A / B ) { long ans1 = a * d - b * c ; long ans2 = a * d ; long cp = gcd ( ans1 , ans2 ) ; System . out . println ( ans1 / cp + \" / \" + ans2 / cp ) ; } } public static long gcd ( long a , long b ) { if ( b == 0 ) { return a ; } return gcd ( b , a % b ) ; } }", "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 a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int A = a , B = b , C = c , D = d ; int num , p , q ; if ( c > d ) { num = c * a ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; if ( b < d ) { a = A ; b = B ; c = C ; d = D ; num = b * d ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; } } else { num = b * d ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; if ( a < c ) { a = A ; b = B ; c = C ; d = D ; num = a * c ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; } } if ( p == 0 ) { q = 1 ; }" ]
[ "from fractions import Fractiona , b , c , d = map ( int , input ( ) . split ( ) ) v = Fraction ( abs ( a * d - b * c ) , max ( a * d , b * c ) ) print ( v . numerator , ' / ' , v . denominator , sep = ' ' ) NEW_LINE", "from fractions import Fractiona , b , c , d = map ( int , input ( ) . split ( ) ) if ( a / b == c / d ) : print ( '0/1' ) elif ( a / b < c / d ) : r1 = ( ( b * c ) - ( a * d ) ) / ( b * c ) print ( Fraction ( r1 ) . limit_denominator ( ) ) elif ( a / b > c / d ) : r = ( ( a * d ) - ( b * c ) ) / ( a * d ) print ( Fraction ( r ) . limit_denominator ( ) ) NEW_LINE", "import mathn , k , l , m = map ( int , input ( ) . split ( ) ) k = k * lm = m * na = abs ( k - m ) b = max ( k , m ) x = math . gcd ( a , b ) a //= xb //= xprint ( str ( a ) + \" / \" + str ( b ) ) NEW_LINE", "import sysimport mathdef gcd ( a , b ) : c = max ( a , b ) d = min ( a , b ) r = c % d if r == 0 : return d return gcd ( d , r ) def lcm ( a , b ) : def gcd_naive ( a , b ) : c = max ( a , b ) d = min ( a , b ) r = c % d if r == 0 : return d return gcd_naive ( d , r )   return int ( a * b / gcd_naive ( a , b ) )   def fn ( a , b , c , d ) : k1 = lcm ( a , c ) k2 = lcm ( b , d ) f = k1 // a b1 = b * f f2 = k1 // c d1 = d * f2 if b1 == d1 : print ( \"0/1\" ) return 0 elif b1 > d1 : nu = b1 - d1 de = b1 else : f1 = k2 // b a1 = f1 * a f3 = k2 // d c1 = f3 * c nu = a1 - c1 de = a1 g = gcd ( nu , de ) nu = int ( nu // g ) de = int ( de // g ) print ( str ( nu ) + \" / \" + str ( de ) ) if __name__ == ' _ _ main _ _ ' : input = sys . stdin . read ( ) data = list ( map ( float , input . split ( ) ) ) a = ( data [ 0 ] ) b = data [ 1 ] c = data [ 2 ] d = data [ 3 ] ( fn ( a , b , c , d ) ) NEW_LINE", "def gcd ( a , b ) : while a % b != 0 : a , b = b , a % b return b   l = input ( ) . split ( ' ▁ ' ) a , b , c , d = int ( l [ 0 ] ) , int ( l [ 1 ] ) , int ( l [ 2 ] ) , int ( l [ 3 ] ) if a * d > b * c : p = a * d - b * c q = a * delse : p = b * c - a * d q = b * ce = gcd ( p , q ) p //= eq //= eprint ( str ( p ) + \" / \" + str ( q ) ) NEW_LINE" ]
codeforces_1271_B
[ "import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; String str = s . next ( ) ; int b = 0 , w = 0 ; ArrayList < Integer > black = new ArrayList < > ( ) ; ArrayList < Integer > white = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( str . charAt ( i ) == ' B ' ) { b ++ ; black . add ( i + 1 ) ; } else { w ++ ; white . add ( i + 1 ) ; } } if ( b % 2 == 1 && w % 2 == 1 ) { System . out . println ( - 1 ) ; return ; } ArrayList < Integer > ans = new ArrayList < > ( ) ; if ( b % 2 == 1 ) { for ( int i = 1 ; i < white . size ( ) ; i = i + 2 ) { for ( int start = white . get ( i ) - 1 ; start >= white . get ( i - 1 ) ; start -- ) { ans . add ( start ) ; } } } else { for ( int i = 1 ; i < black . size ( ) ; i = i + 2 ) { for ( int start = black . get ( i ) - 1 ; start >= black . get ( i - 1 ) ; start -- ) { ans . add ( start ) ; } } } System . out . println ( ans . size ( ) ) ; for ( int num : ans ) { System . out . print ( num + \" ▁ \" ) ; } } }", "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 . util . * ; import java . math . BigInteger ; public class asd { static Scanner s = new Scanner ( System . in ) ; public static void main ( String args [ ] ) throws Exception { int t = 1 ; while ( t -- > 0 ) { solve ( ) ; } } public static void solve ( ) { int n = s . nextInt ( ) ; String str = s . next ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; char [ ] ch = str . toCharArray ( ) ; int b = 0 ; int w = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( ch [ i ] == ' W ' ) w ++ ; else b ++ ; } if ( w % 2 == 1 && b % 2 == 1 ) { System . out . println ( \" - 1\" ) ; return ; } int col = 9 ; if ( w % 2 == 0 ) col = 2 ; else if ( b % 2 == 0 ) col = 3 ; if ( col == 2 ) {", "import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { PrintWriter out ; FastReader sc ; long mod = ( long ) ( 1e9 + 7 ) ; long maxlong = Long . MAX_VALUE ; long minlong = Long . MIN_VALUE ; public void sol ( ) { int n = ni ( ) ; StringBuilder sb = new StringBuilder ( ) ; char [ ] ar = rl ( ) ; int a = 0 , b = 0 ; for ( char ch : ar ) { if ( ch == ' W ' ) a ++ ; else b ++ ; } if ( a % 2 != 0 && b % 2 != 0 ) pl ( \" - 1\" ) ; else { int p = 0 ; if ( a % 2 == 0 ) { for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ar [ i ] == ' W ' && ar [ i + 1 ] == ' W ' ) { sb . append ( i + 1 + \" ▁ \" ) ; ar [ i + 1 ] = ' B ' ; p ++ ; } else if ( ar [ i ] == ' W ' ) { ar [ i + 1 ] = ' W ' ; sb . append ( i + 1 + \" ▁ \" ) ; p ++ ; } } } else { for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ar [ i ] == ' B ' && ar [ i + 1 ] == ' B ' ) { ar [ i + 1 ] = ' W ' ; sb . append ( i + 1 + \" ▁ \" ) ; p ++ ; } else if ( ar [ i ] == ' B ' ) { ar [ i + 1 ] = ' B ' ; sb . append ( i + 1 + \" ▁ \" ) ; p ++ ; } } } pl ( p ) ; pl ( sb ) ; } } public static void main ( String [ ] args ) { Main g = new Main ( ) ; g . out = new PrintWriter ( System . out ) ; g . sc = new FastReader ( ) ; int t = 1 ;" ]
[ "n = int ( input ( ) ) s1 = list ( input ( ) ) s2 = s1ans1 = ans2 = [ ] for i in range ( n - 1 ) : if s1 [ i ] == ' B ' : s1 [ i ] = ' W ' if s1 [ i + 1 ] == ' B ' : s1 [ i + 1 ] = ' W ' else : s1 [ i + 1 ] = ' B ' ans1 . append ( i + 1 ) if s1 [ n - 1 ] == ' W ' : print ( len ( ans1 ) ) if len ( ans1 ) > 0 : print ( * ans1 ) else : for i in range ( n - 1 ) : if s2 [ i ] == ' W ' : s2 [ i ] = ' B ' if s2 [ i + 1 ] == ' W ' : s2 [ i + 1 ] = ' B ' else : s2 [ i + 1 ] = ' W ' ans2 . append ( i + 1 ) if s2 [ n - 1 ] != ' W ' : print ( len ( ans2 ) ) if len ( ans2 ) > 0 : print ( * ans2 ) else : print ( \" - 1\" )   NEW_LINE", "import sysimport mathfrom collections import defaultdict , Counter , deque   NEW_LINE" ]
codeforces_274_B
[ "import java . util . * ; import java . io . * ; import static java . lang . Math . * ;   public class PracticeProblem { public static FastReader in = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static Set < Integer > [ ] graph ; public static long [ ] written ;   public static void main ( String [ ] args ) { int n = in . nextInt ( ) ;   graph = new Set [ n ] ; for ( int i = 0 ; i < n ; i ++ ) graph [ i ] = new HashSet < > ( ) ;   for ( int i = 0 ; i < n - 1 ; i ++ ) { int a = in . nextInt ( ) - 1 ; int b = in . nextInt ( ) - 1 ;   graph [ a ] . add ( b ) ; graph [ b ] . add ( a ) ; }   written = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) written [ i ] = in . nextInt ( ) ;   long [ ] answer = dfs ( 0 , - 1 ) ;   out . println ( abs ( answer [ 0 ] ) + abs ( answer [ 1 ] ) ) ;   out . close ( ) ; }   public static long [ ] dfs ( int vertex , int parent )", "import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class Solveaproblem { private static long [ ] arr ; private static ArrayList < Integer > [ ] graph ; private static long [ ] dfs ( int item , int prev ) { long min = 0 , max = 0 ; for ( int elem : graph [ item ] ) { if ( elem == prev ) continue ; long [ ] next = dfs ( elem , item ) ; min = Math . min ( min , next [ 0 ] ) ; max = Math . max ( max , next [ 1 ] ) ; } long x = arr [ item ] + min + max ; if ( x > 0 ) min -= x ; else max -= x ; return new long [ ] { min , max } ; } public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; graph = new ArrayList [ n ] ; for ( int i = 0 ; i < n ; i ++ ) graph [ i ] = new ArrayList < > ( ) ; for ( int i = 1 ; i < n ; i ++ ) { StringTokenizer sToken = new StringTokenizer ( reader . readLine ( ) ) ; int x = Integer . parseInt ( sToken . nextToken ( ) ) - 1 ; int y = Integer . parseInt ( sToken . nextToken ( ) ) - 1 ; graph [ x ] . add ( y ) ; graph [ y ] . add ( x ) ; } arr = new long [ n ] ; StringTokenizer sToken = new StringTokenizer ( reader . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = Integer . parseInt ( sToken . nextToken ( ) ) ; long [ ] res = dfs ( 0 , - 1 ) ; System . out . println ( ( res [ 0 ] * ( - 1 ) ) + res [ 1 ] ) ; } }" ]
[ "n = int ( input ( ) ) r = [ [ ] for i in range ( n + 1 ) ] r [ 1 ] = [ 0 ] for i in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) r [ a ] . append ( b ) r [ b ] . append ( a ) t = list ( map ( int , input ( ) . split ( ) ) ) u , v = [ 0 ] * ( n + 1 ) , [ 0 ] * ( n + 1 ) for i , j in enumerate ( t , 1 ) : if j < 0 : u [ i ] = - j else : v [ i ] = j NEW_LINE", "from sys import stdin , stdout , setrecursionlimitfrom collections import defaultdict , deque , Counter , OrderedDictfrom heapq import heappop , heappushimport threading   n = int ( stdin . readline ( ) )   graph = [ set ( ) for x in range ( n ) ]   for x in range ( n - 1 ) : a , b = [ int ( x ) for x in stdin . readline ( ) . split ( ) ] a -= 1 b -= 1   graph [ a ] . add ( b ) graph [ b ] . add ( a )   vals = [ int ( x ) for x in stdin . readline ( ) . split ( ) ]   bruh = [ ( 0 , - 1 ) ]   for x in range ( n ) : num , p = bruh [ x ] for y in graph [ num ] : if y != p : bruh . append ( ( y , num ) )   result = [ - 1 for x in range ( n ) ]   for v , parent in bruh [ : : - 1 ] : nP = 0 nN = 0 for x in graph [ v ] : if x != parent : p , n = result [ x ] nP = max ( nP , p ) nN = max ( nN , n ) nN = max ( nN , nP + vals [ v ] ) nP = max ( nP , nN - vals [ v ] ) result [ v ] = ( nP , nN )   ng , ps = result [ 0 ]   vals [ 0 ] += ps - ng   stdout . write ( str ( ng + ps ) ) NEW_LINE" ]
codeforces_1438_B
[ "import java . util . * ;   public class Example { static int [ ] dp ;   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;", "import java . util . * ;   public class Example { static int [ ] dp ;   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;", "import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int j = 0 ; j < n ; j ++ ) { ar [ j ] = sc . nextInt ( ) ; map . putIfAbsent ( ar [ j ] , 0 ) ; map . put ( ar [ j ] , map . get ( ar [ j ] ) + 1 ) ; } boolean check = false ; for ( Integer integer : map . keySet ( ) ) { if ( map . get ( integer ) >= 2 ) { check = true ; break ; } } if ( check ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; }", "import java . io . * ; import java . util . HashSet ; import java . util . StringTokenizer ;", "import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int j = 0 ; j < n ; j ++ ) { ar [ j ] = sc . nextInt ( ) ; map . putIfAbsent ( ar [ j ] , 0 ) ; map . put ( ar [ j ] , map . get ( ar [ j ] ) + 1 ) ; } boolean check = false ; for ( Integer integer : map . keySet ( ) ) { if ( map . get ( integer ) >= 2 ) { check = true ; break ; } } if ( check ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; }" ]
[ "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE s = set ( b ) NEW_LINE if len ( s ) == len ( b ) : NEW_LINE INDENT print ( \" No \" ) else : NEW_LINE print ( \" Yes \" ) NEW_LINE DEDENT", "import sysimport NEW_LINE mathfrom NEW_LINE collections NEW_LINE import deque NEW_LINE", "def func ( ) : dic = dict ( ) NEW_LINE for i in lst : if NEW_LINE i in dic : print ( ' YES ' ) NEW_LINE return else : dic [ i ] = 0 NEW_LINE print ( ' NO ' )     for _ in range ( int ( input ( ) ) ) : num = int ( input ( ) ) NEW_LINE lst = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE func ( ) NEW_LINE", "from collections import defaultdict   for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE d = defaultdict ( int ) NEW_LINE for x in b : d [ x ] += 1 NEW_LINE ok = False NEW_LINE for v in d . values ( ) : if NEW_LINE v > 1 : ok = True NEW_LINE break NEW_LINE print ( \" YES \" if ok else \" NO \" ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l1 = list ( set ( a ) ) NEW_LINE if len ( a ) == len ( l1 ) : NEW_LINE INDENT print ( \" NO \" ) else : NEW_LINE print ( \" YES \" )   NEW_LINE DEDENT" ]
codeforces_803_B
[ "  import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class er10a {", "import java . util . * ; import java . 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 B803 {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;", "import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ;    public class CodeForce { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ;", "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 long MAX = ( long ) 1e12 ; private static final long MOD = 100000007 ;   private static final int MAXN = 300005 ; 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 ) ;" ]
[ "def solve ( ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] d = [ float ( ' inf ' ) ] * n prev = - float ( ' inf ' ) for i in range ( n ) : if a [ i ] == 0 : prev = i d [ i ] = min ( d [ i ] , i - prev ) next = float ( ' inf ' ) for i in range ( n - 1 , - 1 , - 1 ) : if a [ i ] == 0 : next = i d [ i ] = min ( d [ i ] , next - i ) return d   print ( * solve ( ) )   NEW_LINE", "from bisect import bisect_left as blt = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) q , l = [ ] , [ 0 ] * tfor i in range ( t ) : if a [ i ] == 0 : q . append ( i ) r = len ( q ) for i in range ( t ) : if a [ i ] != 0 : p = bl ( q , i ) if p == 0 : l [ i ] = q [ 0 ] - i elif p == r : l [ i ] = i - q [ - 1 ] else : l [ i ] = min ( i - q [ p - 1 ] , q [ p ] - i ) print ( * l ) NEW_LINE", "from array import * n = int ( input ( ) ) ar = list ( map ( int , input ( ) . split ( ) ) ) dist1 = [ ] dist2 = [ ] for i in range ( n ) : dist1 . append ( 0 ) dist2 . append ( 0 )   st = nfor i in range ( n ) : if ar [ i ] != 0 : dist1 [ i ] = st else : st = 0 st += 1 st = nar . reverse ( ) for i in range ( n ) : if ar [ i ] != 0 : dist2 [ i ] = st else : st = 0 st += 1 dist2 . reverse ( ) for i in range ( n ) : m = min ( dist1 [ i ] , dist2 [ i ] ) print ( m , end = \" ▁ \" ) ; print ( \" \\n \" )   NEW_LINE" ]
codeforces_1104_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 . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskA { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int t = in . nextInt ( ) ; out . println ( t ) ; for ( int i = 0 ; i < t ; i ++ ) { out . print ( \"1 ▁ \" ) ; } }   } }  ", "import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int s = 0 ; System . out . println ( n ) ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . print ( 1 + \" ▁ \" ) ;    } System . out . println ( ) ; } }", "  import java . util . Scanner ;    public class num {   public static void main ( String [ ] args ) { Scanner Input = new Scanner ( System . in ) ; int n = 0 ; n = Input . nextInt ( ) ; System . out . println ( n ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( \"1 ▁ \" ) ; }    } }" ]
[ "def main ( ) : n = int ( input ( ) ) print ( f ' { n } \\n { \" ▁ \" . join ( [ \" 1 \" ▁ for ▁ _ ▁ in ▁ range ( n ) ] ) } ' )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "import sys   def main ( ) : n = int ( sys . stdin . read ( ) . strip ( ) ) for i in range ( 9 , 0 , - 1 ) : if not n % i : return n // i , ( n // i * f ' { i } ▁ ' ) . strip ( )   print ( * main ( ) , sep = ' \\n ' ) NEW_LINE", "a = int ( input ( ) ) print ( a ) print ( * ( [ 1 ] * a ) ) NEW_LINE", "def rec ( n , z , l , x , y ) : if n > z : return l elif n == z : l . append ( n ) return l else : if n not in l : l . append ( n ) rec ( n * x , z , l , x , y ) rec ( n * y , z , l , x , y )     def gcd ( x , y ) : if x < y : x , y = y , x if y == 0 : return x return gcd ( y , x % y )     def lcm ( x , y ) : if x < y : x , y = y , x gcd_ = gcd ( x , y ) return x * y // gcd_     def main_func ( ) : output_list = [ ] t = int ( input ( ) ) return str ( t ) + \" \\n \" + \" ▁ \" . join ( [ str ( 1 ) for i in range ( t ) ] )     print ( main_func ( ) )       NEW_LINE" ]
codeforces_741_B
[ "import java . util . * ; import java . io . * ; import java . io . BufferedReader ;   public class Z_A { public static long mod = 1000000007 ; public static Debug db ;   public static void main ( String [ ] args ) throws IOException { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; Autocompletion solver = new Autocompletion ( ) ; db = new Debug ( System . getSecurityManager ( ) == null ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Autocompletion {   public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int w = in . nextInt ( ) ; int warr [ ] = in . nextIntArr ( n ) ; int b [ ] = in . nextIntArr ( n ) ; UnionFind uf = new UnionFind ( n ) ; for ( int i = 0 ; i < m ; i ++ ) { int x = in . nextInt ( ) - 1 ; int y = in . nextInt ( ) - 1 ; uf . combine ( x , y ) ;", "import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ; Student ( int x , int y ) { this . x = x ; this . y = y ;", "import java . util . * ; import java . io . * ;   public class b { static int [ ] parent , rank , weight , beauty , wt , bt ; static List < Integer > [ ] al ;   static void merge ( int a , int b ) { int u = find ( a ) ; int v = find ( b ) ; if ( u == v ) return ;   if ( rank [ u ] >= rank [ v ] ) { parent [ v ] = u ; beauty [ u ] += beauty [ v ] ; weight [ u ] += weight [ v ] ; } else { parent [ u ] = v ; beauty [ v ] += beauty [ u ] ; weight [ v ] += weight [ u ] ; } }   static int find ( int k ) { if ( parent [ k ] != k ) parent [ k ] = find ( parent [ k ] ) ; return parent [ k ] ; }   static long f ( List < Integer > list , int n , int w , long [ ] [ ] dp ) { if ( w < 0 ) return Integer . MIN_VALUE ; if ( n == 0 ) return 0 ; if ( dp [ n ] [ w ] != - 1 ) return dp [ n ] [ w ] ;   long a = f ( list , n - 1 , w , dp ) ;" ]
[ "import math , sys , bisect , heapq , osfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulatefrom functools import lru_cache NEW_LINE", "def ler ( ) : return [ int ( x ) for x in input ( ) . split ( ) ]   def dfs ( u , adj , visited , s , Pesos , Belezas ) : visited [ u ] = True total_p = Pesos [ u ] total_b = Belezas [ u ] s . append ( u ) for v in adj [ u ] : if not visited [ v ] : w , b = dfs ( v , adj , visited , s , Pesos , Belezas ) total_p += w total_b += b return total_p , total_b n , m , w = ler ( ) Pesos = ler ( ) Belezas = ler ( ) adj = [ [ ] for _ in range ( n ) ] for _ in range ( m ) : x , y = ler ( ) x -= 1 y -= 1 adj [ x ] . append ( y ) adj [ y ] . append ( x ) visited = [ False ] * nf = [ 0 ] * ( w + 1 ) for i in range ( n ) : if visited [ i ] : continue   s = [ ] total_p , total_b = dfs ( i , adj , visited , s , Pesos , Belezas ) for j in range ( w , - 1 , - 1 ) : jw = j + total_p if jw <= w : f [ jw ] = max ( f [ jw ] , f [ j ] + total_b ) for v in s : jw = j + Pesos [ v ] if jw <= w : f [ jw ] = max ( f [ jw ] , f [ j ] + Belezas [ v ] ) print ( f [ w ] )   NEW_LINE", "n , m , k = map ( int , input ( ) . split ( ) ) a = map ( int , input ( ) . split ( ) ) b = map ( int , input ( ) . split ( ) ) ab = [ ( 0 , 0 ) ] + list ( zip ( a , b ) ) l = list ( range ( n + 1 ) )   def f ( x ) : if x == l [ x ] : return x l [ x ] = f ( l [ x ] ) return l [ x ] for i in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) x , y = f ( x ) , f ( y ) if x != y : l [ y ] = x p = [ [ ] for j in range ( n + 1 ) ] for i in range ( 1 , n + 1 ) : p [ f ( i ) ] . append ( i ) r = ( k + 1 ) * [ 0 ] r [ 0 ] = 1 for i in p : if len ( i ) > 1 : l = [ ab [ x ] for x in i ] x0 = sum ( x [ 0 ] for x in l ) x1 = sum ( x [ 1 ] for x in l ) l . append ( ( x0 , x1 ) ) l . sort ( ) for j in range ( k , - 1 , - 1 ) : if r [ j ] : for w , b in l : if j + w > k : break r [ j + w ] = max ( r [ j + w ] , r [ j ] + b ) elif len ( i ) == 1 : w , b = ab [ i [ 0 ] ] for j in range ( k - w , - 1 , - 1 ) : if r [ j ] : r [ j + w ] = max ( r [ j + w ] , r [ j ] + b ) res = max ( r ) - 1 print ( res ) NEW_LINE" ]
codeforces_955_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 . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { static int maxn = 110 ; static int cnt [ ] = new int [ maxn ] ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) cnt [ s . charAt ( i ) - ' a ' ] ++ ; int flag = 0 , flag2 = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( cnt [ i ] > 1 ) flag ++ ; if ( cnt [ i ] >= 1 ) flag2 ++ ; } if ( flag2 > 4 ) System . out . println ( \" No \" ) ; else if ( flag >= 2 || flag2 > 3 || ( flag == 1 && flag2 >= 3 ) ) System . out . println ( \" Yes \" ) ; else System . out . println ( \" No \" ) ; } }" ]
[ "from collections import Counter     def has_beautiful_splits ( s ) : counter = Counter ( s ) if len ( counter ) == 4 : return True elif len ( counter ) == 3 : return max ( counter . values ( ) ) > 1 elif len ( counter ) == 2 : return min ( counter . values ( ) ) > 1 return False     s = input ( ) print ( \" Yes \" if has_beautiful_splits ( s ) else \" No \" ) NEW_LINE", "from collections import Counters = input ( ) A = [ char for char in s ]   A . sort ( ) c = Counter ( A ) if len ( c . keys ( ) ) > 4 : print ( \" No \" ) elif len ( c . keys ( ) ) == 4 : print ( \" Yes \" ) elif len ( c . keys ( ) ) == 3 : z = list ( c . values ( ) ) if z == [ 1 , 1 , 1 ] : print ( \" No \" ) else : print ( \" Yes \" ) elif len ( c . keys ( ) ) == 2 : z = list ( c . values ( ) ) if 1 in z : print ( \" No \" ) else : print ( \" Yes \" ) else : print ( \" No \" ) NEW_LINE", "def adorable ( text ) : counter = { } for i in text : if i not in counter : counter [ i ] = 1 else : counter [ i ] += 1 n = len ( counter . keys ( ) ) if n == 1 : return \" No \" elif n == 2 : if all ( counter [ i ] >= 2 for i in counter ) : return \" Yes \" else : return \" No \" elif n == 3 : if any ( counter [ i ] >= 2 for i in counter ) : return \" Yes \" else : return \" No \" elif n == 4 : return \" Yes \" else : return \" No \"   print ( adorable ( input ( ) ) ) NEW_LINE", "from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) from collections import Counterlst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : s = input ( ) n = len ( s ) d = Counter ( s ) f = 1 ; cnt = 0 for k , v in d . items ( ) : if v == 1 : cnt += 1 if ( len ( d ) == 2 and cnt == 0 ) : print ( ' YES ' ) elif ( 3 == len ( d ) and cnt <= 2 ) : print ( ' YES ' ) elif ( len ( d ) == 4 ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE" ]
codeforces_1167_B
[ "import java . io . IOException ; import java . util . Scanner ;   public class Main { static Scanner in = new Scanner ( System . in ) ; public static void main ( String [ ] args ) throws IOException { int a2 = query ( 1 , 2 ) ; int a3 = query ( 1 , 3 ) ; int a4 = query ( 1 , 4 ) ; int a5 = query ( 1 , 5 ) ; int a1 = gcd ( gcd ( a2 , a3 ) , gcd ( a4 , a5 ) ) ; if ( a1 == 15 * 2 || a1 == 23 * 2 ) { a1 /= 2 ; } a2 /= a1 ; a3 /= a1 ; a4 /= a1 ; a5 /= a1 ; int a6 = 4 + 8 + 15 + 16 + 23 + 42 - a1 - a2 - a3 - a4 - a5 ; System . out . println ( \" ! ▁ \" + a1 + \" ▁ \" + a2 + \" ▁ \" + a3 + \" ▁ \" + a4 + \" ▁ \" + a5 + \" ▁ \" + a6 ) ; } public static int query ( int i , int j ) { System . out . println ( \" ? ▁ \" + i + \" ▁ \" + j ) ; System . out . flush ( ) ; return in . nextInt ( ) ; } public static int gcd ( int a , int b ) { return b == 0 ? a : gcd ( b , a % b ) ; } }" ]
[ "from itertools import permutationsprint ( ' ? ▁ 1 ▁ 2' ) print ( ' ? ▁ 2 ▁ 3' ) print ( ' ? ▁ 3 ▁ 4' ) print ( ' ? ▁ 4 ▁ 5' ) ab = int ( input ( ) ) bc = int ( input ( ) ) cd = int ( input ( ) ) de = int ( input ( ) )   s = [ 4 , 8 , 15 , 16 , 23 , 42 ] for l in permutations ( s ) : if l [ 0 ] * l [ 1 ] == ab and l [ 1 ] * l [ 2 ] == bc and l [ 2 ] * l [ 3 ] == cd and l [ 3 ] * l [ 4 ] == de : print ( f ' ! ▁ { l [ 0 ] } ▁ { l [ 1 ] } ▁ { l [ 2 ] } ▁ { l [ 3 ] } ▁ { l [ 4 ] } ▁ { l [ 5 ] } ' ) NEW_LINE", "''' bsdchodi ▁ ques better ▁ to ▁ take ▁ 1 ▁ element ▁ common ▁ in ▁ all ▁ and ▁ just ▁ find ▁ it   '''       l = [ 4 , 8 , 15 , 16 , 23 , 42 ] print ( ' ? ' , 1 , 5 ) a = int ( input ( ) ) print ( ' ? ' , 2 , 5 ) b = int ( input ( ) ) print ( ' ? ' , 3 , 5 ) c = int ( input ( ) ) print ( ' ? ' , 4 , 5 ) d = int ( input ( ) ) l = l [ : : - 1 ] v = 0 for i in range ( 0 , len ( l ) ) : if a // l [ i ] in l and b // l [ i ] in l and c // l [ i ] in l and d // l [ i ] in l : v = l [ i ] breakm = [ ] m . append ( a // v ) m . append ( b // v ) m . append ( c // v ) m . append ( d // v ) m . append ( v ) o = list ( set ( l ) - set ( m ) ) m = m + oprint ( ' ! ' , * m ) NEW_LINE", "from math import gcdans = [ ] print ( ' ? ▁ 1 ▁ 2' , flush = True ) a = int ( input ( ) ) print ( ' ? ▁ 1 ▁ 3' , flush = True ) b = int ( input ( ) ) print ( ' ? ▁ 1 ▁ 4' , flush = True ) c = int ( input ( ) ) print ( ' ? ▁ 1 ▁ 5' , flush = True ) d = int ( input ( ) ) ans . append ( gcd ( gcd ( a , b ) , gcd ( c , d ) ) ) if ans [ 0 ] in [ 2 * 15 , 2 * 23 ] : ans [ 0 ] //= 2 ans . append ( a // ans [ 0 ] ) ans . append ( b // ans [ 0 ] ) ans . append ( c // ans [ 0 ] ) ans . append ( d // ans [ 0 ] ) ans . append ( [ x for x in [ 4 , 8 , 15 , 16 , 23 , 42 ] if x not in ans ] [ 0 ] ) print ( ' ! ' , * ans ) NEW_LINE", "import sysimport mathimport itertools def ask ( l , r ) : print ( ' ? ' , l , r ) sys . stdout . flush ( ) n = int ( input ( ) ) return n def answer ( lst ) : print ( ' ! ' , * lst ) jury = [ 4 , 8 , 15 , 16 , 23 , 42 ] perm = list ( itertools . permutations ( jury ) ) ab = ask ( 1 , 2 ) bc = ask ( 2 , 3 ) cd = ask ( 3 , 4 ) de = ask ( 4 , 5 ) for a , b , c , d , e , f in perm : if a * b == ab and b * c == bc and c * d == cd and d * e == de : answer ( [ a , b , c , d , e , f ] ) NEW_LINE" ]
codeforces_1313_A
[ "  import java . util . Arrays ; import java . util . Scanner ;   public class task1 { static Scanner scanner = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { int food [ ] = new int [ 3 ] ; int n = scanner . nextInt ( ) ; for ( int j = 0 ; j < n ; j ++ ) { for ( int i = 0 ; i < 3 ; i ++ ) { food [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( food ) ; if ( food [ 0 ] == 0 ) { if ( food [ 1 ] == 0 && food [ 2 ] == 0 ) System . out . println ( 0 ) ; else if ( food [ 1 ] == 0 && food [ 2 ] >= 1 ) System . out . println ( 1 ) ; else if ( food [ 1 ] == 1 && food [ 2 ] >= 1 ) System . out . println ( 2 ) ; else if ( food [ 1 ] > 1 && food [ 2 ] > 1 ) System . out . println ( 3 ) ; } else if ( food [ 0 ] == 1 && food [ 1 ] == 1 && food [ 2 ] >= 1 ) System . out . println ( 3 ) ; else if ( ( food [ 0 ] == 1 && food [ 1 ] >= 2 && food [ 2 ] >= 2 ) || ( food [ 0 ] == 2 && food [ 1 ] == 2 && food [ 2 ] == 2 ) ) System . out . println ( 4 ) ; else if ( food [ 0 ] == 2 && food [ 1 ] >= 2 && food [ 2 ] > 2 ) System . out . println ( 5 ) ; else if ( food [ 0 ] == 3 && food [ 1 ] >= 3 && food [ 2 ] >= 3 ) System . out . println ( 6 ) ; else System . out . println ( 7 ) ;   } } }", "import java . util . Scanner ;   public class FastFoodRestaurant { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int testCase = scanner . nextInt ( ) ; while ( ( testCase -- ) != 0 ) { int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; if ( b > a ) { int tmp = a ; a = b ; b = tmp ; } if ( c > a ) { int tmp = a ; a = c ; c = tmp ; } if ( c > b ) { int tmp = c ; c = b ; b = tmp ; }   int cnt = 0 ; if ( a != 0 ) { -- a ; ++ cnt ; } if ( b != 0 ) { -- b ; ++ cnt ; } if ( c != 0 ) { -- c ; ++ cnt ; } if ( a != 0 && b != 0 ) { ++ cnt ; -- a ; -- b ; } if ( a != 0 && c != 0 ) { ++ cnt ; -- a ; -- c ; } if ( b != 0 && c != 0 ) { ++ cnt ; -- b ; -- c ; } if ( a != 0 && b != 0 && c != 0 ) { ++ cnt ; -- a ; -- b ; -- c ; }   System . out . println ( cnt ) ; }   }   }", "import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class Codeforces { public static void main ( String args [ ] ) throws FileNotFoundException , IOException { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t -- > 0 ) { int arr [ ] = new int [ 3 ] ; arr [ 0 ] = scan . nextInt ( ) ; arr [ 1 ] = scan . nextInt ( ) ; arr [ 2 ] = scan . nextInt ( ) ; Arrays . sort ( arr ) ; int count = 0 ; if ( arr [ 0 ] > 0 || arr [ 1 ] > 0 || arr [ 2 ] > 0 ) { if ( arr [ 0 ] > 0 ) { arr [ 0 ] -- ; count ++ ; } if ( arr [ 1 ] > 0 ) { arr [ 1 ] -- ; count ++ ; } if ( arr [ 2 ] > 0 ) { arr [ 2 ] -- ; count ++ ; } } if ( arr [ 2 ] > 0 && arr [ 1 ] > 0 ) { arr [ 2 ] -- ; arr [ 1 ] -- ; count += 1 ; } if ( arr [ 2 ] > 0 && arr [ 0 ] > 0 ) { arr [ 2 ] -- ; arr [ 0 ] -- ; count += 1 ; } if ( arr [ 1 ] > 0 && arr [ 0 ] > 0 ) { arr [ 1 ] -- ; arr [ 0 ] -- ; count += 1 ; } if ( arr [ 2 ] > 0 && arr [ 1 ] > 0 && arr [ 0 ] > 0 ) { arr [ 2 ] -- ; arr [ 1 ] -- ; arr [ 0 ] -- ; count += 1 ; } System . out . println ( count ) ; } } }", "import java . util . * ; public class fastfoodrestaurant { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 1 ; i <= t ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int count = 0 ; int A [ ] = { 1 , 0 , 0 , 1 , 1 , 0 , 1 } ; int B [ ] = { 0 , 1 , 0 , 1 , 0 , 1 , 1 } ; int C [ ] = { 0 , 0 , 1 , 0 , 1 , 1 , 1 } ; if ( c > a ) { int k = c ; c = a ; a = k ; } for ( int j = 0 ; j <= 6 ; j ++ ) { if ( a - A [ j ] >= 0 && b - B [ j ] >= 0 && c - C [ j ] >= 0 ) { a = a - A [ j ] ; b = b - B [ j ] ; c = c - C [ j ] ; count ++ ; } } System . out . println ( count ) ; } } }" ]
[ "def solve ( a , b , c ) : slist = [ a , b , c ] slist . sort ( ) a , b , c = slist mlist = [ ( 0 , 0 , 1 ) , ( 0 , 1 , 0 ) , ( 1 , 0 , 0 ) , ( 0 , 1 , 1 ) , ( 1 , 0 , 1 ) , ( 1 , 1 , 0 ) , ( 1 , 1 , 1 ) ] cnt = 0   for da , db , dc in mlist : if a >= da and b >= db and c >= dc : a -= da b -= db c -= dc cnt += 1   return cnt   if __name__ == ' _ _ main _ _ ' : T = int ( input ( ) ) for t in range ( T ) : a , b , c = tuple ( map ( int , input ( ) . split ( ) ) ) print ( solve ( a , b , c ) ) NEW_LINE", "import mathimport operator   def lcm ( a , b ) : return ( a / math . gcd ( a , b ) ) * b def nCr ( n , r ) : return ( ( math . factorial ( n ) ) / ( ( math . factorial ( r ) ) * ( math . factorial ( n - r ) ) ) )     def isKthBitSet ( n , k ) : if ( n & ( 1 << ( k - 1 ) ) ) : return True else : return Falsedef maximalRectangle ( matrix ) : if not matrix or not matrix [ 0 ] : return 0 n = len ( matrix [ 0 ] ) height = [ 0 ] * ( n + 1 ) ans = 0 for row in matrix : for i in range ( n ) : height [ i ] = height [ i ] + 1 if row [ i ] == '0' else 0 stack = [ - 1 ] for i in range ( n + 1 ) : while height [ i ] < height [ stack [ - 1 ] ] : h = height [ stack . pop ( ) ] w = i - 1 - stack [ - 1 ] ans = max ( ans , h * w ) stack . append ( i ) return ans     def matched ( str ) : count = 0 for i in str : if i == \" ( \" : count += 1 elif i == \" ) \" : count -= 1 if count < 0 : return False return count == 0   def isValid ( h , m , nh , nm ) : l = [ 0 , 1 , 5 , - 1 , - 1 , 2 , - 1 , - 1 , 8 , - 1 ] if ( l [ h // 10 ] == - 1 or l [ h % 10 ] == - 1 or l [ m // 10 ] == - 1 or l [ m % 10 ] == - 1 ) : return False resh = l [ m % 10 ] * 10 + l [ m // 10 ] resm = l [ h % 10 ] * 10 + l [ h // 10 ]   return ( resh < nh and resm < nm )       def solve ( ) :   a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE", "test_number = int ( input ( ) )   for i in range ( test_number ) : dishes = sorted ( list ( map ( int , input ( ) . split ( ) ) ) , reverse = True )   visitor = 0   for i in range ( len ( dishes ) ) : if dishes [ i ] > 0 : dishes [ i ] -= 1 visitor += 1   for j in range ( 2 ) : for i in range ( 1 , 3 ) : if dishes [ j ] > 0 and dishes [ i ] > 0 and i > j : dishes [ j ] -= 1 dishes [ i ] -= 1 visitor += 1   if dishes [ 0 ] > 0 and dishes [ 1 ] > 0 and dishes [ 2 ] > 0 : visitor += 1   print ( visitor ) NEW_LINE", "T_ON = 1 DEBUG_ON = 0 MOD = 998244353     def solve ( ) : A = read_ints ( ) A . sort ( ) a , b , c = A total = 0 NEW_LINE", "cases = int ( input ( ) ) while cases : cases -= 1 a , b , c = sorted ( map ( int , input ( ) . split ( ) ) , reverse = True ) ans = 0   if a : a -= 1 ans += 1 if b : b -= 1 ans += 1 if c : c -= 1 ans += 1 if a and b : a -= 1 b -= 1 ans += 1 if a and c : a -= 1 c -= 1 ans += 1 if c and b : c -= 1 b -= 1 ans += 1 if a and b and c : ans += 1   print ( ans ) NEW_LINE" ]
codeforces_344_A
[ "import java . util . Scanner ; public class CF800 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; int counter = 0 ; int counter2 = 1 ; int [ ] y = new int [ x ] ; for ( int i = 0 ; i < y . length ; i ++ ) { y [ i ] = input . nextInt ( ) ; counter ++ ; } for ( int c = 0 ; c < counter - 1 ; c ++ ) { if ( y [ c ] != y [ c + 1 ] ) { counter2 ++ ; } } System . out . println ( counter2 ) ; } }", "import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int n = in . nextInt ( ) ;   int g = 0 ; int prev = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { int m = in . nextInt ( ) ; if ( m != prev ) { g ++ ; prev = m ; } }   System . out . println ( g ) ; } }", "import java . util . * ; public class magnets { 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 m = sc . nextInt ( ) ; if ( m != c ) { c = m ; d ++ ; } } System . out . println ( d ) ; } }", "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 ( ) ; String [ ] arr = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . next ( ) ; } int cnt = 1 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ! ( arr [ i ] . equals ( arr [ i + 1 ] ) ) ) { cnt ++ ; } } System . out . println ( cnt ) ; } }", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AMagnets solver = new AMagnets ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class AMagnets { public void solve ( int testNumber , FastScanner fs , PrintWriter out ) { int n = fs . nextInt ( ) ; int rep = 0 ; String p = fs . next ( ) , t ; for ( int i = 1 ; i < n ; i ++ ) { t = fs . next ( ) ; if ( t . charAt ( 0 ) == p . charAt ( 1 ) ) { rep ++ ; } p = t ; } rep ++ ; out . println ( rep ) ; }   }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }  " ]
[ "def function ( Str , X ) : import itertools Lst = [ ] for i , j in itertools . groupby ( Str ) : if i == X : Lst . append ( len ( list ( j ) ) ) return Lst N = int ( input ( ) ) Lst1 = [ ] for _ in range ( N ) : Str = input ( ) Lst1 . append ( Str ) NStr1 = \" \" . join ( Lst1 )   NStr = NStr1 . replace ( \"10\" , \" P \" ) NStr2 = NStr . replace ( \"01\" , \" Q \" )       Val = len ( function ( NStr2 , \" P \" ) )   Val1 = len ( function ( NStr2 , \" Q \" ) )   print ( Val + Val1 ) NEW_LINE", "\"\"\" n = input ( ) . strip ( ) m = input ( ) . strip ( ) s = n [ : : -1 ] if ▁ s = = m : ▁ ▁ ▁ ▁ print ( \" YES \" ) else : ▁ ▁ ▁ ▁ print ( \" NO \" )  n = int ( input ( ) ) s = input ( ) . strip ( ) if ▁ s . count ( ' A ' ) > s . count ( ' D ' ) : ▁ ▁ ▁ ▁ print ( \" Anton \" ) elif ▁ s . count ( ' A ' ) < s . count ( ' D ' ) : ▁ ▁ ▁ ▁ print ( \" Danik \" ) else : ▁ ▁ ▁ ▁ print ( \" Friendship \" ) \"\"\" \"\"\" n = input ( ) . strip ( ) if ▁ ' H ' ▁ in ▁ n ▁ or ▁ ' Q ' ▁ in ▁ n ▁ or ▁ ' 9 ' ▁ in ▁ n : ▁ ▁ ▁ ▁ print ( \" YES \" ) else : ▁ ▁ ▁ ▁ print ( \" NO \" ) \"\"\" \"\"\" n , h = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) c = 0for ▁ i ▁ in ▁ a : ▁ ▁ ▁ ▁ if ▁ i > h : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ c = c + 2 ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ c = c + 1print ( c ) \"\"\" \"\"\" c = 0for ▁ i ▁ in ▁ range ( int ( input ( ) ) ) : ▁ ▁ ▁ ▁ p , q = map ( int , input ( ) . split ( ) ) ▁ ▁ ▁ ▁ if ▁ ( q - p ) > = 2 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ c = c + 1print ( c ) \"\"\" p = [ ] c = 1 for i in range ( int ( input ( ) ) ) : s = input ( ) p . append ( s ) if len ( p ) == 1 : print ( 1 ) else : for i in range ( len ( p ) - 1 ) : if p [ i ] != p [ i + 1 ] : c = c + 1 print ( c ) NEW_LINE", "n = int ( input ( ) ) poles = [ ] for _ in range ( n ) : poles . append ( input ( ) ) num_groups = 1 for i in range ( n - 1 ) : if not int ( poles [ i ] [ 1 ] ) ^ int ( poles [ i + 1 ] [ 0 ] ) : num_groups += 1 print ( num_groups ) NEW_LINE", "n = int ( input ( ) ) c = 1 for i in range ( n ) : if i == 0 : new = input ( ) continue old = new new = input ( ) if old [ 1 ] == new [ 0 ] : c += 1 print ( c ) NEW_LINE", "n = int ( input ( ) ) current = input ( ) c = 1 for _ in range ( 1 , n ) : x = input ( ) if current != x : c += 1 current = xprint ( c ) NEW_LINE" ]
codeforces_660_B
[ "import java . io . * ; import java . math . * ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = Long . 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 = 300005 ; private static final int MAXA = 100007 ; private static final int MAXLOG = 22 ;   public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;", "import java . util . Scanner ;   public class Main {    public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ;   int n = in . nextInt ( ) ;   int m = in . nextInt ( ) ;   for ( int i = 1 ; i <= 2 * n ; i ++ ) { int a = 2 * n + i ;   if ( a <= m ) System . out . println ( a ) ; if ( i <= m ) System . out . println ( i ) ; } } }" ]
[ "n , m = map ( int , input ( ) . split ( ) ) arr = [ [ 0 , 0 , 0 , 0 ] for i in range ( n ) ]   i = 1 pos = 0 while 1 : if i > m or pos == n : break if i <= m : arr [ pos ] [ 0 ] = i i += 1 if i <= m : arr [ pos ] [ 3 ] = i i += 1 pos += 1   pos = 0 while 1 : if i > m or pos == n : break if i <= m : arr [ pos ] [ 1 ] = i i += 1 if i <= m : arr [ pos ] [ 2 ] = i i += 1 pos += 1       for i in arr : if i [ 1 ] : print ( i [ 1 ] , end = \" ▁ \" ) if i [ 0 ] : print ( i [ 0 ] , end = \" ▁ \" ) if i [ 2 ] : print ( i [ 2 ] , end = \" ▁ \" ) if i [ 3 ] : print ( i [ 3 ] , end = \" ▁ \" )   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", "n , m = input ( ) . split ( ) n , m = int ( n ) , int ( m ) temp = 1 groos = n * 2 + 1 while groos <= m : print ( groos , end = \" ▁ \" ) print ( temp , end = \" ▁ \" ) groos , temp = groos + 1 , temp + 1 while temp <= min ( n * 2 , m ) : print ( temp , end = \" ▁ \" ) temp += 1 NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a , b , c , d = [ ] , [ ] , [ ] , [ ] for i in range ( n ) : if 2 * i + 1 <= m : a . append ( 2 * i + 1 ) NEW_LINE" ]
codeforces_1430_B
[ "import java . util . Arrays ; import java . util . Scanner ;   public class B1430 {   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 ( ) ; Integer [ ] A = new Integer [ N ] ; for ( int n = 0 ; n < N ; n ++ ) { A [ n ] = in . nextInt ( ) ; } Arrays . sort ( A ) ; long answer = 0 ; for ( int n = 1 ; n <= K + 1 ; n ++ ) { answer += A [ N - n ] ; } System . out . println ( answer ) ; } }   }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Collections ;   public class barrels { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < t ; i ++ ) { int [ ] rong0 = Arrays . stream ( br . readLine ( ) . split ( \" \\\\ s \" ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int [ ] rong = Arrays . stream ( br . readLine ( ) . split ( \" \\\\ s \" ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int n = rong0 [ 0 ] , k = rong0 [ 1 ] ; Integer [ ] newArray = new Integer [ rong . length ] ; int x = 0 ; for ( int value : rong ) { newArray [ x ++ ] = Integer . valueOf ( value ) ; } Arrays . sort ( newArray , Collections . reverseOrder ( ) ) ; long sum = 0 ; for ( int d = 0 ; d <= k ; d ++ ) { sum += newArray [ d ] ; } System . out . println ( sum ) ; } }   }" ]
[ "for i in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) NEW_LINE lis = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE temp = 0 NEW_LINE rr = sorted ( lis , reverse = True ) NEW_LINE for i in range ( k + 1 ) : temp += rr [ i ] NEW_LINE print ( temp ) NEW_LINE", "for i in range ( int ( input ( ) ) ) : n , k = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( sum ( sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) [ : : - 1 ] [ : k + 1 ] ) ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE for j in range ( t ) : a , b = map ( int , input ( ) . split ( ' ▁ ' ) ) NEW_LINE k = list ( map ( int , input ( ' ' ) . split ( ' ▁ ' ) ) ) NEW_LINE if k . count ( 0 ) == a : NEW_LINE INDENT print ( 0 ) else : NEW_LINE k = sorted ( k ) NEW_LINE DEDENT z = max ( k ) NEW_LINE for i in range ( 1 , b + 1 ) : z += k [ a - 1 - i ] NEW_LINE print ( z ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A . sort ( ) NEW_LINE print ( sum ( A [ - k - 1 : ] ) ) NEW_LINE" ]
codeforces_259_B
[ "import java . util . * ; public class LittleElephantandMagicSquare { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; long sum = 0 ;   for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { arr [ i ] [ j ] = sc . nextInt ( ) ; sum += arr [ i ] [ j ] ; } }   sum /= 2 ;   arr [ 0 ] [ 0 ] = ( int ) sum - arr [ 0 ] [ 1 ] - arr [ 0 ] [ 2 ] ; arr [ 1 ] [ 1 ] = ( int ) sum - arr [ 1 ] [ 0 ] - arr [ 1 ] [ 2 ] ; arr [ 2 ] [ 2 ] = ( int ) sum - arr [ 2 ] [ 0 ] - arr [ 2 ] [ 1 ] ;   System . out . println ( ) ;   for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { System . out . print ( arr [ i ] [ j ] + \" ▁ \" ) ; } System . out . println ( ) ; }      } }", "import java . util . * ; public class Practice { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int i , j , sum = 0 ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; for ( i = 0 ; i < 3 ; ++ i ) for ( j = 0 ; j < 3 ; ++ j ) { a [ i ] [ j ] = scan . nextInt ( ) ; sum += a [ i ] [ j ] ; } a [ 0 ] [ 0 ] = sum / 2 - ( a [ 1 ] [ 0 ] + a [ 2 ] [ 0 ] ) ; a [ 1 ] [ 1 ] = sum / 2 - ( a [ 0 ] [ 1 ] + a [ 2 ] [ 1 ] ) ; a [ 2 ] [ 2 ] = sum / 2 - ( a [ 0 ] [ 2 ] + a [ 1 ] [ 2 ] ) ; for ( i = 0 ; i < 3 ; ++ i ) { System . out . println ( ) ; for ( j = 0 ; j < 3 ; ++ j ) System . out . print ( a [ i ] [ j ] + \" ▁ \" ) ; } } }  ", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {", "import java . util . * ; public class MagicSquare {   public static void main ( String [ ] args ) {" ]
[ "a , b , c = map ( int , input ( ) . split ( ) ) d , e , f = map ( int , input ( ) . split ( ) ) g , h , i = map ( int , input ( ) . split ( ) )   sum1 = a + b + csum2 = d + e + fsum3 = g + h + ia = ( sum1 + sum2 + sum3 ) // 2 - ( sum1 ) e = ( sum1 + sum2 + sum3 ) // 2 - ( sum2 ) i = ( sum1 + sum2 + sum3 ) // 2 - ( sum3 ) print ( a , b , c ) print ( d , e , f ) print ( g , h , i )           NEW_LINE", "\"\"\" ▁ ▁ ▁ ▁ https : / / codeforces . com / problemset / problem / 259 / B \"\"\" import fileinput   def sommeColonne ( t , col ) : res = 0 for i in range ( 3 ) : res += t [ i ] [ col ] return res   def sommeLigne ( t , lig ) : res = 0 for i in range ( 3 ) : res += t [ lig ] [ i ] return res   def sommeDiag1 ( t ) : return t [ 0 ] [ 0 ] + t [ 1 ] [ 1 ] + t [ 2 ] [ 2 ]   def sommeDiag2 ( t ) : return t [ 0 ] [ 2 ] + t [ 1 ] [ 1 ] + t [ 2 ] [ 0 ]   def valide ( v ) : return v >= 1 and v <= 100000   def cherche ( t ) : \"\"\" ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Recherche ▁ par ▁ force ▁ brute . . . ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Un ▁ candidat ▁ est ▁ un ▁ triplet ▁ de ▁ nombres ▁ ( la ▁ diagonale ) . ▁ ▁ ▁ ▁ \"\"\" NEW_LINE", "x = [ ] s = 0 for i in range ( 3 ) : y = list ( map ( int , input ( ) . split ( ) ) ) x . append ( y ) s += sum ( y ) s = s // 2 x [ 0 ] [ 0 ] = s - x [ 0 ] [ 1 ] - x [ 0 ] [ 2 ] x [ 1 ] [ 1 ] = s - x [ 1 ] [ 0 ] - x [ 1 ] [ 2 ] x [ 2 ] [ 2 ] = s - x [ 2 ] [ 0 ] - x [ 2 ] [ 1 ] for i in x : for j in i : print ( j , end = \" ▁ \" ) print ( \" \" ) NEW_LINE", "a = [ ] for i in range ( 3 ) : x = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) a . append ( x ) x = ( a [ 0 ] [ 1 ] + a [ 0 ] [ 2 ] + a [ 1 ] [ 0 ] + a [ 1 ] [ 2 ] + a [ 2 ] [ 1 ] + a [ 2 ] [ 0 ] ) // 2   a [ 0 ] [ 0 ] = x - ( a [ 0 ] [ 1 ] + a [ 0 ] [ 2 ] ) a [ 1 ] [ 1 ] = x - ( a [ 1 ] [ 0 ] + a [ 1 ] [ 2 ] ) a [ 2 ] [ 2 ] = x - ( a [ 2 ] [ 1 ] + a [ 2 ] [ 0 ] ) for i in range ( 3 ) : for j in range ( 3 ) : print ( a [ i ] [ j ] , end = \" ▁ \" ) print ( ) NEW_LINE" ]
codeforces_1372_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class CF1372_D2_B { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int t = scanner . nextInt ( ) ; StringBuilder out = new StringBuilder ( ) ; for ( int i = 0 ; i < t ; i ++ ) { solve ( scanner , out ) ; } System . out . print ( out ) ; }   private static void solve ( FastScanner scanner , StringBuilder out ) { int n = scanner . nextInt ( ) ;", "import java . awt . Desktop ;   import java . io . BufferedReader ;    import java . io . IOException ; import java . io . InputStreamReader ; 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 ; }   }   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 . * ; import java . math . BigInteger ; import java . util . * ;    public class test1 {   static long getLCM ( int a , int b ) { int bigger = 0 , smaller = 0 ; if ( a > b ) { bigger = a ; smaller = b ; } else { bigger = b ; smaller = a ; }   if ( bigger % smaller == 0 ) return bigger ; long counter = 2 ; long num = bigger ; while ( num < Integer . MAX_VALUE ) { if ( ( num * counter ) % smaller == 0 ) { return num * counter ; } counter ++ ; } return ( long ) a * b ; }   public static void main ( String [ ] args ) throws IOException { long startTime = System . currentTimeMillis ( ) ; Reader sc = new Reader ( ) ; int t = sc . nextInt ( ) ; StringBuilder finalResult = new StringBuilder ( ) ;", "import java . util . Scanner ; import java . util . ArrayList ; import java . util . Collections ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- != 0 ) { long n = s . nextLong ( ) ; ArrayList < Long > list = new ArrayList < > ( ) ; for ( long i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { list . add ( i ) ; if ( n / i != i ) { list . add ( n / i ) ; } } } Collections . sort ( list ) ; long a = 0 , b = 0 , max = Long . MAX_VALUE ; for ( int i = 0 ; i < list . size ( ) - 1 ; i ++ ) {" ]
[ "def largest_factor ( n ) : if ( n % 3 == 0 ) : return n // 3 i = 5 while i ** 2 <= n : if ( n % i == 0 ) : return ( n // i ) if ( n % ( i + 2 ) ) == 0 : return n // ( i + 2 ) i += 6 return 1 def answer ( n ) : if n % 2 == 0 : return [ n // 2 , n // 2 ] NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) p = 0 for i in range ( 2 , int ( n ** 0.5 ) + 1 ) : if n % i == 0 : p = i break if p == 0 : p = n print ( n // p , n - ( n // p ) )   NEW_LINE", "from math import sqrtdef isPrime ( n ) : if ( n <= 1 ) : return False if ( n <= 3 ) : return True if ( n % 2 == 0 or n % 3 == 0 ) : return False i = 5 while ( i * i <= n ) : if ( n % i == 0 or n % ( i + 2 ) == 0 ) : return False i = i + 6 return True   def fun ( n ) : if n % 2 == 0 : return n // 2 , n // 2 elif isPrime ( n ) : return 1 , n - 1 else : for i in range ( 2 , n // 2 ) : if isPrime ( i ) and n % i == 0 : return n // i , n - ( n // i )   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) print ( * fun ( n ) ) NEW_LINE", "from sys import stdin , stdoutstdin . readlinedef mp ( ) : return list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) def it ( ) : return int ( stdin . readline ( ) . strip ( ) ) from collections import defaultdict as dd , Counter as C , dequefrom math import ceil , gcd   def factors ( n ) : s = set ( ) i = 2 while i * i <= n : if n % i == 0 : s . add ( i ) s . add ( n // i ) i += 1 return sorted ( list ( s ) )   for _ in range ( it ( ) ) : n = it ( ) x = factors ( n ) NEW_LINE", "from math import * t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) )   i = 2 res = n - 1 while i <= sqrt ( n ) : if n % i == 0 : res = n // i break i += 1   print ( res , n - res ) NEW_LINE" ]
codeforces_436_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ;   import java . util . * ; import javafx . util . Pair ;   public class Main { public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int k = input . nextInt ( ) ; int ans [ ] = new int [ m ] ; char a [ ] [ ] = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . next ( ) . toCharArray ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( a [ i ] [ j ] == ' U ' ) { if ( i % 2 == 0 ) ans [ j ] ++ ; } else if ( a [ i ] [ j ] == ' L ' ) { if ( j - i >= 0 ) { ans [ j - i ] ++ ; } } else if ( a [ i ] [ j ] == ' R ' ) { if ( j + i < m ) { ans [ j + i ] ++ ; } } } } for ( int an : ans ) { System . out . print ( an + \" ▁ \" ) ; } System . out . println ( \" \" ) ; }     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 ( ) ; } }   }" ]
[ "def solve ( ) : answer = [ 0 ] * m for i in range ( 1 , n ) : for j in range ( m ) : if j - i >= 0 : if park [ i ] [ j - i ] == ' R ' : answer [ j ] += 1 if j + i < m : if park [ i ] [ j + i ] == ' L ' : answer [ j ] += 1 if 2 * i < n : if park [ 2 * i ] [ j ] == ' U ' : answer [ j ] += 1 return answer   n , m , k = tuple ( map ( int , input ( ) . split ( ) ) ) park = [ input ( ) for i in range ( n ) ] print ( ' ▁ ' . join ( map ( str , solve ( ) ) ) ) NEW_LINE", "n , m , k = map ( int , input ( ) . split ( ) ) ans = [ 0 ] * m   for i in range ( n ) : field = input ( ) for j in range ( m ) : if ( field [ j ] == ' U ' ) and ( i % 2 == 0 ) : ans [ j ] += 1 elif ( field [ j ] == ' L ' ) and ( j >= i ) : ans [ j - i ] += 1 elif ( field [ j ] == ' R ' ) and ( j + i < m ) : ans [ j + i ] += 1   print ( ' ▁ ' . join ( map ( str , ans ) ) ) NEW_LINE", "n , m , k = map ( int , input ( ) . split ( ) ) seen = [ 0 for _ in range ( m ) ] for i in range ( n ) : S = list ( input ( ) ) for j in range ( m ) : if S [ j ] == ' U ' and not i & 1 : seen [ j ] += 1 elif S [ j ] == ' L ' and j - i >= 0 : seen [ j - i ] += 1 elif S [ j ] == ' R ' and j + i < m : seen [ j + i ] += 1 print ( * seen , sep = \" ▁ \" ) NEW_LINE" ]
codeforces_482_A
[ "import java . lang . * ; import java . util . * ; import java . io . * ;   public class pblm2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; List < Integer > al = new ArrayList < Integer > ( ) ; int i = 1 , c = n - k , end = n ; if ( k < n ) { if ( k == 1 ) { while ( i <= n ) { al . add ( i ++ ) ; } } else { while ( c > 0 ) { al . add ( i ++ ) ; c -- ; } while ( i <= end ) { if ( end != i ) al . add ( end -- ) ; al . add ( i ++ ) ; } } } else if ( k == 1 && n == 1 ) al . add ( i ) ; for ( int p : al ) System . out . print ( p + \" ▁ \" ) ; } }    ", "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 n = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; int start = 1 ; int end = k + 1 ; int i = 0 ; while ( i < n ) { if ( i <= k && i % 2 == 0 ) { System . out . print ( start + \" ▁ \" ) ; start ++ ; i ++ ; } else if ( i <= k && i % 2 != 0 ) { System . out . print ( end + \" ▁ \" ) ; end -- ; i ++ ; } else { System . out . print ( ( i + 1 ) + \" ▁ \" ) ; i ++ ; } } } }" ]
[ "n , k = [ int ( i ) for i in input ( ) . split ( ) ] if k == 2 : print ( 1 , 3 , 2 , end = \" ▁ \" ) for i in range ( 4 , n + 1 ) : print ( i , end = \" ▁ \" ) elif k % 2 == 0 : low = 1 high = n for i in range ( k - 1 ) : if i % 2 == 1 : print ( low , end = \" ▁ \" ) low += 1 else : print ( high , end = \" ▁ \" ) high -= 1 for i in range ( low , high + 1 ) : print ( i , end = \" ▁ \" ) else : low = 1 high = n for i in range ( k - 1 ) : if i % 2 == 0 : print ( low , end = \" ▁ \" ) low += 1 else : print ( high , end = \" ▁ \" ) high -= 1 for i in range ( low , high + 1 ) : print ( i , end = \" ▁ \" ) print ( ) NEW_LINE", "n , k = [ int ( i ) for i in input ( ) . split ( ) ] if k == 2 : print ( 1 , 3 , 2 , end = \" ▁ \" ) for i in range ( 4 , n + 1 ) : print ( i , end = \" ▁ \" ) elif k % 2 == 0 : low = 1 high = n for i in range ( k - 1 ) : if i % 2 == 1 : print ( low , end = \" ▁ \" ) low += 1 else : print ( high , end = \" ▁ \" ) high -= 1 for i in range ( low , high + 1 ) : print ( i , end = \" ▁ \" ) else : low = 1 high = n for i in range ( k - 1 ) : if i % 2 == 0 : print ( low , end = \" ▁ \" ) low += 1 else : print ( high , end = \" ▁ \" ) high -= 1 for i in range ( low , high + 1 ) : print ( i , end = \" ▁ \" ) print ( ) NEW_LINE", "n , k = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) if n == 1 : print ( 1 ) elif n == 2 : print ( '1 ▁ 2' ) else : if k == 1 : for i in range ( 1 , n + 1 ) : print ( i , end = \" ▁ \" ) print ( ) elif k == n - 1 : i1 = 1 i2 = n for i in range ( 1 , n + 1 ) : if i % 2 != 0 : print ( i1 , end = \" ▁ \" ) i1 += 1 else : print ( i2 , end = \" ▁ \" ) i2 -= 1 else : for i in range ( 1 , n - k ) : print ( i , end = \" ▁ \" ) i1 = i + 1 i2 = n for j in range ( 1 , k + 2 ) : if j % 2 != 0 : print ( i1 , end = \" ▁ \" ) i1 += 1 else : print ( i2 , end = \" ▁ \" ) i2 -= 1 NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) a = [ i + 1 for i in range ( n ) ] j = n ; ans = [ ] ; d = 1 ; t = 0 for i in range ( k ) : if i % 2 == 0 : ans . append ( j ) j -= 1 else : ans . append ( d ) d += 1 if k % 2 == 0 : for i in range ( d , j + 1 ) : ans . append ( i ) else : for i in range ( j , d - 1 , - 1 ) : ans . append ( i ) print ( * ans ) NEW_LINE" ]
codeforces_1144_B
[ "import java . util . * ; import java . io . * ; public class Main { static int [ ] A ; static int [ ] B ; static int [ ] C ; static int n ; static int ans ; public static void main ( String [ ] args ) throws IOException {", "import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > even = new ArrayList < Integer > ( ) ; ArrayList < Integer > odd = new ArrayList < Integer > ( ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 0 ) even . add ( arr [ i ] ) ; else odd . add ( arr [ i ] ) ; } if ( even . size ( ) == odd . size ( ) ) System . out . println ( 0 ) ; else if ( even . size ( ) == odd . size ( ) + 1 || odd . size ( ) == even . size ( ) + 1 ) System . out . println ( 0 ) ; else { int s = 0 ; if ( odd . size ( ) > even . size ( ) ) { int k = odd . size ( ) - even . size ( ) ; for ( int i = k - 2 ; i >= 0 ; i -- ) s = s + odd . get ( i ) ; } else { int k = even . size ( ) - odd . size ( ) ; for ( int i = k - 2 ; i >= 0 ; i -- ) s = s + even . get ( i ) ; } System . out . println ( s ) ; } } }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long sum = 0 ; ArrayList < Integer > odd = new ArrayList < Integer > ( ) ; ArrayList < Integer > even = new ArrayList < Integer > ( ) ; while ( n -- > 0 ) { int t = sc . nextInt ( ) ; if ( t % 2 == 0 ) even . add ( t ) ; else odd . add ( t ) ; } Collections . sort ( odd ) ; Collections . sort ( even ) ; int t = Math . abs ( even . size ( ) - odd . size ( ) ) ; if ( t <= 1 ) sum = 0 ; else { t -- ; if ( even . size ( ) > odd . size ( ) ) { for ( int i = 0 ; i < t ; i ++ ) { sum += even . get ( i ) ; } } else { for ( int i = 0 ; i < t ; i ++ ) { sum += odd . get ( i ) ; } } } System . out . println ( sum ) ; } }" ]
[ "n = int ( input ( ) ) lst = sorted ( list ( map ( int , input ( ) . split ( ) ) ) , reverse = True ) pis = [ i for i in lst if i % 2 == 0 ] pos = [ i for i in lst if i not in pis ] a , b = len ( pis ) , len ( pos ) if abs ( a - b ) <= 1 : print ( 0 ) else : print ( sum ( pis [ b + 1 : ] ) if a > b else sum ( pos [ a + 1 : ] ) ) NEW_LINE", "n = int ( input ( ) ) daf = list ( map ( int , input ( ) . split ( ) ) ) daf_even = [ x for x in daf if x % 2 == 0 ] daf_odd = [ x for x in daf if x % 2 ] daf_even . sort ( ) daf_odd . sort ( ) x = len ( daf_even ) y = len ( daf_odd ) if abs ( x - y ) <= 1 : print ( 0 ) else : if x > y + 1 : sel = x - ( y + 1 ) print ( sum ( daf_even [ : sel ] ) ) else : sel = y - ( x + 1 ) print ( sum ( daf_odd [ : sel ] ) ) NEW_LINE", "T_ON = 0 DEBUG_ON = 0 MOD = 998244353     def solve ( ) : n = read_int ( ) A = read_ints ( ) A . sort ( ) odds = [ ] evens = [ ] for a in A : if is_odd ( a ) : odds . append ( a ) else : evens . append ( a ) count_odd = len ( odds ) count_even = len ( evens ) if abs ( count_odd - count_even ) <= 1 : print ( 0 ) return if count_odd > count_even : left = count_odd - count_even - 1 print ( sum ( odds [ : left ] ) ) else : left = count_even - count_odd - 1 print ( sum ( evens [ : left ] ) )     def main ( ) : T = read_int ( ) if T_ON else 1 for i in range ( T ) : solve ( )     def debug ( * xargs ) : if DEBUG_ON : print ( * xargs )     from collections import * import math     NEW_LINE", "n = int ( input ( ) ) lst = sorted ( list ( map ( int , input ( ) . split ( ) ) ) , reverse = True ) pis = [ i for i in lst if i % 2 == 0 ] pos = [ i for i in lst if i not in pis ] a , b = len ( pis ) , len ( pos ) if abs ( a - b ) <= 1 : print ( 0 ) else : print ( sum ( pis [ b + 1 : ] ) if a > b else sum ( pos [ a + 1 : ] ) ) NEW_LINE" ]
codeforces_545_B
[ "import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ;    public class B545 {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class B {   public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; String s1 = fs . next ( ) ; String s2 = fs . next ( ) ; int dist = 0 ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { if ( s1 . charAt ( i ) != s2 . charAt ( i ) ) dist ++ ; } if ( dist % 2 != 0 ) { System . out . println ( \" impossible \" ) ; return ; } boolean f = true ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { if ( s1 . charAt ( i ) != s2 . charAt ( i ) ) { if ( f ) System . out . print ( s1 . charAt ( i ) ) ; else System . out . print ( s2 . charAt ( i ) ) ; f = ! f ; } else { System . out . print ( s1 . charAt ( i ) ) ; } } } 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 ( ) ) ; } } }   ", "   import java . util . * ;    public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String s = input . nextLine ( ) ; String t = input . nextLine ( ) ; int count = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != t . charAt ( i ) ) count ++ ; } if ( count % 2 == 1 ) { System . out . println ( \" impossible \" ) ; } else { count = count / 2 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == t . charAt ( i ) ) System . out . print ( s . charAt ( i ) ) ; else { if ( count % 2 == 0 ) System . out . print ( s . charAt ( i ) ) ; else System . out . print ( t . charAt ( i ) ) ; count -- ; } } System . out . println ( \" \" ) ; } } }  " ]
[ "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 ( ) : s , t = input ( ) , input ( ) n = len ( s ) diff = 0 answer = [ ]   for i in range ( n ) : if s [ i ] != t [ i ] : answer . append ( s [ i ] if diff % 2 == 0 else t [ i ] ) diff += 1 else : answer . append ( s [ i ] ) if diff % 2 == 0 : print ( \" \" . join ( answer ) ) else : print ( \" impossible \" )   main ( ) NEW_LINE", "a = input ( ) b = input ( ) l = [ ] for i in range ( len ( a ) ) : if ( a [ i ] != b [ i ] ) : l . append ( i )   if len ( l ) % 2 : print ( \" impossible \" ) elif l : i = l [ len ( l ) // 2 ] print ( a [ : i ] + b [ i : ] ) else : print ( a ) NEW_LINE", "s = input ( ) t = input ( ) c = 0 n = len ( s ) for j in range ( n ) : if s [ j ] != t [ j ] : c += 1 if c % 2 != 0 : print ( ' impossible ' ) else : c1 = 0 c2 = 0 p = \" \" for j in range ( n ) : if s [ j ] == t [ j ] : p += s [ j ] else : if c1 < c // 2 : c1 += 1 p += s [ j ] else : p += t [ j ] print ( p ) NEW_LINE", "from sys import stdin , stdoutfrom os import pathrd = lambda : stdin . readline ( ) . strip ( ) wr = stdout . writeif ( path . exists ( ' input . txt ' ) ) : stdin = open ( \" input . txt \" , \" r \" ) import time NEW_LINE" ]
codeforces_68_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . StringTokenizer ;   public class Gym {  ", "import java . util . * ;     import java . io . * ; 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 . util . * ;     import java . io . * ; 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 ] ;" ]
[ "l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE x = min ( l [ : 4 ] ) NEW_LINE if x > l [ 5 ] : NEW_LINE INDENT print ( l [ 5 ] - l [ 4 ] + 1 ) elif x >= l [ 4 ] : NEW_LINE print ( x - l [ 4 ] ) else : NEW_LINE print ( \"0\" ) NEW_LINE DEDENT", "* P , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( max ( 0 , min ( b - a + 1 , min ( P ) - a ) ) ) NEW_LINE", "l = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE print ( min ( l [ 5 ] - l [ 4 ] + 1 , max ( 0 , min ( l [ : 4 ] ) - l [ 4 ] ) ) ) NEW_LINE", "def check_permutations ( p1 , p2 , p3 , p4 , x ) : total = 0 NEW_LINE s1 = { p1 , p2 , p3 , p4 } NEW_LINE for i in s1 : a = i NEW_LINE s2 = { a } NEW_LINE s2 = s1 - s2 NEW_LINE for j in s2 : b = j NEW_LINE s3 = { j } NEW_LINE s3 = s2 - s3 NEW_LINE for k in s3 : c = k NEW_LINE s4 = { k } NEW_LINE s4 = s3 - s4 NEW_LINE for z in ( s4 ) : d = z NEW_LINE if ( ( ( ( x % a ) % b ) ) % c ) % d == x : total += 1 NEW_LINE return total NEW_LINE p1 , p2 , p3 , p4 , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE ans = 0 NEW_LINE for i in range ( a , b + 1 ) : if NEW_LINE check_permutations ( p1 , p2 , p3 , p4 , i ) >= 7 : ans += 1 NEW_LINE print ( ans ) NEW_LINE", "p1 , p2 , p3 , p4 , a , b = map ( int , input ( ) . split ( ) )   m = min ( p1 , p2 , p3 , p4 )   if m - a <= 0 : NEW_LINE INDENT print ( 0 ) elif m > b : NEW_LINE print ( b - a + 1 ) else : NEW_LINE print ( m - a ) NEW_LINE DEDENT" ]
codeforces_844_A
[ "import java . util . * ;   public class dDiversity { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; int k = scan . nextInt ( ) ; int counter = 0 ; if ( s . length ( ) < k ) { System . out . println ( \" impossible \" ) ; } else { int [ ] AtoZcount = new int [ 26 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { AtoZcount [ s . charAt ( i ) - ' a ' ] ++ ; }", "import javax . print . DocFlavor ; import java . io . * ; import java . net . Inet4Address ; import java . sql . ClientInfoStatus ; import java . util . * ;  ", "import java . io . * ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) throws IOException { String s = sc . nextLine ( ) ; int k = sc . nextInt ( ) ; if ( k > s . length ( ) ) pw . println ( \" impossible \" ) ; else {", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String s1 = s . nextLine ( ) ; int k = s . nextInt ( ) ; HashMap < Character , Integer > h = new HashMap < > ( ) ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { if ( h . containsKey ( s1 . charAt ( i ) ) ) h . put ( s1 . charAt ( i ) , h . get ( s1 . charAt ( i ) ) + 1 ) ; else h . put ( s1 . charAt ( i ) , 1 ) ; } if ( k > s1 . length ( ) ) System . out . println ( \" impossible \" ) ; else if ( h . size ( ) >= k ) System . out . println ( \"0\" ) ; else { int count = k - h . size ( ) ; System . out . println ( count ) ; } } }" ]
[ "s = input ( ) k = int ( input ( ) ) if len ( s ) >= k : print ( max ( 0 , k - len ( set ( s ) ) ) ) else : print ( ' impossible ' ) NEW_LINE", "s = input ( ) k = int ( input ( ) ) arr = set ( list ( s ) )   x = len ( arr )     if ( x >= k ) : print ( 0 ) else : k -= x rem = len ( s ) - x   NEW_LINE", "s = input ( ) k = int ( input ( ) )   ss = set ( s . strip ( ) )   ns = len ( ss )   if k > len ( s ) : print ( \" impossible \" ) else : print ( max ( 0 , k - ns ) )   NEW_LINE", "s = list ( str ( input ( ) ) ) k = int ( input ( ) ) r = 0 possible = Trueif len ( s ) < k : possible = Falseelse : r = k - len ( set ( s ) ) r = 0 if r < 0 else rprint ( r if possible else \" impossible \" ) NEW_LINE", "string = list ( input ( ) ) differnt_words = int ( input ( ) ) difset = set ( string )   if ( differnt_words > len ( string ) ) : print ( \" impossible \" ) else : val = differnt_words - len ( difset ) if ( val < 0 ) : print ( 0 ) else : print ( val ) NEW_LINE" ]
codeforces_357_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; int box = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int beg = 0 , ent = 0 ; for ( int i = 2 ; i <= n ; i ++ ) { beg = 0 ; ent = 0 ; for ( int j = 1 ; j < i ; j ++ ) beg += a [ j ] ; for ( int k = i ; k <= n ; k ++ ) ent += a [ k ] ; if ( beg >= x && beg <= y && ent >= x && ent <= y ) box = i ; } System . out . println ( box ) ; } }  ", "import java . util . * ; import java . io . * ; import java . text . * ; import java . math . * ; import java . lang . Math . * ;   public class A { public static void main ( String [ ] args ) throws Exception { new A ( ) . run ( ) ; } public FastIO file = new FastIO ( ) ; public int ntc , ctc ; public final long MOD = 1000000007L ;", "import java . util . Arrays ; import java . util . Scanner ;   public class NewMain49 {   public static void main ( String [ ] args ) {", "import java . util . Scanner ;   public class GroupDividing { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;   int m = scan . nextInt ( ) ; int [ ] sum = new int [ m + 1 ] ; int k = - 1 ;   for ( int i = 0 ; i < m ; i ++ ) sum [ i + 1 ] = sum [ i ] + scan . nextInt ( ) ;   int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ;   for ( int i = 1 ; i < m + 1 ; i ++ ) { if ( sum [ i ] >= x && sum [ i ] <= y && sum [ m ] - sum [ i ] >= x && sum [ m ] - sum [ i ] <= y ) { k = i ; break ; } } System . out . println ( k + 1 ) ; } }" ]
[ "m = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) x , y = map ( int , input ( ) . split ( ) ) for i in range ( 1 , m ) : arr [ i ] += arr [ i - 1 ]   total = arr [ - 1 ]     for i in range ( m ) : if x <= arr [ i ] <= y and x <= total - arr [ i ] <= y : ans = i + 2 print ( ans ) exit ( ) print ( 0 ) NEW_LINE", "n = int ( input ( ) ) arr = [ int ( z ) for z in input ( ) . split ( ) ] x , y = map ( int , input ( ) . split ( ) ) for i in range ( 1 , n ) : b = sum ( arr [ : i ] ) a = sum ( arr [ i : ] ) if b >= x and b <= y and a >= x and a <= y : print ( i + 1 ) exit ( ) print ( 0 ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) x = b [ 0 ] y = b [ 1 ] i = 1 s = sum ( a ) ans1 = 0 ans2 = sans = 0 while i <= n : ans1 += a [ i - 1 ] ans2 -= a [ i - 1 ] NEW_LINE", "n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) x , y = map ( int , input ( ) . split ( ) )   for i in range ( 1 , n ) : A [ i ] = A [ i ] + A [ i - 1 ]   for i in range ( n ) : a = A [ i ] itr = A [ - 1 ] - a if a >= x and a <= y and itr >= x and itr <= y : print ( i + 2 ) breakelse : print ( 0 ) NEW_LINE", "import sys , mathsys . setrecursionlimit ( 10 ** 8 ) ''' def ▁ fun ( ) : ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( 16 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( 4 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ i & (1 < < j ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( j , end = ' ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ) import ▁ binarytreefrom ▁ collections ▁ import ▁ dequebst ▁ = ▁ binarytree . tree ( height = 4 , is _ perfect = True ) print ( bst ) def ▁ s ( bst ) : ▁ ▁ ▁ ▁ if ▁ bst : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ bst . left , bst . right ▁ = ▁ bst . right , bst . left ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . right ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . left ) s ( bst ) print ( bst ) '''   n = int ( input ( ) ) s = list ( map ( int , input ( ) . split ( ) ) ) x , y = map ( int , input ( ) . split ( ) ) ss = 0 pika = 1 for i in range ( n ) : ss += s [ i ] if x <= ss <= y and x <= sum ( s [ i + 1 : ] ) <= y : print ( i + 2 ) pika = 0 breakif pika == 1 : print ( 0 ) NEW_LINE" ]
codeforces_572_B
[ "import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ;   public class orderBook {   public static void main ( String [ ] args ) {", "import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ;   public class orderBook {   public static void main ( String [ ] args ) {", "import java . util . Scanner ;   public class B572 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int S = in . nextInt ( ) ; int [ ] buy = new int [ 100001 ] ; int [ ] sell = new int [ 100001 ] ; for ( int n = 0 ; n < N ; n ++ ) { String type = in . next ( ) ; int p = in . nextInt ( ) ; int q = in . nextInt ( ) ; int [ ] A = ( type . charAt ( 0 ) == ' B ' ) ? buy : sell ; A [ p ] += q ; } int sellS = S ; int p = 0 ; while ( sellS > 0 && p < sell . length ) { if ( sell [ p ] > 0 ) { sellS -- ; } p ++ ; } p -- ; while ( p >= 0 ) { if ( sell [ p ] > 0 ) { System . out . println ( \" S ▁ \" + p + \" ▁ \" + sell [ p ] ) ; } p -- ; } int buyS = S ; for ( p = buy . length - 1 ; p >= 0 ; p -- ) { if ( buy [ p ] > 0 && buyS > 0 ) { buyS -- ; System . out . println ( \" B ▁ \" + p + \" ▁ \" + buy [ p ] ) ; } } }   }" ]
[ "import sys , os . pathfrom collections import * from copy import * import mathmod = 10 ** 9 + 7 if ( os . path . exists ( ' input . txt ' ) ) : sys . stdin = open ( \" input . txt \" , \" r \" ) sys . stdout = open ( \" output . txt \" , \" w \" )     n , s = map ( int , input ( ) . split ( ) ) mat = [ ] buy = { } sell = { } for i in range ( n ) : dpq = list ( map ( str , input ( ) . split ( ) ) ) d = dpq [ 0 ] p = int ( dpq [ 1 ] ) q = int ( dpq [ 2 ] ) if ( d == \" S \" ) : sell [ p ] = sell . get ( p , 0 ) + q else : buy [ p ] = buy . get ( p , 0 ) + qb = list ( buy . items ( ) ) b . sort ( ) sel = list ( sell . items ( ) ) sel . sort ( ) b = b [ - s : ] sel = sel [ : s ] b . reverse ( ) sel . reverse ( ) for i in sel : print ( ' S ' , * i ) for i in b : print ( ' B ' , * i )           NEW_LINE", "n , s = map ( int , input ( ) . split ( ) )   buys , sells = { } , { }   for i in range ( n ) : line = input ( ) . split ( ) d = line [ 0 ] p = int ( line [ 1 ] ) v = int ( line [ 2 ] )   if d == ' B ' : if p in buys : buys [ p ] += v else : buys [ p ] = v else : if p in sells : sells [ p ] += v else : sells [ p ] = v   sells = sorted ( sells . items ( ) ) [ : s ] buys = sorted ( buys . items ( ) , reverse = True ) [ : s ]   for sell in sells [ : : - 1 ] : print ( ' S ' , sell [ 0 ] , sell [ 1 ] )   for buy in buys : print ( ' B ' , buy [ 0 ] , buy [ 1 ] ) NEW_LINE", "n , s = input ( ) . split ( ) n , s = int ( n ) , int ( s ) dic = { } while n > 0 : listOfInput = input ( ) . split ( ) key = ' ▁ ' . join ( listOfInput [ : - 1 ] ) value = listOfInput [ - 1 ] if key in dic : dic [ key ] += int ( value ) else : dic [ key ] = int ( value ) n -= 1 listOfSells = sorted ( [ int ( key . split ( ) [ 1 ] ) for key in dic if key . split ( ) [ 0 ] == ' S ' ] ) [ : s ] listOfBuys = sorted ( [ int ( key . split ( ) [ 1 ] ) for key in dic if key . split ( ) [ 0 ] == ' B ' ] ) for i in range ( s ) : if listOfSells : value = listOfSells . pop ( ) key = ' S ▁ ' + str ( value ) print ( ' S ▁ ' + str ( value ) + ' ▁ ' + str ( dic [ key ] ) ) else : passfor i in range ( s ) : if listOfBuys : value = listOfBuys . pop ( ) key = ' B ▁ ' + str ( value ) print ( ' B ▁ ' + str ( value ) + ' ▁ ' + str ( dic [ key ] ) ) else : pass NEW_LINE", "n , s = input ( ) . split ( ) n , s = int ( n ) , int ( s ) dic = { } while n > 0 : listOfInput = input ( ) . split ( ) key = ' ▁ ' . join ( listOfInput [ : - 1 ] ) value = listOfInput [ - 1 ] if key in dic : dic [ key ] += int ( value ) else : dic [ key ] = int ( value ) n -= 1 listOfSells = sorted ( [ int ( key . split ( ) [ 1 ] ) for key in dic if key . split ( ) [ 0 ] == ' S ' ] ) [ : s ] listOfBuys = sorted ( [ int ( key . split ( ) [ 1 ] ) for key in dic if key . split ( ) [ 0 ] == ' B ' ] ) for i in range ( s ) : if listOfSells : value = listOfSells . pop ( ) key = ' S ▁ ' + str ( value ) print ( ' S ▁ ' + str ( value ) + ' ▁ ' + str ( dic [ key ] ) ) else : passfor i in range ( s ) : if listOfBuys : value = listOfBuys . pop ( ) key = ' B ▁ ' + str ( value ) print ( ' B ▁ ' + str ( value ) + ' ▁ ' + str ( dic [ key ] ) ) else : pass   NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) bs , s = { } , { } for _ in \" ▁ \" * a : x , y , z = input ( ) . split ( ) y , z = int ( y ) , int ( z ) if x == ' B ' : if y in bs : bs [ y ] += z else : bs [ y ] = z else : if y in s : s [ y ] += z else : s [ y ] = z NEW_LINE" ]
codeforces_798_B
[ "import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ; public class Cat_Furrier { public static boolean samechars ( String [ ] st ) { int [ ] ar = new int [ 26 ] ; for ( int i = 0 ; i < st [ 0 ] . length ( ) ; i ++ ) ar [ st [ 0 ] . charAt ( i ) - ' a ' ] ++ ; for ( int j = 1 ; j < st . length ; j ++ ) { int [ ] tar = new int [ 26 ] ; for ( int i = 0 ; i < st [ j ] . length ( ) ; i ++ ) tar [ st [ j ] . charAt ( i ) - ' a ' ] ++ ; if ( ! Arrays . equals ( ar , tar ) ) return false ; } return true ; } public static void main ( String [ ] args ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ; import static java . util . Arrays . sort ; import javafx . util . Pair ;   public class Main {   public static void main ( String [ ] args ) {   FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; StringBuilder s [ ] = new StringBuilder [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = new StringBuilder ( input . next ( ) ) ; }", "import java . util . * ; import java . io . * ; import java . math . * ;   public class First {   public static int func ( int m , int n , String [ ] s ) { boolean flag = true ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < m ; i ++ ) { String target = s [ i ] + s [ i ] ; int sum = 0 ; for ( int j = 0 ; j < m ; j ++ ) { if ( i == j ) { continue ; } int index = target . lastIndexOf ( s [ j ] ) ; if ( index == - 1 ) { flag = false ; break ; } else { if ( index > 0 ) { sum += ( n - index ) ; } } } if ( ! flag ) { break ; } if ( min > sum ) { min = sum ; } } if ( ! flag ) { return - 1 ; } return min ; } public static void process ( ) throws IOException { int m = ni ( ) ; String [ ] s = new String [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { s [ i ] = nln ( ) ; } int n = s [ 0 ] . length ( ) ; int ans = ( m == 1 ) ? 0 : func ( m , n , s ) ; pn ( ans ) ; }    static AnotherReader sc ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( System . out ) ; sc = new AnotherReader ( ) ; boolean oj = true ;  ", "import java . 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 ) {" ]
[ "n = int ( input ( ) ) arr = [ ] mi = 100000 def get_next ( word ) : return word [ 1 : len ( word ) ] + word [ 0 ] def other ( cur_word ) : total = 0 for i in range ( 1 , n ) : flag = 0 mw = arr [ i ] for j in range ( len ( mw ) ) : if ( mw == cur_word ) : flag = 1 break total += 1 mw = get_next ( mw ) if ( flag == 0 ) : return - 1 return total for i in range ( n ) : arr . append ( input ( ) ) cur_word = arr [ 0 ] for i in range ( len ( arr [ 0 ] ) ) : res = i + other ( cur_word ) mi = min ( res , mi ) cur_word = get_next ( cur_word ) print ( mi ) NEW_LINE", "from collections import Counterfrom sys import stdin , stdout   STRS = [ ]   def main ( ) : n = int ( stdin . readline ( ) . rstrip ( ) )   for _ in range ( n ) : STRS . append ( stdin . readline ( ) . rstrip ( ) )   k = len ( STRS [ 0 ] ) best = float ( ' inf ' ) c = Counter ( STRS [ 0 ] ) for s in STRS : if c != Counter ( s ) : best = - 1 break   if best > 0 : table = [ [ float ( ' inf ' ) ] * k for _ in range ( n ) ] table [ 0 ] = list ( range ( k ) )   for i in range ( 1 , n ) : NEW_LINE", "n = int ( input ( ) ) s = [ input ( ) for i in range ( n ) ] m = len ( s [ 0 ] ) ans = 10 ** 18 l = [ [ ] for i in range ( n ) ] for i in range ( n ) : for j in range ( m + 1 ) : l [ i ] . append ( s [ i ] ) s [ i ] = s [ i ] [ 1 : ] + s [ i ] [ 0 ] for i in range ( m ) : c = i flag = True for j in range ( 1 , n ) : if not l [ 0 ] [ i ] in l [ j ] : flag = False break idx = l [ j ] . index ( l [ 0 ] [ i ] ) c += idx if flag : ans = min ( ans , c ) if ans == 10 ** 18 : print ( - 1 ) else : print ( ans ) NEW_LINE", "def check ( string1 , string2 ) : size1 = len ( string1 ) size2 = len ( string2 ) temp = ' ' if size1 != size2 : return 0 temp = string1 + string1 if ( temp . count ( string2 ) > 0 ) : return 1 else : return 0 n = int ( input ( ) ) s = [ ] for i in range ( n ) : s . append ( input ( ) ) for i in range ( 1 , n ) : if check ( s [ 0 ] , s [ i ] ) == 0 : print ( - 1 ) exit ( ) def r ( s1 , s2 ) : for i in range ( len ( s2 ) ) : if s2 [ i : ] + s2 [ : i ] == s1 : return ip = float ( \" inf \" ) for i in range ( n ) : ans = 0 for j in range ( n ) : if i == j : continue else : ans += r ( s [ i ] , s [ j ] ) p = min ( p , ans ) print ( p ) NEW_LINE" ]
codeforces_712_A
[ "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; if ( i > 0 ) System . out . print ( ( a [ i - 1 ] + a [ i ] ) + \" ▁ \" ) ; } System . out . print ( a [ n - 1 ] ) ; } }", "import java . util . Scanner ;   public class MemoryAndCrow { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } for ( int j = 0 ; j < n - 1 ; j ++ ) { System . out . print ( b [ j ] + b [ j + 1 ] + \" ▁ \" ) ; } System . out . print ( b [ n - 1 ] ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ;   public class Main {   static void sort ( long a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; long temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; }   public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int a [ ] = new int [ n ] ; int ans [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } ans [ n - 1 ] = a [ n - 1 ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) { ans [ i ] = a [ i ] + a [ i + 1 ] ; } for ( int an : ans ) { System . out . print ( an + \" ▁ \" ) ; } System . out . println ( ) ; }   }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int [ ] arr = new int [ t ] ; int [ ] brr = new int [ t ] ; for ( int i = 0 ; i < t ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } for ( int j = 0 ; j < t - 1 ; j ++ ) { brr [ j ] = arr [ j ] + arr [ j + 1 ] ; } brr [ t - 1 ] = arr [ t - 1 ] ; for ( int x : brr ) { System . out . print ( x + \" ▁ \" ) ; } } }", "import java . util . Scanner ;   public class PROBLEM48 {   public static void main ( String [ ] args ) {" ]
[ "n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] l = [ ] for i in range ( 1 , n ) : l . append ( a [ i ] + a [ i - 1 ] ) l . append ( a [ n - 1 ] ) print ( * l ) NEW_LINE", "n = int ( input ( ) ) List = list ( map ( int , input ( ) . split ( ) ) )   A = 0 list_new = [ ] for i in range ( 0 , n ) : if i == len ( List ) - 1 : list_new . append ( List [ i ] ) break A = List [ i + 1 ] + List [ i ] list_new . append ( A ) A = 0   for i in range ( len ( list_new ) ) : print ( list_new [ i ] , end = \" ▁ \" ) NEW_LINE", "def solve ( arr ) : res = [ arr [ - 1 ] ] for i in range ( len ( arr ) - 2 , - 1 , - 1 ) : res . insert ( 0 , arr [ i ] + arr [ i + 1 ] ) return res     def main ( ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) print ( * solve ( arr ) ) main ( ) NEW_LINE", "n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n - 1 ) : print ( li [ i ] + li [ i + 1 ] , end = ' ▁ ' ) print ( li [ n - 1 ] )   NEW_LINE", "n = int ( input ( ) ) lst = [ int ( i ) for i in input ( ) . split ( ) ]   for i in range ( n - 1 ) : print ( lst [ i ] + lst [ i + 1 ] , end = ' ▁ ' ) print ( lst [ n - 1 ] ) NEW_LINE" ]
codeforces_715_A
[ "import java . io . * ; import java . math . * ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 1000000007 ;   private static final int MAXN = 200001 ; private static final int MAXA = 1000007 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i == 1 ) { System . out . println ( \"2\" ) ; } else { System . out . println ( ( long ) i * ( i + 1 ) * ( i + 1 ) - ( i - 1 ) ) ; } } } }  ", "import java . util . * ; import java . io . * ; import java . math . BigInteger ; public class mat { static class InputReader { private InputStream stream ; private byte [ ] inbuf = new byte [ 1024 ] ; private int start = 0 ; private int end = 0 ;   public InputReader ( InputStream stream ) { this . stream = stream ; }   private int readByte ( ) { if ( start == - 1 ) throw new UnknownError ( ) ; if ( end >= start ) { end = 0 ; try { start = stream . read ( inbuf ) ; } catch ( IOException e ) { throw new UnknownError ( ) ; } if ( start <= 0 ) return - 1 ; } return inbuf [ end ++ ] ; }   private boolean isSpaceChar ( int c ) { return ! ( c >= 33 && c <= 126 ) ; }   private int skip ( ) { int b ; while ( ( b = readByte ( ) ) != - 1 && isSpaceChar ( b ) ) ; return b ; }   public String next ( ) { int b = skip ( ) ; StringBuilder sb = new StringBuilder ( ) ; while ( ! ( isSpaceChar ( b ) ) ) {" ]
[ "from math import sqrt , floor , ceil   NEW_LINE", "from sys import stdoutn = int ( input ( ) ) stdout . write ( \"2 \\n \" ) for lv in range ( 2 , n + 1 ) : stdout . write ( str ( lv * ( lv + 1 ) * ( lv + 1 ) - ( lv - 1 ) ) + ' \\n ' ) NEW_LINE", "n = int ( input ( ) ) l = [ 2 ] cs = 2 for i in range ( 2 , n + 1 ) : xs = i * ( i + 1 ) ys = xs * xs ax = ys - cs ax = ax // i cs = xs l . append ( ax )   for i in range ( len ( l ) ) : print ( l [ i ] ) NEW_LINE", "import mathn = int ( input ( ) ) al = 2 for i in range ( 1 , n + 1 ) : ai = ( i * i + i ) ** 2 ; res = ( ai - al ) // i ; al = ( i * i + i ) print ( int ( res ) ) NEW_LINE" ]
codeforces_1466_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;", "import java . util . Scanner ; import java . util . Set ; import java . util . TreeSet ;   public class Main { public static void main ( String [ ] args ) throws Exception { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; int n ; while ( t != 0 ) { n = in . nextInt ( ) ; Set < Integer > s = new TreeSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = in . nextInt ( ) ; if ( s . contains ( a ) ) s . add ( a + 1 ) ; else s . add ( a ) ; } System . out . println ( s . size ( ) ) ; t -- ; } } }", "import java . util . Scanner ;   public class B1466 {   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 answer = 0 ; int last = 0 ; for ( int n = 0 ; n < N ; n ++ ) { int x = in . nextInt ( ) ; if ( last < x ) { last = x ; answer ++ ; } else if ( last == x ) { last = x + 1 ; answer ++ ; } } System . out . println ( answer ) ; } }   }", "import java . util . * ; public class enhancements { public static void main ( String [ ] args ) { int t , n ;   Scanner sc = new Scanner ( System . in ) ;   t = sc . nextInt ( ) ;   while ( t -- > 0 ) { n = sc . nextInt ( ) ; Set < Integer > s = new TreeSet < > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { int a = sc . nextInt ( ) ; if ( s . contains ( a ) ) s . add ( a + 1 ) ; else s . add ( a ) ; }   System . out . println ( s . size ( ) ) ; }   }   }" ]
[ "t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE x = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l = set ( ) NEW_LINE for j in x : if NEW_LINE j not in l : l . add ( j ) else : l . add ( j + 1 ) NEW_LINE l1 = set ( ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a . sort ( reverse = True ) NEW_LINE d = { } NEW_LINE for el in a : d [ el ] = True   for i in range ( n ) : if NEW_LINE not d . get ( a [ i ] + 1 , False ) : d [ a [ i ] + 1 ] = True NEW_LINE d . pop ( a [ i ] ) else : d [ a [ i ] ] = True   print ( len ( d ) ) NEW_LINE", "for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE count = [ 0 ] * ( 2 * n + 2 ) NEW_LINE for i in a : count [ i ] += 1 NEW_LINE for i in range ( len ( a ) - 1 , - 1 , - 1 ) : if NEW_LINE count [ a [ i ] + 1 ] == 0 : count [ a [ i ] + 1 ] += 1 NEW_LINE count [ a [ i ] ] -= 1 NEW_LINE a [ i ] += 1 NEW_LINE print ( len ( set ( a ) ) ) NEW_LINE", "from collections import defaultdictfor NEW_LINE _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = sorted ( list ( map ( int , input ( ) . split ( ) ) ) , reverse = 1 ) NEW_LINE d = defaultdict ( int ) NEW_LINE for i in a : d [ i ] += 1 NEW_LINE for i in a : if NEW_LINE not d [ i + 1 ] : d [ i ] -= 1 NEW_LINE if not d [ i ] : del d [ i ] NEW_LINE d [ i + 1 ] = 1 NEW_LINE print ( len ( d ) ) NEW_LINE" ]
codeforces_1408_B
[ "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; int [ ] visit = new int [ 200 ] ; int count = 0 ;", "import java . util . * ; public class ArraysSum {   public static void main ( String [ ] args ) {", "import java . io . * ; import java . util . * ;   public class Main { static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String [ ] args ) throws IOException { int t = input . nextInt ( ) ; int [ ] a = new int [ 105 ] ; Set < Integer > st = new HashSet < Integer > ( ) ; while ( t -- != 0 ) { st . clear ( ) ; int n = input . nextInt ( ) ; int k = input . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = input . nextInt ( ) ; st . add ( x ) ; } int cnt = st . size ( ) ; if ( k == 1 && cnt > 1 ) { pr . println ( - 1 ) ; continue ; } if ( cnt <= k ) { pr . println ( 1 ) ; continue ; } pr . println ( 1 + ( cnt - 2 ) / ( k - 1 ) ) ; } pr . flush ( ) ; } static class input { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StreamTokenizer in = new StreamTokenizer ( br ) ; static String nextLine ( ) throws IOException { return br . readLine ( ) ; } static int nextInt ( ) throws IOException { in . nextToken ( ) ; return ( int ) in . nval ; } static long nextLong ( ) throws IOException { in . nextToken ( ) ; return ( long ) in . nval ; } static double nextDouble ( ) throws IOException { in . nextToken ( ) ; return in . nval ; } } }  " ]
[ "import math , sys , bisect , heapqfrom NEW_LINE collections NEW_LINE import defaultdict , Counter , dequefrom NEW_LINE itertools NEW_LINE import groupby , accumulatefrom NEW_LINE functools NEW_LINE import lru_cache NEW_LINE", "t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n , k = map ( int , input ( ) . split ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE p = 0 NEW_LINE pre = - 1 NEW_LINE for i in range ( n ) : if NEW_LINE pre != l [ i ] : pre = l [ i ] NEW_LINE p += 1 NEW_LINE if k == 1 and p > 1 : NEW_LINE INDENT print ( - 1 ) else : NEW_LINE cnt = 1 NEW_LINE DEDENT p -= k NEW_LINE while p > 0 : p -= ( k - 1 ) NEW_LINE cnt += 1 NEW_LINE print ( cnt ) NEW_LINE", "import sys , os , ioimport NEW_LINE math , bisect , operatorinf , mod = float ( ' inf ' ) , 10 ** 9 + 7 NEW_LINE" ]
codeforces_856_A
[ "import java . util . * ; import java . io . * ; public class A { public static void main ( String ar [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int r = 0 ; r < t ; r ++ ) { int n = Integer . parseInt ( br . readLine ( ) ) ; String s1 [ ] = br . readLine ( ) . split ( \" ▁ \" ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parseInt ( s1 [ i ] ) ; Arrays . sort ( a ) ; boolean b [ ] = new boolean [ 1000001 ] ; Arrays . fill ( b , true ) ; int k = 1 ; sb . append ( \" YES \" ) . append ( \" \\n \" ) ; int count = 0 ; while ( count < n ) { while ( ! b [ k ] ) k ++ ; count ++ ; sb . append ( k ) . append ( \" ▁ \" ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { int u = k + a [ j ] - a [ i ] ; if ( u <= 1000000 && u >= 1 ) b [ u ] = false ; } } k ++ ; } sb . append ( \" \\n \" ) ; } System . out . println ( sb ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . io . StreamTokenizer ; import java . util . Arrays ;   public class Main {   public static void main ( String [ ] args ) throws IOException { StreamTokenizer in = new StreamTokenizer ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; in . nextToken ( ) ; int t = ( int ) in . nval ; for ( int i = 0 ; i < t ; i ++ ) { in . nextToken ( ) ; int n = ( int ) in . nval ; int a [ ] = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { in . nextToken ( ) ; int num = ( int ) in . nval ; a [ j ] = num ; } if ( n == 1 ) { out . println ( \" YES \" ) ; out . println ( 1 ) ; continue ; } int chaA [ ] = new int [ 1000010 ] ; Arrays . sort ( a ) ; for ( int j = 0 ; j < n - 1 ; j ++ ) { for ( int k = j + 1 ; k < n ; k ++ ) { chaA [ a [ k ] - a [ j ] ] = 1 ;" ]
[ "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) b = [ ] b . append ( 1 ) t = 10 ** 6 used = [ 0 ] * ( t + 1 ) used [ 1 ] = 1 can_be = 2 diffs = [ ] for i in range ( n ) : for j in range ( i + 1 , n ) : diffs . append ( a [ j ] - a [ i ] ) for i in range ( 1 , n ) : for j in diffs : used [ min ( b [ i - 1 ] + j , t ) ] = 1 while ( used [ can_be ] ) : can_be += 1 b . append ( can_be ) used [ can_be ] = 1 if len ( b ) == n : print ( ' YES ' ) for i in b : print ( i , end = ' ▁ ' ) print ( ' ' ) else : print ( ' NO ' )     NEW_LINE", "''' from ▁ random ▁ import ▁ randint visited ▁ = ▁ [ -1 ] ▁ * ▁ ( 2 ▁ * ▁ 10 ▁ * * ▁ 6 ▁ + ▁ 1 ) t ▁ = ▁ int ( input ( ) ) for ▁ i ▁ in ▁ range ( t ) : ▁ ▁ ▁ ▁ n , ▁ A ▁ = ▁ int ( input ( ) ) , ▁ list ( map ( int , ▁ input ( ) . split ( ) ) ) ▁ ▁ ▁ ▁ A . sort ( ) ▁ ▁ ▁ ▁ res ▁ = ▁ [ 1 ] ▁ * ▁ n ▁ ▁ ▁ ▁ v ▁ = ▁ 1 ▁ ▁ ▁ ▁ cnt ▁ = ▁ 0 ▁ ▁ ▁ ▁ while ▁ cnt ▁ < ▁ n : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ # v ▁ = ▁ randint ( 1 , ▁ 10 * * 6 ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ all ( visited [ a ▁ + ▁ v ] ▁ ! = ▁ i ▁ for ▁ a ▁ in ▁ A ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ a ▁ in ▁ A : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ visited [ a ▁ + ▁ v ] ▁ = ▁ i ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ res [ cnt ] ▁ = ▁ v ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ cnt ▁ + = ▁ 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ v ▁ + = ▁ 1 ▁ ▁ ▁ ▁ print ( \" YES \\n \" ▁ + ▁ ' ▁ ' . join ( map ( str , res ) ) ) '''   t = int ( input ( ) )   def check ( arr , v , dic ) : for i in arr : if dic [ i + v ] == 1 : return True return False     def check2 ( arr , v , dic ) : ok = False for i in arr : if dic [ i + v ] == 1 : ok = True break return ok     dic = [ 0 ] * 2000005   for _ in range ( t ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr . sort ( ) brr = [ 1 ] * n cnt = 0 i = 1 flag = True tmp = { } while cnt < n : ''' ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ while ▁ check ( arr , i , dic ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ i ▁ + = ▁ 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ brr [ cnt ] ▁ = ▁ i  ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ v ▁ in ▁ arr : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ # if ▁ i + v > 2e6 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ # ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ dic [ i + v ] ▁ = ▁ 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ tmp [ i + v ] ▁ = ▁ 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ cnt ▁ + = ▁ 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ''' NEW_LINE", "''' from ▁ random ▁ import ▁ randint visited ▁ = ▁ [ -1 ] ▁ * ▁ ( 2 ▁ * ▁ 10 ▁ * * ▁ 6 ▁ + ▁ 1 ) t ▁ = ▁ int ( input ( ) ) for ▁ i ▁ in ▁ range ( t ) : ▁ ▁ ▁ ▁ n , ▁ A ▁ = ▁ int ( input ( ) ) , ▁ list ( map ( int , ▁ input ( ) . split ( ) ) ) ▁ ▁ ▁ ▁ A . sort ( ) ▁ ▁ ▁ ▁ res ▁ = ▁ [ 1 ] ▁ * ▁ n ▁ ▁ ▁ ▁ v ▁ = ▁ 1 ▁ ▁ ▁ ▁ cnt ▁ = ▁ 0 ▁ ▁ ▁ ▁ while ▁ cnt ▁ < ▁ n : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ # v ▁ = ▁ randint ( 1 , ▁ 10 * * 6 ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ all ( visited [ a ▁ + ▁ v ] ▁ ! = ▁ i ▁ for ▁ a ▁ in ▁ A ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ a ▁ in ▁ A : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ visited [ a ▁ + ▁ v ] ▁ = ▁ i ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ res [ cnt ] ▁ = ▁ v ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ cnt ▁ + = ▁ 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ v ▁ + = ▁ 1 ▁ ▁ ▁ ▁ print ( \" YES \\n \" ▁ + ▁ ' ▁ ' . join ( map ( str , res ) ) ) '''   t = int ( input ( ) )   def check ( arr , v , dic ) : for i in arr : if dic [ i + v ] == 1 : return True return False     def check2 ( arr , v , dic ) : ok = False for i in arr : if dic [ i + v ] == 1 : ok = True break return ok     def check3 ( arr , v , dic ) : return any ( dic [ a + v ] == 1 for a in arr )     dic = [ 0 ] * 2000005   for _ in range ( t ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr . sort ( ) brr = [ 1 ] * n cnt = 0 i = 1 flag = True tmp = { } while cnt < n : ''' ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ while ▁ check ( arr , i , dic ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ i ▁ + = ▁ 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ brr [ cnt ] ▁ = ▁ i  ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ v ▁ in ▁ arr : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ # if ▁ i + v > 2e6 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ # ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ dic [ i + v ] ▁ = ▁ 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ tmp [ i + v ] ▁ = ▁ 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ cnt ▁ + = ▁ 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ''' NEW_LINE", "visited = [ - 1 ] * ( 2 * 10 ** 6 + 1 ) t = int ( input ( ) ) for i in range ( t ) : n , A = int ( input ( ) ) , list ( map ( int , input ( ) . split ( ) ) ) A . sort ( ) res = [ ] v = 1 while len ( res ) < n : flag = True for a in A : if visited [ a + v ] == i : flag = False break if not flag : v += 1 continue for a in A : visited [ a + v ] = i res . append ( v ) v += 1 print ( \" YES \\n \" + ' ▁ ' . join ( map ( str , res ) ) ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) b = [ ] b . append ( 1 ) used = [ 0 ] * ( 10 ** 6 + 1 ) used [ 1 ] = 1 can_be = 2 diffs = [ ] for i in range ( n ) : for j in range ( i + 1 , n ) : diffs . append ( a [ j ] - a [ i ] ) for i in range ( 1 , n ) : for j in diffs : used [ min ( b [ i - 1 ] + j , 10 ** 6 ) ] = 1 while ( used [ can_be ] ) : can_be += 1 b . append ( can_be ) used [ can_be ] = 1 if len ( b ) == n : print ( ' YES ' ) for i in b : print ( i , end = ' ▁ ' ) print ( ' ' ) else : print ( ' NO ' )     NEW_LINE" ]
codeforces_1443_B
[ "import java . util . * ; import java . math . * ; public class SavingTheCity { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; char [ ] arr = sc . next ( ) . toCharArray ( ) ; int ones = 0 ; int zeros = 0 ; int out = 0 ; for ( int i = 0 ; i < arr . length ; i ++ ) { if ( arr [ i ] == '0' ) zeros ++ ; else { ones ++ ; if ( ones == 1 ) out += a ; else out += Math . min ( a , zeros * b ) ; zeros = 0 ; } } System . out . println ( out ) ; } } }", "import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ;   public class B1443 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; String S = in . next ( ) ; int pos1 = S . indexOf ( '1' ) ; int answer = 0 ; if ( pos1 != - 1 ) { List < Integer > gaps = new ArrayList < > ( ) ; while ( true ) { int pos0 = S . indexOf ( '0' , pos1 ) ; if ( pos0 == - 1 ) break ; pos1 = S . indexOf ( '1' , pos0 ) ; if ( pos1 == - 1 ) break ; gaps . add ( pos1 - pos0 ) ; } Collections . sort ( gaps ) ; answer += A ; for ( int gap : gaps ) { answer += Math . min ( gap * B , A ) ; } } System . out . println ( answer ) ; } }   }" ]
[ "from sys import stdin , stdoutstdin . readlinedef NEW_LINE mp ( ) : NEW_LINE return list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE def it ( ) : return int ( stdin . readline ( ) . strip ( ) ) NEW_LINE from collections import defaultdict as dd , Counter as C , dequeimport NEW_LINE math   for _ in range ( it ( ) ) : a , b = mp ( ) NEW_LINE l = input ( ) NEW_LINE s = l . strip ( '0' ) NEW_LINE ind = 0 NEW_LINE ans , flag = a , 0 NEW_LINE for i in range ( 1 , len ( s ) ) : if NEW_LINE s [ i ] == '1' and flag == 0 : k = i - ind NEW_LINE ans += min ( ( k - 1 ) * b , a ) NEW_LINE ind = i NEW_LINE flag = 1 elif s [ i ] == '1' : k = i - ind NEW_LINE ans += min ( ( k - 1 ) * b , a ) NEW_LINE ind = i NEW_LINE if not flag : if NEW_LINE s : NEW_LINE if s [ 0 ] == '1' : NEW_LINE INDENT print ( a ) else : NEW_LINE print ( 0 ) else : print ( 0 ) else : print ( ans )     NEW_LINE DEDENT", "import sysfor NEW_LINE x in range ( int ( input ( ) ) ) : a , b = map ( int , input ( ) . split ( ) ) NEW_LINE s = input ( ) NEW_LINE s = s . strip ( '0' ) NEW_LINE if '1' not in s or s == [ ] : print ( 0 ) NEW_LINE continue NEW_LINE ans = a NEW_LINE zero = 0 NEW_LINE for i in s : if NEW_LINE i == '0' : zero += 1 NEW_LINE if i == '1' : if NEW_LINE zero > 0 : ans += min ( a , zero * b ) NEW_LINE zero = 0 NEW_LINE print ( ans ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : a , b = map ( int , input ( ) . split ( ) ) NEW_LINE s = input ( ) NEW_LINE id = 0 NEW_LINE id1 = 0 NEW_LINE ans = 0 NEW_LINE m = float ( ' inf ' ) NEW_LINE for i in range ( len ( s ) ) : if NEW_LINE s [ i ] == '0' : m += 1 else : ans += min ( a , b * m ) NEW_LINE m = 0 NEW_LINE print ( ans ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : a , b = map ( int , input ( ) . split ( ) ) NEW_LINE s = input ( ) NEW_LINE cnt = 10 ** 6 NEW_LINE ans = 0 NEW_LINE for i in range ( len ( s ) ) : if NEW_LINE s [ i ] == \"0\" : cnt += 1 else : ans += min ( a , cnt * b ) NEW_LINE cnt = 0 NEW_LINE print ( ans ) NEW_LINE" ]
codeforces_1480_A
[ "  import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;    public class Main {   public static void main ( String [ ] args ) throws IOException {   Scanner sc = new Scanner ( System . in ) ; int testCases = sc . nextInt ( ) ; while ( testCases -- > 0 ) { StringBuilder inp = new StringBuilder ( sc . next ( ) ) ; int n = inp . length ( ) ; boolean aliceTurn = true ; for ( int i = 0 ; i < n ; i ++ ) { if ( aliceTurn ) { if ( inp . charAt ( i ) == ' a ' ) { inp . setCharAt ( i , ' b ' ) ; } else { inp . setCharAt ( i , ' a ' ) ; } aliceTurn = false ; } else { if ( inp . charAt ( i ) == ' z ' ) { inp . setCharAt ( i , ' y ' ) ; } else { inp . setCharAt ( i , ' z ' ) ; } aliceTurn = true ; } } System . out . println ( inp . toString ( ) ) ; } }   static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( 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 double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; }   public char nextChar ( ) throws IOException { return next ( ) . charAt ( 0 ) ; }   public String nextLine ( ) throws IOException { return br . readLine ( ) ; }   public boolean ready ( ) throws IOException { return br . ready ( ) ; }   } }", "  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 ( ) ; sc . nextLine ( ) ; while ( t -- > 0 ) { String s = sc . nextLine ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' a ' && i % 2 == 0 ) System . out . print ( \" b \" ) ; else if ( i % 2 == 0 ) System . out . print ( \" a \" ) ; else { if ( s . charAt ( i ) == ' z ' ) System . out . print ( \" y \" ) ; else System . out . print ( \" z \" ) ; } } System . out . println ( ) ; } } }", "import java . util . * ; import java . lang . * ; import java . io . * ; import java . math . BigInteger ;   public class Test { public static void main ( String [ ] args ) { new A ( ) . run ( ) ; } static class A { public void run ( ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { char [ ] s = in . next ( ) . toCharArray ( ) ; int c = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( c == 0 ) { if ( s [ i ] == ' a ' ) s [ i ] = ' b ' ; else s [ i ] = ' a ' ; } else { if ( s [ i ] == ' z ' ) s [ i ] = ' y ' ; else s [ i ] = ' z ' ; } c ^= 1 ; } System . out . println ( s ) ; } } } }", "  import java . util . * ; import java . lang . * ; import java . io . * ;   public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception { FastReader in = new FastReader ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; int t = 1 ; t = in . nextInt ( ) ; while ( t > 0 ) { -- t ; String s = in . next ( ) ; StringBuilder ans = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 ) { if ( s . charAt ( i ) == ' a ' ) sb . append ( \" b \" ) ; else sb . append ( \" a \" ) ; } else { if ( s . charAt ( i ) == ' z ' ) sb . append ( \" y \" ) ; else sb . append ( \" z \" ) ; } } sb . append ( \" \\n \" ) ; } System . out . print ( sb ) ; } static int upper_bound ( int arr [ ] , int x ) { int a = Arrays . binarySearch ( arr , x ) ; if ( a < 0 ) { a *= ( - 1 ) ; return a - 1 ; } else { while ( a < arr . length && arr [ a ] == x ) ++ a ; return a ; } } static long gcd ( long a , long b ) { if ( a == 0 ) return b ; else return gcd ( b % a , a ) ; }" ]
[ "t = int ( input ( ) ) NEW_LINE while t :   NEW_LINE s = input ( ) NEW_LINE strinig_list = [ ] NEW_LINE for i in range ( len ( s ) ) : if NEW_LINE i % 2 == 0 : NEW_LINE if s [ i ] != \" a \" : NEW_LINE INDENT strinig_list . append ( \" a \" ) else : NEW_LINE strinig_list . append ( \" b \" ) else : if s [ i ] != \" z \" : NEW_LINE strinig_list . append ( \" z \" ) else : NEW_LINE strinig_list . append ( \" y \" ) NEW_LINE DEDENT for i in strinig_list : print ( i , end = \" \" ) NEW_LINE print ( \" \" ) NEW_LINE t -= 1   NEW_LINE", "t = int ( input ( ) ) NEW_LINE for i in range ( t ) : s = list ( map ( str , input ( ) ) ) NEW_LINE for j in range ( len ( s ) ) : if NEW_LINE j % 2 == 0 : NEW_LINE if s [ j ] == \" a \" : NEW_LINE INDENT s [ j ] = \" b \" else : NEW_LINE s [ j ] = \" a \" else : if s [ j ] == \" z \" : NEW_LINE s [ j ] = \" y \" else : NEW_LINE s [ j ] = \" z \" NEW_LINE DEDENT print ( ' ' . join ( map ( str , s ) ) )   NEW_LINE", "def solve ( ) : string = input ( ) NEW_LINE newStr = \" \"   for count , i in enumerate ( string ) : if NEW_LINE count % 2 != 0 : NEW_LINE if i == \" z \" : NEW_LINE INDENT newStr += \" y \" else : NEW_LINE newStr += \" z \" else : if i == \" a \" : NEW_LINE newStr += \" b \" else : NEW_LINE newStr += \" a \" NEW_LINE DEDENT print ( newStr )     for i in range ( int ( input ( ) ) ) : solve ( )     NEW_LINE", "for t in range ( int ( input ( ) ) ) : s = input ( ) NEW_LINE r = ' ' NEW_LINE for i in range ( len ( s ) ) : if NEW_LINE i % 2 == 0 : NEW_LINE if s [ i ] != ' a ' : NEW_LINE INDENT r += ' a ' else : NEW_LINE r += ' b ' else : if s [ i ] != ' z ' : NEW_LINE r += ' z ' else : NEW_LINE r += ' y ' NEW_LINE DEDENT print ( r ) NEW_LINE" ]
codeforces_1178_B
[ "import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; String str = s . next ( ) ; long prefix [ ] = new long [ str . length ( ) ] ; long suffix [ ] = new long [ str . length ( ) ] ; for ( int i = 1 ; i < str . length ( ) ; i ++ ) { prefix [ i ] = prefix [ i - 1 ] ; if ( str . charAt ( i ) == ' v ' && str . charAt ( i - 1 ) == ' v ' ) { prefix [ i ] ++ ; } } for ( int i = str . length ( ) - 2 ; i >= 0 ; i -- ) { suffix [ i ] = suffix [ i + 1 ] ; if ( str . charAt ( i ) == ' v ' && str . charAt ( i + 1 ) == ' v ' ) { suffix [ i ] ++ ; }   } long ans = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' o ' ) { ans += prefix [ i ] * suffix [ i ] ; } } System . out . println ( ans ) ; } }", "import java . util . * ; import java . io . * ; import java . math . * ;   public class First { public static void process ( ) throws IOException { String s = nln ( ) . trim ( ) ; char ch [ ] = s . toCharArray ( ) ; int n = ch . length ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( i == 0 ) { a [ i ] = 0 ; } else { if ( ch [ i ] == ' v ' && ch [ i ] == ch [ i - 1 ] ) { a [ i ] = a [ i - 1 ] + 1 ; } else { a [ i ] = a [ i - 1 ] ; } } } int x = a [ n - 1 ] ; long ans = 0l ; for ( int i = 0 ; i < n ; i ++ ) { if ( ch [ i ] == ' o ' ) { ans += ( ( ( long ) a [ i ] ) * ( x - a [ i ] ) ) ; } } pn ( ans ) ; }    static AnotherReader sc ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( System . out ) ; sc = new AnotherReader ( ) ; boolean oj = true ;  ", "import java . io . * ; import java . util . * ; import java . lang . * ;   public class c1 { public static FScanner scan ; public static PrintWriter out ; public static void main ( String [ ] args ) { scan = new FScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;   int T = 1 ;" ]
[ "s = input ( ) dp = [ ] dp . append ( [ 0 ] * len ( s ) ) dp . append ( [ 0 ] * len ( s ) ) dp . append ( [ 0 ] * len ( s ) ) for i in range ( 1 , len ( s ) ) : dp [ 0 ] [ i ] = dp [ 0 ] [ i - 1 ] dp [ 1 ] [ i ] = dp [ 1 ] [ i - 1 ] dp [ 2 ] [ i ] = dp [ 2 ] [ i - 1 ] if s [ i ] == ' o ' : dp [ 1 ] [ i ] += dp [ 0 ] [ i - 1 ] if i > 0 and s [ i - 1 ] == ' v ' and s [ i ] == ' v ' : dp [ 0 ] [ i ] += 1 dp [ 2 ] [ i ] += dp [ 1 ] [ i ] print ( dp [ 2 ] [ - 1 ] ) NEW_LINE", "st = input ( ) li = [ ] s = 0   for i in range ( len ( st ) ) : if ( st [ i ] == \" v \" ) : s += 1 else : if ( s > 1 ) : li . append ( s - 1 ) li . append ( 0 ) s = 0 if ( s > 0 ) : li . append ( s - 1 ) NEW_LINE", "st = input ( ) li = [ ] s = 0   for i in range ( len ( st ) ) : if ( st [ i ] == \" v \" ) : s += 1 else : if ( s > 1 ) : li . append ( s - 1 ) li . append ( 0 ) s = 0 if ( s > 0 ) : li . append ( s - 1 ) NEW_LINE" ]
codeforces_44_B
[ "import java . util . * ;   public class Test {   public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ;   int count = 0 ; for ( int i = 0 ; i <= a ; i += 2 ) { int rem = n ; rem = rem - i / 2 ; for ( int j = 0 ; j <= b && j <= rem ; j ++ ) { int rem1 = rem - j ; if ( rem1 % 2 == 0 && rem1 / 2 <= c ) count ++ ; } } System . out . println ( count ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . io . PrintWriter ;   public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int a = Integer . parseInt ( st . nextToken ( ) ) ; int b = Integer . parseInt ( st . nextToken ( ) ) ; int c = Integer . parseInt ( st . nextToken ( ) ) ; br . close ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int count = 0 ; for ( int j = 0 ; j <= b ; j ++ ) { for ( int k = 0 ; k <= c ; k ++ ) { if ( n - j - 2 * k > 0 && n - j - 2 * k > 0.5 * a ) continue ; if ( n - j - 2 * k >= 0 ) count ++ ; } } pw . println ( count ) ; pw . flush ( ) ; pw . close ( ) ; } }" ]
[ "n , a , b , c = list ( map ( int , input ( ) . split ( ) ) ) res = 0 for x in range ( c + 1 ) : for y in range ( b + 1 ) : diff = n - 2 * x - y if diff >= 0 and diff * 2 <= a : res += 1 print ( res ) NEW_LINE", "def nik ( rudy , x , y , z , cot ) : for i in range ( z + 1 ) : for j in range ( y + 1 ) : t = rudy - i * 2 - j if t >= 0 and x * 0.5 >= t : cot += 1 return cotrudy , x , y , z = list ( map ( int , input ( ) . split ( ) ) ) cot = 0 print ( nik ( rudy , x , y , z , cot ) )   NEW_LINE", "def nik ( rudy , pig , y , z ) : temp = 0 for i in range ( z + 1 ) : for j in range ( y + 1 ) : t = rudy - i * 2 - j if t >= 0 and pig * 0.5 >= t : temp += 1 print ( temp ) rudy , pig , y , z = list ( map ( int , input ( ) . split ( ) ) ) nik ( rudy , pig , y , z ) NEW_LINE", "n , c , b , a = map ( int , input ( ) . split ( ) )   c = c // 2   k = 0 for i in range ( a + 1 ) :   if 2 * i > n : break   for j in range ( b + 1 ) :   if 2 * i + j > n :   break   if 2 * i + j + c >= n :   k += 1   print ( k ) NEW_LINE" ]
codeforces_596_A
[ "import com . sun . org . apache . bcel . internal . generic . AALOAD ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ;   public class Main {   static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; }   public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int x1 , y1 , x2 , y2 ; x1 = y1 = Integer . MAX_VALUE ; x2 = y2 = Integer . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; x1 = Math . min ( x1 , a ) ; y1 = Math . min ( y1 , b ) ; x2 = Math . max ( x2 , a ) ; y2 = Math . max ( y2 , b ) ; } if ( x1 == x2 || y1 == y2 ) { System . out . println ( \" - 1\" ) ; } else { System . out . println ( Math . abs ( x2 - x1 ) * Math . abs ( y2 - y1 ) ) ; } }   }", "  import java . util . * ; import java . lang . * ; import java . io . * ;   public class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception {", "import java . util . Scanner ;   public class SymmetryPool { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ;   int [ ] [ ] coo = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { coo [ i ] [ 0 ] = scanner . nextInt ( ) ; coo [ i ] [ 1 ] = scanner . nextInt ( ) ; }   if ( n == 1 ) { System . out . println ( - 1 ) ; } else if ( n == 2 ) { int side1 = Math . abs ( coo [ 0 ] [ 1 ] - coo [ 1 ] [ 1 ] ) ; int side2 = Math . abs ( coo [ 0 ] [ 0 ] - coo [ 1 ] [ 0 ] ) ; if ( side1 == 0 || side2 == 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( side1 * side2 ) ; } } else { int side1 = 0 ; int side2 = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { if ( coo [ i ] [ 1 ] - coo [ i + 1 ] [ 1 ] != 0 ) side2 = Math . abs ( coo [ i ] [ 1 ] - coo [ i + 1 ] [ 1 ] ) ; if ( coo [ i ] [ 0 ] - coo [ i + 1 ] [ 0 ] != 0 ) side1 = Math . abs ( coo [ i ] [ 0 ] - coo [ i + 1 ] [ 0 ] ) ; }   System . out . println ( side1 * side2 ) ; } } }" ]
[ "n = int ( input ( ) ) v = [ ] for i in range ( n ) : a = list ( map ( int , input ( ) . split ( ) ) ) v . append ( a )   if n == 2 and v [ 0 ] [ 0 ] != v [ 1 ] [ 0 ] and v [ 0 ] [ 1 ] != v [ 1 ] [ 1 ] : print ( abs ( v [ 0 ] [ 0 ] - v [ 1 ] [ 0 ] ) * abs ( v [ 0 ] [ 1 ] - v [ 1 ] [ 1 ] ) )   elif n == 3 or n == 4 : print ( abs ( v [ 0 ] [ 0 ] - v [ 1 ] [ 0 ] ) * abs ( v [ 0 ] [ 1 ] - v [ 1 ] [ 1 ] ) + abs ( v [ 0 ] [ 0 ] - v [ 2 ] [ 0 ] ) * abs ( v [ 0 ] [ 1 ] - v [ 2 ] [ 1 ] ) + abs ( v [ 2 ] [ 0 ] - v [ 1 ] [ 0 ] ) * abs ( v [ 2 ] [ 1 ] - v [ 1 ] [ 1 ] ) ) else : print ( - 1 )   NEW_LINE", "n = int ( input ( ) ) if n == 1 : x1 , y1 = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) print ( - 1 ) elif n == 2 : x1 , y1 = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) x2 , y2 = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) if x1 == x2 or y1 == y2 : print ( - 1 ) else : print ( abs ( x1 - x2 ) * abs ( y1 - y2 ) ) elif n == 3 : x1 , y1 = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) x2 , y2 = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) x3 , y3 = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) if x1 != x2 and y1 != y2 : print ( abs ( x1 - x2 ) * abs ( y1 - y2 ) ) elif x1 != x3 and y1 != y3 : print ( abs ( x1 - x3 ) * abs ( y1 - y3 ) ) else : print ( abs ( x2 - x3 ) * abs ( y2 - y3 ) ) else : x1 , y1 = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) x2 , y2 = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) x3 , y3 = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) x4 , y4 = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) if x1 != x2 and y1 != y2 : print ( abs ( x1 - x2 ) * abs ( y1 - y2 ) ) elif x1 != x3 and y1 != y3 : print ( abs ( x1 - x3 ) * abs ( y1 - y3 ) ) else : print ( abs ( x1 - x4 ) * abs ( y1 - y4 ) ) NEW_LINE", "  n = int ( input ( ) ) st = [ ] if n == 1 : print ( \" - 1\" ) elif n == 2 : for i in range ( 2 ) : st . append ( tuple ( map ( int , input ( ) . split ( ) ) ) ) if st [ 0 ] [ 0 ] == st [ 1 ] [ 0 ] or st [ 1 ] [ 1 ] == st [ 0 ] [ 1 ] : print ( \" - 1\" ) else : print ( abs ( st [ 0 ] [ 0 ] - st [ 1 ] [ 0 ] ) * abs ( st [ 1 ] [ 1 ] - st [ 0 ] [ 1 ] ) ) else : b = False for i in range ( n ) : st . append ( tuple ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( n - 1 ) : for ii in range ( i + 1 , n ) : if st [ i ] [ 0 ] != st [ ii ] [ 0 ] and st [ ii ] [ 1 ] != st [ i ] [ 1 ] : print ( abs ( st [ i ] [ 0 ] - st [ ii ] [ 0 ] ) * abs ( st [ i ] [ 1 ] - st [ ii ] [ 1 ] ) ) b = True ; break if b : break     NEW_LINE", "def solve ( ) : n = int ( input ( ) ) pairs = [ ] for _ in range ( n ) : pairs . append ( tuple ( map ( int , input ( ) . split ( ) ) ) )   pairs . sort ( )   left = min ( pairs , key = lambda x : x [ 0 ] ) [ 0 ] right = max ( pairs , key = lambda x : x [ 0 ] ) [ 0 ]   top = max ( pairs , key = lambda x : x [ 1 ] ) [ 1 ] bot = min ( pairs , key = lambda x : x [ 1 ] ) [ 1 ]   area = ( right - left ) * ( top - bot ) if area == 0 : print ( - 1 ) else : print ( area ) solve ( )   NEW_LINE" ]
codeforces_730_A
[ "import java . io . * ; import java . util . * ;   public class Main { static BufferedReader br ; static StringTokenizer st ;   static String nextToken ( ) { try { while ( st == null || ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( br . readLine ( ) ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   static int nextInt ( ) { return Integer . parseInt ( nextToken ( ) ) ; }   static char nextChar ( ) throws IOException { return ( char ) br . read ( ) ; }   private static long nextLong ( ) { return Long . parseLong ( nextToken ( ) ) ; }   private static String nextString ( ) throws IOException { return br . readLine ( ) ; }   public static void main ( String [ ] args ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   void run ( FastScanner in , PrintWriter out ) {   int N = in . nextInt ( ) ; TreeSet < int [ ] > ts = new TreeSet < > ( ( a , b ) -> { return a [ 0 ] == b [ 0 ] ? a [ 1 ] - b [ 1 ] : a [ 0 ] - b [ 0 ] ; } ) ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int [ ] r = new int [ 2 ] ; r [ 0 ] = in . nextInt ( ) ; r [ 1 ] = i ; ts . add ( r ) ;   sum += r [ 0 ] ; }   List < List < Integer > > ans = new ArrayList < > ( ) ; for ( int i = 0 ; i < 10000 && ts . first ( ) [ 0 ] != ts . last ( ) [ 0 ] ; i ++ ) {   int diff = sum - N * ts . first ( ) [ 0 ] ;   int numPick = diff % 2 == 0 ? 2 : 3 ; numPick = Math . min ( numPick , N ) ;  " ]
[ "n = ( int ( input ( ) ) ) R = list ( map ( int , input ( ) . split ( ) ) ) Time = 0 ; check = FalseOutput = [ ] while ( check == False ) : pos_max = [ ] ; pos_sec = [ ] ; Max_sec = - 1 ; Max_num = 0 ; Max = - 1 ; Min = 999999999 ; Time += 1 ; string = ' ' for i in range ( len ( R ) - 1 , - 1 , - 1 ) : if ( R [ i ] < Min ) : Min = R [ i ] if ( R [ i ] > Max ) : Max_sec = Max ; Max = R [ i ] ; pos_sec = pos_max ; pos_max = [ ] ; pos_max . append ( i ) ; Max_num = 1 elif ( R [ i ] == Max ) : Max_num += 1 ; pos_max . append ( i ) elif ( R [ i ] > Max_sec ) : Max_sec = R [ i ] pos_sec = [ ] pos_sec . append ( i ) NEW_LINE", "n = int ( input ( ) )   L = list ( map ( int , input ( ) . split ( ) ) )   ans = 0   M = [ ]   while max ( L ) != min ( L ) :   ans += 1   k = max ( L )   if L . count ( k ) == 3 :   s = ' '   for i in range ( len ( L ) ) :   if L [ i ] == k :   s += '1'   L [ i ] -= 1   else :   s += '0'   M . append ( s )   else :   max_1 = 0   max_2 = 1   if L [ max_1 ] < L [ max_2 ] :   max_1 , max_2 = max_2 , max_1   for i in range ( 2 , n ) :   if L [ i ] > L [ max_1 ] :   max_2 , max_1 = max_1 , i   elif L [ i ] > L [ max_2 ] :   max_2 = i   s = ' '   for i in range ( n ) :   if i == max_1 or i == max_2 :   s += '1'   else :   s += '0'   M . append ( s )   L [ max_1 ] -= 1   if L [ max_1 ] < 0 :   L [ max_1 ] = 0   L [ max_2 ] -= 1   if L [ max_2 ] < 0 :   L [ max_2 ] = 0   print ( max ( L ) )   print ( ans )   for i in M :   print ( i )       NEW_LINE" ]
codeforces_185_A
[ "import java . math . BigInteger ; import java . util . Scanner ;   public class A185 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long N = in . nextLong ( ) ; BigInteger bigN = BigInteger . valueOf ( N ) ; BigInteger two = BigInteger . valueOf ( 2 ) ; BigInteger mod = BigInteger . valueOf ( 1000000007 ) ; BigInteger power = two . modPow ( bigN , mod ) ; long result = power . add ( BigInteger . ONE ) . multiply ( power ) . divide ( two ) . mod ( mod ) . longValue ( ) ; System . out . println ( result ) ; }   }" ]
[ "n = int ( input ( ) ) m = pow ( 10 , 9 ) + 7 if n == 0 : print ( 1 ) else : print ( ( pow ( 2 , 2 * n - 1 , m ) + pow ( 2 , n - 1 , m ) ) % m ) NEW_LINE", "n = int ( input ( ) ) if n == 0 : print ( 1 ) else : p = 1000000007 y = ( n - 1 ) % ( p - 1 ) z = pow ( 2 , y , p ) x = ( z * ( 2 * z + 1 ) ) % p print ( x ) NEW_LINE", "mod = 1000000007 n = int ( input ( ) ) h = pow ( 2 , n , mod ) print ( ( ( ( h ) * ( h + 1 ) ) // 2 ) % mod ) NEW_LINE", "mod = 1000000007 n = int ( input ( ) ) h = pow ( 2 , n , mod ) print ( ( ( ( h ) * ( h + 1 ) ) // 2 ) % mod ) NEW_LINE", "z = 1000000007 def f ( a , m ) : p = 1 while m : if m % 2 : p = ( p * a ) % z m -= 1 else : m //= 2 a = ( a * a ) % z return pn = int ( input ( ) ) x = f ( 2 , n ) print ( ( x * ( x + 1 ) // 2 ) % z ) NEW_LINE" ]
codeforces_424_B
[ "import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class Compressing { public static class pair { double dist ; int pop ; public pair ( double dist , int pop ) { this . dist = dist ; this . pop = pop ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int pop = sc . nextInt ( ) ; pair [ ] ar = new pair [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; double dist = Math . sqrt ( x * x + y * y ) ; ar [ i ] = new pair ( dist , c ) ; } Arrays . sort ( ar , ( a , b ) -> Double . compare ( a . dist , b . dist ) ) ; int i = 0 ; while ( pop < 1000000 && i < n ) { pop += ar [ i ] . pop ;", "import java . util . * ;   public class Main {   public static double distance ( double x , double y ) { return Math . sqrt ( ( x * x ) + ( y * y ) ) ; }   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; long s = input . nextLong ( ) ; double a [ ] [ ] = new double [ n ] [ 2 ] ; TreeMap < Double , Long > map = new TreeMap < > ( ) ; long sum = s ; for ( int i = 0 ; i < n ; i ++ ) { double x = input . nextDouble ( ) ; double y = input . nextDouble ( ) ; long people = input . nextLong ( ) ; double key = distance ( x , y ) ; map . put ( key , map . getOrDefault ( key , 0L ) + people ) ; sum += people ; } if ( sum < 1000000 ) { System . out . println ( \" - 1\" ) ; } else { for ( Map . Entry < Double , Long > entry : map . entrySet ( ) ) { Long value = entry . getValue ( ) ; s += value ; if ( s >= 1000000 ) { System . out . println ( entry . getKey ( ) ) ; return ; } } }   }   }", "import java . lang . * ; import java . util . * ; import java . io . * ;   public class Codeforces {   public void solve ( ) throws IOException { FastScanner fs = new FastScanner ( ) ; StringBuilder print = new StringBuilder ( ) ; int n = fs . nextInt ( ) , pop = fs . nextInt ( ) ; Places [ ] places = new Places [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = fs . nextInt ( ) , y = fs . nextInt ( ) , p = fs . nextInt ( ) ; float d = x * x + y * y ; places [ i ] = new Places ( d , p ) ; } Arrays . sort ( places , ( o1 , o2 ) -> { if ( o1 . r != o2 . r ) return ( int ) ( o1 . r - o2 . r ) ; else return o2 . pop - o1 . pop ; } ) ; for ( int i = 0 ; i < n ; i ++ ) { pop += places [ i ] . pop ; if ( pop >= 1000000 ) { System . out . printf ( \" % .6f % n \" , Math . sqrt ( places [ i ] . r ) ) ; return ; } } System . out . println ( \" - 1\" ) ; } class Places { float r ; int pop ; Places ( float r , int pop ) { this . r = r ; this . pop = pop ; } } public static void main ( String [ ] args ) throws IOException { try { new Codeforces ( ) . solve ( ) ; } catch ( Exception e ) {" ]
[ "n , p = map ( int , input ( ) . split ( ) ) dic = { } for i in range ( n ) : x , y , t = map ( int , input ( ) . split ( ) ) dist = ( ( x ** 2 ) + ( y ** 2 ) ) ** .5 if dist in dic . keys ( ) : dic [ dist ] = dic [ dist ] + t else : dic [ dist ] = tfor j in sorted ( dic ) : p = p + dic [ j ] if p >= 1000000 : print ( j ) breakelse : print ( - 1 ) NEW_LINE", "from sys import stdin , stdoutfrom math import sqrtnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) sq = lambda x , y : ( x * x + y * y ) mega = 10 ** 6 def fn ( rad ) : sm = init for a , b , pop in l1 : if sq ( a , b ) <= rad : sm += pop if sm >= mega : return True return Falsefor _ in range ( 1 ) : NEW_LINE", "from math import sqrt as rfrom collections import defaultdict as dq   n , s = map ( int , input ( ) . split ( ) )   left = 1000000 - s   d = dq ( int ) for i in range ( n ) : x , y , k = map ( int , input ( ) . split ( ) ) d [ x , y ] = k   minm = float ( ' inf ' ) f = 0 for k1 , v1 in d . items ( ) : xc = abs ( k1 [ 0 ] ) yc = abs ( k1 [ 1 ] ) total = 0 rad = round ( r ( xc ** 2 + ( yc ** 2 ) ) , 7 ) for k2 , v2 in d . items ( ) : if round ( r ( k2 [ 0 ] ** 2 + ( k2 [ 1 ] ** 2 ) ) , 7 ) <= rad : total += v2 if total >= left : if rad < minm : minm = rad f = 1   print ( minm if f == 1 else - 1 ) NEW_LINE", "import mathn , s = map ( int , input ( ) . split ( ) ) dist = [ ] for _ in range ( n ) : x , y , k = map ( int , input ( ) . split ( ) ) dist . append ( [ math . sqrt ( x * x + y * y ) , k ] ) left = 1000000 - sdist . sort ( key = lambda x : x [ 0 ] ) ans = 0 i = - 1 while ans < left : i += 1 if i == n : break ans = ans + dist [ i ] [ 1 ] if i >= 0 and i < n : print ( dist [ i ] [ 0 ] ) else : print ( \" - 1\" ) NEW_LINE" ]
codeforces_566_A
[ "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . io . BufferedWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . Writer ; import java . io . OutputStreamWriter ; import java . util . NoSuchElementException ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { new Thread ( null , new TaskA ( ) , \" qqq \" , 256 * 1024 * 1024 ) . start ( ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . NoSuchElementException ; import java . util . StringTokenizer ;   public class CodeforceSol11a { static FastScanner in ; static PrintWriter out ; public static class FastScanner { BufferedReader br ; StringTokenizer st ; public FastScanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( 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 ( ) ) ; } }   public static void main ( String [ ] args ) {" ]
[ "import sys   class Node : def __init__ ( self , d ) : global nodes self . ch = { } self . a = [ [ ] , [ ] ] self . d = d nodes += [ self ]   nodes = [ ] pairs = [ ] res = 0   N = int ( sys . stdin . readline ( ) ) _input = sys . stdin . readlines ( ) _input = [ s [ : - 1 ] for s in _input ] A = [ _input [ : N ] , _input [ N : ] ] T = Node ( 0 )   for i , l in enumerate ( A ) : for j , s in enumerate ( l ) : t = T for c in s : v = ord ( c ) - ord ( ' a ' ) if not v in t . ch : t . ch [ v ] = Node ( t . d + 1 ) t = t . ch [ v ] t . a [ i ] += [ j + 1 ]   for n in reversed ( nodes ) : for i in n . ch : n . a [ 0 ] += n . ch [ i ] . a [ 0 ] n . a [ 1 ] += n . ch [ i ] . a [ 1 ] k = min ( len ( n . a [ 0 ] ) , len ( n . a [ 1 ] ) ) for i in range ( k ) : pairs += [ str ( n . a [ 0 ] [ - 1 ] ) + ' ▁ ' + str ( n . a [ 1 ] [ - 1 ] ) ] n . a [ 0 ] . pop ( ) n . a [ 1 ] . pop ( ) res += n . d   print ( res ) print ( ' \\n ' . join ( pairs ) ) NEW_LINE", "import sys   SIGMA = 26   nodes = [ ] pairs = [ ] res = 0   class Node : def __init__ ( self ) : self . ch = { } self . a = [ ] self . b = [ ] self . d = 0   def add ( self , s , i ) : t = self for c in s : v = ord ( c ) - ord ( ' a ' ) if not v in t . ch : t . ch [ v ] = Node ( ) t . ch [ v ] . d = t . d + 1 nodes . append ( t . ch [ v ] ) t = t . ch [ v ] t . a . append ( i )   def inc ( self , s , i ) : t = self for c in s : v = ord ( c ) - ord ( ' a ' ) if not v in t . ch : break t = t . ch [ v ] t . b . append ( i )   def solve ( self ) : global pairs global res for i in range ( SIGMA ) : if i in self . ch : self . a . extend ( self . ch [ i ] . a ) self . b . extend ( self . ch [ i ] . b ) k = min ( len ( self . a ) , len ( self . b ) ) for i in range ( k ) : pairs . append ( str ( self . a [ - 1 ] ) + ' ▁ ' + str ( self . b [ - 1 ] ) ) self . a . pop ( ) self . b . pop ( ) res += self . d return res   sys . setrecursionlimit ( 2000000 ) _input = sys . stdin . readlines ( ) _input = [ s [ : - 1 ] for s in _input ] N = int ( _input [ 0 ] ) A = _input [ 1 : N + 1 ] B = _input [ N + 1 : ] T = Node ( ) nodes . append ( T ) for i , s in enumerate ( A ) : T . add ( s , i + 1 ) for i , s in enumerate ( B ) : T . inc ( s , i + 1 ) for n in reversed ( nodes ) : n . solve ( ) print ( res ) print ( ' \\n ' . join ( pairs ) ) NEW_LINE", "import sys   SIGMA = 26   nodes = [ ] pairs = [ ] res = 0   class Node : def __init__ ( self ) : self . ch = { } self . a = [ ] self . b = [ ] self . d = 0   def add ( self , s , i ) : t = self for c in s : v = ord ( c ) - ord ( ' a ' ) if not v in t . ch : t . ch [ v ] = Node ( ) t . ch [ v ] . d = t . d + 1 nodes . append ( t . ch [ v ] ) t = t . ch [ v ] t . a . append ( i )   def inc ( self , s , i ) : t = self for c in s : v = ord ( c ) - ord ( ' a ' ) if not v in t . ch : break t = t . ch [ v ] t . b . append ( i )   def solve ( self ) : global pairs global res for i in range ( SIGMA ) : if i in self . ch : self . a . extend ( self . ch [ i ] . a ) self . b . extend ( self . ch [ i ] . b ) k = min ( len ( self . a ) , len ( self . b ) ) for i in range ( k ) : pairs . append ( str ( self . a [ - 1 ] ) + ' ▁ ' + str ( self . b [ - 1 ] ) ) self . a . pop ( ) self . b . pop ( ) res += self . d return res   _input = sys . stdin . readlines ( ) _input = [ s [ : - 1 ] for s in _input ] N = int ( _input [ 0 ] ) A = _input [ 1 : N + 1 ] B = _input [ N + 1 : ] T = Node ( ) nodes . append ( T ) for i , s in enumerate ( A ) : T . add ( s , i + 1 ) for i , s in enumerate ( B ) : T . inc ( s , i + 1 ) for n in reversed ( nodes ) : n . solve ( ) print ( res ) print ( ' \\n ' . join ( pairs ) ) NEW_LINE" ]
codeforces_789_B
[ "import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ; Student ( int x , int y ) { this . x = x ; this . y = y ;", "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class cdfmu2b { static void merge ( int arr [ ] , int l , int m , int r ) { int n1 = m - l + 1 ; int n2 = r - m ; int L [ ] = new int [ n1 ] ; int R [ ] = new int [ n2 ] ; for ( int i = 0 ; i < n1 ; ++ i ) L [ i ] = arr [ l + i ] ; for ( int j = 0 ; j < n2 ; ++ j ) R [ j ] = arr [ m + 1 + j ] ; int i = 0 , j = 0 ; int k = l ; while ( i < n1 && j < n2 ) { if ( L [ i ] <= R [ j ] ) { arr [ k ] = L [ i ] ; i ++ ; } else { arr [ k ] = R [ j ] ; j ++ ; } k ++ ; } while ( i < n1 ) { arr [ k ] = L [ i ] ; i ++ ; k ++ ; } while ( j < n2 ) { arr [ k ] = R [ j ] ; j ++ ; k ++ ; } } static void sort ( int arr [ ] , int l , int r ) { if ( l < r ) { int m = ( l + r ) / 2 ; sort ( arr , l , m ) ; sort ( arr , m + 1 , r ) ; merge ( arr , l , m , r ) ; } } public static int lowerBound ( int [ ] array , int length , int value ) { int low = 0 ; int high = length ; while ( low < high ) { final int mid = ( low + high ) / 2 ;", "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class cdfmu2b { static void merge ( int arr [ ] , int l , int m , int r ) { int n1 = m - l + 1 ; int n2 = r - m ; int L [ ] = new int [ n1 ] ; int R [ ] = new int [ n2 ] ; for ( int i = 0 ; i < n1 ; ++ i ) L [ i ] = arr [ l + i ] ; for ( int j = 0 ; j < n2 ; ++ j ) R [ j ] = arr [ m + 1 + j ] ; int i = 0 , j = 0 ; int k = l ; while ( i < n1 && j < n2 ) { if ( L [ i ] <= R [ j ] ) { arr [ k ] = L [ i ] ; i ++ ; } else { arr [ k ] = R [ j ] ; j ++ ; } k ++ ; } while ( i < n1 ) { arr [ k ] = L [ i ] ; i ++ ; k ++ ; } while ( j < n2 ) { arr [ k ] = R [ j ] ; j ++ ; k ++ ; } } static void sort ( int arr [ ] , int l , int r ) { if ( l < r ) { int m = ( l + r ) / 2 ; sort ( arr , l , m ) ; sort ( arr , m + 1 , r ) ; merge ( arr , l , m , r ) ; } } public static int lowerBound ( int [ ] array , int length , int value ) { int low = 0 ; int high = length ; while ( low < high ) { final int mid = ( low + high ) / 2 ;" ]
[ "from collections import defaultdictb , q , l , m = map ( int , input ( ) . split ( ) ) arr = [ int ( x ) for x in input ( ) . split ( ) ] d = defaultdict ( bool ) for i in arr : d [ i ] = Trueif ( b == 0 ) : if ( d [ b ] ) : print ( 0 ) else : print ( \" inf \" ) elif ( q == 0 ) : if ( abs ( b ) > l ) : print ( 0 ) else : ans = 0 if ( not d [ b ] ) : ans += 1 if ( d [ 0 ] ) : print ( ans ) else : print ( \" inf \" )   elif ( q == 1 ) : if ( abs ( b ) > l ) : print ( 0 ) else : if ( d [ b ] ) : print ( 0 ) else : print ( \" inf \" ) elif ( q == - 1 ) : if ( abs ( b ) > l ) : print ( 0 ) else : if ( d [ b ] and d [ - b ] ) : print ( 0 ) else : print ( \" inf \" ) else : possible = [ ] curr = b while ( abs ( curr ) <= l ) : if ( not d [ curr ] ) : possible . append ( curr ) curr *= q print ( len ( possible ) ) NEW_LINE", "b1 , q , l , m = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) if abs ( b1 ) > l : print ( 0 ) elif b1 == 0 : if b1 in a : print ( 0 ) else : print ( ' inf ' ) elif q == 1 : if b1 in a : print ( 0 ) else : print ( ' inf ' ) elif q == - 1 : if b1 in a and - b1 in a : print ( 0 ) else : print ( ' inf ' ) elif q == 0 : if 0 not in a : print ( ' inf ' ) elif b1 in a : print ( 0 ) else : print ( 1 ) else : ans = 0 while abs ( b1 ) <= l : if b1 not in a : ans = ans + 1 b1 = b1 * q print ( ans ) NEW_LINE", "a , b , c , d = map ( int , input ( ) . split ( ) ) l = set ( list ( map ( int , input ( ) . split ( ) ) ) ) if ( abs ( a ) > c ) : print ( 0 ) exit ( 0 ) if ( a == 0 ) : if 0 in l : print ( 0 ) exit ( 0 ) else : print ( \" inf \" ) exit ( 0 ) if ( b == 1 ) : if a in l : print ( 0 ) exit ( 0 ) else : print ( \" inf \" ) exit ( 0 ) if ( b == - 1 ) : if ( - a in l ) and ( a in l ) : print ( 0 ) exit ( 0 ) else : print ( \" inf \" ) exit ( 0 ) if ( b == 0 ) : if 0 in l : if a in l : print ( 0 ) exit ( 0 ) else : print ( 1 ) exit ( 0 ) else : print ( \" inf \" ) exit ( 0 ) ans = 0 while ( abs ( a ) <= c ) : if ( a not in l ) : ans += 1 a = a * bprint ( ans ) NEW_LINE", "b , q , L , m = map ( int , input ( ) . split ( ) ) p = list ( map ( int , input ( ) . split ( ) ) )   def solve ( b , q , L , m , p ) : if q == 1 : if b in p : return 0 elif abs ( b ) <= L : return ' inf ' else : return 0 if q == - 1 : if ( b not in p or - b not in p ) and abs ( b ) <= L : return ' inf ' else : return 0 if q == 0 : if 0 not in p and abs ( b ) <= L : return ' inf ' elif b in p or not abs ( b ) <= L : return 0 else : return 1 if b == 0 : if 0 not in p : return ' inf ' else : return 0 s = 0 while abs ( b ) <= L : if b not in p : s += 1 b = b * q return s   print ( solve ( b , q , L , m , p ) ) NEW_LINE", "a , b , c , d = map ( int , input ( ) . split ( ) ) l = set ( list ( map ( int , input ( ) . split ( ) ) ) ) if ( abs ( a ) > c ) : print ( 0 ) exit ( 0 ) if ( a == 0 ) : if 0 in l : print ( 0 ) exit ( 0 ) else : print ( \" inf \" ) exit ( 0 ) if ( b == 1 ) : if a in l : print ( 0 ) exit ( 0 ) else : print ( \" inf \" ) exit ( 0 ) if ( b == - 1 ) : if ( - a in l ) and ( a in l ) : print ( 0 ) exit ( 0 ) else : print ( \" inf \" ) exit ( 0 ) if ( b == 0 ) : if 0 in l : if a in l : print ( 0 ) exit ( 0 ) else : print ( 1 ) exit ( 0 ) else : print ( \" inf \" ) exit ( 0 ) ans = 0 while ( abs ( a ) <= c ) : if ( a not in l ) : ans += 1 a = a * bprint ( ans ) NEW_LINE" ]
codeforces_416_B
[ "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 m = sc . nextInt ( ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main {   public static void main ( String [ ] args ) { FastScanner input = new FastScanner ( ) ;   int pictures = input . nextInt ( ) ; int painters = input . nextInt ( ) ; int a [ ] [ ] = new int [ pictures + 1 ] [ painters + 1 ] ; for ( int i = 1 ; i <= pictures ; i ++ ) { for ( int j = 1 ; j <= painters ; j ++ ) { a [ i ] [ j ] = Math . max ( a [ i ] [ j - 1 ] , a [ i - 1 ] [ j ] ) + input . nextInt ( ) ; } } for ( int i = 1 ; i <= pictures ; i ++ ) { System . out . print ( a [ i ] [ painters ] + \" ▁ \" ) ; } System . out . println ( \" \" ) ; }   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 ( ) ; } }   }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class Task416B { public static void main ( String [ ] args ) throws IOException { Task416B task = new Task416B ( ) ; task . resolve ( ) ; }   private void resolve ( ) throws IOException { BufferedReader bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   String [ ] strings = bufferedReader . readLine ( ) . split ( \" ▁ \" ) ; int pictureCount = Integer . parseInt ( strings [ 0 ] ) ; int artistCount = Integer . parseInt ( strings [ 1 ] ) ;   int [ ] [ ] drawTime = new int [ pictureCount ] [ artistCount ] ; for ( int i = 0 ; i < pictureCount ; i ++ ) { strings = bufferedReader . readLine ( ) . split ( \" ▁ \" ) ; for ( int j = 0 ; j < artistCount ; j ++ ) { drawTime [ i ] [ j ] = Integer . parseInt ( strings [ j ] ) ; } }   int [ ] [ ] endTime = new int [ pictureCount ] [ artistCount ] ; endTime [ 0 ] [ 0 ] = drawTime [ 0 ] [ 0 ] ; for ( int i = 1 ; i < artistCount ; i ++ ) { endTime [ 0 ] [ i ] = drawTime [ 0 ] [ i ] + endTime [ 0 ] [ i - 1 ] ; }   for ( int i = 1 ; i < pictureCount ; i ++ ) { endTime [ i ] [ 0 ] = drawTime [ i ] [ 0 ] + endTime [ i - 1 ] [ 0 ] ; }   for ( int i = 1 ; i < pictureCount ; i ++ ) { for ( int j = 1 ; j < artistCount ; j ++ ) { endTime [ i ] [ j ] = Math . max ( endTime [ i - 1 ] [ j ] , endTime [ i ] [ j - 1 ] ) + drawTime [ i ] [ j ] ; } }   for ( int i = 0 ; i < pictureCount ; i ++ ) { System . out . print ( endTime [ i ] [ artistCount - 1 ] + \" ▁ \" ) ; } } }" ]
[ "m , n = map ( int , input ( ) . split ( ) ) l = [ ] for i in range ( m ) : k = list ( map ( int , input ( ) . split ( ) ) ) l . append ( k ) p = [ 0 ] * 6 for i in range ( m ) : for j in range ( 1 , n + 1 ) : p [ j ] = max ( p [ j ] , p [ j - 1 ] ) p [ j ] += l [ i ] [ j - 1 ] print ( p [ n ] , end = ' ▁ ' ) NEW_LINE", "from itertools import accumulatem , n = map ( int , input ( ) . split ( ) ) t = [ ] for i in range ( m ) : arr = list ( map ( int , input ( ) . split ( ) ) ) t . append ( arr ) d = [ 0 ] * mfor i in range ( n ) : d [ 0 ] += t [ 0 ] [ i ] for j in range ( 1 , m ) : d [ j ] = max ( d [ j - 1 ] , d [ j ] ) + t [ j ] [ i ] print ( * d ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) x = [ ] for i in range ( n ) : x . append ( list ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( 1 , m ) : x [ 0 ] [ i ] += x [ 0 ] [ i - 1 ] for i in range ( 1 , n ) : for j in range ( m ) : if j == 0 : x [ i ] [ j ] += x [ i - 1 ] [ j ] else : x [ i ] [ j ] += max ( x [ i - 1 ] [ j ] , x [ i ] [ j - 1 ] ) for i in x : print ( i [ - 1 ] , end = \" ▁ \" ) NEW_LINE", "import sysimport mathdef fn ( n , m , a ) : if n == 1 : t1 = 0 for i in range ( m ) : t1 = t1 + a [ i ] [ 0 ] print ( t1 , end = ' ▁ ' ) return 0 t = [ 0 ] * n t [ 0 ] = a [ 0 ] [ 0 ] for i in range ( 1 , n ) : t [ i ] = a [ 0 ] [ i ] + t [ i - 1 ] print ( t [ n - 1 ] , end = ' ▁ ' ) for i in range ( 1 , m ) : t [ 0 ] = t [ 0 ] + a [ i ] [ 0 ] for j in range ( n - 1 ) : if t [ j + 1 ] < t [ j ] : t [ j + 1 ] = a [ i ] [ j + 1 ] + t [ j ] else : t [ j + 1 ] = t [ j + 1 ] + a [ i ] [ j + 1 ] print ( t [ n - 1 ] , end = ' ▁ ' ) if __name__ == ' _ _ main _ _ ' : input = sys . stdin . read ( ) data = list ( map ( int , input . split ( ) ) ) n = ( data [ 1 ] ) m = data [ 0 ] a = [ [ 0 ] * n for i in range ( m ) ] l = data [ 2 : ] k = 0 for i in range ( m ) : for j in range ( n ) : a [ i ] [ j ] = l [ k ] k = k + 1 ( fn ( n , m , a ) ) NEW_LINE", "m , n = map ( int , input ( ) . split ( ) ) t = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( m ) ] cnt = [ [ 0 ] * n for i in range ( m ) ] for i in range ( m ) : for j in range ( n ) : if i == j == 0 : cnt [ i ] [ j ] = t [ i ] [ j ] elif i == 0 : cnt [ i ] [ j ] = cnt [ i ] [ j - 1 ] + t [ i ] [ j ] elif j == 0 : cnt [ i ] [ j ] = cnt [ i - 1 ] [ j ] + t [ i ] [ j ] else : cnt [ i ] [ j ] = max ( cnt [ i - 1 ] [ j ] , cnt [ i ] [ j - 1 ] ) + t [ i ] [ j ] ans = [ ] for i in range ( m ) : ans . append ( cnt [ i ] [ n - 1 ] ) print ( * ans ) NEW_LINE" ]
codeforces_1146_B
[ "import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) {   Scanner scanner = new Scanner ( System . in ) ; String s = scanner . next ( ) ; String newstr = s . replaceAll ( \" a \" , \" \" ) ;   int removedcharlength = s . length ( ) - newstr . length ( ) ; int midindex = newstr . length ( ) / 2 ; if ( newstr . substring ( 0 , midindex ) . equals ( newstr . substring ( midindex ) ) ) { String strz = s . substring ( 0 , midindex + removedcharlength ) . replaceAll ( \" a \" , \" \" ) ;   if ( s . substring ( midindex + removedcharlength ) . equals ( strz ) ) System . out . println ( s . substring ( 0 , midindex + removedcharlength ) ) ; else System . out . println ( \" : ( \" ) ; } else System . out . println ( \" : ( \" ) ;   }   }", "  import java . util . * ; public class file { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; String str = scn . nextLine ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( char c : str . toCharArray ( ) ) { if ( c != ' a ' ) { sb . append ( c ) ; } } if ( sb . length ( ) % 2 == 0 ) { if ( sb . substring ( 0 , sb . length ( ) / 2 ) . equals ( sb . substring ( sb . length ( ) / 2 , sb . length ( ) ) ) ) { if ( str . substring ( str . length ( ) - sb . length ( ) / 2 , str . length ( ) ) . equals ( sb . substring ( 0 , sb . length ( ) / 2 ) ) ) { System . out . println ( str . substring ( 0 , str . length ( ) - sb . length ( ) / 2 ) ) ; } else { System . out . println ( \" : ( \" ) ; } } else { System . out . println ( \" : ( \" ) ; } } else { System . out . println ( \" : ( \" ) ; } } }", "import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String t = in . next ( ) ; String s = t . substring ( 0 , ( int ) ( t . length ( ) + t . chars ( ) . filter ( c -> c == ' a ' ) . count ( ) ) / 2 ) ; System . out . println ( t . equals ( s + s . replaceAll ( \" a \" , \" \" ) ) ? s : \" : ( \" ) ; } }" ]
[ "def check ( t , n ) : flag = True if n % 2 != 0 : return False mid = n // 2 i = 0 while i < n // 2 : if t [ i ] != t [ mid ] : flag = False break i += 1 mid += 1 return flagif __name__ == ' _ _ main _ _ ' : t = input ( ) n = len ( t ) S = set ( t ) if len ( S ) == 1 and ' a ' in S : print ( t ) elif t . count ( ' a ' ) == 0 : if n % 2 == 1 : print ( ' : ( ' ) else : if not check ( t , n ) : print ( ' : ( ' ) else : print ( t [ : n // 2 ] ) else : s = ' ' for i in range ( n ) : if t [ i ] != ' a ' : s += t [ i ] if check ( s , len ( s ) ) : s = s [ len ( s ) // 2 : ] if t [ n - len ( s ) : ] == s : print ( t [ : n - len ( s ) ] ) else : print ( ' : ( ' ) else : print ( ' : ( ' ) NEW_LINE", "t = input ( ) c = 0 n = len ( t ) s = ' ' a = ' : ( ' for i in range ( n ) : if i - c == n - i : if s == t [ i : ] : a = t [ : i ] break if t [ i ] == ' a ' : c += 1 if t [ i ] != ' a ' : s += t [ i ] if c == n : print ( t ) else : print ( a ) NEW_LINE", "T = input ( ) Tp = ' '   for i in T : Tp += ( i , ' ' ) [ i == ' a ' ]   l = len ( Tp ) k = len ( T )   if l % 2 == 1 : print ( ' : ( ' ) exit ( 0 )   for i , j in zip ( range ( 1 + l // 2 ) , range ( l // 2 , l ) ) : if not Tp [ i ] == Tp [ j ] : print ( ' : ( ' ) exit ( 0 )   for i in range ( k - l // 2 , k ) : if T [ i ] == ' a ' : print ( ' : ( ' ) exit ( 0 )   for i in range ( k - l // 2 ) : print ( T [ i ] , end = ' ' ) NEW_LINE", "def check ( arr , s ) : if len ( arr ) != len ( s ) : return False n = len ( arr ) for i in range ( n ) : if arr [ i ] != s [ i ] : return False return Trues = input ( ) n = len ( s ) cta = s . count ( ' a ' ) ans = \" : ( \" new = 0 if cta == n : ans = selif cta == 0 : if n % 2 == 0 and s [ : n // 2 ] == s [ n // 2 : ] : ans = s [ : n // 2 ] else : ind = 0 rem = [ ] for i in range ( n ) : if s [ i ] == ' a ' : ind = i for i in range ( ind ) : if s [ i ] != ' a ' : rem . append ( s [ i ] ) new += 1 for i in range ( ind + 1 , n ) : rem_len = n - i if rem_len == new : if check ( rem , s [ i : ] ) : ans = s [ : i ] break else : rem . append ( s [ i ] ) new += 1 print ( ans ) NEW_LINE" ]
codeforces_393_A
[ "import java . util . Scanner ;   public class Nineteen {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s ; s = scanner . nextLine ( ) ; System . out . println ( enumerate ( s ) ) ; }   public static int enumerate ( String source ) { byte [ ] counter = new byte [ ] { - 1 , 0 , 0 , 0 } ; for ( char ch : source . toCharArray ( ) ) { switch ( ch ) { case ' n ' : counter [ 0 ] ++ ; break ; case ' i ' : counter [ 1 ] ++ ; break ; case ' e ' : counter [ 2 ] ++ ; break ; case ' t ' : counter [ 3 ] ++ ; break ; } }   counter [ 0 ] /= 2 ; counter [ 2 ] /= 3 ; int min1 = Math . min ( counter [ 0 ] , counter [ 1 ] ) ; int min2 = Math . min ( counter [ 2 ] , counter [ 3 ] ) ; int min = Math . min ( min1 , min2 ) ; return min ; } }", "import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ;   int n = 0 ; int t = 0 ; int i = 0 ; int e = 0 ; for ( int x = 0 ; x < s . length ( ) ; x ++ ) { if ( s . charAt ( x ) == ' n ' ) n ++ ; if ( s . charAt ( x ) == ' t ' ) t ++ ; if ( s . charAt ( x ) == ' i ' ) i ++ ; if ( s . charAt ( x ) == ' e ' ) e ++ ; } n = ( n - 1 ) / 2 ; e = e / 3 ; int c = Math . min ( n , t ) ; int d = Math . min ( e , i ) ; int z = Math . min ( c , d ) ; System . out . println ( z ) ; } }", "import java . util . Scanner ; public class Nineteen { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s ;", "import java . util . Arrays ; import java . util . Scanner ;   public class Game { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   String str = input . nextLine ( ) ; int [ ] freq = new int [ 4 ] ; Arrays . fill ( freq , 0 ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { switch ( str . charAt ( i ) ) { case ' n ' : freq [ 0 ] ++ ; break ;   case ' i ' : freq [ 1 ] ++ ; break ;   case ' e ' : freq [ 2 ] ++ ; break ;   case ' t ' : freq [ 3 ] ++ ; break ;   default : break ; } } if ( freq [ 0 ] < 3 || freq [ 1 ] < 1 || freq [ 2 ] < 3 || freq [ 3 ] < 1 ) { System . out . println ( 0 ) ; return ; }   int ans = 0 ; if ( freq [ 0 ] >= 3 && freq [ 1 ] >= 1 && freq [ 2 ] >= 3 && freq [ 3 ] >= 1 ) { freq [ 0 ] -- ; } while ( ( freq [ 0 ] >= 2 && ( freq [ 0 ] % 3 <= 2 ) ) && freq [ 1 ] >= 1 && freq [ 2 ] >= 3 && freq [ 3 ] >= 1 ) { freq [ 0 ] -= 2 ; freq [ 1 ] -- ; freq [ 2 ] -= 3 ; freq [ 3 ] -- ; ans ++ ; } System . out . println ( ans ) ;   } }", "import java . util . Arrays ; import java . util . Scanner ; import java . util . Stack ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   while ( sc . hasNext ( ) ) { String source = sc . nextLine ( ) ; int n = 0 ; int e = 0 ; int i = 0 ; int t = 0 ; for ( int j = 0 ; j < source . length ( ) ; j ++ ) { if ( source . charAt ( j ) == ' n ' ) { n ++ ; } if ( source . charAt ( j ) == ' e ' ) { e ++ ; } if ( source . charAt ( j ) == ' t ' ) { t ++ ; } if ( source . charAt ( j ) == ' i ' ) { i ++ ; }   } n = ( n - 1 ) / 2 ; e /= 3 ; int min1 = Math . min ( n , e ) ; int min2 = Math . min ( i , t ) ; int min = Math . min ( min1 , min2 ) ; System . out . println ( min ) ; }   } }" ]
[ "a = str ( input ( ) ) import collectionscnt = collections . Counter ( a ) ans = min ( { ( cnt [ ' n ' ] - 1 ) // 2 , cnt [ ' e ' ] // 3 , cnt [ ' i ' ] , cnt [ ' t ' ] } ) if ans < 1 : print ( 0 ) else : print ( ans ) NEW_LINE", "str = input ( ) ans = { ' n ' : 0 , ' i ' : 0 , ' e ' : 0 , ' t ' : 0 } for i in str : if i in ans : ans [ i ] += 1 ans [ ' n ' ] -= 1 ans [ ' n ' ] //= 2 ans [ ' e ' ] //= 3 ans = min ( ans . values ( ) ) print ( ans if ans > 0 else 0 ) NEW_LINE", "a = input ( ) b = a . count ( ' n ' ) c = a . count ( ' i ' ) d = a . count ( ' e ' ) e = a . count ( ' t ' )   if b > 4 : print ( min ( ( b - 1 ) // 2 , c , d // 3 , e ) ) elif b == 3 or b == 4 : print ( min ( 1 , c , d // 3 , e ) ) else : print ( 0 ) NEW_LINE", "st = input ( ) nn = st . count ( ' n ' ) ne = st . count ( ' e ' ) ni = st . count ( ' i ' ) nt = st . count ( ' t ' )   ans = min ( ( nn - 1 ) // 2 , ne // 3 , ni , nt ) print ( max ( ans , 0 ) ) NEW_LINE", "word = input ( ) n = word . count ( ' n ' ) i = word . count ( ' i ' ) e = word . count ( ' e ' ) t = word . count ( ' t ' )   if ( n < 3 ) : print ( 0 ) else : print ( min ( ( n - 1 ) // 2 , i , e // 3 , t ) ) NEW_LINE" ]
codeforces_124_A
[ "import java . util . Scanner ;   public class noOfPositions { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( ( i - 1 ) >= a && ( n - i ) <= b ) c ++ ; } System . out . println ( c ) ; } }", "import java . util . * ;   public class Solve {   static Scanner scan = new Scanner ( System . in ) ;   public static void solve ( int n , int a , int b ) {   System . out . println ( Math . min ( ( n - a ) , ( b + 1 ) ) ) ; }   public static void main ( String [ ] args ) {   int n = scan . nextInt ( ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ;   solve ( n , a , b ) ; } }", "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 ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int front = 0 ; int end = n ; int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { front ++ ; end -- ; if ( front > a && end <= b ) { ans ++ ;", "  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 ( ) ;  " ]
[ "n , a , b = map ( int , input ( ) . split ( ) ) ans = 0 while n - a - 1 > b : a += 1 print ( n - a ) NEW_LINE", "def main ( ) : n , a , b = map ( int , input ( ) . split ( ) ) print ( n - max ( a + 1 , n - b ) + 1 ) if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "n , a , b = map ( int , input ( ) . split ( ) ) itog = 0 for i in range ( 1 , n + 1 ) : if i - 1 >= a and n - i <= b : itog += 1 print ( itog ) NEW_LINE" ]
codeforces_1307_B
[ "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 . util . * ; public class Problem1307b { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( x % a [ i ] == 0 ) { ans = Math . min ( ans , x / a [ i ] ) ; } else if ( a [ i ] > x ) { ans = Math . min ( ans , x / a [ i ] + 2 ) ; } else { ans = Math . min ( ans , x / a [ i ] + 1 ) ; } } System . out . println ( ans ) ; } } }", "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 n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int arr [ ] = sc . readArray ( n ) ; int max = 0 ; for ( int e : arr ) { if ( e == m ) { System . out . println ( 1 ) ; return ; } max = max ( e , max ) ; } int cc = ceil ( m , max ) ; if ( cc < 2 ) System . out . println ( 2 ) ; else System . out . println ( cc ) ;   }  " ]
[ "for i in range ( int ( input ( ) ) ) : n , x = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) b = x // a [ - 1 ] if b == 0 : b += 1 if x % a [ - 1 ] != 0 : b += 1 for i in range ( n - 2 , - 1 , - 1 ) : c = x // a [ i ] if c == 0 : c += 1 if x % a [ i ] != 0 : c += 1 b = min ( b , c ) else : b = min ( b , c ) break print ( b ) NEW_LINE", "from math import ceil , sqrt , gcd , factorialfrom collections import defaultdict as ddd = dd ( lambda : 0 ) from sys import stdininput = stdin . readline def mp ( ) : return map ( int , input ( ) . split ( ) ) def it ( ) : return int ( input ( ) ) for _ in range ( it ( ) ) : a , b = mp ( ) s = list ( mp ( ) ) if b in s : print ( 1 ) else : print ( max ( 2 , ceil ( b / max ( s ) ) ) ) NEW_LINE", "import mathfor _ in \" ▁ \" * int ( input ( ) ) : n , x = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) mx = max ( a ) print ( 1 if x in a else 2 if mx > x else math . ceil ( x / mx ) ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , x = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( )   start = int ( x / a [ - 1 ] ) * a [ - 1 ] ans = int ( x / a [ - 1 ] ) diff = x - start temp = ans for i in a : if i > diff and start != 0 : ans += 1 break elif i == diff : ans += 1 break if temp == ans : ans += 2 if x % a [ - 1 ] == 0 : ans = int ( x / a [ - 1 ] ) print ( ans ) NEW_LINE", "import mathfor _ in range ( int ( input ( ) ) ) : n , x = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) if x in a : print ( 1 ) elif 2 * a [ - 1 ] > x : print ( 2 ) else : res = float ( ' inf ' ) for i in range ( n - 1 , - 1 , - 1 ) : if x % a [ i ] == 0 : res = min ( x // a [ i ] , res ) else : res = min ( math . ceil ( x / a [ i ] ) , res ) print ( res ) NEW_LINE" ]
codeforces_605_A
[ "  import java . io . * ; import java . util . * ;   public class C335A { static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Kioken sc = new Kioken ( ) ;   public static void main ( String args [ ] ) throws IOException { int t = 1 ;", "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 ; public class B { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;", "import java . io . * ; import java . math . * ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 1000000007 ;   private static final int MAXN = 200001 ; private static final int MAXA = 1000007 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;", "import java . io . * ; import java . util . * ; import java . lang . * ;   public class B {   public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int n = in . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] inva = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) - 1 ; inva [ a [ i ] ] = i ; } int curr = 1 ; int ans = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( inva [ i ] < inva [ i - 1 ] ) curr = 1 ; else curr ++ ;" ]
[ "n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) )   dp = [ 0 ] * ( n + 1 ) for x in p : dp [ x ] = 1 + dp [ x - 1 ]   res = n - max ( dp ) print ( res ) NEW_LINE", "n = int ( input ( ) ) arr = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) l = [ 0 ] * ( n + 1 ) for c in arr : l [ c ] = l [ c - 1 ] + 1 print ( n - max ( l ) ) NEW_LINE", "n = int ( input ( ) ) l = [ int ( x ) for x in input ( ) . split ( ) ] b = [ 0 ] * ( n + 1 ) for i in l : b [ i ] = b [ i - 1 ] + 1 print ( n - max ( b ) )     NEW_LINE", "import math , sys , bisect , heapq , osfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulatefrom functools import lru_cache NEW_LINE" ]
codeforces_1407_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Big_VOVA { static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int t = in . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = in . nextInt ( ) ; } Arrays . sort ( arr ) ; int gcd = arr [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) { int max = Integer . MIN_VALUE ; int ind = i ; for ( int j = i ; j >= 0 ; j -- ) { int val = gcd ( gcd , arr [ j ] ) ; if ( max < val ) { max = val ; ind = j ; } }", "import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ;   public class B1407 {   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 ( ) ; List < Integer > rest = new ArrayList < > ( ) ; for ( int n = 0 ; n < N ; n ++ ) { rest . add ( in . nextInt ( ) ) ; } StringBuilder output = new StringBuilder ( ) ; int gcd = 0 ; int nextGCD ; int nextNumber = 0 ; while ( ! rest . isEmpty ( ) ) { nextGCD = 0 ; for ( int a : rest ) { int candGCD = gcd ( a , gcd ) ; if ( candGCD > nextGCD ) { nextGCD = candGCD ; nextNumber = a ; } } gcd = nextGCD ; output . append ( nextNumber ) . append ( ' ▁ ' ) ; rest . remove ( ( Integer ) nextNumber ) ; } System . out . println ( output ) ; } }   static int gcd ( int a , int b ) { return ( b == 0 ) ? a : gcd ( b , a % b ) ; }   }" ]
[ "from math import gcdfor NEW_LINE _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = [ ] NEW_LINE visited = [ 0 ] * n NEW_LINE maxi = max ( l ) NEW_LINE id = l . index ( maxi ) NEW_LINE visited [ id ] = 1 NEW_LINE ans . append ( maxi ) NEW_LINE k = 0 NEW_LINE hcf = - 1 NEW_LINE while k < n - 2 : for NEW_LINE i in range ( n ) : NEW_LINE if visited [ i ] == 0 : curr_hcf = gcd ( l [ i ] , maxi ) NEW_LINE if curr_hcf > hcf : curr_id = i NEW_LINE hcf = curr_hcf NEW_LINE ans . append ( l [ curr_id ] ) NEW_LINE visited [ curr_id ] = 1 NEW_LINE maxi = hcf NEW_LINE k += 1 NEW_LINE hcf = - 1 NEW_LINE for i in range ( n ) : if NEW_LINE visited [ i ] == 0 : ans . append ( l [ i ] ) NEW_LINE print ( * ans ) NEW_LINE", "ll = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE t = lambda : int ( input ( ) ) NEW_LINE ss = lambda : input ( ) NEW_LINE from math import log10 , log2 , ceil , factorial as f , gcd NEW_LINE", "for i in range ( int ( input ( ) ) ) : from math import gcd NEW_LINE n = int ( input ( ) ) NEW_LINE arr = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE arr . sort ( ) NEW_LINE li = [ ] NEW_LINE li . append ( arr . pop ( ) ) NEW_LINE hcf = li [ - 1 ] NEW_LINE while ( len ( arr ) > 0 ) : m , q = 0 , 0 NEW_LINE for x in arr : if NEW_LINE m < gcd ( hcf , x ) : m = gcd ( hcf , x ) NEW_LINE q = x NEW_LINE li += [ q ] NEW_LINE arr . remove ( q ) NEW_LINE hcf = m NEW_LINE print ( * li ) NEW_LINE", "from math import gcdfor NEW_LINE _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = [ ] NEW_LINE visited = [ 0 ] * n NEW_LINE maxi = 0 NEW_LINE for i in range ( n ) : hcf = 0 NEW_LINE for j in range ( n ) : if NEW_LINE visited [ j ] == 0 and gcd ( maxi , l [ j ] ) > hcf : max_id = j NEW_LINE hcf = gcd ( maxi , l [ j ] ) NEW_LINE ans . append ( l [ max_id ] ) NEW_LINE visited [ max_id ] = 1 NEW_LINE maxi = hcf NEW_LINE" ]
codeforces_38_B
[ "import java . util . Scanner ;   public class B38 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; int rookX = s . charAt ( 0 ) - ' a ' ; int rookY = s . charAt ( 1 ) - '1' ; s = in . next ( ) ; int knightX = s . charAt ( 0 ) - ' a ' ; int knightY = s . charAt ( 1 ) - '1' ; int [ ] [ ] moves = new int [ ] [ ] { { 1 , 2 } , { - 1 , 2 } , { 1 , - 2 } , { - 1 , - 2 } , { 2 , 1 } , { - 2 , 1 } , { 2 , - 1 } , { - 2 , - 1 } } ; int answer = 0 ; for ( int x = 0 ; x < 8 ; x ++ ) { if ( x == rookX ) continue ; for ( int y = 0 ; y < 8 ; y ++ ) { if ( y == rookY ) continue ; if ( x == knightX && y == knightY ) continue ; boolean ok = true ; for ( int [ ] move : moves ) { int beatX = x + move [ 0 ] ; int beatY = y + move [ 1 ] ; if ( ( beatX == rookX && beatY == rookY ) || ( beatX == knightX && beatY == knightY ) ) { ok = false ; break ; } } if ( ok ) { answer ++ ; } } } System . out . println ( answer ) ; }   }", "import java . util . * ; import java . math . * ; import java . text . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String rook = sc . next ( ) ; String knight = sc . next ( ) ; int r = knight . charAt ( 0 ) - ' a ' + 1 ; int c = knight . charAt ( 1 ) - '0' ; boolean m [ ] [ ] = new boolean [ 9 ] [ 9 ] ; int r1 = rook . charAt ( 0 ) - ' a ' + 1 ; int c1 = rook . charAt ( 1 ) - '0' ; for ( int i = 1 ; i <= 8 ; i ++ ) m [ r1 ] [ i ] = true ; for ( int i = 1 ; i <= 8 ; i ++ ) m [ i ] [ c1 ] = true ; int dx [ ] = { 2 , 2 , - 2 , - 2 , 1 , 1 , - 1 , - 1 } ; int dy [ ] = { - 1 , 1 , - 1 , 1 , 2 , - 2 , 2 , - 2 } ; int ans = 0 ; int x = 0 , y = 0 ; m [ r ] [ c ] = true ; for ( int i = 0 ; i < 8 ; i ++ ) { x = r + dx [ i ] ; y = c + dy [ i ] ; if ( x < 1 || y < 1 || x > 8 || y > 8 ) continue ; m [ x ] [ y ] = true ; } for ( int i = 1 ; i <= 8 ; i ++ ) { for ( int j = 1 ; j <= 8 ; j ++ ) { if ( ! m [ i ] [ j ] ) { boolean place = true ; for ( int k = 0 ; k < 8 ; k ++ ) { x = i + dx [ k ] ; y = j + dy [ k ] ; if ( x == r1 && y == c1 ) place = false ; } if ( place ) ans ++ ; } } } System . out . println ( ans ) ; } }  ", "import java . util . Scanner ;   public class Chess { static void moveKnight ( boolean [ ] visited , int knight ) { for ( int i = - 1 ; i < 3 ; i += 2 ) {", "import java . util . Scanner ;     public class MAIN {   public static void main ( String [ ] args ) {" ]
[ "first = input ( ) second = input ( ) s = \" abcdefjh \" ans = 0 for i in \" abcdefgh \" : for j in range ( 1 , 9 ) : move = i + str ( j )   if move != first and move != second : if not i in first and not str ( j ) in first : NEW_LINE", "n = 9 chs = [ [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ] a = input ( ) b = input ( ) lx = ord ( a [ 0 ] ) - 96 ly = int ( a [ 1 ] ) hx = ord ( b [ 0 ] ) - 96 hy = int ( b [ 1 ] ) chs [ hy ] [ hx ] = chs [ ly ] [ lx ] = 1 for i in range ( 1 , n ) : for j in range ( 1 , n ) : if ( ly == i or lx == j ) or ( ( abs ( i - ly ) == 1 and abs ( j - lx ) == 2 ) or ( abs ( i - ly ) == 2 and abs ( j - lx ) == 1 ) ) : chs [ i ] [ j ] = 1 if ( abs ( hy - i ) == 1 and abs ( hx - j ) == 2 ) or ( abs ( hy - i ) == 2 and abs ( hx - j ) == 1 ) : chs [ i ] [ j ] = 1 ans = 0 for i in range ( 1 , n ) : for j in range ( 1 , n ) : if chs [ i ] [ j ] == 0 : ans += 1 print ( ans ) NEW_LINE", "n = 9 chs = [ [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ] a = input ( ) b = input ( ) lx = ord ( a [ 0 ] ) - 96 ly = int ( a [ 1 ] ) hx = ord ( b [ 0 ] ) - 96 hy = int ( b [ 1 ] ) chs [ hy ] [ hx ] = chs [ ly ] [ lx ] = 1 for i in range ( 1 , n ) : for j in range ( 1 , n ) : if ( ly == i or lx == j ) or ( ( abs ( i - ly ) == 1 and abs ( j - lx ) == 2 ) or ( abs ( i - ly ) == 2 and abs ( j - lx ) == 1 ) ) : chs [ i ] [ j ] = 1 if ( abs ( hy - i ) == 1 and abs ( hx - j ) == 2 ) or ( abs ( hy - i ) == 2 and abs ( hx - j ) == 1 ) : chs [ i ] [ j ] = 1 ans = 0 for i in range ( 1 , n ) : for j in range ( 1 , n ) : if chs [ i ] [ j ] == 0 : ans += 1 print ( ans ) NEW_LINE", "n = 9 chs = [ [ 0 for i in range ( 0 , n ) ] for j in range ( 0 , n ) ] a = input ( ) b = input ( ) lx = ord ( a [ 0 ] ) - 96 ly = int ( a [ 1 ] ) hx = ord ( b [ 0 ] ) - 96 hy = int ( b [ 1 ] ) chs [ hy ] [ hx ] = chs [ ly ] [ lx ] = 1 for i in range ( 1 , n ) : for j in range ( 1 , n ) : if ( ly == i or lx == j ) or ( ( abs ( i - ly ) == 1 and abs ( j - lx ) == 2 ) or ( abs ( i - ly ) == 2 and abs ( j - lx ) == 1 ) ) : chs [ i ] [ j ] = 1 if ( abs ( hy - i ) == 1 and abs ( hx - j ) == 2 ) or ( abs ( hy - i ) == 2 and abs ( hx - j ) == 1 ) : chs [ i ] [ j ] = 1 ans = 0 for i in range ( 1 , n ) : for j in range ( 1 , n ) : if chs [ i ] [ j ] == 0 : ans += 1 print ( ans ) NEW_LINE" ]
codeforces_873_B
[ "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 n = input . nextInt ( ) ; String s = input . next ( ) ; int left = 0 ; int right = n - 1 ; int zero = 0 ; int one = 0 ; long ans = 0 ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '0' ) zero ++ ; else one ++ ; if ( one - zero == 0 ) { ans = Math . max ( ans , i + 1 ) ; } else if ( map . containsKey ( one - zero ) ) { ans = Math . max ( ans , i - map . get ( one - zero ) ) ; } else map . put ( one - zero , i ) ; } System . out . println ( ans ) ; }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }", "import java . util . ArrayList ; import java . util . Scanner ;   public class BalancedSubstring {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String s = scanner . nextLine ( ) ; scanner . close ( ) ; int output = solveProblem ( n , s ) ; System . out . println ( output ) ; } private static int solveProblem ( int n , String s ) { int ones = 0 ; int zeroes = 0 ; int [ ] nums = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { char c = s . charAt ( i ) ;", "import java . util . * ;   public class BalancedSubstrings { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int n = input . nextInt ( ) ; input . nextLine ( ) ; String s = input . nextLine ( ) ;   input . close ( ) ;   int [ ] pre = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { if ( s . charAt ( i - 1 ) == '0' ) { pre [ i ] = pre [ i - 1 ] + 1 ; } else { pre [ i ] = pre [ i - 1 ] - 1 ; } }   int [ ] mp = new int [ 2 * n + 1 ] ; mp [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( pre [ i ] < 0 ) { if ( mp [ n + pre [ i ] ] == 0 ) { mp [ n + pre [ i ] ] = i ; } } else if ( pre [ i ] > 0 ) { if ( mp [ pre [ i ] ] == 0 ) { mp [ pre [ i ] ] = i ; } } }   int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( pre [ i ] < 0 ) { ans = Math . max ( ans , i - mp [ n + pre [ i ] ] ) ; } else { ans = Math . max ( ans , i - mp [ pre [ i ] ] ) ; } }   System . out . println ( ans ) ; } }", "  import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws java . lang . Exception {" ]
[ "n = int ( input ( ) ) s = input ( ) o = [ 0 ] * nz = [ 0 ] * nfor i in range ( n ) : if i == 0 : if s [ i ] == '1' : o [ i ] = 1 else : z [ i ] = 1 else : if s [ i ] == '1' : o [ i ] = o [ i - 1 ] + 1 z [ i ] = z [ i - 1 ] else : z [ i ] = z [ i - 1 ] + 1 o [ i ] = o [ i - 1 ] d = [ ] for i in range ( n ) : d . append ( o [ i ] - z [ i ] )   dd = { } dd . setdefault ( 0 , - 1 ) for i in range ( n ) : if d [ i ] not in dd . keys ( ) : dd . setdefault ( d [ i ] , i ) NEW_LINE", "input ( ) instring = input ( ) balance = [ 0 ]   num0 = 0 num1 = 0   for c in instring : if c == \"0\" : num0 += 1 else : num1 += 1   balance . append ( num0 - num1 )   d = { }   for i in range ( len ( balance ) ) : if balance [ i ] not in d : d [ balance [ i ] ] = i   ans = 0 NEW_LINE", "from collections import defaultdictimport sysinput = sys . stdin . readline   n = int ( input ( ) ) s = input ( ) m = defaultdict ( lambda : - 1 ) m [ 0 ] = 0 ans = 0 sum = 0   for i in range ( 1 , n + 1 ) : sum += ( 1 if s [ i - 1 ] == '1' else - 1 ) if ( sum == 0 ) : ans = i elif ( m [ sum ] != - 1 ) : ans = max ( ans , i - m [ sum ] ) else : m [ sum ] = i print ( ans ) NEW_LINE" ]
codeforces_732_A
[ "import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int k = in . nextInt ( ) % 10 ; int r = in . nextInt ( ) ; int res = 1 ; int s = k ; while ( s % 10 != 0 && s % 10 != r ) { s = k * ++ res ; } System . out . println ( res ) ; }   }   ", "import java . util . Scanner ;   public class A732 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = scanner . nextInt ( ) , r = scanner . nextInt ( ) ;   for ( int i = 1 ; ; i ++ ) { if ( i * k % 10 == 0 || i * k % 10 == r ) { System . out . println ( i ) ; break ; } } } }", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int total = 1 ; int total_temp = 0 ;   while ( true ) { total_temp = total * k ; if ( total_temp % 10 == 0 || total_temp % 10 == r ) { break ; } else { total ++ ; } }   System . out . println ( total ) ; } }", "import java . util . Scanner ; import java . util . StringTokenizer ;   public class BuyAShovel { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ;   StringTokenizer stringTokenizer = new StringTokenizer ( line ) ;   int k = Integer . parseInt ( stringTokenizer . nextToken ( ) ) ; int r = Integer . parseInt ( stringTokenizer . nextToken ( ) ) ;   for ( int i = 1 ; i < 100000 ; i ++ ) { int result = ( k * i ) % 10 ;   if ( result == 0 || result == r ) { System . out . println ( i ) ; return ; }   }   } }" ]
[ "price , coin = map ( int , input ( ) . split ( ) ) i = 1 while ( price * i ) % 10 != 0 and ( price * i - coin ) % 10 != 0 : i += 1 print ( i ) NEW_LINE", "k , r = map ( int , input ( ) . split ( \" ▁ \" ) ) i , m = 1 , kwhile m % 10 != r and m % 10 != 0 : i += 1 m = k * iprint ( i ) NEW_LINE", "a , b = ( int ( i ) for i in input ( ) . split ( ) ) k = 1 c = awhile a % 10 != 0 and a % 10 != b : k += 1 a = c * kprint ( k ) NEW_LINE", "[ shovel_price , rest ] = input ( ) . split ( ' ▁ ' ) x = 1 while True : if ( ( x * int ( shovel_price ) ) % 10 == 0 ) or ( ( x * int ( shovel_price ) % 10 == int ( rest ) ) ) : print ( x ) exit ( ) else : x += 1 NEW_LINE", "x , y = map ( int , input ( ) . split ( ) ) n = 0 b = Truewhile b : n += 1 if ( n * x - y ) % 10 == 0 or n * x % 10 == 0 : b = Falseprint ( n ) NEW_LINE" ]
codeforces_1221_B
[ "import javax . print . attribute . standard . PrinterMessageFromOperator ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;", "import java . util . * ;   public class CodeForces22B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( ( i + j ) % 2 == 0 ) { System . out . print ( \" W \" ) ; } else { System . out . print ( \" B \" ) ; } } System . out . println ( ) ; } } }", "import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { PrintWriter out ; FastReader sc ; long mod = ( long ) ( 1e9 + 7 ) ; long maxlong = Long . MAX_VALUE ; long minlong = Long . MIN_VALUE ; public void sol ( ) { int n = ni ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { for ( int j = 0 ; j < n ; j ++ ) { if ( j % 2 == 0 ) sb . append ( ' W ' ) ; else sb . append ( ' B ' ) ; } } else { for ( int j = 0 ; j < n ; j ++ ) { if ( j % 2 == 0 ) sb . append ( \" B \" ) ; else sb . append ( \" W \" ) ; } } sb . append ( \" \\n \" ) ; } pl ( sb ) ; } public static void main ( String [ ] args ) { Main g = new Main ( ) ; g . out = new PrintWriter ( System . out ) ; g . sc = new FastReader ( ) ; int t = 1 ;" ]
[ "n = int ( input ( ) ) for i in range ( n ) : if i % 2 == 0 : if n % 2 == 1 : print ( \" WB \" * ( ( n // 2 ) - 1 ) + \" WBW \" ) else : print ( \" WB \" * ( n // 2 ) ) else : if n % 2 == 1 : print ( \" BW \" * ( ( n // 2 ) - 1 ) + \" BWB \" ) else : print ( \" BW \" * ( n // 2 ) ) NEW_LINE" ]
codeforces_712_B
[ "import java . util . Collections ;   import java . util . * ; import java . lang . * ; import java . io . * ; import java . util . Arrays ;   public class CodeChef { public static void solve ( String sr ) { if ( sr . length ( ) % 2 != 0 ) { System . out . println ( \" - 1\" ) ; return ; } int [ ] arr = new int [ 4 ] ; for ( int i = 0 ; i < sr . length ( ) ; i ++ ) { if ( sr . charAt ( i ) == ' L ' ) arr [ 0 ] ++ ; else if ( sr . charAt ( i ) == ' R ' ) arr [ 1 ] ++ ; else if ( sr . charAt ( i ) == ' U ' ) arr [ 2 ] ++ ; else if ( sr . charAt ( i ) == ' D ' ) arr [ 3 ] ++ ; } int count = 0 ; int diff1 = Math . abs ( arr [ 0 ] - arr [ 1 ] ) ; int diff2 = Math . abs ( arr [ 2 ] - arr [ 3 ] ) ; count = Math . min ( diff1 , diff2 ) + Math . abs ( diff1 - diff2 ) / 2 ; System . out . println ( count ) ;   }   public static void main ( String args [ ] ) throws Exception { StringBuilder sb = new StringBuilder ( ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   String sr = br . readLine ( ) ; solve ( sr ) ; } }  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class MemoryAndTrident { static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; String s = sc . next ( ) ; int left = 0 ; int right = 0 ; int up = 0 ; int down = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' L ' ) { left ++ ; } else if ( s . charAt ( i ) == ' R ' ) { right ++ ; } else if ( s . charAt ( i ) == ' D ' ) { down ++ ; } else { up ++ ; } } if ( s . length ( ) % 2 == 1 ) { System . out . println ( \" - 1\" ) ; } else { int max1 = Math . max ( left , right ) ; int min1 = Math . min ( left , right ) ; int max2 = Math . max ( up , down ) ; int min2 = Math . min ( up , down ) ; int ans1 = max1 + max2 ; int ans2 = min1 + min2 ; System . out . println ( ( ans1 - ans2 ) / 2 ) ; } } }", "import java . text . DecimalFormat ; import java . util . stream . LongStream ; import java . util . stream . IntStream ; import java . io . * ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;", "import java . util . * ; import java . io . * ; public class B712 { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; static StringTokenizer st ; public static void main ( String [ ] args ) throws IOException { String s = next ( ) ; int up = 0 ; int right = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' U ' ) { up ++ ; } else if ( s . charAt ( i ) == ' D ' ) { up -- ; } else if ( s . charAt ( i ) == ' L ' ) { right -- ; } else { right ++ ; } } up = Math . abs ( up ) ; right = Math . abs ( right ) ; if ( ( up + right ) % 2 == 0 ) { pr . println ( ( up + right ) / 2 ) ; } else { pr . println ( - 1 ) ; } pr . close ( ) ; } static String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } static long readLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } static int readInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } static double readDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } static char readCharacter ( ) throws IOException { return next ( ) . charAt ( 0 ) ; } static String readLine ( ) throws IOException { return br . readLine ( ) . trim ( ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;" ]
[ "s = input ( ) r = l = d = u = 0 for i in s : if i == ' R ' : r += 1 if i == ' L ' : l += 1 if i == ' D ' : d += 1 if i == ' U ' : u += 1 if ( u + d + r + l ) % 2 == 0 : 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", "import sys , mathsys . setrecursionlimit ( 10 ** 8 ) ''' def ▁ fun ( ) : ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( 16 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( 4 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ i & (1 < < j ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( j , end = ' ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ) import ▁ binarytreefrom ▁ collections ▁ import ▁ dequebst ▁ = ▁ binarytree . tree ( height = 4 , is _ perfect = True ) print ( bst ) def ▁ s ( bst ) : ▁ ▁ ▁ ▁ if ▁ bst : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ bst . left , bst . right ▁ = ▁ bst . right , bst . left ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . right ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . left ) s ( bst ) print ( bst ) ''' s = input ( ) x , y = 0 , 0 for i in s : if i == ' L ' : x -= 1 elif i == ' R ' : x += 1 elif i == ' U ' : y += 1 elif i == ' D ' : y -= 1 print ( - 1 if len ( s ) % 2 != 0 else ( abs ( x ) + abs ( y ) ) // 2 ) NEW_LINE", "s = input ( ) if len ( s ) % 2 == 1 : print ( - 1 ) else : l = s . count ( ' L ' ) r = s . count ( ' R ' ) u = s . count ( ' U ' ) d = s . count ( ' D ' )   NEW_LINE" ]
codeforces_12_B
[ "import java . util . * ; import java . io . * ; public class parakh { public static void swap ( char a [ ] , int i , int j ) { char c = a [ j ] ; a [ j ] = a [ i ] ; a [ i ] = c ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;", "import java . io . * ; import java . util . * ;   public class Main { static final int N = 15 ; static String str1 , str2 ; static Character [ ] arr = new Character [ N ] ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ;   public static void main ( String [ ] args ) throws IOException {", "import java . io . * ; import java . util . * ;   public class Main { static final int N = 15 ; static String str1 , str2 ; static Character [ ] arr = new Character [ N ] ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ;   public static void main ( String [ ] args ) throws IOException {", "import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { FastScanner input = new FastScanner ( ) ; String question = input . next ( ) ; String ans = input . next ( ) ; if ( question . equals ( \"0\" ) && question . equals ( ans ) ) { System . out . println ( \" OK \" ) ; return ; } char a [ ] = question . toCharArray ( ) ; Arrays . sort ( a ) ; if ( a [ 0 ] == '0' ) { for ( int i = 0 ; i < question . length ( ) ; i ++ ) { if ( a [ i ] >= '1' && a [ i ] <= '9' ) { char temp = a [ i ] ; a [ i ] = '0' ; a [ 0 ] = temp ; break ; } } } String newQ = new String ( a ) ; if ( newQ . equals ( ans ) ) { System . out . println ( \" OK \" ) ; } else { System . out . println ( \" WRONG _ ANSWER \" ) ; } }   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 ( ) ) ; } }   }" ]
[ "num = input ( ) given = input ( )   num = \" \" . join ( sorted ( num ) )   idx = - 1 for i in range ( len ( num ) ) : if int ( num [ i ] ) > 0 : idx = i break   if idx == - 1 : solution = \"0\" else : solution = num [ idx ] + num [ : idx ] + num [ idx + 1 : ]   print ( \" WRONG _ ANSWER \" if solution != given else \" OK \" ) NEW_LINE", "num = input ( ) given = input ( )   num = \" \" . join ( sorted ( num ) )   idx = - 1 for i in range ( len ( num ) ) : if int ( num [ i ] ) > 0 : idx = i break   if idx == - 1 : solution = \"0\" else : solution = num [ idx ] + num [ : idx ] + num [ idx + 1 : ]   print ( \" WRONG _ ANSWER \" if solution != given else \" OK \" ) NEW_LINE", "n = sorted ( list ( input ( ) ) )   NEW_LINE", "a = list ( input ( ) ) b = list ( input ( ) )   if a . count ( '0' ) == len ( a ) : if ( b . count ( '0' ) == len ( b ) ) : if len ( a ) == len ( b ) : print ( \" OK \" ) else : print ( \" WRONG _ ANSWER \" ) else : print ( \" WRONG _ ANSWER \" )   else :   a . sort ( ) x = a . count ( '0' ) a = [ a [ x ] ] + [ '0' ] * x + a [ x + 1 : ] print ( \" OK \" if a == b else \" WRONG _ ANSWER \" )   NEW_LINE" ]