id
stringlengths
13
20
java
sequence
python
sequence
codeforces_171_B
[ "  import java . lang . reflect . Array ; import java . text . CollationElementIterator ; import java . util . * ; import java . util . Map . Entry ; import java . io . * ; import java . lang . Math . * ; import java . math . BigInteger ;   import static java . lang . Math . * ; import static java . lang . System . * ; import static java . util . Arrays . fill ; import static java . util . Arrays . spliterator ; public class ContestMain implements Runnable { private static Reader in = new Reader ( ) ; private static StringBuilder ans = new StringBuilder ( ) ; private static long MOD = 998244353 ; private static final int N = ( int ) ( 2e5 + 7 ) ;", "import java . io . * ; import java . util . * ; public class Main { static int mod = ( int ) ( Math . pow ( 10 , 9 ) + 7 ) ; public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ; out . println ( 6 * n * ( n - 1 ) + 1 ) ; out . close ( ) ; } static void mergeSort ( int [ ] A ) {", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long n = s . nextLong ( ) ; long res = 6 * n * ( n - 1 ) + 1 ; System . out . println ( res ) ; } }", "import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int temp1 = p6 ( a ) ; int temp2 = p3 ( a * 3 - 2 ) ;   System . out . println ( temp2 * 2 - temp1 ) ; } static int p6 ( int n ) { return p3 ( n ) * 6 - n * 6 + 1 ; } static int p3 ( int n ) { return n * ( n + 1 ) / 2 ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Solution171B { public static void main ( String [ ] args ) { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; Solver171B solver = new Solver171B ( ) ; solver . solve ( 0 , in , out ) ; out . close ( ) ; }   static class Solver171B { public void solve ( int testNumber , InputReader in , PrintWriter out ) { long n = in . nextInt ( ) ; out . println ( 6L * n * ( n - 1L ) + 1L ) ; } }   static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; }   public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }" ]
[ "def tri_len ( n ) : return 3 * n - 2 def triangle ( n ) : return ( n * ( n + 1 ) ) // 2 def star ( n ) : l = tri_len ( n ) return triangle ( n - 1 ) * 3 + triangle ( l ) print ( star ( int ( input ( ) ) ) ) NEW_LINE", "n = int ( input ( ) ) print ( 6 * n * n - 6 * n + 1 ) NEW_LINE", "import mathimport sysinput = sys . stdin . readline   def inp ( ) : return ( int ( input ( ) ) ) def inlt ( ) : return ( list ( map ( int , input ( ) . split ( ) ) ) )   n = inp ( ) print ( n * ( n - 1 ) * 6 + 1 ) NEW_LINE", "n = int ( input ( ) ) print ( 6 * n * ( n - 1 ) + 1 ) NEW_LINE", "n = int ( input ( ) ) print ( 1 + 6 * ( n * ( n - 1 ) ) ) NEW_LINE" ]
codeforces_1210_B
[ "import java . io . DataInputStream ; import java . io . FileInputStream ; import java . io . IOException ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Scanner ;   public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16 ; private DataInputStream din ; private byte [ ] buffer ; private int bufferPointer , bytesRead ; public Reader ( ) { din = new DataInputStream ( System . in ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; } public Reader ( String file_name ) throws IOException { din = new DataInputStream ( new FileInputStream ( file_name ) ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; } public String readLine ( ) throws IOException { byte [ ] buf = new byte [ 64 ] ;", "# include < bits / stdc ++ . h > # include < ext / pb_ds / assoc_container . hpp > # include < ext / pb_ds / tree_policy . hpp > using namespace __gnu_pbds ; # define ll long long # define ld long double # define el ' \\n ' # define _3m_Sevawy ios_base :: sync_with_stdio ( 0 ) ; cin . tie ( 0 ) ; cout . tie ( 0 ) ; # define ordered_set tree < string , null_type , less < string > , rb_tree_tag , tree_order_statistics_node_update > # define error ( args ... ) { string _s = # args ; replace ( _s . begin ( ) , _s . end ( ) , ' , ' , ' ▁ ' ) ; stringstream _ss ( _s ) ; istream_iterator < string > _it ( _ss ) ; err ( _it , args ) ; } using namespace std ; const ll N = 7e3 + 5 , mod = 1e9 + 7 , inf = 1e18 , M = 2 * N ; bool ok [ N ] ; int main ( ) { _3m_Sevawy int tt = 1 ;" ]
[ "from collections import defaultdictN = int ( input ( ) ) if ( N == 1 ) : print ( 0 ) exit ( ) a = [ int ( x ) for x in input ( ) . split ( ) ] b = [ int ( x ) for x in input ( ) . split ( ) ] Dict = defaultdict ( int ) Sum = defaultdict ( int ) for i in range ( N ) : Dict [ a [ i ] ] += 1 Sum [ a [ i ] ] += b [ i ] ans = 0 val = 0 Group = [ ] for i in Dict . keys ( ) : if ( Dict [ i ] > 1 ) : Group . append ( i ) ans += Sum [ i ] val |= ifor i in range ( N ) : if ( Dict [ a [ i ] ] == 1 ) : for k in Group : if ( a [ i ] | k <= k ) : ans += Sum [ a [ i ] ] breakprint ( ans ) NEW_LINE", "import sysinput = sys . stdin . readlinefrom collections import defaultdict n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) c = defaultdict ( int ) for i in range ( n ) : c [ a [ i ] ] += 1     s = 0 for i in range ( n ) : for j in c : if c [ j ] > 1 : if j | a [ i ] == j : s += b [ i ] breakprint ( s ) NEW_LINE", "import sysinput = sys . stdin . readlinefrom collections import defaultdict n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) c = defaultdict ( int ) for i in range ( n ) : c [ a [ i ] ] += 1     s = 0 for i in range ( n ) : for j in c : if c [ j ] > 1 : if j | a [ i ] == j : s += b [ i ] breakprint ( s ) NEW_LINE" ]
codeforces_671_A
[ "def dis ( x1 , y1 , x2 , y2 ) : return ( ( x1 - x2 ) * * 2 + ( y1 - y2 ) * * 2 ) * * 0.5   ax , ay , bx , by , tx , ty = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) a , b , s = [ ] , [ ] , 0f or i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) dist = dis ( tx , ty , x , y ) a . append ( ( dis ( ax , ay , x , y ) - dist , i ) ) b . append ( ( dis ( bx , by , x , y ) - dist , i ) ) s += dist * 2 a . sort ( ) b . sort ( ) if n > 1 and a [ 0 ] [ 1 ] = = b [ 0 ] [ 1 ] : res = min ( a [ 0 ] [ 0 ] , b [ 0 ] [ 0 ] , a [ 0 ] [ 0 ] + b [ 1 ] [ 0 ] , a [ 1 ] [ 0 ] + b [ 0 ] [ 0 ] ) else : res = min ( a [ 0 ] [ 0 ] , b [ 0 ] [ 0 ] ) if ( n > 1 ) : res = min ( a [ 0 ] [ 0 ] + b [ 0 ] [ 0 ] , res ) print ( res + s )", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . List ; import java . util . Random ; import java . util . StringTokenizer ;   public class Main implements Runnable {   int sz [ ] ; int id [ ] ; List < Integer > edges [ ] ; long tree [ ] ;   private void solve ( ) throws IOException { long ax = nextLong ( ) ; long ay = nextLong ( ) ; long bx = nextLong ( ) ; long by = nextLong ( ) ; long tx = nextLong ( ) ; long ty = nextLong ( ) ; int n = nextInt ( ) ; long d1 [ ] = new long [ n ] ; long d2 [ ] = new long [ n ] ; long d3 [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { long x = nextLong ( ) ; long y = nextLong ( ) ; d1 [ i ] = ( x - tx ) * ( x - tx ) + ( y - ty ) * ( y - ty ) ; d2 [ i ] = ( x - ax ) * ( x - ax ) + ( y - ay ) * ( y - ay ) ; d3 [ i ] = ( x - bx ) * ( x - bx ) + ( y - by ) * ( y - by ) ; } double min1 , min2 , smin1 , smin2 ; min1 = min2 = smin1 = smin2 = 1e13 ; int ind1 = - 1 , ind2 = - 1 , ind3 = - 1 , ind4 = - 1 ; double tot = 0.0d ; for ( int i = 0 ; i < n ; ++ i ) {" ]
[ "def dis ( x1 , y1 , x2 , y2 ) : return ( ( x1 - x2 ) ** 2 + ( y1 - y2 ) ** 2 ) ** 0.5   ax , ay , bx , by , tx , ty = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) a , b , s = [ ] , [ ] , 0 for i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) dist = dis ( tx , ty , x , y ) a . append ( ( dis ( ax , ay , x , y ) - dist , i ) ) b . append ( ( dis ( bx , by , x , y ) - dist , i ) ) s += dist * 2 a . sort ( ) b . sort ( ) if n > 1 and a [ 0 ] [ 1 ] == b [ 0 ] [ 1 ] : res = min ( a [ 0 ] [ 0 ] , b [ 0 ] [ 0 ] , a [ 0 ] [ 0 ] + b [ 1 ] [ 0 ] , a [ 1 ] [ 0 ] + b [ 0 ] [ 0 ] ) else : res = min ( a [ 0 ] [ 0 ] , b [ 0 ] [ 0 ] ) if ( n > 1 ) : res = min ( a [ 0 ] [ 0 ] + b [ 0 ] [ 0 ] , res ) print ( res + s ) NEW_LINE", "/ ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **   Online C + + Compiler . Code , Compile , Run and Debug C + + program online . Write your code in this editor and press \" Run \" button to compile and execute it .   ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** * /   NEW_LINE", "ax , ay , bx , by , tx , ty = map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) a , b = [ ] , [ ] res = 0 for i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) lt = ( ( tx - x ) * ( tx - x ) + ( ty - y ) * ( ty - y ) ) ** 0.5 la = ( ( ax - x ) * ( ax - x ) + ( ay - y ) * ( ay - y ) ) ** 0.5 lb = ( ( bx - x ) * ( bx - x ) + ( by - y ) * ( by - y ) ) ** 0.5 a += [ ( la - lt , i ) ] b += [ ( lb - lt , i ) ] res += lta . sort ( ) ; b . sort ( ) res *= 2 if a [ 0 ] [ 1 ] == b [ 0 ] [ 1 ] and n > 1 : res += min ( a [ 0 ] [ 0 ] , b [ 0 ] [ 0 ] , a [ 0 ] [ 0 ] + b [ 1 ] [ 0 ] , a [ 1 ] [ 0 ] + b [ 0 ] [ 0 ] ) else : if a [ 0 ] [ 1 ] == b [ 0 ] [ 1 ] : res += min ( a [ 0 ] [ 0 ] , b [ 0 ] [ 0 ] ) else : res += min ( a [ 0 ] [ 0 ] , b [ 0 ] [ 0 ] , a [ 0 ] [ 0 ] + b [ 0 ] [ 0 ] ) print ( res ) NEW_LINE" ]
codeforces_1452_A
[ "import java . awt . Point ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . lang . reflect . Array ; import java . math . BigDecimal ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . Hashtable ; import java . util . LinkedList ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Stack ; import java . util . StringTokenizer ;    public class Edu98 { static PrintWriter out ; static Scanner sc ; static ArrayList < Integer > q , w ; static ArrayList < Point > ref [ ] ; static HashSet < Integer > primesH ; static boolean prime [ ] ;", "import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ;   if ( a == b ) if ( a == 0 ) System . out . println ( a ) ; else System . out . println ( 2 * a ) ;   if ( a != b ) if ( a > b ) System . out . println ( 2 * a - 1 ) ; else System . out . println ( 2 * b - 1 ) ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class RobotProgram { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int res = Math . min ( n1 , n2 ) * 2 ; n1 = Math . max ( n1 , n2 ) - Math . min ( n1 , n2 ) ; res += Math . max ( 0 , 2 * n1 - 1 ) ; System . out . println ( res ) ; } }             public static class MyScanner { BufferedReader br ; StringTokenizer st ;   public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   } }", "import java . util . * ; public class HelloWorld {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int c = 0 ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int m = ( int ) Math . max ( x , y ) ; int n = ( int ) Math . min ( x , y ) ; int d = 2 * ( n ) ; int md = 0 ; if ( m - n != 0 ) md = ( m - n ) * 2 - 1 ; System . out . println ( d + md ) ; } } }" ]
[ "for _ in range ( int ( input ( ) ) ) : x , y = map ( int , input ( ) . split ( ) ) NEW_LINE x = abs ( x ) NEW_LINE y = abs ( y ) NEW_LINE if x > y : x , y = y , x NEW_LINE print ( 2 * x + max ( 0 , 2 * ( y - x ) - 1 ) ) NEW_LINE", "import sys   input = sys . stdin . buffer . readline   t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : x , y = map ( int , input ( ) . split ( ) )   steps = min ( x , y ) * 2 NEW_LINE extra = abs ( x - y )   steps += 2 * extra NEW_LINE steps -= extra > 0 NEW_LINE print ( steps ) NEW_LINE", "import sys   input = sys . stdin . readline   t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : x , y = map ( int , input ( ) . split ( ) )   steps = min ( x , y ) * 2 NEW_LINE extra = abs ( x - y )   steps += 2 * extra NEW_LINE steps -= extra > 0 NEW_LINE print ( steps ) NEW_LINE", "def string_to_list ( s , char ) : collector = \" \" NEW_LINE output_list = [ ] NEW_LINE for i in range ( len ( s ) ) : if NEW_LINE s [ i ] != char : collector += s [ i ] NEW_LINE if i == len ( s ) - 1 : NEW_LINE INDENT output_list . append ( int ( collector ) ) else : NEW_LINE output_list . append ( int ( collector ) ) NEW_LINE DEDENT collector = \" \" NEW_LINE return output_list     NEW_LINE def list_to_string ( l , char ) : output_string = \" \" NEW_LINE for i in range ( len ( l ) - 1 ) : output_string += str ( l [ i ] ) + char NEW_LINE output_string += str ( l [ - 1 ] ) NEW_LINE return output_string     NEW_LINE def quick_sort ( l ) : def NEW_LINE partition ( l , start , end ) : pivot = l [ end ] NEW_LINE i = start NEW_LINE for j in range ( start , end ) : if NEW_LINE l [ j ] <= pivot : l [ j ] , l [ i ] = l [ i ] , l [ j ] NEW_LINE i += 1 NEW_LINE l [ end ] , l [ i ] = l [ i ] , l [ end ] NEW_LINE return i   NEW_LINE def recutrsion_part ( l , start , end ) : if NEW_LINE len ( l ) < 2 : NEW_LINE return l elif not start >= end : p = partition ( l , start , end ) NEW_LINE recutrsion_part ( l , start , p - 1 ) NEW_LINE recutrsion_part ( l , p + 1 , end ) NEW_LINE recutrsion_part ( l , 0 , len ( l ) - 1 ) NEW_LINE return l     NEW_LINE" ]
codeforces_489_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 n = Integer . parseInt ( br . readLine ( ) ) ; int arr [ ] = new int [ n ] ; String str [ ] = br . readLine ( ) . split ( \" ▁ \" ) ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = Integer . parseInt ( str [ i ] ) ; sort ( arr , n ) ;", "  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 size = sc . nextInt ( ) ; int arr [ ] = new int [ size ] ; int sortarr [ ] = new int [ size ] ; int ans [ ] [ ] = new int [ size ] [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; sortarr [ i ] = arr [ i ] ; } Arrays . sort ( sortarr ) ; int swap = 0 , temp = 0 ; for ( int i = 0 ; i < size ; i ++ ) { if ( arr [ i ] == sortarr [ i ] ) continue ; else { for ( int j = i + 1 ; j < size ; j ++ ) { if ( arr [ j ] == sortarr [ i ] ) { int tem = arr [ j ] ; arr [ j ] = arr [ i ] ; arr [ i ] = tem ; swap ++ ; ans [ temp ++ ] [ 0 ] = i ; ans [ temp - 1 ] [ 1 ] = j ; break ; } } } } System . out . println ( swap ) ; for ( int i = 0 ; i < temp ; i ++ ) System . out . println ( ans [ i ] [ 0 ] + \" ▁ \" + ans [ i ] [ 1 ] ) ; } }", "import java . util . * ; import java . io . * ; import java . math . * ;   public class Main { static class Pair { int a ; int b ; Pair ( int a , int b ) { this . a = a ; this . b = b ; } }   private static int MAX = Integer . MAX_VALUE ; private static int MIN = Integer . MIN_VALUE ; private static int MOD = 1000000007 ; static FastScanner sc = new FastScanner ( ) ;   public static void main ( String [ ] args ) throws IOException {", "import java . util . * ;   public class swap_sort_c_2 { 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 ( ) ; } ArrayList < Integer > list = new ArrayList < > ( ) ; int index = 0 ; int swaps = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int min = index ; for ( int j = index ; j < n ; j ++ ) { if ( arr [ j ] < arr [ min ] ) min = j ; } if ( min != index ) { list . add ( min ) ; list . add ( index ) ; swaps ++ ; } int temp = arr [ index ] ; arr [ index ] = arr [ min ] ; arr [ min ] = temp ; index ++ ; } System . out . println ( swaps ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { if ( i % 2 == 0 && i != 0 ) System . out . println ( ) ; System . out . print ( list . get ( i ) + \" ▁ \" ) ; } } }", "import java . util . Scanner ; public class Main {   public static void main ( String [ ] args ) { Scanner SC = new Scanner ( System . in ) ; int N , Cnt = 0 , A [ ] , B [ ] [ ] , Min , ID , Tmp ; N = SC . nextInt ( ) ; A = new int [ N ] ; B = new int [ 2 ] [ N ] ; for ( int i = 0 ; i < N ; i ++ ) A [ i ] = SC . nextInt ( ) ;" ]
[ "n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) z = [ ] c = 0 for i in range ( n ) : a , b = i , x [ i ] for j in range ( i , n ) : if x [ j ] < b : a = j b = x [ j ] x [ i ] , x [ a ] = x [ a ] , x [ i ] if a != i : c += 1 z . append ( [ i , a ] ) print ( c ) for i in z : for j in i : print ( j , end = \" ▁ \" ) print ( \" \" ) NEW_LINE", "n = int ( input ( ) ) lst = list ( map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) ) print ( n ) for i in range ( n ) : j = lst [ i : ] . index ( min ( lst [ i : ] ) ) lst [ i ] , lst [ j + i ] = lst [ j + i ] , lst [ i ] print ( i , j + i , end = \" ▁ \" ) print ( ) NEW_LINE", "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) p = l . copy ( ) p . sort ( ) print ( n )   for i in range ( n ) : j = l [ i : ] . index ( p [ i ] ) + i print ( i , j ) l [ i ] , l [ j ] = l [ j ] , l [ i ] NEW_LINE", "import sysimport os . pathif ( os . path . exists ( ' input _ file . txt ' ) ) : sys . stdin = open ( \" input _ file . txt \" , \" r \" ) sys . stdout = open ( \" output _ file . txt \" , \" w \" )   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) aa = sorted ( a ) i = 0 NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( n - 1 ) for i in range ( n - 1 ) : j = a . index ( min ( a [ i : ] ) , i ) print ( i , j ) a [ i ] , a [ j ] = a [ j ] , a [ i ] NEW_LINE" ]
codeforces_615_A
[ "import java . util . * ; public class Bulbs {   public static void main ( String [ ] args ) {", "import java . util . * ; public class Bulbs {   public static void main ( String [ ] args ) {", "import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ;   public class Main {   public static void main ( String [ ] args ) { int n , m ; int bulbs ; Scanner sc = new Scanner ( System . in ) ; Set < Integer > onBulbs = new HashSet < > ( ) ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ;   for ( int i = 1 ; i <= n ; i ++ ) { bulbs = sc . nextInt ( ) ; int temp ; for ( int j = 1 ; j <= bulbs ; j ++ ) { temp = sc . nextInt ( ) ; onBulbs . add ( temp ) ; } }    if ( m == onBulbs . size ( ) ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ;    } }", "import java . io . * ; import java . util . * ;   public class Prb2 {   static PrintWriter pw ; static Scanner sc ; static long mod = 1000000000 + 7 ;   static void print ( final String arg ) { pw . write ( arg ) ; pw . flush ( ) ; }   static int ni ( ) { return sc . nextInt ( ) ; } static long nl ( ) { return sc . nextLong ( ) ; }   static void runFile ( ) throws Exception {   sc = new Scanner ( new FileReader ( \" input . txt \" ) ) ; pw = new PrintWriter ( new BufferedWriter ( new FileWriter ( \" output . txt \" ) ) ) ; }   static void runIo ( ) throws Exception {   pw = new PrintWriter ( System . out ) ; sc = new Scanner ( System . in ) ; }   static boolean sv [ ] = new boolean [ 1000002 ] ;   static void seive ( ) {", "import java . util . Arrays ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class Bulbs { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   StringTokenizer tokenizer = new StringTokenizer ( scanner . nextLine ( ) ) ; int n = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int m = Integer . parseInt ( tokenizer . nextToken ( ) ) ;   boolean [ ] arr = new boolean [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { StringTokenizer lineTok = new StringTokenizer ( scanner . nextLine ( ) ) ; int r = Integer . parseInt ( lineTok . nextToken ( ) ) ; for ( int j = 0 ; j < r ; j ++ ) { int i1 = Integer . parseInt ( lineTok . nextToken ( ) ) ; arr [ i1 - 1 ] = true ; } }   boolean allMatch = true ; for ( int i = 0 ; i < arr . length ; i ++ ) { if ( ! arr [ i ] ) { allMatch = false ; } }   System . out . println ( allMatch ? \" YES \" : \" NO \" ) ;   } }" ]
[ "n , m = map ( int , input ( ) . split ( ) ) s = set ( ) for t in range ( n ) : arr = list ( map ( int , input ( ) . split ( ) ) ) for i in arr [ 1 : ] : s . add ( i ) if len ( s ) == m : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) x = [ ] s = set ( ) for i in range ( n ) : x += [ list ( map ( int , input ( ) . split ( ) ) ) ] x [ i ] [ 0 ] = ' i ' for i in range ( n ) : for j in range ( 1 , len ( x [ i ] ) ) : s . add ( x [ i ] [ j ] ) if len ( s ) == m : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE", "buttons , bulbs = map ( int , input ( ) . split ( ) ) storage = [ ] s = set ( ) for i in range ( buttons ) : storage += [ list ( map ( int , input ( ) . split ( ) ) ) ] storage [ i ] [ 0 ] = ' i ' for i in range ( buttons ) : for j in range ( 1 , len ( storage [ i ] ) ) : s . add ( storage [ i ] [ j ] ) if len ( s ) == bulbs : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE", "def main_function ( ) : n , m = [ int ( i ) for i in input ( ) . split ( \" ▁ \" ) ] collector = [ 0 for i in range ( m + 1 ) ] for i in range ( n ) : l = [ int ( i ) for i in input ( ) . split ( \" ▁ \" ) ] for i in range ( 1 , len ( l ) ) : collector [ l [ i ] ] += 1 NEW_LINE", "def main ( ) : n , m = map ( int , input ( ) . split ( ) ) lights = [ ] for _ in range ( n ) : lights += list ( map ( int , input ( ) . split ( ) ) ) [ 1 : ] count_light = set ( lights ) if 0 in count_light and len ( count_light ) - 1 == m : print ( \" YES \" ) elif 0 not in count_light and len ( count_light ) == m : print ( \" YES \" ) else : print ( \" NO \" )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE" ]
codeforces_39_B
[ "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class cdf39b { 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 cdf39b { 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 . util . * ; import java . io . * ;   public class Tournament { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   int t = 1 ;   while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) . trim ( ) ) ; int a [ ] = new int [ n ] ; String str [ ] = br . readLine ( ) . trim ( ) . split ( \" ▁ \" ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( str [ i ] ) ; }   int find = 1 ; ArrayList < Integer > li = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == find ) { li . add ( 2001 + i ) ; find ++ ; } }   pw . println ( li . size ( ) ) ; for ( int x : li ) pw . print ( x + \" ▁ \" ) ; } pw . flush ( ) ; }   }" ]
[ "a = int ( input ( ) ) ; p = [ ] for i , j in enumerate ( map ( int , input ( ) . split ( ) ) ) : if j > 0 : p . append ( [ 2000 + i + 1 , j ] ) p = sorted ( p ) ; t = 1 ; ok = 0 ; o = [ ] for i in range ( len ( p ) ) : if p [ i ] [ 0 ] > ok and t == p [ i ] [ 1 ] : o . append ( p [ i ] [ 0 ] ) ; ok = p [ i ] [ 0 ] ; t += 1 print ( t - 1 ) ; print ( * o ) NEW_LINE", "a = int ( input ( ) ) ; p = [ ] for i , j in enumerate ( map ( int , input ( ) . split ( ) ) ) : if j > 0 : p . append ( [ 2000 + i + 1 , j ] ) p = sorted ( p ) ; t = 1 ; ok = 0 ; o = [ ] for i in range ( len ( p ) ) : if p [ i ] [ 0 ] > ok and t == p [ i ] [ 1 ] : o . append ( p [ i ] [ 0 ] ) ; ok = p [ i ] [ 0 ] ; t += 1 print ( t - 1 ) ; print ( * o ) NEW_LINE", "n = int ( input ( ) ) p = 2000 a = list ( map ( int , input ( ) . split ( ) ) ) ans = [ ] income = 0 for i in range ( 0 , len ( a ) ) : if a [ i ] > 0 and a [ i ] - income == 1 : ans . append ( p + ( i + 1 ) ) income = a [ i ] print ( len ( ans ) ) if len ( ans ) == 0 : exit ( ) print ( * ans ) NEW_LINE", "from sys import stdin , stdout     years = int ( input ( ) )   incomes = list ( map ( int , list ( stdin . readline ( ) . split ( ' ▁ ' ) ) ) )   respuestas = list ( ) cnt = 1     for x in range ( years ) : if incomes [ x ] == cnt : respuestas . append ( str ( 2000 + x + 1 ) ) cnt += 1 print ( len ( respuestas ) ) if respuestas : print ( ' ▁ ' . join ( respuestas ) ) NEW_LINE", "n = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) s = [ 0 ] x = 0 g = [ ] for i in b : x += 1 if i >= 1 and i - max ( s ) == 1 : g . append ( 2000 + x ) s . append ( i ) else : continues . remove ( 0 ) k = list ( zip ( g , s ) ) h = [ ] for p in range ( len ( k ) ) : h . append ( k [ p ] [ 0 ] ) if len ( s ) == 0 : print ( 0 ) else : print ( len ( h ) ) print ( * h ) NEW_LINE" ]
codeforces_407_B
[ "import java . util . Scanner ; public class LongPath {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; long [ ] [ ] rooms = new long [ n ] [ 3 ] ; for ( int i = 0 ; i < n ; i ++ ) { rooms [ i ] [ 0 ] = scanner . nextInt ( ) - 1 ; } scanner . close ( ) ; long output = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int pointer = ( int ) rooms [ i ] [ 0 ] ; rooms [ i ] [ 2 ] = output ; long portalValue = 2 ; for ( int j = pointer ; j < i ; j ++ ) { portalValue = ( portalValue + rooms [ j ] [ 1 ] ) % 1000000007 ; } rooms [ i ] [ 1 ] = portalValue ; output = ( output + portalValue ) % 1000000007 ; } System . out . println ( output ) ; } }", "import java . util . * ; import java . io . * ;", "import java . util . * ; import java . io . * ;", "import java . io . * ; import java . util . * ; import java . lang . * ;   public class pracs { public static int dp [ ] ; public static int [ ] arr ; public static int MOD = ( int ) ( 1e9 + 7 ) ; public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int n = in . nextInt ( ) ; arr = new int [ n + 2 ] ; for ( int i = 1 ; i <= n ; i ++ ) arr [ i ] = in . nextInt ( ) ; dp = new int [ n + 2 ] ;" ]
[ "import sysinput = sys . stdin . readline   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) d = [ 0 ] * ( n + 1 ) MOD = int ( 1e9 + 7 )   for i in range ( 0 , n ) : d [ i + 1 ] = ( d [ i ] + ( d [ i ] - d [ a [ i ] - 1 ] ) + 2 + MOD ) % MOD print ( d [ n ] ) ; NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) dp = [ 0 for i in range ( n + 1 ) ] for i in range ( n + 1 ) : if i > 0 : dp [ i ] = ( 2 * dp [ i - 1 ] + 2 - dp [ a [ i - 1 ] - 1 ] ) % 1000000007 print ( ( dp [ n ] + 1000000007 ) % 1000000007 ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) values = [ 0 for k in range ( n ) ] for k in range ( n ) : back = a [ k ] if a [ k ] == k + 1 : values [ k ] = 2 else : values [ k ] += 2 for t in range ( a [ k ] - 1 , k ) : values [ k ] += values [ t ] values [ k ] %= int ( 1e9 + 7 ) print ( int ( sum ( values ) % ( 1e9 + 7 ) ) ) NEW_LINE", "n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) dp = [ 0 ] * ( n + 1 ) dp [ 1 ] = 2 for i in range ( 2 , n + 1 ) : c = 0 for j in range ( p [ i - 1 ] , i ) : c += dp [ j ] dp [ i ] = c + 2 print ( sum ( dp ) % ( 10 ** 9 + 7 ) ) NEW_LINE", "import sysMOD = 10 ** 9 + 7 N = int ( input ( ) ) bs = [ int ( b ) - 1 for b in input ( ) . split ( ) ] fs = [ 0 ] for i in range ( 1 , N + 1 ) : f = 2 * fs [ i - 1 ] + 2 - fs [ bs [ i - 1 ] ] fs . append ( f % MOD ) print ( fs [ - 1 ] ) NEW_LINE" ]
codeforces_104_A
[ "import javax . swing . plaf . IconUIResource ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class codeforces { static int M = 1_000_000_007 ; static int INF = Integer . MAX_VALUE ; static final FastScanner fs = new FastScanner ( ) ;  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class C { static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] nextArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } static class FastWriter extends PrintWriter { FastWriter ( ) { super ( System . out ) ; }   void println ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + \" ▁ \" ) ; } println ( ) ; }   void println ( long [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + \" ▁ \" ) ; } println ( ) ; } } public static void main ( String [ ] args ) {", "import java . util . * ; import java . util . Scanner ; public class Blackjack { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) - 10 ; if ( n < 1 || n > 11 ) System . out . print ( 0 ) ; else if ( n == 10 ) System . out . print ( 15 ) ; else System . out . print ( 4 ) ; } }", "import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a1 = 4 , a2 = 4 , a3 = 4 , a4 = 4 , a5 = 4 , a6 = 4 , a7 = 4 , a8 = 4 , a9 = 4 , a10 = 15 ; int x = n - 10 ; if ( x == 0 || n < 10 || x > 11 ) System . out . println ( 0 ) ; else { if ( x == 1 || x == 11 ) System . out . println ( a1 ) ; if ( x == 2 ) System . out . println ( a2 ) ; if ( x == 3 ) System . out . println ( a3 ) ; if ( x == 4 ) System . out . println ( a4 ) ; if ( x == 5 ) System . out . println ( a5 ) ; if ( x == 6 ) System . out . println ( a6 ) ; if ( x == 7 ) System . out . println ( a7 ) ; if ( x == 8 ) System . out . println ( a8 ) ; if ( x == 9 ) System . out . println ( a9 ) ; if ( x == 10 ) System . out . println ( a10 ) ; } } }" ]
[ "import sysimport collectionsimport itertools   n = int ( input ( ) ) if n <= 10 : print ( '0' ) elif n > 21 : print ( '0' ) elif n < 20 : print ( '4' ) elif n == 20 : print ( '15' ) else : print ( '4' ) NEW_LINE", "n = int ( input ( ) ) if 0 <= n <= 10 : print ( 0 ) elif n == 11 : print ( 4 ) elif 12 <= n <= 19 : print ( 4 ) elif n == 20 : print ( 15 ) elif n == 21 : print ( 4 ) elif 22 <= n <= 25 : print ( 0 ) NEW_LINE", "n = int ( input ( ) ) if ( n < 10 ) : print ( 0 ) else : n = n - 10 if ( n == 0 or n > 11 ) : print ( 0 ) elif ( n == 10 ) : print ( 15 ) else : print ( 4 ) NEW_LINE", "n = int ( input ( ) )   n -= 10   if n <= 0 : print ( 0 )   elif n < 10 or n == 11 : print ( 4 )   elif n == 10 : print ( 15 )   else : print ( 0 ) NEW_LINE", "a = int ( input ( ) ) print ( ( 10 < a < 22 ) * 4 + ( a == 20 ) * 11 ) NEW_LINE" ]
codeforces_1292_A
[ "# include < iostream > using namespace std ; bool map [ 3 ] [ 1000010 ] = { 0 } ; int main ( ) { int n , q , x , y ; cin >> n >> q ; int wall = 0 ;", "import java . util . * ; import java . io . * ; public class AiseHi { static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } static FastReader sc = new FastReader ( ) ; public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; int t = 1 ;", "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 ;   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 ( ) ; int t ;", "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 ( ) ; int q = input . nextInt ( ) ; int bad = 0 ; boolean check [ ] [ ] = new boolean [ 3 ] [ n + 1 ] ; StringBuilder ans = new StringBuilder ( ) ; for ( int i = 0 ; i < q ; i ++ ) { int x = input . nextInt ( ) ; int y = input . nextInt ( ) ; if ( ! check [ x ] [ y ] ) { check [ x ] [ y ] = true ; if ( y - 1 >= 1 && check [ 3 - x ] [ y - 1 ] ) { bad ++ ; } if ( y + 1 <= n && check [ 3 - x ] [ y + 1 ] ) { bad ++ ; } if ( check [ 3 - x ] [ y ] ) bad ++ ; } else { check [ x ] [ y ] = false ; if ( y - 1 >= 1 && check [ 3 - x ] [ y - 1 ] ) { bad -- ; } if ( y + 1 <= n && check [ 3 - x ] [ y + 1 ] ) { bad -- ; } if ( check [ 3 - x ] [ y ] ) bad -- ; } if ( bad >= 1 ) { ans . append ( \" NO \\n \" ) ; } else ans . append ( \" YES \\n \" ) ;" ]
[ "n , q = map ( int , input ( ) . split ( ) ) a = [ [ 0 ] * n , [ 0 ] * n ] blocks = 0 for i in range ( 0 , q ) : x = 0 r , c = map ( int , input ( ) . split ( ) ) if ( a [ r - 1 ] [ c - 1 ] == 1 ) : if ( r == 2 ) : if ( c != 1 and a [ 0 ] [ c - 2 ] == 1 ) : x += 1 if ( c != n and a [ 0 ] [ c ] == 1 ) : x += 1 if ( a [ 0 ] [ c - 1 ] == 1 ) : x += 1 blocks -= x else : if ( c != 1 and a [ 1 ] [ c - 2 ] == 1 ) : x += 1 if ( c != n and a [ 1 ] [ c ] == 1 ) : x += 1 if ( a [ 1 ] [ c - 1 ] == 1 ) : x += 1 blocks -= x a [ r - 1 ] [ c - 1 ] = 0 else : a [ r - 1 ] [ c - 1 ] = 1 if ( r == 2 ) : if ( c != 1 and a [ 0 ] [ c - 2 ] == 1 ) : x += 1 if ( c != n and a [ 0 ] [ c ] == 1 ) : x += 1 if ( a [ 0 ] [ c - 1 ] == 1 ) : x += 1 blocks += x else : if ( c != 1 and a [ 1 ] [ c - 2 ] == 1 ) : x += 1 if ( c != n and a [ 1 ] [ c ] == 1 ) : x += 1 if ( a [ 1 ] [ c - 1 ] == 1 ) : x += 1 blocks += x if ( blocks == 0 ) : print ( \" Yes \" ) else : print ( \" No \" ) NEW_LINE", "def solve ( n , quer , change ) : matrix = [ [ 0 ] * ( n + 1 ) for _ in range ( 3 ) ] block = 0 for x , y in change : if matrix [ x ] [ y ] == 0 : matrix [ x ] [ y ] = 1 if x - 1 > 0 : if matrix [ x - 1 ] [ y ] == 1 : block += 1 if y - 1 > 0 and matrix [ x - 1 ] [ y - 1 ] == 1 : block += 1 if y + 1 <= n and matrix [ x - 1 ] [ y + 1 ] == 1 : block += 1 else : if matrix [ x + 1 ] [ y ] == 1 : block += 1 if y - 1 > 0 and matrix [ x + 1 ] [ y - 1 ] == 1 : block += 1 if y + 1 <= n and matrix [ x + 1 ] [ y + 1 ] == 1 : block += 1 else : matrix [ x ] [ y ] = 0 if x - 1 > 0 : if matrix [ x - 1 ] [ y ] == 1 : block -= 1 if y - 1 > 0 and matrix [ x - 1 ] [ y - 1 ] == 1 : block -= 1 if y + 1 <= n and matrix [ x - 1 ] [ y + 1 ] == 1 : block -= 1 else : if matrix [ x + 1 ] [ y ] == 1 : block -= 1 if y - 1 > 0 and matrix [ x + 1 ] [ y - 1 ] == 1 : block -= 1 if y + 1 <= n and matrix [ x + 1 ] [ y + 1 ] == 1 : block -= 1 if block == 0 : print ( \" YES \" ) else : print ( \" NO \" ) n , q = list ( map ( int , input ( ) . split ( ) ) ) m = [ ] for _ in range ( q ) : m . append ( list ( map ( int , input ( ) . split ( ) ) ) ) solve ( n , q , m ) NEW_LINE", "from sys import stdin , stdoutinput = stdin . readline def main ( ) : NEW_LINE" ]
codeforces_25_A
[ "import java . util . Scanner ;   public class n25A { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int e_index = 0 ; int o_index = 0 ; int a ; int flag = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { a = scanner . nextInt ( ) ; if ( a % 2 == 0 ) if ( e_index == 0 ) e_index = i + 1 ; else flag = 1 ; if ( a % 2 == 1 ) if ( o_index == 0 ) o_index = i + 1 ; else flag = 0 ;   } if ( flag == 1 ) System . out . println ( o_index ) ; else System . out . println ( e_index ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st ; int N = Integer . parseInt ( br . readLine ( ) ) ; int even = 0 , odd = 0 , evenIdx = 0 , oddIdx = 0 ; st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < N ; i ++ ) { int temp = Integer . parseInt ( st . nextToken ( ) ) ; if ( temp % 2 == 0 ) {", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; scn . nextLine ( ) ; int [ ] arrayt = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arrayt [ i ] = scn . nextInt ( ) ; } selectEvenness ( arrayt ) ; scn . close ( ) ; } public static void selectEvenness ( int [ ] array ) { int count_even = 0 , count_odd = 0 , num1 = 0 , num2 = 0 , index_odd = 0 , index_even = 0 ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] % 2 == 1 ) { count_odd ++ ; index_odd = i + 1 ; } else if ( array [ i ] % 2 == 0 ) { count_even ++ ; index_even = i + 1 ; } if ( count_even == 1 && count_odd > 1 ) { System . out . println ( index_even ) ; break ; } else if ( count_odd == 1 && count_even > 1 ) { System . out . println ( index_odd ) ; break ; } } } }", "import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ;   public class solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] numbers = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { numbers [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( i == 0 ) { if ( numbers [ i ] % 2 != numbers [ i + 1 ] % 2 && numbers [ i ] % 2 != numbers [ i + 2 ] % 2 ) { System . out . println ( i + 1 ) ; break ; } continue ; } else if ( i == n - 1 ) { if ( numbers [ i ] % 2 != numbers [ i - 1 ] % 2 && numbers [ i ] % 2 != numbers [ i - 2 ] % 2 ) { System . out . println ( i + 1 ) ; break ; } continue ; } if ( numbers [ i ] % 2 != numbers [ i - 1 ] % 2 && numbers [ i ] % 2 != numbers [ i + 1 ] % 2 ) { System . out . print ( i + 1 ) ; break ; } } } }", "import java . util . Scanner ;   public class main {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int n = input . nextInt ( ) ; int [ ] arr = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = input . nextInt ( ) ; }   int evenOccurance = 0 ; int oddOccurance = 0 ; int ifEven = 0 , ifOdd = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 0 ) { evenOccurance ++ ; ifEven = i + 1 ; } else if ( arr [ i ] % 2 != 0 ) { oddOccurance ++ ; ifOdd = i + 1 ; } } if ( oddOccurance == 1 ) { System . out . println ( ifOdd ) ; } else if ( evenOccurance == 1 ) { System . out . println ( ifEven ) ; }   return ;   } }  " ]
[ "def f ( x ) : return ( x % 2 ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) s = 0 for i in range ( n ) : s += f ( a [ i ] ) if s == ( n - 1 ) : k = 2 i = 0 while k > 0 : k = f ( a [ i ] ) i += 1 print ( i ) else : k = - 1 i = 0 while k < 1 : k = f ( a [ i ] ) i += 1 print ( i ) NEW_LINE", "from collections import * N = int ( input ( ) ) Lst = deque ( map ( int , input ( ) . split ( ) ) ) NLst = list ( Lst ) ( Lst1 , Lst2 ) = ( deque ( ) , deque ( ) ) for i in range ( N ) : if Lst [ i ] % 2 == 0 : Lst1 . append ( Lst [ i ] ) else : Lst2 . append ( Lst [ i ] ) if len ( Lst1 ) == 1 : print ( NLst . index ( Lst1 [ 0 ] ) + 1 ) else : print ( NLst . index ( Lst2 [ 0 ] ) + 1 ) NEW_LINE", "input ( ) ; l = [ int ( x ) % 2 for x in input ( ) . split ( ) ] print ( l . index ( sum ( l ) == 1 ) + 1 ) NEW_LINE", "n = int ( input ( ) ) arr = list ( int ( x ) for x in input ( ) . split ( ) ) even = 0 for i in arr : if i % 2 == 0 : even += 1   if even == n - 1 : for i in range ( len ( arr ) ) : if arr [ i ] % 2 != 0 : print ( i + 1 ) breakelif even == 1 : for i in range ( len ( arr ) ) : if arr [ i ] % 2 == 0 : print ( i + 1 ) break NEW_LINE", "n = int ( input ( ) ) odd = 0 even = 0 oddNum = 0 evenNum = 0 a = input ( ) item = a . split ( \" ▁ \" ) testi = [ eval ( x ) for x in item ] for i in range ( 0 , n ) : if testi [ i ] % 2 == 0 : even += 1 evenNum = i + 1 else : odd += 1 oddNum = i + 1 if odd == 1 : print ( oddNum ) if even == 1 : print ( evenNum ) NEW_LINE" ]
codeforces_1494_B
[ "  import java . util . * ; import java . io . * ; import java . text . DecimalFormat ;    public class berland {    static DecimalFormat df1 = new DecimalFormat ( \" # .000000\" ) ; static DecimalFormat df = new DecimalFormat ( \" # . # # # # # # \" ) ; static boolean printing = false ;   static int N ;   static long total = 0L ; static int A = 10000001 ;   public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ;", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . PriorityQueue ; import java . util . Set ; import java . util . Stack ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; import java . util . function . Function ; import java . util . stream . Collectors ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;    public class Solution {   public static int INF = Integer . MAX_VALUE ; public static long MOD = 1000000000 + 7L ;   public static int WHITE = 0 ; public static int GRAY = 1 ; public static int BLACK = 2 ;    class Pair { public int day ; int count ;   Pair ( int d , int c ) { day = d ; count = c ; } }   static class Solver {   public void solve ( InputReader in , PrintWriter out ) { int tt = in . nextInt ( ) ;", "import java . util . * ; import java . math . * ; public class BerlandCrossword { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int n = sc . nextInt ( ) ; boolean works = true ; int [ ] hold = new int [ 4 ] ; int [ ] arr = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; hold [ i ] = arr [ i ] ; }" ]
[ "for _ in range ( int ( input ( ) ) ) : flag = 0 NEW_LINE n , u , r , d , l = map ( int , input ( ) . split ( ) ) NEW_LINE for i in range ( 0 , 2 ) : for NEW_LINE j in range ( 0 , 2 ) : NEW_LINE for k in range ( 0 , 2 ) : for NEW_LINE m in range ( 0 , 2 ) : NEW_LINE if 0 <= u - i - j <= n - 2 and 0 <= r - j - k <= n - 2 and 0 <= d - k - m <= n - 2 and 0 <= l - i - m <= n - 2 : flag = 1 NEW_LINE if flag == 0 : NEW_LINE INDENT print ( \" NO \" ) else : NEW_LINE print ( \" YES \" ) NEW_LINE DEDENT", "import sys   r = sys . stdin . readline   t = int ( r ( ) )   for tests in range ( t ) : arr = [ int ( item ) for item in r ( ) . split ( ) ] NEW_LINE n = arr [ 0 ] NEW_LINE flag = True NEW_LINE for i in range ( 16 , 32 ) : flag = True NEW_LINE secarr = arr [ 1 : ] NEW_LINE for j in range ( 4 ) : secarr [ j ] -= ( int ( bin ( i ) [ 3 : ] [ j ] ) + int ( bin ( i ) [ 3 : ] [ ( j - 1 ) % 4 ] ) ) NEW_LINE for j in secarr : if NEW_LINE j < 0 or j > n - 2 : flag = False NEW_LINE break NEW_LINE if flag : break   if flag : NEW_LINE INDENT print ( \" YES \" ) else : NEW_LINE print ( \" NO \" )       NEW_LINE DEDENT", "for _ in range ( int ( input ( ) ) ) : n , U , R , D , L = map ( int , input ( ) . split ( ) ) NEW_LINE for mask in range ( 16 ) : rU , rR , rD , rL = U , R , D , L NEW_LINE if mask & 1 : rU -= 1 NEW_LINE rL -= 1 NEW_LINE if mask & 2 : rL -= 1 NEW_LINE rD -= 1 NEW_LINE if mask & 4 : rD -= 1 NEW_LINE rR -= 1 NEW_LINE if mask & 8 : rR -= 1 NEW_LINE rU -= 1 NEW_LINE if min ( rU , rR , rD , rL ) >= 0 and max ( rU , rR , rD , rL ) <= n - 2 : print ( \" YES \" ) NEW_LINE break else : print ( \" NO \" ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE bit = 1 << 4 NEW_LINE for _ in range ( t ) : n , u , r , d , l = map ( int , input ( ) . split ( ) ) NEW_LINE yes = False NEW_LINE for mask in range ( bit ) : ur = mask & 1 NEW_LINE dr = ( mask >> 1 ) & 1 NEW_LINE dl = ( mask >> 2 ) & 1 NEW_LINE ul = ( mask >> 3 ) & 1 NEW_LINE u2 = u - ul - ur NEW_LINE r2 = r - ur - dr NEW_LINE d2 = d - dr - dl NEW_LINE l2 = l - dl - ul   if 0 <= min ( u2 , r2 , d2 , l2 ) and max ( u2 , r2 , d2 , l2 ) <= n - 2 : yes = True NEW_LINE break NEW_LINE if yes : NEW_LINE INDENT print ( ' YES ' ) else : NEW_LINE print ( ' NO ' )   NEW_LINE DEDENT", "for _ in range ( int ( input ( ) ) ) : n , U , R , D , L = map ( int , input ( ) . split ( ) ) NEW_LINE ans = ' NO ' NEW_LINE for a in range ( 2 ) : for NEW_LINE b in range ( 2 ) : NEW_LINE for c in range ( 2 ) : for NEW_LINE d in range ( 2 ) : NEW_LINE if 0 <= U - a - b <= n - 2 and 0 <= R - b - c <= n - 2 and 0 <= D - c - d <= n - 2 and 0 <= L - d - a <= n - 2 : ans = ' YES ' NEW_LINE print ( ans ) NEW_LINE" ]
codeforces_1493_B
[ "import java . util . * ; public class planetlapituletti1300 {   static int [ ] reflect = new int [ ] { 0 , 1 , 5 , - 1 , - 1 , 2 , - 1 , - 1 , 8 , - 1 } ; public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int T = sc . nextInt ( ) ; StringBuilder str = new StringBuilder ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String tm = sc . next ( ) ; int H = Integer . parseInt ( Character . toString ( tm . charAt ( 0 ) ) + Character . toString ( tm . charAt ( 1 ) ) ) ; int M = Integer . parseInt ( Character . toString ( tm . charAt ( 3 ) ) + Character . toString ( tm . charAt ( 4 ) ) ) ; Time time = new Time ( H , M , h , m ) ; for ( int i = 0 ; i < 10000 ; i ++ ) { if ( time . checkValid ( ) ) {", "import java . io . * ; import java . util . * ;   public class B { static int [ ] valid = new int [ ] { 0 , 1 , 5 , - 1 , - 1 , 2 , - 1 , - 1 , 8 , - 1 } ; public static int reverse ( int time ) { int reversed = 0 ; for ( int i = 0 ; i < 2 ; i ++ ) { int dig = time % 10 ; if ( valid [ dig ] == - 1 ) { return - 1 ; } reversed = reversed * 10 + valid [ dig ] ; time /= 10 ; } return reversed ; } public static void main ( String [ ] args ) {", "import java . util . * ; import java . math . * ; public class SortTheArray { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String [ ] in = sc . next ( ) . split ( \" : \" ) ; int hour = Integer . parseInt ( in [ 0 ] ) ; int minute = Integer . parseInt ( in [ 1 ] ) ; while ( true ) { if ( works ( h , m , hour , minute ) ) break ; minute ++ ; if ( minute == m ) { minute = 0 ; hour ++ ; } if ( hour == h ) hour = 0 ; } if ( hour < 10 ) System . out . print ( \"0\" + hour ) ; else System . out . print ( hour ) ; System . out . print ( \" : \" ) ; if ( minute < 10 ) System . out . print ( \"0\" + minute ) ; else System . out . print ( minute ) ; System . out . println ( ) ;", "  import java . util . * ; import java . io . * ; import java . text . DecimalFormat ;    public class pplanet {    static DecimalFormat df1 = new DecimalFormat ( \" # .000000\" ) ; static DecimalFormat df = new DecimalFormat ( \" # . # # # # # # \" ) ; static boolean printing = false ;   static int N ;   static int total = 0 ;    public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ;", "import java . io . * ; import java . util . * ; import java . util . stream . Stream ;    public class A { static final int INF = ( int ) 1e9 + 9 ; static final int MAXN = ( int ) 1e5 + 5 ; static final int MAXLOG = ( int ) ( Math . log ( MAXN ) / Math . log ( 2 ) + 1e-10 ) + 1 ; static final int MOD = 1_000_000_007 ;   static BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; static Reader in = new Reader ( ) ;   static List < Character > validRef = Arrays . asList ( '0' , '1' , '2' , '5' , '8' ) ;   public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ;" ]
[ "def check ( curr ) : ones , tens = curr % 10 , curr // 10 NEW_LINE if ones in d and tens in d : return d [ ones ] * 10 + d [ tens ] NEW_LINE return 10 ** 5 NEW_LINE d = { 1 : 1 , 2 : 5 , 5 : 2 , 8 : 8 , 0 : 0 } NEW_LINE for _ in range ( int ( input ( ) ) ) : h , m = map ( int , input ( ) . split ( ) ) NEW_LINE x , y = map ( int , input ( ) . split ( \" : \" ) ) NEW_LINE while True : if NEW_LINE check ( x ) < m and check ( y ) < h : NEW_LINE break NEW_LINE y += 1 NEW_LINE if y == m : y = 0 NEW_LINE x = ( x + 1 ) % h NEW_LINE print ( str ( x ) . rjust ( 2 , \"0\" ) + \" : \" + str ( y ) . rjust ( 2 , \"0\" ) ) NEW_LINE", "p = { '5' : '2' , '2' : '5' , '1' : '1' , '0' : '0' , '8' : '8' } NEW_LINE for _ in range ( int ( input ( ) ) ) : h , m = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE a , b = input ( ) . split ( \" : \" ) NEW_LINE for _ in range ( 50000 ) : if NEW_LINE any ( e not in p for e in a + b ) : NEW_LINE if int ( b ) == m - 1 : if NEW_LINE int ( a ) != h - 1 : a = '0' * ( a [ 0 ] == '0' ) * ( a [ 1 ] < '9' ) + str ( int ( a ) + 1 ) NEW_LINE b = '00' NEW_LINE continue else : a = '00' NEW_LINE b = '00' NEW_LINE continue else : b = '0' * ( b [ 0 ] == '0' ) * ( b [ 1 ] < '9' ) + str ( int ( b ) + 1 ) NEW_LINE continue else : if int ( p [ b [ 1 ] ] + p [ b [ 0 ] ] ) < h and int ( p [ a [ 1 ] ] + p [ a [ 0 ] ] ) < m : print ( a + \" : \" + b ) NEW_LINE break else : if int ( b ) == m - 1 : if NEW_LINE int ( a ) != h - 1 : a = '0' * ( a [ 0 ] == '0' ) * ( a [ 1 ] < '9' ) + str ( int ( a ) + 1 ) NEW_LINE b = '00' NEW_LINE continue else : a = '00' NEW_LINE b = '00' NEW_LINE continue else : b = '0' * ( b [ 0 ] == '0' ) * ( b [ 1 ] < '9' ) + str ( int ( b ) + 1 ) NEW_LINE continue NEW_LINE", "import sysimport NEW_LINE itertoolsimport NEW_LINE collections   NEW_LINE def rs ( x = ' ' ) : if NEW_LINE len ( x ) == 0 : NEW_LINE return sys . stdin . readline ( ) . strip ( ) NEW_LINE return input ( x ) . strip ( )   NEW_LINE def ri ( x = ' ' ) : return int ( rs ( x ) ) NEW_LINE def rm ( x = ' ' ) : return map ( str , rs ( x ) . split ( ) ) NEW_LINE def rl ( x = ' ' ) : return rs ( x ) . split ( ) NEW_LINE def rmi ( x = ' ' ) : return map ( int , rl ( x ) ) NEW_LINE def rli ( x = ' ' ) : return [ int ( val ) for val in rl ( x ) ] NEW_LINE def println ( val ) : sys . stdout . write ( str ( val ) + ' \\n ' ) NEW_LINE   NEW_LINE def mirror ( val ) : mirrored = [ 0 , 1 , 5 , - 1 , - 1 , 2 , - 1 , - 1 , 8 , - 1 ] NEW_LINE a , b = val // 10 , val % 10 NEW_LINE if mirrored [ a ] == - 1 or mirrored [ b ] == - 1 : return - 1 NEW_LINE return mirrored [ b ] * 10 + mirrored [ a ]   NEW_LINE def solve ( testCase ) : h , m = rmi ( ) NEW_LINE time = rs ( ) NEW_LINE hour , minute = time [ : 2 ] , time [ 3 : ] NEW_LINE hour = int ( hour ) * m + int ( minute ) NEW_LINE while True : h2 , m2 = mirror ( hour // m % h ) , mirror ( hour % m ) NEW_LINE h2 , m2 = m2 , h2 NEW_LINE if h2 >= 0 and m2 >= 0 and h2 < h and m2 < m : break NEW_LINE hour += 1 NEW_LINE h = hour // m % h NEW_LINE m = hour % m NEW_LINE ans = [ ] NEW_LINE if h < 10 : ans += [ '0' ] NEW_LINE ans += [ str ( h ) , ' : ' ] NEW_LINE if m < 10 : ans += [ '0' ] NEW_LINE ans += [ str ( m ) ] NEW_LINE", "import sys , mathimport NEW_LINE heapq   from collections import NEW_LINE INDENT dequeinput = sys . stdin . readline   NEW_LINE DEDENT", "def inpl ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE   NEW_LINE def inpi ( ) : return int ( input ( ) ) NEW_LINE   r = { '0' : '0' , '1' : '1' , '2' : '5' , '5' : '2' , '8' : '8' , ' : ' : ' : ' } NEW_LINE def refl ( d ) : if NEW_LINE d in r : NEW_LINE return r [ d ] else : return ' x '   NEW_LINE def to_h ( h , m ) : rr = '0' if h < 10 else ' ' NEW_LINE rr += str ( h ) NEW_LINE rr += ' : ' NEW_LINE rr += '0' if m < 10 else ' ' NEW_LINE rr += str ( m ) NEW_LINE return rr   NEW_LINE def from_h ( h ) : return list ( map ( int , h . split ( ' : ' ) ) ) NEW_LINE   NEW_LINE def mirror ( h ) : return ' ' . join ( [ refl ( d ) for d in h [ : : - 1 ] ] ) NEW_LINE   NEW_LINE def is_mirror ( h ) : return mirror ( h ) == h NEW_LINE   NEW_LINE def is_legal ( ch , cm , h , m ) : return ch < h and cm < m NEW_LINE   NEW_LINE def inc ( ch , cm , h , m ) : cm += 1 NEW_LINE ch += cm // m NEW_LINE cm = cm % m NEW_LINE ch = ch % h NEW_LINE return ch , cm   NEW_LINE def f ( ) : h , m = inpl ( ) NEW_LINE sh , sm = list ( map ( int , input ( ) . split ( ' : ' ) ) ) NEW_LINE while True : st = to_h ( sh , sm ) NEW_LINE mt = mirror ( st ) NEW_LINE" ]
codeforces_282_A
[ "import java . util . Scanner ;   public class BitPlusPlus {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int am = scanner . nextInt ( ) ; int x = 0 ; for ( int i = 0 ; i < am ; i ++ ) { String line = scanner . next ( ) ; if ( line . contains ( \" + + \" ) ) x ++ ; else x -- ; } System . out . println ( x ) ; }   }", "import java . util . Scanner ;   public class BitPlusPlus { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; scanner . nextLine ( ) ; int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String line = scanner . nextLine ( ) ; if ( line . contains ( \" + \" ) ) { res ++ ; } else { res -- ; } }   System . out . println ( res ) ; } }", "import java . io . * ; import java . util . * ; import java . lang . * ; public class Solution { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = 0 ; while ( n -- > 0 ) { String s = sc . next ( ) ; if ( s . contains ( \" + \" ) ) c ++ ; else c -- ; } System . out . println ( c ) ; } }", "import java . util . Scanner ;   public class Bit { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String str = s . next ( ) ; if ( str . equals ( \" X + + \" ) || str . equals ( \" + + X \" ) ) { result = result + 1 ; } else { result = result - 1 ; } } System . out . println ( result ) ; } }", "import java . io . * ; import java . util . * ; import java . lang . * ; import java . util . Random ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; int repeat = scan . nextInt ( ) ; int val = 0 ; while ( repeat -- > 0 ) { String test = scan . next ( ) . trim ( ) ; if ( test . equals ( \" + + X \" ) || test . equals ( \" X + + \" ) ) val ++ ; else if ( test . equals ( \" - - X \" ) || test . equals ( \" X - - \" ) ) val -- ; } System . out . println ( val ) ; } }" ]
[ "test = int ( input ( ) ) total = 0 for i in range ( test ) : s = input ( ) if s . count ( \" + \" ) == 2 : total += 1 elif s . count ( \" - \" ) == 2 : total -= 1 print ( total ) NEW_LINE", "n = int ( input ( ) ) count = 0 while ( n > 0 ) : n -= 1 strr = str ( input ( ) ) if ( ' - - ' in strr ) : count -= 1 else : count += 1 print ( count ) NEW_LINE", "n = int ( input ( ) ) x = 0 for i in range ( n ) : bit_operation = input ( ) if bit_operation == \" X + + \" or bit_operation == \" + + X \" : x = x + 1 elif bit_operation == \" X - - \" or bit_operation == \" - - X \" : x = x - 1 print ( x ) NEW_LINE" ]
codeforces_35_A
[ "import java . io . * ; import java . util . * ; public class asd {   public static void main ( String args [ ] ) throws Exception { PrintWriter output = new PrintWriter ( \" output . txt \" ) ; Scanner s = new Scanner ( new File ( \" input . txt \" ) ) ; int ball = s . nextInt ( ) ; int i = 3 ; while ( i -- > 0 ) { int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; if ( a == ball ) { ball = b ; } else if ( b == ball ) { ball = a ; } } output . println ( ball ) ; output . flush ( ) ; } }", "import java . io . File ; import java . io . FileNotFoundException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; import java . util . Stack ;   public class test {   public static void main ( String [ ] args ) throws FileNotFoundException {", "import java . io . File ; import java . io . FileNotFoundException ; import java . io . FileWriter ; import java . io . IOException ; import java . util . Scanner ;   public class codeforces { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner in = new Scanner ( new File ( \" input . txt \" ) ) ; int res = in . nextInt ( ) ; in . nextLine ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; in . nextLine ( ) ; if ( a == res ) { res = b ; } else if ( b == res ) { res = a ; } } System . out . println ( res ) ; try { FileWriter myWriter = new FileWriter ( \" output . txt \" ) ; myWriter . write ( String . valueOf ( res ) ) ; myWriter . close ( ) ; } catch ( IOException e ) { System . out . println ( \" An ▁ error ▁ occurred . \" ) ; e . printStackTrace ( ) ; } } }  " ]
[ "import syssys . stdin = open ( \" input . txt \" , \" r \" ) sys . stdout = open ( \" output . txt \" , \" w \" ) n = int ( input ( ) ) for i in range ( 3 ) : u , v = map ( int , input ( ) . split ( ) ) if ( u == n ) : n = v elif ( v == n ) : n = uprint ( n ) NEW_LINE", "rfile = open ( ' input . txt ' , ' r ' ) maintxt = rfile . read ( ) . split ( ' \\n ' ) rfile . close ( ) pos = int ( maintxt [ 0 ] ) for i in range ( 1 , 4 ) : temp = maintxt [ i ] . split ( ' ▁ ' ) cup1 , cup2 = int ( temp [ 0 ] ) , int ( temp [ 1 ] ) if pos == cup1 : pos = cup2 elif pos == cup2 : pos = cup1wfile = open ( ' output . txt ' , ' w ' ) wfile . write ( str ( pos ) )         NEW_LINE", "rfile = open ( ' input . txt ' , ' r ' ) maintxt = rfile . read ( ) . split ( ' \\n ' ) rfile . close ( ) pos = int ( maintxt [ 0 ] ) for i in range ( 1 , 4 ) : temp = maintxt [ i ] . split ( ' ▁ ' ) cup1 , cup2 = int ( temp [ 0 ] ) , int ( temp [ 1 ] ) if pos == cup1 : pos = cup2 elif pos == cup2 : pos = cup1wfile = open ( ' output . txt ' , ' w ' ) wfile . write ( str ( pos ) ) NEW_LINE", "reFile = open ( ' input . txt ' , ' r ' ) pos = int ( reFile . readline ( ) )   for i in range ( 3 ) : cup1 , cup2 = [ int ( item ) for item in reFile . readline ( ) . split ( ' ▁ ' ) ] if cup1 == pos : pos = cup2 elif cup2 == pos : pos = cup1reFile . close ( )   wFile = open ( ' output . txt ' , ' w ' ) wFile . write ( str ( pos ) ) wFile . close ( ) NEW_LINE" ]
codeforces_730_B
[ "import java . io . * ; import java . util . * ; public class B { public static void main ( String [ ] args ) throws Throwable { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out , true ) ; Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int min = 1 , max = n ; if ( n > 1 ) { pw . printf ( \" ? ▁ % d ▁ % d \\n \" , 1 , n ) ; pw . flush ( ) ; char c = sc . next ( ) . charAt ( 0 ) ; if ( c == ' > ' ) { min = n ; max = 1 ; } int s = 2 , e = n - 1 ; while ( s <= e ) { int min1 = s , max1 = e ; if ( s != e ) { pw . printf ( \" ? ▁ % d ▁ % d \\n \" , s , e ) ; pw . flush ( ) ; c = sc . next ( ) . charAt ( 0 ) ; if ( c == ' > ' ) { min1 = e ; max1 = s ; } } pw . printf ( \" ? ▁ % d ▁ % d \\n \" , min1 , min ) ; pw . flush ( ) ; c = sc . next ( ) . charAt ( 0 ) ; if ( c == ' < ' ) min = min1 ; pw . printf ( \" ? ▁ % d ▁ % d \\n \" , max1 , max ) ; pw . flush ( ) ; c = sc . next ( ) . charAt ( 0 ) ; if ( c == ' > ' ) max = max1 ; s ++ ; e -- ; } } pw . printf ( \" ! ▁ % d ▁ % d \\n \" , min , max ) ; pw . flush ( ) ; } pw . flush ( ) ; pw . close ( ) ; } }" ]
[ "from collections import defaultdictfor ik in range ( int ( input ( ) ) ) : n = int ( input ( ) ) d = defaultdict ( str ) if n == 1 : print ( \" ! ▁ 1 ▁ 1\" , flush = True ) continue elif n == 2 : print ( \" ? ▁ 1 ▁ 2\" , flush = True ) s = input ( ) if s == \" > \" : print ( \" ! ▁ 2 ▁ 1\" , flush = True ) else : print ( \" ! ▁ 1 ▁ 2\" , flush = True ) continue last = [ i for i in range ( 1 , n + 1 ) ] res = [ ] while ( len ( last ) != 1 ) : for i in range ( len ( last ) // 2 ) : print ( \" ? \" , last [ 2 * i ] , last [ 2 * i + 1 ] , flush = True ) r = input ( ) d [ ( last [ 2 * i ] , last [ 2 * i + 1 ] ) ] = r if r == ' > ' : res . append ( last [ 2 * i ] ) else : res . append ( last [ 2 * i + 1 ] ) if len ( last ) % 2 == 1 : res . append ( last [ - 1 ] ) last = res + [ ] res = [ ] max = last [ 0 ] NEW_LINE", "import sysT = int ( input ( ) ) def compare ( l , r , arr ) : print ( ' ? ' , a [ l ] + 1 , a [ r ] + 1 ) sys . stdout . flush ( ) res = input ( ) if ( res == ' > ' ) : return 1 ; else : return 0 ;   while ( T > 0 ) : T -= 1 Max_a = [ ] Min_a = [ ] n = int ( input ( ) ) a = range ( n ) for i in range ( int ( n / 2 ) ) : if ( compare ( i * 2 , i * 2 + 1 , a ) > 0 ) : Max_a . append ( i * 2 ) Min_a . append ( i * 2 + 1 ) else : Max_a . append ( i * 2 + 1 ) Min_a . append ( i * 2 ) if ( n % 2 == 1 ) : Max_a . append ( n - 1 ) Min_a . append ( n - 1 ) Max_index = Max_a [ - 1 ] Min_index = Min_a [ - 1 ] for i in range ( len ( Max_a ) - 1 ) : if ( compare ( Max_a [ i ] , Max_index , a ) > 0 ) : Max_index = Max_a [ i ] for i in range ( len ( Min_a ) - 1 ) : if ( compare ( Min_a [ i ] , Min_index , a ) == 0 ) : Min_index = Min_a [ i ] print ( ' ! ' , Min_index + 1 , Max_index + 1 ) sys . stdout . flush ( )               NEW_LINE", "from sys import *   def f ( t ) : n = len ( t ) k = n >> 1 u , v = [ ] , [ ] if n & 1 : u , v = [ t [ - 1 ] ] , [ t [ - 1 ] ] for i in range ( k ) : print ( ' ? ' , t [ i ] , t [ k + i ] ) stdout . flush ( ) q = k * ( input ( ) == ' < ' ) u . append ( t [ k - q + i ] ) v . append ( t [ q + i ] ) return u , v   for i in range ( int ( input ( ) ) ) : u , v = f ( range ( 1 , int ( input ( ) ) + 1 ) ) while len ( u ) > 1 : u = f ( u ) [ 0 ] while len ( v ) > 1 : v = f ( v ) [ 1 ] print ( ' ! ' , u [ 0 ] , v [ 0 ] ) stdout . flush ( ) NEW_LINE", "import sys   def f ( arr ) : mn , mx = [ ] , [ ] for i in range ( len ( arr ) // 2 ) : print ( ' ? ' , arr [ 2 * i ] , arr [ 2 * i + 1 ] ) sys . stdout . flush ( ) if input ( ) == ' > ' : mn . append ( arr [ 2 * i + 1 ] ) mx . append ( arr [ 2 * i ] ) else : mn . append ( arr [ 2 * i ] ) mx . append ( arr [ 2 * i + 1 ] ) if len ( arr ) % 2 == 1 : mn . append ( arr [ - 1 ] ) mx . append ( arr [ - 1 ] ) return ( mn , mx )     for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) arr = range ( 1 , n + 1 ) mn , mx = f ( arr ) while len ( mn ) > 1 : mn = f ( mn ) [ 0 ] while len ( mx ) > 1 : mx = f ( mx ) [ 1 ] print ( ' ! ' , mn [ 0 ] , mx [ 0 ] ) sys . stdout . flush ( )         NEW_LINE", "from sys import stdin , stdoutfrom math import sin , tan , cos     def ask ( i , j ) : stdout . write ( ' ? ▁ ' + str ( i ) + ' ▁ ' + str ( j ) + ' \\n ' ) stdout . flush ( ) return stdin . readline ( ) . strip ( )     T = int ( stdin . readline ( ) ) for t in range ( T ) : n = int ( stdin . readline ( ) ) if n == 1 : stdout . write ( ' ! ▁ 1 ▁ 1 \\n ' ) stdout . flush ( ) continue l , r = 1 , 2 if ask ( l , r ) == ' > ' : l , r = r , l for i in range ( 3 , n + 1 , 2 ) : if i == n : s = ask ( l , i ) f = ask ( r , i ) if s == ' > ' : l = i if f == ' < ' : r = i continue lb , rb = i , i + 1 if ask ( lb , rb ) == ' > ' : lb , rb = rb , lb if ask ( lb , l ) == ' < ' : l = lb if ask ( rb , r ) == ' > ' : r = rb   stdout . write ( ' ! ▁ ' + str ( l ) + ' ▁ ' + str ( r ) + ' \\n ' ) stdout . flush ( ) NEW_LINE" ]
codeforces_120_B
[ "import java . io . File ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Scanner ;   public class B120 {   public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( new File ( \" input . txt \" ) ) ; PrintWriter out = new PrintWriter ( new File ( \" output . txt \" ) ) ; int N = in . nextInt ( ) ; int K = in . nextInt ( ) - 1 ; int [ ] A = new int [ N ] ; for ( int n = 0 ; n < N ; n ++ ) { A [ n ] = in . nextInt ( ) ; } while ( A [ K ] == 0 ) { K = ( K + 1 ) % N ; } out . println ( K + 1 ) ; out . close ( ) ; }   }", "import java . io . * ; import java . util . * ; public class kuchBhi { public static void main ( String [ ] args ) throws Throwable {", "import java . io . * ; import java . util . * ; public class kuchBhi { public static void main ( String [ ] args ) throws Throwable {", "import java . io . File ; import java . io . PrintWriter ; import java . lang . * ; import java . util . * ;   public class Abhishek {   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( new File ( \" input . txt \" ) ) ; PrintWriter out = new PrintWriter ( new File ( \" output . txt \" ) ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } k -- ; while ( a [ k ] != 1 ) { k ++ ; k %= n ; } out . println ( k + 1 ) ; out . close ( ) ; }   }" ]
[ "if __name__ == ' _ _ main _ _ ' : cin = open ( \" input . txt \" , \" r \" ) cout = open ( \" output . txt \" , \" w \" ) n , k = map ( int , cin . readline ( ) . split ( ) ) a = [ int ( i ) for i in cin . readline ( ) . split ( ) ] a = [ i + 1 for i in range ( n ) if a [ i ] ]   for i , v in enumerate ( a ) : if k <= v : cout . write ( str ( v ) ) break else : cout . write ( str ( a [ 0 ] ) ) NEW_LINE", "import sys   sys . stdin = open ( r ' input . txt ' , ' r ' ) sys . stdout = open ( r ' output . txt ' , ' w ' )   n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   i = k - 1 ; while ( True ) : if i == n : i = 0 continue   if a [ i ] == 1 : print ( i + 1 ) break   i += 1 NEW_LINE", "import syssys . stdin = open ( r ' input . txt ' , ' r ' ) sys . stdout = open ( r ' output . txt ' , ' w ' ) n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) i = k - 1 ; while ( True ) : if i == n : i = 0 continue if a [ i ] == 1 : print ( i + 1 ) break i += 1 NEW_LINE", "input_file = open ( \" input . txt \" , \" r \" ) n , k = tuple ( [ int ( num ) for num in input_file . readline ( ) [ : - 1 ] . split ( ) ] ) arr = [ int ( num ) for num in input_file . readline ( ) [ : - 1 ] . split ( ) ] print ( n ) print ( k ) print ( arr ) k = k - 1 while ( arr [ k ] == 0 ) : k = ( k + 1 ) % noutput_file = open ( \" output . txt \" , \" w \" ) output_file . write ( \" % d \" % ( k + 1 ) ) NEW_LINE", "import syssys . stdin = open ( r ' input . txt ' , ' r ' ) sys . stdout = open ( r ' output . txt ' , ' w ' ) n , k = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( k - 1 , 2 * n ) : pos = i % n if arr [ pos ] == 1 : print ( pos + 1 ) break NEW_LINE" ]
codeforces_221_A
[ "import java . util . Scanner ;   public class P221A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . print ( n + \" ▁ \" ) ; for ( int i = 1 ; i < n ; i ++ ) { System . out . print ( i + \" ▁ \" ) ; } System . out . println ( ) ; } }", "import java . util . * ;    public class dummycodes {   public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . print ( n + \" ▁ \" ) ; for ( int i = 1 ; i <= n - 1 ; i ++ ) { System . out . print ( i + \" ▁ \" ) ; } } }    ", "import java . util . Arrays ; import java . util . Scanner ;   public class _0733LittleElephantandFunction {   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 ] = i + 1 ; } for ( int i = n - 1 ; i > 0 ; i -- ) { int temp = arr [ i ] ; arr [ i ] = arr [ i - 1 ] ; arr [ i - 1 ] = temp ; } for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( arr [ i ] + \" ▁ \" ) ; } }   }", "import java . math . BigInteger ; import java . util . * ; import java . util . Comparator ; import java . lang . * ; import java . util . Arrays ;      public class geek { static class comp { int a , b ; public comp ( ) { } public comp ( int a , int b ) { this . a = a ; this . b = b ; }   } static boolean check ( long x ) { if ( x == 1 || x == 0 ) return false ; for ( long i = 2 ; i <= Math . sqrt ( x ) ; i ++ ) { if ( x % i == 0 ) { return false ; } } return true ; }    public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; try { StringBuffer sb = new StringBuffer ( ) ; int n = s . nextInt ( ) ; sb . append ( n + \" ▁ \" ) ; if ( n > 1 ) { for ( int i = 1 ; i < n ; i ++ ) { sb . append ( i + \" ▁ \" ) ; } }     System . out . println ( sb ) ;          ", "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 = int ( input ( ) ) arr = list ( range ( 1 , n ) ) print ( n , * arr ) NEW_LINE", "N = int ( input ( ) ) print ( N , * range ( 1 , N ) ) NEW_LINE", "N = int ( input ( ) ) print ( N , * range ( 1 , N ) ) NEW_LINE" ]
codeforces_1064_A
[ "import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( Math . max ( 0 , a [ 2 ] - a [ 1 ] - a [ 0 ] + 1 ) ) ;   } }", "import java . util . * ;   public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int [ ] a = { input . nextInt ( ) , input . nextInt ( ) , input . nextInt ( ) } ; Arrays . sort ( a ) ; int res = a [ 2 ] + 1 - a [ 0 ] - a [ 1 ] ; System . out . println ( res < 0 ? 0 : res ) ; } }", "import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int ans = 0 ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i <= 2 ; i ++ ) a [ i ] = s . nextInt ( ) ; Arrays . sort ( a ) ; if ( a [ 0 ] + a [ 1 ] > a [ 2 ] ) ans = 0 ; else ans = a [ 2 ] - a [ 1 ] - a [ 0 ] + 1 ; System . out . println ( ans ) ; } }" ]
[ "a , b , c = ( int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ) if a < b : max = b b = a a = maxif a < c : max = c c = a a = max   if a < b + c : time = 0 else : time = a - ( b + c ) + 1   print ( time ) NEW_LINE", "import sys   def main ( ) : a , b , c = sorted ( map ( int , sys . stdin . read ( ) . strip ( ) . split ( ) ) ) return max ( c + 1 - a - b , 0 )   print ( main ( ) ) NEW_LINE", "a , b , c = sorted ( map ( int , input ( ) . split ( ) ) ) print ( max ( 0 , c - a - b + 1 ) ) NEW_LINE", "a , b , c = map ( int , input ( ) . split ( ) ) if ( a < b ) : max = b b = a a = maxif ( a < c ) : max = c c = a a = maxk = 0 if a >= b + c : k = a - ( b + c ) + 1 else : k = 0 print ( k ) NEW_LINE" ]
codeforces_287_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class BinarySearchAdv {   public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String s [ ] ; s = br . readLine ( ) . split ( \" ▁ \" ) ; long n = Long . parseLong ( s [ 0 ] ) ; long k = Long . parseLong ( s [ 1 ] ) ; long sum = ( k * k - k ) / 2 + 1 ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ;   public class Main { public static int mod = 1000000007 ; public static int [ ] [ ] [ ] dp ; public static int MAX_VAL ; public static PrintWriter out ; public static int num = 0 ;   public static void main ( String [ ] args ) throws IOException {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ;   public class Pipeline_CodeForces {   public static BigInteger sumSuffix ( long idx , int k ) { BigInteger t2 = new BigInteger ( 2 + \" \" ) ; BigInteger tIDX = new BigInteger ( idx + \" \" ) ; BigInteger k1 = new BigInteger ( k + \" \" ) ; BigInteger k2 = new BigInteger ( ( k + 1 ) + \" \" ) ; BigInteger n1 = ( k1 . multiply ( k2 ) ) . divide ( t2 ) ;   BigInteger idx1 = new BigInteger ( idx + \" \" ) ; BigInteger idx2 = new BigInteger ( ( idx + 1 ) + \" \" ) ; BigInteger n2 = ( idx1 . multiply ( idx2 ) ) . divide ( t2 ) ;   return n1 . subtract ( n2 ) . add ( tIDX ) ; } public static long BSfindfirstSmaller ( BigInteger N , int k ) { long start = 1 ; long end = k ; long mid = 0 ; while ( start < end ) { mid = start + ( end - start ) / 2 ;", "import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . nio . file . Paths ; import java . util . InputMismatchException ;   public class Main {   public Main ( ) throws FileNotFoundException {  " ]
[ "def suma ( n ) : return n * ( n + 1 ) // 2   def sumaij ( i , j ) : if i <= 1 : return suma ( j ) return suma ( j ) - suma ( i - 1 )   def bin_search_solution ( n , k ) : st , end = 1 , k while st < end : mid = ( st + end ) // 2 s = sumaij ( mid , k ) if s == n : return k - mid + 1 if s > n : st = mid + 1 else : end = mid return k - st + 2   def solve ( ) : n , k = map ( int , input ( ) . split ( ) ) if n == 1 : print ( 0 ) elif k >= n : print ( 1 ) else : n -= 1 k -= 1 if suma ( k ) < n : print ( - 1 ) else : res = bin_search_solution ( n , k ) print ( res )   if __name__ == ' _ _ main _ _ ' : solve ( ) NEW_LINE", "def bs ( n , k , lo , hi ) : while lo <= hi : mid = ( hi + lo ) // 2 summ = ( ( k * ( k + 1 ) ) // 2 - 1 ) - ( ( ( mid - 1 ) * ( mid ) ) // 2 - 1 ) - ( k - 2 ) if summ == n : return k - mid + 1 elif summ > n : lo = mid + 1 elif summ < n : hi = mid - 1 if summ > n : mid += 1 return k - mid + 1     def solve ( ) : n , k = map ( int , input ( ) . split ( ) ) if n == 1 : return 0 elif ( k * ( k + 1 ) // 2 ) - ( k - 2 ) <= n : return - 1 elif k >= n : return 1 else : return bs ( n , k , 2 , k )   print ( solve ( ) ) NEW_LINE", "def main ( ) : n , k = map ( int , input ( ) . split ( ) ) n -= 1 k -= 1 if n == 0 : minSplitters = 0 elif n <= k : minSplitters = 1 elif n > sum_consecutive ( k ) : minSplitters = - 1 else : minSplitters = min_splitters ( n , k )   print ( minSplitters )     def min_splitters ( n , k ) : low , high = 1 , k while low < high : mid = ( low + high ) // 2 summation = sum_consecutive2 ( mid , k ) if summation == n : return k - mid + 1 elif summation > n : low = mid + 1 else : high = mid   return k - low + 2     def sum_consecutive ( num ) : return int ( 0.5 * num * ( num + 1 ) )     def sum_consecutive2 ( num1 , num2 ) : return sum_consecutive ( num2 ) - sum_consecutive ( num1 - 1 )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "import mathn , k = map ( int , input ( ) . split ( ) ) n -= 1 k -= 1 if n > ( k * ( k + 1 ) ) // 2 : print ( - 1 ) else : l = - 1 r = k + 1 while r > l + 1 : m = ( l + r ) // 2 if n > ( m * ( 2 * k - m + 1 ) ) // 2 : l = m else : r = m print ( r ) NEW_LINE" ]
codeforces_1119_A
[ "import java . util . Scanner ;   public class IlyaColorWalk { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , l = 0 , r = n - 1 , c [ ] = new int [ n ] ;   for ( i = 0 ; i < n ; i ++ ) c [ i ] = in . nextInt ( ) ; in . close ( ) ;   while ( c [ l ] == c [ n - 1 ] ) l ++ ; while ( c [ r ] == c [ 0 ] ) r -- ; System . out . println ( Math . max ( n - l - 1 , r ) ) ; } }", "import java . io . PrintWriter ; import java . util . Scanner ;   public class ColorfulWalk1100 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ;   int houses = in . nextInt ( ) ; int [ ] colors = new int [ houses ] ; for ( int i = 0 ; i < houses ; i ++ ) colors [ i ] = in . nextInt ( ) ; int distanceEnd = 0 ; for ( int i = 0 ; i < houses - 1 ; i ++ ) { if ( colors [ i ] != colors [ houses - 1 ] ) { distanceEnd = Math . abs ( ( houses - 1 ) - i ) ; break ; } } int distanceBeg = 0 ; for ( int i = houses - 1 ; i > - 1 ; i -- ) { if ( colors [ i ] != colors [ 0 ] ) { distanceBeg = Math . abs ( i ) ; break ; } } out . print ( Math . max ( distanceBeg , distanceEnd ) ) ; out . close ( ) ; } }", "import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = in . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( a [ i ] != a [ n ] ) { ans = n - i ; break ; } } for ( int i = n ; i >= 1 ; i -- ) { if ( a [ 1 ] != a [ i ] ) { if ( ( i - 1 ) > ans ) ans = i - 1 ; break ; } } out . println ( ans ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreElements ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }" ]
[ "try : n = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) z = [ ] i = n - 1 while i > 0 : if not c [ i ] == c [ 0 ] : z . append ( i ) break else : i = i - 1 i = 0 while i < n - 1 : if not c [ i ] == c [ n - 1 ] : z . append ( n - 1 - i ) break else : i = i + 1 print ( max ( z ) ) except : pass NEW_LINE", "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n - 1 ) : if l [ i ] != l [ - 1 ] : distance = n - i - 1 breakfor j in range ( n - 1 , 0 , - 1 ) : if l [ j ] != l [ 0 ] : if j > distance : distance = j breakprint ( distance ) NEW_LINE", "n = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) i = 0j = n - 1 ans1 = 0 ans2 = 0 while i < n - 1 and j > 0 : if c [ j ] != c [ 0 ] : ans1 = j break else : j -= 1 if c [ i ] != c [ n - 1 ] : ans2 = n - 1 - i break else : i += 1   print ( max ( ans1 , ans2 ) ) NEW_LINE", "def mex ( a ) : a . sort ( ) f = 0 for i in range ( len ( a ) ) : if a [ i ] != i : f = 1 return i if f == 0 : return max ( a ) + 1 import math   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) i = 0j = n - 1 while a [ i ] == a [ j ] : i += 1 ans1 = j - ii = 0 while a [ i ] == a [ j ] : j -= 1 ans = max ( ans1 , j ) print ( ans ) NEW_LINE" ]
codeforces_74_B
[ "import java . util . Scanner ;   public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) , m = s . nextInt ( ) , k = s . nextInt ( ) ; String str = s . next ( ) ; str = s . next ( ) ; char [ ] array = s . next ( ) . toCharArray ( ) ; int i = 1 ; for ( char item : array ) { if ( item == '0' ) { if ( m < k ) m = Math . max ( 1 , m - 1 ) ; else m = Math . min ( n , m + 1 ) ; if ( str . equals ( \" head \" ) ) k -- ; else k ++ ; } else { if ( str . equals ( \" head \" ) ) k -- ; else k ++ ; if ( str . equals ( \" head \" ) ) m = n ; else m = 1 ; } if ( k == n ) str = \" head \" ; else if ( k == 1 ) str = \" tail \" ; if ( m == k ) { System . out . println ( \" Controller ▁ \" + i ) ; System . exit ( 0 ) ; } i ++ ; } System . out . println ( \" Stowaway \" ) ; } }", "  import java . util . Scanner ;   public class B74 { public static void main ( String [ ] args ) { new B74 ( ) . run ( ) ; }   public void run ( ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; scanner . nextLine ( ) ; String di = scanner . nextLine ( ) ; String time = scanner . nextLine ( ) ; char [ ] ts = time . toCharArray ( ) ; for ( int i = 0 ; i < ts . length ; ++ i ) {", "import java . util . * ; import java . io . * ;   public class Train { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   int t = 1 ;   while ( t -- > 0 ) {   String str [ ] = br . readLine ( ) . trim ( ) . split ( \" ▁ \" ) ; int n = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; int k = Integer . parseInt ( str [ 2 ] ) ;   boolean tohead = false ; str = br . readLine ( ) . trim ( ) . split ( \" ▁ \" ) ; if ( str [ 1 ] . equals ( \" head \" ) ) tohead = true ; else tohead = false ;   char a [ ] = br . readLine ( ) . trim ( ) . toCharArray ( ) ; int time = a . length ; for ( int i = 0 ; i < time ; i ++ ) { if ( a [ i ] == '0' ) {   if ( m != 1 && m != n ) { int x = Math . abs ( k - ( m + 1 ) ) ; int y = Math . abs ( k - ( m - 1 ) ) ; if ( x > y ) { m ++ ; } else { m -- ; } }   if ( tohead ) k -- ; else k ++ ; if ( k == 1 || k == n ) { tohead = ! tohead ; } } else { if ( tohead ) k -- ; else k ++ ; if ( k == 1 || k == n ) { tohead = ! tohead ; }   if ( k == 1 ) { m = n ; } else if ( k == n ) { m = 1 ; } else { if ( tohead ) m = n ; else m = 1 ; } }  " ]
[ "J = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE v , y , z = J ( ) NEW_LINE dir = ' to ▁ tail ' == input ( ) NEW_LINE for t , x in enumerate ( map ( int , input ( ) ) ) : if NEW_LINE z == 1 : dir = 1 elif z == v : dir = 0 NEW_LINE if not x : NEW_LINE INDENT y = min ( v , y + 1 ) if z < y else max ( 1 , y - 1 ) else : NEW_LINE y = 1 if dir else v NEW_LINE DEDENT z = z + 1 if dir else z - 1 NEW_LINE if y == z : print ( ' Controller ▁ ' + str ( t + 1 ) ) NEW_LINE exit ( 0 ) NEW_LINE print ( ' Stowaway ' ) NEW_LINE", "from sys import stdin , stdout , exit NEW_LINE n , m , k = map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE d = 1 if stdin . readline ( ) [ 6 ] == ' l ' else - 1 NEW_LINE m = 1 if m < k else n NEW_LINE for i , c in enumerate ( stdin . readline ( ) , 1 ) : if NEW_LINE c == '0' : NEW_LINE if k == 1 : NEW_LINE INDENT k , d = 2 , 1 elif k == n : NEW_LINE k , d = n - 1 , - 1 else : NEW_LINE k += d NEW_LINE DEDENT if m == k : stdout . write ( ' Controller ▁ ' + str ( i ) ) NEW_LINE exit ( 0 ) else : if k == 1 : NEW_LINE INDENT k , d , m = 2 , 1 , 1 elif k == n : NEW_LINE k , d , m = n - 1 , - 1 , n elif d == 1 : NEW_LINE k += 1 NEW_LINE DEDENT m = 1 else : k -= 1 NEW_LINE m = n NEW_LINE stdout . write ( ' Stowaway ' ) NEW_LINE", "from sys import stdin , stdout , exit NEW_LINE n , m , k = map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE d = 1 if stdin . readline ( ) [ 6 ] == ' l ' else - 1 NEW_LINE m = 1 if m < k else nfor NEW_LINE i in range ( 5 ) : passfor NEW_LINE i , c in enumerate ( stdin . readline ( ) , 1 ) : NEW_LINE if c == '0' : if NEW_LINE k == 1 : k , d = 2 , 1 elif k == n : k , d = n - 1 , - 1 else : k += d NEW_LINE if m == k : stdout . write ( ' Controller ▁ ' + str ( i ) ) NEW_LINE exit ( 0 ) else : if k == 1 : NEW_LINE INDENT k , d , m = 2 , 1 , 1 elif k == n : NEW_LINE k , d , m = n - 1 , - 1 , n elif d == 1 : NEW_LINE k += 1 NEW_LINE DEDENT m = 1 else : k -= 1 NEW_LINE m = n NEW_LINE stdout . write ( ' Stowaway ' ) NEW_LINE" ]
codeforces_815_B
[ "import java . io . * ; import java . util . * ;   public class MainB { static final StdIn in = new StdIn ( ) ; static final PrintWriter out = new PrintWriter ( System . out ) ; static final long M = ( long ) 1e9 + 7 ; public static void main ( String [ ] args ) { int n = in . nextInt ( ) ; long [ ] a = in . readLongArray ( n ) ; if ( n % 2 == 1 ) { -- n ; for ( int i = 0 ; i < n ; ++ i ) { if ( i % 2 == 0 ) a [ i ] = a [ i ] + a [ i + 1 ] ; else { a [ i ] = a [ i ] - a [ i + 1 ] + M ; if ( a [ i ] < 0 ) a [ i ] += M ; } } } long ans = 0 , nck = 1 ; int s = n / 2 % 2 == 0 ? - 1 : 1 ; for ( int i = 0 ; i < n / 2 ; ++ i ) { ans = ( nck * ( a [ 2 * i ] + s * a [ 2 * i + 1 ] ) + ans ) % M ; nck = nck * ( n / 2 - 1 - i ) % M * modI ( i + 1 , M ) % M ;", "import java . io . * ; import java . util . * ;   import static java . math . BigDecimal . valueOf ;   public class Solution { static MyScanner sc ; private static PrintWriter out ; static long M2 = 1_000_000_000L + 7 ;   public static void main ( String [ ] s ) throws Exception { StringBuilder stringBuilder = new StringBuilder ( ) ;  " ]
[ "import sys   def CreateFact ( n , mod ) : cant = n + 1 factorials = [ 1 ] * cant   for x in range ( 1 , cant ) : val = factorials [ x - 1 ] * x % mod factorials [ x ] = val inv_factorial = [ 1 ] * cant inv_factorial [ n ] = pow ( factorials [ - 1 ] , mod - 2 , mod ) for x in reversed ( range ( 0 , n ) ) : val = inv_factorial [ x + 1 ] * ( x + 1 ) % mod inv_factorial [ x ] = val return factorials , inv_factorial   def CalculateNPairsCoef ( n , mod ) : factorial , inv_factorial = CreateFact ( n , mod ) coef = [ 1 ] * n middle = int ( ( n + 1 ) / 2 ) last = n - 1 for x in range ( 1 , middle ) : o = factorial [ n - 1 ] * inv_factorial [ n - 1 - x ] % mod * inv_factorial [ x ] % mod coef [ x ] = o coef [ last - x ] = o return coef   def KarenAdTest ( ) : n = int ( sys . stdin . readline ( ) ) line = sys . stdin . readline ( ) . split ( ) i = 0 while i < n : x = int ( line [ i ] ) line [ i ] = x i += 1 mod = 1000000007   if n == 1 : val = line [ 0 ] % mod print ( val ) return if n == 2 : val = ( line [ 0 ] + line [ 1 ] ) % mod print ( val ) return if n == 3 : val = ( line [ 0 ] + 2 * line [ 1 ] - line [ 2 ] ) % mod print ( val ) return if n == 4 : val = ( line [ 0 ] - line [ 1 ] + line [ 2 ] - line [ 3 ] ) % mod print ( val ) return if n == 5 : val = ( line [ 0 ] + 2 * line [ 2 ] + line [ 4 ] ) % mod print ( val ) return NEW_LINE" ]
codeforces_123_A
[ "import java . util . * ; import java . io . * ; import static java . lang . Math . * ;   public class PracticeProblem { public static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   public static FastReader in = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static StringBuilder answer = new StringBuilder ( ) ;   public static void main ( String [ ] args ) { solve ( ) ; out . close ( ) ; }   private static void solve ( ) { char [ ] s = in . nextLine ( ) . toCharArray ( ) ; int n = s . length ;   if ( n < 4 ) { out . println ( \" YES \" ) ; out . println ( new String ( s ) ) ; return ; }   int [ ] charCount = new int [ 26 ] ;   for ( char c : s ) charCount [ c - ' a ' ] ++ ;  " ]
[ "k = [ 1 ] * 1001 for i in range ( 2 , 1001 ) : if k [ i ] == 1 : z = i for j in range ( z , 1001 , z ) : k [ j ] = 0 k [ i ] = 1 k [ 0 ] = k [ 1 ] = 0 z = input ( ) lo = len ( z ) if 1 : w = [ 0 ] * 26 for i in z : w [ ord ( i ) - 97 ] += 1 p = 0 for i in range ( lo // 2 + 1 , lo + 1 ) : p += k [ i ] if max ( w ) < lo - p - 1 : print ( \" NO \" ) else : print ( \" YES \" ) s = [ 1 ] * ( lo + 1 ) k1 = w . index ( max ( w ) ) for i in range ( 2 , lo // 2 + 1 ) : s [ i ] = chr ( k1 + 97 ) ; w [ k1 ] -= 1 for i in range ( lo // 2 + 1 , lo + 1 ) : if k [ i ] == 0 and w [ k1 ] != 0 : s [ i ] = chr ( k1 + 97 ) ; w [ k1 ] -= 1 j = 0 for i in range ( 1 , 1 + lo ) : if s [ i ] == 1 : while w [ j ] < 1 : j += 1 s [ i ] = chr ( 97 + j ) ; w [ j ] -= 1 print ( * s [ 1 : ] , sep = ' ' )   NEW_LINE", "p = [ 1 ] * 1001 for i in range ( 2 , 1001 ) : if p [ i ] : for j in range ( i , 1001 , i ) : p [ j ] = 0 p [ i ] = 1 a = input ( ) z = len ( a ) l = [ 0 ] * 26 for i in a : l [ ord ( i ) - 97 ] += 1 gh = 0 for i in range ( z // 2 + 1 , z + 1 ) : gh += p [ i ] if max ( l ) < z - 1 - gh : exit ( print ( \" NO \" ) ) ans = [ ' ' ] * ( z + 1 ) t = l . index ( max ( l ) ) for i in range ( 2 , 1 + ( z // 2 ) ) : ans [ i ] = chr ( t + 97 ) ; l [ t ] -= 1 for i in range ( 1 + ( z // 2 ) , z + 1 ) : if p [ i ] == 0 : ans [ i ] = chr ( t + 97 ) ; l [ t ] -= 1j = 0 for i in range ( 1 , z + 1 ) : if ans [ i ] == ' ' : while l [ j ] <= 0 : j += 1 ans [ i ] = chr ( j + 97 ) ; l [ j ] -= 1 print ( \" YES \" ) print ( ' ' . join ( ans [ 1 : : ] ) ) NEW_LINE" ]
codeforces_482_B
[ "import java . util . * ; import java . io . * ; import java . text . * ;   public class B482 {   static class SegmentTree {", "import java . util . * ; import java . io . * ; public class Solution { public static void main ( String [ ] args ) throws IOException , InterruptedException { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int N = 1 ; while ( N < n ) { N *= 2 ; } int [ ] arr = new int [ N + 1 ] ; SegmentTree sg = new SegmentTree ( arr ) ; int l [ ] = new int [ m + 1 ] ; int r [ ] = new int [ m + 1 ] ; int q [ ] = new int [ m + 1 ] ;   for ( int i = 1 ; i <= m ; i ++ ) { l [ i ] = sc . nextInt ( ) ; r [ i ] = sc . nextInt ( ) ; q [ i ] = sc . nextInt ( ) ; sg . updateRange ( l [ i ] , r [ i ] , q [ i ] ) ; } for ( int i = 1 ; i <= m ; i ++ ) { if ( sg . query ( l [ i ] , r [ i ] ) != q [ i ] ) { System . out . println ( \" NO \" ) ; return ; } } System . out . println ( \" YES \" ) ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . print ( sg . query ( i , i ) + \" ▁ \" ) ; } } static class SegmentTree { int [ ] sTree , array , lazy ; int N ; public SegmentTree ( int [ ] array ) { this . array = array ; N = array . length - 1 ;", "import java . util . * ; import java . io . * ; public class Solution { public static void main ( String [ ] args ) throws IOException , InterruptedException { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int N = 1 ; while ( N < n ) { N *= 2 ; } int [ ] arr = new int [ N + 1 ] ; SegmentTree sg = new SegmentTree ( arr ) ; int l [ ] = new int [ m + 1 ] ; int r [ ] = new int [ m + 1 ] ; int q [ ] = new int [ m + 1 ] ;   for ( int i = 1 ; i <= m ; i ++ ) { l [ i ] = sc . nextInt ( ) ; r [ i ] = sc . nextInt ( ) ; q [ i ] = sc . nextInt ( ) ; sg . updateRange ( l [ i ] , r [ i ] , q [ i ] ) ; } for ( int i = 1 ; i <= m ; i ++ ) { if ( sg . query ( l [ i ] , r [ i ] ) != q [ i ] ) { System . out . println ( \" NO \" ) ; return ; } } System . out . println ( \" YES \" ) ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . print ( sg . query ( i , i ) + \" ▁ \" ) ; } } static class SegmentTree { int [ ] sTree , array , lazy ; int N ; public SegmentTree ( int [ ] array ) { this . array = array ; N = array . length - 1 ;" ]
[ "import sys   input = sys . stdin . readline   n , m = map ( int , input ( ) . split ( ) ) a = [ ] for _ in range ( m ) : l , r , q = map ( int , input ( ) . split ( ) ) l -= 1 r -= 1 a . append ( ( l , r , q ) ) res = [ 0 ] * nbad = Falsefor i in range ( 30 ) : events = [ 0 ] * ( n + 1 ) for l , r , q in a : if q & ( 1 << i ) : events [ l ] += 1 events [ r + 1 ] -= 1 c = 0 for j in range ( n ) : c += events [ j ] if c > 0 : res [ j ] |= ( 1 << i ) s = [ 0 ] * ( n + 1 ) for j in range ( n ) : s [ j + 1 ] = s [ j ] + ( ( res [ j ] >> i ) & 1 ) for l , r , q in a : if q & ( 1 << i ) == 0 : if s [ r + 1 ] - s [ l ] == r - l + 1 : bad = True breakif bad : print ( \" NO \" ) else : print ( \" YES \" ) print ( * res ) NEW_LINE" ]
codeforces_1245_B
[ "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 matht = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) a , b , c = map ( int , input ( ) . split ( ) ) st = input ( ) ans = 0 st1 = \" \" for x in st : if ( x == \" R \" and b > 0 ) : ans += 1 b -= 1 st1 += \" P \" elif ( x == \" S \" and a > 0 ) : ans += 1 a -= 1 st1 += \" R \" elif ( x == \" P \" and c > 0 ) : ans += 1 c -= 1 st1 += \" S \" else : st1 += \" * \"   ans_str = \" \" for x in st1 : if ( x == ' * ' ) : if ( a > 0 ) : ans_str += \" R \" a -= 1 elif ( b > 0 ) : ans_str += \" P \" b -= 1 elif ( c > 0 ) : ans_str += \" S \" c -= 1 else : ans_str += x if ( ans >= math . ceil ( n / 2 ) ) : print ( \" YES \" ) print ( ans_str ) else : print ( \" NO \" )   NEW_LINE", "import mathdef main ( ) : cases = int ( input ( ) ) for _ in range ( cases ) : dic = { ' R ' : 0 , ' P ' : 0 , ' S ' : 0 } seq = [ ] n = int ( input ( ) ) R , P , S = [ int ( i ) for i in input ( ) . split ( \" ▁ \" ) ] for ele in list ( input ( ) ) : dic [ ele ] += 1 seq . append ( ele ) win = True qtd_fail = 0 if dic [ ' R ' ] > P : qtd_fail += dic [ ' R ' ] - P if dic [ ' P ' ] > S : qtd_fail += dic [ ' P ' ] - S if dic [ ' S ' ] > R : qtd_fail += dic [ ' S ' ] - R w = n - qtd_fail k = math . ceil ( n / 2 ) NEW_LINE", "from math import ceilfor _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a , b , c = map ( int , input ( ) . split ( ) ) s = input ( ) d = { ' R ' : 0 , ' P ' : 0 , ' S ' : 0 } for i in s : d [ i ] += 1 wins = min ( b , d [ ' R ' ] ) + min ( d [ ' P ' ] , c ) + min ( d [ ' S ' ] , a ) if wins >= ceil ( n / 2 ) : print ( \" YES \" ) ans = [ ' ' ] * n for i in range ( n ) : if s [ i ] == ' R ' and b > 0 : ans [ i ] = ' P ' b -= 1 elif s [ i ] == ' P ' and c > 0 : ans [ i ] = ' S ' c -= 1 elif s [ i ] == ' S ' and a > 0 : ans [ i ] = ' R ' a -= 1 for i in range ( n ) : if ( a + b + c ) == 0 : break if ans [ i ] == ' ' : if a != 0 : ans [ i ] = ' R ' a -= 1 elif b != 0 : ans [ i ] = ' P ' b -= 1 elif c != 0 : ans [ i ] = ' S ' c -= 1 out = ' ' for an in ans : out += an print ( out ) else : print ( \" NO \" ) NEW_LINE", "t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) a , b , c = map ( int , input ( ) . split ( ) ) s = input ( ) ans = [ ] cnt = 0 for i in range ( n ) : if a > 0 and s [ i ] == \" S \" : a -= 1 cnt += 1 ans . append ( \" R \" ) elif b > 0 and s [ i ] == \" R \" : b -= 1 cnt += 1 ans . append ( \" P \" ) elif c > 0 and s [ i ] == \" P \" : c -= 1 cnt += 1 ans . append ( \" S \" ) else : ans . append ( \" ? \" ) for i in range ( n ) : if ans [ i ] == \" ? \" : if a > 0 : ans [ i ] = \" R \" a -= 1 elif b > 0 : ans [ i ] = \" P \" b -= 1 else : ans [ i ] = \" S \" c -= 1 if cnt >= ( n + 1 ) // 2 : print ( \" YES \" ) print ( \" \" . join ( ans ) ) else : print ( \" NO \" ) NEW_LINE" ]
codeforces_277_A
[ "import java . io . * ; import java . util . * ; import java . math . * ; import java . math . BigInteger ;", "import java . io . * ; import java . util . * ;   public class TWO77A { private int adj [ ] [ ] ; private boolean visited [ ] ; private int n , m ; private boolean allNone = true ; public static void main ( String args [ ] ) { TWO77A t = new TWO77A ( ) ; t . process ( ) ; } public void process ( ) { Scanner s = new Scanner ( System . in ) ; n = s . nextInt ( ) ; m = s . nextInt ( ) ; adj = new int [ n ] [ n ] ; ArrayList < Employee > employees = new ArrayList < Employee > ( ) ; visited = new boolean [ n ] ; Arrays . fill ( visited , false ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { adj [ i ] [ j ] = 0 ; } } for ( int i = 0 ; i < n ; i ++ ) { int numLanguage = s . nextInt ( ) ; if ( numLanguage != 0 ) { allNone = false ; } Employee e = new Employee ( ) ; for ( int j = 0 ; j < numLanguage ; j ++ ) { e . languages . add ( s . nextInt ( ) ) ; } employees . add ( e ) ; } for ( int emp1 = 0 ; emp1 < n ; emp1 ++ ) { for ( int emp2 = emp1 + 1 ; emp2 < n ; emp2 ++ ) { Employee e1 = employees . get ( emp1 ) ; Employee e2 = employees . get ( emp2 ) ; for ( int lang : e2 . languages ) { if ( e1 . languages . contains ( lang ) ) { adj [ emp1 ] [ emp2 ] = adj [ emp2 ] [ emp1 ] = 1 ; } } } }", "import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ;    public class A277 { static class weightedQU { int [ ] id ; int [ ] size ; public weightedQU ( int n ) { id = new int [ n ] ; size = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { size [ i ] = i ; id [ i ] = i ; } } public int root ( int i ) { while ( i != id [ i ] ) { id [ i ] = id [ id [ i ] ] ; i = id [ i ] ; } return i ; } public boolean connected ( int p , int q ) { return root ( p ) == root ( q ) ; } public void union ( int p , int q ) { int i = root ( p ) ; ; int j = root ( q ) ; if ( size [ i ] < size [ j ] ) { id [ i ] = j ; size [ j ] += size [ j ] ; } else { id [ j ] = i ; size [ i ] += size [ j ] ; } } } public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;" ]
[ "from collections import defaultdictn , m = map ( int , input ( ) . split ( ) ) a = [ ] graph = defaultdict ( list ) coun0 = 0 for i in range ( n ) : a . append ( list ( map ( int , input ( ) . split ( ) ) ) ) if a [ i ] [ 0 ] == 0 : coun0 += 1 if coun0 == len ( a ) : print ( len ( a ) ) else : for i in range ( n ) : for j in range ( n ) : if i != j : for k in range ( 1 , a [ i ] [ 0 ] + 1 ) : for l in range ( 1 , a [ j ] [ 0 ] + 1 ) : if a [ i ] [ k ] == a [ j ] [ l ] : graph [ i ] . append ( j ) def dfs ( n ) : vis [ n ] = 1 for i in graph [ n ] : if not vis [ i ] : dfs ( i ) vis = [ 0 ] * n ans = - 1 for i in range ( n ) : if not vis [ i ] : ans += 1 dfs ( i ) print ( ans ) NEW_LINE", "from sys import stdin , stdoutinput = stdin . readline def main ( ) : n , m = map ( int , input ( ) . split ( ) ) sets = list ( range ( n + 1 + m ) ) sizes = [ 1 ] * ( n + 1 + m ) def get ( a ) : if sets [ a ] != a : sets [ a ] = get ( sets [ a ] ) return sets [ a ] def union ( a , b ) : a = get ( a ) b = get ( b ) if a == b : return if sizes [ a ] > sizes [ b ] : a , b = b , a sets [ a ] = b sizes [ b ] += sizes [ a ] flags = [ 1 ] * n for i in range ( n ) : nums = list ( map ( int , input ( ) . split ( ) ) ) for j in range ( 1 , nums [ 0 ] + 1 ) : union ( i , nums [ j ] - 1 + n ) flags [ i ] = nums [ 0 ] ans = 0 s = set ( ) for i in range ( n ) : if flags [ i ] == 0 : ans += 1 continue s . add ( get ( i ) ) print ( max ( 0 , len ( s ) - 1 ) + ans ) main ( ) NEW_LINE", "from sys import stdininput = stdin . readlinen , m = map ( int , input ( ) . split ( ) ) l = [ ] cnt = 0 for _ in range ( n ) : a = set ( list ( map ( int , input ( ) . split ( ) ) ) [ 1 : ] ) if len ( a ) == 0 : cnt += 1 continue li = [ ] for s in l : if a & s : a |= s else : li . append ( s ) li . append ( a ) l = liprint ( cnt + max ( 0 , len ( l ) - 1 ) ) NEW_LINE" ]
codeforces_703_B
[ "import java . io . * ; import java . util . * ; public class Mishka_and_trip { 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 ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ;   long arr [ ] = new long [ n + 1 ] ; long sum = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; sum += arr [ i ] ; } boolean capital [ ] = new boolean [ n + 1 ] ; long ans = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int x = sc . nextInt ( ) ; capital [ x ] = true ; sum -= arr [ x ] ;   ans += ( sum * arr [ x ] ) ; }  ", "import java . io . * ; import java . util . * ;   public class CF { public static void main ( String [ ] args ) throws IOException {", "import java . io . * ; import java . util . * ; import java . util . regex . * ; public class vk18 { public static void main ( String [ ] stp ) throws Exception { Scanner scan = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) , k = Integer . parseInt ( st . nextToken ( ) ) , i , p = 0 ; ; Integer a [ ] = new Integer [ n ] ; st = new StringTokenizer ( br . readLine ( ) ) ; long sum = 0 , ans = 0 ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; sum += a [ i ] ; } st = new StringTokenizer ( br . readLine ( ) ) ; for ( i = 0 ; i < k ; i ++ ) { p = Integer . parseInt ( st . nextToken ( ) ) - 1 ; sum -= a [ p ] ; ans += sum * a [ p ] ; a [ p ] = 0 ; } for ( i = 1 ; i < n ; i ++ ) { ans += a [ i ] * a [ i - 1 ] ; } ans += a [ 0 ] * a [ n - 1 ] ; pw . println ( ans ) ; pw . flush ( ) ; } }", "import java . util . * ;   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 ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int k = input . nextInt ( ) ; int a [ ] = new int [ n ] ; int c [ ] = new int [ k ] ; long total = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; total += a [ i ] ; } long ans = 0 ; for ( int i = 0 ; i < k ; i ++ ) { c [ i ] = input . nextInt ( ) - 1 ; total -= a [ c [ i ] ] ; ans += total * a [ c [ i ] ] ; a [ c [ i ] ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { ans += ( a [ i ] * a [ ( i + 1 ) % n ] ) ; } System . out . println ( ans ) ; }     }" ]
[ "n , k = map ( int , input ( ) . split ( ) ) v = list ( map ( int , input ( ) . split ( ) ) ) c = set ( i - 1 for i in map ( int , input ( ) . split ( ) ) )   prefix_all = [ 0 ] * nprefix_cap = [ 0 ] * n   for i in range ( n ) : if i > 0 : prefix_all [ i ] += prefix_all [ i - 1 ] prefix_cap [ i ] += prefix_cap [ i - 1 ] prefix_all [ i ] += v [ i ] if i in c : prefix_cap [ i ] += v [ i ]   res = 0 for i in range ( n ) : if i in c : res += v [ i ] * ( prefix_all [ n - 1 ] - prefix_all [ i ] ) else : res += v [ i ] * ( prefix_cap [ n - 1 ] - prefix_cap [ i ] ) if i + 1 < n and i + 1 not in c : res += v [ i ] * v [ i + 1 ] if i == 0 and n - 1 not in c : res += v [ 0 ] * v [ n - 1 ] print ( res )   NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) C = list ( map ( int , input ( ) . split ( ) ) ) S = list ( map ( int , input ( ) . split ( ) ) ) G = set ( S ) ans = 0 sus = sum ( C ) stos = 0 for x in G : stos += C [ x - 1 ] for j in S : ans += C [ j - 1 ] * ( sus - C [ j - 1 ] ) for i in range ( n ) : if i + 1 not in G and ( i + 1 ) % n + 1 not in G : ans += C [ i ] * C [ ( i + 1 ) % n ] s2 = 0 for v in G : s2 += C [ v - 1 ] * C [ v - 1 ] print ( ans - ( stos * stos - s2 ) // 2 ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) cit = list ( map ( int , input ( ) . split ( ) ) ) ''' # ▁ a ▁ good ▁ approach ▁ but ▁ not ▁ sufficient ▁ for ▁ the ▁ time ▁ limitans ▁ = ▁ 0ans _ set ▁ = ▁ set ( ) for ▁ i ▁ in ▁ range ( n ▁ - ▁ 1 ) : TABSYMBOL ans _ set . add ( ( i , ▁ i ▁ + ▁ 1 ) )  ans _ set . add ( (0 , ▁ n ▁ - ▁ 1 ) )  for ▁ i ▁ in ▁ range ( k ) : TABSYMBOL bfc ▁ = ▁ cit [ i ] ▁ - ▁ 1 TABSYMBOL for ▁ ii ▁ in ▁ range ( n ) : TABSYMBOL TABSYMBOL if ▁ ii ▁ = = ▁ bfc : TABSYMBOL TABSYMBOL TABSYMBOL continue TABSYMBOL TABSYMBOL else : TABSYMBOL TABSYMBOL TABSYMBOL ans _ set . add ( ( min ( bfc , ▁ ii ) , ▁ max ( bfc , ▁ ii ) ) )  for ▁ i ▁ in ▁ ans _ set : TABSYMBOL ii , ▁ jj ▁ = ▁ i TABSYMBOL ans ▁ + = ▁ l [ ii ] ▁ * ▁ l [ jj ]  print ( ans ) ''' ans = 0 sum_ = sum ( l ) for i in range ( k ) : sum_ -= l [ cit [ i ] - 1 ] ans += sum_ * l [ cit [ i ] - 1 ]   cit = set ( cit ) for i in range ( n - 1 ) : if ( i + 1 ) not in cit and ( i + 2 ) not in cit : ans += l [ i ] * l [ i + 1 ]   if 1 not in cit and n not in cit : ans += l [ 0 ] * l [ - 1 ]     print ( ans ) NEW_LINE", "from collections import * n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) cap = [ 0 for i in range ( n ) ] c = list ( map ( int , input ( ) . split ( ) ) ) for i in c : cap [ i - 1 ] = 1 s = sum ( a ) ans = 0 for i in range ( n ) : if ( cap [ i ] == 1 ) : ans += a [ i ] * ( s - a [ i ] ) s -= a [ i ] elif ( cap [ i - 1 ] != 1 ) : ans += a [ i ] * a [ i - 1 ] print ( ans ) NEW_LINE" ]
codeforces_743_A
[ "import java . util . Scanner ;   public class P743A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; String s = sc . next ( ) ; System . out . println ( s . charAt ( a - 1 ) == s . charAt ( b - 1 ) ? 0 : 1 ) ; } }", "import java . io . * ; import java . util . * ; import java . math . * ;   public class Main { 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 . Scanner ;   public class VladikFlights { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , a = in . nextInt ( ) - 1 , b = in . nextInt ( ) - 1 ; String s = in . next ( ) ;   in . close ( ) ; System . out . println ( s . charAt ( a ) == s . charAt ( b ) ? 0 : 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 ;   public class Main { public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int a = input . nextInt ( ) - 1 ; int b = input . nextInt ( ) - 1 ; String s = input . next ( ) ; if ( s . charAt ( b ) == s . charAt ( a ) ) { System . out . println ( \"0\" ) ; } else { int min = Math . min ( a , b ) ; int max = Math . max ( a , b ) ; String sub = s . substring ( min + 1 , max ) ; int first = ( min + 1 ) + sub . indexOf ( ( s . charAt ( max ) == '1' ) ? \"1\" : \"0\" ) ; if ( first < 0 ) { System . out . println ( Math . abs ( min - max ) ) ; return ; } else System . out . println ( \"1\" ) ; } } }" ]
[ "n , a , b = map ( int , input ( ) . split ( ) ) s = str ( input ( ) ) if s [ a - 1 ] == s [ b - 1 ] : print ( 0 ) else : print ( abs ( int ( s [ a - 1 ] ) - int ( s [ b - 1 ] ) ) ) NEW_LINE", "if __name__ == ' _ _ main _ _ ' : n , a , b = map ( int , input ( ) . split ( ) ) s = input ( ) f = a - 1 t = b - 1 if a > b : f , t = t , f if a == b or s [ a - 1 ] == s [ b - 1 ] : print ( 0 ) else : print ( 1 ) NEW_LINE", "if __name__ == \" _ _ main _ _ \" : n , a , b = map ( int , input ( ) . split ( ) ) s = input ( ) if s [ a - 1 ] == s [ b - 1 ] : print ( 0 ) else : print ( 1 ) NEW_LINE", "n , a , b = map ( int , input ( ) . split ( ) ) s = input ( ) if ( s [ a - 1 ] == s [ b - 1 ] ) : NEW_LINE", "import sysfrom os import pathif ( path . exists ( ' input . txt ' ) and path . exists ( ' output . txt ' ) ) : sys . stdout = open ( ' output . txt ' , ' w ' ) sys . stdin = open ( ' input . txt ' , ' r ' )   def main ( ) : n , a , b = ( int ( i ) for i in input ( ) . split ( ) ) a -= 1 b -= 1 s = input ( ) if s [ a ] == s [ b ] : print ( 0 ) else : ans = 1e6 i = 0 while i < n : if ans == 1 : break if s [ i ] == s [ a ] : for j in range ( i + 1 , n ) : if s [ j ] == s [ b ] : ans = min ( ans , abs ( i - j ) ) break if s [ i ] == s [ b ] : for j in range ( i + 1 , n ) : if s [ j ] == s [ a ] : ans = min ( ans , abs ( i - j ) ) break i += 1 print ( ans )     main ( ) NEW_LINE" ]
codeforces_1203_B
[ "import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ;   public class EqualRectangles { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String testCase = scanner . nextLine ( ) ; int t = Integer . parseInt ( testCase ) ; String [ ] n = new String [ t ] ; String [ ] sticks = new String [ t ] ;    for ( int i = 0 ; i < t ; i ++ ) { n [ i ] = scanner . nextLine ( ) ; sticks [ i ] = scanner . nextLine ( ) ; } for ( int i = 0 ; i < t ; i ++ ) { solve ( n [ i ] , sticks [ i ] ) ; } }    public static void solve ( String n , String sticks ) { int r = Integer . parseInt ( n ) ; int [ ] s = Arrays . stream ( sticks . split ( \" ▁ \" ) ) . mapToInt ( Integer :: parseInt ) . sorted ( ) . toArray ( ) ; boolean helper = false ; boolean helper1 = false ;   int area = s [ 0 ] * s [ 4 * r - 1 ] ;    for ( int i = 0 ; i < 4 * r - 1 ; i = i + 2 ) { if ( s [ i ] == s [ i + 1 ] ) helper = true ; else { helper = false ; break ; } }   if ( ! helper ) System . out . println ( \" NO \" ) ; else { for ( int i = 1 ; i < 2 * r ; i = i + 2 ) { if ( s [ i ] * s [ 4 * r - i ] == area ) helper1 = true ; else { helper1 = false ; break ; } }   if ( helper1 ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ;   } } }", "import java . util . Arrays ; import java . util . Scanner ;   public class EqualRectangles { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int q = scanner . nextInt ( ) ;   while ( q -- != 0 ) { int n = scanner . nextInt ( ) ; int [ ] sides = new int [ ( 4 * n ) ] ;   for ( int i = 0 ; i < sides . length ; i ++ ) { sides [ i ] = scanner . nextInt ( ) ; } System . out . println ( solve ( sides , n ) ) ; } }   public static String solve ( int [ ] sides , int n ) { Arrays . sort ( sides ) ;   boolean ans = true ; int y = sides [ 0 ] * sides [ sides . length - 1 ] ; int j = sides . length - 1 ; for ( int i = 0 ; i < sides . length / 2 ; i += 2 , j -= 2 ) { if ( sides [ i ] == sides [ i + 1 ] && ( sides [ j ] == sides [ ( j - 1 ) ] ) && sides [ i ] * sides [ j ] == y ) { } else { ans = false ; break ; } }   if ( ans ) { return \" YES \" ; } else { return \" NO \" ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; import java . math . * ; public class code { static int dp [ ] [ ] ; static boolean visited [ ] ; static int ans = 0 ; public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int arr [ ] = new int [ 4 * n ] ; for ( int i = 0 ; i < 4 * n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; boolean flg = true ; n = 4 * n ; for ( int i = 0 ; i < n - 1 ; i += 2 ) { if ( arr [ i ] == arr [ i + 1 ] ) list . add ( arr [ i ] ) ; else { flg = false ; break ; } }", "import java . util . * ;   public class EqualRectangles { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int cases = scanner . nextInt ( ) ; while ( ( cases -- ) != 0 ) { int n = scanner . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; int temp = n * 4 ; while ( ( temp -- ) != 0 ) { list . add ( scanner . nextInt ( ) ) ; } list . sort ( Comparator . comparingInt ( o -> o ) ) ; boolean state = true ; for ( int i = 0 ; i < list . size ( ) - 1 ; i += 2 ) { if ( ! list . get ( i ) . equals ( list . get ( i + 1 ) ) ) { state = false ; System . out . println ( \" NO \" ) ; break ; } } if ( state ) { int lastIndex = list . size ( ) - 1 ; TreeSet < Integer > couple = new TreeSet < > ( ) ; for ( int j = 0 ; j < list . size ( ) / 2 ; j ++ ) { couple . add ( list . get ( j ) * list . get ( lastIndex -- ) ) ; } if ( couple . size ( ) == 1 ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } } } }" ]
[ "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 = inp ( ) a = inpl ( ) c = Counter ( a ) res = 1 b = [ ] for key , va in c . items ( ) : if va % 2 : res = 0 for i in range ( va // 2 ) : b . append ( key ) if res == 0 : print ( ' NO ' ) ; continue b . sort ( ) se = set ( ) for i in range ( n * 2 ) : se . add ( b [ i ] * b [ - 1 - i ] ) print ( ' YES ' if len ( se ) == 1 else ' NO ' ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) count = 0 a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) f = 0 p = a [ 0 ] * a [ 4 * n - 1 ] for i in range ( 0 , 4 * n , 2 ) : if a [ i ] * a [ 4 * n - 1 - i ] != p or a [ i ] != a [ i + 1 ] : f = 1   if f == 0 : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "from math import *   a = int ( input ( ) ) for x in range ( a ) : b = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) c . sort ( ) t = 0 m = 0 for y in range ( 0 , ( 4 * b ) // 2 , 2 ) : if y == 0 : if ( c [ y ] == c [ y + 1 ] ) and ( c [ ( 4 * b ) - y - 1 ] == c [ ( 4 * b ) - y - 2 ] ) : t = c [ y ] * c [ ( 4 * b ) - y - 1 ] else : m = - 1 break   else : if ( c [ y ] * c [ ( 4 * b ) - y - 1 ] != t ) or ( c [ y ] != c [ y + 1 ] ) or ( c [ ( 4 * b ) - y - 1 ] != c [ ( 4 * b ) - y - 2 ] ) : m = - 1 break   if m == - 1 : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "t = int ( input ( ) ) for _ in range ( t ) :   n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) )   li . sort ( )   i = 0 j = len ( li ) - 1 area = li [ i ] * li [ j ] res = \" YES \" while i < j : if li [ i ] != li [ i + 1 ] or li [ j ] != li [ j - 1 ] or li [ i ] * li [ j ] != area : res = \" NO \" break   i += 2 j -= 2 print ( res )     NEW_LINE" ]
codeforces_1326_A
[ "import java . util . Scanner ;   public class BadUglyNumbers { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; int [ ] array = new int [ t ] ;   for ( int i = 0 ; i < t ; i ++ ) { array [ i ] = scanner . nextInt ( ) ; }   for ( int i = 0 ; i < array . length ; i ++ ) solve ( array [ i ] ) ;    }   public static void solve ( int n ) { if ( n == 1 ) System . out . println ( - 1 ) ; else { System . out . print ( 2 ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . print ( 3 ) ; } System . out . println ( \" ▁ \" ) ; } } }", "import java . util . Arrays ; import java . util . Scanner ;   public class BadUglyNumbers { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int testCases = scanner . nextInt ( ) ;   while ( testCases -- != 0 ) { int n = scanner . nextInt ( ) ; System . out . println ( solve ( n ) ) ; } }   public static String solve ( int n ) { if ( n == 1 ) { return \" - 1\" ; } String str = \"2\" ;   char [ ] chars = new char [ n - 1 ] ; Arrays . fill ( chars , '3' ) ; str = str + new String ( chars ) ; return str ; } }", "import java . util . Scanner ;   public class task2 { static Scanner scanner = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { long a = scanner . nextInt ( ) ; for ( int i = 0 ; i < a ; i ++ ) { long num = scanner . nextInt ( ) ; for ( long j = 0 ; j < num ; j ++ ) { if ( num > 1 ) { if ( j == 0 ) System . out . print ( 2 ) ; else System . out . print ( 3 ) ; } else System . out . print ( - 1 ) ; } System . out . println ( ) ; }   } }", "import java . io . * ; import java . util . StringTokenizer ;" ]
[ "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) if n == 1 : print ( - 1 ) else : res = [ 3 ] * ( n - 1 ) res . insert ( 0 , 2 ) print ( * res , sep = ' ' ) NEW_LINE", "for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) if n == 1 : print ( - 1 ) else : ans = \"2\" + ( \"3\" * ( n - 1 ) ) print ( ans ) NEW_LINE", "def bad_ugly ( ) : for i in range ( int ( input ( ) ) ) : x = int ( input ( ) ) if ( x < 2 ) : print ( \" - 1\" ) else : print ( \"5\" + \"7\" * ( x - 1 ) )           bad_ugly ( )       NEW_LINE", "def func ( s ) : for i in range ( s ) : n = int ( input ( ) ) if n == 1 : print ( ' - 1' ) else : ans = '2' + ( '3' * ( n - 1 ) ) print ( ans )   s = int ( input ( ) ) func ( s ) NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) if n == 1 : print ( - 1 ) else : print ( '5' + '7' * ( n - 1 ) ) NEW_LINE" ]
codeforces_744_A
[ "import java . io . * ; import java . util . * ;   public class A { static ArrayList < Integer > g [ ] ; static int [ ] vis , cc ; public static void main ( String [ ] args ) throws IOException { FastReader f = new FastReader ( ) ; StringBuffer sb = new StringBuffer ( ) ; int n = f . nextInt ( ) ; int m = f . nextInt ( ) ; int k = f . nextInt ( ) ; Set < Integer > cap = new HashSet < > ( ) ; for ( int i = 0 ; i < k ; i ++ ) cap . add ( f . nextInt ( ) ) ; g = new ArrayList [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) g [ i ] = new ArrayList < > ( ) ; vis = new int [ n + 1 ] ; cc = new int [ n + 1 ] ; List < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { int x = f . nextInt ( ) ; int y = f . nextInt ( ) ; g [ x ] . add ( y ) ; g [ y ] . add ( x ) ; list . add ( x + \" ▁ \" + y ) ; } int c = 1 ; for ( int x : cap ) { dfs ( x , c ) ; c ++ ; }", "import java . util . * ; import java . io . * ; public class gfg { public static void main ( String [ ] args ) throws IOException {" ]
[ "import sysinput = sys . stdin . readline   class Unionfind : def __init__ ( self , n ) : self . par = [ - 1 ] * n self . rank = [ 1 ] * n def root ( self , x ) : r = x while not self . par [ r ] < 0 : r = self . par [ r ] t = x while t != r : tmp = t t = self . par [ t ] self . par [ tmp ] = r return r def unite ( self , x , y ) : rx = self . root ( x ) ry = self . root ( y ) if rx == ry : return if self . rank [ rx ] <= self . rank [ ry ] : self . par [ ry ] += self . par [ rx ] self . par [ rx ] = ry if self . rank [ rx ] == self . rank [ ry ] : self . rank [ ry ] += 1 else : self . par [ rx ] += self . par [ ry ] self . par [ ry ] = rx def is_same ( self , x , y ) : return self . root ( x ) == self . root ( y ) def count ( self , x ) : return - self . par [ self . root ( x ) ]   n , m , k = map ( int , input ( ) . split ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) uf = Unionfind ( n )   for _ in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) uf . unite ( u - 1 , v - 1 )   sizes = [ uf . count ( ci - 1 ) for ci in c ] sizes . sort ( ) sizes [ - 1 ] += n - sum ( sizes ) ans = 0   for size in sizes : ans += size * ( size - 1 ) // 2   ans -= m   print ( ans ) NEW_LINE", "import osimport sysfrom io import BytesIO , IOBaseBUFSIZE = 8192 class FastIO ( IOBase ) : newlines = 0 def __init__ ( self , file ) : self . _fd = file . fileno ( ) self . buffer = BytesIO ( ) self . writable = \" x \" in file . mode or \" r \" not in file . mode self . write = self . buffer . write if self . writable else None def read ( self ) : while True : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) if not b : break ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines = 0 return self . buffer . read ( ) def readline ( self ) : while self . newlines == 0 : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) self . newlines = b . count ( b \" \\n \" ) + ( not b ) ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines -= 1 return self . buffer . readline ( ) def flush ( self ) : if self . writable : os . write ( self . _fd , self . buffer . getvalue ( ) ) self . buffer . truncate ( 0 ) , self . buffer . seek ( 0 ) class IOWrapper ( IOBase ) : def __init__ ( self , file ) : self . buffer = FastIO ( file ) self . flush = self . buffer . flush self . writable = self . buffer . writable self . write = lambda s : self . buffer . write ( s . encode ( \" ascii \" ) ) self . read = lambda : self . buffer . read ( ) . decode ( \" ascii \" ) self . readline = lambda : self . buffer . readline ( ) . decode ( \" ascii \" )     sys . stdin , sys . stdout = IOWrapper ( sys . stdin ) , IOWrapper ( sys . stdout ) input = lambda : sys . stdin . readline ( ) . rstrip ( \" \\n \" ) NEW_LINE", "from queue import Queue   n , m , k = [ int ( i ) for i in input ( ) . split ( ) ] govt = [ 0 for i in range ( n ) ] l = [ int ( i ) for i in input ( ) . split ( ) ] for i in l : govt [ i - 1 ] = 1 edges = [ ] adj = [ [ ] for i in range ( n ) ] for i in range ( m ) : x = [ int ( i ) for i in input ( ) . split ( ) ] adj [ x [ 0 ] - 1 ] . append ( x [ 1 ] - 1 ) adj [ x [ 1 ] - 1 ] . append ( x [ 0 ] - 1 ) parent = [ - 1 for i in range ( n ) ] mx = 0 ans = 0 visited = [ 0 for i in range ( n ) ] total_no_gov_nodes = 0 extra = 0 for i in range ( n ) : num_edges = 0 back = 0 num_nodes = 0 gov_exist = 0 if ( visited [ i ] == 0 ) : q = Queue ( ) q . put ( i ) visited [ i ] = 1 while ( q . empty ( ) != True ) : num_nodes += 1 tmp = q . get ( ) if ( govt [ tmp ] == 1 ) : gov_exist = 1 for child in adj [ tmp ] : if ( visited [ child ] == 0 ) : num_edges += 1 q . put ( child ) visited [ child ] = 1 parent [ child ] = tmp elif ( parent [ tmp ] != child ) : back += 1 num_edges += ( back / 2 ) num_edges = int ( num_edges ) if ( gov_exist == 1 ) : mx = max ( mx , num_nodes ) add = int ( ( num_nodes * ( num_nodes - 1 ) ) / 2 ) ans += ( add - num_edges ) if ( gov_exist == 0 ) : if ( total_no_gov_nodes == 0 ) : total_no_gov_nodes = num_nodes else : extra += ( total_no_gov_nodes * num_nodes ) total_no_gov_nodes += num_nodesans += extraans += ( mx * total_no_gov_nodes ) print ( ans ) NEW_LINE", "from sys import stdin , stdout   def find ( node ) : x = [ ] while dsu [ node ] > 0 : x . append ( node ) node = dsu [ node ] for i in x : dsu [ i ] = node return node   def union ( node1 , node2 ) : if node1 != node2 : if dsu [ node1 ] > dsu [ node2 ] : node1 , node2 = node2 , node1 dsu [ node1 ] += dsu [ node2 ] dsu [ node2 ] = node1 edges [ node1 ] += edges [ node2 ] + 1 else : edges [ node1 ] += 1   n , m , k = map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) arr = [ int ( num ) for num in stdin . readline ( ) . strip ( ) . split ( ) ] edges = [ 0 ] * ( n + 1 ) dsu = [ - 1 ] * ( n + 1 ) maxm = 1 maxm_e = 0 maxm_p = Nonefor __ in range ( m ) : a , b = map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) union ( find ( a ) , find ( b ) ) req = set ( ) for i in arr : p_i = find ( i ) r_e = ( dsu [ p_i ] * ( dsu [ p_i ] + 1 ) ) // 2 maxm_e += r_e - edges [ p_i ] if abs ( dsu [ p_i ] ) >= maxm : maxm = max ( maxm , abs ( dsu [ p_i ] ) ) maxm_p = p_i req . add ( p_i )   for i in range ( 1 , n + 1 ) : if dsu [ i ] < 0 : p_i = find ( i ) if p_i not in req : r_e = ( dsu [ p_i ] * ( dsu [ p_i ] + 1 ) ) // 2 maxm_e += r_e - edges [ p_i ] maxm_e += dsu [ maxm_p ] * dsu [ p_i ] dsu [ maxm_p ] += dsu [ p_i ] stdout . write ( f ' { maxm _ e } ' ) NEW_LINE", "n , m , k = map ( int , input ( ) . split ( ) )   a = set ( map ( int , input ( ) . split ( ) ) )   A = [ [ 0 for i in range ( n + 1 ) ] for i in range ( n + 1 ) ] visited = [ 0 for i in range ( n + 1 ) ]   for i in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) A [ u ] [ v ] = 1 A [ v ] [ u ] = 1   e = 0   def dfs ( u ) : global e global v visited [ u ] = 1 e += 1 for i in range ( 1 , n + 1 ) : if A [ u ] [ i ] == 1 and visited [ i ] == 0 : dfs ( i )   return   max_e = 0 ans = 0   for u in a : e = 0 dfs ( u ) ans += e * ( e - 1 ) // 2 max_e = max ( max_e , e ) k = 0 for i in range ( 1 , n + 1 ) : if visited [ i ] == 0 : e = 0 dfs ( i ) k += e ans += ( max_e * k + k * ( k - 1 ) // 2 ) ans -= m   print ( max ( ans , 0 ) ) NEW_LINE" ]
codeforces_934_B
[ "import java . util . * ; import java . io . * ; public class Main { static PrintWriter w = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; if ( n > 36 ) w . println ( - 1 ) ; else { for ( int i = 1 ; i <= n / 2 ; i ++ ) w . print ( \"8\" ) ; if ( n % 2 == 1 ) w . print ( \"4\" ) ; } w . close ( ) ; } }", "import java . util . * ; public class contest10 { static Scanner scn = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int k = scn . nextInt ( ) ; StringBuilder ans = new StringBuilder ( ) ; int lenCheck = 18 ; while ( k > 1 && ans . length ( ) < 20 ) { ans . append ( 8 ) ; k -= 2 ; } if ( k == 1 ) { ans . append ( 4 ) ; } if ( ans . length ( ) > 18 ) System . out . println ( \" - 1\" ) ; else System . out . println ( ans ) ; } }", "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; if ( k > 36 ) { System . out . print ( \" - 1\" ) ; return ; } while ( k >= 2 ) { k -= 2 ; System . out . print ( \"8\" ) ; } if ( k == 1 ) { System . out . print ( \"6\" ) ; } } }" ]
[ "k = int ( input ( ) ) s = \" \" if k > 36 : print ( - 1 ) else : while k > 0 : if k >= 2 : s = s + \"8\" k = k - 2 else : s = s + \"4\" k = k - 1 print ( s ) NEW_LINE", "k = int ( input ( ) )   a = [ 1 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 2 , 1 ]   if ( k > 36 ) : print ( - 1 ) elif ( k == 1 ) : print ( 6 ) else : print ( '8' * ( k // 2 ) , end = \" \" ) if ( k % 2 ) : print ( \"0\" ) NEW_LINE", "import sysdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( int , input ( ) . split ( ) ) ) n = iinput ( ) if n > 36 : print ( - 1 ) else : print ( \"8\" * ( n // 2 ) + \"4\" * ( n % 2 ) ) NEW_LINE", "n = int ( input ( ) ) if ( n > 36 ) : print ( - 1 ) exit ( ) if ( n % 2 == 0 ) : for i in range ( n // 2 ) : print ( 8 , end = \" \" ) else : for i in range ( n // 2 ) : print ( 8 , end = \" \" ) print ( 4 , end = \" \" ) NEW_LINE", "k = int ( input ( ) )   if k > 36 : print ( - 1 ) exit ( )   res = \" \"   res = res + \"8\" * ( k // 2 )   res = res + \"9\" * ( k % 2 )   print ( res )   NEW_LINE" ]
codeforces_631_A
[ "import java . util . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int next ; int aSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { next = scan . nextInt ( ) ; aSum |= next ; } int bSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { next = scan . nextInt ( ) ; bSum |= next ; } System . out . println ( aSum + bSum ) ; } }", "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 + 1 ] ; int b [ ] = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = in . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) b [ i ] = in . nextInt ( ) ; long a1 = 0 , b1 = 0 , ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { a1 = a1 | a [ i ] ; b1 = b1 | b [ i ] ; if ( a1 + b1 > ans ) ans = a1 + b1 ; } System . out . println ( ans ) ; } }", "import java . util . Scanner ;   public class _0591Interview { static long XOR ( int i , int j , int [ ] a , int [ ] b ) { long XorA = 0 ; long XorB = 0 ; for ( int x = i ; x <= j ; x ++ ) { XorA = XorA | a [ x ] ; XorB = XorB | b [ x ] ; } return XorA + XorB ; }   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } long max = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { max = Math . max ( max , XOR ( i , j , a , b ) ) ; } } System . out . println ( max ) ; }   }" ]
[ "from functools import reducedef solve ( n , a , b ) : return reduce ( lambda x , y : x | y , a ) + reduce ( lambda x , y : x | y , b )         def main ( ) : NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) )   def f ( x , l , r ) : t = 0 for i in x [ l : r ] : t |= i   return t   ms = 0 for s in range ( n , 0 , - 1 ) : for l in range ( 0 , s ) : r = l + s if r > n : break else : if ( f ( a , l , r ) + f ( b , l , r ) ) > ms : ms = f ( a , l , r ) + f ( b , l , r )   print ( ms ) \t \t \t   NEW_LINE", "n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] b = [ int ( x ) for x in input ( ) . split ( ) ] mxa = 0 for i in range ( n ) : cur = a [ i ] for j in range ( i , n ) : cur |= a [ j ] mxa = max ( mxa , cur ) mxb = 0 for i in range ( n ) : cur = b [ i ] for j in range ( i , n ) : cur |= b [ j ] mxb = max ( mxb , cur ) print ( mxa + mxb ) NEW_LINE", "a = int ( input ( ) ) x1 = list ( map ( int , input ( ) . split ( ) ) ) x2 = list ( map ( int , input ( ) . split ( ) ) ) y1 = 0 y2 = 0 for i in range ( a ) : y1 |= x1 [ i ] y2 |= x2 [ i ] print ( y1 + y2 ) NEW_LINE", "import sys     n = int ( sys . stdin . readline ( ) ) a = [ int ( x ) for x in sys . stdin . readline ( ) . strip ( ) . split ( ) ] b = [ int ( x ) for x in sys . stdin . readline ( ) . strip ( ) . split ( ) ] A = a [ 0 ] for x in a : A |= xB = b [ 0 ] for x in b : B |= x   print ( A + B ) NEW_LINE" ]
codeforces_716_B
[ "import java . util . * ; import java . util . stream . Collectors ; import java . lang . * ; import java . io . * ; public class Problem { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; System . out . println ( find ( s ) ) ; } public static String find ( String s ) { char [ ] ch = s . toCharArray ( ) ; char [ ] ar = new char [ 26 ] ; int i = 0 , j = 0 , ques = 0 ; Set < Character > set = new HashSet < Character > ( ) ; while ( j < s . length ( ) ) { if ( j >= 26 ) { if ( ch [ i ] == ' ? ' ) ques -- ; else { ar [ ch [ i ] - ' A ' ] -- ; if ( ar [ ch [ i ] - ' A ' ] == 0 ) set . remove ( ch [ i ] ) ; } i ++ ; } if ( ch [ j ] == ' ? ' ) ques ++ ; else { ar [ ch [ j ] - ' A ' ] ++ ; set . add ( ch [ j ] ) ; } if ( set . size ( ) + ques == 26 ) { String ans = process ( ch , i , j , set ) ; if ( ans . equals ( \" - 1\" ) ) return ans ; else { for ( int x = 0 ; x < ch . length ; x ++ ) { if ( ch [ x ] == ' ? ' ) ch [ x ] = ' A ' ; } return new String ( ch ) ; } } j ++ ; } return \" - 1\" ; } public static String process ( char [ ] ch , int i , int j , Set < Character > set ) { for ( char p = ' A ' ; p <= ' Z ' ; p ++ ) { if ( set . contains ( p ) ) set . remove ( p ) ; else set . add ( p ) ; }", "import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ;   public class CompleteTheWord { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; if ( s . length ( ) < 26 ) { System . out . println ( - 1 ) ; } else { boolean possible = true ; int left = 0 ; int right = 25 ; int [ ] count = new int [ 26 ] ; int counter = 0 ; for ( int i = 0 ; i <= 25 ; i ++ ) {", "import java . util . * ; import java . io . * ; import java . math . * ; public class B372 {   public static void main ( String args [ ] ) { FastReader sc = new FastReader ( ) ; StringBuilder sb = new StringBuilder ( ) ; int t , i , n ; t = 1 ; while ( t -- > 0 ) { char s [ ] = sc . next ( ) . toCharArray ( ) ; n = s . length ; if ( n < 26 ) { sb . append ( - 1 ) . append ( ' \\n ' ) ; continue ; } int j ; HashSet < Character > set = new HashSet < > ( ) ; boolean flag = false ; for ( i = 0 ; i < n ; i ++ ) { int count = 0 ; set . clear ( ) ; for ( j = i ; j <= i + 25 && i + 25 < n ; j ++ ) { if ( s [ j ] != ' ? ' ) set . add ( s [ j ] ) ; else count ++ ;", "import java . util . ArrayList ; import java . util . HashSet ; import java . util . Scanner ;   public class CF716_D2_B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . next ( ) ; HashSet < Character > set = new HashSet < > ( ) ; int q = 0 ; char [ ] alphabet = \" abcdefghijklmnopqrstuvwxyz \" . toUpperCase ( ) . toCharArray ( ) ; int start = - 1 ; for ( int i = 0 ; i <= s . length ( ) - 26 ; i ++ ) {   for ( int j = 0 ; j < 26 ; j ++ ) { if ( Character . isAlphabetic ( s . charAt ( i + j ) ) ) { set . add ( s . charAt ( i + j ) ) ; } else if ( s . charAt ( i + j ) == ' ? ' ) { q ++ ; } } if ( set . size ( ) + q == 26 ) { start = i ; break ; } else { set = new HashSet < > ( ) ; q = 0 ; } } if ( start == - 1 ) { System . out . println ( - 1 ) ; } else { ArrayList < Character > missing = new ArrayList < > ( ) ; for ( char c : alphabet ) { if ( ! set . contains ( c ) ) { missing . add ( c ) ; } } StringBuilder builder = new StringBuilder ( ) ; builder . append ( s . substring ( 0 , start ) . replace ( ' ? ' , ' A ' ) ) ; int j = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( s . charAt ( start + i ) == ' ? ' ) { builder . append ( missing . get ( j ++ ) ) ; } else { builder . append ( s . charAt ( start + i ) ) ; } } builder . append ( s . substring ( start + 26 ) . replace ( ' ? ' , ' A ' ) ) ; System . out . println ( builder . toString ( ) ) ;   }   } }", "import java . io . BufferedWriter ; import java . io . ByteArrayInputStream ; import java . io . FileInputStream ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . InputMismatchException ; import java . util . List ; import java . util . Set ;   public class Main { private static final long MOD = ( long ) 1e9 + 7 ; static InputStream is ; static PrintWriter out ; static String INPUT = \" \" ; static int lenbuf = 0 , ptrbuf = 0 ; private static byte [ ] inbuf = new byte [ 1024 ] ; static boolean readFile = false ;" ]
[ "word = input ( ) . lower ( )   if len ( word ) < 26 : print ( - 1 ) exit ( )   alpha = [ ' q ' , ' w ' , ' e ' , ' r ' , ' t ' , ' y ' , ' u ' , ' i ' , ' o ' , ' p ' , ' a ' , ' s ' , ' d ' , ' f ' , ' g ' , ' h ' , ' j ' , ' k ' , ' l ' , ' z ' , ' x ' , ' c ' , ' v ' , ' b ' , ' n ' , ' m ' ]   for i in range ( len ( word ) - 26 + 1 ) : cnt = 0 used = [ ] for char in alpha :   if word [ i : i + 26 ] . count ( char ) == 1 : used . append ( char )   if word [ i : i + 26 ] . count ( char ) < 2 : cnt += 1   if word [ i : i + 26 ] . count ( char ) >= 2 : cnt -= 500000 break   cnt -= 1   if cnt == 0 :   NEW_LINE", "import collections   s = input ( ) n = len ( s ) if n < 26 : print ( - 1 ) exit ( ) d = [ 0 ] * 26 for i in range ( 25 ) : if s [ i ] != ' ? ' : d [ ord ( s [ i ] ) - ord ( ' A ' ) ] += 1   def check ( ) : return all ( d [ i ] <= 1 for i in range ( 26 ) )   b = Falsefor i in range ( 25 , n ) : if s [ i ] != ' ? ' : d [ ord ( s [ i ] ) - ord ( ' A ' ) ] += 1 if i >= 26 : if s [ i - 26 ] != ' ? ' : d [ ord ( s [ i - 26 ] ) - ord ( ' A ' ) ] -= 1 if check ( ) : for j in range ( n ) : if s [ j ] != ' ? ' : print ( s [ j ] , end = \" \" ) else : if j < i - 25 or j > i : print ( ' A ' , end = \" \" ) else : for k in range ( 26 ) : if d [ k ] == 0 : print ( chr ( ord ( ' A ' ) + k ) , end = \" \" ) d [ k ] = 1 break exit ( ) print ( - 1 ) NEW_LINE", "import sysfrom math import * from string import ascii_uppercase   def ints_input ( ) : return [ int ( i ) for i in sys . stdin . readline ( ) . strip ( \" \\n \" ) . split ( \" ▁ \" ) ]     def print_list ( arr ) : sys . stdout . writelines ( str ( x ) + \" ▁ \" for x in arr ) sys . stdout . write ( \" \\n \" )     def fast_input ( type = str ) : return type ( sys . stdin . readline ( ) . strip ( \" \\n \" ) )     s = fast_input ( ) if len ( s ) < 26 : print ( - 1 ) exit ( )   r , j = 0 , 25 found = Falsewhile not found and j < len ( s ) : sl = s [ r : j + 1 ] q = sl . count ( ' ? ' ) if len ( set ( sl ) ) + q - 1 == 26 or len ( set ( sl ) ) == 26 : found = True else : r += 1 j += 1 if not found : print ( - 1 ) exit ( ) d = { } for i in ascii_uppercase + ' ? ' : d [ i ] = 0   for i in sl : d [ i ] += 1 d . pop ( ' ? ' ) zz = list ( filter ( lambda x : not x [ 1 ] , d . items ( ) ) ) k = 0 s = list ( s ) for i in range ( len ( s ) ) : if s [ i ] == ' ? ' : if r <= i <= j : s [ i ] = zz [ k ] [ 0 ] k += 1 else : s [ i ] = ' A ' print ( \" \" . join ( s ) ) NEW_LINE", "s = [ i for i in input ( ) ] ; n = len ( s ) NEW_LINE" ]
codeforces_773_A
[ "import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ; Student ( int x , int y ) { this . x = x ; this . y = y ; } } static int sieveOfEratosthenes ( int n ) {", "import java . util . * ; public class A0773_SuccessRate { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { long x = sc . nextInt ( ) ; long y = sc . nextInt ( ) ; long p = sc . nextInt ( ) ; long q = sc . nextInt ( ) ; if ( ! works ( x , y , p , q , 1000000000 ) ) { System . out . println ( - 1 ) ; continue ; } long l = 0 ; long r = 1000000000 ; while ( r > l ) { long mid = ( r + l ) / 2 ; if ( works ( x , y , p , q , mid ) ) r = mid ; else l = mid + 1 ; } System . out . println ( r * q - y ) ; } sc . close ( ) ; } public static boolean works ( long x , long y , long p , long q , long mid ) { if ( p * mid >= x && q * mid - p * mid >= y - x ) return true ; return false ; } }", "import java . lang . * ; import java . util . * ;   public final class Solution { public static void main ( String [ ] args ) { Solution p = new Solution ( ) ; p . run ( ) ; } private void run ( ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int p = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; System . out . println ( solve ( x , y , p , q ) ) ; } } private long solve ( int x , int y , int p , int q ) { if ( p == 0 ) { if ( x != 0 ) { return - 1 ; } else { return 0 ; } } if ( p == q ) { if ( x != y ) { return - 1 ; } else { return 0 ; } } long k = ( long ) Math . ceil ( Math . max ( x * 1.0 / p , ( ( y - x ) * 1.0 / ( q - p ) ) ) ) ;   return ( ( k * q ) - y ) ; } }", "# include < bits / stdc ++ . h > using namespace std ; # define int long long # define FAST ios_base :: sync_with_stdio ( false ) ; cin . tie ( 0 ) ; cout . tie ( 0 ) ;" ]
[ "from math import ceilfor _ in range ( int ( input ( ) ) ) : x , y , p , q = map ( int , input ( ) . split ( ) ) if p == q and x != y : print ( - 1 ) elif p == q : print ( 0 ) elif p == 0 and x == 0 : print ( 0 ) elif p == 0 : print ( - 1 ) else : a = y // q r = y % q g1 = ( x - p * a + p - 1 ) // p g2 = ceil ( ( x - r - p * a ) / ( p - q ) ) print ( max ( g1 , g2 ) * q - r ) NEW_LINE" ]
codeforces_242_B
[ "import java . util . Scanner ;   public class B242 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int min = Integer . MAX_VALUE ; int max = Integer . MIN_VALUE ; int [ ] firsts = new int [ n ] ; int [ ] seconds = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int first = s . nextInt ( ) ; int second = s . nextInt ( ) ; if ( first < min ) { min = first ; } if ( second > max ) { max = second ; } firsts [ i ] = first ; seconds [ i ] = second ; } boolean found = false ; for ( int i = 0 ; i < n ; i ++ ) { if ( firsts [ i ] == min && seconds [ i ] == max ) { System . out . println ( i + 1 ) ; found = true ; break ; } } if ( ! found ) { System . out . println ( - 1 ) ; } } }", "  import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class experiment { static int M = 1_000_000_007 ; static int INF = Integer . MAX_VALUE ; static final FastScanner fs = new FastScanner ( ) ;  ", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int T = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; int max = Integer . MIN_VALUE ; int ar [ ] [ ] = new int [ 2 ] [ T ] ; int result = - 1 ; for ( int i = 0 ; i < T ; i ++ ) { int first = sc . nextInt ( ) ; int second = sc . nextInt ( ) ; min = Math . min ( min , first ) ; max = Math . max ( max , second ) ; ar [ 0 ] [ i ] = first ; ar [ 1 ] [ i ] = second ; } for ( int i = 0 ; i < T ; i ++ ) { if ( ar [ 0 ] [ i ] == min && ar [ 1 ] [ i ] == max ) { result = i + 1 ; break ; } } System . out . println ( result ) ; } }", "    import java . util . * ;    public class dummycodes {   public static class Pair { int l ; int r ; int index ; public Pair ( int x , int y , int i ) { l = x ; r = y ; index = i ; } } public static class sortByL implements Comparator < Pair > { @ Override public int compare ( Pair o1 , Pair o2 ) { return ( o1 . l == o2 . l ) ? o2 . r - o1 . r : o1 . l - o2 . l ; }   }   public static void solve ( ArrayList < Pair > arr , int sze , int maxR ) { Collections . sort ( arr , new sortByL ( ) ) ; Pair P = arr . get ( 0 ) ; int a = P . l ; int b = P . r ;   if ( a <= b && b >= maxR ) System . out . println ( P . index + 1 ) ; else System . out . println ( \" - 1\" ) ; }   public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < Pair > arr = new ArrayList < > ( ) ; int max = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { Pair p = new Pair ( sc . nextInt ( ) , sc . nextInt ( ) , i ) ; arr . add ( p ) ; if ( p . r > max ) max = p . r ; } solve ( arr , n , max ) ; } }      " ]
[ "def solution ( ) : n = int ( input ( ) ) k = [ ] mn = float ( ' Inf ' )   mx = float ( ' - Inf ' ) for i in range ( n ) : l , r = map ( int , input ( ) . split ( ) ) k . append ( ( l , r ) ) mn = min ( l , mn ) mx = max ( r , mx )   for i in range ( n ) : if k [ i ] [ 0 ] == mn and k [ i ] [ 1 ] == mx : print ( i + 1 ) return print ( - 1 ) return     solution ( ) NEW_LINE", "  def find_cover_all_seg ( n , l , r ) : min = l [ 0 ] index_min = [ ] max = r [ 0 ] index_max = [ ] for i in range ( n ) : if min >= l [ i ] : min = l [ i ] index_min . append ( i ) if max <= r [ i ] : max = r [ i ] index_max . append ( i ) common_index_list = list ( set ( index_min ) . intersection ( index_max ) ) NEW_LINE", "l = list ( list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( int ( input ( ) ) ) ) x = min ( i [ 0 ] for i in l ) y = max ( i [ 1 ] for i in l ) if [ x , y ] in l : print ( l . index ( [ x , y ] ) + 1 ) else : print ( \" - 1\" ) NEW_LINE", "n = int ( input ( ) ) l = [ ] r = [ ] for i in range ( n ) : s , e = map ( int , input ( ) . split ( ) ) l . append ( s ) r . append ( e ) mn = l [ 0 ] mx = r [ 0 ]   for i in range ( n ) : if ( l [ i ] < mn ) : mn = l [ i ] if r [ i ] > mx : mx = r [ i ] flag = 1 p = 0 for i in range ( n ) : if l [ i ] <= mn and r [ i ] >= mx : p = i + 1 flag = 0 if flag == 0 : print ( p ) else : print ( - 1 ) NEW_LINE", "n = int ( input ( ) ) p = [ ] al = [ ] bl = [ ] while n > 0 : n -= 1 a , b = map ( int , input ( ) . split ( ) ) p . append ( [ a , b ] ) al . append ( a ) bl . append ( b ) t1 = min ( al ) t2 = max ( bl ) if [ t1 , t2 ] in p : print ( p . index ( [ t1 , t2 ] ) + 1 ) else : print ( - 1 ) NEW_LINE" ]
codeforces_1397_B
[ "import java . io . * ; import java . util . * ; public class B { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; Long [ ] arr = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = in . nextLong ( ) ; pw . println ( solve ( arr , n ) ) ; pw . close ( ) ; } static long solve ( Long [ ] arr , int n ) { Arrays . sort ( arr ) ; long reng = ( long ) 1e15 ; long ans = ( long ) 1e15 ; boolean finished = false ; for ( long C = 1 ; ; C ++ ) { long res = 0 ; for ( long i = 0 , pw = 1 ; i < n ; i ++ , pw *= C ) { if ( pw >= reng ) { finished = true ; break ; } res += Math . abs ( ( arr [ ( int ) i ] - pw ) ) ; } if ( finished ) break ; ans = Math . min ( ans , res ) ; } return ans ; } static void debug ( Object ... obj ) { System . err . println ( Arrays . deepToString ( obj ) ) ; } }" ]
[ "import sys NEW_LINE input = sys . stdin . readline NEW_LINE import math NEW_LINE n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a . sort ( ) NEW_LINE j = a [ 0 ] NEW_LINE c = 1 NEW_LINE mn = 10 ** 18 NEW_LINE inf = 10 ** 18 NEW_LINE if n <= 2 : NEW_LINE INDENT print ( a [ 0 ] - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT while c <= 10 ** 9 : NEW_LINE INDENT cnt = 0 NEW_LINE ok = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT k = c ** i - a [ i ] NEW_LINE cnt += abs ( k ) NEW_LINE if c ** i > inf : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT if cnt < mn : NEW_LINE INDENT mn = cnt NEW_LINE DEDENT if c ** ( n - 1 ) > mn + a [ - 1 ] : NEW_LINE INDENT break NEW_LINE DEDENT c += 1 NEW_LINE DEDENT print ( mn ) NEW_LINE DEDENT", "n , s = open ( 0 ) ; NEW_LINE print ( min ( sum ( abs ( x - c ** i ) for i , x in enumerate ( sorted ( map ( int , s . split ( ) ) ) ) ) for c in range ( 2 + 9 ** 6 // int ( n ) ** 2 ) ) ) NEW_LINE", "from sys import stdin , stdout NEW_LINE def main ( ) : NEW_LINE INDENT n = stdin . readline ( ) NEW_LINE arr = [ int ( i ) for i in stdin . readline ( ) . split ( ) ] NEW_LINE arr . sort ( ) NEW_LINE t = int ( n ) - 1 NEW_LINE p = float ( 1 / t ) NEW_LINE temp = int ( ( int ( arr [ t ] ) ** p ) // 1 ) NEW_LINE ans = int ( 0 ) NEW_LINE ans1 = int ( 0 ) NEW_LINE for i in range ( int ( n ) ) : NEW_LINE INDENT ans = int ( int ( ans ) + int ( abs ( int ( int ( temp ** i ) - arr [ i ] ) ) ) ) NEW_LINE DEDENT temp = int ( int ( temp ) + 1 ) NEW_LINE for i in range ( int ( n ) ) : NEW_LINE INDENT ans1 = int ( int ( ans1 ) + int ( abs ( int ( int ( temp ** i ) - arr [ i ] ) ) ) ) NEW_LINE DEDENT ans = min ( int ( ans ) , int ( ans1 ) ) NEW_LINE stdout . write ( str ( ans ) ) NEW_LINE DEDENT if __name__ == \" _ _ main _ _ \" : NEW_LINE INDENT main ( ) NEW_LINE DEDENT", "from sys import stdin , stdout NEW_LINE input = stdin . readline NEW_LINE def main ( ) : NEW_LINE INDENT t = 1 NEW_LINE for i in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE ai = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = sum ( ai ) - n NEW_LINE if n > 33 : NEW_LINE INDENT print ( ans ) NEW_LINE return NEW_LINE DEDENT base = 2 NEW_LINE num = 10 ** 10 * 5 NEW_LINE ai . sort ( ) NEW_LINE while base ** ( n - 1 ) < num : NEW_LINE INDENT ans = min ( ans , sum ( [ abs ( ai [ i ] - base ** i ) for i in range ( n ) ] ) ) NEW_LINE base += 1 NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT DEDENT main ( ) NEW_LINE", "n = int ( input ( ) ) NEW_LINE s = sorted ( map ( int , input ( ) . split ( ) ) ) NEW_LINE c = 1 NEW_LINE mx = 100 * ( 10 ** 9 ) NEW_LINE ans = float ( ' inf ' ) NEW_LINE while c ** ( n - 1 ) < mx : NEW_LINE INDENT cur = 0 NEW_LINE for i in range ( n ) : cur += abs ( s [ i ] - c ** i ) NEW_LINE c += 1 NEW_LINE ans = min ( ans , cur ) NEW_LINE DEDENT print ( ans ) NEW_LINE" ]
codeforces_805_A
[ "  import java . math . * ; import java . util . * ; import java . io . * ; public class gr13b {", "import java . util . Scanner ;   public class _0664FakeNP {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( r - l == 0 ) { System . out . println ( l ) ; } else { System . out . println ( 2 ) ;   } }   }", "import java . util . * ; import java . math . * ; public class FakeNP { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( l == r ) { System . out . println ( l ) ; return ; } System . out . println ( 2 ) ; } }", "import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( l == r ) { System . out . println ( l ) ; } else { System . out . println ( \"2\" ) ; } } }", "import java . util . * ;   public class Solve {   static Scanner scan = new Scanner ( System . in ) ;   public static long solve ( long l , long r ) { if ( l == r ) { return l ; } return 2 ; }    public static void main ( String [ ] args ) {   long l = scan . nextLong ( ) ; long r = scan . nextLong ( ) ; System . out . println ( solve ( l , r ) ) ; } }" ]
[ "n , m = map ( int , input ( ) . split ( ) ) print ( ( n , 2 ) [ n != m ] ) NEW_LINE", "a , b = input ( ) . split ( ) print ( a if a == b else 2 ) NEW_LINE", "l , r = map ( int , input ( ) . split ( ) ) if l != r : print ( 2 ) else : print ( l ) NEW_LINE", "def main ( ) : l , r = tuple ( map ( int , input ( ) . split ( ) ) ) if l == r : print ( l ) else : print ( 2 )   if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "m , n = map ( int , input ( ) . split ( ) ) if ( m == n ) : print ( m ) else : print ( 2 ) NEW_LINE" ]
codeforces_300_A
[ "import java . util . * ; public class Array { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; List < Integer > list1 = new ArrayList < > ( ) ; List < Integer > list2 = new ArrayList < > ( ) ; List < Integer > list3 = new ArrayList < > ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { int temp = sc . nextInt ( ) ; if ( temp < 0 ) list1 . add ( temp ) ; else if ( temp > 0 ) list2 . add ( temp ) ; else list3 . add ( temp ) ; } if ( list2 . size ( ) == 0 ) { int num1 = list1 . remove ( list1 . size ( ) - 1 ) ; int num2 = list1 . remove ( list1 . size ( ) - 1 ) ; list2 . add ( num1 ) ; list2 . add ( num2 ) ; }   if ( list1 . size ( ) % 2 == 0 ) { list3 . add ( list1 . remove ( list1 . size ( ) - 1 ) ) ;   } sc . close ( ) ;   System . out . print ( list1 . size ( ) ) ; for ( int i = 0 ; i < list1 . size ( ) ; i ++ ) System . out . print ( \" ▁ \" + list1 . get ( i ) ) ;   System . out . println ( ) ; System . out . print ( list2 . size ( ) ) ; for ( int i = 0 ; i < list2 . size ( ) ; i ++ ) System . out . print ( \" ▁ \" + list2 . get ( i ) + \" ▁ \" ) ;   System . out . println ( ) ; System . out . print ( list3 . size ( ) ) ; for ( int i = 0 ; i < list3 . size ( ) ; i ++ ) System . out . print ( \" ▁ \" + list3 . get ( i ) + \" ▁ \" ) ; }    }", "import java . util . ArrayList ; import java . util . Scanner ;   public class array { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int [ ] arr = new int [ x ] ; ArrayList < Integer > n = new ArrayList < > ( ) ; ArrayList < Integer > p = new ArrayList < > ( ) ; ArrayList < Integer > z = new ArrayList < > ( ) ;   for ( int i = 0 ; i < x ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( arr [ i ] < 0 ) n . add ( arr [ i ] ) ; if ( arr [ i ] > 0 ) p . add ( arr [ i ] ) ; if ( arr [ i ] == 0 ) z . add ( arr [ i ] ) ;    }", "import java . util . * ; public class Array {   public static void main ( String [ ] args ) {", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {" ]
[ "n = int ( input ( ) ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) neg = [ i for i in arr if i < 0 ] pos = [ i for i in arr if i > 0 ] zero = [ 0 ]   if len ( neg ) % 2 == 0 : pos . extend ( neg [ 1 : - 1 ] ) zero . append ( neg [ - 1 ] ) neg = neg [ : 1 ] else : if len ( pos ) == 0 : pos . extend ( neg [ - 2 : ] ) neg = neg [ : - 2 ]     print ( len ( neg ) , * neg ) print ( len ( pos ) , * pos ) print ( len ( zero ) , * zero )         NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr . sort ( ) i = 0 while ( arr [ i ] < 0 and i < n ) : i += 1 neg = i - 1 zero = ii += 1 pos = 0 while ( i < n and arr [ i ] > 0 ) : i += 1 pos = iif pos > zero : print ( 1 , arr [ 0 ] ) print ( 1 , arr [ zero + 1 ] ) print ( n - 2 , end = ' ▁ ' ) for j in range ( 1 , n ) : if j != zero + 1 : print ( arr [ j ] , end = ' ▁ ' ) else : print ( 1 , arr [ 0 ] ) print ( 2 , arr [ 1 ] , arr [ 2 ] ) print ( n - 3 , end = ' ▁ ' ) for j in range ( 3 , n ) : print ( arr [ j ] , end = ' ▁ ' ) NEW_LINE", "n = int ( input ( ) ) array = list ( map ( int , input ( ) . split ( ) ) ) a , b , c = [ ] , [ ] , [ ] for i in array : if i < 0 : a . append ( i ) elif i > 0 : b . append ( i ) else : c . append ( i ) if not b : b . append ( a . pop ( ) ) b . append ( a . pop ( ) ) if len ( a ) % 2 == 0 : c . append ( a . pop ( ) ) print ( len ( a ) , * a ) print ( len ( b ) , * b ) print ( len ( c ) , * c ) NEW_LINE", "n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) a = [ ] b = [ ] c = [ ] for i in li : if i < 0 : a . append ( i ) elif i > 0 : b . append ( i ) else : c . append ( i )   if len ( a ) % 2 != 0 and len ( b ) == 0 : b . append ( a [ 0 ] ) b . append ( a [ 1 ] ) a = a [ 2 : ] elif len ( b ) == 0 and len ( a ) >= 3 : b . append ( a [ 0 ] ) b . append ( a [ 1 ] ) a = a [ 2 : ] c . extend ( a [ 1 : ] ) a = a [ : 1 ] if len ( a ) % 2 == 0 : c . extend ( a [ 1 : ] ) a = a [ : 1 ]     print ( len ( a ) , * a ) print ( len ( b ) , * b ) print ( len ( c ) , * c ) NEW_LINE", "t = int ( input ( ) ) n = [ ] p = [ ] z = [ ] l = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( t ) : if l [ i ] > 0 : p . append ( l [ i ] ) elif l [ i ] < 0 : n . append ( l [ i ] ) else : z . append ( l [ i ] ) if len ( n ) % 2 != 0 : if len ( p ) == 0 : x = n [ 0 ] y = n [ 1 ] p . append ( x ) p . append ( y ) n . remove ( x ) n . remove ( y ) else : if len ( p ) == 0 : a = n [ 0 ] b = n [ 1 ] c = n [ 2 ] p . append ( a ) p . append ( b ) z . append ( c ) n . remove ( a ) n . remove ( b ) n . remove ( c ) else : a = n [ 0 ] z . append ( a ) n . remove ( a )   r = ' ' s = ' ' q = ' ' for i in n : r += str ( i ) + ' ▁ ' for i in p : s += str ( i ) + ' ▁ ' for i in z : q += str ( i ) + ' ▁ ' print ( len ( n ) , r ) print ( len ( p ) , s ) print ( len ( z ) , q ) NEW_LINE" ]
codeforces_320_B
[ "import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws Exception { Scanner in = new Scanner ( System . in ) ;   int q = in . nextInt ( ) ;   ArrayList < Interval > intervals = new ArrayList < > ( ) ; int numIntervals = 0 ;   for ( int counter = 0 ; counter < q ; counter ++ ) { if ( in . nextInt ( ) == 1 ) { Interval newInterval = new Interval ( in . nextInt ( ) , in . nextInt ( ) , ++ numIntervals ) ; for ( Interval i : intervals ) { i . addInterval ( newInterval ) ; newInterval . addInterval ( i ) ; } intervals . add ( newInterval ) ; } else { int first = in . nextInt ( ) - 1 ; int goal = in . nextInt ( ) - 1 ;   System . out . println ( intervals . get ( first ) . contains ( intervals . get ( goal ) ) ? \" YES \" : \" NO \" ) ; } } }   private static class Interval { int a , b , id ; ArrayList < Interval > paths ;   public Interval ( int a , int b , int id ) { this . a = a ; this . b = b ; this . id = id ;   paths = new ArrayList < > ( ) ; }   public void addInterval ( Interval i ) { if ( i . a < this . a && this . a < i . b || i . a < this . b && this . b < i . b ) { paths . add ( i ) ;" ]
[ "def addEdges ( adj , nodes ) : startNewInterval , endNewInterval = nodes [ - 1 ] for i in range ( 1 , len ( nodes ) - 1 ) : startOther , endOther = nodes [ i ] if startOther < startNewInterval < endOther or startOther < endNewInterval < endOther : adj [ len ( nodes ) - 1 ] . add ( i ) if startNewInterval < startOther < endNewInterval or startNewInterval < endOther < endNewInterval : adj [ i ] . add ( len ( nodes ) - 1 )   def dfs ( adj , start , dest ) : visited = [ False ] * len ( adj ) dfsStack = [ start ] while dfsStack : cur = dfsStack . pop ( ) if visited [ cur ] : continue if cur == dest : return True visited [ cur ] = True dfsStack . extend ( list ( adj [ cur ] ) ) return False inputs = int ( input ( ) ) nodes = [ None ] adj = [ None ] for _ in range ( inputs ) : queryType , start , end = map ( int , input ( ) . split ( ) ) if queryType == 1 : NEW_LINE", "import sysfrom math import sqrtfrom collections import dequeinput = sys . stdin . readline   NEW_LINE", "n = int ( input ( ) )     class Graph :   def __init__ ( self , V ) : self . V = V self . adj = [ [ ] for i in range ( V ) ]   def DFSUtil ( self , temp , v , y , visited ) :   visited [ v ] = True if v == y : return True   NEW_LINE", "def addEdges ( adj , nodes ) : startNewInterval , endNewInterval = nodes [ - 1 ] for i in range ( 1 , len ( nodes ) - 1 ) : startOther , endOther = nodes [ i ] if startOther < startNewInterval < endOther or startOther < endNewInterval < endOther : adj [ len ( nodes ) - 1 ] . add ( i ) if startNewInterval < startOther < endNewInterval or startNewInterval < endOther < endNewInterval : adj [ i ] . add ( len ( nodes ) - 1 )   def dfs ( adj , start , dest ) : visited = [ False ] * len ( adj ) dfsStack = [ start ] while dfsStack : cur = dfsStack . pop ( ) if visited [ cur ] : continue if cur == dest : return True visited [ cur ] = True dfsStack . extend ( list ( adj [ cur ] ) ) return False inputs = int ( input ( ) ) nodes = [ None ] adj = [ None ] for _ in range ( inputs ) : queryType , start , end = map ( int , input ( ) . split ( ) ) if queryType == 1 : NEW_LINE" ]
codeforces_1033_A
[ "import java . io . * ; import java . util . * ; import java . math . * ;   public class Main { public static void main ( String args [ ] ) throws Exception { FastScanner fs = new FastScanner ( ) ;", "  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 c701a {", "import java . util . * ; public class test { public static void main ( String [ ] args ) throws java . lang . Exception {" ]
[ "n = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) bx , by = map ( int , input ( ) . split ( ) ) cx , cy = map ( int , input ( ) . split ( ) ) if ax in range ( min ( bx , cx ) , max ( bx , cx ) ) or ay in range ( min ( by , cy ) , max ( by , cy ) ) : print ( ' NO ' ) else : print ( ' YES ' ) NEW_LINE", "N = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) bx , by = map ( int , input ( ) . split ( ) ) cx , cy = map ( int , input ( ) . split ( ) ) board = [ [ - 1 ] * N for i in range ( N ) ] for i in range ( N ) : board [ i ] [ ax - 1 ] = 1 board [ ay - 1 ] [ i ] = 1 for i in range ( - N , N ) : if 0 <= ay - 1 + i < N and 0 <= ax - 1 + i < N : board [ ay - 1 + i ] [ ax - 1 + i ] = 1 if 0 <= ay - 1 - i < N and 0 <= ax - 1 + i < N : board [ ay - 1 - i ] [ ax - 1 + i ] = 1 q = [ ( by - 1 , bx - 1 ) ] while q : yy , xx = q . pop ( ) if yy == cy - 1 and xx == cx - 1 : print ( \" YES \" ) exit ( ) for dx in [ - 1 , 0 , 1 ] : for dy in [ - 1 , 0 , 1 ] : if 0 <= yy + dy < N and 0 <= xx + dx < N and board [ yy + dy ] [ xx + dx ] == - 1 : board [ yy + dy ] [ xx + dx ] = 0 q . append ( ( yy + dy , xx + dx ) ) print ( \" NO \" ) NEW_LINE", "n = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) NEW_LINE", "n = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) bx , by = map ( int , input ( ) . split ( ) ) cx , cy = map ( int , input ( ) . split ( ) ) if ( ( bx > ax and cx > ax ) or ( bx < ax and cx < ax ) ) and ( ( by > ay and cy > ay ) or ( by < ay and cy < ay ) ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE", "dimensions = int ( input ( ) ) ax , ay = tuple ( map ( int , input ( ) . split ( ) ) ) bx , by = tuple ( map ( int , input ( ) . split ( ) ) ) cx , cy = tuple ( map ( int , input ( ) . split ( ) ) )   if bx < ax and by < ay : if cx < ax and cy < ay : diff_x = ax - cx diff_y = ay - cy   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   elif bx < ax and by > ay : if cx < ax and cy > ay : diff_x = ax - cx diff_y = cy - ay   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   elif bx > ax and by < ay : if cx > ax and cy < ay : diff_x = cx - ax diff_y = ay - cy   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   elif bx > ax and by > ay : if cx > ax and cy > ay : diff_x = cx - ax diff_y = cy - ay   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   else : print ( ' NO ' ) NEW_LINE" ]
codeforces_268_A
[ "import java . util . Scanner ; public class Test {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] home = new int [ n ] ; int [ ] away = new int [ n ] ; int matches = 0 ; for ( int i = 0 ; i < n ; i ++ ) { home [ i ] = in . nextInt ( ) ; away [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i == j ) continue ; if ( home [ i ] == away [ j ] ) ++ matches ; } } System . out . println ( matches ) ; } }", "import java . util . * ;   public class Main { public static void main ( String [ ] args ) { int n , i ; int a1 , a2 ; int [ ] jerh = new int [ 51 ] ; int [ ] jera = new int [ 51 ] ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; for ( i = 0 ; i < n ; i ++ ) { a1 = sc . nextInt ( ) ; a2 = sc . nextInt ( ) ; jerh [ i ] = a1 ; jera [ i ] = a2 ; } int j , sig = 0 ; for ( i = 0 ; i < n ; i ++ ) { for ( j = 0 ; j < n ; j ++ ) { if ( jerh [ i ] == jera [ j ] ) sig ++ ; } } System . out . println ( sig ) ; } }  ", "import java . util . * ; public class Game { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] arr1 = new int [ n ] ; int [ ] arr2 = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr1 [ i ] = s . nextInt ( ) ; arr2 [ i ] = s . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i != j && arr1 [ i ] == arr2 [ j ] ) { count ++ ; } } } System . out . println ( count ) ; } }", "import java . util . * ; public class Game { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int [ ] h = new int [ t ] ; int [ ] a = new int [ t ] ; int count = 0 ; for ( int i = 0 ; i < t ; i ++ ) { h [ i ] = sc . nextInt ( ) ; a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < t ; i ++ ) { for ( int j = 0 ; j < t ; j ++ ) { if ( i != j && h [ i ] == a [ j ] ) ++ count ; } } System . out . println ( count ) ; } }", "import java . util . Scanner ; public class Test {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] home = new int [ n ] ; int [ ] away = new int [ n ] ; int matches = 0 ; for ( int i = 0 ; i < n ; i ++ ) { home [ i ] = in . nextInt ( ) ; away [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) if ( home [ i ] == away [ j ] ) ++ matches ; System . out . println ( matches ) ; } }" ]
[ "n = int ( input ( ) ) l1 = [ ] l2 = [ ] result = 0 for i in range ( n ) : t = input ( ) . split ( ) l1 . append ( t [ 0 ] ) l2 . append ( t [ 1 ] )   for i in range ( len ( l1 ) ) : for j in range ( len ( l2 ) ) : if l1 [ i ] == l2 [ j ] : result += 1     print ( result ) NEW_LINE", "s = 0 a = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( int ( input ( ) ) ) ] for i in range ( len ( a ) ) : for j in range ( len ( a ) ) : if a [ i ] [ 0 ] == a [ j ] [ 1 ] : s += 1 print ( s ) NEW_LINE", "n = int ( input ( \" \" ) ) l = [ ] for i in range ( n ) : a , b = input ( \" \" ) . split ( \" ▁ \" ) a , b = int ( a ) , int ( b ) l . append ( a ) l . append ( b ) c = 0 for i in range ( 0 , len ( l ) , 2 ) : for j in range ( 1 , len ( l ) , 2 ) : if l [ i ] == l [ j ] : c = c + 1 print ( c ) NEW_LINE", "n = int ( input ( ) ) s1 = [ ] s2 = [ ] ans = 0 for i in range ( n ) : a , b = input ( ) . split ( ) s1 . append ( a ) s2 . append ( b )   for x in s2 : ans = ans + s1 . count ( x ) NEW_LINE", "n = int ( input ( ) ) l1 = [ ] l2 = [ ] r = 0 for i in range ( n ) : t = input ( ) . split ( ) l1 . append ( t [ 0 ] ) l2 . append ( t [ 1 ] )   for i in range ( len ( l1 ) ) : for j in range ( len ( l2 ) ) : if l1 [ i ] == l2 [ j ] : r += 1     print ( r ) NEW_LINE" ]
codeforces_1322_B
[ "import java . util . * ; import java . io . * ; public class A { static class Reader { final private int BUFFER_SIZE = 1 << 16 ; private DataInputStream din ; private byte [ ] buffer ; private int bufferPointer , bytesRead ; public Reader ( ) { din = new DataInputStream ( System . in ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; } public Reader ( String file_name ) throws IOException { din = new DataInputStream ( new FileInputStream ( file_name ) ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; } public String readLine ( ) throws IOException { byte [ ] buf = new byte [ 64 ] ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Main { private static int findAnswer ( int n , int [ ] a ) { int res = 0 ; for ( int bit = 0 ; bit <= 25 ; bit ++ ) { if ( findBit ( n , a , bit ) > 0 ) { res += ( 1 << bit ) ; } } return res ; }   private static int findBit ( int n , int [ ] a , int bit ) { int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = ( a [ i ] % ( 1 << ( bit + 1 ) ) ) ; } Arrays . sort ( A ) ;", "import java . io . * ; import java . util . * ; import static java . lang . Math . * ;   public class PresentRedo { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; Arrays . setAll ( a , i -> sc . nextInt ( ) ) ; int MAXBIT = 24 ; int ans = 0 ; for ( int i = 0 , bit = 1 ; i <= MAXBIT ; i ++ , bit <<= 1 ) { int [ ] fraction = new int [ N ] ; long ones = 0 ; for ( int j = 0 ; j < N ; j ++ ) { fraction [ j ] = a [ j ] & ( bit - 1 ) ; if ( ( a [ j ] & bit ) > 0 ) { ones ++ ; } } Arrays . sort ( fraction ) ; int r = N ; long carried = 0 ; for ( int l = 0 ; l < N ; l ++ ) { while ( r >= max ( 1 , l + 2 ) && fraction [ l ] + fraction [ r - 1 ] >= bit ) { r -- ; } r = max ( r , l + 1 ) ; carried += max ( 0 , N - r ) ; }" ]
[ "for z in range ( 1 ) : co = 0 n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) for e in range ( 1 , 25 ) : po = 2 ** e re = sorted ( [ k % po for k in l ] ) b = n r = 0 for a in range ( n ) : b -= 1 while re [ a ] + re [ b ] >= po and b >= 0 : b -= 1 b += 1 r += n - b - ( a >= b ) r //= 2 if r % 2 : co += 2 ** e if n % 2 == 0 : for k in l : co = co ^ k print ( co ) NEW_LINE", "import sysinput = sys . stdin . readline   n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) )   ANS = 0 for i in range ( 26 ) : B = [ ]   for a in A : B . append ( a & ( ( 1 << ( i + 1 ) ) - 1 ) )   B . sort ( )   j0 = n - 1 j1 = n - 1 j2 = n - 1 count = 0   for j in range ( n ) : while j0 >= 0 and B [ j0 ] + B [ j ] >= ( 1 << i ) : j0 -= 1 while j1 >= 0 and B [ j1 ] + B [ j ] > ( 1 << ( i + 1 ) ) - 1 : j1 -= 1   while j2 >= 0 and B [ j2 ] + B [ j ] >= ( 1 << i ) + ( 1 << ( i + 1 ) ) : j2 -= 1   NEW_LINE", "import sysinput = sys . stdin . readline   n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) )   ANS = 0 for i in range ( 26 ) : B = [ ]   for a in A : B . append ( a & ( ( 1 << ( i + 1 ) ) - 1 ) )   B . sort ( )   j0 = n - 1 j1 = n - 1 j2 = n - 1 count = 0   for j in range ( n ) : while j0 >= 0 and B [ j0 ] + B [ j ] >= ( 1 << i ) : j0 -= 1 while j1 >= 0 and B [ j1 ] + B [ j ] > ( 1 << ( i + 1 ) ) - 1 : j1 -= 1   while j2 >= 0 and B [ j2 ] + B [ j ] >= ( 1 << i ) + ( 1 << ( i + 1 ) ) : j2 -= 1   NEW_LINE", "from collections import defaultdictfrom queue import deque     def arrinp ( ) : return [ * map ( int , input ( ) . split ( ' ▁ ' ) ) ]     def mulinp ( ) : return map ( int , input ( ) . split ( ' ▁ ' ) )     def intinp ( ) : return int ( input ( ) )     def solution ( ) : co = 0 n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) for e in range ( 1 , 25 ) : po = 2 ** e re = sorted ( [ k % po for k in l ] ) b = n r = 0 for a in range ( n ) : b -= 1 while re [ a ] + re [ b ] >= po and b >= 0 : b -= 1 b += 1 r += n - b - ( a >= b ) r //= 2 if r % 2 : co += 2 ** e if n % 2 == 0 : for k in l : co = co ^ k print ( co )     testcases = 1 NEW_LINE" ]
codeforces_540_A
[ "import java . util . Scanner ;   public class sixteen {   public static void main ( String [ ] args ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Random ; import java . util . * ; import java . util . StringTokenizer ; import java . util . Scanner ; public class Comptetive { static class Pair { int f ; int s ; Pair ( int f , int s ) { this . f = f ; this . s = s ; } } public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ;", "import java . util . * ; import java . io . * ; import java . math . * ; import java . text . * ;   public class Main { static PrintWriter out ; static Reader in ; public static void main ( String [ ] args ) throws IOException { input_output ( ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class A { static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] nextArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } static class FastWriter extends PrintWriter { FastWriter ( ) { super ( System . out ) ; }   void println ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + \" ▁ \" ) ; } println ( ) ; }   void println ( long [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + \" ▁ \" ) ; } println ( ) ; } } public static void main ( String [ ] args ) { FastScanner in = new FastScanner ( ) ; FastWriter out = new FastWriter ( ) ; int n = in . nextInt ( ) ; String [ ] str1 = in . next ( ) . split ( \" \" ) ; String [ ] str2 = in . next ( ) . split ( \" \" ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int diff = Math . abs ( Integer . parseInt ( str1 [ i ] ) - Integer . parseInt ( str2 [ i ] ) ) ; if ( diff <= 5 ) { cnt += diff ; } else { cnt += 10 - diff ; } } out . println ( cnt ) ; out . close ( ) ; } }", "import java . util . Scanner ;   public class A540 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) , t = 0 ; String word1 = scanner . next ( ) , word2 = scanner . next ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int diff = Math . abs ( word1 . charAt ( i ) - word2 . charAt ( i ) ) ; if ( diff > 5 ) { t += 10 - diff ; } else { t += diff ; } } System . out . println ( t ) ; } }" ]
[ "def fun ( ls , ms ) : ans = 0 for i , j in zip ( ls , ms ) : NEW_LINE", "n = int ( input ( ) ) s1 = input ( ) s2 = input ( ) s = 0 for i in range ( n ) : m = min ( abs ( int ( s1 [ i ] ) - int ( s2 [ i ] ) ) , min ( int ( s1 [ i ] ) , 10 - int ( s1 [ i ] ) ) + min ( int ( s2 [ i ] ) , 10 - int ( s2 [ i ] ) ) ) s = s + mprint ( s ) NEW_LINE", "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 ( ) : n = int ( input ( ) ) NEW_LINE", "n = int ( input ( ) ) lock = str ( input ( ) ) unlock = str ( input ( ) )   total_comb = 0   for i in range ( 0 , n ) : a = int ( lock [ i ] ) b = int ( unlock [ i ] )   d1 = abs ( a - b ) d2 = 10 - max ( a , b ) + min ( a , b )   total_comb += min ( d1 , d2 )   print ( total_comb ) NEW_LINE" ]
codeforces_937_A
[ "import java . io . * ; import java . util . * ;   public class Olympiad { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; if ( ! set . contains ( a ) && a != 0 ) { set . add ( a ) ; } } System . out . println ( set . size ( ) ) ; } }", "import java . util . Scanner ; import java . util . Arrays ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int r = 0 ; while ( r < n ) { a [ r ] = sc . nextInt ( ) ; r ++ ; } r = 0 ; int i = n - 1 ; int q = 1 ; Arrays . sort ( a ) ; while ( a [ r ] == 0 ) { r ++ ; } r = 0 ; while ( a [ r ] == 0 ) { if ( r + 1 == n ) { q = 0 ; r ++ ; } q = 1 ; r ++ ; } if ( q != 0 ) { while ( a [ r ] == 0 ) { r ++ ; } while ( a [ r ] != a [ i ] ) { if ( a [ r ] == a [ r + 1 ] ) { r ++ ; } else { q ++ ; r ++ ; } } System . out . println ( q ) ; } else { System . out . println ( 0 ) ; } } }", "import java . util . * ; import java . util . Arrays ; public class program { 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 count = 1 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( a [ i ] != 0 ) { if ( a [ i ] != a [ i + 1 ] ) { count ++ ; } } } System . out . println ( count ) ; } }", "import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ 601 ] ; Arrays . fill ( a , - 1 ) ; int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; if ( x > 0 && a [ x ] == - 1 ) { a [ x ] = 1 ; res ++ ; } } System . out . println ( res ) ; } }" ]
[ "def main_function ( ) : n = int ( input ( ) ) p = [ int ( i ) for i in input ( ) . split ( \" ▁ \" ) ] hash = [ 0 for i in range ( 605 ) ] for i in p : if not i == 0 : hash [ i ] += 1 count = 0 for i in hash : if i != 0 : count += 1 return count       print ( main_function ( ) ) NEW_LINE", "n = int ( input ( ) ) a = set ( map ( int , input ( ) . split ( ) ) ) a -= { 0 } print ( len ( a ) ) NEW_LINE", "import sysinput = sys . stdin . readline   n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] res = [ int ( i ) for i in a if i > 0 ] print ( len ( set ( res ) ) ) NEW_LINE", "import sys   def main ( ) : _ , s = sys . stdin . read ( ) . strip ( ) . split ( ' \\n ' ) return len ( set ( s . split ( ) ) - { '0' } ) print ( main ( ) ) NEW_LINE" ]
codeforces_997_A
[ "import java . io . * ; import java . util . * ; import java . util . stream . * ;   public class a implements Runnable { public static void main ( String [ ] args ) { new Thread ( null , new a ( ) , \" process \" , 1 << 26 ) . start ( ) ; } public void run ( ) { FastReader scan = new FastReader ( ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . Arrays ; import java . util . ArrayList ; import java . util . * ;   public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; String s = sc . next ( ) ; int i = 0 ; int count0 , count1 ; count1 = 0 ; count0 = 0 ; char st = s . charAt ( 0 ) ; if ( st == '0' ) count0 ++ ; else count1 ++ ; for ( i = 1 ; i < n ; i ++ ) { if ( s . charAt ( i ) == st ) continue ; { st = s . charAt ( i ) ; if ( st == '0' ) count0 ++ ; else count1 ++ ; } } if ( y > x ) { if ( count0 > 1 ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . Arrays ; import java . util . ArrayList ; import java . util . * ;   public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; String s = sc . next ( ) ; int i = 0 ; int count0 , count1 ; count1 = 0 ; count0 = 0 ; char st = s . charAt ( 0 ) ; if ( st == '0' ) count0 ++ ; else count1 ++ ; for ( i = 1 ; i < n ; i ++ ) { if ( s . charAt ( i ) == st ) continue ; { st = s . charAt ( i ) ; if ( st == '0' ) count0 ++ ; else count1 ++ ; } } if ( y > x ) { if ( count0 > 1 ) {" ]
[ "n , x , y = map ( int , input ( ) . split ( ) ) s = input ( ) c = 0 ans1 , ans2 = 0 , 0 for i in range ( n - 1 ) : if s [ i ] == '0' and s [ i + 1 ] == '1' : c += 1 if s [ n - 1 ] == '0' : c += 1 if c == 0 : print ( 0 ) else : ans1 = x * ( c - 1 ) + y ans2 = ( c - 1 ) * y + y print ( min ( ans1 , ans2 ) )       NEW_LINE", "def so ( l ) : l = l . replace ( \"11\" , \"1\" ) return ln , x , y = map ( int , input ( ) . split ( ) ) l = input ( ) if ( \"0\" not in l ) : print ( 0 ) else : while ( \"11\" in l ) : l = so ( l ) l = l . split ( \"1\" ) if ( l [ 0 ] == \" \" ) : l . remove ( \" \" ) if ( l [ - 1 ] == \" \" ) : l . pop ( )   a = len ( l ) - 1 ans1 = ( a + 1 ) * y   ans2 = a * x + y print ( min ( ans1 , ans2 ) ) NEW_LINE", "if __name__ == ' _ _ main _ _ ' : n , x , y = map ( int , input ( ) . split ( ) ) s = list ( input ( ) )   arr = [ s [ 0 ] ]   for i in range ( 1 , n ) : if s [ i ] != s [ i - 1 ] : arr . append ( s [ i ] )   if len ( arr ) == 1 and arr [ 0 ] == '1' : print ( 0 ) exit ( 0 )   c = arr . count ( '0' )   xarr = [ 0 ] yarr = [ y ]   for i in range ( 1 , c ) : xarr . append ( xarr [ - 1 ] + x ) yarr . append ( yarr [ - 1 ] + y )   yarr . reverse ( )   print ( min ( map ( lambda o : o [ 0 ] + o [ 1 ] , zip ( xarr , yarr ) ) ) ) NEW_LINE", "if __name__ == ' _ _ main _ _ ' : n , x , y = map ( int , input ( ) . split ( ) ) s = list ( input ( ) )   arr = [ s [ 0 ] ]   for i in range ( 1 , n ) : if s [ i ] != s [ i - 1 ] : arr . append ( s [ i ] )   if len ( arr ) == 1 and arr [ 0 ] == '1' : print ( 0 ) exit ( 0 )   c = arr . count ( '0' )   xarr = [ 0 ] yarr = [ y ]   for i in range ( 1 , c ) : xarr . append ( xarr [ - 1 ] + x ) yarr . append ( yarr [ - 1 ] + y )   yarr . reverse ( )   print ( min ( map ( lambda o : o [ 0 ] + o [ 1 ] , zip ( xarr , yarr ) ) ) ) NEW_LINE" ]
codeforces_252_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = 0 ; int [ ] x = new int [ n + 1 ] ; x [ 1 ] = sc . nextInt ( ) ; for ( int i = 2 ; i <= n ; i ++ ) { x [ i ] = sc . nextInt ( ) ^ x [ i - 1 ] ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { t = Math . max ( t , x [ i ] ^ x [ j ] ) ; } } System . out . println ( t ) ; } }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = 0 ; int [ ] x = new int [ n + 1 ] ; x [ 1 ] = sc . nextInt ( ) ; for ( int i = 2 ; i <= n ; i ++ ) { x [ i ] = sc . nextInt ( ) ^ x [ i - 1 ] ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { t = Math . max ( t , x [ i ] ^ x [ j ] ) ; } } System . out . println ( t ) ; } }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] x = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { x [ i ] = sc . nextLong ( ) ^ x [ i - 1 ] ; } long max = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { max = Math . max ( x [ i ] , max ) ; for ( int j = 0 ; j < i ; j ++ ) { max = Math . max ( x [ i ] ^ x [ j ] , max ) ; } } System . out . println ( max ) ; } }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] x = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { x [ i ] = sc . nextLong ( ) ^ x [ i - 1 ] ; } long max = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { max = Math . max ( x [ i ] , max ) ; for ( int j = 0 ; j < i ; j ++ ) { max = Math . max ( x [ i ] ^ x [ j ] , max ) ; } } System . out . println ( max ) ; } }", "import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner read = new Scanner ( System . in ) ; long ans = 0 ; int n = read . nextInt ( ) ; long [ ] arr = new long [ n + 1 ] ; long [ ] pref = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { arr [ i ] = read . nextLong ( ) ; pref [ i ] = pref [ i - 1 ] ^ arr [ i ] ; } for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = i ; j <= n ; j ++ ) { ans = Math . max ( ans , pref [ j ] ^ pref [ i - 1 ] ) ; } } System . out . println ( ans ) ; } }" ]
[ "import mathn = int ( input ( ) ) ; ans = 0 a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : x = 0 for j in range ( i , n ) : x = x ^ a [ j ] ans = max ( ans , x ) print ( ans )   NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = [ ] for i in range ( n ) : x = a [ i ] b . append ( x ) for j in range ( i + 1 , n ) : x ^= a [ j ] b . append ( x ) print ( max ( b ) ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = max ( a ) for i in range ( n - 1 ) : p = a [ i ] for j in range ( i + 1 , n ) : p = p ^ a [ j ] ans = max ( ans , p ) print ( ans ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) max_xor = - 19999 for i in range ( 1 , n + 1 ) : for j in range ( n - i + 1 ) : cur_xor = arr [ j ] for h in range ( j , j + i - 1 ) : cur_xor = cur_xor ^ arr [ h + 1 ] max_xor = max ( cur_xor , max_xor ) print ( max_xor ) NEW_LINE", "import math , sysfrom collections import defaultdict , dequeimport bisect as bidef yes ( ) : print ( ' YES ' ) def no ( ) : print ( ' NO ' ) def I ( ) : return ( int ( sys . stdin . readline ( ) ) ) def In ( ) : return ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def Sn ( ) : return sys . stdin . readline ( ) . strip ( ) def Pr ( x ) : sys . stdout . write ( str ( x ) + ' \\n ' ) NEW_LINE" ]
codeforces_396_A
[ "import java . io . * ; import java . util . * ;   public class P396A { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( in , out ) ; out . close ( ) ; }   static class Task { private static List < Integer > primes = new ArrayList < > ( ) ; final long M = 1000000007 ;   public static void sievePrimes ( int maxValue ) {", "import java . io . * ; import java . math . BigInteger ; import java . util . * ; import java . util . Stack ; import java . util . regex . Pattern ;        public class ROUGH {   public static class FastReader { BufferedReader br ; StringTokenizer st ;", "import java . io . * ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . StringTokenizer ;   public class multipliers { static public HashMap < Integer , Integer > factor ( int in ) { HashMap < Integer , Integer > result = new HashMap < > ( ) ; for ( int i = 2 ; i * i <= in ; i ++ ) { if ( in % i == 0 ) { int count = 0 ; while ( in % i == 0 ) { count ++ ; in /= i ; } result . put ( i , count ) ; } } if ( in != 1 ) { result . put ( in , 1 ) ; } return result ; }   static public void factor ( int in , HashMap < Integer , Integer > a ) { HashMap < Integer , Integer > result = new HashMap < > ( ) ; for ( int i = 2 ; i * i <= in ; i ++ ) { if ( in % i == 0 ) { int count = 0 ; while ( in % i == 0 ) { count ++ ; in /= i ; } if ( a . containsKey ( i ) ) a . put ( i , a . remove ( i ) + count ) ; else a . put ( i , count ) ; } } if ( in != 1 ) { if ( a . containsKey ( in ) ) a . put ( in , a . remove ( in ) + 1 ) ; else a . put ( in , 1 ) ;   }   } static int base = 0 ; static int MOD = ( int ) ( 1e9 + 7 ) ;", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . util . Set ; import java . util . HashMap ; import java . io . IOException ; import java . util . Random ; import java . io . UncheckedIOException ; import java . util . HashSet ; import java . util . Map ; import java . io . Closeable ; import java . io . Writer ; import java . io . OutputStreamWriter ; import java . math . BigInteger ; import java . util . Collections ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) throws Exception { Thread thread = new Thread ( null , new TaskAdapter ( ) , \" \" , 1 << 29 ) ; thread . start ( ) ; thread . join ( ) ; }   static class TaskAdapter implements Runnable { @ Override public void run ( ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastInput in = new FastInput ( inputStream ) ; FastOutput out = new FastOutput ( outputStream ) ; AOnNumberOfDecompositionsIntoMultipliers solver = new AOnNumberOfDecompositionsIntoMultipliers ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } }   static class AOnNumberOfDecompositionsIntoMultipliers { int mod = ( int ) 1e9 + 7 ; Combination comb = new Combination ( ( int ) 1e5 , mod ) ;   public void solve ( int testNumber , FastInput in , FastOutput out ) { int n = in . ri ( ) ; int [ ] a = in . ri ( n ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int x : a ) { Set < Integer > set = PollardRho . findAllFactors ( x ) ; for ( int y : set ) { int p = 0 ; while ( x % y == 0 ) { x /= y ; p ++ ; } map . put ( y , map . getOrDefault ( y , 0 ) + p ) ; } }   long ans = 1 ; for ( int v : map . values ( ) ) {" ]
[ "from math import factorial as fdef primes ( n ) : sieve = [ True ] * n for i in range ( 3 , int ( n ** 0.5 ) + 1 , 2 ) : if sieve [ i ] : sieve [ i * i : : 2 * i ] = [ False ] * ( ( n - i * i - 1 ) // ( 2 * i ) + 1 ) return [ 2 ] + [ i for i in range ( 3 , n , 2 ) if sieve [ i ] ] p = primes ( 31627 ) s = [ 0 ] * ( 31623 ) s1 = { } def factorize ( n ) : for i in p : if n <= 1 : return 56 while n % i == 0 : s [ p . index ( i ) ] += 1 n //= i if n > 1 : if n in s1 : s1 [ n ] += 1 else : s1 [ n ] = 1 n = int ( input ( ) ) for i in map ( int , input ( ) . split ( ) ) : factorize ( i ) s = list ( filter ( lambda a : a != 0 , s ) ) for i in s1 . values ( ) : s . append ( i ) ans = 1 for i in s : ans *= f ( i + n - 1 ) // ( f ( n - 1 ) * f ( i ) ) print ( int ( ans ) % 1000000007 ) NEW_LINE", "Mod = 1000000007 MAX = 33000 n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) B = [ 0 ] * MAX bePrime = [ 0 ] * MAX ; primNum = [ ] C = [ ] fac = [ 1 ] for j in range ( 1 , MAX ) : fac . append ( fac [ - 1 ] * j % Mod ) def calc ( M , N ) : return fac [ M ] * pow ( fac [ N ] * fac [ M - N ] % Mod , Mod - 2 , Mod ) % Mod for j in range ( 2 , MAX ) : if bePrime [ j ] == 0 : primNum . append ( j ) i = j while i < MAX : bePrime [ i ] = 1 i = i + j for x in A : tmp = x for j in primNum : while tmp % j == 0 : tmp /= j B [ j ] += 1 if tmp > 1 : C . append ( tmp ) ans = 1 for j in range ( 2 , MAX ) : if B [ j ] > 0 : ans = ans * calc ( n + B [ j ] - 1 , n - 1 ) % Mod l = len ( C ) for j in range ( 0 , l ) : num = 0 ; for k in range ( 0 , l ) : if C [ k ] == C [ j ] : num = num + 1 if k > j : num = 0 break if num > 0 : ans = ans * calc ( n + num - 1 , n - 1 ) % Mod print ( str ( ans % Mod ) ) NEW_LINE", "from math import factorial as fdef primes ( n ) : sieve = [ True ] * n for i in range ( 3 , int ( n ** 0.5 ) + 1 , 2 ) : if sieve [ i ] : sieve [ i * i : : 2 * i ] = [ False ] * ( ( n - i * i - 1 ) // ( 2 * i ) + 1 ) return [ 2 ] + [ i for i in range ( 3 , n , 2 ) if sieve [ i ] ] p = primes ( 31627 ) s = [ 0 ] * ( 31623 ) s1 = { } def factorize ( n ) : for i in p : if n <= 1 : return 56 while n % i == 0 : s [ p . index ( i ) ] += 1 n //= i if n > 1 : if n in s1 : s1 [ n ] += 1 else : s1 [ n ] = 1 n = int ( input ( ) ) for i in map ( int , input ( ) . split ( ) ) : factorize ( i ) s = list ( filter ( lambda a : a != 0 , s ) ) for i in s1 . values ( ) : s . append ( i ) ans = 1 for i in s : ans *= f ( i + n - 1 ) // ( f ( n - 1 ) * f ( i ) ) print ( int ( ans ) % 1000000007 ) NEW_LINE", "from math import factorial as fdef primes ( n ) : sieve = [ True ] * n for i in range ( 3 , int ( n ** 0.5 ) + 1 , 2 ) : if sieve [ i ] : sieve [ i * i : : 2 * i ] = [ False ] * ( ( n - i * i - 1 ) // ( 2 * i ) + 1 ) return [ 2 ] + [ i for i in range ( 3 , n , 2 ) if sieve [ i ] ] p = primes ( 31627 ) s = [ 0 ] * ( 31623 ) s1 = { } def factorize ( n ) : for i in p : if n <= 1 : return 56 while n % i == 0 : s [ p . index ( i ) ] += 1 n //= i if n > 1 : if n in s1 : s1 [ n ] += 1 else : s1 [ n ] = 1 n = int ( input ( ) ) for i in map ( int , input ( ) . split ( ) ) : factorize ( i ) s = list ( filter ( lambda a : a != 0 , s ) ) for i in s1 . values ( ) : s . append ( i ) ans = 1 for i in s : ans *= f ( i + n - 1 ) // ( f ( n - 1 ) * f ( i ) ) print ( int ( ans ) % 1000000007 ) NEW_LINE" ]
codeforces_983_A
[ "import java . util . * ; import java . io . * ; public class Solution { public static PrintWriter out ; public static void main ( String args [ ] ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) , true ) ; int n = sc . nextInt ( ) ; for ( int z = 1 ; z <= n ; z ++ ) { long p = sc . nextLong ( ) ; long q = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; q = q / gcd ( p , q ) ; b = gcd ( b , q ) ; while ( b != 1 ) { while ( q % b == 0 ) q = q / b ; b = gcd ( q , b ) ; } if ( q == 1 ) out . println ( \" Finite \" ) ; else out . println ( \" Infinite \" ) ; } out . close ( ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) return b ; else if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }", "import java . io . BufferedInputStream ; import java . io . IOException ; import java . io . PrintWriter ;   public class CF_483_A {   static final BufferedInputStream input = new BufferedInputStream ( System . in ) ; static final PrintWriter output = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) throws Exception { int n = readInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { long p = readLong ( ) ; long q = readLong ( ) ; long b = readLong ( ) ; q = q / gcd ( q , p ) ; long d = gcd ( q , b ) ; while ( d > 1 ) { q /= d ; while ( ( q % d ) == 0 ) { q /= d ; } d = gcd ( q , d ) ; } output . println ( ( q == 1 ) ? \" Finite \" : \" Infinite \" ) ; } output . flush ( ) ; output . close ( ) ; }   static long gcd ( long a , long b ) {", "import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = input . nextInt ( ) ; while ( T -- > 0 ) { long p = input . nextLong ( ) ; long q = input . nextLong ( ) ; long b = input . nextLong ( ) ; q = q / gcd ( p , q ) ; long g = gcd ( q , b ) ; while ( g > 1 ) { while ( q % g == 0 ) { q = q / g ; } g = gcd ( q , b ) ; } if ( q == 1 ) { out . println ( \" Finite \" ) ; } else { out . println ( \" Infinite \" ) ; } } out . close ( ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) { return b ; } else { return gcd ( b % a , a ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) {   return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }" ]
[ "import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = input . nextInt ( ) ; while ( T - -> 0 ) { long p = input . nextLong ( ) ; long q = input . nextLong ( ) ; long b = input . nextLong ( ) ; q = q / gcd ( p , q ) ; long g = gcd ( q , b ) ; while ( g > 1 ) { while ( q % g == 0 ) { q = q / g ; } g = gcd ( q , b ) ; } if ( q == 1 ) { out . println ( \" Finite \" ) ; } else { out . println ( \" Infinite \" ) ; } } out . close ( ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) { return b ; } else { return gcd ( b % a , a ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) {   return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } NEW_LINE", "import sys   def main ( ) : n = int ( input ( ) ) ans = [ ] for i in range ( n ) : p , q , b = map ( int , input ( ) . split ( \" ▁ \" ) ) t = pow ( b , 111 , q ) if p * t % q == 0 : ans . append ( \" Finite \" ) else : ans . append ( \" Infinite \" )   print ( \" \\n \" . join ( ans ) )   main ( ) NEW_LINE", "import sysinput = sys . stdin . readline   t = int ( input ( ) ) res = [ ] for _ in range ( t ) : p , q , b = map ( int , input ( ) . split ( ) ) if p * pow ( b , 64 , q ) % q != 0 : res . append ( \" Infinite \" ) else : res . append ( \" Finite \" ) print ( ' \\n ' . join ( res ) ) NEW_LINE" ]
codeforces_1398_A
[ "import java . util . * ; import java . util . Arrays ; public class BadTriangle { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; Arrays . sort ( arr ) ; if ( arr [ 0 ] + arr [ 1 ] <= arr [ n - 1 ] ) System . out . println ( 1 + \" ▁ \" + 2 + \" ▁ \" + n ) ; else System . out . println ( - 1 ) ; } } }", "import java . util . * ; public class BadTriangle { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int c = 0 , n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; if ( a [ 0 ] + a [ 1 ] <= a [ n - 1 ] ) System . out . println ( 1 + \" ▁ \" + 2 + \" ▁ \" + n ) ; else System . out . println ( - 1 ) ; } } }", "import java . util . * ; public class op { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; int i , j ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } if ( a [ 0 ] + a [ 1 ] <= a [ n - 1 ] ) System . out . println ( 1 + \" ▁ \" + 2 + \" ▁ \" + n ) ; else System . out . println ( - 1 ) ; } } }", "import java . util . * ; import java . io . * ; public class _practise { public static void main ( String args [ ] ) { FastReader in = new FastReader ( ) ; PrintWriter so = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = in . nextLong ( ) ; if ( a [ 0 ] + a [ 1 ] > a [ n - 1 ] ) so . println ( \" - 1\" ) ; else so . println ( \"1 ▁ 2 ▁ \" + ( n ) ) ; } so . flush ( ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } int [ ] readIntArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long [ ] readLongArray ( int n ) { long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }", "import java . util . Scanner ; public class BadTriangle { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int test_case = scan . nextInt ( ) ; while ( test_case -- > 0 ) { int n = scan . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scan . nextInt ( ) ; } if ( arr [ n - 1 ] >= ( arr [ 0 ] + arr [ 1 ] ) ) { System . out . println ( 1 + \" ▁ \" + 2 + \" ▁ \" + n ) ; } else { System . out . println ( \" - 1\" ) ; } } scan . close ( ) ; } }" ]
[ "t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE ali = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE q = ali [ 1 ] + ali [ 0 ] NEW_LINE if ( ali [ - 1 ] >= q ) : NEW_LINE INDENT print ( 1 , 2 , n ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT DEDENT", "def removeSmallest ( ) : NEW_LINE INDENT s = arr [ 0 ] + arr [ 1 ] NEW_LINE k = 0 NEW_LINE if len ( arr ) < 3 : NEW_LINE INDENT k = - 1 NEW_LINE DEDENT for i in range ( 2 , n ) : NEW_LINE INDENT if s <= arr [ i ] : NEW_LINE INDENT k = 0 NEW_LINE x = i + 1 NEW_LINE break NEW_LINE DEDENT else : NEW_LINE INDENT k = - 1 NEW_LINE DEDENT DEDENT if k == 0 : NEW_LINE INDENT return ( \" \" + str ( 1 ) + \" ▁ \" + str ( 2 ) + \" ▁ \" + str ( i + 1 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT return - 1 NEW_LINE DEDENT DEDENT t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE arr = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( removeSmallest ( ) ) NEW_LINE DEDENT", "import sys NEW_LINE input = sys . stdin . readline NEW_LINE for test in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE if a [ 0 ] + a [ 1 ] > a [ - 1 ] : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 , 2 , n ) NEW_LINE DEDENT DEDENT", "for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( * ( [ 1 , 2 , n ] , [ - 1 ] ) [ a [ 0 ] + a [ 1 ] > a [ n - 1 ] ] ) NEW_LINE DEDENT", "import sys NEW_LINE input = sys . stdin . readline NEW_LINE def non_deg ( vals ) : NEW_LINE INDENT a , b , c = vals NEW_LINE return a + b > c and a + c > b and b + c > a NEW_LINE DEDENT t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if not non_deg ( [ a [ 0 ] , a [ 1 ] , a [ - 1 ] ] ) : NEW_LINE INDENT print ( 1 , 2 , n ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT DEDENT" ]
codeforces_936_B
[ "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 . StringTokenizer ;   public class B {   public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) , m = fs . nextInt ( ) ; Node [ ] nodes = new Node [ n ] ; for ( int i = 0 ; i < n ; i ++ ) nodes [ i ] = new Node ( i ) ; for ( int i = 0 ; i < n ; i ++ ) { nodes [ i ] . outDegree = fs . nextInt ( ) ; for ( int j = 0 ; j < nodes [ i ] . outDegree ; j ++ ) { int next = fs . nextInt ( ) - 1 ; nodes [ i ] . canReach . add ( nodes [ next ] ) ; nodes [ next ] . canReachMe . add ( nodes [ i ] ) ; } }", "import java . util . * ; import java . io . * ; public class EdA { static long [ ] mods = { 1000000007 , 998244353 , 1000000009 } ; static long mod = mods [ 0 ] ; public static MyScanner sc ; public static PrintWriter out ; static Map < State , ArrayList < State > > graph ; static Map < Integer , ArrayList < Integer > > outgraph ; static int [ ] [ ] dp ; static Set < Integer > currDFS ; public static void main ( String [ ] omkar ) throws Exception {" ]
[ "n , m = list ( map ( int , input ( ) . split ( ) ) )   from collections import defaultdict   graph = defaultdict ( list )   for i in range ( 1 , n + 1 ) : neighbours = list ( map ( int , input ( ) . split ( ) ) ) [ 1 : ] graph [ ( i , 0 ) ] = [ ( x , 1 ) for x in neighbours ] graph [ ( i , 1 ) ] = [ ( x , 0 ) for x in neighbours ]   start = int ( input ( ) )   NEW_LINE", "n , m = [ int ( x ) for x in input ( ) . split ( ) ]   edges = [ set ( ) ]   drain = set ( )   for i in range ( n ) :   nums = [ int ( x ) for x in input ( ) . split ( ) ]   if nums [ 0 ] == 0 :   drain . add ( i + 1 )   edges . append ( set ( nums [ 1 : ] ) )   start = int ( input ( ) )       nodes = { start }   visited = { }   while len ( nodes ) > 0 :   curr = nodes . pop ( )   for v in edges [ abs ( curr ) ] :   if curr > 0 :   v = - v   if visited . get ( v ) is None :   nodes . add ( v )   visited [ v ] = curr       ok = False   for d in drain :   if - d in visited :   print ( ' Win ' )   v = - d   l = [ ]   while v != start :   l . append ( abs ( v ) )   v = visited [ v ]   l . append ( start )   print ( ' ▁ ' . join ( str ( x ) for x in l [ : : - 1 ] ) )   ok = True   break       if not ok :   stack = [ start ]   in_stack = { start }   visited = { start }   while len ( stack ) > 0 :   curr = stack [ - 1 ]   if len ( edges [ curr ] ) == 0 :   stack . pop ( )   in_stack . remove ( curr )   continue   v = edges [ curr ] . pop ( )   if v not in visited :   visited . add ( v )   stack . append ( v )   in_stack . add ( v )   elif v in in_stack :   print ( ' Draw ' )   ok = True   break   if not ok :   print ( ' Lose ' )         NEW_LINE" ]
codeforces_354_A
[ "import java . util . * ; import java . io . * ; import java . math . BigInteger ;   public class b { public static void main ( String [ ] args ) throws IOException { FastScanner sc = new FastScanner ( ) ; int n = sc . nextInt ( ) ; long l = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; long ql = sc . nextLong ( ) ; long qr = sc . nextLong ( ) ; long [ ] w = sc . nextLongArray ( n ) ;   long [ ] lsum = new long [ n + 1 ] ; long [ ] rsum = new long [ n + 1 ] ; lsum [ 1 ] = w [ 0 ] ; for ( int i = 2 ; i <= n ; i ++ ) lsum [ i ] = lsum [ i - 1 ] + w [ i - 1 ] ; rsum [ n - 1 ] = w [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) rsum [ i ] = rsum [ i + 1 ] + w [ i ] ;   long min = Integer . MAX_VALUE ;   for ( int i = 0 ; i <= n ; i ++ ) { int lop = i ; int rop = n - i ; long cost = lsum [ lop ] * l + rsum [ n - rop ] * r ;   if ( lop > rop ) { cost += ( lop - rop - 1 ) * ql ; } else if ( rop > lop ) { cost += ( rop - lop - 1 ) * qr ; } min = Math . min ( min , cost ) ; } System . out . println ( min ) ;   } }  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Main { static class InputReader { protected BufferedReader br = null ; StringTokenizer tokenizer = null ;   public InputReader ( InputStream is ) { super ( ) ; br = new BufferedReader ( new InputStreamReader ( is ) ) ; }   public String next ( ) { for ( ; tokenizer == null || ! tokenizer . hasMoreTokens ( ) ; ) { try { tokenizer = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) {", "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   int N ; long [ ] w ; long L , R , QL , QR ; void run ( FastScanner in , PrintWriter out ) {" ]
[ "import sysfrom os import pathif ( path . exists ( ' input . txt ' ) ) : sys . stdin = open ( \" input . txt \" , \" r \" ) sys . stdout = open ( \" output . txt \" , \" w \" ) N = 10 ** 5 + 5 n , l , r , q1 , q2 = map ( int , input ( ) . split ( ) ) w = [ int ( x ) for x in input ( ) . split ( ) ] pre = [ 0 ] * Nfor i in range ( n ) : pre [ i + 1 ] = pre [ i ] + w [ i ]   ans = 10 ** 18   for i in range ( n + 1 ) : curr = pre [ i ] * l + ( pre [ n ] - pre [ i ] ) * r x , y = i , n - i if ( x < y ) : curr += q2 * ( y - x - 1 ) elif ( x > y ) : curr += q1 * ( x - y - 1 ) ans = min ( ans , curr ) print ( ans ) NEW_LINE", "import time , math as mt , bisect as bs , sysfrom sys import stdin , stdoutfrom collections import dequefrom fractions import Fractionfrom collections import Counterfrom collections import OrderedDictpi = 3.14159265358979323846264338327950 def II ( ) : NEW_LINE", "if __name__ == ' _ _ main _ _ ' : n , l , r , ql , qr = map ( int , input ( ) . split ( ) ) weights = [ int ( x ) for x in input ( ) . split ( ) ]   curr_sum = 0 cum_sum = list ( )   for i in weights : curr_sum += i cum_sum . append ( curr_sum ) NEW_LINE" ]
codeforces_99_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int x [ ] = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = scan . nextInt ( ) ; sum += x [ i ] ; } int a = 0 ; int b = 0 ; int count = 0 ; float norm = ( ( float ) sum ) / n ; for ( int i = 0 ; i < n && count < 3 ; i ++ ) { if ( x [ i ] < norm ) { count ++ ; a = i + 1 ; } else if ( x [ i ] > norm ) { count ++ ; b = i + 1 ; } } if ( count == 3 || norm != ( int ) norm ) { System . out . println ( \" Unrecoverable ▁ configuration . \" ) ; } else if ( a == 0 ) { System . out . println ( \" Exemplary ▁ pages . \" ) ; } else { System . out . println ( ( int ) ( x [ b - 1 ] - norm ) + \" ▁ ml . ▁ from ▁ cup ▁ # \" + a + \" ▁ to ▁ cup ▁ # \" + b + \" . \" ) ; } } }", "import java . io . * ; import java . util . * ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import java . text . DecimalFormat ; import java . lang . Math ; import java . util . Iterator ; public class b88 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; float avg = 0 ; ArrayList < Integer > A = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { A . add ( sc . nextInt ( ) ) ; avg += ( float ) A . get ( i ) ; } avg = ( float ) avg / n ; int count = 0 ; for ( int i = 0 ; i < A . size ( ) ; i ++ ) { if ( ( float ) A . get ( i ) != avg ) { count ++ ; } } if ( count > 2 ) { System . out . println ( \" Unrecoverable ▁ configuration . \" ) ; } else if ( count == 0 ) { System . out . println ( \" Exemplary ▁ pages . \" ) ; } else if ( count == 2 ) { ArrayList < Integer > B = new ArrayList < Integer > ( A ) ; Collections . sort ( B ) ; if ( B . get ( B . size ( ) - 1 ) - ( int ) avg == ( int ) avg - B . get ( 0 ) ) { System . out . println ( ( B . get ( B . size ( ) - 1 ) - ( int ) avg ) + \" ▁ ml . ▁ from ▁ cup ▁ # \" + ( A . indexOf ( B . get ( 0 ) ) + 1 ) + \" ▁ to ▁ cup ▁ # \" + ( A . indexOf ( B . get ( B . size ( ) - 1 ) ) + 1 ) + \" . \" ) ; } else { System . out . println ( \" Unrecoverable ▁ configuration . \" ) ; } } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . * ; public class Main { public static void ans ( int [ ] arr , int sum , int n ) { if ( sum % n != 0 ) { System . out . println ( \" Unrecoverable ▁ configuration . \" ) ; return ; } int equal = sum / n ; int inc = 0 , dec = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > equal ) inc ++ ; else if ( arr [ i ] < equal ) dec ++ ; } if ( inc == 0 && dec == 0 ) { System . out . println ( \" Exemplary ▁ pages . \" ) ; return ; } else if ( inc == 1 && dec == 1 ) { int a = 0 , b = 0 , ia = 0 , ib = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > equal ) { a = arr [ i ] - equal ; ia = i ; } else if ( arr [ i ] < equal ) { b = equal - arr [ i ] ; ib = i ; } } if ( a == b ) { System . out . println ( a + \" ▁ ml . ▁ from ▁ cup ▁ # \" + ( ib + 1 ) + \" ▁ to ▁ cup ▁ # \" + ( ia + 1 ) + \" . \" ) ; return ; } else { System . out . println ( \" Unrecoverable ▁ configuration . \" ) ; return ; } } else { System . out . println ( \" Unrecoverable ▁ configuration . \" ) ; return ; } } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int arr [ ] = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( br . readLine ( ) ) ; sum = sum + arr [ i ] ; } ans ( arr , sum , n ) ; } }", "import java . util . * ; import java . math . * ; public class Main { public static void main ( String args [ ] ) { Scanner cin = new Scanner ( System . in ) ; int n = cin . nextInt ( ) ; int [ ] juice = new int [ 1006 ] ; int x = 0 ; for ( int i = 0 ; i != n ; ++ i ) { x += ( juice [ i ] = cin . nextInt ( ) ) ; } int ave = x / n ; int plus_pos = 0 , minus_pos = 0 , plus_cnt = 0 , minus_cnt = 0 ; for ( int i = 0 ; i != n ; ++ i ) { if ( juice [ i ] > ave ) { plus_pos = i ; plus_cnt ++ ; } if ( juice [ i ] < ave ) { minus_pos = i ; minus_cnt ++ ; } } if ( plus_cnt == 1 && minus_cnt == 1 && ave - juice [ minus_pos ] == juice [ plus_pos ] - ave ) { System . out . printf ( \" % d ▁ ml . ▁ from ▁ cup ▁ # % d ▁ to ▁ cup ▁ # % d . \\n \" , ave - juice [ minus_pos ] , minus_pos + 1 , plus_pos + 1 ) ; } else if ( plus_cnt == 0 && minus_cnt == 0 ) { System . out . println ( \" Exemplary ▁ pages . \" ) ; } else { System . out . println ( \" Unrecoverable ▁ configuration . \" ) ; } cin . close ( ) ; } }" ]
[ "a = int ( input ( ) ) NEW_LINE summa = 0 NEW_LINE s = [ ] NEW_LINE for i in range ( a ) : NEW_LINE INDENT h = int ( input ( ) ) NEW_LINE summa += h NEW_LINE s . append ( h ) NEW_LINE DEDENT if ( summa / a ) != int ( summa / a ) : NEW_LINE INDENT print ( \" Unrecoverable ▁ configuration . \" ) NEW_LINE DEDENT else : NEW_LINE INDENT v = summa // a NEW_LINE c = 0 NEW_LINE r = 0 NEW_LINE ans = [ ] NEW_LINE for i in range ( a ) : NEW_LINE INDENT if s [ i ] != v : NEW_LINE INDENT c += 1 NEW_LINE DEDENT DEDENT if c > 2 : NEW_LINE INDENT print ( \" Unrecoverable ▁ configuration . \" ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT c = 0 NEW_LINE for i in range ( a ) : NEW_LINE INDENT if s [ i ] != v : NEW_LINE INDENT if c == 0 : NEW_LINE INDENT c += 1 NEW_LINE r = v - s [ i ] NEW_LINE ans . append ( i + 1 ) NEW_LINE DEDENT elif c == 1 : NEW_LINE INDENT c += 1 NEW_LINE if abs ( v - s [ i ] ) != abs ( r ) : NEW_LINE INDENT print ( \" Unrecoverable ▁ configuration . \" ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT if r > 0 : NEW_LINE INDENT print ( str ( r ) + \" ▁ ml . ▁ from ▁ cup ▁ # \" + str ( ans [ 0 ] ) + \" ▁ to ▁ cup ▁ # \" + str ( i + 1 ) + \" . \" ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( str ( abs ( r ) ) + \" ▁ ml . ▁ from ▁ cup ▁ # \" + str ( i + 1 ) + \" ▁ to ▁ cup ▁ # \" + str ( ans [ 0 ] ) + \" . \" ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT print ( \" Unrecoverable ▁ configuration . \" ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT DEDENT DEDENT if not c : NEW_LINE INDENT print ( \" Exemplary ▁ pages . \" ) NEW_LINE DEDENT DEDENT", "n = int ( input ( ) ) NEW_LINE q = [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE w = sorted ( q ) NEW_LINE if w [ 0 ] == w [ - 1 ] : NEW_LINE INDENT print ( ' Exemplary ▁ pages . ' ) NEW_LINE exit ( ) NEW_LINE DEDENT if ( w [ 0 ] + w [ - 1 ] ) % 2 or ( n > 2 and ( w [ n - 2 ] != w [ 1 ] or w [ 1 ] != ( w [ 0 ] + w [ - 1 ] ) // 2 ) ) : NEW_LINE INDENT print ( ' Unrecoverable ▁ configuration . ' ) NEW_LINE exit ( ) NEW_LINE DEDENT x , y = q . index ( min ( w ) ) , q . index ( max ( w ) ) NEW_LINE print ( ( q [ y ] - q [ x ] ) // 2 , ' ▁ ml . ▁ from ▁ cup ▁ # ' , x + 1 , ' ▁ to ▁ cup ▁ # ' , y + 1 , ' . ' , sep = ' ' ) NEW_LINE", "n = int ( input ( ) ) NEW_LINE d = { } NEW_LINE for i in range ( n ) : NEW_LINE INDENT s = int ( input ( ) ) NEW_LINE if s in d : NEW_LINE INDENT d [ s ] += [ i + 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT d [ s ] = [ i + 1 ] NEW_LINE DEDENT DEDENT mx = max ( d ) NEW_LINE mn = min ( d ) NEW_LINE l = len ( d ) NEW_LINE if l == 1 : NEW_LINE INDENT print ( \" Exemplary ▁ pages . \" ) NEW_LINE exit ( ) NEW_LINE DEDENT elif l == 2 : NEW_LINE INDENT if len ( d [ mx ] ) != 1 or len ( d [ mn ] ) != 1 : NEW_LINE INDENT print ( ' Unrecoverable ▁ configuration . ' ) NEW_LINE exit ( ) NEW_LINE DEDENT if ( mx + mn ) % 2 : NEW_LINE INDENT print ( \" Unrecoverable ▁ configuration . \" ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT elif l == 3 : NEW_LINE INDENT if len ( d [ mx ] ) != 1 or len ( d [ mn ] ) != 1 : NEW_LINE INDENT print ( ' Unrecoverable ▁ configuration . ' ) NEW_LINE exit ( ) NEW_LINE DEDENT md = ( set ( d ) - { mx , mn } ) . pop ( ) NEW_LINE if ( mx + mn ) / 2 != md : NEW_LINE INDENT print ( \" Unrecoverable ▁ configuration . \" ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT print ( \" Unrecoverable ▁ configuration . \" ) NEW_LINE exit ( ) NEW_LINE DEDENT print ( ( mx - mn ) // 2 , ' ▁ ml . ▁ from ▁ cup ▁ # ' , * d [ mn ] , ' ▁ to ▁ cup ▁ # ' , * d [ mx ] , ' . ' , sep = ' ' ) NEW_LINE" ]
codeforces_430_B
[ "import java . io . * ; import java . util . * ; public class Solution { static Scanner sc = new Scanner ( System . in ) ; static PrintWriter out = new PrintWriter ( System . out ) ;", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;  " ]
[ "def count ( balls ) : stop = False ans = len ( balls ) m = len ( balls ) while ( not stop and m > 0 ) : elms2remove = set ( ) i = 2 stop = True m = len ( balls ) while i < len ( balls ) : if balls [ i ] == balls [ i - 1 ] == balls [ i - 2 ] : elms2remove |= { i , i - 1 , i - 2 } stop = False while i + 1 < m and balls [ i + 1 ] == balls [ i ] : elms2remove . add ( i + 1 ) i += 1   balls = [ b for i , b in enumerate ( balls ) if i not in elms2remove ] break   i += 1   return ans - len ( balls ) - 1     def main ( ) : n , _k , x = map ( int , input ( ) . split ( ) ) balls = [ int ( c ) for c in input ( ) . split ( ) ]   ans = 0 i = 0 while i < n - 1 : if balls [ i ] == x and balls [ i + 1 ] == x : conf = balls [ : i ] conf . append ( x ) conf += balls [ i : ] ans = max ( ans , count ( conf ) ) while i < n - 1 and balls [ i ] == x : i += 1   i += 1   print ( ans )     if __name__ == \" _ _ main _ _ \" : main ( ) NEW_LINE", "import osimport sysfrom io import BytesIO , IOBase   BUFSIZE = 8192     class FastIO ( IOBase ) : newlines = 0   def __init__ ( self , file ) : self . _fd = file . fileno ( ) self . buffer = BytesIO ( ) self . writable = \" x \" in file . mode or \" r \" not in file . mode self . write = self . buffer . write if self . writable else None   def read ( self ) : while True : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) if not b : break ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines = 0 return self . buffer . read ( )   def readline ( self ) : while self . newlines == 0 : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) self . newlines = b . count ( b \" \\n \" ) + ( not b ) ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines -= 1 return self . buffer . readline ( )   def flush ( self ) : if self . writable : os . write ( self . _fd , self . buffer . getvalue ( ) ) self . buffer . truncate ( 0 ) , self . buffer . seek ( 0 )     class IOWrapper ( IOBase ) : def __init__ ( self , file ) : self . buffer = FastIO ( file ) self . flush = self . buffer . flush self . writable = self . buffer . writable self . write = lambda s : self . buffer . write ( s . encode ( \" ascii \" ) ) self . read = lambda : self . buffer . read ( ) . decode ( \" ascii \" ) self . readline = lambda : self . buffer . readline ( ) . decode ( \" ascii \" )     sys . stdin , sys . stdout = IOWrapper ( sys . stdin ) , IOWrapper ( sys . stdout ) input = lambda : sys . stdin . readline ( ) . rstrip ( \" \\n \" ) NEW_LINE" ]
codeforces_685_A
[ "import java . io . * ; import java . util . * ;   public class CF685A { static int digits ( int n ) { return n == 0 ? 0 : 1 + digits ( n / 7 ) ; } static int power ( int k ) { return k == 0 ? 1 : 7 * power ( k - 1 ) ; } static boolean [ ] used = new boolean [ 7 ] ; static boolean valid ( int n , int k ) { for ( int d = 0 ; d < 7 ; d ++ ) used [ d ] = false ; for ( int i = 0 ; i < k ; i ++ ) { int d = n % 7 ; if ( used [ d ] ) return false ; used [ d ] = true ; n /= 7 ; } return true ; } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int m = Integer . parseInt ( st . nextToken ( ) ) ; int kn = n == 1 ? 1 : digits ( n - 1 ) ; int km = m == 1 ? 1 : digits ( m - 1 ) ; int k = kn + km ; if ( k > 7 ) { System . out . println ( 0 ) ; return ; } int M = power ( km ) ; int cnt = 0 ; for ( int n_ = 0 ; n_ < n ; n_ ++ ) for ( int m_ = 0 ; m_ < m ; m_ ++ ) { int nm = n_ * M + m_ ; if ( valid ( nm , k ) ) cnt ++ ; } System . out . println ( cnt ) ; } }" ]
[ "from itertools import permutations   n , m = map ( int , input ( ) . split ( ) )   def S ( x ) : if x == 0 : return 1 res = 0 while x > 0 : x //= 7 res += 1 return res     a , b = S ( n - 1 ) , S ( m - 1 )   if a + b > 7 : print ( 0 ) exit ( )   D = list ( range ( 7 ) )   res = 0   for v in permutations ( D , a ) :   x = 0 for i in range ( a ) : x = 7 * x + v [ i ]   if x >= n : continue   R = [ d for d in D if d not in v ]   for u in permutations ( R , b ) : y = 0 for i in range ( b ) : y = 7 * y + u [ i ]   res += y < m   print ( res ) NEW_LINE", "from itertools import permutationsdef findPow ( num ) : ans = 1 num = num // 7 while num > 0 : num //= 7 ans += 1 return ansa , b = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] x = findPow ( a - 1 ) y = findPow ( b - 1 ) ans = 0 if ( x + y ) > 7 : ans = 0 else : for i in permutations ( '0123456' , x + y ) : s = ' ' . join ( list ( i ) ) p , q = int ( s [ : x ] , 7 ) , int ( s [ x : ] , 7 ) if p <= a - 1 and q <= b - 1 : ans += 1   print ( ans ) NEW_LINE", "import mathimport sysfrom bisect import bisect_right , bisect_left , insort_rightfrom collections import Counter , defaultdictfrom heapq import heappop , heappushfrom itertools import accumulate , permutations , combinationsfrom sys import stdout   R = lambda : map ( int , input ( ) . split ( ) ) n , m = R ( ) nc , mc = n , mn -= 1 m -= 1 a = b = 0 while n : n //= 7 a += 1 while m : m //= 7 b += 1 a , b = max ( 1 , a ) , max ( 1 , b ) if a + b > 7 : print ( 0 ) else : res = 0 bs = [ 1 ] whole = [ 0 , 1 , 2 , 3 , 4 , 5 , 6 ] for i in range ( 10 ) : bs . append ( bs [ - 1 ] * 7 ) for pa in permutations ( whole , a ) : if sum ( x * y for x , y in zip ( bs , pa ) ) < nc : for pb in permutations ( [ x for x in whole if x not in pa ] , b ) : if sum ( x * y for x , y in zip ( bs , pb ) ) < mc : res += 1 print ( res ) NEW_LINE", "from itertools import permutations as p     def length_base_7 ( ele , arr ) : if not ele : arr . append ( 0 ) return 1 length = 0 while ele : arr . append ( ele % 7 ) ele //= 7 length += 1 return length     n , m = map ( int , input ( ) . split ( ) ) n -= 1 m -= 1   n_base7 , m_base7 = [ ] , [ ] n_length , m_length = length_base_7 ( n , n_base7 ) , length_base_7 ( m , m_base7 )   n_base7 , m_base7 = n_base7 [ : : - 1 ] , m_base7 [ : : - 1 ]   combination_number = { 0 , 1 , 2 , 3 , 4 , 5 , 6 } res = 0 for i in p ( combination_number , n_length ) : if list ( i ) <= n_base7 : for j in p ( combination_number - set ( i ) , m_length ) : if list ( j ) <= m_base7 : res += 1   print ( res ) NEW_LINE" ]
codeforces_716_A
[ "import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; } int words = 1 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( a [ i + 1 ] - a [ i ] <= c ) words ++ ; else words = 1 ; } System . out . println ( words ) ;    } }", "import java . io . * ; import java . util . * ;   public class submission { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ;   List < Integer > t = new ArrayList < > ( n ) ; for ( int i = 0 ; i < n ; i ++ ) { t . add ( scanner . nextInt ( ) ) ; }   int ans = 0 ;   for ( int i = 0 ; i < n - 1 ; ++ i ) { if ( t . get ( i + 1 ) - t . get ( i ) <= c ) { ans ++ ; } else { ans = 0 ; } } ans ++ ; System . out . println ( ans ) ;   scanner . close ( ) ; } }", "import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int total = 0 ; int prev = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int curr = sc . nextInt ( ) ; if ( curr - prev > c ) total = 1 ; else total ++ ; prev = curr ; } System . out . println ( total ) ; } }  ", "import java . util . Scanner ; import java . util . StringTokenizer ;   public class CrazyComputer { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String line1 = scanner . nextLine ( ) ;   StringTokenizer tokenizer = new StringTokenizer ( line1 ) ; int n = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int m = Integer . parseInt ( tokenizer . nextToken ( ) ) ;   int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; }   int lastItem = arr [ n - 1 ] ; int count = 1 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( Math . abs ( arr [ i ] - lastItem ) <= m ) { count ++ ; lastItem = arr [ i ] ; } else { break ; } }   System . out . println ( count ) ; } }" ]
[ "n , c = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) t = 1 p = l [ 0 ] for i in l [ 1 : ] : if i - p > c : t = 1 else : t += 1 p = iprint ( t ) NEW_LINE", "def string_to_list ( s , char ) : collector = \" \" output_list = [ ] for i in range ( len ( s ) ) : if s [ i ] != char : collector += s [ i ] if i == len ( s ) - 1 : output_list . append ( int ( collector ) ) else : output_list . append ( int ( collector ) ) collector = \" \" return output_list     NEW_LINE", "n , c = map ( int , input ( ) . split ( ) ) l = [ ] l . extend ( map ( int , input ( ) . split ( ) ) )   c1 = 1 for i in range ( n - 1 ) : if l [ i + 1 ] - l [ i ] <= c : c1 += 1 else : c1 = 1   print ( c1 ) NEW_LINE", "n , x = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) c = 0 for i in range ( 1 , n ) : if ( ( a [ i ] - a [ i - 1 ] ) <= x ) : c = c + 1 else : c = 0 print ( c + 1 ) NEW_LINE", "n , c = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) ans = 1 for i in range ( n - 1 ) : if arr [ i + 1 ] - arr [ i ] <= c : ans += 1 else : ans = 1 print ( ans ) NEW_LINE" ]
codeforces_1469_B
[ "import java . util . * ; import java . awt . Point ; import java . lang . Math ; import java . util . Arrays ; import java . util . Scanner ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . OutputStream ; import java . util . Comparator ; import java . math . BigInteger ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . stream . IntStream ; import java . io . IOException ; import java . util . ArrayList ; import java . math . BigInteger ; import java . util . Collections ; import java . util . StringTokenizer ; public class S { public static void main ( String [ ] args ) throws java . lang . Exception { FastScanner in = new FastScanner ( ) ; int t = in . ni ( ) ; while ( t -- > 0 ) { int n = in . ni ( ) ; int r [ ] = in . ria ( n ) ; int m = in . ni ( ) ; int b [ ] = in . ria ( m ) ; int i = 0 , j = 0 , max = 0 , sum = 0 ; int max1 = 0 , max2 = 0 , sum1 = 0 , sum2 = 0 ; for ( i = 0 ; i < n ; i ++ ) { sum1 += r [ i ] ; max1 = Math . max ( max1 , sum1 ) ; } for ( i = 0 ; i < m ; i ++ ) { sum2 += b [ i ] ; max2 = Math . max ( max2 , sum2 ) ; } max = max1 + max2 ; System . out . println ( max ) ; } }  ", "import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) {", "import java . util . Scanner ;   public class B1469 {   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 maxR = 0 ; int sum = 0 ; for ( int n = 0 ; n < N ; n ++ ) { int r = in . nextInt ( ) ; sum += r ; maxR = Math . max ( maxR , sum ) ; } int maxB = 0 ; sum = 0 ; int M = in . nextInt ( ) ; for ( int m = 0 ; m < M ; m ++ ) { int b = in . nextInt ( ) ; sum += b ; maxB = Math . max ( maxB , sum ) ; } int answer = maxR + maxB ; System . out . println ( answer ) ; } }   }", "import java . util . * ; public class anb { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; int i , j ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; int a [ ] = new int [ n ] ; int ar [ ] = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; if ( i != 0 ) ar [ i ] = ar [ i - 1 ] + a [ i ] ; else ar [ i ] = a [ i ] ; } int m = in . nextInt ( ) ; int b [ ] = new int [ m ] ; int br [ ] = new int [ m ] ; for ( i = 0 ; i < m ; i ++ ) { b [ i ] = in . nextInt ( ) ; if ( i != 0 ) br [ i ] = br [ i - 1 ] + b [ i ] ; else br [ i ] = b [ i ] ; } int max1 = 0 , max2 = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( ar [ i ] > max1 ) max1 = ar [ i ] ; } for ( i = 0 ; i < m ; i ++ ) { if ( br [ i ] > max2 ) max2 = br [ i ] ; } System . out . println ( max1 + max2 ) ; } } }" ]
[ "def check ( a1 , a2 ) : m1 = 0 NEW_LINE c1 = 0 NEW_LINE for i in range ( 0 , len ( a1 ) ) : c1 = c1 + a1 [ i ] NEW_LINE m1 = max ( m1 , c1 ) NEW_LINE sum = m1 NEW_LINE m1 = 0 NEW_LINE c1 = 0 NEW_LINE for i in range ( 0 , len ( a2 ) ) : c1 = c1 + a2 [ i ] NEW_LINE m1 = max ( m1 , c1 ) NEW_LINE sum += m1 NEW_LINE return sum     for _ in range ( int ( input ( ) ) ) : x = int ( input ( ) ) NEW_LINE a1 = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE y = int ( input ( ) ) NEW_LINE a2 = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE k = ( check ( a1 , a2 ) ) NEW_LINE print ( k ) NEW_LINE", "def solver ( n , m , red , blue ) : ans = 0 NEW_LINE r = [ 0 ] * ( n + 1 ) NEW_LINE b = [ 0 ] * ( m + 1 ) NEW_LINE for i in range ( n ) : r [ i + 1 ] += r [ i ] + red [ i ] NEW_LINE for i in range ( m ) : b [ i + 1 ] += b [ i ] + blue [ i ] NEW_LINE ans = max ( r ) + max ( b ) NEW_LINE print ( max ( 0 , ans ) ) NEW_LINE T = int ( input ( ) ) NEW_LINE for _ in range ( T ) : n = int ( input ( ) ) NEW_LINE red = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE m = int ( input ( ) ) NEW_LINE blue = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE solver ( n , m , red , blue ) NEW_LINE", "from collections import Counterdef NEW_LINE maxSubArraySum ( a , size ) : max1 = 0 NEW_LINE ans = 0 NEW_LINE for i in a : max1 += i NEW_LINE if ( max1 > ans ) : ans = max1 NEW_LINE return anst = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE ali = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE m = int ( input ( ) ) NEW_LINE bli = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE q = maxSubArraySum ( ali , n ) NEW_LINE w = maxSubArraySum ( bli , m ) NEW_LINE", "import osimport NEW_LINE sysfrom NEW_LINE io NEW_LINE import BytesIO , IOBase     NEW_LINE def main ( ) : pass NEW_LINE     NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE r = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE m = int ( input ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE p = list ( ) NEW_LINE q = list ( ) NEW_LINE for i in range ( n ) : l = sum ( r [ : ( i + 1 ) ] ) NEW_LINE p . append ( l ) NEW_LINE for j in range ( m ) : d = sum ( b [ : ( j + 1 ) ] ) NEW_LINE q . append ( d ) NEW_LINE a = max ( p ) NEW_LINE b = max ( q ) NEW_LINE print ( max ( 0 , a ) + max ( 0 , b ) ) NEW_LINE" ]
codeforces_985_B
[ "import java . util . ArrayList ; import java . util . Scanner ;   public class testD { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int i , j ; i = input . nextInt ( ) ; j = input . nextInt ( ) ; ArrayList < String > m = new ArrayList < String > ( ) ; input . nextLine ( ) ; for ( int k = 0 ; k < i ; k ++ ) { m . add ( input . nextLine ( ) ) ; }   ArrayList < Integer > light = new ArrayList < Integer > ( ) ; for ( int k = 0 ; k < j ; k ++ ) { light . add ( 0 ) ; }   for ( int k = 0 ; k < m . size ( ) ; k ++ ) { for ( int l = 0 ; l < j ; l ++ ) { if ( m . get ( k ) . charAt ( l ) == '1' ) { light . set ( l , light . get ( l ) + 1 ) ; } } } for ( int k = 0 ; k < i ; k ++ ) { if ( is ( light , j , m , k ) ) { System . out . println ( \" YES \" ) ; return ; } } System . out . println ( \" NO \" ) ; }   public static Boolean is ( ArrayList < Integer > light , int lightnum , ArrayList < String > button , int buttonnum ) { for ( int j = 0 ; j < lightnum ; j ++ ) { if ( button . get ( buttonnum ) . charAt ( j ) == '1' ) { if ( light . get ( j ) - 1 == 0 ) { return false ; } } } return true ; } }  ", "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 SwitchesAndLamps {   public static void main ( String [ ] args ) {   InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader sc = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Solver solver = new Solver ( ) ;", "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . nextLine ( ) ; String [ ] str = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { str [ i ] = sc . nextLine ( ) ; } boolean flag1 , flag2 ; for ( int i = 0 ; i < n ; i ++ ) { flag2 = true ; for ( int j = 0 ; j < m ; j ++ ) { if ( str [ i ] . charAt ( j ) == '1' ) { flag1 = false ; for ( int k = 0 ; k < n ; k ++ ) { if ( str [ k ] . charAt ( j ) == '1' && k != i ) { flag1 = true ; break ; } } if ( ! flag1 ) flag2 = false ; } } if ( flag2 ) { System . out . println ( \" YES \" ) ; return ; } } System . out . println ( \" NO \" ) ; return ; } }  " ]
[ "n , m = map ( int , input ( ) . split ( ) ) grid = [ ] for i in range ( n ) : grid . append ( input ( ) ) cnts = [ 0 for i in range ( m ) ] for i in range ( n ) : for j in range ( m ) : cnts [ j ] += 0 if grid [ i ] [ j ] == '0' else 1 for i in range ( n ) : flag = True for j in range ( m ) : if grid [ i ] [ j ] == '1' and cnts [ j ] == 1 : flag = False break if flag : print ( ' YES ' ) exit ( 0 ) print ( ' NO ' ) NEW_LINE", "if __name__ == ' _ _ main _ _ ' : cin = input n , m = map ( int , cin ( ) . split ( ) ) s , l , f = [ [ ] for _ in range ( n ) ] , [ 0 ] * m , 0   for i in range ( n ) : t = cin ( ) for j in range ( m ) : if t [ j ] == \"1\" : l [ j ] += int ( t [ j ] ) s [ i ] . append ( j ) for i in range ( n ) : r = set ( l [ c ] - 1 for c in s [ i ] ) if not 0 in r : f = not f break print ( \" YNEOS \" [ not f : : 2 ] ) NEW_LINE", "import sys , math , itertoolsfrom collections import Counter , deque , defaultdictfrom bisect import bisect_left , bisect_right from heapq import heappop , heappush , heapify , nlargestfrom copy import deepcopymod = 10 ** 9 + 7 INF = float ( ' inf ' ) def inp ( ) : return int ( sys . stdin . readline ( ) ) def inpl ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def inpl_1 ( ) : return list ( map ( lambda x : int ( x ) - 1 , sys . stdin . readline ( ) . split ( ) ) ) def inps ( ) : return sys . stdin . readline ( ) def inpsl ( x ) : tmp = sys . stdin . readline ( ) ; return list ( tmp [ : x ] ) def err ( x ) : print ( x ) ; exit ( )   n , m = inpl ( ) s = [ inpsl ( m ) for _ in range ( n ) ] lampcnt = [ 0 ] * mfor i in range ( n ) : for j in range ( m ) : if s [ i ] [ j ] == '1' : lampcnt [ j ] += 1 res = Falsefor i in range ( n ) : only = False for j in range ( m ) : if s [ i ] [ j ] == '1' and lampcnt [ j ] == 1 : only = True if not only : res = Trueprint ( ' YES ' if res else ' NO ' ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) x = list ( list ( map ( int , input ( ) ) ) for i in range ( n ) ) res = [ 0 ] * mfor i in range ( n ) : for j in range ( m ) : res [ j ] += x [ i ] [ j ]   for i in range ( n ) : ok = 1 for j in range ( m ) : if res [ j ] == 1 and x [ i ] [ j ] == 1 : ok = 0 break if ok : print ( \" YES \" ) exit ( ) print ( \" NO \" ) NEW_LINE" ]
codeforces_1020_B
[ "   import java . io . * ; import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;    public class Main1 {   static class pair implements Comparable < pair > { int a ; int b ; public pair ( int a , int b ) { this . a = a ; this . b = b ; } @ Override public int compareTo ( pair o ) {", "import java . io . * ; import java . util . * ; import java . math . * ;   public class Main { public static void main ( String args [ ] ) throws Exception { FastScanner fs = new FastScanner ( ) ;", "  import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; StringTokenizer st ;   int N = Integer . parseInt ( in . readLine ( ) ) ; st = new StringTokenizer ( in . readLine ( ) ) ; int [ ] graph = new int [ N ] ;   for ( int i = 0 ; i < N ; i ++ ) { graph [ i ] = Integer . parseInt ( st . nextToken ( ) ) - 1 ; }   StringBuilder ans = new StringBuilder ( ) ; for ( int i = 0 ; i < N ; i ++ ) { boolean [ ] marked = new boolean [ N ] ; marked [ i ] = true ; int j = graph [ i ] ; while ( true ) { if ( marked [ j ] ) { ans . append ( j + 1 ) . append ( \" ▁ \" ) ; break ; } else { marked [ j ] = true ; } j = graph [ j ] ; } } out . println ( ans ) ;   in . close ( ) ; out . close ( ) ; }   }", "import java . io . * ; import java . util . * ;   public class badge { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N = Integer . parseInt ( br . readLine ( ) ) ; int [ ] succ = new int [ N ] ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < N ; i ++ ) { succ [ i ] = Integer . parseInt ( st . nextToken ( ) ) - 1 ; } int [ ] out = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { int cur = i ; boolean [ ] seen = new boolean [ N ] ; while ( ! seen [ cur ] ) { seen [ cur ] = true ; cur = succ [ cur ] ; } out [ i ] = cur ; } PrintWriter pw = new PrintWriter ( System . out ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( out [ i ] != - 1 ) { sb . append ( ( out [ i ] + 1 ) + \" ▁ \" ) ; } else { sb . append ( ( i + 1 ) + \" ▁ \" ) ; } } if ( out [ N - 1 ] != - 1 ) { sb . append ( ( out [ N - 1 ] + 1 ) ) ; } else { sb . append ( N ) ; } pw . println ( sb . toString ( ) ) ; pw . close ( ) ; } }" ]
[ "n = int ( input ( ) ) a1 = [ 0 ] + [ int ( x ) for x in input ( ) . strip ( ) . split ( \" ▁ \" ) ]   out = [ ]   for i in range ( 1 , n + 1 ) : a = a1 . copy ( ) j = a [ i ] NEW_LINE", "import functoolsimport timefrom collections import Counter   def timer ( func ) : @ functools . wraps ( func ) def wrapper ( * args , ** kwargs ) : stime = time . perf_counter ( ) res = func ( * args , ** kwargs ) elapsed = time . perf_counter ( ) - stime print ( f \" { func . _ _ name _ _ } ▁ in ▁ { elapsed : .4f } ▁ secs \" ) return res return wrapper   class solver : NEW_LINE", "n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) ans = [ ] for start in range ( n ) : holes = [ 0 for i in range ( n ) ] holes [ start ] = 1 cur = start while max ( holes ) != 2 : holes [ p [ cur ] - 1 ] += 1 cur = p [ cur ] - 1 ans . append ( cur + 1 )   print ( ' ▁ ' . join ( list ( map ( str , ans ) ) ) ) NEW_LINE", "n = int ( input ( ) ) d = dict ( zip ( range ( 1 , n + 1 ) , map ( int , input ( ) . split ( ) ) ) ) ans = [ 0 ] * nfor i in d : node = i s = set ( ) while node not in s : s . add ( node ) node = d [ node ] ans [ i - 1 ] = node   print ( * ans )   NEW_LINE", "def badge ( arr , n ) : \"\"\" ▁ DFS ▁ approach ▁ to ▁ check ▁ if ▁ we ▁ visit ▁ a ▁ node ▁ twice \"\"\"   NEW_LINE" ]
codeforces_840_B
[ "import java . io . * ; import java . util . * ; import java . util . concurrent . TimeUnit ;   public class b429 implements Runnable { public static void main ( String [ ] args ) { try { new Thread ( null , new b429 ( ) , \" process \" , 1 << 26 ) . start ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } public void run ( ) { FastReader scan = new FastReader ( ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ;" ]
[ "import sys   n , m = map ( int , sys . stdin . readline ( ) . split ( ) ) d = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) gph = [ [ ] for _ in range ( n ) ]   for _ in range ( m ) : u , v = map ( int , sys . stdin . readline ( ) . split ( ) ) u -= 1 v -= 1 gph [ u ] . append ( ( v , _ ) ) gph [ v ] . append ( ( u , _ ) ) t = - 1 if d . count ( 1 ) % 2 == 1 : if - 1 not in d : print ( - 1 ) exit ( 0 ) t = d . index ( - 1 )   ans = [ False ] * mvis = [ False ] * ned = [ ( - 1 , - 1 ) ] * nrets = [ ( d [ u ] == 1 ) or ( u == t ) for u in range ( n ) ]   stk = [ [ 0 , iter ( gph [ 0 ] ) ] ] while len ( stk ) > 0 : u = stk [ - 1 ] [ 0 ] vis [ u ] = True try : while True : v , i = next ( stk [ - 1 ] [ 1 ] ) if not vis [ v ] : ed [ v ] = ( u , i ) stk . append ( [ v , iter ( gph [ v ] ) ] ) break except StopIteration : p , e = ed [ u ] if p >= 0 and rets [ u ] : rets [ p ] = not rets [ p ] ans [ e ] = True stk . pop ( ) pass print ( ans . count ( True ) ) print ( \" \\n \" . join ( [ str ( i + 1 ) for i in range ( m ) if ans [ i ] ] ) ) NEW_LINE" ]
codeforces_628_B
[ "import java . util . * ; import java . io . * ; import java . math . * ;   public class First {   public static void process ( ) throws IOException { char ch [ ] = nln ( ) . trim ( ) . toCharArray ( ) ; HashSet < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i <= 96 ; i += 4 ) { String x = Integer . toString ( i ) ; if ( i < 10 ) { x = \"0\" + x ; } set . add ( x ) ; } long count = 0l ; int n = ch . length ; for ( int i = 0 ; i < n ; i ++ ) { if ( i == 0 ) { if ( ch [ i ] == '0' || ch [ i ] == '4' || ch [ i ] == '8' ) {", "import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . nextLine ( ) . toCharArray ( ) ; long sum = 0 ; for ( int i = 0 ; i < s . length ; ++ i ) { if ( ( s [ i ] - '0' ) % 4 == 0 ) { ++ sum ; } } for ( int i = 1 ; i < s . length ; ++ i ) { int x = ( s [ i - 1 ] - '0' ) * 10 + ( s [ i ] - '0' ) ; if ( x % 4 == 0 ) { sum += i ; } } System . out . println ( sum ) ; } }", "import java . io . * ;   public class NewSkateboard { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   String number = input . readLine ( ) ; int n = number . length ( ) ;   input . close ( ) ;   long [ ] dp = new long [ n + 1 ] ; dp [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int lastDigit = number . charAt ( i - 1 ) - '0' ; int lastTwoDigits = - 1 ; if ( i >= 2 ) { lastTwoDigits = ( number . charAt ( i - 2 ) - '0' ) * 10 + lastDigit ; }   dp [ i ] = dp [ i - 1 ] ; if ( lastDigit % 4 == 0 ) { dp [ i ] ++ ; }   if ( lastTwoDigits % 4 == 0 ) { dp [ i ] += ( i - 1 ) ; } }   PrintWriter output = new PrintWriter ( System . out ) ; output . println ( dp [ n ] ) ; output . close ( ) ; } }", "import java . lang . * ; import java . util . * ; import java . io . * ;   public class pblm2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long count = 0 ; int l = s . length ( ) ; for ( int i = l - 1 ; i >= 0 ; i -- ) { if ( Integer . parseInt ( s . charAt ( i ) + \" \" ) % 4 == 0 ) count ++ ; if ( i > 0 ) { String k = s . charAt ( i - 1 ) + \" \" + s . charAt ( i ) + \" \" ;", "import java . io . * ; import java . util . * ; public class Asd { static PrintWriter w = new PrintWriter ( System . out ) ; static FastScanner s = new FastScanner ( ) ;   public static void main ( String [ ] args ) {" ]
[ "import sysimport os . pathif os . path . exists ( ' input . txt ' ) : sys . stdin = open ( ' input . txt ' , ' r ' ) sys . stdout = open ( ' output . txt ' , ' w ' ) s = input ( ) n = len ( s ) ans = 0 for i in range ( n - 2 , - 1 , - 1 ) : if int ( s [ i ] + s [ i + 1 ] ) % 4 == 0 : ans += i + 1 for i in range ( n ) : if int ( s [ i ] ) % 4 == 0 : ans = ans + 1 print ( ans ) NEW_LINE", "s = input ( ) n = len ( s ) ans = 0 for i in range ( 1 , n ) : if int ( s [ i - 1 : i + 1 ] ) % 4 == 0 : ans += ifor i in range ( n ) : if int ( s [ i ] ) % 4 == 0 : ans += 1 print ( ans ) NEW_LINE", "s = input ( ) ans = 0 for i in range ( len ( s ) ) : if ( i != len ( s ) - 1 ) : if ( int ( s [ i ] + s [ i + 1 ] ) % 4 == 0 ) : ans += i + 1 NEW_LINE" ]
codeforces_1467_B
[ "import java . io . * ; import java . util . * ; import java . math . * ;   public class B { public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Random ; import java . util . StringTokenizer ;   public class HillAndValleys {    public static int HV ( int [ ] a ) {   int n = a . length ; int mask [ ] = new int [ n ] ;" ]
[ "import osimport NEW_LINE sysfrom NEW_LINE io NEW_LINE import BytesIO , IOBase     NEW_LINE def main ( ) : pass NEW_LINE     NEW_LINE", "def is_hv ( i ) : if NEW_LINE i == 0 or i == n - 1 : NEW_LINE return 0 else : if a [ i ] > a [ i - 1 ] and a [ i ] > a [ i + 1 ] : NEW_LINE INDENT return 1 elif a [ i ] < a [ i - 1 ] and a [ i ] < a [ i + 1 ] : NEW_LINE return 1 else : NEW_LINE return 0 NEW_LINE DEDENT for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE hv = [ 0 ] * n NEW_LINE for i in range ( 1 , n - 1 ) : if NEW_LINE is_hv ( i ) == 1 : hv [ i ] = 1 NEW_LINE s = sum ( hv ) NEW_LINE result = s NEW_LINE for i in range ( n ) : if NEW_LINE hv [ i ] == 1 : t = a [ i ] NEW_LINE for e in [ a [ i - 1 ] , a [ i + 1 ] ] : a [ i ] = e NEW_LINE result = min ( is_hv ( i - 1 ) + is_hv ( i + 1 ) + s - hv [ i - 1 ] - hv [ i + 1 ] - 1 , result ) NEW_LINE a [ i ] = t NEW_LINE print ( result ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ]   hills_and_valleys = [ 0 ] * n NEW_LINE for ind in range ( 1 , n - 1 ) : if NEW_LINE a [ ind - 1 ] < a [ ind ] and a [ ind + 1 ] < a [ ind ] or a [ ind - 1 ] > a [ ind ] and a [ ind + 1 ] > a [ ind ] : hills_and_valleys [ ind ] = 1   sum_of_hills_and_valleys = sum ( hills_and_valleys )   NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ]   hills_and_valleys = [ 0 ] * n NEW_LINE for ind in range ( 1 , n - 1 ) : if NEW_LINE a [ ind - 1 ] < a [ ind ] and a [ ind + 1 ] < a [ ind ] or a [ ind - 1 ] > a [ ind ] and a [ ind + 1 ] > a [ ind ] : hills_and_valleys [ ind ] = 1   sum_of_hills_and_valleys = sum ( hills_and_valleys )   if n >= 2 : NEW_LINE INDENT left_num_and_right_num = [ [ a [ 0 ] , a [ 1 ] ] ] else : NEW_LINE left_num_and_right_num = [ [ a [ 0 ] , a [ 0 ] ] ]   for ind in range ( 1 , n - 1 ) : left_num_and_right_num . append ( [ a [ ind - 1 ] , a [ ind + 1 ] ] )   if n >= 2 : left_num_and_right_num . append ( [ a [ - 2 ] , a [ - 1 ] ] )   num_of_deleted_ones = 0 NEW_LINE DEDENT for ind in range ( 1 , n - 1 ) : if NEW_LINE hills_and_valleys [ ind - 1 ] == hills_and_valleys [ ind ] == hills_and_valleys [ ind + 1 ] == 1 : num_of_deleted_ones = 3 NEW_LINE break elif hills_and_valleys [ ind ] == 1 : ones = sum ( hills_and_valleys [ ind - 1 : ind + 2 ] )   if a [ ind - 1 ] < a [ ind + 1 ] > left_num_and_right_num [ ind + 1 ] [ 1 ] or \\ a [ ind - 1 ] > a [ ind + 1 ] < left_num_and_right_num [ ind + 1 ] [ 1 ] : num_of_deleted_ones = max ( num_of_deleted_ones , ones - 1 ) else : NEW_LINE INDENT num_of_deleted_ones = max ( num_of_deleted_ones , ones )   if left_num_and_right_num [ ind - 1 ] [ 0 ] < a [ ind - 1 ] > a [ ind + 1 ] or \\ left_num_and_right_num [ ind - 1 ] [ 0 ] > a [ ind - 1 ] < a [ ind + 1 ] : num_of_deleted_ones = max ( num_of_deleted_ones , ones - 1 ) else : NEW_LINE num_of_deleted_ones = max ( num_of_deleted_ones , ones )   print ( sum_of_hills_and_valleys - num_of_deleted_ones ) NEW_LINE DEDENT" ]
codeforces_1462_B
[ "import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int t = scn . nextInt ( ) ; while ( t -- > 0 ) { int n = scn . nextInt ( ) ; String str = scn . next ( ) ; if ( str . equals ( \"2020\" ) ) { System . out . println ( \" YES \" ) ; continue ; } if ( str . substring ( 0 , 4 ) . equals ( \"2020\" ) || str . substring ( n - 4 , n ) . equals ( \"2020\" ) ) { System . out . println ( \" YES \" ) ; continue ; } if ( ( str . substring ( 0 , 3 ) + str . substring ( n - 1 , n ) ) . equals ( \"2020\" ) || ( str . substring ( 0 , 2 ) + str . substring ( n - 2 , n ) ) . equals ( \"2020\" ) || ( str . subSequence ( 0 , 1 ) + str . substring ( n - 3 , n ) ) . equals ( \"2020\" ) ) { System . out . println ( \" YES \" ) ; continue ; } System . out . println ( \" NO \" ) ; } } }", "import java . util . * ; public class lastyear { public static void main ( String [ ] args ) { int t , n , i ;   String s = \" \" ;   Scanner sc = new Scanner ( System . in ) ;   t = sc . nextInt ( ) ;   while ( t -- > 0 ) { n = sc . nextInt ( ) ; s = sc . next ( ) ;   if ( s . startsWith ( \"2020\" ) || s . endsWith ( \"2020\" ) || ( s . startsWith ( \"2\" ) && s . endsWith ( \"020\" ) ) || ( s . startsWith ( \"20\" ) && s . endsWith ( \"20\" ) ) || ( s . startsWith ( \"202\" ) && s . endsWith ( \"0\" ) ) ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } }   }   }  ", "import java . util . * ; import java . util . regex . * ; import java . io . * ;   public class Solution {  ", "import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = in . nextInt ( ) ; char [ ] s = in . next ( ) . toCharArray ( ) ; if ( s [ 0 ] == '2' && s [ 1 ] == '0' && s [ n - 2 ] == '2' && s [ n - 1 ] == '0' ) { System . out . println ( \" YES \" ) ; } else if ( s [ 0 ] == '2' && s [ n - 3 ] == '0' && s [ n - 2 ] == '2' && s [ n - 1 ] == '0' ) { System . out . println ( \" YES \" ) ; } else if ( s [ 0 ] == '2' && s [ 1 ] == '0' && s [ 2 ] == '2' && s [ n - 1 ] == '0' ) { System . out . println ( \" YES \" ) ; } else if ( s [ 0 ] == '2' && s [ 1 ] == '0' && s [ 2 ] == '2' && s [ 3 ] == '0' ) { System . out . println ( \" YES \" ) ; } else if ( s [ n - 4 ] == '2' && s [ n - 3 ] == '0' && s [ n - 2 ] == '2' && s [ n - 1 ] == '0' ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } } }  ", "import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { long i , t ; Scanner sc = new Scanner ( System . in ) ; t = sc . nextLong ( ) ; for ( i = 1 ; i <= t ; i ++ ) { int n ; String s ; n = sc . nextInt ( ) ; s = sc . next ( ) ; if ( s . charAt ( 0 ) == '2' && s . charAt ( 1 ) == '0' && s . charAt ( 2 ) == '2' && s . charAt ( 3 ) == '0' ) { System . out . println ( \" yes \" ) ; } else if ( s . charAt ( n - 4 ) == '2' && s . charAt ( n - 3 ) == '0' && s . charAt ( n - 2 ) == '2' && s . charAt ( n - 1 ) == '0' ) { System . out . println ( \" yes \" ) ; } else if ( s . charAt ( 0 ) == '2' && s . charAt ( 1 ) == '0' && s . charAt ( 2 ) == '2' && s . charAt ( n - 1 ) == '0' ) { System . out . println ( \" yes \" ) ; } else if ( s . charAt ( 0 ) == '2' && s . charAt ( 1 ) == '0' && s . charAt ( n - 2 ) == '2' && s . charAt ( n - 1 ) == '0' ) { System . out . println ( \" yes \" ) ; } else if ( s . charAt ( 0 ) == '2' && s . charAt ( n - 3 ) == '0' && s . charAt ( n - 2 ) == '2' && s . charAt ( n - 1 ) == '0' ) { System . out . println ( \" yes \" ) ; } else { System . out . println ( \" no \" ) ; } } } }" ]
[ "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE s = input ( ) NEW_LINE t = [ ] NEW_LINE a = s [ : 4 ] NEW_LINE t . append ( a ) NEW_LINE b = s [ - 4 ] + s [ - 3 ] + s [ - 2 ] + s [ - 1 ] NEW_LINE t . append ( b ) NEW_LINE c = s [ 0 ] + s [ - 3 ] + s [ - 2 ] + s [ - 1 ] NEW_LINE t . append ( c ) NEW_LINE d = s [ : 2 ] + s [ - 2 ] + s [ - 1 ] NEW_LINE t . append ( d ) NEW_LINE e = s [ : 3 ] + s [ - 1 ] NEW_LINE t . append ( e ) NEW_LINE if '2020' in t : NEW_LINE INDENT print ( ' YES ' ) else : NEW_LINE print ( ' NO ' ) NEW_LINE DEDENT", "t = int ( input ( ) )   for i in range ( t ) : n = list ( map ( int , input ( ) . split ( ) ) )   s = input ( )     l = len ( s ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE for x in range ( t ) : n = int ( input ( ) ) NEW_LINE s = input ( )   if ( s [ : 1 ] == \"2\" and s [ n - 3 : ] == \"020\" ) : print ( \" YES \" )   elif ( s [ : 2 ] == \"20\" and s [ n - 2 : ] == \"20\" ) : print ( \" YES \" ) elif ( s [ : 3 ] == \"202\" and s [ n - 1 : ] == \"0\" ) : print ( \" YES \" )   elif ( s [ : 4 ] == \"2020\" or s [ n - 4 : ] == \"2020\" ) : print ( \" YES \" )   else : print ( \" NO \" )   NEW_LINE", "t = int ( input ( ) )   NEW_LINE def testcase ( s ) : temp = \"2020\" NEW_LINE if s == \" \" : print ( \" NO \" ) NEW_LINE return n = len ( s ) - 4 NEW_LINE for i in range ( 5 ) : curr = s [ : i ] + s [ i + n : ] NEW_LINE if curr == temp : print ( \" YES \" ) NEW_LINE return print ( \" NO \" )   for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE s = input ( ) NEW_LINE testcase ( s ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE while t : t -= 1 NEW_LINE n = int ( input ( ) ) NEW_LINE st = input ( ) NEW_LINE if st [ 0 : 1 ] == \"2\" and st [ n - 3 : ] == \"020\" or st [ 0 : 2 ] == \"20\" and st [ n - 2 : ] == \"20\" or st [ 0 : 3 ] == \"202\" and st [ n - 1 : ] == \"0\" or st [ 0 : 4 ] == \"2020\" or st [ n - 4 : ] == \"2020\" : NEW_LINE INDENT print ( \" YES \" ) else : NEW_LINE print ( \" NO \" ) NEW_LINE DEDENT" ]
codeforces_214_A
[ "import java . util . Scanner ;   public class SystemofEquations { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int a = ( int ) Math . max ( Math . sqrt ( n ) , Math . sqrt ( m ) ) ; int b = Math . max ( m , n ) - ( int ) Math . pow ( a , 2 ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class experiment { static int M = 1_000_000_007 ; static int INF = Integer . MAX_VALUE ; static final FastScanner fs = new FastScanner ( ) ;  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class NewClass {   public static void main ( String [ ] args ) throws IOException {   BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tok = new StringTokenizer ( reader . readLine ( ) ) ; int n = Integer . parseInt ( tok . nextToken ( ) ) , m = Integer . parseInt ( tok . nextToken ( ) ) , min = Math . min ( n , m ) , count = 0 , x , y ;   for ( int i = 0 ; i <= min ; i ++ ) { for ( int j = 0 ; j <= min ; j ++ ) { x = ( int ) Math . pow ( i , 2 ) + j ; y = ( int ) Math . pow ( j , 2 ) + i ; if ( m == y && x == n ) { count ++ ; } } } System . out . println ( count ) ; } }", "import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int ans = 0 ; for ( int a = 0 ; a * a <= n && a <= m ; a ++ ) { int b = n - a * a ; if ( a + ( b * b ) == m ) { ans ++ ; } } System . out . print ( ans ) ; } }" ]
[ "  n , m = map ( int , input ( ) . split ( ) )     count = 0 for i in range ( 0 , int ( n ** ( 1 / 2 ) ) + 1 ) : for j in range ( 0 , int ( m ** ( 1 / 2 ) ) + 1 ) : if ( i ** 2 ) + j == n and i + ( j ** 2 ) == m : count += 1   print ( count ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) i = 0 c = 0 while i ** 2 <= n : if i + ( n - i ** 2 ) ** 2 == m : c += 1 i += 1 print ( c ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) count = 0 a = 0 while a ** 2 <= n : b = n - a ** 2 if b >= 0 and a + b ** 2 == m : count += 1 a += 1 print ( count ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a = 0 b = 0 pair = 0   while a <= n : while b <= m : if ( a ** 2 ) + b == n and a + ( b ** 2 ) == m : pair += 1 b += 1 a += 1 b = 0 print ( pair ) NEW_LINE" ]
codeforces_591_A
[ "import java . util . * ; public class WizardsDuel {   public static void main ( String [ ] args ) {", "import java . util . * ;   public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; double n = input . nextDouble ( ) ; double p = input . nextDouble ( ) ; double q = input . nextDouble ( ) ; System . out . printf ( Locale . UK , \" % .4f \\n \" , p * n / ( p + q ) ) ; } }", "import java . util . * ;   public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; double n = input . nextDouble ( ) ; double p = input . nextDouble ( ) ; double q = input . nextDouble ( ) ; double res = p * n / ( p + q ) ; if ( res % 1 != 0 ) System . out . printf ( Locale . UK , \" % .4f \\n \" , res ) ; else System . out . printf ( \" % d \\n \" , ( int ) res ) ; } }", "import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner S = new Scanner ( System . in ) ; int i = S . nextInt ( ) ; int v1 = S . nextInt ( ) ; int v2 = S . nextInt ( ) ;   System . out . println ( i / ( Float . parseFloat ( String . valueOf ( v2 ) ) / v1 + 1 ) ) ; } }", "import java . util . * ; public class Wizrds_Duel { public static void main ( String [ ] args ) {" ]
[ "a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) )   print ( a / ( b + c ) * b ) NEW_LINE", "l = int ( input ( ) ) p = int ( input ( ) ) q = int ( input ( ) ) c = p / ( p + q ) print ( c * l ) NEW_LINE", "l = int ( input ( ) ) p = int ( input ( ) ) q = int ( input ( ) )   time = l / ( p + q ) print ( p * time ) NEW_LINE", "s = int ( input ( ) ) p = int ( input ( ) ) q = int ( input ( ) ) print ( s * p / ( p + q ) ) NEW_LINE", "l , p , q = [ int ( input ( ) ) for _ in [ 1 , 2 , 3 ] ] print ( l * p / ( p + q ) ) NEW_LINE" ]
codeforces_1287_A
[ "import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int j = 0 ; j < n ; j ++ ) { int k = sc . nextInt ( ) ; int temp = 0 , res = 0 ; String students = sc . next ( ) ; char [ ] a = new char [ k ] ; a = students . toCharArray ( ) ; for ( int x = 0 ; x < k ; x ++ ) { a [ x ] = students . charAt ( x ) ; } for ( int i = k - 1 ; i >= 0 ; i -- ) { if ( a [ i ] == ' A ' ) { res = Math . max ( res , temp ) ; temp = 0 ; } else { temp ++ ; } } System . out . println ( res ) ; } } }", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int count = 0 , count1 = 0 ; int n = s . nextInt ( ) ; s . nextLine ( ) ; String s1 = s . nextLine ( ) ; boolean jt = false ; for ( int j = 0 ; j < s1 . length ( ) ; j ++ ) { if ( s1 . charAt ( j ) == ' A ' ) jt = true ; if ( s1 . charAt ( j ) == ' P ' && jt == true ) { count ++ ; } else { count = 0 ; } if ( count > count1 ) count1 = count ; } System . out . println ( count1 ) ; } } }", "import java . util . * ;   public class Practice {   public static void main ( String [ ] args ) {" ]
[ "t = int ( input ( ) ) for q in range ( t ) : n = int ( input ( ) ) s = input ( ) c = 0 while \" AP \" in s : s = s . replace ( \" AP \" , \" AA \" ) c += 1 print ( c ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = input ( ) . split ( ' A ' ) max1 = 0 for i in range ( 1 , len ( a ) ) : max1 = max ( max1 , len ( a [ i ] ) ) print ( max1 )     NEW_LINE", "I = inputexec ( int ( I ( ) ) * \" I ( ) ; print ( max ( 0,0 , * map ( len , I ( ) . split ( ' A ' ) [ 1 : ] ) ) ) ; \" ) 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", "x = int ( input ( ) ) for i in range ( x ) : n = int ( input ( ) ) s = input ( ) b = [ ] for j in range ( n ) : if ( s [ j ] == \" A \" ) : b . append ( j ) d = 0 if ( len ( b ) > 0 ) : for k in range ( 0 , len ( b ) - 1 ) : t = b [ k + 1 ] - b [ k ] - 1 d = max ( d , t ) if ( b [ - 1 ] != n - 1 ) : t = n - 1 - b [ - 1 ] d = max ( t , d ) print ( d ) else : print ( 0 ) NEW_LINE" ]
codeforces_793_B
[ "import java . io . * ; import java . util . * ;   public class F {", "import java . util . * ;   import javafx . util . Pair ;   import java . io . * ;   public class Main { static int [ ] dx = { 0 , 1 , 0 , - 1 } ;", "import java . io . * ; import java . util . * ; public class Main { public static IO in ; public static PrintWriter out ; static void init_io ( String filename ) throws Exception { if ( filename . equals ( \" \" ) ) { in = new IO ( System . in ) ; out = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) , true ) ; } else { in = new IO ( new FileInputStream ( filename + \" . in \" ) ) ; out = new PrintWriter ( new BufferedWriter ( new FileWriter ( filename + \" . out \" ) ) , true ) ; } } final static long mod = 1000000007 ; static int n , m ; static int pack ( int r , int c , int dir , int nturns ) { return r * m * 12 + c * 12 + dir * 3 + nturns ; } static int pack2 ( int pos , int dir , int nturns ) { return pos * 12 + dir * 3 + nturns ; } static int dr [ ] = new int [ ] { 0 , 0 , - 1 , 1 } ; static int dc [ ] = new int [ ] { 1 , - 1 , 0 , 0 } ; static boolean valid ( int r , int c ) { return r >= 0 && r < n && c >= 0 && c < m ; } static void solve ( int tc ) throws Exception { n = in . nint ( ) ; m = in . nint ( ) ; boolean [ ] [ ] grid = new boolean [ n ] [ m ] ; boolean [ ] vis = new boolean [ n * m * 12 ] ; int spos = 0 , tpos = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String s = in . nstr ( ) ; for ( int j = 0 ; j < m ; j ++ ) { if ( s . charAt ( j ) == ' S ' ) spos = i * m + j ; if ( s . charAt ( j ) == ' T ' ) tpos = i * m + j ; grid [ i ] [ j ] = ( s . charAt ( j ) != ' * ' ) ; } } int [ ] queue = new int [ 15000000 ] ;" ]
[ "n , m = map ( int , input ( ) . split ( ) ) mat = [ ] ans = - 1 for i in range ( n ) : mat . append ( input ( ) )   s , d = - 1 , - 1 for i in range ( n ) : for j in range ( m ) : if mat [ i ] [ j ] == ' S ' : s = ( i , j ) if mat [ i ] [ j ] == ' T ' : d = ( i , j )   q = [ ( s [ 0 ] , s [ 1 ] , - 1 , - 1 ) ] vis = [ 0 ] * ( n * m ) pos = 0 found = False   tmp = [ ( 0 , 1 , 1 ) , ( 0 , - 1 , 1 ) , ( 1 , 0 , 0 ) , ( - 1 , 0 , 0 ) ] for a , b , c in tmp : x , y = d while x < n and x >= 0 and y < m and y >= 0 and not mat [ x ] [ y ] == ' * ' : vis [ x * m + y ] = - 1 x += a y += b NEW_LINE", "from typing import List , Set , Dictdef map2home ( n : int , m : int , map_in : List [ List [ str ] ] , turns : int ) -> List [ list ] : def validate ( i , j ) : return True if 0 <= i < n and 0 <= j < m and map_in [ i ] [ j ] != - 1 else False   def check ( i , j , count ) : if end == ( i , j ) : return 1 if count <= turns else - 1 else : return 0 NEW_LINE", "import sysinput = sys . stdin . readline   def q ( sx , sy , gx , gy ) : for i in range ( sx , gx + 1 ) : for j in range ( sy , gy + 1 ) : if S [ i ] [ j ] == ' * ' : return False return True   n , m = map ( int , input ( ) . split ( ) ) S = [ input ( ) [ : - 1 ] for _ in range ( n ) ]   for i in range ( n ) : for j in range ( m ) : if S [ i ] [ j ] == ' S ' : Sx , Sy = i , j if S [ i ] [ j ] == ' T ' : Tx , Ty = i , j   for i in range ( n ) : if q ( min ( i , Sx ) , Sy , max ( i , Sx ) , Sy ) and q ( i , min ( Sy , Ty ) , i , max ( Sy , Ty ) ) and q ( min ( i , Tx ) , Ty , max ( i , Tx ) , Ty ) : print ( ' YES ' ) exit ( )   for i in range ( m ) : if q ( Sx , min ( i , Sy ) , Sx , max ( i , Sy ) ) and q ( min ( Sx , Tx ) , i , max ( Sx , Tx ) , i ) and q ( Tx , min ( i , Ty ) , Tx , max ( i , Ty ) ) : print ( ' YES ' ) exit ( )   print ( ' NO ' ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a = [ ] x , y = 0 , 0     def f ( c , x , y ) : for i in range ( x + 1 , n ) : if a [ i ] [ y ] == ' T ' : print ( ' YES ' ) exit ( ) if a [ i ] [ y ] == ' . ' : a [ i ] [ y ] = c elif a [ i ] [ y ] != c : break for i in range ( x - 1 , - 1 , - 1 ) : if a [ i ] [ y ] == ' T ' : print ( ' YES ' ) exit ( ) if a [ i ] [ y ] == ' . ' : a [ i ] [ y ] = c elif a [ i ] [ y ] != c : break for j in range ( y + 1 , m ) : if a [ x ] [ j ] == ' T ' : print ( ' YES ' ) exit ( ) if a [ x ] [ j ] == ' . ' : a [ x ] [ j ] = c elif a [ x ] [ j ] != c : break for j in range ( y - 1 , - 1 , - 1 ) : if a [ x ] [ j ] == ' T ' : print ( ' YES ' ) exit ( ) if a [ x ] [ j ] == ' . ' : a [ x ] [ j ] = c elif a [ x ] [ j ] != c : break     for i in range ( n ) : s = input ( ) for j in range ( m ) : if s [ j ] == ' S ' : x , y = i , j a . append ( list ( s ) ) f ( '1' , x , y ) for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] == '1' : f ( '2' , i , j ) for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] == '2' : f ( '3' , i , j ) print ( ' NO ' )     NEW_LINE" ]
codeforces_255_B
[ "import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; StringBuilder s = new StringBuilder ( input . next ( ) ) ; StringBuilder ans = new StringBuilder ( ) ; int x = 0 ; int y = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' x ' ) x ++ ; else y ++ ; } int max = Math . max ( x , y ) ; int min = Math . min ( x , y ) ; if ( max == x ) for ( int i = 0 ; i < ( max - min ) ; i ++ ) { ans . append ( \" x \" ) ; } else for ( int i = 0 ; i < ( max - min ) ; i ++ ) { ans . append ( \" y \" ) ; } System . out . println ( ans ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class CodeParsing {   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 x = 0 ; int y = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' x ' ) { x ++ ; } else { y ++ ; } } int m = Math . abs ( x - y ) ; char a ; StringBuilder sb = new StringBuilder ( ) ; if ( x > y ) { a = ' x ' ; } else { a = ' y ' ; } for ( int i = 0 ; i < m ; i ++ ) { sb . append ( a ) ; } System . out . println ( sb . toString ( ) ) ; }   }", "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 codeParsing { 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 count_x = 0 ; int count_y = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' x ' ) { count_x ++ ; } else { count_y ++ ; } }   StringBuilder ans = new StringBuilder ( ) ; int k = 0 ; char c ; if ( count_x > count_y ) { c = ' x ' ; k = count_x - count_y ; } else { c = ' y ' ; k = count_y - count_x ; } while ( k -- > 0 ) { ans . append ( c ) ; } System . out . println ( ans ) ; } }", "import java . util . Arrays ; import java . util . Scanner ;   public class B255 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int x = 0 ; int y = 0 ; for ( char c : in . next ( ) . toCharArray ( ) ) { if ( c == ' x ' ) { x ++ ; } else { y ++ ; } } char [ ] array ; if ( x >= y ) { x -= y ; array = new char [ x ] ; Arrays . fill ( array , ' x ' ) ; } else { y -= x ; array = new char [ y ] ; Arrays . fill ( array , ' y ' ) ; } System . out . println ( new String ( array ) ) ; }   }", "import java . util . Scanner ;   public class CodeParsing {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] c = sc . next ( ) . toCharArray ( ) ; int x = 0 , y = 0 ; for ( char ch : c ) { if ( ch == ' x ' ) x ++ ; else y ++ ; } StringBuilder ans = new StringBuilder ( ) ; int left ; left = Math . abs ( x - y ) ; char ansChar = x > y ? ' x ' : ' y ' ; while ( left -- > 0 ) ans . append ( ansChar ) ; System . out . println ( ans . toString ( ) ) ; sc . close ( ) ; } }" ]
[ "L = input ( )     s1 = L . count ( \" x \" ) s2 = L . count ( \" y \" ) x = max ( s1 , s2 ) v = abs ( s1 - s2 ) if x == L . count ( \" x \" ) : print ( \" x \" * v ) else : print ( \" y \" * v ) NEW_LINE", "n = input ( ) stack = [ ] for i in n : if stack == [ ] : stack . append ( i ) else : s = stack . pop ( ) if s == ' y ' and i == ' x ' : pass elif s == ' x ' and i == ' y ' : pass else : stack . append ( s ) stack . append ( i ) for i in stack : print ( i , end = ' ' ) NEW_LINE", "from sys import stdin , stdoutimport bisect as bsnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE", "s = input ( ) xs = s . count ( \" x \" ) ys = s . count ( \" y \" )   if xs > ys : print ( \" x \" * ( xs - ys ) ) else : print ( \" y \" * ( ys - xs ) ) NEW_LINE" ]
codeforces_1177_B
[ "import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = 1 ; while ( T -- > 0 ) { long k = input . nextLong ( ) ; long v = 9 ; long s = 0 ; int x = 1 ; while ( true ) { if ( s + v * x > k ) { break ; } s += v * x ; v *= 10 ; x ++ ; } if ( s == k ) { out . println ( 9 ) ; } else { long d = k - s ; long u = d / x ; long rem = d % x ; long nu = ( long ) Math . pow ( 10 , x - 1 ) ; nu += u ; if ( rem == 0 ) { nu -- ; out . println ( nu % 10 ) ; } else { String str = String . valueOf ( nu ) ; out . println ( str . charAt ( ( int ) ( rem - 1 ) ) ) ; } } } out . close ( ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }", "import java . util . * ; import java . io . * ; import java . text . * ;   public class Main {", "import java . util . Scanner ;   public class B1177 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long N = in . nextLong ( ) ; long answer = solve ( N , 0 , 1 , 1 ) ; System . out . println ( answer ) ; }   static long solve ( long N , long offset , long start , int digits ) { long thisSection = digits * start * 9 ; long fromOffset = N - offset ; if ( fromOffset > thisSection ) { return solve ( N , offset + thisSection , 10 * start , digits + 1 ) ; } long number = start + ( fromOffset - 1 ) / digits ; long posInNumber = digits - 1 - ( fromOffset - 1 ) % digits ; while ( posInNumber > 0 ) { posInNumber -- ; number /= 10 ; } return number % 10 ; }   }", "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 ) {" ]
[ "def main ( ) : k = int ( input ( ) ) n , tenPow , s = 1 , 1 , 0 while ( ( s + 9 * tenPow * n ) < k ) : s += 9 * tenPow * n n += 1 tenPow *= 10 num = str ( tenPow - 1 + ( k - s + n - 1 ) // n ) print ( num [ ( k - s - 1 ) % n ] )   if __name__ == \" _ _ main _ _ \" : main ( )   NEW_LINE", "pre_cal_sum_dec = { } def sum_dec ( n ) : ''' Sum ▁ of ▁ 10 * * n ▁ + ▁ 10 * * ( n - 1 ) ▁ + ▁ . . . ▁ 10 * * 1 ▁ ▁ ▁ ▁ Parameter : ▁ n : ▁ number ▁ ▁ ▁ ▁ Return : ▁ result ▁ of ▁ the ▁ sum ''' global pre_cal_sum_dec try : return pre_cal_sum_dec [ n ] except : sumer = 0 for i in range ( 1 , n ) : sumer += 10 ** i pre_cal_sum_dec [ n ] = sumer return sumerdef find_head ( digits ) : ''' Find ▁ the ▁ starting ▁ number ▁ of ▁ a ▁ digit ▁ cluster : ▁ ex : ▁ 10 ▁ for ▁ 2 - dig ; ▁ 190 ▁ for ▁ 3 - dig ''' if digits < 1 : return 0 elif digits == 1 : return 1 else : return ( digits - 1 ) * 10 ** ( digits - 1 ) - sum_dec ( digits - 1 )   def cutter ( start , end ) : listo = [ 0 for _ in range ( 10 ) ] part = ( end - start ) // 9 listo [ 0 ] = start for each in range ( 1 , 10 ) : start += part listo [ each ] = start return listodef finder ( number ) : x , i = 0 , 0 if number == 1 : return 1 while x < number : bef = x x = find_head ( i ) i += 1 if x == number : return 1 e = i - 2 number = number - bef interval = e * 10 ** ( e - 1 ) col = number % e NEW_LINE", "pre_cal_sum_dec = { } def sum_dec ( n ) : ''' Sum ▁ of ▁ 10 * * n ▁ + ▁ 10 * * ( n - 1 ) ▁ + ▁ . . . ▁ 10 * * 1 ▁ ▁ ▁ ▁ Parameter : ▁ n : ▁ number ▁ ▁ ▁ ▁ Return : ▁ result ▁ of ▁ the ▁ sum ''' global pre_cal_sum_dec try : return pre_cal_sum_dec [ n ] except : sumer = 0 for i in range ( 1 , n ) : sumer += 10 ** i pre_cal_sum_dec [ n ] = sumer return sumerdef find_head ( digits ) : ''' Find ▁ the ▁ starting ▁ number ▁ of ▁ a ▁ digit ▁ cluster : ▁ ex : ▁ 10 ▁ for ▁ 2 - dig ; ▁ 190 ▁ for ▁ 3 - dig ''' if digits < 1 : return 0 elif digits == 1 : return 1 else : return ( digits - 1 ) * 10 ** ( digits - 1 ) - sum_dec ( digits - 1 )   list_of_head = [ find_head ( i ) for i in range ( 18 ) ] def finder ( number ) : x , i = 0 , 1 if number == 1 : return 1 for x in list_of_head [ 1 : ] : if x > number : break bef = x i += 1 if x == number : return 1 e = i - 1 number = number - bef interval = e * 10 ** ( e - 1 ) col = number % e NEW_LINE" ]
codeforces_907_B
[ "import java . util . * ; import java . io . * ;   public class B { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; char [ ] [ ] arr = new char [ 11 ] [ 11 ] ; for ( int i = 0 ; i < 11 ; i ++ ) { arr [ i ] = in . nextLine ( ) . toCharArray ( ) ; } int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; x = ( x - 1 ) % 3 ; y = ( y - 1 ) % 3 ; boolean untouched = true ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { if ( arr [ i + ( 4 * x ) ] [ j + ( 4 * y ) ] == ' . ' ) { untouched = false ; arr [ i + ( 4 * x ) ] [ j + ( 4 * y ) ] = ' ! ' ; } } } for ( int i = 0 ; i < 11 ; i ++ ) { if ( ! ( i == 3 || i == 7 ) ) { for ( int j = 0 ; j < 11 ; j ++ ) { if ( untouched && arr [ i ] [ j ] == ' . ' ) System . out . print ( ' ! ' ) ; else System . out . print ( arr [ i ] [ j ] ) ; } } System . out . println ( ) ; } } }" ]
[ "board = [ list ( input ( ) ) for i in range ( 11 ) ] ( x , y ) = map ( int , input ( ) . split ( ) )   x = ( x - 1 ) % 3 y = ( y - 1 ) % 3   can = Falsefor i in range ( 3 ) : for j in range ( 3 ) : if board [ x * 4 + i ] [ y * 4 + j ] == ' . ' : board [ x * 4 + i ] [ y * 4 + j ] = ' ! ' can = True if not can : for i in range ( 11 ) : if i % 4 != 3 : for j in range ( 11 ) : if board [ i ] [ j ] == ' . ' : board [ i ] [ j ] = ' ! '   for i in range ( 11 ) : print ( ' ' . join ( board [ i ] ) ) NEW_LINE", "X = [ ] count = 0 while ( count < 9 ) : Y = input ( ) Z = [ char for char in Y if char != ' ▁ ' ] if Z != [ ] : X . append ( Z ) count += 1 x , y = map ( int , input ( ) . split ( ) ) u = ( x - 1 ) % 3 v = ( y - 1 ) % 3 ok = False for i in range ( 3 ) : for j in range ( 3 ) : t , s = 3 * u + i , 3 * v + j if X [ t ] [ s ] == ' . ' : X [ t ] [ s ] = ' ! ' ok = True if ok == False : for i in range ( 9 ) : for j in range ( 9 ) : if X [ i ] [ j ] == ' . ' : X [ i ] [ j ] = ' ! ' cnt = 0 for i in X : cnt += 1 [ u1 , u2 , u3 , u4 , u5 , u6 , u7 , u8 , u9 ] = i print ( u1 + u2 + u3 + \" ▁ \" + u4 + u5 + u6 + \" ▁ \" + u7 + u8 + u9 ) if cnt == 3 or cnt == 6 : print ( \" ▁ \" ) NEW_LINE" ]
codeforces_632_B
[ "import java . util . * ;    public class CodeforcesContest { private static long sport ( int [ ] a , char [ ] chars ) { int n = a . length ; long [ ] pa = new long [ n + 1 ] ; long [ ] pb = new long [ n + 1 ] ; for ( int i = 1 ; i < n + 1 ; i ++ ) { if ( chars [ i - 1 ] == ' A ' ) { pa [ i ] += pa [ i - 1 ] + a [ i - 1 ] ; pb [ i ] = pb [ i - 1 ] ; } else { pb [ i ] += pb [ i - 1 ] + a [ i - 1 ] ; pa [ i ] = pa [ i - 1 ] ; } } int from = Integer . MAX_VALUE ; int to = Integer . MAX_VALUE ; long max = 0 ;", "import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ;    public class B632 {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;" ]
[ "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) ; s = input ( ) if n == 1 : print ( arr [ 0 ] ) ; exit ( ) NEW_LINE", "n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) s = input ( ) total = 0 for i in range ( n ) : if s [ i ] == ' B ' : total += p [ i ] ans = totalcur = totalfor i in range ( n ) : if s [ i ] == ' A ' : cur += p [ i ] else : cur -= p [ i ] ans = max ( ans , cur )   cur = totalfor i in reversed ( range ( n ) ) : if s [ i ] == ' A ' : cur += p [ i ] else : cur -= p [ i ] ans = max ( ans , cur )   print ( ans ) NEW_LINE", "n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) s = input ( ) ogmx = 0 premx = [ 0 ] * ( n + 1 ) sufmx = [ 0 ] * ( n + 1 ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) s = input ( ) def m ( s , a ) : q , w = 0 , 0 for i in range ( n ) : if s [ i ] == \" A \" : q += a [ i ] else : w += a [ i ] r = w for i in range ( n ) : if s [ i ] == \" A \" : w += a [ i ] ; q -= a [ i ] else : q += a [ i ] ; w -= a [ i ] r = max ( r , w ) return rprint ( max ( m ( s , a ) , m ( s [ : : - 1 ] , a [ : : - 1 ] ) ) ) NEW_LINE" ]
codeforces_1473_B
[ "import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- != 0 ) { String a = s . next ( ) ; String b = s . next ( ) ; int num = lcm ( a . length ( ) , b . length ( ) ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class B_String_LCM {   static Scanner scanner = new Scanner ( ) ; static int testCases ; static String mul ( String s , int k ) { StringBuilder sb = new StringBuilder ( ) ; while ( k -- >= 1 ) { sb . append ( s ) ; } return sb . toString ( ) ; } static int gcd ( int a , int b ) { if ( a == 0 ) return b ; if ( b == 0 ) return a ; if ( a == b ) return a ; if ( a > b ) return gcd ( a - b , b ) ; return gcd ( a , b - a ) ; } static void solve ( String a , String b ) { int n = a . length ( ) , m = b . length ( ) ; int g = gcd ( n , m ) ; if ( mul ( a , m / g ) . equalsIgnoreCase ( mul ( b , n / g ) ) ) { System . out . println ( mul ( a , m / g ) ) ; } else { System . out . println ( - 1 ) ; } } public static void main ( String [ ] args ) throws IOException { testCases = scanner . nextInt ( ) ; for ( int i = 0 ; i < testCases ; i ++ ) { solve ( scanner . next ( ) , scanner . next ( ) ) ; } } static class Scanner { BufferedReader in ; StringTokenizer st ;   public Scanner ( ) { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) throws IOException { while ( st == null || ! st . hasMoreElements ( ) ) { st = new StringTokenizer ( in . readLine ( ) ) ; } return st . nextToken ( ) ; } int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } String nextLine ( ) throws IOException { return in . readLine ( ) ; } } }  ", "  import java . util . * ; import java . lang . * ; import java . io . * ;    public class Codechef { static int hcf ( int a , int b ) { int hcf = 1 ; for ( int i = 1 ; i <= a || i <= b ; i ++ ) { if ( a % i == 0 && b % i == 0 ) hcf = i ; } return hcf ; } public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int tt = sc . nextInt ( ) ; sc . nextLine ( ) ; while ( tt -- != 0 ) { String s , t ; s = sc . nextLine ( ) ; t = sc . nextLine ( ) ; int x = s . length ( ) ; int y = t . length ( ) ; int lcm = ( x * y ) / hcf ( x , y ) ; int a = lcm / x ; int b = lcm / y ; String s1 = \" \" , s2 = \" \" ; for ( int i = 1 ; i <= a ; i ++ ) { s1 += s ; } for ( int i = 1 ; i <= b ; i ++ ) { s2 += t ; } if ( s1 . equals ( s2 ) ) { System . out . println ( s1 ) ; } else System . out . println ( - 1 ) ; } } }", "import java . util . Scanner ;   public class B1473 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { String A = in . next ( ) ; String B = in . next ( ) ; int a = A . length ( ) ; int b = B . length ( ) ; int gcd = gcd ( a , b ) ; int aCopies = b / gcd ; int bCopies = a / gcd ; StringBuilder aa = new StringBuilder ( ) ; StringBuilder bb = new StringBuilder ( ) ; for ( int i = 0 ; i < aCopies ; i ++ ) { aa . append ( A ) ; } for ( int i = 0 ; i < bCopies ; i ++ ) { bb . append ( B ) ; } boolean ok = aa . toString ( ) . equals ( bb . toString ( ) ) ; System . out . println ( ok ? aa : \" - 1\" ) ; } }   static int gcd ( int a , int b ) { return ( b == 0 ) ? a : gcd ( b , a % b ) ; }   }" ]
[ "import mathfor NEW_LINE _ in range ( int ( input ( ) ) ) : s1 = input ( ) NEW_LINE s2 = input ( ) NEW_LINE g = math . gcd ( len ( s1 ) , len ( s2 ) ) NEW_LINE if ( len ( s2 ) // g * s1 == len ( s1 ) // g * s2 ) : NEW_LINE INDENT print ( len ( s2 ) // g * s1 ) else : NEW_LINE print ( - 1 ) NEW_LINE DEDENT", "for _ in range ( 0 , int ( input ( ) ) ) : s , t = input ( ) , input ( ) NEW_LINE p , q = len ( s ) , len ( t ) NEW_LINE while p != q : if NEW_LINE p > q : q = q + len ( t ) else : p = p + len ( s ) NEW_LINE f , g = ( int ( q / len ( t ) ) , int ( p / len ( s ) ) ) NEW_LINE if s * g == t * f : NEW_LINE INDENT print ( s * g ) else : NEW_LINE print ( - 1 ) NEW_LINE DEDENT", "a = int ( input ( ) ) NEW_LINE for i in range ( a ) : s = input ( ) NEW_LINE t = input ( ) NEW_LINE n1 = len ( t ) NEW_LINE n2 = len ( s ) NEW_LINE x = n1 NEW_LINE while x >= n1 : if NEW_LINE x % n2 == 0 and x % n1 == 0 : alpha = x NEW_LINE break NEW_LINE x += 1 NEW_LINE", "import math   testCases = int ( input ( ) )   for i in range ( testCases ) : stringA = input ( ) NEW_LINE stringB = input ( ) NEW_LINE a = len ( stringA ) NEW_LINE b = len ( stringB ) NEW_LINE LCM = a * b // math . gcd ( a , b ) NEW_LINE stringAlcm = stringA * ( LCM // a ) NEW_LINE stringBlcm = stringB * ( LCM // b ) NEW_LINE if stringAlcm == stringBlcm : NEW_LINE INDENT print ( stringAlcm ) else : NEW_LINE print ( - 1 ) NEW_LINE DEDENT" ]
codeforces_1005_A
[ "import java . util . Scanner ;   public class Stairways { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n + 1 ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == 1 ) { ++ ans ; } } System . out . println ( ans ) ; int c = 0 ; a [ n ] = 1 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { if ( a [ i ] != 1 ) { ++ c ; } else { System . out . print ( ( c + 1 ) + \" ▁ \" ) ; c = 0 ; } } } }", "import java . util . ArrayList ; import java . util . Scanner ;   public class JavaApplication4 { public static void main ( String [ ] args ) { int sum , x , counter = 0 ; ArrayList < Integer > max = new ArrayList < > ( ) ; Scanner scan = new Scanner ( System . in ) ; int i = 0 ; x = scan . nextInt ( ) ; int n [ ] = new int [ x ] ; if ( x == 1 ) { n [ 0 ] = scan . nextInt ( ) ; counter = 1 ; max . add ( 1 ) ; } else { for ( i = 0 ; i < x ; i ++ ) { n [ i ] = scan . nextInt ( ) ; if ( n [ i ] == 1 ) counter ++ ; if ( i != 0 & n [ i ] == 1 ) max . add ( n [ i - 1 ] ) ; } max . add ( n [ i - 1 ] ) ; } System . out . println ( counter ) ; max . forEach ( ( t ) -> { System . out . print ( t + \" ▁ \" ) ; } ) ;  \t  }" ]
[ "n = int ( input ( ) )   arr = [ int ( i ) for i in input ( ) . split ( ) ] arr = arr [ 1 : : ] + [ arr [ 0 ] ] x = 1 ans = [ ]   for i in arr : if i == 1 : ans . append ( x ) x = 1 else : x += 1   print ( len ( ans ) ) print ( * ans )   NEW_LINE", "input ( ) a = input ( ) . split ( ) l = [ x for x , y in zip ( a , a [ 1 : ] + [ '1' ] ) if '1' == y ] print ( len ( l ) ) print ( * l ) NEW_LINE", "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) c = 0 s = [ ] d = 1 for i in l : if ( i == d ) : d += 1 else : s . append ( d - 1 ) d = 2 c += 1 s . append ( d - 1 ) c += 1 print ( c ) for i in s : print ( i , end = ' ▁ ' ) NEW_LINE" ]
codeforces_1173_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 ;   public class Test {   public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . call ( in , out ) ; out . close ( ) ; }   static class TaskA { public void call ( InputReader in , PrintWriter out ) { int n , a , b = 1 ; n = in . nextInt ( ) ; a = ( n / 2 ) + 1 ; out . println ( a ) ; for ( int i = 1 , j = 1 ; i <= a && j <= a ; i ++ ) { if ( b > n ) break ; if ( b % 2 == 0 ) { out . println ( j + \" ▁ \" + i ) ; j ++ ; i -- ; } else { out . println ( j + \" ▁ \" + i ) ; } b ++ ;   }       } }   static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; }   public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   } }", "import java . io . * ; import java . util . * ; public class Mohammad { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , c = n / 2 ; System . out . println ( ++ c ) ; for ( int i = 1 ; i <= c ; i ++ ) System . out . println ( 1 + \" ▁ \" + i ) ; for ( int i = 2 ; i <= n - c + 1 ; i ++ ) System . out . println ( c + \" ▁ \" + i ) ; } }", "import java . io . * ; import java . util . * ; public class Mohammad { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , c = n / 2 ; System . out . println ( ++ c ) ; for ( int i = 1 ; i <= c ; i ++ ) System . out . println ( 1 + \" ▁ \" + i ) ; for ( int i = 2 ; i <= n - c + 1 ; i ++ ) System . out . println ( c + \" ▁ \" + i ) ; } }", "import java . io . * ; import java . util . * ; public class Mohammad { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , c = n / 2 ; System . out . println ( ++ c ) ; for ( int i = 1 ; i <= c ; i ++ ) System . out . println ( 1 + \" ▁ \" + i ) ; for ( int i = 2 ; i <= n - c + 1 ; i ++ ) System . out . println ( c + \" ▁ \" + i ) ; } }", "import java . util . * ; public class B_564 { public static void main ( String [ ] args ) { Scanner omkar = new Scanner ( System . in ) ; int n = omkar . nextInt ( ) ; int m = n / 2 + 1 ; System . out . println ( \" \" + m ) ; for ( int i = 1 ; i <= m ; i ++ ) { System . out . println ( \"1 ▁ \" + i ) ; } for ( int i = 1 ; i <= n - m ; i ++ ) { System . out . println ( ( i + 1 ) + \" ▁ \" + m ) ; } }   }" ]
[ "import mathimport sysfrom collections import * import itertools def cint ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def cstr ( ) : return list ( map ( str , input ( ) . split ( ' ▁ ' ) ) )   def gcd ( a , b ) : if ( b == 0 ) : return a return gcd ( b , a % b )     def solve ( t ) : n = int ( input ( ) ) r = ( n + 1 ) // 2   if ( n + 1 ) / 2 != ( n + 1 ) // 2 : r += 1   print ( r ) indx = 1 for i in range ( n ) : if i < r : print ( 0 + 1 , i + 1 ) else : print ( indx + 1 , r ) indx += 1 \t \t \t       if __name__ == \" _ _ main _ _ \" : NEW_LINE", "import matha = int ( input ( ) ) m = math . ceil ( ( a + 1 ) / 2 ) print ( m ) for i in range ( 1 , min ( a + 1 , m + 1 ) ) : print ( 1 , i ) a = a - 1 for i in range ( m - a + 1 , m + 1 ) : if ( a <= 0 ) : break print ( m , i ) a = a - 1 NEW_LINE", "n = int ( input ( ) ) m = n // 2 + 1 print ( m ) for i in range ( n ) : print ( i // 2 + 1 , i // 2 + 1 + i % 2 ) NEW_LINE", "n = int ( input ( ) ) if ( ( n - 1 ) % 2 == 1 ) : c = ( ( n - 1 ) // 2 ) + 1 else : c = ( n - 1 ) // 2 c += 1 r = 1 print ( c ) for i in range ( 1 , n + 1 ) : if ( i <= n - c ) : print ( \"1\" , end = \" ▁ \" ) print ( i ) else : print ( c , end = \" ▁ \" ) print ( r ) r += 1 NEW_LINE" ]
codeforces_818_A
[ "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 { String [ ] str = br . readLine ( ) . split ( \" ▁ \" ) ; long N = Long . parseLong ( str [ 0 ] ) ; long K = Long . parseLong ( str [ 1 ] ) ; Solution obj = new Solution ( ) ; long [ ] ans = obj . dipCertiNotWinners ( N , K ) ; System . out . println ( ans [ 0 ] + \" ▁ \" + ans [ 1 ] + \" ▁ \" + ans [ 2 ] ) ; br . close ( ) ; } }   class Solution { public long [ ] dipCertiNotWinners ( long N , long K ) {", "import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; public class _p000818A { static public void main ( final String [ ] args ) throws IOException { p000818A . _main ( args ) ; }", "  import java . io . * ; import java . util . * ;   public class Training { public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; long n = input . nextLong ( ) , k = input . nextLong ( ) ; long a = n / 2 / ( k + 1 ) ; long b = a * k ; System . out . println ( a + \" ▁ \" + b + \" ▁ \" + ( n - a - b ) ) ;   }", "import java . io . * ; import java . math . * ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 100000007 ;   private static final int MAXN = 300005 ; private static final int MAXA = 1000007 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;", "import java . util . * ;   public class P1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( n <= k ) { System . out . println ( 0 + \" ▁ \" + 0 + \" ▁ \" + n ) ;   } else { long a = ( n / 2 ) / ( k + 1 ) ;   long b = k * a ; long N = n - ( a + a * k ) ; System . out . println ( a + \" ▁ \" + b + \" ▁ \" + N ) ; }   } }" ]
[ "n , k = map ( int , input ( ) . split ( ) )   certificate = n // 2 // ( k + 1 ) * kdiplomas = n // 2 // ( k + 1 ) non_winners = n - diplomas - certificate   print ( diplomas , certificate , non_winners ) NEW_LINE", "''' ▁ ▁ ▁ ▁ ▁ Design ▁ by ▁ Dinh ▁ Viet ▁ Anh ( JOKER ) / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ $ $ _ _ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ $ $ $ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ _ _ _ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ _ _ _ _ $ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ $ $ $ $ _ _ $ $ $ $ $ $ $ $ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ $ $ $ $ $ $ _ _ _ $ $ $ $ $ $ $ $ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ _ _ _ $ _ _ _ _ _ _ $ $ $ $ $ $ $ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ $ _ _ $ $ $ $ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $ $ $ / / _ _ _ _ _ _ _ _ _ _ _ _ _ $ _ _ $ $ $ $ _ _ $ $ $ $ $ $ $ $ $ $ $ _ _ _ _ _ $ _ _ _ _ $ $ $ / / _ _ _ _ _ _ _ _ _ _ $ $ $ _ _ _ $ $ $ $ _ _ _ $ $ $ $ $ $ $ $ $ $ $ _ _ $ $ $ $ _ _ $ $ $ $ / / _ _ _ _ _ _ _ _ _ $ $ $ $ _ _ _ $ $ $ $ $ _ _ _ $ $ $ $ $ $ $ $ $ $ _ _ $ $ $ $ $ $ $ $ $ / / _ _ _ _ $ _ _ _ _ $ $ $ _ _ _ _ _ $ $ $ $ _ _ _ _ _ _ _ _ _ _ $ $ $ _ _ _ $ $ $ $ $ $ $ / / _ _ $ $ $ $ _ _ $ $ $ $ _ _ _ _ _ $ $ $ $ _ _ _ _ _ $ _ _ _ _ $ $ $ _ _ _ _ _ $ / / _ _ $ $ $ $ _ _ $ $ $ _ _ _ _ _ _ _ $ $ $ $ _ _ $ $ $ $ $ $ $ $ $ $ / / _ _ _ $ $ $ $ $ $ $ $ $ _ _ _ _ _ _ $ $ $ $ _ _ $ $ $ $ $ $ $ $ $ / / _ _ _ $ $ $ $ $ $ $ $ $ $ _ _ _ _ _ $ $ $ $ _ _ _ $ $ $ $ $ $ / / _ _ _ $ $ $ $ $ $ $ $ $ $ $ _ _ _ _ _ $ $ $ / / _ _ _ _ $ $ $ $ $ $ $ $ $ $ $ _ _ _ _ $ $ $ $ / / _ _ _ _ $ $ $ $ $ _ _ $ $ $ $ $ _ _ _ $ $ $ / / _ _ _ _ $ $ $ $ $ _ _ _ $ $ $ $ $ $ / / _ _ _ _ $ $ $ $ $ _ _ _ _ $ $ $ / / _ _ _ _ _ $ $ $ $ / / _ _ _ _ _ $ $ $ $ / / _ _ _ _ _ $ $ $ $ ''' from math import * from cmath import * from itertools import * from decimal import * NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) c = a // 2 d = c // ( b + 1 ) e = b * dprint ( d , e , a - d - e ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) d = n // ( 2 * ( k + 1 ) ) c = k * dnw = n - ( c + d ) print ( d , c , nw ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) d = ( n // 2 ) // ( k + 1 ) print ( d , k * d , n - ( k + 1 ) * d ) NEW_LINE" ]
codeforces_192_B
[ "import java . io . * ; import java . util . * ;   public class b { static class Reader { final private int BUFFER_SIZE = 1 << 20 ; 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 next ( ) throws IOException { byte [ ] buf = new byte [ 64 ] ;", "import java . util . Arrays ; import java . util . Scanner ;   public class RainDestroyer { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] sort = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; sort [ i ] = a [ i ] ; }   Arrays . sort ( sort ) ;   int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( sort [ i ] == a [ j ] ) { if ( j == 0 || j == n - 1 || a [ j - 1 ] <= a [ j ] || a [ j + 1 ] <= a [ j ] ) { ans = sort [ i ] ; } } } if ( ans > 0 ) { System . out . println ( ans ) ; break ; } } } }" ]
[ "n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) m = min ( x ) l = mc = 0 a = x [ 0 ] b = x [ - 1 ] flag = 0 while True : m = 2 ** 20 for i in range ( 1 , n - 1 ) : x [ i ] -= l if x [ i ] <= 0 and x [ i - 1 ] <= 0 : flag = 1 break if x [ i ] > 0 : m = min ( m , x [ i ] ) c += l if c > a or c > b : break if flag == 1 : break l = mprint ( min ( c , a , b ) ) NEW_LINE", "if __name__ == ' _ _ main _ _ ' : n = int ( input ( ) ) a = [ 0 ] + [ int ( i ) for i in input ( ) . split ( ) ] + [ 0 ] mx = 10 ** 6 + 1   for i in range ( n + 1 ) : mx = min ( mx , max ( a [ i ] , a [ i + 1 ] ) )   print ( mx ) NEW_LINE", "n , a = int ( input ( ) ) , [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) + [ 0 ] x = [ ] for i in range ( n + 1 ) : x . append ( max ( a [ i ] , a [ i + 1 ] ) ) print ( min ( x ) ) NEW_LINE" ]
codeforces_106_A
[ "import java . util . * ;   public class TCS1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String str = sc . nextLine ( ) ; String a = str . split ( \" ▁ \" ) [ 0 ] ; String b = str . split ( \" ▁ \" ) [ 1 ] ; String temp = \"6789TJQKA \" ; if ( a . charAt ( 1 ) == b . charAt ( 1 ) ) { if ( temp . indexOf ( a . charAt ( 0 ) ) > temp . indexOf ( b . charAt ( 0 ) ) ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } else { if ( a . charAt ( 1 ) == s . charAt ( 0 ) ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } } }", "import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int first = 0 , second = 0 ; String wrong = input . next ( ) ; String First = input . next ( ) ; String Second = input . next ( ) ; if ( First . charAt ( 0 ) == ' T ' ) first = 10 ; else if ( First . charAt ( 0 ) == ' J ' ) first = 11 ; else if ( First . charAt ( 0 ) == ' Q ' ) first = 12 ; else if ( First . charAt ( 0 ) == ' K ' ) first = 13 ; else if ( First . charAt ( 0 ) == ' A ' ) first = 14 ; else first = First . charAt ( 0 ) - '0' ; if ( Second . charAt ( 0 ) == ' T ' ) second = 10 ; else if ( Second . charAt ( 0 ) == ' J ' ) second = 11 ; else if ( Second . charAt ( 0 ) == ' Q ' ) second = 12 ; else if ( Second . charAt ( 0 ) == ' K ' ) second = 13 ; else if ( Second . charAt ( 0 ) == ' A ' ) second = 14 ; else second = Second . charAt ( 0 ) - '0' ; if ( First . charAt ( 1 ) == wrong . charAt ( 0 ) && ( Second . charAt ( 1 ) != wrong . charAt ( 0 ) ) ) System . out . println ( \" YES \" ) ; else if ( First . charAt ( 1 ) == Second . charAt ( 1 ) && first > second ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; }     }  ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( newInputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }    public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ;" ]
[ "c = [ '6' , '7' , '8' , '9' , ' T ' , ' J ' , ' Q ' , ' K ' , ' A ' ] t = input ( ) f , s = input ( ) . split ( ) if f [ 1 ] == t and s [ 1 ] != t : print ( ' YES ' ) exit ( ) elif s [ 1 ] == t and f [ 1 ] != t : print ( ' NO ' ) exit ( ) if f [ 1 ] != s [ 1 ] : print ( ' NO ' ) elif c . index ( f [ 0 ] ) > c . index ( s [ 0 ] ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE", "s = input ( ) a , b = map ( str , input ( ) . split ( ) ) NEW_LINE", "x = input ( ) s = { '6' : 6 , '7' : 7 , '8' : 8 , '9' : 9 , ' T ' : 10 , ' J ' : 11 , ' Q ' : 12 , ' K ' : 13 , ' A ' : 14 } y = ( list ( input ( ) . split ( ) ) ) if ( x == y [ 0 ] [ 1 ] ) : if ( y [ 0 ] [ 1 ] != y [ 1 ] [ 1 ] ) : print ( \" YES \" ) else : if ( s [ y [ 0 ] [ 0 ] ] > s [ y [ 1 ] [ 0 ] ] ) : print ( \" YES \" ) else : print ( \" NO \" ) elif ( y [ 0 ] [ 1 ] != y [ 1 ] [ 1 ] ) : print ( \" NO \" ) else : if ( s [ y [ 0 ] [ 0 ] ] > s [ y [ 1 ] [ 0 ] ] ) : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counterfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE" ]
codeforces_1293_B
[ "import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . time . LocalTime ; import java . util . * ; import java . util . concurrent . * ; import java . util . regex . * ;    public class Main {    public static void main ( String [ ] args ) { FastScanner scan = new FastScanner ( ) ; int n = scan . nextInt ( ) ; double ans = 0 ; while ( n > 0 ) { double temp = ( double ) 1 / n ; ans += temp ; n -- ; } System . out . println ( ans ) ; } public static long divisor ( long n ) { for ( long i = 3 ; i < n ; i ++ ) { if ( n % i == 0 ) return i ; } return n ; } public static void sort ( int [ ] a ) { ArrayList < Integer > b = new ArrayList < > ( ) ; for ( int i : a ) b . add ( i ) ; Collections . sort ( b ) ; for ( int i = 0 ; i < a . length ; i ++ ) a [ i ] = b . get ( 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 ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }  ", "   import java . util . Scanner ;   public class JOEisOnTV { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n == 1 ) { System . out . println ( \"1\" ) ; return ; } double d = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { d = d + ( float ) 1 / i ; } System . out . println ( d ) ; } }", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class Solution { public static void main ( String [ ] args ) throws java . lang . Exception { java . io . BufferedReader br = new java . io . BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; OutputStream outputStream = System . out ; PrintWriter out = new PrintWriter ( outputStream ) ; int n = Integer . parseInt ( br . readLine ( ) . trim ( ) ) ; double ans = 0.0 ; for ( int i = 1 ; i <= n ; i ++ ) ans += 1.0 / i ; out . println ( ans ) ; out . close ( ) ; } }" ]
[ "n = int ( input ( ) ) i = 1 ans = 0 while ( i <= n ) : ans += 1 / i i += 1 print ( ans ) NEW_LINE", "import matht = int ( input ( ) ) ans = 0 for i in range ( t ) : ans = ans + 1 / t t -= 1 print ( ans )   NEW_LINE", "import sys   n = int ( sys . stdin . readline ( ) )   sigma = 0 total = n   while total : sigma += ( 1 / total ) total -= 1 print ( sigma ) NEW_LINE", "import sys   input = sys . stdin . readline   def main ( ) : n = int ( input ( ) )   ans = 0 for i in range ( 1 , n + 1 ) : ans += 1 / n n -= 1   print ( ans )   main ( ) NEW_LINE" ]
codeforces_558_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Comparator ; import java . util . StringTokenizer ;   public class Lala_Land { 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 ( ) ) ) ; } }   public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int n = in . nextInt ( ) ; Apple a [ ] = new Apple [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int pos = in . nextInt ( ) ; int app = in . nextInt ( ) ; a [ i ] = new Apple ( pos , app ) ; } Arrays . sort ( a , new Sort ( ) ) ; int mid = - 1 ; int neg = 0 ; int pos = 0 ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] . pos < 0 ) { neg ++ ; } else { if ( mid == - 1 ) mid = i ; pos ++ ; } sum += a [ i ] . tot ; } int min = Math . min ( neg , pos ) ; if ( pos != neg ) { sum = 0 ;", "import java . util . Scanner ;   public class LalaLandAppleTrees { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , a [ ] = new int [ n ] , b [ ] = new int [ n ] , c = 0 , l = 0 ; long s = 0 ;   for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; b [ i ] = in . nextInt ( ) ; s += b [ i ] ; } in . close ( ) ;   while ( c < s ) { int x = Integer . MAX_VALUE , y = Integer . MIN_VALUE , xi = 0 , yi = 0 , xn = 0 , yn = 0 ; for ( i = 0 ; i < n ; i ++ ) {   if ( a [ i ] > 0 ) { if ( a [ i ] < x ) { x = a [ i ] ; xi = i ; } xn ++ ; } else if ( a [ i ] < 0 ) { if ( a [ i ] > y ) { y = a [ i ] ; yi = i ; } yn ++ ; } } if ( xn == 0 && yn == 0 ) break ; if ( l == 0 && xn >= yn || l < 0 && xn > 0 ) { c += b [ xi ] ; l = x ; a [ xi ] = 0 ;   } else if ( l == 0 && xn < yn || l > 0 && yn > 0 ) { c += b [ yi ] ; l = y ; a [ yi ] = 0 ; } else { break ; } } System . out . println ( c ) ; } }" ]
[ "    t = [ ] w = [ ]     n = int ( input ( ) )   p = 0 for i in range ( n ) : v = list ( map ( int , input ( ) . split ( ) ) )   if v [ 0 ] == 0 : p += v [ 1 ] elif v [ 0 ] < 0 : w . append ( v ) else : t . append ( v )   t . sort ( ) w . sort ( ) t = t [ : : - 1 ]   if len ( w ) > len ( t ) : o = 1 else : o = 0 while True : if o == 0 : if len ( t ) > 0 : p += t [ - 1 ] [ 1 ] t . pop ( ) o = 1 else : break elif o == 1 : if len ( w ) > 0 : p += w [ - 1 ] [ 1 ] w . pop ( ) o = 0 else : break   print ( p )       NEW_LINE", "n = int ( input ( ) ) pos = [ ] neg = [ ] for i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) if x < 0 : neg . append ( [ x , y ] ) else : pos . append ( [ x , y ] ) pos . sort ( ) neg . sort ( reverse = True ) l1 = len ( pos ) l2 = len ( neg ) m = min ( l1 , l2 ) tot = 0 for i in range ( m ) : tot += neg [ i ] [ 1 ] + pos [ i ] [ 1 ] if l1 > l2 : tot += pos [ m ] [ 1 ] elif l2 > l1 : tot += neg [ m ] [ 1 ] else : passprint ( tot ) NEW_LINE", "def solve ( num , neg , pos , nseq , pseq ) : app = 0 if neg == pos : for x , y in nseq : app += y for x , y in pseq : app += y elif neg > pos : times = pos index = 0 while index < pos : app += pseq [ index ] [ 1 ] index += 1 index = 0 while index < pos + 1 : app += nseq [ index ] [ 1 ] index += 1 else : times = neg index = 0 while index < neg : app += nseq [ index ] [ 1 ] index += 1 index = 0 while index < neg + 1 : app += pseq [ index ] [ 1 ] index += 1 return app num = int ( input ( ) ) p = 0 n = 0 pseq = [ ] nseq = [ ] for x in range ( num ) : i , j = list ( map ( int , input ( ) . split ( ) ) ) if i < 0 : n += 1 nseq . append ( [ i , j ] ) else : p += 1 pseq . append ( [ i , j ] ) pseq . sort ( key = lambda i : i [ 0 ] ) nseq . sort ( key = lambda i : i [ 0 ] , reverse = True )   print ( solve ( num , n , p , nseq , pseq ) ) 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 ) ''' t = int ( input ( ) ) pos = [ None ] * ( pow ( 10 , 5 ) + 1 ) neg = [ None ] * ( pow ( 10 , 5 ) + 1 ) pp , nn = 0 , 0 for _ in range ( t ) : x , a = map ( int , input ( ) . split ( ) ) if x < 0 : neg [ abs ( x ) ] = a nn += 1 else : pos [ x ] = a pp += 1 if nn < pp : pp = nn + 1 i = 0 s1 , s2 = 0 , 0 while nn != 0 : if neg [ i ] != None : s1 += neg [ i ] nn -= 1 i += 1 i = 0 while pp != 0 : if pos [ i ] != None : s2 += pos [ i ] pp -= 1 i += 1 print ( s1 + s2 ) elif nn > pp : nn = pp + 1 i = 0 s1 , s2 = 0 , 0 while nn != 0 : if neg [ i ] != None : s1 += neg [ i ] nn -= 1 i += 1 i = 0 while pp != 0 : if pos [ i ] != None : s2 += pos [ i ] pp -= 1 i += 1 print ( s1 + s2 ) else : nn = pp i = 0 s1 , s2 = 0 , 0 while nn != 0 : if neg [ i ] != None : s1 += neg [ i ] nn -= 1 i += 1 i = 0 while pp != 0 : if pos [ i ] != None : s2 += pos [ i ] pp -= 1 i += 1 print ( s1 + s2 )   NEW_LINE" ]
codeforces_774_A
[ "   import static java . lang . Math . abs ; import static java . lang . System . out ; import java . util . Scanner ;  ", "   import static java . lang . Math . abs ; import static java . lang . System . out ; import java . util . Scanner ;  ", "   import static java . lang . Math . abs ; import static java . lang . System . out ; import java . util . Scanner ;  ", "import java . util . Scanner ;   public class cf774A {   public static void main ( String [ ] args ) {", "   import static java . lang . Math . abs ; import static java . lang . System . out ; import java . util . Scanner ;  " ]
[ "n , c1 , c2 = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] s = input ( )   cnt = s . count ( '1' )   def price ( x ) : return c1 + c2 * ( x - 1 ) ** 2   prices = [ ]   for i in range ( 1 , cnt + 1 ) : bigGroupsPeople = n // i + 1 numBigGroups = n % i smallGroupsPeople = n // i numSmallGroups = i - n % i totalPrice = numBigGroups * price ( bigGroupsPeople ) + numSmallGroups * price ( smallGroupsPeople ) prices . append ( totalPrice )   print ( min ( prices ) ) NEW_LINE", "n , c1 , c2 = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] s = input ( )   cnt = s . count ( '1' )   def price ( x ) : return c1 + c2 * ( x - 1 ) ** 2   prices = [ ]   for i in range ( 1 , cnt + 1 ) : bigGroupsPeople = n // i + 1 numBigGroups = n % i smallGroupsPeople = n // i numSmallGroups = i - n % i totalPrice = numBigGroups * price ( bigGroupsPeople ) + numSmallGroups * price ( smallGroupsPeople ) prices . append ( totalPrice )   print ( min ( prices ) ) NEW_LINE", "t = input ( ) t = t . split ( ) n = int ( t [ 0 ] ) c1 = int ( t [ 1 ] ) c2 = int ( t [ 2 ] ) t = input ( ) d = 0 for i in t : if ( i == \"1\" ) : d = d + 1   min = 10 ** 1488 for i in range ( 1 , d + 1 ) : t = c1 * i + i * c2 * ( ( ( n // i ) - 1 ) ** 2 ) + c2 * ( n % i ) * ( 2 * ( n // i ) - 1 ) if t < min : min = t   print ( min ) NEW_LINE", "t = input ( )   t = t . split ( )   n = int ( t [ 0 ] )   c1 = int ( t [ 1 ] )   c2 = int ( t [ 2 ] )   t = input ( )   d = 0   for i in t :   if ( i == \"1\" ) :   d = d + 1       min = 10 ** 1488   for i in range ( 1 , d + 1 ) :   t = c1 * i + i * c2 * ( ( ( n // i ) - 1 ) ** 2 ) + c2 * ( n % i ) * ( 2 * ( n // i ) - 1 )   if t < min :   min = t       print ( min )       NEW_LINE" ]
codeforces_1475_A
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tc = sc . nextInt ( ) ; while ( tc -- > 0 ) { long n = sc . nextLong ( ) ; while ( n % 2 == 0 ) { n /= 2 ; } if ( n == 1 ) System . out . println ( \" NO \" ) ; else System . out . println ( \" YES \" ) ; } sc . close ( ) ; } }", "import java . io . * ; import java . util . * ; import java . math . * ; import java . awt . Point ; public class Main { static final long MOD = 1000000007L ;", "import java . io . * ; import java . util . * ;   public class OddDivisor {", "import java . io . * ; import java . util . * ;   public class A { public static void main ( String [ ] args ) throws IOException { FastReader fr = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; int t = fr . nextInt ( ) ;   while ( t -- > 0 ) { long n = fr . nextLong ( ) ; while ( ( n & 1 ) != 1 ) n >>= 1 ;   if ( n == 1 ) { pr . println ( \" NO \" ) ; } else { pr . println ( \" YES \" ) ; } }   pr . close ( ) ; }   static class Pair { int x , y ;   public Pair ( int x , int y ) { this . x = x ; this . y = y ; } }   static int toInt ( String s ) { return Integer . parseInt ( s ) ; }   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) throws FileNotFoundException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; long n ; for ( int i = 0 ; i < t ; i ++ ) { n = sc . nextLong ( ) ; if ( ( n & n - 1 ) == 0 ) { System . out . println ( \" NO \" ) ; } else { System . out . println ( \" YES \" ) ; } } } }" ]
[ "import math   NEW_LINE def solve ( ) : n = int ( input ( ) ) NEW_LINE if bin ( n ) [ 2 : ] . count ( '1' ) == 1 : NEW_LINE INDENT return False else : NEW_LINE return True   for t in range ( int ( input ( ) ) ) : if NEW_LINE DEDENT solve ( ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE", "def solve ( n ) : if NEW_LINE INDENT ( n <= 2 ) : NEW_LINE DEDENT return \" NO \" elif ( n & ( n - 1 ) == 0 ) : NEW_LINE return \" NO \" else : return \" YES \" NEW_LINE for i in range ( int ( input ( ) ) ) : print ( solve ( int ( input ( ) ) ) ) NEW_LINE", "for _ in ' . ' * int ( input ( ) ) : n = int ( input ( ) ) ; print ( \" YNEOS \" [ n & - n == n : : 2 ] ) NEW_LINE", "t = input ( ) NEW_LINE t = int ( t ) NEW_LINE while t > 0 : n = input ( ) NEW_LINE n = int ( n ) NEW_LINE if ( n & ( n - 1 ) == 0 ) : NEW_LINE INDENT print ( \" NO \" ) else : NEW_LINE print ( \" YES \" ) NEW_LINE DEDENT t -= 1   NEW_LINE", "for _ in range ( int ( input ( ) ) ) :   NEW_LINE n = bin ( int ( input ( ) ) ) [ 1 : ]   if n != \"1\" and n . count ( \"1\" ) == 1 : NEW_LINE INDENT print ( ' NO ' ) else : NEW_LINE print ( ' YES ' ) NEW_LINE DEDENT" ]
codeforces_901_A
[ "import java . util . * ; public class Codeforces { private static void sport ( int [ ] a , int h ) { boolean f = true ; for ( int i = 1 ; i < a . length ; i ++ ) { if ( a [ i - 1 ] > 1 && a [ i ] > 1 ) { f = false ; break ; } } if ( f ) { System . out . println ( \" perfect \" ) ; return ; } System . out . println ( \" ambiguous \" ) ; System . out . print ( \"0 ▁ \" ) ; LinkedList < Integer > queue = new LinkedList < > ( ) ; queue . add ( 1 ) ; for ( int i = 1 ; i < a . length ; i ++ ) { LinkedList < Integer > q = new LinkedList < > ( ) ; Integer poll = queue . removeLast ( ) ; for ( int j = 0 ; j < a [ i ] ; j ++ ) { System . out . print ( poll + \" ▁ \" ) ; q . addLast ( poll + j + 1 ) ; } queue . clear ( ) ; queue . addAll ( q ) ; } System . out . println ( ) ;" ]
[ "n = int ( input ( ) ) n += 1 l = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 for i in range ( n - 1 ) : if ( l [ i ] > 1 and l [ i + 1 ] > 1 ) : ans = i + 1 breakelse : print ( \" perfect \" ) exit ( 0 ) print ( \" ambiguous \" ) prev = 0 now = 0 for i in range ( n ) : for j in range ( l [ i ] ) : print ( prev , end = \" ▁ \" ) now += 1 prev = nowprint ( ) prev = 0 now = 0 for i in range ( n ) : for j in range ( l [ i ] ) : if ( ans == i ) : print ( prev - 1 , end = \" ▁ \" ) ans = - 1 else : print ( prev , end = \" ▁ \" ) now += 1 prev = now NEW_LINE", "I = lambda : list ( map ( int , input ( ) . split ( ) ) ) n , = I ( ) l = I ( ) ans = \" perfect \" f = 0 temp = - 1 node = 1 for i in range ( n ) : if min ( l [ i ] , l [ i + 1 ] ) > 1 : ans = \" ambiguous \" temp = i + 1 f = 1 breakif not f : print ( ans ) else : a = '0' b = '0' for i in range ( 1 , n + 1 ) : a += ( \" ▁ \" + str ( node ) ) * l [ i ] if i != temp : b += ( \" ▁ \" + str ( node ) ) * l [ i ] else : b += ( \" ▁ \" + str ( node - 1 ) ) + ( ( \" ▁ \" + str ( node ) ) * ( l [ i ] - 1 ) ) node += l [ i ] print ( ans ) print ( a ) print ( b )       NEW_LINE", "n = int ( input ( ) ) n += 1 l = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 for i in range ( n - 1 ) : if ( l [ i ] > 1 and l [ i + 1 ] > 1 ) : ans = i + 1 breakelse : print ( \" perfect \" ) exit ( 0 ) print ( \" ambiguous \" ) prev = 0 now = 0 for i in range ( n ) : for j in range ( l [ i ] ) : print ( prev , end = \" ▁ \" ) now += 1 prev = nowprint ( ) prev = 0 now = 0 for i in range ( n ) : for j in range ( l [ i ] ) : if ( ans == i ) : print ( prev - 1 , end = \" ▁ \" ) ans = - 1 else : print ( prev , end = \" ▁ \" ) now += 1 prev = now NEW_LINE", "n = int ( input ( ) ) n += 1 l = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 for i in range ( n - 1 ) : if ( l [ i ] > 1 and l [ i + 1 ] > 1 ) : ans = i + 1 breakelse : print ( \" perfect \" ) exit ( 0 ) print ( \" ambiguous \" ) prev = 0 now = 0 for i in range ( n ) : for j in range ( l [ i ] ) : print ( prev , end = \" ▁ \" ) now += 1 prev = nowprint ( ) prev = 0 now = 0 for i in range ( n ) : for j in range ( l [ i ] ) : if ( ans == i ) : print ( prev - 1 , end = \" ▁ \" ) ans = - 1 else : print ( prev , end = \" ▁ \" ) now += 1 prev = now NEW_LINE" ]
codeforces_1359_A
[ "import java . io . * ; import java . util . * ; import java . text . DecimalFormat ;   public class Main { static long mod = ( long ) 1e9 + 7 ; static long mod1 = 998244353 ;   public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ;    int t = in . nextInt ( ) ; while ( t -- > 0 ) {   int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int k = in . nextInt ( ) ; int z = n / k ; if ( z >= m ) out . println ( m ) ; else { int rem = m - z ; int i = 1 ; while ( i * ( k - 1 ) < rem ) { i ++ ; } if ( i < z ) out . println ( z - i ) ; else out . println ( 0 ) ; }   } out . close ( ) ; }      static final Random random = new Random ( ) ;   static void ruffleSort ( int [ ] a ) { int n = a . length ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ; public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int t = fs . nextInt ( ) ; while ( t -- > 0 ) { int n = fs . nextInt ( ) ; int m = fs . nextInt ( ) ; int k = fs . nextInt ( ) ; int ans = 0 ; int r = n / k ; if ( r >= m ) { ans = m ; } else if ( k > 1 ) ans = r - ( int ) ( Math . ceil ( ( float ) ( m - r ) / ( k - 1 ) ) ) ; System . out . println ( ans ) ; } } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }", "import java . util . Scanner ;   public class _0607BerlandPoker { static int BerlandPoker ( int n , int m , int k ) { int single = n / k ; int jokers = Math . min ( single , m ) ; int remainingJokers = m - jokers ; int ans = 0 ; if ( remainingJokers < ( k - 1 ) ) { if ( remainingJokers != 0 ) { ans += 1 ; } } else { ans += remainingJokers / ( k - 1 ) ; if ( remainingJokers % ( k - 1 ) != 0 ) { ans ++ ; } } return jokers - ans ; }   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cases = sc . nextInt ( ) ; while ( cases > 0 ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( BerlandPoker ( n , m , k ) ) ; cases -- ; } }   }", "import java . util . * ;   public class Solve {   static Scanner scan = new Scanner ( System . in ) ;   public static int ceil ( int x , int y ) { return ( x + y - 1 ) / y ; }   public static void solve ( int n , int m , int k ) {   if ( m == 0 ) { System . out . println ( 0 ) ; } else if ( m < ( n / k ) ) { System . out . println ( m ) ; } else { int val = m - ( n / k ) ; m -= ( n / k ) ; int left = ceil ( m , ( k - 1 ) ) ; System . out . println ( ( n / k ) - left ) ; } }   public static void main ( String [ ] args ) {   int t = scan . nextInt ( ) ; while ( t -- > 0 ) { int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int k = scan . nextInt ( ) ;   solve ( n , m , k ) ; } } }" ]
[ "import matht = int ( input ( ) ) for i in range ( t ) : n , m , k = map ( int , input ( ) . split ( ) ) if m == 0 : print ( 0 ) elif n // k >= m : print ( m ) else : if ( m - n // k ) % ( k - 1 ) == 0 : print ( ( n // k ) - ( ( m - n // k ) // ( k - 1 ) ) ) else : print ( ( n // k ) - ( ( ( m - n // k ) - ( m - n // k ) % ( k - 1 ) ) // ( k - 1 ) + 1 ) ) NEW_LINE", "t = int ( input ( ) )   def poker ( n , m , k ) : hands = n // k winning_hand = min ( hands , m ) m -= winning_hand sub = 0 if m // ( k - 1 ) > 0 : sub += m // ( k - 1 ) if m % ( k - 1 ) > 0 : sub += 1 elif m % ( k - 1 ) > 0 : sub += 1   print ( winning_hand - sub )         for i in range ( t ) : n , m , k = map ( int , input ( ) . split ( ) ) poker ( n , m , k )                     NEW_LINE", "for i in range ( int ( input ( ) ) ) : a , b , c = list ( map ( int , input ( ) . split ( ) ) ) print ( ( a // c ) + ( - ( b - ( a // c ) ) // ( c - 1 ) ) if a // c < b else b ) NEW_LINE", "t = int ( input ( ) )   for i in range ( t ) : n , m , k = map ( int , input ( ) . split ( ) ) d = n // k a1 = min ( m , d ) a2 = ( m - a1 + k - 2 ) // ( k - 1 ) print ( a1 - a2 ) NEW_LINE", "t = int ( input ( ) )   for i in range ( t ) : n , m , k = map ( int , input ( ) . split ( ) ) ans = 0 d = n // k for a1 in range ( m + 1 ) : for a2 in range ( a1 + 1 ) : if ( a1 > d ) : continue if ( a1 + a2 > m ) : continue if ( a1 + ( k - 1 ) * a2 < m ) : continue ans = max ( ans , a1 - a2 ) print ( ans ) NEW_LINE" ]
codeforces_785_A
[ "import java . util . * ; public class AntonPoly { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int out = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String str = s . next ( ) ; if ( str . equals ( \" Tetrahedron \" ) ) { out = out + 4 ; } else if ( str . equals ( \" Cube \" ) ) { out = out + 6 ; } else if ( str . equals ( \" Octahedron \" ) ) { out = out + 8 ; } else if ( str . equals ( \" Dodecahedron \" ) ) { out = out + 12 ; } else if ( str . equals ( \" Icosahedron \" ) ) { out = out + 20 ; } } System . out . println ( out ) ; } }", "import java . util . * ; public class Anton { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; if ( s . contains ( \" Tetrahedron \" ) ) sum = sum + 4 ; else if ( s . contains ( \" Cube \" ) ) sum = sum + 6 ; else if ( s . contains ( \" Octahedron \" ) ) sum = sum + 8 ; else if ( s . contains ( \" Dodecahedron \" ) ) sum = sum + 12 ; else if ( s . contains ( \" Icosahedron \" ) ) sum = sum + 20 ; } System . out . println ( sum ) ; } }", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashMap < String , Integer > hm = new HashMap < String , Integer > ( ) ; hm . put ( \" Tetrahedron \" , 4 ) ; hm . put ( \" Cube \" , 6 ) ; hm . put ( \" Octahedron \" , 8 ) ; hm . put ( \" Dodecahedron \" , 12 ) ; hm . put ( \" Icosahedron \" , 20 ) ; String str ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { str = sc . next ( ) ; sum = sum + hm . get ( str ) ; } System . out . println ( sum ) ;   } }", "import java . util . Scanner ;   public class AntonAndPoly { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; scanner . nextLine ( ) ;   int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String poly = scanner . nextLine ( ) . trim ( ) ; switch ( poly ) { case \" Tetrahedron \" : res += 4 ; break ; case \" Cube \" : res += 6 ; break ; case \" Octahedron \" : res += 8 ; break ; case \" Dodecahedron \" : res += 12 ; break ; case \" Icosahedron \" : res += 20 ; break ; } } System . out . println ( res ) ; } }" ]
[ "n = int ( input ( ) )   mapping = { \" Icosahedron \" : 20 , \" Dodecahedron \" : 12 , \" Cube \" : 6 , \" Octahedron \" : 8 , \" Tetrahedron \" : 4 , }   sum = 0 for i in range ( n ) : string = input ( ) sum += mapping [ string ]   print ( sum ) NEW_LINE", "num_of_hed = int ( input ( ) ) faces = 0   for i in range ( 0 , num_of_hed ) : str1 = input ( ) if str1 [ 0 ] == \" T \" : faces += 4 elif str1 [ 0 ] == \" C \" : faces += 6 elif str1 [ 0 ] == \" O \" : faces += 8 elif str1 [ 0 ] == \" D \" : faces += 12 else : faces += 20   print ( faces ) NEW_LINE", "n = int ( input ( ) ) c = 0 for i in range ( n ) : s = input ( ) if s [ 0 ] == ' T ' : c += 4 elif s [ 0 ] == ' C ' : c += 6 elif s [ 0 ] == ' O ' : c += 8 elif s [ 0 ] == ' D ' : c += 12 elif s [ 0 ] == ' I ' : c += 20 print ( c ) NEW_LINE", "n = int ( input ( ) ) c = 0 for i in range ( n ) : s = input ( ) if ( s == \" Tetrahedron \" ) : c += 4 if ( s == \" Cube \" ) : c += 6 if ( s == \" Octahedron \" ) : c += 8 if ( s == \" Dodecahedron \" ) : c += 12 if ( s == \" Icosahedron \" ) : c += 20 print ( c ) NEW_LINE", "a = int ( input ( ) ) x = 0 for i in range ( a ) : b = input ( ) if b == \" Tetrahedron \" : x += 4 elif b == \" Cube \" : x += 6 elif b == \" Octahedron \" : x += 8 elif b == \" Dodecahedron \" : x += 12 else : x += 20 print ( x ) NEW_LINE" ]
codeforces_67_B
[ "import java . awt . * ; import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . * ; import java . util . List ; import java . util . Queue ;   import static java . lang . Math . max ; import static java . lang . Math . min ;    public class B implements Runnable {  " ]
[ "n , k = map ( int , input ( ) . split ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) )   taken = [ False for i in range ( n + 2 ) ] NEW_LINE a = [ ]   for i in range ( n ) : has = - 1 NEW_LINE for j in range ( 1 , n + 1 ) : if NEW_LINE not taken [ j ] and b [ j - 1 ] == 0 : has = j NEW_LINE break NEW_LINE a . append ( has ) NEW_LINE taken [ has ] = True NEW_LINE for j in range ( 1 , has - k + 1 ) : b [ j - 1 ] -= 1   print ( * a ) NEW_LINE", "s = input ( ) NEW_LINE l = s . split ( )   n = int ( l [ 0 ] ) NEW_LINE k = int ( l [ 1 ] )   s = input ( ) NEW_LINE l = s . split ( )   b = [ - 1 ]   for i in range ( 1 , n + 1 ) : b . append ( int ( l [ i - 1 ] ) )   for i in range ( 1 , n + 1 ) :   NEW_LINE j = 1 NEW_LINE while b [ j ] != 0 : j += 1   b [ j ] -= 1 NEW_LINE print ( j , end = ' ▁ ' )   for t in range ( 1 , n + 1 ) : if NEW_LINE j - k >= t : b [ t ] -= 1   NEW_LINE" ]
codeforces_96_B
[ "import java . util . * ; import java . lang . * ; import java . io . * ; public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) { 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 IOException { FastIO io = new FastIO ( ) ; long n = io . nextInt ( ) ; System . out . println ( findSuperLucky ( n , 0 , 0 , 0 ) ) ; } static long findSuperLucky ( long n , int f , int s , long formed ) { if ( formed >= n && f == s ) { return formed ; } if ( formed > n * 100 ) { return Long . MAX_VALUE ; } return Math . min ( findSuperLucky ( n , f + 1 , s , formed * 10 + 4 ) , findSuperLucky ( n , f , s + 1 , formed * 10 + 7 ) ) ; } }", "import java . io . IOException ; import java . util . * ; import java . util . Arrays ; import java . util . Scanner ; public class Bit_year { static Set < String > set ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; set = new TreeSet < String > ( ) ; System . out . println ( ( long ) permute ( n ) ) ; } public static long permute ( int n ) { int pow = 2 ; while ( pow <= 10 ) { char [ ] ar = new char [ pow ] ; for ( int i = 0 ; i < pow / 2 ; i ++ ) ar [ i ] = '4' ; for ( int i = pow / 2 ; i < pow ; i ++ ) ar [ i ] = '7' ; permuteHelper ( ar , 0 ) ; for ( String s : set ) { if ( Long . parseLong ( s ) >= n ) { return Long . parseLong ( s ) ; } } pow += 2 ; } return 0 ; } private static void permuteHelper ( char [ ] arr , int index ) { if ( index >= arr . length - 1 ) { set . add ( new String ( arr ) ) ; return ; } for ( int i = index ; i < arr . length ; i ++ ) { char t = arr [ index ] ; arr [ index ] = arr [ i ] ; arr [ i ] = t ; permuteHelper ( arr , index + 1 ) ; t = arr [ index ] ; arr [ index ] = arr [ i ] ; arr [ i ] = t ; } } }", "import java . util . * ; public class LuckyNumbersEasy { static ArrayList < Long > arr = new ArrayList < > ( ) ; static double cons = Math . pow ( 10 , 12 ) ; static long n ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; n = sc . nextLong ( ) ; calc ( 0 ) ; Collections . sort ( arr ) ; System . out . println ( arr . get ( 0 ) ) ; } public static void calc ( long i ) { if ( i > cons ) { return ; } String [ ] temp = Long . toString ( i ) . split ( \" \" ) ; long s = 0 ; long f = 0 ; for ( String x : temp ) { if ( x . equals ( \"4\" ) ) { f ++ ; } else { s ++ ; } } if ( i >= n && s == f ) { arr . add ( i ) ; } calc ( ( i * 10 ) + 4 ) ; calc ( ( i * 10 ) + 7 ) ; } }" ]
[ "n = int ( input ( ) ) NEW_LINE l = [ 0 ] NEW_LINE i = 0 NEW_LINE while True : NEW_LINE INDENT t = l [ i ] NEW_LINE if t >= n : NEW_LINE INDENT if str ( t ) . count ( '7' ) == str ( t ) . count ( '4' ) : NEW_LINE INDENT print ( t ) ; NEW_LINE break NEW_LINE DEDENT DEDENT l += [ t * 10 + 4 , t * 10 + 7 ] NEW_LINE i += 1 NEW_LINE DEDENT", "n = int ( input ( ) ) NEW_LINE ls = [ 47 , 74 , 4477 , 4747 , 4774 , 7447 , 7474 , 7744 , 444777 , 447477 , 447747 , 447774 , 474477 , 474747 , 474774 , 477447 , 477474 , 477744 , 744477 , 744747 , 744774 , 747447 , 747474 , 747744 , 774447 , 774474 , 774744 , 777444 , 44447777 , 44474777 , 44477477 , 44477747 , 44477774 , 44744777 , 44747477 , 44747747 , 44747774 , 44774477 , 44774747 , 44774774 , 44777447 , 44777474 , 44777744 , 47444777 , 47447477 , 47447747 , 47447774 , 47474477 , 47474747 , 47474774 , 47477447 , 47477474 , 47477744 , 47744477 , 47744747 , 47744774 , 47747447 , 47747474 , 47747744 , 47774447 , 47774474 , 47774744 , 47777444 , 74444777 , 74447477 , 74447747 , 74447774 , 74474477 , 74474747 , 74474774 , 74477447 , 74477474 , 74477744 , 74744477 , 74744747 , 74744774 , 74747447 , 74747474 , 74747744 , 74774447 , 74774474 , 74774744 , 74777444 , 77444477 , 77444747 , 77444774 , 77447447 , 77447474 , 77447744 , 77474447 , 77474474 , 77474744 , 77477444 , 77744447 , 77744474 , 77744744 , 77747444 , 77774444 , 4444477777 ] NEW_LINE for i in ls : NEW_LINE INDENT if i >= n : NEW_LINE INDENT print ( i ) NEW_LINE break NEW_LINE DEDENT DEDENT", "def luckynumwithequalnumberoffourandseven ( x , n , a ) : NEW_LINE INDENT if x >= n and str ( x ) . count ( \"4\" ) == str ( x ) . count ( \"7\" ) : NEW_LINE INDENT a . append ( x ) NEW_LINE DEDENT else : NEW_LINE INDENT if x < 1e12 : NEW_LINE INDENT luckynumwithequalnumberoffourandseven ( x * 10 + 4 , n , a ) NEW_LINE luckynumwithequalnumberoffourandseven ( x * 10 + 7 , n , a ) NEW_LINE DEDENT DEDENT return a NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE s = [ ] NEW_LINE luckynumwithequalnumberoffourandseven ( 0 , n , s ) NEW_LINE s = sorted ( s ) NEW_LINE print ( s [ 0 ] ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT", "a = [ ] NEW_LINE def f ( n , x ) : NEW_LINE INDENT if x <= 1e11 : NEW_LINE INDENT if x >= n and str ( x ) . count ( '4' ) == str ( x ) . count ( '7' ) : NEW_LINE INDENT a . append ( x ) NEW_LINE DEDENT f ( n , 10 * x + 4 ) NEW_LINE f ( n , 10 * x + 7 ) NEW_LINE DEDENT DEDENT f ( int ( input ( ) ) , 0 ) NEW_LINE a . sort ( ) NEW_LINE print ( a [ 0 ] ) NEW_LINE", "slucky = [ 4 , 7 ] NEW_LINE i = 0 NEW_LINE while slucky [ - 1 ] < 10 ** 9 : NEW_LINE INDENT slucky . append ( slucky [ i ] * 10 + 4 ) NEW_LINE slucky . append ( slucky [ i ] * 10 + 7 ) NEW_LINE i += 1 NEW_LINE DEDENT def superlucky ( n ) : NEW_LINE INDENT four = 0 NEW_LINE seven = 0 NEW_LINE while n > 0 : NEW_LINE INDENT if n % 10 == 4 : NEW_LINE INDENT four += 1 NEW_LINE DEDENT else : NEW_LINE INDENT seven += 1 NEW_LINE DEDENT n = n // 10 NEW_LINE DEDENT if four == seven : NEW_LINE INDENT return True NEW_LINE DEDENT return False NEW_LINE DEDENT lucky = [ ] NEW_LINE for item in slucky : NEW_LINE INDENT if superlucky ( item ) : NEW_LINE INDENT lucky . append ( item ) NEW_LINE DEDENT DEDENT lucky = [ 0 ] + lucky + [ 4444477777 ] NEW_LINE def binarySearch ( n ) : NEW_LINE INDENT left = 0 NEW_LINE right = len ( lucky ) - 1 NEW_LINE mid = ( left + right ) // 2 NEW_LINE while left <= right : NEW_LINE INDENT mid = ( left + right ) // 2 NEW_LINE if lucky [ mid - 1 ] < n <= lucky [ mid ] : NEW_LINE INDENT print ( lucky [ mid ] ) NEW_LINE break NEW_LINE DEDENT elif n > lucky [ mid ] : NEW_LINE INDENT left = mid + 1 NEW_LINE DEDENT else : NEW_LINE INDENT right = mid - 1 NEW_LINE DEDENT DEDENT DEDENT n = int ( input ( ) ) NEW_LINE binarySearch ( n ) NEW_LINE" ]
codeforces_230_A
[ "import java . util . * ; import java . lang . * ; import java . io . * ; public class Main {    public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] arrx = new int [ n ] ; int [ ] arry = new int [ n ] ; int [ ] sortedx = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arrx [ i ] = sc . nextInt ( ) ; sortedx [ i ] = arrx [ i ] ; arry [ i ] = sc . nextInt ( ) ; } Arrays . sort ( sortedx ) ; boolean ans = true ; for ( int i = 0 ; i < n ; i ++ ) { if ( sortedx [ i ] < s ) { int idx = find ( sortedx [ i ] , arrx ) ; s += arry [ idx ] ; } else { ans = false ; break ; } } if ( ans ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } public static int find ( int x , int [ ] arr ) { int ans = 0 ; for ( int i = 0 ; i < arr . length ; i ++ ) { if ( arr [ i ] == x ) { ans = i ; arr [ i ] = - 1 ; break ; } } return ans ; } }", "  import java . util . * ;   public class DemoObj { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; int n = sc . nextInt ( ) ;   int arr [ ] [ ] = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { arr [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] [ 0 ] < s ) { s += arr [ i ] [ 1 ] ; arr [ i ] = arr [ n - 1 ] ; n -- ; i = - 1 ; } } if ( n == 0 ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } }", "import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {", "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int s = scan . nextInt ( ) ; int n = scan . nextInt ( ) ; int [ ] [ ] array = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] [ 0 ] = scan . nextInt ( ) ; array [ i ] [ 1 ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( s > array [ i ] [ 0 ] ) { s += array [ i ] [ 1 ] ; array [ i ] = array [ n - 1 ] ; i = - 1 ; n -- ; } } if ( n == 0 ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } }" ]
[ "f = lambda : map ( int , input ( ) . split ( ) ) s , n = f ( ) for a , b in sorted ( list ( f ( ) ) for i in ' ▁ ' * n ) : s = ( s + b ) * ( s > a ) print ( ' YNEOS ' [ s < 1 : : 2 ] ) NEW_LINE", "s , n = [ int ( i ) for i in input ( ) . split ( ) ] dr = [ ]   for i in range ( n ) : dr . append ( [ int ( j ) for j in input ( ) . split ( ) ] )   dr . sort ( )   for i in range ( n ) : if s > dr [ i ] [ 0 ] : s += dr [ i ] [ 1 ] else : print ( \" NO \" ) exit ( 0 ) print ( \" YES \" )       NEW_LINE", "import sysimport itertoolsimport collections     def rs ( x = ' ' ) : return sys . stdin . readline ( ) . strip ( ) if len ( x ) == 0 else input ( x ) . strip ( ) def ri ( x = ' ' ) : return int ( rs ( x ) ) def rm ( x = ' ' ) : return map ( str , rs ( x ) . split ( ) ) def rl ( x = ' ' ) : return rs ( x ) . split ( ) def rmi ( x = ' ' ) : return map ( int , rs ( x ) . split ( ) ) def rli ( x = ' ' ) : return [ int ( x ) for x in rs ( x ) . split ( ) ] def println ( val ) : sys . stdout . write ( str ( val ) + ' \\n ' )     def solve ( testCase ) : s , n = rmi ( ) A = [ tuple ( rmi ( ) ) for _ in range ( n ) ] A . sort ( ) for x , y in A : if x < s : s += y else : print ( ' NO ' ) return print ( ' YES ' )     for _ in range ( ri ( ) if 0 else 1 ) : solve ( _ + 1 ) NEW_LINE", "a = lambda : map ( int , input ( ) . split ( ) ) s , n = a ( ) g = 0 l = [ ] for i in ' ▁ ' * n : l . append ( ( list ( a ( ) ) ) ) l . sort ( ) for i in range ( n ) : if l [ i ] [ 0 ] < s : s += l [ i ] [ 1 ] else : g = 1 print ( [ ' YES ' , ' NO ' ] [ g == 1 ] ) NEW_LINE", "s , n = map ( int , input ( ) . split ( ) ) dragons = [ ] for i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) dragons += [ [ x , y ] ] dragons . sort ( ) ans = ' YES ' for i in range ( n ) : if s > dragons [ i ] [ 0 ] : s += dragons [ i ] [ 1 ] else : ans = ' NO ' breakprint ( ans ) NEW_LINE" ]
codeforces_1293_A
[ "import java . util . * ; import java . math . * ; public class ConnerAndMarkland { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int n = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; ArrayList < Integer > arr = new ArrayList < > ( ) ; for ( int i = 0 ; i < k ; i ++ ) arr . add ( sc . nextInt ( ) ) ;   for ( int i = 0 ; i <= k ; i ++ ) { if ( s - i >= 1 && ! arr . contains ( s - i ) ) { System . out . println ( i ) ; break ; } if ( s + i <= n && ! arr . contains ( s + i ) ) { System . out . println ( i ) ; break ; } } } } }", "import java . util . * ; import java . io . * ; import java . math . * ;     public class A {   private static long INF = 2000000000000000000L , M = 1000000007 , MM = 998244353 ; private static int N = 0 ;   public static void process ( ) throws IOException {   long n = sc . nextLong ( ) , s = sc . nextLong ( ) ; int k = sc . nextInt ( ) ; HashSet < Long > set = new HashSet < Long > ( ) ; long i = s , j = s ; for ( int ii = 0 ; ii < k ; ii ++ ) { long a = sc . nextLong ( ) ; set . add ( a ) ; while ( set . contains ( j ) ) j ++ ; while ( set . contains ( i ) ) i -- ; } long min = INF ; if ( i > 0 ) min = min ( min , s - i ) ; if ( j <= n ) min = min ( min , j - s ) ; System . out . println ( min ) ;   }  ", "import java . util . * ; import java . io . * ;   public class CFA { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ;" ]
[ "for _ in range ( int ( input ( ) ) ) : n , s , k = [ int ( x ) for x in input ( ) . split ( ) ] fl = { int ( x ) for x in input ( ) . split ( ) } i = 0 while 1 : if max ( s - i , 1 ) not in fl or min ( n , s + i ) not in fl : print ( i ) ; break i += 1 NEW_LINE", "for _ in range ( int ( input ( ) ) ) :   n , k , s = map ( int , input ( ) . split ( ) ) t = list ( map ( int , input ( ) . split ( ) ) )   if k not in t : print ( 0 ) else : dist = 1 while k + dist <= n or k - dist >= 1 : if k + dist > n : if k - dist not in t : break elif k - dist <= 0 : if k + dist not in t : break elif k + dist not in t or k - dist not in t : break dist += 1 print ( dist ) NEW_LINE", "adet = int ( input ( ' ' ) ) liste = [ ] for _ in range ( adet ) : p1 = input ( ' ' ) p2 = input ( ' ' ) liste . append ( ( p1 , p2 ) ) for __ in liste : occ = __ [ 1 ] . split ( ) mevcut_konum = int ( __ [ 0 ] . split ( ) [ 1 ] ) finder1 = mevcut_konum finder2 = mevcut_konum while True : if str ( finder1 ) not in occ : print ( abs ( finder1 - mevcut_konum ) ) break elif str ( finder2 ) not in occ : print ( abs ( finder2 - mevcut_konum ) ) break if finder1 < int ( __ [ 0 ] . split ( ) [ 0 ] ) : finder1 += 1 if finder2 > 1 : finder2 -= 1 NEW_LINE" ]
codeforces_318_B
[ "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 ) ; String s = sc . next ( ) ; char [ ] ch = s . toCharArray ( ) ; List < Integer > heavy = new ArrayList < Integer > ( ) ; List < Integer > metal = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < ch . length ; i ++ ) { if ( i + 5 > s . length ( ) ) break ; String t = s . substring ( i , i + 5 ) ;", "import java . util . * ; import java . io . * ; import java . lang . * ; public class Codeforces { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; String next ( ) { if ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) {   } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public static void main ( String [ ] args ) { new Codeforces ( ) . solve ( ) ; } void solve ( ) { String str = next ( ) ; long cnt = 0 , res = 0 ; for ( int i = 0 ; i < str . length ( ) - 4 ; i ++ ) { if ( str . substring ( i , i + 5 ) . equals ( \" heavy \" ) ) cnt ++ ; else if ( str . substring ( i , i + 5 ) . equals ( \" metal \" ) ) res += cnt ; } out . println ( res ) ; out . close ( ) ; } }", "    import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import javafx . util . Pair ;   public class CodeForce { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringBuilder sb = new StringBuilder ( ) ;   static boolean flag = false ; static int next ( String [ ] sr , int ind ) { return Integer . parseInt ( sr [ ind ] ) ; }   public static void main ( String [ ] args ) throws IOException { String sr = br . readLine ( ) ; long count = 0 ; long total = 0 ; if ( sr . length ( ) < 10 ) System . out . println ( \"0\" ) ; else { for ( int i = sr . length ( ) - 5 ; i >= 0 ; i -- ) { if ( sr . charAt ( i ) == ' m ' ) { if ( sr . substring ( i , i + 5 ) . equals ( \" metal \" ) ) count ++ ; } if ( sr . charAt ( i ) == ' h ' ) { if ( sr . substring ( i , i + 5 ) . equals ( \" heavy \" ) ) total += count ; } } System . out . println ( total ) ;      }       }    }", "import java . io . * ; import java . util . * ;   public class Main { static BufferedReader reader ; static StringTokenizer tokenizer ; static PrintWriter writer ;   static int nextInt ( ) throws IOException { return Integer . parseInt ( nextToken ( ) ) ; }   static long nextLong ( ) throws IOException { return Long . parseLong ( nextToken ( ) ) ; }   static double nextDouble ( ) throws IOException { return Double . parseDouble ( nextToken ( ) ) ; }   static String nextToken ( ) throws IOException { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } return tokenizer . nextToken ( ) ; } static String nexts ( ) throws IOException { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; String s = \" \" ; while ( tokenizer . hasMoreTokens ( ) ) { s += tokenizer . nextElement ( ) + \" ▁ \" ; } return s ; }  " ]
[ "import sys   text = sys . stdin . readline ( ) . strip ( )   i = 0 heavys = 0 result = 0 while ( i + 5 ) <= len ( text ) : if text [ i : i + 5 ] == \" heavy \" : heavys += 1 i += 5 elif text [ i : i + 5 ] == \" metal \" : result += heavys i += 5 else : i += 1 print ( result )   NEW_LINE", "string = input ( ' ' ) heavy = list ( ) metal = list ( ) start = 0 while ( string . find ( \" heavy \" , start ) != - 1 ) : heavy . append ( string . find ( \" heavy \" , start ) ) start = string . find ( \" heavy \" , start ) + 5 start = 0 while ( string . find ( \" metal \" , start ) != - 1 ) : metal . append ( string . find ( \" metal \" , start ) ) start = string . find ( \" metal \" , start ) + 5 start = 0 output = 0 for i in range ( len ( heavy ) ) : for j in range ( start , len ( metal ) ) : if heavy [ i ] > metal [ j ] : continue else : output = output + ( len ( metal ) - j ) start = j break   print ( output ) NEW_LINE", "s = input ( ) l = len ( s ) i = length = sub = 0 while 1 : if i <= l - 5 : if s [ i : i + 5 ] == ' heavy ' : length += 1 i += 5 elif s [ i : i + 5 ] == ' metal ' : sub += length i += 5 else : i += 1 else : breakprint ( sub ) NEW_LINE", "aisa = input ( ) kyu = 0 channa = 0 for i in range ( len ( aisa ) - 4 ) : if aisa [ i : i + 5 ] == ' heavy ' : kyu += 1 if aisa [ i : i + 5 ] == ' metal ' : channa += kyuprint ( channa )   NEW_LINE" ]
codeforces_1323_A
[ "import java . util . * ; import java . io . * ; public class a { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- > 0 ) { int n = s . nextInt ( ) ; int [ ] arr = new int [ n + 1 ] ; for ( int i = 1 ; i < arr . length ; i ++ ) { arr [ i ] = s . nextInt ( ) ; } if ( n == 1 && arr [ 1 ] % 2 != 0 ) { System . out . println ( \" - 1\" ) ; } else if ( arr [ 1 ] % 2 == 0 ) { System . out . println ( \"1\" ) ; System . out . println ( \"1\" ) ; } else if ( arr [ 2 ] % 2 == 0 ) { System . out . println ( \"1\" ) ; System . out . println ( \"2\" ) ; } else { System . out . println ( \"2\" ) ; System . out . println ( \"1 ▁ 2\" ) ; } } } }", "import java . util . * ; public class Practi {   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 [ 105 ] ; for ( int i = 1 ; i <= n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } if ( n == 1 && arr [ 1 ] % 2 == 1 ) System . out . println ( \" - 1\" ) ; else { if ( arr [ 1 ] % 2 == 0 ) System . out . println ( \"1 \\n 1\" ) ; else if ( arr [ 2 ] % 2 == 0 ) System . out . println ( \"1 \\n 2\" ) ; else System . out . println ( \"2 \\n 1 ▁ 2\" ) ; } } }   }", "import java . util . * ; import java . io . * ; import java . lang . * ;   public class Solution { 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 id = - 1 ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( arr [ i ] % 2 == 1 ) a . add ( i + 1 ) ; else if ( id == - 1 ) id = i + 1 ; } if ( id != - 1 ) { System . out . print ( 1 + \" \\n \" + id ) ; System . out . println ( ) ; } else { if ( a . size ( ) >= 2 ) { System . out . print ( 2 + \" \\n \" + a . get ( 0 ) + \" ▁ \" + a . get ( 1 ) ) ; System . out . println ( ) ; } else System . out . println ( - 1 ) ; } } } }" ]
[ "for _ in [ 0 ] * int ( input ( ) ) : n = input ( ) a = [ * map ( int , input ( ) . split ( ) ) ] if a [ 0 ] % 2 == 0 : print ( '1 \\n 1' ) elif n == '1' : print ( - 1 ) elif a [ 1 ] % 2 == 0 : print ( '1 \\n 2' ) else : print ( '2 \\n 1 ▁ 2' ) NEW_LINE", "T = int ( input ( ) ) while T > 0 : T -= 1 n = int ( input ( ) ) lst = [ int ( x ) for x in input ( ) . strip ( ) . split ( ) ] if len ( lst ) == 0 : print ( - 1 ) continue if len ( lst ) == 1 and lst [ 0 ] % 2 : print ( - 1 ) continue d = lst [ 0 ] if not d % 2 : print ( \"1 \\n 1\" ) continue if lst [ 1 ] % 2 : print ( \"2 \\n 1 ▁ 2\" ) else : print ( \"1 \\n 2\" ) NEW_LINE", "from sys import stdininput = stdin . readline   t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] if n == 1 and a [ 0 ] % 2 > 0 : print ( - 1 ) continue odd = [ ] for i in range ( n ) : if a [ i ] % 2 == 0 : print ( 1 ) print ( i + 1 ) break else : odd . append ( i + 1 ) if len ( odd ) == 2 : print ( 2 ) print ( * odd ) break NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) c = 0 for i in range ( n ) : if a [ i ] % 2 == 0 : print ( 1 ) print ( i + 1 ) c += 1 break if c == 0 : for j in range ( n ) : if n == 1 : print ( - 1 ) c += 1 break elif a [ j ] % 2 != 0 and a [ j + 1 ] % 2 != 0 : print ( 2 ) print ( j + 1 , j + 2 ) c += 1 break if c == 0 : print ( - 1 ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = tuple ( map ( int , input ( ) . split ( ) ) ) if n == 1 : if not a [ 0 ] % 2 : print ( 1 ) print ( 1 ) else : print ( - 1 ) else : if not a [ 0 ] % 2 : print ( 1 ) print ( 1 ) elif not a [ 1 ] % 2 : print ( 1 ) print ( 2 ) else : print ( 2 ) print ( 1 , 2 ) NEW_LINE" ]
codeforces_190_B
[ "import java . util . * ; import java . io . * ; import java . math . * ;   public class x190B { public static void main ( String omkar [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; long x1 = Long . parseLong ( st . nextToken ( ) ) ; long y1 = Long . parseLong ( st . nextToken ( ) ) ; long r1 = Long . parseLong ( st . nextToken ( ) ) ; st = new StringTokenizer ( infile . readLine ( ) ) ; long x2 = Long . parseLong ( st . nextToken ( ) ) ; long y2 = Long . parseLong ( st . nextToken ( ) ) ; long r2 = Long . parseLong ( st . nextToken ( ) ) ; double dist = ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ; dist = Math . sqrt ( dist ) ; dist -= r1 + r2 ; if ( dist > 0 ) System . out . println ( dist / 2 ) ; else {", "import java . util . ArrayList ; import java . util . Scanner ;   public class Surrounded { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; ArrayList < Integer > firstInput = new ArrayList < > ( ) ; ArrayList < Integer > secondInput = new ArrayList < > ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { firstInput . add ( s . nextInt ( ) ) ; } for ( int i = 0 ; i < 3 ; i ++ ) { secondInput . add ( s . nextInt ( ) ) ; }   getMinRadius ( firstInput , secondInput ) ;   }   private static void getMinRadius ( ArrayList < Integer > firstInput , ArrayList < Integer > secondInput ) { double eucledianDistance = getEucledianDistance ( firstInput , secondInput ) ; double diameter = eucledianDistance - ( firstInput . get ( 2 ) + secondInput . get ( 2 ) ) ; double radius = diameter / 2.0 ; if ( radius <= 0 ) { if ( Math . max ( firstInput . get ( 2 ) , secondInput . get ( 2 ) ) > eucledianDistance + Math . min ( firstInput . get ( 2 ) , secondInput . get ( 2 ) ) ) { System . out . printf ( \" % .15f \" , Math . abs ( radius ) - Math . min ( firstInput . get ( 2 ) , secondInput . get ( 2 ) ) ) ; } else { System . out . printf ( \" % .15f \" , 0f ) ; } } else { System . out . printf ( \" % .15f \" , radius ) ;   } }   private static double getEucledianDistance ( ArrayList < Integer > firstInput , ArrayList < Integer > secondInput ) { return Math . sqrt ( Math . pow ( secondInput . get ( 1 ) - firstInput . get ( 1 ) , 2 ) + Math . pow ( secondInput . get ( 0 ) - firstInput . get ( 0 ) , 2 ) ) ; }   }", "import java . io . * ; import java . util . * ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import java . text . DecimalFormat ; import java . lang . Math ; import java . util . Iterator ; public class b90 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x1 = sc . nextInt ( ) ; int y1 = sc . nextInt ( ) ; int r1 = sc . nextInt ( ) ; int x2 = sc . nextInt ( ) ; int y2 = sc . nextInt ( ) ; int r2 = sc . nextInt ( ) ; double d = Math . sqrt ( Math . pow ( x1 - x2 , 2 ) + Math . pow ( y1 - y2 , 2 ) ) ; if ( Math . pow ( x1 , 2 ) + Math . pow ( y1 , 2 ) == Math . pow ( r1 , 2 ) && Math . pow ( x2 , 2 ) + Math . pow ( y2 , 2 ) == Math . pow ( r2 , 2 ) ) { System . out . println ( 0 ) ; } else if ( d <= ( double ) ( r1 + r2 ) && 2 * d >= ( double ) ( r1 + r2 ) ) { System . out . println ( 0 ) ; } else if ( d < ( double ) Math . max ( r1 , r2 ) ) { System . out . println ( ( ( double ) Math . max ( r1 , r2 ) - ( d + ( double ) Math . min ( r1 , r2 ) ) ) / 2 ) ; } else { System . out . println ( ( d - ( double ) ( r1 + r2 ) ) / 2 ) ; } } }" ]
[ "import mathx1 , y1 , r1 = map ( int , input ( ) . split ( ) ) x2 , y2 , r2 = map ( int , input ( ) . split ( ) ) d = math . sqrt ( ( x1 - x2 ) ** 2 + ( y1 - y2 ) ** 2 ) R = max ( r1 , r2 ) r = min ( r1 , r2 ) NEW_LINE", "from math import sqrtx1 , y1 , r1 = map ( int , input ( ) . split ( ) ) x2 , y2 , r2 = map ( int , input ( ) . split ( ) )   d = sqrt ( ( x1 - x2 ) ** 2 + ( y1 - y2 ) ** 2 ) if d > r1 + r2 : print ( ( d - ( r1 + r2 ) ) / 2 ) elif d < abs ( r1 - r2 ) : print ( ( abs ( r1 - r2 ) - d ) / 2 ) else : print ( 0 ) NEW_LINE", "import sysimport mathdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def rinput ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) mod = int ( 1e9 ) + 7   x1 , y1 , r1 = rinput ( ) x2 , y2 , r2 = rinput ( )   d = math . sqrt ( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) ) - r1 - r2r = d / 2 f = - ( r + min ( r1 , r2 ) ) NEW_LINE", "x1 , y1 , r1 = list ( map ( float , input ( ) . split ( ) ) ) x2 , y2 , r2 = list ( map ( float , input ( ) . split ( ) ) ) if r1 > r2 : r2 , r1 = r1 , r2d = ( ( x2 - x1 ) ** 2 + ( y2 - y1 ) ** 2 ) ** ( 0.5 ) if d > r1 + r2 : print ( ( d - ( r1 + r2 ) ) / 2 ) elif r2 > d + r1 : print ( ( r2 - ( r1 + d ) ) / 2 ) else : print ( 0 ) NEW_LINE", "import math   x1 , y1 , r1 = map ( int , input ( ) . split ( ) ) x2 , y2 , r2 = map ( int , input ( ) . split ( ) )   d = ( x2 - x1 ) ** 2 + ( y2 - y1 ) ** 2 ans = 0.0   if ( d >= ( r1 + r2 ) ** 2 ) : ans = math . sqrt ( d ) - r1 - r2   elif ( d >= ( r1 - r2 ) ** 2 ) : ans = 0.0   else : ans = abs ( r1 - r2 ) - math . sqrt ( d )   ans /= 2 print ( ans ) NEW_LINE" ]
codeforces_897_B
[ "import java . util . Scanner ;   public class B897 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; long mod = in . nextInt ( ) ; long answer = 0 ; for ( int n = 1 ; n <= N ; n ++ ) { String nTxt = Integer . toString ( n ) ; long zcy = Long . parseLong ( nTxt + new StringBuilder ( nTxt ) . reverse ( ) ) ; answer += zcy ; answer %= mod ; } System . out . println ( answer ) ; }   }", "import java . util . Scanner ;   public class Eieve {   public static void main ( String args [ ] ) {   Scanner input = new Scanner ( System . in ) ;   long k = input . nextLong ( ) , p = input . nextLong ( ) ; long j = 0 , i1 = 0 , sum = 0 , c = 1 , j1 = 0 ;   for ( int i = 1 ; i <= k ; i ++ ) { j = i ; j1 = i ; while ( j1 > 0 ) {   j = j * 10 + j1 % 10 ;", "import java . math . BigInteger ; import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int k = in . nextInt ( ) ; int p = in . nextInt ( ) ; BigInteger sum = new BigInteger ( \"0\" ) ; String newNum = \" \" ; String num ; for ( int i = 1 ; i <= k ; i ++ ) { num = i + \" \" ; newNum = num ; for ( int j = num . length ( ) - 1 ; j >= 0 ; j -- ) { newNum += num . charAt ( j ) ; } BigInteger n = new BigInteger ( newNum ) ; sum = sum . add ( n ) ; } String pb1 = p + \" \" ; BigInteger pb2 = new BigInteger ( pb1 ) ; System . out . println ( sum . mod ( pb2 ) ) ; in . close ( ) ; }   }  ", "import java . io . * ; import java . util . * ; import java . lang . * ;   public class Rextester { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; br . close ( ) ; int n = new Integer ( st . nextToken ( ) ) ; int k = new Integer ( st . nextToken ( ) ) ; int p = 0 ; long ans = 0 ; StringBuffer sb = new StringBuffer ( \"11\" ) ; for ( int a = 0 ; a < n ; a ++ ) { long x = new Long ( sb . toString ( ) ) ;", "import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int P = scan . nextInt ( ) ; long sum = 0 ; for ( int i = 1 ; i <= k ; i ++ ) { String first = i + \" \" ; StringBuilder last = new StringBuilder ( first ) . reverse ( ) ; sum += Long . parseLong ( first + last ) ; sum = sum % P ; } System . out . println ( sum ) ; } }" ]
[ "k , p = map ( int , input ( ) . split ( ) ) res = 0 for i in range ( 1 , k + 1 ) : res += int ( str ( i ) + ( str ( i ) [ : : - 1 ] ) ) res %= pprint ( res ) NEW_LINE", "k , p = map ( int , input ( ) . split ( ) ) res = 0 for i in range ( 1 , k + 1 ) : res += int ( str ( i ) + ( str ( i ) [ : : - 1 ] ) ) res %= pprint ( res ) NEW_LINE", "\"\"\" ▁ ▁ ▁ ▁ Chtholly ' s ▁ request ▁ ▁ ▁ ▁ You ▁ can ▁ solve ▁ it ▁ recursively \"\"\" import math , sysdef nextZCY ( num ) : NEW_LINE", "def main ( ) :   k , p = map ( int , input ( ) . split ( ) )   table = [ 0 ] * ( k + 5 ) table [ 0 ] = 1 for i in range ( 1 , k + 5 ) : table [ i ] = table [ i - 1 ] * 10 table [ i ] %= p ans = 0 for i in range ( 1 , k + 1 ) : d = len ( str ( i ) ) j = list ( str ( i ) ) j . reverse ( ) j = int ( ' ' . join ( j ) ) ans += i * table [ d ] + j ans %= p print ( ans )   if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE" ]
codeforces_560_B
[ "import java . util . * ; import java . util . Scanner ; import java . io . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ;   import javax . lang . model . util . ElementScanner6 ;   public class pcc15c {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int t = 1 ;", "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 {   public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ; int a1 = input . nextInt ( ) ; int b1 = input . nextInt ( ) ; int a2 = input . nextInt ( ) ; int b2 = input . nextInt ( ) ; int a3 = input . nextInt ( ) ; int b3 = input . nextInt ( ) ; if ( ( a2 + a3 ) <= a1 && Math . max ( b2 , b3 ) <= b1 ) { System . out . println ( \" YES \" ) ; } else if ( ( a2 + a3 ) <= b1 && Math . max ( b2 , b3 ) <= a1 ) { System . out . println ( \" YES \" ) ; } else if ( ( a2 + b3 ) <= a1 && Math . max ( b2 , a3 ) <= b1 ) { System . out . println ( \" YES \" ) ; } else if ( ( a2 + b3 ) <= b1 && Math . max ( b2 , a3 ) <= a1 ) { System . out . println ( \" YES \" ) ; } else if ( ( b2 + a3 ) <= b1 && Math . max ( a2 , b3 ) <= a1 ) { System . out . println ( \" YES \" ) ; } else if ( ( b2 + a3 ) <= a1 && Math . max ( a2 , b3 ) <= b1 ) { System . out . println ( \" YES \" ) ; } else if ( ( b2 + b3 ) <= a1 && Math . max ( a2 , a3 ) <= b1 ) { System . out . println ( \" YES \" ) ; } else if ( ( b2 + b3 ) <= b1 && Math . max ( a2 , a3 ) <= a1 ) { System . out . println ( \" YES \" ) ; } else System . out . println ( \" NO \" ) ; }   }" ]
[ "from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) def fn ( x , y , p , q ) : if y + q <= b and max ( x , p ) <= l : return True if x + p <= l and max ( y , q ) <= b : return True return Falsefor _ in range ( 1 ) : NEW_LINE", "I = lambda : [ * map ( int , input ( ) . split ( ) ) ] z , u , v = I ( ) , I ( ) , I ( ) r = 0 for x , y in ( z , z [ : : - 1 ] ) : for a , b in ( u , u [ : : - 1 ] ) : for c , d in ( v , v [ : : - 1 ] ) : r |= a + c <= x and max ( b , d ) <= yprint ( ' YNEOS ' [ 1 - r : : 2 ] ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) c , d = map ( int , input ( ) . split ( ) ) e , f = map ( int , input ( ) . split ( ) )   for A , B in [ ( a , b ) , ( b , a ) ] : for C , D in [ ( c , d ) , ( d , c ) ] : for E , F in [ ( e , f ) , ( f , e ) ] : if C + E <= A and max ( D , F ) <= B : print ( ' YES ' ) exit ( ) print ( ' NO ' ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) a1 , b1 = map ( int , input ( ) . split ( ) ) a2 , b2 = map ( int , input ( ) . split ( ) ) ar1 = n * mar2 = ( a1 * b1 ) + ( a2 * b2 ) a = a1 + a2b = a1 + b2c = a2 + b1d = b1 + b2t = 1 def fu ( su , q , w , n , m ) : t = 1 mi = min ( n , m ) ma = max ( n , m ) if ( su <= mi ) : if ( q <= ma and w <= ma ) : return t else : t = 0 return t   elif ( su <= ma ) : if ( q <= mi and w <= mi ) : return t else : t = 0 return t else :   t = 0 return t z1 = fu ( a , b1 , b2 , n , m ) z2 = fu ( b , b1 , a2 , n , m ) z3 = fu ( c , a1 , b2 , n , m ) z4 = fu ( d , a1 , a2 , n , m ) NEW_LINE", "    a , b = [ int ( x ) for x in input ( ) . split ( ) ] c , d = [ int ( x ) for x in input ( ) . split ( ) ] e , f = [ int ( x ) for x in input ( ) . split ( ) ] def do ( a , b , c , d , e , f ) : for i in range ( 1 , 5 ) : if ( c + e <= a and d <= b and f <= b ) or ( d + f <= b and c <= a and e <= a ) : return \" YES \" if i % 2 : c , d = d , c e , f = f , e return \" NO \" print ( do ( a , b , c , d , e , f ) ) NEW_LINE" ]
codeforces_652_B
[ "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 print ( int [ ] arr ) { for ( int i = 0 ; i < arr . length ; i ++ ) { if ( i == arr . length - 1 ) System . out . print ( arr [ i ] ) ; else System . out . print ( arr [ i ] + \" ▁ \" ) ; } System . out . println ( ) ; } public static boolean method ( int [ ] arr ) { boolean flag = true ; for ( int i = 1 ; i < arr . length ; i += 2 ) { if ( arr [ i ] < arr [ i - 1 ] ) { int temp = arr [ i ] ; arr [ i ] = arr [ i - 1 ] ; arr [ i - 1 ] = temp ; } } for ( int i = 2 ; i < arr . length ; i += 2 ) { if ( arr [ i ] > arr [ i - 1 ] ) { int temp = arr [ i ] ; arr [ i ] = arr [ i - 1 ] ; arr [ i - 1 ] = temp ; } } for ( int i = 1 ; i < arr . length ; i ++ ) { if ( i % 2 != 0 && arr [ i ] < arr [ i - 1 ] ) flag = false ; else if ( i % 2 == 0 && arr [ i ] > arr [ i - 1 ] ) flag = false ; } return flag ; } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; String s = br . readLine ( ) ; String [ ] s1 = s . split ( \" ▁ \" ) ; int [ ] arr = new int [ x ] ; for ( int j = 0 ; j < s1 . length ; j ++ ) { arr [ j ] = ( Integer . parseInt ( s1 [ j ] ) ) ; } if ( method ( arr ) ) print ( arr ) ; else System . out . println ( \" Impossible \" ) ; } }", "import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = ( int ) sc . nextLong ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; Long [ ] x = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = sc . nextLong ( ) ; } Arrays . sort ( x ) ; int z = n / 2 ; if ( n % 2 == 0 ) { for ( int i = 0 ; i < z ; i ++ ) { if ( i != 0 ) System . out . print ( \" ▁ \" ) ; System . out . print ( x [ i ] + \" ▁ \" + x [ x . length - i - 1 ] ) ; } } else { for ( int i = 0 ; i < z ; i ++ ) { if ( i != 0 ) System . out . print ( \" ▁ \" ) ; System . out . print ( x [ i ] + \" ▁ \" + x [ x . length - i - 1 ] ) ; } System . out . print ( \" ▁ \" + x [ z ] ) ; } } }", "import java . io . IOException ; import java . io . PrintWriter ; import java . util . * ; public class Main {   public static void main ( String [ ] args ) throws IOException {", "import java . io . * ; import java . util . * ; public class Mangos { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = ( int ) sc . nextLong ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; Long [ ] x = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = sc . nextLong ( ) ; } Arrays . sort ( x ) ; int z = n / 2 ; if ( n % 2 == 0 ) { for ( int i = 0 ; i < z ; i ++ ) { if ( i != 0 ) System . out . print ( \" ▁ \" ) ; System . out . print ( x [ i ] + \" ▁ \" + x [ x . length - i - 1 ] ) ; } } else { for ( int i = 0 ; i < z ; i ++ ) { if ( i != 0 ) System . out . print ( \" ▁ \" ) ; System . out . print ( x [ i ] + \" ▁ \" + x [ x . length - i - 1 ] ) ; } System . out . print ( \" ▁ \" + x [ z ] ) ; } } }" ]
[ "n = int ( input ( ) ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( )   arr . sort ( ) NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = [ ] check = sorted ( a ) i , j = 0 , n - 1 while i < j : ans . append ( check [ i ] ) ans . append ( check [ j ] ) i += 1 j -= 1 if i == j : ans . append ( check [ i ] ) print ( * ans ) 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 ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr . sort ( ) x = [ ] z = 1 for i in range ( n // 2 ) : x . append ( arr [ i ] ) x . append ( arr [ len ( arr ) - i - 1 ] ) if n % 2 == 1 : x . append ( arr [ ( n // 2 ) ] ) for i in range ( n ) : if i % 2 == 1 : if x [ i ] < x [ i - 1 ] : print ( \" Impossible \" ) z = 0 break else : if x [ i ] > x [ i - 1 ] : print ( \" Impossible \" ) z = 0 breakif z != 0 : print ( ' ▁ ' . join ( map ( str , x ) ) ) NEW_LINE", "n = int ( input ( ) ) array = list ( map ( int , input ( ) . split ( ) ) ) array . sort ( ) ans = [ ]   for i in range ( n // 2 ) : ans . append ( array [ i ] ) ans . append ( array [ n - i - 1 ] )   if len ( array ) % 2 != 0 : ans . append ( array [ n // 2 ] ) print ( \" ▁ \" . join ( [ str ( i ) for i in ans ] ) ) NEW_LINE", "n = int ( input ( ) )   numero = input ( ) . split ( ) for i in range ( n ) : numero [ i ] = int ( numero [ i ] )     if n == 1 : print ( numero [ 0 ] ) else : for i in range ( 1 , n ) : if i % 2 != 0 and numero [ i ] < numero [ i - 1 ] : auxiliar = numero [ i ] numero [ i ] = numero [ i - 1 ] numero [ i - 1 ] = auxiliar elif i % 2 == 0 and numero [ i ] > numero [ i - 1 ] : auxiliar = numero [ i ] numero [ i ] = numero [ i - 1 ] numero [ i - 1 ] = auxiliar   respuesta = str ( numero [ 0 ] ) for i in range ( 1 , n ) : respuesta = respuesta + ' ▁ ' + str ( numero [ i ] ) print ( respuesta ) NEW_LINE" ]
codeforces_69_B
[ "import java . util . * ; import java . io . * ; public class Bets {   public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) , m = Integer . parseInt ( st . nextToken ( ) ) ; int a [ ] [ ] = new int [ m ] [ 4 ] ; for ( int i = 0 ; i < m ; i ++ ) { StringTokenizer s = new StringTokenizer ( br . readLine ( ) ) ; a [ i ] [ 0 ] = Integer . parseInt ( s . nextToken ( ) ) ; a [ i ] [ 1 ] = Integer . parseInt ( s . nextToken ( ) ) ; a [ i ] [ 2 ] = Integer . parseInt ( s . nextToken ( ) ) ; a [ i ] [ 3 ] = Integer . parseInt ( s . nextToken ( ) ) ; } int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int min = 10001 , max = 0 , position = - 1 ; for ( int p = 0 ; p < m ; p ++ ) { if ( a [ p ] [ 0 ] <= i && a [ p ] [ 1 ] >= i ) { if ( a [ p ] [ 2 ] < min ) { min = a [ p ] [ 2 ] ; position = p ; }", "import java . util . Arrays ; import java . util . Scanner ;   public class B69 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int M = in . nextInt ( ) ; int [ ] minTime = new int [ N ] ; Arrays . fill ( minTime , Integer . MAX_VALUE ) ; int [ ] money = new int [ N ] ; for ( int m = 0 ; m < M ; m ++ ) { int L = in . nextInt ( ) - 1 ; int R = in . nextInt ( ) - 1 ; int T = in . nextInt ( ) ; int C = in . nextInt ( ) ; for ( int n = L ; n <= R ; n ++ ) { if ( T < minTime [ n ] ) { money [ n ] = C ; minTime [ n ] = T ; } } } int answer = 0 ; for ( int amount : money ) { answer += amount ; } System . out . println ( answer ) ; }   }" ]
[ "n , m = map ( int , input ( ) . split ( ) ) NEW_LINE athletes = { } NEW_LINE for i in range ( m ) : l , r , t , c = map ( int , input ( ) . split ( ) ) NEW_LINE athletes [ i + 1 ] = [ l , r , t , c ]   ans = 0 NEW_LINE for i in range ( 1 , n + 1 ) : lowTime = 10 ** 5 NEW_LINE money = 0 NEW_LINE for athlete in athletes : if NEW_LINE athletes [ athlete ] [ 0 ] <= i <= athletes [ athlete ] [ 1 ] and athletes [ athlete ] [ 2 ] < lowTime : lowTime = athletes [ athlete ] [ 2 ] NEW_LINE money = athletes [ athlete ] [ 3 ] NEW_LINE ans += money   print ( ans ) NEW_LINE", "n = [ int ( i ) for i in input ( ) . split ( ) ]   batata = [ 1001 ] * ( n [ 0 ] ) NEW_LINE score = [ 0 ] * ( n [ 0 ] )   for i in range ( n [ 1 ] ) : all = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE for b in range ( all [ 0 ] - 1 , all [ 1 ] ) : if NEW_LINE batata [ b ] > all [ 2 ] : batata [ b ] = all [ 2 ] NEW_LINE score [ b ] = all [ 3 ] NEW_LINE sum = 0 NEW_LINE for i in range ( n [ 0 ] ) : sum += score [ i ]   print ( sum )           NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) NEW_LINE athletes = { } NEW_LINE for i in range ( m ) : l , r , t , c = map ( int , input ( ) . split ( ) ) NEW_LINE athletes [ i + 1 ] = [ l , r , t , c ] NEW_LINE ans = 0 NEW_LINE for i in range ( 1 , n + 1 ) : lowTime = 10 ** 5 NEW_LINE money = 0 NEW_LINE for athlete in athletes : if NEW_LINE athletes [ athlete ] [ 0 ] <= i <= athletes [ athlete ] [ 1 ] and athletes [ athlete ] [ 2 ] < lowTime : lowTime = athletes [ athlete ] [ 2 ] NEW_LINE money = athletes [ athlete ] [ 3 ] NEW_LINE ans += money NEW_LINE print ( ans ) NEW_LINE" ]
codeforces_949_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Stack ;   public class Zebras { public static void main ( String [ ] a ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; char [ ] day = br . readLine ( ) . toCharArray ( ) ; Stack < ArrayList < Integer > > zebras = new Stack < ArrayList < Integer > > ( ) ; Stack < ArrayList < Integer > > nonZebras = new Stack < ArrayList < Integer > > ( ) ; for ( int i = 0 ; i < day . length ; i ++ ) { if ( day [ i ] == '0' ) { if ( ! nonZebras . isEmpty ( ) ) { ArrayList < Integer > x = nonZebras . pop ( ) ; x . add ( i + 1 ) ; zebras . push ( x ) ; } else { ArrayList < Integer > x = new ArrayList < Integer > ( ) ; x . add ( i + 1 ) ; zebras . push ( x ) ; } } else { if ( ! zebras . isEmpty ( ) ) { ArrayList < Integer > x = zebras . pop ( ) ; x . add ( i + 1 ) ; nonZebras . push ( x ) ; } else { System . out . println ( - 1 ) ; return ; } } } if ( nonZebras . isEmpty ( ) ) { out . println ( zebras . size ( ) ) ; while ( ! zebras . isEmpty ( ) ) { ArrayList < Integer > x = zebras . pop ( ) ; out . print ( x . size ( ) ) ; for ( int s : x ) out . print ( \" ▁ \" + s ) ; out . println ( ) ; } } else { out . println ( - 1 ) ; } out . flush ( ) ; } }" ]
[ "s = input ( ) l = [ ] even = [ ] odd = [ ] f = 1 for i in range ( len ( s ) ) : if s [ i ] == '0' : if len ( even ) != 0 : ind = even . pop ( ) l [ ind ] . append ( i + 1 ) odd . append ( ind ) else : l . append ( [ i + 1 ] ) odd . append ( len ( l ) - 1 ) else : if len ( odd ) : ind = odd . pop ( ) l [ ind ] . append ( i + 1 ) even . append ( ind ) else : f = 0 breakif f and len ( even ) == 0 : print ( len ( l ) ) for x in l : print ( len ( x ) , * x ) else : print ( - 1 ) NEW_LINE", "s = input ( ) res , p = [ ] , - 1   for i in range ( len ( s ) ) : j = i + 1 if s [ i ] == '0' : if p > - 1 : res [ p ] . append ( j ) p -= 1 else : res . append ( [ j ] ) else : p += 1 if p >= len ( res ) : print ( - 1 ) exit ( ) res [ p ] . append ( j )   if p != - 1 : print ( - 1 ) exit ( )   print ( len ( res ) ) for x in res : print ( len ( x ) , * x ) NEW_LINE", "from collections import deque l = input ( ) az = deque ( [ ] ) z = deque ( [ ] ) f = 0 for i in range ( len ( l ) ) : if l [ i ] == '0' : if len ( az ) == 0 : z . append ( [ i + 1 ] ) else : az [ 0 ] . append ( i + 1 ) z . append ( az [ 0 ] ) az . popleft ( ) else : NEW_LINE" ]
codeforces_544_B
[ "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 , k ; n = input . nextInt ( ) ; k = input . nextInt ( ) ; char a [ ] [ ] = new char [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { Arrays . fill ( a [ i ] , ' S ' ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( k == 0 ) break ; for ( int j = 0 ; j < n ; j ++ ) { if ( k == 0 ) break ; if ( ( i + j ) % 2 == 0 ) { a [ i ] [ j ] = ' L ' ; k -- ; } } } if ( k > 0 ) { System . out . println ( \" NO \" ) ; return ; } System . out . println ( \" YES \" ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { System . out . print ( a [ i ] [ j ] ) ; } System . out . println ( ) ; } } }", "import java . util . Scanner ;   public class CF544_D2_B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; char [ ] [ ] map = new char [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i % 2 == 0 ) { if ( j % 2 == 1 || k == 0 ) { map [ i ] [ j ] = ' S ' ; } else if ( k > 0 ) { map [ i ] [ j ] = ' L ' ; k -- ; } } else { if ( j % 2 == 0 || k == 0 ) { map [ i ] [ j ] = ' S ' ; } else if ( k > 0 ) { map [ i ] [ j ] = ' L ' ; k -- ; } } } } if ( k == 0 ) { printMap ( map ) ; } else { System . out . println ( \" NO \" ) ; }    }   static void printMap ( char [ ] [ ] map ) { System . out . println ( \" YES \" ) ; for ( int i = 0 ; i < map . length ; i ++ ) { for ( int j = 0 ; j < map . length ; j ++ ) { System . out . print ( map [ i ] [ j ] ) ; } System . out . println ( ) ; }   } }", "import java . io . BufferedWriter ; import java . io . ByteArrayInputStream ; import java . io . FileInputStream ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ;   public class Main { private static final long MOD = ( long ) 1e9 + 7 ; static InputStream is ; static PrintWriter out ; static String INPUT = \" \" ; static int lenbuf = 0 , ptrbuf = 0 ; private static byte [ ] inbuf = new byte [ 1024 ] ; static boolean readFile = false ;" ]
[ "import sys , os , ioimport math , bisect , operatorinf , mod = float ( ' inf ' ) , 10 ** 9 + 7 NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) map , islands = [ [ ' S ' for x in range ( n ) ] for y in range ( n ) ] , 0     def print_map ( ) : print ( \" YES \" ) for line in map : print ( \" \" . join ( line ) )     for i in range ( n ) : for j in range ( n ) : if islands == k : print_map ( ) exit ( ) if ( i + j ) - 1 & 1 : map [ i ] [ j ] = ' L ' islands += 1 if islands == k : print_map ( ) exit ( )   print ( \" NO \" ) NEW_LINE", "from collections import defaultdict , Counter import sys import bisectimport mathdef get_array ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def input ( ) : return sys . stdin . readline ( ) . strip ( )     ( n , k ) = get_ints ( )   mat = [ [ ' S ' for _ in range ( n ) ] for _ in range ( n ) ] if n & 1 : s = ( ( n + 1 ) // 2 ) * ( ( n + 1 ) // 2 ) + ( n // 2 ) * ( n // 2 ) if k > s : print ( \" NO \" ) else : print ( \" YES \" ) row = 0 while ( k ) : for col in range ( row % 2 , n , 2 ) : if k == 0 : break mat [ row ] [ col ] = ' L ' k -= 1 NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) matrix = [ [ \" S \" for i in range ( n ) ] for j in range ( n ) ] for i in range ( n ) : for j in range ( n ) : if k > 0 : if i % 2 == 0 and j % 2 == 0 : matrix [ i ] [ j ] = \" L \" k -= 1 elif i % 2 == 1 and j % 2 == 1 : matrix [ i ] [ j ] = \" L \" k -= 1 if k > 0 : print ( \" NO \" ) else : print ( \" YES \" ) for lst in matrix : print ( \" \" . join ( lst ) ) NEW_LINE", "n , k = input ( ) . split ( ) n , k = int ( n ) , int ( k ) if k > ( n * n + 1 ) // 2 : print ( \" NO \" ) exit ( ) print ( \" YES \" ) for i in range ( 0 , n ) : for j in range ( 0 , n ) : if ( ( i + j ) % 2 == 0 and k > 0 ) : print ( ' L ' , end = ' ' ) k -= 1 else : print ( ' S ' , end = ' ' ) print ( ) NEW_LINE" ]
codeforces_1393_A
[ "import java . util . Scanner ; public class A1393 { 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 = N / 2 + 1 ; System . out . println ( answer ) ; } } }", "import java . util . Scanner ; public class Div2A { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = Integer . parseInt ( scanner . nextLine ( ) ) ; int n ; for ( int i = 0 ; i < t ; i ++ ) { n = Integer . parseInt ( scanner . nextLine ( ) ) ; System . out . println ( ( n / 2 ) + 1 ) ; } scanner . close ( ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] nextArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long [ ] nextArray ( long n ) { long [ ] a = new long [ ( int ) n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } static class FastWriter extends PrintWriter { FastWriter ( ) { super ( System . out ) ; } void println ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + \" ▁ \" ) ; } println ( ) ; } void println ( long [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + \" ▁ \" ) ; } println ( ) ; } } public static void main ( String [ ] args ) { FastScanner in = new FastScanner ( ) ; FastWriter out = new FastWriter ( ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; out . println ( ( n / 2 ) + 1 ) ; } out . close ( ) ; } }" ]
[ "t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( n ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( n // 2 + 1 ) NEW_LINE DEDENT DEDENT", "import sys NEW_LINE from collections import * NEW_LINE from heapq import * NEW_LINE import math NEW_LINE import bisect NEW_LINE def input ( ) : NEW_LINE INDENT return sys . stdin . readline ( ) NEW_LINE DEDENT for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE if n % 2 : NEW_LINE INDENT tmp = ( n - 1 ) // 2 NEW_LINE print ( 1 + tmp ) NEW_LINE DEDENT else : NEW_LINE INDENT tmp = n // 2 NEW_LINE print ( tmp + 1 ) NEW_LINE DEDENT DEDENT", "for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT print ( int ( input ( ) ) // 2 + 1 ) NEW_LINE DEDENT", "for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT print ( int ( input ( ) ) // 2 + 1 ) NEW_LINE DEDENT", "t = int ( input ( ) ) NEW_LINE for i in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE print ( n // 2 + 1 ) NEW_LINE DEDENT" ]
codeforces_659_B
[ "import java . io . * ; import java . util . * ; import static java . lang . Math . * ;   public class Main implements Runnable {   private boolean console = false ; private long MOD = 1000_000_007L ; private int MAX = 1000_001 ;   private void solve1 ( ) {   int n = in . ni ( ) , m = in . ni ( ) ; ArrayList < Pair > [ ] list = new ArrayList [ m + 1 ] ;   for ( int i = 0 ; i <= m ; ++ i ) { list [ i ] = new ArrayList < > ( ) ; }   for ( int i = 0 ; i < n ; ++ i ) { String name = in . ns ( ) ; int num = in . ni ( ) ; int score = in . ni ( ) ;   list [ num ] . add ( new Pair ( name , score ) ) ; }   for ( int i = 1 ; i <= m ; ++ i ) {   list [ i ] . sort ( ( a , b ) -> b . score - a . score ) ;   if ( list [ i ] . size ( ) == 2 ) { out . println ( list [ i ] . get ( 0 ) . name + \" ▁ \" + list [ i ] . get ( 1 ) . name ) ; continue ; }   if ( list [ i ] . get ( 1 ) . score == list [ i ] . get ( 2 ) . score ) { out . println ( \" ? \" ) ; continue ; }   out . println ( list [ i ] . get ( 0 ) . name + \" ▁ \" + list [ i ] . get ( 1 ) . name ) ; }    }   class Pair { String name ; int score ;   public Pair ( String name , int score ) { this . name = name ; this . score = score ; } }   private void solve ( ) { int testCases = 1 ;", "import java . util . * ; import java . lang . * ; import java . math . * ; import java . awt . image . ConvolveOp ; import java . io . * ; import java . text . DecimalFormat ; import java . lang . Math ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . * ; public class Codeforces { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader sc = new FastReader ( ) ; static int pInf = Integer . MAX_VALUE ; static int nInf = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { int test = 1 ;" ]
[ "def main ( ) : N , M = map ( int , input ( ) . split ( ) ) x = { } for i in range ( M ) : x [ i + 1 ] = [ ] for j in range ( N ) : a , b , c = ( input ( ) . split ( ) ) b = int ( b ) c = int ( c ) x [ b ] += [ ( c , a ) ] for k in range ( M ) : y = sorted ( x [ k + 1 ] ) [ : : - 1 ] if len ( y ) > 2 and ( y [ 1 ] [ 0 ] == y [ 2 ] [ 0 ] ) : print ( \" ? \" ) else : print ( y [ 0 ] [ 1 ] + ' ▁ ' + y [ 1 ] [ 1 ] ) if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "from operator import itemgetterfrom collections import defaultdictn , m = map ( int , input ( ) . split ( ) ) dicta = defaultdict ( list ) details = [ ] for i in range ( n ) : participant = input ( ) . split ( ) participant [ 1 ] = int ( participant [ 1 ] ) participant [ 2 ] = int ( participant [ 2 ] ) details . append ( participant )   details . sort ( key = itemgetter ( 1 , 2 ) ) for j in range ( n ) : dicta [ details [ j ] [ 1 ] ] . append ( [ details [ j ] [ 0 ] , details [ j ] [ 2 ] ] ) for key in dicta . keys ( ) : valu = len ( dicta [ key ] ) if len ( dicta [ key ] ) != 2 and dicta [ key ] [ valu - 2 ] [ 1 ] == dicta [ key ] [ valu - 3 ] [ 1 ] : print ( \" ? \" ) else : print ( \" { } ▁ { } \" . format ( dicta [ key ] [ valu - 1 ] [ 0 ] , dicta [ key ] [ valu - 2 ] [ 0 ] ) ) NEW_LINE", "n , m = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in range ( 1 , m + 1 ) : d [ i ] = [ ] for i in range ( n ) : a , b , c = input ( ) . split ( ) a = str ( a ) b = int ( b ) c = int ( c ) d [ b ] . append ( [ c , a ] ) for i in range ( 1 , m + 1 ) : a = d [ i ] a . sort ( reverse = True ) if len ( a ) > 2 and a [ 1 ] [ 0 ] == a [ 2 ] [ 0 ] : print ( \" ? \" ) else : print ( a [ 0 ] [ 1 ] , a [ 1 ] [ 1 ] ) NEW_LINE", "from sys import stdin , stdouta , b = map ( int , stdin . readline ( ) . split ( ) ) d = { } for i in range ( 1 , b + 1 ) : d [ i ] = [ ] for _ in \" ▁ \" * a : x , y , z = stdin . readline ( ) . split ( ) y = int ( y ) ; z = int ( z ) d [ y ] . append ( [ z , x ] ) ans = ' ' for i in d : d [ i ] . sort ( reverse = True ) if len ( d [ i ] ) > 2 and d [ i ] [ 1 ] [ 0 ] == d [ i ] [ 2 ] [ 0 ] : ans += ' ? ' else : ans += d [ i ] [ 0 ] [ 1 ] + ' ▁ ' + d [ i ] [ 1 ] [ 1 ] ans += ' \\n ' stdout . write ( ans ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) d = { } for i in range ( a ) : f = list ( input ( ) . split ( ) ) if int ( f [ 1 ] ) in d : d [ int ( f [ 1 ] ) ] . append ( ( int ( f [ 2 ] ) , f [ 0 ] ) ) else : d [ int ( f [ 1 ] ) ] = [ ( int ( f [ 2 ] ) , f [ 0 ] ) ] for i in d : d [ i ] . sort ( ) d [ i ] . reverse ( ) for i in range ( 1 , b + 1 ) : if len ( d [ i ] ) > 2 and d [ i ] [ 2 ] [ 0 ] == d [ i ] [ 1 ] [ 0 ] : print ( ' ? ' ) else : print ( d [ i ] [ 0 ] [ 1 ] , d [ i ] [ 1 ] [ 1 ] ) NEW_LINE" ]