Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
13
20
java
sequence
python
sequence
atcoder_arc044_B
[ "import java . io . * ; import java . util . * ; import static java . lang . System . in ; class Main { static long mod = 1000000000 + 7 ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = ...
[ "def main ( ) : NEW_LINE INDENT R = 10 ** 9 + 7 NEW_LINE N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( \" ▁ \" ) ) ) NEW_LINE if a [ 0 ] != 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT amax = max ( a ) NEW_LINE h = [ 0 ] * ( amax + 1 ) NEW_LINE for i in a : NEW_LINE INDENT h [ i ] += 1 N...
atcoder_arc032_B
[ "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 ( ) ; UnionFind uf = new UnionFind ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ; int b = sc . nextInt ( )...
[ "import sys NEW_LINE input = sys . stdin . readline NEW_LINE n , m = map ( int , input ( ) . split ( ) ) NEW_LINE par = [ ] NEW_LINE rank = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT par . append ( i ) NEW_LINE rank . append ( 0 ) NEW_LINE DEDENT def find ( x , par ) : NEW_LINE INDENT if par [ x ] == x : N...
atcoder_abc015_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) , m = sc . next ( ) ; if ( n . length ( ) > m . length ( ) ) System . out . println ( n ) ; else System . out . println ( m ) ; } }", "im...
[ "s1 = input ( ) NEW_LINE s2 = input ( ) NEW_LINE if len ( s1 ) > len ( s2 ) : NEW_LINE INDENT print ( s1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( s2 ) NEW_LINE DEDENT", "print ( max ( open ( 0 ) , key = len ) ) NEW_LINE", "a = input ( ) NEW_LINE b = input ( ) NEW_LINE print ( a if len ( a ) >= len ( b )...
atcoder_arc084_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ...
[ "N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE c = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE sorted_a = sorted ( a ) NEW_LINE sorted_b = sorted ( b ) NEW_LINE sorted_c = sorted ( c ) NE...
atcoder_arc007_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; System . out . println ( sc . next ( ) . replaceAll ( a , \" \" ) ) ; } }", "import java . io . OutputStream ; import java . io . IOException ; import j...
[ "X = input ( ) NEW_LINE s = input ( ) NEW_LINE result = \" \" . join ( [ c for c in s if c not in X ] ) NEW_LINE print ( result ) NEW_LINE", "x , c = input ( ) , input ( ) NEW_LINE ans = \" \" NEW_LINE for i in range ( len ( c ) ) : NEW_LINE INDENT if c [ i ] != x : ans += c [ i ] NEW_LINE DEDENT print ( ans ) NE...
atcoder_abc059_B
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String s = \" EQUAL \" ; if ( a . length ( ) > b . length ( ) ) { System . out . println ( \" GREATER \" ) ; System . exi...
[ "a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE print ( \" GREATER \" if a > b else \" LESS \" if a < b else \" EQUAL \" ) NEW_LINE", "import sys NEW_LINE ns = lambda : sys . stdin . readline ( ) . rstrip ( ) NEW_LINE ni = lambda : int ( ns ( ) ) NEW_LINE nm = lambda : map ( int , sys . stdin . rea...
atcoder_abc089_B
[ "import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String a [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . next ( ) ; } Set < String >...
[ "N = int ( input ( ) ) NEW_LINE a = list ( input ( ) . split ( ) ) NEW_LINE if ( \" Y \" in a ) : NEW_LINE INDENT print ( \" Four \" ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( \" Three \" ) NEW_LINE DEDENT", "input ( ) ; print ( ' TFhoruere ' [ ' Y ' in input ( ) : : 2 ] ) NEW_LINE", "n = int ( input ( ) ...
atcoder_abc105_D
[ "import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; int [ ] sum = new int [ n + 1 ] ; long ans = 0 ; sum [ 0 ] = 0 ; map . put ( 0 , 1 )...
[ "from itertools import accumulate as ac NEW_LINE from collections import Counter as c NEW_LINE n , m = map ( int , input ( ) . split ( ) ) NEW_LINE a = 0 NEW_LINE for i in c ( [ i % m for i in [ 0 ] + list ( ac ( list ( map ( int , input ( ) . split ( ) ) ) ) ) ] ) . values ( ) : NEW_LINE INDENT a += i * ( i - 1 ) ...
atcoder_abc043_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int total = scanner . nextInt ( ) ; int sum = 0 ; for ( int ix = 1 ; ix <= total ; ix ++ ) { sum += ix ; } System . out . println ( sum ) ; } }", "import java . util . Arrays...
[ "N = int ( input ( ) ) NEW_LINE print ( int ( ( 1 + N ) * N / 2 ) ) NEW_LINE", "def children_and_candies ( N : int ) -> int : NEW_LINE INDENT return N * ( N + 1 ) // 2 NEW_LINE DEDENT if __name__ == \" _ _ main _ _ \" : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE ans = children_and_candies ( N ) NEW_LINE print...
atcoder_abc114_D
[ "import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] p = { 2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 , 41 , 43 , 47 , 53 , 59 , 61 , 67 , 71 , 73 , 79 , 83 , 89 , 97 } ; int [ ] pTotal = new int...
[ "import math NEW_LINE from collections import Counter NEW_LINE import itertools NEW_LINE def prime_factors ( n ) : NEW_LINE INDENT i = 2 NEW_LINE factors = [ ] NEW_LINE while i * i <= n : NEW_LINE INDENT if n % i == 0 : NEW_LINE INDENT n //= i NEW_LINE factors . append ( i ) NEW_LINE DEDENT else : NEW_LINE INDENT i...
atcoder_arc078_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { public static void main ( String args [ ] ) { ConsoleScanner cin = new ConsoleScanner...
[ "def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE import numpy as np NEW_LINE ans = float ( ' inf ' ) NEW_LINE N = int ( input ( ) ) NEW_LINE a = np . cumsum ( np . array ( inpl ( ) ) ) NEW_LINE suma = a [ - 1 ] NEW_LINE a = np . delete ( a , - 1 ) NEW_LINE for i in a : NEW_LINE INDENT an...
atcoder_abc022_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int weight = 0 ; int output = 0 ; for ( int i = 0 ; i < n ; i ++ ) { weight += sc . nextInt ( ) ; if...
[ "ans = 0 NEW_LINE n , s , t = map ( int , input ( ) . split ( ) ) NEW_LINE w = int ( input ( ) ) NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT if s <= w <= t : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT w += int ( input ( ) ) NEW_LINE DEDENT if s <= w <= t : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT print ( ans ...
atcoder_arc017_C
[ "import java . util . HashMap ; import java . util . Scanner ; public class Main { static int a ; static int [ ] w ; static HashMap < Integer , Integer > left = new HashMap < Integer , Integer > ( ) ; static HashMap < Integer , Integer > right = new HashMap < Integer , Integer > ( ) ; public static void main ( Stri...
[ "from bisect import bisect , bisect_left NEW_LINE def inpl ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE N , X = inpl ( ) NEW_LINE W = [ int ( input ( ) ) for _ in range ( N ) ] NEW_LINE A = N // 2 NEW_LINE B = N - A NEW_LINE C = [ ] NEW_LINE D = [ ] NEW_LINE for i in range ( 2 ** A ) : NEW_LIN...
atcoder_agc001_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) * 2 ; long length [ ] = new long [ num ] ; for ( int i = 0 ; i < num ; i ++ ) { length [ i ] = sc . nextLong ( ) ; } Arrays . sort ( length ) ; long ans =...
[ "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_arc065_A
[ "import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; char [ ] array = sc . nextLine ( ) . toCharArray ( ) ; try { for ( int i = array . length - 1 ; i >= 0 ; i -- ) { if ( i >= 6 ) { if ( array [ i - 6 ] == ' d ' && array [ i - 5 ] == ' r ' ...
[ "s = list ( input ( ) ) NEW_LINE c = 0 NEW_LINE while len ( s ) > 0 : NEW_LINE INDENT p = \"1\" NEW_LINE q = \"1\" NEW_LINE r = \"1\" NEW_LINE if len ( s ) < 5 : NEW_LINE INDENT break NEW_LINE DEDENT if len ( s ) <= 7 : NEW_LINE INDENT if len ( s ) == 5 : NEW_LINE INDENT if s == list ( \" dream \" ) or s == list ( ...
atcoder_arc061_B
[ "import java . util . * ; import java . awt . Point ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } public void solve ( ) { Scanner scanner = new Scanner ( System . in ) ; long H = scanner . nextLong ( ) ; long W = scanner . nextLong ( ) ; int N = scanner . nextInt (...
[ "import sys NEW_LINE input = sys . stdin . readline NEW_LINE sys . setrecursionlimit ( 10000 ) NEW_LINE H , W , N = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE if N == 0 : NEW_LINE INDENT reslis = [ 0 ] * 10 NEW_LINE reslis [ 0 ] = ( H - 2 ) * ( W - 2 ) - sum ( reslis ) NEW_LINE DEDENT else : NEW_LINE IND...
atcoder_agc001_C
[ "import java . util . * ; class Main { static ArrayList < Integer > [ ] map ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; if ( x == 1 ) { System . out . println ( n - 2 ) ; System . exit ( 0 ) ; } map = new ArrayList ...
[ "from collections import deque NEW_LINE n , k = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE b = [ [ int ( i ) - 1 for i in input ( ) . split ( ) ] for i in range ( n - 1 ) ] NEW_LINE x , d , ans , c = [ [ ] for i in range ( n ) ] , [ [ ] for i in range ( n ) ] , n , 0 NEW_LINE for i , j in b : NEW_LINE IN...
atcoder_abc118_D
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { int INF = 100000000 ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] dp = new int [ n + 1 ] ; int [ ] a = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { a [ i ] =...
[ "import sys NEW_LINE def solve ( N : int , M : int , A : \" List [ int ] \" ) : NEW_LINE INDENT costs = [ 10 ** 18 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6 ] NEW_LINE cand = [ ( i , costs [ i ] ) for i in A ] NEW_LINE cand . sort ( reverse = True ) NEW_LINE digits = [ - 1 * 10 ** 16 for i in range ( N + 1 ) ] NEW_LINE d...
atcoder_agc001_B
[ "import java . util . * ; import java . awt . * ; import java . awt . geom . Point2D ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; long n = sc . nextLong ( ) ; long x = sc . nextLong ...
[ "import sys NEW_LINE stdin = sys . stdin NEW_LINE ni = lambda : int ( ns ( ) ) NEW_LINE na = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) NEW_LINE nn = lambda : list ( stdin . readline ( ) . split ( ) ) NEW_LINE ns = lambda : stdin . readline ( ) . rstrip ( ) NEW_LINE n , x = na ( ) NEW_LINE def...
atcoder_abc011_B
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . nextLine ( ) ; scanner . close ( ) ; String formatted = \" \" ; if ( s . length ( ) == 1 ) { formatted = s . toUpperCase ( ) ; } else { formatted = s...
[ "s = str ( input ( ) ) NEW_LINE print ( s . capitalize ( ) ) NEW_LINE", "s = input ( ) NEW_LINE s = s . lower ( ) NEW_LINE if len ( s ) >= 2 : NEW_LINE INDENT print ( s [ 0 ] . upper ( ) + s [ 1 : ] ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( s [ 0 ] . upper ( ) ) NEW_LINE DEDENT", "s = input ( ) NEW_LINE ...
atcoder_abc104_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; boolean b1 , b2 = false , b3 = true ; b1 = ( s . charAt ( 0 ) == ' A ' ) ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ...
[ "from collections import Counter NEW_LINE from functools import reduce NEW_LINE import fractions NEW_LINE import math NEW_LINE import statistics NEW_LINE import sys NEW_LINE import time NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE INF = 10 ** 18 NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def LI ( ) : return [ int...
atcoder_abc040_C
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int [ ] dp = new int [ n ] ; dp [ 0 ] = 0 ; dp [ 1 ] = Math ...
[ "n , * a = map ( int , open ( 0 ) . read ( ) . split ( ) ) NEW_LINE dp = [ 0 for i in range ( n ) ] NEW_LINE dp [ 1 ] = abs ( a [ 0 ] - a [ 1 ] ) NEW_LINE for i in range ( 2 , n ) : NEW_LINE INDENT x = abs ( a [ i ] - a [ i - 2 ] ) + dp [ i - 2 ] NEW_LINE y = abs ( a [ i ] - a [ i - 1 ] ) + dp [ i - 1 ] NEW_LINE dp...
atcoder_abc121_D
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long ans = 0 ; long c = 0 ; if ( a % 2 == 0 ) { if ( b % 2 == 0 ) { c = b - a ; c /= 2 ; if ( c % 2 == 0 ) { ans = b ; } el...
[ "A , B = map ( int , input ( ) . split ( ) ) NEW_LINE A -= 1 NEW_LINE if A % 4 == 1 : NEW_LINE INDENT A = 1 NEW_LINE DEDENT elif A % 4 == 2 : NEW_LINE INDENT A += 1 NEW_LINE DEDENT elif A % 4 == 3 : NEW_LINE INDENT A = 0 NEW_LINE DEDENT if B % 4 == 1 : NEW_LINE INDENT B = 1 NEW_LINE DEDENT elif B % 4 == 2 : NEW_LIN...
atcoder_arc027_A
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int ans = 0 ; if ( h < 17 ) { if ( m == 0 ) { ans = ( 18 - h ) * 60 ; } else { ans = ( ( 17 - h ) * 60 ) + ( 60 - m ) ; }...
[ "h , m = map ( int , input ( ) . split ( ) ) NEW_LINE min = 60 * h + m NEW_LINE a = 18 * 60 NEW_LINE print ( a - min ) NEW_LINE", "import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE h , m = map ( int , input ( ) . split ( ) ) NEW_LINE ams = 0 NEW_LINE if m == ...
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
7