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
u186838327
p03700
python
s043348468
s243209753
1,286
561
7,072
50,904
Accepted
Accepted
56.38
n, a, b = list(map(int, input().split())) h = [int(eval(input())) for _ in range(n)] import math def ok(x): t = 0 for i in range(n): r = h[i] - b*x if r < 0: continue else: t += math.ceil(r/(a-b)) if t <= x: return True else: ...
n, a, b = list(map(int, input().split())) H = [int(eval(input())) for _ in range(n)] def ok(x): tot = 0 for i in range(n): if b*x >= H[i]: continue else: r = H[i] - b*x if r%(a-b) == 0: tot += r//(a-b) else: ...
26
28
445
524
n, a, b = list(map(int, input().split())) h = [int(eval(input())) for _ in range(n)] import math def ok(x): t = 0 for i in range(n): r = h[i] - b * x if r < 0: continue else: t += math.ceil(r / (a - b)) if t <= x: return True else: return...
n, a, b = list(map(int, input().split())) H = [int(eval(input())) for _ in range(n)] def ok(x): tot = 0 for i in range(n): if b * x >= H[i]: continue else: r = H[i] - b * x if r % (a - b) == 0: tot += r // (a - b) else: ...
false
7.142857
[ "-h = [int(eval(input())) for _ in range(n)]", "-import math", "+H = [int(eval(input())) for _ in range(n)]", "- t = 0", "+ tot = 0", "- r = h[i] - b * x", "- if r < 0:", "+ if b * x >= H[i]:", "- t += math.ceil(r / (a - b))", "- if t <= x:", "+ ...
false
0.037974
0.076557
0.49602
[ "s043348468", "s243209753" ]
u124605948
p03419
python
s556719303
s471215393
30
26
9,108
9,068
Accepted
Accepted
13.33
n, m = list(map(int, input().split())) if n >= 2 and m >= 2: print(((n-2)*(m-2))) elif (n == 1 and m >= 3) or (n >= 3 and m == 1): print((max(n, m)-2)) elif (n == 1 and m == 2) or (n == 2 and m == 1): print((0)) elif (n == 1 and m == 1): print((1))
n, m = list(map(int, input().split())) if n*m == 1: print((1)) elif n == 1 or m == 1: print((max(n, m)-2)) else: print(((n-2)*(m-2)))
10
8
260
141
n, m = list(map(int, input().split())) if n >= 2 and m >= 2: print(((n - 2) * (m - 2))) elif (n == 1 and m >= 3) or (n >= 3 and m == 1): print((max(n, m) - 2)) elif (n == 1 and m == 2) or (n == 2 and m == 1): print((0)) elif n == 1 and m == 1: print((1))
n, m = list(map(int, input().split())) if n * m == 1: print((1)) elif n == 1 or m == 1: print((max(n, m) - 2)) else: print(((n - 2) * (m - 2)))
false
20
[ "-if n >= 2 and m >= 2:", "+if n * m == 1:", "+ print((1))", "+elif n == 1 or m == 1:", "+ print((max(n, m) - 2))", "+else:", "-elif (n == 1 and m >= 3) or (n >= 3 and m == 1):", "- print((max(n, m) - 2))", "-elif (n == 1 and m == 2) or (n == 2 and m == 1):", "- print((0))", "-elif n...
false
0.03609
0.033782
1.068326
[ "s556719303", "s471215393" ]
u285436211
p02659
python
s847074492
s450057259
32
27
9,976
9,164
Accepted
Accepted
15.62
from decimal import Decimal a,b=input().split() print((int(Decimal(a)*Decimal(b))))
a,b = list(map(str, input().split())) a=int(a) b=int(b.replace(".","")) print((a*b//100))
3
4
83
84
from decimal import Decimal a, b = input().split() print((int(Decimal(a) * Decimal(b))))
a, b = list(map(str, input().split())) a = int(a) b = int(b.replace(".", "")) print((a * b // 100))
false
25
[ "-from decimal import Decimal", "-", "-a, b = input().split()", "-print((int(Decimal(a) * Decimal(b))))", "+a, b = list(map(str, input().split()))", "+a = int(a)", "+b = int(b.replace(\".\", \"\"))", "+print((a * b // 100))" ]
false
0.166616
0.108038
1.542198
[ "s847074492", "s450057259" ]
u008357982
p02756
python
s097601048
s800109453
440
348
12,256
8,676
Accepted
Accepted
20.91
from collections import deque d = deque(list(input())) flag = 1 for _ in range(int(input())): a = input() if a[0] == '1': flag *= -1 elif a[2] == '1' and flag == 1: d.appendleft(a[4]) elif a[2] == '1' and flag == -1: d.append(a[4]) elif a[2] == '2' and flag == 1:...
from collections import deque d = deque(list(eval(input()))) flag = 1 for _ in range(int(eval(input()))): a = eval(input()) if a[0] == '1': flag *= -1 elif a[2] == '1' and flag == 1: d.appendleft(a[4]) elif a[2] == '1' and flag == -1: d.append(a[4]) elif a[2] == ...
19
19
436
436
from collections import deque d = deque(list(input())) flag = 1 for _ in range(int(input())): a = input() if a[0] == "1": flag *= -1 elif a[2] == "1" and flag == 1: d.appendleft(a[4]) elif a[2] == "1" and flag == -1: d.append(a[4]) elif a[2] == "2" and flag == 1: d.a...
from collections import deque d = deque(list(eval(input()))) flag = 1 for _ in range(int(eval(input()))): a = eval(input()) if a[0] == "1": flag *= -1 elif a[2] == "1" and flag == 1: d.appendleft(a[4]) elif a[2] == "1" and flag == -1: d.append(a[4]) elif a[2] == "2" and flag...
false
0
[ "-d = deque(list(input()))", "+d = deque(list(eval(input())))", "-for _ in range(int(input())):", "- a = input()", "+for _ in range(int(eval(input()))):", "+ a = eval(input())", "-print(*d, sep=\"\")", "+print((\"\".join(d)))" ]
false
0.042663
0.084462
0.505115
[ "s097601048", "s800109453" ]
u312025627
p02744
python
s369238558
s681146415
368
335
56,408
69,256
Accepted
Accepted
8.97
def main(): from string import ascii_lowercase dic = {i: s for i, s in enumerate(ascii_lowercase)} N = int(eval(input())) ans = [] def dfs(s, mx): if len(s) == N: print(s) return else: for i in range(mx+2): v = s + dic[...
def main(): from string import ascii_lowercase dic = {i: s for i, s in enumerate(ascii_lowercase)} N = int(input()) ans = [] def dfs(s, mx): if len(s) == N: ans.append(s) return else: for i in range(mx+2): v = s + dic[i...
20
21
439
471
def main(): from string import ascii_lowercase dic = {i: s for i, s in enumerate(ascii_lowercase)} N = int(eval(input())) ans = [] def dfs(s, mx): if len(s) == N: print(s) return else: for i in range(mx + 2): v = s + dic[i] ...
def main(): from string import ascii_lowercase dic = {i: s for i, s in enumerate(ascii_lowercase)} N = int(input()) ans = [] def dfs(s, mx): if len(s) == N: ans.append(s) return else: for i in range(mx + 2): v = s + dic[i] ...
false
4.761905
[ "- N = int(eval(input()))", "+ N = int(input())", "- print(s)", "+ ans.append(s)", "+ print(*ans, sep=\"\\n\")" ]
false
0.14558
0.043056
3.381162
[ "s369238558", "s681146415" ]
u796942881
p03221
python
s242570224
s067480124
633
327
38,624
32,976
Accepted
Accepted
48.34
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) Pm = [0] * M Ym = [0] * M ym = [0] * M Am = [[0 for i in range(2)] for j in range(M)] Cn = [0] * N D = {} for i in range(M): P, Y = list(map(int, input().split())) Pm[i], Ym[i] = P, Y ym[i] = Y D[...
def main(): N, M, *PY = list(map(int, open(0).read().split())) lst = [] ans = [""] * M for k, py in enumerate(zip(*[iter(PY)] * 2)): lst.append((py[0], py[1], k)) lst.sort() pre, num = lst[0][0], 1 for cur, y, i in lst: if pre != cur: num = 1 an...
35
19
523
439
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) Pm = [0] * M Ym = [0] * M ym = [0] * M Am = [[0 for i in range(2)] for j in range(M)] Cn = [0] * N D = {} for i in range(M): P, Y = list(map(int, input().split())) Pm[i], Ym[i] = P, Y ym[i] = Y D[Y] = i ym.sort() for i in rang...
def main(): N, M, *PY = list(map(int, open(0).read().split())) lst = [] ans = [""] * M for k, py in enumerate(zip(*[iter(PY)] * 2)): lst.append((py[0], py[1], k)) lst.sort() pre, num = lst[0][0], 1 for cur, y, i in lst: if pre != cur: num = 1 ans[i] = "{:0...
false
45.714286
[ "-import sys", "+def main():", "+ N, M, *PY = list(map(int, open(0).read().split()))", "+ lst = []", "+ ans = [\"\"] * M", "+ for k, py in enumerate(zip(*[iter(PY)] * 2)):", "+ lst.append((py[0], py[1], k))", "+ lst.sort()", "+ pre, num = lst[0][0], 1", "+ for cur, y, i...
false
0.038958
0.00649
6.002792
[ "s242570224", "s067480124" ]
u115682115
p03645
python
s406279411
s924003682
826
596
72,024
18,892
Accepted
Accepted
27.85
N,M = list(map(int,input().split())) a = [list(map(int,input().split())) for i in range(M)] b = set() for i in a: if i[0]==1 or i[1]==N: b.add((i[0],i[1])) for i in range(2,N): if (1,i) in b and (i,N) in b: print('POSSIBLE') exit() print('IMPOSSIBLE')
N, M = list(map(int,input().split())) t_mid = set() f_mid = set() for _ in range(M): f, t = list(map(int,input().split())) if f == 1: t_mid.add(t) elif t == N: f_mid.add(f) if t_mid & f_mid: print('POSSIBLE') else: print('IMPOSSIBLE')
11
14
282
273
N, M = list(map(int, input().split())) a = [list(map(int, input().split())) for i in range(M)] b = set() for i in a: if i[0] == 1 or i[1] == N: b.add((i[0], i[1])) for i in range(2, N): if (1, i) in b and (i, N) in b: print("POSSIBLE") exit() print("IMPOSSIBLE")
N, M = list(map(int, input().split())) t_mid = set() f_mid = set() for _ in range(M): f, t = list(map(int, input().split())) if f == 1: t_mid.add(t) elif t == N: f_mid.add(f) if t_mid & f_mid: print("POSSIBLE") else: print("IMPOSSIBLE")
false
21.428571
[ "-a = [list(map(int, input().split())) for i in range(M)]", "-b = set()", "-for i in a:", "- if i[0] == 1 or i[1] == N:", "- b.add((i[0], i[1]))", "-for i in range(2, N):", "- if (1, i) in b and (i, N) in b:", "- print(\"POSSIBLE\")", "- exit()", "-print(\"IMPOSSIBLE\")"...
false
0.125093
0.087549
1.428834
[ "s406279411", "s924003682" ]
u833543158
p03013
python
s109750063
s780738904
667
468
460,020
460,020
Accepted
Accepted
29.84
import sys N, M = list(map(int, input().split())) a = [int(line) for line in sys.stdin] ans = [-1] * (N + 1) # not evaluated yet for broken in a: ans[broken] = 0 # unreachable ans[0] = 1 # reachable if ans[1]: ans[1] = 1 for i in range(2, N + 1): if ans[i]: ans[i] = ans[i -...
import sys N, M = list(map(int, input().split())) ans = [-1] * (N + 1) # not evaluated yet for line in sys.stdin: ans[int(line)] = 0 # unreachable ans[0] = 1 # reachable if ans[1]: ans[1] = 1 for i in range(2, N + 1): if ans[i]: ans[i] = ans[i - 1] + ans[i - 2] print((ans[N...
20
18
361
329
import sys N, M = list(map(int, input().split())) a = [int(line) for line in sys.stdin] ans = [-1] * (N + 1) # not evaluated yet for broken in a: ans[broken] = 0 # unreachable ans[0] = 1 # reachable if ans[1]: ans[1] = 1 for i in range(2, N + 1): if ans[i]: ans[i] = ans[i - 1] + ans[i - 2] print...
import sys N, M = list(map(int, input().split())) ans = [-1] * (N + 1) # not evaluated yet for line in sys.stdin: ans[int(line)] = 0 # unreachable ans[0] = 1 # reachable if ans[1]: ans[1] = 1 for i in range(2, N + 1): if ans[i]: ans[i] = ans[i - 1] + ans[i - 2] print((ans[N] % 1000000007))
false
10
[ "-a = [int(line) for line in sys.stdin]", "-for broken in a:", "- ans[broken] = 0 # unreachable", "+for line in sys.stdin:", "+ ans[int(line)] = 0 # unreachable" ]
false
0.038869
0.045571
0.852933
[ "s109750063", "s780738904" ]
u057109575
p02948
python
s728242162
s528652642
618
526
105,088
94,788
Accepted
Accepted
14.89
from heapq import heappush, heappop N, M = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] pq = [] for a, b in X: heappush(pq, (a, b)) cand = [] ans = 0 for t in range(1, M + 1): while pq: a, b = heappop(pq) if a <= t: hea...
from heapq import heappop, heappush N, M = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] X.sort(reverse=True) ans = 0 pq = [] for n in range(M + 1): while X and X[-1][0] <= n: a, b = X.pop() heappush(pq, -b) if pq: ans -= heapp...
25
18
474
335
from heapq import heappush, heappop N, M = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] pq = [] for a, b in X: heappush(pq, (a, b)) cand = [] ans = 0 for t in range(1, M + 1): while pq: a, b = heappop(pq) if a <= t: heappush(cand, -b) ...
from heapq import heappop, heappush N, M = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(N)] X.sort(reverse=True) ans = 0 pq = [] for n in range(M + 1): while X and X[-1][0] <= n: a, b = X.pop() heappush(pq, -b) if pq: ans -= heappop(pq) print(ans)
false
28
[ "-from heapq import heappush, heappop", "+from heapq import heappop, heappush", "+X.sort(reverse=True)", "+ans = 0", "-for a, b in X:", "- heappush(pq, (a, b))", "-cand = []", "-ans = 0", "-for t in range(1, M + 1):", "- while pq:", "- a, b = heappop(pq)", "- if a <= t:", ...
false
0.037413
0.06735
0.555492
[ "s728242162", "s528652642" ]
u073852194
p02948
python
s158228995
s854080327
707
603
46,212
20,932
Accepted
Accepted
14.71
import heapq n,m = list(map(int,input().split())) Jobs = [list(map(int,input().split()))for i in range(n)] Days = [[] for i in range(m)] for i in range(n): if Jobs[i][0] <= m: Days[Jobs[i][0]-1] += [[-Jobs[i][1],Jobs[i][0]]] Heap = [] heapq.heapify(Heap) ans = 0 for i in range(m): for j...
from heapq import heappop,heappush N,M = list(map(int,input().split())) job = [tuple(map(int,input().split())) for _ in range(N)] job.sort(key=lambda x:x[1],reverse=True) job.sort(key=lambda x:x[0]) heap = [] ans = 0 j = -1 for i in range(M)[::-1]: while j < N-1 and job[j+1][0]+i <= M: j +...
20
20
437
411
import heapq n, m = list(map(int, input().split())) Jobs = [list(map(int, input().split())) for i in range(n)] Days = [[] for i in range(m)] for i in range(n): if Jobs[i][0] <= m: Days[Jobs[i][0] - 1] += [[-Jobs[i][1], Jobs[i][0]]] Heap = [] heapq.heapify(Heap) ans = 0 for i in range(m): for job in Day...
from heapq import heappop, heappush N, M = list(map(int, input().split())) job = [tuple(map(int, input().split())) for _ in range(N)] job.sort(key=lambda x: x[1], reverse=True) job.sort(key=lambda x: x[0]) heap = [] ans = 0 j = -1 for i in range(M)[::-1]: while j < N - 1 and job[j + 1][0] + i <= M: j += 1 ...
false
0
[ "-import heapq", "+from heapq import heappop, heappush", "-n, m = list(map(int, input().split()))", "-Jobs = [list(map(int, input().split())) for i in range(n)]", "-Days = [[] for i in range(m)]", "-for i in range(n):", "- if Jobs[i][0] <= m:", "- Days[Jobs[i][0] - 1] += [[-Jobs[i][1], Jobs[...
false
0.048998
0.049236
0.995163
[ "s158228995", "s854080327" ]
u627803856
p02813
python
s208301167
s473084173
179
39
45,040
3,064
Accepted
Accepted
78.21
from itertools import permutations n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) s = list(range(1, n+1)) s = list(permutations(s)) a, b = 0, 0 for i, v in enumerate(s, start=1): if v == p: a = i elif v == q: b = i else: pass print(0) if p == ...
n = int(eval(input())) P = list(map(int, input().split())) Q = list(map(int, input().split())) from itertools import permutations l = list(range(1, n + 1)) perm = permutations(l, n) idx_P, idx_Q = 0, 0 for i,v in enumerate(perm): if v == tuple(P): idx_P = i if v == tuple(Q): idx...
20
17
344
349
from itertools import permutations n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) s = list(range(1, n + 1)) s = list(permutations(s)) a, b = 0, 0 for i, v in enumerate(s, start=1): if v == p: a = i elif v == q: b = i else: pass print(0) if...
n = int(eval(input())) P = list(map(int, input().split())) Q = list(map(int, input().split())) from itertools import permutations l = list(range(1, n + 1)) perm = permutations(l, n) idx_P, idx_Q = 0, 0 for i, v in enumerate(perm): if v == tuple(P): idx_P = i if v == tuple(Q): idx_Q = i print((a...
false
15
[ "+n = int(eval(input()))", "+P = list(map(int, input().split()))", "+Q = list(map(int, input().split()))", "-n = int(input())", "-p = tuple(map(int, input().split()))", "-q = tuple(map(int, input().split()))", "-s = list(range(1, n + 1))", "-s = list(permutations(s))", "-a, b = 0, 0", "-for i, v i...
false
0.041585
0.043689
0.951853
[ "s208301167", "s473084173" ]
u821624310
p02409
python
s650805964
s631766267
30
20
7,680
7,732
Accepted
Accepted
33.33
b_ifo = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] n = int(input()) for i in range(n): b, f, r, v = map(int, input().split()) b_ifo[b-1][f-1][r-1] += v for i in range(4): for j in range(3): for k in range(10): print(" " + str(b_ifo[i][j][k]), end = "") ...
house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] n = int(input()) for i in range(n): b, f, r, v = map(int, input().split()) house[b-1][f-1][r-1] += v for i in range(4): for j in range(3): for k in range(10): print(" " + str(house[i][j][k]), end="") ...
12
12
370
387
b_ifo = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] n = int(input()) for i in range(n): b, f, r, v = map(int, input().split()) b_ifo[b - 1][f - 1][r - 1] += v for i in range(4): for j in range(3): for k in range(10): print(" " + str(b_ifo[i][j][k]), end="") pri...
house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] n = int(input()) for i in range(n): b, f, r, v = map(int, input().split()) house[b - 1][f - 1][r - 1] += v for i in range(4): for j in range(3): for k in range(10): print(" " + str(house[i][j][k]), end="") pri...
false
0
[ "-b_ifo = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]", "+house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]", "- b_ifo[b - 1][f - 1][r - 1] += v", "+ house[b - 1][f - 1][r - 1] += v", "- print(\" \" + str(b_ifo[i][j][k]), end=\"\")", "+ p...
false
0.07502
0.067468
1.111935
[ "s650805964", "s631766267" ]
u627600101
p02609
python
s627589331
s509743715
548
418
20,624
20,564
Accepted
Accepted
23.72
N = int(eval(input())) X = eval(input()) ans = [1 for _ in range(N)] if N == 1: if X[0] == '1': print((0)) exit() else: print((1)) exit() l = 0 for k in range(N): if X[k] == '1': l+=1 if l == 0: for _ in range(N): print((1)) exit() if l == 1: if X[-1] == '1...
N = int(eval(input())) X = eval(input()) ans = [1 for _ in range(N)] if N == 1: if X[0] == '1': print((0)) exit() else: print((1)) exit() l = X.count('1') if l == 0: for _ in range(N): print((1)) exit() if l == 1: if X[-1] == '1': for _ in range(N-1): an...
77
87
1,182
1,464
N = int(eval(input())) X = eval(input()) ans = [1 for _ in range(N)] if N == 1: if X[0] == "1": print((0)) exit() else: print((1)) exit() l = 0 for k in range(N): if X[k] == "1": l += 1 if l == 0: for _ in range(N): print((1)) exit() if l == 1: if ...
N = int(eval(input())) X = eval(input()) ans = [1 for _ in range(N)] if N == 1: if X[0] == "1": print((0)) exit() else: print((1)) exit() l = X.count("1") if l == 0: for _ in range(N): print((1)) exit() if l == 1: if X[-1] == "1": for _ in range(N - 1)...
false
11.494253
[ "-l = 0", "-for k in range(N):", "- if X[k] == \"1\":", "- l += 1", "+l = X.count(\"1\")", "-poplist = [0 for _ in range(l + 1)]", "+\"\"\"", "+poplist = [0 for _ in range(l+1)]", "- for k in range(t, l + 1, 2 * t):", "- for j in range(t):", "- if k + j > l:", "-...
false
0.075114
0.04012
1.872237
[ "s627589331", "s509743715" ]
u254871849
p03673
python
s601816984
s024714981
299
195
22,708
25,948
Accepted
Accepted
34.78
import sys input = sys.stdin.readline import collections n = int(input().rstrip()) a = [a for a in input().split()] b = collections.deque([], maxlen=n) for i in range(n): b.append(a[i]) if i % 2 == 0 else b.appendleft(a[i]) if (n - 1) % 2 == 0: b = list(reversed(b)) for elem in b: print(elem, end=' '...
import sys from collections import deque n, *a = map(int, sys.stdin.read().split()) def main(): b = deque() for i in range(n): if i & 1: b.appendleft(a[i]) else: b.append(a[i]) res = list(b) if n & 1: res = res[::-1] return res if...
13
21
321
388
import sys input = sys.stdin.readline import collections n = int(input().rstrip()) a = [a for a in input().split()] b = collections.deque([], maxlen=n) for i in range(n): b.append(a[i]) if i % 2 == 0 else b.appendleft(a[i]) if (n - 1) % 2 == 0: b = list(reversed(b)) for elem in b: print(elem, end=" ")
import sys from collections import deque n, *a = map(int, sys.stdin.read().split()) def main(): b = deque() for i in range(n): if i & 1: b.appendleft(a[i]) else: b.append(a[i]) res = list(b) if n & 1: res = res[::-1] return res if __name__ == "__m...
false
38.095238
[ "+from collections import deque", "-input = sys.stdin.readline", "-import collections", "+n, *a = map(int, sys.stdin.read().split())", "-n = int(input().rstrip())", "-a = [a for a in input().split()]", "-b = collections.deque([], maxlen=n)", "-for i in range(n):", "- b.append(a[i]) if i % 2 == 0 ...
false
0.108155
0.049463
2.186599
[ "s601816984", "s024714981" ]
u021019433
p02642
python
s363241226
s536242029
256
208
163,300
98,156
Accepted
Accepted
18.75
N = 1000001 a = [0]* N eval(input()) for x in input().split(): a[int(x)] += 1 for i in range(1, N): if a[i]: a[i + i::i] = (0 for _ in a[i + i::i]) print((a.count(1)))
N = 1000001 a = [0]* N _, s = open(0) for x in s.split(): a[int(x)] += 1 for i in range(1, N): for j in range(i + i, N, i): if a[i]: a[j] = 0 print((a.count(1)))
9
10
176
183
N = 1000001 a = [0] * N eval(input()) for x in input().split(): a[int(x)] += 1 for i in range(1, N): if a[i]: a[i + i :: i] = (0 for _ in a[i + i :: i]) print((a.count(1)))
N = 1000001 a = [0] * N _, s = open(0) for x in s.split(): a[int(x)] += 1 for i in range(1, N): for j in range(i + i, N, i): if a[i]: a[j] = 0 print((a.count(1)))
false
10
[ "-eval(input())", "-for x in input().split():", "+_, s = open(0)", "+for x in s.split():", "- if a[i]:", "- a[i + i :: i] = (0 for _ in a[i + i :: i])", "+ for j in range(i + i, N, i):", "+ if a[i]:", "+ a[j] = 0" ]
false
0.302496
3.220693
0.093923
[ "s363241226", "s536242029" ]
u061916079
p03723
python
s344552358
s718188919
161
26
12,400
2,940
Accepted
Accepted
83.85
# -*- coding: utf-8 -*- import math import sys import itertools import numpy as np import functools import collections mo = 1000000007 r = range x, y, z = list(map(int, input().split())) ret = 0 while not(x % 2 == 1 or y % 2 == 1 or z % 2 == 1): ret += 1 x, y, z = y//2+z//2, z//2+x//2, x//2+y//...
x, y, z = list(map(int, input().split())) ret = 0 while not(x % 2 == 1 or y % 2 == 1 or z % 2 == 1): ret += 1 x, y, z = y//2+z//2, z//2+x//2, x//2+y//2 if ret > 10000: ret = -1 break; print(ret)
21
11
384
228
# -*- coding: utf-8 -*- import math import sys import itertools import numpy as np import functools import collections mo = 1000000007 r = range x, y, z = list(map(int, input().split())) ret = 0 while not (x % 2 == 1 or y % 2 == 1 or z % 2 == 1): ret += 1 x, y, z = y // 2 + z // 2, z // 2 + x // 2, x // 2 + y ...
x, y, z = list(map(int, input().split())) ret = 0 while not (x % 2 == 1 or y % 2 == 1 or z % 2 == 1): ret += 1 x, y, z = y // 2 + z // 2, z // 2 + x // 2, x // 2 + y // 2 if ret > 10000: ret = -1 break print(ret)
false
47.619048
[ "-# -*- coding: utf-8 -*-", "-import math", "-import sys", "-import itertools", "-import numpy as np", "-import functools", "-import collections", "-", "-mo = 1000000007", "-r = range" ]
false
0.043623
0.035518
1.228191
[ "s344552358", "s718188919" ]
u353919145
p03352
python
s785227643
s575825266
23
18
2,940
3,064
Accepted
Accepted
21.74
X=int(eval(input())) s=[] for i in range(1,100,+1): for j in range(2,100,+1): if i**j<=X: s.append(i**j) print((max(s)))
n=int(eval(input())) a=[1] for i in range(2,33): for j in range(2,11): x=i**j if x<=1000: a.append(x) a=list(set(a)) a.sort() def binarySearch(value, xList): low=0 high=len(xList) while low!=high: mid=(low+high)//2 if xList[mid]<=value: low=mid+1 ...
8
24
138
402
X = int(eval(input())) s = [] for i in range(1, 100, +1): for j in range(2, 100, +1): if i**j <= X: s.append(i**j) print((max(s)))
n = int(eval(input())) a = [1] for i in range(2, 33): for j in range(2, 11): x = i**j if x <= 1000: a.append(x) a = list(set(a)) a.sort() def binarySearch(value, xList): low = 0 high = len(xList) while low != high: mid = (low + high) // 2 if xList[mid] <= va...
false
66.666667
[ "-X = int(eval(input()))", "-s = []", "-for i in range(1, 100, +1):", "- for j in range(2, 100, +1):", "- if i**j <= X:", "- s.append(i**j)", "-print((max(s)))", "+n = int(eval(input()))", "+a = [1]", "+for i in range(2, 33):", "+ for j in range(2, 11):", "+ x = ...
false
0.04315
0.035849
1.20367
[ "s785227643", "s575825266" ]
u633068244
p00085
python
s204663514
s679952750
430
20
4,260
4,256
Accepted
Accepted
95.35
while True: n, m = list(map(int, input().split())) if n == 0 and m == 0: break p = [ 1 for i in range(n) ] pn = n; count = 0; flag = 1 while flag == 1: for i in range(n): if p[i] == 1: count += 1 ...
while True: n, m = list(map(int, input().split())) if n == 0 and m == 0: break p = [ i+1 for i in range(n) ] np = n; a = 0 while np > 1: a = (a+m-1)%len(p) p.pop(a) np -= 1 print(p[0])
19
11
618
275
while True: n, m = list(map(int, input().split())) if n == 0 and m == 0: break p = [1 for i in range(n)] pn = n count = 0 flag = 1 while flag == 1: for i in range(n): if p[i] == 1: count += 1 if count == m: p[i] ...
while True: n, m = list(map(int, input().split())) if n == 0 and m == 0: break p = [i + 1 for i in range(n)] np = n a = 0 while np > 1: a = (a + m - 1) % len(p) p.pop(a) np -= 1 print(p[0])
false
42.105263
[ "- p = [1 for i in range(n)]", "- pn = n", "- count = 0", "- flag = 1", "- while flag == 1:", "- for i in range(n):", "- if p[i] == 1:", "- count += 1", "- if count == m:", "- p[i] = 0", "- count...
false
0.041228
0.034919
1.180685
[ "s204663514", "s679952750" ]
u562935282
p02693
python
s046981149
s763577953
24
22
9,160
9,160
Accepted
Accepted
8.33
def main(): K = int(eval(input())) A, B = list(map(int, input().split())) for x in range(A, B + 1): if x % K == 0: print('OK') return print('NG') if __name__ == '__main__': main() # import sys # input = sys.stdin.readline # # sys.setrecursionlimi...
def main(): from math import floor K = int(eval(input())) A, B = list(map(int, input().split())) multiple = floor(B / K) * K # B以下の最大のKの倍数 cond = (A <= multiple) # A以上なら範囲内にある print(('OK' if cond else 'NG')) if __name__ == '__main__': main()
30
15
586
280
def main(): K = int(eval(input())) A, B = list(map(int, input().split())) for x in range(A, B + 1): if x % K == 0: print("OK") return print("NG") if __name__ == "__main__": main() # import sys # input = sys.stdin.readline # # sys.setrecursionlimit(10 ** 7) # # (int(...
def main(): from math import floor K = int(eval(input())) A, B = list(map(int, input().split())) multiple = floor(B / K) * K # B以下の最大のKの倍数 cond = A <= multiple # A以上なら範囲内にある print(("OK" if cond else "NG")) if __name__ == "__main__": main()
false
50
[ "+ from math import floor", "+", "- for x in range(A, B + 1):", "- if x % K == 0:", "- print(\"OK\")", "- return", "- print(\"NG\")", "+ multiple = floor(B / K) * K # B以下の最大のKの倍数", "+ cond = A <= multiple # A以上なら範囲内にある", "+ print((\"OK\" if cond els...
false
0.045437
0.153867
0.295303
[ "s046981149", "s763577953" ]
u721316601
p02989
python
s917746676
s802045825
146
77
14,780
14,428
Accepted
Accepted
47.26
from collections import Counter N = int(eval(input())) d = Counter(list(map(int, input().split()))) ans = 0 l, r = 0, N for K in range(10**5+1): if l == r: ans += 1 l += d[K] r -= d[K] print(ans)
N = int(eval(input())) d = sorted(list(map(int, input().split())), reverse=True) print((d[N//2-1] - d[N//2]))
14
4
225
105
from collections import Counter N = int(eval(input())) d = Counter(list(map(int, input().split()))) ans = 0 l, r = 0, N for K in range(10**5 + 1): if l == r: ans += 1 l += d[K] r -= d[K] print(ans)
N = int(eval(input())) d = sorted(list(map(int, input().split())), reverse=True) print((d[N // 2 - 1] - d[N // 2]))
false
71.428571
[ "-from collections import Counter", "-", "-d = Counter(list(map(int, input().split())))", "-ans = 0", "-l, r = 0, N", "-for K in range(10**5 + 1):", "- if l == r:", "- ans += 1", "- l += d[K]", "- r -= d[K]", "-print(ans)", "+d = sorted(list(map(int, input().split())), reverse=...
false
0.2312
0.068535
3.373468
[ "s917746676", "s802045825" ]
u706984643
p02996
python
s966449186
s403538444
742
621
104,388
96,552
Accepted
Accepted
16.31
import math from collections import defaultdict,deque from itertools import permutations ml=lambda:list(map(int,input().split())) ll=lambda:list(map(int,input().split())) ii=lambda:int(eval(input())) ip=lambda:list(eval(input())) ips=lambda:input().split() """========main code===============""" #t=1 t=ii(...
import sys input=sys.stdin.readline import math from collections import defaultdict,deque from itertools import permutations ml=lambda:list(map(int,input().split())) ll=lambda:list(map(int,input().split())) ii=lambda:int(eval(input())) ip=lambda:list(eval(input())) ips=lambda:input().split() """========main...
30
32
564
602
import math from collections import defaultdict, deque from itertools import permutations ml = lambda: list(map(int, input().split())) ll = lambda: list(map(int, input().split())) ii = lambda: int(eval(input())) ip = lambda: list(eval(input())) ips = lambda: input().split() """========main code===============""" # t=1...
import sys input = sys.stdin.readline import math from collections import defaultdict, deque from itertools import permutations ml = lambda: list(map(int, input().split())) ll = lambda: list(map(int, input().split())) ii = lambda: int(eval(input())) ip = lambda: list(eval(input())) ips = lambda: input().split() """==...
false
6.25
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.035819
0.054285
0.659835
[ "s966449186", "s403538444" ]
u153259685
p02711
python
s356959313
s793183772
22
20
9,004
9,084
Accepted
Accepted
9.09
string=eval(input()) if "7" in string: print('Yes') else: print('No')
string=eval(input()) t=False for i in range (len(string)): if string[i]=="7": t=True if t==True: print("Yes") else: print("No")
5
9
71
140
string = eval(input()) if "7" in string: print("Yes") else: print("No")
string = eval(input()) t = False for i in range(len(string)): if string[i] == "7": t = True if t == True: print("Yes") else: print("No")
false
44.444444
[ "-if \"7\" in string:", "+t = False", "+for i in range(len(string)):", "+ if string[i] == \"7\":", "+ t = True", "+if t == True:" ]
false
0.097606
0.084064
1.161099
[ "s356959313", "s793183772" ]
u844789719
p03458
python
s412680938
s846311027
764
597
83,260
199,776
Accepted
Accepted
21.86
import itertools import numpy as np N, K, *XYC = open(0).read().split() N = int(N) K = int(K) board = np.zeros((4 * K + 1, 4 * K + 1), dtype=np.uint16) for x, y, c in zip(XYC[::3], XYC[1::3], XYC[2::3]): x = int(x) y = int(y) if c == 'W': x += K x = x % (2 * K) y = y % (2 * K) ...
import numpy as np N, K, *XYC = open(0).read().split() N = int(N) K = int(K) board = np.zeros((4 * K + 1, 4 * K + 1), dtype=np.int64) for x, y, c in zip(XYC[::3], XYC[1::3], XYC[2::3]): x = int(x) y = int(y) if c == 'W': x += K x = x % (2 * K) y = y % (2 * K) board[x, y] += 1...
28
27
941
922
import itertools import numpy as np N, K, *XYC = open(0).read().split() N = int(N) K = int(K) board = np.zeros((4 * K + 1, 4 * K + 1), dtype=np.uint16) for x, y, c in zip(XYC[::3], XYC[1::3], XYC[2::3]): x = int(x) y = int(y) if c == "W": x += K x = x % (2 * K) y = y % (2 * K) board[x, ...
import numpy as np N, K, *XYC = open(0).read().split() N = int(N) K = int(K) board = np.zeros((4 * K + 1, 4 * K + 1), dtype=np.int64) for x, y, c in zip(XYC[::3], XYC[1::3], XYC[2::3]): x = int(x) y = int(y) if c == "W": x += K x = x % (2 * K) y = y % (2 * K) board[x, y] += 1 board[...
false
3.571429
[ "-import itertools", "-board = np.zeros((4 * K + 1, 4 * K + 1), dtype=np.uint16)", "+board = np.zeros((4 * K + 1, 4 * K + 1), dtype=np.int64)" ]
false
0.460822
0.482082
0.955901
[ "s412680938", "s846311027" ]
u396368249
p03573
python
s828647353
s467655901
354
169
22,276
13,492
Accepted
Accepted
52.26
# -*- coding: utf-8 -*- import sys, copy, math, itertools from copy import * from collections import deque import numpy as np from heapq import * from bisect import * import scipy as sp A, B, C = list( map(int, input().split() ) ) if A==B: print(C) if B==C: print(A) if C==A: print(B)
# -*- coding: utf-8 -*- import sys, copy, math, itertools from copy import * from collections import deque import numpy as np from heapq import * from bisect import * import scipy as sp #from scipy.optimize import linprog from scipy import ceil, ifft from scipy.fftpack import fft A, B, C = list( map(int, i...
14
17
299
397
# -*- coding: utf-8 -*- import sys, copy, math, itertools from copy import * from collections import deque import numpy as np from heapq import * from bisect import * import scipy as sp A, B, C = list(map(int, input().split())) if A == B: print(C) if B == C: print(A) if C == A: print(B)
# -*- coding: utf-8 -*- import sys, copy, math, itertools from copy import * from collections import deque import numpy as np from heapq import * from bisect import * import scipy as sp # from scipy.optimize import linprog from scipy import ceil, ifft from scipy.fftpack import fft A, B, C = list(map(int, input().spli...
false
17.647059
[ "+# from scipy.optimize import linprog", "+from scipy import ceil, ifft", "+from scipy.fftpack import fft", "+" ]
false
0.042152
0.041986
1.003939
[ "s828647353", "s467655901" ]
u532966492
p02757
python
s809911363
s463688619
916
631
6,564
12,740
Accepted
Accepted
31.11
def main(): n, p = list(map(int, input().split())) s = list(map(int, list(eval(input())))) now = 1 now2 = 0 dp = [0]*p cnt = 0 if p != 5: for i in s: now2 = (now2*10+i) % p dp[((i-now2) % p)*pow(now, p-2, p) % p] += 1 cnt += dp[((-now2...
n,p=list(map(int,input().split()));s,n,N,c,d=list(map(int,list(eval(input())))),1,0,0,[0]*p if p!=5: for i in s:N,a=(N*10+i)%p,pow(n,p-2,p);d[(i-N)*a%p]+=1;c+=d[-N*a%p];n=n*10%p else:c=sum([j+1 for j,i in enumerate(s)if i%5==0]) print(c)
22
5
500
224
def main(): n, p = list(map(int, input().split())) s = list(map(int, list(eval(input())))) now = 1 now2 = 0 dp = [0] * p cnt = 0 if p != 5: for i in s: now2 = (now2 * 10 + i) % p dp[((i - now2) % p) * pow(now, p - 2, p) % p] += 1 cnt += dp[((-now2)...
n, p = list(map(int, input().split())) s, n, N, c, d = list(map(int, list(eval(input())))), 1, 0, 0, [0] * p if p != 5: for i in s: N, a = (N * 10 + i) % p, pow(n, p - 2, p) d[(i - N) * a % p] += 1 c += d[-N * a % p] n = n * 10 % p else: c = sum([j + 1 for j, i in enumerate(s) if...
false
77.272727
[ "-def main():", "- n, p = list(map(int, input().split()))", "- s = list(map(int, list(eval(input()))))", "- now = 1", "- now2 = 0", "- dp = [0] * p", "- cnt = 0", "- if p != 5:", "- for i in s:", "- now2 = (now2 * 10 + i) % p", "- dp[((i - now2) ...
false
0.036077
0.034399
1.04879
[ "s809911363", "s463688619" ]
u179304833
p02659
python
s301867252
s433367605
27
24
10,076
9,116
Accepted
Accepted
11.11
import math import decimal x,y = list(map(decimal.Decimal,input().split())) print((math.floor(x*y)))
x,y = list(map(str,input().split())) yy=y.replace(".","") xy=str(int(x)*int(yy)) print((xy[:len(xy)-2] if len(xy)>2 else 0))
4
4
101
126
import math import decimal x, y = list(map(decimal.Decimal, input().split())) print((math.floor(x * y)))
x, y = list(map(str, input().split())) yy = y.replace(".", "") xy = str(int(x) * int(yy)) print((xy[: len(xy) - 2] if len(xy) > 2 else 0))
false
0
[ "-import math", "-import decimal", "-", "-x, y = list(map(decimal.Decimal, input().split()))", "-print((math.floor(x * y)))", "+x, y = list(map(str, input().split()))", "+yy = y.replace(\".\", \"\")", "+xy = str(int(x) * int(yy))", "+print((xy[: len(xy) - 2] if len(xy) > 2 else 0))" ]
false
0.17639
0.05476
3.221125
[ "s301867252", "s433367605" ]
u761320129
p03427
python
s425487357
s282644720
30
26
9,144
9,128
Accepted
Accepted
13.33
N = eval(input()) ans = sum(int(c) for c in N) for i in range(1,len(N)): t = sum(int(c) for c in N[:i]) - 1 + 9 * (len(N) - i) ans = max(ans, t) print(ans)
S = eval(input()) N = int(S) ans = sum(map(int,S)) for i in range(1,len(S)): n = str(int(S[:i]) - 1) t = sum(map(int,n)) + 9*(len(S)-i) ans = max(ans,t) print(ans)
7
9
164
178
N = eval(input()) ans = sum(int(c) for c in N) for i in range(1, len(N)): t = sum(int(c) for c in N[:i]) - 1 + 9 * (len(N) - i) ans = max(ans, t) print(ans)
S = eval(input()) N = int(S) ans = sum(map(int, S)) for i in range(1, len(S)): n = str(int(S[:i]) - 1) t = sum(map(int, n)) + 9 * (len(S) - i) ans = max(ans, t) print(ans)
false
22.222222
[ "-N = eval(input())", "-ans = sum(int(c) for c in N)", "-for i in range(1, len(N)):", "- t = sum(int(c) for c in N[:i]) - 1 + 9 * (len(N) - i)", "+S = eval(input())", "+N = int(S)", "+ans = sum(map(int, S))", "+for i in range(1, len(S)):", "+ n = str(int(S[:i]) - 1)", "+ t = sum(map(int, ...
false
0.037275
0.037289
0.999629
[ "s425487357", "s282644720" ]
u940568210
p03379
python
s206922318
s047932205
1,140
318
35,724
29,972
Accepted
Accepted
72.11
import numpy as np n = int(eval(input())) x_str = input().split() xs = np.array([int(c) for c in x_str]) xs_len = len(xs) center = (xs_len - 1)//2 c_xs = np.sort(xs) for x in xs: if x <= c_xs[center]: print((c_xs[center+1])) else: print((c_xs[center]))
n = int(eval(input())) x_str = input().split() xs = [int(c) for c in x_str] xs_len = len(xs) center = (xs_len - 1)//2 c_xs = xs[:] c_xs.sort() for x in xs: if x <= c_xs[center]: print((c_xs[center+1])) else: print((c_xs[center]))
17
16
288
263
import numpy as np n = int(eval(input())) x_str = input().split() xs = np.array([int(c) for c in x_str]) xs_len = len(xs) center = (xs_len - 1) // 2 c_xs = np.sort(xs) for x in xs: if x <= c_xs[center]: print((c_xs[center + 1])) else: print((c_xs[center]))
n = int(eval(input())) x_str = input().split() xs = [int(c) for c in x_str] xs_len = len(xs) center = (xs_len - 1) // 2 c_xs = xs[:] c_xs.sort() for x in xs: if x <= c_xs[center]: print((c_xs[center + 1])) else: print((c_xs[center]))
false
5.882353
[ "-import numpy as np", "-", "-xs = np.array([int(c) for c in x_str])", "+xs = [int(c) for c in x_str]", "-c_xs = np.sort(xs)", "+c_xs = xs[:]", "+c_xs.sort()" ]
false
0.287624
0.039268
7.324556
[ "s206922318", "s047932205" ]
u545368057
p03576
python
s111477974
s660486000
690
143
9,292
74,520
Accepted
Accepted
79.28
""" 座標圧縮 2D累積和 全探索 勝利 """ n, k = list(map(int,input().split())) xs = set() ys = set() ps = [] # 座圧 for _ in range(n): x,y = list(map(int,input().split())) ps.append((x,y)) xs.add(x) ys.add(y) xdic = {x:i for i,x in enumerate(sorted(list(xs)))} ydic = {y:i for i,y in enumerate(sorted(lis...
n,k = list(map(int, input().split())) xs = [] ys = [] ps = [] for i in range(n): x,y = list(map(int, input().split())) xs.append(x) ys.append(y) ps.append((x,y)) # 座圧 xs = sorted(list(set(xs))) ys = sorted(list(set(ys))) xdic = {x:i for i, x in enumerate(xs)} ydic = {y:i for i, y in enumera...
54
49
1,356
1,236
""" 座標圧縮 2D累積和 全探索 勝利 """ n, k = list(map(int, input().split())) xs = set() ys = set() ps = [] # 座圧 for _ in range(n): x, y = list(map(int, input().split())) ps.append((x, y)) xs.add(x) ys.add(y) xdic = {x: i for i, x in enumerate(sorted(list(xs)))} ydic = {y: i for i, y in enumerate(sorted(list(ys)))} ...
n, k = list(map(int, input().split())) xs = [] ys = [] ps = [] for i in range(n): x, y = list(map(int, input().split())) xs.append(x) ys.append(y) ps.append((x, y)) # 座圧 xs = sorted(list(set(xs))) ys = sorted(list(set(ys))) xdic = {x: i for i, x in enumerate(xs)} ydic = {y: i for i, y in enumerate(ys)} ...
false
9.259259
[ "-\"\"\"", "-座標圧縮", "-2D累積和", "-全探索", "-勝利", "-\"\"\"", "-xs = set()", "-ys = set()", "+xs = []", "+ys = []", "+for i in range(n):", "+ x, y = list(map(int, input().split()))", "+ xs.append(x)", "+ ys.append(y)", "+ ps.append((x, y))", "-for _ in range(n):", "- x, y = ...
false
0.046911
0.038593
1.215527
[ "s111477974", "s660486000" ]
u762540523
p03722
python
s645502066
s221188057
850
762
3,700
3,828
Accepted
Accepted
10.35
def resolve(): n, m = list(map(int, input().split())) a = [list(map(int, input().split())) for i in range(m)] a = [[x, y, -z] for x, y, z in a] print((BF(a, n, 1)[-1])) def BF(p, n, s): inf = float("inf") d = [inf for i in range(n)] d[s-1] = 0 for i in range(n+1): f...
def BellmanFord(): def BF(s, n, edge, inf=float("inf")): d = [inf for i in range(n)] d[s] = 0 for i in range(n): for before, after, dist in edge: if before != inf: d[after] = min(d[after], d[before] + dist) if i == n - 2: ...
24
22
625
789
def resolve(): n, m = list(map(int, input().split())) a = [list(map(int, input().split())) for i in range(m)] a = [[x, y, -z] for x, y, z in a] print((BF(a, n, 1)[-1])) def BF(p, n, s): inf = float("inf") d = [inf for i in range(n)] d[s - 1] = 0 for i in range(n + 1): for e in ...
def BellmanFord(): def BF(s, n, edge, inf=float("inf")): d = [inf for i in range(n)] d[s] = 0 for i in range(n): for before, after, dist in edge: if before != inf: d[after] = min(d[after], d[before] + dist) if i == n - 2: ...
false
8.333333
[ "-def resolve():", "+def BellmanFord():", "+ def BF(s, n, edge, inf=float(\"inf\")):", "+ d = [inf for i in range(n)]", "+ d[s] = 0", "+ for i in range(n):", "+ for before, after, dist in edge:", "+ if before != inf:", "+ d[after] ...
false
0.048917
0.048165
1.015622
[ "s645502066", "s221188057" ]
u867826040
p03425
python
s370501264
s239275998
52
48
9,052
9,024
Accepted
Accepted
7.69
from itertools import combinations as cmbs from sys import stdin c = {"M":0,"A":0,"R":0,"C":0,"H":0} for si in [s[0] for s in stdin]: if si in c: c[si] += 1 print((sum(i*j*k for i,j,k in cmbs(list(c.values()),r=3))))
from itertools import combinations as cmbs from sys import stdin def main(): c = {"M":0,"A":0,"R":0,"C":0,"H":0} for si in [s[0] for s in stdin]: if si in c: c[si] += 1 print((sum(i*j*k for i,j,k in cmbs(list(c.values()),r=3)))) main()
7
13
230
279
from itertools import combinations as cmbs from sys import stdin c = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} for si in [s[0] for s in stdin]: if si in c: c[si] += 1 print((sum(i * j * k for i, j, k in cmbs(list(c.values()), r=3))))
from itertools import combinations as cmbs from sys import stdin def main(): c = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} for si in [s[0] for s in stdin]: if si in c: c[si] += 1 print((sum(i * j * k for i, j, k in cmbs(list(c.values()), r=3)))) main()
false
46.153846
[ "-c = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}", "-for si in [s[0] for s in stdin]:", "- if si in c:", "- c[si] += 1", "-print((sum(i * j * k for i, j, k in cmbs(list(c.values()), r=3))))", "+", "+def main():", "+ c = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}", "+ ...
false
0.048576
0.045555
1.066301
[ "s370501264", "s239275998" ]
u344065503
p02947
python
s351821228
s705398291
635
266
75,096
99,860
Accepted
Accepted
58.11
import collections n=int(eval(input())) ans=0 s=["".join(sorted(eval(input()))) for _ in range(n)] c=collections.Counter(s) for i in set(s): a=c[i] ans+=a*(a-1)//2 print(ans)
n=int(eval(input())) dictionary={} count=0 for i in range(n): s="".join(sorted(eval(input()))) if s in dictionary: dictionary[s]+=1 count+=dictionary[s] else: dictionary[s]=0 print(count)
9
11
175
222
import collections n = int(eval(input())) ans = 0 s = ["".join(sorted(eval(input()))) for _ in range(n)] c = collections.Counter(s) for i in set(s): a = c[i] ans += a * (a - 1) // 2 print(ans)
n = int(eval(input())) dictionary = {} count = 0 for i in range(n): s = "".join(sorted(eval(input()))) if s in dictionary: dictionary[s] += 1 count += dictionary[s] else: dictionary[s] = 0 print(count)
false
18.181818
[ "-import collections", "-", "-ans = 0", "-s = [\"\".join(sorted(eval(input()))) for _ in range(n)]", "-c = collections.Counter(s)", "-for i in set(s):", "- a = c[i]", "- ans += a * (a - 1) // 2", "-print(ans)", "+dictionary = {}", "+count = 0", "+for i in range(n):", "+ s = \"\".joi...
false
0.03215
0.031446
1.022402
[ "s351821228", "s705398291" ]
u969850098
p02803
python
s107250772
s408925098
410
361
3,316
3,316
Accepted
Accepted
11.95
from collections import deque def main(): H, W = list(map(int, input().split())) maze = [list(eval(input())) for _ in range(H)] ans = 0 for h in range(H): for w in range(W): if maze[h][w] == '#': continue goal_dists = [[-1] * W for _ in rang...
from collections import deque def main(): H, W = list(map(int, input().split())) maze = [list(eval(input())) for _ in range(H)] directions = [[0, 1], [0, -1], [1, 0], [-1, 0]] ans = 0 for h in range(H): for w in range(W): if maze[h][w] == '#': continu...
33
34
1,011
1,040
from collections import deque def main(): H, W = list(map(int, input().split())) maze = [list(eval(input())) for _ in range(H)] ans = 0 for h in range(H): for w in range(W): if maze[h][w] == "#": continue goal_dists = [[-1] * W for _ in range(H)] ...
from collections import deque def main(): H, W = list(map(int, input().split())) maze = [list(eval(input())) for _ in range(H)] directions = [[0, 1], [0, -1], [1, 0], [-1, 0]] ans = 0 for h in range(H): for w in range(W): if maze[h][w] == "#": continue ...
false
2.941176
[ "+ directions = [[0, 1], [0, -1], [1, 0], [-1, 0]]", "- for dh, dw in [[0, 1], [0, -1], [1, 0], [-1, 0]]:", "+ for dh, dw in directions:" ]
false
0.039142
0.043148
0.907173
[ "s107250772", "s408925098" ]
u836737505
p02714
python
s949560844
s421433153
402
305
73,880
73,700
Accepted
Accepted
24.13
n = int(eval(input())) s = eval(input()) r = s.count("R") g = s.count("G") b = s.count("B") c = 0 for i in range(n): for j in range(1,int((n-i-1)/2)+1): if len(set([s[i],s[i+j],s[i+j+j]])) == 3: c += 1 print(((r*g*b) - c))
n = int(eval(input())) s = list(eval(input())) r = s.count("R") g = s.count("G") b = s.count("B") c = 0 for i in range(n): j = 1 while i+j+j+1 <= n: if len(set([s[i],s[i+j],s[i+j+j]]))==3: c += 1 j += 1 print((r*g*b - c))
11
13
242
256
n = int(eval(input())) s = eval(input()) r = s.count("R") g = s.count("G") b = s.count("B") c = 0 for i in range(n): for j in range(1, int((n - i - 1) / 2) + 1): if len(set([s[i], s[i + j], s[i + j + j]])) == 3: c += 1 print(((r * g * b) - c))
n = int(eval(input())) s = list(eval(input())) r = s.count("R") g = s.count("G") b = s.count("B") c = 0 for i in range(n): j = 1 while i + j + j + 1 <= n: if len(set([s[i], s[i + j], s[i + j + j]])) == 3: c += 1 j += 1 print((r * g * b - c))
false
15.384615
[ "-s = eval(input())", "+s = list(eval(input()))", "- for j in range(1, int((n - i - 1) / 2) + 1):", "+ j = 1", "+ while i + j + j + 1 <= n:", "-print(((r * g * b) - c))", "+ j += 1", "+print((r * g * b - c))" ]
false
0.077914
0.116015
0.671589
[ "s949560844", "s421433153" ]
u077291787
p02832
python
s234416373
s714202610
162
84
25,116
25,116
Accepted
Accepted
48.15
# ABC148D - Brick Break def main(): N, *A = list(map(int, open(0).read().split())) remaining = 0 cur = 0 # current index for target in range(1, N + 1): be_kept = False for i in range(cur, N): if A[i] == target: remaining += 1 cur = i...
# ABC148D - Brick Break def main(): N, *A = list(map(int, open(0).read().split())) remaining = 0 target = 1 for i in A: if i == target: remaining += 1 target += 1 print((N - remaining if remaining else -1)) if __name__ == "__main__": main()
20
14
509
304
# ABC148D - Brick Break def main(): N, *A = list(map(int, open(0).read().split())) remaining = 0 cur = 0 # current index for target in range(1, N + 1): be_kept = False for i in range(cur, N): if A[i] == target: remaining += 1 cur = i + 1 ...
# ABC148D - Brick Break def main(): N, *A = list(map(int, open(0).read().split())) remaining = 0 target = 1 for i in A: if i == target: remaining += 1 target += 1 print((N - remaining if remaining else -1)) if __name__ == "__main__": main()
false
30
[ "- cur = 0 # current index", "- for target in range(1, N + 1):", "- be_kept = False", "- for i in range(cur, N):", "- if A[i] == target:", "- remaining += 1", "- cur = i + 1", "- be_kept = True", "- break", ...
false
0.038996
0.036689
1.062861
[ "s234416373", "s714202610" ]
u620084012
p03835
python
s586889129
s675364044
1,892
244
2,940
40,940
Accepted
Accepted
87.1
K, S = list(map(int,input().split())) ans = 0 for k in range(K+1): for j in range(S-k+1): if j <= K and 0 <= S-k-j <= K: ans += 1 print(ans)
K, S = list(map(int,input().split())) ans = 0 for X in range(K+1): for Y in range(K+1): if 0 <= S-(X+Y) <= K: ans += 1 print(ans)
8
7
166
154
K, S = list(map(int, input().split())) ans = 0 for k in range(K + 1): for j in range(S - k + 1): if j <= K and 0 <= S - k - j <= K: ans += 1 print(ans)
K, S = list(map(int, input().split())) ans = 0 for X in range(K + 1): for Y in range(K + 1): if 0 <= S - (X + Y) <= K: ans += 1 print(ans)
false
12.5
[ "-for k in range(K + 1):", "- for j in range(S - k + 1):", "- if j <= K and 0 <= S - k - j <= K:", "+for X in range(K + 1):", "+ for Y in range(K + 1):", "+ if 0 <= S - (X + Y) <= K:" ]
false
0.036978
0.044103
0.838447
[ "s586889129", "s675364044" ]
u665238221
p02269
python
s534665363
s736281271
4,580
1,130
30,992
31,412
Accepted
Accepted
75.33
n = int(eval(input())) d = set() for _ in range(n): c, s = input().split() if c == 'insert': d.add(s) else: print(('yes' if s in d else 'no'))
import sys n = int(eval(input())) d = set() for i in sys.stdin: c, s = i.split() if c == 'insert': d.add(s) else: print(('yes' if s in d else 'no'))
8
9
170
177
n = int(eval(input())) d = set() for _ in range(n): c, s = input().split() if c == "insert": d.add(s) else: print(("yes" if s in d else "no"))
import sys n = int(eval(input())) d = set() for i in sys.stdin: c, s = i.split() if c == "insert": d.add(s) else: print(("yes" if s in d else "no"))
false
11.111111
[ "+import sys", "+", "-for _ in range(n):", "- c, s = input().split()", "+for i in sys.stdin:", "+ c, s = i.split()" ]
false
0.040128
0.036158
1.109804
[ "s534665363", "s736281271" ]
u971091945
p02630
python
s970177370
s039808596
574
410
24,000
40,324
Accepted
Accepted
28.57
import collections n = int(eval(input())) a = list(map(int, input().split())) q = int(eval(input())) d = collections.Counter(a) ans = sum(a) for i in range(q): b, c = list(map(int, input().split())) num = (c-b)*d[b] ans += num print(ans) d[c] += d[b] d[b] = 0
import collections n = int(eval(input())) a = list(map(int, input().split())) q = int(eval(input())) bc = [] for i in range(q): bci = list(map(int, input().split())) bc.append(bci) d = collections.Counter(a) ans = sum(a) for i in range(q): b, c = bc[i] num = (c-b)*d[b] ans += ...
16
22
283
359
import collections n = int(eval(input())) a = list(map(int, input().split())) q = int(eval(input())) d = collections.Counter(a) ans = sum(a) for i in range(q): b, c = list(map(int, input().split())) num = (c - b) * d[b] ans += num print(ans) d[c] += d[b] d[b] = 0
import collections n = int(eval(input())) a = list(map(int, input().split())) q = int(eval(input())) bc = [] for i in range(q): bci = list(map(int, input().split())) bc.append(bci) d = collections.Counter(a) ans = sum(a) for i in range(q): b, c = bc[i] num = (c - b) * d[b] ans += num print(ans)...
false
27.272727
[ "+bc = []", "+for i in range(q):", "+ bci = list(map(int, input().split()))", "+ bc.append(bci)", "- b, c = list(map(int, input().split()))", "+ b, c = bc[i]" ]
false
0.035674
0.045042
0.79201
[ "s970177370", "s039808596" ]
u226108478
p02582
python
s846513319
s787141780
29
24
8,948
8,924
Accepted
Accepted
17.24
# -*- coding: utf-8 -*- def main(): s = eval(input()) # See: # https://atcoder.jp/contests/abc175/editorial/51 # 1. 各文字がRと一致しているか # 2. 何文字一致しているか、を条件分岐 first = s[0] == 'R' second = s[1] == 'R' third = s[2] == 'R' if first and second and third: print((3)) ...
# -*- coding: utf-8 -*- def main(): s = eval(input()) # See: # https://atcoder.jp/contests/abc175/submissions/15907467 # Pythonのシンタックスを活用 if 'RRR' in s: print((3)) elif 'RR' in s: print((2)) elif 'R' in s: print((1)) else: print((0)) ...
26
21
509
347
# -*- coding: utf-8 -*- def main(): s = eval(input()) # See: # https://atcoder.jp/contests/abc175/editorial/51 # 1. 各文字がRと一致しているか # 2. 何文字一致しているか、を条件分岐 first = s[0] == "R" second = s[1] == "R" third = s[2] == "R" if first and second and third: print((3)) elif (first and s...
# -*- coding: utf-8 -*- def main(): s = eval(input()) # See: # https://atcoder.jp/contests/abc175/submissions/15907467 # Pythonのシンタックスを活用 if "RRR" in s: print((3)) elif "RR" in s: print((2)) elif "R" in s: print((1)) else: print((0)) if __name__ == "__ma...
false
19.230769
[ "- # https://atcoder.jp/contests/abc175/editorial/51", "- # 1. 各文字がRと一致しているか", "- # 2. 何文字一致しているか、を条件分岐", "- first = s[0] == \"R\"", "- second = s[1] == \"R\"", "- third = s[2] == \"R\"", "- if first and second and third:", "+ # https://atcoder.jp/contests/abc175/submissions/15...
false
0.134898
0.037538
3.593661
[ "s846513319", "s787141780" ]
u280552586
p02912
python
s785319027
s864958606
165
141
14,204
20,404
Accepted
Accepted
14.55
import heapq import sys input = sys.stdin.readline n, m = list(map(int, input().split())) A = list(map(int, input().split())) A = list([x*(-1) for x in A]) heapq.heapify(A) for _ in range(m): max_price = -heapq.heappop(A) // 2 heapq.heappush(A, -max_price) total = -sum(A) print(total)
import heapq n, m = list(map(int, input().split())) A = list([-int(x) for x in input().split()]) heapq.heapify(A) for _ in range(m): max_price = -heapq.heappop(A) // 2 heapq.heappush(A, -max_price) total = -sum(A) print(total)
15
10
304
244
import heapq import sys input = sys.stdin.readline n, m = list(map(int, input().split())) A = list(map(int, input().split())) A = list([x * (-1) for x in A]) heapq.heapify(A) for _ in range(m): max_price = -heapq.heappop(A) // 2 heapq.heappush(A, -max_price) total = -sum(A) print(total)
import heapq n, m = list(map(int, input().split())) A = list([-int(x) for x in input().split()]) heapq.heapify(A) for _ in range(m): max_price = -heapq.heappop(A) // 2 heapq.heappush(A, -max_price) total = -sum(A) print(total)
false
33.333333
[ "-import sys", "-input = sys.stdin.readline", "-A = list(map(int, input().split()))", "-A = list([x * (-1) for x in A])", "+A = list([-int(x) for x in input().split()])" ]
false
0.041152
0.041019
1.003257
[ "s785319027", "s864958606" ]
u702582248
p02918
python
s258130366
s496989523
176
41
39,408
3,564
Accepted
Accepted
76.7
from collections import Counter mod = 1000000007 def inverse(a): return pow(a, mod - 2, mod) def usearch(x, a): lft = 0 rgt = len(a) + 1 while rgt - lft > 1: mid = (rgt + lft) // 2 if a[mid] <= x: lft = mid else: rgt = mid return l...
from collections import Counter mod = 1000000007 def inverse(a): return pow(a, mod - 2, mod) def usearch(x, a): lft = 0 rgt = len(a) + 1 while rgt - lft > 1: mid = (rgt + lft) // 2 if a[mid] <= x: lft = mid else: rgt = mid return l...
39
33
665
576
from collections import Counter mod = 1000000007 def inverse(a): return pow(a, mod - 2, mod) def usearch(x, a): lft = 0 rgt = len(a) + 1 while rgt - lft > 1: mid = (rgt + lft) // 2 if a[mid] <= x: lft = mid else: rgt = mid return lft def main():...
from collections import Counter mod = 1000000007 def inverse(a): return pow(a, mod - 2, mod) def usearch(x, a): lft = 0 rgt = len(a) + 1 while rgt - lft > 1: mid = (rgt + lft) // 2 if a[mid] <= x: lft = mid else: rgt = mid return lft def main():...
false
15.384615
[ "- while cnt >= 2 and k > 0:", "- ans += 2", "- cnt -= 2", "- k -= 1", "- if k > 0 and cnt > 0:", "- ans += 1", "+ ans += k * 2", "+ ans = min(ans, n - 1)" ]
false
0.007275
0.038035
0.191262
[ "s258130366", "s496989523" ]
u130900604
p02659
python
s928000566
s803917682
91
61
77,644
61,736
Accepted
Accepted
32.97
def LI():return list(map(int,input().split())) def yes():return print("Yes") def no():return print("No") from collections import deque, defaultdict, Counter from heapq import heappop, heappush import math from decimal import Decimal # pi=math.pi # print(pi) # yes() # no() # n=int(input()) # s=input() a,b...
a,b=input().split() b=b.replace(".","") a=int(a) b=int(b) ans=a*b//100 print(ans)
19
6
412
86
def LI(): return list(map(int, input().split())) def yes(): return print("Yes") def no(): return print("No") from collections import deque, defaultdict, Counter from heapq import heappop, heappush import math from decimal import Decimal # pi=math.pi # print(pi) # yes() # no() # n=int(input()) # s=inp...
a, b = input().split() b = b.replace(".", "") a = int(a) b = int(b) ans = a * b // 100 print(ans)
false
68.421053
[ "-def LI():", "- return list(map(int, input().split()))", "-", "-", "-def yes():", "- return print(\"Yes\")", "-", "-", "-def no():", "- return print(\"No\")", "-", "-", "-from collections import deque, defaultdict, Counter", "-from heapq import heappop, heappush", "-import math...
false
0.04529
0.038669
1.171223
[ "s928000566", "s803917682" ]
u901582103
p03212
python
s417868993
s776025056
62
44
4,072
3,060
Accepted
Accepted
29.03
import sys sys.setrecursionlimit(100000) n=int(eval(input())) m=len(str(n)) L=[] def dfs(i,num): if i==m+1: return if 0<i<m+1: if len(set(num))==3 and int(num)<=n: L.append(int(num)) dfs(i+1,num+'3') dfs(i+1,num+'5') dfs(i+1,num+'7') dfs(0,'') print((len(L)...
n=int(eval(input())) m=len(str(n)) r=0 def dfs(i,s): global r if len(set(s))==3 and int(s)<=n: r+=1 if i==m: return dfs(i+1,'3'+s) dfs(i+1,'5'+s) dfs(i+1,'7'+s) dfs(0,'') print(r)
16
16
314
230
import sys sys.setrecursionlimit(100000) n = int(eval(input())) m = len(str(n)) L = [] def dfs(i, num): if i == m + 1: return if 0 < i < m + 1: if len(set(num)) == 3 and int(num) <= n: L.append(int(num)) dfs(i + 1, num + "3") dfs(i + 1, num + "5") dfs(i + 1, num + "7")...
n = int(eval(input())) m = len(str(n)) r = 0 def dfs(i, s): global r if len(set(s)) == 3 and int(s) <= n: r += 1 if i == m: return dfs(i + 1, "3" + s) dfs(i + 1, "5" + s) dfs(i + 1, "7" + s) dfs(0, "") print(r)
false
0
[ "-import sys", "-", "-sys.setrecursionlimit(100000)", "-L = []", "+r = 0", "-def dfs(i, num):", "- if i == m + 1:", "+def dfs(i, s):", "+ global r", "+ if len(set(s)) == 3 and int(s) <= n:", "+ r += 1", "+ if i == m:", "- if 0 < i < m + 1:", "- if len(set(num))...
false
0.06365
0.112628
0.565129
[ "s417868993", "s776025056" ]
u021019433
p03014
python
s414801709
s391287788
1,083
996
99,032
142,680
Accepted
Accepted
8.03
from itertools import chain h, w = list(map(int, input().split())) s = [eval(input()) for _ in range(h)] a = [[-1] * w for _ in range(h)] for i in range(h): p = 0 while p < w: j = p while j < w and s[i][j] == '.': j += 1 for k in range(p, j): a[i][k] ...
h, w = list(map(int, input().split())) s = [eval(input()) for _ in range(h)] a = [[None] * w for _ in range(h)] for i in range(h): p = 0 while p < w: j = p while j < w and s[i][j] == '.': j += 1 for k in range(p, j): a[i][k] = j - p p = j + 1 r...
26
24
581
545
from itertools import chain h, w = list(map(int, input().split())) s = [eval(input()) for _ in range(h)] a = [[-1] * w for _ in range(h)] for i in range(h): p = 0 while p < w: j = p while j < w and s[i][j] == ".": j += 1 for k in range(p, j): a[i][k] += j - p ...
h, w = list(map(int, input().split())) s = [eval(input()) for _ in range(h)] a = [[None] * w for _ in range(h)] for i in range(h): p = 0 while p < w: j = p while j < w and s[i][j] == ".": j += 1 for k in range(p, j): a[i][k] = j - p p = j + 1 r = 0 for j i...
false
7.692308
[ "-from itertools import chain", "-", "-a = [[-1] * w for _ in range(h)]", "+a = [[None] * w for _ in range(h)]", "- a[i][k] += j - p", "+ a[i][k] = j - p", "+r = 0", "- a[k][j] += i - p", "+ r = max(r, a[k][j] + i - p - 1)", "-print((max(chain.from_itera...
false
0.077918
0.078722
0.989792
[ "s414801709", "s391287788" ]
u729938879
p03108
python
s343070947
s593681687
965
830
38,520
21,692
Accepted
Accepted
13.99
N, M =list(map(int, input().split())) a, b = [], [] for i in range(M): a_i, b_i = list(map(int, input().split())) a.append(a_i -1) b.append(b_i -1) class UnionFind: def __init__(self, n): self.p = {} self.r = {} self.s = {} for i in range(n): ...
class UnionFind: def __init__(self, n): self.p = [i for i in range(n)] self.s = [1 for i in range(n)] def find(self, x): if x == self.p[x]: return x else: self.p[x] = self.find(self.p[x]) return self.p[x] def union...
63
53
1,578
1,285
N, M = list(map(int, input().split())) a, b = [], [] for i in range(M): a_i, b_i = list(map(int, input().split())) a.append(a_i - 1) b.append(b_i - 1) class UnionFind: def __init__(self, n): self.p = {} self.r = {} self.s = {} for i in range(n): self.p[i] = ...
class UnionFind: def __init__(self, n): self.p = [i for i in range(n)] self.s = [1 for i in range(n)] def find(self, x): if x == self.p[x]: return x else: self.p[x] = self.find(self.p[x]) return self.p[x] def union(self, a, b): ap...
false
15.873016
[ "+class UnionFind:", "+ def __init__(self, n):", "+ self.p = [i for i in range(n)]", "+ self.s = [1 for i in range(n)]", "+", "+ def find(self, x):", "+ if x == self.p[x]:", "+ return x", "+ else:", "+ self.p[x] = self.find(self.p[x])", "+ ...
false
0.047818
0.04731
1.010722
[ "s343070947", "s593681687" ]
u775681539
p02813
python
s639748773
s361196980
35
27
3,060
3,064
Accepted
Accepted
22.86
#python3 from itertools import permutations n=int(eval(input())) p=[int(i) for i in input().split()] q=[int(i) for i in input().split()] def f(lis): cnt=0 for i in permutations(list(range(1,n+1))): cnt+=1 if i == tuple(lis): return cnt print((abs(f(p)-f(q))))
def main(): n = int(eval(input())) p = tuple(int(i) for i in input().split()) q = tuple(int(i) for i in input().split()) from itertools import permutations a = [i for i in range(1, n+1)] o1 = -1 o2 = -1 cnt = 0 for i in permutations(a): cnt += 1 if i == p: ...
14
18
279
416
# python3 from itertools import permutations n = int(eval(input())) p = [int(i) for i in input().split()] q = [int(i) for i in input().split()] def f(lis): cnt = 0 for i in permutations(list(range(1, n + 1))): cnt += 1 if i == tuple(lis): return cnt print((abs(f(p) - f(q))))
def main(): n = int(eval(input())) p = tuple(int(i) for i in input().split()) q = tuple(int(i) for i in input().split()) from itertools import permutations a = [i for i in range(1, n + 1)] o1 = -1 o2 = -1 cnt = 0 for i in permutations(a): cnt += 1 if i == p: ...
false
22.222222
[ "-# python3", "-from itertools import permutations", "+def main():", "+ n = int(eval(input()))", "+ p = tuple(int(i) for i in input().split())", "+ q = tuple(int(i) for i in input().split())", "+ from itertools import permutations", "-n = int(eval(input()))", "-p = [int(i) for i in input...
false
0.128284
0.049409
2.596357
[ "s639748773", "s361196980" ]
u001024152
p03112
python
s949757477
s077235790
1,823
942
14,204
12,816
Accepted
Accepted
48.33
# D from bisect import bisect_right A,B,Q = list(map(int, input().split())) INF = float('inf') s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF] t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF] for q in range(Q): x = int(eval(input())) b,d = bisect_right(s, x), bisect_right(t, x) ...
# D from bisect import bisect_right import sys input = sys.stdin.readline A,B,Q = list(map(int, input().split())) INF = float('inf') s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF] t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF] for q in range(Q): x = int(eval(input())) b,d = b...
16
18
568
608
# D from bisect import bisect_right A, B, Q = list(map(int, input().split())) INF = float("inf") s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF] t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF] for q in range(Q): x = int(eval(input())) b, d = bisect_right(s, x), bisect_right(t, x) an...
# D from bisect import bisect_right import sys input = sys.stdin.readline A, B, Q = list(map(int, input().split())) INF = float("inf") s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF] t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF] for q in range(Q): x = int(eval(input())) b, d = bisect_...
false
11.111111
[ "+import sys", "+input = sys.stdin.readline" ]
false
0.03829
0.033594
1.139797
[ "s949757477", "s077235790" ]
u754022296
p03725
python
s330616025
s609518098
1,907
1,754
83,076
83,140
Accepted
Accepted
8.02
import sys input = sys.stdin.readline from collections import deque h, w, k = list(map(int, input().split())) A = [input().rstrip() for _ in range(h)] for i, a in enumerate(A): if "S" in a: sy = i sx = a.index("S") break que = deque() D = ((-1, 0), (0, -1), (1, 0), (0, 1)) def bf...
import sys input = sys.stdin.readline from collections import deque def main(): h, w, k = list(map(int, input().split())) A = [input().rstrip() for _ in range(h)] for i, a in enumerate(A): if "S" in a: sy = i sx = a.index("S") break que = deque() D = ((-1, 0), (0, -1), (1...
52
56
1,120
1,251
import sys input = sys.stdin.readline from collections import deque h, w, k = list(map(int, input().split())) A = [input().rstrip() for _ in range(h)] for i, a in enumerate(A): if "S" in a: sy = i sx = a.index("S") break que = deque() D = ((-1, 0), (0, -1), (1, 0), (0, 1)) def bfs(y, x):...
import sys input = sys.stdin.readline from collections import deque def main(): h, w, k = list(map(int, input().split())) A = [input().rstrip() for _ in range(h)] for i, a in enumerate(A): if "S" in a: sy = i sx = a.index("S") break que = deque() D = ((...
false
7.142857
[ "-h, w, k = list(map(int, input().split()))", "-A = [input().rstrip() for _ in range(h)]", "-for i, a in enumerate(A):", "- if \"S\" in a:", "- sy = i", "- sx = a.index(\"S\")", "- break", "-que = deque()", "-D = ((-1, 0), (0, -1), (1, 0), (0, 1))", "+", "+def main():", ...
false
0.107155
0.039037
2.744994
[ "s330616025", "s609518098" ]
u353919145
p02923
python
s806519124
s470825342
102
87
11,136
14,252
Accepted
Accepted
14.71
n = int(eval(input())) x = input().split() y = [0] c = 0 for i in range(n-1): if int(x[i]) >= int(x[i+1]): c = c + 1 else: y.append(c) c = 0 y.append(c) print((max(y)))
n = int(eval(input())) alturas = list(map(int, input().split())) if n == 1: print((0)) else: atual = 0 max_value = 0 contador = 0 while atual + 1 < n: if alturas[atual] >= alturas[atual+1]: contador += 1 else: max_value = max(contador, max_value) contador = 0 atual += 1 max_value =...
12
18
187
357
n = int(eval(input())) x = input().split() y = [0] c = 0 for i in range(n - 1): if int(x[i]) >= int(x[i + 1]): c = c + 1 else: y.append(c) c = 0 y.append(c) print((max(y)))
n = int(eval(input())) alturas = list(map(int, input().split())) if n == 1: print((0)) else: atual = 0 max_value = 0 contador = 0 while atual + 1 < n: if alturas[atual] >= alturas[atual + 1]: contador += 1 else: max_value = max(contador, max_value) ...
false
33.333333
[ "-x = input().split()", "-y = [0]", "-c = 0", "-for i in range(n - 1):", "- if int(x[i]) >= int(x[i + 1]):", "- c = c + 1", "- else:", "- y.append(c)", "- c = 0", "-y.append(c)", "-print((max(y)))", "+alturas = list(map(int, input().split()))", "+if n == 1:", "+ ...
false
0.046855
0.039884
1.174765
[ "s806519124", "s470825342" ]
u537905693
p02953
python
s704123096
s461881274
70
50
14,484
14,832
Accepted
Accepted
28.57
#!/usr/bin/env python # coding: utf-8 def ri(): return int(eval(input())) def rl(): return list(input().split()) def rli(): return list(map(int, input().split())) def main(): n = ri() lh = rli() for i in range(len(lh)-1): if lh[i+1] > lh[i]: lh[i+1] -= 1 ...
#!/usr/bin/env python # coding: utf-8 def ri(): return int(eval(input())) def rl(): return list(input().split()) def rli(): return list(map(int, input().split())) def main(): n = ri() lh = rli() c = 0 for h in lh: # print(c, h) if h < c: pri...
26
30
450
482
#!/usr/bin/env python # coding: utf-8 def ri(): return int(eval(input())) def rl(): return list(input().split()) def rli(): return list(map(int, input().split())) def main(): n = ri() lh = rli() for i in range(len(lh) - 1): if lh[i + 1] > lh[i]: lh[i + 1] -= 1 i...
#!/usr/bin/env python # coding: utf-8 def ri(): return int(eval(input())) def rl(): return list(input().split()) def rli(): return list(map(int, input().split())) def main(): n = ri() lh = rli() c = 0 for h in lh: # print(c, h) if h < c: print("No") ...
false
13.333333
[ "- for i in range(len(lh) - 1):", "- if lh[i + 1] > lh[i]:", "- lh[i + 1] -= 1", "- if lh[i + 1] < lh[i]:", "+ c = 0", "+ for h in lh:", "+ # print(c, h)", "+ if h < c:", "+ elif h == c:", "+ c = h", "+ else:", "+ ...
false
0.04643
0.04689
0.990195
[ "s704123096", "s461881274" ]
u936985471
p02936
python
s771189842
s931249489
1,998
1,825
81,204
64,300
Accepted
Accepted
8.66
N,Q=list(map(int,input().split())) tree={} for i in range(N-1): a,b=list(map(int,input().split())) if (a-1) in tree: tree[a-1].append(b-1) else: tree[a-1]=[b-1] if (b-1) in tree: tree[b-1].append(a-1) else: tree[b-1]=[a-1] point=[0]*N for i in range(Q): p,x=list(map(int,inp...
N,Q=list(map(int,input().split())) E=[[] for i in range(N)] for i in range(N-1): a,b=list(map(int,input().split())) a,b=a-1,b-1 E[a].append(b) E[b].append(a) P=[0]*N for i in range(Q): p,x=list(map(int,input().split())) P[p-1]+=x ans=[0]*N stack=[] # 点,親,ポイント stack.append([0,-1,0]) wh...
36
31
676
547
N, Q = list(map(int, input().split())) tree = {} for i in range(N - 1): a, b = list(map(int, input().split())) if (a - 1) in tree: tree[a - 1].append(b - 1) else: tree[a - 1] = [b - 1] if (b - 1) in tree: tree[b - 1].append(a - 1) else: tree[b - 1] = [a - 1] point = [...
N, Q = list(map(int, input().split())) E = [[] for i in range(N)] for i in range(N - 1): a, b = list(map(int, input().split())) a, b = a - 1, b - 1 E[a].append(b) E[b].append(a) P = [0] * N for i in range(Q): p, x = list(map(int, input().split())) P[p - 1] += x ans = [0] * N stack = [] # 点,親,ポイン...
false
13.888889
[ "-tree = {}", "+E = [[] for i in range(N)]", "- if (a - 1) in tree:", "- tree[a - 1].append(b - 1)", "- else:", "- tree[a - 1] = [b - 1]", "- if (b - 1) in tree:", "- tree[b - 1].append(a - 1)", "- else:", "- tree[b - 1] = [a - 1]", "-point = [0] * N", "...
false
0.033736
0.035463
0.951302
[ "s771189842", "s931249489" ]
u072053884
p02343
python
s461360106
s922021357
11,810
420
8,780
8,624
Accepted
Accepted
96.44
import sys f_i = sys.stdin n, q = list(map(int, f_i.readline().split())) class DisjointSets: def __init__(self, size): self.size = size self.representatives = list(range(size)) def _find(self, x): return self.representatives[x] def union(self, x, y): x1 ...
import sys f_i = sys.stdin n, q = list(map(int, f_i.readline().split())) class DisjointSets: def __init__(self, size): # negative values are roots(representatives of each tree) # positive values represent the parent element self.table = [-1 for _ in range(size)] def _find...
38
45
853
1,203
import sys f_i = sys.stdin n, q = list(map(int, f_i.readline().split())) class DisjointSets: def __init__(self, size): self.size = size self.representatives = list(range(size)) def _find(self, x): return self.representatives[x] def union(self, x, y): x1 = self._find(x) ...
import sys f_i = sys.stdin n, q = list(map(int, f_i.readline().split())) class DisjointSets: def __init__(self, size): # negative values are roots(representatives of each tree) # positive values represent the parent element self.table = [-1 for _ in range(size)] def _find(self, x): ...
false
15.555556
[ "- self.size = size", "- self.representatives = list(range(size))", "+ # negative values are roots(representatives of each tree)", "+ # positive values represent the parent element", "+ self.table = [-1 for _ in range(size)]", "- return self.representatives[x]", ...
false
0.055481
0.03603
1.539833
[ "s461360106", "s922021357" ]
u550943777
p03044
python
s699084417
s896765469
944
814
55,432
80,288
Accepted
Accepted
13.77
import heapq as hp N = int(eval(input())) ans = [-1]*N arr = [] for i in range(N-1): u,v,w = list(map(int,input().split())) u -= 1 v -= 1 arr.append([u,v,w]) e_list = [[] for i in range(N)] for u,v,w in arr: e_list[u].append([v,w]) e_list[v].append([u,w]) stack = [0] ans[0] = 0 ...
N = int(input()) e_list = [[] for i in range(N)] for i in range(N-1): u,v,w = map(int,input().split()) w %= 2 e_list[u-1].append([v-1,w]) e_list[v-1].append([u-1,w]) stack = [0] ans = [-1]*N ans[0] = 0 while stack: x = stack.pop() for v,w in e_list[x]: if ans[v] != -1: ...
25
20
536
435
import heapq as hp N = int(eval(input())) ans = [-1] * N arr = [] for i in range(N - 1): u, v, w = list(map(int, input().split())) u -= 1 v -= 1 arr.append([u, v, w]) e_list = [[] for i in range(N)] for u, v, w in arr: e_list[u].append([v, w]) e_list[v].append([u, w]) stack = [0] ans[0] = 0 whi...
N = int(input()) e_list = [[] for i in range(N)] for i in range(N - 1): u, v, w = map(int, input().split()) w %= 2 e_list[u - 1].append([v - 1, w]) e_list[v - 1].append([u - 1, w]) stack = [0] ans = [-1] * N ans[0] = 0 while stack: x = stack.pop() for v, w in e_list[x]: if ans[v] != -1: ...
false
20
[ "-import heapq as hp", "-", "-N = int(eval(input()))", "+N = int(input())", "+e_list = [[] for i in range(N)]", "+for i in range(N - 1):", "+ u, v, w = map(int, input().split())", "+ w %= 2", "+ e_list[u - 1].append([v - 1, w])", "+ e_list[v - 1].append([u - 1, w])", "+stack = [0]", ...
false
0.040634
0.095404
0.425915
[ "s699084417", "s896765469" ]
u827141374
p03073
python
s484586530
s597057741
50
36
3,188
3,188
Accepted
Accepted
28
S = eval(input()) p01 = 0 p10 = 0 p00 = 0 p11 = 0 for i in range(0, (len(S)//2 * 2), 2): if S[i:i+2] == '01': p01 += 1 elif S[i:i+2] == '10': p10 += 1 elif S[i:i+2] == '00': p00 += 1 else: p11 += 1 #print(p01,p10,p00,p11) c = 0 if (p01 == 0) and (p10 == 0)...
S = eval(input()) c = 0 zo = 0 # zero-one oz = 0 # one-zero for i in range(0, len(S)//2 * 2, 2): if S[i] == '0': oz += 1 else: zo += 1 if S[i+1] == '0': zo += 1 else: oz += 1 if len(S) & 1: if S[-1] == '0': oz += 1 else: zo += 1 p...
29
19
565
331
S = eval(input()) p01 = 0 p10 = 0 p00 = 0 p11 = 0 for i in range(0, (len(S) // 2 * 2), 2): if S[i : i + 2] == "01": p01 += 1 elif S[i : i + 2] == "10": p10 += 1 elif S[i : i + 2] == "00": p00 += 1 else: p11 += 1 # print(p01,p10,p00,p11) c = 0 if (p01 == 0) and (p10 == 0):...
S = eval(input()) c = 0 zo = 0 # zero-one oz = 0 # one-zero for i in range(0, len(S) // 2 * 2, 2): if S[i] == "0": oz += 1 else: zo += 1 if S[i + 1] == "0": zo += 1 else: oz += 1 if len(S) & 1: if S[-1] == "0": oz += 1 else: zo += 1 print((min(oz...
false
34.482759
[ "-p01 = 0", "-p10 = 0", "-p00 = 0", "-p11 = 0", "-for i in range(0, (len(S) // 2 * 2), 2):", "- if S[i : i + 2] == \"01\":", "- p01 += 1", "- elif S[i : i + 2] == \"10\":", "- p10 += 1", "- elif S[i : i + 2] == \"00\":", "- p00 += 1", "+c = 0", "+zo = 0 # zero-...
false
0.035908
0.067817
0.529489
[ "s484586530", "s597057741" ]
u086503932
p02726
python
s613946583
s345055070
1,312
305
3,444
101,420
Accepted
Accepted
76.75
N, X, Y = list(map(int, input().split())) ans = [0] * N for i in range(N): for j in range(i+1, N): tmp = min(j-i, abs(X-1-i) + 1 + abs(Y-1-j)) ans[tmp] += 1 for k in range(1,N): print((ans[k]))
from collections import deque N, X, Y = map(int, input().split()) adj = [[] for _ in range(N)] for i in range(N-1): adj[i].append(i+1) adj[i+1].append(i) adj[X-1].append(Y-1) adj[Y-1].append(X-1) dist = [[-1]*N for _ in range(N)] for i in range(N): queue = deque([i]) dist[i][i] = 0 ...
10
30
208
636
N, X, Y = list(map(int, input().split())) ans = [0] * N for i in range(N): for j in range(i + 1, N): tmp = min(j - i, abs(X - 1 - i) + 1 + abs(Y - 1 - j)) ans[tmp] += 1 for k in range(1, N): print((ans[k]))
from collections import deque N, X, Y = map(int, input().split()) adj = [[] for _ in range(N)] for i in range(N - 1): adj[i].append(i + 1) adj[i + 1].append(i) adj[X - 1].append(Y - 1) adj[Y - 1].append(X - 1) dist = [[-1] * N for _ in range(N)] for i in range(N): queue = deque([i]) dist[i][i] = 0 ...
false
66.666667
[ "-N, X, Y = list(map(int, input().split()))", "-ans = [0] * N", "+from collections import deque", "+", "+N, X, Y = map(int, input().split())", "+adj = [[] for _ in range(N)]", "+for i in range(N - 1):", "+ adj[i].append(i + 1)", "+ adj[i + 1].append(i)", "+adj[X - 1].append(Y - 1)", "+adj[...
false
0.046465
0.044764
1.038004
[ "s613946583", "s345055070" ]
u564589929
p02732
python
s962206754
s229318789
1,312
409
32,156
26,140
Accepted
Accepted
68.83
from collections import Counter import math def solver(): N = int(eval(input())) A = list(map(int, input().split())) cnt = Counter(A) # print(cnt) def comb(n, r): if n - r < 0: return 0 if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n ...
import sys sys.setrecursionlimit(10 ** 6) # input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def LI1(): retur...
50
39
1,224
864
from collections import Counter import math def solver(): N = int(eval(input())) A = list(map(int, input().split())) cnt = Counter(A) # print(cnt) def comb(n, r): if n - r < 0: return 0 if n - r < r: r = n - r if r == 0: return 1 ...
import sys sys.setrecursionlimit(10**6) # input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def...
false
22
[ "-from collections import Counter", "-import math", "+import sys", "+", "+sys.setrecursionlimit(10**6)", "+# input = sys.stdin.readline ####", "+int1 = lambda x: int(x) - 1", "-def solver():", "- N = int(eval(input()))", "- A = list(map(int, input().split()))", "- cnt = Counter(A)", ...
false
0.093892
0.093983
0.999036
[ "s962206754", "s229318789" ]
u226155577
p03090
python
s059024480
s448252830
180
20
39,152
3,444
Accepted
Accepted
88.89
import sys N = int(eval(input())) ans = [] if N % 2: print((N*(N-1)//2 - N//2)) for i in range(1, N+1): for j in range(i+1, N+1): if i + j != N: ans.append("%d %d\n" % (i, j)) else: print((N*(N-1)//2 - N//2)) for i in range(1, N+1): for j in rang...
import sys N = int(sys.stdin.readline()) ans = ["%d\n" % (N*(N-1)//2 - N//2)] K = N+((N&1)^1) for i in range(1, N+1): for j in range(i+1, N+1): if i + j != K: ans.append("%d %d\n" % (i, j)) sys.stdout.writelines(ans)
17
10
428
250
import sys N = int(eval(input())) ans = [] if N % 2: print((N * (N - 1) // 2 - N // 2)) for i in range(1, N + 1): for j in range(i + 1, N + 1): if i + j != N: ans.append("%d %d\n" % (i, j)) else: print((N * (N - 1) // 2 - N // 2)) for i in range(1, N + 1): fo...
import sys N = int(sys.stdin.readline()) ans = ["%d\n" % (N * (N - 1) // 2 - N // 2)] K = N + ((N & 1) ^ 1) for i in range(1, N + 1): for j in range(i + 1, N + 1): if i + j != K: ans.append("%d %d\n" % (i, j)) sys.stdout.writelines(ans)
false
41.176471
[ "-N = int(eval(input()))", "-ans = []", "-if N % 2:", "- print((N * (N - 1) // 2 - N // 2))", "- for i in range(1, N + 1):", "- for j in range(i + 1, N + 1):", "- if i + j != N:", "- ans.append(\"%d %d\\n\" % (i, j))", "-else:", "- print((N * (N - 1) // 2 ...
false
0.040656
0.036129
1.125279
[ "s059024480", "s448252830" ]
u864197622
p02782
python
s805187142
s985337713
633
223
82,324
71,664
Accepted
Accepted
64.77
nn = 2002002 P = 10**9+7 fa = [1] for i in range(1, nn): fa.append(fa[-1] * i % P) f = lambda a, b: fa[a+b+2] * pow(fa[a+1] * fa[b+1], P-2, P) % P - 1 r1, c1, r2, c2 = list(map(int, input().split())) print(((f(r2, c2) - f(r2, c1-1) - f(r1-1, c2) + f(r1-1, c1-1)) % P))
nn = 2002002 P = 10**9+7 fa = [1] + [0] * nn for i in range(nn): fa[i+1] = fa[i] * (i+1) % P f = lambda a, b: fa[a+b+2] * pow(fa[a+1] * fa[b+1], P-2, P) % P - 1 r1, c1, r2, c2 = list(map(int, input().split())) print(((f(r2, c2) - f(r2, c1-1) - f(r1-1, c2) + f(r1-1, c1-1)) % P))
7
7
266
276
nn = 2002002 P = 10**9 + 7 fa = [1] for i in range(1, nn): fa.append(fa[-1] * i % P) f = lambda a, b: fa[a + b + 2] * pow(fa[a + 1] * fa[b + 1], P - 2, P) % P - 1 r1, c1, r2, c2 = list(map(int, input().split())) print(((f(r2, c2) - f(r2, c1 - 1) - f(r1 - 1, c2) + f(r1 - 1, c1 - 1)) % P))
nn = 2002002 P = 10**9 + 7 fa = [1] + [0] * nn for i in range(nn): fa[i + 1] = fa[i] * (i + 1) % P f = lambda a, b: fa[a + b + 2] * pow(fa[a + 1] * fa[b + 1], P - 2, P) % P - 1 r1, c1, r2, c2 = list(map(int, input().split())) print(((f(r2, c2) - f(r2, c1 - 1) - f(r1 - 1, c2) + f(r1 - 1, c1 - 1)) % P))
false
0
[ "-fa = [1]", "-for i in range(1, nn):", "- fa.append(fa[-1] * i % P)", "+fa = [1] + [0] * nn", "+for i in range(nn):", "+ fa[i + 1] = fa[i] * (i + 1) % P" ]
false
0.97967
2.475082
0.395813
[ "s805187142", "s985337713" ]
u186838327
p03487
python
s147175654
s489735149
269
98
67,240
89,916
Accepted
Accepted
63.57
n = int(eval(input())) l = list(map(int, input().split())) d = {} for a in l: if a in d: d[a] += 1 else: d[a] = 1 ans = 0 for k, v in list(d.items()): if k > v: ans += v elif k < v: ans += v-k else: pass print(ans)
n = int(eval(input())) A = list(map(int, input().split())) from collections import Counter C = Counter(A) ans = 0 for k, v in list(C.items()): if v < k: ans += v elif v > k: ans += (v-k) print(ans)
19
12
253
222
n = int(eval(input())) l = list(map(int, input().split())) d = {} for a in l: if a in d: d[a] += 1 else: d[a] = 1 ans = 0 for k, v in list(d.items()): if k > v: ans += v elif k < v: ans += v - k else: pass print(ans)
n = int(eval(input())) A = list(map(int, input().split())) from collections import Counter C = Counter(A) ans = 0 for k, v in list(C.items()): if v < k: ans += v elif v > k: ans += v - k print(ans)
false
36.842105
[ "-l = list(map(int, input().split()))", "-d = {}", "-for a in l:", "- if a in d:", "- d[a] += 1", "- else:", "- d[a] = 1", "+A = list(map(int, input().split()))", "+from collections import Counter", "+", "+C = Counter(A)", "-for k, v in list(d.items()):", "- if k > v:"...
false
0.054135
0.049806
1.086905
[ "s147175654", "s489735149" ]
u197615397
p02271
python
s307837662
s515271406
820
500
49,116
5,792
Accepted
Accepted
39.02
import bisect n = int(eval(input())) A = tuple(map(int,input().split())) q = int(eval(input())) Q = tuple(map(int, input().split())) dp = [0]*(2**n) for i in range(n): for j in range(1<<i): dp[j+(1<<i)] = dp[j] + A[i] dp.sort() for n in Q: i = bisect.bisect(dp, n) print(("yes" if i>0...
def solve(): from itertools import product input() A = tuple(map(lambda x: (0, int(x)), input().split())) result = [0]*(2000*20+1) for a in product(*A): result[sum(a)] = 1 input() print(*("yes" if result[q] else "no" for q in map(int, input().split())), sep="\n") if __...
15
14
333
355
import bisect n = int(eval(input())) A = tuple(map(int, input().split())) q = int(eval(input())) Q = tuple(map(int, input().split())) dp = [0] * (2**n) for i in range(n): for j in range(1 << i): dp[j + (1 << i)] = dp[j] + A[i] dp.sort() for n in Q: i = bisect.bisect(dp, n) print(("yes" if i > 0 and...
def solve(): from itertools import product input() A = tuple(map(lambda x: (0, int(x)), input().split())) result = [0] * (2000 * 20 + 1) for a in product(*A): result[sum(a)] = 1 input() print(*("yes" if result[q] else "no" for q in map(int, input().split())), sep="\n") if __name__...
false
6.666667
[ "-import bisect", "+def solve():", "+ from itertools import product", "-n = int(eval(input()))", "-A = tuple(map(int, input().split()))", "-q = int(eval(input()))", "-Q = tuple(map(int, input().split()))", "-dp = [0] * (2**n)", "-for i in range(n):", "- for j in range(1 << i):", "- ...
false
0.034721
0.03509
0.989488
[ "s307837662", "s515271406" ]
u644907318
p03023
python
s211701677
s242251552
172
62
38,256
61,656
Accepted
Accepted
63.95
print(((int(eval(input()))-2)*180))
N = int(eval(input())) print((180*(N-2)))
1
2
27
34
print(((int(eval(input())) - 2) * 180))
N = int(eval(input())) print((180 * (N - 2)))
false
50
[ "-print(((int(eval(input())) - 2) * 180))", "+N = int(eval(input()))", "+print((180 * (N - 2)))" ]
false
0.037032
0.036809
1.006047
[ "s211701677", "s242251552" ]
u092650292
p02606
python
s411442823
s813675886
42
29
10,020
9,112
Accepted
Accepted
30.95
from math import gcd from math import factorial as f from math import ceil, floor, sqrt import math import bisect import re import heapq from copy import deepcopy import itertools from itertools import permutations from sys import exit ii = lambda: int(eval(input())) mi = lambda: list(map(int, i...
l, r, d = list(map(int, input().split())) cnt = 0 tmp = d while tmp <= r: if tmp <= r and tmp >= l: cnt += 1 tmp += d print(cnt)
37
9
584
147
from math import gcd from math import factorial as f from math import ceil, floor, sqrt import math import bisect import re import heapq from copy import deepcopy import itertools from itertools import permutations from sys import exit ii = lambda: int(eval(input())) mi = lambda: list(map(int, input().split())) li = l...
l, r, d = list(map(int, input().split())) cnt = 0 tmp = d while tmp <= r: if tmp <= r and tmp >= l: cnt += 1 tmp += d print(cnt)
false
75.675676
[ "-from math import gcd", "-from math import factorial as f", "-from math import ceil, floor, sqrt", "-import math", "-import bisect", "-import re", "-import heapq", "-from copy import deepcopy", "-import itertools", "-from itertools import permutations", "-from sys import exit", "-", "-ii = ...
false
0.036349
0.047598
0.763661
[ "s411442823", "s813675886" ]
u594956556
p03037
python
s636667801
s992833842
347
308
3,060
10,996
Accepted
Accepted
11.24
n,m=list(map(int,input().split())) l0,r0=1,n for i in range(m): l,r=list(map(int,input().split())) if l>r0 or r<l0: print((0)) exit() else: l0=max(l0,l) r0=min(r0,r) print((r0-l0+1))
n,m=list(map(int,input().split())) l=[0 for _ in range(m)] r=[0 for _ in range(m)] for i in range(m): l[i],r[i] = list(map(int,input().split())) lmax=max(l) rmin=min(r) if rmin>=lmax: print((rmin-lmax+1)) else: print((0))
11
13
198
225
n, m = list(map(int, input().split())) l0, r0 = 1, n for i in range(m): l, r = list(map(int, input().split())) if l > r0 or r < l0: print((0)) exit() else: l0 = max(l0, l) r0 = min(r0, r) print((r0 - l0 + 1))
n, m = list(map(int, input().split())) l = [0 for _ in range(m)] r = [0 for _ in range(m)] for i in range(m): l[i], r[i] = list(map(int, input().split())) lmax = max(l) rmin = min(r) if rmin >= lmax: print((rmin - lmax + 1)) else: print((0))
false
15.384615
[ "-l0, r0 = 1, n", "+l = [0 for _ in range(m)]", "+r = [0 for _ in range(m)]", "- l, r = list(map(int, input().split()))", "- if l > r0 or r < l0:", "- print((0))", "- exit()", "- else:", "- l0 = max(l0, l)", "- r0 = min(r0, r)", "-print((r0 - l0 + 1))", "+ ...
false
0.04105
0.070635
0.58115
[ "s636667801", "s992833842" ]
u854175276
p03013
python
s337577807
s589851085
603
478
64,800
45,040
Accepted
Accepted
20.73
def xgcd(a, b): if b == 0: g = a x = 1 y = 0 return g, x, y else: g, s, t = xgcd(b, a%b) x = t y = s - a//b*x return g, x, y def invmod(a, p): _, x, _ = xgcd(a, p) if x < 0: x = x + p return x def count_route...
n , m = list(map(int, input().split())) const = 1000000007 r = [1 for i in range(n+1)] for i in range(m): r[int(eval(input()))] = 0 for i in range(2, n+1): if r[i] > 0: r[i] = (r[i-1] + r[i-2])%const print((r[n]))
44
9
896
215
def xgcd(a, b): if b == 0: g = a x = 1 y = 0 return g, x, y else: g, s, t = xgcd(b, a % b) x = t y = s - a // b * x return g, x, y def invmod(a, p): _, x, _ = xgcd(a, p) if x < 0: x = x + p return x def count_route(n): i...
n, m = list(map(int, input().split())) const = 1000000007 r = [1 for i in range(n + 1)] for i in range(m): r[int(eval(input()))] = 0 for i in range(2, n + 1): if r[i] > 0: r[i] = (r[i - 1] + r[i - 2]) % const print((r[n]))
false
79.545455
[ "-def xgcd(a, b):", "- if b == 0:", "- g = a", "- x = 1", "- y = 0", "- return g, x, y", "- else:", "- g, s, t = xgcd(b, a % b)", "- x = t", "- y = s - a // b * x", "- return g, x, y", "-", "-", "-def invmod(a, p):", "- _, ...
false
0.04552
0.048371
0.941047
[ "s337577807", "s589851085" ]
u102461423
p02931
python
s270058485
s480087739
459
397
35,576
35,448
Accepted
Accepted
13.51
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) import operator N,H,W = list(map(int,readline().split())) m = list(map(int,read().split())) RCA = sorted(zip(m,m,m),key=operator.itemgetter(2),reverse=True) roo...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import operator N,H,W = list(map(int,readline().split())) m = list(map(int,read().split())) RCA = sorted(zip(m,m,m),key=operator.itemgetter(2),reverse=True) root = list(range(H+W)) size = [...
53
48
1,153
1,035
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) import operator N, H, W = list(map(int, readline().split())) m = list(map(int, read().split())) RCA = sorted(zip(m, m, m), key=operator.itemgetter(2), reverse=True) root = l...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import operator N, H, W = list(map(int, readline().split())) m = list(map(int, read().split())) RCA = sorted(zip(m, m, m), key=operator.itemgetter(2), reverse=True) root = list(range(H + W)) size = [1] ...
false
9.433962
[ "-sys.setrecursionlimit(10**7)", "-size = [0] * (H + W)", "+size = [1] * (H + W)", "- return x", "- path = [x]", "- while y != root[y]:", "- path.append(y)", "- y = root[y]", "- for p in path:", "- root[p] = y", "- return y", "+ return y", "+ ...
false
0.038218
0.074417
0.513564
[ "s270058485", "s480087739" ]
u497596438
p03290
python
s505713687
s368256324
234
215
44,016
41,456
Accepted
Accepted
8.12
from copy import copy D,G=list(map(int,input().split())) p=[] c=[] for i in range(D): a,b=list(map(int,input().split())) p.append(a) c.append(b) lst1=[] lst2=[] lst3=[] def func1(l1,l2,l3,p,c,G): S=0 n=0 ind=0 for i in range(len(l1)): S+=c[i]*l1[i] n+=p[i]*l1...
from math import ceil D,G=list(map(int,input().split())) P=[] C=[] R=[] for i in range(D): p,c=list(map(int,input().split())) P.append(p) C.append(c) R.append((i+1)*100*p+c) bit=2**D ans=10**19 for i in range(bit): i=bin(i)[2:].zfill(D) su=0 num=0 k=-1 for j in range...
50
31
1,032
605
from copy import copy D, G = list(map(int, input().split())) p = [] c = [] for i in range(D): a, b = list(map(int, input().split())) p.append(a) c.append(b) lst1 = [] lst2 = [] lst3 = [] def func1(l1, l2, l3, p, c, G): S = 0 n = 0 ind = 0 for i in range(len(l1)): S += c[i] * l1[i]...
from math import ceil D, G = list(map(int, input().split())) P = [] C = [] R = [] for i in range(D): p, c = list(map(int, input().split())) P.append(p) C.append(c) R.append((i + 1) * 100 * p + c) bit = 2**D ans = 10**19 for i in range(bit): i = bin(i)[2:].zfill(D) su = 0 num = 0 k = -1 ...
false
38
[ "-from copy import copy", "+from math import ceil", "-p = []", "-c = []", "+P = []", "+C = []", "+R = []", "- a, b = list(map(int, input().split()))", "- p.append(a)", "- c.append(b)", "-lst1 = []", "-lst2 = []", "-lst3 = []", "-", "-", "-def func1(l1, l2, l3, p, c, G):", "-...
false
0.039615
0.036949
1.072138
[ "s505713687", "s368256324" ]
u463775490
p03610
python
s463151680
s477702703
29
18
3,572
3,192
Accepted
Accepted
37.93
s = eval(input()) ans = [s[i] for i in range(len(s)) if i%2 == 0] print((''.join(ans)))
print((input()[::2]))
3
1
81
19
s = eval(input()) ans = [s[i] for i in range(len(s)) if i % 2 == 0] print(("".join(ans)))
print((input()[::2]))
false
66.666667
[ "-s = eval(input())", "-ans = [s[i] for i in range(len(s)) if i % 2 == 0]", "-print((\"\".join(ans)))", "+print((input()[::2]))" ]
false
0.138985
0.042304
3.285374
[ "s463151680", "s477702703" ]
u798803522
p02271
python
s223328676
s756170629
70
20
7,792
7,788
Accepted
Accepted
71.43
a_len = int(eval(input())) a_ar = sorted([int(n) for n in input().split(" ")]) b_len = int(eval(input())) b_ar = [int(n) for n in input().split(" ")] dp = [0 for n in range(2001)] for a in a_ar: new_dp = dp[:] new_dp[a] = 1 for i,d in enumerate(dp): if d and i + a <= 2000: new_...
a_len = int(eval(input())) a_ar = sorted([int(n) for n in input().split(" ")]) b_len = int(eval(input())) b_ar = [int(n) for n in input().split(" ")] max_b = max(b_ar) dp = [0 for n in range(max_b + 1)] for a in a_ar: new_dp = dp[:] new_dp[a] = 1 for i,d in enumerate(dp): if d and i + a <=...
19
18
470
448
a_len = int(eval(input())) a_ar = sorted([int(n) for n in input().split(" ")]) b_len = int(eval(input())) b_ar = [int(n) for n in input().split(" ")] dp = [0 for n in range(2001)] for a in a_ar: new_dp = dp[:] new_dp[a] = 1 for i, d in enumerate(dp): if d and i + a <= 2000: new_dp[i + a]...
a_len = int(eval(input())) a_ar = sorted([int(n) for n in input().split(" ")]) b_len = int(eval(input())) b_ar = [int(n) for n in input().split(" ")] max_b = max(b_ar) dp = [0 for n in range(max_b + 1)] for a in a_ar: new_dp = dp[:] new_dp[a] = 1 for i, d in enumerate(dp): if d and i + a <= max_b: ...
false
5.263158
[ "-dp = [0 for n in range(2001)]", "+max_b = max(b_ar)", "+dp = [0 for n in range(max_b + 1)]", "- if d and i + a <= 2000:", "+ if d and i + a <= max_b:", "- elif i + a > 2000:", "- break" ]
false
0.037775
0.052689
0.716938
[ "s223328676", "s756170629" ]
u832039789
p02861
python
s644835799
s925005942
402
17
3,188
3,064
Accepted
Accepted
95.77
from itertools import permutations as perm n = int(eval(input())) l = [] for i in range(n): x,y = list(map(int,input().split())) l.append([x, y]) sm = 0 cnt = 0 permm = list(range(n)) for p in perm(permm): for i, j in zip(p, p[1:]): x1, y1 = l[i] x2, y2 = l[j] sm +...
n = int(eval(input())) l = [] for i in range(n): x,y = list(map(int,input().split())) l.append([x, y]) sm = 0 for i in range(n): for j in range(n): sm += ((l[i][0] - l[j][0]) ** 2 + (l[i][1] - l[j][1]) ** 2) ** 0.5 print((sm / n))
20
11
383
247
from itertools import permutations as perm n = int(eval(input())) l = [] for i in range(n): x, y = list(map(int, input().split())) l.append([x, y]) sm = 0 cnt = 0 permm = list(range(n)) for p in perm(permm): for i, j in zip(p, p[1:]): x1, y1 = l[i] x2, y2 = l[j] sm += ((x1 - x2) ** ...
n = int(eval(input())) l = [] for i in range(n): x, y = list(map(int, input().split())) l.append([x, y]) sm = 0 for i in range(n): for j in range(n): sm += ((l[i][0] - l[j][0]) ** 2 + (l[i][1] - l[j][1]) ** 2) ** 0.5 print((sm / n))
false
45
[ "-from itertools import permutations as perm", "-", "-cnt = 0", "-permm = list(range(n))", "-for p in perm(permm):", "- for i, j in zip(p, p[1:]):", "- x1, y1 = l[i]", "- x2, y2 = l[j]", "- sm += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5", "- cnt += 1", "-print((sm / cn...
false
0.092762
0.044976
2.062506
[ "s644835799", "s925005942" ]
u925626880
p03448
python
s898553298
s895208388
32
28
3,060
3,060
Accepted
Accepted
12.5
def main(): a = int(eval(input())) # 500 b = int(eval(input())) # 100 c = int(eval(input())) # 50 x = int(eval(input())) ans = 0 for i in range(a+1): I = i*500 for j in range(b+1): J = j*100 for k in range(c+1): K = k*50 ...
def main(): a = int(eval(input())) # 500 b = int(eval(input())) # 100 c = int(eval(input())) # 50 x = int(eval(input())) ans = 0 for i in range(a+1): I = i*500 if I > x: break for j in range(b+1): J = j*100 if I+J > x: ...
21
25
414
500
def main(): a = int(eval(input())) # 500 b = int(eval(input())) # 100 c = int(eval(input())) # 50 x = int(eval(input())) ans = 0 for i in range(a + 1): I = i * 500 for j in range(b + 1): J = j * 100 for k in range(c + 1): K = k * 50 ...
def main(): a = int(eval(input())) # 500 b = int(eval(input())) # 100 c = int(eval(input())) # 50 x = int(eval(input())) ans = 0 for i in range(a + 1): I = i * 500 if I > x: break for j in range(b + 1): J = j * 100 if I + J > x: ...
false
16
[ "+ if I > x:", "+ break", "+ if I + J > x:", "+ break" ]
false
0.007733
0.038529
0.200706
[ "s898553298", "s895208388" ]
u150984829
p02234
python
s214014608
s122369231
180
130
5,728
5,728
Accepted
Accepted
27.78
import sys n=int(eval(input()))+1 e=list([x.split() for x in sys.stdin]) p=[int(e[0][0])]+list(int(x[1])for x in e) m=[[0]*n for _ in[0]*n] for l in range(2,n): for i in range(1,n-l+1): j=i+l-1;m[i][j]=1e6 for k in range(i,j):m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]) print((m[1][n-1]))
def s(): n=int(eval(input()))+1 e=[input().split()for _ in[0]*~-n] p=[int(e[0][0])]+list(int(x[1])for x in e) m=[[0]*n for _ in[0]*n] for l in range(2,n): for i in range(1,n-l+1): j=i+l-1;m[i][j]=1e6 for k in range(i,j):m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]) print((m[1][n-1])) ...
10
11
310
339
import sys n = int(eval(input())) + 1 e = list([x.split() for x in sys.stdin]) p = [int(e[0][0])] + list(int(x[1]) for x in e) m = [[0] * n for _ in [0] * n] for l in range(2, n): for i in range(1, n - l + 1): j = i + l - 1 m[i][j] = 1e6 for k in range(i, j): m[i][j] = min(m[i][...
def s(): n = int(eval(input())) + 1 e = [input().split() for _ in [0] * ~-n] p = [int(e[0][0])] + list(int(x[1]) for x in e) m = [[0] * n for _ in [0] * n] for l in range(2, n): for i in range(1, n - l + 1): j = i + l - 1 m[i][j] = 1e6 for k in range(i, j)...
false
9.090909
[ "-import sys", "+def s():", "+ n = int(eval(input())) + 1", "+ e = [input().split() for _ in [0] * ~-n]", "+ p = [int(e[0][0])] + list(int(x[1]) for x in e)", "+ m = [[0] * n for _ in [0] * n]", "+ for l in range(2, n):", "+ for i in range(1, n - l + 1):", "+ j = i +...
false
0.046863
0.039865
1.175531
[ "s214014608", "s122369231" ]
u084320347
p02754
python
s934868969
s113012239
173
17
38,256
2,940
Accepted
Accepted
90.17
N,A,B = list(map(int,input().split())) ans = N//(A+B)*A ans += min(N%(A+B),A) print(ans)
n,a,b = list(map(int,input().split())) print(((n//(a+b)*a)+min(n%(a+b),a)))
7
3
98
76
N, A, B = list(map(int, input().split())) ans = N // (A + B) * A ans += min(N % (A + B), A) print(ans)
n, a, b = list(map(int, input().split())) print(((n // (a + b) * a) + min(n % (a + b), a)))
false
57.142857
[ "-N, A, B = list(map(int, input().split()))", "-ans = N // (A + B) * A", "-ans += min(N % (A + B), A)", "-print(ans)", "+n, a, b = list(map(int, input().split()))", "+print(((n // (a + b) * a) + min(n % (a + b), a)))" ]
false
0.057814
0.03551
1.628129
[ "s934868969", "s113012239" ]
u628335443
p02924
python
s121876135
s603095570
34
17
5,076
2,940
Accepted
Accepted
50
from decimal import Decimal n = int(eval(input())) ans = (Decimal((n - 1) * n) / 2) print(ans)
n = int(eval(input())) ans = ((n - 1) * n) // 2 print(ans)
7
4
98
57
from decimal import Decimal n = int(eval(input())) ans = Decimal((n - 1) * n) / 2 print(ans)
n = int(eval(input())) ans = ((n - 1) * n) // 2 print(ans)
false
42.857143
[ "-from decimal import Decimal", "-", "-ans = Decimal((n - 1) * n) / 2", "+ans = ((n - 1) * n) // 2" ]
false
0.050091
0.063869
0.784272
[ "s121876135", "s603095570" ]
u090225501
p03343
python
s862738518
s374807455
1,397
797
3,452
12,404
Accepted
Accepted
42.95
import heapq def main(): _, k, q = list(map(int, input().split())) a = tuple(map(int, input().split())) gs = [a] m = float('inf') for y in sorted(set(a)): gs = groups(gs, y, k) x = find_x(gs, y, k, q) if x is None: break m = min(m, x - y) ...
import heapq def main(): _, k, q = list(map(int, input().split())) a = list(map(int, input().split())) idx = make_index(a) groups = [(0, len(a))] m = float('inf') for y in sorted(set(a)): xs = [] for start, stop in groups: xs.extend(nsmallest(stop - star...
56
67
1,039
1,431
import heapq def main(): _, k, q = list(map(int, input().split())) a = tuple(map(int, input().split())) gs = [a] m = float("inf") for y in sorted(set(a)): gs = groups(gs, y, k) x = find_x(gs, y, k, q) if x is None: break m = min(m, x - y) print(m) ...
import heapq def main(): _, k, q = list(map(int, input().split())) a = list(map(int, input().split())) idx = make_index(a) groups = [(0, len(a))] m = float("inf") for y in sorted(set(a)): xs = [] for start, stop in groups: xs.extend(nsmallest(stop - start - k + 1, a...
false
16.41791
[ "- a = tuple(map(int, input().split()))", "- gs = [a]", "+ a = list(map(int, input().split()))", "+ idx = make_index(a)", "+ groups = [(0, len(a))]", "- gs = groups(gs, y, k)", "- x = find_x(gs, y, k, q)", "- if x is None:", "+ xs = []", "+ for sta...
false
0.079809
0.046785
1.70589
[ "s862738518", "s374807455" ]
u416758623
p03243
python
s790797337
s830360044
22
17
2,940
2,940
Accepted
Accepted
22.73
n = eval(input()) for i in range(1,10): N = str(i) + str(i) + str(i) if n <= N: print(N) break
# coding: utf-8 # Your code here! N = eval(input()) if N[0]==N[1]==N[2]: print(N) else: if int(N) <int(N[0]*3): print((int(N[0]*3))) else: print((str((int(N[0])+1))*3))
6
12
117
208
n = eval(input()) for i in range(1, 10): N = str(i) + str(i) + str(i) if n <= N: print(N) break
# coding: utf-8 # Your code here! N = eval(input()) if N[0] == N[1] == N[2]: print(N) else: if int(N) < int(N[0] * 3): print((int(N[0] * 3))) else: print((str((int(N[0]) + 1)) * 3))
false
50
[ "-n = eval(input())", "-for i in range(1, 10):", "- N = str(i) + str(i) + str(i)", "- if n <= N:", "- print(N)", "- break", "+# coding: utf-8", "+# Your code here!", "+N = eval(input())", "+if N[0] == N[1] == N[2]:", "+ print(N)", "+else:", "+ if int(N) < int(N[0] *...
false
0.068553
0.03242
2.114502
[ "s790797337", "s830360044" ]
u072717685
p03775
python
s361427352
s593463713
70
39
64,708
9,260
Accepted
Accepted
44.29
from math import floor def main(): n = int(eval(input())) nsq = floor(n ** 0.5) r = 11 for nsqe in range(nsq, 0, -1): if n % nsqe == 0: rt = max(len(str(nsqe)), len(str(n // nsqe))) r = min(r, rt) print(r) if __name__ == '__main__': main()
import sys read = sys.stdin.read readlines = sys.stdin.readlines from math import sqrt, ceil, log10 def main(): n = int(eval(input())) sqrtn = ceil(sqrt(n)) r = n for i1 in range(1, sqrtn + 1): if n % i1 == 0: t1 = log10(i1) t2 = log10(n//i1) t = m...
14
18
304
417
from math import floor def main(): n = int(eval(input())) nsq = floor(n**0.5) r = 11 for nsqe in range(nsq, 0, -1): if n % nsqe == 0: rt = max(len(str(nsqe)), len(str(n // nsqe))) r = min(r, rt) print(r) if __name__ == "__main__": main()
import sys read = sys.stdin.read readlines = sys.stdin.readlines from math import sqrt, ceil, log10 def main(): n = int(eval(input())) sqrtn = ceil(sqrt(n)) r = n for i1 in range(1, sqrtn + 1): if n % i1 == 0: t1 = log10(i1) t2 = log10(n // i1) t = max(t1, ...
false
22.222222
[ "-from math import floor", "+import sys", "+", "+read = sys.stdin.read", "+readlines = sys.stdin.readlines", "+from math import sqrt, ceil, log10", "- nsq = floor(n**0.5)", "- r = 11", "- for nsqe in range(nsq, 0, -1):", "- if n % nsqe == 0:", "- rt = max(len(str(nsqe)...
false
0.060252
0.055146
1.092591
[ "s361427352", "s593463713" ]
u445624660
p02743
python
s336486067
s094268790
121
26
5,588
9,160
Accepted
Accepted
78.51
from decimal import * a, b, c = list(map(int, input().split())) if Decimal(a)**Decimal("0.5") + Decimal(b)**Decimal("0.5") < Decimal( c)**Decimal("0.5"): print("Yes") else: print("No")
a, b, c = list(map(int, input().split())) # a + 2√ab + b < c , 2√ab < c - a - b, 4ab < (c - a - b)^2 if c - a - b < 0: print("No") else: print(("Yes" if 4 * a * b < (c - a - b)**2 else "No"))
7
6
201
197
from decimal import * a, b, c = list(map(int, input().split())) if Decimal(a) ** Decimal("0.5") + Decimal(b) ** Decimal("0.5") < Decimal(c) ** Decimal( "0.5" ): print("Yes") else: print("No")
a, b, c = list(map(int, input().split())) # a + 2√ab + b < c , 2√ab < c - a - b, 4ab < (c - a - b)^2 if c - a - b < 0: print("No") else: print(("Yes" if 4 * a * b < (c - a - b) ** 2 else "No"))
false
14.285714
[ "-from decimal import *", "-", "-if Decimal(a) ** Decimal(\"0.5\") + Decimal(b) ** Decimal(\"0.5\") < Decimal(c) ** Decimal(", "- \"0.5\"", "-):", "- print(\"Yes\")", "+# a + 2√ab + b < c , 2√ab < c - a - b, 4ab < (c - a - b)^2", "+if c - a - b < 0:", "+ print(\"No\")", "- print(\"No\"...
false
0.04774
0.07586
0.629322
[ "s336486067", "s094268790" ]
u745087332
p03152
python
s978512182
s163917042
855
543
3,188
3,188
Accepted
Accepted
36.49
# coding:utf-8 import sys import bisect # from collections import Counter, defaultdict INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def S(): return eval(inpu...
# coding:utf-8 import sys INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): return eval(i...
60
50
1,109
1,097
# coding:utf-8 import sys import bisect # from collections import Counter, defaultdict INF = float("inf") MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def S(): return eval(...
# coding:utf-8 import sys INF = float("inf") MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): ...
false
16.666667
[ "-import bisect", "-# from collections import Counter, defaultdict", "+def LI_():", "+ return [int(x) - 1 for x in sys.stdin.readline().split()]", "+", "+", "-def I():", "+def II():", "-def S():", "+def SI():", "-N, M = LI()", "-A = LI()", "-B = LI()", "-A.sort()", "-B.sort()", "-SA...
false
0.035582
0.061153
0.58186
[ "s978512182", "s163917042" ]
u810356688
p03166
python
s678464748
s190576483
632
344
80,924
36,448
Accepted
Accepted
45.57
import sys def input(): return sys.stdin.readline().rstrip() sys.setrecursionlimit(10**6) memo=dict() def rec(v): if v in memo:return memo[v] res=0 for nv in graph[v]: res=max(res,rec(nv)+1) memo[v]=res return res def main(): n,m=list(map(int,input().split())) XY=[tuple(...
import sys def input(): return sys.stdin.readline().rstrip() from collections import deque def main(): n,m=list(map(int,input().split())) XY=[tuple(map(int,input().split())) for i in range(m)] graph=[[]for _ in range(n)] deg=[0]*n #頂点iの入次数 for x,y in XY: graph[x-1].append(y-1) ...
25
30
581
751
import sys def input(): return sys.stdin.readline().rstrip() sys.setrecursionlimit(10**6) memo = dict() def rec(v): if v in memo: return memo[v] res = 0 for nv in graph[v]: res = max(res, rec(nv) + 1) memo[v] = res return res def main(): n, m = list(map(int, input().s...
import sys def input(): return sys.stdin.readline().rstrip() from collections import deque def main(): n, m = list(map(int, input().split())) XY = [tuple(map(int, input().split())) for i in range(m)] graph = [[] for _ in range(n)] deg = [0] * n # 頂点iの入次数 for x, y in XY: graph[x - ...
false
16.666667
[ "-sys.setrecursionlimit(10**6)", "-memo = dict()", "-", "-", "-def rec(v):", "- if v in memo:", "- return memo[v]", "- res = 0", "- for nv in graph[v]:", "- res = max(res, rec(nv) + 1)", "- memo[v] = res", "- return res", "+from collections import deque", "- ...
false
0.037772
0.04712
0.80163
[ "s678464748", "s190576483" ]
u922003189
p02690
python
s040489912
s330593995
140
49
9,052
9,072
Accepted
Accepted
65
x=int(eval(input())) i=1 flag=0 for i in range(10000): for j in range(-1000,1001): if(i**5+j**5==x): flag=1 print((i,-j)) exit(0)
x=int(eval(input())) i=1 flag=0 for i in range(200): for j in range(-200,200): if(i**5+j**5==x): flag=1 print((i,-j)) exit(0)
10
10
183
179
x = int(eval(input())) i = 1 flag = 0 for i in range(10000): for j in range(-1000, 1001): if i**5 + j**5 == x: flag = 1 print((i, -j)) exit(0)
x = int(eval(input())) i = 1 flag = 0 for i in range(200): for j in range(-200, 200): if i**5 + j**5 == x: flag = 1 print((i, -j)) exit(0)
false
0
[ "-for i in range(10000):", "- for j in range(-1000, 1001):", "+for i in range(200):", "+ for j in range(-200, 200):" ]
false
0.039633
0.038235
1.036564
[ "s040489912", "s330593995" ]
u419686324
p03557
python
s091790077
s699201957
896
319
121,644
23,328
Accepted
Accepted
64.4
import bisect, functools, sys sys.setrecursionlimit(10**6) N = int(eval(input())) A = sorted(int(x) for x in input().split()) B = sorted(int(x) for x in input().split()) C = sorted(int(x) for x in input().split()) @functools.lru_cache(maxsize=None) def a(n): return bisect.bisect_left(A, n) b_cache = [0...
N = int(eval(input())) A = sorted(int(x) for x in input().split()) B = sorted(int(x) for x in input().split()) C = sorted(int(x) for x in input().split()) import bisect print((sum(bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b)) for b in B)))
31
7
742
251
import bisect, functools, sys sys.setrecursionlimit(10**6) N = int(eval(input())) A = sorted(int(x) for x in input().split()) B = sorted(int(x) for x in input().split()) C = sorted(int(x) for x in input().split()) @functools.lru_cache(maxsize=None) def a(n): return bisect.bisect_left(A, n) b_cache = [0] * (N +...
N = int(eval(input())) A = sorted(int(x) for x in input().split()) B = sorted(int(x) for x in input().split()) C = sorted(int(x) for x in input().split()) import bisect print((sum(bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b)) for b in B)))
false
77.419355
[ "-import bisect, functools, sys", "-", "-sys.setrecursionlimit(10**6)", "+import bisect", "-", "-@functools.lru_cache(maxsize=None)", "-def a(n):", "- return bisect.bisect_left(A, n)", "-", "-", "-b_cache = [0] * (N + 1)", "-b_cached = [False] * (N + 1)", "-", "-", "-def b_i(i):", "...
false
0.04282
0.039205
1.092211
[ "s091790077", "s699201957" ]
u548303713
p02959
python
s944013861
s150429288
162
138
18,476
18,476
Accepted
Accepted
14.81
n = int(eval(input())) aa = list(map(int, input().split())) num = sum(aa) bb = list(map(int, input().split())) for i in range(n): c = min(aa[i], bb[i]) aa[i] -= c aa[i + 1] -= min(aa[i + 1], bb[i] - c) print((num - sum(aa)))
n=int(eval(input())) a=list(map(int,input().split())) b=list(map(int,input().split())) b.append(0) #n+1番目を作っとく num=0 c=0 for i in range(n): if a[i]<=c: num+=a[i] c=b[i] else: a[i]-=c num+=c if b[i]>=a[i]: num+=a[i] c=b[i]-a[i] ...
9
25
236
441
n = int(eval(input())) aa = list(map(int, input().split())) num = sum(aa) bb = list(map(int, input().split())) for i in range(n): c = min(aa[i], bb[i]) aa[i] -= c aa[i + 1] -= min(aa[i + 1], bb[i] - c) print((num - sum(aa)))
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) b.append(0) # n+1番目を作っとく num = 0 c = 0 for i in range(n): if a[i] <= c: num += a[i] c = b[i] else: a[i] -= c num += c if b[i] >= a[i]: num += a[i] c = b...
false
64
[ "-aa = list(map(int, input().split()))", "-num = sum(aa)", "-bb = list(map(int, input().split()))", "+a = list(map(int, input().split()))", "+b = list(map(int, input().split()))", "+b.append(0) # n+1番目を作っとく", "+num = 0", "+c = 0", "- c = min(aa[i], bb[i])", "- aa[i] -= c", "- aa[i + 1]...
false
0.037671
0.098318
0.383154
[ "s944013861", "s150429288" ]
u276115223
p03416
python
s828236128
s226882667
63
50
2,940
2,940
Accepted
Accepted
20.63
# ABC 090: B – Palindromic Numbers a, b = [int(s) for s in input().split()] number_of_parindromics = 0 for i in range(a, b + 1): if str(i) == str(i)[::-1]: number_of_parindromics += 1 print(number_of_parindromics)
# ABC 090: B – Palindromic Numbers a, b = list(map(int, input().split())) nums = 0 for i in range(a, b + 1): i_str = str(i) nums = nums + 1 if i_str == i_str[::-1] else nums print(nums)
9
7
236
193
# ABC 090: B – Palindromic Numbers a, b = [int(s) for s in input().split()] number_of_parindromics = 0 for i in range(a, b + 1): if str(i) == str(i)[::-1]: number_of_parindromics += 1 print(number_of_parindromics)
# ABC 090: B – Palindromic Numbers a, b = list(map(int, input().split())) nums = 0 for i in range(a, b + 1): i_str = str(i) nums = nums + 1 if i_str == i_str[::-1] else nums print(nums)
false
22.222222
[ "-# ABC 090: B – Palindromic Numbers", "-a, b = [int(s) for s in input().split()]", "-number_of_parindromics = 0", "+# ABC 090: B – Palindromic Numbers", "+a, b = list(map(int, input().split()))", "+nums = 0", "- if str(i) == str(i)[::-1]:", "- number_of_parindromics += 1", "-print(number...
false
0.146558
0.130817
1.12033
[ "s828236128", "s226882667" ]
u707808519
p03721
python
s267034368
s121431322
359
216
29,816
11,836
Accepted
Accepted
39.83
import bisect N, K = list(map(int, input().split())) A = []; B = [0] for i in range(N): a, b = list(map(int, input().split())) A.append([a, b]) A.sort() for i in range(N): B.append(A[i][1] + B[i]) ans = bisect.bisect_left(B, K) - 1 print((A[ans][0]))
N, K = list(map(int, input().split())) cnt = [0 for _ in range(10**5 + 10)] for i in range(N): a, b = list(map(int, input().split())) cnt[a] += b res = 0 for i in range(len(cnt)): res += cnt[i] if res >= K: break print(i)
14
13
264
247
import bisect N, K = list(map(int, input().split())) A = [] B = [0] for i in range(N): a, b = list(map(int, input().split())) A.append([a, b]) A.sort() for i in range(N): B.append(A[i][1] + B[i]) ans = bisect.bisect_left(B, K) - 1 print((A[ans][0]))
N, K = list(map(int, input().split())) cnt = [0 for _ in range(10**5 + 10)] for i in range(N): a, b = list(map(int, input().split())) cnt[a] += b res = 0 for i in range(len(cnt)): res += cnt[i] if res >= K: break print(i)
false
7.142857
[ "-import bisect", "-", "-A = []", "-B = [0]", "+cnt = [0 for _ in range(10**5 + 10)]", "- A.append([a, b])", "-A.sort()", "-for i in range(N):", "- B.append(A[i][1] + B[i])", "-ans = bisect.bisect_left(B, K) - 1", "-print((A[ans][0]))", "+ cnt[a] += b", "+res = 0", "+for i in rang...
false
0.13594
0.203371
0.668433
[ "s267034368", "s121431322" ]
u729133443
p03128
python
s052458892
s206857872
249
174
51,420
14,388
Accepted
Accepted
30.12
n,m,*a=list(map(int,open(0).read().split())) d=[] for i,j in((7,3),(9,6),(8,7),(6,6),(5,5),(4,4),(3,5),(1,2),(2,5)): if i in a: d.append((i,j)) dp=[0]*-~n for i in range(1,n+1): for j,k in d: if i-k<0 or i-k!=0 and not dp[i-k]:continue dp[i]=max(dp[i],dp[i-k]*10+j) print((dp[n]...
n,m,*a=list(map(int,open(0).read().split())) d=[0]*-~n for i in range(1,n+1): for j,k in zip((1,2,3,4,5,6,7,8,9),(2,5,5,4,5,6,3,7,6)): if j in a and i-k>=0and(i-k<1or d[i-k]):d[i]=max(d[i],d[i-k]*10+j) print((d[n]))
11
6
314
215
n, m, *a = list(map(int, open(0).read().split())) d = [] for i, j in ((7, 3), (9, 6), (8, 7), (6, 6), (5, 5), (4, 4), (3, 5), (1, 2), (2, 5)): if i in a: d.append((i, j)) dp = [0] * -~n for i in range(1, n + 1): for j, k in d: if i - k < 0 or i - k != 0 and not dp[i - k]: continue ...
n, m, *a = list(map(int, open(0).read().split())) d = [0] * -~n for i in range(1, n + 1): for j, k in zip((1, 2, 3, 4, 5, 6, 7, 8, 9), (2, 5, 5, 4, 5, 6, 3, 7, 6)): if j in a and i - k >= 0 and (i - k < 1 or d[i - k]): d[i] = max(d[i], d[i - k] * 10 + j) print((d[n]))
false
45.454545
[ "-d = []", "-for i, j in ((7, 3), (9, 6), (8, 7), (6, 6), (5, 5), (4, 4), (3, 5), (1, 2), (2, 5)):", "- if i in a:", "- d.append((i, j))", "-dp = [0] * -~n", "+d = [0] * -~n", "- for j, k in d:", "- if i - k < 0 or i - k != 0 and not dp[i - k]:", "- continue", "- ...
false
0.04209
0.089464
0.470464
[ "s052458892", "s206857872" ]
u545368057
p03734
python
s309643037
s276546885
293
266
69,212
69,556
Accepted
Accepted
9.22
N,W = list(map(int, input().split())) ws = [] vs = [] for i in range(N): w,v = list(map(int, input().split())) ws.append(w) vs.append(v) ws_m = [w-ws[0] for w in ws] """ i番目まで見て、n個選んでいて、重さがwのときのvの最大値 ただし、wはN個選んだときにW-N*[w[0]]となっているので、そこをmaxとする dp[i][n][w] """ dp = [[[-1]*(3*N+10) for i in ran...
N,W = list(map(int, input().split())) ws = [] vs = [] for i in range(N): w,v = list(map(int, input().split())) ws.append(w) vs.append(v) ws_m = [w-ws[0] for w in ws] """ i番目まで見て、n個選んでいて、重さがwのときのvの最大値 ただし、wはN個選んだときにW-N*[w[0]]となっているので、そこをmaxとする dp[i][n][w] """ dp = [[-1]*(3*N+1) for i in range...
30
50
820
1,334
N, W = list(map(int, input().split())) ws = [] vs = [] for i in range(N): w, v = list(map(int, input().split())) ws.append(w) vs.append(v) ws_m = [w - ws[0] for w in ws] """ i番目まで見て、n個選んでいて、重さがwのときのvの最大値 ただし、wはN個選んだときにW-N*[w[0]]となっているので、そこをmaxとする dp[i][n][w] """ dp = [[[-1] * (3 * N + 10) for i in range(N ...
N, W = list(map(int, input().split())) ws = [] vs = [] for i in range(N): w, v = list(map(int, input().split())) ws.append(w) vs.append(v) ws_m = [w - ws[0] for w in ws] """ i番目まで見て、n個選んでいて、重さがwのときのvの最大値 ただし、wはN個選んだときにW-N*[w[0]]となっているので、そこをmaxとする dp[i][n][w] """ dp = [[-1] * (3 * N + 1) for i in range(N + ...
false
40
[ "-dp = [[[-1] * (3 * N + 10) for i in range(N + 1)] for j in range(N + 1)]", "+dp = [[-1] * (3 * N + 1) for i in range(N + 1)]", "+dp[0][0] = 0", "+for i, (w, v) in enumerate(zip(ws_m, vs)):", "+ dp[i + 1][:] = dp[i][:]", "+ for j in range(len(dp[i])):", "+ if dp[i][j] == -1:", "+ ...
false
0.118788
0.119282
0.995862
[ "s309643037", "s276546885" ]
u588341295
p03127
python
s505974400
s905585598
137
82
16,888
16,828
Accepted
Accepted
40.15
# -*- coding: utf-8 -*- import sys, re from collections import deque, defaultdict, Counter from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10 if sys.version_info.minor >= 5: from math import gcd else: from fractions import gcd from heapq import heappop, heappush, heapify, heappushpop from b...
# -*- coding: utf-8 -*- """ 参考:https://img.atcoder.jp/abc118/editorial.pdf """ import sys, re from collections import deque, defaultdict, Counter from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10 if sys.version_info.minor >= 5: from math import gcd else: from fractions import gcd from ...
46
40
1,520
1,424
# -*- coding: utf-8 -*- import sys, re from collections import deque, defaultdict, Counter from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10 if sys.version_info.minor >= 5: from math import gcd else: from fractions import gcd from heapq import heappop, heappush, heapify, heappushpop from bi...
# -*- coding: utf-8 -*- """ 参考:https://img.atcoder.jp/abc118/editorial.pdf """ import sys, re from collections import deque, defaultdict, Counter from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10 if sys.version_info.minor >= 5: from math import gcd else: from fractions import gcd from heapq...
false
13.043478
[ "+\"\"\"", "+参考:https://img.atcoder.jp/abc118/editorial.pdf", "+\"\"\"", "-A.sort()", "-mn = A[0]", "-i = 1", "-while i < N and mn > 1:", "- div = A[i] % mn", "- if div != 0 and mn > div:", "- mn = div", "- i = 0", "- else:", "- i += 1", "-print(mn)", "+prin...
false
0.038736
0.039504
0.980557
[ "s505974400", "s905585598" ]
u759412327
p03352
python
s435242717
s272142774
19
17
3,316
2,940
Accepted
Accepted
10.53
X = int(eval(input())) se = set(n**e for n in range(32) for e in range(2,11) if n**e <= X) answer = max(se) print(answer)
X = int(eval(input())) S = set(n**e for n in range(32) for e in range(2,11) if n**e<=X) print((max(S)))
5
3
121
98
X = int(eval(input())) se = set(n**e for n in range(32) for e in range(2, 11) if n ** e <= X) answer = max(se) print(answer)
X = int(eval(input())) S = set(n**e for n in range(32) for e in range(2, 11) if n ** e <= X) print((max(S)))
false
40
[ "-se = set(n**e for n in range(32) for e in range(2, 11) if n ** e <= X)", "-answer = max(se)", "-print(answer)", "+S = set(n**e for n in range(32) for e in range(2, 11) if n ** e <= X)", "+print((max(S)))" ]
false
0.049823
0.049073
1.015281
[ "s435242717", "s272142774" ]
u902462889
p04045
python
s900578878
s533181072
593
210
3,064
3,064
Accepted
Accepted
64.59
lst_1 = input().split() N = lst_1[0] K = int(lst_1[1]) lst_N = list(N) lst_hate = input().split() flg = True while 1: for i in range(len(lst_N)): for j in range(len(lst_hate)): if lst_N[i] == lst_hate[j]: flg = False break if fl...
N, K = list(map(int, input().split())) D = list(map(int, input().split())) k = N """while k > 0: lst.append(k % 10) k //= 10 #lst.reverse()""" #print(lst) while 1: flg = True lst = [] N = k while k > 0: lst.append(k % 10) k //= 10 lst.reverse() # print...
34
29
475
509
lst_1 = input().split() N = lst_1[0] K = int(lst_1[1]) lst_N = list(N) lst_hate = input().split() flg = True while 1: for i in range(len(lst_N)): for j in range(len(lst_hate)): if lst_N[i] == lst_hate[j]: flg = False break if flg == True: break N =...
N, K = list(map(int, input().split())) D = list(map(int, input().split())) k = N """while k > 0: lst.append(k % 10) k //= 10 #lst.reverse()""" # print(lst) while 1: flg = True lst = [] N = k while k > 0: lst.append(k % 10) k //= 10 lst.reverse() # print(lst) for i in ...
false
14.705882
[ "-lst_1 = input().split()", "-N = lst_1[0]", "-K = int(lst_1[1])", "-lst_N = list(N)", "-lst_hate = input().split()", "-flg = True", "+N, K = list(map(int, input().split()))", "+D = list(map(int, input().split()))", "+k = N", "+\"\"\"while k > 0:", "+ lst.append(k % 10)", "+ k //= 10", ...
false
0.044715
0.033857
1.320707
[ "s900578878", "s533181072" ]
u075012704
p03151
python
s356173838
s670302349
391
253
97,712
21,552
Accepted
Accepted
35.29
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) A_origin = A[:] if sum(A) < sum(B): print((-1)) exit() diff = [[i, a - b] for i, a, b in zip(list(range(N)), A, B)] order = sorted([[i, x] for i, x in diff if x > 0], key=lambda d: d[1]) C = [] cha...
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) # 各テストの余裕を小さい順に margins = [[i, a - b] for i, (a, b) in enumerate(zip(A, B)) if (a - b) > 0] margins.sort(key=lambda m: m[1]) # 調整済みA X = A[:] # 余裕が大きい方から使っていく for i in range(N): while (A[i] < B[i]) and m...
33
39
730
758
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) A_origin = A[:] if sum(A) < sum(B): print((-1)) exit() diff = [[i, a - b] for i, a, b in zip(list(range(N)), A, B)] order = sorted([[i, x] for i, x in diff if x > 0], key=lambda d: d[1]) C = [] charge = order.pop() fo...
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) # 各テストの余裕を小さい順に margins = [[i, a - b] for i, (a, b) in enumerate(zip(A, B)) if (a - b) > 0] margins.sort(key=lambda m: m[1]) # 調整済みA X = A[:] # 余裕が大きい方から使っていく for i in range(N): while (A[i] < B[i]) and margins: co...
false
15.384615
[ "-A_origin = A[:]", "-if sum(A) < sum(B):", "- print((-1))", "- exit()", "-diff = [[i, a - b] for i, a, b in zip(list(range(N)), A, B)]", "-order = sorted([[i, x] for i, x in diff if x > 0], key=lambda d: d[1])", "-C = []", "-charge = order.pop()", "+# 各テストの余裕を小さい順に", "+margins = [[i, a - b]...
false
0.036706
0.037286
0.984457
[ "s356173838", "s670302349" ]
u150984829
p02258
python
s830552941
s848838403
180
120
19,840
5,640
Accepted
Accepted
33.33
import sys b,s=-1e10,1e10 eval(input()) for r in map(int,sys.stdin.readlines()): b,s=(b,r-s)[b<r-s],(s,r)[s>r] print(b)
import sys b,s=-1e10,1e10 eval(input()) for r in map(int,sys.stdin): if b<r-s:b=r-s if s>r:s=r print(b)
6
7
120
106
import sys b, s = -1e10, 1e10 eval(input()) for r in map(int, sys.stdin.readlines()): b, s = (b, r - s)[b < r - s], (s, r)[s > r] print(b)
import sys b, s = -1e10, 1e10 eval(input()) for r in map(int, sys.stdin): if b < r - s: b = r - s if s > r: s = r print(b)
false
14.285714
[ "-for r in map(int, sys.stdin.readlines()):", "- b, s = (b, r - s)[b < r - s], (s, r)[s > r]", "+for r in map(int, sys.stdin):", "+ if b < r - s:", "+ b = r - s", "+ if s > r:", "+ s = r" ]
false
0.037751
0.036637
1.030397
[ "s830552941", "s848838403" ]
u678167152
p03361
python
s217263295
s997484610
196
29
39,280
9,236
Accepted
Accepted
85.2
def check(): H, W = list(map(int, input().split())) S = [0]*(H+2) S[0] = '.'*(W+2) S[H+1] = '.'*(W+2) dh = [0,1,0,-1] dw = [1,0,-1,0] for h in range(1,H+1): S[h] = '.' + eval(input()) + '.' for h in range(H): for w in range(W): if S[h][w]=='#': ...
def check(): H, W = list(map(int, input().split())) S = [0]*(H+2) S[0] = '.'*(W+2) S[H+1] = '.'*(W+2) for h in range(1,H+1): S[h] = '.' + eval(input()) + '.' dh = [0,1,0,-1] dw = [1,0,-1,0] for h in range(1,H+1): for w in range(1,W+1): i...
19
25
510
592
def check(): H, W = list(map(int, input().split())) S = [0] * (H + 2) S[0] = "." * (W + 2) S[H + 1] = "." * (W + 2) dh = [0, 1, 0, -1] dw = [1, 0, -1, 0] for h in range(1, H + 1): S[h] = "." + eval(input()) + "." for h in range(H): for w in range(W): if S[h][w...
def check(): H, W = list(map(int, input().split())) S = [0] * (H + 2) S[0] = "." * (W + 2) S[H + 1] = "." * (W + 2) for h in range(1, H + 1): S[h] = "." + eval(input()) + "." dh = [0, 1, 0, -1] dw = [1, 0, -1, 0] for h in range(1, H + 1): for w in range(1, W + 1): ...
false
24
[ "+ for h in range(1, H + 1):", "+ S[h] = \".\" + eval(input()) + \".\"", "- S[h] = \".\" + eval(input()) + \".\"", "- for h in range(H):", "- for w in range(W):", "- if S[h][w] == \"#\":", "- for i in range(4):", "- if S[h + dh[i]...
false
0.055386
0.036963
1.498417
[ "s217263295", "s997484610" ]
u774729733
p02954
python
s831665331
s226329713
403
345
83,544
77,964
Accepted
Accepted
14.39
from copy import deepcopy from sys import exit,setrecursionlimit import math from collections import defaultdict,Counter,deque from fractions import Fraction as frac import bisect import sys import logging import heapq logging.basicConfig(level=logging.DEBUG) input = sys.stdin.readline setrecursionlimit(...
from copy import deepcopy from sys import exit,setrecursionlimit import math from collections import defaultdict,Counter,deque from fractions import Fraction as frac import bisect import sys import logging import heapq logging.basicConfig(level=logging.DEBUG) input = sys.stdin.readline setrecursionlimit(...
53
51
1,086
949
from copy import deepcopy from sys import exit, setrecursionlimit import math from collections import defaultdict, Counter, deque from fractions import Fraction as frac import bisect import sys import logging import heapq logging.basicConfig(level=logging.DEBUG) input = sys.stdin.readline setrecursionlimit(1000000) ...
from copy import deepcopy from sys import exit, setrecursionlimit import math from collections import defaultdict, Counter, deque from fractions import Fraction as frac import bisect import sys import logging import heapq logging.basicConfig(level=logging.DEBUG) input = sys.stdin.readline setrecursionlimit(1000000) ...
false
3.773585
[ "+ A = [0 for _ in range(len(S) - 1)]", "- start = 0", "- base = 0", "- end = 0", "- group = []", "+ s = 0", "+ b = 0", "+ e = 0", "+ l = 0", "- s = S[i]", "- if mode == \"L\" and s == mode:", "+ c = S[i]", "+ if mode == \"L\" and c == m...
false
0.150456
0.061134
2.461084
[ "s831665331", "s226329713" ]
u935558307
p03682
python
s701707969
s752711479
1,875
1,617
124,836
134,820
Accepted
Accepted
13.76
class UnionFind(): def __init__(self,n): self.n=n self.parents = [i for i in range(n+1)] self.size = [1]*(n+1) def find(self,x): if self.parents[x]==x: return x else: self.parents[x]=self.find(self.parents[x]) return self.pare...
class UnionFind(): def __init__(self,n): self.n=n self.parents = [i for i in range(n+1)] self.size = [1]*(n+1) def find(self,x): if self.parents[x]==x: return x else: self.parents[x]=self.find(self.parents[x]) return self.pare...
45
44
1,261
1,270
class UnionFind: def __init__(self, n): self.n = n self.parents = [i for i in range(n + 1)] self.size = [1] * (n + 1) def find(self, x): if self.parents[x] == x: return x else: self.parents[x] = self.find(self.parents[x]) return self.p...
class UnionFind: def __init__(self, n): self.n = n self.parents = [i for i in range(n + 1)] self.size = [1] * (n + 1) def find(self, x): if self.parents[x] == x: return x else: self.parents[x] = self.find(self.parents[x]) return self.p...
false
2.222222
[ "+ self.size[xRoot] += self.size[yRoot]", "+ self.size[yRoot] = 0", "- if self.size[xRoot] == self.size[yRoot]:", "- self.size[yRoot] += 1", "+ self.size[yRoot] += self.size[xRoot]", "+ self.size[xRoot] = 0", "+XY = [[i] + list(map(in...
false
0.195127
0.105219
1.854484
[ "s701707969", "s752711479" ]
u729133443
p03075
python
s183338623
s900213012
165
17
38,256
2,940
Accepted
Accepted
89.7
a,*_,e,k=eval('int(input()),'*6);print(('Y:a(y !'[e-a>k::2]))
a,*_,e,k=list(map(int,open(0)));print(('Y:a(y !'[e-a>k::2]))
1
1
59
52
a, *_, e, k = eval("int(input())," * 6) print(("Y:a(y !"[e - a > k :: 2]))
a, *_, e, k = list(map(int, open(0))) print(("Y:a(y !"[e - a > k :: 2]))
false
0
[ "-a, *_, e, k = eval(\"int(input()),\" * 6)", "+a, *_, e, k = list(map(int, open(0)))" ]
false
0.041785
0.034743
1.20268
[ "s183338623", "s900213012" ]
u588341295
p04013
python
s739803038
s702912610
315
187
92,252
5,236
Accepted
Accepted
40.63
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ...
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ...
39
37
1,174
1,097
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in rang...
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in rang...
false
5.128205
[ "-A = LIST()", "-MAX = N * K", "-# dp[i][j][k] := i枚目までからj枚取って、合計をkにする通り数", "-dp = list3d(N + 1, N + 1, MAX + 1, 0)", "-dp[0][0][0] = 1", "+# 予め-Kした状態で用意しておく", "+A = [a - K for a in LIST()]", "+MAX = N * K * 2", "+# dp[i][k] := i枚目までのカードで、合計をkにする通り数", "+dp = list2d(N + 1, MAX + 1, 0)", "+# 負の数を考...
false
0.041233
0.03974
1.03757
[ "s739803038", "s702912610" ]
u819048695
p02889
python
s443483729
s985692002
1,857
1,042
125,404
72,284
Accepted
Accepted
43.89
def warshal(data): for k in range(n): for i in range(n): for j in range(n): data[i][j]=min(data[i][j],data[i][k]+data[k][j]) return data n,m,l=list(map(int,input().split())) inf=float("inf") data=[[inf]*n for i in range(n)] for i in range(m): a,b,c=list(map(int,...
import sys input=sys.stdin.readline def Warshall_Floyd(N,DIST): for k in range(N): for i in range(N): for j in range(N): DIST[i][j]=min(DIST[i][j],DIST[i][k]+DIST[k][j]) return DIST N,M,L=list(map(int,input().split())) ABC=[list(map(int,input().split())) for i ...
35
44
828
958
def warshal(data): for k in range(n): for i in range(n): for j in range(n): data[i][j] = min(data[i][j], data[i][k] + data[k][j]) return data n, m, l = list(map(int, input().split())) inf = float("inf") data = [[inf] * n for i in range(n)] for i in range(m): a, b, c = l...
import sys input = sys.stdin.readline def Warshall_Floyd(N, DIST): for k in range(N): for i in range(N): for j in range(N): DIST[i][j] = min(DIST[i][j], DIST[i][k] + DIST[k][j]) return DIST N, M, L = list(map(int, input().split())) ABC = [list(map(int, input().split())) ...
false
20.454545
[ "-def warshal(data):", "- for k in range(n):", "- for i in range(n):", "- for j in range(n):", "- data[i][j] = min(data[i][j], data[i][k] + data[k][j])", "- return data", "+import sys", "+", "+input = sys.stdin.readline", "-n, m, l = list(map(int, input().spl...
false
0.091547
0.047949
1.909261
[ "s443483729", "s985692002" ]
u690536347
p03074
python
s011840012
s277755959
102
91
9,996
10,000
Accepted
Accepted
10.78
from itertools import accumulate as ac N, K = list(map(int, input().split())) *S, = list(map(int, eval(input()))) l = [] c0, c1 = 0, 0 prev = 0 for i, j in enumerate(S): if i==0: if j==0: c0 += 1 else: c1 += 1 else: if prev!=j: if ...
from itertools import accumulate as ac N, K = list(map(int, input().split())) *S, = list(map(int, eval(input()))) l = [] c = 0 if N==1: l.append(S[0]) else: for i in range(N-1): c += 1 if S[i]!=S[i+1]: l.append(c) c = 0 if c: l.append(c+1) ...
47
32
811
531
from itertools import accumulate as ac N, K = list(map(int, input().split())) (*S,) = list(map(int, eval(input()))) l = [] c0, c1 = 0, 0 prev = 0 for i, j in enumerate(S): if i == 0: if j == 0: c0 += 1 else: c1 += 1 else: if prev != j: if prev == 1: ...
from itertools import accumulate as ac N, K = list(map(int, input().split())) (*S,) = list(map(int, eval(input()))) l = [] c = 0 if N == 1: l.append(S[0]) else: for i in range(N - 1): c += 1 if S[i] != S[i + 1]: l.append(c) c = 0 if c: l.append(c + 1) if S[0]...
false
31.914894
[ "-c0, c1 = 0, 0", "-prev = 0", "-for i, j in enumerate(S):", "- if i == 0:", "- if j == 0:", "- c0 += 1", "- else:", "- c1 += 1", "- else:", "- if prev != j:", "- if prev == 1:", "- l.append(c1)", "- c1...
false
0.036803
0.041949
0.877321
[ "s011840012", "s277755959" ]
u227550284
p02712
python
s187128670
s568835366
210
147
56,324
9,156
Accepted
Accepted
30
import sys input = sys.stdin.readline def fizzbuzz(n): if n % 5 == 0 and n % 3 == 0: return 0 elif n % 3 == 0: return 0 elif n % 5 == 0: return 0 else: return n def main(): n = int(eval(input())) li = list(range(1, n+1)) change_li = lis...
n = int(eval(input())) ans = 0 for i in range(1, n+1): if i % 3 != 0 and i % 5 != 0: ans += i print(ans)
26
7
408
118
import sys input = sys.stdin.readline def fizzbuzz(n): if n % 5 == 0 and n % 3 == 0: return 0 elif n % 3 == 0: return 0 elif n % 5 == 0: return 0 else: return n def main(): n = int(eval(input())) li = list(range(1, n + 1)) change_li = list(map(fizzbuzz, l...
n = int(eval(input())) ans = 0 for i in range(1, n + 1): if i % 3 != 0 and i % 5 != 0: ans += i print(ans)
false
73.076923
[ "-import sys", "-", "-input = sys.stdin.readline", "-", "-", "-def fizzbuzz(n):", "- if n % 5 == 0 and n % 3 == 0:", "- return 0", "- elif n % 3 == 0:", "- return 0", "- elif n % 5 == 0:", "- return 0", "- else:", "- return n", "-", "-", "-def ...
false
0.151
0.134864
1.119647
[ "s187128670", "s568835366" ]
u177411511
p03309
python
s152238975
s514553356
356
247
27,264
27,260
Accepted
Accepted
30.62
import sys from collections import deque from collections import Counter import statistics import math stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline() n = ni() a_li = na() for i in range(n): a_li[i] = a_li[i] - (i + 1) m1...
import sys from collections import deque from collections import Counter import statistics import math stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline() n = ni() a_li = na() for i in range(n): a_li[i] = a_li[i] - (i + 1) m1...
23
23
512
504
import sys from collections import deque from collections import Counter import statistics import math stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline() n = ni() a_li = na() for i in range(n): a_li[i] = a_li[i] - (i + 1) m1 = statistics.med...
import sys from collections import deque from collections import Counter import statistics import math stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline() n = ni() a_li = na() for i in range(n): a_li[i] = a_li[i] - (i + 1) m1 = statistics.med...
false
0
[ "-m2 = statistics.median_high(a_li)", "+# m2 = statistics.median_high(a_li)", "-ans2 = 0", "+# ans2 = 0", "- ans2 += abs(a_li[i] - m2)", "-print((min(ans1, ans2)))", "+ # ans2 += abs(a_li[i] - m2)", "+print(ans1)" ]
false
0.048217
0.04889
0.986244
[ "s152238975", "s514553356" ]