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
u419686324
p03846
python
s832997545
s360155676
69
63
14,692
14,180
Accepted
Accepted
8.7
N = int(eval(input())) A = [int(x) for x in input().split()] from collections import Counter def f(): cnt = Counter(A) m = N - 1 for k, v in list(cnt.items()): if k == 0 and v == 1: continue if v != 2 or k > m: return 0 return pow(2, N//2, 10**9 + 7) print((f...
N = int(eval(input())) A = [int(x) for x in input().split()] from collections import Counter def f(): cnt = Counter(A) m = N - 1 for k, v in list(cnt.items()): if k == 0: if v == 1: continue else: return 0 else: ...
15
19
310
406
N = int(eval(input())) A = [int(x) for x in input().split()] from collections import Counter def f(): cnt = Counter(A) m = N - 1 for k, v in list(cnt.items()): if k == 0 and v == 1: continue if v != 2 or k > m: return 0 return pow(2, N // 2, 10**9 + 7) print((...
N = int(eval(input())) A = [int(x) for x in input().split()] from collections import Counter def f(): cnt = Counter(A) m = N - 1 for k, v in list(cnt.items()): if k == 0: if v == 1: continue else: return 0 else: if v != 2 ...
false
21.052632
[ "- if k == 0 and v == 1:", "- continue", "- if v != 2 or k > m:", "- return 0", "+ if k == 0:", "+ if v == 1:", "+ continue", "+ else:", "+ return 0", "+ else:", "+ if v != 2 or k > m...
false
0.035794
0.036134
0.990585
[ "s832997545", "s360155676" ]
u332906195
p02717
python
s507607580
s713563260
19
17
3,316
2,940
Accepted
Accepted
10.53
A, B, C = list(map(int, input().split())) print((C, A, B))
X, Y, Z = list(map(int, input().split())) print((Z, X, Y))
2
2
52
52
A, B, C = list(map(int, input().split())) print((C, A, B))
X, Y, Z = list(map(int, input().split())) print((Z, X, Y))
false
0
[ "-A, B, C = list(map(int, input().split()))", "-print((C, A, B))", "+X, Y, Z = list(map(int, input().split()))", "+print((Z, X, Y))" ]
false
0.066106
0.063605
1.039322
[ "s507607580", "s713563260" ]
u863442865
p02998
python
s982198473
s940755915
602
452
70,620
64,304
Accepted
Accepted
24.92
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush...
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush...
56
57
1,265
1,561
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left, bisect_right from heapq import heapify, heappop, heappush ...
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left, bisect_right from heapq import heapify, heappop, heappush ...
false
1.754386
[ "-", "- def find(x):", "- if par[x] < 0:", "- return x", "- else:", "- par[x] = find(par[x])", "- return par[x]", "-", "- def unite(x, y):", "- x = find(x)", "- y = find(y)", "- if x == y:", "- return False"...
false
0.043809
0.339432
0.129067
[ "s982198473", "s940755915" ]
u779805689
p03967
python
s407900513
s639679711
74
67
73,340
66,068
Accepted
Accepted
9.46
S=eval(input()) G=P=0 K=0 for s in S: if P==G: if s=="p": K-=1 G+=1 else: if s=="g": K+=1 P+=1 print(K)
S=eval(input()) K=0 for i in range(len(S)): if i%2==0 and S[i]=="p": K-=1 elif i%2==1 and S[i]=="g": K+=1 print(K)
15
9
177
141
S = eval(input()) G = P = 0 K = 0 for s in S: if P == G: if s == "p": K -= 1 G += 1 else: if s == "g": K += 1 P += 1 print(K)
S = eval(input()) K = 0 for i in range(len(S)): if i % 2 == 0 and S[i] == "p": K -= 1 elif i % 2 == 1 and S[i] == "g": K += 1 print(K)
false
40
[ "-G = P = 0", "-for s in S:", "- if P == G:", "- if s == \"p\":", "- K -= 1", "- G += 1", "- else:", "- if s == \"g\":", "- K += 1", "- P += 1", "+for i in range(len(S)):", "+ if i % 2 == 0 and S[i] == \"p\":", "+ K -= 1", "...
false
0.048802
0.121053
0.403146
[ "s407900513", "s639679711" ]
u729133443
p03250
python
s708421436
s226441185
169
17
38,384
2,940
Accepted
Accepted
89.94
a,b,c=sorted(input().split());print((int(c+b)+int(a)))
a,b,c=sorted(input().split());print((eval(c+b+'+'+a)))
1
1
52
52
a, b, c = sorted(input().split()) print((int(c + b) + int(a)))
a, b, c = sorted(input().split()) print((eval(c + b + "+" + a)))
false
0
[ "-print((int(c + b) + int(a)))", "+print((eval(c + b + \"+\" + a)))" ]
false
0.044505
0.038092
1.168357
[ "s708421436", "s226441185" ]
u150984829
p02257
python
s383197678
s756462170
70
60
5,680
5,608
Accepted
Accepted
14.29
c=0 for _ in[0]*int(eval(input())): x=int(eval(input())) if 2 in[x,pow(2,x,x)]:c+=1 print(c)
import sys eval(input());c=0 for e in sys.stdin: x=int(e) if 2 in[x,pow(2,x,x)]:c+=1 print(c)
5
6
87
95
c = 0 for _ in [0] * int(eval(input())): x = int(eval(input())) if 2 in [x, pow(2, x, x)]: c += 1 print(c)
import sys eval(input()) c = 0 for e in sys.stdin: x = int(e) if 2 in [x, pow(2, x, x)]: c += 1 print(c)
false
16.666667
[ "+import sys", "+", "+eval(input())", "-for _ in [0] * int(eval(input())):", "- x = int(eval(input()))", "+for e in sys.stdin:", "+ x = int(e)" ]
false
0.042548
0.108482
0.392216
[ "s383197678", "s756462170" ]
u541610817
p03319
python
s747618524
s043657699
51
17
13,880
2,940
Accepted
Accepted
66.67
N, K = [int(x) for x in input().split()] A_lst = [int(x) for x in input().split()] r = -1 l = -1 for i in range(N): if A_lst[i] == 1: r = i l = N - i - 1 print(((r + l + K - 2)//(K - 1)))
N, K = [int(x) for x in input().split()] print(((N + K - 3)//(K - 1)))
9
2
214
70
N, K = [int(x) for x in input().split()] A_lst = [int(x) for x in input().split()] r = -1 l = -1 for i in range(N): if A_lst[i] == 1: r = i l = N - i - 1 print(((r + l + K - 2) // (K - 1)))
N, K = [int(x) for x in input().split()] print(((N + K - 3) // (K - 1)))
false
77.777778
[ "-A_lst = [int(x) for x in input().split()]", "-r = -1", "-l = -1", "-for i in range(N):", "- if A_lst[i] == 1:", "- r = i", "- l = N - i - 1", "-print(((r + l + K - 2) // (K - 1)))", "+print(((N + K - 3) // (K - 1)))" ]
false
0.05587
0.078417
0.71247
[ "s747618524", "s043657699" ]
u562935282
p03088
python
s619698369
s034751064
283
160
47,836
5,580
Accepted
Accepted
43.46
import sys sys.setrecursionlimit(10 ** 6) mod = 10 ** 9 + 7 def is_ok(last4): for j in range(4): t = list(last4) if j != 3: t[j], t[j + 1] = t[j + 1], t[j] if 'AGC' in ''.join(t): return False return True def rec(length, last3): if last3 ...
def solve(): from functools import lru_cache mod = 10 ** 9 + 7 def is_ok(last4: str) -> bool: if 'AGC' in last4: return False for j in range(3): t = list(last4) t[j], t[j + 1] = t[j + 1], t[j] if 'AGC' in ''.join(t): ...
36
31
676
717
import sys sys.setrecursionlimit(10**6) mod = 10**9 + 7 def is_ok(last4): for j in range(4): t = list(last4) if j != 3: t[j], t[j + 1] = t[j + 1], t[j] if "AGC" in "".join(t): return False return True def rec(length, last3): if last3 in m[length]: ...
def solve(): from functools import lru_cache mod = 10**9 + 7 def is_ok(last4: str) -> bool: if "AGC" in last4: return False for j in range(3): t = list(last4) t[j], t[j + 1] = t[j + 1], t[j] if "AGC" in "".join(t): return Fals...
false
13.888889
[ "-import sys", "+def solve():", "+ from functools import lru_cache", "-sys.setrecursionlimit(10**6)", "-mod = 10**9 + 7", "+ mod = 10**9 + 7", "+", "+ def is_ok(last4: str) -> bool:", "+ if \"AGC\" in last4:", "+ return False", "+ for j in range(3):", "+ ...
false
0.141012
0.057147
2.467513
[ "s619698369", "s034751064" ]
u525065967
p02574
python
s897375984
s715356922
780
576
126,812
126,712
Accepted
Accepted
26.15
n = int(eval(input())) A = [*list(map(int, input().split()))] def solve(): MAX_A = 10**6 + 1 C = [0] * MAX_A for a in A: C[a] += 1 pairwise = True for i in range(2, MAX_A): if sum(C[i::i]) > 1: pairwise = False if pairwise: return 'pairwise' from math import gcd g = 0 ...
n = int(eval(input())) A = [*list(map(int, input().split()))] def solve(): MAX_A = 10**6 + 1 C = [0] * MAX_A for a in A: C[a] += 1 pairwise = True if sum(C[2::2]) > 1: pairwise = False for i in range(3, MAX_A, 2): if sum(C[i::i]) > 1: pairwise = False if pairwise: return 'p...
16
17
417
463
n = int(eval(input())) A = [*list(map(int, input().split()))] def solve(): MAX_A = 10**6 + 1 C = [0] * MAX_A for a in A: C[a] += 1 pairwise = True for i in range(2, MAX_A): if sum(C[i::i]) > 1: pairwise = False if pairwise: return "pairwise" from math im...
n = int(eval(input())) A = [*list(map(int, input().split()))] def solve(): MAX_A = 10**6 + 1 C = [0] * MAX_A for a in A: C[a] += 1 pairwise = True if sum(C[2::2]) > 1: pairwise = False for i in range(3, MAX_A, 2): if sum(C[i::i]) > 1: pairwise = False if...
false
5.882353
[ "- for i in range(2, MAX_A):", "+ if sum(C[2::2]) > 1:", "+ pairwise = False", "+ for i in range(3, MAX_A, 2):" ]
false
0.748437
0.604749
1.237599
[ "s897375984", "s715356922" ]
u560867850
p02928
python
s958542174
s442955501
934
797
3,188
3,188
Accepted
Accepted
14.67
def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) MOD = 10**9 + 7 count = 0 for i in range(N-1): for j in range(i+1, N): if A[i] == A[j]: continue elif A[i] > A[j]: count += K + K*(K-1) /...
def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) MOD = 10**9 + 7 count = 0 for i in range(N-1): for j in range(i+1, N): if A[i] == A[j]: continue elif A[i] > A[j]: count += K + K*(K-1) /...
23
23
472
468
def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) MOD = 10**9 + 7 count = 0 for i in range(N - 1): for j in range(i + 1, N): if A[i] == A[j]: continue elif A[i] > A[j]: count += K + K * (K - 1) // 2 ...
def main(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) MOD = 10**9 + 7 count = 0 for i in range(N - 1): for j in range(i + 1, N): if A[i] == A[j]: continue elif A[i] > A[j]: count += K + K * (K - 1) // 2 ...
false
0
[ "- count %= MOD", "+ count %= MOD" ]
false
0.046509
0.04531
1.026455
[ "s958542174", "s442955501" ]
u375172966
p03835
python
s339791299
s896741992
1,823
1,268
2,940
2,940
Accepted
Accepted
30.44
k, s = list(map(int, input().split())) ans = 0 for x in range(k+1): for y in range(k+1): if x + y <= s: if s - (x + y) <= k: ans += 1 print(ans)
k, s = list(map(int, input().split())) ans = 0 for x in range(k+1): for y in range(k+1): if 0 <= s - (x+y) <= k: ans += 1 print(ans)
8
9
185
160
k, s = list(map(int, input().split())) ans = 0 for x in range(k + 1): for y in range(k + 1): if x + y <= s: if s - (x + y) <= k: ans += 1 print(ans)
k, s = list(map(int, input().split())) ans = 0 for x in range(k + 1): for y in range(k + 1): if 0 <= s - (x + y) <= k: ans += 1 print(ans)
false
11.111111
[ "- if x + y <= s:", "- if s - (x + y) <= k:", "- ans += 1", "+ if 0 <= s - (x + y) <= k:", "+ ans += 1" ]
false
0.063327
0.061294
1.033164
[ "s339791299", "s896741992" ]
u863442865
p02762
python
s988658732
s114102442
902
703
95,776
77,148
Accepted
Accepted
22.06
#木作って終わり、問題文難しい # def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby #from itertools import product fr...
#木作って終わり、問題文難しい # def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby #from itertools import product fr...
69
69
1,688
1,652
# 木作って終わり、問題文難しい # def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque # from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby # from itertools import product from bis...
# 木作って終わり、問題文難しい # def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque # from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby # from itertools import product from bis...
false
0
[ "- adj = [[] for _ in range(n)]", "+ adj = [0] * n", "- adj[a - 1].append(b - 1)", "- adj[b - 1].append(a - 1)", "+ adj[a - 1] += 1", "+ adj[b - 1] += 1", "- p = size(friend, i) - 1 - len(adj[i])", "+ p = size(friend, i) - 1 - adj[i]" ]
false
0.069387
0.052298
1.326771
[ "s988658732", "s114102442" ]
u057109575
p02586
python
s716451654
s848609312
1,948
1,237
179,140
453,396
Accepted
Accepted
36.5
R, C, K = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(K)] items = [[0] * (C + 1) for _ in range(R + 1)] for r, c, v in X: items[r][c] = v dp = [[0] * 4 for _ in range(C + 1)] for i in range(1, R + 1): # Vertical transition for j in range(1, C + 1): ...
R, C, K = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(K)] items = [[0] * (C + 1) for _ in range(R + 1)] for r, c, v in X: items[r][c] = v dp0 = [[0] * (C + 1) for _ in range(R + 1)] dp1 = [[0] * (C + 1) for _ in range(R + 1)] dp2 = [[0] * (C + 1) for _ in range(R +...
24
26
698
1,001
R, C, K = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(K)] items = [[0] * (C + 1) for _ in range(R + 1)] for r, c, v in X: items[r][c] = v dp = [[0] * 4 for _ in range(C + 1)] for i in range(1, R + 1): # Vertical transition for j in range(1, C + 1): dp[j][0] = ...
R, C, K = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(K)] items = [[0] * (C + 1) for _ in range(R + 1)] for r, c, v in X: items[r][c] = v dp0 = [[0] * (C + 1) for _ in range(R + 1)] dp1 = [[0] * (C + 1) for _ in range(R + 1)] dp2 = [[0] * (C + 1) for _ in range(R + 1)] dp3 = ...
false
7.692308
[ "-dp = [[0] * 4 for _ in range(C + 1)]", "+dp0 = [[0] * (C + 1) for _ in range(R + 1)]", "+dp1 = [[0] * (C + 1) for _ in range(R + 1)]", "+dp2 = [[0] * (C + 1) for _ in range(R + 1)]", "+dp3 = [[0] * (C + 1) for _ in range(R + 1)]", "- # Vertical transition", "- dp[j][0] = max(dp[j])", "- ...
false
0.045446
0.04525
1.004323
[ "s716451654", "s848609312" ]
u562935282
p02732
python
s385479610
s540441299
646
245
30,040
30,004
Accepted
Accepted
62.07
from collections import Counter def choose(n, r): x, y = 1, 1 for i in range(r): x *= n - i y *= i + 1 return x // y N = int(input()) *a, = map(int, input().split()) ctr = Counter(a) b = 0 for cnt in ctr.values(): b += choose(cnt, 2) ret = [] for x in a: ...
def main(): from collections import Counter N = int(input()) *a, = map(int, input().split()) ctr = Counter(a) frm_n = sum(x * (x - 1) // 2 for x in ctr.values()) ans = [] for x in a: ans.append(frm_n - ctr[x] + 1) print(*ans, sep='\n') if __name__ == '__main__...
27
34
430
686
from collections import Counter def choose(n, r): x, y = 1, 1 for i in range(r): x *= n - i y *= i + 1 return x // y N = int(input()) (*a,) = map(int, input().split()) ctr = Counter(a) b = 0 for cnt in ctr.values(): b += choose(cnt, 2) ret = [] for x in a: cnt = ctr[x] res = ...
def main(): from collections import Counter N = int(input()) (*a,) = map(int, input().split()) ctr = Counter(a) frm_n = sum(x * (x - 1) // 2 for x in ctr.values()) ans = [] for x in a: ans.append(frm_n - ctr[x] + 1) print(*ans, sep="\n") if __name__ == "__main__": main() #...
false
20.588235
[ "-from collections import Counter", "+def main():", "+ from collections import Counter", "+", "+ N = int(input())", "+ (*a,) = map(int, input().split())", "+ ctr = Counter(a)", "+ frm_n = sum(x * (x - 1) // 2 for x in ctr.values())", "+ ans = []", "+ for x in a:", "+ ...
false
0.041385
0.035761
1.157267
[ "s385479610", "s540441299" ]
u692054751
p02678
python
s761278034
s542813851
774
681
55,684
57,440
Accepted
Accepted
12.02
from collections import deque N, M = [int(s) for s in input().split()] edge = [[int(s) - 1 for s in input().split()] for _ in range(M)] graph = [[] for _ in range(N)] for i, j in edge: graph[i].append(j) graph[j].append(i) dq = deque([0]) visited = [False] * N visited[0] = True parent = [0]*N whi...
from collections import deque N, M = [int(s) for s in input().split()] edge = [[int(s) - 1 for s in input().split()] for _ in range(M)] graph = [[] for _ in range(N)] for i, j in edge: graph[i].append(j) graph[j].append(i) dq = deque([0]) parent = [0] * N parent[0] = 1 while(dq): search_obj =...
28
26
724
679
from collections import deque N, M = [int(s) for s in input().split()] edge = [[int(s) - 1 for s in input().split()] for _ in range(M)] graph = [[] for _ in range(N)] for i, j in edge: graph[i].append(j) graph[j].append(i) dq = deque([0]) visited = [False] * N visited[0] = True parent = [0] * N while dq: s...
from collections import deque N, M = [int(s) for s in input().split()] edge = [[int(s) - 1 for s in input().split()] for _ in range(M)] graph = [[] for _ in range(N)] for i, j in edge: graph[i].append(j) graph[j].append(i) dq = deque([0]) parent = [0] * N parent[0] = 1 while dq: search_obj = dq.pop() f...
false
7.142857
[ "-visited = [False] * N", "-visited[0] = True", "+parent[0] = 1", "- if not visited[candidate_obj]:", "+ if not parent[candidate_obj]:", "- parent[candidate_obj] = search_obj", "- visited[candidate_obj] = True", "-total_visited = sum(visited)", "+ paren...
false
0.007559
0.037319
0.202556
[ "s761278034", "s542813851" ]
u223663729
p02703
python
s882399612
s743066932
688
619
24,500
24,120
Accepted
Accepted
10.03
from heapq import heapify, heappop, heappush import sys input = sys.stdin.readline class Heap(): def __init__(self, ): self.h = [] def heapify(self, h): self.h = h heapify(self.h) def heappop(self,): return heappop(self.h) def heappush(self, x): ...
from heapq import heappop, heappush import sys input = sys.stdin.readline INF = 10**100 MAX = 2500 N, M, S = list(map(int, input().split())) S = min(S, MAX) G = [[] for _ in [0]*N] C = [] for _ in [0]*M: u, v, a, b = list(map(int, input().split())) u -= 1 v -= 1 G[v].append((u, a, b)) ...
72
53
1,227
969
from heapq import heapify, heappop, heappush import sys input = sys.stdin.readline class Heap: def __init__( self, ): self.h = [] def heapify(self, h): self.h = h heapify(self.h) def heappop( self, ): return heappop(self.h) def heappush(self,...
from heapq import heappop, heappush import sys input = sys.stdin.readline INF = 10**100 MAX = 2500 N, M, S = list(map(int, input().split())) S = min(S, MAX) G = [[] for _ in [0] * N] C = [] for _ in [0] * M: u, v, a, b = list(map(int, input().split())) u -= 1 v -= 1 G[v].append((u, a, b)) G[u].appe...
false
26.388889
[ "-from heapq import heapify, heappop, heappush", "+from heapq import heappop, heappush", "-", "-", "-class Heap:", "- def __init__(", "- self,", "- ):", "- self.h = []", "-", "- def heapify(self, h):", "- self.h = h", "- heapify(self.h)", "-", "- d...
false
0.104666
0.25268
0.414221
[ "s882399612", "s743066932" ]
u571445182
p03556
python
s695648110
s105346905
64
17
3,188
2,940
Accepted
Accepted
73.44
N=int(eval(input())) Flag=0 while Flag==0: Tmp=N**0.5 Tmp2 = round(Tmp) if Tmp2 == Tmp: Flag=1 else: N -= 1 print(N)
N=int(eval(input())) Tmp=int(N**0.5) N = Tmp**2 print(N)
16
6
148
58
N = int(eval(input())) Flag = 0 while Flag == 0: Tmp = N**0.5 Tmp2 = round(Tmp) if Tmp2 == Tmp: Flag = 1 else: N -= 1 print(N)
N = int(eval(input())) Tmp = int(N**0.5) N = Tmp**2 print(N)
false
62.5
[ "-Flag = 0", "-while Flag == 0:", "- Tmp = N**0.5", "- Tmp2 = round(Tmp)", "- if Tmp2 == Tmp:", "- Flag = 1", "- else:", "- N -= 1", "+Tmp = int(N**0.5)", "+N = Tmp**2" ]
false
0.0494
0.084071
0.587604
[ "s695648110", "s105346905" ]
u718706790
p03109
python
s969765301
s181429382
31
17
4,312
2,940
Accepted
Accepted
45.16
import datetime a = eval(input()) b = datetime.datetime.strptime(a, '%Y/%m/%d') c = datetime.datetime(2019, 4, 30) if b <= c: print('Heisei') else: print('TBD')
a = eval(input()) if a[5:7] <= '04': print('Heisei') else: print('TBD')
10
6
167
73
import datetime a = eval(input()) b = datetime.datetime.strptime(a, "%Y/%m/%d") c = datetime.datetime(2019, 4, 30) if b <= c: print("Heisei") else: print("TBD")
a = eval(input()) if a[5:7] <= "04": print("Heisei") else: print("TBD")
false
40
[ "-import datetime", "-", "-b = datetime.datetime.strptime(a, \"%Y/%m/%d\")", "-c = datetime.datetime(2019, 4, 30)", "-if b <= c:", "+if a[5:7] <= \"04\":" ]
false
0.098677
0.038815
2.542207
[ "s969765301", "s181429382" ]
u525529288
p03695
python
s902941735
s720890640
151
21
12,512
3,316
Accepted
Accepted
86.09
#レート 1-399:灰色 #レート 400-799:茶色 #レート 800-1199:緑色 #レート 1200-1599:水色 #レート 1600-1999:青色 #レート 2000-2399:黄色 #レート 2400-2799:橙色 #レート 2800-3199:赤色 import numpy as np n = eval(input()) a = np.array(list(map(int, input().split()))) a = a // 400 b = set() sa = 0 ans = 0 for i in a:...
#レート 1-399:灰色 #レート 400-799:茶色 #レート 800-1199:緑色 #レート 1200-1599:水色 #レート 1600-1999:青色 #レート 2000-2399:黄色 #レート 2400-2799:橙色 #レート 2800-3199:赤色 from collections import Counter n = eval(input()) c = Counter([min(int(i) // 400, 8) for i in input().split()]) ans = 0 for i in range(...
24
17
424
384
# レート 1-399:灰色 # レート 400-799:茶色 # レート 800-1199:緑色 # レート 1200-1599:水色 # レート 1600-1999:青色 # レート 2000-2399:黄色 # レート 2400-2799:橙色 # レート 2800-3199:赤色 import numpy as np n = eval(input()) a = np.array(list(map(int, input().split()))) a = a // 400 b = set() sa = 0 ans = 0 for i in a: if i >= 8: sa += 1 else: ...
# レート 1-399:灰色 # レート 400-799:茶色 # レート 800-1199:緑色 # レート 1200-1599:水色 # レート 1600-1999:青色 # レート 2000-2399:黄色 # レート 2400-2799:橙色 # レート 2800-3199:赤色 from collections import Counter n = eval(input()) c = Counter([min(int(i) // 400, 8) for i in input().split()]) ans = 0 for i in range(8): ans += 1 if c[i] > 0 else 0 pri...
false
29.166667
[ "-import numpy as np", "+from collections import Counter", "-a = np.array(list(map(int, input().split())))", "-a = a // 400", "-b = set()", "-sa = 0", "+c = Counter([min(int(i) // 400, 8) for i in input().split()])", "-for i in a:", "- if i >= 8:", "- sa += 1", "- else:", "- ...
false
0.172745
0.126467
1.365927
[ "s902941735", "s720890640" ]
u123756661
p02924
python
s110162741
s816226674
189
166
38,384
38,384
Accepted
Accepted
12.17
n=int(eval(input())) t=n-1 ans=t*(t+1) print((ans//2))
n=int(eval(input()))-1 print((n*(n+1)//2))
4
2
50
35
n = int(eval(input())) t = n - 1 ans = t * (t + 1) print((ans // 2))
n = int(eval(input())) - 1 print((n * (n + 1) // 2))
false
50
[ "-n = int(eval(input()))", "-t = n - 1", "-ans = t * (t + 1)", "-print((ans // 2))", "+n = int(eval(input())) - 1", "+print((n * (n + 1) // 2))" ]
false
0.046059
0.041664
1.105487
[ "s110162741", "s816226674" ]
u197968862
p02743
python
s711506339
s997632271
34
18
5,076
2,940
Accepted
Accepted
47.06
from decimal import * a, b, c = list(map(int, input().split())) if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt(): print("Yes") else: print("No")
a, b, c = list(map(int,input().split())) f = c - a - b if f > 0 and f ** 2 > 4 * a * b: print('Yes') else: print('No')
7
7
166
127
from decimal import * a, b, c = list(map(int, input().split())) if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt(): print("Yes") else: print("No")
a, b, c = list(map(int, input().split())) f = c - a - b if f > 0 and f**2 > 4 * a * b: print("Yes") else: print("No")
false
0
[ "-from decimal import *", "-", "-if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():", "+f = c - a - b", "+if f > 0 and f**2 > 4 * a * b:" ]
false
0.036695
0.036936
0.993477
[ "s711506339", "s997632271" ]
u347397127
p02614
python
s792860464
s036829149
156
143
73,904
9,220
Accepted
Accepted
8.33
import itertools import copy h,w,k = list(map(int,input().split())) C = [list(eval(input())) for i in range(h)] ans = 0 for i in range(h+1): for j in range(w+1): for high in itertools.combinations(list(range(h)),i): for width in itertools.combinations(list(range(w)),j): C2 = copy.deepcopy(C...
import itertools,copy h,w,k = list(map(int,input().split())) C = [list(eval(input())) for i in range(h)] ans = 0 for bith in range(2**h): for bitw in range(2**w): Ccopy = copy.deepcopy(C) for high in range(h): if (1 & bith>>high): for i in range(w): Ccopy[high][i] = "." ...
20
18
584
517
import itertools import copy h, w, k = list(map(int, input().split())) C = [list(eval(input())) for i in range(h)] ans = 0 for i in range(h + 1): for j in range(w + 1): for high in itertools.combinations(list(range(h)), i): for width in itertools.combinations(list(range(w)), j): ...
import itertools, copy h, w, k = list(map(int, input().split())) C = [list(eval(input())) for i in range(h)] ans = 0 for bith in range(2**h): for bitw in range(2**w): Ccopy = copy.deepcopy(C) for high in range(h): if 1 & bith >> high: for i in range(w): ...
false
10
[ "-import itertools", "-import copy", "+import itertools, copy", "-for i in range(h + 1):", "- for j in range(w + 1):", "- for high in itertools.combinations(list(range(h)), i):", "- for width in itertools.combinations(list(range(w)), j):", "- C2 = copy.deepcopy(C)",...
false
0.039138
0.050709
0.771823
[ "s792860464", "s036829149" ]
u150984829
p02386
python
s854132804
s706514324
80
40
5,608
5,604
Accepted
Accepted
50
def f(): for c in range(n): for d in a[c+1:]: for p in('012345','152043','215304','302541','410352','514320'): f=[d[int(i)]for i in p] if f[::5]==a[c][::5]: f=f[1:5]*2 for k in range(4): if f[k:k+4]==a[c][1:5]:return"No" return"Yes" b=0 n=int(eval(input())) a=[input().split()f...
def f(): for c in range(n): for d in a[c+1:]: for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]): f=[d[i]for i in p] if f[::5]==a[c][::5]: f=f[1:5]*2 for k in range(4): if f[k:k+4]==a[c][1:5]:return"No" return"Yes" b=0 n=int(eval(input...
15
15
369
394
def f(): for c in range(n): for d in a[c + 1 :]: for p in ("012345", "152043", "215304", "302541", "410352", "514320"): f = [d[int(i)] for i in p] if f[::5] == a[c][::5]: f = f[1:5] * 2 for k in range(4): ...
def f(): for c in range(n): for d in a[c + 1 :]: for p in ( [0, 1, 2, 3, 4, 5], [1, 5, 2, 0, 4, 3], [2, 1, 5, 3, 0, 4], [3, 0, 2, 5, 4, 1], [4, 1, 0, 3, 5, 2], [5, 1, 4, 3, 2, 0], ): ...
false
0
[ "- for p in (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):", "- f = [d[int(i)] for i in p]", "+ for p in (", "+ [0, 1, 2, 3, 4, 5],", "+ [1, 5, 2, 0, 4, 3],", "+ [2, 1, 5, 3, 0, 4],", "+ ...
false
0.053744
0.038109
1.410278
[ "s854132804", "s706514324" ]
u562935282
p03141
python
s667868643
s770075683
394
360
21,308
7,452
Accepted
Accepted
8.63
n = int(eval(input())) ab = [tuple(map(int, input().split())) for _ in range(n)] ab.sort(key=lambda x: sum(x), reverse=True) s = sum(a for a, _ in ab) s -= sum(sum(dish) for dish in ab[1::2]) print(s)
n = int(eval(input())) e = [] curr = 0 for _ in range(n): a, b = list(map(int, input().split())) e.append(a + b) curr -= b e.sort(reverse=True) print((curr + sum(e[::2])))
6
11
200
182
n = int(eval(input())) ab = [tuple(map(int, input().split())) for _ in range(n)] ab.sort(key=lambda x: sum(x), reverse=True) s = sum(a for a, _ in ab) s -= sum(sum(dish) for dish in ab[1::2]) print(s)
n = int(eval(input())) e = [] curr = 0 for _ in range(n): a, b = list(map(int, input().split())) e.append(a + b) curr -= b e.sort(reverse=True) print((curr + sum(e[::2])))
false
45.454545
[ "-ab = [tuple(map(int, input().split())) for _ in range(n)]", "-ab.sort(key=lambda x: sum(x), reverse=True)", "-s = sum(a for a, _ in ab)", "-s -= sum(sum(dish) for dish in ab[1::2])", "-print(s)", "+e = []", "+curr = 0", "+for _ in range(n):", "+ a, b = list(map(int, input().split()))", "+ ...
false
0.040699
0.037808
1.076465
[ "s667868643", "s770075683" ]
u864013199
p03450
python
s244730825
s525457218
1,256
1,038
102,432
98,664
Accepted
Accepted
17.36
from collections import deque N,M = list(map(int,input().split())) Tree = [[] for _ in range(N)] for _ in range(M): L,R,D = list(map(int,input().split())) L -= 1; R -= 1 Tree[L].append((R,D)) Tree[R].append((L,-D)) num = dict() for i in range(N): if i not in num: num[i] = 0 ...
from collections import deque import sys input = sys.stdin.readline #文字列入力では注意! N,M = list(map(int,input().split())) Graph = [[] for _ in range(N)] for _ in range(M): L,R,D = list(map(int,input().split())) L -= 1; R -= 1 Graph[L].append((R,D)) Graph[R].append((L,-D)) num = dict() for i i...
27
29
672
731
from collections import deque N, M = list(map(int, input().split())) Tree = [[] for _ in range(N)] for _ in range(M): L, R, D = list(map(int, input().split())) L -= 1 R -= 1 Tree[L].append((R, D)) Tree[R].append((L, -D)) num = dict() for i in range(N): if i not in num: num[i] = 0 ...
from collections import deque import sys input = sys.stdin.readline # 文字列入力では注意! N, M = list(map(int, input().split())) Graph = [[] for _ in range(N)] for _ in range(M): L, R, D = list(map(int, input().split())) L -= 1 R -= 1 Graph[L].append((R, D)) Graph[R].append((L, -D)) num = dict() for i in r...
false
6.896552
[ "+import sys", "+input = sys.stdin.readline # 文字列入力では注意!", "-Tree = [[] for _ in range(N)]", "+Graph = [[] for _ in range(N)]", "- Tree[L].append((R, D))", "- Tree[R].append((L, -D))", "+ Graph[L].append((R, D))", "+ Graph[R].append((L, -D))", "- Q = deque(Tree[i])", "+ ...
false
0.041259
0.155827
0.264777
[ "s244730825", "s525457218" ]
u369142620
p03206
python
s146493642
s184999337
19
17
3,060
2,940
Accepted
Accepted
10.53
D= int(eval(input())); C = "Christmas"; E = " Eve"; if D==25: print(C); elif 21 < D < 25: print((C+(E*(25-D))));
D = int(eval(input())) chris = 'Christmas' eve = ' Eve' num = 25 if D in range(22,25): num -= D eve = ' Eve' * num chris += eve print(chris)
9
12
123
161
D = int(eval(input())) C = "Christmas" E = " Eve" if D == 25: print(C) elif 21 < D < 25: print((C + (E * (25 - D))))
D = int(eval(input())) chris = "Christmas" eve = " Eve" num = 25 if D in range(22, 25): num -= D eve = " Eve" * num chris += eve print(chris)
false
25
[ "-C = \"Christmas\"", "-E = \" Eve\"", "-if D == 25:", "- print(C)", "-elif 21 < D < 25:", "- print((C + (E * (25 - D))))", "+chris = \"Christmas\"", "+eve = \" Eve\"", "+num = 25", "+if D in range(22, 25):", "+ num -= D", "+ eve = \" Eve\" * num", "+ chris += eve", "+print(...
false
0.039896
0.041358
0.964662
[ "s146493642", "s184999337" ]
u846155148
p03795
python
s942400830
s290313655
29
23
9,012
9,160
Accepted
Accepted
20.69
N = int( eval(input()) ) x = int( 800 * N ) # 15食食べるごとに200円もらえる y = int( N / 15 ) *200 print(( x - y ))
# 1食800円をN食食べた N = int( eval(input()) ) x = int( 800 * N ) # 15食食べるごとに200円もらえる y = N // 15 * 200 print(( x - y ))
8
9
106
117
N = int(eval(input())) x = int(800 * N) # 15食食べるごとに200円もらえる y = int(N / 15) * 200 print((x - y))
# 1食800円をN食食べた N = int(eval(input())) x = int(800 * N) # 15食食べるごとに200円もらえる y = N // 15 * 200 print((x - y))
false
11.111111
[ "+# 1食800円をN食食べた", "-y = int(N / 15) * 200", "+y = N // 15 * 200" ]
false
0.045875
0.043824
1.046804
[ "s942400830", "s290313655" ]
u871980676
p02883
python
s356147074
s861346260
477
415
37,240
37,236
Accepted
Accepted
13
import numpy as np import sys input = sys.stdin.readline N, K = list(map(int,input().split())) A = np.sort(list(map(int,input().split()))) F = np.sort(list(map(int,input().split())))[::-1] mul = A*F if K >= sum(A)*N: print((0)) exit() ma = 2**40 mi = 0 while ma != mi: tgt = (ma + mi)//2 ...
import numpy as np import sys input = sys.stdin.readline N, K = list(map(int,input().split())) A = np.sort(list(map(int,input().split()))) F = np.sort(list(map(int,input().split())))[::-1] mul = A*F if K >= np.sum(A)*N: print((0)) exit() ma = A[-1]*F[0] mi = 0 while ma != mi: tgt = (ma + mi)/...
22
22
474
473
import numpy as np import sys input = sys.stdin.readline N, K = list(map(int, input().split())) A = np.sort(list(map(int, input().split()))) F = np.sort(list(map(int, input().split())))[::-1] mul = A * F if K >= sum(A) * N: print((0)) exit() ma = 2**40 mi = 0 while ma != mi: tgt = (ma + mi) // 2 tmp = ...
import numpy as np import sys input = sys.stdin.readline N, K = list(map(int, input().split())) A = np.sort(list(map(int, input().split()))) F = np.sort(list(map(int, input().split())))[::-1] mul = A * F if K >= np.sum(A) * N: print((0)) exit() ma = A[-1] * F[0] mi = 0 while ma != mi: tgt = (ma + mi) // 2 ...
false
0
[ "-if K >= sum(A) * N:", "+if K >= np.sum(A) * N:", "-ma = 2**40", "+ma = A[-1] * F[0]", "- ma = mi + (ma - mi) // 2", "+ ma = (ma + mi) // 2", "- mi = mi + (ma - mi) // 2 + 1", "+ mi = (ma + mi) // 2 + 1" ]
false
0.47254
0.194556
2.428806
[ "s356147074", "s861346260" ]
u111365362
p02630
python
s649700402
s935111919
425
322
83,364
106,012
Accepted
Accepted
24.24
n = int(eval(input())) a = list(map(int,input().split())) b = [0 for _ in range(100001)] for x in a: b[x] += 1 ans = sum(a) q = int(eval(input())) for _ in range(q): x,y = list(map(int,input().split())) ans += (y-x) * b[x] b[x],b[y] = 0,b[x]+b[y] print(ans)
#15:30 n = int(eval(input())) a = list(map(int,input().split())) b = {} for x in a: b[x] = 0 q = int(eval(input())) inp = [] for _ in range(q): x,y = list(map(int,input().split())) b[x] = 0 b[y] = 0 inp.append([x,y]) for x in a: b[x] += 1 ans = sum(a) for z in inp: x,y = z ans += (y-x)...
12
21
260
350
n = int(eval(input())) a = list(map(int, input().split())) b = [0 for _ in range(100001)] for x in a: b[x] += 1 ans = sum(a) q = int(eval(input())) for _ in range(q): x, y = list(map(int, input().split())) ans += (y - x) * b[x] b[x], b[y] = 0, b[x] + b[y] print(ans)
# 15:30 n = int(eval(input())) a = list(map(int, input().split())) b = {} for x in a: b[x] = 0 q = int(eval(input())) inp = [] for _ in range(q): x, y = list(map(int, input().split())) b[x] = 0 b[y] = 0 inp.append([x, y]) for x in a: b[x] += 1 ans = sum(a) for z in inp: x, y = z ans += (...
false
42.857143
[ "+# 15:30", "-b = [0 for _ in range(100001)]", "+b = {}", "+for x in a:", "+ b[x] = 0", "+q = int(eval(input()))", "+inp = []", "+for _ in range(q):", "+ x, y = list(map(int, input().split()))", "+ b[x] = 0", "+ b[y] = 0", "+ inp.append([x, y])", "-q = int(eval(input()))", "...
false
0.045314
0.09442
0.479915
[ "s649700402", "s935111919" ]
u018679195
p02759
python
s847265993
s034413004
19
17
3,060
2,940
Accepted
Accepted
10.53
N = int(eval(input())) print(((N + 1) // 2)) #sjdjsdajkjkafffjfjfjfjfjjfjf
n = int(eval(input())) if n % 2 == 0: print((n//2)) else: print((n//2 + 1))
3
5
69
79
N = int(eval(input())) print(((N + 1) // 2)) # sjdjsdajkjkafffjfjfjfjfjjfjf
n = int(eval(input())) if n % 2 == 0: print((n // 2)) else: print((n // 2 + 1))
false
40
[ "-N = int(eval(input()))", "-print(((N + 1) // 2))", "-# sjdjsdajkjkafffjfjfjfjfjjfjf", "+n = int(eval(input()))", "+if n % 2 == 0:", "+ print((n // 2))", "+else:", "+ print((n // 2 + 1))" ]
false
0.046993
0.056859
0.826483
[ "s847265993", "s034413004" ]
u197615397
p02348
python
s128668489
s643120377
3,590
3,120
19,784
19,800
Accepted
Accepted
13.09
import math def lazy_update(s, e, value): a = [(1, l+s, l+e, 1)] while a: k, s, e, depth = a.pop() l_end, r_end = k << (rank-depth), (k+1) << (rank-depth) mid = (l_end + r_end) // 2 if s == l_end and e == r_end: lazy[k] = value else: if l...
import math def lazy_update(s, e, value): a = [(1, l+s, l+e, 1)] ap = a.append while a: k, s, e, depth = a.pop() l_end, r_end = k << (rank-depth), (k+1) << (rank-depth) mid = (l_end + r_end) // 2 if s == l_end and e == r_end: lazy[k] = value el...
43
46
1,189
1,232
import math def lazy_update(s, e, value): a = [(1, l + s, l + e, 1)] while a: k, s, e, depth = a.pop() l_end, r_end = k << (rank - depth), (k + 1) << (rank - depth) mid = (l_end + r_end) // 2 if s == l_end and e == r_end: lazy[k] = value else: if...
import math def lazy_update(s, e, value): a = [(1, l + s, l + e, 1)] ap = a.append while a: k, s, e, depth = a.pop() l_end, r_end = k << (rank - depth), (k + 1) << (rank - depth) mid = (l_end + r_end) // 2 if s == l_end and e == r_end: lazy[k] = value el...
false
6.521739
[ "+ ap = a.append", "+ child = k << 1", "- lazy[k << 1] = lazy[k]", "- lazy[(k << 1) + 1] = lazy[k]", "+ lazy[child] = lazy[k]", "+ lazy[child + 1] = lazy[k]", "- a.append((k << 1, s, min(mid, e), depth + 1))", "+ ...
false
0.036022
0.037928
0.949729
[ "s128668489", "s643120377" ]
u467129921
p00425
python
s374750918
s182178492
20
10
4,848
4,856
Accepted
Accepted
50
while 1: n = eval(input()) if n == 0: break d = list(range(1, 7)) ans = 1 for i in range(n): c = input()[0] if c == 'N': S = [1,5,2,3,0,4] elif c == "S": S = [4,0,2,3,5,1] elif c == "E": S = [3,1,0,5,4,2] elif c == "W": S = [2,1,5,0,4,3] elif c == "R": S = [0,2,4,1,3,5] ...
import sys operator = sys.stdin.read().split() top = 1 bottom = 6 south = 2 north = 5 east = 3 west = 4 sum = 1 for var in operator[1:]: if var == "North": north,top,south,bottom = top,south,bottom,north sum += top elif var == "South": south,top,north,bottom...
16
40
403
920
while 1: n = eval(input()) if n == 0: break d = list(range(1, 7)) ans = 1 for i in range(n): c = input()[0] if c == "N": S = [1, 5, 2, 3, 0, 4] elif c == "S": S = [4, 0, 2, 3, 5, 1] elif c == "E": S = [3, 1, 0, 5, 4, 2] ...
import sys operator = sys.stdin.read().split() top = 1 bottom = 6 south = 2 north = 5 east = 3 west = 4 sum = 1 for var in operator[1:]: if var == "North": north, top, south, bottom = top, south, bottom, north sum += top elif var == "South": south, top, north, bottom = top, north, botto...
false
60
[ "-while 1:", "- n = eval(input())", "- if n == 0:", "- break", "- d = list(range(1, 7))", "- ans = 1", "- for i in range(n):", "- c = input()[0]", "- if c == \"N\":", "- S = [1, 5, 2, 3, 0, 4]", "- elif c == \"S\":", "- S = [4, 0...
false
0.049303
0.04979
0.990222
[ "s374750918", "s182178492" ]
u423665486
p03721
python
s524201954
s644486287
563
294
45,400
5,744
Accepted
Accepted
47.78
def resolve(): n, k = list(map(int, input().split())) arr = [0]*(10**5+1) for i in range(n): a, b = list(map(int, input().split())) arr[a] += b for i in range(len(arr)): if arr[i] >= k: print(i) break k -= arr[i] resolve()
def resolve(): n, k = list(map(int, input().split())) B = [0]*10**5 for _ in range(n): a, b = list(map(int, input().split())) B[a-1] += b cnt = 0 for i in range(len(B)): cnt += B[i] if cnt >= k: print((i+1)) break resolve()
12
13
239
240
def resolve(): n, k = list(map(int, input().split())) arr = [0] * (10**5 + 1) for i in range(n): a, b = list(map(int, input().split())) arr[a] += b for i in range(len(arr)): if arr[i] >= k: print(i) break k -= arr[i] resolve()
def resolve(): n, k = list(map(int, input().split())) B = [0] * 10**5 for _ in range(n): a, b = list(map(int, input().split())) B[a - 1] += b cnt = 0 for i in range(len(B)): cnt += B[i] if cnt >= k: print((i + 1)) break resolve()
false
7.692308
[ "- arr = [0] * (10**5 + 1)", "- for i in range(n):", "+ B = [0] * 10**5", "+ for _ in range(n):", "- arr[a] += b", "- for i in range(len(arr)):", "- if arr[i] >= k:", "- print(i)", "+ B[a - 1] += b", "+ cnt = 0", "+ for i in range(len(B)):", ...
false
0.07679
0.048076
1.59725
[ "s524201954", "s644486287" ]
u281303342
p03416
python
s572331718
s314864236
66
50
2,940
2,940
Accepted
Accepted
24.24
A,B = list(map(int,input().split())) n=0 for i in range(A,B+1): if i == int(str(i)[::-1]): n+=1 print(n)
A,B = list(map(int,input().split())) ans = 0 for i in range(A,B+1): s = str(i) if s == s[::-1]: ans += 1 print(ans)
6
9
115
136
A, B = list(map(int, input().split())) n = 0 for i in range(A, B + 1): if i == int(str(i)[::-1]): n += 1 print(n)
A, B = list(map(int, input().split())) ans = 0 for i in range(A, B + 1): s = str(i) if s == s[::-1]: ans += 1 print(ans)
false
33.333333
[ "-n = 0", "+ans = 0", "- if i == int(str(i)[::-1]):", "- n += 1", "-print(n)", "+ s = str(i)", "+ if s == s[::-1]:", "+ ans += 1", "+print(ans)" ]
false
0.059743
0.122125
0.489195
[ "s572331718", "s314864236" ]
u307622233
p02642
python
s482376235
s113337831
1,416
266
51,504
32,164
Accepted
Accepted
81.21
import numpy as np def main(): n = int(eval(input())) A = [int(i) for i in input().split()] max_dp = max(A) + 1 dp = np.zeros(max_dp, dtype="int32") for a in A: if dp[a] >= 2: continue dp[np.arange(a, max_dp, a)] += 2 dp[a] -= 1 print((n...
def main(): n = int(eval(input())) A = [int(i) for i in input().split()] max_dp = max(A) + 1 dp = [0] * max_dp for a in A: if dp[a] >= 2: continue dp[a] += 1 for i in range(a << 1, max_dp, a): dp[i] += 2 print((dp.count(1))) ...
22
20
373
352
import numpy as np def main(): n = int(eval(input())) A = [int(i) for i in input().split()] max_dp = max(A) + 1 dp = np.zeros(max_dp, dtype="int32") for a in A: if dp[a] >= 2: continue dp[np.arange(a, max_dp, a)] += 2 dp[a] -= 1 print((np.sum(dp == 1))) if...
def main(): n = int(eval(input())) A = [int(i) for i in input().split()] max_dp = max(A) + 1 dp = [0] * max_dp for a in A: if dp[a] >= 2: continue dp[a] += 1 for i in range(a << 1, max_dp, a): dp[i] += 2 print((dp.count(1))) if __name__ == "__mai...
false
9.090909
[ "-import numpy as np", "-", "-", "- dp = np.zeros(max_dp, dtype=\"int32\")", "+ dp = [0] * max_dp", "- dp[np.arange(a, max_dp, a)] += 2", "- dp[a] -= 1", "- print((np.sum(dp == 1)))", "+ dp[a] += 1", "+ for i in range(a << 1, max_dp, a):", "+ dp[i]...
false
0.2993
0.082801
3.614703
[ "s482376235", "s113337831" ]
u821624310
p02257
python
s169775243
s277111536
1,610
1,190
7,760
7,728
Accepted
Accepted
26.09
import math cnt = 0 N = int(input()) for n in range(N): i = int(input()) if i == 2\ or i == 3\ or i == 5\ or i == 7: cnt += 1 elif i % 2 == 0: continue else: j = 3 prime = 1 while j >= 3 and j <= int(math.sqrt(i)): if i % j ...
import math n = int(input()) cnt = 0 for i in range(n): x = int(input()) if x == 2: cnt += 1 elif x <= 1\ or x % 2 == 0: continue else: j = 3 prime = "yes" while j <= math.sqrt(x): if x % j == 0: prime = "no" ...
25
22
473
439
import math cnt = 0 N = int(input()) for n in range(N): i = int(input()) if i == 2 or i == 3 or i == 5 or i == 7: cnt += 1 elif i % 2 == 0: continue else: j = 3 prime = 1 while j >= 3 and j <= int(math.sqrt(i)): if i % j == 0: prime = ...
import math n = int(input()) cnt = 0 for i in range(n): x = int(input()) if x == 2: cnt += 1 elif x <= 1 or x % 2 == 0: continue else: j = 3 prime = "yes" while j <= math.sqrt(x): if x % j == 0: prime = "no" break ...
false
12
[ "+n = int(input())", "-N = int(input())", "-for n in range(N):", "- i = int(input())", "- if i == 2 or i == 3 or i == 5 or i == 7:", "+for i in range(n):", "+ x = int(input())", "+ if x == 2:", "- elif i % 2 == 0:", "+ elif x <= 1 or x % 2 == 0:", "- prime = 1", "- ...
false
0.037556
0.036618
1.02562
[ "s169775243", "s277111536" ]
u729133443
p03987
python
s126691067
s550683702
988
709
104,764
26,316
Accepted
Accepted
28.24
from bisect import* class SqrtSet: def __init__(self,block_limit=201): self.key=[] self.child=[[]] self.block_limit=block_limit def search_lower(self,key): if not key:return None ret=None i=bisect_left(self.key,key) if i:ret=self.key[i-1] ...
class UnionFind(): def __init__(self,size): self.table=[-1]*size def root(self,x): while self.table[x]>=0: x=self.table[x] return x def unite(self,x,y): s1=self.root(x) s2=self.root(y) if s1!=s2: if self.table[s1]>self.table[...
46
35
1,330
892
from bisect import * class SqrtSet: def __init__(self, block_limit=201): self.key = [] self.child = [[]] self.block_limit = block_limit def search_lower(self, key): if not key: return None ret = None i = bisect_left(self.key, key) if i: ...
class UnionFind: def __init__(self, size): self.table = [-1] * size def root(self, x): while self.table[x] >= 0: x = self.table[x] return x def unite(self, x, y): s1 = self.root(x) s2 = self.root(y) if s1 != s2: if self.table[s1] > se...
false
23.913043
[ "-from bisect import *", "+class UnionFind:", "+ def __init__(self, size):", "+ self.table = [-1] * size", "+", "+ def root(self, x):", "+ while self.table[x] >= 0:", "+ x = self.table[x]", "+ return x", "+", "+ def unite(self, x, y):", "+ s1 = s...
false
0.049893
0.048005
1.039337
[ "s126691067", "s550683702" ]
u957872856
p03455
python
s447047712
s214954347
19
17
2,940
2,940
Accepted
Accepted
10.53
a, b = list(map(int, input().split())) sum = a*b if sum % 2 == 0: print("Even") else: print("Odd")
a, b = list(map(int,input().split())) if (a*b) % 2 == 0: print("Even") else: print("Odd")
7
5
106
91
a, b = list(map(int, input().split())) sum = a * b if sum % 2 == 0: print("Even") else: print("Odd")
a, b = list(map(int, input().split())) if (a * b) % 2 == 0: print("Even") else: print("Odd")
false
28.571429
[ "-sum = a * b", "-if sum % 2 == 0:", "+if (a * b) % 2 == 0:" ]
false
0.047686
0.048125
0.990893
[ "s447047712", "s214954347" ]
u729133443
p03059
python
s021365032
s139540623
166
26
38,460
9,044
Accepted
Accepted
84.34
a,b,t=list(map(int,input().split()));print((t//a*b))
a,b,c=list(map(int,input().split())) print((c//a*b))
1
2
44
45
a, b, t = list(map(int, input().split())) print((t // a * b))
a, b, c = list(map(int, input().split())) print((c // a * b))
false
50
[ "-a, b, t = list(map(int, input().split()))", "-print((t // a * b))", "+a, b, c = list(map(int, input().split()))", "+print((c // a * b))" ]
false
0.037857
0.066487
0.569392
[ "s021365032", "s139540623" ]
u477977638
p02839
python
s212977116
s063325482
1,946
70
676,488
13,940
Accepted
Accepted
96.4
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines # mod=10**9+7 # rstrip().decode('utf-8') # map(int,input().split()) # import numpy as np def main(): h, w = list(map(int, input().split())) G = [[0] * w for i in range(h)] A = [0]*h B...
import sys #input = sys.stdin.readline input = sys.stdin.buffer.readline # mod=10**9+7 # rstrip().decode('utf-8') # map(int,input().split()) # import numpy as np def main(): h,w=list(map(int,input().split())) A=[list(map(int,input().split())) for _ in range(h)] B=[list(map(int,input().split())) for _...
53
37
1,069
864
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines # mod=10**9+7 # rstrip().decode('utf-8') # map(int,input().split()) # import numpy as np def main(): h, w = list(map(int, input().split())) G = [[0] * w for i in range(h)] A = [0] * h B = [0] *...
import sys # input = sys.stdin.readline input = sys.stdin.buffer.readline # mod=10**9+7 # rstrip().decode('utf-8') # map(int,input().split()) # import numpy as np def main(): h, w = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(h)] B = [list(map(int, input().split())) ...
false
30.188679
[ "-read = sys.stdin.buffer.read", "+# input = sys.stdin.readline", "-inputs = sys.stdin.buffer.readlines", "- G = [[0] * w for i in range(h)]", "- A = [0] * h", "- B = [0] * h", "- for i in range(h):", "- A[i] = list(map(int, input().split()))", "- for i in range(h):", "- ...
false
0.089498
0.037806
2.367307
[ "s212977116", "s063325482" ]
u678167152
p03610
python
s279191570
s909769283
168
17
39,536
3,192
Accepted
Accepted
89.88
S = eval(input()) ans = S[::2] print(ans)
print((input()[::2]))
3
1
37
19
S = eval(input()) ans = S[::2] print(ans)
print((input()[::2]))
false
66.666667
[ "-S = eval(input())", "-ans = S[::2]", "-print(ans)", "+print((input()[::2]))" ]
false
0.115417
0.044473
2.595209
[ "s279191570", "s909769283" ]
u771167374
p03999
python
s156090990
s248154674
29
25
9,096
9,112
Accepted
Accepted
13.79
s = eval(input()) n = len(s) all_sum = 0 #0から(2^n-1)-1までループ for bit in range(1<<(n-1)): func = s[0] for i in range(n-1): if bit & (1<<i): func += "+" func += s[i+1] all_sum += sum(map(int, func.split('+'))) print(all_sum)
def dfs(i, f): if i == n-1: #もし枝が最後のけたに到達したら、という条件式 return sum (list(map(int, f.split('+')))) #式fの末尾に'+'を追加する/追加しないをして次の数字を追加 return dfs(i+1, f+s[i+1]) + dfs(i+1, f+'+'+s[i+1]) s = eval(input()) n = len(s) print((dfs(0, s[0])))
13
9
273
253
s = eval(input()) n = len(s) all_sum = 0 # 0から(2^n-1)-1までループ for bit in range(1 << (n - 1)): func = s[0] for i in range(n - 1): if bit & (1 << i): func += "+" func += s[i + 1] all_sum += sum(map(int, func.split("+"))) print(all_sum)
def dfs(i, f): if i == n - 1: # もし枝が最後のけたに到達したら、という条件式 return sum(list(map(int, f.split("+")))) # 式fの末尾に'+'を追加する/追加しないをして次の数字を追加 return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1]) s = eval(input()) n = len(s) print((dfs(0, s[0])))
false
30.769231
[ "+def dfs(i, f):", "+ if i == n - 1: # もし枝が最後のけたに到達したら、という条件式", "+ return sum(list(map(int, f.split(\"+\"))))", "+ # 式fの末尾に'+'を追加する/追加しないをして次の数字を追加", "+ return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + \"+\" + s[i + 1])", "+", "+", "-all_sum = 0", "-# 0から(2^n-1)-1までループ", "-for bit...
false
0.042729
0.040698
1.049901
[ "s156090990", "s248154674" ]
u947883560
p03372
python
s727340586
s103990891
309
264
35,116
26,532
Accepted
Accepted
14.56
#!/usr/bin/env python3 import sys from itertools import accumulate INF = float("inf") def solve(N: int, C: int, x: "List[int]", v: "List[int]"): # 時計回りターンなし nt_cost = x nt_benefit = list(accumulate(v)) nt_callory = [b-c for c, b in zip(nt_cost, nt_benefit)] nt_callory_acc = list(accum...
#!/usr/bin/env python3 import sys from itertools import accumulate INF = float("inf") def solve(N: int, C: int, x: "List[int]", v: "List[int]"): # 時計回りターンなし nt_cost = x nt_benefit = accumulate(v) nt_callory = [b-c for c, b in zip(nt_cost, nt_benefit)] nt_callory_acc = list(accumulate(...
65
54
1,752
1,441
#!/usr/bin/env python3 import sys from itertools import accumulate INF = float("inf") def solve(N: int, C: int, x: "List[int]", v: "List[int]"): # 時計回りターンなし nt_cost = x nt_benefit = list(accumulate(v)) nt_callory = [b - c for c, b in zip(nt_cost, nt_benefit)] nt_callory_acc = list(accumulate(nt_c...
#!/usr/bin/env python3 import sys from itertools import accumulate INF = float("inf") def solve(N: int, C: int, x: "List[int]", v: "List[int]"): # 時計回りターンなし nt_cost = x nt_benefit = accumulate(v) nt_callory = [b - c for c, b in zip(nt_cost, nt_benefit)] nt_callory_acc = list(accumulate([0] + nt_c...
false
16.923077
[ "- nt_benefit = list(accumulate(v))", "+ nt_benefit = accumulate(v)", "- nt_callory_acc = list(accumulate(nt_callory, max)) + [0]", "- # [0]はモンキーパッチ。後に負の参照をした場合に参照させる用", "- # print(nt_callory)", "- # print(nt_callory_acc)", "+ nt_callory_acc = list(accumulate([0] + nt_callory, max))...
false
0.261233
0.007712
33.875546
[ "s727340586", "s103990891" ]
u219197917
p02767
python
s825433295
s422161178
21
17
3,060
2,940
Accepted
Accepted
19.05
eval(input()) x = sorted([int(i) for i in input().split()]) cost = sum([xi**2 for xi in x]) for p in range(x[0], x[-1] + 1): c = 0 for xi in x: c += (xi - p)**2 cost = min(c, cost) print(cost)
n = int(eval(input())) x = [int(i) for i in input().split()] p = round(sum(x) / n) print((sum((i - p)**2 for i in x)))
9
4
214
113
eval(input()) x = sorted([int(i) for i in input().split()]) cost = sum([xi**2 for xi in x]) for p in range(x[0], x[-1] + 1): c = 0 for xi in x: c += (xi - p) ** 2 cost = min(c, cost) print(cost)
n = int(eval(input())) x = [int(i) for i in input().split()] p = round(sum(x) / n) print((sum((i - p) ** 2 for i in x)))
false
55.555556
[ "-eval(input())", "-x = sorted([int(i) for i in input().split()])", "-cost = sum([xi**2 for xi in x])", "-for p in range(x[0], x[-1] + 1):", "- c = 0", "- for xi in x:", "- c += (xi - p) ** 2", "- cost = min(c, cost)", "-print(cost)", "+n = int(eval(input()))", "+x = [int(i) for ...
false
0.112468
0.046716
2.40748
[ "s825433295", "s422161178" ]
u546338822
p02660
python
s140040353
s093510877
135
110
9,548
9,444
Accepted
Accepted
18.52
def main(): import copy n = int(eval(input())) if n==1: print((0)) return k = copy.deepcopy(int(n**0.5)+2) ans = 0 for i in range(2,k): if n%i==0: m = 1 ans += 1 n = n//i cnt = 0 while n%i==0: ...
def main(): n = int(eval(input())) if n==1: print((0)) return k = int(n**0.5)+1 ans = 0 for i in range(2,k+1): if n%i==0: m = 0 cnt = 0 while n%i==0: cnt +=1 n = int(n/i) if cnt>...
33
27
673
567
def main(): import copy n = int(eval(input())) if n == 1: print((0)) return k = copy.deepcopy(int(n**0.5) + 2) ans = 0 for i in range(2, k): if n % i == 0: m = 1 ans += 1 n = n // i cnt = 0 while n % i == 0: ...
def main(): n = int(eval(input())) if n == 1: print((0)) return k = int(n**0.5) + 1 ans = 0 for i in range(2, k + 1): if n % i == 0: m = 0 cnt = 0 while n % i == 0: cnt += 1 n = int(n / i) if ...
false
18.181818
[ "- import copy", "-", "- k = copy.deepcopy(int(n**0.5) + 2)", "+ k = int(n**0.5) + 1", "- for i in range(2, k):", "+ for i in range(2, k + 1):", "- m = 1", "- ans += 1", "- n = n // i", "+ m = 0", "- n = n // i", "+ ...
false
0.047908
0.047678
1.00481
[ "s140040353", "s093510877" ]
u903005414
p02768
python
s252498047
s813885285
1,894
251
26,112
26,144
Accepted
Accepted
86.75
import numpy as np n, a, b = list(map(int, input().split())) a, b = min(a, b), max(a, b) MOD = 10**9 + 7 v = pow(2, n, MOD) - 1 def cumprod(arr, MOD): L = len(arr) Lsq = int(L**.5 + 1) arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq) for n in range(1, Lsq): arr[:, n] *= arr[:, n - 1]...
import numpy as np n, a, b = list(map(int, input().split())) a, b = min(a, b), max(a, b) MOD = 10**9 + 7 v = pow(2, n, MOD) - 1 def cumprod(arr, MOD): L = len(arr) Lsq = int(L**.5 + 1) arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq) for n in range(1, Lsq): arr[:, n] *= arr[:, n - 1]...
64
52
1,535
1,223
import numpy as np n, a, b = list(map(int, input().split())) a, b = min(a, b), max(a, b) MOD = 10**9 + 7 v = pow(2, n, MOD) - 1 def cumprod(arr, MOD): L = len(arr) Lsq = int(L**0.5 + 1) arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq) for n in range(1, Lsq): arr[:, n] *= arr[:, n - 1] a...
import numpy as np n, a, b = list(map(int, input().split())) a, b = min(a, b), max(a, b) MOD = 10**9 + 7 v = pow(2, n, MOD) - 1 def cumprod(arr, MOD): L = len(arr) Lsq = int(L**0.5 + 1) arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq) for n in range(1, Lsq): arr[:, n] *= arr[:, n - 1] a...
false
18.75
[ "-# a_fact = fact[a]", "-# b_fact = fact[b]", "+a_fact = fact[a]", "+b_fact = fact[b]", "-# print('an a_fact', an_fact, a_fact)", "-# print('bn b_fact', bn_fact, b_fact)", "-# print('an a_fact', an_fact)", "-# print('bn b_fact', bn_fact)", "+", "+", "-ca = an_fact", "-for i in range(1, a + 1):...
false
1.11616
0.577451
1.93291
[ "s252498047", "s813885285" ]
u671211357
p02683
python
s702519967
s914305178
98
73
9,212
9,220
Accepted
Accepted
25.51
N,M,X=list(map(int,input().split())) CA=[list(map(int,input().split())) for i in range(N)] ans=float("inf") for i in range(2**N): ruikei=[0]*M onedan=0 for j in range(N): if ((i>>j)&1): onedan+=CA[j][0] for k in range(1,M+1): ruikei[k-1]+=CA[j][k] ...
N,M,X=list(map(int,input().split())) CA=[list(map(int,input().split())) for i in range(N)] kotae=[] def saiki(A): if len(A)==N: goukei=[0]*M onedan=0 for i in range(N): if A[i]==1: for j in range(M): goukei[j]+=CA[i][j+1] ...
24
25
552
593
N, M, X = list(map(int, input().split())) CA = [list(map(int, input().split())) for i in range(N)] ans = float("inf") for i in range(2**N): ruikei = [0] * M onedan = 0 for j in range(N): if (i >> j) & 1: onedan += CA[j][0] for k in range(1, M + 1): ruikei[k - ...
N, M, X = list(map(int, input().split())) CA = [list(map(int, input().split())) for i in range(N)] kotae = [] def saiki(A): if len(A) == N: goukei = [0] * M onedan = 0 for i in range(N): if A[i] == 1: for j in range(M): goukei[j] += CA[i][j +...
false
4
[ "-ans = float(\"inf\")", "-for i in range(2**N):", "- ruikei = [0] * M", "- onedan = 0", "- for j in range(N):", "- if (i >> j) & 1:", "- onedan += CA[j][0]", "- for k in range(1, M + 1):", "- ruikei[k - 1] += CA[j][k]", "- # print(onedan)", ...
false
0.038492
0.039452
0.975647
[ "s702519967", "s914305178" ]
u102902647
p03160
python
s073729887
s929746949
292
131
19,984
20,476
Accepted
Accepted
55.14
N = int(eval(input())) h_list = list(map(int, input().split())) def chmin(a, b): if a > b: return b else: return a import numpy as np dp_list = [np.inf] * N dp_list[0] = 0 dp_list[1] = abs(h_list[1] - h_list[0]) for i in range(2, N): dp_list[i] = chmin(dp_list[i], dp_list[i-1] + ...
N = int(eval(input())) h_list = list(map(int, input().split())) dp_list = [0, abs(h_list[0] - h_list[1])] for n in range(2, N): h0 = h_list[n-2] h1 = h_list[n-1] h2 = h_list[n] tmp_min = min(abs(h2-h1)+dp_list[n-1], abs(h2-h0)+dp_list[n-2]) dp_list.append(tmp_min) print((dp_list[-1]))
15
12
444
311
N = int(eval(input())) h_list = list(map(int, input().split())) def chmin(a, b): if a > b: return b else: return a import numpy as np dp_list = [np.inf] * N dp_list[0] = 0 dp_list[1] = abs(h_list[1] - h_list[0]) for i in range(2, N): dp_list[i] = chmin(dp_list[i], dp_list[i - 1] + abs(h...
N = int(eval(input())) h_list = list(map(int, input().split())) dp_list = [0, abs(h_list[0] - h_list[1])] for n in range(2, N): h0 = h_list[n - 2] h1 = h_list[n - 1] h2 = h_list[n] tmp_min = min(abs(h2 - h1) + dp_list[n - 1], abs(h2 - h0) + dp_list[n - 2]) dp_list.append(tmp_min) print((dp_list[-1])...
false
20
[ "-", "-", "-def chmin(a, b):", "- if a > b:", "- return b", "- else:", "- return a", "-", "-", "-import numpy as np", "-", "-dp_list = [np.inf] * N", "-dp_list[0] = 0", "-dp_list[1] = abs(h_list[1] - h_list[0])", "-for i in range(2, N):", "- dp_list[i] = chmin(dp...
false
0.47805
0.046002
10.392051
[ "s073729887", "s929746949" ]
u968166680
p02936
python
s907907836
s899005370
1,530
907
274,424
63,504
Accepted
Accepted
40.72
import sys readline = sys.stdin.readline sys.setrecursionlimit(10 ** 9) def main(): N, Q = list(map(int, readline().split())) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = list(map(int, readline().split())) G[a - 1].append(b - 1) G[b - 1].append(a - 1) ...
import sys from collections import deque readline = sys.stdin.readline sys.setrecursionlimit(10 ** 9) def main(): N, Q = list(map(int, readline().split())) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = list(map(int, readline().split())) G[a - 1].append(b - 1) ...
34
38
650
800
import sys readline = sys.stdin.readline sys.setrecursionlimit(10**9) def main(): N, Q = list(map(int, readline().split())) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = list(map(int, readline().split())) G[a - 1].append(b - 1) G[b - 1].append(a - 1) X = [0] * N ...
import sys from collections import deque readline = sys.stdin.readline sys.setrecursionlimit(10**9) def main(): N, Q = list(map(int, readline().split())) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = list(map(int, readline().split())) G[a - 1].append(b - 1) G[b - 1].app...
false
10.526316
[ "+from collections import deque", "-", "- def dfs(v, p):", "- C[v] = C[p] + X[v]", "+ C[0] = X[0]", "+ seen = [False] * N", "+ stack = deque([0])", "+ while stack:", "+ v = stack.pop()", "+ seen[v] = True", "- if nv != p:", "- dfs(n...
false
0.078266
0.04034
1.940145
[ "s907907836", "s899005370" ]
u759412327
p03673
python
s095222543
s889364613
169
108
25,156
23,972
Accepted
Accepted
36.09
n = int(eval(input())) a = list(map(int,input().split())) if n%2==0: z = a[::-2]+a[0::2] else: z = a[::-2]+a[1::2] print((*z))
N = int(eval(input())) A = input().split() print((*(A[::-2]+A[N%2::2])))
9
3
132
66
n = int(eval(input())) a = list(map(int, input().split())) if n % 2 == 0: z = a[::-2] + a[0::2] else: z = a[::-2] + a[1::2] print((*z))
N = int(eval(input())) A = input().split() print((*(A[::-2] + A[N % 2 :: 2])))
false
66.666667
[ "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-if n % 2 == 0:", "- z = a[::-2] + a[0::2]", "-else:", "- z = a[::-2] + a[1::2]", "-print((*z))", "+N = int(eval(input()))", "+A = input().split()", "+print((*(A[::-2] + A[N % 2 :: 2])))" ]
false
0.007415
0.037463
0.197924
[ "s095222543", "s889364613" ]
u971091945
p02689
python
s478781865
s028547109
332
259
36,060
20,064
Accepted
Accepted
21.99
n, m = list(map(int, input().split())) h = list(map(int, input().split())) li = list(range(1,n+1)) ab = [list() for _ in range(m)] p = [] ih = dict(list(zip(li, h))) for i in range(m): a, b = list(map(int,input().split())) c = ih[a] d = ih[b] if c>d: p.append(b) elif d>c: ...
n, m = list(map(int,input().split())) h = list(map(int,input().split())) li = [1]*n for i in range(m): a, b = list(map(int,input().split())) if li[a-1] == 1 and h[a-1] <= h[b-1]: li[a-1] = 0 if li[b-1] == 1 and h[b-1] <= h[a-1]: li[b-1] = 0 print((sum(li)))
22
12
398
284
n, m = list(map(int, input().split())) h = list(map(int, input().split())) li = list(range(1, n + 1)) ab = [list() for _ in range(m)] p = [] ih = dict(list(zip(li, h))) for i in range(m): a, b = list(map(int, input().split())) c = ih[a] d = ih[b] if c > d: p.append(b) elif d > c: p.a...
n, m = list(map(int, input().split())) h = list(map(int, input().split())) li = [1] * n for i in range(m): a, b = list(map(int, input().split())) if li[a - 1] == 1 and h[a - 1] <= h[b - 1]: li[a - 1] = 0 if li[b - 1] == 1 and h[b - 1] <= h[a - 1]: li[b - 1] = 0 print((sum(li)))
false
45.454545
[ "-li = list(range(1, n + 1))", "-ab = [list() for _ in range(m)]", "-p = []", "-ih = dict(list(zip(li, h)))", "+li = [1] * n", "- c = ih[a]", "- d = ih[b]", "- if c > d:", "- p.append(b)", "- elif d > c:", "- p.append(a)", "- else:", "- p.append(a)", "- ...
false
0.044866
0.040407
1.110344
[ "s478781865", "s028547109" ]
u644778646
p03215
python
s641780948
s327693329
547
397
147,632
102,136
Accepted
Accepted
27.42
from fractions import gcd from datetime import date, timedelta from heapq import* import math from collections import defaultdict, Counter, deque import sys from bisect import * import itertools import copy sys.setrecursionlimit(10 ** 7) MOD = 10 ** 9 + 7 def main(): n, k = list(map(int, input().spl...
from fractions import gcd from datetime import date, timedelta from heapq import* import math from collections import defaultdict, Counter, deque import sys from bisect import * import itertools import copy sys.setrecursionlimit(10 ** 7) MOD = 10 ** 9 + 7 def main(): n, k = list(map(int, input().spl...
72
52
1,508
1,037
from fractions import gcd from datetime import date, timedelta from heapq import * import math from collections import defaultdict, Counter, deque import sys from bisect import * import itertools import copy sys.setrecursionlimit(10**7) MOD = 10**9 + 7 def main(): n, k = list(map(int, input().split())) a = l...
from fractions import gcd from datetime import date, timedelta from heapq import * import math from collections import defaultdict, Counter, deque import sys from bisect import * import itertools import copy sys.setrecursionlimit(10**7) MOD = 10**9 + 7 def main(): n, k = list(map(int, input().split())) a = l...
false
27.777778
[ "- ansl = []", "+ L = []", "- ansl.append(rui[j + 1] - rui[i])", "- ansl = sorted(ansl, reverse=True)", "- cnt = 0", "- ansbit = 0", "- L = []", "- for i in range(51):", "- bit = 1 << (50 - i)", "- l = []", "- for j in range(len(ansl)):", "-...
false
0.035151
0.041332
0.850443
[ "s641780948", "s327693329" ]
u563838154
p02756
python
s761590043
s837506757
1,869
1,341
4,392
40,616
Accepted
Accepted
28.25
s = eval(input()) q = int(eval(input())) a = [] # for j in range(q): # a.extend([list(map(str,input().split()))]) # # print(a) # for i in a: pre = "" nex = "" c = 1 for j in range(q): i = list(map(str,input().split())) if i ==["1"]: c *= -1 # s = s[::-1] elif i[0]=="2" and...
s = eval(input()) q = int(eval(input())) a = [] # for j in range(q): # a.extend([list(map(str,input().split()))]) # # print(a) # for i in a: pre = "" nex = "" c = 1 TFC = [input().split() for _ in range(q)] for i in TFC: # for j in range(q): # i = list(map(str,input().split())) if i ==["1"]: ...
31
33
635
697
s = eval(input()) q = int(eval(input())) a = [] # for j in range(q): # a.extend([list(map(str,input().split()))]) # # print(a) # for i in a: pre = "" nex = "" c = 1 for j in range(q): i = list(map(str, input().split())) if i == ["1"]: c *= -1 # s = s[::-1] elif i[0] == "2" and i[1] == "1...
s = eval(input()) q = int(eval(input())) a = [] # for j in range(q): # a.extend([list(map(str,input().split()))]) # # print(a) # for i in a: pre = "" nex = "" c = 1 TFC = [input().split() for _ in range(q)] for i in TFC: # for j in range(q): # i = list(map(str,input().split())) if i == ["1"]: ...
false
6.060606
[ "-for j in range(q):", "- i = list(map(str, input().split()))", "+TFC = [input().split() for _ in range(q)]", "+for i in TFC:", "+ # for j in range(q):", "+ # i = list(map(str,input().split()))" ]
false
0.036562
0.036918
0.990373
[ "s761590043", "s837506757" ]
u970197315
p03837
python
s214386441
s157311586
416
96
3,444
73,328
Accepted
Accepted
76.92
# ABC051 D - Candidates of No Shortest Paths si = lambda: eval(input()) ni = lambda: int(eval(input())) nm = lambda: list(map(int, input().split())) nl = lambda: list(map(int, input().split())) def WF(): for k in range(n): for i in range(n): for j in range(n): d[i][j]=mi...
N,M = list(map(int,input().split())) A = [] B = [] C = [] for i in range(M): a,b,c = list(map(int,input().split())) a -= 1 b -= 1 A.append(a) B.append(b) C.append(c) inf = 10**18 dist = [[inf]*N for i in range(N)] for i in range(N): for j in range(N): if i == j: ...
44
38
953
656
# ABC051 D - Candidates of No Shortest Paths si = lambda: eval(input()) ni = lambda: int(eval(input())) nm = lambda: list(map(int, input().split())) nl = lambda: list(map(int, input().split())) def WF(): for k in range(n): for i in range(n): for j in range(n): d[i][j] = min(d[i...
N, M = list(map(int, input().split())) A = [] B = [] C = [] for i in range(M): a, b, c = list(map(int, input().split())) a -= 1 b -= 1 A.append(a) B.append(b) C.append(c) inf = 10**18 dist = [[inf] * N for i in range(N)] for i in range(N): for j in range(N): if i == j: di...
false
13.636364
[ "-# ABC051 D - Candidates of No Shortest Paths", "-si = lambda: eval(input())", "-ni = lambda: int(eval(input()))", "-nm = lambda: list(map(int, input().split()))", "-nl = lambda: list(map(int, input().split()))", "-", "-", "-def WF():", "- for k in range(n):", "- for i in range(n):", ...
false
0.047552
0.064388
0.738521
[ "s214386441", "s157311586" ]
u633068244
p00009
python
s079646791
s211453984
580
410
35,248
35,252
Accepted
Accepted
29.31
import math r = 999999 sqrt = int(math.sqrt(r)) p = [1]*r p[0] = 0 for i in range(1,sqrt): if p[i]: for j in range(2*i+1,r,i+1): p[j] = 0 while True: try: n = int(input()) print(p[:n].count(1)) except: break
import math r = 999999 sqrt = int(math.sqrt(r)) p = [1]*r p[0] = 0 for i in range(1,sqrt): if p[i]: for j in range(2*i+1,r,i+1): p[j] = 0 while True: try: n = int(input()) print(sum(p[:n])) except: break
17
17
284
280
import math r = 999999 sqrt = int(math.sqrt(r)) p = [1] * r p[0] = 0 for i in range(1, sqrt): if p[i]: for j in range(2 * i + 1, r, i + 1): p[j] = 0 while True: try: n = int(input()) print(p[:n].count(1)) except: break
import math r = 999999 sqrt = int(math.sqrt(r)) p = [1] * r p[0] = 0 for i in range(1, sqrt): if p[i]: for j in range(2 * i + 1, r, i + 1): p[j] = 0 while True: try: n = int(input()) print(sum(p[:n])) except: break
false
0
[ "- print(p[:n].count(1))", "+ print(sum(p[:n]))" ]
false
0.452832
0.670948
0.674914
[ "s079646791", "s211453984" ]
u440180827
p02408
python
s793058074
s588479950
30
20
7,724
7,676
Accepted
Accepted
33.33
cards = [[0 for i in range(13)] for j in range(4)] s2n = {'S': 0, 'H': 1, 'C': 2, 'D': 3} n2s = 'SHCD' n = int(eval(input())) for i in range(n): card = list(input().split()) card[1] = int(card[1]) cards[s2n[card[0]]][card[1]-1] = 1 for i in range(4): for j in range(13): if not cards[i...
cards = [[0 for i in range(13)] for j in range(4)] s2n = {'S': 0, 'H': 1, 'C': 2, 'D': 3} n2s = 'SHCD' n = int(eval(input())) for i in range(n): card = list(input().split()) card[1] = int(card[1]) cards[s2n[card[0]]][card[1]-1] = 1 for i in range(4): for j in range(13): if not(cards[i...
12
12
351
352
cards = [[0 for i in range(13)] for j in range(4)] s2n = {"S": 0, "H": 1, "C": 2, "D": 3} n2s = "SHCD" n = int(eval(input())) for i in range(n): card = list(input().split()) card[1] = int(card[1]) cards[s2n[card[0]]][card[1] - 1] = 1 for i in range(4): for j in range(13): if not cards[i][j]: ...
cards = [[0 for i in range(13)] for j in range(4)] s2n = {"S": 0, "H": 1, "C": 2, "D": 3} n2s = "SHCD" n = int(eval(input())) for i in range(n): card = list(input().split()) card[1] = int(card[1]) cards[s2n[card[0]]][card[1] - 1] = 1 for i in range(4): for j in range(13): if not (cards[i][j]): ...
false
0
[ "- if not cards[i][j]:", "+ if not (cards[i][j]):" ]
false
0.046026
0.035921
1.281291
[ "s793058074", "s588479950" ]
u729133443
p02861
python
s654281157
s490333158
187
18
39,408
3,060
Accepted
Accepted
90.37
l=list(map(int,open(0).read().split()[1:]));*z,=list(zip(l,l));print((sum(((a-x)**2+(b-y)**2)**.5for a,b in z for x,y in z)/len(z)))
n,*z=[list(map(int,t.split()))for t in open(0)];print((sum(((a-x)**2+(b-y)**2)**.5for a,b in z for x,y in z)/n[0]))
1
1
118
113
l = list(map(int, open(0).read().split()[1:])) (*z,) = list(zip(l, l)) print((sum(((a - x) ** 2 + (b - y) ** 2) ** 0.5 for a, b in z for x, y in z) / len(z)))
n, *z = [list(map(int, t.split())) for t in open(0)] print((sum(((a - x) ** 2 + (b - y) ** 2) ** 0.5 for a, b in z for x, y in z) / n[0]))
false
0
[ "-l = list(map(int, open(0).read().split()[1:]))", "-(*z,) = list(zip(l, l))", "-print((sum(((a - x) ** 2 + (b - y) ** 2) ** 0.5 for a, b in z for x, y in z) / len(z)))", "+n, *z = [list(map(int, t.split())) for t in open(0)]", "+print((sum(((a - x) ** 2 + (b - y) ** 2) ** 0.5 for a, b in z for x, y in z) /...
false
0.047658
0.045666
1.04361
[ "s654281157", "s490333158" ]
u621935300
p03061
python
s587503315
s290754377
270
124
44,696
47,624
Accepted
Accepted
54.07
import sys from fractions import gcd from collections import deque N=eval(input()) A=list(map(int, sys.stdin.readline().split())) L=deque() for i in range(N): if i==0: L.append(A[i]) else: L.append( gcd(A[i],L[i-1]) ) R=deque() for i in range(N-1,-1,-1): if i==N-1: R.appendleft(A[i]) ...
import sys from fractions import gcd N=eval(input()) A=list(map(int, sys.stdin.readline().split())) L=[] R=[] for i,a in enumerate(A): if i==0: L.append(a) else: L.append( gcd(L[-1],a) ) for i,a in enumerate(A[::-1]): if i==0: R.append(a) else: R.ap...
34
32
503
538
import sys from fractions import gcd from collections import deque N = eval(input()) A = list(map(int, sys.stdin.readline().split())) L = deque() for i in range(N): if i == 0: L.append(A[i]) else: L.append(gcd(A[i], L[i - 1])) R = deque() for i in range(N - 1, -1, -1): if i == N - 1: ...
import sys from fractions import gcd N = eval(input()) A = list(map(int, sys.stdin.readline().split())) L = [] R = [] for i, a in enumerate(A): if i == 0: L.append(a) else: L.append(gcd(L[-1], a)) for i, a in enumerate(A[::-1]): if i == 0: R.append(a) else: R.append(gcd(...
false
5.882353
[ "-from collections import deque", "-L = deque()", "-for i in range(N):", "+L = []", "+R = []", "+for i, a in enumerate(A):", "- L.append(A[i])", "+ L.append(a)", "- L.append(gcd(A[i], L[i - 1]))", "-R = deque()", "-for i in range(N - 1, -1, -1):", "- if i == N - 1:", ...
false
0.054462
0.052993
1.027724
[ "s587503315", "s290754377" ]
u426534722
p02241
python
s230101754
s340137083
30
20
7,916
7,988
Accepted
Accepted
33.33
from sys import stdin INF = 1<<21 WHITE = 0 GRAY = 1 BLACK = 2 n = int(stdin.readline()) M = [[INF] * (n + 1) for _ in range(n + 1)] for i in range(0, n): for j, e in enumerate(list(map(int, stdin.readline().split()))): if e != -1: M[i][j] = e d = [INF] * n d[0] = 0 t = [-1] * n color = [0] * n...
from sys import stdin INF = 1<<21 WHITE, GRAY, BLACK = 0, 1, 2 n = int(stdin.readline()) M = [[INF] * n for _ in range(n)] for i in range(0, n): for j, e in enumerate(list(map(int, stdin.readline().split()))): if e != -1: M[i][j] = e d = [INF] * n d[0] = 0 color = [0] * n def prim(): while T...
31
26
783
698
from sys import stdin INF = 1 << 21 WHITE = 0 GRAY = 1 BLACK = 2 n = int(stdin.readline()) M = [[INF] * (n + 1) for _ in range(n + 1)] for i in range(0, n): for j, e in enumerate(list(map(int, stdin.readline().split()))): if e != -1: M[i][j] = e d = [INF] * n d[0] = 0 t = [-1] * n color = [0] *...
from sys import stdin INF = 1 << 21 WHITE, GRAY, BLACK = 0, 1, 2 n = int(stdin.readline()) M = [[INF] * n for _ in range(n)] for i in range(0, n): for j, e in enumerate(list(map(int, stdin.readline().split()))): if e != -1: M[i][j] = e d = [INF] * n d[0] = 0 color = [0] * n def prim(): wh...
false
16.129032
[ "-WHITE = 0", "-GRAY = 1", "-BLACK = 2", "+WHITE, GRAY, BLACK = 0, 1, 2", "-M = [[INF] * (n + 1) for _ in range(n + 1)]", "+M = [[INF] * n for _ in range(n)]", "-t = [-1] * n", "- t[v] = u", "- color[v] = GRAY" ]
false
0.108742
0.044999
2.416549
[ "s230101754", "s340137083" ]
u562935282
p03044
python
s179066274
s572308963
1,137
619
160,928
40,696
Accepted
Accepted
45.56
import sys sys.setrecursionlimit(10 ** 9) class UnionFind: def __init__(self, n): self.v = [-1 for _ in range(n)] # 根(負): 連結頂点数 * (-1) / 子(正): 根の頂点番号(0-indexed) def find(self, x): # xを含む木における根の頂点番号を返す if self.v[x] < 0: # (負)は根 return x else: # 根の頂点番号 ...
from collections import deque N = int(input()) es = [[] for _ in range(N)] # 0-indexed for _ in range(N - 1): u, v, w = map(int, input().split()) u -= 1 v -= 1 es[u].append((v, w)) es[v].append((u, w)) visited = [-1] * N visited[0] = 0 dq = deque() dq.append(0) while dq: v...
70
28
1,599
545
import sys sys.setrecursionlimit(10**9) class UnionFind: def __init__(self, n): self.v = [-1 for _ in range(n)] # 根(負): 連結頂点数 * (-1) / 子(正): 根の頂点番号(0-indexed) def find(self, x): # xを含む木における根の頂点番号を返す if self.v[x] < 0: # (負)は根 return x else: # 根の頂点番号 self.v[...
from collections import deque N = int(input()) es = [[] for _ in range(N)] # 0-indexed for _ in range(N - 1): u, v, w = map(int, input().split()) u -= 1 v -= 1 es[u].append((v, w)) es[v].append((u, w)) visited = [-1] * N visited[0] = 0 dq = deque() dq.append(0) while dq: v = dq.popleft() fo...
false
60
[ "-import sys", "-", "-sys.setrecursionlimit(10**9)", "-", "-", "-class UnionFind:", "- def __init__(self, n):", "- self.v = [-1 for _ in range(n)] # 根(負): 連結頂点数 * (-1) / 子(正): 根の頂点番号(0-indexed)", "-", "- def find(self, x): # xを含む木における根の頂点番号を返す", "- if self.v[x] < 0: # (負)は...
false
0.040808
0.039962
1.021173
[ "s179066274", "s572308963" ]
u352394527
p00440
python
s269717857
s836683760
320
260
8,436
8,440
Accepted
Accepted
18.75
while True: try: n,k = list(map(int,input().split())) if n == 0 and k == 0: break lst = [0 for _ in range(n)] lst2 = [] flag = 0 for _ in range(k): i = int(eval(input())) if not i: flag = 1 else: lst[i - 1] = 1 l = -1 r = -1 for i in...
def main(): while True: try: n,k = list(map(int,input().split())) if n == 0 and k == 0: break lst = [0 for _ in range(n)] lst2 = [] flag = 0 for _ in range(k): i = int(eval(input())) if not i: flag = 1 else: lst[i - 1] = ...
47
50
1,057
1,202
while True: try: n, k = list(map(int, input().split())) if n == 0 and k == 0: break lst = [0 for _ in range(n)] lst2 = [] flag = 0 for _ in range(k): i = int(eval(input())) if not i: flag = 1 else: ...
def main(): while True: try: n, k = list(map(int, input().split())) if n == 0 and k == 0: break lst = [0 for _ in range(n)] lst2 = [] flag = 0 for _ in range(k): i = int(eval(input())) if ...
false
6
[ "-while True:", "- try:", "- n, k = list(map(int, input().split()))", "- if n == 0 and k == 0:", "- break", "- lst = [0 for _ in range(n)]", "- lst2 = []", "- flag = 0", "- for _ in range(k):", "- i = int(eval(input()))", "- ...
false
0.039717
0.04
0.992911
[ "s269717857", "s836683760" ]
u018679195
p02854
python
s181873399
s989301861
149
137
26,764
26,220
Accepted
Accepted
8.05
n=int(eval(input())) l= list((int(x) for x in input().split())) beg=end=i=0 n-=1 while(i<=n): if(beg>end): end+=l[n] n-=1 else: beg+=l[i] i+=1 print((abs(end-beg)))
n = int(eval(input())) arr = list(map(int, input().split())) i = 0 j = n-1 sumL =0 sumR = 0 while(i <= j): if(sumL < sumR): sumL += arr[i] i +=1 else: sumR += arr[j] j -=1 print((abs(sumL - sumR)))
12
16
177
247
n = int(eval(input())) l = list((int(x) for x in input().split())) beg = end = i = 0 n -= 1 while i <= n: if beg > end: end += l[n] n -= 1 else: beg += l[i] i += 1 print((abs(end - beg)))
n = int(eval(input())) arr = list(map(int, input().split())) i = 0 j = n - 1 sumL = 0 sumR = 0 while i <= j: if sumL < sumR: sumL += arr[i] i += 1 else: sumR += arr[j] j -= 1 print((abs(sumL - sumR)))
false
25
[ "-l = list((int(x) for x in input().split()))", "-beg = end = i = 0", "-n -= 1", "-while i <= n:", "- if beg > end:", "- end += l[n]", "- n -= 1", "+arr = list(map(int, input().split()))", "+i = 0", "+j = n - 1", "+sumL = 0", "+sumR = 0", "+while i <= j:", "+ if sumL < ...
false
0.061256
0.078225
0.783078
[ "s181873399", "s989301861" ]
u020390084
p03418
python
s676566231
s655129839
66
60
3,064
3,064
Accepted
Accepted
9.09
#!/usr/bin/env python3 import sys def solve(N: int, K: int): if K!=0: ans = 0 for j in range(1,N+1): #10**5ループなのでいけるはず。 if K <= j-1: ans += (j-K) * (N//j) if N%j >=K: ans += N%j - K + 1 else: ans = N * N ...
#!/usr/bin/env python3 import sys def solve(N: int, K: int): if K!=0: ans = 0 for j in range(K+1,N+1): ans += (j-K) * (N//j) if N%j >=K: ans += N%j - K + 1 else: ans = N * N print(ans) return def main(): de...
31
30
658
609
#!/usr/bin/env python3 import sys def solve(N: int, K: int): if K != 0: ans = 0 for j in range(1, N + 1): # 10**5ループなのでいけるはず。 if K <= j - 1: ans += (j - K) * (N // j) if N % j >= K: ans += N % j - K + 1 else: ans = N * N ...
#!/usr/bin/env python3 import sys def solve(N: int, K: int): if K != 0: ans = 0 for j in range(K + 1, N + 1): ans += (j - K) * (N // j) if N % j >= K: ans += N % j - K + 1 else: ans = N * N print(ans) return def main(): def iterate_...
false
3.225806
[ "- for j in range(1, N + 1): # 10**5ループなのでいけるはず。", "- if K <= j - 1:", "- ans += (j - K) * (N // j)", "- if N % j >= K:", "- ans += N % j - K + 1", "+ for j in range(K + 1, N + 1):", "+ ans += (j - K) * (N // j)", "+...
false
0.034812
0.046062
0.755758
[ "s676566231", "s655129839" ]
u653041271
p02861
python
s886235619
s869006363
423
377
35,396
31,144
Accepted
Accepted
10.87
import sys, bisect, math, itertools, string, queue, copy import numpy as np import scipy from collections import Counter,defaultdict,deque from itertools import permutations, combinations from heapq import heappop, heappush from fractions import gcd input = sys.stdin.readline sys.setrecursionlimit(10**8) mod =...
import sys, bisect, math, itertools, string, queue, copy import numpy as np import scipy from collections import Counter,defaultdict,deque from itertools import permutations, combinations from heapq import heappop, heappush # input = sys.stdin.readline.rstrip() sys.setrecursionlimit(10**8) mod = 10**9+7 def in...
30
32
1,111
1,153
import sys, bisect, math, itertools, string, queue, copy import numpy as np import scipy from collections import Counter, defaultdict, deque from itertools import permutations, combinations from heapq import heappop, heappush from fractions import gcd input = sys.stdin.readline sys.setrecursionlimit(10**8) mod = 10**9...
import sys, bisect, math, itertools, string, queue, copy import numpy as np import scipy from collections import Counter, defaultdict, deque from itertools import permutations, combinations from heapq import heappop, heappush # input = sys.stdin.readline.rstrip() sys.setrecursionlimit(10**8) mod = 10**9 + 7 def inp(...
false
6.25
[ "-from fractions import gcd", "-input = sys.stdin.readline", "+# input = sys.stdin.readline.rstrip()", "+def inplt(n):", "+ return [tuple(map(int, input().split())) for _ in range(n)]", "+", "+", "-xy = inpll(n)", "-sum = 0", "-l = list(itertools.permutations(list(range(n)), n))", "-for i in ...
false
0.113456
0.044074
2.574213
[ "s886235619", "s869006363" ]
u018679195
p03161
python
s058159523
s562588993
1,851
368
22,904
52,448
Accepted
Accepted
80.12
import numpy as np N,K= list(map(int,input().split())) H = np.array(list(map(int, input().split()))) dp = np.zeros(N, dtype=int) for i in range(1,N): s=max(i-K,0) dp[i]=np.min(dp[s:i]+np.abs(H[s:i]-H[i])) print((dp[-1]))
import sys n,k = list(map(int, input().split())) a = list(map(int, input().split())) dp = [sys.maxsize]*n dp[0] = 0 for i in range(n): for j in range(i+1, i+k+1): if j < n: dp[j] = min(dp[j], dp[i]+abs(a[i]-a[j])) print((dp[n-1]))
11
13
232
261
import numpy as np N, K = list(map(int, input().split())) H = np.array(list(map(int, input().split()))) dp = np.zeros(N, dtype=int) for i in range(1, N): s = max(i - K, 0) dp[i] = np.min(dp[s:i] + np.abs(H[s:i] - H[i])) print((dp[-1]))
import sys n, k = list(map(int, input().split())) a = list(map(int, input().split())) dp = [sys.maxsize] * n dp[0] = 0 for i in range(n): for j in range(i + 1, i + k + 1): if j < n: dp[j] = min(dp[j], dp[i] + abs(a[i] - a[j])) print((dp[n - 1]))
false
15.384615
[ "-import numpy as np", "+import sys", "-N, K = list(map(int, input().split()))", "-H = np.array(list(map(int, input().split())))", "-dp = np.zeros(N, dtype=int)", "-for i in range(1, N):", "- s = max(i - K, 0)", "- dp[i] = np.min(dp[s:i] + np.abs(H[s:i] - H[i]))", "-print((dp[-1]))", "+n, k ...
false
0.187686
0.04296
4.368869
[ "s058159523", "s562588993" ]
u073852194
p03946
python
s086930870
s332448461
127
84
15,020
20,464
Accepted
Accepted
33.86
N,T = list(map(int,input().split())) A = list(map(int,input().split())) dif = [] max_A = 0 for i in range(N): max_A = max(max_A,A[-1-i]) dif.append(max_A-A[-1-i]) ans = 0 dif.sort(reverse=True) for i in range(N-1): if dif[i]!=dif[i+1]: print((i+1)) break
N, T = list(map(int, input().split())) A = list(map(int, input().split())) lo = 10**18 hi = 0 d = 0 res = 0 for i in range(N): if lo > A[i]: lo = A[i] hi = 0 if hi < A[i]: hi = A[i] if d == hi - lo: res += 1 elif d < hi - lo: d...
13
22
286
359
N, T = list(map(int, input().split())) A = list(map(int, input().split())) dif = [] max_A = 0 for i in range(N): max_A = max(max_A, A[-1 - i]) dif.append(max_A - A[-1 - i]) ans = 0 dif.sort(reverse=True) for i in range(N - 1): if dif[i] != dif[i + 1]: print((i + 1)) break
N, T = list(map(int, input().split())) A = list(map(int, input().split())) lo = 10**18 hi = 0 d = 0 res = 0 for i in range(N): if lo > A[i]: lo = A[i] hi = 0 if hi < A[i]: hi = A[i] if d == hi - lo: res += 1 elif d < hi - lo: d = hi - lo ...
false
40.909091
[ "-dif = []", "-max_A = 0", "+lo = 10**18", "+hi = 0", "+d = 0", "+res = 0", "- max_A = max(max_A, A[-1 - i])", "- dif.append(max_A - A[-1 - i])", "-ans = 0", "-dif.sort(reverse=True)", "-for i in range(N - 1):", "- if dif[i] != dif[i + 1]:", "- print((i + 1))", "- br...
false
0.04791
0.046816
1.023386
[ "s086930870", "s332448461" ]
u954774382
p02995
python
s014197539
s545761943
166
36
38,384
5,112
Accepted
Accepted
78.31
def G(x,y): if(x<y): x,y=y,x if(y==0): return x return G(y,x%y) a,b,c,d=list(map(int,input().split())) ans=0 # print(a,b,c,d,b//c,a//c) ans+=(b//c-a//c+(a%c==0)) # print(ans) ans+=(b//d-a//d+(a%d==0)) # print(ans) lcm=c*d//G(c,d) ans-=(b//lcm-a//lcm+(a%lcm==0)) print((b-a+...
import sys from functools import lru_cache, cmp_to_key from heapq import merge, heapify, heappop, heappush from math import * # import math from collections import defaultdict as dd, deque, Counter as C from itertools import combinations as comb, permutations as perm from bisect import bisect_left as bl, bisect_...
18
47
319
1,276
def G(x, y): if x < y: x, y = y, x if y == 0: return x return G(y, x % y) a, b, c, d = list(map(int, input().split())) ans = 0 # print(a,b,c,d,b//c,a//c) ans += b // c - a // c + (a % c == 0) # print(ans) ans += b // d - a // d + (a % d == 0) # print(ans) lcm = c * d // G(c, d) ans -= b //...
import sys from functools import lru_cache, cmp_to_key from heapq import merge, heapify, heappop, heappush from math import * # import math from collections import defaultdict as dd, deque, Counter as C from itertools import combinations as comb, permutations as perm from bisect import bisect_left as bl, bisect_right ...
false
61.702128
[ "+import sys", "+from functools import lru_cache, cmp_to_key", "+from heapq import merge, heapify, heappop, heappush", "+from math import *", "+", "+# import math", "+from collections import defaultdict as dd, deque, Counter as C", "+from itertools import combinations as comb, permutations as perm", ...
false
0.055451
0.04152
1.3355
[ "s014197539", "s545761943" ]
u163783894
p02802
python
s492295029
s864965415
555
266
47,792
47,536
Accepted
Accepted
52.07
# import sys # import math # import itertools # from collections import deque # from collections import defaultdict # import heapq # import copy # import bisect # import numpy as np # from scipy.special import comb # def my_input(): return sys.stdin.readline().rstrip() # sys.setrecursionlimit(100000) # IN...
import sys # import math # import itertools # from collections import deque # from collections import defaultdict # import heapq # import copy # import bisect # import numpy as np # from scipy.special import comb def my_input(): return sys.stdin.readline().rstrip() # sys.setrecursionlimit(100000) # INF ...
43
45
877
880
# import sys # import math # import itertools # from collections import deque # from collections import defaultdict # import heapq # import copy # import bisect # import numpy as np # from scipy.special import comb # def my_input(): return sys.stdin.readline().rstrip() # sys.setrecursionlimit(100000) # INF = 1001001001...
import sys # import math # import itertools # from collections import deque # from collections import defaultdict # import heapq # import copy # import bisect # import numpy as np # from scipy.special import comb def my_input(): return sys.stdin.readline().rstrip() # sys.setrecursionlimit(100000) # INF = 1001001...
false
4.444444
[ "-# import sys", "+import sys", "+", "-# def my_input(): return sys.stdin.readline().rstrip()", "+def my_input():", "+ return sys.stdin.readline().rstrip()", "+", "+", "- p, s = input().split()", "+ p, s = my_input().split()" ]
false
0.08452
0.079417
1.064257
[ "s492295029", "s864965415" ]
u411203878
p03408
python
s039150912
s085500384
175
64
39,408
62,532
Accepted
Accepted
63.43
n=int(eval(input())) s = [eval(input()) for i in range(n)] m = int(eval(input())) t = [eval(input()) for i in range(m)] l = [0]*n for i in range(n): ans = 0 for j in range(n): if s[i] == s[j]: ans += 1 for k in range(m): if s[i] == t[k]: ans -= 1 l[i]...
N = int(eval(input())) memo = {} for i in range(N): s = eval(input()) if s in memo: memo[s] += 1 else: memo[s] = 1 M = int(eval(input())) for i in range(M): t = eval(input()) if t in memo: memo[t] -= 1 else: memo[t] = -1 score = sorted(list(memo...
15
19
325
347
n = int(eval(input())) s = [eval(input()) for i in range(n)] m = int(eval(input())) t = [eval(input()) for i in range(m)] l = [0] * n for i in range(n): ans = 0 for j in range(n): if s[i] == s[j]: ans += 1 for k in range(m): if s[i] == t[k]: ans -= 1 l[i] = ans pr...
N = int(eval(input())) memo = {} for i in range(N): s = eval(input()) if s in memo: memo[s] += 1 else: memo[s] = 1 M = int(eval(input())) for i in range(M): t = eval(input()) if t in memo: memo[t] -= 1 else: memo[t] = -1 score = sorted(list(memo.items()), key=lamb...
false
21.052632
[ "-n = int(eval(input()))", "-s = [eval(input()) for i in range(n)]", "-m = int(eval(input()))", "-t = [eval(input()) for i in range(m)]", "-l = [0] * n", "-for i in range(n):", "- ans = 0", "- for j in range(n):", "- if s[i] == s[j]:", "- ans += 1", "- for k in range(m...
false
0.107386
0.073235
1.46633
[ "s039150912", "s085500384" ]
u947222120
p03160
python
s844328081
s620231764
209
140
13,784
13,908
Accepted
Accepted
33.01
n = int(eval(input())) h = list(map(int, input().split())) dp = [100000] * n dp[0] = 0 for i in range(0, n): if i == 0: dp[i] = 0 elif i == 1: dp[i] = abs(h[i-1] - h[i]) else: a = dp[i-1] + abs(h[i] - h[i-1]) b = dp[i-2] + abs(h[i] - h[i-2]) dp[i] = ...
n = int(eval(input())) h = list(map(int, input().split())) dp = [100000] * n dp[0] = 0 for i in range(0, n): if i == 0: dp[i] = 0 elif i == 1: dp[i] = abs(h[i-1] - h[i]) else: dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2])) print((dp[-1]))
18
16
395
311
n = int(eval(input())) h = list(map(int, input().split())) dp = [100000] * n dp[0] = 0 for i in range(0, n): if i == 0: dp[i] = 0 elif i == 1: dp[i] = abs(h[i - 1] - h[i]) else: a = dp[i - 1] + abs(h[i] - h[i - 1]) b = dp[i - 2] + abs(h[i] - h[i - 2]) dp[i] = min(dp[i...
n = int(eval(input())) h = list(map(int, input().split())) dp = [100000] * n dp[0] = 0 for i in range(0, n): if i == 0: dp[i] = 0 elif i == 1: dp[i] = abs(h[i - 1] - h[i]) else: dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2])) print((dp[-1]))
false
11.111111
[ "- a = dp[i - 1] + abs(h[i] - h[i - 1])", "- b = dp[i - 2] + abs(h[i] - h[i - 2])" ]
false
0.041886
0.042923
0.975837
[ "s844328081", "s620231764" ]
u353099601
p02707
python
s795484618
s916933889
145
122
32,372
32,988
Accepted
Accepted
15.86
N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N for a in A: ans[a-1] += 1 for _ in ans: print(_)
N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N for a in A: ans[a-1] += 1 print(('\n'.join(map(str, ans))))
10
9
136
140
N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N for a in A: ans[a - 1] += 1 for _ in ans: print(_)
N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N for a in A: ans[a - 1] += 1 print(("\n".join(map(str, ans))))
false
10
[ "-for _ in ans:", "- print(_)", "+print((\"\\n\".join(map(str, ans))))" ]
false
0.045324
0.048279
0.938799
[ "s795484618", "s916933889" ]
u955251526
p03231
python
s875432125
s899434194
21
19
4,496
3,316
Accepted
Accepted
9.52
ls, lt = list(map(int, input().split())) s = list(eval(input())) t = list(eval(input())) def gcd(m,n): if n == 0: return m else: return gcd(n,m%n) g = gcd(ls,lt) m = ls // g n = lt // g ret = g*m*n for i in range(g): if s[i*m] != t[i*n]: ret = -1 break print(r...
n, m = list(map(int, input().split())) s = eval(input()) t = eval(input()) def gcd(x, y): if y == 0: return x return gcd(y, x % y) g = gcd(n, m) for i in range(0, g): if s[i*n//g] != t[i*m//g]: print((-1)) exit() print((n*m//g))
17
12
305
245
ls, lt = list(map(int, input().split())) s = list(eval(input())) t = list(eval(input())) def gcd(m, n): if n == 0: return m else: return gcd(n, m % n) g = gcd(ls, lt) m = ls // g n = lt // g ret = g * m * n for i in range(g): if s[i * m] != t[i * n]: ret = -1 break print(...
n, m = list(map(int, input().split())) s = eval(input()) t = eval(input()) def gcd(x, y): if y == 0: return x return gcd(y, x % y) g = gcd(n, m) for i in range(0, g): if s[i * n // g] != t[i * m // g]: print((-1)) exit() print((n * m // g))
false
29.411765
[ "-ls, lt = list(map(int, input().split()))", "-s = list(eval(input()))", "-t = list(eval(input()))", "+n, m = list(map(int, input().split()))", "+s = eval(input())", "+t = eval(input())", "-def gcd(m, n):", "- if n == 0:", "- return m", "- else:", "- return gcd(n, m % n)", ...
false
0.040715
0.041754
0.975122
[ "s875432125", "s899434194" ]
u842401785
p02633
python
s164688233
s065664774
72
65
61,852
61,772
Accepted
Accepted
9.72
from math import gcd x = int(eval(input())) y = x * 360 // gcd(x, 360) print((y//x))
x = int(eval(input())) y = 0 k = 0 while True: y += x k += 1 if y % 360 == 0: break print(k)
5
9
81
114
from math import gcd x = int(eval(input())) y = x * 360 // gcd(x, 360) print((y // x))
x = int(eval(input())) y = 0 k = 0 while True: y += x k += 1 if y % 360 == 0: break print(k)
false
44.444444
[ "-from math import gcd", "-", "-y = x * 360 // gcd(x, 360)", "-print((y // x))", "+y = 0", "+k = 0", "+while True:", "+ y += x", "+ k += 1", "+ if y % 360 == 0:", "+ break", "+print(k)" ]
false
0.077542
0.040706
1.904957
[ "s164688233", "s065664774" ]
u496744988
p03761
python
s910650528
s427707784
57
25
6,476
3,760
Accepted
Accepted
56.14
from collections import Counter from functools import reduce # import statistics import bisect import copy import string import fractions import math import pprint # for debug pp = pprint.PrettyPrinter(width = 150) import random import sys import time sys.setrecursionlimit(10**7) INF = 10 ** 18 MOD = 10...
from collections import Counter import string import sys def II(): return int(sys.stdin.readline()) def IS(): return eval(input()) def C(x): return Counter(x) n = II() s = sorted([IS() for _ in range(n)]) counter = [] for i in range(len(s)): counter.append(C(s[i])) ans = [] for char in string.ascii_lo...
68
19
1,709
445
from collections import Counter from functools import reduce # import statistics import bisect import copy import string import fractions import math import pprint # for debug pp = pprint.PrettyPrinter(width=150) import random import sys import time sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 def LI(...
from collections import Counter import string import sys def II(): return int(sys.stdin.readline()) def IS(): return eval(input()) def C(x): return Counter(x) n = II() s = sorted([IS() for _ in range(n)]) counter = [] for i in range(len(s)): counter.append(C(s[i])) ans = [] for char in string.as...
false
72.058824
[ "-from functools import reduce", "-", "-# import statistics", "-import bisect", "-import copy", "-import fractions", "-import math", "-import pprint", "-", "-# for debug", "-pp = pprint.PrettyPrinter(width=150)", "-import random", "-import time", "-", "-sys.setrecursionlimit(10**7)", "...
false
0.048204
0.043028
1.12029
[ "s910650528", "s427707784" ]
u334066432
p03455
python
s981705864
s178675061
19
17
2,940
2,940
Accepted
Accepted
10.53
a,b=list(map(int,input().split())) c=a*b if(c%2==0): print("Even") else: print("Odd")
a,b=list(map(int,input().split(" "))) if(a*b%2==0): print("Even") else: print("Odd")
6
5
89
87
a, b = list(map(int, input().split())) c = a * b if c % 2 == 0: print("Even") else: print("Odd")
a, b = list(map(int, input().split(" "))) if a * b % 2 == 0: print("Even") else: print("Odd")
false
16.666667
[ "-a, b = list(map(int, input().split()))", "-c = a * b", "-if c % 2 == 0:", "+a, b = list(map(int, input().split(\" \")))", "+if a * b % 2 == 0:" ]
false
0.049303
0.049261
1.000868
[ "s981705864", "s178675061" ]
u285358283
p03682
python
s531096806
s350292980
1,512
1,376
127,760
127,852
Accepted
Accepted
8.99
class UnionFind: def __init__(self, n): self.p = [i for i in range(n)] self.components = n # 連結成分の数 def root(self, x): if self.p[x] != x: x_now = x while self.p[x_now] != x_now: x_now = self.p[x_now] self.p[x] = x_now ...
class UnionFind: def __init__(self, n): self.p = [i for i in range(n)] self.components = n # 連結成分の数 def root(self, x): if self.p[x] != x: stack = [x] while True: top = stack[-1] if self.p[top] == top: ...
46
51
1,039
1,185
class UnionFind: def __init__(self, n): self.p = [i for i in range(n)] self.components = n # 連結成分の数 def root(self, x): if self.p[x] != x: x_now = x while self.p[x_now] != x_now: x_now = self.p[x_now] self.p[x] = x_now return s...
class UnionFind: def __init__(self, n): self.p = [i for i in range(n)] self.components = n # 連結成分の数 def root(self, x): if self.p[x] != x: stack = [x] while True: top = stack[-1] if self.p[top] == top: break ...
false
9.803922
[ "- x_now = x", "- while self.p[x_now] != x_now:", "- x_now = self.p[x_now]", "- self.p[x] = x_now", "+ stack = [x]", "+ while True:", "+ top = stack[-1]", "+ if self.p[top] == top:", "+ ...
false
0.040533
0.042844
0.946065
[ "s531096806", "s350292980" ]
u651803486
p03078
python
s161897383
s250046659
1,785
1,347
147,544
162,172
Accepted
Accepted
24.54
import heapq x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) e = [] for va in a: for vb in b: e.append(va+vb) e.sort(reverse=True) e = e[:k] d = [] for ve in e: for vc in c: ...
import heapq x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) e = [] # AxB を取得 for va in a: for vb in b: heapq.heappush(e, -(va+vb)) # AxB は 大きい方から最大k個のみ使う d = [] ite = min(k, len(e)...
24
27
403
494
import heapq x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) e = [] for va in a: for vb in b: e.append(va + vb) e.sort(reverse=True) e = e[:k] d = [] for ve in e: for vc in c: heapq.heappush...
import heapq x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) e = [] # AxB を取得 for va in a: for vb in b: heapq.heappush(e, -(va + vb)) # AxB は 大きい方から最大k個のみ使う d = [] ite = min(k, len(e)) # AxB[k個] x C を取得...
false
11.111111
[ "+# AxB を取得", "- e.append(va + vb)", "-e.sort(reverse=True)", "-e = e[:k]", "+ heapq.heappush(e, -(va + vb))", "+# AxB は 大きい方から最大k個のみ使う", "-for ve in e:", "+ite = min(k, len(e))", "+# AxB[k個] x C を取得", "+for i in range(ite):", "+ ve = -heapq.heappop(e)" ]
false
0.104007
0.03969
2.620469
[ "s161897383", "s250046659" ]
u498487134
p02762
python
s109008141
s989961468
1,419
438
103,512
92,320
Accepted
Accepted
69.13
#!/usr/bin/env pypy3 def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) ################ class UnionFind(): """ parents : 親要素(findしない場合は根ではないことの注意),根の場合は"-(要素数)" find(x):要素xの属するグループの根を返す size(x):要素xの属するグループの要素数を...
#!/usr/bin/env pypy3 def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): class UnionFind: def __init__(self, N: int): """ N:要素数 root:各要素の親要素の番号を格納するリスト. ...
95
106
2,268
2,849
#!/usr/bin/env pypy3 def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) ################ class UnionFind: """ parents : 親要素(findしない場合は根ではないことの注意),根の場合は"-(要素数)" find(x):要素xの属するグループの根を返す size(x):要素xの属するグループ...
#!/usr/bin/env pypy3 def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): class UnionFind: def __init__(self, N: int): """ N:要素数 root:各要素の親要素の番号を格納するリスト. ...
false
10.377358
[ "-################", "-class UnionFind:", "- \"\"\"", "- parents : 親要素(findしない場合は根ではないことの注意),根の場合は\"-(要素数)\"", "- find(x):要素xの属するグループの根を返す", "- size(x):要素xの属するグループの要素数を返す", "- same(x,y):x,yが同じグループに属しているか返す", "- members(x):要素xが属するグループに属する要素をリストで返す", "- roots:全ての根の要素を返す", "- ...
false
0.037704
0.042299
0.891349
[ "s109008141", "s989961468" ]
u379535139
p03494
python
s711748372
s403166561
20
18
3,064
3,060
Accepted
Accepted
10
num = int(eval(input())) if num <= 200: num_list = [int(x) for x in input().split()] even_flg = True count = 0 while even_flg: for i, n in enumerate(num_list): if n % 2 == 0: count += 1 num_list[i] = n / 2 else: ...
N = int(eval(input())) A_list = [int(num) for num in input().split()] count = 0 is_even = True while is_even: for i, num in enumerate(A_list): if num % 2: is_even = False break else: num = num // 2 A_list[i] = num else: count +=1 print(count)
16
16
390
292
num = int(eval(input())) if num <= 200: num_list = [int(x) for x in input().split()] even_flg = True count = 0 while even_flg: for i, n in enumerate(num_list): if n % 2 == 0: count += 1 num_list[i] = n / 2 else: even_flg = F...
N = int(eval(input())) A_list = [int(num) for num in input().split()] count = 0 is_even = True while is_even: for i, num in enumerate(A_list): if num % 2: is_even = False break else: num = num // 2 A_list[i] = num else: count += 1 print(cou...
false
0
[ "-num = int(eval(input()))", "-if num <= 200:", "- num_list = [int(x) for x in input().split()]", "- even_flg = True", "- count = 0", "- while even_flg:", "- for i, n in enumerate(num_list):", "- if n % 2 == 0:", "- count += 1", "- num_li...
false
0.044532
0.04544
0.980027
[ "s711748372", "s403166561" ]
u753803401
p02838
python
s663305811
s006296627
1,876
388
89,712
89,712
Accepted
Accepted
79.32
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 n = int(readline()) a = list(map(int, readline().split())) ls = [0] * 65 for v in a: tt = bin(v) for i in range(len(tt)-2): ls[i] += int(tt[-i-1]) t = 0 for i in ran...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 n = int(readline()) a = list(map(int, readline().split())) ls = [0] * 60 t = 0 for i in range(60): for v in a: ls[i] += (v >> i) & 1 t += pow(2, i, mod) * (n - ls[i]) * ls[...
22
19
461
400
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 n = int(readline()) a = list(map(int, readline().split())) ls = [0] * 65 for v in a: tt = bin(v) for i in range(len(tt) - 2): ls[i] += int(tt[-i - 1]) t = 0 for i in range(len(ls)):...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 n = int(readline()) a = list(map(int, readline().split())) ls = [0] * 60 t = 0 for i in range(60): for v in a: ls[i] += (v >> i) & 1 t += pow(2, i, mod) * (n - ls[i]) * ls[i] t ...
false
13.636364
[ "- ls = [0] * 65", "- for v in a:", "- tt = bin(v)", "- for i in range(len(tt) - 2):", "- ls[i] += int(tt[-i - 1])", "+ ls = [0] * 60", "- for i in range(len(ls)):", "+ for i in range(60):", "+ for v in a:", "+ ls[i] += (v >> i) & 1" ]
false
0.03721
0.040734
0.913488
[ "s663305811", "s006296627" ]
u753803401
p02897
python
s884490254
s623059267
179
163
38,292
38,384
Accepted
Accepted
8.94
def slove(): import sys input = sys.stdin.readline n = int(input().rstrip('\n')) print(((n - n // 2) / n)) if __name__ == '__main__': slove()
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 n = int(readline()) print(((n - n // 2) / n)) if __name__ == '__main__': solve()
9
12
170
193
def slove(): import sys input = sys.stdin.readline n = int(input().rstrip("\n")) print(((n - n // 2) / n)) if __name__ == "__main__": slove()
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 n = int(readline()) print(((n - n // 2) / n)) if __name__ == "__main__": solve()
false
25
[ "-def slove():", "- import sys", "+import sys", "- input = sys.stdin.readline", "- n = int(input().rstrip(\"\\n\"))", "+", "+def solve():", "+ readline = sys.stdin.buffer.readline", "+ mod = 10**9 + 7", "+ n = int(readline())", "- slove()", "+ solve()" ]
false
0.062435
0.060365
1.034301
[ "s884490254", "s623059267" ]
u062147869
p03818
python
s019158602
s241826582
220
92
63,976
18,656
Accepted
Accepted
58.18
from collections import defaultdict import sys N=int(eval(input())) A=[int(i) for i in input().split() ] dd=defaultdict(int) for a in A: dd[a]+=1 L=[] for j in list(dd.values()): L.append(j-1) if len(L)==1 or len(L)==2: print((1)) sys.exit() if sum(L)%2==1: print((len(L)-1)) sys.e...
from collections import defaultdict N=int(eval(input())) A=[int(i) for i in input().split()] dd=defaultdict(int) for a in A: dd[a]+=1 num=0 s=0 for p,n in list(dd.items()): num+=1 if n%2==0: s+=1 s%=2 print((num-s)) #print(num,s,dd)
19
15
361
260
from collections import defaultdict import sys N = int(eval(input())) A = [int(i) for i in input().split()] dd = defaultdict(int) for a in A: dd[a] += 1 L = [] for j in list(dd.values()): L.append(j - 1) if len(L) == 1 or len(L) == 2: print((1)) sys.exit() if sum(L) % 2 == 1: print((len(L) - 1)) ...
from collections import defaultdict N = int(eval(input())) A = [int(i) for i in input().split()] dd = defaultdict(int) for a in A: dd[a] += 1 num = 0 s = 0 for p, n in list(dd.items()): num += 1 if n % 2 == 0: s += 1 s %= 2 print((num - s)) # print(num,s,dd)
false
21.052632
[ "-import sys", "-L = []", "-for j in list(dd.values()):", "- L.append(j - 1)", "-if len(L) == 1 or len(L) == 2:", "- print((1))", "- sys.exit()", "-if sum(L) % 2 == 1:", "- print((len(L) - 1))", "- sys.exit()", "-if sum(L) % 2 == 0:", "- print((len(L)))", "- sys.exit()",...
false
0.037421
0.038076
0.982791
[ "s019158602", "s241826582" ]
u736729525
p03634
python
s608924694
s100357865
1,407
669
46,128
56,820
Accepted
Accepted
52.45
from collections import deque def main(): def p(a,b): if a < b: return (a,b) else: return (b,a) #input = open(0).readline N = int(eval(input())) E = [[] for i in range(N)] C = {} D = [0] * N parent = [0]*N for i in range(N-1): a, b, c = list(map(int, input().split...
from collections import deque def main(): def p(a,b): if a < b: return (a,b) else: return (b,a) input = open(0).readline N = int(eval(input())) E = [[] for i in range(N)] C = {} D = [0] * N parent = [0]*N for i in range(N-1): a, b, c = list(map(int, input().split(...
47
48
796
811
from collections import deque def main(): def p(a, b): if a < b: return (a, b) else: return (b, a) # input = open(0).readline N = int(eval(input())) E = [[] for i in range(N)] C = {} D = [0] * N parent = [0] * N for i in range(N - 1): a,...
from collections import deque def main(): def p(a, b): if a < b: return (a, b) else: return (b, a) input = open(0).readline N = int(eval(input())) E = [[] for i in range(N)] C = {} D = [0] * N parent = [0] * N for i in range(N - 1): a, b...
false
2.083333
[ "- # input = open(0).readline", "+ input = open(0).readline", "- C[p(a, b)] = c", "+ C[(a, b)] = c", "+ C[(b, a)] = c", "- D[v] = d + C[p(u, v)]", "+ D[v] = d + C[(u, v)]" ]
false
0.142204
0.048324
2.942701
[ "s608924694", "s100357865" ]
u238940874
p02784
python
s064785267
s505173154
56
41
13,964
13,964
Accepted
Accepted
26.79
h,n = list(map(int,input().split())) a = list(map(int,input().split())) x=0 for i in range (n): x+=a[i] if x >= h: print('Yes') else: print('No')
h,n=list(map(int,input().split())) a=list(map(int,input().split())) if sum(a) >= h: print('Yes') else: print('No')
9
6
159
121
h, n = list(map(int, input().split())) a = list(map(int, input().split())) x = 0 for i in range(n): x += a[i] if x >= h: print("Yes") else: print("No")
h, n = list(map(int, input().split())) a = list(map(int, input().split())) if sum(a) >= h: print("Yes") else: print("No")
false
33.333333
[ "-x = 0", "-for i in range(n):", "- x += a[i]", "-if x >= h:", "+if sum(a) >= h:" ]
false
0.038924
0.006235
6.242422
[ "s064785267", "s505173154" ]
u325956328
p02844
python
s594472876
s972630853
210
27
73,680
9,008
Accepted
Accepted
87.14
N = int(eval(input())) S = eval(input()) ans = 0 for i in range(1000): t = "{:0=3}".format(i) p = 0 for j in range(N): if S[j] == t[p]: p += 1 if p == 3: break if p == 3: ans += 1 print(ans)
N = int(eval(input())) S = eval(input()) ans = 0 for i in range(10): idx0 = S[: N - 2].find(str(i)) if idx0 != -1: for j in range(10): idx1 = S[idx0 + 1 : N - 1].find(str(j)) if idx1 != -1: for k in range(10): idx2 = S[idx0 + idx1 +...
16
17
260
413
N = int(eval(input())) S = eval(input()) ans = 0 for i in range(1000): t = "{:0=3}".format(i) p = 0 for j in range(N): if S[j] == t[p]: p += 1 if p == 3: break if p == 3: ans += 1 print(ans)
N = int(eval(input())) S = eval(input()) ans = 0 for i in range(10): idx0 = S[: N - 2].find(str(i)) if idx0 != -1: for j in range(10): idx1 = S[idx0 + 1 : N - 1].find(str(j)) if idx1 != -1: for k in range(10): idx2 = S[idx0 + idx1 + 2 :].find(s...
false
5.882353
[ "-for i in range(1000):", "- t = \"{:0=3}\".format(i)", "- p = 0", "- for j in range(N):", "- if S[j] == t[p]:", "- p += 1", "- if p == 3:", "- break", "- if p == 3:", "- ans += 1", "+for i in range(10):", "+ idx0 = S[: N - 2].find(str(...
false
0.043911
0.037655
1.166153
[ "s594472876", "s972630853" ]
u150984829
p00424
python
s856046051
s631850797
120
110
7,108
7,116
Accepted
Accepted
8.33
import sys s=sys.stdin.readline for n in iter(s,'0\n'): d={} for _ in[0]*int(n): k,v=s()[:-1].split() d[k]=v print((''.join(d.get(*[s().strip()]*2)for _ in[0]*int(s()))))
import sys s=sys.stdin.readline for n in iter(s,'0\n'): d={} for _ in[0]*int(n): k,v=s()[:-1].split() d[k]=v print((''.join(d.get(*[s()[0]]*2)for _ in[0]*int(s()))))
8
8
183
178
import sys s = sys.stdin.readline for n in iter(s, "0\n"): d = {} for _ in [0] * int(n): k, v = s()[:-1].split() d[k] = v print(("".join(d.get(*[s().strip()] * 2) for _ in [0] * int(s()))))
import sys s = sys.stdin.readline for n in iter(s, "0\n"): d = {} for _ in [0] * int(n): k, v = s()[:-1].split() d[k] = v print(("".join(d.get(*[s()[0]] * 2) for _ in [0] * int(s()))))
false
0
[ "- print((\"\".join(d.get(*[s().strip()] * 2) for _ in [0] * int(s()))))", "+ print((\"\".join(d.get(*[s()[0]] * 2) for _ in [0] * int(s()))))" ]
false
0.033742
0.041119
0.820582
[ "s856046051", "s631850797" ]
u411302151
p02706
python
s358070006
s727502982
25
23
9,820
9,828
Accepted
Accepted
8
N, M = list(map(int, input().split())) l = list(map(int, input().split())) l.sort() free = N s = sum(l) free -= s if free<0: print((-1)) else: print(free)
N, M = list(map(int, input().split())) l = list(map(int, input().split())) l.sort() free = N - sum(l) if free<0: print((-1)) else: print(free)
12
9
168
152
N, M = list(map(int, input().split())) l = list(map(int, input().split())) l.sort() free = N s = sum(l) free -= s if free < 0: print((-1)) else: print(free)
N, M = list(map(int, input().split())) l = list(map(int, input().split())) l.sort() free = N - sum(l) if free < 0: print((-1)) else: print(free)
false
25
[ "-free = N", "-s = sum(l)", "-free -= s", "+free = N - sum(l)" ]
false
0.036752
0.035396
1.038317
[ "s358070006", "s727502982" ]
u088552457
p03944
python
s513773559
s086707071
98
86
3,188
73,716
Accepted
Accepted
12.24
def main(): w, h, n = input_list() points = [] for x in range(w): row = [True]*h points.append(row) for _ in range(n): x, y, a = input_list() if a == 1: for px, row in enumerate(points): for py, v in enumerate(row): if px+1 <= x: points...
# import sys # input = sys.stdin.readline import itertools # 持っているビスケットを叩き、1枚増やす # ビスケット A枚を 1円に交換する # 1円をビスケット B枚に交換する def main(): w, h, n = input_list() zahyou = [[0]*w for _ in range(h)] for _ in range(n): x, y, a = input_list() umeru(zahyou, x, y, a) ans = 0 for ...
40
46
953
1,006
def main(): w, h, n = input_list() points = [] for x in range(w): row = [True] * h points.append(row) for _ in range(n): x, y, a = input_list() if a == 1: for px, row in enumerate(points): for py, v in enumerate(row): if px ...
# import sys # input = sys.stdin.readline import itertools # 持っているビスケットを叩き、1枚増やす # ビスケット A枚を 1円に交換する # 1円をビスケット B枚に交換する def main(): w, h, n = input_list() zahyou = [[0] * w for _ in range(h)] for _ in range(n): x, y, a = input_list() umeru(zahyou, x, y, a) ans = 0 for hz in zahyou: ...
false
13.043478
[ "+# import sys", "+# input = sys.stdin.readline", "+import itertools", "+", "+# 持っているビスケットを叩き、1枚増やす", "+# ビスケット A枚を 1円に交換する", "+# 1円をビスケット B枚に交換する", "- points = []", "- for x in range(w):", "- row = [True] * h", "- points.append(row)", "+ zahyou = [[0] * w for _ in range...
false
0.069854
0.115649
0.604019
[ "s513773559", "s086707071" ]
u348805958
p02611
python
s147143162
s207295725
85
75
70,144
65,492
Accepted
Accepted
11.76
#!python3 import sys iim = lambda: map(int, sys.stdin.readline().rstrip().split()) from functools import lru_cache mod = 10 **9 + 7 @lru_cache(100) def calc(n): ans = 0 if n & 1: Y = [37033746750,-19102088250,-75258447165,+8922649446,+41082466425,+12030593120,-2592429840,-1880967088,-28...
#!python3 import sys iim = lambda: map(int, sys.stdin.readline().rstrip().split()) mod = 10 **9 + 7 def calc(n): ans = 0 if n & 1: Y = [33746491, 897911890, 741553367, 922649390, 82466138, 30593036, 407570181, 119032926, 718747607, 27251510, 15690675, 2549638, 225225, 11620, 330, 4] ...
37
35
1,000
896
#!python3 import sys iim = lambda: map(int, sys.stdin.readline().rstrip().split()) from functools import lru_cache mod = 10**9 + 7 @lru_cache(100) def calc(n): ans = 0 if n & 1: Y = [ 37033746750, -19102088250, -75258447165, +8922649446, +4...
#!python3 import sys iim = lambda: map(int, sys.stdin.readline().rstrip().split()) mod = 10**9 + 7 def calc(n): ans = 0 if n & 1: Y = [ 33746491, 897911890, 741553367, 922649390, 82466138, 30593036, 407570181, ...
false
5.405405
[ "-from functools import lru_cache", "-", "-@lru_cache(100)", "- 37033746750,", "- -19102088250,", "- -75258447165,", "- +8922649446,", "- +41082466425,", "- +12030593120,", "- -2592429840,", "- -1880967088,",...
false
0.035926
0.036315
0.989294
[ "s147143162", "s207295725" ]
u694665829
p03712
python
s616618403
s959294521
31
27
9,012
9,280
Accepted
Accepted
12.9
h,w=list(map(int,input().split())) A=[list(eval(input())) for i in range(h)] f=['#' for i in range(w+2)] print((''.join(f))) for i in A: print((''.join('#'+(''.join((i)))+'#'))) print((''.join(f)))
h,w=list(map(int,input().split())) A=[list(eval(input())) for i in range(h)] B=[['#' for i in range(w+2)] for i in range(h+2)] for i in range(h): for j in range(w): B[i+1][j+1]=A[i][j] for b in B: print((''.join(b)))
7
8
189
225
h, w = list(map(int, input().split())) A = [list(eval(input())) for i in range(h)] f = ["#" for i in range(w + 2)] print(("".join(f))) for i in A: print(("".join("#" + ("".join((i))) + "#"))) print(("".join(f)))
h, w = list(map(int, input().split())) A = [list(eval(input())) for i in range(h)] B = [["#" for i in range(w + 2)] for i in range(h + 2)] for i in range(h): for j in range(w): B[i + 1][j + 1] = A[i][j] for b in B: print(("".join(b)))
false
12.5
[ "-f = [\"#\" for i in range(w + 2)]", "-print((\"\".join(f)))", "-for i in A:", "- print((\"\".join(\"#\" + (\"\".join((i))) + \"#\")))", "-print((\"\".join(f)))", "+B = [[\"#\" for i in range(w + 2)] for i in range(h + 2)]", "+for i in range(h):", "+ for j in range(w):", "+ B[i + 1][j ...
false
0.046045
0.045177
1.019217
[ "s616618403", "s959294521" ]
u203843959
p02844
python
s858582428
s437444095
1,341
516
45,660
44,124
Accepted
Accepted
61.52
N=int(eval(input())) S=eval(input()) answer=0 for i in range(1000): i0=i//100 i1=(i//10)%10 i2=i%10 flag_num=0 for s in S: if flag_num==0 and s==str(i0): flag_num+=1 elif flag_num==1 and s==str(i1): flag_num+=1 elif flag_num==2 and s==str(i2): answer+=1 b...
N=int(eval(input())) S=list(map(int,list(eval(input())))) answer=0 for i in range(1000): i0=i//100 i1=(i//10)%10 i2=i%10 flag_num=0 for s in S: if flag_num==0 and s==i0: flag_num+=1 elif flag_num==1 and s==i1: flag_num+=1 elif flag_num==2 and s==i2: answer+=1 ...
20
20
335
341
N = int(eval(input())) S = eval(input()) answer = 0 for i in range(1000): i0 = i // 100 i1 = (i // 10) % 10 i2 = i % 10 flag_num = 0 for s in S: if flag_num == 0 and s == str(i0): flag_num += 1 elif flag_num == 1 and s == str(i1): flag_num += 1 elif fl...
N = int(eval(input())) S = list(map(int, list(eval(input())))) answer = 0 for i in range(1000): i0 = i // 100 i1 = (i // 10) % 10 i2 = i % 10 flag_num = 0 for s in S: if flag_num == 0 and s == i0: flag_num += 1 elif flag_num == 1 and s == i1: flag_num += 1 ...
false
0
[ "-S = eval(input())", "+S = list(map(int, list(eval(input()))))", "- if flag_num == 0 and s == str(i0):", "+ if flag_num == 0 and s == i0:", "- elif flag_num == 1 and s == str(i1):", "+ elif flag_num == 1 and s == i1:", "- elif flag_num == 2 and s == str(i2):", "+ ...
false
0.035953
0.035804
1.004153
[ "s858582428", "s437444095" ]
u606045429
p03497
python
s143419895
s895825048
169
102
41,500
32,516
Accepted
Accepted
39.64
from collections import * N,K=list(map(int,input().split())) print((sum(v for _,v in Counter(list(map(int,input().split()))).most_common()[K:])))
from collections import Counter N, K = [int(i) for i in input().split()] A = [int(i) for i in input().split()] print((sum(sorted(list(Counter(A).values()), reverse=True)[K:])))
3
6
133
175
from collections import * N, K = list(map(int, input().split())) print((sum(v for _, v in Counter(list(map(int, input().split()))).most_common()[K:])))
from collections import Counter N, K = [int(i) for i in input().split()] A = [int(i) for i in input().split()] print((sum(sorted(list(Counter(A).values()), reverse=True)[K:])))
false
50
[ "-from collections import *", "+from collections import Counter", "-N, K = list(map(int, input().split()))", "-print((sum(v for _, v in Counter(list(map(int, input().split()))).most_common()[K:])))", "+N, K = [int(i) for i in input().split()]", "+A = [int(i) for i in input().split()]", "+print((sum(sort...
false
0.041893
0.034094
1.228739
[ "s143419895", "s895825048" ]
u808817704
p02596
python
s070188683
s802518684
400
249
62,944
9,176
Accepted
Accepted
37.75
def main(): K = int(eval(input())) if K%2 == 0 or K%5==0: return -1 if K % 7 == 0: L = K * 9 // 7 else: L = K * 9 for i in range(1, 10000000): x = pow(10, i, L) if x == 1: return i else: return -1 if __name__ =...
k=int(eval(input())) if k==7 or k==1: print((1)) else: a=7 for i in range(1,10**6): a=10*a+7 if a%k==0: print((i+1)) break else: a=a%k else: print((-1))
21
14
361
237
def main(): K = int(eval(input())) if K % 2 == 0 or K % 5 == 0: return -1 if K % 7 == 0: L = K * 9 // 7 else: L = K * 9 for i in range(1, 10000000): x = pow(10, i, L) if x == 1: return i else: return -1 if __name__ == "__main__": ...
k = int(eval(input())) if k == 7 or k == 1: print((1)) else: a = 7 for i in range(1, 10**6): a = 10 * a + 7 if a % k == 0: print((i + 1)) break else: a = a % k else: print((-1))
false
33.333333
[ "-def main():", "- K = int(eval(input()))", "- if K % 2 == 0 or K % 5 == 0:", "- return -1", "- if K % 7 == 0:", "- L = K * 9 // 7", "+k = int(eval(input()))", "+if k == 7 or k == 1:", "+ print((1))", "+else:", "+ a = 7", "+ for i in range(1, 10**6):", "+ ...
false
0.504444
0.376113
1.341202
[ "s070188683", "s802518684" ]
u191874006
p03281
python
s332534930
s706545479
192
170
38,512
38,640
Accepted
Accepted
11.46
#!/usr/bin/env python3 #ABC106 B n = int(eval(input())) def count(n): c = 0 for i in range(1,n+1): if n % i == 0: c += 1 return c ans = 0 for i in range(1,n+1): if i % 2 == 0:continue x = count(i) if x == 8: ans += 1 print(ans)
#!/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
31
293
773
#!/usr/bin/env python3 # ABC106 B n = int(eval(input())) def count(n): c = 0 for i in range(1, n + 1): if n % i == 0: c += 1 return c ans = 0 for i in range(1, n + 1): if i % 2 == 0: continue x = count(i) if x == 8: ans += 1 print(ans)
#!/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
41.935484
[ "-# ABC106 B", "-n = int(eval(input()))", "+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", "+fr...
false
0.087705
0.043844
2.000383
[ "s332534930", "s706545479" ]
u509029769
p02718
python
s358022288
s410704550
30
27
9,184
9,180
Accepted
Accepted
10
N,M = list(map(int,input().split())) A = list(map(int,input().split())) s = sum(A) A = sorted(A,reverse=True) for i in range(N): if i == M-1: if (s/(4*M))>A[i]: print('No') else: print('Yes')
N,M = list(map(int,input().split())) A = list(map(int,input().split())) s = sum(A) A.sort(reverse=True) for i in range(N): if i == M-1: if (s/(4*M))>A[i]: print('No') else: print('Yes')
12
12
242
236
N, M = list(map(int, input().split())) A = list(map(int, input().split())) s = sum(A) A = sorted(A, reverse=True) for i in range(N): if i == M - 1: if (s / (4 * M)) > A[i]: print("No") else: print("Yes")
N, M = list(map(int, input().split())) A = list(map(int, input().split())) s = sum(A) A.sort(reverse=True) for i in range(N): if i == M - 1: if (s / (4 * M)) > A[i]: print("No") else: print("Yes")
false
0
[ "-A = sorted(A, reverse=True)", "+A.sort(reverse=True)" ]
false
0.04978
0.04188
1.18864
[ "s358022288", "s410704550" ]
u414430923
p02696
python
s004810771
s102378269
24
20
9,140
9,064
Accepted
Accepted
16.67
a,b,n = list(map(int, input().split())) if n < b: print((int(a/b * n))) else: print((int(a/b * (b-1))))
a,b,n = list(map(int, input().split())) print((int(a/b * min(n,b-1))))
5
2
111
69
a, b, n = list(map(int, input().split())) if n < b: print((int(a / b * n))) else: print((int(a / b * (b - 1))))
a, b, n = list(map(int, input().split())) print((int(a / b * min(n, b - 1))))
false
60
[ "-if n < b:", "- print((int(a / b * n)))", "-else:", "- print((int(a / b * (b - 1))))", "+print((int(a / b * min(n, b - 1))))" ]
false
0.038611
0.076515
0.50462
[ "s004810771", "s102378269" ]
u863955163
p02972
python
s628593278
s551179637
1,007
248
14,060
14,112
Accepted
Accepted
75.37
N = int(eval(input())) a = list(map(int, input().split())) M = 0 b = [0]*N B = [] for i in range(N, 0, -1): wa = 0 cnt = 1 while i*cnt <= N: wa += b[i*cnt-1] cnt+=1 if wa%2 != a[i-1]: M+=1 b[i-1] = 1 B.append(i) print(M) if M!=0: print((*B))
N = int(eval(input())) a = list(map(int, input().split())) M = 0 b = [0]*N B = [] for i in range(N, 0, -1): wa = sum(b[i-1::i]) if wa%2 != a[i-1]: M+=1 b[i-1] = 1 B.append(i) print(M) if M!=0: print((*B))
18
14
310
245
N = int(eval(input())) a = list(map(int, input().split())) M = 0 b = [0] * N B = [] for i in range(N, 0, -1): wa = 0 cnt = 1 while i * cnt <= N: wa += b[i * cnt - 1] cnt += 1 if wa % 2 != a[i - 1]: M += 1 b[i - 1] = 1 B.append(i) print(M) if M != 0: print((*B)...
N = int(eval(input())) a = list(map(int, input().split())) M = 0 b = [0] * N B = [] for i in range(N, 0, -1): wa = sum(b[i - 1 :: i]) if wa % 2 != a[i - 1]: M += 1 b[i - 1] = 1 B.append(i) print(M) if M != 0: print((*B))
false
22.222222
[ "- wa = 0", "- cnt = 1", "- while i * cnt <= N:", "- wa += b[i * cnt - 1]", "- cnt += 1", "+ wa = sum(b[i - 1 :: i])" ]
false
0.08257
0.03541
2.331829
[ "s628593278", "s551179637" ]
u860002137
p02760
python
s808911747
s870214967
335
119
21,800
27,268
Accepted
Accepted
64.48
import numpy as np a1 = np.zeros(3, dtype=int) a2 = np.zeros(3, dtype=int) a3 = np.zeros(3, dtype=int) for i in range(3): a1[i], a2[i], a3[i] = map(int, input().split()) n = int(input()) b = [int(input()) for i in range(n)] a = np.array([a1, a2, a3]).T.flatten() for i in range(n): a[np.where(a...
import numpy as np arr = np.array([list(map(int, input().split())) for _ in range(3)]) n = int(eval(input())) for _ in range(n): b = int(eval(input())) arr[np.where(arr == b)] = 0 ans1 = (np.sum(arr, axis=0) == 0).sum() >= 1 ans2 = (np.sum(arr, axis=1) == 0).sum() >= 1 ans3 = (np.diag(arr) == ...
18
17
552
428
import numpy as np a1 = np.zeros(3, dtype=int) a2 = np.zeros(3, dtype=int) a3 = np.zeros(3, dtype=int) for i in range(3): a1[i], a2[i], a3[i] = map(int, input().split()) n = int(input()) b = [int(input()) for i in range(n)] a = np.array([a1, a2, a3]).T.flatten() for i in range(n): a[np.where(a == b[i])] = 0 a ...
import numpy as np arr = np.array([list(map(int, input().split())) for _ in range(3)]) n = int(eval(input())) for _ in range(n): b = int(eval(input())) arr[np.where(arr == b)] = 0 ans1 = (np.sum(arr, axis=0) == 0).sum() >= 1 ans2 = (np.sum(arr, axis=1) == 0).sum() >= 1 ans3 = (np.diag(arr) == 0).sum() == 3 ans...
false
5.555556
[ "-a1 = np.zeros(3, dtype=int)", "-a2 = np.zeros(3, dtype=int)", "-a3 = np.zeros(3, dtype=int)", "-for i in range(3):", "- a1[i], a2[i], a3[i] = map(int, input().split())", "-n = int(input())", "-b = [int(input()) for i in range(n)]", "-a = np.array([a1, a2, a3]).T.flatten()", "-for i in range(n):...
false
0.271595
0.808302
0.336007
[ "s808911747", "s870214967" ]
u340781749
p02586
python
s267255158
s883135808
918
357
387,180
387,036
Accepted
Accepted
61.11
import os import sys import numpy as np def solve(inp): r, c, k = inp[:3] items = np.zeros((r + 1, c + 1), dtype=np.int64) rrr = inp[3::3] ccc = inp[4::3] vvv = inp[5::3] for r_, c_, v in zip(rrr, ccc, vvv): items[r_, c_] = v dp = np.zeros((r + 1, c + 1, 4), dtype=...
import os import sys import numpy as np def solve(inp): r, c, k = inp[:3] items = np.zeros((r + 1, c + 1), dtype=np.int64) rrr = inp[3::3] ccc = inp[4::3] vvv = inp[5::3] for r_, c_, v in zip(rrr, ccc, vvv): items[r_][c_] = v dp = np.zeros((r + 1, c + 1, 4), dtype=...
47
51
1,117
1,236
import os import sys import numpy as np def solve(inp): r, c, k = inp[:3] items = np.zeros((r + 1, c + 1), dtype=np.int64) rrr = inp[3::3] ccc = inp[4::3] vvv = inp[5::3] for r_, c_, v in zip(rrr, ccc, vvv): items[r_, c_] = v dp = np.zeros((r + 1, c + 1, 4), dtype=np.int64) for...
import os import sys import numpy as np def solve(inp): r, c, k = inp[:3] items = np.zeros((r + 1, c + 1), dtype=np.int64) rrr = inp[3::3] ccc = inp[4::3] vvv = inp[5::3] for r_, c_, v in zip(rrr, ccc, vvv): items[r_][c_] = v dp = np.zeros((r + 1, c + 1, 4), dtype=np.int64) for...
false
7.843137
[ "- items[r_, c_] = v", "+ items[r_][c_] = v", "- v = items[i, j]", "- dp[i, j] = np.maximum(dp[i, j - 1], dp[i - 1, j, 3])", "- if v > 0:", "- dp[i, j, 1:] = np.maximum(dp[i, j, 1:], dp[i, j, :-1] + v)", "- return dp[-1, -1, -1]", "+ ...
false
0.215181
0.209632
1.02647
[ "s267255158", "s883135808" ]
u265118937
p02693
python
s325924402
s760717851
65
30
61,708
9,124
Accepted
Accepted
53.85
n = int(eval(input())) a, b = list(map(int, input().split())) k = 1 while True: if a <= n*k <= b: print("OK") exit() elif n*k > b: print("NG") exit() else: k += 1
import math k = int(eval(input())) a, b = list(map(int, input().split())) if k == 1: print("OK") exit() elif a <= k <= b : print("OK") exit() cnt = 1 while True: tmp = cnt * k if a <= tmp <= b: print("OK") exit() elif b <= tmp: print("NG") ...
12
22
213
333
n = int(eval(input())) a, b = list(map(int, input().split())) k = 1 while True: if a <= n * k <= b: print("OK") exit() elif n * k > b: print("NG") exit() else: k += 1
import math k = int(eval(input())) a, b = list(map(int, input().split())) if k == 1: print("OK") exit() elif a <= k <= b: print("OK") exit() cnt = 1 while True: tmp = cnt * k if a <= tmp <= b: print("OK") exit() elif b <= tmp: print("NG") exit() cnt += 1
false
45.454545
[ "-n = int(eval(input()))", "+import math", "+", "+k = int(eval(input()))", "-k = 1", "+if k == 1:", "+ print(\"OK\")", "+ exit()", "+elif a <= k <= b:", "+ print(\"OK\")", "+ exit()", "+cnt = 1", "- if a <= n * k <= b:", "+ tmp = cnt * k", "+ if a <= tmp <= b:", "-...
false
0.03621
0.037769
0.95873
[ "s325924402", "s760717851" ]