id stringlengths 13 20 | java list | python list |
|---|---|---|
atcoder_abc095_B | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] m = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { m [ i ] = sc . nextInt ( ) ; } int cnt = 0 ; int sum = 0 ; int m... | [
"N , X = map ( int , input ( ) . split ( ) ) NEW_LINE m_list = [ int ( input ( ) ) for i in range ( N ) ] NEW_LINE ans = 0 NEW_LINE for i in m_list : NEW_LINE INDENT X -= i NEW_LINE ans += 1 NEW_LINE DEDENT ans += X // min ( m_list ) NEW_LINE print ( ans ) NEW_LINE",
"N , X = [ int ( x ) for x in input ( ) . spli... |
atcoder_arc025_B | [
"import java . util . * ; public class Main { private static int H ; private static int W ; private static int C [ ] [ ] ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; H = scan . nextInt ( ) ; W = scan . nextInt ( ) ; C = new int [ H ] [ W ] ; for ( int i = 0 ; i < H ; i ++ ) { for ( ... | [
"def solve ( ) : NEW_LINE INDENT from itertools import product NEW_LINE H , W = map ( int , input ( ) . split ( ) ) NEW_LINE a = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in [ 0 ] * H ] NEW_LINE cumsum = [ [ [ 0 , 0 ] ] * ( W + 1 ) ] + [ [ [ 0 , 0 ] for _ in [ 0 ] * ( W + 1 ) ] for _ in [ 0 ] * H ] NEW_L... |
atcoder_abc055_A | [
"import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 800 * n ; int y = n / 15 * 200 ; System . out . println ( x - y ) ; } }",
"import java . io . OutputStream ; import java . io . IOException ; import ja... | [
"N = int ( input ( ) ) NEW_LINE print ( N * 800 - N // 15 * 200 ) NEW_LINE",
"import sys NEW_LINE def main ( ) : NEW_LINE INDENT input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE x = 800 * N NEW_LINE y = 200 * ( N // 15 ) NEW_LINE return x - y NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' :... |
atcoder_arc063_B | [
"import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int A [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int min [ ] = new int [ N ] ; min [ 0 ] ... | [
"n , t = map ( int , input ( ) . split ( ) ) NEW_LINE alist = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE minal = [ alist [ 0 ] ] NEW_LINE maxal = [ alist [ - 1 ] ] NEW_LINE for a in alist [ 1 : ] : NEW_LINE INDENT if minal [ - 1 ] > a : NEW_LINE INDENT minal . append ( a ) NEW_LINE DEDENT else : NEW_LINE... |
atcoder_arc042_A | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; ArrayDeque < Integer > deque = new ArrayDeque < > ( M ) ; for ( int i = 0 ; i < M ; i ++ ) { deque . addFirst ( sc . nextInt ( ... | [
"N , M = map ( int , input ( ) . split ( ) ) NEW_LINE a = [ int ( input ( ) ) for _ in range ( M ) ] NEW_LINE a = a [ : : - 1 ] + [ int ( i ) for i in range ( 1 , N + 1 ) ] NEW_LINE L = set ( ) NEW_LINE for i in a : NEW_LINE INDENT if i not in L : NEW_LINE INDENT print ( i ) NEW_LINE L . add ( i ) NEW_LINE DEDENT D... |
atcoder_agc021_A | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { char [ ] n = sc . next ( ) . toCharArray ( ) ; boolean f = false ; for ( int i = 1 ; i < n . length ; i +... | [
"N = list ( input ( ) ) NEW_LINE ans1 , ans2 = 0 , 0 NEW_LINE for i in range ( len ( N ) ) : NEW_LINE INDENT if ( i == 0 ) : ans1 += int ( N [ i ] ) - 1 NEW_LINE else : ans1 += 9 NEW_LINE ans2 += int ( N [ i ] ) NEW_LINE DEDENT ans = max ( ans1 , ans2 ) NEW_LINE print ( ans ) NEW_LINE",
"N = input ( ) NEW_LINE fl... |
atcoder_abc096_B | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , C , K , D , E , max = 0 , ans ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; D = Math . max ( A , B ) ; C = sc . nextInt ( ) ; E = Math . max ( D , C ) ; K = sc .... | [
"abc_list = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE k = int ( input ( ) ) NEW_LINE ans = 0 NEW_LINE for i in range ( k ) : NEW_LINE INDENT abc_list [ abc_list . index ( max ( abc_list ) ) ] = max ( abc_list ) * 2 NEW_LINE DEDENT print ( sum ( abc_list ) ) NEW_LINE",
"from collections import Counter ... |
atcoder_agc012_C | [
"import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Deque ; import java . util . List ; import java . util . Scanner ; class Main { private static int bitcount ( long n ) { int res = 0 ; while ( n > 0 ) { if ( ( n & 1 ) == 1 ) ++ res ; n /= 2 ; } return res ; } public static voi... | [
"n = int ( input ( ) ) + 1 NEW_LINE k = 50 NEW_LINE while ~ n >> k & 1 : NEW_LINE INDENT k -= 1 NEW_LINE DEDENT k -= 1 NEW_LINE a = [ ] NEW_LINE b = [ ] NEW_LINE now = 1 NEW_LINE while k >= 0 : NEW_LINE INDENT a = a + [ now ] NEW_LINE b = b + [ now ] NEW_LINE now += 1 NEW_LINE if n >> k & 1 : NEW_LINE INDENT a = a ... |
atcoder_arc048_C | [
"import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] l = new int [ n ] ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { l [ i ] = sc . nextInt ( ) ; min = Math . min ( min , l [ i ] ) ; ... | [
"import sys NEW_LINE from fractions import gcd NEW_LINE from functools import reduce NEW_LINE N = int ( input ( ) ) NEW_LINE a = sorted ( map ( int , sys . stdin ) ) NEW_LINE mod = 10 ** 9 + 7 NEW_LINE if N == 1 : NEW_LINE INDENT print ( pow ( 2 , a [ 0 ] , mod ) ) NEW_LINE exit ( ) NEW_LINE DEDENT gcd = reduce ( g... |
atcoder_arc052_A | [
"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 ( ) ; for ( int i = 99 ; i > 0 ; i -- ) { if ( s . contains ( String . valueOf ( i ) ) ) { System . out . println ( i ) ; break ; } } }... | [
"S = str ( input ( ) ) NEW_LINE list = [ ] NEW_LINE for i in range ( len ( S ) ) : NEW_LINE INDENT if ord ( S [ i ] ) >= 48 and ord ( S [ i ] ) <= 57 : NEW_LINE INDENT list . append ( S [ i ] ) NEW_LINE DEDENT DEDENT if list [ 0 ] == \"0\" : NEW_LINE INDENT list . pop ( 0 ) NEW_LINE DEDENT ans = \" \" NEW_LINE for ... |
atcoder_arc030_A | [
"import java . util . Scanner ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { System . out . println ( s . nextInt ( ) / 2 >= s . nextInt ( ) ? \" YES \" : \" NO \" ) ; } }",
"import java . util . Scanner ; public class Main { public static void... | [
"n = int ( input ( ) ) NEW_LINE k = int ( input ( ) ) NEW_LINE if n // 2 >= k : NEW_LINE INDENT print ( \" YES \" ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( \" NO \" ) NEW_LINE DEDENT",
"n , k = map ( int , open ( 0 ) ) ; print ( ' YNEOS ' [ n < k * 2 : : 2 ] ) NEW_LINE",
"n = int ( input ( ) ) NEW_LINE k... |
atcoder_arc026_B | [
"import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long total = 1 ; for ( long i = 2 ; i <= ( int ) Math . sqrt ( N ) ; i ++ ) { if ( N % i == 0 ) { total = total + i ... | [
"n = int ( input ( ) ) NEW_LINE ans = 1 NEW_LINE if n == 1 : NEW_LINE INDENT print ( \" Deficient \" ) NEW_LINE quit ( ) NEW_LINE DEDENT i = 2 NEW_LINE ans_l = [ \" Deficient \" , \" Perfect \" , \" Abundant \" ] NEW_LINE while i ** 2 <= n : NEW_LINE INDENT if n % i == 0 : NEW_LINE INDENT ans += i NEW_LINE if n // ... |
atcoder_abc054_B | [
"import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new ... | [
"n , m = map ( int , input ( ) . split ( ) ) NEW_LINE a_list = [ input ( ) for _ in range ( n ) ] NEW_LINE b_list = [ input ( ) for _ in range ( m ) ] NEW_LINE for i in range ( n - m + 1 ) : NEW_LINE INDENT for j in range ( n - m + 1 ) : NEW_LINE INDENT f = True NEW_LINE for k in range ( m ) : NEW_LINE INDENT for l... |
atcoder_abc087_A | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextInt ( ) ; long a = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; System . out . println ( ( x - a ) % b ) ; } }",
"import java . io . IOException ; import... | [
"x = int ( input ( ) ) NEW_LINE a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE print ( ( x - a ) % b ) NEW_LINE",
"x , a , b = map ( int , open ( 0 ) ) ; print ( ( x - a ) % b ) NEW_LINE",
"a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE c = int ( input ( ) ) NEW_LINE print ( ( a - ... |
atcoder_abc024_C | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] l = new int [ d ] ; int [ ] r = new int [ d ] ; for ( int i = 0 ; i <... | [
"n , d , k = map ( int , input ( ) . split ( ) ) NEW_LINE rst = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( d ) ] NEW_LINE dd = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( k ) ] NEW_LINE for dpt , dst in dd : NEW_LINE INDENT min_cur , max_cur = dpt , dpt NEW_LINE for i , ( s ... |
atcoder_abc105_C | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . close ( ) ; if ( n == 0 ) { System . out . println ( 0 ) ; return ; } int [ ] rem = new int [ 40 ] ; for ( int i = 0 ; i < rem... | [
"N = int ( input ( ) ) NEW_LINE a = ' ' NEW_LINE n = 0 NEW_LINE while N != 0 : NEW_LINE INDENT b = '0' if N % ( 2 ** ( n + 1 ) ) == 0 else '1' NEW_LINE a += b NEW_LINE N -= ( ( - 2 ) ** n ) * int ( b ) NEW_LINE n += 1 NEW_LINE DEDENT print ( a [ : : - 1 ] if a else 0 ) NEW_LINE",
"import sys NEW_LINE import itert... |
atcoder_arc037_A | [
"import java . util . Scanner ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = s . nextInt ( ) , sum = 0 ; for ( ; n > 0 ; n -- ) { sum += Math . max ( 0 , 80 - s . nextInt ( ) ) ; } System . out . println ( sum ) ; } }",
"import java . u... | [
"N = int ( input ( ) ) NEW_LINE L = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE res = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT if L [ i ] >= 80 : NEW_LINE INDENT pass NEW_LINE DEDENT else : NEW_LINE INDENT res += 80 - L [ i ] NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE",
"n , m = open ( 0 ) ;... |
atcoder_agc008_A | [
"import java . util . * ; import java . awt . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int ans1 = ( int ) 1e9 + 4 ; int an... | [
"x , y = map ( int , input ( ) . split ( ) ) NEW_LINE if abs ( x ) == abs ( y ) : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT elif abs ( x ) < abs ( y ) : NEW_LINE INDENT if y > 0 : NEW_LINE INDENT if x >= 0 : NEW_LINE INDENT print ( abs ( y ) - abs ( x ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( abs ( y ) -... |
atcoder_arc071_B | [
"import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { long PRIME = 1000000007 ; Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; long [ ] x = new long [ N... | [
"import collections NEW_LINE mod = 1000000007 NEW_LINE def solve ( ) : NEW_LINE INDENT n , m = map ( int , input ( ) . split ( ) ) NEW_LINE x = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE y = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE X = int ( ) NEW_LINE for i in range ( 1 , n ) : NEW_LINE IND... |
atcoder_agc018_B | [
"import java . util . Arrays ; import java . util . Comparator ; import java . util . PriorityQueue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ... | [
"N , M = map ( int , input ( ) . split ( ) ) NEW_LINE A = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT a = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE A . append ( a ) NEW_LINE DEDENT def solve ( ) : NEW_LINE INDENT res = [ 0 for x in range ( M + 1 ) ] NEW_LINE for i in range ( N ) : NEW_LINE INDEN... |
atcoder_abc022_C | [
"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 ( ) ; int [ ] [ ] adj = new int [ N ] [ N ] ; for ( int i = 0 ; i < N ; ++ i ) for ( int j = 0 ; j < N ; ++ j ) adj [ i ] [ j ]... | [
"from scipy . sparse . csgraph import floyd_warshall as wf NEW_LINE n , m = map ( int , input ( ) . split ( ) ) NEW_LINE uvl = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( m ) ] NEW_LINE INF = float ( ' inf ' ) NEW_LINE d = [ [ INF ] * n for _ in range ( n ) ] NEW_LINE for i in range ( n ) : NEW_... |
atcoder_agc019_A | [
"import java . util . * ; public class Main { int INF = Integer . MAX_VALUE ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; long Q = sc . nextLong ( ) ; long H = sc . nextLong ( ) ; long S = sc . nextLong ( ) ; long D = sc . ne... | [
"q , h , s , d , n = map ( int , open ( 0 ) . read ( ) . split ( ) ) ; m = min ( 4 * q , 2 * h , s ) ; print ( n // 2 * min ( d , 2 * m ) + n % 2 * m ) NEW_LINE",
"Q , H , S , D = map ( int , input ( ) . split ( ) ) NEW_LINE N = int ( input ( ) ) NEW_LINE efficient_num , efficient_cost = 0 , 8 * Q NEW_LINE if ( e... |
atcoder_arc080_B | [
"import java . util . Scanner ; import java . util . Set ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int h = s . nextInt ( ) ; int w = s . nextInt ( ) ; s . nextLine ( ) ; int n = s . nextInt ( ) ; int [ ] a... | [
"height , wide = map ( int , input ( ) . split ( ) ) NEW_LINE n = int ( input ( ) ) NEW_LINE anslist = [ ] NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for i , j in enumerate ( a ) : NEW_LINE INDENT for l in range ( j ) : NEW_LINE INDENT anslist . append ( i + 1 ) NEW_LINE DEDENT DEDENT for k ... |
atcoder_agc020_D | [
"import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Q = scan . nextInt ( ) ; while ( Q -- > 0 ) { long A = scan . nextLong ( ) ; long B = scan . nextLong ( ) ; long k = ( A + B ) / ( Math . min ( A , B ) + 1 ) ; if ( k <= 1 ) { ... | [
"import math NEW_LINE Q = int ( input ( ) ) NEW_LINE for _ in range ( Q ) : NEW_LINE INDENT A , B , C , D = map ( int , input ( ) . split ( ) ) NEW_LINE K = math . ceil ( max ( A , B ) / ( min ( A , B ) + 1 ) ) NEW_LINE lo , hi = 0 , A + 1 NEW_LINE while hi - lo > 1 : NEW_LINE INDENT mid = ( lo + hi ) // 2 NEW_LINE... |
atcoder_arc054_A | [
"import java . util . Scanner ; class Main { static Scanner s = new Scanner ( System . in ) ; static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { long l = gInt ( ) , x = gInt ( ) , y = gInt ( ) , s = gInt ( ) , d = gInt ( ) ; long sl = y + x , sr = y - x ;... | [
"l , x , y , s , d = map ( int , input ( ) . split ( ) ) NEW_LINE if d >= s : NEW_LINE INDENT if y != x : a = ( s + l - d ) / ( y - x ) NEW_LINE b = ( d - s ) / ( x + y ) NEW_LINE DEDENT else : NEW_LINE INDENT if y != x : a = ( s - d ) / ( y - x ) NEW_LINE b = ( d - s + l ) / ( y + x ) NEW_LINE DEDENT if y <= x : p... |
atcoder_abc061_C | [
"import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; long K = scn . nextLong ( ) ; Pair [ ] P = new Pair [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { P [ i ] = new Pair ( ... | [
"import sys NEW_LINE def main ( ) : NEW_LINE INDENT input = sys . stdin . readline NEW_LINE N , K = map ( int , input ( ) . split ( ) ) NEW_LINE A = [ ] NEW_LINE for _ in range ( N ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE A . append ( ( a , b ) ) NEW_LINE DEDENT A = sorted ( A , key ... |
atcoder_agc020_B | [
"import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; long [ ] a = new long [ K ] ; for ( int i = 0 ; i < K ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; long max = 2 ; lon... | [
"import math NEW_LINE K = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) [ : : - 1 ] NEW_LINE mi = 2 NEW_LINE ma = 2 NEW_LINE res = 0 NEW_LINE for i in range ( K ) : NEW_LINE INDENT if ( mi % A [ i ] ) and ( ma % A [ i ] ) and ( ( mi // A [ i ] ) == ( ma // A [ i ] ) ) : NEW_LINE INDENT... |
atcoder_agc018_A | [
"import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long K = sc . nextLong ( ) ; long [ ] map = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { map [ i ] = sc . nextL... | [
"from functools import reduce NEW_LINE from fractions import gcd NEW_LINE N , K = map ( int , input ( ) . split ( ) ) NEW_LINE A = sorted ( map ( int , input ( ) . split ( ) ) ) NEW_LINE M = reduce ( gcd , A ) NEW_LINE if K <= A [ - 1 ] and K % M == 0 : print ( \" POSSIBLE \" ) NEW_LINE else : print ( \" IMPOSSIBLE... |
atcoder_arc046_A | [
"import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; int c = 1 ; int [ ] ans = new int [ n + 1 ] ; int i = 1 ; while ( c <= n ) { if ( d ( i ) ) { ans [ c ++ ] = i ; } i ++ ; } o... | [
"import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE n = N // 9 + 1 if N % 9 != 0 else N // 9 NEW_LINE a = N % 9 if N % 9 != 0 else 9 NEW_LINE print ( str ( a ) * n ) NEW_LINE",
"def same ( i ) : NEW_LINE INDENT return len ( set (... |
atcoder_arc072_A | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextLong ( ) ; sc . close ( ) ; long count1 = 0 ; long sum = 0 ; for (... | [
"n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE count1 = a [ 0 ] NEW_LINE count2 = a [ 0 ] NEW_LINE answer1 = 0 NEW_LINE answer2 = 0 NEW_LINE if a [ 0 ] <= 0 : NEW_LINE INDENT answer1 += ( 1 - a [ 0 ] ) NEW_LINE count1 = 1 NEW_LINE DEDENT if a [ 0 ] >= 0 : NEW_LINE INDENT a... |
atcoder_abc088_D | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int [ ] [ ] grid = new int [ w ] [ h ] ; int wCount = 0 ; for ( int i = 0 ; i < h ; i ++ ) { String s = sc . next ( ) ; for ( i... | [
"from collections import deque NEW_LINE H , W = map ( int , input ( ) . split ( ) ) NEW_LINE G = [ list ( input ( ) ) for i in range ( H ) ] NEW_LINE first_black = sum ( [ row . count ( ' # ' ) for row in G ] ) NEW_LINE que = deque ( [ ( 0 , 0 ) ] ) NEW_LINE dist = [ [ - 1 ] * W for i in range ( H ) ] NEW_LINE dist... |
atcoder_abc033_A | [
"import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long k = ... | [
"N = input ( ) NEW_LINE nCnt = N . count ( N [ 0 ] ) NEW_LINE if nCnt == 4 : NEW_LINE INDENT print ( ' SAME ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' DIFFERENT ' ) NEW_LINE DEDENT",
"print ( \" SAME \" if len ( set ( input ( ) ) ) == 1 else \" DIFFERENT \" ) NEW_LINE",
"def password ( N : int ) -> bo... |
atcoder_abc021_A | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( 1 ) ; } } }",
"import java . io . BufferedReader ; import jav... | [
"import sys NEW_LINE n = int ( sys . stdin . readline ( ) . rstrip ( ) ) NEW_LINE div , mod = divmod ( n , 2 ) NEW_LINE ans = 0 NEW_LINE if mod : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT ans += div NEW_LINE print ( ans ) NEW_LINE if mod : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT for _ in range ( div ) : NEW_LINE... |
atcoder_agc007_B | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int inv [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { inv [ sc . nextInt ( ) - 1 ] = i ; } for ( int i = 0 ; i < N ; i ++ ) { if ( i > 0 ... | [
"N = int ( input ( ) ) NEW_LINE p = list ( map ( lambda x : int ( x ) - 1 , input ( ) . split ( ) ) ) NEW_LINE r = { } NEW_LINE for i in range ( N ) : NEW_LINE INDENT r [ p [ i ] ] = i + 1 NEW_LINE DEDENT A = [ 30000 * i for i in range ( 1 , N + 1 ) ] NEW_LINE B = [ 30000 * ( N - i ) + r [ i - 1 ] for i in range ( ... |
atcoder_agc006_B | [
"import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; if ( x == 1 || x == 2 * N - 1 ) { out . println ( \... | [
"n , x = map ( int , input ( ) . split ( ) ) NEW_LINE ans = [ i for i in range ( 1 , 2 * n ) ] NEW_LINE if x == 1 or x == 2 * n - 1 : NEW_LINE INDENT print ( \" No \" ) NEW_LINE exit ( ) NEW_LINE DEDENT print ( \" Yes \" ) NEW_LINE ans [ n - 1 ] , ans [ x - 1 ] = ans [ x - 1 ] , ans [ n - 1 ] NEW_LINE ans [ n - 2 ]... |
atcoder_abc003_C | [
"import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] R = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { R [ i ] = sc . nextInt ... | [
"n , k = map ( int , input ( ) . split ( ) ) NEW_LINE r = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE r . sort ( ) NEW_LINE del r [ : ( n - k ) ] NEW_LINE c = 0 NEW_LINE for i in r : NEW_LINE INDENT c = ( c + i ) / 2 NEW_LINE DEDENT print ( c ) NEW_LINE",
"N , K = [ int ( i ) for i in input ( ) . split ... |
atcoder_agc007_A | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < h ; i ++ ) ... | [
"H , W = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE A_s = [ input ( ) for _ in range ( H ) ] NEW_LINE pos = [ 0 , 0 ] NEW_LINE num = 1 NEW_LINE while True : NEW_LINE INDENT if pos == [ H - 1 , W - 1 ] : NEW_LINE INDENT total = sum ( map ( lambda A : A . count ( \" # \" ) , A_s ) ) NEW_LINE ans = total ==... |
atcoder_arc089_A | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] t = new int [ n + 1 ] ; int [ ] x = new int [ n + 1 ] ; int [ ] y = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { t [ i ] = sc . n... | [
"n = int ( input ( ) ) NEW_LINE s , a , b = 0 , 0 , 0 NEW_LINE f = True NEW_LINE for _ in [ 0 ] * n : NEW_LINE INDENT t , x , y = map ( int , input ( ) . split ( ) ) NEW_LINE p = t - s - ( abs ( x - a ) + abs ( y - b ) ) NEW_LINE if p % 2 == 1 or p < 0 : NEW_LINE INDENT f = False NEW_LINE DEDENT DEDENT print ( \" Y... |
atcoder_arc034_A | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; double max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { max = Math . max ( max , ( sc . nextDouble ( ) + sc . nextDouble ( ) + sc . nextDouble ( )... | [
"import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE ans = 0 NEW_LINE for _ in range ( N ) : NEW_LINE INDENT * a , b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = max ( ans , sum ( a ) + b * 110 / 900 ) NEW_LINE DEDE... |
atcoder_abc003_B | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String l1 = sc . next ( ) ; String l2 = sc . next ( ) ; char temp1 ; char temp2 ; for ( int i = 0 ; i < l1 . length ( ) ; i ++ ) { temp1 = l1 . charAt ( i ) ; temp2 = l2 . cha... | [
"print ( ' You ▁ can ▁ win ' * all ( s + t in ' @ a @ t @ c @ o @ d @ e @ r @ ' + s * 2 for s , t in zip ( * open ( 0 ) ) ) or ' You ▁ will ▁ lose ' ) NEW_LINE",
"S = list ( input ( ) ) NEW_LINE T = list ( input ( ) ) NEW_LINE pit = 0 NEW_LINE N = len ( S ) NEW_LINE for i in range ( N ) : NEW_LINE INDENT if S [ i... |
atcoder_arc001_B | [
"import java . util . * ; import static java . lang . Integer . parseInt ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int question = sc . nextInt ( ) ; ArrayList < String > answers = new ArrayList < String > ( ) ; int scores [ ] = new int [ 4 ] ; ans... | [
"n = int ( input ( ) ) NEW_LINE cs = input ( ) . strip ( ) NEW_LINE cd = { '1' : 0 , '2' : 0 , '3' : 0 , '4' : 0 } NEW_LINE for c in cs : NEW_LINE INDENT cd [ c ] += 1 NEW_LINE DEDENT print ( max ( v for v in cd . values ( ) ) , min ( v for v in cd . values ( ) ) ) NEW_LINE",
"a , b = map ( int , input ( ) . spli... |
atcoder_abc070_D | [
"import java . util . Scanner ; import java . util . ArrayList ; import java . util . List ; public class Main { static List < Edge > [ ] list ; static long [ ] dist ; static class Edge { int to ; long cost ; public Edge ( int to , long cost ) { this . to = to ; this . cost = cost ; } } public static void main ( St... | [
"import sys NEW_LINE from collections import deque NEW_LINE def dfs ( start , dest , pre , d ) : NEW_LINE INDENT if d [ start ] [ dest ] > 0 : NEW_LINE INDENT return d [ start ] [ dest ] NEW_LINE DEDENT for i in range ( len ( d ) ) : NEW_LINE INDENT if d [ start ] [ i ] > 0 and i != pre : NEW_LINE INDENT c = dfs ( ... |
atcoder_abc045_B | [
"import java . util . ArrayDeque ; import java . util . Deque ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { Map < String , Deque < String > > deq =... | [
"S = { c : list ( input ( ) ) for c in \" abc \" } NEW_LINE s = \" a \" NEW_LINE while S [ s ] : NEW_LINE INDENT s = S [ s ] . pop ( 0 ) NEW_LINE DEDENT print ( s . upper ( ) ) NEW_LINE",
"hoa = list ( input ( ) ) NEW_LINE hob = list ( input ( ) ) NEW_LINE hoc = list ( input ( ) ) NEW_LINE f = \" A \" NEW_LINE wh... |
atcoder_abc081_B | [
"import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int hako [ ] = new int [ a ] ; int cont = 0 ; int flag = 1 ; for ( int i = 0 ; i < a ; i ++ ) { hako [ i ] = sc . nextInt ( ) ; } while ( flag == 1 ) { for ( int... | [
"a = int ( input ( ) ) NEW_LINE list = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE flag = False NEW_LINE ans = 30 NEW_LINE for i in range ( 31 ) : NEW_LINE INDENT for j in list : NEW_LINE INDENT if j % ( 2 ** i ) != 0 : NEW_LINE INDENT if not ( flag ) : NEW_LINE INDENT flag = True NEW_LINE ans = i - 1 NEW... |
atcoder_abc090_A | [
"import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String input1 = sc . nextLine ( ) ; String input2 = sc . nextLine ( ) ; String input3 = sc . nextLine ( ) ; System . out . println ( input1 . substring ( 0 , 1 ) + input2 . substrin... | [
"C1 = input ( ) NEW_LINE C2 = input ( ) NEW_LINE C3 = input ( ) NEW_LINE print ( C1 [ : 1 ] + C2 [ 1 : 2 ] + C3 [ 2 : ] ) NEW_LINE",
"s = [ input ( ) for _ in range ( 3 ) ] NEW_LINE for i in range ( 3 ) : NEW_LINE INDENT print ( s [ i ] [ i ] , end = ' ' ) NEW_LINE DEDENT print ( ' ' ) NEW_LINE",
"print ( ' ' .... |
atcoder_abc036_B | [
"import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] a = new String [ n ] ; String [ ] [ ] s = new String [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ]... | [
"n = int ( input ( ) ) NEW_LINE s = [ list ( input ( ) ) for _ in range ( n ) ] NEW_LINE a = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT tmp = [ ] NEW_LINE for j in range ( n ) : NEW_LINE INDENT tmp . append ( s [ n - j - 1 ] [ i ] ) NEW_LINE DEDENT a . append ( tmp ) NEW_LINE DEDENT for i in range ( n ) : ... |
atcoder_abc110_C | [
"import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { char [ ] S = sc . next ( ) . toCharArray ( ) ; char [ ] T = sc . next ( ) . toCharArray ( ) ; int [ ] start = new int [ 26 ] ; int [ ] end = new int [ 26 ] ; Arrays . fill ( ... | [
"prj = { } NEW_LINE prj_inv = { } NEW_LINE s = input ( ) NEW_LINE t = input ( ) NEW_LINE for i , j in zip ( s , t ) : NEW_LINE INDENT if i not in prj and j not in prj_inv : NEW_LINE INDENT prj [ i ] = j NEW_LINE prj_inv [ j ] = i NEW_LINE DEDENT elif i in prj and j in prj_inv : NEW_LINE INDENT if prj [ i ] == j : N... |
atcoder_abc021_D | [
"import java . util . Scanner ; class Main { static int max = 100002 ; static int MOD = 1000000007 ; static long [ ] fac = new long [ max ] ; static long [ ] finv = new long [ max ] ; static long [ ] inv = new long [ max ] ; public static void main ( String [ ] args ) { COMinit ( ) ; Scanner sc = new Scanner ( Syst... | [
"m = 10 ** 9 + 7 NEW_LINE def f ( a , b ) : NEW_LINE INDENT r = 1 NEW_LINE for i in range ( b ) : NEW_LINE INDENT r = r * ( n + k - 1 - i ) * pow ( i + 1 , m - 2 , m ) % m NEW_LINE DEDENT return r NEW_LINE DEDENT n = int ( input ( ) ) NEW_LINE k = int ( input ( ) ) NEW_LINE print ( f ( n , k ) ) NEW_LINE",
"def g... |
atcoder_abc053_B | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; int num = s . length ( ) ; int min = 10 ; int max = 0 ; for ( int i = 0 ; i < num ; i ++ ) { if ( s . charAt ( i ) == ' A ' ) { min = i ; break ; } } ... | [
"S = input ( ) NEW_LINE A = 0 NEW_LINE Z = 0 NEW_LINE flg = 0 NEW_LINE for i in range ( len ( S ) ) : NEW_LINE INDENT if S [ i ] == ' A ' and flg == 0 : NEW_LINE INDENT A = i NEW_LINE flg = 1 NEW_LINE DEDENT if S [ i ] == ' Z ' : NEW_LINE INDENT Z = i NEW_LINE DEDENT DEDENT print ( Z - A + 1 ) NEW_LINE",
"s = inp... |
atcoder_abc064_D | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; char [ ] s = scanner . next ( ) . toCharArray ( ) ; int left = 0 ; int tmp = 0 ; for ( char ch : s ) { if ( ch == ' ( ' ) tmp -- ; else tm... | [
"from collections import deque NEW_LINE N = int ( input ( ) ) NEW_LINE S = input ( ) NEW_LINE dq = deque ( ) NEW_LINE ans = deque ( list ( S ) ) NEW_LINE for s in S : NEW_LINE INDENT if not dq : NEW_LINE INDENT dq . append ( s ) NEW_LINE DEDENT else : NEW_LINE INDENT if dq [ - 1 ] == \" ( \" and s == \" ) \" : NEW_... |
atcoder_arc022_B | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < Integer > set = new HashSet < > ( ) ; int [ ] arr = new int [ n ] ; int max = 0 ; int start = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc ... | [
"N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans , l , count , _set = 1 , 0 , 1 , { a [ 0 ] } NEW_LINE add , remove = _set . add , _set . remove NEW_LINE for n in a [ 1 : ] : NEW_LINE INDENT while n in _set : NEW_LINE INDENT remove ( a [ l ] ) NEW_LINE count -= 1 NEW_LIN... |
atcoder_abc031_D | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } int n , k ; int [ ] v ; String [ ] w ; int [ ] table ; String [ ] ans ; void solve ( ) { Scanner sc = new Scanner ( System . in ) ; k = sc . nextInt ( ) ; n = sc . nextInt ( ) ; v = new int... | [
"k , n = map ( int , input ( ) . split ( ) ) NEW_LINE vw = [ ] NEW_LINE for _ in range ( n ) : NEW_LINE INDENT a , b = input ( ) . split ( ) NEW_LINE vw . append ( [ list ( map ( lambda x : int ( x ) - 1 , list ( a ) ) ) , list ( b ) ] ) NEW_LINE DEDENT d = [ 0 ] * k NEW_LINE while 1 : NEW_LINE INDENT for i in rang... |
atcoder_abc112_C | [
"import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; int calcH ( int cx , int cy , int x , int y , int h ) { return h + Math . abs ( cx - x ) + Math . abs ( cy - y ) ; } boolean check ( i... | [
"import sys NEW_LINE write = sys . stdout . write NEW_LINE def valid ( x , y ) : NEW_LINE INDENT H = info [ nzpoint ] [ 2 ] + abs ( info [ nzpoint ] [ 0 ] - x ) + abs ( info [ nzpoint ] [ 1 ] - y ) NEW_LINE for i in range ( N ) : NEW_LINE INDENT if i == nzpoint : NEW_LINE INDENT continue NEW_LINE DEDENT if max ( 0 ... |
atcoder_abc084_B | [
"import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new ... | [
"n , m = map ( int , input ( ) . split ( ) ) NEW_LINE s = input ( ) NEW_LINE flag = True NEW_LINE if s [ n : n + 1 ] != ' - ' : NEW_LINE INDENT flag = False NEW_LINE DEDENT for i in range ( n ) : NEW_LINE INDENT if s [ i ] == ' - ' : NEW_LINE INDENT flag = False NEW_LINE DEDENT DEDENT for i in range ( n + 1 , len (... |
atcoder_arc059_B | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) - 1 ; i ++ ) { if ( s . charAt ( i ) == s . charAt ( i + 1 ) ) { System . out . println ( ( i + 1 ) + \" ▁ \" + ( i +... | [
"s = input ( ) NEW_LINE if len ( s ) == 2 and s [ 0 ] == s [ 1 ] : print ( 1 , 2 ) NEW_LINE else : NEW_LINE INDENT for i in range ( 3 , len ( s ) + 1 ) : NEW_LINE INDENT a = s [ i - 3 : i ] NEW_LINE if len ( set ( a ) ) != 3 : NEW_LINE INDENT print ( i - 2 , i ) NEW_LINE break NEW_LINE DEDENT DEDENT else : print ( ... |
atcoder_arc084_B | [
"import java . util . Arrays ; import java . util . PriorityQueue ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int [ ] dp = new int [ K ] ; Arrays . fill ( dp , Integer . MAX_VALUE ) ; class Node... | [
"from collections import deque NEW_LINE def inpl ( ) : return tuple ( map ( int , input ( ) . split ( ) ) ) NEW_LINE K = int ( input ( ) ) NEW_LINE visited = [ False for _ in range ( K ) ] NEW_LINE dq = deque ( [ ( 1 , 1 ) ] ) NEW_LINE while True : NEW_LINE INDENT c , m = dq . popleft ( ) NEW_LINE visited [ m ] = T... |
atcoder_arc071_C | [
"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 ; Sc... | [
"s = input ( ) NEW_LINE t = input ( ) NEW_LINE q = int ( input ( ) ) NEW_LINE info = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( q ) ] NEW_LINE MOD = 3 NEW_LINE memo = { \" A \" : 1 , \" B \" : 2 } NEW_LINE s_ruiseki = [ 0 ] * ( len ( s ) + 1 ) NEW_LINE for i in range ( 1 , len ( s ) + 1 ) : NEW... |
atcoder_arc066_C | [
"import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; long [ ] sum = new long [ N ] ; long [ ] a = new long [ N ] ; long [ ] abssum = new long [... | [
"input ( ) NEW_LINE sm = de = 0 NEW_LINE ans = 10 ** 15 NEW_LINE for s in ( input ( ) + \" - 0\" ) . split ( ' - ' ) : NEW_LINE INDENT a = list ( map ( int , s . split ( ' + ' ) ) ) NEW_LINE if sm : NEW_LINE INDENT ans = min ( ans , sum ( a ) + de ) NEW_LINE de += a [ 0 ] NEW_LINE DEDENT sm += sum ( a ) NEW_LINE DE... |
atcoder_abc103_B | [
"import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; String str2 = sc . nextLine ( ) ; int size = str . length ( ) ; int size2 = str2 . length ( ) ; int flag = 1 ; while ( true ) { if ( str . equals ( s... | [
"S = input ( ) NEW_LINE T = input ( ) NEW_LINE s = len ( S ) NEW_LINE if S == T : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE exit ( ) NEW_LINE DEDENT for i in range ( s + 1 ) : NEW_LINE INDENT S = S [ - 1 ] + S [ 0 : s - 1 ] NEW_LINE if S == T : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE exit ( ) NEW_LINE DEDENT DE... |
atcoder_abc024_B | [
"import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int sum = 0 ; int s = sc . nextInt ( ) ; int g = s + T ; for ( int i = 1 ; i < N ; i ++ ) { int tmp = sc . nextInt ( ) ; if ( tm... | [
"n , t = map ( int , input ( ) . split ( ' ▁ ' ) ) NEW_LINE a = [ ] NEW_LINE x = 0 NEW_LINE y = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT a . append ( int ( input ( ) ) ) NEW_LINE DEDENT for i in range ( 1 , n ) : NEW_LINE INDENT if abs ( a [ i ] - a [ i - 1 ] ) > t : NEW_LINE INDENT x += t NEW_LINE DEDENT ... |
atcoder_abc006_B | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; long array [ ] = new long [ num + 5 ] ; for ( int i = 1 ; i <= num ; i ++ ) { array [ i ] = i == 1 || i == 2 ? 0 : i == 3 ? 1 : array [ i - 1 ] + array ... | [
"n = int ( input ( ) ) NEW_LINE a = [ 0 ] * n NEW_LINE if n >= 3 : NEW_LINE INDENT a [ 2 ] = 1 NEW_LINE DEDENT for i in range ( 3 , n ) : NEW_LINE INDENT a [ i ] = ( a [ i - 1 ] + a [ i - 2 ] + a [ i - 3 ] ) % 10007 NEW_LINE DEDENT print ( a [ - 1 ] ) NEW_LINE",
"from sys import stdin NEW_LINE n = int ( stdin . r... |
atcoder_abc057_B | [
"import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] stu = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < stu . length ; i ++ ) { stu [ i ] [ 0 ] = sc . nextInt ( ) ; stu [ i ] [... | [
"N , M = map ( int , input ( ) . split ( ) ) NEW_LINE STUDENTS = [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( N ) ] NEW_LINE CHECKPOINTS = [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( M ) ] NEW_LINE for student in STUDENTS : NEW_LINE INDENT L = 10 ** 10 NEW_LINE for i , check... |
atcoder_abc004_D | [
"import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] yo = Arrays . asList ( br . readLine ( ) . split ( \" ▁ \" ) ) . stream ( ) . mapToInt ( Inte... | [
"r , g , b = map ( int , input ( ) . split ( ) ) NEW_LINE def count ( remaining , place ) : NEW_LINE INDENT if remaining == 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT elif 0 < remaining <= b : NEW_LINE INDENT return abs ( place - 600 ) NEW_LINE DEDENT elif b < remaining <= b + g : NEW_LINE INDENT return abs ( pla... |
atcoder_agc027_A | [
"import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = s... | [
"n , x = map ( int , input ( ) . split ( ) ) ; a = list ( map ( int , input ( ) . split ( ) ) ) ; a . sort ( ) ; ans = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if a [ i ] > x : break NEW_LINE else : NEW_LINE INDENT ans += 1 NEW_LINE x -= a [ i ] NEW_LINE if i == n - 1 and x != 0 : ans -= 1 NEW_LINE DEDENT ... |
atcoder_arc029_A | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int [ ] t = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { t [ i ] = scanner . nextInt ( ) ; } int time = 0 ; int ans = Integer . MAX_... | [
"n = int ( input ( ) ) NEW_LINE t = [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE t . sort ( reverse = True ) NEW_LINE yaki1 = 0 NEW_LINE yaki2 = 0 NEW_LINE for i in t : NEW_LINE INDENT if yaki1 <= yaki2 : NEW_LINE INDENT yaki1 += i NEW_LINE DEDENT else : NEW_LINE INDENT yaki2 += i NEW_LINE DEDENT DEDENT prin... |
atcoder_abc023_A | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String X = sc . next ( ) ; int sum = 0 ; sum += X . charAt ( 0 ) - '0' ; sum += X . charAt ( 1 ) - '0' ; System . out . println ( sum ) ; } }",
"import java . io . OutputStream ; ... | [
"X = input ( ) NEW_LINE print ( sum ( map ( int , X ) ) ) NEW_LINE",
"x = int ( input ( ) ) NEW_LINE ans = 0 NEW_LINE while x > 0 : NEW_LINE INDENT ans += x % 10 NEW_LINE x //= 10 NEW_LINE DEDENT print ( ans ) NEW_LINE",
"def plus_king ( X : int ) -> int : NEW_LINE INDENT return X // 10 + X % 10 NEW_LINE DEDENT... |
atcoder_abc101_A | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solveA ( ) ; } private void solveA ( ) { Scanner scanner = null ; String [ ] stringS = new String [ 4 ] ; try { scanner = new Scanner ( System . in ) ; stringS = scanner . next ( ) . split ( \" \" ) ; in... | [
"s = input ( ) NEW_LINE s_list = list ( s ) NEW_LINE count = 0 NEW_LINE for i in range ( len ( s_list ) ) : NEW_LINE INDENT if s_list [ i ] == ' + ' : NEW_LINE INDENT count += 1 NEW_LINE DEDENT elif s_list [ i ] == ' - ' : NEW_LINE INDENT count -= 1 NEW_LINE DEDENT DEDENT print ( count ) NEW_LINE",
"import collec... |
atcoder_arc002_B | [
"import java . io . * ; import java . time . ZonedDateTime ; import java . time . format . DateTimeFormatter ; import java . util . * ; import java . math . * ; public class Main { static boolean debug = false ; static boolean debug2 = false ; public static void main ( String [ ] args ) throws java . io . IOExcepti... | [
"def main ( ) : NEW_LINE INDENT from datetime import datetime NEW_LINE from datetime import timedelta NEW_LINE ymd = input ( ) NEW_LINE fmt = ' % Y / % m / % d ' NEW_LINE current_date = datetime . strptime ( ymd , fmt ) NEW_LINE while True : NEW_LINE INDENT year = current_date . year NEW_LINE month = current_date .... |
atcoder_agc003_A | [
"import java . util . * ; import java . awt . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int N = 0 , W = 0 , E = 0 , S = 0 ; String s = sc . next ( ) ; int n = s . length ( ) ; f... | [
"S = input ( ) NEW_LINE s = set ( S [ : ] ) NEW_LINE ans = s == set ( [ \" N \" , \" W \" , \" S \" , \" E \" ] ) or s == set ( [ \" N \" , \" S \" ] ) or s == set ( [ \" W \" , \" E \" ] ) NEW_LINE print ( \" Yes \" if ans else \" No \" ) NEW_LINE",
"print ( ' NYoe ▁ s ' [ set ( input ( ) ) in map ( set , [ ' ' ... |
atcoder_abc116_C | [
"import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; int count = 0 ; boolean watered = false ; int [ ] h = new int [ N ] ; for ( int i = 0 ; i < N ; i +... | [
"N = int ( input ( ) ) NEW_LINE H = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE S = sum ( H ) NEW_LINE ans = 0 NEW_LINE while S > 0 : NEW_LINE INDENT for i in range ( N ) : NEW_LINE INDENT if H [ i ] > 0 : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT for j in range ( i , N ) : NEW_LINE INDENT if H [ j ] =... |
atcoder_abc120_A | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int ans ; if ( B >= A * C ) { ans = C ; } else { ans = ( int ) B / A ; } System . out . printl... | [
"A , B , C = map ( int , input ( ) . split ( ) ) NEW_LINE print ( min ( B // A , C ) ) NEW_LINE",
"import math NEW_LINE i = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A = i [ 0 ] NEW_LINE B = i [ 1 ] NEW_LINE C = i [ 2 ] NEW_LINE if ( A * C <= B ) : NEW_LINE INDENT print ( C ) NEW_LINE DEDENT if ( A * ... |
atcoder_abc057_A | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; System . out . println ( ( a + x ) % 24 ) ; } }",
"import java . io . OutputStream ; import java . io . IOException ; import ... | [
"a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( ( a + b ) % 24 ) NEW_LINE",
"print ( eval ( ' ( ' + input ( ) . replace ( ' ▁ ' , ' + ' ) + ' ) %24' ) ) NEW_LINE",
"import sys NEW_LINE def main ( ) : NEW_LINE INDENT input = sys . stdin . readline NEW_LINE A , B = map ( int , input ( ) . split ( ) ... |
atcoder_abc012_C | [
"public class Main { public static void main ( String [ ] $ ) { int n = 2025 - new java . util . Scanner ( System . in ) . nextInt ( ) ; java . util . stream . IntStream . range ( 1 , 10 ) . filter ( i -> n % i == 0 && n / i <= 9 ) . forEach ( i -> System . out . println ( i + \" ▁ x ▁ \" + n / i ) ) ; } }",
"imp... | [
"n = int ( input ( ) ) NEW_LINE for i in range ( 1 , 10 ) : NEW_LINE INDENT for j in range ( 1 , 10 ) : NEW_LINE INDENT if i * j + n == 2025 : NEW_LINE INDENT print ( ' { } ▁ x ▁ { } ' . format ( i , j ) ) NEW_LINE DEDENT DEDENT DEDENT",
"max = 2025 NEW_LINE kuku = int ( input ( ) ) NEW_LINE diff = max - kuku NEW... |
atcoder_abc113_A | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cnt = 0 ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; System . out . println ( N + M / 2 ) ; } }",
"import java . io . IOException ; import java . io . InputStream ;... | [
"X , Y = map ( int , input ( ) . split ( ) ) NEW_LINE print ( X + Y // 2 ) NEW_LINE",
"import sys NEW_LINE INF = float ( \" inf \" ) NEW_LINE def solve ( X : int , Y : int ) : NEW_LINE INDENT print ( X + Y // 2 ) NEW_LINE return NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT def iterate_tokens ( ) : NEW_LINE INDE... |
atcoder_arc039_C | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; Koshi koshi = new Koshi ( 0 , 0 ) ; koshi . reLink ( ) ; for ( int i = 0 ; i < K ; i ++ ) { switch ( s [ i ... | [
"K = int ( input ( ) ) NEW_LINE S = input ( ) NEW_LINE dxdys = { ' R ' : ( 1 , 0 ) , ' L ' : ( - 1 , 0 ) , ' U ' : ( 0 , 1 ) , ' D ' : ( 0 , - 1 ) } NEW_LINE inv = { ' R ' : ' L ' , ' L ' : ' R ' , ' U ' : ' D ' , ' D ' : ' U ' } NEW_LINE x , y = 0 , 0 NEW_LINE boundary = { ( 0 , 0 ) : { ' R ' : ( 0 , 0 ) , ' L ' :... |
atcoder_abc119_B | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { double x = sc . nextDouble ( ) ; if ( \" JPY \" . equals ( sc . next ( ) ) ) { sum += x ; } else { sum... | [
"N = int ( input ( ) ) NEW_LINE A = [ list ( map ( str , input ( ) . split ( ) ) ) for _ in range ( N ) ] NEW_LINE ans = 0 NEW_LINE for value , unit in A : NEW_LINE INDENT if unit == \" BTC \" : NEW_LINE INDENT ans += float ( value ) * 380000 NEW_LINE DEDENT else : NEW_LINE INDENT ans += float ( value ) NEW_LINE DE... |
atcoder_agc002_C | [
"import java . util . * ; public class Main { public void main ( Scanner sc ) { int n = sc . nextInt ( ) ; long limit = sc . nextLong ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } boolean ok = false ; int ans [ ] = new int [ n - 1 ] ; for ( int i = 0 ; i < n ... | [
"N , L = map ( int , input ( ) . split ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE I = [ i + 1 for i in range ( N - 1 ) if a [ i ] + a [ i + 1 ] >= L ] NEW_LINE ans = ( ' Possible \\n { } ' . format ( ' \\n ' . join ( map ( str , list ( range ( 1 , I [ 0 ] ) ) + list ( range ( N - 1 , I... |
atcoder_arc085_B | [
"import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; int max = M... | [
"import sys NEW_LINE fin = sys . stdin . readline NEW_LINE N , Z , W = [ int ( elem ) for elem in fin ( ) . split ( ) ] NEW_LINE a_list = [ int ( elem ) for elem in fin ( ) . split ( ) ] NEW_LINE assert len ( a_list ) == N NEW_LINE if N == 1 : NEW_LINE INDENT print ( abs ( a_list [ - 1 ] - W ) ) NEW_LINE DEDENT els... |
atcoder_abc051_B | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i <= Math . min ( s , k ) ; i ++ ) { ans += Math . max ( 0 , Math . min ( s - i + 1 , k + 1 ) -... | [
"k , s = map ( int , input ( ) . split ( ) ) NEW_LINE ans = 0 NEW_LINE for x in range ( k + 1 ) : NEW_LINE INDENT for y in range ( k + 1 ) : NEW_LINE INDENT if s - x - y >= 0 and s - x - y <= k : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE",
"import itertools NEW_LINE K , S = map... |
atcoder_arc074_B | [
"import java . util . * ; public class Main { public void main ( Scanner sc ) { int n = sc . nextInt ( ) ; long a [ ] = new long [ 3 * n ] ; for ( int i = 0 ; i < 3 * n ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } long sumr [ ] = new long [ n + 1 ] ; long sumb [ ] = new long [ n + 1 ] ; Queue < Long > rq = new Priori... | [
"import heapq NEW_LINE n = int ( input ( ) ) NEW_LINE a = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE selectleft , selectright = [ ] , [ ] NEW_LINE leftscore , rightscore = [ ] , [ ] NEW_LINE for i in range ( 1 , n + 1 ) : heapq . heappush ( selectleft , a [ i ] ) NEW_LINE leftscore . append ( sum... |
atcoder_arc037_C | [
"import java . util . * ; class Main { static long [ ] a , b ; static int n ; static long count ( long v ) { long res = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int l = - 1 , r = n ; while ( r - l > 1 ) { int c = ( l + r ) / 2 ; if ( a [ i ] * b [ c ] <= v ) l = c ; else r = c ; } res += r ; } return res ; } public s... | [
"N , K = map ( int , input ( ) . split ( ) ) NEW_LINE * A , = map ( int , input ( ) . split ( ) ) NEW_LINE * B , = map ( int , input ( ) . split ( ) ) NEW_LINE A . sort ( reverse = 1 ) ; B . sort ( ) NEW_LINE def check ( mid ) : NEW_LINE INDENT j = 0 NEW_LINE res = 0 NEW_LINE for a in A : NEW_LINE INDENT while j < ... |
atcoder_abc009_C | [
"import java . util . Arrays ; import java . util . Scanner ; public class Main { static Scanner in = new Scanner ( System . in ) ; int n , k ; String s ; void solve ( ) { n = in . nextInt ( ) ; k = in . nextInt ( ) ; in . nextLine ( ) ; s = in . nextLine ( ) ; char [ ] c = s . toCharArray ( ) ; Arrays . sort ( c )... | [
"from copy import copy NEW_LINE def main ( ) : NEW_LINE INDENT n , k = map ( int , input ( ) . split ( ) ) NEW_LINE s = list ( input ( ) ) NEW_LINE print ( \" \" . join ( smallest ( k , s , s ) ) ) NEW_LINE DEDENT def smallest ( k , s , avail ) : NEW_LINE INDENT assert len ( s ) == len ( avail ) NEW_LINE assert k >... |
atcoder_abc119_D | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , q = sc . nextInt ( ) ; TreeSet < Long > t = new TreeSet < Long > ( ) , s = new TreeSet < Long > ( ) ; for ( int i = 0 ; i < a ; i +... | [
"from bisect import bisect_left NEW_LINE a , b , q = map ( int , input ( ) . split ( ) ) NEW_LINE inf = float ( ' inf ' ) NEW_LINE S = [ - inf ] + [ int ( input ( ) ) for i in range ( a ) ] + [ inf ] NEW_LINE T = [ - inf ] + [ int ( input ( ) ) for i in range ( b ) ] + [ inf ] NEW_LINE def f ( S , T ) : NEW_LINE IN... |
atcoder_abc030_B | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] st = sc . nextLine ( ) . split ( \" ▁ \" ) ; sc . close ( ) ; int n = Integer . parseInt ( st [ 0 ] ) ; int m = Integer . parseInt ( st [ 1 ] ) ; n = n >= 12 ? n - ... | [
"n , m = map ( int , input ( ) . split ( ) ) NEW_LINE n = n % 12 NEW_LINE n_angle = n * 30 + m * 0.5 NEW_LINE m_angle = m * 6 NEW_LINE print ( min ( abs ( n_angle - m_angle ) , 360 - abs ( n_angle - m_angle ) ) ) NEW_LINE",
"def watch ( n : int , m : int ) -> float : NEW_LINE INDENT long_angle = ( n % 12 ) * ( 36... |
atcoder_abc015_C | [
"import java . util . * ; import java . awt . * ; import java . awt . geom . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int ... | [
"from itertools import product NEW_LINE from functools import reduce NEW_LINE from operator import xor NEW_LINE N , K = map ( int , input ( ) . split ( ) ) NEW_LINE T = [ [ int ( _ ) for _ in input ( ) . split ( ) ] for _ in range ( N ) ] NEW_LINE flag = False NEW_LINE for i in product ( * T ) : NEW_LINE INDENT if ... |
atcoder_abc035_B | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int x = 0 ; int y = 0 ; int uk = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { switch ( s . substring ( i , i + 1 ) ) { case \" R \" : x ++ ; ... | [
"import math NEW_LINE def getInt ( ) : return int ( input ( ) ) NEW_LINE def getIntList ( ) : return [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE def zeros ( n ) : return [ 0 ] * n NEW_LINE def zeros2 ( n , m ) : return [ zeros ( m ) for i in range ( n ) ] NEW_LINE class Debug ( ) : NEW_LINE INDENT def __i... |
atcoder_agc028_B | [
"import java . io . * ; import java . util . * ; public class Main { static final Reader in = new Reader ( ) ; static final long M = ( long ) 1e9 + 7 ; public static void main ( String [ ] args ) { int n = in . nextInt ( ) ; long [ ] ps = new long [ n + 1 ] ; long nf = 1 ; for ( int i = 1 ; i <= n ; ++ i ) { ps [ i... | [
"N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE mod = 10 ** 9 + 7 NEW_LINE F = 1 NEW_LINE for i in range ( 2 , N + 1 ) : NEW_LINE INDENT F = F * i % mod NEW_LINE DEDENT D = [ 0 ] NEW_LINE for i in range ( 2 , N + 1 ) : NEW_LINE INDENT D . append ( D [ - 1 ] + pow ( i , mod ... |
atcoder_abc021_C | [
"import java . util . stream . IntStream ; public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; private static int mod = 1000000007 ; public static void main ( String [ ] $ ) { int n = scanner . nextInt ( ) , a = scanner . nextInt ( ) - 1 , b = scanner . nex... | [
"from collections import deque NEW_LINE def main ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a , b = map ( int , input ( ) . split ( ) ) NEW_LINE a -= 1 NEW_LINE b -= 1 NEW_LINE m = int ( input ( ) ) NEW_LINE adj_mat = [ [ False for j in range ( n ) ] for i in range ( n ) ] NEW_LINE for i in range ( m ) : ... |
atcoder_arc082_C | [
"import java . util . * ; public class Main { static long mod = 998244353 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] x = new long [ n ] , y = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = sc . nextLong ( ) ; y [ i ] ... | [
"def gcd ( a , b ) : NEW_LINE INDENT if b == 0 : NEW_LINE INDENT return a NEW_LINE DEDENT return gcd ( b , a % b ) NEW_LINE DEDENT def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE from collections import defaultdict NEW_LINE H = defaultdict ( lambda : 0 ) NEW_LINE N = int ( input ( ) ) NE... |
atcoder_abc017_B | [
"import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String X = sc . next ( ) ; int ngs = X . length ( ) ; if ( ngs == 0 ) { System . out . println ( \" YES \" ) ; System . exit ( 0 ) ; } int cnt = 0 ; for ( cnt = 0 ; cnt < ngs ; cnt +... | [
"X = input ( ) NEW_LINE X1 = X . split ( \" ch \" ) NEW_LINE X2 = \" \" . join ( X1 ) . split ( \" o \" ) NEW_LINE X3 = \" \" . join ( X2 ) . split ( \" k \" ) NEW_LINE X4 = \" \" . join ( X3 ) . split ( \" u \" ) NEW_LINE if len ( \" \" . join ( X4 ) ) == 0 : NEW_LINE INDENT print ( \" YES \" ) NEW_LINE DEDENT els... |
atcoder_abc065_B | [
"import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( input .... | [
"n , * a = map ( int , open ( 0 ) ) ; c , s = 1 , a [ 0 ] NEW_LINE while s != 2 and c < n : c += 1 ; s = a [ s - 1 ] NEW_LINE print ( c * ( c < n ) or - 1 ) NEW_LINE",
"import sys NEW_LINE from collections import deque NEW_LINE def main ( ) : NEW_LINE INDENT input = sys . stdin . readline NEW_LINE N = int ( input... |
atcoder_agc017_B | [
"import java . util . * ; public class Main { int INF = Integer . MAX_VALUE ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextInt ( ) ; long A = sc . nextInt ( ) ; long B = sc . nextInt ( ) ; long C = sc . nextI... | [
"import sys NEW_LINE stdin = sys . stdin NEW_LINE sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE def li ( ) : return map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE def li_ ( ) : return map ( lambda x : int ( x ) - 1 , stdin . readline ( ) . split ( ) ) NEW_LINE def lf ( ) : return map ( float , stdin . readl... |
atcoder_abc007_A | [
"import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n - 1 ) ; } }",
"import java . util . * ; import java . util . stream . * ; import static java . lang . System... | [
"print ( int ( input ( ) ) - 1 ) NEW_LINE",
"import numpy as np NEW_LINE class Calculator : NEW_LINE INDENT def __init__ ( self ) : NEW_LINE INDENT pass NEW_LINE DEDENT def set_num ( self , N ) : NEW_LINE INDENT self . num = 0 NEW_LINE self . N = N NEW_LINE DEDENT def calc ( self ) : NEW_LINE INDENT self . num = ... |
atcoder_abc012_D | [
"import java . util . * ; public class Main { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] times = new int [ n ] [ n ] ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ... | [
"import sys NEW_LINE stdin = sys . stdin NEW_LINE sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE def li ( ) : return map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE def li_ ( ) : return map ( lambda x : int ( x ) - 1 , stdin . readline ( ) . split ( ) ) NEW_LINE def lf ( ) : return map ( float , stdin . readl... |
atcoder_agc004_C | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) , w = sc . nextInt ( ) ; char [ ] [ ] map = new char [ h ] [ w ] ; for ( int i = 0 ; i < h ; i ++ ) { map [ i ] = sc . next ( ) . toCharArray ( ... | [
"h , w = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE a = [ input ( ) for i in range ( h ) ] NEW_LINE r , b = [ [ \" # \" ] for i in range ( h ) ] , [ [ \" . \" ] for i in range ( h ) ] NEW_LINE x = [ \" # \" , \" . \" ] NEW_LINE for i in range ( h ) : NEW_LINE INDENT for j in range ( 1 , w - 1 ) : NEW_LIN... |
atcoder_arc082_B | [
"import java . util . * ; public class Main { private static int solve ( Scanner scanner ) { int N = Integer . parseInt ( scanner . nextLine ( ) ) ; int [ ] nums = lineToIntNums ( scanner . nextLine ( ) ) ; for ( int i = 0 ; i < N ; i ++ ) { nums [ i ] -- ; } int ret = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( nu... | [
"import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT A [ i - 1 ] -= i NEW_LINE DEDENT ans = 0 NEW_LINE if all ( a != 0 for a in... |
atcoder_agc010_B | [
"import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ]... | [
"N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE s = sum ( A ) NEW_LINE K = s // ( N * ( N + 1 ) // 2 ) NEW_LINE if N == 1 : NEW_LINE INDENT print ( \" YES \" ) NEW_LINE exit ( ) NEW_LINE DEDENT if s % ( N * ( N + 1 ) // 2 ) != 0 : NEW_LINE INDENT print ( \" NO \" ) NEW_LINE... |
atcoder_agc011_B | [
"import java . util . * ; import java . lang . * ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] ball = new long [ n ] ; long [ ] ruisekiball = new long [ n ] ; int ans = 1 ; int ite = n - 1 ; for ( ... | [
"N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A . sort ( ) NEW_LINE c = 0 NEW_LINE kind = N NEW_LINE for i , a in enumerate ( A ) : NEW_LINE INDENT if c * 2 < a : NEW_LINE INDENT kind = N - i NEW_LINE DEDENT c += a NEW_LINE DEDENT print ( kind ) NEW_LINE",
"import sys N... |
atcoder_agc031_A | [
"import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; long mod = 1000000007 ; long [ ] cnt = new long [ 26 ] ; for ( int i = 0 ; i < N ; i ++ ) { cnt [ S . charAt ( i ) - ' a ... | [
"import sys NEW_LINE stdin = sys . stdin NEW_LINE sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE def li ( ) : return map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE def li_ ( ) : return map ( lambda x : int ( x ) - 1 , stdin . readline ( ) . split ( ) ) NEW_LINE def lf ( ) : return map ( float , stdin . readl... |
atcoder_agc025_B | [
"import java . util . Scanner ; public class Main { static final long M = 998244353L ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; long K = scanner . nextLong ( ) ; Syste... | [
"n , a , b , k = map ( int , input ( ) . split ( ) ) NEW_LINE m = 998244353 NEW_LINE I = [ 0 ] * n NEW_LINE for i in range ( n ) : NEW_LINE INDENT I [ i ] = pow ( i + 1 , m - 2 , m ) NEW_LINE DEDENT c = [ 0 ] * ( n + 1 ) NEW_LINE c [ 0 ] = 1 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT c [ i ] = ( c [ i ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.