id stringlengths 2 6 | java stringlengths 48 5.92k | python stringlengths 33 11.1k |
|---|---|---|
T200 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; long res = 0 ; for ( int i = 1 ; i <= n ; i ++ ) res += i ; System .... | N = int ( input ( ) ) NEW_LINE print ( int ( ( 1 + N ) * N / 2 ) ) NEW_LINE
|
T201 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; long res = 0 ; for ( int i = 1 ; i <= n ; i ++ ) res += i ; System .... | 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 ( ans ) NEW_LINE DEDENT
|
T202 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; long res = 0 ; for ( int i = 1 ; i <= n ; i ++ ) res += i ; System .... | from sys import stdin NEW_LINE n = int ( stdin . readline ( ) . rstrip ( ) ) NEW_LINE total = 0 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT total += i NEW_LINE DEDENT print ( total ) NEW_LINE
|
T203 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; long res = 0 ; for ( int i = 1 ; i <= n ; i ++ ) res += i ; System .... | print ( sum ( [ n for n in range ( 1 , int ( input ( ) ) + 1 ) ] ) ) NEW_LINE
|
T204 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; long res = 0 ; for ( int i = 1 ; i <= n ; i ++ ) res += i ; System .... | n = input ( ) NEW_LINE n = int ( n ) NEW_LINE a = 0 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT a = a + i NEW_LINE DEDENT print ( a ) NEW_LINE
|
T205 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; System . out . println ( n * ( n + 1 ) / 2 ) ; } } }
| N = int ( input ( ) ) NEW_LINE print ( int ( ( 1 + N ) * N / 2 ) ) NEW_LINE
|
T206 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; System . out . println ( n * ( n + 1 ) / 2 ) ; } } }
| 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 ( ans ) NEW_LINE DEDENT
|
T207 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; System . out . println ( n * ( n + 1 ) / 2 ) ; } } }
| from sys import stdin NEW_LINE n = int ( stdin . readline ( ) . rstrip ( ) ) NEW_LINE total = 0 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT total += i NEW_LINE DEDENT print ( total ) NEW_LINE
|
T208 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; System . out . println ( n * ( n + 1 ) / 2 ) ; } } }
| print ( sum ( [ n for n in range ( 1 , int ( input ( ) ) + 1 ) ] ) ) NEW_LINE
|
T209 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; System . out . println ( n * ( n + 1 ) / 2 ) ; } } }
| n = input ( ) NEW_LINE n = int ( n ) NEW_LINE a = 0 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT a = a + i NEW_LINE DEDENT print ( a ) NEW_LINE
|
T210 | 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 [ p ... | 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 += 1... |
T211 | 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 [ p ... | import bisect NEW_LINE from math import factorial as fact NEW_LINE import sys NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE prime = [ ] NEW_LINE p_flag = [ False ] * ( 101 ) NEW_LINE p_flag [ 0 ] = p_flag [ 1 ] = True NEW_LINE for i in range ( 2 , 101 ) : NEW_LINE INDENT if not p_flag ... |
T212 | 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 [ p ... | primes = [ 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 ] NEW_LINE def get_prime ( n , count = { p : 0 for p in primes } ) : NEW_LINE INDENT for p in primes : NEW_LINE INDENT cp = n NEW_LINE while cp != 0 and cp % p == 0 : NEW_LINE INDENT count [... |
T213 | 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 [ p ... | import sys NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE INF = 10 ** 18 NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def POW ( x , y ) : NEW_LINE INDENT if y == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT elif y == 1 : NEW_LINE INDENT return x NEW_LINE DEDENT elif y % 2 == 0 : NEW_LINE INDENT return POW ( x , y // 2 ) ... |
T214 | 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 [ p ... | import itertools NEW_LINE from operator import mul NEW_LINE from functools import reduce NEW_LINE N = int ( input ( ) ) NEW_LINE F = 1 NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT F = F * i NEW_LINE DEDENT pns = [ ] NEW_LINE for n in range ( 2 , N + 1 ) : NEW_LINE INDENT for pn in pns : NEW_LINE INDENT if n ... |
T215 | import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashMap ; @ SuppressWarnings ( " unchecked " ) public class Main { static HashMap < Integer , Integer > pf ; static void primeFa... | 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 += 1... |
T216 | import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashMap ; @ SuppressWarnings ( " unchecked " ) public class Main { static HashMap < Integer , Integer > pf ; static void primeFa... | import bisect NEW_LINE from math import factorial as fact NEW_LINE import sys NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE prime = [ ] NEW_LINE p_flag = [ False ] * ( 101 ) NEW_LINE p_flag [ 0 ] = p_flag [ 1 ] = True NEW_LINE for i in range ( 2 , 101 ) : NEW_LINE INDENT if not p_flag ... |
T217 | import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashMap ; @ SuppressWarnings ( " unchecked " ) public class Main { static HashMap < Integer , Integer > pf ; static void primeFa... | primes = [ 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 ] NEW_LINE def get_prime ( n , count = { p : 0 for p in primes } ) : NEW_LINE INDENT for p in primes : NEW_LINE INDENT cp = n NEW_LINE while cp != 0 and cp % p == 0 : NEW_LINE INDENT count [... |
T218 | import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashMap ; @ SuppressWarnings ( " unchecked " ) public class Main { static HashMap < Integer , Integer > pf ; static void primeFa... | import sys NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE INF = 10 ** 18 NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def POW ( x , y ) : NEW_LINE INDENT if y == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT elif y == 1 : NEW_LINE INDENT return x NEW_LINE DEDENT elif y % 2 == 0 : NEW_LINE INDENT return POW ( x , y // 2 ) ... |
T219 | import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashMap ; @ SuppressWarnings ( " unchecked " ) public class Main { static HashMap < Integer , Integer > pf ; static void primeFa... | import itertools NEW_LINE from operator import mul NEW_LINE from functools import reduce NEW_LINE N = int ( input ( ) ) NEW_LINE F = 1 NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT F = F * i NEW_LINE DEDENT pns = [ ] NEW_LINE for n in range ( 2 , N + 1 ) : NEW_LINE INDENT for pn in pns : NEW_LINE INDENT if n ... |
T220 | import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashMap < Integer , Integer > primeCount = new HashMap < > ( ) ; primeCount . put ( 1 , 1 ) ; for ( int i = 2 ; i <= N ; i ++ ) { int value = i ; for ( int j = 2 ; j ... | 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 += 1... |
T221 | import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashMap < Integer , Integer > primeCount = new HashMap < > ( ) ; primeCount . put ( 1 , 1 ) ; for ( int i = 2 ; i <= N ; i ++ ) { int value = i ; for ( int j = 2 ; j ... | import bisect NEW_LINE from math import factorial as fact NEW_LINE import sys NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE prime = [ ] NEW_LINE p_flag = [ False ] * ( 101 ) NEW_LINE p_flag [ 0 ] = p_flag [ 1 ] = True NEW_LINE for i in range ( 2 , 101 ) : NEW_LINE INDENT if not p_flag ... |
T222 | import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashMap < Integer , Integer > primeCount = new HashMap < > ( ) ; primeCount . put ( 1 , 1 ) ; for ( int i = 2 ; i <= N ; i ++ ) { int value = i ; for ( int j = 2 ; j ... | primes = [ 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 ] NEW_LINE def get_prime ( n , count = { p : 0 for p in primes } ) : NEW_LINE INDENT for p in primes : NEW_LINE INDENT cp = n NEW_LINE while cp != 0 and cp % p == 0 : NEW_LINE INDENT count [... |
T223 | import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashMap < Integer , Integer > primeCount = new HashMap < > ( ) ; primeCount . put ( 1 , 1 ) ; for ( int i = 2 ; i <= N ; i ++ ) { int value = i ; for ( int j = 2 ; j ... | import sys NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE INF = 10 ** 18 NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def POW ( x , y ) : NEW_LINE INDENT if y == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT elif y == 1 : NEW_LINE INDENT return x NEW_LINE DEDENT elif y % 2 == 0 : NEW_LINE INDENT return POW ( x , y // 2 ) ... |
T224 | import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashMap < Integer , Integer > primeCount = new HashMap < > ( ) ; primeCount . put ( 1 , 1 ) ; for ( int i = 2 ; i <= N ; i ++ ) { int value = i ; for ( int j = 2 ; j ... | import itertools NEW_LINE from operator import mul NEW_LINE from functools import reduce NEW_LINE N = int ( input ( ) ) NEW_LINE F = 1 NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT F = F * i NEW_LINE DEDENT pns = [ ] NEW_LINE for n in range ( 2 , N + 1 ) : NEW_LINE INDENT for pn in pns : NEW_LINE INDENT if n ... |
T225 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . close ( ) ; int [ ] P = new int [ 48 ] ; int over74 = 0 ; int over24 = 0 ; int over14 = 0 ; int over4 = 0 ; int over2 = 0 ; for ( int i = 2 ; i <= N... | 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 += 1... |
T226 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . close ( ) ; int [ ] P = new int [ 48 ] ; int over74 = 0 ; int over24 = 0 ; int over14 = 0 ; int over4 = 0 ; int over2 = 0 ; for ( int i = 2 ; i <= N... | import bisect NEW_LINE from math import factorial as fact NEW_LINE import sys NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE prime = [ ] NEW_LINE p_flag = [ False ] * ( 101 ) NEW_LINE p_flag [ 0 ] = p_flag [ 1 ] = True NEW_LINE for i in range ( 2 , 101 ) : NEW_LINE INDENT if not p_flag ... |
T227 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . close ( ) ; int [ ] P = new int [ 48 ] ; int over74 = 0 ; int over24 = 0 ; int over14 = 0 ; int over4 = 0 ; int over2 = 0 ; for ( int i = 2 ; i <= N... | primes = [ 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 ] NEW_LINE def get_prime ( n , count = { p : 0 for p in primes } ) : NEW_LINE INDENT for p in primes : NEW_LINE INDENT cp = n NEW_LINE while cp != 0 and cp % p == 0 : NEW_LINE INDENT count [... |
T228 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . close ( ) ; int [ ] P = new int [ 48 ] ; int over74 = 0 ; int over24 = 0 ; int over14 = 0 ; int over4 = 0 ; int over2 = 0 ; for ( int i = 2 ; i <= N... | import sys NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE INF = 10 ** 18 NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def POW ( x , y ) : NEW_LINE INDENT if y == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT elif y == 1 : NEW_LINE INDENT return x NEW_LINE DEDENT elif y % 2 == 0 : NEW_LINE INDENT return POW ( x , y // 2 ) ... |
T229 | import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . close ( ) ; int [ ] P = new int [ 48 ] ; int over74 = 0 ; int over24 = 0 ; int over14 = 0 ; int over4 = 0 ; int over2 = 0 ; for ( int i = 2 ; i <= N... | import itertools NEW_LINE from operator import mul NEW_LINE from functools import reduce NEW_LINE N = int ( input ( ) ) NEW_LINE F = 1 NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT F = F * i NEW_LINE DEDENT pns = [ ] NEW_LINE for n in range ( 2 , N + 1 ) : NEW_LINE INDENT for pn in pns : NEW_LINE INDENT if n ... |
T230 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean [ ] pr = new boolean [ N + 1 ] ; int count = 0 ; for ( int i = 2 ; i < N + 1 ; i ++ ) pr [ i ] = true ; for ( int i = 2 ; i < N + 1 ; i ++ ) { if ( pr ... | 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 += 1... |
T231 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean [ ] pr = new boolean [ N + 1 ] ; int count = 0 ; for ( int i = 2 ; i < N + 1 ; i ++ ) pr [ i ] = true ; for ( int i = 2 ; i < N + 1 ; i ++ ) { if ( pr ... | import bisect NEW_LINE from math import factorial as fact NEW_LINE import sys NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE prime = [ ] NEW_LINE p_flag = [ False ] * ( 101 ) NEW_LINE p_flag [ 0 ] = p_flag [ 1 ] = True NEW_LINE for i in range ( 2 , 101 ) : NEW_LINE INDENT if not p_flag ... |
T232 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean [ ] pr = new boolean [ N + 1 ] ; int count = 0 ; for ( int i = 2 ; i < N + 1 ; i ++ ) pr [ i ] = true ; for ( int i = 2 ; i < N + 1 ; i ++ ) { if ( pr ... | primes = [ 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 ] NEW_LINE def get_prime ( n , count = { p : 0 for p in primes } ) : NEW_LINE INDENT for p in primes : NEW_LINE INDENT cp = n NEW_LINE while cp != 0 and cp % p == 0 : NEW_LINE INDENT count [... |
T233 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean [ ] pr = new boolean [ N + 1 ] ; int count = 0 ; for ( int i = 2 ; i < N + 1 ; i ++ ) pr [ i ] = true ; for ( int i = 2 ; i < N + 1 ; i ++ ) { if ( pr ... | import sys NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE INF = 10 ** 18 NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def POW ( x , y ) : NEW_LINE INDENT if y == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT elif y == 1 : NEW_LINE INDENT return x NEW_LINE DEDENT elif y % 2 == 0 : NEW_LINE INDENT return POW ( x , y // 2 ) ... |
T234 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean [ ] pr = new boolean [ N + 1 ] ; int count = 0 ; for ( int i = 2 ; i < N + 1 ; i ++ ) pr [ i ] = true ; for ( int i = 2 ; i < N + 1 ; i ++ ) { if ( pr ... | import itertools NEW_LINE from operator import mul NEW_LINE from functools import reduce NEW_LINE N = int ( input ( ) ) NEW_LINE F = 1 NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT F = F * i NEW_LINE DEDENT pns = [ ] NEW_LINE for n in range ( 2 , N + 1 ) : NEW_LINE INDENT for pn in pns : NEW_LINE INDENT if n ... |
T235 | 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 ans = m... |
T236 | 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 ( ) ... | n = int ( input ( ) ) ; a = list ( map ( int , input ( ) . split ( ) ) ) ; b = [ 0 ] NEW_LINE for i in a : b . append ( b [ - 1 ] + i ) NEW_LINE b = b [ 1 : ] ; s = b [ - 1 ] ; mi = abs ( b [ 0 ] - ( b [ - 1 ] - b [ 0 ] ) ) NEW_LINE for i in range ( n - 1 ) : mi = min ( abs ( b [ i ] - ( b [ - 1 ] - b [ i ] ) ) , mi ) ... |
T237 | 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 ( ) ... | from numpy import * ; n , * a = map ( int , open ( 0 ) . read ( ) . split ( ) ) ; print ( min ( abs ( cumsum ( a [ : : - 1 ] ) [ : : - 1 ] - cumsum ( [ 0 ] + a [ : - 1 ] ) ) [ 1 : ] ) ) NEW_LINE
|
T238 | 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 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 getIntLines ( n ) : return [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE def getIntMat ( n ) : NEW_LINE INDENT mat = [ ] NEW_LINE for... |
T239 | 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 ( ) ... | from itertools import accumulate NEW_LINE N = int ( input ( ) ) NEW_LINE card = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE acc = list ( accumulate ( card ) ) NEW_LINE s = acc [ - 1 ] NEW_LINE ans = float ( ' inf ' ) NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT t = acc [ i ] NEW_LINE a = s - t NEW_LINE... |
T240 | import java . util . * ; public class Main { private static long solve ( Scanner scanner ) { int N = Integer . parseInt ( scanner . nextLine ( ) ) ; long [ ] a = lineToNums ( scanner . nextLine ( ) ) ; long sumAll = Arrays . stream ( a ) . sum ( ) ; long [ ] xSum = new long [ N ] ; long [ ] ySum = new long [ N ] ; xSum... | 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 ans = m... |
T241 | import java . util . * ; public class Main { private static long solve ( Scanner scanner ) { int N = Integer . parseInt ( scanner . nextLine ( ) ) ; long [ ] a = lineToNums ( scanner . nextLine ( ) ) ; long sumAll = Arrays . stream ( a ) . sum ( ) ; long [ ] xSum = new long [ N ] ; long [ ] ySum = new long [ N ] ; xSum... | n = int ( input ( ) ) ; a = list ( map ( int , input ( ) . split ( ) ) ) ; b = [ 0 ] NEW_LINE for i in a : b . append ( b [ - 1 ] + i ) NEW_LINE b = b [ 1 : ] ; s = b [ - 1 ] ; mi = abs ( b [ 0 ] - ( b [ - 1 ] - b [ 0 ] ) ) NEW_LINE for i in range ( n - 1 ) : mi = min ( abs ( b [ i ] - ( b [ - 1 ] - b [ i ] ) ) , mi ) ... |
T242 | import java . util . * ; public class Main { private static long solve ( Scanner scanner ) { int N = Integer . parseInt ( scanner . nextLine ( ) ) ; long [ ] a = lineToNums ( scanner . nextLine ( ) ) ; long sumAll = Arrays . stream ( a ) . sum ( ) ; long [ ] xSum = new long [ N ] ; long [ ] ySum = new long [ N ] ; xSum... | from numpy import * ; n , * a = map ( int , open ( 0 ) . read ( ) . split ( ) ) ; print ( min ( abs ( cumsum ( a [ : : - 1 ] ) [ : : - 1 ] - cumsum ( [ 0 ] + a [ : - 1 ] ) ) [ 1 : ] ) ) NEW_LINE
|
T243 | import java . util . * ; public class Main { private static long solve ( Scanner scanner ) { int N = Integer . parseInt ( scanner . nextLine ( ) ) ; long [ ] a = lineToNums ( scanner . nextLine ( ) ) ; long sumAll = Arrays . stream ( a ) . sum ( ) ; long [ ] xSum = new long [ N ] ; long [ ] ySum = new long [ N ] ; xSum... | 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 getIntLines ( n ) : return [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE def getIntMat ( n ) : NEW_LINE INDENT mat = [ ] NEW_LINE for... |
T244 | import java . util . * ; public class Main { private static long solve ( Scanner scanner ) { int N = Integer . parseInt ( scanner . nextLine ( ) ) ; long [ ] a = lineToNums ( scanner . nextLine ( ) ) ; long sumAll = Arrays . stream ( a ) . sum ( ) ; long [ ] xSum = new long [ N ] ; long [ ] ySum = new long [ N ] ; xSum... | from itertools import accumulate NEW_LINE N = int ( input ( ) ) NEW_LINE card = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE acc = list ( accumulate ( card ) ) NEW_LINE s = acc [ - 1 ] NEW_LINE ans = float ( ' inf ' ) NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT t = acc [ i ] NEW_LINE a = s - t NEW_LINE... |
T245 | import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String c = stdReader . readLine ( ) ; String vals = stdReader . readLine ( ) ; long [ ] ls = new long [ Integer . valueOf ( ... | 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 ans = m... |
T246 | import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String c = stdReader . readLine ( ) ; String vals = stdReader . readLine ( ) ; long [ ] ls = new long [ Integer . valueOf ( ... | n = int ( input ( ) ) ; a = list ( map ( int , input ( ) . split ( ) ) ) ; b = [ 0 ] NEW_LINE for i in a : b . append ( b [ - 1 ] + i ) NEW_LINE b = b [ 1 : ] ; s = b [ - 1 ] ; mi = abs ( b [ 0 ] - ( b [ - 1 ] - b [ 0 ] ) ) NEW_LINE for i in range ( n - 1 ) : mi = min ( abs ( b [ i ] - ( b [ - 1 ] - b [ i ] ) ) , mi ) ... |
T247 | import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String c = stdReader . readLine ( ) ; String vals = stdReader . readLine ( ) ; long [ ] ls = new long [ Integer . valueOf ( ... | from numpy import * ; n , * a = map ( int , open ( 0 ) . read ( ) . split ( ) ) ; print ( min ( abs ( cumsum ( a [ : : - 1 ] ) [ : : - 1 ] - cumsum ( [ 0 ] + a [ : - 1 ] ) ) [ 1 : ] ) ) NEW_LINE
|
T248 | import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String c = stdReader . readLine ( ) ; String vals = stdReader . readLine ( ) ; long [ ] ls = new long [ Integer . valueOf ( ... | 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 getIntLines ( n ) : return [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE def getIntMat ( n ) : NEW_LINE INDENT mat = [ ] NEW_LINE for... |
T249 | import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String c = stdReader . readLine ( ) ; String vals = stdReader . readLine ( ) ; long [ ] ls = new long [ Integer . valueOf ( ... | from itertools import accumulate NEW_LINE N = int ( input ( ) ) NEW_LINE card = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE acc = list ( accumulate ( card ) ) NEW_LINE s = acc [ - 1 ] NEW_LINE ans = float ( ' inf ' ) NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT t = acc [ i ] NEW_LINE a = s - t NEW_LINE... |
T250 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public ... | 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 ans = m... |
T251 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public ... | n = int ( input ( ) ) ; a = list ( map ( int , input ( ) . split ( ) ) ) ; b = [ 0 ] NEW_LINE for i in a : b . append ( b [ - 1 ] + i ) NEW_LINE b = b [ 1 : ] ; s = b [ - 1 ] ; mi = abs ( b [ 0 ] - ( b [ - 1 ] - b [ 0 ] ) ) NEW_LINE for i in range ( n - 1 ) : mi = min ( abs ( b [ i ] - ( b [ - 1 ] - b [ i ] ) ) , mi ) ... |
T252 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public ... | from numpy import * ; n , * a = map ( int , open ( 0 ) . read ( ) . split ( ) ) ; print ( min ( abs ( cumsum ( a [ : : - 1 ] ) [ : : - 1 ] - cumsum ( [ 0 ] + a [ : - 1 ] ) ) [ 1 : ] ) ) NEW_LINE
|
T253 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public ... | 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 getIntLines ( n ) : return [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE def getIntMat ( n ) : NEW_LINE INDENT mat = [ ] NEW_LINE for... |
T254 | import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public ... | from itertools import accumulate NEW_LINE N = int ( input ( ) ) NEW_LINE card = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE acc = list ( accumulate ( card ) ) NEW_LINE s = acc [ - 1 ] NEW_LINE ans = float ( ' inf ' ) NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT t = acc [ i ] NEW_LINE a = s - t NEW_LINE... |
T255 | import java . util . Scanner ; public class Main { private static long x = 0 ; private static long y = 0 ; private static int N ; private static int a [ ] ; private static long ans ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; N = scan . nextInt ( ) ; a = new int [ N ] ; for ( int i = 0 ... | 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 ans = m... |
T256 | import java . util . Scanner ; public class Main { private static long x = 0 ; private static long y = 0 ; private static int N ; private static int a [ ] ; private static long ans ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; N = scan . nextInt ( ) ; a = new int [ N ] ; for ( int i = 0 ... | n = int ( input ( ) ) ; a = list ( map ( int , input ( ) . split ( ) ) ) ; b = [ 0 ] NEW_LINE for i in a : b . append ( b [ - 1 ] + i ) NEW_LINE b = b [ 1 : ] ; s = b [ - 1 ] ; mi = abs ( b [ 0 ] - ( b [ - 1 ] - b [ 0 ] ) ) NEW_LINE for i in range ( n - 1 ) : mi = min ( abs ( b [ i ] - ( b [ - 1 ] - b [ i ] ) ) , mi ) ... |
T257 | import java . util . Scanner ; public class Main { private static long x = 0 ; private static long y = 0 ; private static int N ; private static int a [ ] ; private static long ans ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; N = scan . nextInt ( ) ; a = new int [ N ] ; for ( int i = 0 ... | from numpy import * ; n , * a = map ( int , open ( 0 ) . read ( ) . split ( ) ) ; print ( min ( abs ( cumsum ( a [ : : - 1 ] ) [ : : - 1 ] - cumsum ( [ 0 ] + a [ : - 1 ] ) ) [ 1 : ] ) ) NEW_LINE
|
T258 | import java . util . Scanner ; public class Main { private static long x = 0 ; private static long y = 0 ; private static int N ; private static int a [ ] ; private static long ans ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; N = scan . nextInt ( ) ; a = new int [ N ] ; for ( int i = 0 ... | 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 getIntLines ( n ) : return [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE def getIntMat ( n ) : NEW_LINE INDENT mat = [ ] NEW_LINE for... |
T259 | import java . util . Scanner ; public class Main { private static long x = 0 ; private static long y = 0 ; private static int N ; private static int a [ ] ; private static long ans ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; N = scan . nextInt ( ) ; a = new int [ N ] ; for ( int i = 0 ... | from itertools import accumulate NEW_LINE N = int ( input ( ) ) NEW_LINE card = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE acc = list ( accumulate ( card ) ) NEW_LINE s = acc [ - 1 ] NEW_LINE ans = float ( ' inf ' ) NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT t = acc [ i ] NEW_LINE a = s - t NEW_LINE... |
T260 | 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 ( we... | 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 ) NEW... |
T261 | 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 ( we... | import sys NEW_LINE n , s , t = [ int ( i ) for i in sys . stdin . readline ( ) . rstrip ( ) . split ( ) ] NEW_LINE w = 0 NEW_LINE ans = 0 NEW_LINE for _ in range ( n ) : NEW_LINE INDENT a = int ( sys . stdin . readline ( ) . rstrip ( ) ) NEW_LINE w += a NEW_LINE if s <= w <= t : NEW_LINE INDENT ans += 1 NEW_LINE DEDEN... |
T262 | 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 ( we... | def solve ( ) : NEW_LINE INDENT n , s , t = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE w = int ( input ( ) ) NEW_LINE if s <= w and w <= t : NEW_LINE INDENT ans = 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans = 0 NEW_LINE DEDENT for i in range ( n - 1 ) : NEW_LINE INDENT a = int ( input ( ) ) NEW_LINE w += a ... |
T263 | 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 ( we... | N , S , T = map ( int , input ( ) . split ( ) ) NEW_LINE W = int ( input ( ) ) NEW_LINE if S <= W <= T : NEW_LINE INDENT daycount = 1 NEW_LINE DEDENT else : NEW_LINE INDENT daycount = 0 NEW_LINE DEDENT for i in range ( N - 1 ) : NEW_LINE INDENT A = int ( input ( ) ) NEW_LINE W += A NEW_LINE if S <= W <= T : NEW_LINE IN... |
T264 | 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 ( we... | n , s , t = map ( int , input ( ) . split ( ) ) NEW_LINE w = int ( input ( ) ) NEW_LINE a_array = [ ] NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT a_array . append ( int ( input ( ) ) ) NEW_LINE DEDENT cnt = 1 if s <= w <= t else 0 NEW_LINE for a in a_array : NEW_LINE INDENT w += a NEW_LINE if s <= w <= t : NEW_... |
T265 | import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i... | 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 ) NEW... |
T266 | import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i... | import sys NEW_LINE n , s , t = [ int ( i ) for i in sys . stdin . readline ( ) . rstrip ( ) . split ( ) ] NEW_LINE w = 0 NEW_LINE ans = 0 NEW_LINE for _ in range ( n ) : NEW_LINE INDENT a = int ( sys . stdin . readline ( ) . rstrip ( ) ) NEW_LINE w += a NEW_LINE if s <= w <= t : NEW_LINE INDENT ans += 1 NEW_LINE DEDEN... |
T267 | import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i... | def solve ( ) : NEW_LINE INDENT n , s , t = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE w = int ( input ( ) ) NEW_LINE if s <= w and w <= t : NEW_LINE INDENT ans = 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans = 0 NEW_LINE DEDENT for i in range ( n - 1 ) : NEW_LINE INDENT a = int ( input ( ) ) NEW_LINE w += a ... |
T268 | import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i... | N , S , T = map ( int , input ( ) . split ( ) ) NEW_LINE W = int ( input ( ) ) NEW_LINE if S <= W <= T : NEW_LINE INDENT daycount = 1 NEW_LINE DEDENT else : NEW_LINE INDENT daycount = 0 NEW_LINE DEDENT for i in range ( N - 1 ) : NEW_LINE INDENT A = int ( input ( ) ) NEW_LINE W += A NEW_LINE if S <= W <= T : NEW_LINE IN... |
T269 | import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i... | n , s , t = map ( int , input ( ) . split ( ) ) NEW_LINE w = int ( input ( ) ) NEW_LINE a_array = [ ] NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT a_array . append ( int ( input ( ) ) ) NEW_LINE DEDENT cnt = 1 if s <= w <= t else 0 NEW_LINE for a in a_array : NEW_LINE INDENT w += a NEW_LINE if s <= w <= t : NEW_... |
T270 | import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | 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 ) NEW... |
T271 | import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | import sys NEW_LINE n , s , t = [ int ( i ) for i in sys . stdin . readline ( ) . rstrip ( ) . split ( ) ] NEW_LINE w = 0 NEW_LINE ans = 0 NEW_LINE for _ in range ( n ) : NEW_LINE INDENT a = int ( sys . stdin . readline ( ) . rstrip ( ) ) NEW_LINE w += a NEW_LINE if s <= w <= t : NEW_LINE INDENT ans += 1 NEW_LINE DEDEN... |
T272 | import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | def solve ( ) : NEW_LINE INDENT n , s , t = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE w = int ( input ( ) ) NEW_LINE if s <= w and w <= t : NEW_LINE INDENT ans = 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans = 0 NEW_LINE DEDENT for i in range ( n - 1 ) : NEW_LINE INDENT a = int ( input ( ) ) NEW_LINE w += a ... |
T273 | import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | N , S , T = map ( int , input ( ) . split ( ) ) NEW_LINE W = int ( input ( ) ) NEW_LINE if S <= W <= T : NEW_LINE INDENT daycount = 1 NEW_LINE DEDENT else : NEW_LINE INDENT daycount = 0 NEW_LINE DEDENT for i in range ( N - 1 ) : NEW_LINE INDENT A = int ( input ( ) ) NEW_LINE W += A NEW_LINE if S <= W <= T : NEW_LINE IN... |
T274 | import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputSt... | n , s , t = map ( int , input ( ) . split ( ) ) NEW_LINE w = int ( input ( ) ) NEW_LINE a_array = [ ] NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT a_array . append ( int ( input ( ) ) ) NEW_LINE DEDENT cnt = 1 if s <= w <= t else 0 NEW_LINE for a in a_array : NEW_LINE INDENT w += a NEW_LINE if s <= w <= t : NEW_... |
T275 | import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = 0 ; int g [ ] = new int [ a ] ; g [ 0 ] = sc . nextInt ( ) ; if ( b <= g [ 0 ] &... | 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 ) NEW... |
T276 | import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = 0 ; int g [ ] = new int [ a ] ; g [ 0 ] = sc . nextInt ( ) ; if ( b <= g [ 0 ] &... | import sys NEW_LINE n , s , t = [ int ( i ) for i in sys . stdin . readline ( ) . rstrip ( ) . split ( ) ] NEW_LINE w = 0 NEW_LINE ans = 0 NEW_LINE for _ in range ( n ) : NEW_LINE INDENT a = int ( sys . stdin . readline ( ) . rstrip ( ) ) NEW_LINE w += a NEW_LINE if s <= w <= t : NEW_LINE INDENT ans += 1 NEW_LINE DEDEN... |
T277 | import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = 0 ; int g [ ] = new int [ a ] ; g [ 0 ] = sc . nextInt ( ) ; if ( b <= g [ 0 ] &... | def solve ( ) : NEW_LINE INDENT n , s , t = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE w = int ( input ( ) ) NEW_LINE if s <= w and w <= t : NEW_LINE INDENT ans = 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans = 0 NEW_LINE DEDENT for i in range ( n - 1 ) : NEW_LINE INDENT a = int ( input ( ) ) NEW_LINE w += a ... |
T278 | import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = 0 ; int g [ ] = new int [ a ] ; g [ 0 ] = sc . nextInt ( ) ; if ( b <= g [ 0 ] &... | N , S , T = map ( int , input ( ) . split ( ) ) NEW_LINE W = int ( input ( ) ) NEW_LINE if S <= W <= T : NEW_LINE INDENT daycount = 1 NEW_LINE DEDENT else : NEW_LINE INDENT daycount = 0 NEW_LINE DEDENT for i in range ( N - 1 ) : NEW_LINE INDENT A = int ( input ( ) ) NEW_LINE W += A NEW_LINE if S <= W <= T : NEW_LINE IN... |
T279 | import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = 0 ; int g [ ] = new int [ a ] ; g [ 0 ] = sc . nextInt ( ) ; if ( b <= g [ 0 ] &... | n , s , t = map ( int , input ( ) . split ( ) ) NEW_LINE w = int ( input ( ) ) NEW_LINE a_array = [ ] NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT a_array . append ( int ( input ( ) ) ) NEW_LINE DEDENT cnt = 1 if s <= w <= t else 0 NEW_LINE for a in a_array : NEW_LINE INDENT w += a NEW_LINE if s <= w <= t : NEW_... |
T280 | import java . util . Scanner ; 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 w = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = sc . n... | 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 ) NEW... |
T281 | import java . util . Scanner ; 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 w = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = sc . n... | import sys NEW_LINE n , s , t = [ int ( i ) for i in sys . stdin . readline ( ) . rstrip ( ) . split ( ) ] NEW_LINE w = 0 NEW_LINE ans = 0 NEW_LINE for _ in range ( n ) : NEW_LINE INDENT a = int ( sys . stdin . readline ( ) . rstrip ( ) ) NEW_LINE w += a NEW_LINE if s <= w <= t : NEW_LINE INDENT ans += 1 NEW_LINE DEDEN... |
T282 | import java . util . Scanner ; 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 w = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = sc . n... | def solve ( ) : NEW_LINE INDENT n , s , t = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE w = int ( input ( ) ) NEW_LINE if s <= w and w <= t : NEW_LINE INDENT ans = 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans = 0 NEW_LINE DEDENT for i in range ( n - 1 ) : NEW_LINE INDENT a = int ( input ( ) ) NEW_LINE w += a ... |
T283 | import java . util . Scanner ; 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 w = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = sc . n... | N , S , T = map ( int , input ( ) . split ( ) ) NEW_LINE W = int ( input ( ) ) NEW_LINE if S <= W <= T : NEW_LINE INDENT daycount = 1 NEW_LINE DEDENT else : NEW_LINE INDENT daycount = 0 NEW_LINE DEDENT for i in range ( N - 1 ) : NEW_LINE INDENT A = int ( input ( ) ) NEW_LINE W += A NEW_LINE if S <= W <= T : NEW_LINE IN... |
T284 | import java . util . Scanner ; 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 w = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = sc . n... | n , s , t = map ( int , input ( ) . split ( ) ) NEW_LINE w = int ( input ( ) ) NEW_LINE a_array = [ ] NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT a_array . append ( int ( input ( ) ) ) NEW_LINE DEDENT cnt = 1 if s <= w <= t else 0 NEW_LINE for a in a_array : NEW_LINE INDENT w += a NEW_LINE if s <= w <= t : NEW_... |
T285 | 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 ( String [ ... | 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_LINE IND... |
T286 | 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 ( String [ ... | 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 ( ) ] NEW... |
T287 | 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 ( String [ ... | def make ( n , r ) : NEW_LINE INDENT v = { 0 : 1 } NEW_LINE for _ in range ( n ) : NEW_LINE INDENT s = int ( input ( ) ) NEW_LINE w = dict ( v ) NEW_LINE for k , val in v . items ( ) : NEW_LINE INDENT w [ k + s ] = v . get ( k + s , 0 ) + val NEW_LINE DEDENT v = w NEW_LINE DEDENT return sorted ( v . items ( ) , reverse... |
T288 | 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 ( String [ ... | from collections import defaultdict NEW_LINE import sys , heapq , bisect , math , itertools , string , queue , datetime NEW_LINE sys . setrecursionlimit ( 10 ** 8 ) NEW_LINE INF = float ( ' inf ' ) NEW_LINE mod = 10 ** 9 + 7 NEW_LINE eps = 10 ** - 7 NEW_LINE AtoZ = [ chr ( i ) for i in range ( 65 , 65 + 26 ) ] NEW_LINE... |
T289 | 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 ( String [ ... | import sys NEW_LINE from collections import defaultdict , Counter NEW_LINE from itertools import product , groupby , count , permutations , combinations NEW_LINE from math import pi , sqrt , ceil , floor NEW_LINE from collections import deque NEW_LINE from bisect import bisect , bisect_left , bisect_right NEW_LINE from... |
T290 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; HashMap < Long , L... | 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_LINE IND... |
T291 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; HashMap < Long , L... | 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 ( ) ] NEW... |
T292 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; HashMap < Long , L... | def make ( n , r ) : NEW_LINE INDENT v = { 0 : 1 } NEW_LINE for _ in range ( n ) : NEW_LINE INDENT s = int ( input ( ) ) NEW_LINE w = dict ( v ) NEW_LINE for k , val in v . items ( ) : NEW_LINE INDENT w [ k + s ] = v . get ( k + s , 0 ) + val NEW_LINE DEDENT v = w NEW_LINE DEDENT return sorted ( v . items ( ) , reverse... |
T293 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; HashMap < Long , L... | from collections import defaultdict NEW_LINE import sys , heapq , bisect , math , itertools , string , queue , datetime NEW_LINE sys . setrecursionlimit ( 10 ** 8 ) NEW_LINE INF = float ( ' inf ' ) NEW_LINE mod = 10 ** 9 + 7 NEW_LINE eps = 10 ** - 7 NEW_LINE AtoZ = [ chr ( i ) for i in range ( 65 , 65 + 26 ) ] NEW_LINE... |
T294 | import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; HashMap < Long , L... | import sys NEW_LINE from collections import defaultdict , Counter NEW_LINE from itertools import product , groupby , count , permutations , combinations NEW_LINE from math import pi , sqrt , ceil , floor NEW_LINE from collections import deque NEW_LINE from bisect import bisect , bisect_left , bisect_right NEW_LINE from... |
T295 | import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long x = scan . nextInt ( ) ; long [ ] w = new long [ n ] ; for ( int i = 0 ; i < n ; ++ i ) w [ i ] = scan . nextInt ( ) ; int m = n / 2 ; long [ ] f = new long ... | 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_LINE IND... |
T296 | import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long x = scan . nextInt ( ) ; long [ ] w = new long [ n ] ; for ( int i = 0 ; i < n ; ++ i ) w [ i ] = scan . nextInt ( ) ; int m = n / 2 ; long [ ] f = new long ... | 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 ( ) ] NEW... |
T297 | import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long x = scan . nextInt ( ) ; long [ ] w = new long [ n ] ; for ( int i = 0 ; i < n ; ++ i ) w [ i ] = scan . nextInt ( ) ; int m = n / 2 ; long [ ] f = new long ... | def make ( n , r ) : NEW_LINE INDENT v = { 0 : 1 } NEW_LINE for _ in range ( n ) : NEW_LINE INDENT s = int ( input ( ) ) NEW_LINE w = dict ( v ) NEW_LINE for k , val in v . items ( ) : NEW_LINE INDENT w [ k + s ] = v . get ( k + s , 0 ) + val NEW_LINE DEDENT v = w NEW_LINE DEDENT return sorted ( v . items ( ) , reverse... |
T298 | import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long x = scan . nextInt ( ) ; long [ ] w = new long [ n ] ; for ( int i = 0 ; i < n ; ++ i ) w [ i ] = scan . nextInt ( ) ; int m = n / 2 ; long [ ] f = new long ... | from collections import defaultdict NEW_LINE import sys , heapq , bisect , math , itertools , string , queue , datetime NEW_LINE sys . setrecursionlimit ( 10 ** 8 ) NEW_LINE INF = float ( ' inf ' ) NEW_LINE mod = 10 ** 9 + 7 NEW_LINE eps = 10 ** - 7 NEW_LINE AtoZ = [ chr ( i ) for i in range ( 65 , 65 + 26 ) ] NEW_LINE... |
T299 | import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long x = scan . nextInt ( ) ; long [ ] w = new long [ n ] ; for ( int i = 0 ; i < n ; ++ i ) w [ i ] = scan . nextInt ( ) ; int m = n / 2 ; long [ ] f = new long ... | import sys NEW_LINE from collections import defaultdict , Counter NEW_LINE from itertools import product , groupby , count , permutations , combinations NEW_LINE from math import pi , sqrt , ceil , floor NEW_LINE from collections import deque NEW_LINE from bisect import bisect , bisect_left , bisect_right NEW_LINE from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.