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
u578049848
p03944
python
s561358693
s327151310
140
18
3,316
3,064
Accepted
Accepted
87.14
W,H,N = list(map(int,input().split())) CoordinateList = [] for i in range(N): x,y,a = list(map(int, input().split())) CoordinateList.append([x,y,a]) # raw White & Black AllArea = [] for numline in range(H): rawWhite = [] rawBlack = [] for numraw in range(W): rawWhite.append("W...
W,H,N = list(map(int,input().split())) CoordinateList1 = [] CoordinateList2 = [] CoordinateList3 = [] CoordinateList4 = [] for i in range(N): x,y,a = list(map(int, input().split())) if a == 1: CoordinateList1.append(x) elif a == 2: CoordinateList2.append(x) elif a == 3: ...
65
36
1,786
849
W, H, N = list(map(int, input().split())) CoordinateList = [] for i in range(N): x, y, a = list(map(int, input().split())) CoordinateList.append([x, y, a]) # raw White & Black AllArea = [] for numline in range(H): rawWhite = [] rawBlack = [] for numraw in range(W): rawWhite.append("W") ...
W, H, N = list(map(int, input().split())) CoordinateList1 = [] CoordinateList2 = [] CoordinateList3 = [] CoordinateList4 = [] for i in range(N): x, y, a = list(map(int, input().split())) if a == 1: CoordinateList1.append(x) elif a == 2: CoordinateList2.append(x) elif a == 3: Coor...
false
44.615385
[ "-CoordinateList = []", "+CoordinateList1 = []", "+CoordinateList2 = []", "+CoordinateList3 = []", "+CoordinateList4 = []", "- CoordinateList.append([x, y, a])", "-# raw White & Black", "-AllArea = []", "-for numline in range(H):", "- rawWhite = []", "- rawBlack = []", "- for numra...
false
0.03653
0.041786
0.874215
[ "s561358693", "s327151310" ]
u867408000
p02761
python
s679221711
s438655497
70
63
61,992
62,420
Accepted
Accepted
10
N, M = list(map(int,input().split())) check_lis = [-1 for _ in range(N)] for _ in range(M): s,c = list(map(int,input().split())) if check_lis[s-1] == -1: check_lis[s-1] = c else: if check_lis[s-1] != c: print('-1') break if check_lis[0] == 0 and N != 1: ...
N, M = list(map(int, input().split())) if N == 1: min_range = 0 max_range = 10 else: min_range = 10 ** (N-1) max_range = 10 ** N digits_lis = ['not defined' for _ in range(N+1)] for _ in range(M): s, c = list(map(int, input().split())) if digits_lis[s] == 'not defined': digits...
27
29
742
781
N, M = list(map(int, input().split())) check_lis = [-1 for _ in range(N)] for _ in range(M): s, c = list(map(int, input().split())) if check_lis[s - 1] == -1: check_lis[s - 1] = c else: if check_lis[s - 1] != c: print("-1") break if check_lis[0] == 0 and N != 1: ...
N, M = list(map(int, input().split())) if N == 1: min_range = 0 max_range = 10 else: min_range = 10 ** (N - 1) max_range = 10**N digits_lis = ["not defined" for _ in range(N + 1)] for _ in range(M): s, c = list(map(int, input().split())) if digits_lis[s] == "not defined": digits_lis[s] =...
false
6.896552
[ "-check_lis = [-1 for _ in range(N)]", "+if N == 1:", "+ min_range = 0", "+ max_range = 10", "+else:", "+ min_range = 10 ** (N - 1)", "+ max_range = 10**N", "+digits_lis = [\"not defined\" for _ in range(N + 1)]", "- if check_lis[s - 1] == -1:", "- check_lis[s - 1] = c", "+...
false
0.036199
0.033864
1.06897
[ "s679221711", "s438655497" ]
u607884285
p03557
python
s615193737
s810549172
1,159
1,068
23,092
24,180
Accepted
Accepted
7.85
n=int(eval(input())) a=list(map(int,input().split(' '))) b=list(map(int,input().split(' '))) c=list(map(int,input().split(' '))) a=[0]+sorted(a)+[float('inf')] c=[0]+sorted(c)+[float('inf')] def bin_search_a(a,b): low=0 high=len(a)-1 while low<=high: mid=(low+high)//2 if a[mid...
n=int(eval(input())) a=list(map(int,input().split(' '))) b=list(map(int,input().split(' '))) c=list(map(int,input().split(' '))) a=[0]+sorted(a)+[float('inf')] c=[0]+sorted(c)+[float('inf')] def meguru_a(bi): ng=n+1 ; ok=0 while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if a[mid] <...
38
34
802
688
n = int(eval(input())) a = list(map(int, input().split(" "))) b = list(map(int, input().split(" "))) c = list(map(int, input().split(" "))) a = [0] + sorted(a) + [float("inf")] c = [0] + sorted(c) + [float("inf")] def bin_search_a(a, b): low = 0 high = len(a) - 1 while low <= high: mid = (low + hi...
n = int(eval(input())) a = list(map(int, input().split(" "))) b = list(map(int, input().split(" "))) c = list(map(int, input().split(" "))) a = [0] + sorted(a) + [float("inf")] c = [0] + sorted(c) + [float("inf")] def meguru_a(bi): ng = n + 1 ok = 0 while abs(ok - ng) > 1: mid = (ok + ng) // 2 ...
false
10.526316
[ "-def bin_search_a(a, b):", "- low = 0", "- high = len(a) - 1", "- while low <= high:", "- mid = (low + high) // 2", "- if a[mid] < b <= a[mid + 1]:", "- return mid", "- if a[mid] >= b:", "- high = mid - 1", "+def meguru_a(bi):", "+ ng = n +...
false
0.047624
0.047721
0.99796
[ "s615193737", "s810549172" ]
u102461423
p03003
python
s166335576
s314477350
292
266
43,684
14,424
Accepted
Accepted
8.9
import numpy as np import sys input = sys.stdin.readline MOD = 10**9 + 7 N,M = list(map(int,input().split())) S = np.array(input().split(), dtype=np.int32) T = np.array(input().split(), dtype=np.int32) # (n,m) 以前で作れている列 dp = np.zeros((N+1, M+1), dtype = np.int64) dp[0] = 1 for n in range(1, N+1): sam...
import numpy as np MOD = 10**9 + 7 N,M = list(map(int,input().split())) S = np.array(input().split(), dtype=np.int32) T = np.array(input().split(), dtype=np.int32) # (n,m) 以前で作れている列 dp = np.ones(M+1, dtype = np.int64) for n in range(N): dp[1:] = ((dp[:-1] * (T == S[n])).cumsum() + dp[1:]) % MOD # cumsumに直...
20
14
477
348
import numpy as np import sys input = sys.stdin.readline MOD = 10**9 + 7 N, M = list(map(int, input().split())) S = np.array(input().split(), dtype=np.int32) T = np.array(input().split(), dtype=np.int32) # (n,m) 以前で作れている列 dp = np.zeros((N + 1, M + 1), dtype=np.int64) dp[0] = 1 for n in range(1, N + 1): same = T ==...
import numpy as np MOD = 10**9 + 7 N, M = list(map(int, input().split())) S = np.array(input().split(), dtype=np.int32) T = np.array(input().split(), dtype=np.int32) # (n,m) 以前で作れている列 dp = np.ones(M + 1, dtype=np.int64) for n in range(N): dp[1:] = ((dp[:-1] * (T == S[n])).cumsum() + dp[1:]) % MOD # cumsumに直す answ...
false
30
[ "-import sys", "-input = sys.stdin.readline", "-dp = np.zeros((N + 1, M + 1), dtype=np.int64)", "-dp[0] = 1", "-for n in range(1, N + 1):", "- same = T == S[n - 1]", "- dp[n, 1:][same] = dp[n - 1, :-1][same] # ちょうど(n,m)で終わる", "- dp[n] = (dp[n].cumsum() + dp[n - 1]) % MOD # cumsumに直す", "-a...
false
0.212522
0.205323
1.035061
[ "s166335576", "s314477350" ]
u426534722
p02271
python
s824625525
s655155562
460
20
5,724
5,660
Accepted
Accepted
95.65
from itertools import combinations n = int(eval(input())) A = tuple(map(int, input().split())) B = set(A) for i in range(2, n + 1): for C in combinations(A, i): B.add(sum(C)) q = int(eval(input())) for m in map(int, input().split()): print(("yes" if m in B else "no"))
n = int(eval(input())) SET1 = {0} for a in map(int, input().split()): for b in tuple(SET1): SET1.add(a + b) eval(input()) for m in map(int, input().split()): print(('yes' if m in SET1 else 'no'))
11
8
282
205
from itertools import combinations n = int(eval(input())) A = tuple(map(int, input().split())) B = set(A) for i in range(2, n + 1): for C in combinations(A, i): B.add(sum(C)) q = int(eval(input())) for m in map(int, input().split()): print(("yes" if m in B else "no"))
n = int(eval(input())) SET1 = {0} for a in map(int, input().split()): for b in tuple(SET1): SET1.add(a + b) eval(input()) for m in map(int, input().split()): print(("yes" if m in SET1 else "no"))
false
27.272727
[ "-from itertools import combinations", "-", "-A = tuple(map(int, input().split()))", "-B = set(A)", "-for i in range(2, n + 1):", "- for C in combinations(A, i):", "- B.add(sum(C))", "-q = int(eval(input()))", "+SET1 = {0}", "+for a in map(int, input().split()):", "+ for b in tuple(...
false
0.08429
0.037965
2.220185
[ "s824625525", "s655155562" ]
u977389981
p03244
python
s419838699
s276885089
106
90
21,084
20,692
Accepted
Accepted
15.09
from collections import Counter n = int(eval(input())) A = [int(i) for i in input().split()] A0 = [] A1 = [] for i in range(0, n, 2): A0.append(A[i]) A1.append(A[i + 1]) C0 = Counter(A0).most_common() C1 = Counter(A1).most_common() if C0[0][0] != C1[0][0]: ans = n - C0[0][1] - C1[0][1] ...
from collections import Counter n = int(eval(input())) A = [int(i) for i in input().split()] S = Counter(A[0::2]).most_common() T = Counter(A[1::2]).most_common() if S[0][0] != T[0][0]: ans = n - S[0][1] - T[0][1] elif S[0][0] == T[0][0]: if len(S) == 1 and len(T) > 1: ans = n // 2 - T[0][1...
26
20
631
542
from collections import Counter n = int(eval(input())) A = [int(i) for i in input().split()] A0 = [] A1 = [] for i in range(0, n, 2): A0.append(A[i]) A1.append(A[i + 1]) C0 = Counter(A0).most_common() C1 = Counter(A1).most_common() if C0[0][0] != C1[0][0]: ans = n - C0[0][1] - C1[0][1] else: if len(C0)...
from collections import Counter n = int(eval(input())) A = [int(i) for i in input().split()] S = Counter(A[0::2]).most_common() T = Counter(A[1::2]).most_common() if S[0][0] != T[0][0]: ans = n - S[0][1] - T[0][1] elif S[0][0] == T[0][0]: if len(S) == 1 and len(T) > 1: ans = n // 2 - T[0][1] elif l...
false
23.076923
[ "-A0 = []", "-A1 = []", "-for i in range(0, n, 2):", "- A0.append(A[i])", "- A1.append(A[i + 1])", "-C0 = Counter(A0).most_common()", "-C1 = Counter(A1).most_common()", "-if C0[0][0] != C1[0][0]:", "- ans = n - C0[0][1] - C1[0][1]", "-else:", "- if len(C0) == 1 and len(C1) == 1:", ...
false
0.046454
0.042565
1.091363
[ "s419838699", "s276885089" ]
u724687935
p03087
python
s922054176
s815334737
651
438
55,128
60,020
Accepted
Accepted
32.72
N, Q = list(map(int, input().split())) S = eval(input()) AC = [0] * N flag = 0 for i, s in enumerate(S): if s == 'C': if flag == 1: AC[i] = AC[i - 1] + 1 flag = 0 else: AC[i] = AC[i - 1] flag = 0 elif s == 'A': AC[i] = AC[i...
import sys N, Q = list(map(int, input().split())) S = eval(input()) AC = [0] * N for i in range(1, N): a = 0 if S[i - 1] == 'A' and S[i] == 'C': a = 1 AC[i] = AC[i - 1] + a LR = [list(map(int, x.split())) for x in sys.stdin.readlines()] for l, r in LR: print((AC[r - 1] - A...
29
18
551
311
N, Q = list(map(int, input().split())) S = eval(input()) AC = [0] * N flag = 0 for i, s in enumerate(S): if s == "C": if flag == 1: AC[i] = AC[i - 1] + 1 flag = 0 else: AC[i] = AC[i - 1] flag = 0 elif s == "A": AC[i] = AC[i - 1] fla...
import sys N, Q = list(map(int, input().split())) S = eval(input()) AC = [0] * N for i in range(1, N): a = 0 if S[i - 1] == "A" and S[i] == "C": a = 1 AC[i] = AC[i - 1] + a LR = [list(map(int, x.split())) for x in sys.stdin.readlines()] for l, r in LR: print((AC[r - 1] - AC[l - 1]))
false
37.931034
[ "+import sys", "+", "-flag = 0", "-for i, s in enumerate(S):", "- if s == \"C\":", "- if flag == 1:", "- AC[i] = AC[i - 1] + 1", "- flag = 0", "- else:", "- AC[i] = AC[i - 1]", "- flag = 0", "- elif s == \"A\":", "- AC[i]...
false
0.083233
0.037187
2.238221
[ "s922054176", "s815334737" ]
u997641430
p02787
python
s899988488
s452697432
380
345
41,452
41,068
Accepted
Accepted
9.21
inf = 10**9 H, N = list(map(int, input().split())) AB = [] for n in range(N): a, b = list(map(int, input().split())) AB.append((a, b)) AB.sort(reverse=True, key=lambda x: x[0]) dp = [inf] * (H + 10 ** 4) dp[0] = 0 for a, b in AB: for h in range(H): if dp[h] != inf: tmp = dp[h...
import sys input = sys.stdin.readline inf = 10**9 H, N = list(map(int, input().split())) AB = [] for n in range(N): a, b = list(map(int, input().split())) AB.append((a, b)) AB.sort(reverse=True, key=lambda x: x[0]) dp = [inf] * (H + 10 ** 4) dp[0] = 0 for a, b in AB: for h in range(H): ...
16
18
400
440
inf = 10**9 H, N = list(map(int, input().split())) AB = [] for n in range(N): a, b = list(map(int, input().split())) AB.append((a, b)) AB.sort(reverse=True, key=lambda x: x[0]) dp = [inf] * (H + 10**4) dp[0] = 0 for a, b in AB: for h in range(H): if dp[h] != inf: tmp = dp[h] + b ...
import sys input = sys.stdin.readline inf = 10**9 H, N = list(map(int, input().split())) AB = [] for n in range(N): a, b = list(map(int, input().split())) AB.append((a, b)) AB.sort(reverse=True, key=lambda x: x[0]) dp = [inf] * (H + 10**4) dp[0] = 0 for a, b in AB: for h in range(H): if dp[h] != in...
false
11.111111
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.049812
0.055361
0.899762
[ "s899988488", "s452697432" ]
u460386402
p02802
python
s577503324
s510392681
364
288
4,596
4,596
Accepted
Accepted
20.88
n,m=list(map(int,input().split())) acount=0 wcount=0 a=[0]*n w=[0]*n for i in range(m): p,m=list(map(str,input().split())) p=int(p) if m=="AC": if a[p-1]==0: acount+=1 a[p-1]+=1 else: if a[p-1]==0: w[p-1]+=1 for i in range(n): if a[i-1]==1: wcount+=w[i-1]...
n,m=list(map(int,input().split())) acount=0 wcount=0 a=[False]*n w=[0]*n for i in range(m): p,m=input().split() p=int(p) if m=="AC": if a[p-1]==False: acount+=1 a[p-1]=True else: if a[p-1]==False: w[p-1]+=1 for i in range(n): if a[i-1]==1: wcount+=w[i-1] ...
21
21
336
341
n, m = list(map(int, input().split())) acount = 0 wcount = 0 a = [0] * n w = [0] * n for i in range(m): p, m = list(map(str, input().split())) p = int(p) if m == "AC": if a[p - 1] == 0: acount += 1 a[p - 1] += 1 else: if a[p - 1] == 0: w[p - 1] += 1 fo...
n, m = list(map(int, input().split())) acount = 0 wcount = 0 a = [False] * n w = [0] * n for i in range(m): p, m = input().split() p = int(p) if m == "AC": if a[p - 1] == False: acount += 1 a[p - 1] = True else: if a[p - 1] == False: w[p - 1] += 1 for ...
false
0
[ "-a = [0] * n", "+a = [False] * n", "- p, m = list(map(str, input().split()))", "+ p, m = input().split()", "- if a[p - 1] == 0:", "+ if a[p - 1] == False:", "- a[p - 1] += 1", "+ a[p - 1] = True", "- if a[p - 1] == 0:", "+ if a[p - 1] == Fal...
false
0.037157
0.061446
0.604711
[ "s577503324", "s510392681" ]
u729133443
p03792
python
s543756421
s872434897
55
33
3,316
5,236
Accepted
Accepted
40
s='#';n,*a=open(0).readlines();n=int(n);f=sum(n==t.count(s)for t in zip(*a));r=list(range(n));print((-all(not s in t for t in a)or min(n*2-f-a[i].count(s)+all(s<a[j][i]for j in r)for i in r)))
n,*a=open(0).readlines();n=int(n);*b,=list(zip(*a));f,e=[sum(n==t.count(c)for t in b)for c in'#.'];print((-(e==n)or min(n*2-f-a[i].count('#')+(not'#'in b[i])for i in range(n))))
1
1
184
169
s = "#" n, *a = open(0).readlines() n = int(n) f = sum(n == t.count(s) for t in zip(*a)) r = list(range(n)) print( ( -all(not s in t for t in a) or min(n * 2 - f - a[i].count(s) + all(s < a[j][i] for j in r) for i in r) ) )
n, *a = open(0).readlines() n = int(n) (*b,) = list(zip(*a)) f, e = [sum(n == t.count(c) for t in b) for c in "#."] print( ( -(e == n) or min(n * 2 - f - a[i].count("#") + (not "#" in b[i]) for i in range(n)) ) )
false
0
[ "-s = \"#\"", "-f = sum(n == t.count(s) for t in zip(*a))", "-r = list(range(n))", "+(*b,) = list(zip(*a))", "+f, e = [sum(n == t.count(c) for t in b) for c in \"#.\"]", "- -all(not s in t for t in a)", "- or min(n * 2 - f - a[i].count(s) + all(s < a[j][i] for j in r) for i in r)", "+ ...
false
0.044096
0.042049
1.048675
[ "s543756421", "s872434897" ]
u864197622
p03395
python
s609292803
s024836497
152
67
3,572
3,564
Accepted
Accepted
55.92
from heapq import heapify, heappush as hpush, heappop as hpop def dijkstra(n, E, i0=0): h = [[0, i0]] D = [-1] * n done = [0] * n D[i0] = 0 while h: d, i = hpop(h) done[i] = 1 for j, w in E[i]: nd = d + w if D[j] < 0 or D[j] >= nd: ...
from collections import deque def BFS_dist(n, E, i0=0): Q = deque([i0]) D = [-1] * n D[i0] = 0 while Q: x = Q.popleft() for c in E[x]: if D[c] == -1: D[c] = D[x] + 1 Q.append(c) return D N = int(eval(input())) A = [int(a) for...
61
56
1,432
1,267
from heapq import heapify, heappush as hpush, heappop as hpop def dijkstra(n, E, i0=0): h = [[0, i0]] D = [-1] * n done = [0] * n D[i0] = 0 while h: d, i = hpop(h) done[i] = 1 for j, w in E[i]: nd = d + w if D[j] < 0 or D[j] >= nd: if...
from collections import deque def BFS_dist(n, E, i0=0): Q = deque([i0]) D = [-1] * n D[i0] = 0 while Q: x = Q.popleft() for c in E[x]: if D[c] == -1: D[c] = D[x] + 1 Q.append(c) return D N = int(eval(input())) A = [int(a) for a in input...
false
8.196721
[ "-from heapq import heapify, heappush as hpush, heappop as hpop", "+from collections import deque", "-def dijkstra(n, E, i0=0):", "- h = [[0, i0]]", "+def BFS_dist(n, E, i0=0):", "+ Q = deque([i0])", "- done = [0] * n", "- while h:", "- d, i = hpop(h)", "- done[i] = 1", ...
false
0.121389
0.139509
0.870118
[ "s609292803", "s024836497" ]
u980503157
p03852
python
s302951454
s311091412
29
26
8,996
9,028
Accepted
Accepted
10.34
letter = eval(input()) if letter in "aeiou": print("vowel") else: print("consonant")
s = eval(input()) if s in "aeiou": print("vowel") else: print("consonant")
6
6
88
78
letter = eval(input()) if letter in "aeiou": print("vowel") else: print("consonant")
s = eval(input()) if s in "aeiou": print("vowel") else: print("consonant")
false
0
[ "-letter = eval(input())", "-if letter in \"aeiou\":", "+s = eval(input())", "+if s in \"aeiou\":" ]
false
0.03877
0.038965
0.994976
[ "s302951454", "s311091412" ]
u057964173
p03073
python
s184819997
s735179744
76
47
5,476
3,316
Accepted
Accepted
38.16
import sys def input(): return sys.stdin.readline().strip() def resolve(): s=eval(input()) x=len(s)//2 l1=[1,0]*x+[1] l2=[0,1]*x+[0] cnt1=0 cnt2=0 for i in range(len(s)): if s[i]!=str(l1[i]): cnt1+=1 if s[i]!=str(l2[i]): cnt2+=1 pri...
import sys def input(): return sys.stdin.readline().strip() def resolve(): s=eval(input()) x=len(s)//2 l1='10'*x+'1' l2='01'*x+'0' cnt1=0 cnt2=0 for i in range(len(s)): if s[i]!=l1[i]: cnt1+=1 if s[i]!=l2[i]: cnt2+=1 print((min(cnt1...
17
17
343
331
import sys def input(): return sys.stdin.readline().strip() def resolve(): s = eval(input()) x = len(s) // 2 l1 = [1, 0] * x + [1] l2 = [0, 1] * x + [0] cnt1 = 0 cnt2 = 0 for i in range(len(s)): if s[i] != str(l1[i]): cnt1 += 1 if s[i] != str(l2[i]): ...
import sys def input(): return sys.stdin.readline().strip() def resolve(): s = eval(input()) x = len(s) // 2 l1 = "10" * x + "1" l2 = "01" * x + "0" cnt1 = 0 cnt2 = 0 for i in range(len(s)): if s[i] != l1[i]: cnt1 += 1 if s[i] != l2[i]: cnt2 +=...
false
0
[ "- l1 = [1, 0] * x + [1]", "- l2 = [0, 1] * x + [0]", "+ l1 = \"10\" * x + \"1\"", "+ l2 = \"01\" * x + \"0\"", "- if s[i] != str(l1[i]):", "+ if s[i] != l1[i]:", "- if s[i] != str(l2[i]):", "+ if s[i] != l2[i]:" ]
false
0.041299
0.041491
0.995359
[ "s184819997", "s735179744" ]
u754022296
p03603
python
s291733712
s938123317
1,546
210
25,096
34,156
Accepted
Accepted
86.42
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) INF = 2**30 n = int(eval(input())) P = list(map(int, input().split())) T = [[] for _ in range(n)] for i, p in enumerate(P, 1): T[p-1].append(i) X = tuple(map(int, input().split())) D = [-1]*n def dfs(v): if D[v] != -1: return D[v]...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) import numpy as np INF = 2**30 n = int(eval(input())) P = tuple(map(int, input().split())) T = [[] for _ in range(n)] for i, p in enumerate(P, 1): T[p-1].append(i) X = tuple(map(int, input().split())) D = [-1]*n def dfs(v): if D[v] !=...
36
36
726
814
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) INF = 2**30 n = int(eval(input())) P = list(map(int, input().split())) T = [[] for _ in range(n)] for i, p in enumerate(P, 1): T[p - 1].append(i) X = tuple(map(int, input().split())) D = [-1] * n def dfs(v): if D[v] != -1: return D[v]...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) import numpy as np INF = 2**30 n = int(eval(input())) P = tuple(map(int, input().split())) T = [[] for _ in range(n)] for i, p in enumerate(P, 1): T[p - 1].append(i) X = tuple(map(int, input().split())) D = [-1] * n def dfs(v): if D[v] != -1...
false
0
[ "+import numpy as np", "+", "-P = list(map(int, input().split()))", "+P = tuple(map(int, input().split()))", "- dp = [INF] * (x + 1)", "+ dp = np.full(x + 1, INF, dtype=np.int64)", "- for nv in T[v]:", "- k = [INF] * (x + 1)", "+ for i, nv in enumerate(T[v]):", "+ k = np....
false
0.04644
0.209553
0.221614
[ "s291733712", "s938123317" ]
u451017206
p03229
python
s387010472
s552176536
302
223
12,600
10,504
Accepted
Accepted
26.16
N = int(eval(input())) A = sorted([int(eval(input())) for i in range(N)]) a = [0] * N b = [0] * N j = 1 for i in range(N-1): a[i] += -j a[i+1] += j b[i] += j b[i+1] += -j j = -j a.sort() b.sort() s1 = sum([i*j for i,j in zip(a, A)]) s2 = sum([i*j for i,j in zip(b, A)]) p...
from sys import stdin from collections import deque N = int(stdin.readline()) A = sorted([int(stdin.readline()) for i in range(N)]) ans1 = deque([A[N-1]]) ans2 = deque([A[0]]) f = 0 f2 = 1 b = N - 2 b2 = N - 1 s = True while f <= b: if s: ans1.append(A[f]) f += 1 if f <= b...
19
46
324
937
N = int(eval(input())) A = sorted([int(eval(input())) for i in range(N)]) a = [0] * N b = [0] * N j = 1 for i in range(N - 1): a[i] += -j a[i + 1] += j b[i] += j b[i + 1] += -j j = -j a.sort() b.sort() s1 = sum([i * j for i, j in zip(a, A)]) s2 = sum([i * j for i, j in zip(b, A)]) print((max(s1, s2)...
from sys import stdin from collections import deque N = int(stdin.readline()) A = sorted([int(stdin.readline()) for i in range(N)]) ans1 = deque([A[N - 1]]) ans2 = deque([A[0]]) f = 0 f2 = 1 b = N - 2 b2 = N - 1 s = True while f <= b: if s: ans1.append(A[f]) f += 1 if f <= b: an...
false
58.695652
[ "-N = int(eval(input()))", "-A = sorted([int(eval(input())) for i in range(N)])", "-a = [0] * N", "-b = [0] * N", "-j = 1", "+from sys import stdin", "+from collections import deque", "+", "+N = int(stdin.readline())", "+A = sorted([int(stdin.readline()) for i in range(N)])", "+ans1 = deque([A[N...
false
0.084782
0.076657
1.106001
[ "s387010472", "s552176536" ]
u729133443
p03700
python
s058010248
s363707475
628
230
26,668
24,568
Accepted
Accepted
63.38
from numpy import* t,*h=open(0) _,a,b=int32(t.split()) i,j=0,2**30 while~i+j: k=(j+i)//2;t=(b*k-int32(h))//(a-b) if-k>sum(t[t<0]):i=k else:j=k print(j)
from numpy import* t,*h=open(0) _,a,b=int32(t.split()) h=int32(h) i,j=0,2**30 while~i+j: k=(j+i)//2 t=(b*k-h)//(a-b) if-k>sum(t[t<0]):i=k else:j=k print(j)
9
11
162
173
from numpy import * t, *h = open(0) _, a, b = int32(t.split()) i, j = 0, 2**30 while ~i + j: k = (j + i) // 2 t = (b * k - int32(h)) // (a - b) if -k > sum(t[t < 0]): i = k else: j = k print(j)
from numpy import * t, *h = open(0) _, a, b = int32(t.split()) h = int32(h) i, j = 0, 2**30 while ~i + j: k = (j + i) // 2 t = (b * k - h) // (a - b) if -k > sum(t[t < 0]): i = k else: j = k print(j)
false
18.181818
[ "+h = int32(h)", "- t = (b * k - int32(h)) // (a - b)", "+ t = (b * k - h) // (a - b)" ]
false
0.200057
0.174724
1.144986
[ "s058010248", "s363707475" ]
u219197917
p03043
python
s770092766
s247330346
85
59
2,940
9,132
Accepted
Accepted
30.59
n, k = [int(i) for i in input().split()] win = 0 for i in range(1, n + 1): for j in range(k): if i * 2 ** j >= k: win += 0.5 ** j / n break print(win)
from math import ceil, log2 n, k = list(map(int, input().split())) print((sum(0.5 ** max(ceil(log2(k / i)), 0) for i in range(1, n + 1)) / n))
8
4
175
139
n, k = [int(i) for i in input().split()] win = 0 for i in range(1, n + 1): for j in range(k): if i * 2**j >= k: win += 0.5**j / n break print(win)
from math import ceil, log2 n, k = list(map(int, input().split())) print((sum(0.5 ** max(ceil(log2(k / i)), 0) for i in range(1, n + 1)) / n))
false
50
[ "-n, k = [int(i) for i in input().split()]", "-win = 0", "-for i in range(1, n + 1):", "- for j in range(k):", "- if i * 2**j >= k:", "- win += 0.5**j / n", "- break", "-print(win)", "+from math import ceil, log2", "+", "+n, k = list(map(int, input().split()))", ...
false
0.102634
0.077389
1.326211
[ "s770092766", "s247330346" ]
u225388820
p03166
python
s651400245
s077462284
393
289
194,100
118,100
Accepted
Accepted
26.46
# 根付き木に対して根から最大でどれだけかかるかを使う方法 import sys sys.setrecursionlimit(1000000000) input = sys.stdin.readline n, m = list(map(int, input().split())) co = [[] for i in range(n)] # 有効辺の向きを逆にした for i in range(m): a, b = list(map(int, input().split())) co[b - 1].append(a - 1) dp = [-1] * n def memo(v): ...
#解説AC import sys sys.setrecursionlimit(1000000000) input = sys.stdin.readline n,m=list(map(int,input().split())) es=[[] for i in range(n)] for i in range(m): x,y=list(map(int,input().split())) es[x-1].append(y-1) dp=[-1]*n def memo(v): if dp[v]+1: #更新済 dp[v]!=-1 return dp[v] ...
33
28
610
458
# 根付き木に対して根から最大でどれだけかかるかを使う方法 import sys sys.setrecursionlimit(1000000000) input = sys.stdin.readline n, m = list(map(int, input().split())) co = [[] for i in range(n)] # 有効辺の向きを逆にした for i in range(m): a, b = list(map(int, input().split())) co[b - 1].append(a - 1) dp = [-1] * n def memo(v): if dp[v] != ...
# 解説AC import sys sys.setrecursionlimit(1000000000) input = sys.stdin.readline n, m = list(map(int, input().split())) es = [[] for i in range(n)] for i in range(m): x, y = list(map(int, input().split())) es[x - 1].append(y - 1) dp = [-1] * n def memo(v): if dp[v] + 1: # 更新済 dp[v]!=-1 return dp[v...
false
15.151515
[ "-# 根付き木に対して根から最大でどれだけかかるかを使う方法", "+# 解説AC", "-co = [[] for i in range(n)] # 有効辺の向きを逆にした", "+es = [[] for i in range(n)]", "- a, b = list(map(int, input().split()))", "- co[b - 1].append(a - 1)", "+ x, y = list(map(int, input().split()))", "+ es[x - 1].append(y - 1)", "- if dp[v] != ...
false
0.082443
0.063534
1.297634
[ "s651400245", "s077462284" ]
u446774692
p03722
python
s445742115
s301301561
1,762
1,302
5,612
3,572
Accepted
Accepted
26.11
N,M = list(map(int,input().split())) from collections import deque ls = [deque([]) for _ in range(N)] for i in range(M): a,b,c = list(map(int,input().split())) a,b = a-1,b-1 ls[a].append([b,c]) cost = [-(10**10)*N]*N cost[0] = 0 for i in range(N): update = False q = [deque(m for m i...
N,M = list(map(int,input().split())) abc = [] for _ in range(M): abc.append(list(map(int,input().split()))) cost = [-(10**10)*N]*N cost[0] = 0 for i in range(N): update = False for a,b,c in abc: a,b = a-1,b-1 if cost[a] != -(10**10)*N: if cost[b] < cost[a] + c: ...
31
26
743
560
N, M = list(map(int, input().split())) from collections import deque ls = [deque([]) for _ in range(N)] for i in range(M): a, b, c = list(map(int, input().split())) a, b = a - 1, b - 1 ls[a].append([b, c]) cost = [-(10**10) * N] * N cost[0] = 0 for i in range(N): update = False q = [deque(m for m i...
N, M = list(map(int, input().split())) abc = [] for _ in range(M): abc.append(list(map(int, input().split()))) cost = [-(10**10) * N] * N cost[0] = 0 for i in range(N): update = False for a, b, c in abc: a, b = a - 1, b - 1 if cost[a] != -(10**10) * N: if cost[b] < cost[a] + c: ...
false
16.129032
[ "-from collections import deque", "-", "-ls = [deque([]) for _ in range(N)]", "-for i in range(M):", "- a, b, c = list(map(int, input().split()))", "- a, b = a - 1, b - 1", "- ls[a].append([b, c])", "+abc = []", "+for _ in range(M):", "+ abc.append(list(map(int, input().split())))", ...
false
0.038507
0.179035
0.215082
[ "s445742115", "s301301561" ]
u874395007
p02419
python
s747764399
s504655328
40
20
6,484
5,556
Accepted
Accepted
50
import re pattern = str(eval(input())) words = [] while True: line = str(eval(input())) if line == 'END_OF_TEXT': break words += line.lower().split() cnt = 0 for word in words: if re.fullmatch(pattern, word): cnt += 1 print(cnt)
W = str(eval(input())) words = [] while True: line = str(eval(input())) if line == 'END_OF_TEXT': break words += line.lower().split() cnt = 0 for word in words: if W == word: cnt += 1 print(cnt)
15
14
265
230
import re pattern = str(eval(input())) words = [] while True: line = str(eval(input())) if line == "END_OF_TEXT": break words += line.lower().split() cnt = 0 for word in words: if re.fullmatch(pattern, word): cnt += 1 print(cnt)
W = str(eval(input())) words = [] while True: line = str(eval(input())) if line == "END_OF_TEXT": break words += line.lower().split() cnt = 0 for word in words: if W == word: cnt += 1 print(cnt)
false
6.666667
[ "-import re", "-", "-pattern = str(eval(input()))", "+W = str(eval(input()))", "- if re.fullmatch(pattern, word):", "+ if W == word:" ]
false
0.042349
0.037045
1.143167
[ "s747764399", "s504655328" ]
u645250356
p03163
python
s703961847
s765104166
669
567
171,888
128,260
Accepted
Accepted
15.25
from collections import Counter,defaultdict import sys,bisect,math,itertools,string,queue mod = 10**9+7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sys.stdin.readline().split()) n,w = inpl() ww = [0] * n vv = [0] * n ...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 mod2 = 998244353 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.rea...
24
25
636
759
from collections import Counter, defaultdict import sys, bisect, math, itertools, string, queue mod = 10**9 + 7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sys.stdin.readline().split()) n, w = inpl() ww = [0...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 mod2 = 998244353 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(in...
false
4
[ "-from collections import Counter, defaultdict", "-import sys, bisect, math, itertools, string, queue", "+from collections import Counter, defaultdict, deque", "+from heapq import heappop, heappush, heapify", "+import sys, bisect, math, itertools, fractions, pprint", "+sys.setrecursionlimit(10**8)", "+m...
false
0.048408
0.033375
1.450418
[ "s703961847", "s765104166" ]
u840988663
p02830
python
s233409453
s782107543
20
17
3,316
2,940
Accepted
Accepted
15
N=int(eval(input())) S,T = list(map(str, input().split())) li=[] for i in range(N): li.append(S[i]) li.append(T[i]) print((''.join(li)))
n=int(eval(input())) s,t=input().split() li=[] for i in range(n): li.append(s[i]) li.append(t[i]) li="".join(li) print(li)
7
9
136
130
N = int(eval(input())) S, T = list(map(str, input().split())) li = [] for i in range(N): li.append(S[i]) li.append(T[i]) print(("".join(li)))
n = int(eval(input())) s, t = input().split() li = [] for i in range(n): li.append(s[i]) li.append(t[i]) li = "".join(li) print(li)
false
22.222222
[ "-N = int(eval(input()))", "-S, T = list(map(str, input().split()))", "+n = int(eval(input()))", "+s, t = input().split()", "-for i in range(N):", "- li.append(S[i])", "- li.append(T[i])", "-print((\"\".join(li)))", "+for i in range(n):", "+ li.append(s[i])", "+ li.append(t[i])", "...
false
0.045312
0.044806
1.011305
[ "s233409453", "s782107543" ]
u334712262
p02925
python
s238834609
s315604047
1,818
1,072
386,444
224,560
Accepted
Accepted
41.03
# -*- coding: utf-8 -*- from collections import Counter, defaultdict import sys # sys.setrecursionlimit(10**6) readline = sys.stdin.buffer.readline # readline = sys.stdin.readline INF = 1 << 60 def read_int(): return int(readline()) def read_int_n(): return list(map(int, readline().split...
import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline MAXN = 1005 MAXV = MAXN*(MAXN-1)//2 to = [[] for _ in range(MAXV)] # 頂点間の辺の情報 id = [[[] for _ in range(MAXN)] for _ in range(MAXN)] # 試合のid=DAGの頂点番号 def toId(i,j): # 選手idから試合idを返す関数 if i > j: # i,jが逆になっても試合idは同じ i,j = j,i ...
109
59
1,930
1,610
# -*- coding: utf-8 -*- from collections import Counter, defaultdict import sys # sys.setrecursionlimit(10**6) readline = sys.stdin.buffer.readline # readline = sys.stdin.readline INF = 1 << 60 def read_int(): return int(readline()) def read_int_n(): return list(map(int, readline().split())) def read_flo...
import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline MAXN = 1005 MAXV = MAXN * (MAXN - 1) // 2 to = [[] for _ in range(MAXV)] # 頂点間の辺の情報 id = [[[] for _ in range(MAXN)] for _ in range(MAXN)] # 試合のid=DAGの頂点番号 def toId(i, j): # 選手idから試合idを返す関数 if i > j: # i,jが逆になっても試合idは同じ i, j = j, i ...
false
45.87156
[ "-# -*- coding: utf-8 -*-", "-from collections import Counter, defaultdict", "-# sys.setrecursionlimit(10**6)", "-readline = sys.stdin.buffer.readline", "-# readline = sys.stdin.readline", "-INF = 1 << 60", "+sys.setrecursionlimit(10**6)", "+readline = sys.stdin.readline", "+MAXN = 1005", "+MAXV =...
false
0.044138
1.582727
0.027887
[ "s238834609", "s315604047" ]
u616217092
p03353
python
s696362007
s729835607
58
40
16,500
16,248
Accepted
Accepted
31.03
from sys import stdin from string import ascii_lowercase def myfind(s, c): result = [] for i, x in enumerate(s): if x == c: result.append(i) return result def main(): s = stdin.readline().rstrip() K = int(stdin.readline().rstrip()) result = [] for x in...
from sys import stdin from string import ascii_lowercase def main(): s = stdin.readline().rstrip() K = int(stdin.readline().rstrip()) result = [] for c in ascii_lowercase: for text in sorted([s[i:] for i, x in enumerate(s) if x == c]): for i in range(len(text)): ...
41
20
965
569
from sys import stdin from string import ascii_lowercase def myfind(s, c): result = [] for i, x in enumerate(s): if x == c: result.append(i) return result def main(): s = stdin.readline().rstrip() K = int(stdin.readline().rstrip()) result = [] for x in ascii_lowercase...
from sys import stdin from string import ascii_lowercase def main(): s = stdin.readline().rstrip() K = int(stdin.readline().rstrip()) result = [] for c in ascii_lowercase: for text in sorted([s[i:] for i, x in enumerate(s) if x == c]): for i in range(len(text)): if ...
false
51.219512
[ "-", "-", "-def myfind(s, c):", "- result = []", "- for i, x in enumerate(s):", "- if x == c:", "- result.append(i)", "- return result", "- for x in ascii_lowercase:", "- idxs = myfind(s, x)", "- if not idxs:", "- continue", "- re...
false
0.049658
0.101003
0.49165
[ "s696362007", "s729835607" ]
u781262926
p03361
python
s185719154
s252019264
281
178
18,300
12,352
Accepted
Accepted
36.65
from itertools import product from collections import deque import numpy as np inputs = open(0).readlines() class Grid(): def __init__(self, grid, w=0, h=0, function=lambda x: x): self.w = w = w if w else len(grid[0]) self.h = h = h if h else len(grid) dtype = type(function(grid[0][0...
from itertools import product from collections import deque import numpy as np inputs = open(0).readlines() class Grid(): def __init__(self, grid, w=0, h=0, function=lambda x: x): self.w = w = w if w else len(grid[0]) self.h = h = h if h else len(grid) dtype = type(function(grid[0][0...
55
54
1,717
1,661
from itertools import product from collections import deque import numpy as np inputs = open(0).readlines() class Grid: def __init__(self, grid, w=0, h=0, function=lambda x: x): self.w = w = w if w else len(grid[0]) self.h = h = h if h else len(grid) dtype = type(function(grid[0][0])) ...
from itertools import product from collections import deque import numpy as np inputs = open(0).readlines() class Grid: def __init__(self, grid, w=0, h=0, function=lambda x: x): self.w = w = w if w else len(grid[0]) self.h = h = h if h else len(grid) dtype = type(function(grid[0][0])) ...
false
1.818182
[ "-from collections import deque", "-def bfs(root):", "+def dfs(root):", "- queue = deque([root])", "- while queue:", "- x, y = queue.popleft()", "+ stack = [root]", "+ while stack:", "+ x, y = stack.pop()", "+ grid[y, x] = 0", "- queue.append((x + ...
false
0.289992
0.153809
1.885402
[ "s185719154", "s252019264" ]
u912237403
p00066
python
s637008420
s241553658
20
10
4,220
4,216
Accepted
Accepted
50
import sys x=["ooo","xxx"] for s in sys.stdin: c="d" for i in range(3): if s[i:9:3]in x: c=s[i] break j=i*3 if s[j:j+3]in x: c=s[j] break else: if s[0::4] in x or s[2:7:2] in x:c=s[4] print(c)
import sys def f(a,b,c): return a if a!="s"and a==b==c else 0 for s in sys.stdin: for i in range(3): c=f(*s[i:9:3]) if c: break j=i*3 c=f(*s[j:j+3]) if c: break else: a=s[4] if f(*s[0:9:4])or f(*s[2:7:2]):c=a else:c="d" print(...
15
15
301
321
import sys x = ["ooo", "xxx"] for s in sys.stdin: c = "d" for i in range(3): if s[i:9:3] in x: c = s[i] break j = i * 3 if s[j : j + 3] in x: c = s[j] break else: if s[0::4] in x or s[2:7:2] in x: c = s[4] print...
import sys def f(a, b, c): return a if a != "s" and a == b == c else 0 for s in sys.stdin: for i in range(3): c = f(*s[i:9:3]) if c: break j = i * 3 c = f(*s[j : j + 3]) if c: break else: a = s[4] if f(*s[0:9:4]) or f(*s[2:7...
false
0
[ "-x = [\"ooo\", \"xxx\"]", "+", "+def f(a, b, c):", "+ return a if a != \"s\" and a == b == c else 0", "+", "+", "- c = \"d\"", "- if s[i:9:3] in x:", "- c = s[i]", "+ c = f(*s[i:9:3])", "+ if c:", "- if s[j : j + 3] in x:", "- c = s[j]...
false
0.040674
0.097335
0.417876
[ "s637008420", "s241553658" ]
u089376182
p03556
python
s614206444
s941975006
21
18
3,316
3,188
Accepted
Accepted
14.29
n = int(eval(input())) print((int(int(n**.5)**2)))
n = int(eval(input())) print((int(n**0.5)**2))
2
2
43
39
n = int(eval(input())) print((int(int(n**0.5) ** 2)))
n = int(eval(input())) print((int(n**0.5) ** 2))
false
0
[ "-print((int(int(n**0.5) ** 2)))", "+print((int(n**0.5) ** 2))" ]
false
0.110774
0.042835
2.586043
[ "s614206444", "s941975006" ]
u494058663
p02683
python
s681296965
s054488916
98
72
9,780
9,232
Accepted
Accepted
26.53
n,m,x = list(map(int,input().split())) pattern = [] for i in range(2**(n)): tmp = [0 for i in range(n)] for j in range(n): if i>>j & 1: tmp[j] = 1 pattern.append(tmp) ans = 10**9 Input= [] for i in range(n): tmp = [int(i) for i in input().split()] Input.append(tmp) ...
def main(): n,m,x = list(map(int,input().split())) A = [] ans = 10**9 for i in range(n): tmp = [int(i) for i in input().split()] A.append(tmp) for i in range(2**n): arg = [0 for j in range(m+1)] cost = 0 for j in range(n): if (i>>j)&1 ==...
35
27
797
691
n, m, x = list(map(int, input().split())) pattern = [] for i in range(2 ** (n)): tmp = [0 for i in range(n)] for j in range(n): if i >> j & 1: tmp[j] = 1 pattern.append(tmp) ans = 10**9 Input = [] for i in range(n): tmp = [int(i) for i in input().split()] Input.append(tmp) for i ...
def main(): n, m, x = list(map(int, input().split())) A = [] ans = 10**9 for i in range(n): tmp = [int(i) for i in input().split()] A.append(tmp) for i in range(2**n): arg = [0 for j in range(m + 1)] cost = 0 for j in range(n): if (i >> j) & 1 == 1...
false
22.857143
[ "-n, m, x = list(map(int, input().split()))", "-pattern = []", "-for i in range(2 ** (n)):", "- tmp = [0 for i in range(n)]", "- for j in range(n):", "- if i >> j & 1:", "- tmp[j] = 1", "- pattern.append(tmp)", "-ans = 10**9", "-Input = []", "-for i in range(n):", "-...
false
0.061045
0.03753
1.626567
[ "s681296965", "s054488916" ]
u893063840
p02949
python
s397282002
s081446694
1,114
334
49,240
25,040
Accepted
Accepted
70.02
n, m, p = list(map(int, input().split())) abc = [list(map(int, input().split())) for _ in range(m)] def bellman_ford(s, g): # loop 0 - (n-1) : bellman ford # loop n - (2n-1): check g can be updated dist = [float("inf")] * n dist[s] = 0 for i in range(2 * n): for a, b, c in abc: ...
from scipy.sparse.csgraph import bellman_ford, NegativeCycleError from scipy.sparse import csr_matrix from collections import defaultdict n, m, p = list(map(int, input().split())) abc = [list(map(int, input().split())) for _ in range(m)] INF = 10 ** 9 fwd = [[] for _ in range(n + 1)] rev = [[] for _ in range...
29
54
688
1,212
n, m, p = list(map(int, input().split())) abc = [list(map(int, input().split())) for _ in range(m)] def bellman_ford(s, g): # loop 0 - (n-1) : bellman ford # loop n - (2n-1): check g can be updated dist = [float("inf")] * n dist[s] = 0 for i in range(2 * n): for a, b, c in abc: ...
from scipy.sparse.csgraph import bellman_ford, NegativeCycleError from scipy.sparse import csr_matrix from collections import defaultdict n, m, p = list(map(int, input().split())) abc = [list(map(int, input().split())) for _ in range(m)] INF = 10**9 fwd = [[] for _ in range(n + 1)] rev = [[] for _ in range(n + 1)] for...
false
46.296296
[ "+from scipy.sparse.csgraph import bellman_ford, NegativeCycleError", "+from scipy.sparse import csr_matrix", "+from collections import defaultdict", "+", "+INF = 10**9", "+fwd = [[] for _ in range(n + 1)]", "+rev = [[] for _ in range(n + 1)]", "+for a, b, c in abc:", "+ fwd[a].append(b)", "+ ...
false
0.036803
0.259546
0.1418
[ "s397282002", "s081446694" ]
u628538573
p03282
python
s828093556
s875864622
24
17
3,064
2,940
Accepted
Accepted
29.17
s = eval(input()) k = int(eval(input())) flag = -1 n = len(s) if n >= k: n = k for i in range(n): if flag == -1: if s[i] != '1': flag = i if flag == -1: print('1') else: print((s[flag]))
s = eval(input()) k = int(eval(input())) i = 0 while s[i] == "1": i += 1 if i > len(s) - 1: break if k <= len(s) and i >= k: print((1)) else: print((s[i]))
17
13
200
159
s = eval(input()) k = int(eval(input())) flag = -1 n = len(s) if n >= k: n = k for i in range(n): if flag == -1: if s[i] != "1": flag = i if flag == -1: print("1") else: print((s[flag]))
s = eval(input()) k = int(eval(input())) i = 0 while s[i] == "1": i += 1 if i > len(s) - 1: break if k <= len(s) and i >= k: print((1)) else: print((s[i]))
false
23.529412
[ "-flag = -1", "-n = len(s)", "-if n >= k:", "- n = k", "-for i in range(n):", "- if flag == -1:", "- if s[i] != \"1\":", "- flag = i", "-if flag == -1:", "- print(\"1\")", "+i = 0", "+while s[i] == \"1\":", "+ i += 1", "+ if i > len(s) - 1:", "+ br...
false
0.036527
0.078794
0.463573
[ "s828093556", "s875864622" ]
u777923818
p03043
python
s405476109
s445543604
174
58
38,640
5,128
Accepted
Accepted
66.67
from collections import defaultdict, deque, Counter def inpl(): return list(map(int, input().split())) N, K = inpl() ans = 0 X = 17 for i in range(1, N+1): while X and i * 2**(X-1) >= K: X -= 1 ans += .5 ** X print((ans/N))
def inpl(): return list(map(int, input().split())) N, K = inpl() X = [0] + [1/N if i <= N else 0 for i in range(1, K)] w = max(0, N-K+1)/N for i in range(K): if (i*2 >= K): w += X[i]/2 else: X[i*2] += X[i]/2 print(w)
13
11
252
251
from collections import defaultdict, deque, Counter def inpl(): return list(map(int, input().split())) N, K = inpl() ans = 0 X = 17 for i in range(1, N + 1): while X and i * 2 ** (X - 1) >= K: X -= 1 ans += 0.5**X print((ans / N))
def inpl(): return list(map(int, input().split())) N, K = inpl() X = [0] + [1 / N if i <= N else 0 for i in range(1, K)] w = max(0, N - K + 1) / N for i in range(K): if i * 2 >= K: w += X[i] / 2 else: X[i * 2] += X[i] / 2 print(w)
false
15.384615
[ "-from collections import defaultdict, deque, Counter", "-", "-", "-ans = 0", "-X = 17", "-for i in range(1, N + 1):", "- while X and i * 2 ** (X - 1) >= K:", "- X -= 1", "- ans += 0.5**X", "-print((ans / N))", "+X = [0] + [1 / N if i <= N else 0 for i in range(1, K)]", "+w = max(...
false
0.045618
0.03616
1.261563
[ "s405476109", "s445543604" ]
u729133443
p03308
python
s809796923
s732192004
188
17
38,256
2,940
Accepted
Accepted
90.96
eval(input());*a,=list(map(int,input().split()));print((max(a)-min(a)))
_,a=open(0);*a,=list(map(int,a.split()));print((max(a)-min(a)))
1
1
57
55
eval(input()) (*a,) = list(map(int, input().split())) print((max(a) - min(a)))
_, a = open(0) (*a,) = list(map(int, a.split())) print((max(a) - min(a)))
false
0
[ "-eval(input())", "-(*a,) = list(map(int, input().split()))", "+_, a = open(0)", "+(*a,) = list(map(int, a.split()))" ]
false
0.083354
0.045616
1.827302
[ "s809796923", "s732192004" ]
u343977188
p02820
python
s285003026
s225328890
57
38
4,084
4,084
Accepted
Accepted
33.33
N,K=list(map(int,input().split())) R,S,P=list(map(int,input().split())) T=list(eval(input())) score={'r':P,'s':R,'p':S} ans=0 for i in range(K): ans += score[T[i]] for i in range(K,N): if T[i-K] == T[i]: T[i] = '' continue ans += score[T[i]] print(ans)
def resolve(): N, K = list(map(int, input().split())) R, S, P = list(map(int, input().split())) T = list(eval(input())) score = {'r': P, 's': R, 'p': S} ans = 0 for i in range(K): ans += score[T[i]] for i in range(K, N): if T[i-K] == T[i]: T[i]...
17
21
268
423
N, K = list(map(int, input().split())) R, S, P = list(map(int, input().split())) T = list(eval(input())) score = {"r": P, "s": R, "p": S} ans = 0 for i in range(K): ans += score[T[i]] for i in range(K, N): if T[i - K] == T[i]: T[i] = "" continue ans += score[T[i]] print(ans)
def resolve(): N, K = list(map(int, input().split())) R, S, P = list(map(int, input().split())) T = list(eval(input())) score = {"r": P, "s": R, "p": S} ans = 0 for i in range(K): ans += score[T[i]] for i in range(K, N): if T[i - K] == T[i]: T[i] = " " ...
false
19.047619
[ "-N, K = list(map(int, input().split()))", "-R, S, P = list(map(int, input().split()))", "-T = list(eval(input()))", "-score = {\"r\": P, \"s\": R, \"p\": S}", "-ans = 0", "-for i in range(K):", "- ans += score[T[i]]", "-for i in range(K, N):", "- if T[i - K] == T[i]:", "- T[i] = \"\"...
false
0.008304
0.041905
0.198163
[ "s285003026", "s225328890" ]
u192154323
p03339
python
s330241451
s327224680
463
296
33,976
17,612
Accepted
Accepted
36.07
n = int(eval(input())) s = eval(input()) W_csum = [0] * n E_csum = [0] * n if s[0] == 'W': W_csum[0] = 1 else: E_csum[0] = 1 for i in range(1,n): if s[i] == 'W': W_csum[i] = W_csum[i-1] + 1 E_csum[i] = E_csum[i-1] else: W_csum[i] = W_csum[i-1] E_csum[i] = ...
n = int(eval(input())) s = eval(input()) W_csum = [0] * (n+1) E_csum = [0] * (n+1) for i in range(n): if s[i] == 'W': W_csum[i+1] = W_csum[i] + 1 E_csum[i+1] = E_csum[i] else: W_csum[i+1] = W_csum[i] E_csum[i+1] = E_csum[i] + 1 E_csum.append(E_csum[-1]) ans = flo...
54
22
1,065
473
n = int(eval(input())) s = eval(input()) W_csum = [0] * n E_csum = [0] * n if s[0] == "W": W_csum[0] = 1 else: E_csum[0] = 1 for i in range(1, n): if s[i] == "W": W_csum[i] = W_csum[i - 1] + 1 E_csum[i] = E_csum[i - 1] else: W_csum[i] = W_csum[i - 1] E_csum[i] = E_csum[i ...
n = int(eval(input())) s = eval(input()) W_csum = [0] * (n + 1) E_csum = [0] * (n + 1) for i in range(n): if s[i] == "W": W_csum[i + 1] = W_csum[i] + 1 E_csum[i + 1] = E_csum[i] else: W_csum[i + 1] = W_csum[i] E_csum[i + 1] = E_csum[i] + 1 E_csum.append(E_csum[-1]) ans = float("i...
false
59.259259
[ "-W_csum = [0] * n", "-E_csum = [0] * n", "-if s[0] == \"W\":", "- W_csum[0] = 1", "-else:", "- E_csum[0] = 1", "-for i in range(1, n):", "+W_csum = [0] * (n + 1)", "+E_csum = [0] * (n + 1)", "+for i in range(n):", "- W_csum[i] = W_csum[i - 1] + 1", "- E_csum[i] = E_csum[i ...
false
0.088691
0.045997
1.928214
[ "s330241451", "s327224680" ]
u054871430
p02695
python
s212189224
s438971869
288
170
119,560
84,592
Accepted
Accepted
40.97
import sys import copy from collections import deque def main(): N, M, Q = list(map(int, input().split())) ABCD = [[int(_) for _ in input().split()] for i in range(Q)] seq_list = make_sequence(N, M) max_score = 0 for i_seq in seq_list: score = 0 for a, b, c, d i...
import sys import itertools def main(): N, M, Q = list(map(int, input().split())) ABCD = [[int(_) for _ in input().split()] for i in range(Q)] value_range = list(range(1, M+1)) seq_list = list(itertools.combinations_with_replacement(value_range, N)) max_score = 0 for i_seq in seq_lis...
59
24
1,375
584
import sys import copy from collections import deque def main(): N, M, Q = list(map(int, input().split())) ABCD = [[int(_) for _ in input().split()] for i in range(Q)] seq_list = make_sequence(N, M) max_score = 0 for i_seq in seq_list: score = 0 for a, b, c, d in ABCD: ...
import sys import itertools def main(): N, M, Q = list(map(int, input().split())) ABCD = [[int(_) for _ in input().split()] for i in range(Q)] value_range = list(range(1, M + 1)) seq_list = list(itertools.combinations_with_replacement(value_range, N)) max_score = 0 for i_seq in seq_list: ...
false
59.322034
[ "-import copy", "-from collections import deque", "+import itertools", "- seq_list = make_sequence(N, M)", "+ value_range = list(range(1, M + 1))", "+ seq_list = list(itertools.combinations_with_replacement(value_range, N))", "-def make_sequence(N, M):", "- seq_list = []", "- sequence...
false
0.104642
0.062675
1.669588
[ "s212189224", "s438971869" ]
u780962115
p02754
python
s200681922
s704388392
20
17
2,940
2,940
Accepted
Accepted
15
n,a,b=list(map(int,input().split())) K=n//(a+b) J=n%(a+b) if J<=a: print((K*a+J)) else: print((K*a+a))
n,a,b=list(map(int,input().split())) print((a*(n//(a+b))+min(a,n%(a+b))))
7
3
106
69
n, a, b = list(map(int, input().split())) K = n // (a + b) J = n % (a + b) if J <= a: print((K * a + J)) else: print((K * a + a))
n, a, b = list(map(int, input().split())) print((a * (n // (a + b)) + min(a, n % (a + b))))
false
57.142857
[ "-K = n // (a + b)", "-J = n % (a + b)", "-if J <= a:", "- print((K * a + J))", "-else:", "- print((K * a + a))", "+print((a * (n // (a + b)) + min(a, n % (a + b))))" ]
false
0.042779
0.043429
0.985025
[ "s200681922", "s704388392" ]
u506858457
p02995
python
s247649334
s450671703
20
18
3,064
3,064
Accepted
Accepted
10
#@k0gane_p a, b, c, d = [int(i) for i in input().split()] def gcd(x,y):#最大公約数 while y: x,y = y, x%y return x def lcm(x,y):#最小公倍数 return x*y // gcd (x,y) def count(A,B,C):#A以下で、BでもCでも割り切れない個数 D=A//B E=A//C F=A // lcm(B,C) return A-D-E+F ans = count(b, c, d) - count(a, c,...
#@k0gane_p a, b, c, d = [int(i) for i in input().split()] def gcd(x,y):#最大公約数 while y: x,y = y, x%y return x def lcm(x,y):#最小公倍数 return x*y // gcd (x,y) def count(A,B,C):#A以下で、BでもCでも割り切れない個数 D=A//B E=A//C F=A // lcm(B,C) return A-D-E+F ans = count(b, c, d) - count(a-1, ...
18
18
435
439
# @k0gane_p a, b, c, d = [int(i) for i in input().split()] def gcd(x, y): # 最大公約数 while y: x, y = y, x % y return x def lcm(x, y): # 最小公倍数 return x * y // gcd(x, y) def count(A, B, C): # A以下で、BでもCでも割り切れない個数 D = A // B E = A // C F = A // lcm(B, C) return A - D - E + F ans ...
# @k0gane_p a, b, c, d = [int(i) for i in input().split()] def gcd(x, y): # 最大公約数 while y: x, y = y, x % y return x def lcm(x, y): # 最小公倍数 return x * y // gcd(x, y) def count(A, B, C): # A以下で、BでもCでも割り切れない個数 D = A // B E = A // C F = A // lcm(B, C) return A - D - E + F ans ...
false
0
[ "-ans = count(b, c, d) - count(a, c, d)", "+ans = count(b, c, d) - count(a - 1, c, d)", "-if a % c != 0 and a % d != 0:", "- ans += 1 # AがCでもDでも割り切れないなら、足す1", "+# if(a % c != 0 and a % d != 0):", "+# ans += 1#AがCでもDでも割り切れないなら、足す1" ]
false
0.044412
0.04604
0.964635
[ "s247649334", "s450671703" ]
u522945737
p02660
python
s432889189
s384458361
195
117
27,172
9,416
Accepted
Accepted
40
import numpy as np import math def fuctrization(n): arr = [] tmp = n for i in range(2,math.ceil(n**(1/2))+1): if tmp%i==0: j = 0 while tmp%i==0: j += 1 tmp //= i arr.append([i,j]) if tmp != 1: arr.append([...
import sys def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) ...
38
37
722
629
import numpy as np import math def fuctrization(n): arr = [] tmp = n for i in range(2, math.ceil(n ** (1 / 2)) + 1): if tmp % i == 0: j = 0 while tmp % i == 0: j += 1 tmp //= i arr.append([i, j]) if tmp != 1: arr.appen...
import sys def factorization(n): arr = [] temp = n for i in range(2, int(-(-(n**0.5) // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.append([i, cnt]) if temp != 1: arr.append([temp, ...
false
2.631579
[ "-import numpy as np", "-import math", "+import sys", "-def fuctrization(n):", "+def factorization(n):", "- tmp = n", "- for i in range(2, math.ceil(n ** (1 / 2)) + 1):", "- if tmp % i == 0:", "- j = 0", "- while tmp % i == 0:", "- j += 1", "- ...
false
0.145536
0.059329
2.453037
[ "s432889189", "s384458361" ]
u606146341
p02731
python
s308842186
s815389918
34
18
5,204
3,060
Accepted
Accepted
47.06
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN L =int(eval(input())) ans = Decimal((L/3)**3) print((float(round(ans, 10))))
L = float(eval(input())) ans = float((L/3)**3) print(ans)
7
5
137
57
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN L = int(eval(input())) ans = Decimal((L / 3) ** 3) print((float(round(ans, 10))))
L = float(eval(input())) ans = float((L / 3) ** 3) print(ans)
false
28.571429
[ "-from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN", "-", "-L = int(eval(input()))", "-ans = Decimal((L / 3) ** 3)", "-print((float(round(ans, 10))))", "+L = float(eval(input()))", "+ans = float((L / 3) ** 3)", "+print(ans)" ]
false
0.042723
0.083066
0.51433
[ "s308842186", "s815389918" ]
u503111914
p03523
python
s944096142
s001029482
31
26
8,968
9,076
Accepted
Accepted
16.13
S=eval(input()) pos={"AKIHABARA","KIHABARA","AKIHBARA","KIHBARA","AKIHABRA","KIHABRA","AKIHBRA","KIHBRA","AKIHABAR","KIHABAR","AKIHBAR","KIHBAR","AKIHABR","KIHABR","AKIHBR","KIHBR"} if S in pos: print("YES") else: print("NO")
S=eval(input()) A = ["AKIHABARA","KIHABARA","AKIHBARA","KIHBARA","AKIHABRA","KIHABRA","AKIHBRA","KIHBRA","AKIHABAR","KIHABAR","AKIHBAR","KIHBAR","AKIHABR","KIHABR","AKIHBR","KIHBR"] print(("YES" if A.count(S)>=1 else "NO"))
8
3
238
222
S = eval(input()) pos = { "AKIHABARA", "KIHABARA", "AKIHBARA", "KIHBARA", "AKIHABRA", "KIHABRA", "AKIHBRA", "KIHBRA", "AKIHABAR", "KIHABAR", "AKIHBAR", "KIHBAR", "AKIHABR", "KIHABR", "AKIHBR", "KIHBR", } if S in pos: print("YES") else: print("NO")
S = eval(input()) A = [ "AKIHABARA", "KIHABARA", "AKIHBARA", "KIHBARA", "AKIHABRA", "KIHABRA", "AKIHBRA", "KIHBRA", "AKIHABAR", "KIHABAR", "AKIHBAR", "KIHBAR", "AKIHABR", "KIHABR", "AKIHBR", "KIHBR", ] print(("YES" if A.count(S) >= 1 else "NO"))
false
62.5
[ "-pos = {", "+A = [", "-}", "-if S in pos:", "- print(\"YES\")", "-else:", "- print(\"NO\")", "+]", "+print((\"YES\" if A.count(S) >= 1 else \"NO\"))" ]
false
0.1404
0.048008
2.924536
[ "s944096142", "s001029482" ]
u729133443
p03401
python
s765540734
s199748541
388
175
67,288
13,800
Accepted
Accepted
54.9
n,*a=list(map(int,open(0).read().split())) a=[0]+a+[0] A=abs c=sum(A(j-i)for i,j in zip(a,a[1:])) for i,j,k in zip(a,a[1:],a[2:]):print((c-A(j-i)-A(k-j)+A(k-i)))
_,a=open(0) a=[0]+list(map(int,a.split()))+[0] A=abs c=sum(A(j-i)for i,j in zip(a,a[1:])) for i,j,k in zip(a,a[1:],a[2:]):print((c-A(j-i)-A(k-j)+A(k-i)))
5
5
157
155
n, *a = list(map(int, open(0).read().split())) a = [0] + a + [0] A = abs c = sum(A(j - i) for i, j in zip(a, a[1:])) for i, j, k in zip(a, a[1:], a[2:]): print((c - A(j - i) - A(k - j) + A(k - i)))
_, a = open(0) a = [0] + list(map(int, a.split())) + [0] A = abs c = sum(A(j - i) for i, j in zip(a, a[1:])) for i, j, k in zip(a, a[1:], a[2:]): print((c - A(j - i) - A(k - j) + A(k - i)))
false
0
[ "-n, *a = list(map(int, open(0).read().split()))", "-a = [0] + a + [0]", "+_, a = open(0)", "+a = [0] + list(map(int, a.split())) + [0]" ]
false
0.0852
0.108805
0.78305
[ "s765540734", "s199748541" ]
u400765446
p02384
python
s180044457
s048084139
40
20
8,192
5,592
Accepted
Accepted
50
class Dice: def __init__(self): # 初期値がない場合 # 上, 南、東、西、北、下にそれぞれ1, 2, 3, 4, 5, 6がくる想定 self.t = 1 self.s = 2 self.e = 3 self.w = 4 self.n = 5 self.b = 6 self.rotway = {"S": 0, "N": 1, "E": 2, "W": 3} def __init__(self, t, s, e, ...
rot_set = [ (1,2,4,3,1), #0 (0,3,5,2,0), #1 (0,1,5,4,0), #2 (0,4,5,1,0), #3 (0,2,5,3,0), #4 (1,3,4,2,1) #5 ] dice_int = list(map(int, input().split())) q = int(eval(input())) right_face = [] for _ in range(q): a, b = list(map(int, input().split())) a_idx = dice_int.inde...
55
25
1,576
562
class Dice: def __init__(self): # 初期値がない場合 # 上, 南、東、西、北、下にそれぞれ1, 2, 3, 4, 5, 6がくる想定 self.t = 1 self.s = 2 self.e = 3 self.w = 4 self.n = 5 self.b = 6 self.rotway = {"S": 0, "N": 1, "E": 2, "W": 3} def __init__(self, t, s, e, w, n, b): ...
rot_set = [ (1, 2, 4, 3, 1), # 0 (0, 3, 5, 2, 0), # 1 (0, 1, 5, 4, 0), # 2 (0, 4, 5, 1, 0), # 3 (0, 2, 5, 3, 0), # 4 (1, 3, 4, 2, 1), # 5 ] dice_int = list(map(int, input().split())) q = int(eval(input())) right_face = [] for _ in range(q): a, b = list(map(int, input().split())) a_...
false
54.545455
[ "-class Dice:", "- def __init__(self):", "- # 初期値がない場合", "- # 上, 南、東、西、北、下にそれぞれ1, 2, 3, 4, 5, 6がくる想定", "- self.t = 1", "- self.s = 2", "- self.e = 3", "- self.w = 4", "- self.n = 5", "- self.b = 6", "- self.rotway = {\"S\": 0, \"N...
false
0.049979
0.008478
5.89501
[ "s180044457", "s048084139" ]
u503263570
p00554
python
s366933068
s932765229
40
30
7,900
7,888
Accepted
Accepted
25
n,m=list(map(int,input().split())) p=[list(map(int,input().split()))for i in range(m)] c=[] for i in p: a,b=i if a>=n:o=0 else:o=n-a c.append(o) c.sort() c.pop() print((sum(c)))
n,m=list(map(int,input().split())) p=[list(map(int,input().split()))for i in range(m)] c=[n-a if n>a else 0for a,b in p] print((sum(c)-max(c)))
11
4
183
138
n, m = list(map(int, input().split())) p = [list(map(int, input().split())) for i in range(m)] c = [] for i in p: a, b = i if a >= n: o = 0 else: o = n - a c.append(o) c.sort() c.pop() print((sum(c)))
n, m = list(map(int, input().split())) p = [list(map(int, input().split())) for i in range(m)] c = [n - a if n > a else 0 for a, b in p] print((sum(c) - max(c)))
false
63.636364
[ "-c = []", "-for i in p:", "- a, b = i", "- if a >= n:", "- o = 0", "- else:", "- o = n - a", "- c.append(o)", "-c.sort()", "-c.pop()", "-print((sum(c)))", "+c = [n - a if n > a else 0 for a, b in p]", "+print((sum(c) - max(c)))" ]
false
0.048573
0.045711
1.062604
[ "s366933068", "s932765229" ]
u225388820
p03171
python
s378104162
s198621485
263
222
41,580
39,664
Accepted
Accepted
15.59
import sys input = sys.stdin.readline n=int(eval(input())) a=list(map(int,input().split())) dp=[0]*3000 for i in range(n): dp[i]=a[i] for i in range(1,n): for j in range(i-1,-1,-1): dp[j]=max(a[i]-dp[j],a[j]-dp[j+1]) print((dp[0]))
def solve(): import sys input = sys.stdin.readline n=int(eval(input())) a=list(map(int,input().split())) dp=a[:] for i in range(1,n): for j in range(i-1,-1,-1): dp[j]=max(a[i]-dp[j],a[j]-dp[j+1]) print((dp[0])) solve()
11
11
249
268
import sys input = sys.stdin.readline n = int(eval(input())) a = list(map(int, input().split())) dp = [0] * 3000 for i in range(n): dp[i] = a[i] for i in range(1, n): for j in range(i - 1, -1, -1): dp[j] = max(a[i] - dp[j], a[j] - dp[j + 1]) print((dp[0]))
def solve(): import sys input = sys.stdin.readline n = int(eval(input())) a = list(map(int, input().split())) dp = a[:] for i in range(1, n): for j in range(i - 1, -1, -1): dp[j] = max(a[i] - dp[j], a[j] - dp[j + 1]) print((dp[0])) solve()
false
0
[ "-import sys", "+def solve():", "+ import sys", "-input = sys.stdin.readline", "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-dp = [0] * 3000", "-for i in range(n):", "- dp[i] = a[i]", "-for i in range(1, n):", "- for j in range(i - 1, -1, -1):", "- dp[j] ...
false
0.052376
0.036213
1.446351
[ "s378104162", "s198621485" ]
u055875839
p02727
python
s310625720
s580093730
393
303
22,556
22,520
Accepted
Accepted
22.9
import heapq x, y, a, b, c = list(map(int, input().split())) def max_listup(limit): l = list([int(x)*-1 for x in input().split()]) heapq.heapify(l) cnt = 1 res = [] while l: if cnt > limit: break m = heapq.heappop(l) res.append(m*-1) cnt += 1 return res if __name__ ...
import heapq x, y, a, b, c = list(map(int, input().split())) def max_listup(limit): l = sorted(list(map(int, input().split()))) cnt = 1 res = [] while l: if cnt > limit: break m = l.pop() res.append(m) cnt += 1 return res if __name__ == "__main__": all = sorted(max_...
24
23
487
448
import heapq x, y, a, b, c = list(map(int, input().split())) def max_listup(limit): l = list([int(x) * -1 for x in input().split()]) heapq.heapify(l) cnt = 1 res = [] while l: if cnt > limit: break m = heapq.heappop(l) res.append(m * -1) cnt += 1 re...
import heapq x, y, a, b, c = list(map(int, input().split())) def max_listup(limit): l = sorted(list(map(int, input().split()))) cnt = 1 res = [] while l: if cnt > limit: break m = l.pop() res.append(m) cnt += 1 return res if __name__ == "__main__": ...
false
4.166667
[ "- l = list([int(x) * -1 for x in input().split()])", "- heapq.heapify(l)", "+ l = sorted(list(map(int, input().split())))", "- m = heapq.heappop(l)", "- res.append(m * -1)", "+ m = l.pop()", "+ res.append(m)" ]
false
0.044677
0.109705
0.40725
[ "s310625720", "s580093730" ]
u697696097
p02762
python
s745063048
s300573930
881
781
7,188
17,096
Accepted
Accepted
11.35
import sys #from io import StringIO #import unittest class UnionFind(): # 作りたい要素数nで初期化 # 使用するインスタンス変数の初期化 def __init__(self, n): self.n = n # root[x]<0ならそのノードが根かつその値が木の要素数 # rootノードでその木の要素数を記録する self.root = [-1]*(n+1) # 木をくっつける時にアンバランスにならないように調整する ...
import sys from io import StringIO import unittest class UnionFind(): # 作りたい要素数nで初期化 # 使用するインスタンス変数の初期化 def __init__(self, n): self.n = n # root[x]<0ならそのノードが根かつその値が木の要素数 # rootノードでその木の要素数を記録する self.root = [-1]*(n+1) # 木をくっつける時にアンバランスにならないように調整する ...
85
81
2,153
2,010
import sys # from io import StringIO # import unittest class UnionFind: # 作りたい要素数nで初期化 # 使用するインスタンス変数の初期化 def __init__(self, n): self.n = n # root[x]<0ならそのノードが根かつその値が木の要素数 # rootノードでその木の要素数を記録する self.root = [-1] * (n + 1) # 木をくっつける時にアンバランスにならないように調整する self.rn...
import sys from io import StringIO import unittest class UnionFind: # 作りたい要素数nで初期化 # 使用するインスタンス変数の初期化 def __init__(self, n): self.n = n # root[x]<0ならそのノードが根かつその値が木の要素数 # rootノードでその木の要素数を記録する self.root = [-1] * (n + 1) # 木をくっつける時にアンバランスにならないように調整する self.rnk =...
false
4.705882
[ "+from io import StringIO", "+import unittest", "-# from io import StringIO", "-# import unittest", "+", "- n, m, k = map(int, readline().strip().split())", "+ n, m, k = list(map(int, readline().strip().split()))", "- a, b = map(int1, readline().strip().split())", "+ a, b = list(...
false
0.035323
0.036196
0.975886
[ "s745063048", "s300573930" ]
u459150945
p02696
python
s879630724
s244745371
24
20
9,000
9,080
Accepted
Accepted
16.67
a, b, n = list(map(int, input().split())) ans = 0 if n < b: ans = max(ans, a*n//b) else: ans = max(ans, (a*n)//b)-a*(n//b) ans = max(ans, ((a*(b*(n//b)-1))//b)-a*(n//b - 1)) print(ans)
import math a, b, n = list(map(int, input().split())) ans = math.floor(a*min((b-1), n)/b) print(ans)
8
4
198
98
a, b, n = list(map(int, input().split())) ans = 0 if n < b: ans = max(ans, a * n // b) else: ans = max(ans, (a * n) // b) - a * (n // b) ans = max(ans, ((a * (b * (n // b) - 1)) // b) - a * (n // b - 1)) print(ans)
import math a, b, n = list(map(int, input().split())) ans = math.floor(a * min((b - 1), n) / b) print(ans)
false
50
[ "+import math", "+", "-ans = 0", "-if n < b:", "- ans = max(ans, a * n // b)", "-else:", "- ans = max(ans, (a * n) // b) - a * (n // b)", "- ans = max(ans, ((a * (b * (n // b) - 1)) // b) - a * (n // b - 1))", "+ans = math.floor(a * min((b - 1), n) / b)" ]
false
0.047896
0.048498
0.987604
[ "s879630724", "s244745371" ]
u367701763
p02793
python
s017254961
s324628200
673
232
74,632
78,756
Accepted
Accepted
65.53
import sys input = sys.stdin.readline import math big = 10 ** 9 + 7 N = int(eval(input())) A = list(map(int, input().split())) num = A[0] for i in range(1, N): num = num * A[i] // math.gcd(num, A[i]) res = 0 for a in A: res += num * pow(a, big-2, big) print((res % big))
from collections import Counter, defaultdict # 拡張ユークリッド互除法 # ax + by = gcd(a,b)の最小整数解を返す def egcd(a, b): if a == 0: return (b, 0, 1) else: g, y, x = egcd(b % a, a) return (g, x - (b // a) * y, y) # mを法とするaの乗法的逆元 def modinv(a, m): g, x, y = egcd(a, m) if g != 1: ...
17
66
291
1,231
import sys input = sys.stdin.readline import math big = 10**9 + 7 N = int(eval(input())) A = list(map(int, input().split())) num = A[0] for i in range(1, N): num = num * A[i] // math.gcd(num, A[i]) res = 0 for a in A: res += num * pow(a, big - 2, big) print((res % big))
from collections import Counter, defaultdict # 拡張ユークリッド互除法 # ax + by = gcd(a,b)の最小整数解を返す def egcd(a, b): if a == 0: return (b, 0, 1) else: g, y, x = egcd(b % a, a) return (g, x - (b // a) * y, y) # mを法とするaの乗法的逆元 def modinv(a, m): g, x, y = egcd(a, m) if g != 1: raise E...
false
74.242424
[ "-import sys", "+from collections import Counter, defaultdict", "-input = sys.stdin.readline", "-import math", "+# 拡張ユークリッド互除法", "+# ax + by = gcd(a,b)の最小整数解を返す", "+def egcd(a, b):", "+ if a == 0:", "+ return (b, 0, 1)", "+ else:", "+ g, y, x = egcd(b % a, a)", "+ re...
false
0.114895
0.046654
2.46268
[ "s017254961", "s324628200" ]
u869790980
p03266
python
s694170180
s648731154
380
58
107,204
70,428
Accepted
Accepted
84.74
import collections n,k = list(map(int, input().split(' '))) cc= collections.Counter() left = n % k for ii in range(k): cc[ii] += n / k if 0<ii <= left: cc[ii] += 1 r = 0 for ii in cc: if (- 2*ii) % k == 0: r += cc[ii] * ((cc[(k - ii) % k ]) ** 2) print(r)
import collections n,k = list(map(int, input().split(' '))) left = n % k cc = [0] * k for ii in range(k): cc[ii] += n / k if 0<ii <= left: cc[ii] += 1 r = 0 for ii in range(len(cc)): if (- 2*ii) % k == 0: r += cc[ii] * ((cc[(k - ii) % k ]) ** 2) print(r)
18
18
284
282
import collections n, k = list(map(int, input().split(" "))) cc = collections.Counter() left = n % k for ii in range(k): cc[ii] += n / k if 0 < ii <= left: cc[ii] += 1 r = 0 for ii in cc: if (-2 * ii) % k == 0: r += cc[ii] * ((cc[(k - ii) % k]) ** 2) print(r)
import collections n, k = list(map(int, input().split(" "))) left = n % k cc = [0] * k for ii in range(k): cc[ii] += n / k if 0 < ii <= left: cc[ii] += 1 r = 0 for ii in range(len(cc)): if (-2 * ii) % k == 0: r += cc[ii] * ((cc[(k - ii) % k]) ** 2) print(r)
false
0
[ "-cc = collections.Counter()", "+cc = [0] * k", "-for ii in cc:", "+for ii in range(len(cc)):" ]
false
0.063198
0.038528
1.640294
[ "s694170180", "s648731154" ]
u843175622
p03584
python
s399607776
s128125848
788
422
22,452
23,488
Accepted
Accepted
46.45
n, k = list(map(int, input().split())) ab = [tuple(map(int, input().split())) for _ in range(n)] # そのままの k ans = 0 for a, b in ab: if k & a == a: ans += b for i in range(31): # 上からi桁目までいっち、あとは1111 if k >> i & 1 == 0: continue nk = k nk &= ~(1 << i) for j in range...
n, k = list(map(int, input().split())) ab = [tuple(map(int, input().split())) for _ in range(n)] ans = sum([b for a, b in ab if k & a == a]) for i in range(30): if k >> i & 1: nk = 1 << i ^ k for j in range(i): nk |= 1 << j ans = max(ans, sum([b for a, b in ab if nk &...
25
12
500
337
n, k = list(map(int, input().split())) ab = [tuple(map(int, input().split())) for _ in range(n)] # そのままの k ans = 0 for a, b in ab: if k & a == a: ans += b for i in range(31): # 上からi桁目までいっち、あとは1111 if k >> i & 1 == 0: continue nk = k nk &= ~(1 << i) for j in range(i - 1, -1, -1): ...
n, k = list(map(int, input().split())) ab = [tuple(map(int, input().split())) for _ in range(n)] ans = sum([b for a, b in ab if k & a == a]) for i in range(30): if k >> i & 1: nk = 1 << i ^ k for j in range(i): nk |= 1 << j ans = max(ans, sum([b for a, b in ab if nk & a == a])) p...
false
52
[ "-# そのままの k", "-ans = 0", "-for a, b in ab:", "- if k & a == a:", "- ans += b", "-for i in range(31):", "- # 上からi桁目までいっち、あとは1111", "- if k >> i & 1 == 0:", "- continue", "- nk = k", "- nk &= ~(1 << i)", "- for j in range(i - 1, -1, -1):", "- nk |= 1 << ...
false
0.038435
0.038982
0.985964
[ "s399607776", "s128125848" ]
u644907318
p03438
python
s261584236
s939716078
97
77
68,384
73,920
Accepted
Accepted
20.62
N = int(eval(input())) A = list(map(int,input().split())) B = list(map(int,input().split())) sa = sum(A) sb = sum(B) if sa>sb: print("No") else: d1 = 0 d2 = 0 for i in range(N): if A[i]>B[i]: d1 += A[i]-B[i] elif B[i]>A[i]: d2 += (B[i]-A[i])//2 ...
N = int(eval(input())) A = list(map(int,input().split())) B = list(map(int,input().split())) cp = 0 cm = 0 for i in range(N): if A[i]>B[i]: cm += A[i]-B[i] elif B[i]>A[i]: cp += (B[i]-A[i])//2 if cp>=cm: print("Yes") else: print("No")
19
14
378
273
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) sa = sum(A) sb = sum(B) if sa > sb: print("No") else: d1 = 0 d2 = 0 for i in range(N): if A[i] > B[i]: d1 += A[i] - B[i] elif B[i] > A[i]: d2 += (B[i] - A[i]) // 2 i...
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) cp = 0 cm = 0 for i in range(N): if A[i] > B[i]: cm += A[i] - B[i] elif B[i] > A[i]: cp += (B[i] - A[i]) // 2 if cp >= cm: print("Yes") else: print("No")
false
26.315789
[ "-sa = sum(A)", "-sb = sum(B)", "-if sa > sb:", "+cp = 0", "+cm = 0", "+for i in range(N):", "+ if A[i] > B[i]:", "+ cm += A[i] - B[i]", "+ elif B[i] > A[i]:", "+ cp += (B[i] - A[i]) // 2", "+if cp >= cm:", "+ print(\"Yes\")", "+else:", "-else:", "- d1 = 0", "...
false
0.0359
0.037732
0.951447
[ "s261584236", "s939716078" ]
u623819879
p03805
python
s469161712
s312443110
276
199
49,880
40,688
Accepted
Accepted
27.9
n,m=list(map(int,input().split())) l=list(range(2,n+1)) v=[[] for i in range(1+n)] for i in range(m): a,b=list(map(int,input().split())) v[a].append(b) v[b].append(a) def check(ls): fr=1 for to in ls: if int(to) not in v[fr]: return 0 fr=int(to) return ...
from heapq import heappush, heappop from collections import deque,defaultdict,Counter import itertools from itertools import permutations,combinations import sys import bisect import string #import math #import time #import random def I(): return int(input()) def MI(): return map(int,input().split(...
22
63
483
1,324
n, m = list(map(int, input().split())) l = list(range(2, n + 1)) v = [[] for i in range(1 + n)] for i in range(m): a, b = list(map(int, input().split())) v[a].append(b) v[b].append(a) def check(ls): fr = 1 for to in ls: if int(to) not in v[fr]: return 0 fr = int(to) ...
from heapq import heappush, heappop from collections import deque, defaultdict, Counter import itertools from itertools import permutations, combinations import sys import bisect import string # import math # import time # import random def I(): return int(input()) def MI(): return map(int, input().split()) ...
false
65.079365
[ "-n, m = list(map(int, input().split()))", "-l = list(range(2, n + 1))", "-v = [[] for i in range(1 + n)]", "-for i in range(m):", "- a, b = list(map(int, input().split()))", "- v[a].append(b)", "- v[b].append(a)", "+from heapq import heappush, heappop", "+from collections import deque, def...
false
0.068952
0.044224
1.559146
[ "s469161712", "s312443110" ]
u324314500
p03077
python
s823042672
s290063317
19
17
3,064
3,064
Accepted
Accepted
10.53
def ii2ss(n): ss = [] for i in range(n): ss.append(eval(input())) return ss def sp2nn(sp, sep=' '): return [int(s) for s in sp.split(sep)] def ss2nn(ss): return [int(s) for s in list(ss)] import math def main(ss): N, A, B, C, D, E = ss2nn(ss) m = min(A, B, C, D, E) ...
# AtCoder Beginner Contest 123 # https://atcoder.jp/contests/abc123 import sys s2nn = lambda s: [int(c) for c in s.split(' ')] ss2nn = lambda ss: [int(s) for s in list(ss)] ss2nnn = lambda ss: [s2nn(s) for s in list(ss)] i2s = lambda: sys.stdin.readline().rstrip() i2n = lambda: int(i2s()) i2nn = lambda: s2nn(...
20
23
380
602
def ii2ss(n): ss = [] for i in range(n): ss.append(eval(input())) return ss def sp2nn(sp, sep=" "): return [int(s) for s in sp.split(sep)] def ss2nn(ss): return [int(s) for s in list(ss)] import math def main(ss): N, A, B, C, D, E = ss2nn(ss) m = min(A, B, C, D, E) return...
# AtCoder Beginner Contest 123 # https://atcoder.jp/contests/abc123 import sys s2nn = lambda s: [int(c) for c in s.split(" ")] ss2nn = lambda ss: [int(s) for s in list(ss)] ss2nnn = lambda ss: [s2nn(s) for s in list(ss)] i2s = lambda: sys.stdin.readline().rstrip() i2n = lambda: int(i2s()) i2nn = lambda: s2nn(i2s()) ii...
false
13.043478
[ "-def ii2ss(n):", "- ss = []", "- for i in range(n):", "- ss.append(eval(input()))", "- return ss", "+# AtCoder Beginner Contest 123", "+# https://atcoder.jp/contests/abc123", "+import sys", "-", "-def sp2nn(sp, sep=\" \"):", "- return [int(s) for s in sp.split(sep)]", "-", ...
false
0.042528
0.044386
0.958144
[ "s823042672", "s290063317" ]
u453815934
p04001
python
s177436849
s109293640
23
20
3,064
3,064
Accepted
Accepted
13.04
s=eval(input()) n=len(s)-1 sum=0 List=[s[0]] for i in range(2**n): for j in range(n): if (i>>j)&1: List+=["+"]+[s[j+1]] else: List+=[s[j+1]] m=0 for h in List: if h=="+": sum+=m m=0 else: m*=10 ...
S=eval(input()) n=len(S) ans=0 for i in range(2**(n-1)): s=0 c=int(S[0]) for j in range(n-1): if (i>>j) & 1: s+=c c=int(S[j+1]) else: c*=10 c+=int(S[j+1]) ans+=s+c print(ans)
22
15
384
222
s = eval(input()) n = len(s) - 1 sum = 0 List = [s[0]] for i in range(2**n): for j in range(n): if (i >> j) & 1: List += ["+"] + [s[j + 1]] else: List += [s[j + 1]] m = 0 for h in List: if h == "+": sum += m m = 0 else: ...
S = eval(input()) n = len(S) ans = 0 for i in range(2 ** (n - 1)): s = 0 c = int(S[0]) for j in range(n - 1): if (i >> j) & 1: s += c c = int(S[j + 1]) else: c *= 10 c += int(S[j + 1]) ans += s + c print(ans)
false
31.818182
[ "-s = eval(input())", "-n = len(s) - 1", "-sum = 0", "-List = [s[0]]", "-for i in range(2**n):", "- for j in range(n):", "+S = eval(input())", "+n = len(S)", "+ans = 0", "+for i in range(2 ** (n - 1)):", "+ s = 0", "+ c = int(S[0])", "+ for j in range(n - 1):", "- Li...
false
0.039016
0.039443
0.98917
[ "s177436849", "s109293640" ]
u604774382
p02399
python
s342775743
s994637126
30
20
6,740
4,208
Accepted
Accepted
33.33
import sys a, b = [ int( val ) for val in sys.stdin.readline().split( ' ' ) ] print(( "{:d} {:d} {:7f}".format( a//b, a%b, a/b ) ))
import sys a, b = [ int( val ) for val in sys.stdin.readline().split( ' ' ) ] print(( "{:d} {:d} {:7f}".format( a//b, a%b, float(a)/float(b) ) ))
4
4
133
148
import sys a, b = [int(val) for val in sys.stdin.readline().split(" ")] print(("{:d} {:d} {:7f}".format(a // b, a % b, a / b)))
import sys a, b = [int(val) for val in sys.stdin.readline().split(" ")] print(("{:d} {:d} {:7f}".format(a // b, a % b, float(a) / float(b))))
false
0
[ "-print((\"{:d} {:d} {:7f}\".format(a // b, a % b, a / b)))", "+print((\"{:d} {:d} {:7f}\".format(a // b, a % b, float(a) / float(b))))" ]
false
0.03958
0.038953
1.016111
[ "s342775743", "s994637126" ]
u524513264
p02576
python
s789830607
s237676411
32
28
9,164
9,092
Accepted
Accepted
12.5
li = list(map(int, input().split())) if li[0] % li[1] == 0: t = li[2] * (li[0] / li[1]) else: t = li[2] * (int(li[0] / li[1]) +1) print((int(t)))
n, x, t = list(map(int, input().split())) time = (n // x) * t if n % x != 0: time += t print(time)
6
7
157
105
li = list(map(int, input().split())) if li[0] % li[1] == 0: t = li[2] * (li[0] / li[1]) else: t = li[2] * (int(li[0] / li[1]) + 1) print((int(t)))
n, x, t = list(map(int, input().split())) time = (n // x) * t if n % x != 0: time += t print(time)
false
14.285714
[ "-li = list(map(int, input().split()))", "-if li[0] % li[1] == 0:", "- t = li[2] * (li[0] / li[1])", "-else:", "- t = li[2] * (int(li[0] / li[1]) + 1)", "-print((int(t)))", "+n, x, t = list(map(int, input().split()))", "+time = (n // x) * t", "+if n % x != 0:", "+ time += t", "+print(ti...
false
0.043103
0.039808
1.082784
[ "s789830607", "s237676411" ]
u150984829
p02397
python
s855881467
s781749265
40
30
5,980
5,876
Accepted
Accepted
25
a=[] while 1: n=eval(input()) if n=='0 0':break a.append(n) for s in a: print((*sorted(map(int,s.split()))))
a=[] while 1: n=input() if n=='0 0':break a.append(n) for s in a: x,y=map(int,s.split()) print(f'{y} {x}') if x>y else print(s)
7
8
110
139
a = [] while 1: n = eval(input()) if n == "0 0": break a.append(n) for s in a: print((*sorted(map(int, s.split()))))
a = [] while 1: n = input() if n == "0 0": break a.append(n) for s in a: x, y = map(int, s.split()) print(f"{y} {x}") if x > y else print(s)
false
12.5
[ "- n = eval(input())", "+ n = input()", "- print((*sorted(map(int, s.split()))))", "+ x, y = map(int, s.split())", "+ print(f\"{y} {x}\") if x > y else print(s)" ]
false
0.038034
0.043685
0.870627
[ "s855881467", "s781749265" ]
u647999897
p02720
python
s320165710
s180814626
196
93
12,716
11,944
Accepted
Accepted
52.55
def solve(): K = int(eval(input())) cnt = 0 n_digit = 1 numbers = [] while cnt < K: numbers = [] dfs("", numbers, n_digit) cnt += len(numbers) n_digit += 1 print((numbers[-(cnt - K + 1)])) def dfs(now, numbers, n_digit): if len(now) == ...
from collections import deque def solve(): K = int(eval(input())) q = deque(list(range(1,10))) cnt = 0 tmp = 0 while cnt < K: tmp = q.popleft() cnt += 1 ones_place = tmp % 10 if ones_place != 0: q.append(tmp*10+ones_place-1) q.appen...
33
22
783
479
def solve(): K = int(eval(input())) cnt = 0 n_digit = 1 numbers = [] while cnt < K: numbers = [] dfs("", numbers, n_digit) cnt += len(numbers) n_digit += 1 print((numbers[-(cnt - K + 1)])) def dfs(now, numbers, n_digit): if len(now) == n_digit: numbe...
from collections import deque def solve(): K = int(eval(input())) q = deque(list(range(1, 10))) cnt = 0 tmp = 0 while cnt < K: tmp = q.popleft() cnt += 1 ones_place = tmp % 10 if ones_place != 0: q.append(tmp * 10 + ones_place - 1) q.append(tmp *...
false
33.333333
[ "+from collections import deque", "+", "+", "+ q = deque(list(range(1, 10)))", "- n_digit = 1", "- numbers = []", "+ tmp = 0", "- numbers = []", "- dfs(\"\", numbers, n_digit)", "- cnt += len(numbers)", "- n_digit += 1", "- print((numbers[-(cnt - K + ...
false
0.073713
0.0582
1.266543
[ "s320165710", "s180814626" ]
u836737505
p03761
python
s503676194
s482083828
24
18
3,064
3,060
Accepted
Accepted
25
n = int(eval(input())) a = list(eval(input()) for _ in range(n)) # n = 3 # a = ["cbaa","daacc","acacac"] s = "" for c in a[0]: f = [] for i in range(n-1): if c not in a[i+1]: break for d in range(len(a[i+1])): if c == a[i+1][d]: f.append(d) ...
def intersect_list(lst1, lst2): arr = [] lst = lst1.copy() for element in lst2: try: lst.remove(element) except ValueError: pass else: arr.append(element) return arr n = int(eval(input())) a0 = list(eval(input())) for i in range(...
21
19
492
399
n = int(eval(input())) a = list(eval(input()) for _ in range(n)) # n = 3 # a = ["cbaa","daacc","acacac"] s = "" for c in a[0]: f = [] for i in range(n - 1): if c not in a[i + 1]: break for d in range(len(a[i + 1])): if c == a[i + 1][d]: f.append(d) ...
def intersect_list(lst1, lst2): arr = [] lst = lst1.copy() for element in lst2: try: lst.remove(element) except ValueError: pass else: arr.append(element) return arr n = int(eval(input())) a0 = list(eval(input())) for i in range(n - 1): a...
false
9.52381
[ "+def intersect_list(lst1, lst2):", "+ arr = []", "+ lst = lst1.copy()", "+ for element in lst2:", "+ try:", "+ lst.remove(element)", "+ except ValueError:", "+ pass", "+ else:", "+ arr.append(element)", "+ return arr", "+", "...
false
0.044322
0.04449
0.996228
[ "s503676194", "s482083828" ]
u190405389
p03310
python
s858682831
s202635268
946
635
126,044
108,920
Accepted
Accepted
32.88
from itertools import accumulate import bisect n = int(eval(input())) a = list(map(int, input().split())) arev = list(reversed(a)) front = list(accumulate(a)) back = list(accumulate(arev)) ans = float('inf') for i in range(1,n-2): b = bisect.bisect_left(front,front[i]//2,0,i-1) c = bisect.bi...
# 解説の方法 from itertools import accumulate n = int(eval(input())) a = list(map(int, input().split())) acc = list(accumulate(a)) l = 0 r = 2 ans = float('inf') for y in range(1,n-2): for x in range(l,y-1): if abs(acc[y]-acc[x]*2)>=abs(acc[y]-acc[x+1]*2): l = x+1 ...
52
35
1,103
712
from itertools import accumulate import bisect n = int(eval(input())) a = list(map(int, input().split())) arev = list(reversed(a)) front = list(accumulate(a)) back = list(accumulate(arev)) ans = float("inf") for i in range(1, n - 2): b = bisect.bisect_left(front, front[i] // 2, 0, i - 1) c = bisect.bisect_left...
# 解説の方法 from itertools import accumulate n = int(eval(input())) a = list(map(int, input().split())) acc = list(accumulate(a)) l = 0 r = 2 ans = float("inf") for y in range(1, n - 2): for x in range(l, y - 1): if abs(acc[y] - acc[x] * 2) >= abs(acc[y] - acc[x + 1] * 2): l = x + 1 con...
false
32.692308
[ "+# 解説の方法", "-import bisect", "-arev = list(reversed(a))", "-front = list(accumulate(a))", "-back = list(accumulate(arev))", "+acc = list(accumulate(a))", "+l = 0", "+r = 2", "-for i in range(1, n - 2):", "- b = bisect.bisect_left(front, front[i] // 2, 0, i - 1)", "- c = bisect.bisect_left...
false
0.042889
0.039243
1.092903
[ "s858682831", "s202635268" ]
u952708174
p03361
python
s155967147
s448570661
22
20
3,064
3,064
Accepted
Accepted
9.09
def c_grid_repainting(H, W, Grid): is_visited = [[False] * W for h in range(H)] delta = [(-1, 0), (1, 0), (0, -1), (0, 1)] # 上下左右 def bfs(r, c): if Grid[r][c] == '.': return if is_visited[r][c]: return q = [(r, c)] while q: h, ...
def c_grid_repainting(H, W, Grid): delta = [(-1, 0), (1, 0), (0, -1), (0, 1)] for h in range(H): for w in range(W): if Grid[h][w] == '.': # 白マスは無視 continue black = 0 # マス(h,w)に隣り合った黒マスの数 for dh, dw in delta: is_internal = 0 <=...
30
20
1,000
737
def c_grid_repainting(H, W, Grid): is_visited = [[False] * W for h in range(H)] delta = [(-1, 0), (1, 0), (0, -1), (0, 1)] # 上下左右 def bfs(r, c): if Grid[r][c] == ".": return if is_visited[r][c]: return q = [(r, c)] while q: h, w = q.pop()...
def c_grid_repainting(H, W, Grid): delta = [(-1, 0), (1, 0), (0, -1), (0, 1)] for h in range(H): for w in range(W): if Grid[h][w] == ".": # 白マスは無視 continue black = 0 # マス(h,w)に隣り合った黒マスの数 for dh, dw in delta: is_internal = 0 <= h + dh ...
false
33.333333
[ "- is_visited = [[False] * W for h in range(H)]", "- delta = [(-1, 0), (1, 0), (0, -1), (0, 1)] # 上下左右", "-", "- def bfs(r, c):", "- if Grid[r][c] == \".\":", "- return", "- if is_visited[r][c]:", "- return", "- q = [(r, c)]", "- while q:...
false
0.046465
0.045916
1.011961
[ "s155967147", "s448570661" ]
u716530146
p02749
python
s555569369
s969345693
1,110
952
173,728
173,728
Accepted
Accepted
14.23
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 sys.setrecursionlimit(10**7) n = int(eval(input())) G = [[] for i in range(n)] for _ in range(n...
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 sys.setrecursionlimit(10**7) n = int(eval(input())) G = [[] for i in range(n)] for _ in range(n...
81
79
1,748
1,691
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") inf = float("inf") mod = 10**9 + 7 mans = inf ans = 0 count = 0 pro = 1 sys.setrecursionlimit(10**7) n = int(eval(input())) G = [[] for i in range(n)] for _ in range(n - 1): ...
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") inf = float("inf") mod = 10**9 + 7 mans = inf ans = 0 count = 0 pro = 1 sys.setrecursionlimit(10**7) n = int(eval(input())) G = [[] for i in range(n)] for _ in range(n - 1): ...
false
2.469136
[ "-# この時点ではA>=Bである", "-# if len(color[0]) < len(color[1]):", "-# A,B = B,A", "+# A>=Bである", "-if len(color[0]) > C and len(color[1]) > C:", "+if len(color[0]) >= A and len(color[1]) >= B:", "-elif len(color[0]) <= C:", "+elif len(color[0]) < A:" ]
false
0.045025
0.149575
0.301022
[ "s555569369", "s969345693" ]
u853619096
p02420
python
s997106353
s682481985
30
20
7,576
7,640
Accepted
Accepted
33.33
while True: s=eval(input()) if s == '-': break m=int(eval(input())) for mi in range(m): h = int(eval(input())) s = s[h:] + s[:h] print(s)
while True: z = list(map(str, eval(input()))) if "-" in z: break n = int(eval(input())) for i in range(n): a=int(eval(input())) z=z[a:]+z[:a] print(("".join(z)))
12
10
180
195
while True: s = eval(input()) if s == "-": break m = int(eval(input())) for mi in range(m): h = int(eval(input())) s = s[h:] + s[:h] print(s)
while True: z = list(map(str, eval(input()))) if "-" in z: break n = int(eval(input())) for i in range(n): a = int(eval(input())) z = z[a:] + z[:a] print(("".join(z)))
false
16.666667
[ "- s = eval(input())", "- if s == \"-\":", "+ z = list(map(str, eval(input())))", "+ if \"-\" in z:", "- m = int(eval(input()))", "- for mi in range(m):", "- h = int(eval(input()))", "- s = s[h:] + s[:h]", "- print(s)", "+ n = int(eval(input()))", "+ for ...
false
0.068156
0.066968
1.017733
[ "s997106353", "s682481985" ]
u017810624
p02762
python
s948115867
s886729501
1,971
1,390
124,092
125,872
Accepted
Accepted
29.48
n,m,k=list(map(int,input().split())) class UF(): def __init__(self, N): self._parent=[n for n in range(0, N)] self._size=[1] * N def find_root(self, x): if self._parent[x]==x:return x self._parent[x]=self.find_root(self._parent[x]) return self._parent[x] def unite(self, x, y): ...
import sys input=sys.stdin.readline n,m,k=list(map(int,input().split())) class UF(): def __init__(self, N): self._parent=[n for n in range(0, N)] self._size=[1] * N def find_root(self, x): if self._parent[x]==x:return x self._parent[x]=self.find_root(self._parent[x]) return self._p...
64
66
1,386
1,424
n, m, k = list(map(int, input().split())) class UF: def __init__(self, N): self._parent = [n for n in range(0, N)] self._size = [1] * N def find_root(self, x): if self._parent[x] == x: return x self._parent[x] = self.find_root(self._parent[x]) return self._...
import sys input = sys.stdin.readline n, m, k = list(map(int, input().split())) class UF: def __init__(self, N): self._parent = [n for n in range(0, N)] self._size = [1] * N def find_root(self, x): if self._parent[x] == x: return x self._parent[x] = self.find_root...
false
3.030303
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.03646
0.042096
0.866128
[ "s948115867", "s886729501" ]
u310431893
p03200
python
s471364304
s572627371
57
46
3,624
3,500
Accepted
Accepted
19.3
S = eval(input()) S.lstrip("W") def f(s): count = 1 for i, si in enumerate(s): if si == 'W': yield (i+1) - count count += 1 print((sum(f(S))))
c = 0 s = 0 for i in eval(input()): if i == "W": s += c else: c += 1 print(s)
11
8
187
102
S = eval(input()) S.lstrip("W") def f(s): count = 1 for i, si in enumerate(s): if si == "W": yield (i + 1) - count count += 1 print((sum(f(S))))
c = 0 s = 0 for i in eval(input()): if i == "W": s += c else: c += 1 print(s)
false
27.272727
[ "-S = eval(input())", "-S.lstrip(\"W\")", "-", "-", "-def f(s):", "- count = 1", "- for i, si in enumerate(s):", "- if si == \"W\":", "- yield (i + 1) - count", "- count += 1", "-", "-", "-print((sum(f(S))))", "+c = 0", "+s = 0", "+for i in eval(input...
false
0.039345
0.038887
1.01177
[ "s471364304", "s572627371" ]
u631277801
p03112
python
s728974090
s873410979
863
715
16,160
17,948
Accepted
Accepted
17.15
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.re...
import sys stdin = sys.stdin sys.setrecursionlimit(10 ** 7) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.r...
58
41
1,632
1,280
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): ...
import sys stdin = sys.stdin sys.setrecursionlimit(10**7) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): ...
false
29.310345
[ "-sys.setrecursionlimit(10**5)", "+sys.setrecursionlimit(10**7)", "-from bisect import bisect_right", "+from bisect import bisect_left", "+", "+", "+def find_left_right(lis: list, pos: int):", "+ left_idx = bisect_left(lis, pos) - 1", "+ left = lis[left_idx]", "+ right = lis[left_idx + 1]...
false
0.037066
0.084682
0.437706
[ "s728974090", "s873410979" ]
u612975321
p03588
python
s031745366
s242960000
264
164
29,144
29,448
Accepted
Accepted
37.88
n = int(eval(input())) ab = [list(map(int, input().split())) for i in range(n)] ab = sorted(ab, key=lambda x:x[0]) print((ab[-1][0] + ab[-1][1]))
import sys input = sys.stdin.buffer.readline n = int(eval(input())) ab = [list(map(int, input().split())) for i in range(n)] ab = sorted(ab, key=lambda x:x[0]) print((ab[-1][0] + ab[-1][1]))
4
7
140
189
n = int(eval(input())) ab = [list(map(int, input().split())) for i in range(n)] ab = sorted(ab, key=lambda x: x[0]) print((ab[-1][0] + ab[-1][1]))
import sys input = sys.stdin.buffer.readline n = int(eval(input())) ab = [list(map(int, input().split())) for i in range(n)] ab = sorted(ab, key=lambda x: x[0]) print((ab[-1][0] + ab[-1][1]))
false
42.857143
[ "+import sys", "+", "+input = sys.stdin.buffer.readline" ]
false
0.041822
0.04116
1.016098
[ "s031745366", "s242960000" ]
u077291787
p03733
python
s512500468
s550678574
133
107
26,832
26,836
Accepted
Accepted
19.55
#ARC073C - Sentou n, t = list(map(int, input().rstrip().split())) lst = list(map(int, input().rstrip().split())) ans, cur = 0, lst[0] for i in lst[1:]: ans += min(t, i - cur) cur = i ans += t print(ans)
# ARC073C - Sentou (ABC060C) def main(): n, t = list(map(int, input().rstrip().split())) lst = list(map(int, input().rstrip().split())) ans, cur = 0, lst[0] for i in lst[1:]: ans += min(t, i - cur) cur = i ans += t print(ans) if __name__ == "__main__": main()
9
14
218
318
# ARC073C - Sentou n, t = list(map(int, input().rstrip().split())) lst = list(map(int, input().rstrip().split())) ans, cur = 0, lst[0] for i in lst[1:]: ans += min(t, i - cur) cur = i ans += t print(ans)
# ARC073C - Sentou (ABC060C) def main(): n, t = list(map(int, input().rstrip().split())) lst = list(map(int, input().rstrip().split())) ans, cur = 0, lst[0] for i in lst[1:]: ans += min(t, i - cur) cur = i ans += t print(ans) if __name__ == "__main__": main()
false
35.714286
[ "-# ARC073C - Sentou", "-n, t = list(map(int, input().rstrip().split()))", "-lst = list(map(int, input().rstrip().split()))", "-ans, cur = 0, lst[0]", "-for i in lst[1:]:", "- ans += min(t, i - cur)", "- cur = i", "-ans += t", "-print(ans)", "+# ARC073C - Sentou (ABC060C)", "+def main():",...
false
0.042092
0.042228
0.99679
[ "s512500468", "s550678574" ]
u190875453
p02899
python
s472046347
s870508334
173
94
32,452
15,588
Accepted
Accepted
45.66
num = int(eval(input())) li = list(map(int, input().split())) number = list(range(num)) data = dict(list(zip(number, li))) data_sorted = sorted(list(data.items()), key = lambda x:x[1]) data_key = [str(i[0] + 1) for i in data_sorted] print((" ".join(data_key)))
x = int(eval(input())) num_list = list(map(int, input().split())) li = list("A" * x) for index, num in enumerate(num_list): li[num-1] = str(index+1) print((" ".join(li)))
8
9
248
174
num = int(eval(input())) li = list(map(int, input().split())) number = list(range(num)) data = dict(list(zip(number, li))) data_sorted = sorted(list(data.items()), key=lambda x: x[1]) data_key = [str(i[0] + 1) for i in data_sorted] print((" ".join(data_key)))
x = int(eval(input())) num_list = list(map(int, input().split())) li = list("A" * x) for index, num in enumerate(num_list): li[num - 1] = str(index + 1) print((" ".join(li)))
false
11.111111
[ "-num = int(eval(input()))", "-li = list(map(int, input().split()))", "-number = list(range(num))", "-data = dict(list(zip(number, li)))", "-data_sorted = sorted(list(data.items()), key=lambda x: x[1])", "-data_key = [str(i[0] + 1) for i in data_sorted]", "-print((\" \".join(data_key)))", "+x = int(ev...
false
0.041336
0.040478
1.021201
[ "s472046347", "s870508334" ]
u188827677
p02707
python
s833745068
s828175886
189
128
34,180
32,276
Accepted
Accepted
32.28
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) count = Counter(a) for i in range(n): if i+1 in count: print((count[i+1])) else: print((0))
n = int(input()) a = list(map(int, input().split())) l = [0]*n for i in a: l[i-1] += 1 print(*l, sep='\n')
10
6
194
112
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) count = Counter(a) for i in range(n): if i + 1 in count: print((count[i + 1])) else: print((0))
n = int(input()) a = list(map(int, input().split())) l = [0] * n for i in a: l[i - 1] += 1 print(*l, sep="\n")
false
40
[ "-from collections import Counter", "-", "-n = int(eval(input()))", "+n = int(input())", "-count = Counter(a)", "-for i in range(n):", "- if i + 1 in count:", "- print((count[i + 1]))", "- else:", "- print((0))", "+l = [0] * n", "+for i in a:", "+ l[i - 1] += 1", "+p...
false
0.03696
0.036379
1.015951
[ "s833745068", "s828175886" ]
u261103969
p02584
python
s835947203
s699373336
80
32
61,732
9,140
Accepted
Accepted
60
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): x, k, d = list(map(int, readline().split())) cur = abs(x) rem = k cnt = min(cur // d, k) cur -= cnt * d rem -= cnt if rem % 2 == 0: ans = cur ...
x, k, d = list(map(int, input().split())) cur = abs(x) # 座標を正にしてしまいます rem = k # 残りの移動回数です cnt = min(cur // d, k) # 0に向かって移動する回数です cur -= d * cnt rem -= cnt # 残り回数が0回の場合分けをする必要はないのですが、一応 if rem > 0: if rem % 2 == 1: cur = abs(cur - d) print(cur)
24
15
411
271
import sys readline = sys.stdin.readline MOD = 10**9 + 7 INF = float("INF") sys.setrecursionlimit(10**5) def main(): x, k, d = list(map(int, readline().split())) cur = abs(x) rem = k cnt = min(cur // d, k) cur -= cnt * d rem -= cnt if rem % 2 == 0: ans = cur else: ans ...
x, k, d = list(map(int, input().split())) cur = abs(x) # 座標を正にしてしまいます rem = k # 残りの移動回数です cnt = min(cur // d, k) # 0に向かって移動する回数です cur -= d * cnt rem -= cnt # 残り回数が0回の場合分けをする必要はないのですが、一応 if rem > 0: if rem % 2 == 1: cur = abs(cur - d) print(cur)
false
37.5
[ "-import sys", "-", "-readline = sys.stdin.readline", "-MOD = 10**9 + 7", "-INF = float(\"INF\")", "-sys.setrecursionlimit(10**5)", "-", "-", "-def main():", "- x, k, d = list(map(int, readline().split()))", "- cur = abs(x)", "- rem = k", "- cnt = min(cur // d, k)", "- cur -...
false
0.034272
0.031252
1.096634
[ "s835947203", "s699373336" ]
u941438707
p02900
python
s026858536
s298956947
483
402
5,176
3,060
Accepted
Accepted
16.77
a,b=list(map(int,input().split())) from fractions import * g=gcd(a,b) c=i=1 while g>1 and i*i<=g: i+=1 if g%i==0: c+=1 while g%i==0: g//=i print((c+(g>1)))
a,b=list(map(int,input().split())) c=1 for i in range(2,int(max(a**.5,b**.5))+2): if a%i==0==b%i: c+=1 while a%i==0: a//=i while b%i==0: b//=i if a==b!=1: c+=1 print(c)
11
12
185
213
a, b = list(map(int, input().split())) from fractions import * g = gcd(a, b) c = i = 1 while g > 1 and i * i <= g: i += 1 if g % i == 0: c += 1 while g % i == 0: g //= i print((c + (g > 1)))
a, b = list(map(int, input().split())) c = 1 for i in range(2, int(max(a**0.5, b**0.5)) + 2): if a % i == 0 == b % i: c += 1 while a % i == 0: a //= i while b % i == 0: b //= i if a == b != 1: c += 1 print(c)
false
8.333333
[ "-from fractions import *", "-", "-g = gcd(a, b)", "-c = i = 1", "-while g > 1 and i * i <= g:", "- i += 1", "- if g % i == 0:", "+c = 1", "+for i in range(2, int(max(a**0.5, b**0.5)) + 2):", "+ if a % i == 0 == b % i:", "- while g % i == 0:", "- g //= i", "-print((c + (g ...
false
0.043344
0.06185
0.700786
[ "s026858536", "s298956947" ]
u644907318
p02879
python
s311487066
s716437579
181
165
38,384
38,384
Accepted
Accepted
8.84
A,B = list(map(int,input().split())) if A>=10 or B>=10: print((-1)) else: print((A*B))
A,B = list(map(int,input().split())) if A<=9 and B<=9: print((A*B)) else: print((-1))
5
5
88
87
A, B = list(map(int, input().split())) if A >= 10 or B >= 10: print((-1)) else: print((A * B))
A, B = list(map(int, input().split())) if A <= 9 and B <= 9: print((A * B)) else: print((-1))
false
0
[ "-if A >= 10 or B >= 10:", "+if A <= 9 and B <= 9:", "+ print((A * B))", "+else:", "-else:", "- print((A * B))" ]
false
0.150574
0.068483
2.198699
[ "s311487066", "s716437579" ]
u089230684
p03814
python
s141337922
s143601040
58
43
3,516
3,516
Accepted
Accepted
25.86
s = eval(input()) ans = [] for i in range(len(s)): if s[i] == "A": j = i break for i in range(len(s)): if s[len(s)-i-1] == "Z": k = len(s)-i-1 break ans = k-j+1 print(ans)
string = eval(input()) index = -1 for i in range(len(string)): if string[i] == "Z": index = i w = string.index("A") z = string[w:index+1] print((len(z)))
12
8
216
175
s = eval(input()) ans = [] for i in range(len(s)): if s[i] == "A": j = i break for i in range(len(s)): if s[len(s) - i - 1] == "Z": k = len(s) - i - 1 break ans = k - j + 1 print(ans)
string = eval(input()) index = -1 for i in range(len(string)): if string[i] == "Z": index = i w = string.index("A") z = string[w : index + 1] print((len(z)))
false
33.333333
[ "-s = eval(input())", "-ans = []", "-for i in range(len(s)):", "- if s[i] == \"A\":", "- j = i", "- break", "-for i in range(len(s)):", "- if s[len(s) - i - 1] == \"Z\":", "- k = len(s) - i - 1", "- break", "-ans = k - j + 1", "-print(ans)", "+string = eval(...
false
0.036949
0.035952
1.027731
[ "s141337922", "s143601040" ]
u761320129
p03328
python
s882327790
s368737809
19
17
3,060
2,940
Accepted
Accepted
10.53
a,b = list(map(int,input().split())) d = b-a b_len = d*(d+1)//2 print((b_len - b))
a,b = list(map(int,input().split())) s = 0 for n in range(1000): if b-a == n: print((s-a)) break s += n
4
8
77
127
a, b = list(map(int, input().split())) d = b - a b_len = d * (d + 1) // 2 print((b_len - b))
a, b = list(map(int, input().split())) s = 0 for n in range(1000): if b - a == n: print((s - a)) break s += n
false
50
[ "-d = b - a", "-b_len = d * (d + 1) // 2", "-print((b_len - b))", "+s = 0", "+for n in range(1000):", "+ if b - a == n:", "+ print((s - a))", "+ break", "+ s += n" ]
false
0.042195
0.043574
0.968346
[ "s882327790", "s368737809" ]
u533039576
p02937
python
s889789719
s497319104
364
260
95,196
53,104
Accepted
Accepted
28.57
from collections import defaultdict s = eval(input()) t = eval(input()) ds = defaultdict(int) for i in range(len(s)): ds[s[i]] += 1 dt = defaultdict(int) for i in range(len(t)): dt[t[i]] += 1 possible = True for ti in dt: if ti not in ds: possible = False break if possi...
from collections import defaultdict from bisect import bisect_left, bisect_right s = eval(input()) t = eval(input()) n = len(s) ds = defaultdict(list) for i in range(n*2): ds[s[i%n]].append(i) ans = 0 x = -1 for i in range(len(t)): if t[i] not in ds: ans = -1 break x_next...
52
23
966
428
from collections import defaultdict s = eval(input()) t = eval(input()) ds = defaultdict(int) for i in range(len(s)): ds[s[i]] += 1 dt = defaultdict(int) for i in range(len(t)): dt[t[i]] += 1 possible = True for ti in dt: if ti not in ds: possible = False break if possible: n = len(s) ...
from collections import defaultdict from bisect import bisect_left, bisect_right s = eval(input()) t = eval(input()) n = len(s) ds = defaultdict(list) for i in range(n * 2): ds[s[i % n]].append(i) ans = 0 x = -1 for i in range(len(t)): if t[i] not in ds: ans = -1 break x_next = ds[t[i]][bis...
false
55.769231
[ "+from bisect import bisect_left, bisect_right", "-ds = defaultdict(int)", "-for i in range(len(s)):", "- ds[s[i]] += 1", "-dt = defaultdict(int)", "+n = len(s)", "+ds = defaultdict(list)", "+for i in range(n * 2):", "+ ds[s[i % n]].append(i)", "+ans = 0", "+x = -1", "- dt[t[i]] += 1"...
false
0.076375
0.041512
1.839836
[ "s889789719", "s497319104" ]
u500673386
p03109
python
s153061325
s988481510
48
27
10,304
9,024
Accepted
Accepted
43.75
import datetime as dt S=eval(input()) s=dt.datetime.strptime(S,'%Y/%m/%d') A='2019/04/30' a=dt.datetime.strptime(A,'%Y/%m/%d') if s<=a: print('Heisei') else: print('TBD')
S=eval(input()) if S<='2019/04/30': print('Heisei') else: print('TBD')
9
5
181
76
import datetime as dt S = eval(input()) s = dt.datetime.strptime(S, "%Y/%m/%d") A = "2019/04/30" a = dt.datetime.strptime(A, "%Y/%m/%d") if s <= a: print("Heisei") else: print("TBD")
S = eval(input()) if S <= "2019/04/30": print("Heisei") else: print("TBD")
false
44.444444
[ "-import datetime as dt", "-", "-s = dt.datetime.strptime(S, \"%Y/%m/%d\")", "-A = \"2019/04/30\"", "-a = dt.datetime.strptime(A, \"%Y/%m/%d\")", "-if s <= a:", "+if S <= \"2019/04/30\":" ]
false
0.039313
0.063065
0.623368
[ "s153061325", "s988481510" ]
u546853743
p03434
python
s231161144
s398549720
28
25
9,124
9,016
Accepted
Accepted
10.71
n=int(eval(input())) a=list(map(int,input().split())) s=0 a.sort() s=sum(a[:n:2])-sum(a[1:n:2]) if s>0: print(s) else: print((-s))
n=int(eval(input())) a=list(map(int,input().split())) s=0 a.sort() s=sum(a[:n:2])-sum(a[1:n:2]) print((abs(s)))
9
7
138
110
n = int(eval(input())) a = list(map(int, input().split())) s = 0 a.sort() s = sum(a[:n:2]) - sum(a[1:n:2]) if s > 0: print(s) else: print((-s))
n = int(eval(input())) a = list(map(int, input().split())) s = 0 a.sort() s = sum(a[:n:2]) - sum(a[1:n:2]) print((abs(s)))
false
22.222222
[ "-if s > 0:", "- print(s)", "-else:", "- print((-s))", "+print((abs(s)))" ]
false
0.055948
0.076489
0.731449
[ "s231161144", "s398549720" ]
u757117214
p02897
python
s258006166
s435416491
20
17
3,060
2,940
Accepted
Accepted
15
n = int(eval(input())) if n == 1: print((1)) elif n % 2 == 0: print((0.5)) else: print(((n+1)/2/n))
n = int(eval(input())) print((1 if n == 1 else 0.5 if n%2 == 0 else (n+1)/2/n))
8
2
109
72
n = int(eval(input())) if n == 1: print((1)) elif n % 2 == 0: print((0.5)) else: print(((n + 1) / 2 / n))
n = int(eval(input())) print((1 if n == 1 else 0.5 if n % 2 == 0 else (n + 1) / 2 / n))
false
75
[ "-if n == 1:", "- print((1))", "-elif n % 2 == 0:", "- print((0.5))", "-else:", "- print(((n + 1) / 2 / n))", "+print((1 if n == 1 else 0.5 if n % 2 == 0 else (n + 1) / 2 / n))" ]
false
0.038012
0.03905
0.973424
[ "s258006166", "s435416491" ]
u604839890
p02641
python
s792516073
s704802349
82
65
64,704
64,984
Accepted
Accepted
20.73
x,n=list(map(int,input().split())) if n!=0: #空行の読み込みを回避、処理を高速化するためにpiを集合型で管理する s=set(list(map(int,input().split()))) else: s=[] diff=10**18 ans=10**18 for i in range(-10000,10000): #十分大きな範囲の整数について確かめる if i in s: #{pi}に含まれる場合は計算を行わない continue else: if abs(x-i)<diff: #Xとの差の絶対値が最小になるものを求める ans=i...
x,n=list(map(int,input().split())) if n!=0: s=set(list(map(int,input().split()))) else: s=[] diff=10**18 ans=10**18 for i in range(-10000,10000): if i in s: continue else: if abs(x-i)<diff: ans=i diff=abs(x-i) print(ans)
15
15
346
248
x, n = list(map(int, input().split())) if n != 0: # 空行の読み込みを回避、処理を高速化するためにpiを集合型で管理する s = set(list(map(int, input().split()))) else: s = [] diff = 10**18 ans = 10**18 for i in range(-10000, 10000): # 十分大きな範囲の整数について確かめる if i in s: # {pi}に含まれる場合は計算を行わない continue else: if abs(x - i) < di...
x, n = list(map(int, input().split())) if n != 0: s = set(list(map(int, input().split()))) else: s = [] diff = 10**18 ans = 10**18 for i in range(-10000, 10000): if i in s: continue else: if abs(x - i) < diff: ans = i diff = abs(x - i) print(ans)
false
0
[ "-if n != 0: # 空行の読み込みを回避、処理を高速化するためにpiを集合型で管理する", "+if n != 0:", "-for i in range(-10000, 10000): # 十分大きな範囲の整数について確かめる", "- if i in s: # {pi}に含まれる場合は計算を行わない", "+for i in range(-10000, 10000):", "+ if i in s:", "- if abs(x - i) < diff: # Xとの差の絶対値が最小になるものを求める", "+ if abs(x - i) ...
false
0.052785
0.059316
0.889888
[ "s792516073", "s704802349" ]
u099155265
p02399
python
s501798091
s495655449
30
20
7,644
7,644
Accepted
Accepted
33.33
a, b = list(map(int, input().split())) print(("{0} {1} {2}".format(a//b, a%b, format(a / b, '.5f'))))
a, b = list(map(int, input().split())) print(("{0:d} {1:d} {2:f}".format(a//b, a%b, a / b)))
3
3
102
93
a, b = list(map(int, input().split())) print(("{0} {1} {2}".format(a // b, a % b, format(a / b, ".5f"))))
a, b = list(map(int, input().split())) print(("{0:d} {1:d} {2:f}".format(a // b, a % b, a / b)))
false
0
[ "-print((\"{0} {1} {2}\".format(a // b, a % b, format(a / b, \".5f\"))))", "+print((\"{0:d} {1:d} {2:f}\".format(a // b, a % b, a / b)))" ]
false
0.083647
0.040588
2.060889
[ "s501798091", "s495655449" ]
u553987207
p02983
python
s892733357
s871544775
789
718
2,940
9,168
Accepted
Accepted
9
L, R = list(map(int, input().split())) r = L + min(2019, R - L) ans = 2019 for i in range(L, r): for j in range(i + 1, r + 1): ans = min(ans, (i * j) % 2019) print(ans)
L, R = list(map(int, input().split())) MOD = 2019 ans = MOD R = min(R, L + MOD) for i in range(L, R): for j in range(i + 1, R + 1): ans = min(ans, (i * j) % MOD) print(ans)
7
8
180
185
L, R = list(map(int, input().split())) r = L + min(2019, R - L) ans = 2019 for i in range(L, r): for j in range(i + 1, r + 1): ans = min(ans, (i * j) % 2019) print(ans)
L, R = list(map(int, input().split())) MOD = 2019 ans = MOD R = min(R, L + MOD) for i in range(L, R): for j in range(i + 1, R + 1): ans = min(ans, (i * j) % MOD) print(ans)
false
12.5
[ "-r = L + min(2019, R - L)", "-ans = 2019", "-for i in range(L, r):", "- for j in range(i + 1, r + 1):", "- ans = min(ans, (i * j) % 2019)", "+MOD = 2019", "+ans = MOD", "+R = min(R, L + MOD)", "+for i in range(L, R):", "+ for j in range(i + 1, R + 1):", "+ ans = min(ans, (i ...
false
0.065138
0.066475
0.979896
[ "s892733357", "s871544775" ]
u227438830
p02406
python
s449848899
s638481333
30
20
8,440
5,868
Accepted
Accepted
33.33
n = int(eval(input())) list_a = [i for i in range(1,n+1) if i % 3 ==0] list_b = [] for i in range (1,n+1): j = i while True: if j == 0: break elif j % 10 == 3: list_b.append(i) break j = j // 10 a = set(list_a) b = set(list_b) c =li...
n = int(input()) for i in range(1,n+1): if i%3 == 0 or i%10 ==3 or (i//10)%10 ==3 or (i//100)%10 ==3 or (i//1000)%10 ==3 : print(' '+str(i),end = '') print()
18
5
368
174
n = int(eval(input())) list_a = [i for i in range(1, n + 1) if i % 3 == 0] list_b = [] for i in range(1, n + 1): j = i while True: if j == 0: break elif j % 10 == 3: list_b.append(i) break j = j // 10 a = set(list_a) b = set(list_b) c = list(a | b) c.s...
n = int(input()) for i in range(1, n + 1): if ( i % 3 == 0 or i % 10 == 3 or (i // 10) % 10 == 3 or (i // 100) % 10 == 3 or (i // 1000) % 10 == 3 ): print(" " + str(i), end="") print()
false
72.222222
[ "-n = int(eval(input()))", "-list_a = [i for i in range(1, n + 1) if i % 3 == 0]", "-list_b = []", "+n = int(input())", "- j = i", "- while True:", "- if j == 0:", "- break", "- elif j % 10 == 3:", "- list_b.append(i)", "- break", "- ...
false
0.043689
0.042962
1.016922
[ "s449848899", "s638481333" ]
u661977789
p02607
python
s650777884
s013315136
29
25
9,080
9,100
Accepted
Accepted
13.79
eval(input()) print((len([i for n,i in enumerate(map(int,input().split()),1) if i%2==1 and n%2])))
eval(input()) print((len([i for i in list(map(int,input().split()))[::2] if i%2])))
2
2
91
76
eval(input()) print( ( len( [ i for n, i in enumerate(map(int, input().split()), 1) if i % 2 == 1 and n % 2 ] ) ) )
eval(input()) print((len([i for i in list(map(int, input().split()))[::2] if i % 2])))
false
0
[ "-print(", "- (", "- len(", "- [", "- i", "- for n, i in enumerate(map(int, input().split()), 1)", "- if i % 2 == 1 and n % 2", "- ]", "- )", "- )", "-)", "+print((len([i for i in list(map(int, input().split...
false
0.042625
0.03252
1.31072
[ "s650777884", "s013315136" ]
u761320129
p03946
python
s535033473
s338249098
97
79
15,020
14,292
Accepted
Accepted
18.56
N,T = list(map(int,input().split())) src = list(map(int,input().split())) minv = src[0] maxp = ans = 0 for i in range(1,N): profit = src[i] - minv if profit == maxp: ans += 1 elif profit > maxp: maxp = profit ans = 1 minv = min(minv, src[i]) print(ans)
N,T = list(map(int,input().split())) src = list(map(int,input().split())) mincost = src[0] maxgain = 0 sell = 0 buy = 1 for a in src[1:]: if a < mincost: mincost = a buy = 1 elif a == mincost: buy += 1 elif a > mincost + maxgain: maxgain = a - mincost ...
14
20
300
400
N, T = list(map(int, input().split())) src = list(map(int, input().split())) minv = src[0] maxp = ans = 0 for i in range(1, N): profit = src[i] - minv if profit == maxp: ans += 1 elif profit > maxp: maxp = profit ans = 1 minv = min(minv, src[i]) print(ans)
N, T = list(map(int, input().split())) src = list(map(int, input().split())) mincost = src[0] maxgain = 0 sell = 0 buy = 1 for a in src[1:]: if a < mincost: mincost = a buy = 1 elif a == mincost: buy += 1 elif a > mincost + maxgain: maxgain = a - mincost sell = 1 ...
false
30
[ "-minv = src[0]", "-maxp = ans = 0", "-for i in range(1, N):", "- profit = src[i] - minv", "- if profit == maxp:", "- ans += 1", "- elif profit > maxp:", "- maxp = profit", "- ans = 1", "- minv = min(minv, src[i])", "-print(ans)", "+mincost = src[0]", "+maxga...
false
0.050395
0.047046
1.071189
[ "s535033473", "s338249098" ]
u864197622
p03225
python
s609103237
s802694309
1,551
1,010
56,940
5,108
Accepted
Accepted
34.88
H, W = list(map(int, input().split())) I = [eval(input()) for _ in range(H)] X = [[[0, 1][a=="#"] for a in inp] for inp in I] k = 32 def r(): global H, W, I I = ["".join([I[H - 1 - j][i] for j in range(H)]) for i in range(W)] H, W = W, H def st1(s): return int(s.replace("#", "1" * k).replace("....
H, W = list(map(int, input().split())) I = [eval(input()) for _ in range(H)] X = [[[0, 1][a=="#"] for a in inp] for inp in I] k = 21 def r(): global H, W, I I = ["".join([I[H - 1 - j][i] for j in range(H)]) for i in range(W)] H, W = W, H def st1(s): return int(s.replace("#", "1" * k).replace("....
37
31
1,120
981
H, W = list(map(int, input().split())) I = [eval(input()) for _ in range(H)] X = [[[0, 1][a == "#"] for a in inp] for inp in I] k = 32 def r(): global H, W, I I = ["".join([I[H - 1 - j][i] for j in range(H)]) for i in range(W)] H, W = W, H def st1(s): return int(s.replace("#", "1" * k).replace(".", ...
H, W = list(map(int, input().split())) I = [eval(input()) for _ in range(H)] X = [[[0, 1][a == "#"] for a in inp] for inp in I] k = 21 def r(): global H, W, I I = ["".join([I[H - 1 - j][i] for j in range(H)]) for i in range(W)] H, W = W, H def st1(s): return int(s.replace("#", "1" * k).replace(".", ...
false
16.216216
[ "-k = 32", "+k = 21", "- C = [[0] * W for _ in range(H)]", "- s = 0", "+ s, t = 0, 0", "- s <<= k", "- s += B[i] >> (j + 1) * k", "- s &= m", "- C[i][j] = s", "- for i in range(1, H):", "- for j in range(1, W):", "- ...
false
0.044153
0.037498
1.177474
[ "s609103237", "s802694309" ]
u025501820
p02727
python
s751940979
s527547245
957
258
51,988
22,504
Accepted
Accepted
73.04
X, Y, A, B, C = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) red = [[i, "r"] for i in p] green = [[i, "g"] for i in q] white = [[i, "w"] for i in r] total = sorted(red + green + white)[::-1] ans = 0 cnt = 0 r_...
X, Y, A, B, C = list(map(int, input().split())) p = sorted(list(map(int, input().split())))[-X:] q = sorted(list(map(int, input().split())))[-Y:] r = list(map(int, input().split())) total = sorted(p + q + r)[::-1] print((sum(total[:X + Y])))
30
7
623
241
X, Y, A, B, C = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) red = [[i, "r"] for i in p] green = [[i, "g"] for i in q] white = [[i, "w"] for i in r] total = sorted(red + green + white)[::-1] ans = 0 cnt = 0 r_cnt = 0 g_cnt = ...
X, Y, A, B, C = list(map(int, input().split())) p = sorted(list(map(int, input().split())))[-X:] q = sorted(list(map(int, input().split())))[-Y:] r = list(map(int, input().split())) total = sorted(p + q + r)[::-1] print((sum(total[: X + Y])))
false
76.666667
[ "-p = list(map(int, input().split()))", "-q = list(map(int, input().split()))", "+p = sorted(list(map(int, input().split())))[-X:]", "+q = sorted(list(map(int, input().split())))[-Y:]", "-red = [[i, \"r\"] for i in p]", "-green = [[i, \"g\"] for i in q]", "-white = [[i, \"w\"] for i in r]", "-total = ...
false
0.060826
0.057376
1.060131
[ "s751940979", "s527547245" ]
u098968285
p03088
python
s517157188
s109753291
641
569
55,132
53,980
Accepted
Accepted
11.23
import re def makelist(n, m): return [[0 for i in range(m)] for j in range(n)] N = int(eval(input())) acgt = ["A", "C", "G", "T"] changed = [".*GAC.*", ".*ACG.*", ".*A.GC.*", ".*AG.C.*"] bad = ".*AGC" # initialize dp = {} for a in acgt: for b in acgt: for c in acgt: now...
import re def makelist(n, m): return [[0 for i in range(m)] for j in range(n)] N = int(eval(input())) acgt = ["A", "C", "G", "T"] changed = [".*AGC", ".*GAC", ".*ACG", ".*A.GC", ".*AG.C"] # initialize dp = {} for a in acgt: for b in acgt: for c in acgt: now = a+b+c ...
57
50
1,275
1,069
import re def makelist(n, m): return [[0 for i in range(m)] for j in range(n)] N = int(eval(input())) acgt = ["A", "C", "G", "T"] changed = [".*GAC.*", ".*ACG.*", ".*A.GC.*", ".*AG.C.*"] bad = ".*AGC" # initialize dp = {} for a in acgt: for b in acgt: for c in acgt: now = a + b + c ...
import re def makelist(n, m): return [[0 for i in range(m)] for j in range(n)] N = int(eval(input())) acgt = ["A", "C", "G", "T"] changed = [".*AGC", ".*GAC", ".*ACG", ".*A.GC", ".*AG.C"] # initialize dp = {} for a in acgt: for b in acgt: for c in acgt: now = a + b + c if any...
false
12.280702
[ "-changed = [\".*GAC.*\", \".*ACG.*\", \".*A.GC.*\", \".*AG.C.*\"]", "-bad = \".*AGC\"", "+changed = [\".*AGC\", \".*GAC\", \".*ACG\", \".*A.GC\", \".*AG.C\"]", "- if re.match(bad, now):", "- dp[now] = 0", "- elif any([re.match(ch, now) for ch in changed]):", "+ ...
false
0.392318
0.509233
0.770409
[ "s517157188", "s109753291" ]
u811276793
p03074
python
s317279149
s386898399
81
58
7,932
8,820
Accepted
Accepted
28.4
# -*- coding: utf-8 -*- def main(N, K, S): cnts = [] now = 1 cnt = 0 for n in S: if now == int(n): cnt += 1 else: cnts.append(cnt) cnt = 1 now = 1 - now if cnt != 0: cnts.append(cnt) if len(cnts) % 2 == 0: cnts.a...
# -*- coding: utf-8 -*- from itertools import accumulate def main(N, K, S): cnts = [] now = '1' cnt = 0 for n in S: if now == n: cnt += 1 else: cnts.append(cnt) cnt = 1 now = n cnts.append(cnt) if now == '0': cnt...
37
36
736
709
# -*- coding: utf-8 -*- def main(N, K, S): cnts = [] now = 1 cnt = 0 for n in S: if now == int(n): cnt += 1 else: cnts.append(cnt) cnt = 1 now = 1 - now if cnt != 0: cnts.append(cnt) if len(cnts) % 2 == 0: cnts.appen...
# -*- coding: utf-8 -*- from itertools import accumulate def main(N, K, S): cnts = [] now = "1" cnt = 0 for n in S: if now == n: cnt += 1 else: cnts.append(cnt) cnt = 1 now = n cnts.append(cnt) if now == "0": cnts.append(0...
false
2.702703
[ "+from itertools import accumulate", "+", "+", "- now = 1", "+ now = \"1\"", "- if now == int(n):", "+ if now == n:", "- now = 1 - now", "- if cnt != 0:", "- cnts.append(cnt)", "- if len(cnts) % 2 == 0:", "+ now = n", "+ cnts.append(c...
false
0.092589
0.111799
0.828172
[ "s317279149", "s386898399" ]
u191874006
p02913
python
s958305761
s186329756
958
629
230,332
49,884
Accepted
Accepted
34.34
#!/usr/bin/env python3 #ABC141 E import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000000) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Co...
#!/usr/bin/env python3 #ABC141 E #Z-algorithm import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000000) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collect...
33
51
875
1,257
#!/usr/bin/env python3 # ABC141 E import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000000) from heapq import heappush, heappop, heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter fro...
#!/usr/bin/env python3 # ABC141 E # Z-algorithm import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000000) from heapq import heappush, heappop, heappushpop from collections import defaultdict from itertools import accumulate from collections impo...
false
35.294118
[ "+# Z-algorithm", "+def z_algorithm(s):", "+ n = len(s)", "+ Z = [0] * n", "+ Z[0] = n", "+ L, R = 0, 0", "+ for i in range(1, n):", "+ if i >= R: # 過去の結果が使えない", "+ L = R = i", "+ while R < n and s[R - L] == s[R]:", "+ R += 1", "+ ...
false
0.036704
0.037138
0.98831
[ "s958305761", "s186329756" ]
u077291787
p03911
python
s368348076
s627749895
475
357
44,996
18,116
Accepted
Accepted
24.84
# cf16-finalC - Interpretation # bipartite graph def dfs() -> None: stack = [(1, 1)] seen_m[1] = 1 while stack: v, flg = stack.pop() if flg: for u in men[v]: if not seen_l[u]: stack.append((u, 0)) seen_l[u] = 1 ...
# cf16-finalC - Interpretation class UnionFind: # O(α(N)) def __init__(self, size): # construct a Union-Find tree (1-idx) self.parent = [i for i in range(size + 1)] self.rank = [0] * (size + 1) def find(self, x): # find the group (root) of a vertex if self.parent[x] == x: ...
35
44
1,057
1,432
# cf16-finalC - Interpretation # bipartite graph def dfs() -> None: stack = [(1, 1)] seen_m[1] = 1 while stack: v, flg = stack.pop() if flg: for u in men[v]: if not seen_l[u]: stack.append((u, 0)) seen_l[u] = 1 else:...
# cf16-finalC - Interpretation class UnionFind: # O(α(N)) def __init__(self, size): # construct a Union-Find tree (1-idx) self.parent = [i for i in range(size + 1)] self.rank = [0] * (size + 1) def find(self, x): # find the group (root) of a vertex if self.parent[x] == x: ...
false
20.454545
[ "-# bipartite graph", "-def dfs() -> None:", "- stack = [(1, 1)]", "- seen_m[1] = 1", "- while stack:", "- v, flg = stack.pop()", "- if flg:", "- for u in men[v]:", "- if not seen_l[u]:", "- stack.append((u, 0))", "- ...
false
0.043916
0.083238
0.527596
[ "s368348076", "s627749895" ]
u066551652
p02773
python
s758705854
s855041415
797
712
46,236
32,988
Accepted
Accepted
10.66
n = int(eval(input())) s_dic = {} for i in range(n): tmp = str(eval(input())) if tmp not in s_dic: s_dic[tmp] = 1 else: s_dic[tmp] += 1 max_value = max(s_dic.values()) s_dic = sorted(list(s_dic.items()), key=lambda x:x[0]) for i in s_dic: if i[1] == max_value: ...
n = int(eval(input())) s_dic = {} for i in range(n): tmp = str(eval(input())) if tmp not in s_dic: s_dic[tmp] = 1 else: s_dic[tmp] += 1 tmp = max(s_dic.values()) max_s_key = [s_value[0] for s_value in list(s_dic.items()) if s_value[1] == tmp] max_s_key = sorted(max_s_key) ...
17
18
314
337
n = int(eval(input())) s_dic = {} for i in range(n): tmp = str(eval(input())) if tmp not in s_dic: s_dic[tmp] = 1 else: s_dic[tmp] += 1 max_value = max(s_dic.values()) s_dic = sorted(list(s_dic.items()), key=lambda x: x[0]) for i in s_dic: if i[1] == max_value: print((i[0]))
n = int(eval(input())) s_dic = {} for i in range(n): tmp = str(eval(input())) if tmp not in s_dic: s_dic[tmp] = 1 else: s_dic[tmp] += 1 tmp = max(s_dic.values()) max_s_key = [s_value[0] for s_value in list(s_dic.items()) if s_value[1] == tmp] max_s_key = sorted(max_s_key) for i in max_s_key:...
false
5.555556
[ "-max_value = max(s_dic.values())", "-s_dic = sorted(list(s_dic.items()), key=lambda x: x[0])", "-for i in s_dic:", "- if i[1] == max_value:", "- print((i[0]))", "+tmp = max(s_dic.values())", "+max_s_key = [s_value[0] for s_value in list(s_dic.items()) if s_value[1] == tmp]", "+max_s_key = s...
false
0.041869
0.043032
0.972987
[ "s758705854", "s855041415" ]
u940533000
p02623
python
s909678054
s488933596
343
296
48,776
47,360
Accepted
Accepted
13.7
N,M,K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) a, b = [0], [0] tmp = 0 for i in range(N): tmp += A[i] a.append(tmp) tmp = 0 for i in range(M): tmp += B[i] b.append(tmp) total = 0 count = [] best_j = len(b)-1 for i in range(len(a...
N,M,K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) a, b = [0], [0] tmp = 0 for i in range(N): tmp += A[i] a.append(tmp) tmp = 0 for i in range(M): tmp += B[i] b.append(tmp) j = len(b)-1 ans = 0 for i in range(len(a)): if a[i] > K:...
31
25
553
408
N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) a, b = [0], [0] tmp = 0 for i in range(N): tmp += A[i] a.append(tmp) tmp = 0 for i in range(M): tmp += B[i] b.append(tmp) total = 0 count = [] best_j = len(b) - 1 for i in range(len(a)): ...
N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) a, b = [0], [0] tmp = 0 for i in range(N): tmp += A[i] a.append(tmp) tmp = 0 for i in range(M): tmp += B[i] b.append(tmp) j = len(b) - 1 ans = 0 for i in range(len(a)): if a[i] > K: ...
false
19.354839
[ "-total = 0", "-count = []", "-best_j = len(b) - 1", "+j = len(b) - 1", "+ans = 0", "- if a[i] <= K:", "- for j in range(best_j, -1, -1):", "- total = a[i] + b[j]", "- if total <= K:", "- count.append(i + j)", "- best_j = j", "- ...
false
0.038056
0.049004
0.776586
[ "s909678054", "s488933596" ]
u918601425
p02848
python
s447876725
s900574030
177
22
39,280
3,064
Accepted
Accepted
87.57
ls=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ') N=26-int(eval(input())) S=eval(input()) ans=[] for i in range(len(S)): x=ls.index(S[i]) ans.append(ls[x-N]) print(("".join(ans)))
ls=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ') N=int(eval(input())) S=eval(input()) ans=[ls[(ls.index(S[i])+N)%26] for i in range(len(S))] print(("".join(ans)))
8
5
164
141
ls = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") N = 26 - int(eval(input())) S = eval(input()) ans = [] for i in range(len(S)): x = ls.index(S[i]) ans.append(ls[x - N]) print(("".join(ans)))
ls = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") N = int(eval(input())) S = eval(input()) ans = [ls[(ls.index(S[i]) + N) % 26] for i in range(len(S))] print(("".join(ans)))
false
37.5
[ "-N = 26 - int(eval(input()))", "+N = int(eval(input()))", "-ans = []", "-for i in range(len(S)):", "- x = ls.index(S[i])", "- ans.append(ls[x - N])", "+ans = [ls[(ls.index(S[i]) + N) % 26] for i in range(len(S))]" ]
false
0.181776
0.037313
4.871697
[ "s447876725", "s900574030" ]
u948911484
p03369
python
s020194035
s870511309
26
24
9,060
9,028
Accepted
Accepted
7.69
print((700+input().count("o")*100))
print(([7,8,9,10][input().count("o")]*100))
1
1
33
41
print((700 + input().count("o") * 100))
print(([7, 8, 9, 10][input().count("o")] * 100))
false
0
[ "-print((700 + input().count(\"o\") * 100))", "+print(([7, 8, 9, 10][input().count(\"o\")] * 100))" ]
false
0.036752
0.044323
0.829184
[ "s020194035", "s870511309" ]
u631025015
p02641
python
s548481868
s491223632
30
26
9,148
9,136
Accepted
Accepted
13.33
x,n = input().split() x=int(x) n=int(n) list=input().split() for i in range(0, len(list)): list[i] = int(list[i]) diff = 200 for i in range(-1, 102): if i not in list and abs(i-x) < diff: diff = abs(i-x) ans = i print(ans)
x,n = input().split() x=int(x) list=input().split() diff = 200 for i in range(-1, 102): if str(i) not in list and abs(i-x) < diff: diff = abs(i-x) ans = i print(ans)
12
9
257
193
x, n = input().split() x = int(x) n = int(n) list = input().split() for i in range(0, len(list)): list[i] = int(list[i]) diff = 200 for i in range(-1, 102): if i not in list and abs(i - x) < diff: diff = abs(i - x) ans = i print(ans)
x, n = input().split() x = int(x) list = input().split() diff = 200 for i in range(-1, 102): if str(i) not in list and abs(i - x) < diff: diff = abs(i - x) ans = i print(ans)
false
25
[ "-n = int(n)", "-for i in range(0, len(list)):", "- list[i] = int(list[i])", "- if i not in list and abs(i - x) < diff:", "+ if str(i) not in list and abs(i - x) < diff:" ]
false
0.033879
0.03573
0.948187
[ "s548481868", "s491223632" ]
u075012704
p03863
python
s816512153
s740522620
36
18
3,316
3,316
Accepted
Accepted
50
S = eval(input()) N = len(S) x = S[0] y = S[1] for i in range(2, N): if i % 2 == 0: if S[i] != x: break else: if S[i] != y: break else: print("Second") exit() if S[0]==S[-1]: if N % 2 == 0: print("First") else: print("...
S = eval(input()) if S[0] == S[-1]: C1 = True else: C1 = False if len(S) % 2 == 1: C2 = True else: C2 = False if C1 ^ C2 == 0: print('Second') else: print('First')
26
16
410
200
S = eval(input()) N = len(S) x = S[0] y = S[1] for i in range(2, N): if i % 2 == 0: if S[i] != x: break else: if S[i] != y: break else: print("Second") exit() if S[0] == S[-1]: if N % 2 == 0: print("First") else: print("Second") else: i...
S = eval(input()) if S[0] == S[-1]: C1 = True else: C1 = False if len(S) % 2 == 1: C2 = True else: C2 = False if C1 ^ C2 == 0: print("Second") else: print("First")
false
38.461538
[ "-N = len(S)", "-x = S[0]", "-y = S[1]", "-for i in range(2, N):", "- if i % 2 == 0:", "- if S[i] != x:", "- break", "- else:", "- if S[i] != y:", "- break", "+if S[0] == S[-1]:", "+ C1 = True", "+ C1 = False", "+if len(S) % 2 == 1:", "+ ...
false
0.034315
0.033246
1.032151
[ "s816512153", "s740522620" ]
u718706790
p03609
python
s448396779
s371923347
19
17
3,316
2,940
Accepted
Accepted
10.53
x, t = list(map(int, input().split())) if x - t >= 0: print((x - t)) else: print((0))
x, t = list(map(int, input().split())) if x > t: print((x - t)) else: print((0))
6
6
85
80
x, t = list(map(int, input().split())) if x - t >= 0: print((x - t)) else: print((0))
x, t = list(map(int, input().split())) if x > t: print((x - t)) else: print((0))
false
0
[ "-if x - t >= 0:", "+if x > t:" ]
false
0.040575
0.040196
1.009424
[ "s448396779", "s371923347" ]
u647766105
p00009
python
s004881555
s554388598
1,400
430
12,104
35,964
Accepted
Accepted
69.29
import sys n=10**6 s=[True]*n s[0]=False s[1]=False for x in range(2, int(n**0.5)+1): if s[x]: for i in range(x+x,n,x): s[i]=False for x in sys.stdin.readlines(): x=int(x)+1 cnt=0 for i in range(x): if s[i]: cnt=cnt+1 print(cnt)
import sys n=10**6 p=[1]*n p[0],p[1]=0,0 for i in range(2,int(n**0.5)+1): if p[i]==1: for j in range(i**2,n,i): p[j]=0 for i in range(2,n): p[i]+=p[i-1] for line in sys.stdin.readlines(): print(p[int(line)])
16
12
305
252
import sys n = 10**6 s = [True] * n s[0] = False s[1] = False for x in range(2, int(n**0.5) + 1): if s[x]: for i in range(x + x, n, x): s[i] = False for x in sys.stdin.readlines(): x = int(x) + 1 cnt = 0 for i in range(x): if s[i]: cnt = cnt + 1 print(cnt)
import sys n = 10**6 p = [1] * n p[0], p[1] = 0, 0 for i in range(2, int(n**0.5) + 1): if p[i] == 1: for j in range(i**2, n, i): p[j] = 0 for i in range(2, n): p[i] += p[i - 1] for line in sys.stdin.readlines(): print(p[int(line)])
false
25
[ "-s = [True] * n", "-s[0] = False", "-s[1] = False", "-for x in range(2, int(n**0.5) + 1):", "- if s[x]:", "- for i in range(x + x, n, x):", "- s[i] = False", "-for x in sys.stdin.readlines():", "- x = int(x) + 1", "- cnt = 0", "- for i in range(x):", "- if...
false
0.575581
0.983218
0.585405
[ "s004881555", "s554388598" ]
u691501673
p02861
python
s177662649
s547976527
398
118
3,064
3,064
Accepted
Accepted
70.35
import math import itertools N = int(eval(input())) array = [list(map(int, input().split())) for _ in range(N)] result = 0 count = 0 permutation_list = itertools.permutations([x for x in range(N)]) for data in permutation_list: count += 1 for i in range(1, len(data)): result += math.sq...
import math import itertools N = int(eval(input())) array = [list(map(int, input().split())) for _ in range(N)] result = 0 count = 0 permutation_list = itertools.permutations([x for x in range(N)]) calc = [[0] * 10 for i in range(10)] for i in range(N): for j in range(N): calc[i][j] = ma...
17
25
470
709
import math import itertools N = int(eval(input())) array = [list(map(int, input().split())) for _ in range(N)] result = 0 count = 0 permutation_list = itertools.permutations([x for x in range(N)]) for data in permutation_list: count += 1 for i in range(1, len(data)): result += math.sqrt( (...
import math import itertools N = int(eval(input())) array = [list(map(int, input().split())) for _ in range(N)] result = 0 count = 0 permutation_list = itertools.permutations([x for x in range(N)]) calc = [[0] * 10 for i in range(10)] for i in range(N): for j in range(N): calc[i][j] = math.sqrt( ...
false
32
[ "+calc = [[0] * 10 for i in range(10)]", "+for i in range(N):", "+ for j in range(N):", "+ calc[i][j] = math.sqrt(", "+ (array[i][0] - array[j][0]) ** 2 + (array[i][1] - array[j][1]) ** 2", "+ )", "+ calc[j][i] = math.sqrt(", "+ (array[i][0] - array[j][0])...
false
0.040566
0.040573
0.999832
[ "s177662649", "s547976527" ]