id
stringlengths
13
20
java
list
python
list
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 == ...
atcoder_abc072_B
[ "import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String s = sc . next ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i += 2 ) { sb . append ( s . charAt ( i ) ) ; } Sys...
[ "s = input ( ) NEW_LINE print ( s [ : : 2 ] ) 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 . readline ( ) . split ( ) ) NEW_LINE nl = lambda : list ( nm ( ) ) NEW_LINE s = list ( ns ( ) ) ...
atcoder_arc087_C
[ "import java . util . * ; public class Main { static class TriTree { Node root = new Node ( ) ; class Node { ArrayList < Node > child = new ArrayList < > ( ) ; char c ; long depth ; public void add ( Node node ) { child . add ( node ) ; } public Node ( ) { } public Node ( char c , long depth ) { this . c = c ; this...
[ "def getGrundyNumber ( x ) : NEW_LINE INDENT ans = 1 NEW_LINE while x % ( ans * 2 ) == 0 : NEW_LINE INDENT ans *= 2 NEW_LINE DEDENT return ans NEW_LINE DEDENT N , L = map ( int , input ( ) . split ( ) ) NEW_LINE Ss = [ input ( ) for i in range ( N ) ] NEW_LINE Ss . sort ( ) NEW_LINE Hgts = { L : 2 } NEW_LINE prev =...
atcoder_abc064_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 [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int [ ] rate = new ...
[ "N = int ( input ( ) ) NEW_LINE a = map ( int , input ( ) . split ( ) ) NEW_LINE color_set = set ( ) NEW_LINE original_cnt = 0 NEW_LINE red_flag = False NEW_LINE for val in a : NEW_LINE INDENT if val >= 3200 : NEW_LINE INDENT original_cnt += 1 NEW_LINE DEDENT else : NEW_LINE INDENT if val >= 2800 : NEW_LINE INDENT ...
atcoder_abc122_B
[ "import java . util . * ; public class Main { public static boolean isValid ( char c ) { if ( c == ' A ' || c == ' C ' || c == ' T ' || c == ' G ' ) { return true ; } return false ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int max = 0 ; fo...
[ "print ( len ( max ( \" \" . join ( str ( int ( c in { \" A \" , \" T \" , \" G \" , \" C \" } ) ) for c in input ( ) ) . split ( \"0\" ) ) ) ) NEW_LINE", "s = input ( ) NEW_LINE counter = 0 NEW_LINE max_count = 0 NEW_LINE for i in range ( len ( s ) ) : NEW_LINE INDENT if s [ i ] == ' A ' or s [ i ] == ' C ' or s...
atcoder_abc029_D
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . compute ( ) ; } void compute ( ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) * 10 ; long ans = 0 ; for ( long i = 10 ; i < 10000000000L ; i *= 10 ) { long digit = N % ( i * 10...
[ "N = int ( input ( ) ) NEW_LINE ans = 0 NEW_LINE for i in range ( 9 ) : NEW_LINE INDENT A = ( N // ( 10 ** ( i ) ) ) NEW_LINE if ( A ) % 10 == 1 : NEW_LINE INDENT ans += ( A // 10 ) * ( 10 ** i ) NEW_LINE ans += ( N % ( 10 ** ( i ) ) + 1 ) NEW_LINE DEDENT elif ( A ) % 10 > 1 : NEW_LINE INDENT ans += ( A // 10 + 1 )...
atcoder_arc094_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 [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) a [ i ] = Integer . parseInt ( sc . next ( ) ) ; int c = 0 ; while ( true ) { Arrays...
[ "def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE C , B , A = sorted ( inpl ( ) ) NEW_LINE if ( B - C ) % 2 == 0 : NEW_LINE INDENT print ( ( 2 * A - B - C ) // 2 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ( 2 * A - B - C + 3 ) // 2 ) NEW_LINE DEDENT", "A , B , C = sorted ( map ( i...
atcoder_arc008_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int num = Integer . parseInt ( br . rea...
[ "n = int ( input ( ) ) NEW_LINE print ( ( n // 10 ) * 100 + min ( 100 , ( n % 10 ) * 15 ) ) NEW_LINE", "import sys NEW_LINE import copy NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE ans = 1000000000000000 NEW_LINE for i in range ( 100 ) : NEW_LINE INDENT for j in range ( 100 ) : ...
atcoder_agc006_D
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int L = 2 * N - 1 ; int [ ] a = new int [ L ] ; for ( int i = 0 ; i < L ; i ++ ) a [ i ] = sc . nextInt ( ) ; int min = 1 ; int max = L ; boolean b [ ] = ...
[ "N = int ( input ( ) ) NEW_LINE a = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE def check ( n ) : NEW_LINE INDENT b = [ False ] * ( len ( a ) ) NEW_LINE for i in range ( 1 , len ( a ) ) : NEW_LINE INDENT if a [ i ] >= n : NEW_LINE INDENT b [ i ] = True NEW_LINE DEDENT else : NEW_LINE INDENT b [ i ...
atcoder_arc083_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 [ ] [ ] A = new int [ N ] [ N ] ; long sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) for ( int j = 0 ; j < N ; j ++ ) { A [ i ] [ j ] = sc . nextIn...
[ "def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE import sys NEW_LINE import numpy NEW_LINE N = int ( input ( ) ) NEW_LINE A = numpy . asarray ( [ inpl ( ) for _ in range ( N ) ] ) NEW_LINE ans = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT A [ i ] [ i ] = 10 ** 9 + 1 NEW_LINE DEDENT...
atcoder_arc081_A
[ "import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ; import java . util . TreeMap ; import java . util . Map . Entry ; public class Main { public static void main ( String [ ] args ) { t...
[ "import sys NEW_LINE import collections NEW_LINE ns = lambda : sys . stdin . readline ( ) . rstrip ( ) NEW_LINE ni = lambda : int ( ns ( ) ) NEW_LINE nm = lambda : map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE nl = lambda : list ( nm ( ) ) NEW_LINE nsl = lambda : map ( str , sys . stdin . readline (...
atcoder_arc014_C
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int r = 0 ; int g = 0 ; int b = 0 ; for ( char c : s . toCharArray ( ) ) { switch ( c ) { case ' R ' : r ++ ; break ; case ' G ...
[ "print ( ( lambda n , l : sum ( [ l . count ( c ) % 2 for c in [ ' R ' , ' G ' , ' B ' ] ] ) ) ( input ( ) , input ( ) ) ) NEW_LINE", "N = int ( input ( ) ) NEW_LINE S = input ( ) NEW_LINE slot = ' ' NEW_LINE for idx in range ( 0 , len ( S ) , 1 ) : NEW_LINE INDENT if len ( slot ) == 0 : NEW_LINE INDENT slot = S ...
atcoder_abc054_A
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; sc . close ( ) ; if ( a == b ) { System . out . println ( \" Draw \" ) ; } else if ( a == 1 ) { System ....
[ "a , b = map ( int , input ( ) . split ( ) ) NEW_LINE if a == b : print ( \" Draw \" ) NEW_LINE elif a == 1 : print ( \" Alice \" ) NEW_LINE elif b == 1 : print ( \" Bob \" ) NEW_LINE elif a > b : print ( \" Alice \" ) NEW_LINE else : print ( \" Bob \" ) NEW_LINE", "from functools import reduce NEW_LINE import ma...
atcoder_arc026_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 a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; if ( n >= 5 ) { ans = 5 * b + ( n - 5 ) * a ; } else { ans = n * b ; } System . ...
[ "N , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE print ( ( N - 5 ) * A + 5 * B if N > 5 else N * B ) NEW_LINE", "def main ( ) : NEW_LINE INDENT n , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE if n <= 5 : NEW_LINE INDENT print ( n * b ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 5 * b + ( n -...
atcoder_arc072_B
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long x = in . nextLong ( ) , y = in . nextLong ( ) ; System . out . println ( Math . abs ( x - y ) <= 1 ? \" Brown \" : \" Alice \" ) ; } }", "import java . io . IOException...
[ "a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( ' Alice ' if abs ( a - b ) > 1 else ' Brown ' ) NEW_LINE", "X , Y = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE cache = { } NEW_LINE def calc ( X , Y ) : NEW_LINE INDENT if X < Y : NEW_LINE INDENT X , Y = Y , X NEW_LINE DEDENT def cal ( X , Y...
atcoder_arc033_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int total = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { int count = 1 ; count += N - i ; total += count ; } System . out . println ( total ) ; } }", "import...
[ "n = int ( input ( ) ) ; print ( n * ( n + 1 ) // 2 ) NEW_LINE", "N = int ( input ( ) ) NEW_LINE res = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j in range ( i , N ) : NEW_LINE INDENT res += 1 NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE", "def main ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_L...
atcoder_abc105_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int K = sc . nextInt ( ) ; System . out . println ( N % K == 0 ? 0 : 1 ) ; } }", "import java . util . Scanner ; public cla...
[ "N , K = map ( int , input ( ) . split ( ) ) NEW_LINE if N % K == 0 : NEW_LINE INDENT print ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT", "import numpy as np NEW_LINE class Calculator : NEW_LINE INDENT def __init__ ( self , N , K ) : NEW_LINE INDENT self . arr = np . array ( [ N , K ]...
atcoder_abc042_A
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { int value = input . nextInt ( ) ; if ( value == 5 ) a ++ ; else if ( value == 7 ) b ++ ; } if ( a == 2 && b == 1 ...
[ "A = input ( ) . split ( ) NEW_LINE print ( \" YES \" if A . count ( \"5\" ) == 2 and A . count ( \"7\" ) == 1 else \" NO \" ) NEW_LINE", "a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE arr = [ a , b , c ] NEW_LINE arr = sorted ( arr ) NEW_LINE if arr [ 0 ] == arr [ 1 ] == 5 and arr [ 2 ] == 7 : NEW_LIN...
atcoder_abc058_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String po = sc . nextLine ( ) ; String popo = sc . nextLine ( ) ; for ( int i = 0 ; i < popo . length ( ) ; i ++ ) { System . out . print ( po . substring ( i , i + 1 ) + popo . sub...
[ "O = input ( ) NEW_LINE E = input ( ) NEW_LINE if len ( O ) == len ( E ) : NEW_LINE INDENT for i in range ( len ( O ) ) : NEW_LINE INDENT print ( O [ i ] + E [ i ] , end = ' ' ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT for i in range ( len ( E ) ) : NEW_LINE INDENT print ( O [ i ] + E [ i ] , end = ' ' ) NEW_L...
atcoder_abc083_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; if ( a + b > c + d ) { System . out . println ( \" Left \" ) ; } else if ...
[ "a , b , c , d = map ( int , input ( ) . split ( ) ) NEW_LINE l = a + b NEW_LINE r = c + d NEW_LINE if l > r : NEW_LINE INDENT print ( \" Left \" ) NEW_LINE DEDENT elif l == r : NEW_LINE INDENT print ( \" Balanced \" ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( \" Right \" ) NEW_LINE DEDENT", "A , B , C , D =...
atcoder_abc001_D
[ "import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N = Integer . parseInt ( br . readLine ( ) ) ; boolean [ ] rainTimes = n...
[ "import sys NEW_LINE input = sys . stdin . readline NEW_LINE n = int ( input ( ) ) NEW_LINE lis = [ list ( map ( int , input ( ) . rstrip ( ) . split ( ' - ' ) ) ) for _ in range ( n ) ] NEW_LINE lis . sort ( ) NEW_LINE for i in range ( n ) : NEW_LINE INDENT lis [ i ] [ 0 ] = lis [ i ] [ 0 ] - lis [ i ] [ 0 ] % 5 N...
atcoder_abc016_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; System . out . println ( ( a + b == n ) ? ( a - b == n ) ? \" ? \" : \" + \" : ( a - b == n ) ? \" -...
[ "a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE if a - b == c : NEW_LINE INDENT if a + b == c : NEW_LINE INDENT print ( \" ? \" ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( \" - \" ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if a + b == c : NEW_LINE INDENT print ( \" + \" ) NEW_LINE DEDENT else : ...
atcoder_abc036_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int tmp = ( B - 1 ) / A ; System . out . println ( tmp + 1 ) ; } }", "import java . io . BufferedReader ; import java . io . ...
[ "a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( - ( - b // a ) ) NEW_LINE", "from math import ceil NEW_LINE def tea ( A : int , B : int ) -> int : NEW_LINE INDENT return ceil ( B / A ) NEW_LINE DEDENT if __name__ == \" _ _ main _ _ \" : NEW_LINE INDENT A , B = map ( int , input ( ) . split ( ) ) NEW...
atcoder_abc027_D
[ "import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final String S = sc . next ( ) ; sc . close ( ) ; int mNum = 0 ; for ( char c : S . toCharArray ( ) ) { if ( c == ' M ' ) mNum ++ ; } int [ ] m =...
[ "S = input ( ) NEW_LINE p = 0 NEW_LINE m = 0 NEW_LINE for i in range ( len ( S ) ) : NEW_LINE INDENT if S [ i ] == ' + ' : NEW_LINE INDENT p += 1 NEW_LINE DEDENT elif S [ i ] == ' - ' : NEW_LINE INDENT m += 1 NEW_LINE DEDENT DEDENT l = [ ] NEW_LINE for i in range ( len ( S ) ) : NEW_LINE INDENT if S [ i ] == ' + ' ...
atcoder_abc078_A
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { String a = sc . next ( ) ; String b = sc . next ( ) ; char ach = a . charAt ( 0 ) ; char bch = b . charAt ( 0 ) ; if ( ach > bch ) { System . out ...
[ "a , b = input ( ) . split ( ) NEW_LINE if a == b : NEW_LINE INDENT print ( \" = \" ) NEW_LINE DEDENT elif a < b : NEW_LINE INDENT print ( \" < \" ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( \" > \" ) NEW_LINE DEDENT", "arr = { ' A ' : 0 , ' B ' : 1 , ' C ' : 2 , ' D ' : 3 , ' E ' : 4 , ' F ' : 5 } NEW_LINE ...
atcoder_abc115_D
[ "import java . util . Scanner ; public class Main { private static final long FIRST_SLICE_IS_BUN = 1 ; private static final long MIDDLE_PATTY = 1 ; public static long process ( TestCase testCase ) { final int N = testCase . N ; final long X = testCase . X ; return countNumPatty ( N , X ) ; } private static long cou...
[ "import sys NEW_LINE input = sys . stdin . readline NEW_LINE N , X = map ( int , input ( ) . split ( ) ) NEW_LINE b = [ 2 ** ( i + 2 ) - 3 for i in range ( N ) ] NEW_LINE p = [ 2 ** ( i + 1 ) - 1 for i in range ( N ) ] NEW_LINE def f ( N , X ) : NEW_LINE INDENT if N == 0 : NEW_LINE INDENT return 0 if X <= 0 else 1 ...
atcoder_agc001_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 ( ) ; ArrayList < Integer > odd = new ArrayList < > ( ) ; ArrayList < Integer > even = new ArrayList < > ( ) ; for ( int i = 0 ; i < ...
[ "n , m = map ( int , input ( ) . split ( ) ) NEW_LINE ali = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if m == 1 and ali [ 0 ] == 1 : NEW_LINE INDENT print ( 1 ) NEW_LINE print ( 1 ) NEW_LINE print ( 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT if m == 1 : NEW_LINE INDENT print ( ali [ 0 ] ) NEW_LINE print ( 2 ...
atcoder_abc099_C
[ "import java . util . * ; 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 ans = Integer . MAX_VALUE ; int s1 = n / 6 , s2 = n / 9 ; int [ ] TS = new int [ n...
[ "N = int ( input ( ) ) NEW_LINE dp = [ 0 for i in range ( N + 1 ) ] NEW_LINE dp [ 1 ] = 1 NEW_LINE kazu = [ 1 ] NEW_LINE i = 6 NEW_LINE while i <= N : NEW_LINE INDENT kazu . append ( i ) NEW_LINE i *= 6 NEW_LINE DEDENT i = 9 NEW_LINE while i <= N : NEW_LINE INDENT kazu . append ( i ) NEW_LINE i *= 9 NEW_LINE DEDENT...
atcoder_agc032_B
[ "import java . util . ArrayList ; import java . util . Scanner ; class Problem { private int N ; Problem ( ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; } void solve ( ) { int n = N % 2 == 1 ? N : N + 1 ; int M = N % 2 == 1 ? ( N - 1 ) / 2 : N / 2 ; ArrayList < String > edges = new ArrayList...
[ "n = int ( input ( ) ) ; print ( * [ ( n - 1 ) ** 2 // 2 ] + [ ' % d ▁ % d ' % ( i , j ) * ( j > i != n - j + 1 - n % 2 ) for i in range ( 1 , n ) for j in range ( n + 1 ) ] ) NEW_LINE", "import sys NEW_LINE def input ( ) : return sys . stdin . readline ( ) . strip ( ) NEW_LINE def list2d ( a , b , c ) : return [...
atcoder_arc025_A
[ "import java . util . * ; public class Main { private static int D [ ] = new int [ 7 ] ; private static int J [ ] = new int [ 7 ] ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < 7 ; i ++ ) { D [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < 7 ; i ++ ) { J [ i...
[ "D = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE J = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE res = 0 NEW_LINE for i in range ( 7 ) : NEW_LINE INDENT if D [ i ] >= J [ i ] : NEW_LINE INDENT res += D [ i ] NEW_LINE DEDENT else : NEW_LINE INDENT res += J [ i ] NEW_LINE DEDENT DEDENT print ( res...
atcoder_abc026_C
[ "import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int B [ ] = new int [ N ] ; LinkedList list [ ] = new LinkedList [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { list [ i ] = new LinkedList ( ) ; } fo...
[ "from collections import defaultdict as dd NEW_LINE n = int ( input ( ) ) NEW_LINE salary = [ 0 ] * ( n + 1 ) NEW_LINE d = dd ( list ) NEW_LINE for i in range ( 2 , n + 1 ) : NEW_LINE INDENT d [ int ( input ( ) ) ] . append ( i ) NEW_LINE DEDENT def calcsalary ( i ) : NEW_LINE INDENT if d [ i ] == [ ] : NEW_LINE IN...
atcoder_abc060_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 ...
[ "A , B , C = map ( int , input ( ) . split ( ) ) NEW_LINE R = { i : False for i in range ( B ) } NEW_LINE X = 0 NEW_LINE while True : NEW_LINE INDENT X += A NEW_LINE r = X % B NEW_LINE if r == C : NEW_LINE INDENT print ( \" YES \" ) NEW_LINE exit ( ) NEW_LINE DEDENT if R [ r ] : NEW_LINE INDENT print ( \" NO \" ) N...
atcoder_abc021_B
[ "import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; int a = reader . nextInt ( ) ; int b = reader . nextInt ( ) ; int K = reader . ...
[ "n = input ( ) NEW_LINE org = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE k = input ( ) NEW_LINE arr = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE t_arr = list ( set ( arr + org ) ) NEW_LINE print ( ' YES ' ) if len ( arr + org ) == len ( t_arr ) else print ( ' NO ' ) NEW_LINE", "f...
atcoder_abc027_A
[ "import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a == b ) { System . out . println ( c ) ; } else if...
[ "a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE if a == b : NEW_LINE INDENT print ( int ( c ) ) NEW_LINE DEDENT elif b == c : NEW_LINE INDENT print ( int ( a ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( int ( b ) ) NEW_LINE DEDENT", "def rect ( l1 : int , l2 : int , l3 : int ) -> int : NEW_LINE IN...
atcoder_abc121_C
[ "import java . math . BigDecimal ; import java . util . AbstractMap . SimpleEntry ; import java . util . ArrayList ; import java . util . Comparator ; import java . util . List ; import java . util . Map . Entry ; import java . util . Scanner ; import java . util . stream . Collectors ; public class Main { public s...
[ "N , M = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A = { } NEW_LINE B = [ 0 ] * N NEW_LINE for i in range ( N ) : NEW_LINE INDENT A [ i ] , B [ i ] = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE DEDENT A = sorted ( A . items ( ) , key = lambda x : x [ 1 ] ) NEW_LINE ans = 0 NEW_LINE for i in ra...
atcoder_abc080_A
[ "import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; if ( a * b <= c )...
[ "n , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( min ( n * a , b ) ) NEW_LINE", "N , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE if ( N * A > B ) : NEW_LINE INDENT print ( B ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( N * A ) NEW_LINE DEDENT", "N , A , B = map ( int , input ( ) . ...
atcoder_agc023_B
[ "import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = readInt ( ) ; char [ ] [ ] charMatrix = new char [ N ] [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { String tmpStr = sc . next ( ) ; for ( int j = 0 ; j < ...
[ "import numpy as np NEW_LINE n = int ( input ( ) ) NEW_LINE a = [ list ( input ( ) ) for i in range ( n ) ] NEW_LINE a = np . array ( a ) NEW_LINE c = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT a = np . roll ( a , 1 , axis = 0 ) NEW_LINE if len ( a [ a != a . T ] ) == 0 : c += n NEW_LINE DEDENT print ( c ) N...
atcoder_agc005_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 ) ; String s = sc . next ( ) ; int l = 0 , r = 1 ; int n = s . length ( ) ; int ans = 0 ; whi...
[ "s = input ( ) NEW_LINE t = [ ] NEW_LINE for a in s : NEW_LINE INDENT t . append ( a ) NEW_LINE if len ( t ) >= 2 : NEW_LINE INDENT if t [ - 2 ] == ' S ' and t [ - 1 ] == ' T ' : NEW_LINE INDENT for i in range ( 2 ) : NEW_LINE INDENT t . pop ( - 1 ) NEW_LINE DEDENT DEDENT DEDENT DEDENT print ( len ( t ) ) NEW_LINE"...
atcoder_arc042_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i , j ; double p , q , n , a , b , c , d , ans ; int pX [ ] = new int [ 12 ] ; int pY [ ] = new int [ 12 ] ; ans = 10000000 ; p = sc . nextInt ( ) ; q = sc . nextInt ( ) ; n = s...
[ "import cmath , sys NEW_LINE t_x , t_y = map ( int , input ( ) . split ( ) ) NEW_LINE N = int ( input ( ) ) NEW_LINE poly = [ list ( map ( int , e . split ( ) ) ) for e in sys . stdin ] NEW_LINE ans = 10000 NEW_LINE for i in range ( N ) : NEW_LINE INDENT p1 , p2 = poly [ i - 1 ] , poly [ i ] NEW_LINE p = complex ( ...
atcoder_abc093_B
[ "import static java . lang . System . * ; import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; TreeSet < Integer > set = new TreeSet < > ( ) ; for ...
[ "a , b , k = map ( int , input ( ) . split ( ) ) NEW_LINE res = [ ] NEW_LINE for i in range ( a , min ( a + k , b ) ) : NEW_LINE INDENT res . append ( i ) NEW_LINE DEDENT for j in range ( max ( a , b - k + 1 ) , b + 1 ) : NEW_LINE INDENT res . append ( j ) NEW_LINE DEDENT res = sorted ( set ( res ) ) NEW_LINE for i...
atcoder_abc040_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = ( int ) 1e9 ; if ( n == 1 ) { ans = 0 ; System . out . println ( ans ) ; return ; } for ( int i = 1 ; i < n ; i ++ ) { for ( int j = 1 ; i + j <...
[ "n = int ( input ( ) ) NEW_LINE s = int ( n ** 0.5 ) NEW_LINE best = 10 ** 9 NEW_LINE for i in range ( s , 0 , - 1 ) : NEW_LINE INDENT q , m = divmod ( n , i ) NEW_LINE best = min ( best , abs ( i - q ) + m ) NEW_LINE DEDENT print ( best ) NEW_LINE", "def rect_rect_rect_rect_rect ( n : int ) -> int : NEW_LINE IND...
atcoder_arc092_C
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean [ ] a = new boolean [ N + 1 ] ; long odd = 0 ; long even = 0 ; long max = Long . MIN_VALUE ; int mp = - 1 ; for ( int i = 1 ; i <= N ; ++ i ) { lo...
[ "N = int ( input ( ) ) NEW_LINE * A , = map ( int , input ( ) . split ( ) ) NEW_LINE def calc ( A ) : NEW_LINE INDENT if len ( A ) == 1 : NEW_LINE INDENT return [ ] , A [ 0 ] NEW_LINE DEDENT res = [ ] NEW_LINE if len ( A ) % 2 == 0 : NEW_LINE INDENT res . append ( len ( A ) ) NEW_LINE A = A [ : - 1 ] NEW_LINE DEDEN...
atcoder_abc028_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 [ ] c = new int [ 6 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' A ' ) { c [ 0 ] ++ ; } else if ( s . charAt (...
[ "str = list ( input ( ) ) NEW_LINE moji = [ ' A ' , ' B ' , ' C ' , ' D ' , ' E ' , ' F ' ] NEW_LINE for i in range ( 6 ) : NEW_LINE INDENT print ( str . count ( moji [ i ] ) , end = ' ' ) NEW_LINE if i < 5 : NEW_LINE INDENT print ( ' ▁ ' , end = ' ' ) NEW_LINE DEDENT DEDENT print ( ) NEW_LINE", "def count_up ( S...
atcoder_abc081_A
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { String string = scanner . nextLine ( ) ; System . out . println ( string . chars ( ) . filter ( x -> x == '1' ) . count ( ) ) ; } } }", "import java . io . Buff...
[ "print ( input ( ) . count ( \"1\" ) ) NEW_LINE", "s = int ( input ( ) ) NEW_LINE i = 0 NEW_LINE if ( s // 100 == 1 ) : NEW_LINE INDENT i = i + 1 NEW_LINE s = s - 100 NEW_LINE DEDENT if ( s // 10 == 1 ) : NEW_LINE INDENT i = i + 1 NEW_LINE s = s - 10 NEW_LINE DEDENT if ( s == 1 ) : NEW_LINE INDENT i = i + 1 NEW_L...
atcoder_abc089_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 ( ) ; long [ ] cnt = new long [ 5 ] ; for ( int i = 0 ; i < n ; i ++ ) { char ch = sc . next ( ) . charAt ( 0 ) ; if ( ch == ' M ' ) cnt ...
[ "N = int ( input ( ) ) NEW_LINE S = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT S . append ( list ( input ( ) ) [ 0 ] ) NEW_LINE DEDENT count = [ 0 ] * 5 NEW_LINE for i in range ( N ) : NEW_LINE INDENT if S [ i ] == \" M \" : NEW_LINE INDENT count [ 0 ] += 1 NEW_LINE DEDENT elif S [ i ] == \" A \" : NEW_LIN...
atcoder_abc077_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; int tmp = 0 ; while ( ( tmp + 1 ) * ( tmp + 1 ) <= N ) { ans = ( tmp + 1 ) * ( tmp + 1 ) ; tmp ++ ; } System . out . printl...
[ "N = int ( input ( ) ) NEW_LINE print ( int ( N ** .5 ) ** 2 ) NEW_LINE", "N = int ( input ( ) . strip ( ) ) NEW_LINE for i in range ( N , 0 , - 1 ) : NEW_LINE INDENT kai = int ( pow ( i , 0.5 ) ) NEW_LINE if i == kai * kai : NEW_LINE INDENT print ( i ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT", "from sys impor...
atcoder_abc078_B
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; int Z = sc . nextInt ( ) ; sc . close ( ) ; X = X - Z ; int ans = 0 ; while ( X >= 0 ) { X = X - ( Y + Z...
[ "x , y , z = [ int ( s ) for s in input ( ) . split ( ) ] NEW_LINE num = ( x - z ) // ( z + y ) NEW_LINE print ( num ) NEW_LINE", "X , Y , Z = map ( int , input ( ) . split ( ) ) NEW_LINE ans = 0 NEW_LINE width_sum = 0 NEW_LINE while 1 : NEW_LINE INDENT if width_sum + Y + Z <= X - Z : NEW_LINE INDENT width_sum +=...
atcoder_abc041_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 [ ] x = new int [ M ] ; int [ ] y = new int [ M ] ; ArrayList [ ] edge = new ArrayList [ N ] ; for ( int i = 0 ; i < N ; i ...
[ "def running ( N : int , M : int , queries : list ) -> int : NEW_LINE INDENT PHI = 0 NEW_LINE g = [ [ 0 ] * N for _ in range ( N ) ] NEW_LINE for u , v in queries : NEW_LINE INDENT g [ u - 1 ] [ v - 1 ] = 1 NEW_LINE g [ v - 1 ] [ u - 1 ] = - 1 NEW_LINE DEDENT dp = [ 0 for _ in range ( 1 << N ) ] NEW_LINE dp [ PHI ]...
atcoder_arc075_D
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int D = sc . nextInt ( ) ; System . out . println ( solve ( D ) ) ; sc . close ( ) ; } static final int MAXL = 17 ; static int N ; static long [ ] v ; static long solve ( int D ) { ...
[ "def solve ( d , K ) : NEW_LINE INDENT r = 1 NEW_LINE for k in range ( K , 1 , - 2 ) : NEW_LINE INDENT if d >= 10 ** k : NEW_LINE INDENT return 0 NEW_LINE DEDENT t = ( - d ) % 10 NEW_LINE d = abs ( ( d - t * ( 10 ** ( k - 1 ) - 1 ) ) // 10 ) NEW_LINE r *= 10 - t - ( K == k ) NEW_LINE DEDENT return r * ( 10 ** ( K %...
atcoder_arc083_A
[ "import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { static IntStream REPS ( int v ) { return IntStream . range ( 0 , v ) ; } static IntStream REPS ( int l , int r ) { return IntStream . rangeClosed ( l , r ) ; } static IntStream INS ( int n ) { return REPS ( n ) . map ( i -...
[ "A , B , C , D , E , F = map ( int , input ( ) . split ( ) ) NEW_LINE ans = 100 * A , 0 NEW_LINE w = set ( ) NEW_LINE for a in range ( 0 , F + 1 , 100 * A ) : NEW_LINE INDENT for b in range ( 0 , F - a + 1 , 100 * B ) : NEW_LINE INDENT if a + b : NEW_LINE INDENT w . add ( a + b ) NEW_LINE DEDENT DEDENT DEDENT s = s...
atcoder_abc035_C
[ "import java . math . BigDecimal ; import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; int [ ] stones = new int [ N + 1 ] ; for ( int i = 0 ; i < Q ; i ++ ) { int start = sc...
[ "import math NEW_LINE import numpy as np NEW_LINE import copy NEW_LINE from collections import defaultdict , Counter NEW_LINE from itertools import product NEW_LINE from bisect import bisect_left , bisect_right NEW_LINE def s_inpl ( ) : return map ( int , input ( ) . split ( ) ) NEW_LINE def inpl ( ) : return list ...
atcoder_abc115_B
[ "import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int p = sc . nextInt ( ) ; max = Math . max ( max , ...
[ "N = int ( input ( ) ) NEW_LINE P = [ int ( input ( ) ) for i in range ( N ) ] NEW_LINE M = int ( max ( P ) ) NEW_LINE print ( int ( sum ( P ) - M + M / 2 ) ) NEW_LINE", "import sys NEW_LINE INF = float ( \" inf \" ) NEW_LINE def solve ( N : int , p : \" List [ int ] \" ) : NEW_LINE INDENT print ( sum ( p ) - max...
atcoder_arc049_B
[ "import java . math . BigInteger ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { class Person { double x ; double y ; double c ; Person ( double x , double y , double c ) { super ( ) ; this . x = x ; this . y = y ; this . c = c ; } } t...
[ "import math , string , itertools , fractions , heapq , collections , re , array , bisect , sys , random , time , copy , functools NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE inf = 10 ** 20 NEW_LINE mod = 10 ** 9 + 7 NEW_LINE def LI ( ) : return [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ...
atcoder_abc103_C
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; int [ ] a = new int [ N ] ; int ans = 0 ; int [ ] M = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { ans += reader . nextInt ( ) - 1 ; }...
[ "import sys NEW_LINE import itertools NEW_LINE import collections NEW_LINE import functools NEW_LINE import math NEW_LINE from queue import Queue NEW_LINE INF = float ( \" inf \" ) NEW_LINE def solve ( N : int , a : \" List [ int ] \" ) : NEW_LINE INDENT print ( sum ( [ v - 1 for v in a ] ) ) NEW_LINE return NEW_LI...
atcoder_arc075_A
[ "import java . io . * ; import java . util . * ; public class Main implements Runnable { private void solve ( ) throws IOException { int N = nextInt ( ) ; int [ ] arr = new int [ N ] ; for ( int i = 0 ; i < N ; ++ i ) arr [ i ] = nextInt ( ) ; Arrays . sort ( arr ) ; int s = 0 ; for ( int i : arr ) s += i ; if ( s ...
[ "def getInt ( ) : return int ( input ( ) ) NEW_LINE def getIntLines ( n ) : return [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE def zeros ( n ) : return [ 0 ] * n NEW_LINE def genBits ( n ) : NEW_LINE INDENT bits = zeros ( n ) NEW_LINE for i in range ( 2 ** n ) : NEW_LINE INDENT for k in range ( n ) : NEW_LI...
atcoder_agc029_A
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; long Bcnt = 0 ; long cnt = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == ' W ' ) cnt += Bcnt ; if ( s [ i ] ==...
[ "S = input ( ) NEW_LINE b = 0 NEW_LINE ans = 0 NEW_LINE for c in S : NEW_LINE INDENT if c == ' B ' : NEW_LINE INDENT b += 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans += b NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE", "import numpy as np NEW_LINE s = np . array ( list ( input ( ) ) ) NEW_LINE ind = np . array (...
atcoder_abc056_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int W = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans ; if ( a < b ) { ans = b - a - W ; } else { ans = a - b - W ; } System . ou...
[ "W , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE ans = 0 NEW_LINE if a + W < b : NEW_LINE INDENT ans = b - a - W NEW_LINE DEDENT elif b + W < a : NEW_LINE INDENT ans = a - b - W NEW_LINE DEDENT else : NEW_LINE INDENT ans = 0 NEW_LINE DEDENT print ( ans ) NEW_LINE", "import sys NEW_LINE def main ( ) : NEW...
atcoder_arc009_B
[ "import java . util . * ; public class Main { int [ ] numbers = new int [ 10 ] ; int [ ] invers = new int [ 10 ] ; Scanner sc ; void run ( ) { this . initialize ( ) ; int N = sc . nextInt ( ) ; ArrayList < Integer > convertedNum = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { convertedNum . add ( this ...
[ "d = { } NEW_LINE B = input ( ) . split ( ) NEW_LINE for i in range ( 10 ) : NEW_LINE INDENT d [ B [ i ] ] = str ( i ) NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE a = [ ] NEW_LINE for _ in range ( N ) : NEW_LINE INDENT t = input ( ) NEW_LINE u = ' ' NEW_LINE for i in t : NEW_LINE INDENT u += d [ i ] NEW_LINE DED...
atcoder_arc010_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int [ ] c = new int [ M + 1 ] ; for ( int i = 1 ...
[ "n , m , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE cnt = 0 NEW_LINE for i in range ( m ) : NEW_LINE INDENT if n <= a : NEW_LINE INDENT n += b NEW_LINE DEDENT cnt += 1 NEW_LINE c = int ( input ( ) ) NEW_LINE n -= c NEW_LINE if n < 0 : NEW_LINE INDENT print ( cnt ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT ...
atcoder_abc016_D
[ "import java . util . * ; class Main { static final double E = 1.0e-9 ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double ax = scan . nextDouble ( ) ; double ay = scan . nextDouble ( ) ; double dx = scan . nextDouble ( ) - ax ; double dy = scan . nextDouble ( ) - ay ;...
[ "Ax , Ay , Bx , By = map ( int , input ( ) . split ( ) ) NEW_LINE N = int ( input ( ) ) NEW_LINE num = 0 NEW_LINE def calc ( x0 , y0 , x1 , y1 , x2 , y2 , x3 , y3 ) : NEW_LINE INDENT P0 = ( x0 - x1 ) * ( y2 - y0 ) + ( y0 - y1 ) * ( x0 - x2 ) NEW_LINE Q0 = ( x0 - x1 ) * ( y3 - y0 ) + ( y0 - y1 ) * ( x0 - x3 ) NEW_LI...
atcoder_arc041_C
[ "import java . util . * ; class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; ArrayDeque < Integer > rq = new ArrayDeque < Integer > ( ) ; ArrayDeque < Integer > lq = new ArrayDeque < Integer > (...
[ "def solve ( n , l , lst ) : NEW_LINE INDENT ans = 0 NEW_LINE np = 1 NEW_LINE while len ( lst ) : NEW_LINE INDENT x , d = lst [ 0 ] NEW_LINE if d == 0 : NEW_LINE INDENT ans += x - np NEW_LINE np += 1 NEW_LINE lst . pop ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT np = l NEW_LINE while l...
atcoder_agc013_C
[ "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 ( ) , l = sc . nextInt ( ) , t = sc . nextInt ( ) ; int temp , cnt = 0 , d ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i...
[ "N , L , T = map ( int , input ( ) . split ( ) ) NEW_LINE ants = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT x , w = map ( int , input ( ) . split ( ) ) NEW_LINE ants . append ( ( x , w ) ) NEW_LINE DEDENT ants2 = [ ] NEW_LINE for ant in ants : NEW_LINE INDENT ants2 . append ( ( ant [ 0 ] + T * ( 3 - 2 * an...
atcoder_abc110_B
[ "import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) , m = sc . nextInt ( ) , x = sc . nextInt ( ) , y = sc . nextInt ( ) ; int max = x , min = y ; for ( int i = 0 ; i < n ; i ++ ) { max =...
[ "n , m , X , Y = map ( int , input ( ) . split ( ) ) NEW_LINE x = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE y = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE x . append ( X ) NEW_LINE y . append ( Y ) NEW_LINE if max ( x ) < min ( y ) : NEW_LINE INDENT print ( ' No ▁ War ' ) NEW_LINE DEDENT else...
atcoder_abc111_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N % 111 == 0 ) { System . out . println ( N ) ; } else { int a = N / 111 + 1 ; System . out . println ( a * 100 + a * 10 + a ) ; } } }", "import ja...
[ "n = int ( input ( ) ) NEW_LINE num = [ 111 , 222 , 333 , 444 , 555 , 666 , 777 , 888 , 999 ] NEW_LINE min_ = 111 NEW_LINE ans = 0 NEW_LINE for i in num : NEW_LINE INDENT if i - n < 0 : NEW_LINE INDENT None NEW_LINE DEDENT else : NEW_LINE INDENT if min_ > i - n : NEW_LINE INDENT ans = i NEW_LINE DEDENT DEDENT DEDEN...
atcoder_arc051_A
[ "import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x1 = sc . nextInt ( ) ; int y1 = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int x2 = sc . nextInt ( ) ; int y2 = sc . nextInt ( ) ; int x3 = sc . nextInt ( ) ; int y3 =...
[ "import math NEW_LINE def caldistance ( x , y , s , t ) : NEW_LINE INDENT return math . sqrt ( ( x - s ) ** 2 + ( y - t ) ** 2 ) NEW_LINE DEDENT x1 , y1 , r = map ( int , input ( ) . split ( ) ) NEW_LINE x2 , y2 , x3 , y3 = map ( int , input ( ) . split ( ) ) NEW_LINE if x2 <= x1 - r and x3 >= x1 + r and y2 <= y1 -...
atcoder_agc004_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 ) { long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = sc . nextLong ( ) ; if ( a % 2 == 0 ...
[ "l = sorted ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( l [ 0 ] * l [ 1 ] * ( l [ 2 ] % 2 ) ) NEW_LINE", "a , b , c = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE one = abs ( ( a // 2 ) * b * c - ( a - a // 2 ) * b * c ) NEW_LINE two = abs ( a * ( b // 2 ) * c - a * ( b - b // 2 ) * c ) NEW_...
atcoder_agc002_E
[ "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 ( ) ; if ( firstWin ( N , a ) ) System . out . println ( \" First \" )...
[ "import math , string , itertools , fractions , heapq , collections , re , array , bisect , sys , random , time NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE inf = 10 ** 10 NEW_LINE mod = 10 ** 9 + 7 NEW_LINE def f ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split...
atcoder_arc060_A
[ "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 ( ) ; int a = sc . nextInt ( ) ; int [ ] num = new int [ n + 1 ] ; long ans = 0 ; long [ ] [ ] [ ] dp = new long [ n ...
[ "import array NEW_LINE from bisect import * NEW_LINE from collections import * NEW_LINE import fractions NEW_LINE import heapq NEW_LINE from itertools import * NEW_LINE import math NEW_LINE import random NEW_LINE import re NEW_LINE import string NEW_LINE import sys NEW_LINE N , A = map ( int , input ( ) . split ( )...
atcoder_abc114_B
[ "import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; String S = reader . next ( ) ; int [ ] X = new int [ 10 ] ; for ( int k = 0 ; k < S . length ( ) ; k ++ ) { X [ k ] = Integer . parseInt ( Ch...
[ "n = input ( ) NEW_LINE a = [ ] NEW_LINE for i in range ( len ( n ) - 2 ) : NEW_LINE INDENT a . append ( abs ( int ( n [ i : i + 3 ] ) - 753 ) ) NEW_LINE DEDENT print ( min ( a ) ) NEW_LINE", "import sys NEW_LINE INF = float ( \" inf \" ) NEW_LINE def solve ( S : int ) : NEW_LINE INDENT S = str ( S ) NEW_LINE pri...
atcoder_arc009_A
[ "import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int number = Integer . parseInt ( br . ...
[ "print ( eval ( \" + eval ( input ( ) . replace ( ' ▁ ' , ' * ' ) ) \" * int ( input ( ) ) ) * 105 // 100 ) NEW_LINE", "import sys NEW_LINE import copy NEW_LINE sys . setrecursionlimit ( 1000000 ) NEW_LINE N = int ( input ( ) ) NEW_LINE a = [ 0 ] * N NEW_LINE b = [ 0 ] * N NEW_LINE for i in range ( N ) : NEW_LINE...
atcoder_abc113_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 t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; double minSub = 1000.0 ; int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int h = sc . nextIn...
[ "N = int ( input ( ) ) NEW_LINE T , A = map ( int , input ( ) . split ( ) ) NEW_LINE H = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE d = 10 ** 4 NEW_LINE n = 0 NEW_LINE for j in range ( N ) : NEW_LINE INDENT dj = abs ( A - ( T - H [ j ] * 0.006 ) ) NEW_LINE if dj < d : NEW_LINE INDENT d = dj NEW_LINE n = ...
atcoder_abc025_B
[ "import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int now = 0 ; for ( int i = 0 ; i < N ; i ++ ) { String a = sc . next ( ) ; int id = sc . nextInt...
[ "N , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE now = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT s , d = input ( ) . split ( ) NEW_LINE if s == \" East \" : NEW_LINE INDENT if int ( d ) < A : NEW_LINE INDENT now += A NEW_LINE DEDENT elif int ( d ) > B : NEW_LINE INDENT now += B NEW_LINE DEDENT else...
atcoder_abc067_B
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] l = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { l [ i ] = sc . nextInt ( ) ; } Arrays . sort ( l ) ; int sum = 0...
[ "t , l = open ( 0 ) ; print ( sum ( sorted ( map ( int , l . split ( ) ) ) [ - int ( t [ 2 : ] ) : ] ) ) 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 . readline ( ) . split ( ) ) NEW_LINE ...
atcoder_arc062_A
[ "import java . math . * ; import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] rate = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; ++ i ) { rate [ i ] [ 0 ] = sc . nextIn...
[ "N = int ( input ( ) ) NEW_LINE P = [ list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) for i in range ( N ) ] NEW_LINE T = [ P [ i ] [ 0 ] for i in range ( N ) ] NEW_LINE A = [ P [ i ] [ 1 ] for i in range ( N ) ] NEW_LINE t = T [ 0 ] NEW_LINE a = A [ 0 ] NEW_LINE k = 1 NEW_LINE for i in range ( 1 , N ) : NEW_LIN...
atcoder_abc026_B
[ "import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] r = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { r [ i ] = sc . nextInt ( ) ; } Arrays . sort ( r ) ; long R = ...
[ "from math import pi NEW_LINE N = int ( input ( ) ) NEW_LINE r = sorted ( [ int ( input ( ) ) for _ in range ( N ) ] , reverse = True ) NEW_LINE ans = 0 NEW_LINE for i , n in enumerate ( r ) : NEW_LINE INDENT if i % 2 == 0 : NEW_LINE INDENT ans += n ** 2 * pi NEW_LINE DEDENT else : NEW_LINE INDENT ans -= n ** 2 * p...
atcoder_abc049_A
[ "import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( sc . next ( ) . matches ( \" [ aiueo ] \" ) ? \" vowel \" : \" consonant \" ) ; } }", "import java . io . IOException ; import java . io . InputStream ; i...
[ "c = str ( input ( ) ) NEW_LINE L = [ \" a \" , \" i \" , \" u \" , \" e \" , \" o \" ] NEW_LINE if c in L : NEW_LINE INDENT print ( \" vowel \" ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( \" consonant \" ) NEW_LINE DEDENT", "import sys , re NEW_LINE from collections import deque , defaultdict , Counter NEW_...
atcoder_abc086_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 ( ) ; sc . close ( ) ; String ab = a + b ; int value = Integer . parseInt ( ab ) ; String ans = \" No \" ; for ( int i = 4 ; i ...
[ "heihousuu = [ i * i for i in range ( int ( 100100 ** 0.5 ) ) ] NEW_LINE a , b = input ( ) . split ( ) NEW_LINE ab = int ( a + b ) NEW_LINE print ( ' Yes ' if ab in heihousuu else ' No ' ) NEW_LINE", "a , b = input ( ) . split ( ) NEW_LINE c = int ( a + b ) NEW_LINE def try_square_root_naive ( n ) : NEW_LINE INDE...