id
stringlengths
13
20
java
sequence
python
sequence
codeforces_1088_B
[ "import java . util . Arrays ; import java . util . Scanner ; Β  public class _0715Ehabandsubtraction { Β  public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int sum = 0 ; for ( int i = 0 ; i < n && k > 0 ; i ++ ) { arr [ i ] = arr [ i ] - sum ; if ( arr [ i ] == 0 ) { continue ; } else { System . out . println ( arr [ i ] ) ; sum += arr [ i ] ; k -- ; } } while ( k > 0 ) { System . out . println ( 0 ) ; k -- ; } } Β  }", "import java . util . * ; import java . util . jar . JarOutputStream ; Β  public class Practise { Β Β  public static void main ( String [ ] args ) {", "import java . util . * ; Β  public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; int [ ] ar = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; Β  } Arrays . sort ( ar ) ; long [ ] ar1 = new long [ n ] ; ar1 [ 0 ] = ar [ 0 ] ; long sum = ar [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { Β  ar1 [ i ] = ar [ i ] - sum ; sum += ar1 [ i ] ; } List < Long > list = new ArrayList < > ( ) ; Β  if ( k <= n ) {", "import java . util . * ; Β  public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; int [ ] ar = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; Β  } Arrays . sort ( ar ) ; long [ ] ar1 = new long [ n ] ; ar1 [ 0 ] = ar [ 0 ] ; long sum = ar [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { Β  ar1 [ i ] = ar [ i ] - sum ; sum += ar1 [ i ] ; } List < Long > list = new ArrayList < > ( ) ; Β  if ( k <= n ) {", "import java . io . * ; import java . util . * ; Β  public class Main { public static void main ( String [ ] args ) throws IOException { FastReader in = new FastReader ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) , k = in . nextInt ( ) ; ArrayList < Long > list = new ArrayList < > ( ) ; HashSet < Long > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Long a = in . nextLong ( ) ; if ( set . contains ( a ) ) continue ; list . add ( a ) ; set . add ( a ) ; } pw . println ( solve ( list , list . size ( ) , k ) ) ; pw . close ( ) ; } Β  static StringBuilder solve ( ArrayList < Long > arr , int n , int k ) { StringBuilder sb = new StringBuilder ( ) ; long prev = 0 ;" ]
[ "n , k = map ( int , input ( ) . split ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] a . insert ( 0 , 0 ) a = sorted ( list ( set ( a ) ) ) for i in range ( min ( k , len ( a ) - 1 ) ) : print ( a [ i + 1 ] - a [ i ] ) for i in range ( max ( k - len ( a ) + 1 , 0 ) ) : print ( 0 ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) a = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) subtract = 0 i = 0 for kk in range ( k ) : if i < n : print ( a [ i ] - subtract ) subtract += a [ i ] - subtract while i < n and a [ i ] <= subtract : i += 1 else : print ( 0 ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) a = sorted ( list ( set ( map ( int , input ( ) . split ( ) ) ) ) ) for i in range ( k ) : if i == 0 : print ( a [ i ] ) elif i < len ( a ) : print ( a [ i ] - a [ i - 1 ] ) else : print ( 0 ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) a = sorted ( list ( set ( map ( int , input ( ) . split ( ) ) ) ) + [ 0 ] ) for i in range ( 1 , k + 1 ) : if i < len ( a ) : print ( a [ i ] - a [ i - 1 ] ) else : print ( 0 ) NEW_LINE" ]
codeforces_165_B
[ "import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static FileWriter fw ; static long oo = Long . MAX_VALUE ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . lang . reflect . Array ; import java . util . Arrays ; import java . util . HashSet ; import java . util . StringTokenizer ; import java . util . TreeSet ; Β Β  public class Main { public static double fun1 ( int v , int k ) { double x = Math . log10 ( ( double ) v ) / Math . log10 ( ( double ) k ) ; int end = ( int ) ( ( x == ( int ) x ) ? x + 1 : ( int ) ( Math . ceil ( x ) ) ) ; int res = 0 ; for ( int i = 0 ; i < end ; i ++ ) { res += v / ( int ) ( Math . pow ( k , i ) ) ; } return res ; } public static int solve ( int n , int k ) { int start = 1 ; int end = ( int ) 1e9 ; int middle ; while ( start <= end ) { middle = ( start + end ) / 2 ; if ( fun1 ( middle , k ) == n ) { return middle ; } else if ( fun1 ( middle , k ) > n ) { if ( fun1 ( middle - 1 , k ) > n || fun1 ( middle - 1 , k ) == n ) { end = middle - 1 ; } else return middle ; } else start = middle + 1 ; } return - 1 ; } public static void main ( String [ ] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String in = bf . readLine ( ) ; StringTokenizer st = new StringTokenizer ( in ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; System . out . println ( solve ( n , k ) ) ; } Β  } Β ", "import java . util . * ; import java . io . * ; Β  public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; } Β  public static long mod = 17352642619633L ; Β  int N ; int K ; void run ( FastScanner in , PrintWriter out ) { Β  N = in . nextInt ( ) ; K = in . nextInt ( ) ; Β  int lo = 1 ; int hi = N + 1 ; int can = - 1 ; while ( lo < hi ) { Β  int m = ( lo + hi ) >> 1 ; long cnt = cnt ( m ) ; if ( cnt >= N ) { can = m ; hi = m ; } else { lo = m + 1 ; } } out . println ( can ) ; } Β  long cnt ( int m ) { long ret = 0 ; while ( m > 0 ) { ret += m ; m /= K ; } return ret ; } Β  static class FastScanner { BufferedReader br ; StringTokenizer st ; Β  public FastScanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( in ) ) ; st = null ; } Β  String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }", "import java . util . * ; import java . io . * ; public class ayaa { public static long fun ( long n , int k ) { long sum = n ; while ( n > 0 ) { n = n / k ; sum += n ; } return sum ; } public static long search ( long n , int k ) { long start = 1 ; long end = n ; long mid = ( start + end ) / 2 ; while ( start <= end ) { if ( fun ( mid , k ) < n ) { start = mid + 1 ; } else { end = mid - 1 ; } mid = ( start + end ) / 2 ; } return start ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; long n = sc . nextLong ( ) ; int k = sc . nextInt ( ) ; System . out . println ( search ( n , k ) ) ; } } Β Β " ]
[ "n , k = list ( map ( int , input ( ) . split ( ) ) ) a = n / 2 v = round ( a ) while round ( a ) > 0 : b = 0 m = 0 while v // ( k ** b ) > 0 : m += v // ( k ** b ) b += 1 if m < n : v += round ( a / 2 ) else : v -= round ( a / 2 ) a /= 2 b = 0 m = 0 while v // ( k ** b ) > 0 : m += v // ( k ** b ) b += 1 if m < n : v += 1 print ( v ) NEW_LINE", "n , k = [ int ( x ) for x in input ( ) . split ( ) ] import mathdef solve ( num , k ) : divisor = k ans = num while True : temp = math . floor ( num / divisor ) if temp == 0 : break ans += temp divisor *= k return ans Β  def bs_first_greater ( start , end , n ) : if start > end : return - 1 mid = ( start + end ) // 2 if solve ( mid , k ) >= n : if mid == start : return mid elif solve ( mid - 1 , k ) < n : return mid else : return bs_first_greater ( start , mid - 1 , n ) Β  else : return bs_first_greater ( mid + 1 , end , n ) Β  print ( bs_first_greater ( 1 , n , n ) ) NEW_LINE", "def geo_sum ( v , k ) : res = 0 aux = v while aux : res += aux aux //= k return res Β  def find_v ( n , k ) : st , end = 1 , n while st < end : mid = ( st + end ) // 2 s = geo_sum ( mid , k ) if s == n : return mid if s < n : st = mid + 1 else : end = mid return end Β  def solve ( ) : n , k = map ( int , input ( ) . split ( ) ) v = find_v ( n , k ) print ( v ) Β  if __name__ == ' _ _ main _ _ ' : solve ( ) NEW_LINE", "def valid ( v ) : ans = 0 while v != 0 : Β  ans += v v = v // k return ans >= n Β  Β  def BSfindFirst ( start , end ) : while start + 1 < end : mid = ( end + start ) // 2 if valid ( mid ) : end = mid else : start = mid return end Β  Β  n , k = map ( int , input ( ) . split ( ) ) print ( BSfindFirst ( 0 , 1000000000 ) ) NEW_LINE", "def possible ( v , k ) : ans = v prev = k while v // k > 0 : ans += ( v // k ) k *= prev return ansn , k = map ( int , input ( ) . split ( ) ) low = khigh = nans = float ( \" inf \" ) while low < high : mid = low + ( ( high - low ) // 2 ) if possible ( mid , k ) >= n : high = mid else : low = mid + 1 print ( high ) NEW_LINE" ]
codeforces_445_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; Β Β  public class Main { Β  public static void main ( String [ ] args ) throws IOException { InputStreamReader r = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( r ) ; String si = br . readLine ( ) ; String [ ] sa = si . split ( \" ▁ \" ) ; int n = Integer . valueOf ( sa [ 0 ] ) ; int m = Integer . valueOf ( sa [ 1 ] ) ; StringBuffer str = new StringBuffer ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String s = br . readLine ( ) ; for ( int j = 0 ; j < m ; j ++ ) { if ( s . charAt ( j ) == ' - ' ) { str . append ( \" - \" ) ; } else { if ( ( i + j ) % 2 == 0 ) { str . append ( \" B \" ) ; } else { str . append ( \" W \" ) ; } } } str . append ( \" \\n \" ) ; } Β  System . out . print ( str . toString ( ) ) ; Β  } Β  }", "import java . util . Scanner ; Β  public class Main { Β  public static char [ ] [ ] array ; public static char [ ] [ ] pos = new char [ ] [ ] { { ' B ' , ' W ' } , { ' W ' , ' B ' } } ; public static void main ( String [ ] args ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . StreamTokenizer ; import java . util . Scanner ; Β  public class Main { Β  public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; char [ ] [ ] ch = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; for ( int j = 0 ; j < m ; j ++ ) { if ( s . charAt ( j ) == ' - ' ) { ch [ i ] [ j ] = s . charAt ( j ) ; } else { if ( ( i + j ) % 2 == 0 ) { ch [ i ] [ j ] = ' B ' ; } else { ch [ i ] [ j ] = ' W ' ; } } } } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { System . out . print ( ch [ i ] [ j ] ) ; } System . out . println ( ) ; } Β  } Β  }", "import java . util . Scanner ; Β  public class Main { Β  static int count = 0 ; static int n , m ; static int q = 0 ; static boolean bl ; Β  public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; m = scan . nextInt ( ) ; scan . nextLine ( ) ; char [ ] [ ] arr = new char [ n ] [ m ] ; boolean [ ] [ ] visited = new boolean [ n ] [ m ] ; String str = \" \" ; for ( int i = 0 ; i < n ; i ++ ) { str = scan . nextLine ( ) ; for ( int j = 0 ; j < m ; j ++ ) { arr [ i ] [ j ] = str . charAt ( j ) ; } } f ( arr , visited , 0 , 0 , false ) ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < m ; ++ j ) { System . out . print ( arr [ i ] [ j ] ) ; } System . out . println ( ) ; } } Β  private static void f ( char [ ] [ ] arr , boolean [ ] [ ] visited , int i , int j , boolean flag ) { if ( i == n || j == m )", "Β  import java . util . * ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; Β Β  public class Sol { public static void main ( String [ ] args ) throws IOException { Β  Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; char [ ] [ ] mat = new char [ r ] [ c ] ; for ( int i = 0 ; i < r ; i ++ ) { String s = sc . next ( ) ; for ( int j = 0 ; j < c ; j ++ ) { mat [ i ] [ j ] = s . charAt ( j ) ; } } for ( int i = 0 ; i < r ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { if ( i % 2 == 0 && mat [ i ] [ j ] == ' . ' ) { if ( j % 2 == 0 ) { mat [ i ] [ j ] = ' B ' ; } else { mat [ i ] [ j ] = ' W ' ; } } else if ( i % 2 != 0 && mat [ i ] [ j ] == ' . ' ) { if ( j % 2 == 0 ) { mat [ i ] [ j ] = ' W ' ; } else { mat [ i ] [ j ] = ' B ' ; } } } } for ( int i = 0 ; i < r ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { System . out . print ( mat [ i ] [ j ] ) ; } System . out . println ( ) ; } } } Β Β Β Β Β " ]
[ "n , m = map ( int , input ( ) . split ( ) ) ans = [ ] for i in range ( n ) : if i % 2 == 0 : x = ' B ' else : x = ' W ' s = input ( ) a = ' ' for j in range ( len ( s ) ) : if s [ j ] == ' . ' : a += x else : a += ' - ' if x == ' B ' : x = ' W ' else : x = ' B ' ans . append ( a ) for i in ans : print ( i ) NEW_LINE", "import sysdef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_ints_lists ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) n , m = get_ints ( ) for j in range ( n ) : s = get_string ( ) w = \" W \" b = \" B \" c = \" - \" if j % 2 == 0 : if m == 1 : if s [ 0 ] == \" . \" : print ( b ) else : print ( c ) else : for i in range ( m ) : if s [ i ] == c : print ( c , end = \" \" ) else : if i % 2 == 0 : print ( b , end = \" \" ) else : print ( w , end = \" \" ) print ( ) elif j % 2 == 1 : if m == 1 : if s [ 0 ] == \" . \" : print ( w ) else : print ( c ) else : for i in range ( m ) : if s [ i ] == c : print ( c , end = \" \" ) else : if i % 2 == 0 : print ( w , end = \" \" ) else : print ( b , end = \" \" ) print ( ) NEW_LINE", "r , c = map ( int , input ( ) . split ( ) ) g = [ ] Β  for _ in range ( r ) : g . append ( list ( input ( ) ) ) Β  for ri in range ( r ) : for ci in range ( c ) : if g [ ri ] [ ci ] == \" - \" : continue Β  cm = 1 if ( ri + 1 ) % 2 == 0 : cm *= - 1 Β  if ( ci + 1 ) % 2 == 0 : cm *= - 1 Β  g [ ri ] [ ci ] = \" B \" if cm == 1 else \" W \" Β  print ( \" \" . join ( g [ ri ] ) ) NEW_LINE", "def answer ( n , m , a ) : ctr = 0 for s in a : ans = [ ] for c in s : if c == ' . ' : if ctr % 2 == 0 : ans . append ( ' B ' ) else : ans . append ( ' W ' ) else : ans . append ( ' - ' ) ctr += 1 print ( ' ' . join ( ans ) ) return Β  def answer2 ( n , m , a ) : for r in range ( n ) : ans = [ ] for c in range ( m ) : if ( r + c ) % 2 == 0 and a [ r ] [ c ] == ' . ' : ans . append ( ' B ' ) elif ( r + c ) % 2 == 1 and a [ r ] [ c ] == ' . ' : ans . append ( ' W ' ) else : ans . append ( ' - ' ) print ( ' ' . join ( ans ) ) Β  def main ( ) : n , m = [ int ( i ) for i in input ( ) . split ( ) ] a = [ 0 ] * n for j in range ( n ) : a [ j ] = input ( ) answer2 ( n , m , a ) Β  returnmain ( ) NEW_LINE", "rows , cols = map ( int , input ( ) . split ( ) ) grid = [ input ( ) for _ in range ( rows ) ] Β  for i in range ( rows ) : for j in range ( cols ) : if grid [ i ] [ j ] == ' . ' : colors = [ ' B ' , ' W ' ] print ( colors [ i % 2 ^ j % 2 ] , end = ' ' ) else : print ( ' - ' , end = ' ' ) print ( ) NEW_LINE" ]
codeforces_1091_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ; import java . util . StringJoiner ; import java . util . stream . IntStream ; import java . io . PrintWriter ;", "import java . util . * ; import java . lang . * ; import java . io . * ; Β  public final class new_year { public static void main ( String [ ] args ) throws java . lang . Exception { Reader r = new Reader ( ) ; r . init ( System . in ) ; int n = r . nextInt ( ) ; int [ ] x = new int [ n ] ; int [ ] y = new int [ n ] ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ;", "import java . util . * ; import java . io . * ; public class tre { public static void main ( String [ ] Args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = 0 , y = 0 ; for ( int i = 0 ; i < 2 * n ; i ++ ) { x += sc . nextLong ( ) ; y += sc . nextLong ( ) ; Β Β  } System . out . println ( x / n + \" ▁ \" + y / n ) ; Β  } Β  }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ;" ]
[ "import 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 = int ( input ( ) ) clues = [ [ int ( i ) for i in input ( ) . split ( ) ] for i in range ( n ) ] dirs = [ [ int ( i ) for i in input ( ) . split ( ) ] for i in range ( n ) ] sum_x = 0 sum_y = 0 sum_a = 0 sum_b = 0 for i in range ( n ) : sum_x += clues [ i ] [ 0 ] sum_y += clues [ i ] [ 1 ] sum_a += dirs [ i ] [ 0 ] sum_b += dirs [ i ] [ 1 ] x = ( sum_x + sum_a ) // n y = ( sum_y + sum_b ) // n print ( x , y ) main ( ) NEW_LINE", "def solve ( n , pillar , clues ) : index = 0 dup_clues = set ( clues ) while index < n : found = True x = pillar [ 0 ] [ 0 ] + clues [ index ] [ 0 ] y = pillar [ 0 ] [ 1 ] + clues [ index ] [ 1 ] for x1 , y1 in pillar : if ( x - x1 , y - y1 ) in dup_clues : continue else : found = False break if found : print ( x , y ) index += 1 NEW_LINE", "n = int ( input ( ) ) l1 = [ ] for i in range ( n ) : l1 . append ( [ int ( j ) for j in input ( ) . split ( ) ] ) l2 = [ ] for i in range ( n ) : l2 . append ( [ int ( j ) for j in input ( ) . split ( ) ] ) l1 . sort ( ) l2 . sort ( ) x = l1 [ 0 ] [ 0 ] + l2 [ - 1 ] [ 0 ] y = l1 [ 0 ] [ 1 ] + l2 [ - 1 ] [ 1 ] print ( x , y ) NEW_LINE", "''' Β  ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Online ▁ Python ▁ Compiler . ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Code , ▁ Compile , ▁ Run ▁ and ▁ Debug ▁ python ▁ program ▁ online . Write ▁ your ▁ code ▁ in ▁ this ▁ editor ▁ and ▁ press ▁ \" Run \" ▁ button ▁ to ▁ execute ▁ it . Β  ''' Β  n = int ( input ( ) ) k = n * 2 l = [ ] m = [ ] for i in range ( 2 * n ) : a , b = map ( int , input ( ) . split ( ) ) if ( i < k // 2 ) : l . append ( ( a , b ) ) else : m . append ( ( a , b ) ) l . sort ( ) m . sort ( reverse = True ) print ( l [ 0 ] [ 0 ] + m [ 0 ] [ 0 ] , l [ 0 ] [ 1 ] + m [ 0 ] [ 1 ] ) NEW_LINE" ]
codeforces_1444_A
[ "Β  import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; public class er103b {", "import java . util . * ; public class Problem1444a { static long pi ; static long qi ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { pi = sc . nextLong ( ) ; qi = sc . nextLong ( ) ; long tmpp = pi ; long tmpq = qi ; long ans = 0 ; for ( int i = 2 ; i <= ( long ) ( Math . sqrt ( tmpq ) ) ; i ++ ) { tmpp = pi ; while ( tmpq % i == 0 ) { if ( tmpp % qi != 0 ) { ans = Math . max ( ans , tmpp ) ; } else if ( tmpp % i != 0 ) { } else { tmpp /= i ; continue ; } tmpq /= i ; } } if ( tmpq >= 2 ) { long x = pi ; while ( true ) { if ( x % qi != 0 ) { ans = Math . max ( ans , x ) ; break ; } if ( x % tmpq != 0 ) { break ; } else x /= tmpq ; } } System . out . println ( ans ) ; } } }", "import java . util . * ; import java . io . * ; public class Main2 { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } static FastReader sc = new FastReader ( ) ; public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; int t = 1 ; t = sc . nextInt ( ) ; while ( t -- > 0 ) { long p = sc . nextLong ( ) ; long q = sc . nextLong ( ) ; if ( p < q || p % q != 0 ) { out . write ( p + \" \\n \" ) ; continue ; } long j = 2L ; ArrayList < Long > a = new ArrayList < > ( ) ; long ans = q ; while ( j * j <= q ) { if ( ans % j == 0 ) { a . add ( j ) ; while ( ans % j == 0 ) ans /= j ; } j ++ ; } if ( ans > 1 ) { a . add ( ans ) ; ans = 1 ; } for ( long l : a ) { long k = p ; while ( k % q == 0 ) k /= l ; ans = Math . max ( k , ans ) ; } out . write ( ans + \" \\n \" ) ; } out . close ( ) ; } }" ]
[ "from math import ceilfor NEW_LINE ad in range ( int ( input ( ) ) ) : NEW_LINE", "from sys import stdin , stdoutstdin . readlinedef NEW_LINE mp ( ) : NEW_LINE return list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE def it ( ) : return int ( stdin . readline ( ) . strip ( ) ) NEW_LINE from collections import defaultdict as dd , Counter as C Β  NEW_LINE def pf ( n ) : v = [ ] NEW_LINE d = dd ( lambda : 0 ) NEW_LINE while n % 2 == 0 : d [ 2 ] += 1 NEW_LINE n //= 2 NEW_LINE i = 3 NEW_LINE while i * i <= n : if NEW_LINE n % i == 0 : d [ i ] += 1 NEW_LINE n //= i else : i += 1 NEW_LINE if n > 2 : d [ n ] += 1 NEW_LINE return dict ( d ) Β  for _ in range ( it ( ) ) : p , q = mp ( ) NEW_LINE d = pf ( q ) NEW_LINE ans = q NEW_LINE ans = 1 NEW_LINE for i , j in d . items ( ) : k = p NEW_LINE while k % q == 0 : k //= i NEW_LINE ans = max ( ans , k ) NEW_LINE print ( ans ) NEW_LINE", "from sys import stdin , stdoutstdin . readlinedef NEW_LINE mp ( ) : NEW_LINE return list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE def it ( ) : return int ( stdin . readline ( ) . strip ( ) ) NEW_LINE from collections import defaultdict as dd , Counter as C Β  NEW_LINE def pf ( n ) : v = [ ] NEW_LINE d = dd ( lambda : 0 ) NEW_LINE while n % 2 == 0 : d [ 2 ] += 1 NEW_LINE n //= 2 NEW_LINE i = 3 NEW_LINE while i * i <= n : if NEW_LINE n % i == 0 : d [ i ] += 1 NEW_LINE n //= i else : i += 1 NEW_LINE if n > 2 : d [ n ] += 1 NEW_LINE return dict ( d ) Β  for _ in range ( it ( ) ) : p , q = mp ( ) NEW_LINE d = pf ( q ) NEW_LINE ans = q NEW_LINE ans = 1 NEW_LINE for i , j in d . items ( ) : k = p NEW_LINE while k % q == 0 : k //= i NEW_LINE ans = max ( ans , k ) NEW_LINE print ( ans ) NEW_LINE" ]
codeforces_975_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 ( ) ; scan . nextLine ( ) ; String [ ] words = scan . nextLine ( ) . split ( \" ▁ \" ) ; Set < Set < Character > > roots = new HashSet < > ( ) ; for ( String w : words ) { Set < Character > root = new HashSet < > ( ) ; for ( int i = 0 ; i < w . length ( ) ; i ++ ) { root . add ( w . charAt ( i ) ) ; } roots . add ( root ) ; } System . out . println ( roots . size ( ) ) ; } }", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; s . nextLine ( ) ; String s2 = s . nextLine ( ) ; String [ ] s1 = s2 . split ( \" ▁ \" ) ; ArrayList < String > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String s3 = \" \" ; char [ ] ch = s1 [ i ] . toCharArray ( ) ; Arrays . sort ( ch ) ; for ( int j = 0 ; j < s1 [ i ] . length ( ) ; j ++ ) { char c = ch [ j ] ; if ( s3 . indexOf ( c ) < 0 ) s3 = s3 + c ; } a . add ( s3 ) ; } HashSet < String > h = new HashSet < > ( a ) ; System . out . println ( h . size ( ) ) ; } }" ]
[ "n = int ( input ( ) ) s = list ( str ( input ( ) ) . split ( \" ▁ \" ) ) k = set ( [ frozenset ( i ) for i in s ] ) print ( len ( k ) ) NEW_LINE", "if __name__ == ' _ _ main _ _ ' : n = int ( input ( ) ) l = input ( ) . split ( ) d = dict ( ) for i in l : s = sorted ( set ( i ) ) j = ' ' for i in range ( len ( s ) ) : j += s [ i ] d . setdefault ( j , 0 ) d [ j ] += 1 print ( len ( d ) ) NEW_LINE", "input ( ) print ( len ( set ( map ( frozenset , input ( ) . split ( ) ) ) ) ) NEW_LINE", "n = int ( input ( ) ) Β  x = list ( input ( ) . split ( ) ) Β  ans = [ ] for i in range ( n ) : y = list ( x [ i ] . strip ( ) ) y . sort ( ) y = set ( y ) y = ' ' . join ( y ) if y in ans : pass else : ans . append ( y ) print ( len ( ans ) ) NEW_LINE", "input ( ) print ( len ( set ( map ( frozenset , input ( ) . split ( ) ) ) ) ) NEW_LINE" ]
codeforces_1141_A
[ "import java . util . * ; Β  public class Solve { Β  static Scanner scan = new Scanner ( System . in ) ; Β  public static void solve ( long n , long m ) { Β  long count = 0 , temp ; Β  if ( m % n == 0 ) { temp = m / n ; while ( temp % 2 == 0 ) { count ++ ; temp /= 2 ; } while ( temp % 3 == 0 ) { count ++ ; temp /= 3 ; } if ( temp == 1 ) { System . out . println ( count ) ; } else { System . out . println ( - 1 ) ; } } else { System . out . println ( - 1 ) ; } } Β  public static void main ( String [ ] args ) { Β  long n = scan . nextLong ( ) ; long m = scan . nextLong ( ) ; Β  solve ( n , m ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import static java . lang . Math . * ; import static java . lang . System . out ; import java . util . * ; import java . io . PrintStream ; import java . io . PrintWriter ; public class A { static final int N = ( int ) ( 1e5 + 100 ) ; static final int mod = 1000000007 ; static final long temp = 998244353 ; static final long MOD = 1000000007 ; static final long M = ( long ) 1e9 + 7 ; static class Pair implements Comparable < Pair > { long first , second ; public Pair ( long aa , long bb ) { first = aa ; second = bb ; } public int compareTo ( Pair o ) { return ( int ) ( o . first - this . first ) ; } } static class Tuple implements Comparable < Tuple > { long first , second , third ; public Tuple ( long first , long second , long third ) { this . first = first ; this . second = second ; this . third = third ; } public int compareTo ( Tuple o ) { return ( int ) ( o . third - this . third ) ; } } public static class DSU { int [ ] parent ; int [ ] rank ;", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { int n , m , sum = 0 , a ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; m = in . nextInt ( ) ; if ( m % n != 0 ) { System . out . println ( - 1 ) ; } else { a = m / n ; while ( a % 2 == 0 || a % 3 == 0 ) { if ( a % 2 == 0 ) { sum ++ ; a = a / 2 ; } if ( a % 3 == 0 ) { sum ++ ; a = a / 3 ; } } if ( a == 1 ) { System . out . println ( sum ) ; } else System . out . println ( - 1 ) ; } } Β  }", "import java . util . * ; public class game23 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int c = 0 ; while ( n < x ) { if ( x % ( 3 * n ) == 0 ) { n *= 3 ; ++ c ; } else if ( x % ( 2 * n ) == 0 ) { n *= 2 ; ++ c ; } else { System . out . print ( - 1 ) ; return ; } } System . out . print ( c ) ; } }" ]
[ "n , m = map ( int , input ( ) . split ( ) ) z = m / n NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) if n == m : print ( 0 ) elif m % n != 0 : print ( - 1 ) else : s = 0 x = m // n while x % 2 == 0 or x % 3 == 0 : if x % 2 == 0 : x = x // 2 s = s + 1 if x % 3 == 0 : x = x // 3 s = s + 1 if x == 1 and s != 0 : print ( s ) else : print ( - 1 ) NEW_LINE", "def solution ( n , m ) : Β  Β  if m % n == 0 : t = m / n i = 0 Β  while t > 1 : Β  if t % 2 == 0 : i += 1 t = t / 2 continue Β  elif t % 3 == 0 : i += 1 t = t / 3 continue Β  else : return - 1 Β  return i else : return - 1 Β  Β  Β  nd = input ( ) . split ( ) ind = list ( map ( int , nd ) ) print ( solution ( ind [ 0 ] , ind [ 1 ] ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) ch = m / nk = 0 if n == m : k = 0 else : while ch != 1 : if ch % 3 == 0 : ch = ch / 3 k += 1 elif ch % 2 == 0 : ch = ch / 2 k += 1 else : k = - 1 ch = 1 print ( k ) NEW_LINE" ]
codeforces_1392_A
[ "import java . util . * ; public class Omkar_and_Password { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int c = 0 , sum = y ; for ( int i = 1 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; if ( x != sum ) { sum = sum + x ; c ++ ; } } if ( c > 0 ) System . out . println ( 1 ) ; else System . out . println ( n ) ; } } }", "import java . util . * ; public class OmkarAndPassword { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int c = 0 , a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( i > 0 && a [ i ] != a [ i - 1 ] ) c ++ ; } if ( c > 0 ) System . out . println ( 1 ) ; else System . out . println ( n ) ; } } }", "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 ( ) ; int a [ ] = new int [ n ] ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; if ( i > 0 && a [ i ] != a [ i - 1 ] ) c ++ ; } if ( c > 0 ) so . println ( \"1\" ) ; else so . println ( 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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashSet ; import java . util . StringTokenizer ; public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int t = fs . nextInt ( ) ; while ( t -- > 0 ) { int n = fs . nextInt ( ) ; HashSet < Integer > a = new HashSet < > ( ) ; int ans = 1 ; for ( int i = 0 ; i < n ; i ++ ) { int b = fs . nextInt ( ) ; a . add ( b ) ; } if ( a . size ( ) == 1 ) ans = n ; 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 ( ) ) ; } } }" ]
[ "from collections import Counter NEW_LINE 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 . count ( ali [ 0 ] ) NEW_LINE if ( q == n ) : NEW_LINE INDENT print ( n ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT DEDENT", "for s in [ * open ( 0 ) ] [ 2 : : 2 ] : s = s . split ( ) ; print ( [ 1 , len ( s ) ] [ len ( { * s } ) < 2 ] ) NEW_LINE", "for i in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if ( min ( l ) == max ( l ) ) : NEW_LINE INDENT print ( n ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT DEDENT", "from itertools import accumulate as ac NEW_LINE from collections import Counter as cc NEW_LINE from bisect import bisect_left as bsl NEW_LINE from bisect import bisect as bs NEW_LINE from math import factorial as f NEW_LINE from collections import * NEW_LINE from itertools import * NEW_LINE from string import * NEW_LINE from bisect import * NEW_LINE from queue import * NEW_LINE from heapq import * NEW_LINE from math import * NEW_LINE from sys import * NEW_LINE from re import * NEW_LINE def fast ( ) : return stdin . readline ( ) . strip ( ) NEW_LINE def zzz ( ) : return [ int ( i ) for i in fast ( ) . split ( ) ] NEW_LINE z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) NEW_LINE szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) ) NEW_LINE def lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) NEW_LINE def output ( answer ) : stdout . write ( str ( answer ) ) NEW_LINE num = int ( z ( ) ) NEW_LINE for _ in range ( num ) : NEW_LINE INDENT n = int ( z ( ) ) NEW_LINE arr = szzz ( ) NEW_LINE if arr [ 0 ] == arr [ - 1 ] : NEW_LINE INDENT print ( n ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT DEDENT" ]
codeforces_77_A
[ "import java . util . * ; import javafx . util . Pair ; Β  public class practice { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; long n = scn . nextLong ( ) , a , b , c , val = 1 ; String l , r ; HashMap < String , Long > map = new HashMap < > ( ) ; HashMap < Pair , Long > like = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { l = scn . next ( ) ; r = scn . next ( ) ; r = scn . next ( ) ; if ( map . containsKey ( l ) == false ) map . put ( l , val ++ ) ; if ( map . containsKey ( r ) == false ) map . put ( r , val ++ ) ; like . put ( new Pair ( map . get ( l ) , map . get ( r ) ) , ( long ) 1 ) ; } a = scn . nextLong ( ) ; b = scn . nextLong ( ) ; c = scn . nextLong ( ) ; long t = 2187 , min = a + b + c , max = 0 ;", "# include < stdio . h > # include < string . h > # include < math . h > # include < stdlib . h > # include < stdio . h > # include < string . h > # include < math . h > # include < stdlib . h > int min ( int a , int b ) { return ( a < b ) ? a : b ; } int max ( int a , int b ) { return ( b < a ) ? a : b ; } int n , a , b , c , k [ 100 ] [ 3 ] , kCnt = 0 , r = - 1 , arr [ 10 ] [ 10 ] , maxHappy = 0 ; int gr [ 3 ] [ 10 ] , s [ 3 ] ; void rec ( int warrior , int grouping ) { for ( int i = 0 ; i < 3 ; i ++ ) { if ( s [ i ] == k [ grouping ] [ i ] ) continue ; gr [ i ] [ s [ i ] ++ ] = warrior ; if ( warrior == 7 ) { int happy = 0 ; for ( int g = 0 ; g < 3 ; g ++ ) for ( int x = 0 ; x < s [ g ] ; x ++ ) for ( int y = 0 ; y < s [ g ] ; y ++ ) happy += arr [ gr [ g ] [ x ] ] [ gr [ g ] [ y ] ] ; if ( happy > maxHappy ) maxHappy = happy ; } else { rec ( warrior + 1 , grouping ) ; } s [ i ] -- ; } } int main ( ) {", "Β  import java . util . Scanner ; Β  public class Heroes { static boolean [ ] [ ] like = new boolean [ 7 ] [ 7 ] ; Β  static int [ ] [ ] mindiv = new int [ 3 ] [ 500 ] ; static int max = 0 ; static int divs = 0 ; static int id ( String name ) { if ( name . equals ( \" Anka \" ) ) return 0 ; else if ( name . equals ( \" Chapay \" ) ) return 1 ; else if ( name . equals ( \" Cleo \" ) ) return 2 ; else if ( name . equals ( \" Troll \" ) ) return 3 ; else if ( name . equals ( \" Dracul \" ) ) return 4 ; else if ( name . equals ( \" Snowy \" ) ) return 5 ; else if ( name . equals ( \" Hexadecimal \" ) ) return 6 ; return - 1 ; } static void rec ( int mem , String cur , boolean [ ] yip , int div ) { boolean debug = false ;" ]
[ "from itertools import product , permutations , combinationsn = int ( input ( ) ) NEW_LINE names = { } NEW_LINE nex = 0 NEW_LINE mama = 128 l NEW_LINE iking = [ 0 ] * mamalikes = [ [ 0 ] * 7 for _ in range ( 7 ) ] NEW_LINE def getName ( name ) : global nex NEW_LINE if name in names : return names [ name ] NEW_LINE names [ name ] = nex NEW_LINE nex += 1 NEW_LINE return names [ name ] NEW_LINE for _ in range ( n ) : a , b , c = input ( ) . split ( ) NEW_LINE likes [ getName ( a ) ] [ getName ( c ) ] = 1 NEW_LINE bosses = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE part = [ ( 0 , 0 , 0 ) ] NEW_LINE dipart = 10 ** 10 NEW_LINE for i in range ( 1 , 4 ) : for NEW_LINE j in range ( i , 7 ) : k = 7 - i - j NEW_LINE if k < j : continue NEW_LINE for per in permutations ( bosses ) : aa = ( per [ 0 ] // i , per [ 1 ] // j , per [ 2 ] // k ) NEW_LINE difi = max ( aa ) - min ( aa ) NEW_LINE if difi < dipart : dipart = difi NEW_LINE part = [ ( i , j , k ) ] elif difi == dipart : part . append ( ( i , j , k ) ) NEW_LINE", "import mathimport NEW_LINE itertools Β  if __name__ == ' _ _ main _ _ ' : N = int ( input ( ) ) NEW_LINE likes = [ input ( ) for i in range ( N ) ] NEW_LINE likes = [ line . split ( ) for line in likes ] NEW_LINE likes = [ ( words [ 0 ] , words [ 2 ] ) for words in likes ] NEW_LINE a , b , c = ( float ( val ) for val in input ( ) . split ( ) ) Β  min_diff = max ( a , b , c ) NEW_LINE possible_groups = [ ] NEW_LINE for i in range ( 1 , 7 - 1 ) : for NEW_LINE j in range ( 1 , 7 - i ) : a_e = math . floor ( a / i ) NEW_LINE b_e = math . floor ( b / j ) NEW_LINE c_e = math . floor ( c / ( 7 - i - j ) ) NEW_LINE diff = max ( a_e , b_e , c_e ) - min ( a_e , b_e , c_e ) NEW_LINE if diff < min_diff : min_diff = diff NEW_LINE possible_groups = [ ( i , j ) ] elif diff == min_diff : possible_groups . append ( ( i , j ) ) NEW_LINE max_likes = 0 NEW_LINE for order in itertools . permutations ( [ ' Anka ' , ' Chapay ' , ' Cleo ' , ' Troll ' , ' Dracul ' , ' Snowy ' , ' Hexadecimal ' ] ) : for NEW_LINE i , j in possible_groups : likes_count = 0 NEW_LINE seta = set ( order [ : i ] ) NEW_LINE setb = set ( order [ i : ( i + j ) ] ) NEW_LINE setc = set ( order [ ( i + j ) : ] ) NEW_LINE for p , q in likes : if NEW_LINE p in seta and q in seta : likes_count += 1 NEW_LINE if p in setb and q in setb : likes_count += 1 NEW_LINE if p in setc and q in setc : likes_count += 1 NEW_LINE max_likes = max ( max_likes , likes_count ) NEW_LINE print ( f ' { min _ diff } ▁ { max _ likes } ' ) Β  NEW_LINE" ]
codeforces_978_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ; public class RemoveDuplicates { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int T = 1 ; PrintWriter out = new PrintWriter ( System . out ) ; for ( int tt = 0 ; tt < T ; tt ++ ) { int n = fs . nextInt ( ) ; int arr [ ] = fs . readArray ( n ) ; int count [ ] = new int [ 1001 ] ; ArrayList < Integer > ans = new ArrayList < > ( ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { count [ arr [ i ] ] ++ ; if ( count [ arr [ i ] ] == 1 ) ans . add ( arr [ i ] ) ; } System . out . println ( ans . size ( ) ) ; Collections . reverse ( ans ) ; for ( int i : ans ) { System . out . print ( i + \" ▁ \" ) ; } System . out . println ( ) ; } out . close ( ) ; } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; public String next ( ) { while ( ! st . hasMoreElements ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }", "import java . util . * ; public class cc { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) a . add ( sc . nextInt ( ) ) ; Collections . reverse ( a ) ; Set < Integer > s = new LinkedHashSet < Integer > ( ) ; s . addAll ( a ) ; a . clear ( ) ; a . addAll ( s ) ; Collections . reverse ( a ) ; s . clear ( ) ; s . addAll ( a ) ; Iterator < Integer > i = s . iterator ( ) ; System . out . println ( s . size ( ) ) ; while ( i . hasNext ( ) ) { System . out . print ( i . next ( ) + \" ▁ \" ) ; } } }", "import java . util . ArrayList ; import java . util . Scanner ; Β  public class duplicates { Β  public static void main ( String [ ] args ) { Scanner userInput = new Scanner ( System . in ) ; int n = userInput . nextInt ( ) ; int in [ ] = new int [ n ] ; ArrayList < Integer > out = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { in [ i ] = userInput . nextInt ( ) ; } for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( out . contains ( in [ i ] ) ) continue ; out . add ( 0 , in [ i ] ) ; } System . out . println ( out . size ( ) ) ; for ( Integer integer : out ) { System . out . print ( integer + \" ▁ \" ) ; } } Β  }", "import java . util . * ; public class MyClass { 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 ( ) ; } LinkedHashSet h = new LinkedHashSet ( ) ; int [ ] arr1 = new int [ n ] ; int k = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { arr1 [ k ] = arr [ i ] ; k ++ ; } for ( int i = 0 ; i < n ; i ++ ) { if ( ! h . contains ( arr1 [ i ] ) ) h . add ( arr1 [ i ] ) ; } ArrayList < Integer > w = new ArrayList < Integer > ( h ) ; Collections . reverse ( w ) ; System . out . println ( w . size ( ) ) ; for ( int i : w ) System . out . print ( i + \" ▁ \" ) ; } }", "import java . util . * ; Β  public class codeforces { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Β  int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; Β Β Β  int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; max = Math . max ( max , arr [ i ] ) ; } boolean [ ] bool = new boolean [ max + 1 ] ; Β  int [ ] indicies = new int [ max + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( bool [ arr [ i ] ] == false ) { bool [ arr [ i ] ] = true ; indicies [ arr [ i ] ] = i ; } else { arr [ indicies [ arr [ i ] ] ] = - 1 ; indicies [ arr [ i ] ] = i ; } } int counter = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] != - 1 ) { counter ++ ; } } System . out . println ( counter ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] != - 1 ) { System . out . print ( arr [ i ] + \" ▁ \" ) ; } } Β Β  } }" ]
[ "from collections import Counter Β  n = int ( input ( ) ) Β  arr = [ int ( i ) for i in input ( ) . split ( ) ] c = Counter ( arr ) Β  for i in range ( len ( arr ) ) : if c [ arr [ i ] ] > 1 : c [ arr [ i ] ] -= 1 arr [ i ] = - 1 Β  print ( len ( c ) ) Β  for i in arr : if i != - 1 : print ( i , end = ' ▁ ' ) NEW_LINE", "n = int ( input ( ) ) lst = list ( map ( int , input ( ) . split ( ) ) ) ans = [ ] lst = lst [ : : - 1 ] for i in lst : if i not in ans : ans . append ( i ) ans = ans [ : : - 1 ] print ( len ( ans ) ) for i in ans : print ( i , end = \" ▁ \" ) NEW_LINE", "T = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) [ : T ] ) ) no_dupe = [ ] for i in range ( len ( arr ) ) : if arr [ i ] in no_dupe : no_dupe . remove ( arr [ i ] ) no_dupe . append ( arr [ i ] ) print ( len ( no_dupe ) ) print ( \" ▁ \" . join ( map ( str , no_dupe ) ) ) NEW_LINE" ]
codeforces_1283_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 ) { long n = s . nextLong ( ) ; long k = s . nextLong ( ) ; long times = n / k ; long ans = times * k ; long rem = n - ans ; ans += Math . min ( k / 2 , rem ) ; System . out . println ( ans ) ; } } }", "import com . sun . security . jgss . GSSUtil ; Β  import java . lang . reflect . Array ; import java . math . BigInteger ; import java . util . * ; Β  public class Example { public static void main ( String [ ] args ) { Β  Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t > 0 ) { int n = sc . nextInt ( ) ; Β  int k = sc . nextInt ( ) ; if ( n % k == 0 ) { System . out . println ( n ) ; } else { int perk = n / k ; long ans = 0 ; int aex = ( int ) Math . floor ( ( double ) k / 2 ) ; if ( aex <= n % k ) { ans = perk * k + aex ; } else { ans = perk * k + n % k ; } System . out . println ( ans ) ; Β  } t -- ; Β Β Β Β  } Β  } } Β Β Β ", "import java . util . Arrays ; import java . util . Scanner ; Β  public class Candies { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int testcases = sc . nextInt ( ) ; sc . nextLine ( ) ; Β  for ( int i = 0 ; i < testcases ; i ++ ) { String array = sc . nextLine ( ) ; int [ ] stream = Arrays . stream ( array . split ( \" ▁ \" ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; System . out . println ( output ( stream ) ) ; } } Β  private static int output ( int [ ] stream ) { int out = 0 ; int a = stream [ 0 ] / stream [ 1 ] ; int left = stream [ 0 ] - ( stream [ 1 ] * a ) ; if ( left > stream [ 1 ] / 2 ) { left = stream [ 1 ] / 2 ; } return stream [ 1 ] * a + left ; } }" ]
[ "for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) print ( min ( n // k * ( k // 2 + ( k % 2 == 1 ) ) + ( n // k + 1 ) * ( k // 2 ) , n ) ) NEW_LINE", "import sysinput = sys . stdin . readline Β  t = int ( input ( ) ) for _ in range ( t ) : n , k = map ( int , input ( ) . split ( ) ) a = n // k ans = min ( n , a * k + k // 2 ) print ( ans ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) res = 0 if n == 1 : print ( 1 ) elif n % k == 0 : print ( n ) else : tmp = n // k st = k // 2 n = n % k ex = min ( n , st ) res = ( tmp * k ) + ex print ( res ) Β  NEW_LINE", "cases = int ( input ( ) ) while cases : cases -= 1 NEW_LINE" ]
codeforces_334_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ; Β Β  public class Template { private static BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static String readln ( ) throws IOException { String line = input . readLine ( ) ; return line ; } Β  public static void main ( String [ ] args ) throws IOException { Β ", "import java . util . Scanner ; public class Cf { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int totalbags = n * n ; for ( int i = 1 ; i <= totalbags / 2 ; i ++ ) { System . out . println ( i + \" ▁ \" + ( ( totalbags - i ) + 1 ) ) ; } } }", "Β  import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class er10a {", "import java . util . * ; import java . io . * ; public class A { static FastReader in = new FastReader ( ) ; static final Random random = new Random ( ) ; static long mod = 1000000007L ; public static void main ( String args [ ] ) throws IOException { int t = 1 ;" ]
[ "n = int ( input ( ) ) Β  for i in range ( n * n // 2 ) : print ( i + 1 , n * n - i ) NEW_LINE", "n = int ( input ( ) ) for i in range ( 1 , ( n * n ) // 2 + 1 ) : print ( i , ( n * n - i + 1 ) ) NEW_LINE", "n = int ( input ( ) ) li = [ [ ] for _ in range ( n ) ] for i in range ( 1 , n * n // 2 + 1 ) : li [ ( i - 1 ) % n ] += [ i , n * n - i + 1 ] for line in li : print ( * line ) NEW_LINE", "n = int ( input ( ) ) sq = n * nfor i in range ( 0 , int ( sq / 2 ) ) : print ( i + 1 , sq - i ) NEW_LINE", "n = int ( input ( ) . strip ( ) ) for i in range ( n ) : a = [ ] for j in range ( n ) : a += [ j * n + ( j + i ) % n + 1 ] print ( * a ) NEW_LINE" ]
codeforces_578_A
[ "import java . util . * ; public class Ideone { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) , b = in . nextInt ( ) ; if ( a < b ) System . out . print ( - 1 ) ; else System . out . printf ( \" % .10f \" , 1.0 * ( a + b ) / ( 2.0 * ( ( a + b ) / ( 2 * b ) ) ) ) ; } }", "import java . io . PrintWriter ; import java . util . Scanner ; Β  public class H { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) ; if ( b > a ) out . println ( - 1 ) ; else if ( a == b ) out . println ( a ) ; else { double r = ( a + b ) / 2.0 ; double r2 = ( a - b ) / 2.0 ; double k = Math . floor ( ( a + b ) / ( 2.0 * b ) ) ; double k2 = Math . floor ( ( a - b ) / ( 2.0 * b ) ) ; out . println ( Math . min ( r / k , r2 / k2 ) ) ; } out . close ( ) ; } }", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; Β  public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AAProblemAboutPolyline solver = new AAProblemAboutPolyline ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } Β  static class AAProblemAboutPolyline { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int a = in . nextInt ( ) , b = in . nextInt ( ) ; Β  if ( b > a ) { out . println ( - 1 ) ; return ; } Β " ]
[ "def solve ( a , b ) : Β  if b > a : return - 1 Β  if a == b : return a u = 2 * int ( ( a + b ) / ( 2 * b ) ) sol1 = ( a + b ) / u return sol1 Β  Β  if __name__ == ' _ _ main _ _ ' : a , b = map ( int , input ( ) . split ( ) ) result = solve ( a , b ) print ( result ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) if a < b : print ( - 1 ) elif a == b : print ( a ) else : i1 = ( a + b ) // ( 2 * b ) i2 = ( a - b ) // ( 2 * b ) if i2 == 0 : print ( ( a + b ) / ( 2 * i1 ) ) else : p = ( a + b ) / 2 q = ( a - b ) / 2 print ( min ( p / i1 , q / i2 ) ) NEW_LINE", "def solve ( a , b ) : Β  NEW_LINE", "def solve ( a , b ) : Β  if b > a : return - 1 Β  if a == b : return a Β  sol1 = ( a + b ) / ( 2 * int ( ( a + b ) / ( 2 * b ) ) ) u = ( 2 * int ( ( a - b ) / ( 2 * b ) ) ) sol2 = ( a - b ) / u if u != 0 else sol1 + 1 return min ( sol1 , sol2 ) Β  Β  if __name__ == ' _ _ main _ _ ' : a , b = map ( int , input ( ) . split ( ) ) result = solve ( a , b ) print ( result ) NEW_LINE" ]
codeforces_756_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; Β  import java . util . * ; Β  public class A_GENERAL {", "import java . util . Scanner ; Β  public class Main { static Scanner scanner = new Scanner ( System . in ) ; static boolean mark [ ] ; static int a [ ] ; static int n ; public static void main ( String [ ] args ) { n = scanner . nextInt ( ) ; a = new int [ n ] ; int b [ ] = new int [ n ] ; mark = new boolean [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scanner . nextInt ( ) - 1 ; } int sum = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = scanner . nextInt ( ) ; sum += b [ i ] ; } if ( sum % 2 == 0 ) { ans = 1 ; } int low = sDFS ( ) ; if ( low == 1 ) { System . out . println ( ans ) ; return ; } System . out . println ( low + ans ) ; } private static int sDFS ( ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! mark [ i ] ) { sum ++ ; DFS ( i ) ; } } return sum ; } private static void DFS ( int x ) { mark [ x ] = true ; if ( ! mark [ a [ x ] ] ) { DFS ( a [ x ] ) ; } } }", "import java . util . * ; Β  public class Barbecue { public static class Graph { public int V ; ArrayList < Integer > adjList [ ] ; public Graph ( int V ) { this . V = V ; adjList = new ArrayList [ V ] ; Β  for ( int i = 0 ; i < V ; i ++ ) { adjList [ i ] = new ArrayList < Integer > ( ) ; } } public void addEdge ( int src , int dest , boolean bidirectional ) { this . adjList [ src ] . add ( dest ) ; if ( bidirectional ) { this . adjList [ dest ] . add ( src ) ; } } public void printGraph ( ) { for ( int v = 0 ; v < this . V ; v ++ ) { System . out . println ( \" Vertex ▁ \" + v + \" : \" ) ; System . out . print ( \" Conntected ▁ to ▁ \" ) ; for ( Integer pCrawl : this . adjList [ v ] ) { System . out . print ( pCrawl + \" ▁ \" ) ; } System . out . println ( \" \\n \" ) ; } } public boolean dfs ( int s , boolean [ ] visited , boolean [ ] recStack ) { if ( recStack [ s ] ) return true ; if ( visited [ s ] ) return false ; visited [ s ] = true ; recStack [ s ] = true ;", "import java . util . Arrays ; import java . util . Scanner ; Β  public class PavelAndBarbeque { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ;" ]
[ "n = int ( input ( ) ) p = [ int ( i ) for i in input ( ) . split ( ) ] zeros = [ int ( i ) for i in input ( ) . split ( ) ] Β  ans = 0 Β  if not sum ( zeros ) % 2 : ans += 1 Β  visited = [ False for i in range ( n ) ] Β  ciclos = 0 for i in range ( n ) : if not visited [ i ] : ciclos += 1 j = i while not visited [ j ] : visited [ j ] = True j = p [ j ] - 1 Β  if ciclos == 1 : ans += 0 else : ans += ciclos Β  print ( ans ) NEW_LINE", "n = int ( input ( ) ) p = [ int ( i ) for i in input ( ) . split ( ) ] b = [ int ( i ) for i in input ( ) . split ( ) ] ans = 0 visited = [ False for i in range ( n ) ] for i in range ( n ) : if visited [ i ] : continue ans += 1 while not visited [ i ] : visited [ i ] = True i = p [ i ] - 1 if ans == 1 : ans = 0 ans += ( sum ( b ) + 1 ) % 2 print ( ans ) NEW_LINE", "read = lambda : map ( int , input ( ) . split ( ) ) Β  n = int ( input ( ) ) Β  p = list ( read ( ) ) Β  b = list ( read ( ) ) Β  ans = ( b . count ( 1 ) + 1 ) % 2 Β  was = [ 0 ] * n Β  cnt = 0 Β  for i in range ( n ) : Β  if not was [ i ] : Β  cnt += 1 Β  v = i Β  while not was [ v ] : Β  was [ v ] = 1 Β  v = p [ v ] - 1 Β  if cnt > 1 : ans += cnt Β  print ( ans ) Β  Β  Β  NEW_LINE", "import sys n = int ( input ( ) ) p = [ int ( i ) for i in input ( ) . split ( ) ] b = [ int ( i ) for i in input ( ) . split ( ) ] ans = 0 num_cycles = 0 checked = set ( ) for i in range ( n ) : if i in checked : continue checked . add ( i ) nxt = p [ i ] - 1 while nxt != i : checked . add ( nxt ) nxt = p [ nxt ] - 1 num_cycles += 1 ans += num_cycles if num_cycles != 1 else 0 ans += ( sum ( b ) % 2 ) == 0 print ( ans ) NEW_LINE", "n = int ( input ( ) ) p = [ int ( i ) for i in input ( ) . split ( ) ] zeros = [ int ( i ) for i in input ( ) . split ( ) ] Β  ans = 0 Β  if not sum ( zeros ) % 2 : ans += 1 Β  visited = [ False for i in range ( n ) ] Β  ciclos = 0 for i in range ( n ) : if not visited [ i ] : ciclos += 1 j = i while not visited [ j ] : visited [ j ] = True j = p [ j ] - 1 Β  if ciclos == 1 : ans += 0 else : ans += ciclos Β  print ( ans ) NEW_LINE" ]
codeforces_1239_B
[ "# include < cstdio > # include < algorithm > # include < queue > # include < set > # include < cstring > Β  using namespace std ; Β  typedef long long ll ; typedef pair < ll , int > pli ; const ll P = 1e9 + 7 ; const int N = 3e5 + 10 ; Β # define mk make_pair # define pb push_back # define fr first # define sc second Β Β  int rd ( ) { int x = 0 , f = 1 ; char c = getchar ( ) ; while ( c > '9' || c < '0' ) f = c == ' - ' ? - 1 : 1 , c = getchar ( ) ; while ( c >= '0' && c <= '9' ) x = x * 10 + c - 48 , c = getchar ( ) ; return x * f ; } Β  int n , cnt , sl , sr , sum [ N ] ; char s [ N ] , tmp [ N ] ; int main ( ) {", "# include < cstdio > # include < algorithm > # include < queue > # include < set > # include < cstring > Β  using namespace std ; Β  typedef long long ll ; typedef pair < ll , int > pli ; const ll P = 1e9 + 7 ; const int N = 3e5 + 10 ; Β # define mk make_pair # define pb push_back # define fr first # define sc second Β Β  int rd ( ) { int x = 0 , f = 1 ; char c = getchar ( ) ; while ( c > '9' || c < '0' ) f = c == ' - ' ? - 1 : 1 , c = getchar ( ) ; while ( c >= '0' && c <= '9' ) x = x * 10 + c - 48 , c = getchar ( ) ; return x * f ; } Β  int n , cnt , sl , sr , sum [ N ] ; char s [ N ] , tmp [ N ] ; int main ( ) {", "import java . util . * ; import java . io . * ; public class cf1239b { Β  public static void main ( String [ ] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ;" ]
[ "n = int ( input ( ) ) s = input ( ) r = 0 l = n - 1 root = [ ] buf = [ ] to_the_right = True for count in range ( n ) : if to_the_right : i = r r += 1 else : i = l l -= 1 b = s [ i ] if b == ' ( ' : if len ( buf ) == 0 or buf [ - 1 ] [ 0 ] != - 1 : buf . append ( [ - 1 , - 1 , [ ] ] ) buf [ - 1 ] [ 0 ] = i else : if len ( buf ) == 0 or buf [ - 1 ] [ 1 ] != - 1 : buf . append ( [ - 1 , - 1 , root ] ) root = [ ] to_the_right = False buf [ - 1 ] [ 1 ] = i if buf [ - 1 ] [ 0 ] != - 1 and buf [ - 1 ] [ 1 ] != - 1 : tmp = buf . pop ( ) if len ( buf ) : buf [ - 1 ] [ 2 ] . append ( tmp ) else : root . append ( tmp ) to_the_right = True sol = [ [ 0 , 1 , 1 ] ] if len ( buf ) == 0 : sol . append ( [ len ( root ) , 1 , 1 ] ) for child in root : sol . append ( [ len ( child [ 2 ] ) + 1 , child [ 0 ] + 1 , child [ 1 ] + 1 ] ) for gr_child in child [ 2 ] : sol . append ( [ len ( root ) + len ( gr_child [ 2 ] ) + 1 , gr_child [ 0 ] + 1 , gr_child [ 1 ] + 1 ] ) print ( ' % d \\n % d ▁ % d ' % tuple ( max ( sol ) ) ) NEW_LINE", "n = int ( input ( ) ) s = input ( ) r = 0 l = n - 1 root = [ ] buf = [ ] to_the_right = True Β  for count in range ( n ) : if to_the_right : i = r r += 1 else : i = l l -= 1 b = s [ i ] Β  if b == ' ( ' : if len ( buf ) == 0 or buf [ - 1 ] [ 0 ] != - 1 : buf . append ( [ - 1 , - 1 , [ ] ] ) buf [ - 1 ] [ 0 ] = i else : if len ( buf ) == 0 or buf [ - 1 ] [ 1 ] != - 1 : buf . append ( [ - 1 , - 1 , root ] ) root = [ ] to_the_right = False buf [ - 1 ] [ 1 ] = i if buf [ - 1 ] [ 0 ] != - 1 and buf [ - 1 ] [ 1 ] != - 1 : tmp = buf . pop ( ) if len ( buf ) : buf [ - 1 ] [ 2 ] . append ( tmp ) else : root . append ( tmp ) to_the_right = True Β  sol = [ [ 0 , 1 , 1 ] ] if len ( buf ) == 0 : sol . append ( [ len ( root ) , 1 , 1 ] ) for child in root : sol . append ( [ len ( child [ 2 ] ) + 1 , child [ 0 ] + 1 , child [ 1 ] + 1 ] ) for gr_child in child [ 2 ] : sol . append ( [ len ( root ) + len ( gr_child [ 2 ] ) + 1 , gr_child [ 0 ] + 1 , gr_child [ 1 ] + 1 ] ) print ( ' % d \\n % d ▁ % d ' % tuple ( max ( sol ) ) ) NEW_LINE" ]
codeforces_1368_A
[ "import java . util . Scanner ; Β  public class A1368 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int a = scanner . nextInt ( ) , c , k = 0 , b = scanner . nextInt ( ) , n = scanner . nextInt ( ) ; if ( a < b ) { c = a ; a = b ; b = c ; } do { if ( k % 2 == 0 ) { b += a ; c = b ; } else { a += b ; c = a ; } k ++ ; } while ( c <= n ) ; System . out . println ( k ) ; } } }", "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 a = fs . nextInt ( ) ; int b = fs . nextInt ( ) ; int n = fs . nextInt ( ) ;", "import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int t , a , b , n ; t = scan . nextInt ( ) ; while ( t -- > 0 ) { a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; n = scan . nextInt ( ) ; int ctr = 0 ; while ( a <= n && b <= n ) { if ( a <= b ) a += b ; else b += a ; ++ ctr ; } System . out . println ( ctr ) ; } } }", "import java . util . * ; import java . lang . String ; import java . lang . Math ; import java . util . Arrays ; Β  public class Capitalization2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t ; t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int a , b , n ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; n = sc . nextInt ( ) ; int res = 0 ; while ( a <= n && b <= n ) { if ( a <= b ) a = a + b ; else b = b + a ; res ++ ; } System . out . println ( res ) ; } } } Β Β  Β Β ", "import java . util . * ; Β  public class Runner { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tests = sc . nextInt ( ) ; for ( int i = 0 ; i < tests ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int count = 0 ; while ( a <= n && b <= n ) { int smaller = getSmaller ( a , b ) ; if ( smaller == a ) { a += b ; } else { b += a ; } count ++ ; } System . out . println ( count ) ; Β  } } private static int getSmaller ( int a , int b ) { if ( a < b ) { return a ; } return b ; } private static int [ ] stringToIntArray ( String str ) { String [ ] strs = str . trim ( ) . split ( \" ▁ \" ) ; int [ ] intArr = new int [ strs . length ] ; for ( int i = 0 ; i < strs . length ; i ++ ) { intArr [ i ] = Integer . parseInt ( strs [ i ] ) ; } return intArr ; } Β  }" ]
[ "for _ in range ( int ( input ( ) ) ) : a , b , n = map ( int , input ( ) . split ( ) ) c = 0 while a <= n and b <= n : if a < b : a += b else : b += a c += 1 print ( c ) NEW_LINE", "T = int ( input ( ) ) Β  nums = [ ] final = [ ] counter = 0 for i in range ( T ) : counter = 0 nums = [ * map ( int , input ( ) . split ( \" ▁ \" ) ) ] while nums [ 0 ] <= nums [ 2 ] and nums [ 1 ] <= nums [ 2 ] : if nums [ 0 ] >= nums [ 1 ] : nums [ 1 ] += nums [ 0 ] else : nums [ 0 ] += nums [ 1 ] counter += 1 final . append ( counter ) Β  for i in range ( len ( final ) ) : print ( final [ i ] ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : a , b , n = [ int ( x ) for x in input ( ) . split ( ) ] i = 0 while a <= n and b <= n : if a < b : a += b else : b += a i += 1 print ( i ) NEW_LINE", "t = int ( input ( ) ) Β  for x in range ( t ) : a , b , n = map ( int , input ( ) . split ( ) ) Β  if a > b : b , a = a , b Β  operation = 0 while a <= n and b <= n : a += b a , b = b , a operation += 1 Β  print ( operation ) NEW_LINE" ]
codeforces_1375_A
[ "Β  import java . util . * ; import java . io . * ; Β  public class Main { private static final int N = ( int ) 1e6 + 10 ; public static void main ( String [ ] args ) throws IOException { int t , n , k ; int [ ] a = new int [ N ] ; StreamTokenizer cin = new StreamTokenizer ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; cin . nextToken ( ) ; t = ( int ) cin . nval ; while ( t -- > 0 ) { cin . nextToken ( ) ; n = ( int ) cin . nval ; int i ; for ( i = 1 ; i <= n ; i ++ ) { int x ; cin . nextToken ( ) ; x = ( int ) cin . nval ; if ( i % 2 == 1 ) System . out . print ( Math . abs ( x ) + \" ▁ \" ) ; else System . out . print ( - Math . abs ( x ) + \" ▁ \" ) ; } System . out . println ( ) ; } Β  } Β  }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t > 0 ) { int n = scan . nextInt ( ) ; t -- ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } int c = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] < 0 ) { a [ i ] *= - 1 ; } } for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = a [ i ] * c ; c *= - 1 ; } for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( a [ i ] + \" ▁ \" ) ; } System . out . println ( ) ; Β  } } }" ]
[ "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( len ( a ) ) : if i % 2 == 0 : print ( abs ( a [ i ] ) , end = ' ▁ ' ) else : print ( - abs ( a [ i ] ) , end = ' ▁ ' ) print ( ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) arr = [ abs ( int ( x ) ) for x in input ( ) . split ( ) ] out = [ ] for i in range ( len ( arr ) ) : if i % 2 == 0 : out . append ( arr [ i ] ) else : out . append ( arr [ i ] * - 1 ) print ( * out ) 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 ( ) ) for _ in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 0 , n ) : if i % 2 == 1 : if a [ i ] < 0 : a [ i ] = 0 - a [ i ] else : if a [ i ] > 0 : a [ i ] = 0 - a [ i ] print ( ' ▁ ' . join ( map ( str , a ) ) ) Β  NEW_LINE", "import sys Β  def answer ( n , a ) : b = [ ] for i in range ( n ) : if i % 2 == 0 : b . append ( abs ( a [ i ] ) ) else : b . append ( - abs ( a [ i ] ) ) Β  return b NEW_LINE", "import sysimport mathfrom math import factorial , inf , gcdfrom heapq import * from functools import * from itertools import * from collections import * from typing import * sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE" ]
codeforces_1366_B
[ "import java . util . * ; import java . io . * ; public class Main2 { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } static int mod = ( int ) ( 1e9 + 7 ) ; static FastReader sc = new FastReader ( ) ; static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { int z = 1 ; z = sc . nextInt ( ) ; while ( z -- > 0 ) { int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = x , h = x ; long ans = 1 ; while ( m -- > 0 ) { int u = sc . nextInt ( ) ; int v = sc . nextInt ( ) ; if ( u <= l && v >= l ) { l = Math . min ( u , l ) ; h = Math . max ( v , h ) ; } if ( u <= h && v >= h ) { l = Math . min ( u , l ) ; h = Math . max ( v , h ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; Β Β  public class Solution { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int INF = ( int ) 1e9 ; int n = sc . nextInt ( ) , x = sc . nextInt ( ) , m = sc . nextInt ( ) , mini = x , maxi = x ; while ( m -- > 0 ) { int l = sc . nextInt ( ) , r = sc . nextInt ( ) ; if ( ( l <= maxi ) && ( r >= mini ) ) { maxi = Math . max ( maxi , r ) ; mini = Math . min ( mini , l ) ; } } System . out . println ( maxi - mini + 1 ) ; } } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Long [ ] readArray ( int n ) { Long [ ] a = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }", "Β Β  import java . io . * ; import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; Β Β  public class Main1 { Β Β Β Β  public static void main ( String [ ] args ) { Β  try { Β Β  FastScanner in = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; Β Β  int t = in . nextInt ( ) ; while ( t -- > 0 ) { long n = in . nextLong ( ) ; long x = in . nextLong ( ) ; long m = in . nextLong ( ) ; long max = - 1 ; long min = Long . MAX_VALUE ; Β  boolean flag = false ;" ]
[ "t = int ( input ( ) ) Β  for _ in range ( t ) : n , posof1 , m = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) res = 0 begin = posof1 end = posof1 for x in range ( m ) : Β  temp = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) if temp [ 0 ] <= begin <= temp [ 1 ] or temp [ 0 ] <= end <= temp [ 1 ] : begin = min ( begin , temp [ 0 ] ) end = max ( end , temp [ 1 ] ) Β  print ( end - begin + 1 ) Β  Β  Β  NEW_LINE", "tt = int ( input ( ) ) for i in range ( 0 , tt ) : n , x , m = map ( int , input ( ) . split ( ) ) l , r = x , x for x in range ( m ) : L , R = map ( int , input ( ) . split ( ) ) if max ( l , L ) <= min ( r , R ) : l = min ( l , L ) r = max ( r , R ) print ( r - l + 1 ) NEW_LINE", "import sys Β  input = sys . stdin . readline Β  for i in range ( int ( input ( ) ) ) : Β  Β  n , x , m = map ( int , input ( ) . split ( ) ) Β  Β  a = x b = x for j in range ( m ) : l , r = map ( int , input ( ) . split ( ) ) Β  Β  Β  if l <= a <= r or l <= b <= r : a = min ( a , l ) b = max ( b , r ) print ( b - a + 1 ) NEW_LINE", "import sys Β  def answer ( n , x , m , l , r ) : lptr = x rptr = x for i in range ( m ) : if l [ i ] < lptr and r [ i ] >= lptr : lptr = l [ i ] if r [ i ] > rptr and l [ i ] <= rptr : rptr = r [ i ] k = ( rptr - lptr ) + 1 return k Β  def main ( ) : t = int ( input ( ) ) while t : n , x , m = [ int ( i ) for i in sys . stdin . readline ( ) . split ( ) ] l = [ 0 ] * m r = [ 0 ] * m for j in range ( m ) : l [ j ] , r [ j ] = [ int ( i ) for i in sys . stdin . readline ( ) . split ( ) ] print ( answer ( n , x , m , l , r ) ) t -= 1 returnmain ( ) NEW_LINE" ]
codeforces_1147_B
[ "import java . util . * ; import java . io . * ; Β  public class CFA { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; private static final long MOD = 1000L * 1000L * 1000L + 7 ; private static final int [ ] dx = { 0 , - 1 , 0 , 1 } ; private static final int [ ] dy = { 1 , 0 , - 1 , 0 } ; private static final String yes = \" Yes \" ; private static final String no = \" No \" ; Β  void solve ( ) {", "Β  import java . util . HashMap ; import java . util . HashSet ; import java . util . Scanner ; Β  public class ChladniFigure { static class Pair { int a ; int b ; int done = 0 ; public Pair ( int a0 , int b0 ) { a = Math . min ( a0 , b0 ) ; b = Math . max ( a0 , b0 ) ; } public String toString ( ) { return ( \" ( \" + a + \" ▁ \" + b + \" ) \" ) ; } } static int n , m ; static HashMap < Integer , HashSet < Integer > > map = new HashMap < > ( ) ; static HashSet < Pair > set = new HashSet < > ( ) ; static HashMap < Integer , HashMap < Integer , Pair > > maptoobj = new HashMap < > ( ) ; static void addpair ( int a , int b ) { if ( a > b ) { int temp = a ; a = b ; b = temp ; } if ( ! map . containsKey ( a ) ) { map . put ( a , new HashSet < Integer > ( ) ) ; maptoobj . put ( a , new HashMap < > ( ) ) ; } map . get ( a ) . add ( b ) ; Pair pair = new Pair ( a , b ) ; set . add ( pair ) ; maptoobj . get ( a ) . put ( b , pair ) ; } static boolean checkpair ( int a , int b ) { if ( a > b ) { int temp = a ; a = b ; b = temp ; } return ( map . containsKey ( a ) && map . get ( a ) . contains ( b ) ) ; } Β  public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; int startn = n ;", "import java . io . * ; import java . lang . reflect . Array ; import java . math . * ; import java . util . * ; Β  public class icpc { public static void main ( String [ ] args ) throws IOException { Reader in = new Reader ( ) ;", "import java . util . * ; import java . io . * ; public class Main { public static void main ( String args [ ] ) { new Main ( ) . work ( ) ; } Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; void work ( ) { int n = in . nextInt ( ) , m = in . nextInt ( ) ; ArrayList < Integer > [ ] graph = ( ArrayList < Integer > [ ] ) new ArrayList [ n ] ; for ( int i = 0 ; i < n ; i ++ ) graph [ i ] = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { int c1 = in . nextInt ( ) - 1 ; int c2 = in . nextInt ( ) - 1 ; if ( c1 < c2 ) { graph [ c1 ] . add ( c2 ) ; graph [ c2 ] . add ( c1 + n ) ; } else { graph [ c2 ] . add ( c1 ) ; graph [ c1 ] . add ( c2 + n ) ; } } for ( int i = 0 ; i < n ; i ++ ) Collections . sort ( graph [ i ] ) ; boolean f = false ; out : for ( int i = 1 ; i < n ; i ++ ) { if ( n % i != 0 ) continue ; for ( int j = 0 ; j < n ; j ++ ) { int k = ( j + i ) % n ; if ( graph [ j ] . size ( ) != graph [ k ] . size ( ) ) continue out ; for ( int l = 0 ; l < graph [ j ] . size ( ) ; l ++ ) { if ( ( graph [ j ] . get ( l ) + i ) % n != graph [ k ] . get ( l ) % n ) { continue out ; } } } f = true ; break ; } if ( f ) { out . print ( \" Yes \" ) ; } else { out . print ( \" No \" ) ; } out . flush ( ) ; } }", "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 ) { Β " ]
[ "import math Β  Β  class CodeforcesTask1147BSolution : def __init__ ( self ) : self . result = ' ' self . n_m = [ ] self . points = [ ] Β  def read_input ( self ) : self . n_m = [ int ( x ) for x in input ( ) . split ( \" ▁ \" ) ] for x in range ( self . n_m [ 1 ] ) : self . points . append ( [ int ( y ) for y in input ( ) . split ( \" ▁ \" ) ] ) Β  def process_task ( self ) : can = False segm = { } for point in self . points : segm [ \" { 0 } _ {1 } \" . format ( * point ) ] = True segm [ \" { 1 } _ {0 } \" . format ( * point ) ] = True for k in range ( 1 , self . n_m [ 0 ] ) : if not self . n_m [ 0 ] % k : NEW_LINE", "def check ( k , g ) : for i in g : a = ( i [ 0 ] + k ) % n b = ( i [ 1 ] + k ) % n if not ( min ( a , b ) , max ( a , b ) ) in g : return False return True Β  n , m = [ int ( i ) for i in input ( ) . split ( ) ] Β  g = set ( ) for i in range ( m ) : a , b = [ int ( i ) for i in input ( ) . split ( ) ] a -= 1 b -= 1 NEW_LINE" ]
codeforces_147_A
[ "import java . io . IOException ; import java . util . * ; public class Punctuation { Β  public static void main ( String [ ] args ) throws IOException {", "import java . util . * ; public class j { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; StringBuilder sd = new StringBuilder ( \" \" ) ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S . charAt ( i ) >= ' a ' && S . charAt ( i ) <= ' z ' ) sd . append ( S . charAt ( i ) ) ; else if ( S . charAt ( i ) == ' ▁ ' ) { for ( ; S . charAt ( i ) == ' ▁ ' ; i ++ ) { } if ( S . charAt ( i ) >= ' a ' && S . charAt ( i ) <= ' z ' ) { sd . append ( ' ▁ ' ) ; sd . append ( S . charAt ( i ) ) ; } else { sd . append ( S . charAt ( i ) ) ; if ( S . charAt ( i + 1 ) != ' ▁ ' ) sd . append ( ' ▁ ' ) ; } } else if ( S . charAt ( i ) == ' . ' || S . charAt ( i ) == ' , ' || S . charAt ( i ) == ' ! ' || S . charAt ( i ) == ' ? ' ) { sd . append ( S . charAt ( i ) ) ; if ( S . charAt ( i + 1 ) != ' ▁ ' ) sd . append ( ' ▁ ' ) ; } } System . out . println ( sd ) ; } Β  }", "import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; String text = sc . nextLine ( ) ; int n = text . length ( ) ; StringBuilder str = new StringBuilder ( text ) ; int i = 0 , j = 0 ; for ( i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' ▁ ' ) { j = i + 1 ; while ( j < str . length ( ) && str . charAt ( j ) == ' ▁ ' ) { str . deleteCharAt ( j ) ; } } } for ( i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' . ' || str . charAt ( i ) == ' , ' || str . charAt ( i ) == ' ! ' || str . charAt ( i ) == ' ? ' ) { if ( str . charAt ( i - 1 ) == ' ▁ ' ) { str . deleteCharAt ( i - 1 ) ; i -= 1 ; } if ( str . charAt ( i + 1 ) != ' ▁ ' ) { str . insert ( i + 1 , ' ▁ ' ) ; } } } if ( str . charAt ( str . length ( ) - 1 ) == ' ▁ ' ) str . deleteCharAt ( str . length ( ) - 1 ) ; pw . print ( str . toString ( ) ) ; Β \t\t Β Β Β Β  pw . close ( ) ; } Β Β Β Β Β Β Β Β Β Β Β Β Β Β " ]
[ "s = str ( input ( ) ) l = ' , . ! ? ' e = ' ' for i in range ( 0 , len ( s ) ) : if ( s [ i ] not in l and s [ i ] != ' ▁ ' ) : e = e + s [ i ] elif ( s [ i ] == ' ▁ ' ) : if ( e [ - 1 ] == ' ▁ ' ) : pass else : e = e + s [ i ] else : if ( e [ - 1 ] == ' ▁ ' ) : e = e [ 0 : len ( e ) - 1 ] e = e + s [ i ] + ' ▁ ' else : e = e + s [ i ] + ' ▁ ' print ( e ) NEW_LINE", "a = input ( ) z = len ( a ) d = [ ] ; t = \" \" for i in a : if i . isalpha ( ) : t += i else : if t != \" \" : d . append ( t ) if i in ' . , ? ! ' : d . append ( i ) t = \" \" d . append ( t ) p = len ( d ) for i in range ( p - 1 ) : if d [ i + 1 ] in \" . , ? ! \" : print ( d [ i ] , end = \" \" ) else : print ( d [ i ] , end = \" ▁ \" ) print ( d [ - 1 ] ) NEW_LINE", "punc = [ ' . ' , ' , ' , ' ! ' , ' ? ' ] ; Β  s = input ( ) x = s . split ( ) res = str ( ) ; Β  for i in x : res = res + i + ' ▁ ' Β  for c in punc : y = res . split ( c ) NEW_LINE", "import re s = input ( ) . strip ( ) s = re . sub ( ' \\s + ' , ' ▁ ' , s ) s = re . sub ( ' \\s ? ( [ . , ! ? ] ) \\s ? ' , ' \\\\1 ▁ ' , s ) print ( s ) NEW_LINE", "import res = re . sub ( \" \\ ▁ + \" , \" ▁ \" , input ( ) ) s = re . sub ( ' ▁ * ( [ , . ! ? ] ) ▁ * ' , r ' \\1 ▁ ' , s ) print ( s ) NEW_LINE" ]
codeforces_1108_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . HashMap ; import java . util . Scanner ; import java . util . StringTokenizer ; Β  public class Main { Β  public static void main ( String [ ] args ) { Β  Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; int num = 0 ; while ( t -- > 0 ) { int a = sc . nextInt ( ) ; num = Math . max ( a , num ) ; if ( map . containsKey ( a ) ) { map . put ( a , map . get ( a ) + 1 ) ; } else { map . put ( a , 1 ) ; } } for ( int i = 1 ; i <= num ; i ++ ) { if ( num % i == 0 ) { map . put ( i , map . get ( i ) - 1 ) ; } } int ans = 0 ; for ( int i = num ; i >= 1 ; i -- ) { if ( map . containsKey ( i ) ) { if ( map . get ( i ) != 0 ) { ans = i ; break ; } } } System . out . println ( num + \" ▁ \" + ans ) ; } } Β ", "import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . LinkedHashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . * ; import java . util . stream . Collectors ; Β  public class absolute { Β  public static void main ( String [ ] args ) {", "import java . util . Arrays ; import java . util . Scanner ; Β  public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; int topb = - 1 , topc = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; }" ]
[ "n = int ( input ( ) ) s = list ( map ( int , input ( ) . split ( ) ) ) b = max ( s ) for i in range ( 1 , b + 1 ) : if ( b % i == 0 ) : s . pop ( s . index ( i ) ) a = max ( s ) print ( a , b ) NEW_LINE", "n = int ( input ( ) ) divisors = [ int ( bruh ) for bruh in input ( ) . split ( ) ] divvies = sorted ( divisors ) bignum = divvies [ 0 ] * divvies [ - 1 ] Β  bignumdivvies = [ ] Β  for div in range ( 1 , bignum + 1 ) : if bignum % div == 0 : bignumdivvies . append ( div ) Β  bignumdivvies = list ( set ( bignumdivvies ) ) Β  smallnumdivvies = [ ] Β  for x in sorted ( divisors ) : for y in range ( divisors . count ( x ) - bignumdivvies . count ( x ) ) : smallnumdivvies . append ( x ) Β  smallnum = smallnumdivvies [ 0 ] * smallnumdivvies [ - 1 ] Β  print ( bignum , smallnum ) 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 ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = max ( a ) a [ a . index ( 1 ) ] = - 1 a [ a . index ( m ) ] = - 1 for i in range ( 2 , int ( m ** 0.5 ) + 1 ) : if m % i == 0 : a [ a . index ( i ) ] = - 1 if m // i != i : a [ a . index ( m // i ) ] = - 1 a . append ( 1 ) print ( m , max ( a ) ) NEW_LINE", "import sys Β  def answer ( n , d ) : NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) x = max ( arr ) divs = [ ] for z in range ( 1 , x + 1 ) : if x % z == 0 : arr . pop ( arr . index ( z ) ) Β  print ( x , max ( arr ) ) NEW_LINE" ]
codeforces_349_B
[ "import java . io . * ; import java . util . * ; import java . lang . * ; public class Main { static InputReader sc ; static PrintWriter pw ; public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; sc = new InputReader ( inputStream ) ; pw = new PrintWriter ( outputStream ) ; solve ( ) ; pw . close ( ) ; }", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . io . BufferedWriter ; import java . io . Writer ; import java . io . OutputStreamWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . util . ArrayList ; import java . io . InputStream ; Β  public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; OutputWriter out = new OutputWriter ( outputStream ) ; BColorTheFence solver = new BColorTheFence ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } Β  static class BColorTheFence { public void solve ( int testNumber , InputReader in , OutputWriter out ) { Β  int v = in . nextInt ( ) ; int [ ] costs = new int [ 10 ] ; int mini = Integer . MAX_VALUE ; Β  for ( int i = 1 ; i <= 9 ; i ++ ) { costs [ i ] = in . nextInt ( ) ; mini = Math . min ( mini , costs [ i ] ) ; } Β  int d = v / mini ; if ( d == 0 ) { out . print ( \" - 1\" ) ; return ; } Β  int idx = - 1 ; for ( int i = 1 ; i <= 9 ; i ++ ) { if ( costs [ i ] == mini ) idx = i ; } Β  ArrayList < Integer > ans = new ArrayList < > ( ) ; for ( int i = 0 ; i < d ; i ++ ) { ans . add ( idx ) ; } Β  int left = v - ( mini * d ) ; Β  for ( int i = 0 ; i < d ; i ++ ) { for ( int j = 9 ; j >= 1 ; j -- ) { if ( left + mini >= costs [ j ] ) { ans . set ( i , j ) ; left -= costs [ j ] ; left += mini ; break ; } } } Β  for ( int el : ans ) out . print ( el ) ; Β " ]
[ "from sys import stdin , stdoutfrom math import floor , gcd , fabs , factorial , fmod , sqrt , inf , logfrom collections import defaultdict as dd , dequefrom heapq import merge , heapify , heappop , heappush , nsmallestfrom bisect import bisect_left as bl , bisect_right as br , bisect mod = pow ( 10 , 9 ) + 7 mod2 = 998244353 def inp ( ) : return stdin . readline ( ) . strip ( ) def iinp ( ) : return int ( inp ( ) ) def out ( var , end = \" \\n \" ) : stdout . write ( str ( var ) + \" \\n \" ) def outa ( * var , end = \" \\n \" ) : stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) def lmp ( ) : return list ( mp ( ) ) def mp ( ) : return map ( int , inp ( ) . split ( ) ) def smp ( ) : return map ( str , inp ( ) . split ( ) ) def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] def l2d ( n , m , val = 0 ) : return [ l1d ( m , val ) for j in range ( n ) ] def remadd ( x , y ) : return 1 if x % y else 0 def ceil ( a , b ) : return ( a + b - 1 ) // b def isprime ( x ) : if x <= 1 : return False if x in ( 2 , 3 ) : return True if x % 2 == 0 : return False for i in range ( 3 , int ( sqrt ( x ) ) + 1 , 2 ) : if x % i == 0 : return False return True n = iinp ( ) arr = lmp ( ) mn = min ( arr ) d = n // mnif d == 0 : print ( - 1 ) else : rem = n % mn for i in range ( d ) : rem += mn for j in range ( 8 , - 1 , - 1 ) : if arr [ j ] <= rem : break print ( j + 1 , end = ' ' ) rem -= arr [ j ] NEW_LINE", "v = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) Β  mincost = min ( a ) dig = v // mincost Β  if dig == 0 : print ( - 1 ) exit ( ) Β  for i in range ( dig , 0 , - 1 ) : for j in range ( 9 , 0 , - 1 ) : if v - a [ j - 1 ] >= mincost * ( i - 1 ) : print ( j , end = \" \" ) v -= a [ j - 1 ] breakprint ( ) NEW_LINE", "def colour_the_fence ( ) : n = int ( input ( ) ) litre_list = list ( map ( int , str ( input ( ) ) . split ( ) ) ) paint_dict = { } Β  for i in range ( 1 , 10 ) : if litre_list [ i - 1 ] > n : continue paint_dict [ litre_list [ i - 1 ] ] = i NEW_LINE", "from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 1 ) : NEW_LINE" ]
codeforces_454_A
[ "import java . util . * ; public class LittlePonyandCrystalMine { Β  public static void main ( String [ ] args ) {", "import java . util . Scanner ; Β  public class Main { Β  public static void main ( String [ ] args ) { Β  int n ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; Β  int l = n / 2 + 1 , r = n / 2 - 1 ;", "import java . io . File ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . * ; Β  public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; char [ ] [ ] ans = new char [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { Arrays . fill ( ans [ i ] , ' * ' ) ; } int start = n / 2 , nowlen = 1 , nowstart = n / 2 ; int Dstart = 1 , Dnowlen = n - 2 , Dnowstart = 1 ; int len = 1 ; int Dlen = Dnowlen ; for ( int i = 0 ; i < n ; i ++ ) { if ( i <= ( n / 2 ) ) { while ( nowlen -- > 0 ) { ans [ i ] [ nowstart ] = ' D ' ; nowstart ++ ; } len += 2 ; nowlen = len ; nowstart = -- start ; } else { while ( Dnowlen -- > 0 ) { ans [ i ] [ Dnowstart ] = ' D ' ; Dnowstart ++ ; } Dlen -= 2 ; Dnowlen = Dlen ; Dnowstart = ++ Dstart ; } } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { System . out . print ( ans [ i ] [ j ] ) ; } System . out . println ( \" \" ) ; } } Β  } Β Β Β ", "import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; Β  public class A454A { Β  public static void main ( String [ ] args ) throws IOException { A454A a = new A454A ( ) ; a . solve ( ) ; } Β  public void solve ( ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedOutputStream bos = new BufferedOutputStream ( new BufferedOutputStream ( System . out ) ) ; Β  int n = Integer . parseInt ( br . readLine ( ) ) ; Β  for ( int i = 0 ; i < n / 2 ; i ++ ) { int nd = i * 2 + 1 ; char [ ] cad = new char [ nd ] ; Arrays . fill ( cad , ' D ' ) ; char [ ] cas = new char [ ( n - nd ) / 2 ] ; Arrays . fill ( cas , ' * ' ) ; bos . write ( String . valueOf ( cas ) . getBytes ( ) ) ; bos . write ( String . valueOf ( cad ) . getBytes ( ) ) ; bos . write ( String . valueOf ( cas ) . getBytes ( ) ) ; bos . write ( \" \\n \" . getBytes ( ) ) ; } Β  char [ ] cad1 = new char [ n ] ; Arrays . fill ( cad1 , ' D ' ) ; bos . write ( String . valueOf ( cad1 ) . getBytes ( ) ) ; bos . write ( \" \\n \" . getBytes ( ) ) ; Β  for ( int i = 0 ; i < n / 2 ; i ++ ) { int ns = i + 1 ; char [ ] cas = new char [ ns ] ; Arrays . fill ( cas , ' * ' ) ; char [ ] cad = new char [ n - ns * 2 ] ; Arrays . fill ( cad , ' D ' ) ; Β  bos . write ( String . valueOf ( cas ) . getBytes ( ) ) ; bos . write ( String . valueOf ( cad ) . getBytes ( ) ) ; bos . write ( String . valueOf ( cas ) . getBytes ( ) ) ; bos . write ( \" \\n \" . getBytes ( ) ) ; } Β  bos . flush ( ) ; } }", "import java . util . Scanner ; Β Β  public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i <= n / 2 ) { if ( j <= ( ( n / 2 ) + i ) && j >= ( ( n / 2 ) - i ) ) System . out . print ( \" D \" ) ; else System . out . print ( \" * \" ) ; } else { if ( j <= ( ( n / 2 ) + ( n - i - 1 ) ) && j >= ( ( n / 2 ) - ( n - i - 1 ) ) ) System . out . print ( \" D \" ) ; else System . out . print ( \" * \" ) ; } } System . out . println ( ) ; } } }" ]
[ "def romb ( n ) : final_list = [ ] m_l = [ ] for i in range ( n ) : m_l . append ( \" * \" ) mid = len ( m_l ) // 2 reached_first = False k = 0 for i in range ( n ) : if len ( m_l ) - 1 >= i + mid and not reached_first : m_l [ i + mid ] = \" D \" m_l [ mid - i ] = \" D \" final_list . append ( \" \" . join ( m_l ) ) if len ( m_l ) - 1 < i + mid : reached_first = True if reached_first : m_l [ - 1 - k ] = \" * \" m_l [ 0 + k ] = \" * \" k += 1 final_list . append ( \" \" . join ( m_l ) ) return \" \\n \" . join ( final_list ) Β  Β  def main_function ( ) : n = int ( input ( ) ) return romb ( n ) Β  print ( main_function ( ) ) NEW_LINE", "import sys Β  def main ( ) : n = int ( sys . stdin . read ( ) . strip ( ) ) return [ ( ' D ' * i ) . center ( n , ' * ' ) for i in list ( range ( 1 , n + 1 , 2 ) ) + list ( range ( n - 2 , 0 , - 2 ) ) ] Β  print ( * main ( ) , sep = ' \\n ' ) NEW_LINE", "n = int ( input ( ) ) for i in range ( 1 , n + 1 , 2 ) : print ( ' * ' * ( ( n - i ) // 2 ) , end = \" \" ) print ( ' D ' * i , end = \" \" ) print ( ' * ' * ( ( n - i ) // 2 ) ) for i in range ( n - 2 , 0 , - 2 ) : print ( ' * ' * ( ( n - i ) // 2 ) , end = \" \" ) print ( ' D ' * i , end = \" \" ) print ( ' * ' * ( ( n - i ) // 2 ) ) NEW_LINE", "if __name__ == ' _ _ main _ _ ' : n = int ( input ( ) ) for i in range ( n ) : for j in range ( n ) : if min ( i , n - i - 1 ) + min ( j , n - j - 1 ) < n // 2 : print ( ' * ' , end = ' ' ) else : print ( ' D ' , end = ' ' ) print ( ) NEW_LINE", "n = int ( input ( ) ) c = \" * \" * nx = 1 mid = Falsefor i in range ( n ) : if i == ( n - 1 ) / 2 : mid = True a = c [ : int ( ( n - x ) / 2 ) ] b = \" D \" * x print ( a + b + a ) if mid == True : x -= 2 else : x += 2 NEW_LINE" ]
codeforces_780_A
[ "import javax . print . DocFlavor ; import java . io . * ; import java . net . Inet4Address ; import java . sql . ClientInfoStatus ; import java . util . * ; Β ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . StringTokenizer ; import java . util . TreeSet ; Β  public class D { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int n = scanner . nextInt ( ) ; TreeSet < Integer > set = new TreeSet < > ( ) ; int max = 0 ; for ( int i = 0 ; i < n * 2 ; i ++ ) { Integer x = scanner . nextInt ( ) ; if ( ! set . contains ( x ) ) { set . add ( x ) ; } else { set . remove ( x ) ; } max = Math . max ( max , set . size ( ) ) ; } Β  System . out . println ( max ) ; } Β  static class FastScanner { BufferedReader br ; StringTokenizer st ; Β  public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } Β  String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } Β  double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } Β  String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } Β  int [ ] nextArray ( int n ) { int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; } } }", "import java . io . * ; import java . util . HashSet ; import java . util . StringTokenizer ;" ]
[ "def main_function ( ) : n = int ( input ( ) ) socks = [ int ( i ) for i in input ( ) . split ( \" ▁ \" ) ] d = [ 0 for i in range ( n + 2 ) ] sum = 0 current_max = 0 for i in socks : if d [ i ] == 0 : d [ i ] = 1 sum += 1 else : d [ i ] = 0 sum -= 1 if sum > current_max : current_max = sum return current_max Β  Β  Β  print ( main_function ( ) ) NEW_LINE", "num = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) Β  table = set ( ) ct = 0 mx = 0 for sock in arr : if sock not in table : table . add ( sock ) ct += 1 else : ct -= 1 Β  mx = max ( ct , mx ) Β  print ( mx ) NEW_LINE", "from collections import defaultdict Β  n = int ( input ( ) ) dic = defaultdict ( lambda : 0 ) socks = [ int ( i ) for i in input ( ) . split ( ) ] table = 0 Max = 0 Β  for i in socks : if dic [ i ] == 1 : if Max < table : Max = table table -= 1 else : dic [ i ] = 1 table += 1 Β  print ( Max ) NEW_LINE", "from collections import Counterdef func ( ) : n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) k = { } m = 0 for i in l : if i in k : del k [ i ] else : k [ i ] = 1 if len ( k ) > m : m = len ( k ) print ( m ) t = 1 NEW_LINE", "import sys Β  def main ( ) : _ , * l = map ( int , sys . stdin . read ( ) . strip ( ) . split ( ) ) s , c , m = set ( ) , 0 , 0 for i in l : if i in s : s . remove ( i ) if m < c : m = c c -= 1 else : s . add ( i ) ; c += 1 return m print ( main ( ) ) NEW_LINE" ]
codeforces_832_A
[ "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 ) ; long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; long x = n / k ; if ( x % 2 == 0 ) System . out . println ( \" NO \" ) ; else System . out . println ( \" YES \" ) ; } }", "import java . util . * ; public class contest18 { static Scanner scn = new Scanner ( System . in ) ; public static void main ( String [ ] args ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; Β  public class Codeforces { Β  private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ; private static PrintWriter out = new PrintWriter ( System . out ) ; Β  public static void solve ( int T ) throws IOException { long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; long val = n / k ; if ( ( val & 1 ) == 1 ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } public static void main ( String [ ] args ) throws IOException { int t = 1 ;", "import java . util . Scanner ; Β  public class SashaAndSticks { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long n = scanner . nextLong ( ) ; long k = scanner . nextLong ( ) ; Β  System . out . println ( ( n / k ) % 2 == 1 ? \" YES \" : \" NO \" ) ; } }" ]
[ "n , k = map ( int , input ( ) . split ( ) ) print ( [ ' NO ' , ' YES ' ] [ ( n // k ) % 2 ] ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) x = n // kif x % 2 == 0 : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) m = n // kif ( m % 2 == 0 ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) if ( ( n // k ) % 2 == 0 ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE" ]
codeforces_50_A
[ "import java . util . * ; Β  public final class domino { public static void main ( String Args [ ] ) { Scanner s = new Scanner ( System . in ) ; int m = s . nextInt ( ) ; int n = s . nextInt ( ) ; System . out . println ( ( m * n ) / 2 ) ; } }", "import java . util . Scanner ; Β  public class CodeForces { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int m = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; System . out . println ( m * n / 2 ) ; } }", "import java . util . * ; Β  public class Main { Β  public static void main ( String [ ] args ) { Β  Scanner sc = new Scanner ( System . in ) ; Β  int m = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; Β  int size = m * n ; int max = size / 2 ; System . out . print ( max ) ; Β  } }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; System . out . println ( ( x * y ) / 2 ) ; } }", "import java . util . * ; Β  public class Main { Β  public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; System . out . println ( ( n * k ) / 2 ) ; } Β  }" ]
[ "a , b = [ int ( x ) for x in input ( ) . split ( ) ] print ( a * b // 2 ) NEW_LINE", "x , y = map ( int , input ( ) . split ( ) ) erg = ( ( x ) * ( y ) ) // 2 print ( erg ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) k = 0 k += ( m // 2 ) * nk += ( m % 2 ) * ( n // 2 ) print ( k ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) c = ( a * b ) // 2 print ( c ) NEW_LINE" ]
codeforces_551_A
[ "import java . io . * ; import java . util . * ; Β  public class A { 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 ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { int res = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( arr [ j ] > arr [ i ] ) { res ++ ; } } System . out . print ( ( res + 1 ) + \" ▁ \" ) ; } } }", "import java . util . * ; public class GukiZandContest { Β  public static void main ( String [ ] args ) {", "import java . util . * ; import java . io . * ; Β  public class A { 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 ( 1 , in , out ) ; out . close ( ) ; } Β  static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int N = in . nextInt ( ) ; int [ ] arr = new int [ N ] ; for ( int i = 0 ; i < arr . length ; i ++ ) arr [ i ] = in . nextInt ( ) ; List < Integer > sort = new ArrayList ( ) ; for ( int i : arr ) sort . add ( i ) ; Collections . sort ( sort , Collections . reverseOrder ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; Β  for ( int i = 0 ; i < arr . length ; i ++ ) { int check = arr [ i ] ; for ( int j = 0 ; j < arr . length ; j ++ ) { if ( sort . get ( j ) == check ) { sb . append ( j + 1 + \" ▁ \" ) ; break ; } } } out . println ( sb . toString ( ) ) ; } } Β ", "import java . io . File ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . * ; Β  public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( a [ j ] > a [ i ] ) count ++ ; } System . out . print ( ( count + 1 ) + \" ▁ \" ) ; } System . out . println ( \" \" ) ; } Β  Β  }", "import java . util . Arrays ; import java . util . Scanner ; Β  public class Bai4 { public static void main ( String [ ] agrs ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] score = new int [ n ] ; Β  for ( int i = 0 ; i < n ; i ++ ) { score [ i ] = sc . nextInt ( ) ; } Β  int [ ] score_sorted = score . clone ( ) ; Arrays . sort ( score_sorted ) ; Β  for ( int i = 0 ; i < n ; i ++ ) { int s = 1 ; for ( int j = 0 ; j < n ; j ++ ) { if ( score [ i ] < score_sorted [ j ] ) { s ++ ; } } System . out . print ( s + \" ▁ \" ) ; } } }" ]
[ "n = input ( ) l = list ( map ( int , input ( ) . split ( ) ) ) for x in l : print ( sorted ( l ) [ : : - 1 ] . index ( x ) + 1 ) NEW_LINE", "num = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) ct = 1 ln = len ( set ( arr ) ) arr = [ i * 3000 for i in arr ] while ln > 0 : mx = max ( arr ) add = arr . count ( mx ) arr = [ ct if i == mx else i for i in arr ] ct += add ln -= 1 Β  print ( * arr ) Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  NEW_LINE", "n = int ( input ( ) ) st = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) Β  studs = [ None ] + st Β  ranks = [ ] Β  for i in range ( 1 , len ( studs ) ) : above = 0 for j in range ( 1 , len ( studs ) ) : if studs [ j ] > studs [ i ] : above += 1 Β  ranks . append ( above + 1 ) Β  print ( ' ▁ ' . join ( map ( str , ranks ) ) ) NEW_LINE", "n = int ( input ( ) ) lst = [ int ( i ) for i in input ( ) . split ( ) ] exp = sorted ( lst , reverse = True ) Β  for i in lst : print ( exp . index ( i ) + 1 , end = ' ▁ ' ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) brr = sorted ( arr , reverse = True ) for i in range ( n ) : print ( brr . index ( arr [ i ] ) + 1 , end = \" ▁ \" ) NEW_LINE" ]
codeforces_681_A
[ "import java . io . File ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . * ; Β  public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String s = input . next ( ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; if ( a >= 2400 && b - a > 0 ) { System . out . println ( \" YES \" ) ; return ; } } System . out . println ( \" NO \" ) ; } } Β Β Β ", "import java . io . * ; import java . util . Collection ; import java . util . HashSet ; import java . util . Iterator ; import java . util . StringTokenizer ; Β  public class A681A { Β  static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static PrintWriter pw = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; static StringTokenizer st ; Β  public static void main ( String [ ] args ) throws IOException { int n = Integer . parseInt ( br . readLine ( ) ) ; boolean found = false ; Β  for ( int i = 0 ; i < n ; i ++ ) { String [ ] sl = br . readLine ( ) . split ( \" ▁ \" ) ; Β  String handle = sl [ 0 ] ; int bs = Integer . parseInt ( sl [ 1 ] ) ; int as = Integer . parseInt ( sl [ 2 ] ) ; Β  if ( bs >= 2400 && as > bs ) { prln ( \" YES \" ) ; found = true ; break ; } } Β  if ( ! found ) { prln ( \" NO \" ) ; } Β  flush ( ) ; close ( ) ; } Β  static String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } Β  static int readInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } Β  static long readLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } Β  static double readDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } Β  static String readLine ( ) throws IOException { return br . readLine ( ) . trim ( ) ; } Β  static class Struct implements Comparable < Struct > { String name ; int value ; Β  Struct ( String name , int value ) { this . name = name ; this . value = value ; } Β  @ Override public int compareTo ( Struct o ) { if ( o . value == value ) return name . compareTo ( o . name ) ; return o . value - value ; } } Β ", "import java . util . Scanner ; public class P_sheet { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; String [ ] handle = new String [ n ] ; int [ ] before = new int [ n ] ; int [ ] after = new int [ n ] ; boolean x = false ; for ( int i = 0 ; i < n ; i ++ ) { handle [ i ] = input . next ( ) ; before [ i ] = input . nextInt ( ) ; after [ i ] = input . nextInt ( ) ; if ( before [ i ] >= 2400 && after [ i ] > before [ i ] ) { x = true ; break ; } Β  } if ( x == true ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } }", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; Β  public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } Β  static class TaskA { public void solve ( int testNumber , Scanner in , PrintWriter out ) { for ( int test = 0 ; test < testNumber ; test ++ ) { int x = in . nextInt ( ) ; boolean status = false ; for ( int i = 0 ; i < x ; i ++ ) { String s = in . next ( ) ; int before = in . nextInt ( ) ; int after = in . nextInt ( ) ; Β  if ( before >= 2400 ) { if ( before < after ) { status = true ; break ; } } } if ( status == false ) { out . println ( \" NO \" ) ; } else { out . println ( \" YES \" ) ; } Β  } } Β  } } Β ", "import java . util . Scanner ; Β  public class GoodContest { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; Β  for ( int i = 0 ; i < n ; i ++ ) { String [ ] s = scanner . nextLine ( ) . split ( \" ▁ \" ) ; Β  Integer pre = Integer . parseInt ( s [ 1 ] ) ; Integer post = Integer . parseInt ( s [ 2 ] ) ; Β  if ( pre >= 2400 && post > pre ) { System . out . println ( \" YES \" ) ; return ; } } System . out . println ( \" NO \" ) ; } }" ]
[ "num = int ( input ( ) ) name = [ ] before = [ ] after = [ ] Β  for i in range ( num ) : n , b , a = input ( ) . split ( ) name . append ( n ) before . append ( int ( b ) ) after . append ( int ( a ) ) Β  result = list ( zip ( before , after ) ) li = [ list ( element ) for element in result ] Β  NEW_LINE", "x = int ( input ( ) ) f = 0 for i in range ( x ) : s , n , m = input ( ) . split ( ) n = int ( n ) m = int ( m ) if ( m > n and m >= 2400 and n >= 2400 ) : f = 1 if f == 1 : print ( ' YES ' ) else : print ( ' NO ' ) Β  Β  Β  Β  Β  Β  Β  Β  Β  NEW_LINE", "c = 0 for i in range ( int ( input ( ) ) ) : s = input ( ) a = s . split ( \" ▁ \" ) if ( int ( a [ 1 ] ) >= 2400 ) : if ( int ( a [ 2 ] ) > int ( a [ 1 ] ) ) : c = 1 breakif ( c == 0 ) : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "def insertion_sort ( l ) : for i in range ( len ( l ) ) : for j in ( range ( i ) ) : k = i - j if l [ k ] >= l [ k - 1 ] : l [ k - 1 ] , l [ k ] = l [ k ] , l [ k - 1 ] else : break return l Β  Β  Β  def selection_sort ( l ) : for i in range ( len ( l ) ) : min_ind = i min_val = l [ i ] for j in range ( i , len ( l ) ) : if min_val > l [ j ] : min_val = l [ j ] min_ind = j l [ i ] , l [ min_ind ] = l [ min_ind ] , l [ i ] return l Β  Β  def bubble_sort ( l ) : for i in range ( len ( l ) - 1 ) : for j in range ( len ( l ) - 1 - i ) : if l [ j ] > l [ j + 1 ] : l [ j ] , l [ j + 1 ] = l [ j + 1 ] , l [ j ] return l Β  Β  NEW_LINE" ]
codeforces_607_B
[ "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 Zuma { Β  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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Objects ; import java . util . Random ; import java . util . StringTokenizer ; Β  public class Solution { static final int maxn = 505 ; public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int tt = 1 ; while ( tt -- > 0 ) { int n = fs . nextInt ( ) ; int [ ] c = new int [ maxn ] ; for ( int i = 0 ; i < n ; i ++ ) c [ i ] = fs . nextInt ( ) ; int [ ] [ ] dp = new int [ maxn ] [ maxn ] ; for ( int len = 1 ; len <= n ; len ++ ) { for ( int i = 0 ; i + len - 1 < n ; i ++ ) { int end = i + len - 1 ; if ( len == 1 ) { dp [ i ] [ end ] = 1 ; } else { dp [ i ] [ end ] = 1 + dp [ i + 1 ] [ end ] ; if ( c [ i ] == c [ i + 1 ] ) { dp [ i ] [ end ] = Math . min ( dp [ i ] [ end ] , 1 + dp [ i + 2 ] [ end ] ) ; } for ( int j = i + 2 ; j <= end ; j ++ ) { if ( c [ i ] == c [ j ] ) { dp [ i ] [ end ] = Math . min ( dp [ i ] [ end ] , dp [ i + 1 ] [ j - 1 ] + dp [ j + 1 ] [ end ] ) ; } } } } } out . println ( dp [ 0 ] [ n - 1 ] ) ; } out . close ( ) ; } static final Random random = new Random ( ) ; static void ruffleSort ( int [ ] a ) { int n = a . length ;", "import java . io . * ; import java . util . * ; Β  public class Main { Β  static int n ; static int [ ] arr ; static int [ ] [ ] dp ; Β  static int recur ( int L , int R ) { if ( L > R ) return 0 ; if ( L == R ) return 1 ; if ( dp [ L ] [ R ] != - 1 ) return dp [ L ] [ R ] ; int res = Integer . MAX_VALUE ; if ( arr [ L ] == arr [ R ] )" ]
[ "INF = int ( 1e9 ) Β  n = int ( input ( ) ) s = list ( map ( int , input ( ) . split ( ) ) ) Β  NEW_LINE", "from sys import stdin , stdoutfor _ in range ( 1 ) : NEW_LINE", "from sys import stdin , stdoutfor t in range ( 1 ) : NEW_LINE", "n = int ( input ( ) ) t = tuple ( map ( int , input ( ) . split ( ) ) ) m = [ [ 1 ] * n for i in range ( n + 1 ) ] for d in range ( 2 , n + 1 ) : for i in range ( n - d + 1 ) : m [ d ] [ i ] = min ( m [ x ] [ i ] + m [ d - x ] [ i + x ] for x in range ( 1 , d ) ) if t [ i ] == t [ i + d - 1 ] : m [ d ] [ i ] = min ( m [ d ] [ i ] , m [ d - 2 ] [ i + 1 ] ) print ( m [ n ] [ 0 ] ) NEW_LINE" ]
codeforces_182_B
[ "import java . util . * ; public class vesya_clender { Β  public static void main ( String [ ] args ) {", "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 d = in . nextInt ( ) ; int n = in . nextInt ( ) ; int a [ ] = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; if ( i < n - 1 ) ans += d - a [ i ] ; } so . println ( ans ) ; so . flush ( ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } int [ ] readIntArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long [ ] readLongArray ( int n ) { long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }", "import java . util . * ; public class VasyasCalendar { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int d = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) ans += ( d - a [ i ] ) ; System . out . println ( ans ) ; } }", "import java . util . * ; Β  public class FoxAndDots { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int d = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; long c = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i - 1 ] < d ) c += d - a [ i - 1 ] ; } System . out . println ( c ) ; } }" ]
[ "d = int ( input ( ) ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) count = 0 for i in range ( len ( a ) - 1 ) : count += d - a [ i ] print ( count ) NEW_LINE", "def main ( ) : d = int ( input ( ) ) n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) s1 = 0 for i in range ( n - 1 ) : s1 += ( d - arr [ i ] ) print ( s1 ) if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE", "d = int ( input ( ) ) n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) r = 0 for i in range ( n - 1 ) : r = r + ( d - l [ i ] ) print ( r ) NEW_LINE", "d = int ( input ( ) ) n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) s = 0 for i in range ( n - 1 ) : s += d - x [ i ] print ( s ) NEW_LINE", "d = int ( input ( ) ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) count = 0 for i in range ( len ( a ) - 1 ) : count += d - a [ i ] print ( count ) NEW_LINE" ]
codeforces_507_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; Β  public class Main { public static void main ( String [ ] args ) { FastScanner input = new FastScanner ( ) ; long n = input . nextInt ( ) * 2 ; long x1 = input . nextInt ( ) ; long y1 = input . nextInt ( ) ; long x2 = input . nextInt ( ) ; long y2 = input . nextInt ( ) ; long ans = ( long ) Math . ceil ( ( Math . sqrt ( ( ( x2 - x1 ) * ( x2 - x1 ) ) + ( ( y1 - y2 ) * ( y1 - y2 ) ) ) ) / n ) ; System . out . println ( ans ) ; } Β  static class FastScanner { Β  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; Β  String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  long nextLong ( ) { Β  return Long . parseLong ( next ( ) ) ; } Β  double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } Β  String nextLine ( ) throws IOException { return br . readLine ( ) ; } } Β  }", "import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . StringTokenizer ; public class ok { public static void main ( String [ ] args ) { InputReader in = new InputReader ( System . in ) ; long r ; int x , y , xx , yy ; r = in . nextInt ( ) ; x = in . nextInt ( ) ; y = in . nextInt ( ) ; xx = in . nextInt ( ) ; yy = in . nextInt ( ) ; r *= 2 ; long dist = ( x - xx ) * 1L * ( x - xx ) + ( y - yy ) * 1L * ( y - yy ) ; r *= r ; int L = 0 , R = 1000000 ; while ( R > L ) { int mid = L + ( R - L ) / 2 ; BigInteger temp = BigInteger . valueOf ( mid ) ; temp = temp . multiply ( BigInteger . valueOf ( mid ) ) ; temp = temp . multiply ( BigInteger . valueOf ( r ) ) ; int test = temp . compareTo ( BigInteger . valueOf ( dist ) ) ; if ( test == 0 || test == 1 ) R = mid ; else L = mid + 1 ; } System . out . println ( R ) ; } static class InputReader { private BufferedReader reader ; private StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) ) ; tokenizer = null ; } public InputReader ( FileReader stream ) { reader = new BufferedReader ( stream ) ; tokenizer = null ; } public String nextLine ( ) { try { return reader . readLine ( ) ; } catch ( IOException e ) {", "import java . util . Scanner ; Β  public class CentreMover { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Β  int r = scanner . nextInt ( ) ; int x = scanner . nextInt ( ) ; int y = scanner . nextInt ( ) ; x -= scanner . nextInt ( ) ; y -= scanner . nextInt ( ) ; Β  double X = ( double ) x / ( 2 * r ) ; double Y = ( double ) y / ( 2 * r ) ; Β  double distance = Math . sqrt ( X * X + Y * Y ) ; Β  System . out . println ( ( int ) Math . ceil ( distance ) ) ; } }", "import java . util . * ; public class Amr_and_Pins { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int x1 = sc . nextInt ( ) ; int y1 = sc . nextInt ( ) ; int x2 = sc . nextInt ( ) ; int y2 = sc . nextInt ( ) ; double dis = 1.0 * Math . sqrt ( 1.0 * ( x2 - x1 ) * ( x2 - x1 ) + 1.0 * ( y2 - y1 ) * ( y2 - y1 ) ) ; long res = ( long ) Math . ceil ( dis / ( 2 * r ) ) ; Β  System . out . println ( res ) ; } }" ]
[ "import sys Β  input = sys . stdin . readline Β  r , x , y , xx , yy = map ( int , input ( ) . split ( ) ) Β  dist = ( ( x - xx ) ** 2 + ( y - yy ) ** 2 ) ** 0.5 Β  ans = dist / ( 2 * r ) Β  if ans % 1 == 0 : print ( int ( ans ) ) else : print ( int ( ans ) + 1 ) Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  NEW_LINE", "import mathr , x , y , x2 , y2 = map ( int , input ( ) . split ( ) ) dis = pow ( ( pow ( x - x2 , 2 ) + pow ( y - y2 , 2 ) ) , 0.5 ) print ( math . ceil ( dis / ( 2 * r ) ) ) NEW_LINE", "a , x , y , p , q = map ( int , input ( ) . split ( ) ) d = ( ( x - p ) ** 2 + ( y - q ) ** 2 ) ** 0.5 ans = d // ( 2 * a ) if ( d % ( 2 * a ) != 0 ) : ans += 1 print ( int ( ans ) ) NEW_LINE", "import mathdef Appel ( arr ) : dobleR = arr [ 0 ] * 2 dx = True dy = True distX = ( arr [ 3 ] - arr [ 1 ] ) ** 2 distY = ( arr [ 4 ] - arr [ 2 ] ) ** 2 distTot = math . sqrt ( distX + distY ) if ( arr [ 3 ] == arr [ 1 ] ) : dx = False if ( arr [ 4 ] == arr [ 2 ] ) : dy = False if ( dy == False and dx == False ) : return 0 if ( dy or dx ) : result = distTot / dobleR return math . ceil ( result ) Β  arr = [ ] arr = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) Β  print ( Appel ( arr ) ) NEW_LINE" ]
codeforces_1152_B
[ "import java . util . * ; import java . io . * ; import java . math . * ; Β  public class Main { Β  final static int mod = 1000000007 ; static FastReader sc ; static PrintWriter out ; Β  public static void solution ( ) throws IOException { long n = sc . nextInt ( ) ; long len = Long . toBinaryString ( n ) . length ( ) ;", "import java . util . * ; import java . io . * ; Β  public class Neko_Performs_Cat_Furrier_Transform { Β  static class FastReader { BufferedReader br ; StringTokenizer st ; Β  public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } Β  String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } Β  double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } Β  String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } Β  } Β  public static void main ( String [ ] args ) {", "import java . io . * ; import java . util . * ; Β  public class B { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int x = Integer . parseInt ( st . nextToken ( ) ) ; int ops = 0 ; StringBuilder ans = new StringBuilder ( ) ; if ( ( x & ( x + 1 ) ) == 0 ) System . out . println ( 0 ) ; else { while ( ( x & ( x + 1 ) ) != 0 ) { if ( x % 2 == 0 ) { ops += 2 ; x ++ ; ans . append ( 0 + \" ▁ \" ) ; continue ; } ops = ops + 2 ; Β  int pos = getleftmostunsetbit ( x ) ; int t = ( int ) Math . pow ( 2 , pos + 1 ) - 1 ; x = x ^ t ; x += 1 ; ans . append ( Integer . toString ( pos + 1 ) . toString ( ) + \" ▁ \" ) ; } System . out . println ( ops ) ; System . out . println ( ans ) ; Β  } Β  } Β  public static int getleftmostunsetbit ( int n ) { Β  if ( ( n & ( n + 1 ) ) == 0 ) return n ;" ]
[ "x = int ( input ( ) ) cnt = 0 l = [ ] while x != ( 2 ** x . bit_length ( ) - 1 ) : if cnt % 2 : x += 1 else : x ^= 2 ** x . bit_length ( ) - 1 l . append ( x . bit_length ( ) ) cnt += 1 print ( cnt ) print ( * l ) NEW_LINE", "x = int ( input ( ) ) flag = 0 ans = [ ] cnt = 0 while flag == 0 : s = bin ( x ) [ 2 : ] if s . count ( \"0\" ) == 0 : flag = 1 break Β  i = len ( s ) no = ( 2 ** i ) - 1 x = x ^ no ans . append ( i ) cnt += 1 s = bin ( x ) [ 2 : ] if s . count ( \"0\" ) == 0 : flag = 1 break Β  cnt += 1 x += 1 Β  NEW_LINE", "from math import ceil , floor , logx = int ( input ( ) ) def get_bits ( x ) : return len ( bin ( x ) [ 2 : ] ) def test ( x ) : return bin ( x ) [ 2 : ] . count ( '0' ) count = 0 val = [ ] while test ( x ) != 0 : if count % 2 == 0 : x = x ^ ( pow ( 2 , get_bits ( x ) ) - 1 ) val . append ( get_bits ( x ) ) else : x += 1 count += 1 print ( count ) print ( * val ) NEW_LINE", "x = int ( input ( ) ) Β  ans = [ ] for j in range ( 40 ) : b = format ( x , ' b ' ) NEW_LINE", "import sys Β  try : import frosch Β  frosch . hook ( ) except ImportError : passini = lambda : int ( sys . stdin . readline ( ) ) inl = lambda : [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] ins = lambda : sys . stdin . readline ( ) . rstrip ( ) debug = lambda * a , ** kw : print ( \" \\033[33m \" , * a , \" \\033[0m \" , ** dict ( file = sys . stderr , ** kw ) ) Β  Β  def is_pow2 ( x ) : while ( x & 1 ) == 0 : x >>= 1 return x == 1 Β  Β  def solve ( ) : x = ini ( ) a = [ ] while True : s = bin ( x ) [ 2 : ] i = s . find ( \"0\" ) if i < 0 : return a suffix = s [ i : ] if suffix == \"0\" * len ( suffix ) : d = len ( s ) - i - 1 else : d = len ( s ) - i x ^= 2 ** d - 1 x += 1 a . append ( d ) Β  Β  a = solve ( ) print ( len ( a ) * 2 ) print ( * a ) NEW_LINE" ]
codeforces_600_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; Β ", "import java . util . ArrayList ; import java . util . Scanner ; Β  public class InterestingDrink { Β  public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; ArrayList < Integer > inputA = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; inputA . add ( x ) ; } inputA . sort ( ( e1 , e2 ) -> e1 . compareTo ( e2 ) ) ; for ( int i = 0 ; i < m ; i ++ ) { int x = sc . nextInt ( ) ; System . out . print ( calc ( inputA , x ) + \" ▁ \" ) ; } } Β  public static int calc ( ArrayList < Integer > input , int value ) { int answer = - 1 ; int l = 0 , r = input . size ( ) - 1 , mid ; while ( l <= r ) { mid = ( l + r ) / 2 ; if ( input . get ( mid ) <= value ) { answer = mid ; l = mid + 1 ; } else { r = mid - 1 ; } } Β  return answer + 1 ; } }" ]
[ "import sysimport bisectt , r = map ( int , sys . stdin . readline ( ) . split ( ) ) a , b = sorted ( [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] ) , [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] R = sorted ( a ) out = [ ] for x in b : out . append ( bisect . bisect ( R , x ) ) print ( * out ) NEW_LINE", "import sysn , m = ( list ( map ( int , input ( ) . split ( ) ) ) ) a = ( list ( map ( int , input ( ) . split ( ) ) ) ) b = ( list ( map ( int , input ( ) . split ( ) ) ) ) a . sort ( ) def findPos ( arr , l , r , x ) : m = 0 while l <= r : m = ( l + r ) // 2 if arr [ m ] <= x : l = m + 1 else : r = m - 1 return lans = [ ] for x in b : ans . append ( str ( findPos ( a , 0 , n - 1 , x ) ) ) print ( ' ▁ ' . join ( ans ) ) NEW_LINE", "def answer ( n , m , a , b ) : a . sort ( ) ans = [ 0 ] * m tup_b = [ ( b [ i ] , i ) for i in range ( m ) ] tup_b . sort ( key = lambda t : t [ 0 ] ) NEW_LINE" ]
codeforces_235_A
[ "import math , sys , bisect , heapq , osfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulatefrom functools import lru_cache # sys . setrecursionlimit ( 200000000 ) int1 = lambda x : int ( x ) - 1d ef input ( ) : return sys . stdin . readline ( ) . rstrip ( ' \\r \\n ' ) # input = iter ( sys . stdin . buffer . read ( ) . decode ( ) . splitlines ( ) ) . __next__aj = lambda : list ( map ( int , input ( ) . split ( ) ) ) def list3d ( a , b , c , d ) : return [ [ [ d ] * c for j in range ( b ) ] for i in range ( a ) ] # MOD = 1000000000 + 7d ef Y ( c ) : print ( [ \" NO \" , \" YES \" ] [ c ] ) def y ( c ) : print ( [ \" no \" , \" yes \" ] [ c ] ) def Yy ( c ) : print ( [ \" No \" , \" Yes \" ] [ c ] ) Β  def gcd ( a , b ) : if b == 0 : return a return gcd ( b , a % b ) Β  def solve ( ) : n , = aj ( ) if n <= 2 : print ( n ) exit ( 0 ) a = n * ( n - 1 ) b = ( n - 1 ) * ( n - 2 ) ans = 0 # print ( a , b ) for i in range ( n - 2 , 0 , - 1 ) : if gcd ( i , a ) == 1 : ans = max ( ans , a * i ) if i <= n - 3 and gcd ( b , i ) == 1 : ans = max ( ans , b * i ) print ( ans ) try : # os . system ( \" online _ judge . py \" ) sys . stdin = open ( ' input . txt ' , ' r ' ) sys . stdout = open ( ' output . txt ' , ' w ' ) except : pass Β  solve ( )", "Β  import java . util . * ; import java . lang . * ; import java . io . * ; Β  public class Codechef { public static long LCM ( long A , long B , long C ) { long temp = A * B / GCD ( A , B ) ; return temp * C / GCD ( temp , C ) ; } public static long GCD ( long A , long B ) { long a = Math . max ( A , B ) ; long b = Math . min ( A , B ) ; while ( true ) { if ( a % b == 0 ) return b ; long temp = a ; a = b ; b = temp % b ; } } public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; long n = scan . nextLong ( ) ; if ( n < 3 ) System . out . println ( n ) ; else if ( n % 2 != 0 ) System . out . println ( LCM ( n , n - 1 , n - 2 ) ) ; else { if ( GCD ( n , n - 3 ) == 1 ) System . out . println ( LCM ( n , n - 1 , n - 3 ) ) ; else System . out . println ( LCM ( n - 1 , n - 2 , n - 3 ) ) ; } } }", "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 . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; public class c705a {" ]
[ "import mathn = int ( input ( ) ) Β  if n == 1 : print ( 1 ) elif n == 2 : print ( 2 ) elif n == 3 : print ( 6 ) else : if n % 2 != 0 : print ( n * ( n - 1 ) * ( n - 2 ) ) elif math . gcd ( n , n - 3 ) == 1 : print ( n * ( n - 1 ) * ( n - 3 ) ) else : print ( ( n - 1 ) * ( n - 2 ) * ( n - 3 ) ) NEW_LINE", "import math , sys , bisect , heapq , osfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulatefrom functools import lru_cache NEW_LINE", "import sys , os , ioimport math , bisect , operatorinf , mod = float ( ' inf ' ) , 10 ** 9 + 7 NEW_LINE", "from math import gcdn = int ( input ( ) ) if ( n < 3 ) : print ( n ) else : if ( n % 2 == 1 ) : print ( n * ( n - 1 ) * ( n - 2 ) ) else : if ( gcd ( n , n - 3 ) == 1 ) : print ( n * ( n - 1 ) * ( n - 3 ) ) else : print ( ( n - 3 ) * ( n - 1 ) * ( n - 2 ) ) NEW_LINE", "n = int ( input ( ) ) if n <= 2 : print ( n ) elif n % 2 != 0 : print ( n * ( n - 1 ) * ( n - 2 ) ) elif n % 2 == 0 : if n % 3 == 0 : print ( ( n - 1 ) * ( n - 2 ) * ( n - 3 ) ) else : print ( n * ( n - 1 ) * ( n - 3 ) ) Β  Β  NEW_LINE" ]
codeforces_271_B
[ "import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . LinkedHashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . * ; import java . util . stream . Collectors ; Β  public class absolute { static List < Integer > primes ; static int [ ] nextprime ; static void sieveOfEratosthenes ( ) { int n = 100004 ; boolean prime [ ] = new boolean [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) prime [ i ] = true ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * p ; i <= n ; i += p ) prime [ i ] = false ; } } int next = 2 , pos = 0 ; nextprime [ 0 ] = nextprime [ 1 ] = 2 ; for ( int i = n ; i >= 2 ; i -- ) { if ( prime [ i ] == true ) { nextprime [ i ] = i ; next = i ; } else { nextprime [ i ] = next ; } } } public static int binary ( int n ) { int st = 0 , end = primes . size ( ) - 1 , pos = - 1 ; while ( st <= end ) { int mid = st + ( end - st ) / 2 ; if ( primes . get ( mid ) > n ) { pos = mid ; end = mid - 1 ; } else st = mid + 1 ; }", "import java . util . ArrayList ; import java . util . Scanner ; Β  public class PrimeMatrix { Β  private static ArrayList < Integer > primes ; public static void main ( String [ ] args ) { Boolean [ ] PrimeGetter = new Boolean [ 100004 ] ; primes = new ArrayList < > ( ) ; Β  for ( int i = 2 ; i < 100004 ; i ++ ) { if ( PrimeGetter [ i ] == null ) { for ( int j = 2 * i ; j < 100004 ; j += i ) { PrimeGetter [ j ] = false ; } Β  primes . add ( i ) ; } } Β  Scanner scanner = new Scanner ( System . in ) ; Β  int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; Β  long [ ] row = new long [ n ] ; long [ ] col = new long [ m ] ; Β  for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { int x = scanner . nextInt ( ) ; Β  int diff = primes . get ( search ( x ) ) - x ; Β  row [ i ] += diff ; col [ j ] += diff ; } } Β  long min = row [ 0 ] ; Β  for ( int i = 1 ; i < n ; i ++ ) min = Math . min ( min , row [ i ] ) ; for ( int i = 0 ; i < m ; i ++ ) min = Math . min ( min , col [ i ] ) ; Β  System . out . println ( min ) ; } Β  private static int search ( int x ) { int first = 0 , last = primes . size ( ) - 1 ; int result = - 1 ; Β  while ( first <= last ) { int mid = ( first + last ) / 2 ; Β  if ( x <= primes . get ( mid ) ) { result = mid ; last = mid - 1 ; } else first = mid + 1 ; } Β  return result ; } }" ]
[ "import sysMAX_SIZE = 100001 isprime = [ True ] * MAX_SIZEprime = [ ] SPF = [ None ] * ( MAX_SIZE ) d = dict ( ) def manipulated_seive ( N ) : isprime [ 0 ] = isprime [ 1 ] = False for i in range ( 2 , N ) : if isprime [ i ] == True : prime . append ( i ) d . setdefault ( i , 1 ) SPF [ i ] = i j = 0 while ( j < len ( prime ) and i * prime [ j ] < N and prime [ j ] <= SPF [ i ] ) : isprime [ i * prime [ j ] ] = False d . setdefault ( i * prime [ j ] , 0 ) SPF [ i * prime [ j ] ] = prime [ j ] j += 1 if __name__ == ' _ _ main _ _ ' : manipulated_seive ( 100001 ) d . setdefault ( 1 , 0 ) prev = 100003 for i in range ( 100000 , 0 , - 1 ) : if d [ i ] == 0 : d [ i ] = prev else : d [ i ] = i prev = i Β  ans = sys . maxsize n , m = map ( int , input ( ) . split ( ) ) l = [ ] for i in range ( n ) : l . append ( list ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( n ) : c = 0 for j in range ( m ) : c += ( d [ l [ i ] [ j ] ] - l [ i ] [ j ] ) ans = min ( c , ans ) for j in range ( m ) : c = 0 for i in range ( n ) : c += ( d [ l [ i ] [ j ] ] - l [ i ] [ j ] ) ans = min ( c , ans ) print ( ans ) NEW_LINE", "import mathn , m = map ( int , input ( ) . rstrip ( ) . split ( ) ) row = [ 0 ] * ncol = [ 0 ] * mdef isPrime ( x ) : if x in [ 2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 ] : return True if x == 1 : return False for i in range ( 2 , int ( math . sqrt ( x ) ) + 2 ) : if x % i == 0 : return False return Trueprimes = [ 0 ] * 100011 for i in range ( 1 , 100011 ) : if isPrime ( i ) : primes [ i ] = 1 for i in range ( n ) : li = list ( map ( int , input ( ) . rstrip ( ) . split ( ) ) ) for j in range ( m ) : x = li [ j ] while primes [ x ] != 1 : x += 1 row [ i ] += x - li [ j ] col [ j ] += x - li [ j ] minm = min ( row + col ) print ( minm ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) matrix = [ [ * map ( int , input ( ) . split ( ) ) ] for _ in range ( n ) ] Β  MAX_ELEM = int ( 2e5 ) Β  def sieve ( ) : prime = [ 1 ] * MAX_ELEM i = 2 while i * i < MAX_ELEM : if prime [ i ] : j = 2 while i * j < MAX_ELEM : prime [ i * j ] = False j += 1 i += 1 prime [ 0 ] = prime [ 1 ] = False nxtPrime = [ 0 ] * MAX_ELEM cur = - 1 for i in range ( MAX_ELEM - 1 , - 1 , - 1 ) : if prime [ i ] : cur = i nxtPrime [ i ] = cur return nxtPrime Β  nxtPrime = sieve ( ) Β  ans = int ( 1e9 ) Β  for i in range ( n ) : res = 0 for k in range ( m ) : res += nxtPrime [ matrix [ i ] [ k ] ] - matrix [ i ] [ k ] ans = min ( ans , res ) Β  for j in range ( m ) : res = 0 for k in range ( n ) : res += nxtPrime [ matrix [ k ] [ j ] ] - matrix [ k ] [ j ] ans = min ( ans , res ) Β  print ( ans ) Β  Β  NEW_LINE" ]
codeforces_612_A
[ "import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; Β Β  public class A612M2 { Β  public static void main ( String args [ ] ) { Β  FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;", "import java . util . Scanner ; Β  public class ER4A { Β  public static void main ( String [ ] args ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . TreeSet ; Β  public class Main { Β Β  public static void main ( String [ ] args ) throws IOException { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) , p = s . nextInt ( ) , q = s . nextInt ( ) ; String word = s . next ( ) ; Β  boolean flag = false ; Β Β  for ( int i = 0 ; i <= n ; i ++ ) { int pp = i ; int qq = ( n - ( pp * Math . min ( p , q ) ) ) / Math . max ( p , q ) ; Β  if ( pp >= 0 && qq >= 0 && ( pp * p ) + ( qq * q ) == n ) { flag = true ; Β  System . out . println ( pp + qq ) ;", "import java . util . * ; Β  public class Main { Β  static int countp = 0 ; static int countq = 0 ; Β  public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int a [ ] = new int [ 2 ] ; a [ 0 ] = input . nextInt ( ) ; a [ 1 ] = input . nextInt ( ) ; String s = input . next ( ) ; if ( s . length ( ) % a [ 0 ] == 0 ) { countp = s . length ( ) / a [ 0 ] ; } else if ( s . length ( ) % a [ 1 ] == 0 ) { countq = s . length ( ) / a [ 1 ] ; Β  } else { for ( int i = 0 ; i <= 100 ; i ++ ) { if ( ( s . length ( ) - ( a [ 0 ] * i ) ) % a [ 1 ] == 0 && ( ( s . length ( ) - ( a [ 0 ] * i ) ) / a [ 1 ] ) >= 0 ) { countp = i ; countq = ( s . length ( ) - ( a [ 0 ] * i ) ) / a [ 1 ] ; break ; } } } int start = 0 ; if ( countp == 0 && countq == 0 ) { System . out . println ( \" - 1\" ) ; } else { System . out . println ( countp + countq ) ; while ( countp -- > 0 ) { System . out . println ( s . substring ( start , start + a [ 0 ] ) ) ; start = start + a [ 0 ] ; } while ( countq -- > 0 ) { System . out . println ( s . substring ( start , start + a [ 1 ] ) ) ; start += a [ 1 ] ; } } } Β  }" ]
[ "n , xs , ys = map ( int , input ( ) . split ( ) ) s = input ( ) for x in range ( n // xs + 1 ) : if ( n - x * xs ) % ys == 0 : y = ( n - x * xs ) // ys print ( x + y ) for i in range ( x ) : print ( s [ i * xs : ( i + 1 ) * xs ] ) s = s [ x * xs : len ( s ) ] for j in range ( y ) : print ( s [ j * ys : ( j + 1 ) * ys ] ) exit ( ) print ( - 1 ) Β  Β  Β  NEW_LINE", "from math import ceil Β  Β  n , p , q = map ( int , input ( ) . split ( ) ) s = input ( ) Β  if p == n or q == n : print ( f ' 1 \\n { s } ' ) else : if p > q : p , q = q , p Β  P = ceil ( n / p ) Q = ceil ( n / q ) cnts = [ - 1 , - 1 ] i = P while i >= 0 : _sum = p * i j = 0 while j <= Q and _sum < n : _sum += q j += 1 Β  if _sum == n : cnts = [ i , j ] break Β  i -= 1 Β  if _sum == n : cnts = [ i , j ] if cnts [ 0 ] == - 1 : print ( - 1 ) else : print ( sum ( cnts ) ) _i = 0 for i in range ( cnts [ 0 ] ) : print ( s [ _i : _i + p ] ) _i += p for j in range ( cnts [ 1 ] ) : print ( s [ _i : _i + q ] ) _i += q NEW_LINE", "try : import re Β  def cg ( string , length ) : return re . findall ( ' . { % d } ' % length , string ) n , p , q = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) s = input ( ) u = 0 if len ( s ) % p == 0 : u = 1 elif len ( s ) % q == 0 : u = 2 else : u = 3 if u == 1 : print ( n // p ) k = cg ( s , p ) for i in k : print ( i ) elif u == 2 : print ( n // q ) k = cg ( s , q ) for i in k : print ( i ) elif u == 3 : flag = 0 for i in range ( 1 , n ) : for j in range ( 1 , n ) : if p * i + q * j == n : op = [ i , j ] flag = 1 break if flag == 1 : print ( sum ( op ) ) u = cg ( s [ 0 : p * op [ 0 ] ] , p ) v = cg ( s [ p * op [ 0 ] : ] , q ) ko = ( u + v ) for i in ko : print ( i ) else : print ( - 1 ) except : pass NEW_LINE", "def yo ( ma , mi , n , s ) : main1 = n // ma main2 = n // mi flag = 0 Β  for i in range ( main1 , - 1 , - 1 ) : for j in range ( 0 , main2 + 1 ) : NEW_LINE", "sn = list ( map ( int , input ( ) . split ( ) ) ) n = sn [ 0 ] p = sn [ 1 ] q = sn [ 2 ] Β  s = input ( ) Β  lim = 0 flag = Falseflag2 = Falsestrings = [ ] while ( lim <= n ) : if ( ( n - lim ) % p == 0 ) : flag = True break elif ( ( n - lim ) % q == 0 ) : flag = True break lim += p Β  lim = 0 if ( flag ) : NEW_LINE" ]
codeforces_1216_B
[ "import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > a = new ArrayList < Integer > ( ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; int p = 0 , s = 0 , c = 0 ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; int [ ] e = arr . clone ( ) ; Arrays . sort ( arr ) ; int start = 0 , end = n - 1 ; while ( start <= end ) { int temp = arr [ start ] ; arr [ start ] = arr [ end ] ; arr [ end ] = temp ; start ++ ; end -- ; } while ( p < n ) { for ( int i = 0 ; i < n ; i ++ ) { int k = arr [ p ] ; if ( k == e [ i ] ) { e [ i ] = - 1 ; a . add ( i + 1 ) ; p ++ ; if ( i == 0 ) s = s + 1 ; else s = s + ( arr [ i ] * i ) + 1 ; break ; } } } System . out . println ( s ) ; for ( int i : a ) System . out . print ( i + \" ▁ \" ) ; } }", "import java . util . * ; Β  public class B { public static < K , V > K getKey ( Map < K , V > map , V value ) { for ( Map . Entry < K , V > entry : map . entrySet ( ) ) { if ( value . equals ( entry . getValue ( ) ) ) { return entry . getKey ( ) ; } } return null ; } Β  public static final class Pair { public int first ; public int second ; public Pair ( int first , int second ) { this . first = first + 1 ; this . second = second ; } Β ", "import java . util . * ; Β  public class B { public static < K , V > K getKey ( Map < K , V > map , V value ) { for ( Map . Entry < K , V > entry : map . entrySet ( ) ) { if ( value . equals ( entry . getValue ( ) ) ) { return entry . getKey ( ) ; } } return null ; } Β  public static final class Pair implements Comparable < Pair > { public int first ; public int second ; public Pair ( int first , int second ) { this . first = first + 1 ; this . second = second ; } Β  public int compareTo ( Pair o ) { return Integer . compare ( o . second , second ) ; }", "import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { PrintWriter out ; FastReader sc ; long mod = ( long ) ( 1e9 + 7 ) ; long maxlong = Long . MAX_VALUE ; long minlong = Long . MIN_VALUE ; public void sol ( ) { int n = ni ( ) ; int [ ] [ ] ar = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] [ 0 ] = ni ( ) ; ar [ i ] [ 1 ] = i ; } Arrays . sort ( ar , new Comparator < int [ ] > ( ) { public int compare ( int [ ] a , int [ ] b ) { return Integer . compare ( b [ 0 ] , a [ 0 ] ) ; } } ) ; StringBuilder sb = new StringBuilder ( ) ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ans += ( ar [ i ] [ 0 ] * 1l * ( i ) ) + 1 ; sb . append ( ar [ i ] [ 1 ] + 1 + \" ▁ \" ) ; } pl ( ans ) ; pl ( sb ) ; } public static void main ( String [ ] args ) { Main g = new Main ( ) ; g . out = new PrintWriter ( System . out ) ; g . sc = new FastReader ( ) ; int t = 1 ;" ]
[ "if __name__ == \" _ _ main _ _ \" : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) dic = { } s = set ( a ) ans = [ ] for i in range ( n ) : dic . setdefault ( a [ i ] , [ ] ) dic [ a [ i ] ] . append ( i + 1 ) a . sort ( reverse = True ) sum = 0 for i in range ( n ) : num = dic [ a [ i ] ] [ 0 ] sum = sum + ( ( a [ i ] * i ) + 1 ) ans . append ( num ) dic [ a [ i ] ] . remove ( num ) print ( sum ) print ( * ans ) Β  Β  NEW_LINE", "n = int ( input ( ) ) Β  daf = list ( map ( int , input ( ) . split ( ) ) ) mul = [ x for x in range ( n ) ] has = 0 daf2 = sorted ( daf , reverse = True ) daf_has = [ ] Β  for i in range ( n ) : x = daf2 [ i ] y = daf . index ( x ) daf_has . append ( str ( y + 1 ) ) daf [ y ] = 0 has += daf2 [ i ] * mul [ i ] has += nprint ( has ) print ( ' ▁ ' . join ( daf_has ) ) NEW_LINE", "n = int ( input ( ) ) s = list ( map ( int , input ( ) . split ( ) ) ) a = sorted ( s , reverse = True ) sum_a = sum ( [ a [ x ] * x + 1 for x in range ( 0 , n ) ] ) print ( sum_a ) i = 0 while i < n : print ( s . index ( a [ i ] ) + 1 , end = \" ▁ \" ) s [ s . index ( a [ i ] ) ] = 0 i += 1 NEW_LINE", "''' a = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] x = a [ 0 ] y = a [ 1 ] z = a [ 2 ] if ▁ y = = x ▁ and ▁ z = = 0 : ▁ ▁ ▁ ▁ print ( '0 ' ) elif ▁ x > y + z : ▁ ▁ ▁ ▁ print ( ' + ' ) elif ▁ y > x + z : ▁ ▁ ▁ ▁ print ( ' - ' ) else : ▁ ▁ ▁ ▁ print ( ' ? ' ) ''' n = int ( input ( ) ) z = [ int ( i ) for i in input ( ) . split ( ) ] x = [ ] d = 0 v = ' ' for i in range ( n ) : c = 0 e = 0 for f in range ( len ( z ) ) : if z [ f ] > c and f + 1 not in x : c = z [ f ] e = f + 1 d += ( i * c ) + 1 x . append ( e ) print ( d ) for i in x : v += str ( i ) v += ' ▁ ' print ( v ) NEW_LINE" ]
codeforces_523_A
[ "import java . util . Scanner ; Β Β  public class RotateFlipandZoom { Β  static char [ ] [ ] brr ; public static void main ( String [ ] args ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; Β  public class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int col = Integer . parseInt ( st . nextToken ( ) ) ; int row = Integer . parseInt ( st . nextToken ( ) ) ; char [ ] [ ] arr = new char [ row ] [ col ] ; for ( int i = 0 ; i < row ; i ++ ) { String line = br . readLine ( ) ; arr [ i ] = line . toCharArray ( ) ; } for ( int j = 0 ; j < col ; j ++ ) { String nl = \" \" ; for ( int i = 0 ; i < row ; i ++ ) { nl = nl + arr [ i ] [ j ] + arr [ i ] [ j ] ; } System . out . println ( nl ) ; System . out . println ( nl ) ; } } catch ( IOException e ) { } } }" ]
[ "[ w , h ] = [ int ( x ) for x in input ( ) . split ( ) ] Β  image = [ ] Β  for i in range ( h ) : image . append ( input ( ) ) Β  Β  for x in range ( w * 2 ) : for y in range ( h * 2 ) : final_x = int ( y / 2 ) final_y = int ( x / 2 ) NEW_LINE", "w , h = map ( int , input ( ) . split ( ) ) l = [ ] for i in range ( h ) : s = input ( ) l . append ( s ) for i in range ( w ) : s = ' ' for j in range ( h - 1 , - 1 , - 1 ) : s += l [ j ] [ i ] * 2 s = s [ : : - 1 ] print ( s ) print ( s ) NEW_LINE", "w , h = map ( int , input ( ) . split ( ) ) l = [ ] for i in range ( h ) : s = input ( ) l . append ( s ) for i in range ( w ) : s = ' ' for j in range ( h - 1 , - 1 , - 1 ) : s += l [ j ] [ i ] * 2 s = s [ : : - 1 ] print ( s ) print ( s ) NEW_LINE" ]
codeforces_1205_A
[ "Β Β  import java . util . * ; import java . lang . * ; import java . io . * ; import java . math . * ; Β Β  public class file { Β Β ", "Β  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 c580a {", "Β  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 ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; if ( n % 2 == 0 ) { out . println ( \" NO \" ) ; out . close ( ) ; return ; } out . println ( \" YES \" ) ; StringBuilder f = new StringBuilder ( ) ; StringBuilder s = new StringBuilder ( ) ; int k = 1 ; boolean flag = true ; while ( k + 1 <= 2 * n ) { if ( flag ) { f . append ( k + \" ▁ \" ) ; s . append ( ( k + 1 ) + \" ▁ \" ) ; k += 2 ; } else { f . append ( ( k + 1 ) + \" ▁ \" ) ; s . append ( k + \" ▁ \" ) ; k += 2 ; } flag = ! flag ; } out . println ( f . toString ( ) + s . toString ( ) ) ; out . close ( ) ; } }", "import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; if ( n % 2 == 0 ) { System . out . println ( \" NO \" ) ; } else { System . out . println ( \" YES \" ) ; int arr [ ] = new int [ 2 * n ] ; int k = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { arr [ i ] = k ; arr [ i + n ] = k + 1 ; } else { arr [ i ] = k + 1 ; arr [ i + n ] = k ; } k = k + 2 ; } for ( int i = 0 ; i < 2 * n ; i ++ ) { System . out . print ( arr [ i ] + \" ▁ \" ) ; } } } }" ]
[ "from sys import stdin , stdoutfrom math import floor , gcd , fabs , factorial , fmod , sqrt , inf , logfrom collections import defaultdict as dd , dequefrom heapq import merge , heapify , heappop , heappush , nsmallestfrom bisect import bisect_left as bl , bisect_right as br , bisect mod = pow ( 10 , 9 ) + 7 mod2 = 998244353 def inp ( ) : return stdin . readline ( ) . strip ( ) def iinp ( ) : return int ( inp ( ) ) def out ( var , end = \" \\n \" ) : stdout . write ( str ( var ) + \" \\n \" ) def outa ( * var , end = \" \\n \" ) : stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) def lmp ( ) : return list ( mp ( ) ) def mp ( ) : return map ( int , inp ( ) . split ( ) ) def smp ( ) : return map ( str , inp ( ) . split ( ) ) def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] def l2d ( n , m , val = 0 ) : return [ l1d ( m , val ) for j in range ( n ) ] def remadd ( x , y ) : return 1 if x % y else 0 def ceil ( a , b ) : return ( a + b - 1 ) // b def isprime ( x ) : if x <= 1 : return False if x in ( 2 , 3 ) : return True if x % 2 == 0 : return False for i in range ( 3 , int ( sqrt ( x ) ) + 1 , 2 ) : if x % i == 0 : return False return True n = iinp ( ) if ( n % 2 ) : print ( \" YES \" ) for i in range ( 0 , 2 * n , 4 ) : if i == 0 : print ( i + 1 , end = ' ▁ ' ) else : print ( i , i + 1 , end = ' ▁ ' ) for i in range ( 2 , 2 * n + 1 , 4 ) : if i == 2 * n : print ( i , end = ' ▁ ' ) else : print ( i , i + 1 , end = ' ▁ ' ) print ( ) else : print ( \" NO \" ) NEW_LINE", "n = int ( input ( ) ) Β  if n % 2 : print ( \" YES \" ) ls = [ 0 ] * 2 * n c = 1 i = - 1 while c <= 2 * n : i = i + 1 ls [ i ] = c i = ( i + n ) % ( 2 * n ) ls [ i ] = c + 1 c = c + 2 print ( * ls ) else : print ( \" NO \" ) NEW_LINE", "n = int ( input ( ) ) if n % 2 == 0 : print ( ' NO ' ) else : print ( ' YES ' ) z = [ 1 ] l = [ 2 ] for i in range ( n - 1 ) : if i % 2 == 0 : z += [ z [ - 1 ] + 3 ] else : z += [ z [ - 1 ] + 1 ] for i in range ( n - 1 ) : if i % 2 != 0 : l += [ l [ - 1 ] + 3 ] else : l += [ l [ - 1 ] + 1 ] c = z + l print ( * c ) NEW_LINE", "n = int ( input ( ) ) if n & 1 : NEW_LINE", "n = int ( input ( ) ) lst = [ 0 ] * ( 2 * n ) f = 0 lst [ 0 ] = 1 ind = 0 for i in range ( 2 , ( 2 * n ) + 1 ) : if f == 0 : ind = ( ind + n ) % ( 2 * n ) lst [ ind ] = i f = 1 else : ind -= 1 lst [ ind ] = i f = 0 Β  if n % 2 : print ( \" YES \" ) print ( * lst ) else : print ( \" NO \" ) NEW_LINE" ]
codeforces_1191_A
[ "import java . io . * ; import java . util . * ; Β  public class GFG { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ;", "import java . io . * ; import java . util . * ; import java . math . * ; public class Maths { static final Random random = new Random ( ) ; static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Reader sc = new Reader ( ) ; public static void main ( String args [ ] ) throws IOException {", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; Β ", "import java . util . * ; public class problem { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; if ( x % 4 == 1 ) { System . out . println ( \"0\" + \" ▁ A \" ) ; } else if ( x % 4 == 3 ) { System . out . println ( \"2\" + \" ▁ A \" ) ; } else if ( x % 4 == 2 ) { System . out . println ( \"1\" + \" ▁ B \" ) ; } else { System . out . println ( \"1\" + \" ▁ A \" ) ; } } }" ]
[ "import sys Β  def main ( ) : n = int ( sys . stdin . read ( ) . strip ( ) ) d = { 1 : '0 ▁ A ' , 3 : '2 ▁ A ' , 2 : '1 ▁ B ' , 0 : '1 ▁ A ' } return d [ n % 4 ] Β  print ( main ( ) ) NEW_LINE", "s = int ( input ( ) ) g = s % 4 if g == 1 : print ( \"0 ▁ A \" ) if g == 2 : print ( \"1 ▁ B \" ) if g == 0 : print ( \"1 ▁ A \" ) if g == 3 : print ( \"2 ▁ A \" ) NEW_LINE", "print ( [ '1 ▁ A ' , '0 ▁ A ' , '1 ▁ B ' , '2 ▁ A ' ] [ int ( input ( ) ) % 4 ] ) NEW_LINE", "x = int ( input ( ) ) if ( x % 4 == 1 ) : print ( \"0 ▁ A \" ) elif ( x % 4 == 0 ) : print ( \"1 ▁ A \" ) elif ( x % 4 == 2 ) : print ( \"1 ▁ B \" ) else : print ( \"2 ▁ A \" ) NEW_LINE" ]
codeforces_46_A
[ "import java . util . * ; public class P2 { Β  public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = 1 ; int k = 2 ; System . out . print ( 2 + \" ▁ \" ) ; for ( int i = 0 ; i < n - 2 ; i ++ ) { c ++ ; k += c ; if ( k % n == 0 ) { System . out . print ( n + \" ▁ \" ) ; } else System . out . print ( k % n + \" ▁ \" ) ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; Β  public class Main { Β  public static void main ( String [ ] args ) throws IOException { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; StringBuilder ans = new StringBuilder ( ) ; int current = 1 ; for ( int i = 1 ; i < n ; i ++ ) { current += i ; if ( current != n ) { ans . append ( current % n + \" ▁ \" ) ; current = current % ( n ) ; } else { ans . append ( current + \" ▁ \" ) ; } } System . out . println ( ans ) ; } Β  static class FastScanner { Β  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; Β  String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  long nextLong ( ) { Β  return Long . parseLong ( next ( ) ) ; } Β  double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } Β  }", "import java . util . Scanner ; Β  public class Main { Β  public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int total = n - 1 ; int ans = 1 ; for ( int i = 1 ; i <= total ; i ++ ) { ans += i ; if ( ans > n ) { ans = ans % n ; } if ( i == total ) { System . out . print ( ans ) ; } else { System . out . print ( ans + \" ▁ \" ) ; } } System . out . println ( ) ; scan . close ( ) ; } Β  }", "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 ) {" ]
[ "n = int ( input ( ) ) s = 1 result = [ ] t = 1 for i in range ( 1 , n ) : t += s if t > n : t -= n result . append ( t ) s += 1 print ( * result ) NEW_LINE", "n = int ( input ( ) ) Β  arr = [ i for i in range ( 1 , n + 1 ) ] * 100 Β  ans = [ ] i = 1j = 1 while n > 1 : ans . append ( arr [ i ] ) i += j + 1 j += 1 n -= 1 Β  print ( * ans ) NEW_LINE", "n = int ( input ( ) ) Β  x = 0 Β  for i in range ( 1 , n ) : x = ( x + i ) % n print ( x + 1 , end = ' ▁ ' ) NEW_LINE", "n = int ( input ( ) ) a = 0 b = [ ] for i in range ( 1 , n ) : a = ( a + i ) % n b . append ( a + 1 ) print ( * b ) NEW_LINE" ]
codeforces_414_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . io . StreamTokenizer ; import java . util . Arrays ; Β  public class Main { public static void main ( String [ ] args ) throws IOException { StreamTokenizer st = new StreamTokenizer ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; PrintWriter pw = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; int MOD = 1000000007 ; st . nextToken ( ) ; int n = ( int ) st . nval ; st . nextToken ( ) ; int k = ( int ) st . nval ; int [ ] dp = new int [ n + 1 ] ; int [ ] tmp = new int [ n + 1 ] ; Arrays . fill ( dp , 1 ) ; for ( int i = 2 ; i <= k ; i ++ ) { Arrays . fill ( tmp , 0 ) ; for ( int j = 1 ; j <= n ; j ++ ) { for ( int t = 1 ; t * j <= n ; t ++ ) { tmp [ t * j ] = ( tmp [ t * j ] + dp [ j ] ) % MOD ; } } for ( int j = 1 ; j <= n ; j ++ ) { dp [ j ] = tmp [ j ] ; } } int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { ans = ( ans + dp [ i ] ) % MOD ; } pw . print ( ans % MOD ) ; pw . flush ( ) ; } Β  }", "import java . util . Arrays ; import java . util . Scanner ; Β  public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int MOD = 1000000007 ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; int [ ] dp = new int [ n + 1 ] ; int [ ] tmp = new int [ n + 1 ] ; Arrays . fill ( dp , 1 ) ; for ( int i = 2 ; i <= k ; i ++ ) { Arrays . fill ( tmp , 0 ) ; for ( int j = 1 ; j <= n ; j ++ ) { for ( int t = 1 ; t * j <= n ; t ++ ) { tmp [ t * j ] = ( tmp [ t * j ] + dp [ j ] ) % MOD ; } } for ( int j = 1 ; j <= n ; j ++ ) { dp [ j ] = tmp [ j ] ; } } int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { ans = ( ans + dp [ i ] ) % MOD ; } System . out . println ( ans % MOD ) ; } Β  }", "import java . util . * ; import java . math . * ; import java . io . * ; Β ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; Β  import java . util . * ; import javafx . util . Pair ; Β  public class Main { static long mod = ( long ) ( 1e9 + 7 ) ; public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; int size = input . nextInt ( ) ; int len = Math . max ( n , size ) + 1 ; long dp [ ] [ ] = new long [ len ] [ len ] ; for ( int i = 1 ; i <= n ; i ++ ) { dp [ 1 ] [ i ] = 1 ; } for ( int i = 1 ; i < len ; i ++ ) { for ( int j = 1 ; j < len ; j ++ ) { for ( int k = j ; k < len ; k += j ) { dp [ i ] [ k ] = ( dp [ i ] [ k ] + dp [ i - 1 ] [ j ] ) % mod ; } } } long ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { ans += ( dp [ size ] [ i ] ) ; ans = ans % mod ; } System . out . println ( ans ) ; } Β  static class FastScanner { Β  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; Β  String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  long nextLong ( ) { Β  return Long . parseLong ( next ( ) ) ; } Β  double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } Β  String nextLine ( ) throws IOException { return br . readLine ( ) ; } } Β  }" ]
[ "n , k = map ( int , input ( ) . split ( ) ) mod = 10 ** 9 + 7 l = [ [ ] for i in range ( 2 * 10 ** 3 + 1 ) ] for i in range ( 1 , 2 * 10 ** 3 + 1 ) : for j in range ( 1 , i + 1 ) : if i % j == 0 : l [ i ] . append ( j ) dp = [ [ 0 ] * ( n + 1 ) for i in range ( k + 1 ) ] for i in range ( 1 , n + 1 ) : dp [ 1 ] [ i ] = 1 for i in range ( 2 , k + 1 ) : for j in range ( 1 , n + 1 ) : for x in l [ j ] : dp [ i ] [ j ] += dp [ i - 1 ] [ j // x ] dp [ i ] [ j ] %= modprint ( sum ( dp [ - 1 ] ) % mod ) NEW_LINE", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; Β  import java . util . * ; import javafx . util . Pair ; Β  public class Main { static long mod = ( long ) ( 1e9 + 7 ) ; public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; int size = input . nextInt ( ) ; int len = Math . max ( n , size ) + 1 ; long dp [ ] [ ] = new long [ len ] [ len ] ; for ( int i = 1 ; i <= n ; i + + ) { dp [ 1 ] [ i ] = 1 ; } for ( int i = 1 ; i < len ; i + + ) { for ( int j = 1 ; j < len ; j + + ) { for ( int k = j ; k < len ; k += j ) { dp [ i ] [ k ] = ( dp [ i ] [ k ] + dp [ i - 1 ] [ j ] ) % mod ; } } } long ans = 0 ; for ( int i = 1 ; i <= n ; i + + ) { ans += ( dp [ size ] [ i ] ) ; ans = ans % mod ; } System . out . println ( ans ) ; } Β  static class FastScanner { Β  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; Β  String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  long nextLong ( ) { Β  return Long . parseLong ( next ( ) ) ; } Β  double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } Β  String nextLine ( ) throws IOException { return br . readLine ( ) ; } } Β  } NEW_LINE", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; Β  import java . util . * ; import javafx . util . Pair ; Β  public class Main { static long mod = ( long ) ( 1e9 + 7 ) ; public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; int size = input . nextInt ( ) ; int len = Math . max ( n , size ) + 1 ; long dp [ ] [ ] = new long [ len ] [ len ] ; for ( int i = 1 ; i <= n ; i + + ) { dp [ 1 ] [ i ] = 1 ; } for ( int i = 1 ; i < len ; i + + ) { for ( int j = 1 ; j < len ; j + + ) { for ( int k = j ; k < len ; k += j ) { dp [ i ] [ k ] = ( dp [ i ] [ k ] + dp [ i - 1 ] [ j ] ) % mod ; } } } long ans = 0 ; for ( int i = 1 ; i <= n ; i + + ) { ans += ( dp [ size ] [ i ] ) ; ans = ans % mod ; } System . out . println ( ans ) ; } Β  static class FastScanner { Β  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; Β  String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  long nextLong ( ) { Β  return Long . parseLong ( next ( ) ) ; } Β  double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } Β  String nextLine ( ) throws IOException { return br . readLine ( ) ; } } Β  } NEW_LINE" ]
codeforces_803_A
[ "import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ; Β  public class A803 { Β  public static void main ( String args [ ] ) { Β  FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;", "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; Β " ]
[ "n , k = list ( map ( int , input ( ) . split ( ) ) ) ans = Noneif ( k > n ** 2 ) : print ( - 1 ) elif ( k == n ** 2 ) : ans = [ [ 1 ] * n for arr in range ( n ) ] for i in range ( n ) : print ( \" ▁ \" . join ( j for j in map ( str , ans [ i ] ) ) ) elif ( k == 0 ) : ans = [ [ 0 ] * n for arr in range ( n ) ] for i in range ( n ) : print ( \" ▁ \" . join ( j for j in map ( str , ans [ i ] ) ) ) else : ans = [ [ 0 ] * n for arr in range ( n ) ] for i in range ( n - 1 , 0 , - 1 ) : loc = n - i - 1 k -= 1 ans [ loc ] [ loc ] = 1 if ( k >= 2 * i ) : for j in range ( loc + 1 , n ) : ans [ loc ] [ j ] = ans [ j ] [ loc ] = 1 if ( k == 2 * i ) : break k -= 2 * i else : if ( k % 2 == 1 ) : ans [ loc + 1 ] [ loc + 1 ] = 1 k -= 1 for j in range ( loc + 1 , loc + 1 + ( k // 2 ) ) : ans [ loc ] [ j ] = ans [ j ] [ loc ] = 1 break for i in range ( n ) : print ( \" ▁ \" . join ( j for j in map ( str , ans [ i ] ) ) ) NEW_LINE", "n , k = list ( map ( int , input ( ) . split ( ) ) ) ans = Noneif ( k > n ** 2 ) : print ( - 1 ) elif ( k == n ** 2 ) : ans = [ [ 1 ] * n for arr in range ( n ) ] for i in range ( n ) : print ( \" ▁ \" . join ( j for j in map ( str , ans [ i ] ) ) ) elif ( k == 0 ) : ans = [ [ 0 ] * n for arr in range ( n ) ] for i in range ( n ) : print ( \" ▁ \" . join ( j for j in map ( str , ans [ i ] ) ) ) else : ans = [ [ 0 ] * n for arr in range ( n ) ] for i in range ( n - 1 , 0 , - 1 ) : loc = n - i - 1 k -= 1 ans [ loc ] [ loc ] = 1 if ( k >= 2 * i ) : for j in range ( loc + 1 , n ) : ans [ loc ] [ j ] = ans [ j ] [ loc ] = 1 if ( k == 2 * i ) : break k -= 2 * i else : if ( k % 2 == 1 ) : ans [ loc + 1 ] [ loc + 1 ] = 1 k -= 1 for j in range ( loc + 1 , loc + 1 + ( k // 2 ) ) : ans [ loc ] [ j ] = ans [ j ] [ loc ] = 1 break for i in range ( n ) : print ( \" ▁ \" . join ( j for j in map ( str , ans [ i ] ) ) ) NEW_LINE", "def maximal_binary_matrix ( n , k ) : matrix = [ [ 0 ] * n for _ in range ( n ) ] for i in range ( n ) : for j in range ( i , n ) : if i == j and k >= 1 : matrix [ i ] [ j ] = 1 k -= 1 elif k >= 2 : matrix [ i ] [ j ] = 1 matrix [ j ] [ i ] = 1 k -= 2 return matrix if k == 0 else None Β  Β  n , k = map ( int , input ( ) . split ( ) ) m = maximal_binary_matrix ( n , k ) if m : for row in m : print ( * row ) else : print ( - 1 ) NEW_LINE", "import sysinput = sys . stdin . readline Β  ''' Β  ''' Β  def pprint ( mat ) : for r in mat : print ( \" ▁ \" . join ( r ) ) Β  n , k = map ( int , input ( ) . split ( ) ) mat = [ [ \"0\" ] * n for _ in range ( n ) ] N = n Β  if n ** 2 < k : print ( - 1 ) sys . exit ( ) else : num_cells = 2 * n - 1 rc = 0 while num_cells > 0 and num_cells <= k : for x in range ( rc , N ) : mat [ x ] [ rc ] = \"1\" mat [ rc ] [ x ] = \"1\" Β  rc += 1 k -= num_cells n -= 1 num_cells = 2 * n - 1 Β  if k == 0 : pprint ( mat ) sys . exit ( ) elif k % 2 == 0 : mat [ rc + 1 ] [ rc + 1 ] = \"1\" k -= 1 Β  for x in range ( rc , rc + k // 2 + 1 ) : mat [ x ] [ rc ] = \"1\" mat [ rc ] [ x ] = \"1\" Β  pprint ( mat ) NEW_LINE" ]
codeforces_1358_A
[ "import java . util . Scanner ; Β  public class A1358 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Β  int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int exp = n * m ; if ( exp % 2 == 0 ) { System . out . println ( exp / 2 ) ; } else { System . out . println ( ( exp + 1 ) / 2 ) ; } } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . Arrays ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Set ; Β  public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } Β  public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; System . out . println ( ( n * m ) % 2 == 0 ? ( n * m ) / 2 : ( n * m ) / 2 + 1 ) ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; Β  public class CF1358A { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int [ ] a = Arrays . stream ( br . readLine ( ) . split ( \" \\\\ s + \" ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; System . out . println ( ( a [ 0 ] * a [ 1 ] + 1 ) / 2 ) ; } } }" ]
[ "t = int ( input ( ) ) for j in range ( t ) : a , b = map ( int , input ( ) . split ( ) ) print ( ( a * b + 1 ) // 2 ) NEW_LINE", "import mathfor _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) print ( math . ceil ( n * m / 2 ) ) NEW_LINE", "t = int ( input ( ' ' ) ) for i in range ( t ) : n , m = map ( int , input ( ' ' ) . split ( ) ) if ( n * m % 2 == 0 ) : print ( int ( ( n * m ) / 2 ) ) else : print ( int ( ( ( n * m ) + 1 ) / 2 ) ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) if m % 2 : print ( m // 2 * n + n // 2 + n % 2 ) else : print ( m // 2 * n ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) if ( n * m % 2 == 0 ) : print ( n * m // 2 ) else : print ( ( n * m - 1 ) // 2 + 1 ) NEW_LINE" ]
codeforces_205_A
[ "import java . util . Scanner ; Β  public class problem91 { Β  public static void main ( String [ ] args ) {", "import java . util . ArrayList ; import java . util . Collection ; import java . util . Collections ; import java . util . Scanner ; Β  public class LittleElephantAndRozdil { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; ArrayList < Integer > arrayList = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arrayList . add ( scanner . nextInt ( ) ) ; } int min = Collections . min ( arrayList ) ;", "import java . util . Scanner ; import java . util . * ; Β Β  public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int min = Integer . MAX_VALUE ; int count = 1 ; int index = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { int r = scan . nextInt ( ) ; if ( r < min ) { index = i ; min = r ; count = 1 ; } else if ( r == min ) { count ++ ; } } if ( count > 1 ) { System . out . print ( \" Still ▁ Rozdil \" ) ; } else { System . out . print ( index + 1 ) ; } scan . close ( ) ; } }", "import java . util . * ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) {" ]
[ "import sysn = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) minn = sys . maxsizeindex = 0 count = 0 for i in range ( n ) : if A [ i ] < minn : minn = A [ i ] index = i count = 1 elif A [ i ] == minn : count += 1 if count == 1 : print ( index + 1 ) else : print ( \" Still ▁ Rozdil \" ) NEW_LINE", "from sys import stdinfrom bisect import bisect_right as br Β  input = stdin . readline Β  n = int ( input ( ) ) lst = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) arr = sorted ( lst ) ind = br ( arr , arr [ 0 ] ) - 1 if ind == 0 : print ( lst . index ( arr [ 0 ] ) + 1 ) else : print ( ' Still ▁ Rozdil ' ) NEW_LINE", "num = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) mn = min ( arr ) if arr . count ( mn ) > 1 : print ( \" Still ▁ Rozdil \" ) else : print ( arr . index ( mn ) + 1 ) Β  Β  NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) x = min ( a ) if a . count ( x ) > 1 : print ( ' Still ▁ Rozdil ' ) else : print ( a . index ( x ) + 1 ) NEW_LINE", "n = int ( input ( ) ) min_idx = - 1 min_dist = float ( \" inf \" ) Β  for idx , d in enumerate ( map ( int , input ( ) . split ( ) ) ) : if d == min_dist : min_idx = - 1 elif d < min_dist : min_idx = idx + 1 min_dist = min ( min_dist , d ) Β  if min_idx >= 0 : print ( min_idx ) else : print ( \" Still ▁ Rozdil \" ) NEW_LINE" ]
codeforces_963_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Random ; import java . util . StringTokenizer ; Β  public class Main implements Runnable { Β  long INF = ( long ) 1e9 + 9 ; Β  private void solve ( ) throws IOException {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Random ; import java . util . StringTokenizer ; Β  public class Main implements Runnable { Β  long INF = ( long ) 1e9 + 9 ; Β  private void solve ( ) throws IOException {", "import java . io . BufferedReader ; import java . io . DataInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; public class D_1296 { public static Scanner sc = new Scanner ( System . in ) ; public static long mod = 1000000000 + 9 ; public static boolean flag [ ] ; public static void main ( String [ ] args ) { Β  long n = sc . nextLong ( ) ; long a = sc . nextLong ( ) % mod ; long b = sc . nextLong ( ) % mod ; int k = sc . nextInt ( ) ; sc . nextLine ( ) ; long ar = quickPow ( a , mod - 2 ) ; long ans = 0 ; long ab = ar * b % mod ; long cycle = 0 ; long tmp = 1 ; long start = quickPow ( a , n ) ; String flag = sc . next ( ) ; Β  for ( int i = 0 ; i < k ; i ++ ) { if ( flag . charAt ( i ) == ' + ' ) cycle = ( cycle + tmp + mod ) % mod ; else cycle = ( cycle - tmp + mod ) % mod ; tmp = tmp * ab % mod ; } long cx = quickPow ( ab , k ) ;" ]
[ "import mathdef binpow ( a , b , m ) : a %= m res = int ( 1 ) while b > 0 : if b & 1 : res = ( res * a ) % m a = ( a * a ) % m b >>= 1 return res Β  def inv ( a , m : int = 1000000009 ) : return binpow ( a , m - 2 , m ) Β  m = int ( 1000000009 ) Β  n , a , b , k = input ( ) . split ( ) n = int ( n ) ; a = int ( a ) ; b = int ( b ) ; k = int ( k ) st = input ( ) res = int ( 1 ) p = int ( ( b * inv ( a , m ) ) % m ) itr = ( n + 1 ) // kmul1 = 0 for i in range ( len ( st ) ) : if st [ i ] == ' + ' : mul1 = ( mul1 + binpow ( p , i , m ) ) % m else : mul1 = ( mul1 - binpow ( p , i , m ) ) % mif binpow ( p , k , m ) == 1 : mul2 = itr % melse : mul2 = ( ( binpow ( p , k * itr , m ) - 1 ) * inv ( ( binpow ( p , k , m ) - 1 ) % m ) ) % mres = ( mul1 * mul2 ) % mleft = n - k * itr + 1 mul1 = binpow ( p , k * itr , m ) mul2 = 0 for i in range ( left ) : if st [ i ] == ' + ' : mul2 = ( mul2 + binpow ( p , i , m ) ) % m else : mul2 = ( mul2 - binpow ( p , i , m ) ) % mres = ( res + mul1 * mul2 ) % mres = ( res * binpow ( a , n , m ) ) % mprint ( res ) Β  Β  NEW_LINE", "n , a , b , k = map ( int , input ( ) . split ( ) ) mod = 10 ** 9 + 9 NEW_LINE", "inp = input ( \" \" ) . split ( ' \\n ' ) nums = inp [ 0 ] . split ( ' ▁ ' ) Β  n = int ( nums [ 0 ] ) a = int ( nums [ 1 ] ) b = int ( nums [ 2 ] ) k = int ( nums [ 3 ] ) Β  st = str ( input ( \" \" ) . strip ( ) ) Β  tot = 0 mod = 10 ** 9 + 9 Β  def inv ( a ) : return pow ( a , mod - 2 , mod ) for i in range ( 0 , k ) : vl = 1 if ( st [ i ] == ' - ' ) : vl = - 1 tot += vl * pow ( a , n - i , mod ) * pow ( b , i , mod ) tot %= mod Β  mult = ( pow ( b , k , mod ) * inv ( pow ( a , k , mod ) ) ) % mod Β  p = ( ( n + 1 ) // k ) - 1 Β  NEW_LINE", "MOD = int ( 1e9 + 9 ) n , a , b , k = map ( int , input ( ) . split ( ) ) s = input ( ) Β  def solve ( ) : res = 0 q = pow ( b , k , MOD ) * pow ( pow ( a , k , MOD ) , MOD - 2 , MOD ) % MOD max_pow = pow ( a , n , MOD ) c = b * pow ( a , MOD - 2 , MOD ) % MOD for i in range ( k ) : res += max_pow if s [ i ] == ' + ' else - max_pow res = ( res % MOD + MOD ) % MOD max_pow = max_pow * c % MOD t = ( n + 1 ) // k if q == 1 : return t * res % MOD z = ( pow ( q , t , MOD ) - 1 ) * pow ( q - 1 , MOD - 2 , MOD ) % MOD return z * res % MOD Β  print ( solve ( ) ) NEW_LINE" ]
codeforces_1388_B
[ "import java . io . * ; import java . util . * ; public class Solution { public static void main ( String [ ] args ) throws Exception { FastReader fr = new FastReader ( ) ; int t = fr . nextInt ( ) ; while ( t -- > 0 ) { int n = fr . nextInt ( ) ; int digs = 4 * n - n ; int nines = digs / 4 ; int eights = n - nines ; StringBuilder sb = new StringBuilder ( ) ; while ( nines > 0 ) { sb . append ( \"9\" ) ; nines -- ; } while ( eights > 0 ) { sb . append ( \"8\" ) ; eights -- ; } System . out . println ( sb . toString ( ) ) ; } } } class Pair implements Comparable < Pair > { int x ; int y ; Pair ( int x , int y ) { this . x = x ; this . y = y ; } public int compareTo ( Pair o ) { if ( this . x != o . x ) return this . x - o . x ; else return this . y - o . y ; } } class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }", "import java . util . Scanner ; public class Div2B { private static int ceiling ( int a , int b ) { return ( a % b == 0 ) ? ( a / b ) : ( a / b ) + 1 ; } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = Integer . parseInt ( scanner . nextLine ( ) ) ; int n ; int ceil ; StringBuilder sb ; for ( int i = 0 ; i < t ; i ++ ) { n = Integer . parseInt ( scanner . nextLine ( ) ) ; ceil = ceiling ( n , 4 ) ; sb = new StringBuilder ( n ) ; for ( int j = 0 ; j < n - ceil ; j ++ ) { sb . append ( 9 ) ; } for ( int j = 0 ; j < ceil ; j ++ ) { sb . append ( 8 ) ; } System . out . println ( sb . toString ( ) ) ; } scanner . close ( ) ; } }" ]
[ "for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE tmp = ( n + 3 ) // 4 NEW_LINE for i in range ( n - tmp ) : NEW_LINE INDENT print ( 9 , end = ' ' ) NEW_LINE DEDENT for i in range ( tmp ) : NEW_LINE INDENT print ( 8 , end = ' ' ) NEW_LINE DEDENT print ( ) NEW_LINE DEDENT", "from math import * NEW_LINE import sys NEW_LINE input = sys . stdin . readline NEW_LINE a = int ( input ( ) ) NEW_LINE for x in range ( a ) : NEW_LINE INDENT b = int ( input ( ) ) NEW_LINE if b == 1 : NEW_LINE INDENT print ( 8 ) NEW_LINE DEDENT else : NEW_LINE INDENT n = ceil ( b / 4 ) NEW_LINE t = ( ( b - n ) * \"9\" ) + ( ( n ) * \"8\" ) NEW_LINE print ( t ) NEW_LINE DEDENT DEDENT", "from sys import stdin , stdout , setrecursionlimit NEW_LINE from math import floor , gcd , fabs , factorial , fmod , sqrt , inf , log , log2 NEW_LINE from random import seed , randint NEW_LINE from datetime import datetime NEW_LINE from collections import defaultdict as dd , deque NEW_LINE from heapq import merge , heapify , heappop , heappush , nsmallest NEW_LINE from bisect import bisect_left as bl , bisect_right as br , bisect NEW_LINE from collections import defaultdict as dd NEW_LINE mod = pow ( 10 , 9 ) + 7 NEW_LINE mod2 = 998244353 NEW_LINE def inp ( ) : return stdin . readline ( ) . strip ( ) NEW_LINE def iinp ( ) : return int ( inp ( ) ) NEW_LINE def out ( var , end = \" \\n \" ) : stdout . write ( str ( var ) + \" \\n \" ) NEW_LINE def outa ( * var , end = \" \\n \" ) : stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) NEW_LINE def lmp ( ) : return list ( mp ( ) ) NEW_LINE def mp ( ) : return map ( int , inp ( ) . split ( ) ) NEW_LINE def smp ( ) : return map ( str , inp ( ) . split ( ) ) NEW_LINE def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] NEW_LINE def l2d ( n , m , val = 0 ) : return [ l1d ( m , val ) for j in range ( n ) ] NEW_LINE def remadd ( x , y ) : return 1 if x % y else 0 NEW_LINE def ceil ( a , b ) : return ( a + b - 1 ) // b NEW_LINE def def_value ( ) : return 0 NEW_LINE for _ in range ( iinp ( ) ) : NEW_LINE INDENT n = iinp ( ) NEW_LINE k = ceil ( n , 4 ) NEW_LINE s = \"9\" * ( n - k ) + \"8\" * k NEW_LINE print ( s ) NEW_LINE DEDENT", "exec ( int ( input ( ) ) * \" a = int ( input ( ) ) -1 ; print ( ( a - a / /4 ) * '9 ' + ( a / /4 + 1 ) * '8 ' ) ; \" ) NEW_LINE", "import sys NEW_LINE from collections import defaultdict , deque NEW_LINE import math NEW_LINE INF = float ( ' inf ' ) NEW_LINE MOD = 10 ** 9 + 7 ; NEW_LINE read = lambda : [ int ( s ) for s in sys . stdin . readline ( ) . split ( ) ] NEW_LINE _ = 1 NEW_LINE _ = int ( input ( ) ) NEW_LINE while _ : NEW_LINE INDENT n , = read ( ) NEW_LINE n8 = math . ceil ( n / 4 ) NEW_LINE n9 = n - n8 NEW_LINE res = \" \" NEW_LINE for i in range ( n9 ) : NEW_LINE INDENT res += \"9\" NEW_LINE DEDENT for i in range ( n8 ) : NEW_LINE INDENT res += \"8\" NEW_LINE DEDENT print ( res ) NEW_LINE _ -= 1 NEW_LINE DEDENT" ]
codeforces_653_B
[ "import java . util . * ; import java . io . * ; Β  public class Bear_and_Compressing { 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 ] ) ; Β  HashMap < String , ArrayList < String > > mp = new HashMap < > ( ) ; ArrayList < String > temp ; for ( int i = 0 ; i < m ; i ++ ) { str = br . readLine ( ) . trim ( ) . split ( \" ▁ \" ) ; Β  if ( mp . get ( str [ 1 ] ) != null ) { temp = ( ArrayList ) mp . get ( str [ 1 ] ) ; temp . add ( str [ 0 ] ) ; mp . put ( str [ 1 ] , temp ) ; } else { temp = new ArrayList < > ( ) ; temp . add ( str [ 0 ] ) ; mp . put ( str [ 1 ] , temp ) ; } } Β  long ans = 0 ; LinkedList < String > q = new LinkedList < > ( ) ; LinkedList < String > p = new LinkedList < > ( ) ; q . add ( \" a \" ) ; while ( ! q . isEmpty ( ) ) { String x = q . poll ( ) ; int z = x . length ( ) ; if ( z == n ) { ans ++ ;", "import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ; Β  public class B653 { Β  public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int Q = in . nextInt ( ) ; Map < Character , List < String > > map = new HashMap < > ( ) ; for ( char c = ' a ' ; c <= ' f ' ; c ++ ) { map . put ( c , new ArrayList < > ( ) ) ; } for ( int q = 0 ; q < Q ; q ++ ) { String expansion = in . next ( ) ; String compression = in . next ( ) ; map . get ( compression . charAt ( 0 ) ) . add ( expansion ) ; } Set < String > set = new HashSet < > ( ) ; set . add ( \" a \" ) ; for ( int n = 2 ; n <= N ; n ++ ) { Set < String > newSet = new HashSet < > ( ) ; for ( String compression : set ) { char c = compression . charAt ( 0 ) ; for ( String expansion : map . get ( c ) ) { newSet . add ( expansion + compression . substring ( 1 ) ) ; } } set = newSet ; } System . out . println ( set . size ( ) ) ; } Β  }" ]
[ "l = [ ] n , q = map ( int , input ( ) . split ( ) ) al = [ \" a \" , \" b \" , \" c \" , \" d \" , \" e \" , \" f \" ] qu = [ ] qu . append ( ( \" \" , 0 ) ) while qu : s , cnt = qu . pop ( 0 ) if cnt == n : l . append ( s ) continue for i in range ( 6 ) : ss = s + al [ i ] qu . append ( ( ss , cnt + 1 ) ) l = list ( set ( l ) ) cnt = 0 item = [ input ( ) . split ( \" ▁ \" ) for i in range ( q ) ] def df ( s ) : global cnt if s == \" a \" : cnt += 1 return elif len ( s ) == 1 : return for t1 , t2 in item : if s [ 0 : 2 ] == t1 : t = t2 + s [ 2 : ] df ( t ) for s in l : df ( s ) print ( cnt ) NEW_LINE", "n , q = map ( int , input ( ) . split ( ) ) from collections import defaultdict Β  def DFS ( d , s , t ) : if len ( s ) == t : NEW_LINE", "links = [ [ ] , [ ] , [ ] , [ ] , [ ] , [ ] ] n , q = map ( int , input ( ) . split ( ) ) for _ in range ( q ) : a , b = input ( ) . split ( ) links [ ord ( b ) - ord ( ' a ' ) ] . append ( a [ 0 ] ) Β  Β  def func ( b , depth ) : if depth == n : return 1 count = 0 for a in links [ ord ( b ) - ord ( ' a ' ) ] : count += func ( a , depth + 1 ) return countprint ( func ( ' a ' , 1 ) ) NEW_LINE", "p = [ \" a \" , \" b \" , \" c \" , \" d \" , \" e \" , \" f \" ] Β  Β  def cond ( item ) : return item [ 0 ] in p and item [ 1 ] in p Β  Β  def dp ( ) : arr = [ [ 0 for j in range ( 6 ) ] for i in range ( n ) ] for j in range ( 6 ) : arr [ 0 ] [ j ] = 1 for i in range ( 1 , n ) : for j in range ( 6 ) : for item in d : if cond ( item ) and d [ item ] == j : x = ord ( item [ 0 ] ) - ord ( \" a \" ) arr [ i ] [ j ] += arr [ i - 1 ] [ x ] return arr [ - 1 ] [ 0 ] Β  Β  n , k = map ( int , input ( ) . split ( ) ) d = { } for i in range ( k ) : a , b = input ( ) . split ( ) d [ a ] = ord ( b ) - ord ( \" a \" ) print ( dp ( ) ) NEW_LINE", "from itertools import product Β  Β  def bear_and_compressing ( ) : n , q = input ( ) . split ( ) n , q = int ( n ) , int ( q ) o = [ ] j = [ ] for _ in range ( q ) : o . append ( list ( input ( ) ) ) s = list ( product ( ' abcdef ' , repeat = n ) ) for i in s : j . append ( list ( i ) ) for _ in range ( n ) : for i in j : for x in o : try : if i [ 0 ] == x [ 0 ] and i [ 1 ] == x [ 1 ] : i . pop ( 0 ) i [ 0 ] = x [ 3 ] except IndexError : continue count = j . count ( [ ' a ' ] ) print ( count ) Β  Β  if __name__ == ' _ _ main _ _ ' : bear_and_compressing ( ) Β  Β  NEW_LINE" ]
codeforces_475_A
[ "import java . text . MessageFormat ; import java . util . * ; Β  public class Main { private static Scanner input = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int k = input . nextInt ( ) ; String [ ] bus = new String [ 34 ] ; Β  for ( int i = 0 ; i < 34 ; i ++ ) { bus [ i ] = i < k ? \" O \" : \" # \" ; } Β  System . out . println ( MessageFormat . format ( \" + - - - - - - - - - - - - - - - - - - - - - - - - + \\n \" + \" | { 0 } . { 4 } . { 7 } . { 10 } . { 13 } . { 16 } . { 19 } . { 22 } . { 25 } . { 28 } . { 31 } . | D | ) \\n \" + \" | { 1 } . { 5 } . { 8 } . { 11 } . { 14 } . { 17 } . { 20 } . { 23 } . { 26 } . { 29 } . { 32 } . | . | \\n \" + \" | { 2 } . . . . . . . . . . . . . . . . . . . . . . . | \\n \" + \" | { 3 } . { 6 } . { 9 } . { 12 } . { 15 } . { 18 } . { 21 } . { 24 } . { 27 } . { 30 } . { 33 } . | . | ) \\n \" + \" + - - - - - - - - - - - - - - - - - - - - - - - - + \\n \" , bus ) ) ; } }", "import java . util . * ; import java . util . stream . * ; Β  public class BayanBus { private static final int numRowsWithoutBack = 10 ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int k = in . nextInt ( ) ; System . out . println ( solve ( k ) ) ; } private static String solve ( int k ) { StringBuilder sb = new StringBuilder ( ) ; String edge = makeEdge ( numRowsWithoutBack + 2 ) ; sb . append ( edge + \" \\n \" ) ;" ]
[ "n = int ( input ( ) ) L = [ \" + - - - - - - - - - - - - - - - - - - - - - - - - + \" , \" | # . # . # . # . # . # . # . # . # . # . # . | D | ) \" , \" | # . # . # . # . # . # . # . # . # . # . # . | . | \" , \" | # . . . . . . . . . . . . . . . . . . . . . . . | \" , \" | # . # . # . # . # . # . # . # . # . # . # . | . | ) \" , \" + - - - - - - - - - - - - - - - - - - - - - - - - + \" ] l = [ ] for y in L : ans = [ ] for x in y : ans . append ( x ) l . append ( ans ) L = lfor i in range ( 1 , len ( L [ 0 ] ) ) : for j in range ( len ( L ) ) : if L [ j ] [ i ] == \" # \" and n > 0 : n -= 1 L [ j ] [ i ] = \" O \" for x in L : print ( \" \" . join ( x ) ) NEW_LINE", "numberoParticipantes = int ( input ( ) ) participantes = [ ' temp ' ] * numberoParticipantes primeraLinea = [ ] segundaLinea = [ ] terceraLinea = [ ] cuartaLinea = [ ] for k in range ( 0 , 11 ) : for l in range ( 0 , 4 ) : if ( l == 0 and len ( participantes ) > 0 ) : primeraLinea . append ( ' O ' ) participantes . pop ( 0 ) elif ( l == 1 and len ( participantes ) > 0 ) : segundaLinea . append ( ' O ' ) participantes . pop ( 0 ) elif ( k == 0 and l == 2 and len ( participantes ) > 0 ) : terceraLinea . append ( ' O ' ) participantes . pop ( 0 ) elif ( l == 3 and len ( participantes ) > 0 ) : cuartaLinea . append ( ' O ' ) participantes . pop ( 0 ) print ( ' + - - - - - - - - - - - - - - - - - - - - - - - - + ' ) for i in range ( 0 , 4 ) : for j in range ( 0 , 27 ) : if ( j == 0 or ( j == 23 and i != 2 ) or j == 25 ) : print ( ' | ' , end = ' ' ) elif ( j == 26 and ( i == 0 or i == 3 ) ) : print ( ' ) ' , end = ' ' ) elif ( j == 26 and ( i == 1 or i == 2 ) ) : print ( ' ' , end = ' ' ) elif ( j == 24 and i == 0 ) : print ( ' D ' , end = ' ' ) elif ( j % 2 == 0 or ( j > 1 and i == 2 ) ) : print ( ' . ' , end = ' ' ) elif ( i == 0 and len ( primeraLinea ) ) : print ( primeraLinea . pop ( ) , end = ' ' ) elif ( i == 1 and len ( segundaLinea ) ) : print ( segundaLinea . pop ( ) , end = ' ' ) elif ( i == 2 and len ( terceraLinea ) ) : print ( terceraLinea . pop ( ) , end = ' ' ) elif ( i == 3 and len ( cuartaLinea ) ) : print ( cuartaLinea . pop ( ) , end = ' ' ) else : print ( ' # ' , end = ' ' ) print ( ' ' ) print ( ' + - - - - - - - - - - - - - - - - - - - - - - - - + ' ) NEW_LINE", "n = int ( input ( ) ) seat = [ [ \" # \" , \" # \" , \" # \" , \" # \" ] for x in range ( 11 ) ] for i in range ( 11 ) : for j in range ( 4 ) : if i != 0 and j == 2 : seat [ i ] [ j ] = \" . \" elif n > 0 : n = n - 1 seat [ i ] [ j ] = \" O \" seat = list ( map ( list , zip ( * seat ) ) ) print ( \" + - - - - - - - - - - - - - - - - - - - - - - - - + \" ) for i in range ( 4 ) : print ( \" | \" , end = \" \" ) for j in range ( 11 ) : print ( seat [ i ] [ j ] + \" . \" , end = \" \" ) if i == 0 : print ( \" | D | ) \" ) elif i == 1 : print ( \" | . | \" ) elif i == 2 : print ( \" . . | \" ) elif i == 3 : print ( \" | . | ) \" ) print ( \" + - - - - - - - - - - - - - - - - - - - - - - - - + \" ) NEW_LINE", "def listToStr ( arr ) : res = ' ' for i in arr : res += i Β  return res Β  Β  def solve ( k ) : border = \" + - - - - - - - - - - - - - - - - - - - - - - - - + \" Β  row1 = list ( \" | \" + ( \" # . \" * 11 ) + \" | D | ) \" ) Β  row2 = list ( \" | \" + ( \" # . \" * 11 ) + \" | . | \" ) Β  row4 = list ( \" | \" + ( \" # . \" * 11 ) + \" | . | ) \" ) Β  row3 = list ( \" | # . . . . . . . . . . . . . . . . . . . . . . . | \" ) Β  rem = k Β  if rem == 1 : row1 [ 1 ] = \" O \" rem = 0 if rem == 2 : row1 [ 1 ] = \" O \" row2 [ 1 ] = \" O \" rem = 0 if rem == 3 : row1 [ 1 ] = \" O \" row2 [ 1 ] = \" O \" row3 [ 1 ] = \" O \" rem = 0 Β  if rem == 4 : row1 [ 1 ] , row2 [ 1 ] , row3 [ 1 ] , row4 [ 1 ] = \" O \" , \" O \" , \" O \" , \" O \" rem = 0 if rem == 0 : row1 = listToStr ( row1 ) row2 = listToStr ( row2 ) row3 = listToStr ( row3 ) row4 = listToStr ( row4 ) print ( border ) print ( row1 ) print ( row2 ) print ( row3 ) print ( row4 ) print ( border ) return if rem > 4 : row1 [ 1 ] , row2 [ 1 ] , row3 [ 1 ] , row4 [ 1 ] = \" O \" , \" O \" , \" O \" , \" O \" rem -= 4 rowsPossible = rem // 3 Β  rem = rem % 3 Β  pos = 1 Β  for i in range ( 1 , rowsPossible + 1 ) : pos = ( 2 * i ) + 1 Β  row1 [ pos ] = \" O \" row2 [ pos ] = \" O \" row4 [ pos ] = \" O \" pos += 2 Β  if rem == 1 : row1 [ pos ] = \" O \" if rem == 2 : row1 [ pos ] = \" O \" row2 [ pos ] = \" O \" row1 = listToStr ( row1 ) row2 = listToStr ( row2 ) row3 = listToStr ( row3 ) row4 = listToStr ( row4 ) print ( border ) print ( row1 ) print ( row2 ) print ( row3 ) print ( row4 ) print ( border ) return Β  Β  k = int ( input ( ) ) Β  solve ( k ) Β  NEW_LINE" ]
codeforces_711_A
[ "import java . util . * ; import java . lang . * ; import java . io . * ; Β  public class UdayLand { public static void main ( String [ ] args ) throws java . lang . Exception {", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = \" ▁ \" ; while ( n -- > 0 ) { s = s + sc . next ( ) + \" \\n \" ; } String s1 = s . replaceFirst ( \" OO \" , \" + + \" ) ; if ( s1 . equals ( s ) ) { System . out . println ( \" NO \" ) ; } else { System . out . println ( \" YES \" ) ; System . out . println ( s1 ) ; } } }", "import java . util . Scanner ; Β  public class BusToUdayland { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; Β  StringBuilder sb = new StringBuilder ( ) ; boolean didReplaceEmptySeats = false ; Β  for ( int i = 0 ; i < n ; i ++ ) { String line = scanner . nextLine ( ) ; if ( didReplaceEmptySeats ) { Β  } else { if ( line . contains ( \" OO \" ) ) { line = line . replaceFirst ( \" OO \" , \" + + \" ) ; didReplaceEmptySeats = true ; } } sb . append ( line + System . lineSeparator ( ) ) ; } Β  if ( didReplaceEmptySeats ) { System . out . println ( \" YES \" ) ; System . out . println ( sb . toString ( ) ) ; } else { System . out . println ( \" NO \" ) ; } Β  } }" ]
[ "n = int ( input ( ) ) found = Falsebus = [ ] for i in range ( n ) : row = list ( input ( ) ) for seat in range ( len ( row ) - 1 ) : if ( row [ seat ] == row [ seat + 1 ] and row [ seat ] == ' O ' and not found ) : found = True row [ seat ] = ' + ' row [ seat + 1 ] = ' + ' bus . append ( row ) Β  if found : print ( \" YES \" ) for i in range ( n ) : print ( \" \" . join ( map ( str , bus [ i ] ) ) ) else : print ( \" NO \" ) NEW_LINE", "n = int ( input ( ) ) Β  bus = [ ] Β  for x in range ( n ) : s = input ( ) Β  row = [ s [ 0 ] , s [ 1 ] , s [ 3 ] , s [ 4 ] ] Β  bus . append ( row ) Β  result = ' NO ' Β  for x in bus : if x [ 0 ] == ' O ' and x [ 1 ] == ' O ' : result = ' YES ' x [ 0 ] = ' + ' x [ 1 ] = ' + ' break if x [ 2 ] == ' O ' and x [ 3 ] == ' O ' : result = ' YES ' x [ 2 ] = ' + ' x [ 3 ] = ' + ' break Β  if result == ' NO ' : print ( ' NO ' ) else : print ( ' YES ' ) for x in bus : print ( ' % s % s | % s % s ' % ( x [ 0 ] , x [ 1 ] , x [ 2 ] , x [ 3 ] ) ) NEW_LINE", "n = int ( input ( ) ) Β  bus = [ ] Β  for x in range ( n ) : s = input ( ) row = [ s [ 0 ] , s [ 1 ] , s [ 3 ] , s [ 4 ] ] bus . append ( row ) Β  result = ' NO ' Β  for x in bus : if x [ 0 ] == ' O ' and x [ 1 ] == ' O ' : result = ' YES ' x [ 0 ] = ' + ' x [ 1 ] = ' + ' break if x [ 2 ] == ' O ' and x [ 3 ] == ' O ' : result = ' YES ' x [ 2 ] = ' + ' x [ 3 ] = ' + ' break Β  if result == ' NO ' : print ( ' NO ' ) else : print ( ' YES ' ) Β  for x in bus : print ( ' % s % s | % s % s ' % ( x [ 0 ] , x [ 1 ] , x [ 2 ] , x [ 3 ] ) ) NEW_LINE", "n = int ( input ( ) ) l = [ ] for i in range ( n ) : l . append ( input ( ) ) c = 0 for i in range ( n ) : if \" OO \" in l [ i ] : c = 1 if l [ i ] [ 0 ] == ' O ' and l [ i ] [ 1 ] == ' O ' : l [ i ] = \" + + \" + l [ i ] [ 2 : ] else : l [ i ] = l [ i ] [ : 3 ] + \" + + \" breakif c : print ( \" YES \" ) for i in l : print ( i ) else : print ( \" NO \" ) NEW_LINE", "num_rows = int ( input ( ) ) rows = [ ] vacancy = Falsefor i in range ( num_rows ) : row = input ( ) NEW_LINE" ]
codeforces_483_A
[ "import java . util . * ; public class CounterExample { public static long co_prime ( long n1 , long n2 ) {", "import java . util . * ; Β  public class Main { public static void main ( String [ ] args ) { Β  Scanner sc = new Scanner ( System . in ) ; Β  long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; if ( x % 2 != 0 ) { x ++ ; } if ( x + 2 > y ) { System . out . println ( \" - 1\" ) ; } else { System . out . println ( x + \" ▁ \" + ( x + 1 ) + \" ▁ \" + ( x + 2 ) ) ; } Β  } }", "import java . util . * ; import java . lang . * ; import java . io . * ; Β  public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {", "import java . util . * ; public class CounterExample { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long l = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; Β  long a = 0 ; long b = 0 ; long c = 0 ; sc . close ( ) ; Β  for ( long i = l ; i <= r ; i ++ ) { if ( i % 2 == 0 && a == 0 ) { a = i ; } Β  else if ( i % 2 != 0 && a != 0 ) { b = i ; } else if ( i % 2 == 0 && ( a != 0 && b != 0 ) ) { c = i ; break ; } } if ( a != 0 && b != 0 && c != 0 ) System . out . println ( a + \" ▁ \" + b + \" ▁ \" + c ) ; else System . out . println ( - 1 ) ; } }" ]
[ "import sys Β  def answer ( l , r ) : if ( r - l ) < 2 : print ( ' - 1' ) return NEW_LINE", "from math import gcdl , r = map ( int , input ( ) . split ( ) ) if ( r - l < 2 ) : print ( - 1 ) exit ( ) for a in range ( l , r + 1 ) : for b in range ( a + 1 , r + 1 ) : for c in range ( b + 1 , r + 1 ) : if ( gcd ( a , b ) == 1 and gcd ( b , c ) == 1 and gcd ( a , c ) != 1 ) : print ( a , b , c ) exit ( ) else : print ( - 1 ) NEW_LINE", "def gcd ( a , b ) : while ( b ) : a , b = b , a % b return a Β  a , b = map ( int , input ( ) . split ( ) ) s1 , s2 , s3 = 0 , 0 , 0 if b - a < 2 : print ( - 1 ) exit ( ) Β  else : for i in range ( a , b ) : for j in range ( i + 1 , b + 1 ) : if gcd ( i , j ) == 1 : s1 , s2 = i , j for k in range ( s2 + 1 , b + 1 ) : if gcd ( s1 , k ) != 1 and gcd ( s2 , k ) == 1 : s3 = k print ( s1 , s2 , s3 ) exit ( ) print ( - 1 ) NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) if a % 2 : a += 1 if a + 2 > b : print ( - 1 ) else : print ( a , a + 1 , a + 2 ) NEW_LINE" ]
codeforces_59_A
[ "import java . util . * ; public class CodeForces { static Scanner input = new Scanner ( System . in ) ; public static void main ( String args [ ] ) { String s = input . next ( ) ; String ss = \" \" ; String sk = \" \" ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == s . toLowerCase ( ) . charAt ( i ) ) ss += s . charAt ( i ) ; else sk += s . charAt ( i ) ; } if ( ss . length ( ) >= sk . length ( ) ) System . out . println ( s . toLowerCase ( ) ) ; else System . out . println ( s . toUpperCase ( ) ) ; } }", "import java . util . Scanner ; public class java { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String ch = s . next ( ) ; int k = 0 ; int m = 0 ; for ( int i = 0 ; i < ( ch . length ( ) ) ; i ++ ) { if ( ch . charAt ( i ) >= ' a ' && ch . charAt ( i ) <= ' z ' ) k = k + 1 ; else m = m + 1 ; } if ( m > k ) System . out . println ( ch . toUpperCase ( ) ) ; else System . out . println ( ch . toLowerCase ( ) ) ; } }", "import java . util . Scanner ; public class Word { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String ch = s . next ( ) ; int i = 0 ; int j = 0 ; char c ; for ( int r = 0 ; r < ch . length ( ) ; r ++ ) { c = ch . charAt ( r ) ; if ( Character . isUpperCase ( c ) ) { i ++ ; } else { j ++ ; } } if ( j >= i ) { ch = ch . toLowerCase ( ) ; } else { ch = ch . toUpperCase ( ) ; } System . out . println ( ch ) ; } }", "import java . util . Scanner ; public class Main { Β  public static void main ( String [ ] args ) {" ]
[ "s = input ( ) NEW_LINE countc = 0 NEW_LINE counts = 0 NEW_LINE for i in s : if NEW_LINE INDENT ( ord ( i ) >= 97 and ord ( i ) <= 122 ) : counts += 1 elif ( ord ( i ) >= 65 and ord ( i ) <= 90 ) : countc += 1 NEW_LINE DEDENT if ( countc > counts ) : NEW_LINE INDENT print ( s . upper ( ) ) else : NEW_LINE print ( s . lower ( ) ) NEW_LINE DEDENT", "word = input ( ' ' ) NEW_LINE upper = 0 l NEW_LINE ower = 0 NEW_LINE for x in word : if NEW_LINE x >= \" A \" and x <= \" Z \" : upper += 1 elif x >= \" a \" and x <= \" z \" : lower += 1 NEW_LINE if lower >= upper : NEW_LINE INDENT print ( word . lower ( ) ) else : NEW_LINE print ( word . upper ( ) ) NEW_LINE DEDENT", "s1 = input ( ) Β  lowers = 0 u NEW_LINE ppers = 0 Β  for c in s1 : if NEW_LINE c . isupper ( ) : uppers += 1 else : lowers += 1 Β  if lowers < uppers : NEW_LINE INDENT print ( s1 . upper ( ) ) else : NEW_LINE print ( s1 . lower ( ) ) Β  NEW_LINE DEDENT", "s = input ( ) NEW_LINE c = 0 NEW_LINE def f ( ) : for NEW_LINE i in range ( 2 ) : ddd = 999 NEW_LINE for x in s : if NEW_LINE x . isupper ( ) : c += 1 Β  if c > len ( s ) // 2 : NEW_LINE INDENT s = s . upper ( ) else : NEW_LINE s = s . lower ( ) NEW_LINE DEDENT f ( ) NEW_LINE print ( s ) NEW_LINE", "Into = list ( input ( ) ) NEW_LINE big = 0 NEW_LINE small = 0 NEW_LINE out = [ ] NEW_LINE for i in Into : if NEW_LINE ord ( i ) < 97 : big += 1 else : small += 1 NEW_LINE if big > small : for NEW_LINE j in Into : NEW_LINE if ord ( j ) >= 97 : j = chr ( ord ( j ) - 32 ) NEW_LINE out . append ( j ) else : out . append ( j ) else : for j in Into : if NEW_LINE ord ( j ) < 97 : j = chr ( ord ( j ) + 32 ) NEW_LINE out . append ( j ) else : out . append ( j ) NEW_LINE s = ' ' NEW_LINE for k in out : s += kprint ( s ) NEW_LINE" ]
codeforces_327_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; Β  public class Flipping_Game { static class RealScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; Β  String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } Β  long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } Β  public static void main ( String [ ] args ) { RealScanner sc = new RealScanner ( ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int count1 = 0 , count0 = 0 , max = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { int val = arr [ i ] ; if ( val == 1 ) { count1 ++ ; if ( count0 > 0 ) { count0 -- ; } } if ( val == 0 ) { count0 ++ ; if ( count0 > max ) { max = count0 ; } } } System . out . println ( count1 + max ) ; } }", "import java . io . * ; import java . util . * ; Β  public class P1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Map < Integer , ArrayList < Integer > > map = new HashMap < > ( ) ; int n = sc . nextInt ( ) ; Β  int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { int cursum = 0 ; int min = Integer . MAX_VALUE ; for ( int j = i ; j < n ; j ++ ) { ArrayList < Integer > al = new ArrayList < > ( ) ; if ( a [ j ] == 0 ) { cursum -= 1 ; } else { cursum += 1 ; } if ( cursum < min ) { min = cursum ; al . add ( i ) ; al . add ( j ) ; map . put ( min , al ) ; } } } int min = Integer . MAX_VALUE ; for ( int k : map . keySet ( ) ) { if ( min > k ) min = k ; } Β  ArrayList < Integer > p = map . get ( min ) ; int x = p . get ( 0 ) ; int y = p . get ( 1 ) ; Β  for ( int i = x ; i <= y ; i ++ ) { if ( a [ i ] == 1 ) a [ i ] = 0 ; else a [ i ] = 1 ; } int sum = 0 ; Β  for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; } System . out . println ( sum ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; Β  public class Flipping_Game { static class RealScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( \" \" ) ; Β  String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } Β  long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } Β  public static void main ( String [ ] args ) { RealScanner sc = new RealScanner ( ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; }" ]
[ "x = int ( input ( ) ) Β  difference = [ 0 ] Β  ones = 0 zeros = 0 Β  line = input ( ) . split ( \" ▁ \" ) Β  for i in line : if ( int ( i ) == 1 ) : ones += 1 else : zeros += 1 difference . append ( zeros - ones ) Β  minimum = 0 maximum = 0 Β  for i in range ( 1 , len ( difference ) ) : result = difference [ i ] - minimum maximum = max ( ones + result , maximum ) minimum = min ( difference [ i ] , minimum ) Β  print ( maximum ) Β  NEW_LINE", "n = int ( input ( ) ) zeros_and_ones = list ( map ( int , input ( ) . split ( ) ) ) num_of_ones = zeros_and_ones . count ( 1 ) cnt = 0 max_arr = [ ] print_ans = Truefor i in zeros_and_ones : if 0 not in zeros_and_ones : print_ans = False print ( num_of_ones - 1 ) break if cnt >= 0 : if i == 1 and cnt != 0 : cnt -= 1 if i == 0 : cnt += 1 max_arr . append ( cnt ) if print_ans : print ( num_of_ones + max ( max_arr ) ) NEW_LINE", "n = int ( input ( ) ) array = list ( map ( int , input ( ) . split ( ) ) ) maxOnes = sum ( array ) newArray = [ ] for i in array : newArray . append ( 1 if i == 0 else - 1 ) Β  curMaxSum = 0 totalMaxSum = 0 for i in newArray : curMaxSum = max ( 0 , curMaxSum + i ) totalMaxSum = max ( totalMaxSum , curMaxSum ) Β  print ( maxOnes + totalMaxSum if maxOnes != n else n - 1 ) NEW_LINE", "def run2 ( ) : numberOfBits = int ( input ( ) ) line = input ( ) . split ( \" ▁ \" ) bits = [ int ( element ) for element in line ] scores = [ 1 - 2 * element for element in bits ] NEW_LINE" ]
codeforces_429_A
[ "import java . util . * ; import java . io . * ; import java . math . * ; Β  public class Practice Β  { static FastReader sc = new FastReader ( ) ; static int mod = ( int ) Math . pow ( 10 , 9 ) + 7 ; static int dp [ ] [ ] ; static ArrayList < Integer > l = new ArrayList < Integer > ( ) ; public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ;", "import java . util . * ; import java . io . * ; import java . math . * ; Β  public class Practice Β  { static FastReader sc = new FastReader ( ) ; static int mod = ( int ) Math . pow ( 10 , 9 ) + 7 ; static int dp [ ] [ ] ; static ArrayList < Integer > l = new ArrayList < Integer > ( ) ; public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ;", "n = int ( input ( ) ) g = [ [ ] for i in range ( n ) ] for i in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) g [ a - 1 ] . append ( b - 1 ) g [ b - 1 ] . append ( a - 1 ) start = list ( map ( int , input ( ) . split ( ) ) ) goal = list ( map ( int , input ( ) . split ( ) ) ) q = [ ( 0 , 0 , 0 , 0 ) ] ans = [ ] while q : node , dst , a , b = q . pop ( ) if dst : if a != ( start [ node ] != goal [ node ] ) : ans . append ( node + 1 ) a = 1 - a else : if b != ( start [ node ] != goal [ node ] ) : ans . append ( node + 1 ) b = 1 - b dst = 1 - dst for to in g [ node ] : g [ to ] . remove ( node ) q . append ( ( to , dst , a , b ) ) print ( len ( ans ) ) print ( \" \\n \" . join ( map ( str , ans ) ) )" ]
[ "n = int ( input ( ) ) g = [ [ ] for i in range ( n ) ] for i in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) g [ a - 1 ] . append ( b - 1 ) g [ b - 1 ] . append ( a - 1 ) start = list ( map ( int , input ( ) . split ( ) ) ) goal = list ( map ( int , input ( ) . split ( ) ) ) q = [ ( 0 , 0 , 0 , 0 ) ] ans = [ ] while q : node , dst , a , b = q . pop ( ) if dst : if a != ( start [ node ] != goal [ node ] ) : ans . append ( node + 1 ) a = 1 - a else : if b != ( start [ node ] != goal [ node ] ) : ans . append ( node + 1 ) b = 1 - b dst = 1 - dst for to in g [ node ] : g [ to ] . remove ( node ) q . append ( ( to , dst , a , b ) ) print ( len ( ans ) ) print ( \" \\n \" . join ( map ( str , ans ) ) ) NEW_LINE", "n = int ( input ( ) ) adj = [ [ ] for i in range ( n + 1 ) ] for i in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) adj [ a ] . append ( b ) adj [ b ] . append ( a ) u = [ - 1 ] + list ( map ( int , input ( ) . split ( ) ) ) v = [ - 1 ] + list ( map ( int , input ( ) . split ( ) ) ) q = [ ( 1 , 0 , 0 , 0 ) ] ans = [ ] while q : x , a , b , c = q . pop ( ) if a : if b != ( u [ x ] != v [ x ] ) : ans . append ( x ) b = 1 - b else : if c != ( u [ x ] != v [ x ] ) : ans . append ( x ) c = 1 - c a = 1 - a for i in adj [ x ] : adj [ i ] . remove ( x ) q . append ( ( i , a , b , c ) ) print ( len ( ans ) ) print ( ' \\n ' . join ( map ( str , ans ) ) ) NEW_LINE", "from sys import stdin , stdoutfrom collections import defaultdict , dequenmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) def bfs ( ) : global ans q = deque ( ) p [ 1 ] = - 1 q . append ( 1 ) while q : src = q . popleft ( ) if p [ src ] != - 1 and p [ p [ src ] ] != - 1 : dp [ src ] = dp [ p [ p [ src ] ] ] if dp [ src ] ^ init [ src - 1 ] != goal [ src - 1 ] : dp [ src ] ^= 1 ans += [ src ] for neigh in g [ src ] : if neigh == p [ src ] : continue p [ neigh ] = src q . append ( neigh ) Β  for _ in range ( 1 ) : NEW_LINE" ]
codeforces_718_A
[ "import java . util . Arrays ; import java . util . Scanner ; Β  public class hello { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; long t = in . nextLong ( ) ; String num = in . next ( ) ; int dec = num . indexOf ( \" . \" ) ; num = num . replace ( \" . \" , \" \" ) ; char [ ] cs = num . toCharArray ( ) ; Β  int len = cs . length ; for ( int i = dec ; i < len ; i ++ ) { if ( cs [ i ] - '0' >= 5 ) { len = i + 1 ; break ; } } while ( t > 0 ) { int roundIdx = - 1 ; for ( int i = len - 1 ; i >= dec ; i -- ) { int v = cs [ i ] - '0' ; if ( v >= 5 ) { roundIdx = i ; break ; } } if ( roundIdx == - 1 ) break ; len = roundIdx ; while ( len > 0 && cs [ len - 1 ] == '9' ) { cs [ len - 1 ] = '0' ; len -- ; } if ( len == 0 ) { System . out . print ( \"1\" ) ; break ; } cs [ len - 1 ] ++ ; t -- ; } System . out . print ( new String ( cs , 0 , dec ) ) ; if ( len - dec > 0 ) { System . out . print ( \" . \" ) ; System . out . println ( new String ( cs , dec , len - dec ) ) ; } else { System . out . println ( ) ; } } }", "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 ;" ]
[ "n , t = map ( int , input ( ) . split ( ) ) s = '0' + input ( ) f = s . find ( ' . ' ) if f == - 1 : print ( s [ 1 : ] ) exit ( ) r = list ( s [ : f ] + s [ f + 1 : ] ) for i in range ( f , len ( r ) ) : execute = False while r [ i ] >= '5' and r [ i ] <= '9' : if i < f or t <= 0 : break i -= 1 z = ord ( r [ i ] ) + 1 while z == ord ( \"9\" ) + 1 : i -= 1 z = ord ( r [ i ] ) + 1 while len ( r ) != i + 1 : r . pop ( ) r [ - 1 ] = chr ( z ) t -= 1 execute = True if execute : breakif r [ 0 ] == '0' : r = r [ 1 : ] f -= 1 r += [ '0' ] * max ( f - len ( r ) , 0 ) if len ( r ) == f : print ( ' ' . join ( map ( str , r ) ) ) else : print ( * r [ : f ] , ' . ' , * r [ f : ] , sep = ' ' ) NEW_LINE", "import sysn , t = map ( int , sys . stdin . readline ( ) . split ( ) ) x = sys . stdin . readline ( ) y = x . find ( ' . ' ) for i in range ( y + 1 , n ) : if x [ i ] > '4' : for j in range ( t ) : i -= 1 if x [ i ] != '4' : break if i == y : i -= 1 while i and x [ i ] == '9' : i -= 1 x = x [ : i ] + str ( int ( x [ i ] ) + 1 ) + '0' * ( y - i - 1 ) else : x = x [ : i ] + str ( int ( x [ i ] ) + 1 ) breakprint ( x ) Β  Β  NEW_LINE", "from sys import * input = stdin . readlinen , t = map ( int , input ( ) . split ( ) ) num = input ( ) idx = num . find ( \" . \" ) if idx < 0 : print ( num ) exit ( ) cnt = 1 for i in range ( idx + 1 , n ) : if num [ i ] < \"5\" : if 5 - int ( num [ i ] ) == 1 : cnt += 1 else : cnt = 1 if num [ i ] >= \"5\" : j = min ( cnt , t ) if num [ i - j ] != \" . \" : num = num [ : i - j ] + str ( int ( num [ i - j ] ) + 1 ) else : curr = 0 while num [ idx - curr - 1 ] == \"9\" and ( idx - curr ) != 0 : curr += 1 num = num [ : idx - curr - 1 ] + str ( int ( num [ idx - curr - 1 ] ) + 1 ) + \"0\" * curr if curr != idx else \"1\" + \"0\" * curr breakprint ( num ) NEW_LINE" ]
codeforces_1348_A
[ "import java . util . Scanner ; Β  public class A1348 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) ; int index = n / 2 ; int sum = ( int ) ( 2 * ( Math . pow ( 2 , index ) - 1 ) ) ; System . out . println ( sum ) ; } } }", "import java . io . * ; import java . util . * ; Β  public class Temp { 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 ; Β  public class CF1348A { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( ( int ) ( Math . pow ( 2 , Math . floor ( n / 2.0 ) + 1 ) - 2 ) ) ; } } }", "import java . util . Scanner ; import java . lang . Math ; public class NewMain { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int t ; t = in . nextInt ( ) ; for ( int j = 0 ; j < t ; j ++ ) { int n ; n = in . nextInt ( ) ; int sum1 = 0 , sum2 = 0 ; sum1 += Math . pow ( 2 , n ) ; for ( int i = 1 ; i < n / 2 ; i ++ ) { sum1 += Math . pow ( 2 , i ) ; } for ( int i = n / 2 ; i < n ; i ++ ) { sum2 += Math . pow ( 2 , i ) ; } System . out . println ( sum1 - sum2 ) ; } } }", "import java . util . * ; Β  public class balance { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int c1 = 1 << n ; int c2 = 0 ; for ( int i = 1 ; i < n ; ++ i ) { if ( i < n / 2 ) c1 += 1 << i ; else c2 += 1 << i ; }" ]
[ "t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) l = [ 2 ** i for i in range ( 1 , n + 1 ) ] NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) x = n // 2 print ( 2 ** ( x + 1 ) - 2 ) Β  NEW_LINE", "t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) sa = ( 1 << n ) for i in range ( 1 , n // 2 ) : sa += ( 1 << i ) sb = 0 for i in range ( n // 2 , n ) : sb += ( 1 << i ) print ( abs ( sb - sa ) ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = 2 k = 4 for i in range ( 1 , n // 2 ) : a += k k *= 2 print ( a ) NEW_LINE", "t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) li = [ ] for i in range ( 1 , n + 1 ) : li . append ( 2 ** i ) NEW_LINE" ]
codeforces_373_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int [ ] map = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { for ( char c : sc . next ( ) . toCharArray ( ) ) { if ( c != ' . ' ) { map [ c - '0' ] ++ ; if ( map [ c - '0' ] > 2 * k ) { System . out . println ( \" NO \" ) ; return ; } } } } System . out . println ( \" YES \" ) ; } }", "import java . util . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; scan . nextLine ( ) ; Map < Integer , Integer > count = new HashMap < > ( ) ; String result = \" YES \" ; for ( int i = 0 ; i < 4 ; i ++ ) { String s = scan . nextLine ( ) ; for ( int j = 0 ; j < 4 ; j ++ ) { char ch = s . charAt ( j ) ; if ( ch == ' . ' ) continue ; int num = Integer . parseInt ( String . valueOf ( ch ) ) ; if ( ! count . containsKey ( num ) ) { count . put ( num , 0 ) ; } int c = count . get ( num ) ; if ( c == 2 * k ) { result = \" NO \" ; break ; } else { count . put ( num , c + 1 ) ; } } } System . out . println ( result ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . util . StringTokenizer ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( newInputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } Β Β  public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ; int l = fs . nextInt ( ) ; Β  HashMap < Integer , Integer > hs = new HashMap < > ( ) ; Β  for ( int i = 0 ; i < 4 ; i ++ ) { String k = fs . nextLine ( ) ; for ( char ch : k . toCharArray ( ) ) { if ( ch >= '0' && ch <= '9' ) { hs . putIfAbsent ( ( int ) ch , 0 ) ; hs . put ( ( int ) ch , hs . get ( ( int ) ch ) + 1 ) ; } } } Β  boolean flag = true ; Β  for ( Integer key : hs . keySet ( ) ) { if ( hs . get ( key ) > l * 2 ) { flag = false ; break ; } } Β  if ( flag ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } Β Β  } }", "import java . util . * ; public class CollectingBeatsIsFun { public static void main ( String [ ] args ) { Β  Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; boolean flag = true ; Β  for ( int i = 0 ; i < 4 ; i ++ ) { String temp = sc . next ( ) ; for ( int j = 0 ; j < temp . length ( ) ; j ++ ) { if ( temp . charAt ( j ) != ' . ' ) { int num = temp . charAt ( j ) - '0' ; if ( map . containsKey ( num ) ) { map . put ( num , map . get ( num ) + 1 ) ; } else map . put ( num , 1 ) ; } } } sc . close ( ) ; for ( Map . Entry < Integer , Integer > entry : map . entrySet ( ) ) { if ( entry . getValue ( ) > 2 * k ) { flag = false ; break ; } } if ( flag ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } }" ]
[ "k = int ( input ( ) ) l = [ 0 ] * 10 for i in range ( 4 ) : for j in input ( ) : if ( j != ' . ' ) : l [ int ( j ) ] += 1 for i in range ( 10 ) : if l [ i ] > k * 2 : print ( \" NO \" ) exit ( ) print ( \" YES \" ) NEW_LINE", "k = int ( input ( ) ) a = [ ] for i in range ( 4 ) : s = input ( ) for j in s : if j . isdigit ( ) : a . append ( int ( j ) ) for i in range ( 1 , 10 ) : if a . count ( i ) > k * 2 : print ( \" NO \" ) breakelse : print ( \" YES \" ) NEW_LINE", "k = int ( input ( ) ) d = { } t = [ ] for i in range ( 10 ) : d [ i ] = 0 for i in range ( 4 ) : arr = input ( ) t . append ( arr ) for i in range ( 4 ) : for j in range ( 4 ) : if t [ i ] [ j ] == \" . \" : continue else : d [ int ( t [ i ] [ j ] ) ] += 1 for i in range ( 10 ) : if d [ i ] > 2 * k : print ( \" NO \" ) breakelse : print ( \" YES \" ) NEW_LINE", "from collections import Counterk = int ( input ( ) ) * 2 x = [ ] for i in range ( 4 ) : x . extend ( list ( input ( ) ) ) c = Counter ( x ) v = 0 del c [ ' . ' ] for i in c : if c [ i ] > k : v = 1 breakif v == 1 : print ( \" NO \" ) else : print ( \" YES \" ) NEW_LINE", "n = int ( input ( ) ) Β  arr = [ ] for i in range ( 4 ) : arr . append ( input ( ) ) Β  flag = Truefor i in arr : for j in i : if j == ' . ' : continue else : c = 0 for k in arr : c += k . count ( j ) if c > ( 2 * n ) : flag = False break Β  if not flag : break if not flag : break Β  if flag : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE" ]
codeforces_69_A
[ "import java . util . Scanner ; Β  public class Codeforces { Β  public static void main ( String [ ] args ) { Β  Scanner input = new Scanner ( System . in ) ; Β ", "import java . io . * ; import java . util . * ; public class MyClass { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int arr [ ] = new int [ 3 ] ; while ( n -- > 0 ) { String s [ ] = br . readLine ( ) . split ( \" ▁ \" ) ; for ( int i = 0 ; i < 3 ; i ++ ) { arr [ i ] += Integer . parseInt ( s [ i ] ) ; } } for ( int i = 0 ; i < 3 ; i ++ ) { if ( arr [ i ] != 0 ) { System . out . println ( \" NO \" ) ; return ; } } System . out . println ( \" YES \" ) ; } }", "import java . util . Scanner ; public class YoungPhysicist { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n , x , y , z , Sum_X = 0 , Sum_Y = 0 , Sum_Z = 0 ; n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { x = in . nextInt ( ) ; y = in . nextInt ( ) ; z = in . nextInt ( ) ; Sum_X = Sum_X + x ; Sum_Y = Sum_Y + y ; Sum_Z = Sum_Z + z ; } if ( Sum_X == 0 && Sum_Y == 0 && Sum_Z == 0 ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } }", "import java . io . * ; import java . util . * ; Β  public class YoungPhysicist { public static void main ( String args [ ] ) { FScanner in = new FScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; int xsum = 0 , ysum = 0 , zsum = 0 ; while ( n -- > 0 ) { xsum = xsum + in . nextInt ( ) ; ysum = ysum + in . nextInt ( ) ; zsum = zsum + in . nextInt ( ) ; } if ( xsum == 0 && ysum == 0 && zsum == 0 ) out . println ( \" YES \" ) ; else out . println ( \" NO \" ) ; out . close ( ) ; } Β  static class FScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer sb = new StringTokenizer ( \" \" ) ; Β  String next ( ) { while ( ! sb . hasMoreTokens ( ) ) { try { sb = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { } } return sb . nextToken ( ) ; } String nextLine ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { } return \" \" ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } Β  int [ ] readArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } Β  float nextFloat ( ) { return Float . parseFloat ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }" ]
[ "pos = [ 0 , 0 , 0 ] NEW_LINE for i in range ( int ( input ( ) ) ) : forces = input ( ) . split ( ) NEW_LINE for j in range ( 3 ) : pos [ j ] += int ( forces [ j ] ) NEW_LINE if all ( i == 0 for i in pos ) : NEW_LINE INDENT print ( \" YES \" ) else : NEW_LINE print ( \" NO \" ) NEW_LINE DEDENT", "n = int ( input ( ) ) NEW_LINE x , y , z = 0 , 0 , 0 NEW_LINE for _ in range ( n ) : [ xi , yi , zi ] = [ int ( i ) for i in input ( ) . split ( ' ▁ ' ) ] NEW_LINE x += xi NEW_LINE y += yi NEW_LINE z += zi Β  if x == 0 and y == 0 and z == 0 : NEW_LINE INDENT print ( \" YES \" ) else : NEW_LINE print ( \" NO \" ) Β  NEW_LINE DEDENT", "n = int ( input ( ) ) NEW_LINE res = [ [ None , None , None ] for i in range ( n ) ] NEW_LINE for i in range ( n ) : res [ i ] [ 0 ] , res [ i ] [ 1 ] , res [ i ] [ 2 ] = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = [ 0 ] * 3 Β  for i in range ( n ) : ans [ 0 ] += res [ i ] [ 0 ] Β  for i in range ( n ) : ans [ 1 ] += res [ i ] [ 1 ] Β  for i in range ( n ) : NEW_LINE ans [ 2 ] += res [ i ] [ 2 ] Β  if ans [ 0 ] == 0 and ans [ 1 ] == 0 and ans [ 2 ] == 0 : print ( \" YES \" ) NEW_LINE exit ( ) NEW_LINE print ( \" NO \" ) NEW_LINE", "n = int ( input ( ) ) NEW_LINE x = 0 NEW_LINE y = 0 NEW_LINE z = 0 NEW_LINE for i in range ( n ) : inp = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE x += inp [ 0 ] NEW_LINE y += inp [ 1 ] NEW_LINE z += inp [ 2 ] NEW_LINE if ( x == 0 and y == 0 and z == 0 ) : NEW_LINE INDENT print ( \" YES \" ) else : NEW_LINE print ( \" NO \" ) NEW_LINE DEDENT", "n = int ( input ( ) ) NEW_LINE x = 0 ; NEW_LINE y = 0 ; NEW_LINE z = 0 NEW_LINE for _ in range ( n ) : a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE x += a NEW_LINE y += b NEW_LINE z += c NEW_LINE if x == 0 and y == 0 and z == 0 : NEW_LINE INDENT print ( \" YES \" ) else : NEW_LINE print ( \" NO \" ) NEW_LINE DEDENT" ]
codeforces_125_B
[ "import java . util . Scanner ; Β Β  public class SimpleXML { Β  public static void main ( String [ ] args ) {", "import java . util . * ; Β  public class Main { Β Β  public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String [ ] c = s . split ( \" > < \" ) ; c [ 0 ] = c [ 0 ] . substring ( 1 ) ; c [ c . length - 1 ] = c [ c . length - 1 ] . substring ( 0 , 2 ) ; int spaces = 0 ; for ( int i = 0 ; i < c . length ; i ++ ) { if ( c [ i ] . charAt ( 0 ) != ' / ' ) { for ( int j = spaces ; j > 0 ; j -- ) System . out . print ( \" ▁ \" ) ; System . out . println ( \" < \" + c [ i ] + \" > \" ) ; spaces += 2 ; } else { spaces -= 2 ; for ( int j = spaces ; j > 0 ; j -- ) System . out . print ( \" ▁ \" ) ; System . out . println ( \" < \" + c [ i ] + \" > \" ) ; } } Β  } Β  }", "import java . util . Scanner ; public class Ishu1 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str ; int nested = 0 , i , j ; int [ ] degree = new int [ 26 ] ; char [ ] ch = new char [ 1000 ] ; str = scan . next ( ) ; ch = str . toCharArray ( ) ; for ( i = 0 ; i < str . length ( ) ; ++ i ) if ( ch [ i ] >= ' a ' && ch [ i ] <= ' z ' ) { if ( ch [ i - 1 ] == ' < ' ) { for ( j = 1 ; j <= 2 * nested ; ++ j ) System . out . print ( \" ▁ \" ) ; System . out . println ( \" < \" + ch [ i ] + \" > \" ) ; ++ nested ; } else if ( ch [ i - 1 ] == ' / ' ) { -- nested ; for ( j = 1 ; j <= 2 * nested ; ++ j ) System . out . print ( \" ▁ \" ) ; System . out . println ( \" < / \" + ch [ i ] + \" > \" ) ; } } } }", "import java . util . * ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; Β  public final class Xml { public static void main ( String [ ] args ) throws IOException { Β  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; Β  int h = 0 ; int i = 0 ; Β  while ( i + 1 < s . length ( ) ) { if ( s . charAt ( i + 1 ) == ' / ' ) { h -- ; for ( int j = 0 ; j < 2 * h ; j ++ ) { System . out . print ( ' ▁ ' ) ; } System . out . println ( s . substring ( i , i + 4 ) ) ; i += 4 ; } else { for ( int j = 0 ; j < 2 * h ; j ++ ) { System . out . print ( ' ▁ ' ) ; } System . out . println ( s . substring ( i , i + 3 ) ) ; i += 3 ; h ++ ; } } } }" ]
[ "s = input ( ) s1 = s . split ( ' < ' ) NEW_LINE", "a = input ( ) . split ( ' > ' ) NEW_LINE", "s = input ( ) s = \" \" . join ( s . split ( ' > ' ) ) s = \" \" . join ( s . split ( ' < ' ) ) a = [ ] i = 0 tab = 0 ws = ' ▁ ' while i < len ( s ) : if s [ i ] != ' / ' : a . append ( ws * tab + ' < ' + s [ i ] + ' > ' ) tab += 2 i += 1 if s [ i ] == ' / ' : tab -= 2 a . append ( ws * tab + ' < / ' + s [ i + 1 ] + ' > ' ) i += 2 for i in a : print ( i ) NEW_LINE", "str_input = input ( ) queue = [ ] indentation = 0 while ( str_input != \" \" ) : if ( str_input [ 1 ] == ' / ' ) : print ( \" % s % s \" % ( indentation * \" ▁ \" , str_input [ 0 : 4 ] ) ) queue . pop ( ) str_input = str_input [ 4 : ] if ( str_input != \" \" and str_input [ 1 ] == \" / \" ) : indentation -= 2 else : print ( \" % s % s \" % ( indentation * \" ▁ \" , str_input [ 0 : 3 ] ) ) queue . append ( str_input [ 1 : 2 ] ) str_input = str_input [ 3 : ] if ( str_input != \" \" and str_input [ 0 : 3 ] != \" < / % s \" % ( queue [ - 1 ] ) ) : indentation += 2 NEW_LINE", "s = input ( ) . split ( ' < ' ) [ 1 : ] level = - 1 arr = set ( ) f = Falsefor i in s : f = False if i [ 0 ] != ' / ' : f = True Β  if f : level += 1 print ( \" ▁ \" * ( 2 * level ) + ' < ' + i ) if not f : level -= 1 NEW_LINE" ]
codeforces_92_B
[ "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 ( ) ; char [ ] arr = sr . toCharArray ( ) ; int i = sr . length ( ) - 1 ; int count = 0 ; while ( i > 0 ) { if ( arr [ i ] == '0' ) { count ++ ; } else { int j = i - 1 ; while ( j >= 0 && arr [ j ] != '0' ) { arr [ j ] = '0' ; j -- ; } count = count + 2 ; if ( j >= 0 ) arr [ j ] = 1 ; else { count += i ; System . out . println ( count ) ; return ; } } i -- ; } if ( arr [ 0 ] == '0' ) count ++ ; System . out . println ( count ) ; } }", "import java . util . * ; import java . io . * ; public class Binary_Number { 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 carry = 0 ; char a [ ] = br . readLine ( ) . trim ( ) . toCharArray ( ) ; long ans = 0 ; int n = a . length ; for ( int i = n - 1 ; i > 0 ; i -- ) { int val = Integer . parseInt ( \" \" + a [ i ] ) + carry ; if ( val == 2 ) { ans ++ ; carry = 1 ; } else if ( val == 1 ) { ans += 2 ; carry = 1 ; } else { ans ++ ; } } int val = Integer . parseInt ( \" \" + a [ 0 ] ) + carry ; if ( val == 2 ) ans ++ ; pw . println ( ans ) ; } pw . flush ( ) ; } }", "import java . util . Scanner ; public class BinaryNumber { static public void print ( String s ) { int rem = 0 ; int count = 0 ; for ( int i = s . length ( ) - 1 ; i >= 1 ; i -- ) { int x = s . charAt ( i ) - '0' ; int y = x + rem ; if ( y % 2 == 0 ) { count = count + 1 ; } else { count = count + 2 ; } if ( y != 0 ) { rem = 1 ; } else { rem = 0 ; } } System . out . print ( count + rem ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; print ( s ) ; } }" ]
[ "s = list ( input ( ) [ : : - 1 ] ) NEW_LINE i = 0 NEW_LINE l = len ( s ) NEW_LINE carry = False NEW_LINE c = 0 NEW_LINE if s . count ( '1' ) == 1 : NEW_LINE INDENT print ( l - 1 ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT while i < l : NEW_LINE INDENT if s [ i ] == '1' : NEW_LINE INDENT if not carry : NEW_LINE INDENT c += 2 NEW_LINE i += 1 NEW_LINE carry = True NEW_LINE DEDENT else : NEW_LINE INDENT s [ i ] = '0' NEW_LINE c += 1 NEW_LINE i += 1 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if carry : NEW_LINE INDENT s [ i ] = '1' NEW_LINE carry = False NEW_LINE DEDENT else : NEW_LINE INDENT c += 1 NEW_LINE i += 1 NEW_LINE DEDENT DEDENT DEDENT print ( c ) NEW_LINE", "s = list ( input ( ) ) NEW_LINE n = len ( s ) - 1 NEW_LINE ans = 0 NEW_LINE while s [ n ] != '1' : NEW_LINE INDENT ans += 1 NEW_LINE n -= 1 NEW_LINE DEDENT if n == 0 : NEW_LINE INDENT print ( ans ) NEW_LINE exit ( ) NEW_LINE DEDENT counter = 0 NEW_LINE while n >= 0 : NEW_LINE INDENT if s [ n ] != '0' : NEW_LINE INDENT counter += 1 NEW_LINE n -= 1 NEW_LINE continue NEW_LINE DEDENT ans += ( counter + 1 ) NEW_LINE s [ n ] = '1' NEW_LINE counter = 0 NEW_LINE DEDENT ans += counter + 1 NEW_LINE print ( ans ) NEW_LINE", "a = input ( ) [ : : - 1 ] . replace ( ' ' , ' ▁ ' ) . split ( ) NEW_LINE z = len ( a ) - 1 NEW_LINE ans = 0 NEW_LINE i = 0 NEW_LINE while i < z : NEW_LINE INDENT if a [ i ] == '0' : NEW_LINE INDENT while i < z and a [ i ] == '0' : i += 1 ; ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans += 1 NEW_LINE while i < z and a [ i ] == '1' : i += 1 ; ans += 1 NEW_LINE if i == z : ans += 1 NEW_LINE a [ i ] = '1' NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE", "import sys NEW_LINE from array import array NEW_LINE def input ( ) : NEW_LINE INDENT return sys . stdin . buffer . readline ( ) . decode ( ' utf - 8' ) NEW_LINE DEDENT x = list ( map ( int , input ( ) . rstrip ( ) ) ) NEW_LINE y = 0 NEW_LINE ans = 0 NEW_LINE while len ( x ) > 1 : NEW_LINE INDENT if x [ - 1 ] ^ y == 1 : NEW_LINE INDENT y = 1 NEW_LINE ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT y = ( x [ - 1 ] + y ) >> 1 NEW_LINE DEDENT ans += 1 NEW_LINE x . pop ( ) NEW_LINE DEDENT if y == 1 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT print ( ans ) NEW_LINE" ]
codeforces_698_A
[ "import java . util . Scanner ; public class GymContest { static int [ ] [ ] mem ; public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; mem = new int [ n ] [ 3 ] ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = s . nextInt ( ) ; System . out . println ( dp ( arr , 0 , 0 ) ) ;", "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 Newbie { Β  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 . util . * ; Β  public class Test { Β  static Scanner sc ; static Map < String , Integer > dp ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; dp = new HashMap < > ( ) ; int t = 1 ; while ( t -- > 0 ) solve ( ) ; } Β  static void solve ( ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; Β  for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; Β  int ans = 0 ; ans = rest ( 0 , 0 , arr ) ; Β  System . out . println ( ans ) ; Β  } Β  static int rest ( int pvs , int curr_ind , int [ ] arr ) { int ans = 0 ; Β  if ( curr_ind >= arr . length ) return ans ; Β  String key = pvs + \" - \" + curr_ind ; if ( dp . containsKey ( key ) ) return dp . get ( key ) ; Β  if ( arr [ curr_ind ] == 0 ) { ans = rest ( 0 , curr_ind + 1 , arr ) + 1 ; } else if ( arr [ curr_ind ] == 3 ) { if ( pvs == 1 ) { ans = Math . min ( 1 + rest ( 0 , curr_ind + 1 , arr ) , rest ( 2 , curr_ind + 1 , arr ) ) ; } else if ( pvs == 2 ) ans = Math . min ( rest ( 1 , curr_ind + 1 , arr ) , 1 + rest ( 0 , curr_ind + 1 , arr ) ) ; else ans = Math . min ( rest ( 1 , curr_ind + 1 , arr ) , rest ( 2 , curr_ind + 1 , arr ) ) ; Β  } else { if ( pvs == arr [ curr_ind ] ) ans = 1 + rest ( 0 , curr_ind + 1 , arr ) ; else ans = rest ( arr [ curr_ind ] , curr_ind + 1 , arr ) ; } Β  dp . put ( key , ans ) ; Β  return ans ; Β  } }" ]
[ "def answer ( n , a ) : num_rest = 0 if a [ 0 ] == 0 : num_rest += 1 NEW_LINE", "n = int ( input ( ) ) dp = [ [ 0 for i in range ( 3 ) ] for j in range ( n + 1 ) ] ar = tuple ( map ( str , input ( ) . split ( ) ) ) for i in range ( 1 , n + 1 ) : x = ar [ i - 1 ] dp [ i ] [ 0 ] = min ( dp [ i - 1 ] ) + 1 if ( x == '1' or x == '3' ) : dp [ i ] [ 1 ] = min ( dp [ i - 1 ] [ 0 ] , dp [ i - 1 ] [ 2 ] ) else : dp [ i ] [ 1 ] = dp [ i - 1 ] [ 1 ] + 1 if ( x == '2' or x == '3' ) : dp [ i ] [ 2 ] = min ( dp [ i - 1 ] [ 0 ] , dp [ i - 1 ] [ 1 ] ) else : dp [ i ] [ 2 ] = dp [ i - 1 ] [ 2 ] + 1 print ( min ( dp [ - 1 ] ) ) NEW_LINE", "n = int ( input ( ) ) * a , = map ( int , input ( ) . split ( ) ) if a [ 0 ] != 3 : dp = [ a [ 0 ] ] + [ 0 ] * ( n - 1 ) else : dp = [ - 1 ] + [ 0 ] * ( n - 1 ) for i in range ( 1 , n ) : if a [ i ] == 0 : dp [ i ] = a [ i ] elif a [ i ] == 1 : if dp [ i - 1 ] != 1 : dp [ i ] = 1 elif a [ i ] == 2 : if dp [ i - 1 ] != 2 : dp [ i ] = 2 else : if dp [ i - 1 ] == 1 : dp [ i ] = 2 elif dp [ i - 1 ] == 2 : dp [ i ] = 1 else : dp [ i ] = - 1 print ( dp . count ( 0 ) ) NEW_LINE", "n = int ( input ( ) ) Β  day = list ( map ( int , input ( ) . split ( ) ) ) Β  inf = 10 ** 20 dp = [ [ inf for _ in range ( 3 ) ] for _ in range ( n + 5 ) ] Β  NEW_LINE" ]
codeforces_748_B
[ "import java . util . Scanner ; Β  public class Main { Β  public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String str1 = in . next ( ) ; String str2 = in . next ( ) ; char c1 , c2 ; int a1 , a2 ; int ansSum = 0 ; int arr [ ] = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { arr [ i ] = - 1 ; } in . close ( ) ; for ( int i = 0 ; i < str1 . length ( ) ; i ++ ) { c1 = str1 . charAt ( i ) ; c2 = str2 . charAt ( i ) ; a1 = ( int ) c1 - 97 ; a2 = ( int ) c2 - 97 ; if ( ( arr [ a2 ] != a1 || arr [ a1 ] != a2 ) && ( arr [ a1 ] != - 1 || arr [ a2 ] != - 1 ) ) { System . out . println ( - 1 ) ; return ; } else if ( a1 == a2 ) { arr [ a1 ] = a1 ; } else if ( arr [ a1 ] == - 1 && arr [ a2 ] == - 1 ) { arr [ a1 ] = a2 ; arr [ a2 ] = a1 ; ansSum ++ ; } } System . out . println ( ansSum ) ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( arr [ i ] != - 1 && arr [ i ] != arr [ arr [ i ] ] ) { System . out . println ( ( char ) ( arr [ i ] + 97 ) + \" ▁ \" + ( char ) ( arr [ arr [ i ] ] + 97 ) ) ; arr [ arr [ i ] ] = - 1 ; arr [ i ] = - 1 ; } } } Β  } Β ", "import java . io . * ; import java . math . BigInteger ; import java . util . * ; Β  public class icpc { public static void main ( String [ ] args ) throws IOException {", "import java . io . * ; import java . util . * ; Β  public class A { Β  static final boolean stdin = true ; static final String filename = \" \" ; static FastScanner br ; static PrintWriter pw ; Β  public static void main ( String [ ] args ) throws IOException { Β  if ( stdin ) { br = new FastScanner ( ) ; pw = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; } else { br = new FastScanner ( filename + \" . in \" ) ; pw = new PrintWriter ( new FileWriter ( filename + \" . out \" ) ) ; } Β  Solver solver = new Solver ( ) ; solver . solve ( br , pw ) ; } Β  static class Solver { public void solve ( FastScanner br , PrintWriter pw ) throws IOException { char [ ] a = br . nextToken ( ) . toCharArray ( ) , b = br . nextToken ( ) . toCharArray ( ) ; int c = a . length ; boolean poss = true ; ArrayList < Character > d = new ArrayList < Character > ( ) ; for ( int i = 0 ; i < c ; i ++ ) { if ( a [ i ] != b [ i ] ) { if ( d . contains ( a [ i ] ) || d . contains ( b [ i ] ) ) { poss = false ; break ; } d . add ( a [ i ] ) ; d . add ( b [ i ] ) ; for ( int j = 0 ; j < c ; j ++ ) { if ( b [ j ] == d . get ( d . size ( ) - 1 ) ) { b [ j ] = d . get ( d . size ( ) - 2 ) ; } else if ( b [ j ] == d . get ( d . size ( ) - 2 ) ) { b [ j ] = d . get ( d . size ( ) - 1 ) ; } } }" ]
[ "first = input ( ) . strip ( ) second = input ( ) . strip ( ) mapping = dict ( ) printed = Falsefor i , letter in enumerate ( first ) : if letter == second [ i ] : mapping [ letter ] = second [ i ] else : if mapping . get ( letter ) : if mapping . get ( letter ) != second [ i ] : printed = True print ( - 1 ) break else : if first . count ( letter ) == second . count ( second [ i ] ) : mapping [ letter ] = second [ i ] else : printed = True print ( - 1 ) breakanswers = dict ( ) for k , v in mapping . items ( ) : if answers . get ( v ) : if mapping . get ( v ) == k : continue else : printed = True print ( - 1 ) break else : if k != v : answers [ k ] = v Β  if not printed : print ( len ( answers ) ) for k , v in answers . items ( ) : print ( k , v ) NEW_LINE", "def fun ( s1 , s2 ) : if s1 == s2 : return 0 , [ ] d = { } rep = set ( ) ans = [ ] for k in range ( len ( s1 ) ) : if s1 [ k ] != s2 [ k ] : if s1 [ k ] in d and d [ s1 [ k ] ] != s2 [ k ] or s2 [ k ] in d and d [ s2 [ k ] ] != s1 [ k ] : return - 1 , [ ] if s1 [ k ] in rep or s2 [ k ] in rep : return - 1 , [ ] if s1 [ k ] not in d : ans . append ( s1 [ k ] + s2 [ k ] ) d [ s1 [ k ] ] = s2 [ k ] d [ s2 [ k ] ] = s1 [ k ] else : if s1 [ k ] in d : return - 1 , [ ] rep . add ( s1 [ k ] ) return len ( ans ) , ans s1 = input ( ) s2 = input ( ) ans , changes = fun ( s1 , s2 ) if ans < 1 : print ( ans ) else : print ( ans ) for k in range ( ans ) : print ( changes [ k ] [ 0 ] , changes [ k ] [ 1 ] ) NEW_LINE", "import syss = input ( ) t = input ( ) st1 = [ ] st2 = [ ] checked = [ ] right = [ ] for i in range ( len ( s ) ) : if s [ i ] in checked and t [ i ] not in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in checked and t [ i ] in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right and t [ i ] not in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in right and t [ i ] in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in st1 and s [ i ] not in st2 : if t [ i ] not in st1 and t [ i ] not in st2 : if s [ i ] != t [ i ] : checked . append ( s [ i ] ) checked . append ( t [ i ] ) st1 . append ( s [ i ] ) st2 . append ( t [ i ] ) else : right . append ( s [ i ] ) right . append ( t [ i ] ) if s [ i ] == t [ i ] : if s [ i ] in st1 or s [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) elif t [ i ] in st1 or t [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) if s [ i ] in st2 : if st1 [ st2 . index ( s [ i ] ) ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right or t [ i ] in right : if s [ i ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) print ( len ( st1 ) ) for i in range ( len ( st1 ) ) : print ( st1 [ i ] , end = \" ▁ \" ) print ( st2 [ i ] ) NEW_LINE", "import syss = input ( ) t = input ( ) st1 = [ ] st2 = [ ] checked = [ ] right = [ ] for i in range ( len ( s ) ) : a = [ ] if s [ i ] in checked and t [ i ] not in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in checked and t [ i ] in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right and t [ i ] not in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in right and t [ i ] in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in st1 and s [ i ] not in st2 : if t [ i ] not in st1 and t [ i ] not in st2 : if s [ i ] != t [ i ] : checked . append ( s [ i ] ) checked . append ( t [ i ] ) st1 . append ( s [ i ] ) st2 . append ( t [ i ] ) else : right . append ( s [ i ] ) right . append ( t [ i ] ) if s [ i ] == t [ i ] : if s [ i ] in st1 or s [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) elif t [ i ] in st1 or t [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) if s [ i ] in st2 : if st1 [ st2 . index ( s [ i ] ) ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right or t [ i ] in right : if s [ i ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) print ( len ( st1 ) ) for i in range ( len ( st1 ) ) : print ( st1 [ i ] , end = \" ▁ \" ) print ( st2 [ i ] ) NEW_LINE", "import sys Β  string1 = input ( ) string2 = input ( ) st1 = [ ] st2 = [ ] checked = [ ] right = [ ] for i in range ( len ( string1 ) ) : a = [ ] if string1 [ i ] in checked and string2 [ i ] not in checked : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] not in checked and string2 [ i ] in checked : print ( ' - 1' ) sys . exit ( ) Β  if string1 [ i ] in right and string2 [ i ] not in right : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] not in right and string2 [ i ] in right : print ( ' - 1' ) sys . exit ( ) Β  if string1 [ i ] not in st1 and string1 [ i ] not in st2 : if string2 [ i ] not in st1 and string2 [ i ] not in st2 : if string1 [ i ] != string2 [ i ] : checked . append ( string1 [ i ] ) checked . append ( string2 [ i ] ) st1 . append ( string1 [ i ] ) st2 . append ( string2 [ i ] ) else : right . append ( string1 [ i ] ) right . append ( string2 [ i ] ) if string1 [ i ] == string2 [ i ] : if string1 [ i ] in st1 or string1 [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) elif string2 [ i ] in st1 or string2 [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] in st2 : if st1 [ st2 . index ( string1 [ i ] ) ] != string2 [ i ] : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] in right or string2 [ i ] in right : if string1 [ i ] != string2 [ i ] : print ( ' - 1' ) sys . exit ( ) print ( len ( st1 ) ) for i in range ( len ( st1 ) ) : print ( st1 [ i ] , end = \" ▁ \" ) print ( st2 [ i ] ) NEW_LINE" ]
codeforces_479_B
[ "import java . util . * ; Β  public class CodeForces698 { Β  public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;", "import java . io . BufferedReader ; import java . io . * ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; Β  public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } Β  String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } Β  double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } Β  String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 1 ;", "import java . io . * ; import java . util . * ; Β  public class Dpairs { Β  public static void main ( String [ ] args ) throws IOException { BufferedReader ob = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuffer sb = new StringBuffer ( ) ; String s [ ] = ob . readLine ( ) . split ( \" ▁ \" ) ; int n = Integer . parseInt ( s [ 0 ] ) ; int k = Integer . parseInt ( s [ 1 ] ) ; int cpy = 0 ; String str [ ] = ob . readLine ( ) . split ( \" ▁ \" ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parseInt ( str [ i ] ) ;", "import java . io . BufferedReader ; import java . io . * ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 1 ;" ]
[ "n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) diff = max ( l ) - min ( l ) if diff == 0 : print ( 0 , 0 ) elif diff == 1 : print ( 1 , 0 ) else : s = 0 ans = [ ] while ( s < k ) : x = l . index ( min ( l ) ) y = l . index ( max ( l ) ) if max ( l ) - min ( l ) <= 1 : break else : Β  s += 1 l [ x ] += 1 l [ y ] -= 1 ans . append ( [ y + 1 , x + 1 ] ) print ( max ( l ) - min ( l ) , s ) for i in range ( len ( ans ) ) : print ( * ans [ i ] ) NEW_LINE", "towers , operationsNum = map ( int , input ( ) . split ( ) ) towersHeights = list ( map ( int , input ( ) . split ( ) ) ) changes = [ ] for i in range ( operationsNum ) : minH , maxH = min ( towersHeights ) , max ( towersHeights ) instability = max ( towersHeights ) - min ( towersHeights ) minindex , maxindex = towersHeights . index ( minH ) , towersHeights . index ( maxH ) if instability != 0 : changes . append ( str ( maxindex + 1 ) + \" ▁ \" + str ( minindex + 1 ) ) towersHeights [ minindex ] += 1 towersHeights [ maxindex ] -= 1 print ( max ( towersHeights ) - min ( towersHeights ) , len ( changes ) ) for i in changes : print ( i ) NEW_LINE", "''' ▁ ▁ ▁ ▁ Problem ▁ Link ▁ https : / / codeforces . com / contest / 479 / problem / B ''' Β  n , k = map ( int , input ( ) . split ( ) ) towers = list ( map ( int , input ( ) . split ( ) ) ) Β  def get_min_max_indices ( ) : tmp = towers [ 0 ] max_index = 0 min_index = 0 for i in range ( 1 , len ( towers ) ) : if ( towers [ i ] > towers [ max_index ] ) : max_index = i if ( towers [ i ] < towers [ min_index ] ) : min_index = i return min_index , max_index Β  tracks = [ ] for i in range ( k ) : min_index , max_index = get_min_max_indices ( ) if ( towers [ min_index ] == towers [ max_index ] ) : break towers [ max_index ] -= 1 towers [ min_index ] += 1 tracks . append ( [ max_index + 1 , min_index + 1 ] ) Β  lowest_point , highest_point = get_min_max_indices ( ) print ( towers [ highest_point ] - towers [ lowest_point ] , len ( tracks ) ) Β  for record in tracks : print ( * record ) NEW_LINE", "numOfTowers , numOfOperations = map ( int , input ( ) . split ( ) ) heights = list ( map ( int , input ( ) . split ( ) ) ) l = [ ] for i in range ( numOfOperations ) : max_index = heights . index ( max ( heights ) ) min_index = heights . index ( min ( heights ) ) Β  if min_index != max_index : heights [ max_index ] -= 1 heights [ min_index ] += 1 l . append ( [ max_index + 1 , min_index + 1 ] ) Β  print ( max ( heights ) - min ( heights ) , len ( l ) ) for j in l : print ( ' ▁ ' . join ( map ( str , j ) ) ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) Β  heights = list ( map ( int , input ( ) . split ( ) ) ) stabilities = [ max ( heights ) - min ( heights ) ] pos = [ ( 0 , 0 ) ] Β  for i in range ( k ) : higher = heights . index ( max ( heights ) ) lower = heights . index ( min ( heights ) ) heights [ higher ] -= 1 heights [ lower ] += 1 stabilities . append ( max ( heights ) - min ( heights ) ) pos . append ( ( higher + 1 , lower + 1 ) ) Β  smallest = min ( stabilities ) operations = stabilities . index ( smallest ) Β  print ( smallest , operations ) for i in range ( operations ) : print ( * pos [ i + 1 ] ) NEW_LINE" ]
codeforces_110_A
[ "import java . util . * ; Β  public class Q4 { Β  public static void main ( String [ ] args ) {", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; Β  public class A_Nearly_Lucky_Number { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; char [ ] s = fs . next ( ) . toCharArray ( ) ; Β  int lucky = 0 ; for ( char c : s ) { if ( c == '4' || c == '7' ) { lucky ++ ; } } Β  System . out . println ( ( lucky == 4 || lucky == 7 ) ? \" YES \" : \" NO \" ) ; } Β  static int min ( int a , int b ) { return Math . min ( a , b ) ; } Β  static int max ( int a , int b ) { return Math . max ( a , b ) ; } Β  static long min ( long a , long b ) { return Math . min ( a , b ) ; } Β  static long max ( long a , long b ) { return Math . max ( a , b ) ; } Β  static class FastScanner { BufferedReader br ; StringTokenizer st ; Β  public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } Β  String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } char nextChar ( ) { return next ( ) . charAt ( 0 ) ; } Β  String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }", "import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = ( br . readLine ( ) ) ; int c = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '4' || s . charAt ( i ) == '7' ) { c ++ ; } } if ( c == 4 || c == 7 ) { System . out . println ( \" YES \" ) ; } else { System . out . println ( \" NO \" ) ; } } }", "import java . io . * ; import java . util . Scanner ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; if ( System . getProperty ( \" ONLINE _ JUDGE \" ) == null ) { try { System . setOut ( new PrintStream ( new FileOutputStream ( \" output . txt \" ) ) ) ; sc = new Scanner ( new File ( \" input . txt \" ) ) ; } catch ( Exception e ) { } }" ]
[ "n = int ( input ( ) ) m = 0 while n > 0 : d = n % 10 if d == 4 or d == 7 : m += 1 n = n // 10 if m == 4 or m == 7 : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "n = input ( ) k = n . count ( '4' ) + n . count ( '7' ) if k == 4 or k == 7 : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "n = input ( ) c = 0 for i in n : if ( i == '4' or i == '7' ) : c += 1 if ( c == 4 or c == 7 ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE", "print ( \" NYOE ▁ S \" [ sum ( i in '47' for i in input ( ) ) in ( 4 , 7 ) : : 2 ] ) NEW_LINE" ]
codeforces_190_A
[ "import java . util . Scanner ; Β  public class StupidBusPrice { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Β  int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; Β  if ( n == 0 ) { if ( m == 0 ) System . out . println ( \"0 ▁ 0\" ) ; else System . out . println ( \" Impossible \" ) ; return ; } Β  if ( m > n ) { System . out . print ( m + \" ▁ \" ) ; System . out . println ( n + m - 1 ) ; } else { System . out . print ( n + \" ▁ \" ) ; if ( m > 1 ) System . out . println ( n + m - 1 ) ; else System . out . println ( n ) ; } } }", "import java . util . * ; Β Β  public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ;", "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 ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( n == 0 && m > 0 ) System . out . println ( \" Impossible \" ) ; else if ( m == 0 ) { System . out . println ( n + \" ▁ \" + n ) ; } else { int max = 0 , min = n * m ; if ( n >= m ) { min = n ; max = ( n - 1 ) + m ; } else { min = m ; max = n - 1 + m ; } System . out . println ( min + \" ▁ \" + max ) ; } } Β  }" ]
[ "arr = list ( map ( int , input ( ) . split ( ) ) ) n = arr [ 0 ] m = arr [ 1 ] if ( n == 0 and m > 0 ) : print ( \" Impossible \" ) else : a = max ( m , n ) b = m + n - 1 if ( m == 0 ) : b = n a = n print ( str ( a ) + \" ▁ \" + str ( b ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) if m == 0 : print ( n , n ) elif n == 0 : print ( ' Impossible ' ) else : print ( max ( n , m ) , n + m - 1 ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) Β  if n == 0 : if m == 0 : print ( '0 ▁ 0' ) else : print ( ' Impossible ' ) Β  else : if m == 0 : print ( str ( n ) + ' ▁ ' + str ( n ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) if n == 0 : if m == 0 : print ( 0 , 0 ) else : print ( \" Impossible \" ) else : print ( n + max ( 0 , m - n ) , n + max ( 0 , m - 1 ) ) NEW_LINE" ]
codeforces_914_A
[ "import java . util . Scanner ; public class Main { public static boolean notSqr ( int num ) { return ( num < 0 ) ? true : Math . sqrt ( num ) > ( int ) Math . sqrt ( num ) ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) , i , k = - 1 ; int [ ] a = new int [ 1000 ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; if ( notSqr ( a [ i ] ) ) k = ( k == - 1 ) ? i : ( ( a [ i ] > a [ k ] ) ? i : k ) ; } System . out . println ( a [ k ] ) ; } }", "import java . util . Scanner ; public class Main { public static boolean notSqr ( int num ) { return ( num < 0 ) ? true : Math . sqrt ( num ) > ( int ) Math . sqrt ( num ) ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) , i , k = - 1 ; int [ ] a = new int [ 1000 ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; if ( notSqr ( a [ i ] ) ) k = ( k == - 1 ) ? i : ( ( a [ i ] > a [ k ] ) ? i : k ) ; } System . out . println ( a [ k ] ) ; } }", "import java . util . * ; Β Β  public class Main { Β  public static void main ( String [ ] args ) {", "import java . util . Arrays ; import java . util . Scanner ; Β  public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] nums = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { nums [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( nums ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( ( Math . sqrt ( nums [ i ] ) % 1 ) != 0 ) { System . out . println ( nums [ i ] ) ; break ; } } } }", "import java . util . * ; public class PerfectSquare { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int max = - ( int ) Math . pow ( 10 , 6 ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( ! isPerfect ( a [ i ] ) ) { if ( a [ i ] > max ) { max = a [ i ] ; } } } System . out . println ( max ) ; } static boolean isPerfect ( int n ) { double b = Math . sqrt ( n ) ; if ( b == ( int ) b ) return true ; else return false ; } }" ]
[ "import math Β  n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) mx = - 10000000 for num in l : if ( num < 0 ) : mx = max ( mx , num ) else : k = int ( math . sqrt ( num ) ) if ( k * k < num ) : mx = max ( mx , num ) print ( mx ) NEW_LINE", "import mathn = int ( input ( ) ) s = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) s . sort ( reverse = True ) for i in s : if i >= 0 : t = math . sqrt ( i ) if t != int ( t ) : print ( i ) break else : print ( i ) break NEW_LINE", "import mathdef check ( x ) : y = int ( math . sqrt ( x ) ) if ( x == y * y ) : return False return Truen = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) for i in range ( n - 1 , - 1 , - 1 ) : if ( a [ i ] < 0 or check ( a [ i ] ) ) : print ( a [ i ] ) break NEW_LINE", "num = int ( input ( ) ) arr = sorted ( map ( int , input ( ) . split ( ) ) ) Β  Β  for n in arr : if n < 0 : ans = n else : x = int ( n ** 0.5 ) if n != x * x : ans = n Β  print ( ans ) Β  Β  NEW_LINE", "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) mx = - 10000000 for num in l : if ( num < 0 ) : mx = max ( mx , num ) beg = 0 end = 1000 while ( beg <= end ) : mid = beg + ( end - beg ) // 2 if ( mid * mid <= num ) : beg = mid + 1 else : end = mid - 1 if ( end * end < num ) : mx = max ( mx , num ) print ( mx ) NEW_LINE" ]
codeforces_939_A
[ "import java . util . Scanner ; Β  public class LoveTriangle { Β  public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int planesNumber = sc . nextInt ( ) ; Β  sc . nextLine ( ) ;", "import java . util . Scanner ; Β  public class Problem25 { Β  public static void main ( String [ ] args ) {", "import java . util . * ; Β Β  public class Triangle { Β  static class Edge { int v , u ; public Edge ( int v , int u ) { this . v = v ; this . u = u ; } } public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int [ ] [ ] adj = new int [ n ] [ n ] ; LinkedList < Edge > edges = new LinkedList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int v = scn . nextInt ( ) - 1 ; adj [ i ] [ v ] = 1 ; adj [ v ] [ i ] = 1 ; edges . add ( new Edge ( i , v ) ) ; } for ( Edge e : edges ) for ( int i = 0 ; i < n ; i ++ ) if ( adj [ i ] [ e . v ] == 1 && adj [ i ] [ e . u ] == 1 ) { System . out . println ( \" YES \" ) ; return ; } System . out . println ( \" NO \" ) ; } }" ]
[ "n = int ( input ( ) ) f = [ 1 ] + list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 1 , n + 1 ) : if f [ f [ f [ i ] ] ] == i : print ( ' Yes ' ) breakelse : print ( ' No ' ) NEW_LINE", "import sys Β  stdin = sys . stdininf = 1 << 60 mod = 1000000007 eps = 1e-10 Β  sys . setrecursionlimit ( 10 ** 7 ) Β  ni = lambda : int ( ns ( ) ) nin = lambda y : [ ni ( ) for _ in range ( y ) ] na = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) nan = lambda y : [ na ( ) for _ in range ( y ) ] ns = lambda : stdin . readline ( ) . rstrip ( ) nsn = lambda y : [ ns ( ) for _ in range ( y ) ] nas = lambda : stdin . readline ( ) . split ( ) Β  n = ni ( ) a = list ( map ( lambda x : x - 1 , na ( ) ) ) Β  ok = Falsefor i in range ( n ) : A = i B = a [ A ] C = a [ B ] if A != B and B != C and A != C and a [ C ] == A : ok = True Β  if ok : print ( \" YES \" ) else : print ( \" NO \" ) NEW_LINE", "n = int ( input ( ) ) f = [ 1 ] + list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 1 , n + 1 ) : if f [ f [ f [ i ] ] ] == i : print ( ' Yes ' ) breakelse : print ( ' No ' ) NEW_LINE", "n = int ( input ( ) ) l = [ ] a = ( input ( ) . split ( \" ▁ \" ) ) NEW_LINE" ]
codeforces_990_B
[ "import java . util . * ; Β  public class CodeForces990B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) , k = input . nextInt ( ) ; int ans = 0 ; List < Integer > list = new ArrayList < > ( ) ; int [ ] count = new int [ 1000000 * 4 ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = input . nextInt ( ) ; list . add ( x ) ; count [ x ] ++ ; } Collections . sort ( list ) ; for ( int i = n - 1 ; i >= 1 ; i -- ) { if ( list . get ( i ) > list . get ( i - 1 ) && list . get ( i ) <= list . get ( i - 1 ) + k ) ans += count [ list . get ( i - 1 ) ] ; } System . out . println ( n - ans ) ; } }", "import com . sun . security . jgss . GSSUtil ; Β  import javax . swing . table . AbstractTableModel ; import java . io . * ; import java . util . * ; import java . util . concurrent . atomic . AtomicReferenceFieldUpdater ; Β ", "import java . 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 ) { int t = 1 ;" ]
[ "n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) a = 0 i = 0 while i < ( n - 1 ) : j = i + 1 while j < n and l [ j ] == l [ i ] : j += 1 if j == n : break else : if l [ j ] <= l [ i ] + k : a += ( j - i ) i = jprint ( n - a ) NEW_LINE", "n , K = map ( int , input ( ) . split ( ) ) b = sorted ( [ int ( x ) for x in input ( ) . split ( ) ] ) l = cur = 0 for i in range ( 1 , n ) : if b [ i ] == b [ i - 1 ] : continue if b [ i ] > b [ i - 1 ] + K : l = i else : cur += ( i - l ) ; l = iprint ( n - cur ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) j = 0 a . sort ( ) n1 = nfor i in range ( n ) : while a [ j ] < a [ i ] : if a [ i ] <= a [ j ] + k : n1 -= 1 j += 1 print ( n1 ) NEW_LINE", "n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) slow , fast = 0 , 0 while fast < n : if a [ slow ] == a [ fast ] : fast += 1 elif abs ( a [ slow ] - a [ fast ] ) <= k : a [ slow ] = 0 slow += 1 else : slow += 1 ans = 0 for i in a : if i != 0 : ans += 1 print ( ans ) NEW_LINE" ]
codeforces_1162_B
[ "import java . util . * ; public class contest10 { static Scanner scn = new Scanner ( System . in ) ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; Β  public class Codeforces { Β  private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ; Β  public static int [ ] LPS ( String p ) { int [ ] lps = new int [ p . length ( ) ] ; Β  int i = 1 ; int j = 0 ; while ( i < p . length ( ) ) { if ( p . charAt ( i ) == p . charAt ( j ) ) { lps [ i ] = j + 1 ; i ++ ; j ++ ; } else { if ( j == 0 ) { lps [ i ] = 0 ; i ++ ; } else { j = lps [ j - 1 ] ; } } } return lps ; } Β  public static void KMP ( String text , String pattern ) { int [ ] lps = LPS ( pattern ) ; int i = 0 ; int j = 0 ; ArrayList < Integer > matches = new ArrayList < > ( ) ; while ( i < text . length ( ) ) { if ( text . charAt ( i ) == pattern . charAt ( j ) ) { i ++ ; j ++ ; } else { if ( j != 0 ) { j = lps [ j - 1 ] ; } else { i ++ ; } } if ( j == pattern . length ( ) ) { matches . add ( i - j ) ; j = lps [ j - 1 ] ; } } for ( int x : matches ) { System . out . println ( \" Match ▁ at ▁ : ▁ \" + x ) ; } } Β  private static class SegmentTree { private long [ ] st ; private int size ; private int n ; private long [ ] a ; SegmentTree ( long [ ] a , int n ) { this . size = 4 * n ; this . n = n ; this . a = a ; st = new long [ size ] ;", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; Β  public class Codeforces { Β  private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ; Β  public static int [ ] LPS ( String p ) { int [ ] lps = new int [ p . length ( ) ] ; Β  int i = 1 ; int j = 0 ; while ( i < p . length ( ) ) { if ( p . charAt ( i ) == p . charAt ( j ) ) { lps [ i ] = j + 1 ; i ++ ; j ++ ; } else { if ( j == 0 ) { lps [ i ] = 0 ; i ++ ; } else { j = lps [ j - 1 ] ; } } } return lps ; } Β  public static void KMP ( String text , String pattern ) { int [ ] lps = LPS ( pattern ) ; int i = 0 ; int j = 0 ; ArrayList < Integer > matches = new ArrayList < > ( ) ; while ( i < text . length ( ) ) { if ( text . charAt ( i ) == pattern . charAt ( j ) ) { i ++ ; j ++ ; } else { if ( j != 0 ) { j = lps [ j - 1 ] ; } else { i ++ ; } } if ( j == pattern . length ( ) ) { matches . add ( i - j ) ; j = lps [ j - 1 ] ; } } for ( int x : matches ) { System . out . println ( \" Match ▁ at ▁ : ▁ \" + x ) ; } } Β  private static class SegmentTree { private long [ ] st ; private int size ; private int n ; private long [ ] a ; SegmentTree ( long [ ] a , int n ) { this . size = 4 * n ; this . n = n ; this . a = a ; st = new long [ size ] ;", "import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; Β  public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BDoubleMatrix solver = new BDoubleMatrix ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } Β  static class BDoubleMatrix { public void solve ( int testNumber , FastReader in , PrintWriter out ) { int n = in . nextInt ( ) , m = in . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] [ ] b = new int [ n ] [ m ] ; int [ ] [ ] min = new int [ n ] [ m ] ; int [ ] [ ] max = new int [ n ] [ m ] ; in . readArray ( a ) ; in . readArray ( b ) ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < m ; ++ j ) { min [ i ] [ j ] = Math . min ( a [ i ] [ j ] , b [ i ] [ j ] ) ; max [ i ] [ j ] = Math . max ( a [ i ] [ j ] , b [ i ] [ j ] ) ; } }" ]
[ "n , m = map ( int , input ( ) . split ( ) ) A = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] B = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] Β  X = [ [ 0 ] * m for i in range ( n ) ] Y = [ [ 0 ] * m for i in range ( n ) ] Β  for i in range ( n ) : for j in range ( m ) : X [ i ] [ j ] = min ( A [ i ] [ j ] , B [ i ] [ j ] ) Y [ i ] [ j ] = max ( A [ i ] [ j ] , B [ i ] [ j ] ) Β  NEW_LINE", "N , M = map ( int , input ( ) . split ( ) ) mat1 = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] mat2 = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] Β  ans = ' Possible ' for r in range ( N ) : for c in range ( M ) : bigger_v = max ( mat1 [ r ] [ c ] , mat2 [ r ] [ c ] ) smaller_v = min ( mat1 [ r ] [ c ] , mat2 [ r ] [ c ] ) if r > 0 : bigger_prev = max ( mat1 [ r - 1 ] [ c ] , mat2 [ r - 1 ] [ c ] ) smaller_prev = min ( mat1 [ r - 1 ] [ c ] , mat2 [ r - 1 ] [ c ] ) if not ( bigger_v > bigger_prev and smaller_v > smaller_prev ) : ans = ' Impossible ' break if c > 0 : bigger_prev = max ( mat1 [ r ] [ c - 1 ] , mat2 [ r ] [ c - 1 ] ) smaller_prev = min ( mat1 [ r ] [ c - 1 ] , mat2 [ r ] [ c - 1 ] ) if not ( bigger_v > bigger_prev and smaller_v > smaller_prev ) : NEW_LINE", "a , b = map ( int , input ( ) . split ( ) ) flag = 0 l1 = [ ] l2 = [ ] for i in range ( a * 2 ) : l3 = list ( map ( int , input ( ) . split ( ) ) ) if i < a : l1 . append ( l3 ) else : l2 . append ( l3 ) for x in range ( b ) : if l1 [ i - a ] [ x ] > l2 [ i - a ] [ x ] : l1 [ i - a ] [ x ] , l2 [ i - a ] [ x ] = l2 [ i - a ] [ x ] , l1 [ i - a ] [ x ] if x > 0 and ( l1 [ i - a ] [ x ] <= l1 [ i - a ] [ x - 1 ] or l2 [ i - a ] [ x ] <= l2 [ i - a ] [ x - 1 ] ) : flag = 1 if flag : print ( ' Impossible ' ) exit ( ) for x in range ( b ) : for i in range ( a - 1 ) : if l1 [ i ] [ x ] >= l1 [ i + 1 ] [ x ] or l2 [ i ] [ x ] >= l2 [ i + 1 ] [ x ] : print ( ' Impossible ' ) exit ( ) print ( ' Possible ' ) NEW_LINE", "def check ( a , n , m ) : for i in range ( n ) : Β  if ( sorted ( a [ i ] ) != a [ i ] or len ( a [ i ] ) != len ( set ( a [ i ] ) ) ) : return 0 Β  return 1 Β  n , m = map ( int , input ( ) . split ( ) ) a = [ ] b = [ ] a1 = [ ] b1 = [ ] for i in range ( m ) : a1 . append ( [ 0 ] * n ) b1 . append ( [ 0 ] * n ) for i in range ( n ) : l = [ int ( x ) for x in input ( ) . split ( ) ] a . append ( l ) for i in range ( n ) : l = [ int ( x ) for x in input ( ) . split ( ) ] b . append ( l ) Β  Β  for i in range ( n ) : for j in range ( m ) : x = a [ i ] [ j ] y = b [ i ] [ j ] a [ i ] [ j ] = min ( x , y ) b [ i ] [ j ] = max ( x , y ) Β  Β  for i in range ( n ) : for j in range ( m ) : a1 [ j ] [ i ] = a [ i ] [ j ] b1 [ j ] [ i ] = b [ i ] [ j ] Β  Β  if ( check ( a , n , m ) == 1 and check ( a1 , m , n ) == 1 and check ( b , n , m ) == 1 and check ( b1 , m , n ) == 1 ) : print ( \" Possible \" ) else : print ( \" Impossible \" ) NEW_LINE", "def inp ( ) : return map ( int , input ( ) . split ( ) ) Β  def check ( arr , n , m ) : for i in range ( n ) : for j in range ( 1 , m ) : if arr [ i ] [ j ] <= arr [ i ] [ j - 1 ] : return 1 for i in range ( m ) : for j in range ( 1 , n ) : if arr [ j ] [ i ] <= arr [ j - 1 ] [ i ] : return 1 return 0 Β  n , m = inp ( ) arr = [ ] for i in range ( n ) : arr . append ( list ( inp ( ) ) ) brr = [ ] for i in range ( n ) : brr . append ( list ( inp ( ) ) ) for i in range ( n ) : for j in range ( m ) : if arr [ i ] [ j ] > brr [ i ] [ j ] : x = arr [ i ] [ j ] arr [ i ] [ j ] = brr [ i ] [ j ] brr [ i ] [ j ] = xf = check ( arr , n , m ) | check ( brr , n , m ) if f == 1 : print ( \" Impossible \" ) else : print ( \" Possible \" ) NEW_LINE" ]
codeforces_172_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; Β  public class Main { Β  public static boolean check ( String Number , String Divi ) { for ( int i = 0 ; i <= 9 ; i ++ ) { String ch = i + \" \" ; if ( Number . contains ( ch ) && Divi . contains ( ch ) ) { return true ; } } return false ; } Β  public static void main ( String [ ] args ) throws IOException { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; String a [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . next ( ) ; } for ( int i = 0 ; i < a [ 0 ] . length ( ) ; i ++ ) { for ( int j = 0 ; j < n - 1 ; j ++ ) { if ( a [ j ] . charAt ( i ) != a [ j + 1 ] . charAt ( i ) ) { System . out . println ( i ) ; return ; } } } Β  } Β  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 ( ) ) ; } Β  double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } Β  }", "Β  import java . util . * ; import java . lang . * ; import java . io . * ; Β  public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sx = new Scanner ( System . in ) ; int n = sx . nextInt ( ) ; int i = 1 ; String s1 = sx . next ( ) ;", "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 { int N = ints ( ) ; String [ ] nums = new String [ N ] ; for ( int i = 0 ; i < N ; i += 1 ) { nums [ i ] = str ( ) ; } Solution obj = new Solution ( ) ; System . out . println ( obj . longestcommonPrefix ( nums , N ) ) ; } } Β  class Solution { public int longestcommonPrefix ( String [ ] nums , int N ) { String first = nums [ 0 ] ; int length = first . length ( ) ; String prefix = \" \" ; for ( int i = 0 ; i < length ; i += 1 ) { boolean isFound = true ; String curr_pre = first . substring ( 0 , i + 1 ) ; for ( int j = 1 ; j < N && isFound ; j += 1 ) { if ( ! nums [ j ] . startsWith ( curr_pre ) ) isFound = false ; } if ( isFound ) prefix = curr_pre ; if ( ! isFound ) return prefix . length ( ) ; } return prefix . length ( ) ; } } Β ", "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String [ ] array = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = scan . next ( ) ; } int count = 0 ; for ( int i = 0 ; i < array [ 0 ] . length ( ) ; i ++ ) { for ( int j = 0 ; j < array . length ; j ++ ) { if ( array [ 0 ] . charAt ( i ) != array [ j ] . charAt ( i ) ) { System . out . println ( count ) ; return ; } } count ++ ; } } }", "import java . util . * ; public class P2 { Β  public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; boolean flag = true ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) s [ i ] = sc . next ( ) ; for ( int i = 0 ; i < s [ 0 ] . length ( ) ; i ++ ) { for ( int j = 0 ; j < n - 1 ; j ++ ) { if ( s [ j ] . charAt ( i ) == s [ j + 1 ] . charAt ( i ) ) { continue ; } else { flag = false ; break ; } } if ( flag ) { c ++ ; } else { break ; } } System . out . println ( c ) ; } }" ]
[ "n = int ( input ( ) ) s1 = input ( ) s2 = input ( ) mi = 0 for j in range ( len ( s1 ) ) : if s1 [ j ] != s2 [ j ] : mi = j breaktemp = s2for j in range ( n - 2 ) : s3 = input ( ) for i in range ( len ( temp ) ) : if temp [ i ] != s3 [ i ] : mi = min ( i , mi ) break temp = s3print ( mi ) NEW_LINE", "num = int ( input ( ) ) arr , arr2 = ( [ ] , [ ] ) i = 0 for x in range ( num ) : nums = input ( ) while len ( arr ) < len ( nums ) : arr . append ( set ( ) ) for y in range ( len ( nums ) ) : arr [ y ] . add ( nums [ y ] ) y = 0 for z in range ( len ( arr ) ) : if len ( arr [ z ] ) == 1 and i == z : arr2 . append ( arr [ z ] ) i += 1 else : breakif len ( nums ) > 1 : print ( len ( arr2 ) ) else : print ( 0 ) NEW_LINE", "n = int ( input ( ) ) Β  str1 = str ( input ( ) ) ctr = len ( str1 ) for i in range ( 2 , n + 1 ) : strn = str ( input ( ) ) ans = 0 for j in range ( ctr ) : if str1 [ j ] != strn [ j ] : break else : ans += 1 ctr = ans Β  Β  print ( ctr ) NEW_LINE", "a = int ( input ( ) ) c = [ ] Β  cnt = 0 for i in range ( a ) : c . append ( input ( ) ) Β  for i in range ( 0 , len ( c [ 0 ] ) ) : b = 0 for j in range ( 1 , a ) : if c [ j ] [ i ] == c [ 0 ] [ i ] : b += 1 else : break if b == a - 1 : cnt += 1 else : breakprint ( cnt ) Β  Β  NEW_LINE", "cases = int ( input ( ) ) Β  numbers = [ ] while cases : cases -= 1 s = input ( ) numbers . append ( s ) Β  numbers . sort ( ) Β  ct = 0 Β  for i , j in zip ( numbers [ 0 ] , numbers [ - 1 ] ) : if i == j : ct += 1 else : print ( ct ) break NEW_LINE" ]
codeforces_611_A
[ "import java . util . Scanner ; Β  public class NewYearandDays { Β  public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; String [ ] a = s . split ( \" ▁ \" , - 1 ) ; Β  int n = Integer . valueOf ( a [ 0 ] ) ; if ( a [ 2 ] . equals ( \" month \" ) ) { if ( n == 31 ) { System . out . println ( \"7\" ) ; } else if ( n > 29 ) { System . out . println ( \"11\" ) ; } else { System . out . println ( \"12\" ) ; } } else { int p = 366 / 7 ; if ( n == 5 || n == 6 ) { ++ p ; } System . out . println ( p ) ; Β  } } Β  }", "import java . util . Scanner ; Β Β Β  public class JavaApplication173 { Β Β Β Β  public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Β  int n = sc . nextInt ( ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; Β  if ( s2 . charAt ( 0 ) == ' w ' ) { int x = 0 ; int current = 5 ; for ( int i = 0 ; i < 366 ; i ++ ) { if ( current == n ) { x ++ ; } current ++ ; if ( current > 7 ) { current = 1 ; } } System . out . println ( x ) ; return ; } else { switch ( n ) { case 30 : System . out . println ( 11 ) ; break ; case 31 : System . out . println ( 7 ) ; break ; default : System . out . println ( 12 ) ; break ; } } Β  } }", "import java . util . Scanner ; Β  public class Candy { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . next ( ) ; String s = sc . next ( ) ; sc . close ( ) ; Β  if ( s . equals ( \" week \" ) ) { if ( n == 5 || n == 6 ) System . out . println ( 53 ) ; else System . out . println ( 52 ) ; } else { if ( n <= 29 ) System . out . println ( 12 ) ; else if ( n == 30 ) System . out . println ( 11 ) ; else System . out . println ( 7 ) ; } Β  } }", "import java . util . Scanner ; Β  public class NewYearAndDays { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String str = input . nextLine ( ) ; Β  input . close ( ) ; Β  StringBuffer num = new StringBuffer ( ) ; Β  if ( Character . isDigit ( str . charAt ( 0 ) ) && Character . isDigit ( str . charAt ( 1 ) ) ) num . append ( str . charAt ( 0 ) ) . append ( str . charAt ( 1 ) ) ; else num . append ( str . charAt ( 0 ) ) ; int number = Integer . parseInt ( num . toString ( ) ) ; Β  if ( str . contains ( \" month \" ) ) { if ( number <= 29 ) System . out . println ( 12 ) ; else if ( number == 30 ) System . out . println ( 11 ) ; else System . out . println ( 7 ) ; } else { if ( number == 5 || number == 6 ) System . out . println ( 53 ) ; else System . out . println ( 52 ) ; } } }", "import java . util . Scanner ; Β  public class NYDays { public static void main ( String [ ] args ) { Β  Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; String s = in . nextLine ( ) ; Β  in . close ( ) ; System . out . println ( s . charAt ( s . length ( ) - 1 ) == ' k ' ? x == 5 || x == 6 ? 53 : 52 : x < 30 ? 12 : x < 31 ? 11 : 7 ) ; } }" ]
[ "s = list ( input ( ) . split ( ) ) Β  if s [ - 1 ] == \" week \" : if s [ 0 ] in \"56\" : print ( 53 ) else : print ( 52 ) else : if int ( s [ 0 ] ) == 31 : print ( 7 ) elif int ( s [ 0 ] ) == 30 : print ( 11 ) else : print ( 12 ) NEW_LINE", "M = [ 31 ] * 7 + [ 30 ] * 4 + [ 29 ] ; n , _ , s = input ( ) . split ( ) ; print ( 52 + ( n in '56' ) if s > ' n ' else sum ( i >= int ( n ) for i in M ) ) NEW_LINE", "n , _ , s = input ( ) . split ( ) ; print ( [ [ [ 12 , 52 + ( n in '56' ) ] [ s > ' n ' ] , 11 ] [ n == '30' ] , 7 ] [ n == '31' ] ) NEW_LINE", "s = input ( ) . split ( ) x = int ( s [ 0 ] ) if s [ - 1 ] == ' month ' : if x == 31 : print ( 7 ) elif x == 30 : print ( 11 ) else : print ( 12 ) else : print ( 52 if ( x < 5 or x > 6 ) else 53 ) NEW_LINE", "s = input ( ) . split ( ) days = 366 Β  if s [ 2 ] == ' week ' : ans = 52 if int ( s [ 0 ] ) == 5 or int ( s [ 0 ] ) == 6 : ans += 1 print ( ans ) Β  else : if int ( s [ 0 ] ) == 31 : print ( 7 ) elif int ( s [ 0 ] ) == 30 : print ( 11 ) Β  else : print ( 12 ) NEW_LINE" ]
codeforces_641_A
[ "import java . util . * ; public class square { public static void main ( String ar [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String d = sc . next ( ) ; char [ ] dir = d . toCharArray ( ) ; int [ ] jumps = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) jumps [ j ] = sc . nextInt ( ) ; HashSet < Integer > visited = new HashSet ( ) ; visited . add ( 0 ) ; int curr = 0 ; while ( true ) { if ( dir [ curr ] == ' < ' ) curr = curr - jumps [ curr ] ; else if ( dir [ curr ] == ' > ' ) curr = curr + jumps [ curr ] ; if ( curr < 0 || curr >= n ) { System . out . println ( \" FINITE \" ) ; return ; } else if ( visited . contains ( curr ) ) { System . out . println ( \" INFINITE \" ) ; return ; } visited . add ( curr ) ; } } }", "import java . util . * ; public class square { public static void main ( String ar [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String d = sc . next ( ) ; char [ ] dir = d . toCharArray ( ) ; int [ ] jumps = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) jumps [ j ] = sc . nextInt ( ) ; HashSet < Integer > visited = new HashSet ( ) ; visited . add ( 0 ) ; int curr = 0 ; while ( true ) { if ( dir [ curr ] == ' < ' ) curr = curr - jumps [ curr ] ; else if ( dir [ curr ] == ' > ' ) curr = curr + jumps [ curr ] ; if ( curr < 0 || curr >= n ) { System . out . println ( \" FINITE \" ) ; return ; } else if ( visited . contains ( curr ) ) { System . out . println ( \" INFINITE \" ) ; return ; } visited . add ( curr ) ; } } }", "import java . util . * ; public class square { public static void main ( String ar [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String d = sc . next ( ) ; char [ ] dir = d . toCharArray ( ) ; int [ ] jumps = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) jumps [ j ] = sc . nextInt ( ) ; HashSet < Integer > visited = new HashSet ( ) ; visited . add ( 0 ) ; int curr = 0 ; while ( true ) { if ( dir [ curr ] == ' < ' ) curr = curr - jumps [ curr ] ; else if ( dir [ curr ] == ' > ' ) curr = curr + jumps [ curr ] ; if ( curr < 0 || curr >= n ) { System . out . println ( \" FINITE \" ) ; return ; } else if ( visited . contains ( curr ) ) { System . out . println ( \" INFINITE \" ) ; return ; } visited . add ( curr ) ; } } }", "import com . sun . org . apache . bcel . internal . generic . AALOAD ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ; Β  public class Main { Β  static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; } Β  Arrays . sort ( a ) ; } Β  public static void main ( String [ ] args ) throws IOException { Β  Scanner input = new Scanner ( System . in ) ; Β  int n = input . nextInt ( ) ; String s = input . next ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; ) { if ( count > n ) { System . out . println ( \" INFINITE \" ) ; return ; } count ++ ; if ( s . charAt ( i ) == ' > ' ) { if ( ( i + 1 + a [ i ] ) > n ) { System . out . println ( \" FINITE \" ) ; return ; } else { i = ( i + a [ i ] ) ; } } else if ( s . charAt ( i ) == ' < ' ) { if ( ( ( i + 1 ) - a [ i ] ) <= 0 ) { System . out . println ( \" FINITE \" ) ; return ; } else { i = i - a [ i ] ; } } } System . out . println ( \" INFINITE \" ) ; } Β  }" ]
[ "n = int ( input ( ) ) s = input ( ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) Β  Β  f = Truevisited = set ( ) pos = 0 while 1 : if pos < 0 or pos >= n : break Β  if pos in visited : f = False break Β  visited . add ( pos ) if s [ pos ] == ' > ' : pos += arr [ pos ] else : pos -= arr [ pos ] Β  Β  print ( \" FINITE \" if f else \" INFINITE \" ) Β  Β  NEW_LINE", "if __name__ == ' _ _ main _ _ ' : Y = lambda : list ( map ( int , input ( ) . split ( ) ) ) N = lambda : int ( input ( ) ) Β  n = N ( ) s = input ( ) a = Y ( ) nxt , ans = 0 , 0 Β  for i in range ( n ) : nxt += [ a [ nxt ] , - a [ nxt ] ] [ s [ nxt ] == ' < ' ] if nxt >= n or nxt < 0 : ans = 2 break print ( \" INFINITE \" [ ans : ] ) NEW_LINE", "if __name__ == ' _ _ main _ _ ' : Y = lambda : list ( map ( int , input ( ) . split ( ) ) ) N = lambda : int ( input ( ) ) Β  n = N ( ) s = input ( ) a = Y ( ) nxt , ans = 0 , 0 Β  for i in range ( n ) : nxt += a [ nxt ] if s [ nxt ] == ' > ' else - a [ nxt ] if nxt >= n or nxt < 0 : ans = 2 break print ( \" INFINITE \" [ ans : ] ) NEW_LINE", "n = int ( input ( ) ) s = input ( ) d = { } a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : d [ i + 1 ] = 1 * a [ i ] if s [ i ] == ' > ' else - 1 * a [ i ] cell = 1 for i in range ( n ) : cell += ( d [ cell ] ) if cell < 1 or cell > n : print ( \" FINITE \" ) breakelse : print ( \" INFINITE \" ) NEW_LINE", "n = int ( input ( ) ) s = input ( ) a = list ( map ( int , input ( ) . split ( ) ) ) k = 0 i = 0 while k < n * 4 : if s [ i ] == ' > ' : k += a [ i ] i += a [ i ] else : k += a [ i ] i -= a [ i ] if i < 0 or i >= n : exit ( print ( \" FINITE \" ) ) Β  print ( \" INFINITE \" ) NEW_LINE" ]
codeforces_4_B
[ "import java . util . * ; public class BeforeAnExam { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int d = sc . nextInt ( ) ; int sumhours = sc . nextInt ( ) ; int [ ] [ ] ar = new int [ d ] [ 2 ] ; int maxSum = 0 , minSum = 0 ; for ( int i = 0 ; i < d ; i ++ ) { ar [ i ] [ 0 ] = sc . nextInt ( ) ; ar [ i ] [ 1 ] = sc . nextInt ( ) ; maxSum += ar [ i ] [ 1 ] ; minSum += ar [ i ] [ 0 ] ; } Β Β  if ( sumhours > maxSum || sumhours < minSum ) { System . out . println ( \" NO \" ) ; System . exit ( 0 ) ; } Β  int [ ] dayHours = new int [ d ] ; for ( int i = 0 ; i < d ; i ++ ) { dayHours [ i ] = ar [ i ] [ 1 ] - ar [ i ] [ 0 ] ; } Β  int [ ] res = new int [ d ] ; int temp = 0 ; for ( int i = 0 ; i < d ; i ++ ) { temp += ar [ i ] [ 0 ] ; res [ i ] = ar [ i ] [ 0 ] ; } Β Β  System . out . println ( \" YES \" ) ; if ( ( temp == sumhours ) ) { for ( int i = 0 ; i < d ; i ++ ) { System . out . print ( res [ i ] + \" ▁ \" ) ; } } else { int req = sumhours - temp ; for ( int i = 0 ; i < d ; i ++ ) { if ( dayHours [ i ] - req >= 0 ) { res [ i ] += req ; break ; } else { req = req - dayHours [ i ] ; res [ i ] += dayHours [ i ] ; Β  } Β  } Β Β Β  for ( int i = 0 ; i < d ; i ++ ) System . out . print ( res [ i ] + \" ▁ \" ) ; } Β Β Β Β Β Β Β  } }", "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 BeforeAnExam { public static void main ( String [ ] args ) { FastReader ( ) ; int t = 1 ; while ( t > 0 ) { solve ( ) ; -- t ; } write . flush ( ) ; write . close ( ) ; } static void solve ( ) { int d = ni ( ) , st = ni ( ) ; int mins = 0 ; int maxs = 0 ; int [ ] min = new int [ d ] ; int [ ] max = new int [ d ] ; for ( int i = 0 ; i < d ; ++ i ) { min [ i ] = ni ( ) ; max [ i ] = ni ( ) ; mins = mins + min [ i ] ; maxs = maxs + max [ i ] ; } if ( st < mins || st > maxs ) { out ( \" NO \" ) ; } else { out ( \" YES \" ) ; if ( st == mins ) { for ( int e : min ) { ou ( e + \" ▁ \" ) ; } } else { int rem = st - mins ; for ( int i = 0 ; i < d ; ++ i ) { if ( rem <= ( max [ i ] - min [ i ] ) ) { min [ i ] = min [ i ] + rem ; rem = 0 ; break ; } else { Β  rem = rem - ( max [ i ] - min [ i ] ) ; min [ i ] = max [ i ] ; } } for ( int e : min ) { ou ( e + \" ▁ \" ) ; } } } }", "import java . util . * ; Β  public class BeforeAnExam_B { Β  public static void main ( String [ ] args ) {", "import java . util . HashSet ; import java . util . Scanner ; Β  public class Main { public static void main ( String [ ] args ) { int d , sum_time ; int min [ ] = new int [ 100 ] ; int max [ ] = new int [ 100 ] ; int total_max = 0 ; int total_min = 0 ; int [ ] ans = new int [ 100 ] ; int sum = 0 ; int sum_min = 0 ; Scanner in = new Scanner ( System . in ) ; d = in . nextInt ( ) ; sum_time = in . nextInt ( ) ; for ( int i = 1 ; i <= d ; i ++ ) { min [ i ] = in . nextInt ( ) ; max [ i ] = in . nextInt ( ) ; total_max += max [ i ] ; total_min += min [ i ] ; } if ( total_max < sum_time || total_min > sum_time ) { System . out . println ( \" NO \" ) ; } else { System . out . println ( \" YES \" ) ; sum_time -= total_min ; int total = 0 ; for ( int i = 1 ; i <= d ; i ++ ) { max [ i ] -= min [ i ] ; total += max [ i ] ; } total -= max [ 1 ] ; for ( int i = 1 ; i <= d ; i ++ ) {", "import java . util . * ; Β  public class solucion2 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int d = scan . nextInt ( ) ; int hs = scan . nextInt ( ) ; int hmin = 0 ; int hmax = 0 ; int [ ] hminarray = new int [ d ] ; int [ ] hmaxarray = new int [ d ] ; for ( int i = 0 ; i < d ; i ++ ) { hminarray [ i ] = scan . nextInt ( ) ; hmin += hminarray [ i ] ; hmaxarray [ i ] = scan . nextInt ( ) ; hmax += hmaxarray [ i ] ; } if ( hs >= hmin && hs <= hmax ) { System . out . println ( \" YES \" ) ; int reparto = hs - hmin ; for ( int i = 0 ; i < d ; i ++ ) { if ( reparto > hmaxarray [ i ] - hminarray [ i ] ) { reparto -= ( hmaxarray [ i ] - hminarray [ i ] ) ; hminarray [ i ] = hmaxarray [ i ] ; } else { hminarray [ i ] += reparto ; reparto = 0 ; } } for ( int i = 0 ; i < d ; i ++ ) { System . out . print ( hminarray [ i ] + \" ▁ \" ) ; } } else System . out . println ( \" NO \" ) ; } } Β " ]
[ "d , sum_time = map ( int , input ( ) . split ( ) ) Β  min_tim = [ ] max_tim = [ ] for i in range ( d ) : min_time , max_time = map ( int , input ( ) . split ( ) ) min_tim . append ( min_time ) max_tim . append ( max_time ) alloted_sum_time = sum ( min_tim ) for j in range ( len ( min_tim ) ) : if alloted_sum_time < sum_time : x = min ( max_tim [ j ] - min_tim [ j ] , sum_time - alloted_sum_time ) alloted_sum_time += x NEW_LINE", "a = [ ] b = [ ] result = [ ] n , s = map ( int , input ( ) . split ( ) ) for i in range ( n ) : c , d = map ( int , input ( ) . split ( ) ) a . append ( c ) result . append ( c ) b . append ( d ) if sum ( a ) <= s <= sum ( b ) : print ( ' YES ' ) remain = s - sum ( a ) for i in range ( n ) : if b [ i ] - a [ i ] <= remain : result [ i ] = b [ i ] remain -= b [ i ] - a [ i ] else : result [ i ] = a [ i ] + remain break for i in result : print ( i , end = ' ▁ ' ) else : print ( ' NO ' ) NEW_LINE", "d , sumTime = map ( int , input ( ) . split ( ) ) min_Time = [ ] max_Time = [ ] for i in range ( 0 , d ) : tmp , tmp1 = map ( int , input ( ) . split ( ) ) min_Time . append ( tmp ) max_Time . append ( tmp1 ) res = [ ] if ( sum ( min_Time ) <= sumTime and sum ( max_Time ) >= sumTime ) : remaining_Time = sumTime - sum ( min_Time ) for i in range ( 0 , d ) : res . append ( min_Time [ i ] ) for i in range ( 0 , d ) : if ( remaining_Time == 0 ) : break else : res [ i ] = min ( remaining_Time + min_Time [ i ] , max_Time [ i ] ) remaining_Time -= res [ i ] - min_Time [ i ] print ( \" YES \" ) for i in range ( 0 , d ) : print ( res [ i ] ) else : print ( \" NO \" ) NEW_LINE", "study_days , sum_of_times = map ( int , input ( ) . split ( ) ) minimals , maximals = [ ] , [ ] for _ in range ( study_days ) : least , most = map ( int , input ( ) . split ( ) ) minimals . append ( least ) maximals . append ( most ) lowest_sum , highest_sum = sum ( minimals ) , sum ( maximals ) if lowest_sum <= sum_of_times <= highest_sum : print ( \" YES \" ) difference_from_minimum = sum_of_times - lowest_sum index = 0 while difference_from_minimum : if minimals [ index ] < maximals [ index ] : minimals [ index ] += 1 difference_from_minimum -= 1 else : index += 1 print ( \" ▁ \" . join ( str ( x ) for x in minimals ) ) else : print ( \" NO \" ) NEW_LINE", "def proB ( arr , k ) : sumi = 0 for i in arr : sumi += i [ 0 ] if ( sumi > k ) : print ( ' NO ' ) else : k -= sumi ans = [ ] for i in arr : ans . append ( i [ 0 ] ) if ( i [ 1 ] - i [ 0 ] >= k ) : ans [ - 1 ] += k k = 0 else : ans [ - 1 ] += i [ 1 ] - i [ 0 ] k -= i [ 1 ] - i [ 0 ] if ( k > 0 ) : print ( ' NO ' ) else : print ( ' YES ' ) print ( * ans ) t , k = list ( map ( int , input ( ) . split ( ) ) ) arr = [ ] for i in range ( t ) : arr1 = list ( map ( int , input ( ) . split ( ) ) ) arr . append ( arr1 ) proB ( arr , k ) NEW_LINE" ]
codeforces_719_A
[ "import java . io . IOException ; import java . util . * ; public class VitayAgain { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } if ( arr [ n - 1 ] == 15 ) { System . out . println ( \" DOWN \" ) ; return ; } else if ( arr [ n - 1 ] == 0 ) { System . out . println ( \" UP \" ) ; return ; } if ( n == 1 ) { System . out . println ( - 1 ) ; return ; } System . out . println ( arr [ arr . length - 1 ] > arr [ arr . length - 2 ] ? \" UP \" : \" DOWN \" ) ; } }", "import java . util . * ; Β  public class Main { Β  public static void main ( String [ ] args ) { int n ; int [ ] num = new int [ 100 ] ; Scanner input = new Scanner ( System . in ) ; n = input . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { num [ i ] = input . nextInt ( ) ; } if ( num [ n ] == 15 ) { System . out . println ( \" DOWN \" ) ; } else if ( num [ n ] == 0 ) { System . out . println ( \" UP \" ) ; } else if ( n == 1 && num [ n ] != 15 && num [ n ] != 0 ) { System . out . println ( - 1 ) ; } else if ( num [ n ] > num [ n - 1 ] ) { System . out . println ( \" UP \" ) ; } else if ( num [ n ] < num [ n - 1 ] ) { System . out . println ( \" DOWN \" ) ; } } } Β " ]
[ "n = int ( input ( ) ) Β  days = [ int ( bruh ) for bruh in input ( ) . split ( ) ] Β  if days [ - 1 ] == 15 : print ( \" DOWN \" ) exit ( ) Β  if days [ - 1 ] == 0 : print ( \" UP \" ) exit ( ) Β  if len ( days ) == 1 : print ( - 1 ) exit ( ) Β  if days [ - 1 ] < days [ - 2 ] : print ( \" DOWN \" ) exit ( ) Β  if days [ - 1 ] > days [ - 2 ] : print ( \" UP \" ) exit ( ) Β  Β  NEW_LINE", "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) if n == 1 : if a [ - 1 ] == 15 : print ( ' DOWN ' ) elif a [ - 1 ] == 0 : print ( ' UP ' ) else : print ( - 1 ) elif a [ - 1 ] > a [ - 2 ] : if a [ - 1 ] != 15 : print ( ' UP ' ) else : print ( ' DOWN ' ) else : if a [ - 1 ] != 0 : print ( ' DOWN ' ) else : print ( ' UP ' ) NEW_LINE", "t = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) Β  if len ( a ) == 1 : if a [ 0 ] == 0 : print ( ' UP ' ) elif a [ 0 ] == 15 : print ( ' DOWN ' ) else : print ( - 1 ) quit ( ) Β  last = a [ - 1 ] prev = a [ - 2 ] Β  if last == 0 or ( last > prev and last != 15 ) : print ( ' UP ' ) else : print ( ' DOWN ' ) NEW_LINE", "n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) if arr [ n - 1 ] == 15 : print ( \" DOWN \" ) elif arr [ n - 1 ] == 0 : print ( ' UP ' ) elif n == 1 : print ( - 1 ) else : if arr [ n - 2 ] > arr [ n - 1 ] : print ( ' DOWN ' ) else : print ( \" UP \" ) NEW_LINE", "Β  n = int ( input ( ) ) l = [ int ( x ) for x in input ( ) . split ( ) ] Β  ans = - 1 if l [ - 1 ] == 15 : ans = ' DOWN ' elif l [ - 1 ] == 0 : ans = ' UP ' elif n == 1 : passelif n > 1 : if l [ - 2 ] > l [ - 1 ] : ans = ' DOWN ' else : ans = ' UP ' Β  Β  print ( ans ) NEW_LINE" ]
codeforces_1409_B
[ "import java . util . Scanner ; Β  public class B1409 { Β  public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int X = in . nextInt ( ) ; int Y = in . nextInt ( ) ; int N = in . nextInt ( ) ; long answer = Math . min ( solve ( A , B , X , Y , N ) , solve ( B , A , Y , X , N ) ) ; System . out . println ( answer ) ; } } Β  static long solve ( int A , int B , int X , int Y , int N ) { int delta = Math . min ( A - X , N ) ; A -= delta ; N -= delta ; delta = Math . min ( B - Y , N ) ; B -= delta ; return A * ( long ) B ; } Β  }", "import java . util . Scanner ; Β  public class _0841MinimumProduct { Β  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 ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int temp1a = a ; int temp1b = b ; int diff = 0 ; int tempn = n ; diff = Math . min ( tempn , ( a - x ) ) ; temp1a -= diff ; tempn -= diff ; diff = Math . min ( tempn , ( b - y ) ) ; temp1b -= diff ; tempn -= diff ; tempn = n ; int temp2a = a ; int temp2b = b ; diff = 0 ; diff = Math . min ( tempn , ( b - y ) ) ; temp2b -= diff ; tempn -= diff ; diff = Math . min ( tempn , ( a - x ) ) ; temp2a -= diff ; tempn -= diff ; System . out . println ( Math . min ( 1L * temp2a * temp2b * 1L , 1L * temp1b * temp1a * 1L ) ) ; t -- ; } } Β  }", "import java . util . * ; public class _1409B { 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 ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; long res1 = 0 , res2 = 0 , a1 , b1 , a2 , b2 ; a1 = Math . max ( a - n , x ) ; b1 = Math . max ( b - Math . max ( n - ( a - x ) , 0 ) , y ) ; a2 = Math . max ( b - n , y ) ; b2 = Math . max ( a - Math . max ( n - ( b - y ) , 0 ) , x ) ; System . out . println ( Math . min ( a1 * b1 , a2 * b2 ) ) ; } } }", "import java . io . * ; import java . math . * ; import java . util . * ; Β  Β Β Β Β  public class Main { Β  private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ; private static int dx1 [ ] = { 1 , 1 , 0 , - 1 , - 1 , - 1 , 0 , 1 } ; private static int dy1 [ ] = { 0 , - 1 , - 1 , - 1 , 0 , 1 , 1 , 1 } ; Β  private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ; Β  private static final long MAX = ( long ) 1e12 ; private static final long MOD = 1000000007 ; Β  private static final int MAXN = 200001 ; private static final int MAXA = 1000004 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException { Β  InputReader in = new InputReader ( System . in ) ;", "import java . io . * ; import java . util . * ; Β  public class B { Β  public static void main ( String [ ] args ) throws FileNotFoundException { FastScanner fs = new FastScanner ( ) ; FastOutput fo = new FastOutput ( ) ; long initial_time = System . currentTimeMillis ( ) ; int testcases = fs . nextInt ( ) ; for ( int tt = 0 ; tt < testcases ; tt ++ ) {" ]
[ "for _ in range ( int ( input ( ) ) ) : a , b , x , y , n = map ( int , input ( ) . split ( ) ) NEW_LINE z = max ( ( a - n ) , x ) NEW_LINE t = max ( ( b - ( n - a + z ) ) , y ) NEW_LINE l = max ( ( b - n ) , y ) NEW_LINE q = max ( a - ( n - b + l ) , x ) NEW_LINE print ( min ( z * t , l * q ) ) NEW_LINE", "t = int ( input ( ) ) Β  for tc in range ( t ) : a , b , x , y , n = map ( int , input ( ) . split ( ) ) NEW_LINE a1 , b1 , n1 = a , b , n NEW_LINE a2 , b2 , n2 = a , b , n Β  if n1 > ( a1 - x ) : n1 -= ( a1 - x ) NEW_LINE a1 -= ( a1 - x ) NEW_LINE if n1 > ( b1 - y ) : b1 -= ( b1 - y ) NEW_LINE n1 -= ( b1 - y ) else : b1 -= n1 else : a1 -= n1 NEW_LINE n1 = 0 Β  if n2 > ( b2 - y ) : n2 -= ( b2 - y ) NEW_LINE b2 -= ( b2 - y ) NEW_LINE if n2 > ( a2 - x ) : a2 -= ( a2 - x ) NEW_LINE n2 -= ( a2 - x ) else : a2 -= n2 else : b2 -= n2 NEW_LINE n2 = 0 Β  print ( min ( a1 * b1 , a2 * b2 ) ) Β  NEW_LINE", "for _ in range ( int ( input ( ) ) ) : a , b , x , y , n = map ( int , input ( ) . split ( ) ) NEW_LINE a1 = max ( x , a - n ) NEW_LINE b1 = max ( y , b - ( n - ( a - a1 ) ) ) NEW_LINE b2 = max ( y , b - n ) NEW_LINE a2 = max ( x , a - ( n - ( b - b2 ) ) ) NEW_LINE print ( min ( a1 * b1 , a2 * b2 ) ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : a , b , x , y , n = map ( int , input ( ) . split ( ) ) NEW_LINE n1 = min ( a - x , n ) NEW_LINE n2 = min ( b - y , n - n1 ) NEW_LINE res1 = ( a - n1 ) * ( b - n2 ) NEW_LINE n1 = min ( b - y , n ) NEW_LINE n2 = min ( a - x , n - n1 ) NEW_LINE res2 = ( a - n2 ) * ( b - n1 ) NEW_LINE print ( min ( res1 , res2 ) ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : a , b , x , y , n = map ( int , input ( ) . split ( ) ) NEW_LINE n1 = min ( a - x , n ) NEW_LINE n2 = min ( b - y , n - n1 ) NEW_LINE res1 = ( a - n1 ) * ( b - n2 ) NEW_LINE n1 = min ( b - y , n ) NEW_LINE n2 = min ( a - x , n - n1 ) NEW_LINE res2 = ( a - n2 ) * ( b - n1 ) NEW_LINE print ( min ( res1 , res2 ) ) NEW_LINE" ]
codeforces_710_A
[ "import java . util . * ; Β  public class CodeForces710A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String s = input . next ( ) ; int x = s . charAt ( 0 ) - ' a ' ; int y = Integer . parseInt ( s . charAt ( 1 ) + \" \" ) ; boolean bool = false ; boolean bool2 = false ; Β  if ( x == 0 || x == 7 ) { bool = true ; } if ( y == 1 || y == 8 ) { bool2 = true ; } Β  if ( bool && bool2 ) { System . out . println ( 3 ) ; } else if ( bool || bool2 ) { System . out . println ( 5 ) ; } else { System . out . println ( 8 ) ; } } }", "import java . util . * ; public class P2 { Β  public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int c = s . charAt ( 0 ) - 96 ; int r = s . charAt ( 1 ) - 48 ;", "Β  import java . lang . * ; import java . util . * ; Β  public class Main { Β  public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; StringBuilder t = new StringBuilder ( sc . nextLine ( ) ) ; char i = t . charAt ( 0 ) ; int n = Integer . parseInt ( String . valueOf ( t . charAt ( 1 ) ) ) ; int m = 8 ; if ( ( n == 1 || n == 8 ) && ( i == ' a ' || i == ' h ' ) ) { System . out . println ( 3 ) ; } else if ( n == 1 || n == 8 ) { System . out . println ( 5 ) ; } else if ( i == ' a ' || i == ' h ' ) { System . out . println ( 5 ) ; } else { System . out . println ( 8 ) ; } Β  } } Β ", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; Β  public class CF710A { Β  public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String in = br . readLine ( ) ; char first = in . charAt ( 0 ) ; int second = in . charAt ( 1 ) - '0' ; if ( ( first == ' a ' || first == ' h ' ) && ( second == 1 || second == 8 ) ) { System . out . println ( 3 ) ; } else if ( ( ( first == ' a ' || first == ' h ' ) ) || ( ( second == 8 || second == 1 ) ) ) { System . out . println ( 5 ) ; } else { System . out . println ( 8 ) ; } } Β  }", "import java . util . * ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char x = s . charAt ( 0 ) ; char y = s . charAt ( 1 ) ; if ( x == ' a ' && y == '2' || x == ' a ' && y == '3' || x == ' a ' && y == '4' || x == ' a ' && y == '5' || x == ' a ' && y == '6' || x == ' a ' && y == '7' || x == ' h ' && y == '2' || x == ' h ' && y == '3' || x == ' h ' && y == '4' || x == ' h ' && y == '5' || x == ' h ' && y == '6' || x == ' h ' && y == '7' || x == ' b ' && y == '1' || x == ' c ' && y == '1' || x == ' d ' && y == '1' || x == ' e ' && y == '1' || x == ' f ' && y == '1' || x == ' g ' && y == '1' || x == ' b ' && y == '8' || x == ' c ' && y == '8' || x == ' d ' && y == '8' || x == ' e ' && y == '8' || x == ' f ' && y == '8' || x == ' g ' && y == '8' ) { System . out . println ( \"5\" ) ; } else if ( x == ' a ' && y == '1' || x == ' h ' && y == '1' || x == ' a ' && y == '8' || x == ' h ' && y == '8' ) { System . out . println ( \"3\" ) ; } else { System . out . println ( \"8\" ) ; } } }" ]
[ "import sys Β  def main ( ) : s = sys . stdin . read ( ) . strip ( ) if s in { ' a1' , ' a8' , ' h1' , ' h8' } : return 3 if any ( i in s for i in '18ah ' ) : return 5 return 8 Β  print ( main ( ) ) NEW_LINE", "z = ' abcdefgh ' a = input ( ) b = z . find ( a [ 0 ] ) + 1 c = int ( a [ 1 ] ) if b == 1 or b == 8 : if c == 1 or c == 8 : print ( 3 ) else : print ( 5 ) else : if c == 1 or c == 8 : print ( 5 ) else : print ( 8 ) NEW_LINE", "import sysinput = sys . stdin . readline Β  pozicia = input ( ) if pozicia [ 0 ] == \" a \" or pozicia [ 0 ] == \" h \" : if pozicia [ 1 ] == \"1\" or pozicia [ 1 ] == \"8\" : print ( 3 ) else : print ( 5 ) elif pozicia [ 1 ] == \"1\" or pozicia [ 1 ] == \"8\" : print ( 5 ) else : print ( 8 ) NEW_LINE", "s = input ( ) if ( s == ' a1' ) or ( s == ' a8' ) or ( s == ' h1' ) or ( s == ' h8' ) : print ( 3 ) elif ( s [ 1 ] == '1' ) or ( s [ 1 ] == '8' ) or ( s [ 0 ] == ' a ' ) or ( s [ 0 ] == ' h ' ) : print ( 5 ) else : print ( 8 ) NEW_LINE", "from sys import stdin , stdout Β  def main ( ) : s = stdin . readline ( ) [ : - 1 ] x = int ( s [ 1 ] ) if ord ( s [ 0 ] ) > ord ( ' a ' ) and ord ( s [ 0 ] ) < ord ( ' h ' ) : if x > 1 and x < 8 : stdout . write ( '8 \\n ' ) else : stdout . write ( '5 \\n ' ) else : if x > 1 and x < 8 : stdout . write ( '5 \\n ' ) else : stdout . write ( '3 \\n ' ) Β  if __name__ == \" _ _ main _ _ \" : main ( ) NEW_LINE" ]
codeforces_358_B
[ "import java . io . * ; import java . util . * ; Β  public class Codeforces { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; Β  int n = in . nextInt ( ) ; StringBuilder st = new StringBuilder ( ) ; st . append ( \" < 3\" ) ; for ( int i = 0 ; i < n ; i ++ ) { st . append ( in . next ( ) ) ; st . append ( \" < 3\" ) ; } String all = st . toString ( ) ; String s = in . next ( ) ; int i = 0 ; for ( Character c : s . toCharArray ( ) ) { if ( i < all . length ( ) && c . equals ( all . charAt ( i ) ) ) { i ++ ; } } if ( i == all . length ( ) ) { out . println ( \" yes \" ) ; } else { out . println ( \" no \" ) ; } out . flush ( ) ; } Β  static class Pair { int x , y ; Β  Pair ( int a , int b ) { x = a ; y = b ; } } Β  static class Scanner { StringTokenizer st ; BufferedReader br ; Β  public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } Β  public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } Β  public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } Β  public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } Β  public String nextLine ( ) throws IOException { return br . readLine ( ) ; } Β  public boolean ready ( ) throws IOException { return br . ready ( ) ; } } } Β " ]
[ "n = int ( input ( ) ) ts = [ input ( ) for i in range ( n ) ] t = ' < 3' + ' < 3' . join ( ts ) + ' < 3' s = input ( ) i = 0j = 0 while i < len ( t ) and j < len ( s ) : if t [ i ] == s [ j ] : i += 1 j += 1 print ( i == len ( t ) and ' yes ' or ' no ' ) NEW_LINE", "n = int ( input ( ) ) s = ' < 3' + ' < 3' . join ( [ input ( ) for i in range ( n ) ] ) + ' < 3' idx = 0 for i in input ( ) : if len ( s ) > idx and s [ idx ] == i : idx += 1 if len ( s ) > idx : print ( \" no \" ) else : print ( \" yes \" ) NEW_LINE", "n = int ( input ( ) ) l = [ ] for i in range ( n ) : l . append ( input ( ) ) s = input ( ) stage = 0 cur = 0 curpos = 0 f = 0 for j in range ( len ( s ) ) : i = s [ j ] curword = l [ cur ] if stage == 0 and i == \" < \" : stage = 1 elif stage == 1 and i == \"3\" : stage = 2 if stage == 2 : if i == curword [ curpos ] : curpos += 1 if curpos == len ( curword ) : cur += 1 curpos = 0 stage = 0 if cur == len ( l ) : for k in range ( j + 1 , len ( s ) ) : if s [ k ] == \" < \" and f == 0 : f = 1 if s [ k ] == \"3\" and f == 1 : f = 2 break Β  if cur == len ( l ) and f == 2 : print ( \" yes \" ) else : print ( \" no \" ) NEW_LINE", "length = int ( input ( ) ) Β  message = [ ] Β  for i in range ( 0 , length ) : message . append ( input ( ) ) Β  nmessage = \" < 3\" Β  for i in range ( 0 , length ) : nmessage += message [ i ] nmessage += \" < 3\" Β  encoded_message = input ( ) Β  for i in encoded_message : if len ( nmessage ) != 0 : if i == nmessage [ 0 ] : nmessage = nmessage [ 1 : ] Β  if len ( nmessage ) == 0 : print ( \" yes \" ) else : print ( \" no \" ) NEW_LINE", "t = ' < 3' + ' < 3' . join ( input ( ) for i in range ( int ( input ( ) ) ) ) + ' < 3' p = input ( ) s = \" yes \" j = 0 for c in t : j = p . find ( c , j ) + 1 if j == 0 : s = ' no ' breakprint ( s ) NEW_LINE" ]
codeforces_1413_B
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; import java . util . Vector ; Β Β Β  public class Codeforces { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }", "import java . io . * ; import java . util . * ; import java . math . * ; Β Β Β Β  public class Test { Β  public static void process ( ) throws IOException { int n = ni ( ) ; int m = ni ( ) ; HashMap < Integer , ArrayList < Integer > > map = new HashMap < Integer , ArrayList < Integer > > ( ) ; HashSet < Integer > set = new HashSet < Integer > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int j = 1 ; j <= m ; j ++ ) { list . add ( ni ( ) ) ; } map . put ( list . get ( 0 ) , list ) ; set . add ( list . get ( 0 ) ) ; } ArrayList < ArrayList < Integer > > cols = new ArrayList < ArrayList < Integer > > ( ) ; for ( int i = 1 ; i <= m ; i ++ ) { ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int j = 1 ; j <= n ; j ++ ) { list . add ( ni ( ) ) ; } cols . add ( list ) ; } int i = 0 ; for ( i = 0 ; i < cols . size ( ) ; i ++ ) { if ( set . containsAll ( cols . get ( i ) ) ) { break ; } } for ( Integer x : cols . get ( i ) ) { ArrayList < Integer > list = map . get ( x ) ; for ( Integer z : list ) { p ( z + \" ▁ \" ) ; } pn ( \" \" ) ; Β  } } Β Β  static AnotherReader sc ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( System . out ) ; sc = new AnotherReader ( ) ; boolean oj = true ; Β ", "import java . io . * ; import java . lang . * ; import java . util . * ; Β  public class b { static BufferedReader f ; static StringTokenizer st ; static StringBuilder ans = new StringBuilder ( ) ; public static void tc ( ) throws IOException { st = new StringTokenizer ( f . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int m = Integer . parseInt ( st . nextToken ( ) ) ; int [ ] arr = new int [ n * m ] ; int [ ] [ ] grid = new int [ n ] [ m ] ;", "import java . util . Scanner ; Β  public class B1413 { Β  public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; StringBuilder output = new StringBuilder ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int R = in . nextInt ( ) ; int C = in . nextInt ( ) ; int [ ] [ ] rows = new int [ R ] [ ] ; int [ ] rowIndex = new int [ R * C + 1 ] ; for ( int r = 0 ; r < R ; r ++ ) { int [ ] row = new int [ C ] ; for ( int c = 0 ; c < C ; c ++ ) { int a = in . nextInt ( ) ; row [ c ] = a ; rowIndex [ a ] = r ; } rows [ r ] = row ; } for ( int c = 0 ; c < C ; c ++ ) { for ( int r = 0 ; r < R ; r ++ ) { int a = in . nextInt ( ) ; if ( c == 0 ) { for ( int elem : rows [ rowIndex [ a ] ] ) { output . append ( elem ) . append ( ' ▁ ' ) ; } output . append ( ' \\n ' ) ; } } } } System . out . print ( output ) ; } Β  }" ]
[ "t = int ( input ( ) ) NEW_LINE d = dict ( ) NEW_LINE ans = ' ' NEW_LINE for i in range ( t ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE d . clear ( ) NEW_LINE a = [ ] NEW_LINE for i in range ( n ) : x = input ( ) . split ( ) NEW_LINE a . append ( x ) NEW_LINE d [ x [ 0 ] ] = i NEW_LINE", "import sys NEW_LINE input = sys . stdin . readlinefor NEW_LINE _ in ' A ' * int ( input ( ) ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE c = [ 0 ] * ( n * m + 1 ) NEW_LINE r = [ 0 ] * ( n * m + 1 ) NEW_LINE matrix = [ [ 0 ] * m for i in range ( n ) ] NEW_LINE for i in range ( n ) : row = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for j in range ( m ) : c [ row [ j ] ] = j NEW_LINE for j in range ( m ) : column = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for i in range ( n ) : r [ column [ i ] ] = i NEW_LINE for i in range ( 1 , n * m + 1 ) : matrix [ r [ i ] ] [ c [ i ] ] = i NEW_LINE for i in range ( n ) : print ( * matrix [ i ] ) NEW_LINE", "input = __import__ ( ' sys ' ) . stdin . readlinefor NEW_LINE _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE rows = [ ] NEW_LINE g = { } NEW_LINE for i in range ( n ) : row = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE rows . append ( row ) NEW_LINE for j in range ( m ) : g [ row [ j ] ] = i NEW_LINE res = [ ] NEW_LINE ans = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for i in range ( n ) : res . append ( g [ ans [ i ] ] ) NEW_LINE for _ in range ( m - 1 ) : input ( ) NEW_LINE for i in res : print ( * rows [ i ] ) NEW_LINE", "from sys import stdininput = stdin . readline Β  t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n , m = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE a = [ [ int ( x ) for x in input ( ) . split ( ) ] for _ in range ( n ) ] NEW_LINE b = [ [ int ( x ) for x in input ( ) . split ( ) ] for _ in range ( m ) ] NEW_LINE d = [ 0 ] * ( n * m ) NEW_LINE for y in range ( n ) : for NEW_LINE x in range ( m ) : d [ a [ y ] [ x ] - 1 ] = y NEW_LINE ans = [ ] NEW_LINE for i in b [ 0 ] : ans . append ( a [ d [ i - 1 ] ] ) NEW_LINE for i in ans : print ( * i ) NEW_LINE", "import sysinput = sys . stdin . readlinet = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE row = [ ] NEW_LINE col = [ ] NEW_LINE for i in range ( n ) : row . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE for i in range ( m ) : col . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE for i in col [ 0 ] : for NEW_LINE j in row : NEW_LINE if i in j : print ( * j ) NEW_LINE" ]
codeforces_464_A
[ "import java . util . * ; import java . io . * ; import java . math . * ; Β ", "import java . util . * ; import java . io . * ; Β  public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; } Β  public static long mod = 17352642619633L ; Β  void run ( FastScanner in , PrintWriter out ) { Β  int N = in . nextInt ( ) ; int P = in . nextInt ( ) ; String s = in . next ( ) ; char [ ] ca = s . toCharArray ( ) ; Β  boolean found = false ; Β  for ( int i = N - 1 ; i >= 0 ; i -- ) { Β  for ( char c = ( char ) ( ca [ i ] + 1 ) ; c < ' a ' + P ; c ++ ) { Β  if ( i - 1 >= 0 && ca [ i - 1 ] == c ) continue ; if ( i - 2 >= 0 && ca [ i - 2 ] == c ) continue ; Β " ]
[ "n , k = map ( int , input ( ) . split ( ) ) s = input ( ) if k == 1 and n > 1 : print ( ' NO ' ) exit ( 0 ) if k <= 2 : if n > 2 : print ( ' NO ' ) exit ( 0 ) Β  Β  arr = [ ] for ch in s : arr . append ( ord ( ch ) - 96 ) Β  i = n - 1 last = - 1 Β  while i >= 0 : for num in range ( arr [ i ] + 1 , k + 1 ) : if i - 2 >= 0 and num != arr [ i - 1 ] and num != arr [ i - 2 ] : arr [ i ] = num last = i break Β  elif i - 2 < 0 and i - 1 == 0 and arr [ i - 1 ] != num : arr [ i ] = num last = i break Β  elif i == 0 : arr [ i ] = num last = i break if last != - 1 : break i -= 1 Β  if i < 0 : print ( ' NO ' ) exit ( 0 ) Β  for i in range ( i + 1 , n ) : for num in range ( 1 , k + 1 ) : if i - 2 >= 0 and num != arr [ i - 1 ] and num != arr [ i - 2 ] : Β  arr [ i ] = num break elif i - 2 < 0 and i - 1 == 0 and arr [ i - 1 ] != num : Β  arr [ i ] = num breakans = \" \" for num in arr : ans += chr ( num + 96 ) Β  print ( ans ) NEW_LINE", "def trans ( c ) : return chr ( ord ( c ) + 1 ) Β  n , p = list ( map ( int , input ( ) . split ( ) ) ) s = list ( input ( ) ) s [ n - 1 ] = trans ( s [ n - 1 ] ) Β  i = n - 1 while i >= 0 and i < n : if ord ( s [ i ] ) >= ord ( ' a ' ) + p : s [ i ] = ' a ' i -= 1 s [ i ] = trans ( s [ i ] ) elif i > 0 and s [ i ] == s [ i - 1 ] or i > 1 and s [ i ] == s [ i - 2 ] : s [ i ] = trans ( s [ i ] ) else : i += 1 else : print ( \" NO \" if i < 0 else \" \" . join ( s ) ) NEW_LINE", "n , p = list ( map ( int , input ( ) . split ( ) ) ) s = list ( input ( ) ) s [ n - 1 ] = chr ( ord ( s [ n - 1 ] ) + 1 ) i = n - 1 while i >= 0 and i < n : if ord ( s [ i ] ) >= ord ( ' a ' ) + p : s [ i ] = ' a ' i -= 1 s [ i ] = chr ( ord ( s [ i ] ) + 1 ) elif i > 0 and s [ i ] == s [ i - 1 ] or i > 1 and s [ i ] == s [ i - 2 ] : s [ i ] = chr ( ord ( s [ i ] ) + 1 ) else : i += 1 print ( \" NO \" if i < 0 else \" \" . join ( s ) ) NEW_LINE", "def trans ( c ) : return chr ( ord ( c ) + 1 ) n , p = list ( map ( int , input ( ) . split ( ) ) ) s = list ( input ( ) ) s [ n - 1 ] = trans ( s [ n - 1 ] ) i = n - 1 while i >= 0 and i < n : if ord ( s [ i ] ) >= ord ( ' a ' ) + p : s [ i ] = ' a ' i -= 1 s [ i ] = trans ( s [ i ] ) elif i > 0 and s [ i ] == s [ i - 1 ] or i > 1 and s [ i ] == s [ i - 2 ] : s [ i ] = trans ( s [ i ] ) else : i += 1 print ( \" NO \" if i < 0 else \" \" . join ( s ) ) NEW_LINE" ]
codeforces_111_B
[ "import java . util . * ; Β  import java . io . * ; Β  public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; } Β ", "import java . util . * ; import java . io . * ; public class helloworld { static long fact [ ] ; static long max ; static int ans ; 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 . lang . * ; import java . util . * ; Β  public class Solution { static int n = 100001 ; static ArrayList < Integer > arr [ ] = new ArrayList [ n ] ; public static void divisors ( ) { for ( int j = 0 ; j < n ; j ++ ) { arr [ j ] = new ArrayList < Integer > ( ) ; } for ( int i = 1 ; i < n ; i ++ ) { for ( int j = 1 ; j * j <= i ; j ++ ) { if ( i % j == 0 ) { if ( i / j == j ) { arr [ i ] . add ( j ) ; } else { arr [ i ] . add ( j ) ; arr [ i ] . add ( i / j ) ; } } } } } public static void main ( String [ ] args ) { divisors ( ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x , y ; Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; int count = 0 ; for ( int j = 1 ; j < arr [ x ] . size ( ) ; j ++ ) { if ( map . get ( arr [ x ] . get ( j ) ) != null && map . get ( arr [ x ] . get ( j ) ) >= i - y && map . get ( arr [ x ] . get ( j ) ) < i ) { count ++ ; } } for ( int j = 1 ; j < arr [ x ] . size ( ) ; j ++ ) { map . put ( arr [ x ] . get ( j ) , i ) ; } if ( y == 0 ) System . out . println ( arr [ x ] . size ( ) ) ; else System . out . println ( arr [ x ] . size ( ) - 1 - count ) ; } } }", "import java . io . BufferedReader ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintStream ; import java . io . PrintWriter ; import java . util . ArrayDeque ; 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 . PriorityQueue ; import java . util . Random ; import java . util . StringTokenizer ; Β  public class Solution { static final int N = ( int ) 1e5 + 5 ; static ArrayList < Integer > [ ] fact ; static int [ ] last ; public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int tt = 1 ; while ( tt -- > 0 ) { int n = fs . nextInt ( ) ; fact = new ArrayList [ N ] ; for ( int i = 0 ; i < N ; i ++ ) fact [ i ] = new ArrayList < Integer > ( ) ; generate ( ) ; last = new int [ N ] ; for ( int i = 1 ; i <= n ; i ++ ) { int x = fs . nextInt ( ) , y = fs . nextInt ( ) ; int ans = 0 ; for ( int f : fact [ x ] ) { if ( i - last [ f ] > y ) ans ++ ; } out . println ( ans ) ; for ( int f : fact [ x ] ) last [ f ] = i ; } } out . close ( ) ; } static void generate ( ) { for ( int i = 1 ; i < N ; i ++ ) { for ( int j = 1 ; i * j < N ; j ++ ) { fact [ i * j ] . add ( i ) ; } } } static final Random random = new Random ( ) ; static void ruffleSort ( int [ ] a ) { int n = a . length ;" ]
[ "entrada = int ( input ( ) ) temporario = [ - 1 ] * 100005 i = 1 while ( i <= entrada ) : resposta = 0 x , y = input ( ) . split ( ) x = int ( x ) y = int ( y ) j = 1 while ( j * j <= x ) : if ( x % j == 0 ) : if ( i - temporario [ j ] > y ) : resposta += 1 if ( x - j * j and i - temporario [ int ( x / j ) ] > y ) : resposta += 1 temporario [ j ] = temporario [ int ( x / j ) ] = i j += 1 print ( resposta ) i += 1 NEW_LINE", "import sysimport collections as ccinput = sys . stdin . buffer . readlineI = lambda : list ( map ( int , input ( ) . split ( ) ) ) prev = cc . defaultdict ( int ) for tc in range ( int ( input ( ) ) ) : x , y = I ( ) div = set ( ) for i in range ( 1 , int ( x ** 0.5 ) + 1 ) : if x % i == 0 : div . add ( i ) div . add ( x // i ) ans = 0 now = tc + 1 for i in div : if now - prev [ i ] > y : ans += 1 prev [ i ] = now print ( ans ) NEW_LINE", "import sysimport collections as ccinput = sys . stdin . buffer . readlineI = lambda : list ( map ( int , input ( ) . split ( ) ) ) prev = cc . defaultdict ( int ) for tc in range ( int ( input ( ) ) ) : x , y = I ( ) div = set ( ) for i in range ( 1 , int ( x ** 0.5 ) + 1 ) : if x % i == 0 : div . add ( i ) div . add ( x // i ) ans = 0 now = tc + 1 for i in div : if now - prev [ i ] > y : ans += 1 prev [ i ] = now print ( ans ) NEW_LINE", "import sysimport collections as ccinput = sys . stdin . buffer . readlineI = lambda : list ( map ( int , input ( ) . split ( ) ) ) prev = cc . defaultdict ( int ) for tc in range ( int ( input ( ) ) ) : x , y = I ( ) div = set ( ) for i in range ( 1 , int ( x ** 0.5 ) + 1 ) : if x % i == 0 : div . add ( i ) div . add ( x // i ) ans = 0 now = tc + 1 for i in div : if now - prev [ i ] > y : ans += 1 prev [ i ] = now print ( ans ) NEW_LINE" ]
codeforces_1355_A
[ "import java . io . * ; import java . util . * ; Β  public class D { Β  public static void main ( String [ ] args ) { FastScanner in = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { long a = in . nextLong ( ) , k = in . nextLong ( ) ; int cnt = 1 ; int min = minDig ( a ) ; int max = maxDig ( a ) ; while ( min != 0 && cnt < k ) { a += min * max ; min = minDig ( a ) ; max = maxDig ( a ) ; cnt ++ ; } out . println ( a ) ; } out . flush ( ) ; } Β  static int minDig ( long a ) { int min = 9 ; while ( a > 0 ) { min = Math . min ( min , ( int ) ( a % 10 ) ) ; a /= 10 ; } return min ; } Β  static int maxDig ( long a ) { int max = 0 ; while ( a > 0 ) { max = Math . max ( max , ( int ) ( a % 10 ) ) ; a /= 10 ; } return max ; } Β  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 ) { } return st . nextToken ( ) ; } String nextLine ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { } return \" \" ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } int [ ] readArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; Β  public class Seq_Digits { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int t = in . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; while ( t -- > 0 ) { long n = in . nextLong ( ) ; long k = in . nextLong ( ) ; k -- ; while ( k -- > 0 ) { long a = To_Add ( n ) ; if ( a == 0 ) { break ; } n += a ; } sb . append ( n + \" \\n \" ) ; } System . out . println ( sb ) ; Β  } static long To_Add ( long n ) { long min = Long . MAX_VALUE ; long max = Long . MIN_VALUE ; Β  while ( n > 0 ) { min = Math . min ( min , n % 10 ) ; max = Math . max ( max , n % 10 ) ; n /= 10 ; } return ( min * max ) ; } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; Β  public class Codeforces { Β  private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ; Β  public static int [ ] LPS ( String p ) { int [ ] lps = new int [ p . length ( ) ] ; Β  int i = 1 ; int j = 0 ; while ( i < p . length ( ) ) { if ( p . charAt ( i ) == p . charAt ( j ) ) { lps [ i ] = j + 1 ; i ++ ; j ++ ; } else { if ( j == 0 ) { lps [ i ] = 0 ; i ++ ; } else { j = lps [ j - 1 ] ; } } } return lps ; } Β  public static void KMP ( String text , String pattern ) { int [ ] lps = LPS ( pattern ) ; int i = 0 ; int j = 0 ; ArrayList < Integer > matches = new ArrayList < > ( ) ; while ( i < text . length ( ) ) { if ( text . charAt ( i ) == pattern . charAt ( j ) ) { i ++ ; j ++ ; } else { if ( j != 0 ) { j = lps [ j - 1 ] ; } else { i ++ ; } } if ( j == pattern . length ( ) ) { matches . add ( i - j ) ; j = lps [ j - 1 ] ; } } for ( int x : matches ) { System . out . println ( \" Match ▁ at ▁ : ▁ \" + x ) ; } } Β  private static class SegmentTree { private long [ ] st ; private int size ; private int n ; private long [ ] a ; SegmentTree ( long [ ] a , int n ) { this . size = 4 * n ; this . n = n ; this . a = a ; st = new long [ size ] ;" ]
[ "if __name__ == \" _ _ main _ _ \" : for _ in range ( int ( input ( ) ) ) : a1 , k = map ( int , input ( ) . split ( ) ) i = 1 a = a1 while i < k and '0' not in str ( a ) : p = a s = str ( a ) li = list ( s ) a = p + ( int ( min ( li ) ) * int ( max ( li ) ) ) i = i + 1 print ( a ) Β  NEW_LINE", "for _ in range ( int ( input ( ) ) ) : a , k = map ( int , input ( ) . split ( ) ) n = a prev = a cnt = 0 while cnt != k - 1 : n = a max = 0 min = 9 while n : if n % 10 > max : max = n % 10 if n % 10 < min : min = n % 10 n //= 10 a = a + min * max if a == prev : break else : prev = a cnt += 1 print ( a ) NEW_LINE", "def min_max_digs ( n ) : digits = set ( ) while n > 0 : digits . add ( n % 10 ) n //= 10 return list ( digits ) Β  for _ in range ( int ( input ( ) ) ) : a , k = map ( int , input ( ) . split ( ) ) for _ in range ( k - 1 ) : if a % 10 == 0 : break digits = min_max_digs ( a ) mn = min ( digits ) mx = max ( digits ) if mn == 0 : break a += min ( digits ) * max ( digits ) print ( a ) NEW_LINE", "def ContainsZero ( c ) : t = list ( set ( str ( c ) ) ) for j in range ( len ( t ) ) : m = int ( t [ j ] ) if m == 0 : return True return False Β  def MinMaxDigit ( c ) : t = list ( set ( str ( c ) ) ) minimum = 11 maximum = - 1 for j in range ( len ( t ) ) : m = int ( t [ j ] ) if m < minimum : minimum = m if m > maximum : maximum = m return minimum * maximum Β  N = int ( input ( ) ) Β  for _ in range ( N ) : data = input ( ) . split ( ) a = int ( data [ 0 ] ) k = int ( data [ 1 ] ) for i in range ( 1 , k ) : if ContainsZero ( a ) : break else : a = a + MinMaxDigit ( a ) print ( a ) NEW_LINE", "if __name__ == ' _ _ main _ _ ' : for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) i = 1 ans = str ( n ) while i < k and '0' not in ans : ans = str ( int ( ans ) + int ( max ( ans ) ) * int ( min ( ans ) ) ) i += 1 print ( ans ) NEW_LINE" ]
codeforces_174_A
[ "import java . util . * ; Β  public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; double k = s . nextDouble ( ) ; double [ ] a = new double [ n ] ; double max = Double . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = s . nextDouble ( ) ; if ( a [ i ] > max ) { max = a [ i ] ; } } solve ( a , k , max ) ; } static void solve ( double [ ] a , double k , double max ) { double minreq = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { minreq += max - a [ i ] ; } if ( minreq > k ) { System . out . println ( - 1 ) ; } else { double n = ( k - minreq ) / a . length ; for ( double val : a ) { System . out . println ( ( max - val + n ) ) ; } } } }", "import java . util . Locale ; import java . util . Scanner ; Β  public class A174 { Β  public static void main ( String [ ] args ) { Locale . setDefault ( Locale . US ) ; Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int B = in . nextInt ( ) ; int [ ] A = new int [ N ] ; int max = 0 ; int sum = 0 ; for ( int n = 0 ; n < N ; n ++ ) { int a = in . nextInt ( ) ; sum += a ; max = Math . max ( a , max ) ; A [ n ] = a ; } int minNeeded = N * max - sum ; if ( minNeeded > B ) { System . out . println ( \" - 1\" ) ; } else { double target = ( sum + B ) / ( double ) N ; for ( int a : A ) { System . out . println ( target - a ) ; } } } Β  }", "import com . sun . security . jgss . GSSUtil ; Β  import java . io . * ; import java . lang . reflect . Array ; import java . nio . Buffer ; import java . util . * ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; Β  public class Pair { Β  public static void main ( String [ ] args ) throws Exception { try { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , b = sc . nextInt ( ) ; Β  double sum = 0 ; double [ ] arr = new double [ 100 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextDouble ( ) ; sum += arr [ i ] ; } sum += b ; sum /= n ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > sum ) { System . out . println ( - 1 ) ; return ; } } for ( int i = 0 ; i < n ; i ++ ) { System . out . printf ( \" % .6f \\n \" , sum - arr [ i ] ) ; } } catch ( Exception e ) { } } }", "import java . util . Scanner ; import java . util . Arrays ; public class Ishu { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n , b , i , sum = 0 , index = 0 ; String str ; double temp ; boolean flag = true ; int [ ] a = new int [ 100 ] ; n = scan . nextInt ( ) ; b = scan . nextInt ( ) ; for ( i = 0 ; i < n ; ++ i ) { a [ i ] = scan . nextInt ( ) ; sum += a [ i ] ; } sum += b ; temp = ( double ) sum / n ; for ( i = 0 ; i < n ; ++ i ) if ( ( double ) a [ i ] > temp ) { System . out . println ( - 1 ) ; return ; } for ( i = 0 ; i < n ; ++ i ) { str = String . valueOf ( temp - a [ i ] ) ; index = str . indexOf ( ' . ' ) ; if ( str . length ( ) - index < 7 ) { while ( str . length ( ) - index < 7 ) str += \"0\" ; } else if ( str . length ( ) - index > 7 ) str = String . valueOf ( Math . round ( ( temp - a [ i ] ) * 1000000.0 ) / 1000000.0 ) ; System . out . println ( str ) ; } } }" ]
[ "n , t = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) X = float ( ( sum ( l ) + t ) / n ) NEW_LINE", "n , b = map ( int , input ( ) . split ( ) ) s = list ( map ( int , input ( ) . split ( ) ) ) sb = sum ( s ) + bsb /= nif sb - max ( s ) >= 0 : for x in s : print ( sb - x ) else : print ( ' - 1' ) Β  Β  NEW_LINE", "n , k = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) lst = list ( map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) ) m = max ( lst ) lst2 = [ ] s = 0 for i in range ( n ) : lst2 . append ( m - lst [ i ] ) s += m - lst [ i ] if s > k : print ( - 1 ) else : k -= s k = k / n for i in range ( n ) : print ( \" { 0 : . 6f } \" . format ( k + lst2 [ i ] ) ) NEW_LINE", "n , b = map ( int , input ( ) . split ( ) ) a = list ( float ( x ) for x in input ( ) . split ( ) ) s = max ( a ) c = [ 0 ] * nfor i in range ( n ) : m = s - a [ i ] b = b - m c [ i ] = c [ i ] + mif b >= 0 : for i in range ( n ) : c [ i ] = c [ i ] + b / n for i in range ( n ) : print ( \" % .6f \" % c [ i ] ) else : print ( \" - 1\" ) NEW_LINE", "def f ( l1 , al ) : n , b = l1 c = ( sum ( al ) + b ) / n if max ( al ) > c : return [ - 1 ] return [ c - a for a in al ] l1 = list ( map ( int , input ( ) . split ( ) ) ) l2 = list ( map ( int , input ( ) . split ( ) ) ) [ print ( r ) for r in f ( l1 , l2 ) ] NEW_LINE" ]
codeforces_1292_B
[ "import sysfrom collections import defaultdict , dequeinput = lambda : sys . stdin . readline ( ) . rstrip ( ) x , y , ax , ay , bx , by = map ( int , input ( ) . split ( ) ) xs , ys , t = map ( int , input ( ) . split ( ) ) a = [ ] ; a . append ( ( x , y ) ) ; px = x ; py = y ; LIMIT = 2 * * 62 - 1 while ( 1 ) : dx = ax * px + bx ; dy = ay * py + by ; if ( dx >= LIMIT or dy >= LIMIT ) : break ; a . append ( ( dx , dy ) ) ; px = dx ; py = dy ; px = xs ; py = ys ; ans = 0 ; a = list ( a ) n = len ( a ) for i in range ( n ) : for j in range ( i , n ) : # start to i to j l = abs ( a [ j ] [ 0 ] - a [ i ] [ 0 ] ) + abs ( a [ j ] [ 1 ] - a [ i ] [ 1 ] ) l1 = abs ( a [ i ] [ 0 ] - xs ) + abs ( a [ i ] [ 1 ] - ys ) + l # start to j to i l2 = abs ( a [ j ] [ 0 ] - xs ) + abs ( a [ j ] [ 1 ] - ys ) + l if l1 <= t or l2 <= t : ans = max ( ans , j - i + 1 ) print ( ans ) ;" ]
[ "x0 , y0 , ax , ay , bx , by = map ( int , input ( ) . split ( ' ▁ ' ) ) ps = [ ( x0 , y0 ) ] NEW_LINE", "import timestartTimeProblem = time . time ( ) Β  import fileinput , sys , itertools , functools , mathfrom bisect import * from heapq import * from collections import * Β  Β  MOD = 10 ** 9 + 7 NEW_LINE", "import sysfrom collections import defaultdict , dequeinput = lambda : sys . stdin . readline ( ) . rstrip ( ) x , y , ax , ay , bx , by = map ( int , input ( ) . split ( ) ) xs , ys , t = map ( int , input ( ) . split ( ) ) a = [ ] ; a . append ( ( x , y ) ) ; px = x ; py = y ; LIMIT = 2 ** 62 - 1 while ( 1 ) : dx = ax * px + bx ; dy = ay * py + by ; if ( dx >= LIMIT or dy >= LIMIT ) : break ; a . append ( ( dx , dy ) ) ; px = dx ; py = dy ; px = xs ; py = ys ; ans = 0 ; a = list ( a ) n = len ( a ) for i in range ( n ) : for j in range ( i , n ) : NEW_LINE", "x0 , y0 , ax , ay , bx , by = map ( int , input ( ) . split ( ) ) xs , ys , t = map ( int , input ( ) . split ( ) ) Β  V = [ [ x0 , y0 ] ] Β  while V [ - 1 ] [ 0 ] < 10 ** 25 : x , y = V [ - 1 ] V . append ( [ ax * x + bx , ay * y + by ] ) Β  ans = 0 Β  for i in range ( len ( V ) ) : Β  if abs ( xs - V [ i ] [ 0 ] ) + abs ( ys - V [ i ] [ 1 ] ) <= t : curt = t - ( abs ( xs - V [ i ] [ 0 ] ) + abs ( ys - V [ i ] [ 1 ] ) ) curans = 1 Β  for j in range ( i - 1 , - 1 , - 1 ) : if abs ( V [ j ] [ 0 ] - V [ j + 1 ] [ 0 ] ) + abs ( V [ j ] [ 1 ] - V [ j + 1 ] [ 1 ] ) <= curt : curt -= abs ( V [ j ] [ 0 ] - V [ j + 1 ] [ 0 ] ) + abs ( V [ j ] [ 1 ] - V [ j + 1 ] [ 1 ] ) curans += 1 else : break Β  ans = max ( ans , curans ) Β  curt = t - ( abs ( xs - V [ i ] [ 0 ] ) + abs ( ys - V [ i ] [ 1 ] ) ) curans = 1 Β  for j in range ( i + 1 , len ( V ) ) : if abs ( V [ j ] [ 0 ] - V [ j - 1 ] [ 0 ] ) + abs ( V [ j ] [ 1 ] - V [ j - 1 ] [ 1 ] ) <= curt : curt -= abs ( V [ j ] [ 0 ] - V [ j - 1 ] [ 0 ] ) + abs ( V [ j ] [ 1 ] - V [ j - 1 ] [ 1 ] ) curans += 1 else : break Β  ans = max ( ans , curans ) Β  print ( ans ) NEW_LINE" ]
codeforces_1185_B
[ "import java . io . * ; import java . util . * ; Β  public class round568B { public static void main ( String s [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { char [ ] s1 = br . readLine ( ) . toCharArray ( ) , s2 = br . readLine ( ) . toCharArray ( ) ; int p1 = 0 , p2 = 0 , n1 = s1 . length , n2 = s2 . length ; while ( p1 < n1 ) { int c1 = count ( s1 , p1 , s1 [ p1 ] ) , c2 = count ( s2 , p2 , s1 [ p1 ] ) ; if ( c1 > c2 ) {", "import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { FastScanner sc = new FastScanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int T = sc . nextInt ( ) ; for ( int ti = 0 ; ti < T ; ti ++ ) { char [ ] s = sc . next ( ) . toCharArray ( ) ; char [ ] t = sc . next ( ) . toCharArray ( ) ; int nowS = 0 ; int nowT = 0 ; boolean flg = true ; while ( nowS < s . length ) { char cs = s [ nowS ] ; int cnt = 0 ; while ( nowS < s . length && cs == s [ nowS ] ) { nowS ++ ; cnt ++ ; } while ( nowT < t . length && cs == t [ nowT ] ) { nowT ++ ; cnt -- ; }", "import java . util . * ; import java . io . * ; public class A { public static void main ( String args [ ] ) { FastScanner in = new FastScanner ( ) ; int t = in . nextInt ( ) ; L : while ( -- t >= 0 ) { char s [ ] = ( in . next ( ) + \" _ \" ) . toCharArray ( ) ; char p [ ] = ( in . next ( ) + \" _ \" ) . toCharArray ( ) ; int n1 = s . length ; int n2 = p . length ; int i = 0 , j = 0 ; boolean chk = false ; while ( i < n1 && j < n2 ) { if ( s [ i ] == p [ j ] ) { i ++ ; int ctr1 = 1 ; while ( i < n1 && s [ i ] == s [ i - 1 ] ) { i ++ ; ctr1 ++ ; } j ++ ; int ctr2 = 1 ; while ( j < n2 && p [ j ] == p [ j - 1 ] ) { j ++ ; ctr2 ++ ; } if ( ctr1 > ctr2 ) { chk = true ; break ; } } else { chk = true ; break ; } } if ( ! chk ) System . out . println ( \" YES \" ) ; else System . out . println ( \" NO \" ) ; } } Β " ]
[ "t = int ( input ( ) ) for zzz in range ( t ) : s1 = input ( ) s2 = input ( ) pos1 = 0 pos2 = 0 prev1 = 0 prev2 = 0 while ( pos1 < len ( s1 ) ) : let1 = s1 [ pos1 ] while pos1 < len ( s1 ) and s1 [ pos1 ] == let1 : pos1 += 1 while pos2 < len ( s2 ) and s2 [ pos2 ] == let1 : pos2 += 1 if ( pos1 - prev1 > pos2 - prev2 ) : print ( ' NO ' ) break prev1 = pos1 prev2 = pos2 else : if ( pos1 == len ( s1 ) and pos2 == len ( s2 ) ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE", "def do ( a , b ) -> bool : if a [ 0 ] != b [ 0 ] : return False i = 0 for j in range ( 1 , len ( b ) ) : if i < len ( a ) - 1 and a [ i + 1 ] == b [ j ] : i += 1 elif b [ j ] != a [ i ] : return False return i == len ( a ) - 1 for _ in range ( int ( input ( ) ) ) : a = input ( ) b = input ( ) print ( \" YES \" ) if do ( a , b ) else print ( \" NO \" ) Β  Β  Β  Β  Β  Β  Β  Β  Β  NEW_LINE", "for u in range ( int ( input ( ) ) ) : s = input ( ) r = input ( ) n , m = len ( s ) , len ( r ) s += '3' c = 0 for i in range ( m ) : if ( s [ c ] == r [ i ] and c < n ) : c += 1 elif ( r [ i ] != r [ i - 1 ] or i == 0 ) : c = c - 1 break if ( c == n ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE" ]
codeforces_1337_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . StringTokenizer ; import java . util . TreeMap ; Β  public class Main implements Runnable { int n , m , k ; static boolean use_n_tests = true ; Β  void solve ( FastScanner in , PrintWriter out , int testNumber ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int d = in . nextInt ( ) ; for ( int i = 0 ; i < 8 ; i ++ ) { int a1 = i & 1 ; int b1 = i & 2 ; int c1 = i & 4 ; int ta , tb , tc ; if ( a1 != 0 ) { ta = b ; } else { ta = a ; } if ( b1 != 0 ) { tb = c ; } else { tb = b ; } if ( c1 != 0 ) { tc = d ; } else { tc = c ; } if ( isOk ( ta , tb , tc ) ) { out . printf ( \" % d ▁ % d ▁ % d \\n \" , ta , tb , tc ) ; return ; } } } Β  boolean isOk ( int a , int b , int c ) { return a + b > c && a + c > b && c + b > a ; } Β ", "Β  import java . io . * ; import java . math . * ; import java . util . * ; Β  public class Main { public static void main ( String [ ] args ) throws IOException { FastReader scan = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; Task solver = new Task ( ) ; int T = scan . nextInt ( ) ; for ( int tt = 0 ; tt < T ; tt ++ ) solver . solve ( tt , scan , out ) ; out . close ( ) ; } Β  static class Task { public void solve ( int testNumber , FastReader scan , PrintWriter out ) { int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; out . println ( b + \" ▁ \" + c + \" ▁ \" + c ) ; } } Β  static class FastReader { BufferedReader br ; StringTokenizer st ; Β  public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } Β  public FastReader ( String s ) throws FileNotFoundException { br = new BufferedReader ( new FileReader ( new File ( s ) ) ) ; } Β  String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } Β  double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } Β  String nextLine ( ) { String str = \" \" ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }", "import java . util . * ; Β  public class Main { Β  public static void main ( String [ ] args ) {", "import java . util . * ; public class P2 { Β  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 ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; System . out . println ( b + \" ▁ \" + c + \" ▁ \" + c ) ; } } }", "import java . awt . * ; import java . util . * ; import java . io . * ; Β  public class Main { public static void main ( String [ ] args ) throws Exception { FastReader sc = new FastReader ( ) ; StringBuilder sb = new StringBuilder ( ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) , d = sc . nextInt ( ) ; sb . append ( a + \" ▁ \" + c + \" ▁ \" + c + \" \\n \" ) ; } System . out . println ( sb ) ; } } 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 ; } }" ]
[ "for _ in range ( int ( input ( ) ) ) : a , b , c , d = map ( int , input ( ) . split ( ) ) print ( b , c , c ) NEW_LINE", "from typing import Iterator Β  Β  def get_num_input ( ) -> Iterator [ int ] : return map ( int , input ( ) . split ( ) ) Β  Β  def main ( ) -> None : first : int second : int _ , first , second , _ = get_num_input ( ) Β  print ( first , second , second ) Β  Β  if __name__ == \" _ _ main _ _ \" : ONLY_ONCE : bool = False for _ in range ( 1 if ONLY_ONCE else int ( input ( ) ) ) : main ( ) NEW_LINE", "from __future__ import division , print_functionfrom collections import * from math import * from itertools import * from time import timeimport osimport sysfrom io import BytesIO , IOBase Β  if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip Β  ''' Notes : x ▁ + ▁ y ▁ > = ▁ zx ▁ + ▁ z ▁ > = ▁ yy ▁ + ▁ z ▁ > = ▁ x ''' Β  def main ( ) : a , b , c , d = map ( int , input ( ) . split ( ) ) x = b y = c z = c print ( f ' { x } ▁ { y } ▁ { z } ' ) Β  Β  NEW_LINE", "for s in [ * open ( 0 ) ] [ 1 : ] : a , b , c , d = s . split ( ) ; print ( a , c , c ) NEW_LINE" ]
codeforces_1163_A
[ "import java . util . * ; import java . io . * ; Β  public class Solution { Β  public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = br . readLine ( ) ; String [ ] info = a . split ( \" ▁ \" ) ; int numCats = Integer . parseInt ( info [ 0 ] ) ; int numDone = Integer . parseInt ( info [ 1 ] ) ; if ( numDone == 0 ) System . out . println ( 1 ) ; else if ( numDone <= numCats / 2 ) System . out . println ( numDone ) ; else System . out . println ( numCats - numDone ) ; } }", "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 ( ) ; if ( m == 0 ) { System . out . println ( 1 ) ; } else { System . out . println ( Math . min ( m , n - m ) ) ; } } } Β ", "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 ( ) ; int m = sc . nextInt ( ) ; if ( m == 0 ) { System . out . println ( \"1\" ) ; } else if ( n - m == 0 ) { System . out . println ( \"0\" ) ; } else { int k = Math . min ( m , n - m ) ; System . out . println ( k ) ; } } }", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; int count = 0 ; if ( m == 0 ) count = 1 ; else { count = Math . min ( m , n - m ) ; } System . out . println ( count ) ; } }", "import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int res = 0 ; if ( m == 0 || m == 1 ) res = 1 ; else if ( m <= n / 2 ) res = m ; else res = n - m ; System . out . println ( res ) ; } }" ]
[ "from math import ceiln , m = list ( map ( int , input ( ) . split ( ) ) ) if m == 0 : print ( 1 ) elif m <= ( n // 2 ) : print ( m ) else : if n % 2 != 0 and m == ceil ( n / 2 ) : print ( n // 2 ) else : print ( n - m ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) if n == m : print ( 0 ) elif m == 0 : print ( 1 ) elif n / m < 2 : print ( n - m ) else : print ( m ) NEW_LINE", "no_of_cats , no_of_cats_left = map ( int , input ( ) . split ( ) ) Β  l = [ ] Β  Β  if ( no_of_cats_left == 0 ) : print ( 1 ) elif ( no_of_cats % 2 == 0 ) : if ( no_of_cats // 2 == no_of_cats_left ) : print ( no_of_cats_left ) elif ( no_of_cats_left < no_of_cats // 2 ) : print ( no_of_cats_left ) else : print ( no_of_cats - no_of_cats_left ) else : if ( no_of_cats_left <= no_of_cats // 2 ) : print ( no_of_cats_left ) else : print ( no_of_cats - no_of_cats_left ) Β  Β  Β  Β  NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) print ( min ( max ( m , 1 ) , n - m ) ) NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) if m != 0 : print ( min ( m , n - m ) ) else : print ( 1 ) NEW_LINE" ]
codeforces_353_A
[ "import java . util . * ; public class cl { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int top_sum = 0 ; int bottom_sum = 0 ; boolean diff = false ; for ( int i = 0 ; i < n ; i ++ ) { int top = in . nextInt ( ) ; int bottom = in . nextInt ( ) ; if ( ( bottom + top ) % 2 != 0 ) diff = true ; top_sum += top ; bottom_sum += bottom ; } if ( top_sum % 2 == 0 && bottom_sum % 2 == 0 ) System . out . println ( 0 ) ; else if ( top_sum % 2 != 0 && bottom_sum % 2 != 0 && n != 1 && diff ) System . out . println ( 1 ) ; else System . out . println ( - 1 ) ; } }", "import java . util . * ; public class cl { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int top_sum = 0 ; int bottom_sum = 0 ; boolean diff = false ; for ( int i = 0 ; i < n ; i ++ ) { int top = in . nextInt ( ) ; int bottom = in . nextInt ( ) ; if ( ( bottom + top ) % 2 != 0 ) diff = true ; top_sum += top ; bottom_sum += bottom ; } if ( top_sum % 2 == 0 && bottom_sum % 2 == 0 ) System . out . println ( 0 ) ; else if ( top_sum % 2 != 0 && bottom_sum % 2 != 0 && n != 1 && diff ) System . out . println ( 1 ) ;" ]
[ "l1 = [ ] ; l2 = [ ] n = int ( input ( ) ) for __ in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) l1 . append ( x ) ; l2 . append ( y ) if sum ( l1 ) % 2 == 0 and sum ( l2 ) % 2 == 0 : print ( 0 ) elif sum ( l1 ) % 2 != 0 and sum ( l2 ) % 2 != 0 and n != 1 : c = - 1 for i , j in zip ( l1 , l2 ) : if abs ( i - j ) % 2 != 0 : c += 2 break print ( c ) else : print ( - 1 ) NEW_LINE", "n = int ( input ( ) ) odd = 0 x = y = 0 for i in range ( n ) : l , r = map ( int , input ( ) . split ( ) ) x += l y += r if ( l + r ) % 2 != 0 : odd += 1 if x % 2 == 0 and y % 2 == 0 : print ( 0 ) else : if odd % 2 == 0 and n != 1 and odd > 0 : print ( 1 ) else : print ( - 1 ) NEW_LINE", "n = int ( input ( ) ) l = 0 r = 0 flag = Falsefor i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) l += x r += y if ( x + y ) % 2 != 0 : flag = Trueif l % 2 == 0 and r % 2 == 0 : print ( '0' ) elif ( l + r ) % 2 == 0 and flag : print ( '1' ) else : print ( ' - 1' ) NEW_LINE", "n = int ( input ( ) ) Β  ls = 0 rs = 0 Β  has = False Β  for _ in range ( n ) : l , r = map ( int , input ( ) . split ( ) ) Β  ls += l rs += r Β  if not has : if l % 2 == 1 and r % 2 == 0 : has = True elif r % 2 == 1 and l % 2 == 0 : has = True Β  if ls % 2 == 0 and rs % 2 == 0 : ans = 0 elif ( ls % 2 == 0 ) ^ ( rs % 2 == 0 ) : ans = - 1 elif has : ans = 1 else : ans = - 1 Β  print ( ans ) NEW_LINE", "n = int ( input ( ) ) if n == 1 : x , y = [ int ( x ) for x in input ( ) . split ( ) ] if x % 2 + y % 2 >= 1 : print ( \" - 1\" ) else : print ( \"0\" ) else : s = ' False ' l = 0 r = 0 for i in range ( n ) : x , y = [ int ( x ) for x in input ( ) . split ( ) ] if y % 2 + x % 2 == 1 : s = ' True ' l += x r += y if l % 2 == 0 and r % 2 == 0 : print ( \"0\" ) elif l % 2 == 1 and r % 2 == 1 and s == ' True ' : print ( \"1\" ) else : print ( \" - 1\" ) NEW_LINE" ]
codeforces_1272_A
[ "import java . util . Scanner ; Β  public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNextInt ( ) ) { int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( Math . max ( 0 , Math . abs ( a - b ) + Math . abs ( a - c ) + Math . abs ( b - c ) - 4 ) ) ; } } } }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int n = sc . nextInt ( ) ; while ( n -- > 0 ) { long a = sc . nextLong ( ) , b = sc . nextLong ( ) , c = sc . nextLong ( ) ; System . out . println ( Math . max ( ( Math . abs ( a - b ) + Math . abs ( a - c ) + Math . abs ( b - c ) - 4 ) , 0 ) ) ; } } } }", "import java . util . * ; Β  public class Main { Β  public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; if ( a [ 0 ] == a [ 2 ] ) System . out . println ( 0 ) ; else if ( a [ 0 ] == a [ 1 ] ) { if ( a [ 0 ] + 1 == a [ 2 ] ) System . out . println ( 0 ) ; else System . out . println ( ( a [ 2 ] - a [ 0 ] - 2 ) * 2 ) ; } else if ( a [ 2 ] == a [ 1 ] ) { if ( a [ 0 ] + 1 == a [ 2 ] ) System . out . println ( 0 ) ; else System . out . println ( ( a [ 2 ] - a [ 0 ] - 2 ) * 2 ) ; } else { a [ 0 ] ++ ; a [ 2 ] -- ; System . out . println ( a [ 1 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] + a [ 2 ] - a [ 0 ] ) ; } } Β  } } Β  }" ]
[ "n = int ( input ( ) ) for i in range ( n ) : a , b , c = [ int ( x ) for x in input ( ) . split ( ) ] l , r = min ( a , b , c ) , max ( a , b , c ) if l < r : l += 1 if l < r : r -= 1 print ( 2 * ( r - l ) ) NEW_LINE", "import sysinput = sys . stdin . readline Β  for test in range ( int ( input ( ) ) ) : a = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) if a [ 0 ] == a [ 2 ] or a [ 0 ] + 1 == a [ 2 ] : print ( 0 ) continue a [ 0 ] += 1 a [ 1 ] = a [ 0 ] a [ 2 ] -= 1 ans = abs ( a [ 0 ] - a [ 1 ] ) + abs ( a [ 0 ] - a [ 2 ] ) + abs ( a [ 1 ] - a [ 2 ] ) print ( ans ) NEW_LINE", "import sysinput = sys . stdin . readline Β  for test in range ( int ( input ( ) ) ) : a = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) if a [ 0 ] == a [ 1 ] and a [ 1 ] == a [ 2 ] : res = 0 else : res = 4 ans = abs ( a [ 0 ] - a [ 1 ] ) + abs ( a [ 0 ] - a [ 2 ] ) + abs ( a [ 1 ] - a [ 2 ] ) print ( max ( 0 , ans - res ) ) NEW_LINE", "\"\"\" s ▁ = ▁ input ( ) l = [ ] i = 0lens ▁ = ▁ len ( s ) while ( i < len ( s ) ) : ▁ ▁ ▁ ▁ l . append ( s [ i : i + 2 ] ) ▁ ▁ ▁ ▁ i + = 2len1 ▁ = ▁ len ( l ) if ▁ len1 = = 1 : ▁ ▁ ▁ ▁ print ( \" NO \" ) else : ▁ ▁ ▁ ▁ if ▁ lens % 2 = = 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ \" AB \" ▁ in ▁ l ▁ and ▁ \" BA \" ▁ in ▁ l : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" YES \" ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" NO \" ) ▁ ▁ ▁ ▁ else : Β  ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ \" AB \" ▁ in ▁ l ▁ and ▁ \" BA \" ▁ in ▁ l : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" YES \" ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ # ▁ print ( l ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ \" AB \" ▁ in ▁ l ▁ and ▁ \" BA \" ▁ not ▁ in ▁ l : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s . find ( \" AB \" ) ! = lens - 3 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s = \" \" ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s + = l [ len1-2 ] [ 1 ] + l [ len1-1 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s = = \" BA \" : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" YES \" ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" NO \" ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" NO \" ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ elif ▁ \" BA \" ▁ in ▁ l ▁ and ▁ \" AB \" ▁ not ▁ in ▁ l : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s . find ( \" BA \" ) ! = lens - 3 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s = \" \" ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s + = l [ len1-2 ] [ 1 ] + l [ len1-1 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s = = \" AB \" : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" YES \" ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" NO \" ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" NO \" ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" NO \" ) \"\"\" \"\"\" s ▁ = ▁ input ( ) ab = s . find ( \" AB \" ) ba ▁ = ▁ s . find ( \" BA \" ) if ▁ s . find ( \" BA \" , ab + 2 ) ! = - 1 ▁ and ▁ ab ! = - 1 : ▁ ▁ ▁ ▁ print ( \" YES \" ) elif ▁ s . find ( \" AB \" , ba + 2 ) ! = - 1 ▁ and ▁ ba ! = - 1 : ▁ ▁ ▁ ▁ print ( \" YES \" ) else : ▁ ▁ ▁ ▁ print ( \" NO \" ) \"\"\" Β  \"\"\" n , m ▁ = ▁ map ( int , input ( ) . split ( ) ) if ▁ m % 2 ! = 0 : ▁ ▁ ▁ ▁ l = [ ( m + 1 ) / /2 ] ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( 1 , ( m + 1 ) / /2 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l . append ( ( m + 1 ) / /2 ▁ - ▁ i ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l . append ( ( m + 1 ) / /2 ▁ + ▁ i ) else : ▁ ▁ ▁ ▁ if ▁ m = = 2 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l = [ 1,2 ] ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l = [ m / /2 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( 1 , m / /2 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l . append ( m / /2 + i ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l . append ( m / /2 - i ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ l . append ( m ) ans ▁ = ▁ l * ( n / / len ( l ) ) ans + = l [ 0 : n % len ( l ) ] for ▁ i ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ print ( ans [ i ] ) \"\"\" \"\"\" def ▁ main ( ) : ▁ ▁ ▁ ▁ t ▁ = ▁ int ( input ( ) ) ▁ ▁ ▁ ▁ for ▁ _ ▁ in ▁ range ( t ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ n ▁ = ▁ int ( input ( ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ n ▁ = ▁ str ( n ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ n = ▁ list ( n ) [ : : - 1 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ i = 0 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ while ( i < len ( n ) ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ n [ i ] = = \" 0 \" : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ n . remove ( n [ i ] ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" \" . join ( n ) ) if ▁ _ _ name _ _ ▁ = = ▁ ' _ _ main _ _ ' : ▁ ▁ ▁ ▁ main ( ) \"\"\" \"\"\" t ▁ = ▁ int ( input ( ) ) for ▁ _ ▁ in ▁ range ( t ) : ▁ ▁ ▁ ▁ s ▁ = ▁ input ( ) ▁ ▁ ▁ ▁ if ▁ len ( s ) %2 = = 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ q ▁ = ▁ s [ : len ( s ) / / 2 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t ▁ = ▁ s [ len ( s ) / / 2 : ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ q ▁ = ▁ sorted ( list ( q ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t ▁ = ▁ sorted ( ( list ( t ) ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ q = = t : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" YES \" ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" NO \" ) ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ q ▁ = ▁ s [ 0 : len ( s ) ▁ / / ▁ 2 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t ▁ = ▁ s [ len ( s ) ▁ / / ▁ 2 ▁ + 1 : ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ q ▁ = ▁ sorted ( list ( q ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t ▁ = ▁ sorted ( ( list ( t ) ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ q ▁ = = ▁ t : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" YES \" ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( \" NO \" ) \"\"\" import sysinput = sys . stdin . readline \"\"\" n = ▁ int ( input ( ) ) l = [ ] for ▁ _ ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ p ▁ = ▁ int ( input ( ) ) ▁ ▁ ▁ ▁ l . append ( p ) l . sort ( ) s = [ ] for ▁ i ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ s . append ( l [ i ] * ( n - i ) ) # print ( s ) print ( max ( s ) ) \"\"\" \"\"\" t ▁ = ▁ int ( input ( ) ) for ▁ _ ▁ in ▁ range ( t ) : ▁ ▁ ▁ ▁ n ▁ = ▁ int ( input ( ) ) ▁ ▁ ▁ ▁ s ▁ = ▁ list ( map ( int , input ( ) . split ( ) ) ) ▁ ▁ ▁ ▁ cnt = 1 ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( len ( s ) -1 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ # print ( s [ i ] ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s [ i ] > = s [ i + 1 ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ cnt + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s [ i + 1 ] = s [ i ] ▁ ▁ ▁ ▁ print ( cnt ) \"\"\" Β  Β  NEW_LINE" ]
codeforces_807_A
[ "import java . util . Scanner ; Β  public class JavaApplication1 { Β  public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int rounds = input . nextInt ( ) ; int [ ] befor = new int [ rounds ] ; int [ ] after = new int [ rounds ] ; boolean check = true ; for ( int i = 0 ; i < rounds ; i ++ ) { befor [ i ] = input . nextInt ( ) ; after [ i ] = input . nextInt ( ) ; if ( befor [ i ] != after [ i ] ) { System . out . println ( \" rated \" ) ; check = false ; break ; } } if ( check ) { for ( int i = 1 ; i < rounds ; i ++ ) { if ( befor [ i - 1 ] < befor [ i ] ) { System . out . println ( \" unrated \" ) ; check = false ; break ; } } } if ( check ) System . out . println ( \" maybe \" ) ; input . close ( ) ; } }", "import java . util . Scanner ; Β  public class IsRated { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; short a = sc . nextShort ( ) ; short d = 0 , aux = Short . MAX_VALUE ; boolean e = false , f = false ; for ( int i = 0 ; i < a ; i ++ ) { short b = sc . nextShort ( ) ; short c = sc . nextShort ( ) ; if ( b != c ) { e = true ; } if ( b == c ) { d ++ ; } if ( aux < b ) { f = true ; } aux = b ; } if ( e ) { System . out . println ( \" rated \" ) ; } else if ( f ) { System . out . println ( \" unrated \" ) ; } else if ( d == a ) { System . out . println ( \" maybe \" ) ; } } }", "import java . util . * ; public class IsItRated { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int in = sc . nextInt ( ) ; boolean diff = false ; Integer [ ] arr = new Integer [ in ] ; Integer [ ] hold = new Integer [ in ] ; for ( int i = 0 ; i < in ; i ++ ) { int temp = sc . nextInt ( ) ; arr [ i ] = sc . nextInt ( ) ; if ( arr [ i ] != temp ) diff = true ; hold [ i ] = arr [ i ] ; } if ( diff ) System . out . println ( \" rated \" ) ; else { Arrays . sort ( arr , Collections . reverseOrder ( ) ) ; boolean out = false ; for ( int i = 0 ; i < in ; i ++ ) { if ( arr [ i ] != hold [ i ] ) { System . out . println ( \" unrated \" ) ; out = true ; break ; } } if ( ! out ) System . out . println ( \" maybe \" ) ; } } }", "import java . util . * ; Β  public class NewClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , lp = 4126 ; boolean changed = false , ni = true ; for ( int i = 0 ; i < n ; i ++ ) { int b = sc . nextInt ( ) , a = sc . nextInt ( ) ; if ( b != a ) { changed = true ; break ; } if ( lp < b ) { ni = false ; } lp = b ; } if ( changed ) System . out . println ( \" rated \" ) ; else if ( ni ) System . out . println ( \" maybe \" ) ; else System . out . println ( \" unrated \" ) ; } }" ]
[ "li = list ( ) for _ in range ( int ( input ( ) ) ) : b , a = map ( int , input ( ) . split ( ) ) li . append ( a ) if b != a : print ( \" rated \" ) breakelse : li2 = sorted ( li ) li . reverse ( ) if li == li2 : print ( \" maybe \" ) else : print ( \" unrated \" ) NEW_LINE", "n = int ( input ( ) ) a = [ ] fl = 1 for i in range ( n ) : a . append ( [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] ) if ( a [ - 1 ] [ 0 ] != a [ - 1 ] [ 1 ] ) : fl = 0 if ( not fl ) : print ( \" rated \" ) else : fl = 1 for i in range ( 1 , n ) : if ( a [ i - 1 ] [ 0 ] < a [ i ] [ 0 ] ) : fl = 0 if ( fl ) : print ( \" maybe \" ) else : print ( \" unrated \" ) NEW_LINE", "num = int ( input ( ) ) participants = [ ] for i in range ( num ) : participant = input ( ) . split ( ) participants . append ( participant ) i = 0 for j in range ( num ) : if int ( participants [ j ] [ 0 ] ) != int ( participants [ j ] [ 1 ] ) : print ( ' rated ' ) break elif j == num - 1 : while i < num - 1 : Β  if int ( participants [ i ] [ 1 ] ) < int ( participants [ i + 1 ] [ 1 ] ) : print ( ' unrated ' ) break i += 1 else : print ( ' maybe ' ) NEW_LINE", "n = int ( input ( ) ) prev = 0 count = - 1 f = 0 for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) NEW_LINE", "cases = int ( input ( ) ) Β  arr = [ ] while cases : cases -= 1 a , b = map ( int , input ( ) . split ( ) ) if a != b : print ( \" rated \" ) exit ( ) arr . append ( a ) Β  sor = sorted ( arr , reverse = True ) Β  if arr == sor : print ( \" maybe \" ) else : print ( \" unrated \" ) NEW_LINE" ]
codeforces_1159_B
[ "import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; Β ", "import java . util . * ; import java . math . * ; import java . io . * ; import java . lang . * ; 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 ( final 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 ( final IOException e ) { e . printStackTrace ( ) ; } return str ; } Β  int [ ] nextIntArray ( final int n ) { final int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( next ( ) ) ; } return a ; } Β  } Β  private static long startTime = System . currentTimeMillis ( ) ; Β  public static void main ( final String [ ] args ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; int a [ ] = sc . nextIntArray ( n ) ; int min = Integer . MAX_VALUE ; for ( int i = 1 ; i <= n ; i ++ ) {", "import java . io . BufferedInputStream ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . List ; import java . util . StringTokenizer ; import java . util . TreeMap ; Β  public class Main { public static void main ( String [ ] args ) throws FileNotFoundException , IOException { InputReader in = new InputReader ( new BufferedInputStream ( System . in ) ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; TaskB solver = new TaskB ( ) ;", "import java . util . * ; Β  public class CodeForces1159B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { min = Math . min ( min , input . nextInt ( ) / Math . max ( i , n - i - 1 ) ) ; } System . out . println ( min ) ; } }" ]
[ "n = int ( input ( ) ) l = [ int ( x ) for x in input ( ) . split ( ) ] ans = 1e10 for i in range ( n ) : ans = min ( ans , l [ i ] // max ( n - i - 1 , i ) ) print ( ans ) NEW_LINE", "n , a , k = int ( input ( ) ) , list ( map ( int , input ( ) . split ( ) ) ) , 10 ** 9 for i in range ( n ) : k = min ( k , a [ i ] // ( max ( n - i - 1 , i ) ) ) print ( k ) NEW_LINE", "n = int ( input ( ) ) l = [ int ( x ) for x in input ( ) . split ( ) ] ans = 1e10 for i in range ( n ) : ans = min ( ans , l [ i ] // max ( n - i - 1 , i ) ) print ( ans ) Β  NEW_LINE", "n = int ( input ( ) ) Β  s = list ( map ( int , input ( ) . split ( ) ) ) ex = 10 ** 9 Β  for i in range ( n ) : ex = min ( ex , s [ i ] // max ( i , n - i - 1 ) ) print ( ex ) NEW_LINE" ]
codeforces_1321_A
[ "import java . math . * ; import java . util . * ; import java . io . * ; Β  public class CFA { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; private static final long MOD = 1000L * 1000L * 1000L + 7 ; private static final int [ ] dx = { 0 , - 1 , 0 , 1 } ; private static final int [ ] dy = { 1 , 0 , - 1 , 0 } ; private static final String yes = \" Yes \" ; private static final String no = \" No \" ; Β  void solve ( ) {", "import java . math . BigInteger ; import java . util . * ; Β  public class Example { public static void main ( String [ ] args ) { Β Β  Scanner sc = new Scanner ( System . in ) ; Β  int t = sc . nextInt ( ) ; Β  int [ ] r = new int [ t ] ; int [ ] a = new int [ t ] ; for ( int i = 0 ; i < t ; i ++ ) { r [ i ] = sc . nextInt ( ) ; Β  } for ( int i = 0 ; i < t ; i ++ ) { a [ i ] = sc . nextInt ( ) ; Β  } int aa = 0 ; int b = 0 ; Β  for ( int i = 0 ; i < t ; i ++ ) { if ( a [ i ] != r [ i ] ) { if ( r [ i ] == 1 ) { aa ++ ; } else { b ++ ; } } } if ( aa != 0 ) { int x = 1 + b / aa ; Β  System . out . println ( x ) ; Β  } else { System . out . println ( - 1 ) ; } Β Β  } } Β Β ", "import java . io . * ; import java . util . * ; Β  public class Main { Β Β  public static void main ( String [ ] args ) throws IOException { int n = sc . nextInt ( ) ; int [ ] r = sc . nextIntArr ( n ) ; int [ ] b = sc . nextIntArr ( n ) ; int R = 0 , B = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( r [ i ] != b [ i ] ) { if ( r [ i ] == 1 ) R ++ ; else B ++ ; } }", "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 { Β  int n = sc . nextInt ( ) ; int arr [ ] = sc . readArray ( n ) ; int b [ ] = sc . readArray ( n ) ; int ff = 0 , ss = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == b [ i ] ) continue ; if ( arr [ i ] == 1 ) ff ++ ; else ss ++ ; } if ( ff == 0 ) { System . out . println ( - 1 ) ; return ; } ss ++ ; int ans = ceil ( ss , ff ) ; System . out . println ( ans ) ; Β  } Β " ]
[ "Β  cases = int ( input ( ) ) Β  arr1 = ( map ( int , input ( ) . split ( ) ) ) arr2 = ( map ( int , input ( ) . split ( ) ) ) Β  lost = 0 win = 0 Β  for i , j in zip ( arr1 , arr2 ) : if i == 1 and j == 0 : win += 1 elif i == 0 and j == 1 : lost += 1 Β  if win == 0 : print ( - 1 ) else : ans = ( lost + win - 1 ) // win if ans * win == lost : ans += 1 print ( ans ) Β  Β  NEW_LINE", "n = int ( input ( ) ) X = list ( map ( int , input ( ) . split ( ) ) ) Y = list ( map ( int , input ( ) . split ( ) ) ) a = 0 b = 0 for i in range ( n ) : a += X [ i ] > Y [ i ] b += X [ i ] < Y [ i ] if a == 0 : print ( - 1 ) else : print ( b // a + 1 ) NEW_LINE", "def solve ( ) : n = int ( input ( ) ) r = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) s1 = { n + 1 } s2 = { n + 1 } for i in range ( n ) : if r [ i ] == 1 : s1 . add ( i ) for i in range ( n ) : if b [ i ] == 1 : s2 . add ( i ) s1 . remove ( n + 1 ) s2 . remove ( n + 1 ) if s1 . issubset ( s2 ) or len ( s2 ) == n or len ( s1 ) == 0 : print ( - 1 ) return else : if len ( s1 ) > len ( s2 ) : print ( 1 ) return else : z = 0 for i in s1 : if not s2 . __contains__ ( i ) : NEW_LINE", "import mathimport operator Β  def lcm ( a , b ) : return ( a / math . gcd ( a , b ) ) * b def nCr ( n , r ) : return ( ( math . factorial ( n ) ) / ( ( math . factorial ( r ) ) * ( math . factorial ( n - r ) ) ) ) Β  Β  def isKthBitSet ( n , k ) : if ( n & ( 1 << ( k - 1 ) ) ) : return True else : return Falsedef maximalRectangle ( matrix ) : if not matrix or not matrix [ 0 ] : return 0 n = len ( matrix [ 0 ] ) height = [ 0 ] * ( n + 1 ) ans = 0 for row in matrix : for i in range ( n ) : height [ i ] = height [ i ] + 1 if row [ i ] == '0' else 0 stack = [ - 1 ] for i in range ( n + 1 ) : while height [ i ] < height [ stack [ - 1 ] ] : h = height [ stack . pop ( ) ] w = i - 1 - stack [ - 1 ] ans = max ( ans , h * w ) stack . append ( i ) return ans Β  Β  def matched ( str ) : count = 0 for i in str : if i == \" ( \" : count += 1 elif i == \" ) \" : count -= 1 if count < 0 : return False return count == 0 Β  def isValid ( h , m , nh , nm ) : l = [ 0 , 1 , 5 , - 1 , - 1 , 2 , - 1 , - 1 , 8 , - 1 ] if ( l [ h // 10 ] == - 1 or l [ h % 10 ] == - 1 or l [ m // 10 ] == - 1 or l [ m % 10 ] == - 1 ) : return False resh = l [ m % 10 ] * 10 + l [ m // 10 ] resm = l [ h % 10 ] * 10 + l [ h // 10 ] Β  return ( resh < nh and resm < nm ) Β  Β  Β  def solve ( ) : Β  NEW_LINE", "def main ( ) : n = int ( input ( ) ) r = readIntArr ( ) b = readIntArr ( ) rwin = 0 bwin = 0 for i in range ( n ) : if r [ i ] == 0 and b [ i ] == 1 : bwin += 1 elif r [ i ] == 1 and b [ i ] == 0 : rwin += 1 if rwin == 0 : print ( - 1 ) else : NEW_LINE" ]
codeforces_1415_A
[ "import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ; while ( t -- > 0 ) { int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int r = input . nextInt ( ) ; int c = input . nextInt ( ) ; Β  System . out . println ( Math . max ( ( r - 1 ) , ( n - r ) ) + Math . max ( ( c - 1 ) , ( m - c ) ) ) ; } } }", "import java . awt . List ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStreamWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . TreeSet ; Β Β  public final class CF_TechCup2021_R2_A { Β  static boolean verb = true ; static void log ( Object X ) { if ( verb ) System . err . println ( X ) ; } static void log ( Object [ ] X ) { if ( verb ) { for ( Object U : X ) System . err . print ( U + \" ▁ \" ) ; System . err . println ( \" \" ) ; } } static void log ( int [ ] X ) { if ( verb ) { for ( int U : X ) System . err . print ( U + \" ▁ \" ) ; System . err . println ( \" \" ) ; } } static void log ( int [ ] X , int L ) { if ( verb ) { for ( int i = 0 ; i < L ; i ++ ) System . err . print ( X [ i ] + \" ▁ \" ) ; System . err . println ( \" \" ) ; } } static void log ( long [ ] X ) { if ( verb ) { for ( long U : X ) System . err . print ( U + \" ▁ \" ) ; System . err . println ( \" \" ) ; } } Β  static void logWln ( Object X ) { if ( verb ) System . err . print ( X ) ; } static void info ( Object o ) { System . out . println ( o ) ; } static void output ( Object o ) { outputWln ( \" \" + o + \" \\n \" ) ; } static void outputWln ( Object o ) { try { out . write ( \" \" + o ) ; } catch ( Exception e ) { } } Β Β Β ", "import java . io . * ; import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tc = sc . nextInt ( ) ; for ( int i = 0 ; i < tc ; i ++ ) { int n = sc . nextInt ( ) - 1 ; int m = sc . nextInt ( ) - 1 ; int r = sc . nextInt ( ) - 1 ; int c = sc . nextInt ( ) - 1 ; int max = 0 ; Β  max = Math . max ( r + c , n - r + m - c ) ; max = Math . max ( max , n - r + c ) ; max = Math . max ( max , r + m - c ) ; System . out . println ( max ) ; } } }", "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int max = Math . abs ( 1 - r ) + Math . abs ( 1 - c ) ; max = Math . max ( max , ( Math . abs ( n - r ) + Math . abs ( 1 - c ) ) ) ; max = Math . max ( max , ( Math . abs ( n - r ) + Math . abs ( m - c ) ) ) ; max = Math . max ( max , ( Math . abs ( 1 - r ) + Math . abs ( m - c ) ) ) ; System . out . println ( max ) ; } } }" ]
[ "t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n , m , r , c = map ( int , input ( ) . split ( ) ) NEW_LINE q = max ( r - 1 , n - r ) NEW_LINE w = max ( c - 1 , m - c ) NEW_LINE print ( q + w ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , m , r , c = map ( int , input ( ) . split ( ) ) NEW_LINE print ( max ( r - 1 , n - r ) + max ( c - 1 , m - c ) ) NEW_LINE", "for _ in range ( int ( input ( ) ) ) : n , m , r , c = map ( int , input ( ) . split ( ) ) NEW_LINE print ( max ( r - 1 , n - r ) + max ( c - 1 , m - c ) ) NEW_LINE", "import sys Β  NEW_LINE def main ( ) : inp = sys . stdin . read ( ) . strip ( ) . split ( ' \\n ' ) NEW_LINE out = [ ] NEW_LINE for s in inp [ 1 : ] : n , m , r , c = map ( int , s . split ( ) ) NEW_LINE out . append ( max ( n - r , r - 1 ) + max ( m - c , c - 1 ) ) NEW_LINE return out NEW_LINE print ( * main ( ) , sep = ' \\n ' ) NEW_LINE" ]
codeforces_1344_B
[ "import java . io . * ; import java . util . * ; public class CF1344B {", "import java . io . BufferedReader ; import java . io . DataInputStream ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; Β Β Β  public class Codeforces { Β  public static void main ( String args [ ] ) throws IOException {", "import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . * ; Β  public class B_Monopole_Magnets { static int N ; static int M ; public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ;", "import java . util . * ; import java . io . * ; Β  public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; } Β  public static long mod = 17352642619633L ; Β  int N ; int M ; char [ ] [ ] g ; Β  int [ ] dx = { 0 , 0 , - 1 , 1 } ; int [ ] dy = { 1 , - 1 , 0 , 0 } ; Β  void run ( FastScanner in , PrintWriter out ) { Β Β  N = in . nextInt ( ) ; M = in . nextInt ( ) ; g = new char [ N ] [ ] ; Β  for ( int i = 0 ; i < N ; i ++ ) { g [ i ] = in . next ( ) . toCharArray ( ) ; } Β  int [ ] rowSegs = new int [ N ] ; int [ ] colSegs = new int [ M ] ; Β " ]
[ "class UnionFind : def __init__ ( self , n ) : self . parent = list ( range ( n ) ) def find ( self , a ) : NEW_LINE" ]
codeforces_876_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 ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = 0 ; if ( c < a && c < b ) { if ( n == 1 ) { System . out . println ( \"0\" ) ; } else { d = Math . min ( ( a + ( c * ( n - 2 ) ) ) , ( b + ( c * ( n - 2 ) ) ) ) ; System . out . println ( d ) ; } } else { d = Math . min ( ( a * ( n - 1 ) ) , ( b * ( n - 1 ) ) ) ; System . out . println ( d ) ; } } }", "import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; String [ ] d = { \" R \" , \" O \" , \" E \" } ; int [ ] d1 = { a , b , c } ; int count = 1 , dist = 0 ; String curr = d [ 0 ] ; int e = a , f = b ; while ( count != n ) { count ++ ; int min = Math . min ( e , f ) ; dist = dist + min ; if ( min == e ) { curr = d [ 1 ] ; f = c ; e = a ; } else { curr = d [ 2 ] ; e = c ; f = b ; } } System . out . println ( dist ) ; } }", "import java . util . * ; Β  public class Absolutezero { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Β  int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int possible1 = a ; int possible2 = b ; n = n - 1 ; int sum = 0 ; for ( int j = n ; j >= 1 ; j -- ) { int min = Math . min ( possible1 , possible2 ) ; sum = sum + min ; if ( min == a ) { possible1 = a ; possible2 = c ; } else if ( min == b ) { possible1 = b ; possible2 = c ; } else { if ( possible1 == a ) { possible1 = b ; possible2 = c ; } else { possible1 = a ; possible2 = c ; } } Β  } System . out . println ( sum ) ; Β Β  } Β  static int countSetBits ( int n ) { int count = 0 ; while ( n > 0 ) { count += n & 1 ; n >>= 1 ; } return count ; } Β  public List < Integer > getDivisors ( int n ) { List < Integer > list = new ArrayList < > ( ) ; for ( int d = 2 ; d * d <= n ; d ++ ) { while ( n % d == 0 ) { list . add ( d ) ; n /= d ; } } if ( n > 1 ) { list . add ( n ) ; } return list ; } Β  public int lcm ( int n1 , int n2 ) { int gcd = 1 ; for ( int i = 1 ; i <= n1 && i <= n2 ; ++ i ) {", "import java . util . Scanner ; Β  public class problem101 { Β  public static void main ( String [ ] args ) {" ]
[ "no_of_meals = int ( input ( ) ) ro = int ( input ( ) ) re = int ( input ( ) ) oe = int ( input ( ) ) distance = 0 home = \" r \" Β  for each in range ( 0 , no_of_meals - 1 ) : if ( home == \" r \" ) : if ( ro > re ) : home = \" e \" distance += re else : home = \" o \" distance += ro elif ( home == \" o \" ) : if ( ro > oe ) : home = \" e \" distance += oe else : home = \" r \" distance += ro else : if ( re > oe ) : home = \" o \" distance += oe else : home = \" r \" distance += re print ( distance ) Β  Β  NEW_LINE", "n = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) n -= 1 if n == 0 : print ( 0 ) else : print ( min ( a , b , c ) * ( n - 1 ) + min ( a , b ) ) NEW_LINE", "n = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) if min ( a , b , c ) == a or min ( a , b , c ) == b or n == 1 : print ( min ( a , b ) * ( n - 1 ) ) else : print ( min ( a , b ) + ( c * ( n - 2 ) ) ) NEW_LINE", "n = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) x = min ( a , b ) y = min ( a , b , c ) print ( 0 if n == 1 else x + y * ( n - 2 ) ) NEW_LINE", "n = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) i = 0 k = 0 m = 0 d = 0 while k != min ( a , b , c ) and d != ( n - 1 ) : if i == 0 : k = min ( a , b ) i = 1 if k == a else 2 m += k d += 1 elif i == 1 : k = min ( a , c ) i = 0 if k == a else 2 m += k d += 1 else : k = min ( b , c ) i = 0 if k == b else 1 m += k d += 1 print ( m if d == n else ( m + ( ( n - d - 1 ) * ( min ( a , b , c ) ) ) ) ) NEW_LINE" ]
codeforces_1418_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;", "import java . util . Scanner ; Β  public class A1418 { Β  public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { long X = in . nextLong ( ) ; long Y = in . nextLong ( ) ; long K = in . nextLong ( ) ; long sticksNeeded = K * ( Y + 1 ) ; long answer = K + ( sticksNeeded - 1 + X - 2 ) / ( X - 1 ) ; System . out . println ( answer ) ; } } Β  }", "import java . util . Scanner ; Β  public class BuyingTorches { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int testCases = scanner . nextInt ( ) ; Β  while ( testCases -- != 0 ) { Β  long x = scanner . nextInt ( ) ; long y = scanner . nextInt ( ) ; long k = scanner . nextInt ( ) ; Β  System . out . println ( solve ( x , y , k ) ) ; } } Β  public static long solve ( long x , long y , long k ) { x -- ; long a = y * k + ( k - 1 ) + ( x - 1 ) ; return a / x + k ; } } Β Β ", "import java . util . Scanner ; Β  public class Main { public static void main ( String [ ] args ) { Β  Scanner scanner = new Scanner ( System . in ) ; int cases = scanner . nextInt ( ) ; Β  for ( int i = 0 ; i < cases ; i ++ ) { long x = scanner . nextInt ( ) ; long y = scanner . nextInt ( ) ; long k = scanner . nextInt ( ) ; Β  long total = k + y * k - 1 ; Β  long x2 = x - 1 ; long trade = ( total + x2 - 1 ) / x2 ; trade += k ; Β  System . out . println ( trade ) ; } } }" ]
[ "import matht = int ( input ( ) ) NEW_LINE for _ in range ( t ) : x , y , k = map ( int , input ( ) . split ( ) ) NEW_LINE coal = ( ( k * y + k - 1 ) + x - 2 ) NEW_LINE totalstcks = k + coal - 1 NEW_LINE trade = coal // ( x - 1 ) NEW_LINE ans = trade + k NEW_LINE print ( ans ) NEW_LINE", "t = int ( input ( ) ) NEW_LINE for i in range ( t ) : x , y , k = map ( int , input ( ) . split ( ) ) NEW_LINE need = int ( k * y ) NEW_LINE if x == 2 : NEW_LINE INDENT print ( need + k - 1 + k ) else : NEW_LINE rem = ( need + k - 1 ) % ( x - 1 ) NEW_LINE DEDENT count = ( need + k - 1 ) // ( x - 1 ) NEW_LINE if rem != 0 : NEW_LINE INDENT print ( count + k + 1 ) else : NEW_LINE print ( int ( count ) + k ) NEW_LINE DEDENT", "import sysinput = sys . stdin . readline Β  for test in range ( int ( input ( ) ) ) : x , y , k = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE need = y * k + k - 1 NEW_LINE", "import sysinput = sys . stdin . readlinefor NEW_LINE _ in range ( int ( input ( ) ) ) : a , b , c = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE print ( c + ( b * c + c - 1 + a + - 2 ) // ( a - 1 ) ) NEW_LINE", "import mathtestcases = int ( input ( ) ) NEW_LINE for i in range ( 0 , testcases ) : xyk = input ( ) NEW_LINE m = xyk . split ( ) NEW_LINE x = int ( m [ 0 ] ) NEW_LINE y = int ( m [ 1 ] ) NEW_LINE k = int ( m [ 2 ] ) NEW_LINE s = 0 NEW_LINE r = ( k * y + k - 1 ) % ( x - 1 ) NEW_LINE if ( r == 0 ) : NEW_LINE INDENT s = ( k * y + k - 1 ) // ( x - 1 ) else : NEW_LINE s = 1 + ( k * y + k - 1 ) // ( x - 1 ) NEW_LINE DEDENT t = k + s NEW_LINE print ( t ) NEW_LINE" ]
codeforces_768_A
[ "import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX_VALUE ; int max = Integer . MIN_VALUE ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; min = Math . min ( min , x ) ; max = Math . max ( max , x ) ; arr [ i ] = x ; } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] != min & arr [ i ] != max ) { count ++ ; } } System . out . println ( count ) ; } }", "import java . util . * ; public class OathOfNightsWatch { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int out = 0 ; int max = arr [ n - 1 ] ; int min = arr [ 0 ] ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( min < arr [ i ] && max > arr [ i ] ) out ++ ; } System . out . println ( out ) ; } }", "import java . util . * ; Β  public class Runner { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int stewards = sc . nextInt ( ) ; sc . nextLine ( ) ; int [ ] stewardsArr = stringToIntArray ( sc . nextLine ( ) ) ; int min = stewardsArr [ 0 ] ; int max = stewardsArr [ 0 ] ; for ( int i = 1 ; i < stewards ; i ++ ) { min = Math . min ( min , stewardsArr [ i ] ) ; max = Math . max ( max , stewardsArr [ i ] ) ; } int edgesFound = 0 ; for ( int i = 0 ; i < stewards ; i ++ ) { if ( stewardsArr [ i ] == min || stewardsArr [ i ] == max ) edgesFound ++ ; } if ( min == max ) System . out . println ( 0 ) ; else System . out . println ( stewards - edgesFound ) ; } Β Β  private static int [ ] stringToIntArray ( String str ) { String [ ] strs = str . trim ( ) . split ( \" ▁ \" ) ; int [ ] intArr = new int [ strs . length ] ; for ( int i = 0 ; i < strs . length ; i ++ ) { intArr [ i ] = Integer . parseInt ( strs [ i ] ) ; } return intArr ; } Β  }", "import java . util . Arrays ; import java . util . Scanner ; Β Β  public class Main { Β  public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; int [ ] arr = new int [ x ] ; int a ; for ( int i = 0 ; i < x ; i ++ ) { arr [ i ] = in . nextInt ( ) ; } Arrays . sort ( arr ) ; int ans = 0 ; for ( int i = 1 ; i < x - 1 ; i ++ ) { if ( arr [ 0 ] < arr [ i ] && arr [ x - 1 ] > arr [ i ] ) ans ++ ; } System . out . println ( ans ) ; } }" ]
[ "n = int ( input ( ) ) s = list ( map ( int , input ( ) . split ( ) ) ) c = n - s . count ( max ( s ) ) - s . count ( min ( s ) ) print ( c if c >= 0 else 0 ) NEW_LINE", "n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) c1 , c2 = 0 , 0 m = min ( l ) mx = max ( l ) if n == 1 or n == 2 : print ( 0 ) elif mx == m : print ( 0 ) else : for i in range ( n ) : if l [ i ] == mx : c1 += 1 if l [ i ] == m : c2 += 1 print ( n - c1 - c2 ) NEW_LINE", "n = input ( ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) mi = min ( arr ) ma = max ( arr ) c = 0 Β  for i in arr : if i != mi and i != ma : c += 1 Β  print ( c ) Β  Β  NEW_LINE", "n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) Β  x . sort ( ) Β  mini = x [ 0 ] maxi = x [ - 1 ] c1 = 0 c2 = 0 for i in range ( n ) : if x [ i ] == maxi : c1 += 1 if x [ i ] == mini : c2 += 1 Β  if maxi == mini : print ( 0 ) else : print ( n - c1 - c2 ) Β  Β  NEW_LINE", "input ( ) ; l = sorted ( map ( int , input ( ) . split ( ) ) ) print ( max ( 0 , len ( l ) - l . count ( l [ 0 ] ) - l . count ( l [ - 1 ] ) ) ) NEW_LINE" ]
codeforces_1057_B
[ "import java . io . * ; import java . util . * ; Β  public class Main { Β  public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader inputReader = new InputReader ( inputStream ) ; PrintWriter printWriter = new PrintWriter ( outputStream ) ; Task task = new Task ( ) ; task . run ( inputReader , printWriter ) ; printWriter . close ( ) ; } Β  static class Task { Β  int n ; int [ ] r ; Β  private void read ( InputReader in ) { n = in . nextInt ( ) ; r = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { r [ i ] = in . nextInt ( ) ; } } Β  private void solve ( PrintWriter out ) { int result = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int sum = 0 ; for ( int j = i ; j < n ; ++ j ) { sum += r [ j ] ; if ( sum > ( j - i + 1 ) * 100 && result < j - i + 1 ) { result = j - i + 1 ; } } } out . print ( result ) ; } Β  void run ( InputReader in , PrintWriter out ) { read ( in ) ; solve ( out ) ; } } Β Β  static class InputReader { private BufferedReader reader ; private StringTokenizer tokenizer ; Β  InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 1 << 15 ) ; tokenizer = null ; } Β  String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } Β  int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }", "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; Β  public class DDoS { 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 ( 1 , in , out ) ; out . close ( ) ; } Β  static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int ar [ ] = new int [ n ] ; int pre [ ] = new int [ n + 1 ] ; for ( int i = 0 ; i < n ; ++ i ) { ar [ i ] = in . nextInt ( ) ; } for ( int i = 1 ; i <= n ; ++ i ) { pre [ i ] = pre [ i - 1 ] + ar [ i - 1 ] ; } int resp = 0 ; for ( int i = 1 ; i <= n ; ++ i ) { for ( int j = i ; j <= n ; ++ j ) { if ( pre [ j ] - pre [ i - 1 ] > 100 * ( j - i + 1 ) ) { resp = max ( resp , j - i + 1 ) ; } } } out . println ( resp ) ; } Β  private int max ( int resp , int i ) { return resp > i ? resp : i ; } } Β  static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; Β  public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } Β  public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } Β  public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Β  } }", "import java . util . * ; public class water { public static void main ( String args [ ] ) { Scanner ob = new Scanner ( System . in ) ; int n = ob . nextInt ( ) ; long a [ ] = new long [ n + 1 ] ; long sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { sum = sum + ob . nextInt ( ) ; a [ i ] = sum ; } long max = 0 ; for ( int i = 0 ; i <= n ; i ++ ) for ( int j = i ; j <= n ; j ++ ) if ( a [ j ] - a [ i ] > 100 * ( j - i ) ) max = Math . max ( max , j - i ) ; System . out . println ( max ) ; } }", "import java . util . * ; import java . io . * ; Β  public class CF1057B { static FastReader in = new FastReader ( ) ; Β  public static void main ( String [ ] args ) { solve ( ) ; } Β  static void solve ( ) { int n = in . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } int [ ] psums = new int [ n + 1 ] ; for ( int i = 1 ; i < n + 1 ; i ++ ) { psums [ i ] = psums [ i - 1 ] + a [ i - 1 ] ; } Β  int longest = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { for ( int j = i ; j < n + 1 ; j ++ ) { if ( psums [ j ] - psums [ i - 1 ] > 100 * ( j - ( i - 1 ) ) ) longest = Math . max ( longest , ( j - ( i - 1 ) ) ) ; } } System . out . println ( longest ) ; } Β  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 ; } } } Β Β Β " ]
[ "from itertools import accumulate as acfrom collections import Counter as ccfrom bisect import bisect_left as bslfrom bisect import bisect as bsfrom math import factorial as ffrom collections import * from itertools import * from string import * from bisect import * from queue import * from heapq import * from math import * from sys import * from re import * def fast ( ) : return stdin . readline ( ) . strip ( ) def zzz ( ) : return [ int ( i ) for i in fast ( ) . split ( ) ] Β  Β  z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) ) Β  Β  def lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) def output ( answer ) : stdout . write ( str ( answer ) ) Β  Β  NEW_LINE", "from sys import stdin , stdoutfrom math import gcd , sqrtfrom collections import dequeinput = stdin . readlineR = lambda : map ( int , input ( ) . split ( ) ) I = lambda : int ( input ( ) ) S = lambda : input ( ) . rstrip ( ' \\n ' ) L = lambda : list ( R ( ) ) P = lambda x : stdout . write ( x ) hg = lambda x , y : ( ( y + x - 1 ) // x ) * xpw = lambda x : 1 if x == 1 else 1 + pw ( x // 2 ) chk = lambda x : chk ( x // 2 ) if not x % 2 else True if x == 1 else FalseN = 10 ** 6 + 7 v = [ ( i + 1 ) * 100 for i in range ( 5000 ) ] ans = 0 n = I ( ) a = L ( ) for i in range ( n ) : s = 0 for j in range ( i , n ) : s += a [ j ] if s > v [ j - i ] : ans = max ( ans , j - i + 1 ) print ( ans ) NEW_LINE", "n = int ( input ( ) ) Β  l = [ * map ( int , input ( ) . split ( ) ) ] mx = 0 mxs = 0 ''' for ▁ i ▁ in ▁ range ( n - 1 ) : ▁ ▁ ▁ ▁ t = 100 ▁ ▁ ▁ ▁ total = l [ i ] ▁ ▁ ▁ ▁ if ▁ total > = t : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ mxs + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( l [ i ] ) ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( i + 1 , n ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t + = 100 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ total + = l [ j ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ total > = t : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ mxs + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( l [ j ] ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ mx = max ( mx , mxs ) print ( mx ) ▁ ▁ ▁ ▁ ▁ ''' m = 0 for i in range ( n ) : s = 0 for j in range ( i , n ) : s = s + l [ j ] if ( s > ( j - i + 1 ) * 100 ) : m = max ( m , j - i + 1 ) print ( m ) NEW_LINE", "import sysinput = sys . stdin . readline Β  ''' Β  ''' Β  n = int ( input ( ) ) r = list ( map ( int , input ( ) . split ( ) ) ) prefix_sum = [ r [ 0 ] ] for i in range ( 1 , n ) : prefix_sum . append ( prefix_sum [ - 1 ] + r [ i ] ) Β  best = 0 done = Falsefor length in reversed ( range ( 1 , n + 1 ) ) : treshold = 100 * length for i in range ( n - length + 1 ) : pre = 0 if i == 0 else prefix_sum [ i - 1 ] total = prefix_sum [ i + length - 1 ] - pre if total > treshold : done = True best = length break if done : break Β  print ( best ) NEW_LINE", "import sysinput = sys . stdin . buffer . readline Β  n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) lst = [ a [ 0 ] ] for i in range ( 1 , n ) : lst . append ( lst [ - 1 ] + a [ i ] ) Β  mx = 0 for i in range ( n ) : for j in range ( i , n ) : if lst [ j ] - lst [ i ] + a [ i ] > 100 * ( j - i + 1 ) and j - i + 1 > mx : mx = j - i + 1 print ( mx ) NEW_LINE" ]
codeforces_301_B
[ "import java . io . * ; import java . util . * ; Β  public class Main { static PrintWriter out = new PrintWriter ( System . out ) ; static Scanner sc = new Scanner ( System . in ) ; static BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long mod = 998244353 ; long inv2 = 1 ; int step = 1 ; long [ ] ans ; Β  List < int [ ] > [ ] graph ; Β Β  public static void main ( String [ ] args ) throws IOException { Main main = new Main ( ) ; Β  main . solve ( ) ;" ]
[ "from sys import stdin , stdoutfrom math import inf Β  Β  def main ( ) : n , d = readline ( ) a = [ 0 ] + list ( readline ( ) ) + [ 0 ] x = [ 0 ] * n y = [ 0 ] * n NEW_LINE", "from sys import stdinfrom math import inf Β  Β  def main ( ) : n , d = readline ( ) a = [ 0 ] + list ( readline ( ) ) + [ 0 ] x = [ 0 ] * n y = [ 0 ] * n NEW_LINE", "from sys import stdinfrom math import inf Β  Β  def readline ( ) : return map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) Β  Β  def dijkstra ( ) : NEW_LINE", "from sys import stdinfrom math import inf def readline ( ) : return map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) def dijkstra ( ) : n , d = readline ( ) a = [ 0 ] + list ( readline ( ) ) + [ 0 ] x = [ 0 ] * n y = [ 0 ] * n for i in range ( n ) : x [ i ] , y [ i ] = readline ( ) lower_cost = [ inf ] * n lower_cost [ 0 ] = 0 visited = [ False ] * n for i in range ( n - 1 ) : lower_value = inf position = 0 for j in range ( n ) : if not visited [ j ] and lower_value > lower_cost [ j ] : lower_value = lower_cost [ j ] position = j if position == n - 1 : break visited [ position ] = True for k in range ( n ) : if not visited [ k ] : diff = lower_cost [ position ] + d * ( abs ( x [ k ] - x [ position ] ) + abs ( y [ k ] - y [ position ] ) ) - a [ position ] if lower_cost [ k ] > diff : lower_cost [ k ] = diff return lower_cost [ - 1 ] if __name__ == ' _ _ main _ _ ' : print ( dijkstra ( ) ) NEW_LINE", "from sys import stdin , stdoutfrom math import inf Β  Β  def main ( ) : n , d = readline ( ) a = [ 0 ] + list ( readline ( ) ) + [ 0 ] x = [ 0 ] * n y = [ 0 ] * n NEW_LINE" ]
codeforces_1105_A
[ "import java . io . * ; import java . util . * ; import java . math . * ; Β  public class Salemstick { public static void main ( String arg [ ] ) throws IOException { CustomInputReader sc = new CustomInputReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int a [ ] = sc . nextIntArr ( n ) ; int ans = Integer . MAX_VALUE , ft = 0 ; Β  for ( int t = 1 ; t < 101 ; ++ t ) { int sum = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( a [ i ] != t ) sum += Math . abs ( t - a [ i ] ) - 1 ; } Β  if ( ans > sum ) { ans = sum ; ft = t ; } } Β  pw . println ( ft + \" ▁ \" + ans ) ; Β " ]
[ "n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) sum1 = int ( 100000000 ) ans = int ( 0 ) for i in range ( 1 , 200 ) : sum2 = int ( 0 ) for j in range ( 0 , n ) : sum2 = sum2 + min ( int ( abs ( a [ j ] - ( i - 1 ) ) ) , int ( abs ( a [ j ] - ( i + 1 ) ) ) , int ( abs ( a [ j ] - i ) ) ) if sum2 < sum1 : sum1 = sum2 ans = iprint ( ans , end = \" ▁ \" ) print ( sum1 ) NEW_LINE", "n = int ( input ( ) ) a = [ int ( o ) for o in input ( ) . split ( ) ] ans = [ ] for i in range ( 1 , 101 ) : su = 0 for j in range ( n ) : su += min ( abs ( i - a [ j ] ) , abs ( i + 1 - a [ j ] ) , abs ( i - 1 - a [ j ] ) ) ans . append ( [ su , i ] ) lol = min ( ans [ : ] ) print ( * lol [ : : - 1 ] ) NEW_LINE", "def check_cost ( num ) : totCost = 0 for i in range ( len ( sticks ) ) : totCost += abs ( num - sticks [ i ] ) if num != sticks [ i ] : totCost -= 1 return totCost Β  numSticks = int ( input ( ) ) sticks = input ( ) . split ( ) sticks = [ int ( x ) for x in sticks ] sticksSet = set ( sticks ) sticksSet = list ( sticksSet ) sticks . sort ( ) checkList = [ ] for i in range ( len ( sticksSet ) ) : if sticksSet [ i ] - 1 > 0 and sticksSet [ i ] not in checkList : checkList . append ( sticksSet [ i ] - 1 ) if sticksSet [ i ] + 1 not in checkList : checkList . append ( sticksSet [ i ] + 1 ) checkList . sort ( ) minPrice = 999999999999999999999 minStick = 0 for i in range ( len ( checkList ) ) : curCost = check_cost ( checkList [ i ] ) if curCost == 0 : print ( checkList [ i ] , curCost ) exit ( ) if curCost < minPrice : minPrice = curCost minStick = checkList [ i ] print ( minStick , minPrice ) NEW_LINE", "n = int ( input ( ) ) stk = list ( map ( int , input ( ) . split ( ) ) ) t , mn = 0 , 1000000 for i in range ( 1 , 101 ) : s = 0 for j in range ( n ) : s += min ( abs ( stk [ j ] - i ) , abs ( stk [ j ] - i - 1 ) , abs ( stk [ j ] - i + 1 ) ) if mn > s : t , mn = i , sprint ( t , mn ) NEW_LINE", "n = input ( ) a = list ( map ( int , input ( ) . split ( ) ) ) Β  t = 0 count = 1000000 for i in range ( 1 , 101 ) : cost = sum ( 0 if k == i else abs ( i - k ) - 1 for k in a ) if cost < count : count = cost t = iprint ( t , count ) NEW_LINE" ]
codeforces_601_A
[ "import java . util . * ; public class tw { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] V = new int [ n + 1 ] [ n + 1 ] ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; V [ a ] [ b ] = 1 ; V [ b ] [ a ] = 1 ; } Queue < Integer > q = new LinkedList < > ( ) ; q . add ( 1 ) ; int [ ] d = new int [ n + 1 ] ; while ( ! q . isEmpty ( ) ) { int vertex = q . poll ( ) ; for ( int i = 2 ; i <= n ; i ++ ) { if ( d [ i ] == 0 && V [ vertex ] [ i ] != V [ 1 ] [ n ] ) { d [ i ] = d [ vertex ] + 1 ; q . add ( i ) ; } } } if ( d [ n ] == 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( d [ n ] ) ; } } }" ]
[ "import sys , os , ioimport math , bisect , operatorinf , mod = float ( ' inf ' ) , 10 ** 9 + 7 NEW_LINE", "from collections import defaultdictimport heapqn , m = map ( int , input ( \" \" ) . split ( ) ) rail_list = defaultdict ( list ) Β  for i in range ( m ) : start , end = map ( int , input ( \" \" ) . split ( ) ) rail_list [ start ] . append ( end ) rail_list [ end ] . append ( start ) Β  def dijkstra_on_road ( ) : dist_road = { i : float ( ' inf ' ) for i in range ( 1 , n + 1 ) } towns = set ( range ( 1 , n + 1 ) ) H_road = [ ( 0 , 1 ) ] while len ( H_road ) != 0 : curr_road_dist , curr_road_id = heapq . heappop ( H_road ) if curr_road_dist <= dist_road [ curr_road_id ] : road_neighbours = towns - set ( rail_list [ curr_road_id ] + [ curr_road_id ] ) for road_neigbour_id in road_neighbours : new_road_distance = curr_road_dist + 1 if new_road_distance < dist_road [ road_neigbour_id ] : dist_road [ road_neigbour_id ] = new_road_distance heapq . heappush ( H_road , ( new_road_distance , road_neigbour_id ) ) Β  return dist_road [ n ] Β  def dijkstra_on_rail ( ) : dist_rail = { i : float ( ' inf ' ) for i in range ( 1 , n + 1 ) } H_rail = [ ( 0 , 1 ) ] while len ( H_rail ) != 0 : curr_rail_dist , curr_rail_id = heapq . heappop ( H_rail ) if curr_rail_dist <= dist_rail [ curr_rail_id ] : for rail_neighbour_id in rail_list [ curr_rail_id ] : new_rail_distance = curr_rail_dist + 1 if new_rail_distance < dist_rail [ rail_neighbour_id ] : dist_rail [ rail_neighbour_id ] = new_rail_distance heapq . heappush ( H_rail , ( new_rail_distance , rail_neighbour_id ) ) Β  return dist_rail [ n ] Β  if n in rail_list [ 1 ] : road_time = dijkstra_on_road ( ) if road_time != float ( ' inf ' ) : print ( road_time ) else : print ( ' - 1' ) else : rail_time = dijkstra_on_rail ( ) if rail_time != float ( ' inf ' ) : print ( rail_time ) else : print ( ' - 1' ) Β  Β  Β  Β  NEW_LINE", "n , m = map ( int , input ( ) . split ( ) ) Β  A = [ [ 0 for i in range ( n ) ] for i in range ( n ) ] Β  for i in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) u -= 1 v -= 1 A [ u ] [ v ] = 1 A [ v ] [ u ] = 1 Β  dist = [ - 1 for i in range ( n ) ] dist [ 0 ] = 0 Β  Q = [ 0 ] Β  while len ( Q ) != 0 : u = Q . pop ( 0 ) for v in range ( n ) : if dist [ v ] == - 1 and A [ v ] [ u ] != A [ 0 ] [ n - 1 ] : dist [ v ] = dist [ u ] + 1 Q . append ( v ) print ( dist [ n - 1 ] ) NEW_LINE", "from collections import deque Β  n , m = map ( int , input ( ) . split ( ) ) Β  rail_network = [ [ 0 ] * ( n + 1 ) for _ in range ( n + 1 ) ] Β  for _ in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) rail_network [ u ] [ v ] = rail_network [ v ] [ u ] = 1 Β  que = deque ( ) Β  dis = [ - 1 ] * ( n + 1 ) dis [ 1 ] = 0 Β  que . append ( 1 ) Β  while que : temp = que . popleft ( ) Β  for i in range ( 1 , n + 1 ) : if rail_network [ temp ] [ i ] != rail_network [ 1 ] [ n ] and dis [ i ] == - 1 : dis [ i ] = dis [ temp ] + 1 que . append ( i ) Β  print ( dis [ - 1 ] ) NEW_LINE", "import math , sys , bisect , heapq , osfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulatefrom functools import lru_cache NEW_LINE" ]