user_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
1 value
submission_id_v0
stringlengths
10
10
submission_id_v1
stringlengths
10
10
cpu_time_v0
int64
10
38.3k
cpu_time_v1
int64
0
24.7k
memory_v0
int64
2.57k
1.02M
memory_v1
int64
2.57k
869k
status_v0
stringclasses
1 value
status_v1
stringclasses
1 value
improvement_frac
float64
7.51
100
input
stringlengths
20
4.55k
target
stringlengths
17
3.34k
code_v0_loc
int64
1
148
code_v1_loc
int64
1
184
code_v0_num_chars
int64
13
4.55k
code_v1_num_chars
int64
14
3.34k
code_v0_no_empty_lines
stringlengths
21
6.88k
code_v1_no_empty_lines
stringlengths
20
4.93k
code_same
bool
1 class
relative_loc_diff_percent
float64
0
79.8
diff
list
diff_only_import_comment
bool
1 class
measured_runtime_v0
float64
0.01
4.45
measured_runtime_v1
float64
0.01
4.31
runtime_lift
float64
0
359
key
list
u844789719
p03222
python
s770210029
s429489179
64
23
3,064
3,436
Accepted
Accepted
64.06
H, W, K = [int(_) for _ in input().split()] if W == 1: print((1)) else: def fib(j): if j == 0 or j == 1: return 1 else: count = 0 for num in range(2 ** (j - 1)): bit = str(bin(num)) flag = 1 for i i...
import collections cd = collections.defaultdict memo = cd(lambda: cd(int)) memo[0][1] = 1 H, W, K = [int(_) for _ in input().split()] mod = 10**9 + 7 fib = [1, 1, 2, 3, 5, 8, 13, 21] + [1] * 8 def count(h, w): if memo[h][w]: return memo[h][w] elif h == 0 or w == 0 or w == W + 1: ...
29
26
1,146
618
H, W, K = [int(_) for _ in input().split()] if W == 1: print((1)) else: def fib(j): if j == 0 or j == 1: return 1 else: count = 0 for num in range(2 ** (j - 1)): bit = str(bin(num)) flag = 1 for i in range(2, le...
import collections cd = collections.defaultdict memo = cd(lambda: cd(int)) memo[0][1] = 1 H, W, K = [int(_) for _ in input().split()] mod = 10**9 + 7 fib = [1, 1, 2, 3, 5, 8, 13, 21] + [1] * 8 def count(h, w): if memo[h][w]: return memo[h][w] elif h == 0 or w == 0 or w == W + 1: return 0 ...
false
10.344828
[ "+import collections", "+", "+cd = collections.defaultdict", "+memo = cd(lambda: cd(int))", "+memo[0][1] = 1", "-if W == 1:", "- print((1))", "-else:", "+mod = 10**9 + 7", "+fib = [1, 1, 2, 3, 5, 8, 13, 21] + [1] * 8", "- def fib(j):", "- if j == 0 or j == 1:", "- ret...
false
0.041157
0.036665
1.122493
[ "s770210029", "s429489179" ]
u504836877
p03665
python
s779457236
s962521016
19
17
3,064
3,064
Accepted
Accepted
10.53
N,P = list(map(int, input().split())) A = [int(a) for a in input().split()] even = 0 odd = 0 for a in A: if a%2 == 0: even += 1 else: odd += 1 L = [1]*(N+1) for i in range(N): L[i+1] = L[i]*(i+1) def cmb(n, r): return L[n]//L[r]//L[n-r] ans = pow(2, N) for ...
N,P = list(map(int, input().split())) A = [int(a) for a in input().split()] even = 0 odd = 0 for a in A: if a%2 == 0: even += 1 else: odd += 1 if odd == 0: if P == 0: ans = pow(2, N) else: ans = 0 else: ans = pow(2, N-1) print(ans)
25
20
428
299
N, P = list(map(int, input().split())) A = [int(a) for a in input().split()] even = 0 odd = 0 for a in A: if a % 2 == 0: even += 1 else: odd += 1 L = [1] * (N + 1) for i in range(N): L[i + 1] = L[i] * (i + 1) def cmb(n, r): return L[n] // L[r] // L[n - r] ans = pow(2, N) for i in ran...
N, P = list(map(int, input().split())) A = [int(a) for a in input().split()] even = 0 odd = 0 for a in A: if a % 2 == 0: even += 1 else: odd += 1 if odd == 0: if P == 0: ans = pow(2, N) else: ans = 0 else: ans = pow(2, N - 1) print(ans)
false
20
[ "-L = [1] * (N + 1)", "-for i in range(N):", "- L[i + 1] = L[i] * (i + 1)", "-", "-", "-def cmb(n, r):", "- return L[n] // L[r] // L[n - r]", "-", "-", "-ans = pow(2, N)", "-for i in range(1, odd + 1, 2):", "- ans -= cmb(odd, i) * pow(2, even)", "-if P == 1:", "- ans = pow(2, N...
false
0.125427
0.045267
2.770831
[ "s779457236", "s962521016" ]
u078349616
p03231
python
s596863727
s761389595
100
39
22,836
5,344
Accepted
Accepted
61
from collections import defaultdict from fractions import gcd N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) L = N * M // gcd(N, M) ds = L // N dt = L // M dict_s = defaultdict(str) dict_t = defaultdict(str) for i in range(N): dict_s[i*ds] = S[i] for i in range(M): dic...
from fractions import gcd N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) g = gcd(N, M) lcm = N * M // g for i in range(g): if S[i*N//g] != T[i*M//g]: print((-1)) exit() print(lcm)
23
11
452
207
from collections import defaultdict from fractions import gcd N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) L = N * M // gcd(N, M) ds = L // N dt = L // M dict_s = defaultdict(str) dict_t = defaultdict(str) for i in range(N): dict_s[i * ds] = S[i] for i in range(M): dict_t[i * dt] ...
from fractions import gcd N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) g = gcd(N, M) lcm = N * M // g for i in range(g): if S[i * N // g] != T[i * M // g]: print((-1)) exit() print(lcm)
false
52.173913
[ "-from collections import defaultdict", "-L = N * M // gcd(N, M)", "-ds = L // N", "-dt = L // M", "-dict_s = defaultdict(str)", "-dict_t = defaultdict(str)", "-for i in range(N):", "- dict_s[i * ds] = S[i]", "-for i in range(M):", "- dict_t[i * dt] = T[i]", "-for key in list(dict_s.keys()...
false
0.051558
0.15991
0.322421
[ "s596863727", "s761389595" ]
u453055089
p02707
python
s553724317
s685841957
201
151
109,864
92,436
Accepted
Accepted
24.88
from collections import Counter, deque n = int(eval(input())) a = deque(list(map(int, input().split()))) c = Counter(a) for i in range(1, n+1): if i in list(c.keys()): print((c[i])) else: print((0))
n = int(eval(input())) a = list(map(int, input().split())) buka = [0]*n for i in range(n-1): buka[a[i]-1] += 1 for i in range(n): print((buka[i]))
9
7
215
152
from collections import Counter, deque n = int(eval(input())) a = deque(list(map(int, input().split()))) c = Counter(a) for i in range(1, n + 1): if i in list(c.keys()): print((c[i])) else: print((0))
n = int(eval(input())) a = list(map(int, input().split())) buka = [0] * n for i in range(n - 1): buka[a[i] - 1] += 1 for i in range(n): print((buka[i]))
false
22.222222
[ "-from collections import Counter, deque", "-", "-a = deque(list(map(int, input().split())))", "-c = Counter(a)", "-for i in range(1, n + 1):", "- if i in list(c.keys()):", "- print((c[i]))", "- else:", "- print((0))", "+a = list(map(int, input().split()))", "+buka = [0] * n"...
false
0.043861
0.047068
0.931862
[ "s553724317", "s685841957" ]
u729133443
p02995
python
s756959125
s051685019
275
35
63,980
5,048
Accepted
Accepted
87.27
from fractions import* a,b,c,d=list(map(int,input().split())) a-=1 e=c*d//gcd(c,d) print((b-a-b//c+a//c-b//d+a//d+b//e-a//e))
from fractions import* a,b,c,d=list(map(int,input().split())) f=lambda x:x-x//c-x//d+x//(c*d//gcd(c,d)) print((f(b)-f(a-1)))
5
4
121
119
from fractions import * a, b, c, d = list(map(int, input().split())) a -= 1 e = c * d // gcd(c, d) print((b - a - b // c + a // c - b // d + a // d + b // e - a // e))
from fractions import * a, b, c, d = list(map(int, input().split())) f = lambda x: x - x // c - x // d + x // (c * d // gcd(c, d)) print((f(b) - f(a - 1)))
false
20
[ "-a -= 1", "-e = c * d // gcd(c, d)", "-print((b - a - b // c + a // c - b // d + a // d + b // e - a // e))", "+f = lambda x: x - x // c - x // d + x // (c * d // gcd(c, d))", "+print((f(b) - f(a - 1)))" ]
false
0.107852
0.043416
2.48418
[ "s756959125", "s051685019" ]
u272075541
p02820
python
s324442913
s188031901
85
53
14,776
4,408
Accepted
Accepted
37.65
# -*- coding: utf-8 -*- ################ DANGER ################ test = "" #test = \ """ 5 2 8 7 6 rsrpr ans 27 """ """ 7 1 100 10 1 ssssppr ans 211 """ """ 30 5 325 234 123 rspsspspsrpspsppprpsprpssprpsr ans 4996 """ ######################################## test = list(reversed(test.strip(...
from array import array n, k = list(map(int, input().split())) r, s, p = list(map(int, input().split())) t = array("u", list(eval(input()))) for i in range(k, n-1): if t[i] == t[i-k]: t[i] = "*" if t[n-1] == t[n-1-k]: t[n-1] = "*" ans = (t.count("r") * p + t.count("s") * r...
54
17
864
344
# -*- coding: utf-8 -*- ################ DANGER ################ test = "" # test = \ """ 5 2 8 7 6 rsrpr ans 27 """ """ 7 1 100 10 1 ssssppr ans 211 """ """ 30 5 325 234 123 rspsspspsrpspsppprpsprpssprpsr ans 4996 """ ######################################## test = list(reversed(test.strip().splitlines())) if test: ...
from array import array n, k = list(map(int, input().split())) r, s, p = list(map(int, input().split())) t = array("u", list(eval(input()))) for i in range(k, n - 1): if t[i] == t[i - k]: t[i] = "*" if t[n - 1] == t[n - 1 - k]: t[n - 1] = "*" ans = t.count("r") * p + t.count("s") * r + t.count("p") * s...
false
68.518519
[ "-# -*- coding: utf-8 -*-", "-################ DANGER ################", "-test = \"\"", "-# test = \\", "-\"\"\"", "-5 2", "-8 7 6", "-rsrpr", "-ans 27", "-\"\"\"", "-\"\"\"", "-7 1", "-100 10 1", "-ssssppr", "-ans 211", "-\"\"\"", "-\"\"\"", "-30 5", "-325 234 123", "-rspssps...
false
0.034091
0.090086
0.378425
[ "s324442913", "s188031901" ]
u680851063
p03111
python
s929255017
s898869339
311
262
14,836
3,188
Accepted
Accepted
15.76
# DFS, パターン列挙_各竹の使用パターンを列挙 n, a, b, c = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] stack = [[0],[1],[2],[-1]] # 初期化_ここでは竹の使用パターン4つを設置 ptns = [] # パターン候補の器_初期化 while stack: # stackが空になるまでループ tmp = stack.pop() # パターンの候補を pop if len(tmp) == n: # 条件に合えば append ...
# DFS, パターン列挙_各竹の使用パターンを列挙 n, a, b, c = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] stack = [[0],[1],[2],[-1]] ans = 10**9 while stack: tmp = stack.pop() if len(tmp) == n: if 0 not in tmp or 1 not in tmp or 2 not in tmp: continue abc = [...
36
32
937
752
# DFS, パターン列挙_各竹の使用パターンを列挙 n, a, b, c = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] stack = [[0], [1], [2], [-1]] # 初期化_ここでは竹の使用パターン4つを設置 ptns = [] # パターン候補の器_初期化 while stack: # stackが空になるまでループ tmp = stack.pop() # パターンの候補を pop if len(tmp) == n: # 条件に合えば append ptns.ap...
# DFS, パターン列挙_各竹の使用パターンを列挙 n, a, b, c = list(map(int, input().split())) l = [int(eval(input())) for _ in range(n)] stack = [[0], [1], [2], [-1]] ans = 10**9 while stack: tmp = stack.pop() if len(tmp) == n: if 0 not in tmp or 1 not in tmp or 2 not in tmp: continue abc = [0, 0, 0, -30]...
false
11.111111
[ "-stack = [[0], [1], [2], [-1]] # 初期化_ここでは竹の使用パターン4つを設置", "-ptns = [] # パターン候補の器_初期化", "-while stack: # stackが空になるまでループ", "- tmp = stack.pop() # パターンの候補を pop", "- if len(tmp) == n: # 条件に合えば append", "- ptns.append(tmp)", "- elif len(tmp) < n: # 条件に合わなければ...", "- w = tmp + ...
false
0.187274
0.28577
0.65533
[ "s929255017", "s898869339" ]
u934442292
p02623
python
s862954682
s537945821
912
707
42,468
42,208
Accepted
Accepted
22.48
import sys from itertools import accumulate input = sys.stdin.readline def is_ok(a, key, idx): if a[idx] <= key: return True else: return False def binary_search(a, key): """Meguru type binary search""" ok = -1 ng = len(a) while (abs(ok - ng) > 1): ...
import sys from itertools import accumulate input = sys.stdin.readline def binary_search(a, key): """Meguru type binary search""" ok = -1 ng = len(a) while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if a[mid] <= key: ok = mid else: ng = m...
50
43
919
808
import sys from itertools import accumulate input = sys.stdin.readline def is_ok(a, key, idx): if a[idx] <= key: return True else: return False def binary_search(a, key): """Meguru type binary search""" ok = -1 ng = len(a) while abs(ok - ng) > 1: mid = (ok + ng) // 2...
import sys from itertools import accumulate input = sys.stdin.readline def binary_search(a, key): """Meguru type binary search""" ok = -1 ng = len(a) while abs(ok - ng) > 1: mid = (ok + ng) // 2 if a[mid] <= key: ok = mid else: ng = mid return ok ...
false
14
[ "-", "-", "-def is_ok(a, key, idx):", "- if a[idx] <= key:", "- return True", "- else:", "- return False", "- if is_ok(a, key, mid):", "+ if a[mid] <= key:" ]
false
0.043606
0.043719
0.997428
[ "s862954682", "s537945821" ]
u060736237
p03262
python
s996866868
s340302386
105
95
16,280
16,240
Accepted
Accepted
9.52
from fractions import gcd N, X = list(map(int, input().split())) x = list(map(int, input().split())) z = list([abs(X - i) for i in x]) ans = z[0] for i in range(1, N): ans = gcd(ans, z[i]) print(ans)
from fractions import gcd n, X = list(map(int, input().split())) x = list(map(int, input().split())) ans = abs(x[0]-X) for el in x[1:]: ans = gcd(ans, abs(el - X)) print(ans)
9
7
208
179
from fractions import gcd N, X = list(map(int, input().split())) x = list(map(int, input().split())) z = list([abs(X - i) for i in x]) ans = z[0] for i in range(1, N): ans = gcd(ans, z[i]) print(ans)
from fractions import gcd n, X = list(map(int, input().split())) x = list(map(int, input().split())) ans = abs(x[0] - X) for el in x[1:]: ans = gcd(ans, abs(el - X)) print(ans)
false
22.222222
[ "-N, X = list(map(int, input().split()))", "+n, X = list(map(int, input().split()))", "-z = list([abs(X - i) for i in x])", "-ans = z[0]", "-for i in range(1, N):", "- ans = gcd(ans, z[i])", "+ans = abs(x[0] - X)", "+for el in x[1:]:", "+ ans = gcd(ans, abs(el - X))" ]
false
0.050593
0.049373
1.024727
[ "s996866868", "s340302386" ]
u898967808
p02844
python
s950325037
s203116985
22
20
3,060
3,188
Accepted
Accepted
9.09
n = int(eval(input())) s = eval(input()) ans = 0 for i in range(1000): pin = '{:03d}'.format(i) p1 = s.find(pin[0]) if p1>=0: p2 = s[p1+1:].find(pin[1]) if p2>=0: p3 = s[p1+p2+2:].find(pin[2]) if p3>=0: ans+=1 print(ans)
n = int(eval(input())) s = eval(input()) ans = 0 for i in range(1000): pin = '{:03d}'.format(i) p1 = s.find(pin[0]) if p1>=0: p2 = s.find(pin[1],p1+1) if p2>=0: p3 = s.find(pin[2],p2+1) if p3>=0: ans+=1 print(ans)
15
15
285
278
n = int(eval(input())) s = eval(input()) ans = 0 for i in range(1000): pin = "{:03d}".format(i) p1 = s.find(pin[0]) if p1 >= 0: p2 = s[p1 + 1 :].find(pin[1]) if p2 >= 0: p3 = s[p1 + p2 + 2 :].find(pin[2]) if p3 >= 0: ans += 1 print(ans)
n = int(eval(input())) s = eval(input()) ans = 0 for i in range(1000): pin = "{:03d}".format(i) p1 = s.find(pin[0]) if p1 >= 0: p2 = s.find(pin[1], p1 + 1) if p2 >= 0: p3 = s.find(pin[2], p2 + 1) if p3 >= 0: ans += 1 print(ans)
false
0
[ "- p2 = s[p1 + 1 :].find(pin[1])", "+ p2 = s.find(pin[1], p1 + 1)", "- p3 = s[p1 + p2 + 2 :].find(pin[2])", "+ p3 = s.find(pin[2], p2 + 1)" ]
false
0.039281
0.042089
0.933266
[ "s950325037", "s203116985" ]
u183422236
p02696
python
s984821522
s433965452
22
19
9,164
9,104
Accepted
Accepted
13.64
a, b, n = list(map(int, input().split())) n = min(n, b-1) print((int((a * n) / b) - a * int(n / b)))
a, b, n = list(map(int, input().split())) syou = n // b if syou >= 1: n = b * 1 - 1 print((int((a * n) / b) - a * int(n / b)))
4
6
96
129
a, b, n = list(map(int, input().split())) n = min(n, b - 1) print((int((a * n) / b) - a * int(n / b)))
a, b, n = list(map(int, input().split())) syou = n // b if syou >= 1: n = b * 1 - 1 print((int((a * n) / b) - a * int(n / b)))
false
33.333333
[ "-n = min(n, b - 1)", "+syou = n // b", "+if syou >= 1:", "+ n = b * 1 - 1" ]
false
0.048438
0.047766
1.014069
[ "s984821522", "s433965452" ]
u598229387
p03162
python
s399079171
s370887533
890
562
24,308
47,008
Accepted
Accepted
36.85
n=int(eval(input())) abc=[[int(i) for i in input().split()] for j in range(n)] dp=[[abc[0][0],abc[0][1],abc[0][2]],[abc[0][0],abc[0][1],abc[0][2]]] for i in range(1,n): for j in range(3): for k in range(3): if j!=k: dp[1][k]=max(dp[1][k] ,dp[0][j]+abc[i][k]) dp[0][...
n=int(eval(input())) abc=[[int(i) for i in input().split()] for j in range(n)] dp=[[0 for i in range(3)] for j in range(n+1)] for i in range(3): dp[1][i]=abc[0][i] for i in range(1,n): dp[i+1][0]=max(dp[i][1],dp[i][2])+abc[i][0] dp[i+1][1]=max(dp[i][2],dp[i][0])+abc[i][1] dp[i+1][2]=max(...
13
14
390
374
n = int(eval(input())) abc = [[int(i) for i in input().split()] for j in range(n)] dp = [[abc[0][0], abc[0][1], abc[0][2]], [abc[0][0], abc[0][1], abc[0][2]]] for i in range(1, n): for j in range(3): for k in range(3): if j != k: dp[1][k] = max(dp[1][k], dp[0][j] + abc[i][k]) ...
n = int(eval(input())) abc = [[int(i) for i in input().split()] for j in range(n)] dp = [[0 for i in range(3)] for j in range(n + 1)] for i in range(3): dp[1][i] = abc[0][i] for i in range(1, n): dp[i + 1][0] = max(dp[i][1], dp[i][2]) + abc[i][0] dp[i + 1][1] = max(dp[i][2], dp[i][0]) + abc[i][1] dp[i +...
false
7.142857
[ "-dp = [[abc[0][0], abc[0][1], abc[0][2]], [abc[0][0], abc[0][1], abc[0][2]]]", "+dp = [[0 for i in range(3)] for j in range(n + 1)]", "+for i in range(3):", "+ dp[1][i] = abc[0][i]", "- for j in range(3):", "- for k in range(3):", "- if j != k:", "- dp[1][k] = m...
false
0.048184
0.043369
1.111018
[ "s399079171", "s370887533" ]
u867826040
p02837
python
s870269222
s058544948
223
178
9,160
9,136
Accepted
Accepted
20.18
n = int(eval(input())) v = [[tuple(map(int, input().split()))for i in range(int(eval(input())))] for i in range(n)] ans = 0 for i in range(2**n): f = [0] * n xy = [] for j in range(n): if (i >> j) & 1: f[j] = 1 xy.append(v[j]) flag = True for xyi in...
n = int(eval(input())) v = [[tuple(map(int, input().split()))for i in range(int(eval(input())))] for i in range(n)] ans = 0 for i in range(2**n): f = True a = 0 for j in range(n): if (i >> j) & 1: if all(i >> (x - 1) & 1 == y for x, y in v[j]): a += 1 ...
22
18
520
424
n = int(eval(input())) v = [ [tuple(map(int, input().split())) for i in range(int(eval(input())))] for i in range(n) ] ans = 0 for i in range(2**n): f = [0] * n xy = [] for j in range(n): if (i >> j) & 1: f[j] = 1 xy.append(v[j]) flag = True for xyi in xy: ...
n = int(eval(input())) v = [ [tuple(map(int, input().split())) for i in range(int(eval(input())))] for i in range(n) ] ans = 0 for i in range(2**n): f = True a = 0 for j in range(n): if (i >> j) & 1: if all(i >> (x - 1) & 1 == y for x, y in v[j]): a += 1 ...
false
18.181818
[ "- f = [0] * n", "- xy = []", "+ f = True", "+ a = 0", "- f[j] = 1", "- xy.append(v[j])", "- flag = True", "- for xyi in xy:", "- for x, y in xyi:", "- # print(f,x,y,bin(i))", "- if (i >> (x - 1)) & 1 != y:", "- ...
false
0.044647
0.038402
1.162611
[ "s870269222", "s058544948" ]
u729133443
p03719
python
s276739478
s743725816
167
26
38,512
8,968
Accepted
Accepted
84.43
a,b,c=list(map(int,input().split()));print(('YNeos'[c<a or c>b::2]))
a,b,c=list(map(int,input().split())) print(('NYoe s'[a<=c<=b::2]))
1
2
60
59
a, b, c = list(map(int, input().split())) print(("YNeos"[c < a or c > b :: 2]))
a, b, c = list(map(int, input().split())) print(("NYoe s"[a <= c <= b :: 2]))
false
50
[ "-print((\"YNeos\"[c < a or c > b :: 2]))", "+print((\"NYoe s\"[a <= c <= b :: 2]))" ]
false
0.069938
0.035941
1.945902
[ "s276739478", "s743725816" ]
u401452016
p02947
python
s597690627
s012026851
351
227
19,760
19,760
Accepted
Accepted
35.33
from collections import Counter n = int(eval(input())) L = [''.join(sorted(eval(input()))) for i in range(n)] c = Counter(L) cnt = 0 for ele in list(c.values()): cnt += ele*(ele-1)/2 print((int(cnt)))
from collections import Counter import sys n = int(sys.stdin.readline()) L = [''.join(sorted(sys.stdin.readline().strip())) for _ in range(n)] ans = 0 L = Counter(L) for num in list(L.values()): ans += num*(num-1)//2 print(ans)
8
9
191
233
from collections import Counter n = int(eval(input())) L = ["".join(sorted(eval(input()))) for i in range(n)] c = Counter(L) cnt = 0 for ele in list(c.values()): cnt += ele * (ele - 1) / 2 print((int(cnt)))
from collections import Counter import sys n = int(sys.stdin.readline()) L = ["".join(sorted(sys.stdin.readline().strip())) for _ in range(n)] ans = 0 L = Counter(L) for num in list(L.values()): ans += num * (num - 1) // 2 print(ans)
false
11.111111
[ "+import sys", "-n = int(eval(input()))", "-L = [\"\".join(sorted(eval(input()))) for i in range(n)]", "-c = Counter(L)", "-cnt = 0", "-for ele in list(c.values()):", "- cnt += ele * (ele - 1) / 2", "-print((int(cnt)))", "+n = int(sys.stdin.readline())", "+L = [\"\".join(sorted(sys.stdin.readli...
false
0.036966
0.036861
1.002842
[ "s597690627", "s012026851" ]
u644516473
p02695
python
s630025896
s778887430
1,052
516
9,108
9,228
Accepted
Accepted
50.95
from itertools import combinations_with_replacement N, M, Q = list(map(int, input().split())) abcd = [list(map(int, input().split())) for _ in range(Q)] ans = 0 for x in combinations_with_replacement(list(range(1, M+1)), N): point = 0 for a, b, c, d in abcd: if x[b-1] - x[a-1] == c: ...
from itertools import combinations_with_replacement def main(): N, M, Q = list(map(int, input().split())) abcd = [list(map(int, input().split())) for _ in range(Q)] ans = 0 for x in combinations_with_replacement(list(range(1, M+1)), N): point = 0 for a, b, c, d in abcd: ...
12
16
373
472
from itertools import combinations_with_replacement N, M, Q = list(map(int, input().split())) abcd = [list(map(int, input().split())) for _ in range(Q)] ans = 0 for x in combinations_with_replacement(list(range(1, M + 1)), N): point = 0 for a, b, c, d in abcd: if x[b - 1] - x[a - 1] == c: p...
from itertools import combinations_with_replacement def main(): N, M, Q = list(map(int, input().split())) abcd = [list(map(int, input().split())) for _ in range(Q)] ans = 0 for x in combinations_with_replacement(list(range(1, M + 1)), N): point = 0 for a, b, c, d in abcd: i...
false
25
[ "-N, M, Q = list(map(int, input().split()))", "-abcd = [list(map(int, input().split())) for _ in range(Q)]", "-ans = 0", "-for x in combinations_with_replacement(list(range(1, M + 1)), N):", "- point = 0", "- for a, b, c, d in abcd:", "- if x[b - 1] - x[a - 1] == c:", "- point ...
false
0.040041
0.038165
1.049152
[ "s630025896", "s778887430" ]
u814986259
p03221
python
s816062512
s597650177
1,103
680
30,692
31,304
Accepted
Accepted
38.35
N,M=list(map(int,input().split())) PY=[[0,0,0] for i in range(M)] for i in range(M): P,Y=list(map(int,input().split())) PY[i]=[P,Y,i] PY.sort(key=lambda x:x[1]) PY.sort(key=lambda x:x[0]) prev=0 for i in range(M): if PY[i][0] != prev: count = 1 else: count+=1 prev=PY[i][0] ans=["0" fo...
N, M = map(int, input().split()) PY = [tuple(list(map(int, input().split()))+[i]) for i in range(M)] PY.sort(key=lambda x: x[1]) ans = ['']*M P = [0]*N for p, y, i in PY: ret = '' p -= 1 P[p] += 1 ret += '{:0=6}'.format(p+1) ret += '{:0=6}'.format(P[p]) ans[i] = ret print(*ans, sep='...
21
13
529
325
N, M = list(map(int, input().split())) PY = [[0, 0, 0] for i in range(M)] for i in range(M): P, Y = list(map(int, input().split())) PY[i] = [P, Y, i] PY.sort(key=lambda x: x[1]) PY.sort(key=lambda x: x[0]) prev = 0 for i in range(M): if PY[i][0] != prev: count = 1 else: count += 1 pr...
N, M = map(int, input().split()) PY = [tuple(list(map(int, input().split())) + [i]) for i in range(M)] PY.sort(key=lambda x: x[1]) ans = [""] * M P = [0] * N for p, y, i in PY: ret = "" p -= 1 P[p] += 1 ret += "{:0=6}".format(p + 1) ret += "{:0=6}".format(P[p]) ans[i] = ret print(*ans, sep="\n")...
false
38.095238
[ "-N, M = list(map(int, input().split()))", "-PY = [[0, 0, 0] for i in range(M)]", "-for i in range(M):", "- P, Y = list(map(int, input().split()))", "- PY[i] = [P, Y, i]", "+N, M = map(int, input().split())", "+PY = [tuple(list(map(int, input().split())) + [i]) for i in range(M)]", "-PY.sort(key...
false
0.036719
0.035535
1.033295
[ "s816062512", "s597650177" ]
u163320134
p02727
python
s127769529
s660332146
729
245
48,816
22,504
Accepted
Accepted
66.39
import heapq x,y,a,b,c=list(map(int,input().split())) arr1=list(map(int,input().split())) arr2=list(map(int,input().split())) arr3=list(map(int,input().split())) q=[] for val in arr1: heapq.heappush(q,(-val,1)) for val in arr2: heapq.heappush(q,(-val,2)) for val in arr3: heapq.heappush(q,(-val,3)) a...
x,y,a,b,c=list(map(int,input().split())) arr1=list(map(int,input().split())) arr1=sorted(arr1,reverse=True) arr1=arr1[:x] arr2=list(map(int,input().split())) arr2=sorted(arr2,reverse=True) arr2=arr2[:y] arr3=list(map(int,input().split())) ans=arr1+arr2+arr3 ans=sorted(ans,reverse=True) print((sum(ans[:x+y])))
32
11
591
312
import heapq x, y, a, b, c = list(map(int, input().split())) arr1 = list(map(int, input().split())) arr2 = list(map(int, input().split())) arr3 = list(map(int, input().split())) q = [] for val in arr1: heapq.heappush(q, (-val, 1)) for val in arr2: heapq.heappush(q, (-val, 2)) for val in arr3: heapq.heappus...
x, y, a, b, c = list(map(int, input().split())) arr1 = list(map(int, input().split())) arr1 = sorted(arr1, reverse=True) arr1 = arr1[:x] arr2 = list(map(int, input().split())) arr2 = sorted(arr2, reverse=True) arr2 = arr2[:y] arr3 = list(map(int, input().split())) ans = arr1 + arr2 + arr3 ans = sorted(ans, reverse=True...
false
65.625
[ "-import heapq", "-", "+arr1 = sorted(arr1, reverse=True)", "+arr1 = arr1[:x]", "+arr2 = sorted(arr2, reverse=True)", "+arr2 = arr2[:y]", "-q = []", "-for val in arr1:", "- heapq.heappush(q, (-val, 1))", "-for val in arr2:", "- heapq.heappush(q, (-val, 2))", "-for val in arr3:", "- ...
false
0.041858
0.040964
1.021838
[ "s127769529", "s660332146" ]
u098012509
p03164
python
s094378925
s705453615
1,230
484
311,552
120,300
Accepted
Accepted
60.65
import sys input = sys.stdin.readline def main(): N, W = [int(x) for x in input().split()] WV = [[int(x) for x in input().split()] for _ in range(N)] sumv = 0 for w, v in WV: sumv += v dp = [[float("inf")] * (sumv + 1) for j in range(N + 1)] for i in range(1, N + 1):...
import sys input = sys.stdin.readline def main(): N, W = [int(x) for x in input().split()] WV = [[int(x) for x in input().split()] for _ in range(N)] sumv = 0 for w, v in WV: sumv += v dp = [[10 ** 9 + 1] * (sumv + 1) for j in range(N + 1)] for i in range(1, N + 1): ...
35
35
735
734
import sys input = sys.stdin.readline def main(): N, W = [int(x) for x in input().split()] WV = [[int(x) for x in input().split()] for _ in range(N)] sumv = 0 for w, v in WV: sumv += v dp = [[float("inf")] * (sumv + 1) for j in range(N + 1)] for i in range(1, N + 1): for j in ...
import sys input = sys.stdin.readline def main(): N, W = [int(x) for x in input().split()] WV = [[int(x) for x in input().split()] for _ in range(N)] sumv = 0 for w, v in WV: sumv += v dp = [[10**9 + 1] * (sumv + 1) for j in range(N + 1)] for i in range(1, N + 1): for j in ran...
false
0
[ "- dp = [[float(\"inf\")] * (sumv + 1) for j in range(N + 1)]", "+ dp = [[10**9 + 1] * (sumv + 1) for j in range(N + 1)]" ]
false
0.174999
0.036115
4.845632
[ "s094378925", "s705453615" ]
u052221988
p02756
python
s109684761
s464075021
701
495
4,480
4,480
Accepted
Accepted
29.39
right = eval(input()) q = int(eval(input())) left = "" flag = 1 for i in range(q) : t = eval(input()) if t == "1" : flag ^= 1 continue t, f, c = t.split(" ") f = int(f) left += c*flag*(2-f) right += c*flag*(f-1) left += c*(1-flag)*(f-1) right += c*(1-flag)*(...
right = eval(input()) flag = 1 left = "" for i in range(int(eval(input()))): t = eval(input()) if t == "1": flag ^= 1 continue t, f, c = t.split(" ") if not ((f=="1")^flag): left += c else: right += c ans = left[::-1] + right if not flag: ans = ans[...
19
17
388
319
right = eval(input()) q = int(eval(input())) left = "" flag = 1 for i in range(q): t = eval(input()) if t == "1": flag ^= 1 continue t, f, c = t.split(" ") f = int(f) left += c * flag * (2 - f) right += c * flag * (f - 1) left += c * (1 - flag) * (f - 1) right += c * (1 -...
right = eval(input()) flag = 1 left = "" for i in range(int(eval(input()))): t = eval(input()) if t == "1": flag ^= 1 continue t, f, c = t.split(" ") if not ((f == "1") ^ flag): left += c else: right += c ans = left[::-1] + right if not flag: ans = ans[::-1] print...
false
10.526316
[ "-q = int(eval(input()))", "+flag = 1", "-flag = 1", "-for i in range(q):", "+for i in range(int(eval(input()))):", "- f = int(f)", "- left += c * flag * (2 - f)", "- right += c * flag * (f - 1)", "- left += c * (1 - flag) * (f - 1)", "- right += c * (1 - flag) * (2 - f)", "-if fl...
false
0.036363
0.036904
0.985337
[ "s109684761", "s464075021" ]
u729133443
p03078
python
s106915683
s198051806
1,812
802
160,844
90,980
Accepted
Accepted
55.74
I=lambda:list(map(int,input().split()));x,y,z,k=I();S=sorted;s=lambda a,b:S(i+j for i in a for j in b)[:-k-1:-1];print((*s(s(S(I()),S(I())),S(I()))))
from numpy import*;I=lambda:int64(input().split());x,y,z,k=I();s=lambda a,b:sort(ravel([b+i for i in a]))[:-k-1:-1];print((*s(s(I(),I()),I())))
1
1
147
141
I = lambda: list(map(int, input().split())) x, y, z, k = I() S = sorted s = lambda a, b: S(i + j for i in a for j in b)[: -k - 1 : -1] print((*s(s(S(I()), S(I())), S(I()))))
from numpy import * I = lambda: int64(input().split()) x, y, z, k = I() s = lambda a, b: sort(ravel([b + i for i in a]))[: -k - 1 : -1] print((*s(s(I(), I()), I())))
false
0
[ "-I = lambda: list(map(int, input().split()))", "+from numpy import *", "+", "+I = lambda: int64(input().split())", "-S = sorted", "-s = lambda a, b: S(i + j for i in a for j in b)[: -k - 1 : -1]", "-print((*s(s(S(I()), S(I())), S(I()))))", "+s = lambda a, b: sort(ravel([b + i for i in a]))[: -k - 1 :...
false
0.042038
0.194594
0.21603
[ "s106915683", "s198051806" ]
u677523557
p02822
python
s296587054
s947004522
1,858
1,707
198,304
69,700
Accepted
Accepted
8.13
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) mod = 10**9+7 N = int(eval(input())) graph = [[] for _ in range(N)] for _ in range(N-1): a, b = list(map(int, input().split())) graph[a-1].append(b-1) graph[b-1].append(a-1) #互いに素なa,bについて、a*x+b*y=1の一つの解 def extgcd(a,b): ...
import sys input = sys.stdin.readline mod = 10**9+7 def dfs(graph, N): ans = 0 Par = [-1]*N Childs = [[] for _ in range(N)] stack = [0] while stack: p = stack.pop() if p >= 0: stack.append(~p) for np in graph[p]: if np != 0 and...
66
44
1,289
1,132
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) mod = 10**9 + 7 N = int(eval(input())) graph = [[] for _ in range(N)] for _ in range(N - 1): a, b = list(map(int, input().split())) graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) # 互いに素なa,bについて、a*x+b*y=1の一つの解 def extgcd(a, b): r ...
import sys input = sys.stdin.readline mod = 10**9 + 7 def dfs(graph, N): ans = 0 Par = [-1] * N Childs = [[] for _ in range(N)] stack = [0] while stack: p = stack.pop() if p >= 0: stack.append(~p) for np in graph[p]: if np != 0 and Par[np] =...
false
33.333333
[ "-sys.setrecursionlimit(10**7)", "-N = int(eval(input()))", "-graph = [[] for _ in range(N)]", "-for _ in range(N - 1):", "- a, b = list(map(int, input().split()))", "- graph[a - 1].append(b - 1)", "- graph[b - 1].append(a - 1)", "-# 互いに素なa,bについて、a*x+b*y=1の一つの解", "-def extgcd(a, b):", "- ...
false
0.078393
0.080489
0.973961
[ "s296587054", "s947004522" ]
u103198430
p02726
python
s171744720
s743081143
1,692
1,197
3,444
3,444
Accepted
Accepted
29.26
import sys def input() -> str: return sys.stdin.readline().rstrip("\r\n") def main(): def min_dest(a, b): return min(b-a, abs(x-a)+1+abs(y-b), abs(x-b)+1+abs(y-a)) n, x, y = list(map(int, input().split())) x, y = x-1, y-1 ans = [0] * (n-1) for i in range(n): ...
import sys def input() -> str: return sys.stdin.readline().rstrip("\r\n") def main(): def min_dest(a, b): return min(b-a, abs(x-a)+1+abs(y-b)) n, x, y = list(map(int, input().split())) x, y = x-1, y-1 ans = [0] * (n-1) for i in range(n): for j in range(i+1, ...
25
25
462
441
import sys def input() -> str: return sys.stdin.readline().rstrip("\r\n") def main(): def min_dest(a, b): return min(b - a, abs(x - a) + 1 + abs(y - b), abs(x - b) + 1 + abs(y - a)) n, x, y = list(map(int, input().split())) x, y = x - 1, y - 1 ans = [0] * (n - 1) for i in range(n): ...
import sys def input() -> str: return sys.stdin.readline().rstrip("\r\n") def main(): def min_dest(a, b): return min(b - a, abs(x - a) + 1 + abs(y - b)) n, x, y = list(map(int, input().split())) x, y = x - 1, y - 1 ans = [0] * (n - 1) for i in range(n): for j in range(i + 1,...
false
0
[ "- return min(b - a, abs(x - a) + 1 + abs(y - b), abs(x - b) + 1 + abs(y - a))", "+ return min(b - a, abs(x - a) + 1 + abs(y - b))" ]
false
0.04136
0.041559
0.995203
[ "s171744720", "s743081143" ]
u581187895
p02984
python
s732332647
s618990591
129
90
14,092
20,564
Accepted
Accepted
30.23
N = int(eval(input())) A = list(map(int, input().split())) X = [0]*N # 全体の和 - 偶数の和*2 = 一番目の値 # もしくは、(x/2)+(y/2)=A, ..B,..C -> x+y+z = A+B+C X[0] = sum(A) - sum(A[1::2])*2 #最初の値から順番にダムの値を引けば答え for i in range(1, N): X[i] = A[i-1]*2 - X[i-1] print((*X))
def resolve(): N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N ans[0] = sum(A) for i in range(1, N, 2): ans[0] -= 2 * A[i] for i in range(N - 1): ans[i + 1] = 2 * A[i] - ans[i] print((*ans)) if __name__ == "__main__": reso...
13
19
263
317
N = int(eval(input())) A = list(map(int, input().split())) X = [0] * N # 全体の和 - 偶数の和*2 = 一番目の値 # もしくは、(x/2)+(y/2)=A, ..B,..C -> x+y+z = A+B+C X[0] = sum(A) - sum(A[1::2]) * 2 # 最初の値から順番にダムの値を引けば答え for i in range(1, N): X[i] = A[i - 1] * 2 - X[i - 1] print((*X))
def resolve(): N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N ans[0] = sum(A) for i in range(1, N, 2): ans[0] -= 2 * A[i] for i in range(N - 1): ans[i + 1] = 2 * A[i] - ans[i] print((*ans)) if __name__ == "__main__": resolve()
false
31.578947
[ "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "-X = [0] * N", "-# 全体の和 - 偶数の和*2 = 一番目の値", "-# もしくは、(x/2)+(y/2)=A, ..B,..C -> x+y+z = A+B+C", "-X[0] = sum(A) - sum(A[1::2]) * 2", "-# 最初の値から順番にダムの値を引けば答え", "-for i in range(1, N):", "- X[i] = A[i - 1] * 2 - X[i - 1]", "-print(...
false
0.041079
0.045642
0.900025
[ "s732332647", "s618990591" ]
u057109575
p02913
python
s616584156
s901527679
610
502
229,896
79,864
Accepted
Accepted
17.7
N = int(eval(input())) S = eval(input()) res = 0 dp = [[0] * (N + 1) for _ in range(N + 1)] for i in reversed(list(range(N))): for j in reversed(list(range(i + 1, N))): if S[i] == S[j]: dp[i][j] = max(dp[i][j], dp[i + 1][j + 1] + 1) res = max(res, min(dp[i][j], j - i)) ...
N = int(eval(input())) S = eval(input()) def z_algorithm(s): n = len(s) res = [0] * n i = 1 j = 0 while i < n: while i + j < n and s[j] == s[i + j]: j += 1 res[i] = j if j == 0: i += 1 continue ...
12
33
310
637
N = int(eval(input())) S = eval(input()) res = 0 dp = [[0] * (N + 1) for _ in range(N + 1)] for i in reversed(list(range(N))): for j in reversed(list(range(i + 1, N))): if S[i] == S[j]: dp[i][j] = max(dp[i][j], dp[i + 1][j + 1] + 1) res = max(res, min(dp[i][j], j - i)) print(res)
N = int(eval(input())) S = eval(input()) def z_algorithm(s): n = len(s) res = [0] * n i = 1 j = 0 while i < n: while i + j < n and s[j] == s[i + j]: j += 1 res[i] = j if j == 0: i += 1 continue k = 1 while i + k < n and k ...
false
63.636364
[ "-res = 0", "-dp = [[0] * (N + 1) for _ in range(N + 1)]", "-for i in reversed(list(range(N))):", "- for j in reversed(list(range(i + 1, N))):", "- if S[i] == S[j]:", "- dp[i][j] = max(dp[i][j], dp[i + 1][j + 1] + 1)", "- res = max(res, min(dp[i][j], j - i))", "-print(res)"...
false
0.095654
0.041971
2.279012
[ "s616584156", "s901527679" ]
u317493066
p03846
python
s866353275
s489129744
101
86
14,820
14,820
Accepted
Accepted
14.85
# -*- coding:utf-8 -*- from collections import Counter def check(n, a): count = Counter(a) if n % 2 == 1 and (0 not in count or count[0] != 1): return False for i in range(1 + (n % 2), n+1, 2): if i not in count or count[i] !=2: return False return True if __nam...
# -*- coding:utf-8 -*- from collections import Counter def check(n, a): count = Counter(a) if n % 2 == 1 and (0 not in count or count[0] != 1): return False for i in range(1 + (n % 2), n+1, 2): if i not in count or count[i] !=2: return False return True if __nam...
26
21
641
510
# -*- coding:utf-8 -*- from collections import Counter def check(n, a): count = Counter(a) if n % 2 == 1 and (0 not in count or count[0] != 1): return False for i in range(1 + (n % 2), n + 1, 2): if i not in count or count[i] != 2: return False return True if __name__ == ...
# -*- coding:utf-8 -*- from collections import Counter def check(n, a): count = Counter(a) if n % 2 == 1 and (0 not in count or count[0] != 1): return False for i in range(1 + (n % 2), n + 1, 2): if i not in count or count[i] != 2: return False return True if __name__ == ...
false
19.230769
[ "+ m = N // 2", "- if N > 1:", "- c = 2", "- for _ in range((N // 2) - 1):", "- c = c * 2 % (int(1e9) + 7)", "- print(c)", "- else:", "- print((1))", "+ print(((2**m) % (10**9 + 7)))" ]
false
0.051045
0.051088
0.999157
[ "s866353275", "s489129744" ]
u167681750
p02780
python
s198112225
s151948708
209
193
24,036
23,912
Accepted
Accepted
7.66
from collections import deque n, k = list(map(int, input().split())) p = deque(list(map(int, input().split()))) adjacent = deque() for i in range(k): adjacent.append(p.popleft()) ans = sum(adjacent) count = ans while p: pp = p.popleft() count -= adjacent.popleft() count += pp adjac...
from collections import deque n, k = list(map(int, input().split())) p = deque(list(map(int, input().split()))) adjacent = deque() for i in range(k): adjacent.append(p.pop()) ans = sum(adjacent) count = ans while p: pp = p.pop() count -= adjacent.popleft() count += pp adjacent.appe...
19
19
373
365
from collections import deque n, k = list(map(int, input().split())) p = deque(list(map(int, input().split()))) adjacent = deque() for i in range(k): adjacent.append(p.popleft()) ans = sum(adjacent) count = ans while p: pp = p.popleft() count -= adjacent.popleft() count += pp adjacent.append(pp) ...
from collections import deque n, k = list(map(int, input().split())) p = deque(list(map(int, input().split()))) adjacent = deque() for i in range(k): adjacent.append(p.pop()) ans = sum(adjacent) count = ans while p: pp = p.pop() count -= adjacent.popleft() count += pp adjacent.append(pp) ans = ...
false
0
[ "- adjacent.append(p.popleft())", "+ adjacent.append(p.pop())", "- pp = p.popleft()", "+ pp = p.pop()" ]
false
0.03804
0.054908
0.692798
[ "s198112225", "s151948708" ]
u716530146
p03033
python
s294620833
s820889198
1,945
1,789
120,128
120,000
Accepted
Accepted
8.02
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') # inf = float('inf') ;mod = 10**9+7 # mans = inf ;ans = 0 ;count = 0 ;pro = 1 from heapq import heappush,heappop n,q=list(map(int,input().split())) STX=[tuple(map(int,inp...
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect, heapq input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 n,q=list(map(int,input().split())) STX=[tuple(map(int,input().split())) for i in range(n)]...
33
32
818
797
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") # inf = float('inf') ;mod = 10**9+7 # mans = inf ;ans = 0 ;count = 0 ;pro = 1 from heapq import heappush, heappop n, q = list(map(int, input().split())) STX = [tuple(map(int, in...
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect, heapq input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") inf = float("inf") mod = 10**9 + 7 mans = inf ans = 0 count = 0 pro = 1 n, q = list(map(int, input().split())) STX = [tuple(map(int, input().split())) for i in range(n)] D...
false
3.030303
[ "-import sys, math, itertools, collections, bisect", "+import sys, math, itertools, collections, bisect, heapq", "-# inf = float('inf') ;mod = 10**9+7", "-# mans = inf ;ans = 0 ;count = 0 ;pro = 1", "-from heapq import heappush, heappop", "-", "+inf = float(\"inf\")", "+mod = 10**9 + 7", "+mans = in...
false
0.037028
0.037312
0.99241
[ "s294620833", "s820889198" ]
u633068244
p01336
python
s951088646
s486300458
8,820
6,700
4,276
4,268
Accepted
Accepted
24.04
while 1: try: N,M = list(map(int,input().split())) dp = [[0]*(M+1) for i in range(3)] for _ in range(N): name = input() C,V,D,L = list(map(int,input().split())) VDL = [V,D,L] if C > M: continue for i in range(3): dp[i][C] = max(dp[i][C],VDL[i]) for j in range(M): if d...
while 1: try: N,M = list(map(int,input().split())) dp = [[0]*(M+1) for i in range(3)] for _ in range(N): name = input() C,V,D,L = list(map(int,input().split())) VDL = [V,D,L] if C > M: continue for i in range(3): dp[i][C] = max(dp[i][C],VDL[i]) for j in range(M-C+1): ...
19
18
467
450
while 1: try: N, M = list(map(int, input().split())) dp = [[0] * (M + 1) for i in range(3)] for _ in range(N): name = input() C, V, D, L = list(map(int, input().split())) VDL = [V, D, L] if C > M: continue for i in r...
while 1: try: N, M = list(map(int, input().split())) dp = [[0] * (M + 1) for i in range(3)] for _ in range(N): name = input() C, V, D, L = list(map(int, input().split())) VDL = [V, D, L] if C > M: continue for i in r...
false
5.263158
[ "- for j in range(M):", "+ for j in range(M - C + 1):", "- if j + C <= M:", "- dp[i][j + C] = max(dp[i][j + C], dp[i][j] + VDL[i])", "+ dp[i][j + C] = max(dp[i][j + C], dp[i][j] + VDL[i])" ]
false
0.041706
0.045602
0.914562
[ "s951088646", "s486300458" ]
u754022296
p03822
python
s425001416
s299449456
609
326
227,944
112,664
Accepted
Accepted
46.47
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n = int(eval(input())) T = [[] for _ in range(n)] for i in range(1, n): a = int(eval(input())) a -= 1 T[a].append(i) def dfs(v): if not T[v]: return 0 L = [dfs(i)+1 for i in T[v]] L.sort() for i in range(len(T[v]) - 1...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) import heapq n = int(eval(input())) T = [[] for _ in range(n)] for i in range(1, n): a = int(eval(input())) a -= 1 T[a].append(i) def dfs(v): if not T[v]: return 0 L = [] for i in T[v]: heapq.heappush(L, dfs(i)+1...
22
26
388
433
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n = int(eval(input())) T = [[] for _ in range(n)] for i in range(1, n): a = int(eval(input())) a -= 1 T[a].append(i) def dfs(v): if not T[v]: return 0 L = [dfs(i) + 1 for i in T[v]] L.sort() for i in range(len(T[v]...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) import heapq n = int(eval(input())) T = [[] for _ in range(n)] for i in range(1, n): a = int(eval(input())) a -= 1 T[a].append(i) def dfs(v): if not T[v]: return 0 L = [] for i in T[v]: heapq.heappush(L, dfs(i...
false
15.384615
[ "+import heapq", "+", "- L = [dfs(i) + 1 for i in T[v]]", "- L.sort()", "- for i in range(len(T[v]) - 1):", "- L[i + 1] = max(L[i] + 1, L[i + 1])", "- return L[-1]", "+ L = []", "+ for i in T[v]:", "+ heapq.heappush(L, dfs(i) + 1)", "+ temp = heapq.heappop(L)",...
false
0.038136
0.037699
1.0116
[ "s425001416", "s299449456" ]
u020390084
p03379
python
s401405833
s356044642
412
302
27,180
30,844
Accepted
Accepted
26.7
import statistics n = int(eval(input())) x = list(map(int,input().split())) median_left = statistics.median_low(x) median_right = statistics.median_high(x) for i in range(n): if x[i] >= median_right: print(median_left) else: print(median_right)
#!/usr/bin/env python3 import sys def solve(N: int, X: "List[int]"): Y = sorted(X) me1 = Y[N//2] me2 = Y[N//2-1] for i in range(N): if X[i]<=me2: print(me1) elif X[i]>=me1: print(me2) return def main(): def iterate_tokens(): ...
14
30
269
611
import statistics n = int(eval(input())) x = list(map(int, input().split())) median_left = statistics.median_low(x) median_right = statistics.median_high(x) for i in range(n): if x[i] >= median_right: print(median_left) else: print(median_right)
#!/usr/bin/env python3 import sys def solve(N: int, X: "List[int]"): Y = sorted(X) me1 = Y[N // 2] me2 = Y[N // 2 - 1] for i in range(N): if X[i] <= me2: print(me1) elif X[i] >= me1: print(me2) return def main(): def iterate_tokens(): for line ...
false
53.333333
[ "-import statistics", "+#!/usr/bin/env python3", "+import sys", "-n = int(eval(input()))", "-x = list(map(int, input().split()))", "-median_left = statistics.median_low(x)", "-median_right = statistics.median_high(x)", "-for i in range(n):", "- if x[i] >= median_right:", "- print(median_...
false
0.169341
0.083066
2.03864
[ "s401405833", "s356044642" ]
u156815136
p03059
python
s337749265
s412113381
35
21
5,048
3,444
Accepted
Accepted
40
import itertools import fractions def main(): a,b,t = list(map(int,input().split())) print((b * (t//a))) if __name__ == '__main__': main()
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] #from fractions import gcd #from itertools import combinations # (string,3) 3回 #from collections import deque from collections import defaultdict #import bisect # # d = m - k...
8
37
146
782
import itertools import fractions def main(): a, b, t = list(map(int, input().split())) print((b * (t // a))) if __name__ == "__main__": main()
# from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] # from fractions import gcd # from itertools import combinations # (string,3) 3回 # from collections import deque from collections import defaultdict # import bisect # # d = m - k[...
false
78.378378
[ "-import itertools", "-import fractions", "+# from statistics import median", "+# import collections", "+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]", "+# from fractions import gcd", "+# from itertools import combinations # (string,3) 3回", "+# from collections i...
false
0.036778
0.039306
0.935693
[ "s337749265", "s412113381" ]
u982896977
p03317
python
s771566221
s718607539
40
17
13,880
3,060
Accepted
Accepted
57.5
n,k = list(map(int,input().split())) a_ = list(map(int,input().split())) if (n-1)%(k-1) == 0: print(((n-1)//(k-1))) else: print(((n-1)//(k-1)+1))
n,k = list(map(int,input().split())) A = n-1 B = k-1 print(((A+(B-1))//B))
6
4
148
69
n, k = list(map(int, input().split())) a_ = list(map(int, input().split())) if (n - 1) % (k - 1) == 0: print(((n - 1) // (k - 1))) else: print(((n - 1) // (k - 1) + 1))
n, k = list(map(int, input().split())) A = n - 1 B = k - 1 print(((A + (B - 1)) // B))
false
33.333333
[ "-a_ = list(map(int, input().split()))", "-if (n - 1) % (k - 1) == 0:", "- print(((n - 1) // (k - 1)))", "-else:", "- print(((n - 1) // (k - 1) + 1))", "+A = n - 1", "+B = k - 1", "+print(((A + (B - 1)) // B))" ]
false
0.041871
0.042133
0.993794
[ "s771566221", "s718607539" ]
u371385198
p03607
python
s748093252
s507385887
165
74
20,664
20,732
Accepted
Accepted
55.15
from collections import Counter N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] c = Counter(A) print((sum(tuple([x % 2 for x in list(c.values())]))))
import sys from collections import Counter input = sys.stdin.readline N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] c = Counter(A) print((sum([x % 2 for x in list(c.values())])))
5
7
156
189
from collections import Counter N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] c = Counter(A) print((sum(tuple([x % 2 for x in list(c.values())]))))
import sys from collections import Counter input = sys.stdin.readline N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] c = Counter(A) print((sum([x % 2 for x in list(c.values())])))
false
28.571429
[ "+import sys", "+input = sys.stdin.readline", "-print((sum(tuple([x % 2 for x in list(c.values())]))))", "+print((sum([x % 2 for x in list(c.values())])))" ]
false
0.046071
0.039012
1.18095
[ "s748093252", "s507385887" ]
u002459665
p02712
python
s938695822
s856326021
186
150
9,108
9,168
Accepted
Accepted
19.35
N = int(eval(input())) ans = 0 for i in range(1, N+1): if i % 3 == 0 and i % 5 == 0: pass elif i % 3 == 0: pass elif i % 5 == 0: pass else: ans += i print(ans)
N = int(eval(input())) ans = 0 for i in range(1, N+1): if i % 3 != 0 and i % 5 != 0: ans += i print(ans)
15
9
218
121
N = int(eval(input())) ans = 0 for i in range(1, N + 1): if i % 3 == 0 and i % 5 == 0: pass elif i % 3 == 0: pass elif i % 5 == 0: pass else: ans += i print(ans)
N = int(eval(input())) ans = 0 for i in range(1, N + 1): if i % 3 != 0 and i % 5 != 0: ans += i print(ans)
false
40
[ "- if i % 3 == 0 and i % 5 == 0:", "- pass", "- elif i % 3 == 0:", "- pass", "- elif i % 5 == 0:", "- pass", "- else:", "+ if i % 3 != 0 and i % 5 != 0:" ]
false
0.369
0.209618
1.760347
[ "s938695822", "s856326021" ]
u039355749
p02629
python
s609284390
s167734733
64
27
61,688
9,032
Accepted
Accepted
57.81
def num2alpha(num): if num<=26: return chr(64+num) elif num%26==0: return num2alpha(num//26-1)+chr(90) else: return num2alpha(num//26)+chr(64+num%26) n = int(eval(input())) print((num2alpha(n).lower()))
n = int(eval(input())) def num2alpha(num): if num<=26: return chr(64+num) elif num%26==0: return num2alpha(num//26-1)+chr(90) else: return num2alpha(num//26)+chr(64+num%26) print((num2alpha(n).lower()))
11
11
242
248
def num2alpha(num): if num <= 26: return chr(64 + num) elif num % 26 == 0: return num2alpha(num // 26 - 1) + chr(90) else: return num2alpha(num // 26) + chr(64 + num % 26) n = int(eval(input())) print((num2alpha(n).lower()))
n = int(eval(input())) def num2alpha(num): if num <= 26: return chr(64 + num) elif num % 26 == 0: return num2alpha(num // 26 - 1) + chr(90) else: return num2alpha(num // 26) + chr(64 + num % 26) print((num2alpha(n).lower()))
false
0
[ "+n = int(eval(input()))", "+", "+", "-n = int(eval(input()))" ]
false
0.046128
0.046312
0.996025
[ "s609284390", "s167734733" ]
u345966487
p02762
python
s471896060
s388123958
1,914
1,637
124,504
123,864
Accepted
Accepted
14.47
from collections import defaultdict N, M, K = list(map(int, input().split())) friends = defaultdict(list) blocked = defaultdict(list) for i in range(M): a, b = list(map(int, input().split())) friends[a - 1].append(b - 1) friends[b - 1].append(a - 1) for j in range(K): c, d = list(map(int, i...
from collections import defaultdict N, M, K = list(map(int, input().split())) friends = defaultdict(list) blocked = defaultdict(list) for i in range(M): a, b = list(map(int, input().split())) friends[a - 1].append(b - 1) friends[b - 1].append(a - 1) for j in range(K): c, d = list(map(int, i...
38
84
927
2,173
from collections import defaultdict N, M, K = list(map(int, input().split())) friends = defaultdict(list) blocked = defaultdict(list) for i in range(M): a, b = list(map(int, input().split())) friends[a - 1].append(b - 1) friends[b - 1].append(a - 1) for j in range(K): c, d = list(map(int, input().split...
from collections import defaultdict N, M, K = list(map(int, input().split())) friends = defaultdict(list) blocked = defaultdict(list) for i in range(M): a, b = list(map(int, input().split())) friends[a - 1].append(b - 1) friends[b - 1].append(a - 1) for j in range(K): c, d = list(map(int, input().split...
false
54.761905
[ "-groups = {}", "+", "+", "+class UnionFind:", "+ def __init__(self, n):", "+ # total number of nodes.", "+ self.n = n", "+ # node id -> root node id", "+ self._root_table = list(range(n))", "+ # root node id -> group size", "+ self._size_table = [1] ...
false
0.049225
0.070832
0.694955
[ "s471896060", "s388123958" ]
u796942881
p03290
python
s834498929
s474190365
44
21
3,064
3,064
Accepted
Accepted
52.27
INF = 1000000007 D, G = list(map(int, input().split())) p = [] c = [] for i in range(D): pi, ci = list(map(int, input().split())) p.append(pi) c.append(ci) def main(): ans = INF # 2 ** D - 1 まで for b in range(2 ** D): num = 0 pnt = 0 # コンプリートしな...
import math INF = 1000000007 D, G = list(map(int, input().split())) p = [] c = [] for i in range(D): pi, ci = list(map(int, input().split())) p.append(pi) c.append(ci) def main(): ans = INF # 2 ** D - 1 まで for b in range(2 ** D): num = 0 pnt = 0 ...
63
51
1,071
958
INF = 1000000007 D, G = list(map(int, input().split())) p = [] c = [] for i in range(D): pi, ci = list(map(int, input().split())) p.append(pi) c.append(ci) def main(): ans = INF # 2 ** D - 1 まで for b in range(2**D): num = 0 pnt = 0 # コンプリートしない MAX x = None ...
import math INF = 1000000007 D, G = list(map(int, input().split())) p = [] c = [] for i in range(D): pi, ci = list(map(int, input().split())) p.append(pi) c.append(ci) def main(): ans = INF # 2 ** D - 1 まで for b in range(2**D): num = 0 pnt = 0 # コンプリートしない MAX x...
false
19.047619
[ "+import math", "+", "+ # i 番目 の フラグ が 立っている", "- if x is None:", "+ # または 既に 目標の 総合スコア に到達", "+ if x is None or G <= pnt:", "- continue", "- flg = True", "- for i in range(p[x]):", "- if G <= pnt:", "- break", ...
false
0.042563
0.102327
0.415951
[ "s834498929", "s474190365" ]
u038408819
p03761
python
s214333312
s582026865
24
22
3,064
3,060
Accepted
Accepted
8.33
N = int(eval(input())) s_cnt = [] for i in range(N): cnt = {} s = eval(input()) for si in s: if si in cnt: cnt[si] += 1 else: cnt[si] = 1 s_cnt.append(cnt) min_ = {} for i in s_cnt: for j in i: if any([j not in s_cnt[k] for k in range(N)]...
N = int(eval(input())) s = [eval(input()) for i in range(N)] alpha = "abcdefghijklmnopqrstuvwxyz" ans = '' for i in alpha: min_ = float('Inf') for sj in s: cnt = 0 for elem in sj: if elem == i: cnt += 1 min_ = min(min_, cnt) ans += i * min_ pr...
26
14
574
316
N = int(eval(input())) s_cnt = [] for i in range(N): cnt = {} s = eval(input()) for si in s: if si in cnt: cnt[si] += 1 else: cnt[si] = 1 s_cnt.append(cnt) min_ = {} for i in s_cnt: for j in i: if any([j not in s_cnt[k] for k in range(N)]): ...
N = int(eval(input())) s = [eval(input()) for i in range(N)] alpha = "abcdefghijklmnopqrstuvwxyz" ans = "" for i in alpha: min_ = float("Inf") for sj in s: cnt = 0 for elem in sj: if elem == i: cnt += 1 min_ = min(min_, cnt) ans += i * min_ print(ans)
false
46.153846
[ "-s_cnt = []", "-for i in range(N):", "- cnt = {}", "- s = eval(input())", "- for si in s:", "- if si in cnt:", "- cnt[si] += 1", "- else:", "- cnt[si] = 1", "- s_cnt.append(cnt)", "-min_ = {}", "-for i in s_cnt:", "- for j in i:", "- ...
false
0.192935
0.110935
1.739171
[ "s214333312", "s582026865" ]
u609061751
p02679
python
s963961533
s945293761
676
623
183,804
184,016
Accepted
Accepted
7.84
import sys input = sys.stdin.readline mod = 10**9 + 7 n = int(eval(input())) ab = [[int(x) for x in input().split()] for _ in range(n)] from collections import defaultdict, Counter import math double_zero_cnt = 0 # [0, 0]の個数 a_b = [] # a/bを、約分した形で保持(a/gcd(a, b), b/gcd(a, b), 符号) for a, b in ab: if a == ...
import sys input = sys.stdin.readline mod = 10**9 + 7 n = int(eval(input())) ab = [[int(x) for x in input().split()] for _ in range(n)] from collections import defaultdict, Counter import math double_zero_cnt = 0 # [0, 0]の個数 a_b = [] # a/bを、約分した形で保持(a/gcd(a, b), b/gcd(a, b), 符号) for a, b in ab: if a == ...
52
47
1,324
1,327
import sys input = sys.stdin.readline mod = 10**9 + 7 n = int(eval(input())) ab = [[int(x) for x in input().split()] for _ in range(n)] from collections import defaultdict, Counter import math double_zero_cnt = 0 # [0, 0]の個数 a_b = [] # a/bを、約分した形で保持(a/gcd(a, b), b/gcd(a, b), 符号) for a, b in ab: if a == 0 and b ...
import sys input = sys.stdin.readline mod = 10**9 + 7 n = int(eval(input())) ab = [[int(x) for x in input().split()] for _ in range(n)] from collections import defaultdict, Counter import math double_zero_cnt = 0 # [0, 0]の個数 a_b = [] # a/bを、約分した形で保持(a/gcd(a, b), b/gcd(a, b), 符号) for a, b in ab: if a == 0 and b ...
false
9.615385
[ "-used_cnt = double_zero_cnt # 組めないものがあるイワシの個数", "+used_cnt = double_zero_cnt # 組めないものがあるイワシの個数(計算で使用したらカウント)" ]
false
0.047494
0.048107
0.987272
[ "s963961533", "s945293761" ]
u066692421
p03221
python
s790821611
s479025995
818
669
36,020
37,480
Accepted
Accepted
18.22
list1 = input().split() n = int(list1[0]) m = int(list1[1]) pre = [[] for i in range(n)] for j in range(m): data = input().split() p = int(data[0]) y = int(data[1]) pre[p - 1].append((j, y)) inums = [0 for z in range(m)] for k in range(n): if len(pre[k]) == 0: pass else:...
n, m = map(int, input().split()) pre = [[] for i in range(n)] for j in range(m): p, y = map(int, input().split()) pre[p - 1].append((y, j)) inums = [0] * m for k in range(n): if len(pre[k]) == 0: pass else: sorted_y = sorted(pre[k]) for l in range(len(sorted_y)): ...
24
19
580
468
list1 = input().split() n = int(list1[0]) m = int(list1[1]) pre = [[] for i in range(n)] for j in range(m): data = input().split() p = int(data[0]) y = int(data[1]) pre[p - 1].append((j, y)) inums = [0 for z in range(m)] for k in range(n): if len(pre[k]) == 0: pass else: sorted_y...
n, m = map(int, input().split()) pre = [[] for i in range(n)] for j in range(m): p, y = map(int, input().split()) pre[p - 1].append((y, j)) inums = [0] * m for k in range(n): if len(pre[k]) == 0: pass else: sorted_y = sorted(pre[k]) for l in range(len(sorted_y)): s1 =...
false
20.833333
[ "-list1 = input().split()", "-n = int(list1[0])", "-m = int(list1[1])", "+n, m = map(int, input().split())", "- data = input().split()", "- p = int(data[0])", "- y = int(data[1])", "- pre[p - 1].append((j, y))", "-inums = [0 for z in range(m)]", "+ p, y = map(int, input().split())",...
false
0.037816
0.036073
1.048339
[ "s790821611", "s479025995" ]
u191874006
p03425
python
s600444973
s856045894
508
190
57,432
75,828
Accepted
Accepted
62.6
#!/usr/bin/env python3 #ABC89 C import math n = int(eval(input())) s = [eval(input()) for _ in range(n)] m,a,r,c,h = 0,0,0,0,0 for i in s: if i[0] == 'M':m += 1 elif i[0] == 'A':a+= 1 elif i[0] == 'R':r += 1 elif i[0] == 'C':c += 1 elif i[0] == 'H':h += 1 ans = m*a*r + m*a*c + m*...
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from...
18
45
380
1,065
#!/usr/bin/env python3 # ABC89 C import math n = int(eval(input())) s = [eval(input()) for _ in range(n)] m, a, r, c, h = 0, 0, 0, 0, 0 for i in s: if i[0] == "M": m += 1 elif i[0] == "A": a += 1 elif i[0] == "R": r += 1 elif i[0] == "C": c += 1 elif i[0] == "H": ...
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop, heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collectio...
false
60
[ "-# ABC89 C", "+import sys", "+from bisect import bisect_right as br", "+from bisect import bisect_left as bl", "-n = int(eval(input()))", "-s = [eval(input()) for _ in range(n)]", "-m, a, r, c, h = 0, 0, 0, 0, 0", "-for i in s:", "- if i[0] == \"M\":", "- m += 1", "- elif i[0] == \...
false
0.04497
0.043808
1.026528
[ "s600444973", "s856045894" ]
u013202780
p02552
python
s010307306
s537823514
29
26
9,016
9,148
Accepted
Accepted
10.34
print((0 if int(eval(input()))==1 else 1))
print((int(eval(input()))^1))
1
1
34
21
print((0 if int(eval(input())) == 1 else 1))
print((int(eval(input())) ^ 1))
false
0
[ "-print((0 if int(eval(input())) == 1 else 1))", "+print((int(eval(input())) ^ 1))" ]
false
0.040191
0.068184
0.589449
[ "s010307306", "s537823514" ]
u189487046
p03240
python
s549603690
s007045774
910
29
3,188
3,064
Accepted
Accepted
96.81
import sys def input(): return sys.stdin.readline()[:-1] N = int(eval(input())) P = [] for _ in range(N): x, y, h = list(map(int, input().split())) P.append([x, y, h]) for i in range(N): x, y, h = P[i] for cx in range(101): for cy in range(101): H = h + abs(...
import sys def input(): return sys.stdin.readline()[:-1] N = int(eval(input())) P = [] for _ in range(N): x, y, h = list(map(int, input().split())) P.append([x, y, h]) if h != 0: tx, ty, th = x, y, h for cx in range(101): for cy in range(101): H = th + abs(tx-...
21
22
471
458
import sys def input(): return sys.stdin.readline()[:-1] N = int(eval(input())) P = [] for _ in range(N): x, y, h = list(map(int, input().split())) P.append([x, y, h]) for i in range(N): x, y, h = P[i] for cx in range(101): for cy in range(101): H = h + abs(x - cx) + abs(y - ...
import sys def input(): return sys.stdin.readline()[:-1] N = int(eval(input())) P = [] for _ in range(N): x, y, h = list(map(int, input().split())) P.append([x, y, h]) if h != 0: tx, ty, th = x, y, h for cx in range(101): for cy in range(101): H = th + abs(tx - cx) + abs(ty - cy)...
false
4.545455
[ "-for i in range(N):", "- x, y, h = P[i]", "- for cx in range(101):", "- for cy in range(101):", "- H = h + abs(x - cx) + abs(y - cy)", "- if all(h == max(H - abs(x - cx) - abs(y - cy), 0) for x, y, h in P):", "- print((cx, cy, H))", "- ...
false
0.10988
0.037373
2.940079
[ "s549603690", "s007045774" ]
u811841526
p02406
python
s117655273
s846718965
50
20
8,204
5,884
Accepted
Accepted
60
n = int(input()) for i in range(1,n+1): x = i if x % 3 == 0: print('', i, end='') else: while True: if x % 10 == 3: print('', i, end='') break x //= 10 if x == 0: break print()
n = int(input()) for i in range(1, n+1): if i % 3 == 0 or '3' in str(i): print(f' {i}', end='') print()
14
5
298
120
n = int(input()) for i in range(1, n + 1): x = i if x % 3 == 0: print("", i, end="") else: while True: if x % 10 == 3: print("", i, end="") break x //= 10 if x == 0: break print()
n = int(input()) for i in range(1, n + 1): if i % 3 == 0 or "3" in str(i): print(f" {i}", end="") print()
false
64.285714
[ "- x = i", "- if x % 3 == 0:", "- print(\"\", i, end=\"\")", "- else:", "- while True:", "- if x % 10 == 3:", "- print(\"\", i, end=\"\")", "- break", "- x //= 10", "- if x == 0:", "- break", "...
false
0.038838
0.038705
1.003438
[ "s117655273", "s846718965" ]
u073852194
p02889
python
s540827237
s975947116
1,662
1,315
125,148
67,164
Accepted
Accepted
20.88
def main(): import sys input = sys.stdin.readline n,m,l = list(map(int,input().split())) Edge = [list(map(int,input().split())) for i in range(m)] q = int(eval(input())) Query = [list(map(int,input().split())) for i in range(q)] D2 = [[float("inf") for i in range(n)] for i in ra...
import sys input = sys.stdin.readline class Graph(): #non-directed def __init__(self, n, edge): self.n = n self.graph = [[] for _ in range(n)] for e in edge: self.graph[e[0] - 1].append((e[1] - 1, e[2])) self.graph[e[1] - 1].append((e[0] - 1, e[2])) ...
47
56
1,334
1,573
def main(): import sys input = sys.stdin.readline n, m, l = list(map(int, input().split())) Edge = [list(map(int, input().split())) for i in range(m)] q = int(eval(input())) Query = [list(map(int, input().split())) for i in range(q)] D2 = [[float("inf") for i in range(n)] for i in range(n)]...
import sys input = sys.stdin.readline class Graph: # non-directed def __init__(self, n, edge): self.n = n self.graph = [[] for _ in range(n)] for e in edge: self.graph[e[0] - 1].append((e[1] - 1, e[2])) self.graph[e[1] - 1].append((e[0] - 1, e[2])) def warsha...
false
16.071429
[ "-def main():", "- import sys", "+import sys", "- input = sys.stdin.readline", "- n, m, l = list(map(int, input().split()))", "- Edge = [list(map(int, input().split())) for i in range(m)]", "- q = int(eval(input()))", "- Query = [list(map(int, input().split())) for i in range(q)]", ...
false
0.079883
0.070995
1.125194
[ "s540827237", "s975947116" ]
u977389981
p03779
python
s972921568
s368339917
29
25
2,940
2,940
Accepted
Accepted
13.79
x = int(eval(input())) time = 0 leap = 0 while leap < x: time += 1 leap += time print(time)
x = int(eval(input())) acc = 0 for i in range(1, x + 1): acc += i if acc >= x: print(i) break
7
8
99
119
x = int(eval(input())) time = 0 leap = 0 while leap < x: time += 1 leap += time print(time)
x = int(eval(input())) acc = 0 for i in range(1, x + 1): acc += i if acc >= x: print(i) break
false
12.5
[ "-time = 0", "-leap = 0", "-while leap < x:", "- time += 1", "- leap += time", "-print(time)", "+acc = 0", "+for i in range(1, x + 1):", "+ acc += i", "+ if acc >= x:", "+ print(i)", "+ break" ]
false
0.082063
0.086292
0.950983
[ "s972921568", "s368339917" ]
u263830634
p03147
python
s603959588
s425396520
23
17
3,064
3,064
Accepted
Accepted
26.09
N = int(eval(input())) lst = list(map(int, input().split())) count = 0 #水をやる回数 def water(i, j): #lst[i:j]に水をやるとする count = 0 #print ('A') #print ('lst', lst[i:j]) #print ('i, j=', i, j) if i == j or lst[i:j] == [0]: #print ('X') return 0 elif min(lst[i:j]) == 0: #ls...
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 9) MOD = 10 ** 9 + 7 N = int(eval(input())) H = list(map(int, input().split())) if N == 1: print((H[0])) exit() ans = 00 i = 1 for i in range(N - 1): if H[i] < H[i + 1]: continue else: ans += H[i] - H[...
28
22
693
351
N = int(eval(input())) lst = list(map(int, input().split())) count = 0 # 水をやる回数 def water(i, j): # lst[i:j]に水をやるとする count = 0 # print ('A') # print ('lst', lst[i:j]) # print ('i, j=', i, j) if i == j or lst[i:j] == [0]: # print ('X') return 0 elif min(lst[i:j]) == 0: # lst[i...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**9) MOD = 10**9 + 7 N = int(eval(input())) H = list(map(int, input().split())) if N == 1: print((H[0])) exit() ans = 00 i = 1 for i in range(N - 1): if H[i] < H[i + 1]: continue else: ans += H[i] - H[i + 1] ans += H[N - 1] p...
false
21.428571
[ "+import sys", "+", "+input = sys.stdin.readline", "+sys.setrecursionlimit(10**9)", "+MOD = 10**9 + 7", "-lst = list(map(int, input().split()))", "-count = 0 # 水をやる回数", "-", "-", "-def water(i, j): # lst[i:j]に水をやるとする", "- count = 0", "- # print ('A')", "- # print ('lst', lst[i:j])...
false
0.035857
0.116722
0.307198
[ "s603959588", "s425396520" ]
u254871849
p03017
python
s098544293
s895402584
27
18
3,572
3,572
Accepted
Accepted
33.33
# 2019-11-22 19:46:21(JST) import sys def main(): n, a, b, c, d = [int(x) for x in sys.stdin.readline().split()] s = '#' + sys.stdin.readline().rstrip() if '##' in s[a+1:c-1] or '##' in s[b+1:d-1]: ans = 'No' else: if c < d: ans = 'Yes' else: ...
# 2019-11-22 19:46:21(JST) import sys def main(): n, a, b, c, d = [int(x) for x in sys.stdin.readline().split()] s = '#' + sys.stdin.readline().rstrip() if '##' in s[a+1:c-1] or '##' in s[b+1:d-1]: ans = 'No' else: if c < d: ans = 'Yes' else: ...
25
27
576
650
# 2019-11-22 19:46:21(JST) import sys def main(): n, a, b, c, d = [int(x) for x in sys.stdin.readline().split()] s = "#" + sys.stdin.readline().rstrip() if "##" in s[a + 1 : c - 1] or "##" in s[b + 1 : d - 1]: ans = "No" else: if c < d: ans = "Yes" else: ...
# 2019-11-22 19:46:21(JST) import sys def main(): n, a, b, c, d = [int(x) for x in sys.stdin.readline().split()] s = "#" + sys.stdin.readline().rstrip() if "##" in s[a + 1 : c - 1] or "##" in s[b + 1 : d - 1]: ans = "No" else: if c < d: ans = "Yes" else: ...
false
7.407407
[ "- for i in range(b, d + 1):", "- if s[i - 1] == s[i] == s[i + 1] == \".\":", "- ans = \"Yes\"", "- break", "+ # for i in range(b, d+1):", "+ # if s[i-1] == s[i] == s[i+1] == '.':", "+ # ans = 'Y...
false
0.052541
0.04716
1.114112
[ "s098544293", "s895402584" ]
u490642448
p02852
python
s047405821
s193255997
250
185
56,604
50,740
Accepted
Accepted
26
n,m = list(map(int,input().split())) s = eval(input()) s_0 = [] for i in range(n+1): if(s[i] == '0'): s_0.append(i) # 二分木 import bisect now = n ans_rev = [] while(now != 0): next_i = bisect.bisect_left(s_0, now-m) next = s_0[next_i] if(now == next): print((-1)) ...
n,m = list(map(int,input().split())) s = eval(input()) now = n ans_rev = [] while(now != 0): for i in range( max(0,now-m),now+1): if(i == now): print((-1)) exit() if(s[i] == '1'): continue ans_rev.append(now - i) now = i br...
23
18
405
353
n, m = list(map(int, input().split())) s = eval(input()) s_0 = [] for i in range(n + 1): if s[i] == "0": s_0.append(i) # 二分木 import bisect now = n ans_rev = [] while now != 0: next_i = bisect.bisect_left(s_0, now - m) next = s_0[next_i] if now == next: print((-1)) exit() ans...
n, m = list(map(int, input().split())) s = eval(input()) now = n ans_rev = [] while now != 0: for i in range(max(0, now - m), now + 1): if i == now: print((-1)) exit() if s[i] == "1": continue ans_rev.append(now - i) now = i break print((" ...
false
21.73913
[ "-s_0 = []", "-for i in range(n + 1):", "- if s[i] == \"0\":", "- s_0.append(i)", "-# 二分木", "-import bisect", "-", "- next_i = bisect.bisect_left(s_0, now - m)", "- next = s_0[next_i]", "- if now == next:", "- print((-1))", "- exit()", "- ans_rev.append(no...
false
0.033601
0.039527
0.850095
[ "s047405821", "s193255997" ]
u883203948
p03127
python
s191184616
s095610386
142
91
14,252
14,224
Accepted
Accepted
35.92
N = int(eval(input())) data = [int(i) for i in input().split()] i = 0 def euq(x,y): a = max(x,y) b = min(x,y) if a % b == 0: return b else: return euq(b, a % b) while i < N-1: com = euq(data[i],data[i + 1]) data[i+1] = com i += 1 print(com)
n = int(eval(input())) data = [int(s) for s in input().split()] def gcd(a,b): if b == 0: return a else: return gcd(b,a%b) x = gcd(data[0], data[1]) for i in range(2,n-1): x = gcd(x,data[i]) print(x)
23
14
294
237
N = int(eval(input())) data = [int(i) for i in input().split()] i = 0 def euq(x, y): a = max(x, y) b = min(x, y) if a % b == 0: return b else: return euq(b, a % b) while i < N - 1: com = euq(data[i], data[i + 1]) data[i + 1] = com i += 1 print(com)
n = int(eval(input())) data = [int(s) for s in input().split()] def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) x = gcd(data[0], data[1]) for i in range(2, n - 1): x = gcd(x, data[i]) print(x)
false
39.130435
[ "-N = int(eval(input()))", "-data = [int(i) for i in input().split()]", "-i = 0", "+n = int(eval(input()))", "+data = [int(s) for s in input().split()]", "-def euq(x, y):", "- a = max(x, y)", "- b = min(x, y)", "- if a % b == 0:", "- return b", "+def gcd(a, b):", "+ if b == ...
false
0.069266
0.043383
1.596608
[ "s191184616", "s095610386" ]
u379142263
p02887
python
s012233680
s888121986
116
51
3,956
3,956
Accepted
Accepted
56.03
n = int(eval(input())) s = eval(input()) ans = [] i = 0 while i != n: cnt = 1 for j in range(i+1,n): if s[i] == s[j]: cnt+=1 else: break ans.append(s[i]) if cnt>=2: i+=cnt else: i+=1 print((len(ans)))
n = int(eval(input())) s = eval(input()) ans = [s[0]] for i in range(n-1): if s[i]!= s[i+1]: ans.append(s[i+1]) print((len(ans)))
20
7
292
133
n = int(eval(input())) s = eval(input()) ans = [] i = 0 while i != n: cnt = 1 for j in range(i + 1, n): if s[i] == s[j]: cnt += 1 else: break ans.append(s[i]) if cnt >= 2: i += cnt else: i += 1 print((len(ans)))
n = int(eval(input())) s = eval(input()) ans = [s[0]] for i in range(n - 1): if s[i] != s[i + 1]: ans.append(s[i + 1]) print((len(ans)))
false
65
[ "-ans = []", "-i = 0", "-while i != n:", "- cnt = 1", "- for j in range(i + 1, n):", "- if s[i] == s[j]:", "- cnt += 1", "- else:", "- break", "- ans.append(s[i])", "- if cnt >= 2:", "- i += cnt", "- else:", "- i += 1", "+a...
false
0.05025
0.049725
1.010562
[ "s012233680", "s888121986" ]
u287341833
p03013
python
s859865263
s714380906
323
178
16,288
13,216
Accepted
Accepted
44.89
import sys import numpy as np MOD = 1000000007 def main(): n, m = [int(x) for x in input().split()] pattern = [1] broken = -1 brokencnt = 0 if brokencnt < m: broken = int(eval(input())) brokencnt += 1 for i in range(1, n + 1): if i == broken: patt...
# -*- coding: utf-8 -*- """ Created on Wed Jun 19 17:29:01 2019 @author: makigon """ mod = 10 ** 9 + 7 N, M = list(map(int, input().split())) a = [int(eval(input())) for i in range(M)] aset = set(a) f = [0 for i in range(N)] f[0] = 1 if 1 in a and N>=2 : f[1] = 0 elif 1 not in a and N>=2: f[1]...
24
31
634
525
import sys import numpy as np MOD = 1000000007 def main(): n, m = [int(x) for x in input().split()] pattern = [1] broken = -1 brokencnt = 0 if brokencnt < m: broken = int(eval(input())) brokencnt += 1 for i in range(1, n + 1): if i == broken: pattern.append...
# -*- coding: utf-8 -*- """ Created on Wed Jun 19 17:29:01 2019 @author: makigon """ mod = 10**9 + 7 N, M = list(map(int, input().split())) a = [int(eval(input())) for i in range(M)] aset = set(a) f = [0 for i in range(N)] f[0] = 1 if 1 in a and N >= 2: f[1] = 0 elif 1 not in a and N >= 2: f[1] = 1 for i in ran...
false
22.580645
[ "-import sys", "-import numpy as np", "-", "-MOD = 1000000007", "-", "-", "-def main():", "- n, m = [int(x) for x in input().split()]", "- pattern = [1]", "- broken = -1", "- brokencnt = 0", "- if brokencnt < m:", "- broken = int(eval(input()))", "- brokencnt +...
false
0.078995
0.058462
1.351214
[ "s859865263", "s714380906" ]
u674588203
p02582
python
s743810805
s570491149
31
27
8,948
8,908
Accepted
Accepted
12.9
# AtCoder Beginner Contest 175 # A - Rainy Season S=eval(input()) if S=="RRR": print((3)) exit() if S=="SRR" or S=="RRS": print((2)) exit() if S=="SSS": print((0)) exit() else: print((1))
# AtCoder Beginner Contest 175 # A - Rainy Season S=eval(input()) ans=0 for i in range (len(S)): if S[i]=="R": tempans=1 for j in range (i+1,len(S)): if S[i]==S[j]: tempans+=1 else: if tempans>ans: ans=temp...
15
21
216
425
# AtCoder Beginner Contest 175 # A - Rainy Season S = eval(input()) if S == "RRR": print((3)) exit() if S == "SRR" or S == "RRS": print((2)) exit() if S == "SSS": print((0)) exit() else: print((1))
# AtCoder Beginner Contest 175 # A - Rainy Season S = eval(input()) ans = 0 for i in range(len(S)): if S[i] == "R": tempans = 1 for j in range(i + 1, len(S)): if S[i] == S[j]: tempans += 1 else: if tempans > ans: ans = tempa...
false
28.571429
[ "-if S == \"RRR\":", "- print((3))", "- exit()", "-if S == \"SRR\" or S == \"RRS\":", "- print((2))", "- exit()", "-if S == \"SSS\":", "- print((0))", "- exit()", "-else:", "- print((1))", "+ans = 0", "+for i in range(len(S)):", "+ if S[i] == \"R\":", "+ te...
false
0.102831
0.043477
2.365176
[ "s743810805", "s570491149" ]
u489959379
p03457
python
s169590746
s500441227
378
220
27,300
27,312
Accepted
Accepted
41.8
n = int(eval(input())) txy = [list(map(int, input().split())) for _ in range(n)] flg = False for i in range(n): t, x, y = txy[i] if x + y > t: flg = False break if (x + y) % 2 == 0: if t % 2 == 0: flg = True else: flg = False ...
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n = int(eval(input())) XY = [list(map(int, input().split())) for _ in range(n)] px, py, pt = 0, 0, 0 for i in range(n): t, x, y = XY[i] if abs(x - p...
26
28
491
639
n = int(eval(input())) txy = [list(map(int, input().split())) for _ in range(n)] flg = False for i in range(n): t, x, y = txy[i] if x + y > t: flg = False break if (x + y) % 2 == 0: if t % 2 == 0: flg = True else: flg = False break else...
import sys sys.setrecursionlimit(10**7) input = sys.stdin.readline f_inf = float("inf") mod = 10**9 + 7 def resolve(): n = int(eval(input())) XY = [list(map(int, input().split())) for _ in range(n)] px, py, pt = 0, 0, 0 for i in range(n): t, x, y = XY[i] if abs(x - px) + abs(y - py) >...
false
7.142857
[ "-n = int(eval(input()))", "-txy = [list(map(int, input().split())) for _ in range(n)]", "-flg = False", "-for i in range(n):", "- t, x, y = txy[i]", "- if x + y > t:", "- flg = False", "- break", "- if (x + y) % 2 == 0:", "- if t % 2 == 0:", "- flg = Tru...
false
0.037692
0.037565
1.003364
[ "s169590746", "s500441227" ]
u191874006
p04021
python
s710740350
s328952571
367
325
49,756
49,884
Accepted
Accepted
11.44
#!/usr/bin/env python3 #AGC3 C import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000000) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Coun...
#!/usr/bin/env python3 #AGC3 C import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000000) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Coun...
34
33
827
815
#!/usr/bin/env python3 # AGC3 C import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000000) from heapq import heappush, heappop, heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from ...
#!/usr/bin/env python3 # AGC3 C import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000000) from heapq import heappush, heappop, heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from ...
false
2.941176
[ "-lst.sort()" ]
false
0.098884
0.115668
0.854891
[ "s710740350", "s328952571" ]
u604839890
p03254
python
s480054433
s993267671
29
25
9,176
9,124
Accepted
Accepted
13.79
n, x = list(map(int, input().split())) a = sorted(list(map(int, input().split()))) cnt = 0 flag = False for i in a: if i <= x: x -= i cnt += 1 if x == 0: flag = True else: break else: if not flag: cnt -= 1 print(cnt)
n, x = list(map(int, input().split())) a = sorted(list(map(int, input().split()))) cnt = 0 flag = False for i in a: if i <= x: x -= i cnt += 1 if x == 0: break else: break else: cnt -= 1 print(cnt)
17
16
291
263
n, x = list(map(int, input().split())) a = sorted(list(map(int, input().split()))) cnt = 0 flag = False for i in a: if i <= x: x -= i cnt += 1 if x == 0: flag = True else: break else: if not flag: cnt -= 1 print(cnt)
n, x = list(map(int, input().split())) a = sorted(list(map(int, input().split()))) cnt = 0 flag = False for i in a: if i <= x: x -= i cnt += 1 if x == 0: break else: break else: cnt -= 1 print(cnt)
false
5.882353
[ "- flag = True", "+ break", "- if not flag:", "- cnt -= 1", "+ cnt -= 1" ]
false
0.069759
0.036814
1.894879
[ "s480054433", "s993267671" ]
u157379742
p02949
python
s519164742
s015314187
809
744
49,028
47,704
Accepted
Accepted
8.03
import sys sys.setrecursionlimit(10**9) INF = float('inf') def main(): n, m, p = list(map(int,input().split())) es = [] for _ in range(m): e = list(map(int,input().split())) es.append([e[0]-1,e[1]-1,- e[2] + p]) v_cost = [INF]*n v_cost[0] = 0 for v in range(n*2): ...
import sys sys.setrecursionlimit(10**9) INF = float('inf') def main(): n, m, p = list(map(int,input().split())) es = [] for _ in range(m): e = list(map(int,input().split())) es.append([e[0]-1,e[1]-1,- e[2] + p]) v_cost = [INF]*n v_cost[0] = 0 for v in range(n*2): ...
32
32
756
732
import sys sys.setrecursionlimit(10**9) INF = float("inf") def main(): n, m, p = list(map(int, input().split())) es = [] for _ in range(m): e = list(map(int, input().split())) es.append([e[0] - 1, e[1] - 1, -e[2] + p]) v_cost = [INF] * n v_cost[0] = 0 for v in range(n * 2): ...
import sys sys.setrecursionlimit(10**9) INF = float("inf") def main(): n, m, p = list(map(int, input().split())) es = [] for _ in range(m): e = list(map(int, input().split())) es.append([e[0] - 1, e[1] - 1, -e[2] + p]) v_cost = [INF] * n v_cost[0] = 0 for v in range(n * 2): ...
false
0
[ "- if v == n - 1:", "- prev = v_cost[-1]", "+ if v == n - 1:", "+ prev = v_cost[-1]" ]
false
0.045785
0.106994
0.427923
[ "s519164742", "s015314187" ]
u761529120
p03436
python
s527006501
s925332852
205
84
41,072
74,144
Accepted
Accepted
59.02
from collections import deque def main(): H, W = list(map(int, input().split())) S = list(eval(input()) for _ in range(H)) Q = deque([(0, 0)]) d = [[float('inf')] * W for _ in range(H)] d[0][0] = 0 dx = [1,0,-1,0] dy = [0,1,0,-1] while Q: h, w = Q.popleft() ...
from collections import deque def main(): H, W = list(map(int, input().split())) S = [list(eval(input())) for _ in range(H)] Q = deque([]) Q.append([0,0]) dh = [1,0,-1,0] dw = [0,1,0,-1] d = [[float('inf')] * W for _ in range(H)] d[0][0] = 0 while Q: h, w = Q.pop...
43
37
933
950
from collections import deque def main(): H, W = list(map(int, input().split())) S = list(eval(input()) for _ in range(H)) Q = deque([(0, 0)]) d = [[float("inf")] * W for _ in range(H)] d[0][0] = 0 dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] while Q: h, w = Q.popleft() if h =...
from collections import deque def main(): H, W = list(map(int, input().split())) S = [list(eval(input())) for _ in range(H)] Q = deque([]) Q.append([0, 0]) dh = [1, 0, -1, 0] dw = [0, 1, 0, -1] d = [[float("inf")] * W for _ in range(H)] d[0][0] = 0 while Q: h, w = Q.popleft...
false
13.953488
[ "- S = list(eval(input()) for _ in range(H))", "- Q = deque([(0, 0)])", "+ S = [list(eval(input())) for _ in range(H)]", "+ Q = deque([])", "+ Q.append([0, 0])", "+ dh = [1, 0, -1, 0]", "+ dw = [0, 1, 0, -1]", "- dx = [1, 0, -1, 0]", "- dy = [0, 1, 0, -1]", "- if ...
false
0.136875
0.136852
1.000169
[ "s527006501", "s925332852" ]
u536034761
p03273
python
s633210096
s485605492
35
30
9,144
9,176
Accepted
Accepted
14.29
H, W = list(map(int, input().split())) L = [] brank = "." * W ban = [] for _ in range(H): s = eval(input()) if brank == s: continue L.append(list(map(str, s))) for i in range(W): for l in L: if l[i] != ".": break else: ban.append(i) continue for l in L: ans = "" ...
H, W = list(map(int, input().split())) L = [] brank = "." * W for _ in range(H): S = eval(input()) if S == brank: continue L.append(list(map(str, S))) if L: L1 = list(zip(*L)) brank = tuple(["." for _ in range(len(L1[0]))]) ans = [] for l in L1: if l == brank: continue ...
25
22
394
372
H, W = list(map(int, input().split())) L = [] brank = "." * W ban = [] for _ in range(H): s = eval(input()) if brank == s: continue L.append(list(map(str, s))) for i in range(W): for l in L: if l[i] != ".": break else: ban.append(i) continue for l in L: ...
H, W = list(map(int, input().split())) L = [] brank = "." * W for _ in range(H): S = eval(input()) if S == brank: continue L.append(list(map(str, S))) if L: L1 = list(zip(*L)) brank = tuple(["." for _ in range(len(L1[0]))]) ans = [] for l in L1: if l == brank: con...
false
12
[ "-ban = []", "- s = eval(input())", "- if brank == s:", "+ S = eval(input())", "+ if S == brank:", "- L.append(list(map(str, s)))", "-for i in range(W):", "- for l in L:", "- if l[i] != \".\":", "- break", "- else:", "- ban.append(i)", "- ...
false
0.039185
0.038633
1.014301
[ "s633210096", "s485605492" ]
u952708174
p03945
python
s453579852
s378562854
43
38
3,188
4,132
Accepted
Accepted
11.63
S = input().strip() stone = S[0] ans = 0 for i in range(1,len(S)): if stone != S[i]: ans += 1 stone = S[i] print(ans)
# ans = len(list(more_itertools.unique_justseen(S))) - 1 # としたいが、more_itertoolsは入っていないみたいなので、 # https://github.com/erikrose/more-itertools/blob/master/more_itertools/recipes.py # にある実装を流用している def c_1d_reversi(S): # 端の同じ色の石は1個の石を置けばひっくり返せる # 連続した石をひとまとめにしたとき、何個の石があるかが解を導く def unique_justseen(itera...
8
19
134
587
S = input().strip() stone = S[0] ans = 0 for i in range(1, len(S)): if stone != S[i]: ans += 1 stone = S[i] print(ans)
# ans = len(list(more_itertools.unique_justseen(S))) - 1 # としたいが、more_itertoolsは入っていないみたいなので、 # https://github.com/erikrose/more-itertools/blob/master/more_itertools/recipes.py # にある実装を流用している def c_1d_reversi(S): # 端の同じ色の石は1個の石を置けばひっくり返せる # 連続した石をひとまとめにしたとき、何個の石があるかが解を導く def unique_justseen(iterable, key=No...
false
57.894737
[ "-S = input().strip()", "-stone = S[0]", "-ans = 0", "-for i in range(1, len(S)):", "- if stone != S[i]:", "- ans += 1", "- stone = S[i]", "-print(ans)", "+# ans = len(list(more_itertools.unique_justseen(S))) - 1", "+# としたいが、more_itertoolsは入っていないみたいなので、", "+# https://github.com/...
false
0.091596
0.082131
1.11524
[ "s453579852", "s378562854" ]
u733774002
p02971
python
s504901278
s535816912
1,032
894
68,568
68,568
Accepted
Accepted
13.37
n = int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) a_max = max(a) ind_M = a.index(a_max) tmpl = a tmpl.pop(ind_M) for i in range(n): if i != ind_M: print(a_max) else: print((max(tmpl)))
def main(): n = int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) a_max = max(a) ind_M = a.index(a_max) tmpl = a tmpl.pop(ind_M) for i in range(n): if i != ind_M: print(a_max) else: print((max(tmpl))) ...
13
18
238
348
n = int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) a_max = max(a) ind_M = a.index(a_max) tmpl = a tmpl.pop(ind_M) for i in range(n): if i != ind_M: print(a_max) else: print((max(tmpl)))
def main(): n = int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) a_max = max(a) ind_M = a.index(a_max) tmpl = a tmpl.pop(ind_M) for i in range(n): if i != ind_M: print(a_max) else: print((max(tmpl))) if __name__ =...
false
27.777778
[ "-n = int(eval(input()))", "-a = []", "-for i in range(n):", "- a.append(int(eval(input())))", "-a_max = max(a)", "-ind_M = a.index(a_max)", "-tmpl = a", "-tmpl.pop(ind_M)", "-for i in range(n):", "- if i != ind_M:", "- print(a_max)", "- else:", "- print((max(tmpl)))",...
false
0.071403
0.083437
0.855771
[ "s504901278", "s535816912" ]
u141610915
p03081
python
s068932133
s059984667
519
351
89,404
120,584
Accepted
Accepted
32.37
import sys input = sys.stdin.readline N, Q = list(map(int, input().split())) s = list(eval(input()))[: -1] t = [] res = 0 for _ in range(Q): u, v = input().split() t.append((u, v)) def check(x): for i in range(Q): u, v = t[i] if s[x] == u: x += (-1) ** (v == "L") if x < 0: ...
import sys input = sys.stdin.readline N, Q = list(map(int, input().split())) S = list(eval(input()))[: -1] qs = [input().split() for _ in range(Q)] def lcheck(x): i = x for t, d in qs: if S[i] == t: if d == "L": i -= 1 else: i += 1 if i in range(N): continue return i < 0 ret...
39
44
626
743
import sys input = sys.stdin.readline N, Q = list(map(int, input().split())) s = list(eval(input()))[:-1] t = [] res = 0 for _ in range(Q): u, v = input().split() t.append((u, v)) def check(x): for i in range(Q): u, v = t[i] if s[x] == u: x += (-1) ** (v == "L") if x <...
import sys input = sys.stdin.readline N, Q = list(map(int, input().split())) S = list(eval(input()))[:-1] qs = [input().split() for _ in range(Q)] def lcheck(x): i = x for t, d in qs: if S[i] == t: if d == "L": i -= 1 else: i += 1 if i i...
false
11.363636
[ "-s = list(eval(input()))[:-1]", "-t = []", "-res = 0", "-for _ in range(Q):", "- u, v = input().split()", "- t.append((u, v))", "+S = list(eval(input()))[:-1]", "+qs = [input().split() for _ in range(Q)]", "-def check(x):", "- for i in range(Q):", "- u, v = t[i]", "- if...
false
0.037368
0.066233
0.564186
[ "s068932133", "s059984667" ]
u327466606
p02579
python
s748833966
s677761869
425
322
89,580
82,392
Accepted
Accepted
24.24
max2 = lambda x,y: x if x > y else y min2 = lambda x,y: x if x < y else y import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline def solve(dist, start, goal): H,W = len(dist),len(dist[0]) q = [start] dist[start[0]][start[1]] = 0 cnt = 0 while q: nq = []...
max2 = lambda x,y: x if x > y else y min2 = lambda x,y: x if x < y else y import sys from itertools import count read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline MOVES = [ ((1, 0), [(2,-1),(2,0),(2,1),(2,2),(1,1)]), ((-1, 0),[(-2,-1),(-2,0),(-2,1),(-2,-2),(-1,-1)]), ((0, 1), ...
47
76
1,362
1,877
max2 = lambda x, y: x if x > y else y min2 = lambda x, y: x if x < y else y import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline def solve(dist, start, goal): H, W = len(dist), len(dist[0]) q = [start] dist[start[0]][start[1]] = 0 cnt = 0 while q: nq = [] w...
max2 = lambda x, y: x if x > y else y min2 = lambda x, y: x if x < y else y import sys from itertools import count read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline MOVES = [ ((1, 0), [(2, -1), (2, 0), (2, 1), (2, 2), (1, 1)]), ((-1, 0), [(-2, -1), (-2, 0), (-2, 1), (-2, -2), (-1, -1)]), ((...
false
38.157895
[ "+from itertools import count", "+MOVES = [", "+ ((1, 0), [(2, -1), (2, 0), (2, 1), (2, 2), (1, 1)]),", "+ ((-1, 0), [(-2, -1), (-2, 0), (-2, 1), (-2, -2), (-1, -1)]),", "+ ((0, 1), [(1, 2), (0, 2), (-1, 2), (-2, 2), (-1, 1)]),", "+ ((0, -1), [(1, -2), (0, -2), (-1, -2), (2, -2), (1, -1)]),", ...
false
0.136052
0.071
1.916216
[ "s748833966", "s677761869" ]
u777283665
p03425
python
s920410253
s200191930
187
144
3,064
4,232
Accepted
Accepted
22.99
from itertools import combinations n = int(eval(input())) d = [0] * 5 for _ in range(n): s = eval(input()) if s[0] == "M": d[0] += 1 if s[0] == "A": d[1] += 1 if s[0] == "R": d[2] += 1 if s[0] == "C": d[3] += 1 if s[0] == "H": d[4] += 1 ...
from itertools import combinations from collections import Counter n = int(eval(input())) s = [input()[0] for _ in range(n)] c =Counter(s) ans = 0 for x, y, z in combinations("MARCH", 3): ans += c[x] * c[y] * c[z] print(ans)
26
12
432
237
from itertools import combinations n = int(eval(input())) d = [0] * 5 for _ in range(n): s = eval(input()) if s[0] == "M": d[0] += 1 if s[0] == "A": d[1] += 1 if s[0] == "R": d[2] += 1 if s[0] == "C": d[3] += 1 if s[0] == "H": d[4] += 1 d = [n for n in d ...
from itertools import combinations from collections import Counter n = int(eval(input())) s = [input()[0] for _ in range(n)] c = Counter(s) ans = 0 for x, y, z in combinations("MARCH", 3): ans += c[x] * c[y] * c[z] print(ans)
false
53.846154
[ "+from collections import Counter", "-d = [0] * 5", "-for _ in range(n):", "- s = eval(input())", "- if s[0] == \"M\":", "- d[0] += 1", "- if s[0] == \"A\":", "- d[1] += 1", "- if s[0] == \"R\":", "- d[2] += 1", "- if s[0] == \"C\":", "- d[3] += 1", ...
false
0.086883
0.073019
1.189871
[ "s920410253", "s200191930" ]
u572142121
p03074
python
s299770914
s604417812
95
82
4,084
7,108
Accepted
Accepted
13.68
N,K=list(map(int,input().split())) S=list(eval(input())) j=0 ans=0 cnt=0 for i in range(N): if S[i]=="0": if i==0 or S[i-1]=="1": cnt+=1 if cnt>K: while S[j]=="1": j+=1 while S[j]=="0": j+=1 cnt-=1 ans=max(ans,i-j+1) print(ans)
N,K=list(map(int,input().split())) S=eval(input()) #Aは0の左端、Bは0の右端 A=[] B=[] for i in range(N-1): if S[i]=='0'and S[i+1]=='1': B.append(i) if S[-1]=='0': B.append(N-1) if S[0]=='0': A.append(0) for i in range(N-1): if S[i]=='1'and S[i+1]=='0': A.append(i+1) if len(A)<=K: print(N) els...
18
27
273
454
N, K = list(map(int, input().split())) S = list(eval(input())) j = 0 ans = 0 cnt = 0 for i in range(N): if S[i] == "0": if i == 0 or S[i - 1] == "1": cnt += 1 if cnt > K: while S[j] == "1": j += 1 while S[j] == "0": j += 1 cnt -= 1 ans = ma...
N, K = list(map(int, input().split())) S = eval(input()) # Aは0の左端、Bは0の右端 A = [] B = [] for i in range(N - 1): if S[i] == "0" and S[i + 1] == "1": B.append(i) if S[-1] == "0": B.append(N - 1) if S[0] == "0": A.append(0) for i in range(N - 1): if S[i] == "1" and S[i + 1] == "0": A.append(i...
false
33.333333
[ "-S = list(eval(input()))", "-j = 0", "-ans = 0", "-cnt = 0", "-for i in range(N):", "- if S[i] == \"0\":", "- if i == 0 or S[i - 1] == \"1\":", "- cnt += 1", "- if cnt > K:", "- while S[j] == \"1\":", "- j += 1", "- while S[j] == \"0\":", "- ...
false
0.082281
0.095459
0.861957
[ "s299770914", "s604417812" ]
u647766105
p02346
python
s548252610
s693959996
2,250
1,920
8,732
8,724
Accepted
Accepted
14.67
class RangeSumQuery(object): def __init__(self, size): self.size = 1 while self.size <= size: self.size *= 2 self.data = [0] * (self.size*2+2) def add(self, idx, value): k = idx + self.size - 1 self.data[k] += value while k > 0: ...
class RangeSumQuery(object): def __init__(self, size): self.size = 1 while self.size <= size: self.size *= 2 self.data = [0] * (self.size*2-1) def add(self, idx, value): k = idx + self.size - 1 self.data[k] += value while k > 0: ...
39
39
1,093
1,087
class RangeSumQuery(object): def __init__(self, size): self.size = 1 while self.size <= size: self.size *= 2 self.data = [0] * (self.size * 2 + 2) def add(self, idx, value): k = idx + self.size - 1 self.data[k] += value while k > 0: k = (k...
class RangeSumQuery(object): def __init__(self, size): self.size = 1 while self.size <= size: self.size *= 2 self.data = [0] * (self.size * 2 - 1) def add(self, idx, value): k = idx + self.size - 1 self.data[k] += value while k > 0: k = (k...
false
0
[ "- self.data = [0] * (self.size * 2 + 2)", "+ self.data = [0] * (self.size * 2 - 1)", "- return sum([vl, vr])", "+ return vl + vr" ]
false
0.056462
0.03634
1.553692
[ "s548252610", "s693959996" ]
u411203878
p03050
python
s949450702
s972618978
205
72
40,172
65,440
Accepted
Accepted
64.88
n=int(eval(input())) ans = 0 for i in range(1,int(n**0.5)+2): if n%i == 0 and n//i>=i+2: ans += (n//i)-1 print(ans)
def prime(p): memo = [p] for i in range(2,(int(p**0.5)+1)): if p%i == 0: memo.append(i) memo.append(p//i) return memo x = int(eval(input())) if x== 1: print((0)) exit() memo = prime(x) ans = 0 for i in memo: if x%(i-1)==x//(i-1): a...
8
22
130
333
n = int(eval(input())) ans = 0 for i in range(1, int(n**0.5) + 2): if n % i == 0 and n // i >= i + 2: ans += (n // i) - 1 print(ans)
def prime(p): memo = [p] for i in range(2, (int(p**0.5) + 1)): if p % i == 0: memo.append(i) memo.append(p // i) return memo x = int(eval(input())) if x == 1: print((0)) exit() memo = prime(x) ans = 0 for i in memo: if x % (i - 1) == x // (i - 1): ans +=...
false
63.636364
[ "-n = int(eval(input()))", "+def prime(p):", "+ memo = [p]", "+ for i in range(2, (int(p**0.5) + 1)):", "+ if p % i == 0:", "+ memo.append(i)", "+ memo.append(p // i)", "+ return memo", "+", "+", "+x = int(eval(input()))", "+if x == 1:", "+ print((0))...
false
0.768454
0.39484
1.946242
[ "s949450702", "s972618978" ]
u261103969
p02780
python
s454882976
s537344320
124
96
25,188
99,496
Accepted
Accepted
22.58
n, k = [int(i) for i in input().split()] p = [int(i) for i in input().split()] sum_max = sum(p[0:k]) sum_temp = sum_max for i in range(n-k): sum_temp = sum_temp - p[i] + p[i+k] if sum_temp > sum_max: sum_max = sum_temp s_max = (sum_max + k) / 2 print(s_max)
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): N, K = list(map(int, readline().split())) P = [0] + list(map(int, readline().split())) cur = sum(P[:K]) s_max = 0 for i in range(N - K + 1): cur += P[...
14
25
293
449
n, k = [int(i) for i in input().split()] p = [int(i) for i in input().split()] sum_max = sum(p[0:k]) sum_temp = sum_max for i in range(n - k): sum_temp = sum_temp - p[i] + p[i + k] if sum_temp > sum_max: sum_max = sum_temp s_max = (sum_max + k) / 2 print(s_max)
import sys readline = sys.stdin.readline MOD = 10**9 + 7 INF = float("INF") sys.setrecursionlimit(10**5) def main(): N, K = list(map(int, readline().split())) P = [0] + list(map(int, readline().split())) cur = sum(P[:K]) s_max = 0 for i in range(N - K + 1): cur += P[K + i] cur -= ...
false
44
[ "-n, k = [int(i) for i in input().split()]", "-p = [int(i) for i in input().split()]", "-sum_max = sum(p[0:k])", "-sum_temp = sum_max", "-for i in range(n - k):", "- sum_temp = sum_temp - p[i] + p[i + k]", "- if sum_temp > sum_max:", "- sum_max = sum_temp", "-s_max = (sum_max + k) / 2",...
false
0.042719
0.040026
1.067273
[ "s454882976", "s537344320" ]
u202634017
p02695
python
s251652752
s477734950
256
214
90,644
88,988
Accepted
Accepted
16.41
n, m, q = list(map(int, input().split())) plist = [] for _ in range(q): plist.append(list(map(int, input().split()))) alist = [] def bfs(depth: int, l: list): global n, m, alist if depth == n: alist.append(l[1:]) return c = l[depth] cl = l.copy() cl.append(c) ...
n, m, q = list(map(int, input().split())) plist = [] for _ in range(q): plist.append(list(map(int, input().split()))) alist = [] def bfs(depth: int, l: list): global n, m, alist if depth == n: alist.append(l[1:]) return c = l[depth] cl = l.copy() cl.append(c) ...
34
34
651
637
n, m, q = list(map(int, input().split())) plist = [] for _ in range(q): plist.append(list(map(int, input().split()))) alist = [] def bfs(depth: int, l: list): global n, m, alist if depth == n: alist.append(l[1:]) return c = l[depth] cl = l.copy() cl.append(c) bfs(depth + 1,...
n, m, q = list(map(int, input().split())) plist = [] for _ in range(q): plist.append(list(map(int, input().split()))) alist = [] def bfs(depth: int, l: list): global n, m, alist if depth == n: alist.append(l[1:]) return c = l[depth] cl = l.copy() cl.append(c) bfs(depth + 1,...
false
0
[ "- bfs(depth + 1, cl.copy())", "+ bfs(depth + 1, cl)", "- bfs(depth + 1, cl.copy())", "+ bfs(depth + 1, cl)" ]
false
0.089243
0.251024
0.355514
[ "s251652752", "s477734950" ]
u633068244
p02269
python
s739563934
s186274424
4,020
3,690
271,868
124,308
Accepted
Accepted
8.21
dict = {"A":1,"C":2,"G":3,"T":4} def a2n(a): ans = 0 for i in range(len(a)): ans += dict[a[i]]*4**i return ans n = int(input()) ls = [0 for i in range(6710886)] for i in range(n): inp = input() if inp[0] == "i": ls[a2n(inp[7:])] = 1 else: print("yes" if ls[a2n(inp[5:])] ...
dict = {"A":1,"C":2,"G":3,"T":4} def a2n(a): ans = 0 for i in range(len(a)): ans += dict[a[i]]*4**i return ans n = int(input()) ls = [0 for i in range(3000000)] for i in range(n): inp = input() if inp[0] == "i": ls[a2n(inp[7:])] = 1 else: print("yes" if ls[a2n(inp[5:])] ...
16
16
351
351
dict = {"A": 1, "C": 2, "G": 3, "T": 4} def a2n(a): ans = 0 for i in range(len(a)): ans += dict[a[i]] * 4**i return ans n = int(input()) ls = [0 for i in range(6710886)] for i in range(n): inp = input() if inp[0] == "i": ls[a2n(inp[7:])] = 1 else: print("yes" if ls[a2...
dict = {"A": 1, "C": 2, "G": 3, "T": 4} def a2n(a): ans = 0 for i in range(len(a)): ans += dict[a[i]] * 4**i return ans n = int(input()) ls = [0 for i in range(3000000)] for i in range(n): inp = input() if inp[0] == "i": ls[a2n(inp[7:])] = 1 else: print("yes" if ls[a2...
false
0
[ "-ls = [0 for i in range(6710886)]", "+ls = [0 for i in range(3000000)]" ]
false
0.609721
0.203731
2.992777
[ "s739563934", "s186274424" ]
u600402037
p02842
python
s547924197
s848297764
1,593
18
21,608
3,060
Accepted
Accepted
98.87
import sys import numpy as np sys.setrecursionlimit(10 ** 9) stdin = sys.stdin ri = lambda: int(rs()) rl = lambda: list(map(int, stdin.readline().split())) rs = lambda: stdin.readline().rstrip() # ignore trailing spaces N = ri() x = N // 1.08 bool = True if int(x * 1.08) != N or x < 1: x += 1 ...
import sys import math stdin = sys.stdin ri = lambda: int(rs()) rl = lambda: list(map(int, stdin.readline().split())) rs = lambda: stdin.readline().rstrip() # ignore trailing spaces N = ri() x = math.ceil(N / 1.08) bool = True if math.floor(x * 1.08) != N: bool = False print((int(x) if bool else ...
18
15
400
325
import sys import numpy as np sys.setrecursionlimit(10**9) stdin = sys.stdin ri = lambda: int(rs()) rl = lambda: list(map(int, stdin.readline().split())) rs = lambda: stdin.readline().rstrip() # ignore trailing spaces N = ri() x = N // 1.08 bool = True if int(x * 1.08) != N or x < 1: x += 1 if int(x * 1.08) !...
import sys import math stdin = sys.stdin ri = lambda: int(rs()) rl = lambda: list(map(int, stdin.readline().split())) rs = lambda: stdin.readline().rstrip() # ignore trailing spaces N = ri() x = math.ceil(N / 1.08) bool = True if math.floor(x * 1.08) != N: bool = False print((int(x) if bool else ":("))
false
16.666667
[ "-import numpy as np", "+import math", "-sys.setrecursionlimit(10**9)", "-x = N // 1.08", "+x = math.ceil(N / 1.08)", "-if int(x * 1.08) != N or x < 1:", "- x += 1", "- if int(x * 1.08) != N:", "- bool = False", "+if math.floor(x * 1.08) != N:", "+ bool = False" ]
false
0.065696
0.067306
0.976082
[ "s547924197", "s848297764" ]
u499381410
p03674
python
s468124350
s311795167
406
347
65,440
65,568
Accepted
Accepted
14.53
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, ...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, ...
58
59
1,462
1,520
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fro...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fro...
false
1.694915
[ "-i = 1", "- i = i * j % mod", "- fac[j] = i", "- inv[j] = pow(i, mod - 2, mod)", "+ fac[j] = fac[j - 1] * j % mod", "+inv[n] = pow(fac[n], mod - 2, mod)", "+for j in range(n - 1, -1, -1):", "+ inv[j] = inv[j + 1] * (j + 1) % mod" ]
false
0.047799
0.050114
0.953818
[ "s468124350", "s311795167" ]
u803848678
p03525
python
s490534460
s518707439
186
22
40,304
3,064
Accepted
Accepted
88.17
n = int(eval(input())) a = [0]*13 for i in map(int, input().split()): a[i] += 1 ans = 0 if any(i>2 for i in a) or a[0] or a[12]>1: pass else: s = [[0]] for i in range(1, 13): nxt = [] if a[i] == 0: nxt = s elif a[i] == 1: for si in s: ...
n = int(eval(input())) a = [0]*13 for i in map(int, input().split()): a[i] += 1 ans = 0 if not (any(i>2 for i in a) or a[0] or a[12]>1): s = [[0]] for i in range(1, 13): nxt = [] if a[i] == 0: nxt = s elif a[i] == 1: for si in s: ...
31
29
720
709
n = int(eval(input())) a = [0] * 13 for i in map(int, input().split()): a[i] += 1 ans = 0 if any(i > 2 for i in a) or a[0] or a[12] > 1: pass else: s = [[0]] for i in range(1, 13): nxt = [] if a[i] == 0: nxt = s elif a[i] == 1: for si in s: ...
n = int(eval(input())) a = [0] * 13 for i in map(int, input().split()): a[i] += 1 ans = 0 if not (any(i > 2 for i in a) or a[0] or a[12] > 1): s = [[0]] for i in range(1, 13): nxt = [] if a[i] == 0: nxt = s elif a[i] == 1: for si in s: nxt.appe...
false
6.451613
[ "-if any(i > 2 for i in a) or a[0] or a[12] > 1:", "- pass", "-else:", "+if not (any(i > 2 for i in a) or a[0] or a[12] > 1):" ]
false
0.039069
0.037628
1.0383
[ "s490534460", "s518707439" ]
u185424824
p03779
python
s368696913
s557953746
29
17
2,940
2,940
Accepted
Accepted
41.38
X = int(eval(input())) total = 1 i = 1 while True: if total >= X: print(i) exit() else: i += 1 total += i
import math X = int(eval(input())) ans = (-1 + (1+8*X)**0.5)/2 print((math.ceil(ans)))
12
5
134
83
X = int(eval(input())) total = 1 i = 1 while True: if total >= X: print(i) exit() else: i += 1 total += i
import math X = int(eval(input())) ans = (-1 + (1 + 8 * X) ** 0.5) / 2 print((math.ceil(ans)))
false
58.333333
[ "+import math", "+", "-total = 1", "-i = 1", "-while True:", "- if total >= X:", "- print(i)", "- exit()", "- else:", "- i += 1", "- total += i", "+ans = (-1 + (1 + 8 * X) ** 0.5) / 2", "+print((math.ceil(ans)))" ]
false
0.082589
0.063321
1.304286
[ "s368696913", "s557953746" ]
u842054747
p02640
python
s435885515
s445658662
28
25
9,096
9,148
Accepted
Accepted
10.71
animals_num, legs_num = list(map(int, input().split())) answer = "No" for i in range(animals_num + 1): j = animals_num - i if j * 4 + i * 2 == legs_num: answer = "Yes" print(answer)
x, y = list(map(int, input().split())) answer = "No" for i in range(x + 1): j = x - i if i * 2 + j * 4 == y: answer = "Yes" print(answer)
9
10
194
152
animals_num, legs_num = list(map(int, input().split())) answer = "No" for i in range(animals_num + 1): j = animals_num - i if j * 4 + i * 2 == legs_num: answer = "Yes" print(answer)
x, y = list(map(int, input().split())) answer = "No" for i in range(x + 1): j = x - i if i * 2 + j * 4 == y: answer = "Yes" print(answer)
false
10
[ "-animals_num, legs_num = list(map(int, input().split()))", "+x, y = list(map(int, input().split()))", "-for i in range(animals_num + 1):", "- j = animals_num - i", "- if j * 4 + i * 2 == legs_num:", "+for i in range(x + 1):", "+ j = x - i", "+ if i * 2 + j * 4 == y:" ]
false
0.04742
0.046179
1.026881
[ "s435885515", "s445658662" ]
u889914341
p03111
python
s125247372
s648463458
93
76
3,064
3,064
Accepted
Accepted
18.28
n, *li = list(map(int, input().split())) L = list(map(int, (int(eval(input())) for _ in range(n)))) ans = int(1e9) def f(A, num, cnt): if num == n: if 0 in A: return global ans ans = min(ans, abs(A[0] - li[0]) + abs(A[1] - li[1]) + abs(A[2] - li[2]) + cnt) return...
INF = float("inf") n, A, B, C = list(map(int, input().split())) L = tuple(map(int, (int(eval(input())) for _ in range(n)))) def f(a, b, c, num): if num == n: if min(a, b, c) > 0: return abs(A - a) + abs(B - b) + abs(C - c) else: return INF return min( f(...
18
16
500
529
n, *li = list(map(int, input().split())) L = list(map(int, (int(eval(input())) for _ in range(n)))) ans = int(1e9) def f(A, num, cnt): if num == n: if 0 in A: return global ans ans = min(ans, abs(A[0] - li[0]) + abs(A[1] - li[1]) + abs(A[2] - li[2]) + cnt) return fo...
INF = float("inf") n, A, B, C = list(map(int, input().split())) L = tuple(map(int, (int(eval(input())) for _ in range(n)))) def f(a, b, c, num): if num == n: if min(a, b, c) > 0: return abs(A - a) + abs(B - b) + abs(C - c) else: return INF return min( f(a + L[nu...
false
11.111111
[ "-n, *li = list(map(int, input().split()))", "-L = list(map(int, (int(eval(input())) for _ in range(n))))", "-ans = int(1e9)", "+INF = float(\"inf\")", "+n, A, B, C = list(map(int, input().split()))", "+L = tuple(map(int, (int(eval(input())) for _ in range(n))))", "-def f(A, num, cnt):", "+def f(a, b,...
false
0.070999
0.060171
1.179944
[ "s125247372", "s648463458" ]
u091489347
p03835
python
s280163245
s078249357
1,760
1,374
2,940
2,940
Accepted
Accepted
21.93
k ,s = list(map(int, input().split())) count = 0 for x in range(k+1): for y in range(k +1): if ((x + y) <= s) and ((s - (x + y)) <= k): count += 1 print(count)
k, s = list(map(int,input().split())) count= 0 #全探索は時計が切れる for x in range(k+1): for y in range(k+1): if 0 <= s - (x +y) <= k: count += 1 print(count)
9
9
203
176
k, s = list(map(int, input().split())) count = 0 for x in range(k + 1): for y in range(k + 1): if ((x + y) <= s) and ((s - (x + y)) <= k): count += 1 print(count)
k, s = list(map(int, input().split())) count = 0 # 全探索は時計が切れる for x in range(k + 1): for y in range(k + 1): if 0 <= s - (x + y) <= k: count += 1 print(count)
false
0
[ "+# 全探索は時計が切れる", "- if ((x + y) <= s) and ((s - (x + y)) <= k):", "+ if 0 <= s - (x + y) <= k:" ]
false
0.060895
0.061532
0.989639
[ "s280163245", "s078249357" ]
u482157295
p02694
python
s227243892
s092551059
60
30
64,520
9,144
Accepted
Accepted
50
x = int(eval(input())) dum = 100 count = 0 while(1): if dum >= x: break dum = dum*1.01 dum = dum//1 count += 1 #print(dum) print(count)
import math x = int(eval(input())) a = 100 cnt = 0 while(1): cnt += 1 a += a//100 if a >= x: break print(cnt)
11
10
167
133
x = int(eval(input())) dum = 100 count = 0 while 1: if dum >= x: break dum = dum * 1.01 dum = dum // 1 count += 1 # print(dum) print(count)
import math x = int(eval(input())) a = 100 cnt = 0 while 1: cnt += 1 a += a // 100 if a >= x: break print(cnt)
false
9.090909
[ "+import math", "+", "-dum = 100", "-count = 0", "+a = 100", "+cnt = 0", "- if dum >= x:", "+ cnt += 1", "+ a += a // 100", "+ if a >= x:", "- dum = dum * 1.01", "- dum = dum // 1", "- count += 1", "- # print(dum)", "-print(count)", "+print(cnt)" ]
false
0.040055
0.041242
0.971224
[ "s227243892", "s092551059" ]
u917734688
p02707
python
s766997257
s999795573
342
206
50,772
38,924
Accepted
Accepted
39.77
import numpy as np N = int(eval(input())) A = list(map(int,input().split())) datas = np.zeros(N) for a in A: datas[a-1] += 1 for data in datas: print((int(data)))
N = int(eval(input())) A = list(map(int,input().split())) datas = {i:0 for i in range(1,N+1)} for a in A: datas[a] += 1 for data in list(datas.values()): print(data)
8
7
165
167
import numpy as np N = int(eval(input())) A = list(map(int, input().split())) datas = np.zeros(N) for a in A: datas[a - 1] += 1 for data in datas: print((int(data)))
N = int(eval(input())) A = list(map(int, input().split())) datas = {i: 0 for i in range(1, N + 1)} for a in A: datas[a] += 1 for data in list(datas.values()): print(data)
false
12.5
[ "-import numpy as np", "-", "-datas = np.zeros(N)", "+datas = {i: 0 for i in range(1, N + 1)}", "- datas[a - 1] += 1", "-for data in datas:", "- print((int(data)))", "+ datas[a] += 1", "+for data in list(datas.values()):", "+ print(data)" ]
false
0.353397
0.039789
8.881709
[ "s766997257", "s999795573" ]
u761320129
p03610
python
s596593659
s810055215
35
17
3,572
3,188
Accepted
Accepted
51.43
S = eval(input()) arr = [] for i in range(len(S)): if i%2 == 0: arr.append(S[i]) print((''.join(arr)))
S = eval(input()) print((S[::2]))
6
2
112
26
S = eval(input()) arr = [] for i in range(len(S)): if i % 2 == 0: arr.append(S[i]) print(("".join(arr)))
S = eval(input()) print((S[::2]))
false
66.666667
[ "-arr = []", "-for i in range(len(S)):", "- if i % 2 == 0:", "- arr.append(S[i])", "-print((\"\".join(arr)))", "+print((S[::2]))" ]
false
0.059468
0.058982
1.008243
[ "s596593659", "s810055215" ]
u992910889
p03986
python
s559599811
s511357753
185
168
40,048
40,048
Accepted
Accepted
9.19
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): X = str(eval(input())) stack = 0 pop = 0 for i in range(len(X)): if X[i] == 'S': stack += 1 elif X[i] == 'T' and stack > 0: pop += 1...
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): # https://scrapbox.io/fukucchi/%E6%8B%AC%E5%BC%A7%E5%88%97%E3%81%AE%E6%95%B4%E5%90%88%E6%80%A7%E5%95%8F%E9%A1%8C # https://atcoder.jp/contests/abc064/tasks/abc064_d X = str(eval(i...
21
28
376
594
import sys sys.setrecursionlimit(10**5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): X = str(eval(input())) stack = 0 pop = 0 for i in range(len(X)): if X[i] == "S": stack += 1 elif X[i] == "T" and stack > 0: pop += 1 s...
import sys sys.setrecursionlimit(10**5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): # https://scrapbox.io/fukucchi/%E6%8B%AC%E5%BC%A7%E5%88%97%E3%81%AE%E6%95%B4%E5%90%88%E6%80%A7%E5%95%8F%E9%A1%8C # https://atcoder.jp/contests/abc064/tasks/abc064_d X = str(eval(input())) ...
false
25
[ "+ # https://scrapbox.io/fukucchi/%E6%8B%AC%E5%BC%A7%E5%88%97%E3%81%AE%E6%95%B4%E5%90%88%E6%80%A7%E5%95%8F%E9%A1%8C", "+ # https://atcoder.jp/contests/abc064/tasks/abc064_d", "- stack = 0", "- pop = 0", "- for i in range(len(X)):", "+ N = len(X)", "+ stack_rem = 0", "+ need_lef...
false
0.04397
0.119301
0.368562
[ "s559599811", "s511357753" ]
u896451538
p03160
python
s241176207
s897799031
192
142
13,928
20,448
Accepted
Accepted
26.04
def MAP(): return list(map(int,input().split())) def INT(): return int(eval(input())) def FLOAT(): return float(eval(input())) MOD = 10**9+7 n = INT() h = MAP() dp = [MOD]*n dp[0]=0 for i in range(n-1): dp[i+1] = min(dp[i+1],dp[i]+abs(h[i]-h[i+1])) if i<n-2: dp[i+2] = min(dp[i+2],dp[i]+...
n = int(eval(input())) h = list(map(int,input().split())) dp = [10**9]*n dp[0]=0 for i in range(1,n): dp[i] = min(dp[i],dp[i-1]+abs(h[i]-h[i-1])) if i>1: dp[i] = min(dp[i],dp[i-2]+abs(h[i]-h[i-2])) print((dp[n-1]))
17
11
343
235
def MAP(): return list(map(int, input().split())) def INT(): return int(eval(input())) def FLOAT(): return float(eval(input())) MOD = 10**9 + 7 n = INT() h = MAP() dp = [MOD] * n dp[0] = 0 for i in range(n - 1): dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1])) if i < n - 2: dp[...
n = int(eval(input())) h = list(map(int, input().split())) dp = [10**9] * n dp[0] = 0 for i in range(1, n): dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1])) if i > 1: dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2])) print((dp[n - 1]))
false
35.294118
[ "-def MAP():", "- return list(map(int, input().split()))", "-", "-", "-def INT():", "- return int(eval(input()))", "-", "-", "-def FLOAT():", "- return float(eval(input()))", "-", "-", "-MOD = 10**9 + 7", "-n = INT()", "-h = MAP()", "-dp = [MOD] * n", "+n = int(eval(input())...
false
0.04354
0.044897
0.969792
[ "s241176207", "s897799031" ]
u429029348
p02659
python
s930439943
s597661928
28
23
10,064
9,156
Accepted
Accepted
17.86
from decimal import Decimal a,b=list(map(str,input().split())) ans=Decimal(a)*Decimal(b) print((int(ans)))
a,b=input().split() a=int(a) b=int(float(b)*100+0.5) ans=a*b//100 print(ans)
4
5
102
80
from decimal import Decimal a, b = list(map(str, input().split())) ans = Decimal(a) * Decimal(b) print((int(ans)))
a, b = input().split() a = int(a) b = int(float(b) * 100 + 0.5) ans = a * b // 100 print(ans)
false
20
[ "-from decimal import Decimal", "-", "-a, b = list(map(str, input().split()))", "-ans = Decimal(a) * Decimal(b)", "-print((int(ans)))", "+a, b = input().split()", "+a = int(a)", "+b = int(float(b) * 100 + 0.5)", "+ans = a * b // 100", "+print(ans)" ]
false
0.04026
0.051354
0.783974
[ "s930439943", "s597661928" ]
u278886389
p02762
python
s277671081
s088834720
1,441
1,303
96,984
84,568
Accepted
Accepted
9.58
from collections import defaultdict from collections import Counter N,M,K = map(int,input().split()) fn = defaultdict(lambda: 1) CD = [0]*K par = list(range(N)) def root(x): S = set() S.add(x) y = x while True: if par[y] == y: for s in S: par[s] =...
from collections import defaultdict from collections import Counter N,M,K = map(int,input().split()) fn = [1]*N CD = [0]*K par = list(range(N)) def root(x): S = set() S.add(x) y = x while True: if par[y] == y: for s in S: par[s] = y r...
52
52
915
898
from collections import defaultdict from collections import Counter N, M, K = map(int, input().split()) fn = defaultdict(lambda: 1) CD = [0] * K par = list(range(N)) def root(x): S = set() S.add(x) y = x while True: if par[y] == y: for s in S: par[s] = y ...
from collections import defaultdict from collections import Counter N, M, K = map(int, input().split()) fn = [1] * N CD = [0] * K par = list(range(N)) def root(x): S = set() S.add(x) y = x while True: if par[y] == y: for s in S: par[s] = y return y ...
false
0
[ "-fn = defaultdict(lambda: 1)", "+fn = [1] * N" ]
false
0.161212
0.04683
3.442509
[ "s277671081", "s088834720" ]
u189487046
p03738
python
s872287386
s097624455
22
17
2,940
2,940
Accepted
Accepted
22.73
a = int(eval(input())) b = int(eval(input())) if a == b: print("EQUAL") elif a > b: print("GREATER") else: print("LESS")
A = int(eval(input())) B = int(eval(input())) if A > B: print('GREATER') elif A < B: print('LESS') else: print('EQUAL')
9
9
130
129
a = int(eval(input())) b = int(eval(input())) if a == b: print("EQUAL") elif a > b: print("GREATER") else: print("LESS")
A = int(eval(input())) B = int(eval(input())) if A > B: print("GREATER") elif A < B: print("LESS") else: print("EQUAL")
false
0
[ "-a = int(eval(input()))", "-b = int(eval(input()))", "-if a == b:", "+A = int(eval(input()))", "+B = int(eval(input()))", "+if A > B:", "+ print(\"GREATER\")", "+elif A < B:", "+ print(\"LESS\")", "+else:", "-elif a > b:", "- print(\"GREATER\")", "-else:", "- print(\"LESS\")" ...
false
0.057913
0.034051
1.70076
[ "s872287386", "s097624455" ]
u788137651
p02684
python
s376133199
s369953084
658
172
100,016
99,912
Accepted
Accepted
73.86
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,sqrt,factorial,hypot,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import...
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,sqrt,factorial,hypot,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import...
70
64
1,934
1,785
# #    ⋀_⋀ #    (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline from math import floor, sqrt, factorial, hypot, log # log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter, defa...
# #    ⋀_⋀ #    (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline from math import floor, sqrt, factorial, hypot, log # log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter, defa...
false
8.571429
[ "- flag = False", "- # print(cycle)", "- # print(i,dist[now])", "- if K < dist[now]:", "- flag = True", "- else:", "+ if K >= dist[now]:", "- # print(K,start)" ]
false
0.048489
0.041092
1.180003
[ "s376133199", "s369953084" ]
u477319617
p02725
python
s362347504
s284076751
173
145
26,060
26,444
Accepted
Accepted
16.18
K, N = list(map(int,input().split())) #K: 湖1周の長さ, N:湖の周りにある家の数 A = list(map(int, input().split())) l = 0 A.append(A[0]+K) for i,aa in enumerate(A): if(i<len(A)-1): l = max(l, A[i+1]-aa) print((K-l))
k,n =list(map(int,input().split())) a = list(map(int,input().split())) a.append(a[0]+k) l = 0 for i in range(n): l = max(l,a[i+1]-a[i]) print((k-l))
11
7
219
151
K, N = list(map(int, input().split())) # K: 湖1周の長さ, N:湖の周りにある家の数 A = list(map(int, input().split())) l = 0 A.append(A[0] + K) for i, aa in enumerate(A): if i < len(A) - 1: l = max(l, A[i + 1] - aa) print((K - l))
k, n = list(map(int, input().split())) a = list(map(int, input().split())) a.append(a[0] + k) l = 0 for i in range(n): l = max(l, a[i + 1] - a[i]) print((k - l))
false
36.363636
[ "-K, N = list(map(int, input().split()))", "-# K: 湖1周の長さ, N:湖の周りにある家の数", "-A = list(map(int, input().split()))", "+k, n = list(map(int, input().split()))", "+a = list(map(int, input().split()))", "+a.append(a[0] + k)", "-A.append(A[0] + K)", "-for i, aa in enumerate(A):", "- if i < len(A) - 1:", ...
false
0.037207
0.049358
0.753808
[ "s362347504", "s284076751" ]
u729133443
p03712
python
s727777096
s091916610
172
17
38,256
3,060
Accepted
Accepted
90.12
_,w,*s=open(0).read().split();t=['#'*(int(w)+2)];a=t+['#'+t+'#'for t in s]+t;print(*a,sep='\n')
_,w,*s=open(0).read().split();t=['#'*(int(w)+2)];a=t+['#'+t+'#'for t in s]+t;print((*a))
1
1
95
86
_, w, *s = open(0).read().split() t = ["#" * (int(w) + 2)] a = t + ["#" + t + "#" for t in s] + t print(*a, sep="\n")
_, w, *s = open(0).read().split() t = ["#" * (int(w) + 2)] a = t + ["#" + t + "#" for t in s] + t print((*a))
false
0
[ "-print(*a, sep=\"\\n\")", "+print((*a))" ]
false
0.03505
0.035744
0.980577
[ "s727777096", "s091916610" ]
u075012704
p03607
python
s597096716
s757429734
278
249
16,636
15,460
Accepted
Accepted
10.43
from collections import Counter N = int(eval(input())) numbers = [int(eval(input())) for i in range(N)] num_cnt = Counter(numbers) ans_box = list([x for x in list(num_cnt.values()) if x%2==1]) print((len(ans_box)))
from collections import defaultdict N = int(eval(input())) D = defaultdict(int) for i in range(N): D[int(eval(input()))] += 1 print((len(list([x for x in list(D.values()) if x%2==1]))))
8
7
206
180
from collections import Counter N = int(eval(input())) numbers = [int(eval(input())) for i in range(N)] num_cnt = Counter(numbers) ans_box = list([x for x in list(num_cnt.values()) if x % 2 == 1]) print((len(ans_box)))
from collections import defaultdict N = int(eval(input())) D = defaultdict(int) for i in range(N): D[int(eval(input()))] += 1 print((len(list([x for x in list(D.values()) if x % 2 == 1]))))
false
12.5
[ "-from collections import Counter", "+from collections import defaultdict", "-numbers = [int(eval(input())) for i in range(N)]", "-num_cnt = Counter(numbers)", "-ans_box = list([x for x in list(num_cnt.values()) if x % 2 == 1])", "-print((len(ans_box)))", "+D = defaultdict(int)", "+for i in range(N):"...
false
0.054737
0.053569
1.021803
[ "s597096716", "s757429734" ]
u462329577
p02995
python
s519547898
s342893117
175
17
38,384
3,060
Accepted
Accepted
90.29
def gcd(i,j): if i > j: tmp = i i = j j = tmp while i != 0: tmp = i i = j%i j = tmp return j def lcm(i,j): return i*j//gcd(i,j) def main(): a,b,c,d = list(map(int,input().split())) ans = b-a+1 ans -= (b//c - (a-1)//c) + (b//d - (a-1)//d) - (b//lcm(c,d) -(a-1)//lcm(...
#!/usr/bin/env python3 a,b,c,d = list(map(int,input().split())) def my_gcd(i,j): if i > j: i,j = j,i while i != 0: if j % i != 0: i,j = j%i,i else: return i def not_div(n): return b//n - (a-1) //n print((not_div(1)-not_div(c)-not_div(d)+not_div(c*d//my_gcd(c,d))))
20
11
346
309
def gcd(i, j): if i > j: tmp = i i = j j = tmp while i != 0: tmp = i i = j % i j = tmp return j def lcm(i, j): return i * j // gcd(i, j) def main(): a, b, c, d = list(map(int, input().split())) ans = b - a + 1 ans -= ( (b // c - (a ...
#!/usr/bin/env python3 a, b, c, d = list(map(int, input().split())) def my_gcd(i, j): if i > j: i, j = j, i while i != 0: if j % i != 0: i, j = j % i, i else: return i def not_div(n): return b // n - (a - 1) // n print((not_div(1) - not_div(c) - not_div(...
false
45
[ "-def gcd(i, j):", "- if i > j:", "- tmp = i", "- i = j", "- j = tmp", "- while i != 0:", "- tmp = i", "- i = j % i", "- j = tmp", "- return j", "+#!/usr/bin/env python3", "+a, b, c, d = list(map(int, input().split()))", "-def lcm(i, j):", ...
false
0.042935
0.04293
1.000117
[ "s519547898", "s342893117" ]
u422104747
p03963
python
s191491820
s933096636
23
19
3,064
3,060
Accepted
Accepted
17.39
n,k = list(map(int, input().split())) print(((k-1)**(n-1)*k))
s=input().split() N=int(s[0]) K=int(s[1]) print(((K-1)**(N-1)*K))
2
4
54
66
n, k = list(map(int, input().split())) print(((k - 1) ** (n - 1) * k))
s = input().split() N = int(s[0]) K = int(s[1]) print(((K - 1) ** (N - 1) * K))
false
50
[ "-n, k = list(map(int, input().split()))", "-print(((k - 1) ** (n - 1) * k))", "+s = input().split()", "+N = int(s[0])", "+K = int(s[1])", "+print(((K - 1) ** (N - 1) * K))" ]
false
0.037201
0.036878
1.00874
[ "s191491820", "s933096636" ]
u401686269
p02820
python
s138487760
s934681322
191
76
39,364
21,240
Accepted
Accepted
60.21
import numpy as np N,K=list(map(int,input().split())) R,S,P=list(map(int,input().split())) T1=eval(input()) T2=T1.replace('r', str(P)+' ').replace('s',str(R)+' ').replace('p',str(S)+' ')[:-1] T2=np.array(list(map(int, T2.split()))) for i in range(N): if i >=K and T1[i]==T1[i-K] and T2[i-K] != 0: T2[i]...
N,K=list(map(int,input().split())) R,S,P=list(map(int,input().split())) T1=eval(input()) T2=T1.replace('r', str(P)+' ').replace('s',str(R)+' ').replace('p',str(S)+' ')[:-1] T2=list(map(int, T2.split())) for i in range(N): if i >=K and T1[i]==T1[i-K] and T2[i-K] != 0:T2[i]=0 print((sum(T2)))
13
8
323
280
import numpy as np N, K = list(map(int, input().split())) R, S, P = list(map(int, input().split())) T1 = eval(input()) T2 = ( T1.replace("r", str(P) + " ") .replace("s", str(R) + " ") .replace("p", str(S) + " ")[:-1] ) T2 = np.array(list(map(int, T2.split()))) for i in range(N): if i >= K and T1[i] == ...
N, K = list(map(int, input().split())) R, S, P = list(map(int, input().split())) T1 = eval(input()) T2 = ( T1.replace("r", str(P) + " ") .replace("s", str(R) + " ") .replace("p", str(S) + " ")[:-1] ) T2 = list(map(int, T2.split())) for i in range(N): if i >= K and T1[i] == T1[i - K] and T2[i - K] != 0: ...
false
38.461538
[ "-import numpy as np", "-", "-T2 = np.array(list(map(int, T2.split())))", "+T2 = list(map(int, T2.split()))", "-print((T2.sum()))", "+print((sum(T2)))" ]
false
0.511125
0.038621
13.234468
[ "s138487760", "s934681322" ]
u860002137
p02862
python
s339894956
s633609266
407
303
38,340
70,024
Accepted
Accepted
25.55
import numpy as np import sys x, y = list(map(int, input().split())) if (x + y) % 3 != 0 or x > 2 * y or y > 2 * x: print((0)) sys.exit() # 手数 n = (x + y) // 3 x -= n y -= n MOD = 10**9 + 7 # モジュラ逆数戦法 def prepare(n, MOD): f = 1 for m in range(1, n + 1): f *= m f...
import numpy as np import sys x, y = list(map(int, input().split())) if (x + y) % 3 != 0 or x > 2 * y or y > 2 * x: print((0)) sys.exit() # 手数 n = (x + y) // 3 x -= n y -= n MOD = 10**9 + 7 def prepare(n, MOD): nrt = int(n ** 0.5) + 1 nsq = nrt * nrt facts = np.arange(nsq, dt...
38
41
604
1,012
import numpy as np import sys x, y = list(map(int, input().split())) if (x + y) % 3 != 0 or x > 2 * y or y > 2 * x: print((0)) sys.exit() # 手数 n = (x + y) // 3 x -= n y -= n MOD = 10**9 + 7 # モジュラ逆数戦法 def prepare(n, MOD): f = 1 for m in range(1, n + 1): f *= m f %= MOD fn = f in...
import numpy as np import sys x, y = list(map(int, input().split())) if (x + y) % 3 != 0 or x > 2 * y or y > 2 * x: print((0)) sys.exit() # 手数 n = (x + y) // 3 x -= n y -= n MOD = 10**9 + 7 def prepare(n, MOD): nrt = int(n**0.5) + 1 nsq = nrt * nrt facts = np.arange(nsq, dtype=np.int64).reshape(n...
false
7.317073
[ "-# モジュラ逆数戦法", "-def prepare(n, MOD):", "- f = 1", "- for m in range(1, n + 1):", "- f *= m", "- f %= MOD", "- fn = f", "- inv = pow(f, MOD - 2, MOD)", "- invs = [1] * (n + 1)", "- invs[n] = inv", "- for m in range(n, 1, -1):", "- inv *= m", "- ...
false
0.124027
0.586502
0.211468
[ "s339894956", "s633609266" ]
u499381410
p02728
python
s752375252
s437521403
2,811
1,632
86,684
186,456
Accepted
Accepted
41.94
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from bisect import bisect_right, bisect_left import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, ...
95
95
2,400
2,115
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from bisect import bisect_right, bisect_left import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factori...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fro...
false
0
[ "-from bisect import bisect_right, bisect_left", "+import math", "+import bisect", "-from math import factorial, ceil, floor, gamma, log", "+from math import factorial, ceil, floor", "-from copy import deepcopy", "-INF = 10**20", "+INF = 10**13", "- return list(map(int, sys.stdin.buffer.readline(...
false
0.03918
0.113264
0.345919
[ "s752375252", "s437521403" ]
u408760403
p03043
python
s699945437
s966013269
66
51
6,296
2,940
Accepted
Accepted
22.73
N,K=list(map(int,input().split())) l=[] for i in range(1,N+1): score=i while 1<=score<=(K-1): score*=2 prob=(1/N)*i/score l.append(prob) print((sum(l)))
N,K=list(map(int,input().split())) prob=0 for i in range(1,N+1): score=i omote=0 while 1<=score<=K-1: score=score*2 omote+=1 prob+=(1/N)*((1/2)**omote) print(prob)
9
10
164
182
N, K = list(map(int, input().split())) l = [] for i in range(1, N + 1): score = i while 1 <= score <= (K - 1): score *= 2 prob = (1 / N) * i / score l.append(prob) print((sum(l)))
N, K = list(map(int, input().split())) prob = 0 for i in range(1, N + 1): score = i omote = 0 while 1 <= score <= K - 1: score = score * 2 omote += 1 prob += (1 / N) * ((1 / 2) ** omote) print(prob)
false
10
[ "-l = []", "+prob = 0", "- while 1 <= score <= (K - 1):", "- score *= 2", "- prob = (1 / N) * i / score", "- l.append(prob)", "-print((sum(l)))", "+ omote = 0", "+ while 1 <= score <= K - 1:", "+ score = score * 2", "+ omote += 1", "+ prob += (1 / N) * ((...
false
0.075603
0.082915
0.911815
[ "s699945437", "s966013269" ]
u995062424
p03607
python
s741282956
s633049038
247
197
8,280
16,592
Accepted
Accepted
20.24
N = int(eval(input())) A = [] for _ in range(N): A.append(int(eval(input()))) A = sorted(A) cnt = 1 ans = 0 for i in range(N-1): if(A[i] == A[i+1]): cnt += 1 continue ans += cnt % 2 cnt = 1 if(cnt % 2 == 1): ans += 1 print(ans)
import collections N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] c = collections.Counter(A) cnt = 0 for value in list(c.values()): if(value%2 != 0): cnt += 1 print(cnt)
19
11
272
194
N = int(eval(input())) A = [] for _ in range(N): A.append(int(eval(input()))) A = sorted(A) cnt = 1 ans = 0 for i in range(N - 1): if A[i] == A[i + 1]: cnt += 1 continue ans += cnt % 2 cnt = 1 if cnt % 2 == 1: ans += 1 print(ans)
import collections N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] c = collections.Counter(A) cnt = 0 for value in list(c.values()): if value % 2 != 0: cnt += 1 print(cnt)
false
42.105263
[ "+import collections", "+", "-A = []", "-for _ in range(N):", "- A.append(int(eval(input())))", "-A = sorted(A)", "-cnt = 1", "-ans = 0", "-for i in range(N - 1):", "- if A[i] == A[i + 1]:", "+A = [int(eval(input())) for _ in range(N)]", "+c = collections.Counter(A)", "+cnt = 0", "+f...
false
0.111018
0.036928
3.006363
[ "s741282956", "s633049038" ]
u816872429
p02902
python
s105928553
s762417748
390
288
48,872
48,232
Accepted
Accepted
26.15
n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): a, b = list(map(int, input().split())) edges[a - 1].append(b - 1) ret = [0] * (n + 1) for start in range(n): parent = [-1] * n q = [start] while len(q) > 0: i = q.pop(0) for j in edg...
n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): a, b = list(map(int, input().split())) edges[a - 1].append(b - 1) def dfs(index, visited, cycle): visited[index] = True cycle.append(index) for i in edges[index]: if visited.get(i): ...
32
56
783
1,331
n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): a, b = list(map(int, input().split())) edges[a - 1].append(b - 1) ret = [0] * (n + 1) for start in range(n): parent = [-1] * n q = [start] while len(q) > 0: i = q.pop(0) for j in edges[i]: ...
n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): a, b = list(map(int, input().split())) edges[a - 1].append(b - 1) def dfs(index, visited, cycle): visited[index] = True cycle.append(index) for i in edges[index]: if visited.get(i): return ...
false
42.857143
[ "-ret = [0] * (n + 1)", "+", "+", "+def dfs(index, visited, cycle):", "+ visited[index] = True", "+ cycle.append(index)", "+ for i in edges[index]:", "+ if visited.get(i):", "+ return cycle[cycle.index(i) :]", "+ ret = dfs(i, visited, cycle)", "+ if ret:"...
false
0.038353
0.038905
0.985827
[ "s105928553", "s762417748" ]
u965602776
p03031
python
s421815371
s760588610
67
33
3,064
3,064
Accepted
Accepted
50.75
n,m=list(map(int,input().split())) s=[] for _ in range(m): _,*t=list(map(int,input().split())) s.append(t) p=list(map(int,input().split())) a=0 for i in range(2**n): f=1 for j in range(m): g=1 g&=(sum([int(bin(i>>(u-1)),2) for u in s[j]])%2==p[j]) f&=g a+=f prin...
n,m=list(map(int,input().split())) s=[] for _ in range(m):_,*t=list(map(int,input().split()));s.append(t) *p,=list(map(int,input().split())) print((sum([all([sum([i>>(u-1)for u in s[j]])%2==p[j]for j in range(m)])for i in range(2**n)])))
15
5
312
221
n, m = list(map(int, input().split())) s = [] for _ in range(m): _, *t = list(map(int, input().split())) s.append(t) p = list(map(int, input().split())) a = 0 for i in range(2**n): f = 1 for j in range(m): g = 1 g &= sum([int(bin(i >> (u - 1)), 2) for u in s[j]]) % 2 == p[j] f &=...
n, m = list(map(int, input().split())) s = [] for _ in range(m): _, *t = list(map(int, input().split())) s.append(t) (*p,) = list(map(int, input().split())) print( ( sum( [ all([sum([i >> (u - 1) for u in s[j]]) % 2 == p[j] for j in range(m)]) for i in ran...
false
66.666667
[ "-p = list(map(int, input().split()))", "-a = 0", "-for i in range(2**n):", "- f = 1", "- for j in range(m):", "- g = 1", "- g &= sum([int(bin(i >> (u - 1)), 2) for u in s[j]]) % 2 == p[j]", "- f &= g", "- a += f", "-print(a)", "+(*p,) = list(map(int, input().split(...
false
0.044505
0.038548
1.154538
[ "s421815371", "s760588610" ]
u241159583
p03379
python
s216450330
s019628400
746
400
44,340
49,028
Accepted
Accepted
46.38
import statistics n = int(eval(input()))-1 a = list(map(int, input().split())) N = sorted([[x,y] for y, x in enumerate(a)]) ans = [0] * (n+1) for i in range(n+1): if i < n//2+1: ans[N[i][1]] = N[n//2+1][0] else: ans[N[i][1]] = N[n//2][0] for x in ans: print(x)
n = int(eval(input())) x = list(enumerate(map(int, input().split()))) x.sort(key=lambda x:x[1]) ans = [""]*n for i in range(n): if (n+1)//2 >= i+1: ans[x[i][0]] = x[(n+1)//2][1] else: ans[x[i][0]] = x[(n+1)//2-1][1] print(("\n".join(map(str, ans))))
11
9
282
254
import statistics n = int(eval(input())) - 1 a = list(map(int, input().split())) N = sorted([[x, y] for y, x in enumerate(a)]) ans = [0] * (n + 1) for i in range(n + 1): if i < n // 2 + 1: ans[N[i][1]] = N[n // 2 + 1][0] else: ans[N[i][1]] = N[n // 2][0] for x in ans: print(x)
n = int(eval(input())) x = list(enumerate(map(int, input().split()))) x.sort(key=lambda x: x[1]) ans = [""] * n for i in range(n): if (n + 1) // 2 >= i + 1: ans[x[i][0]] = x[(n + 1) // 2][1] else: ans[x[i][0]] = x[(n + 1) // 2 - 1][1] print(("\n".join(map(str, ans))))
false
18.181818
[ "-import statistics", "-", "-n = int(eval(input())) - 1", "-a = list(map(int, input().split()))", "-N = sorted([[x, y] for y, x in enumerate(a)])", "-ans = [0] * (n + 1)", "-for i in range(n + 1):", "- if i < n // 2 + 1:", "- ans[N[i][1]] = N[n // 2 + 1][0]", "+n = int(eval(input()))", ...
false
0.162835
0.039001
4.175136
[ "s216450330", "s019628400" ]