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
u677312543
p03212
python
s035158271
s367401768
355
92
3,064
3,060
Accepted
Accepted
74.08
n = int(eval(input())) cnt = 0 i = 1 while i <= n: is_broken = False string = list(str(i)) for j, s in enumerate(string): if s not in ['3', '5', '7']: i = i + 10**(len(string) - j - 1) is_broken = True break if is_broken: continue ...
n = int(eval(input())) def dfs(s): if int(s) > n: return 0 ret = 1 if all(s.count(c) > 0 for c in '753') else 0 for c in '753': ret += dfs(s + c) return ret print((dfs('0')))
24
11
479
210
n = int(eval(input())) cnt = 0 i = 1 while i <= n: is_broken = False string = list(str(i)) for j, s in enumerate(string): if s not in ["3", "5", "7"]: i = i + 10 ** (len(string) - j - 1) is_broken = True break if is_broken: continue c1 = string.cou...
n = int(eval(input())) def dfs(s): if int(s) > n: return 0 ret = 1 if all(s.count(c) > 0 for c in "753") else 0 for c in "753": ret += dfs(s + c) return ret print((dfs("0")))
false
54.166667
[ "-cnt = 0", "-i = 1", "-while i <= n:", "- is_broken = False", "- string = list(str(i))", "- for j, s in enumerate(string):", "- if s not in [\"3\", \"5\", \"7\"]:", "- i = i + 10 ** (len(string) - j - 1)", "- is_broken = True", "- break", "- i...
false
0.091683
0.100534
0.91196
[ "s035158271", "s367401768" ]
u017810624
p02695
python
s317854809
s770760639
275
167
103,152
85,992
Accepted
Accepted
39.27
n,m,q=list(map(int,input().split())) l=[list(map(int,input().split())) for i in range(q)] L=[] for i in range(1,m+1): if n==1: L.append((i)) else: for i2 in range(i,m+1): if n==2: L.append((i,i2)) else: for i3 in range(i2,m+1): if n==3: L.append...
import itertools n,m,q=list(map(int,input().split())) l=[list(map(int,input().split())) for i in range(q)] M=[i+1 for i in range(m)] L=[] for i in itertools.combinations_with_replacement(M,n): L.append(i) ans=[] for i in range(len(L)): ct=0 for j in range(q): if L[i][l[j][1]-1]-L[i][l[j][0]-1]==l[j...
49
15
1,676
373
n, m, q = list(map(int, input().split())) l = [list(map(int, input().split())) for i in range(q)] L = [] for i in range(1, m + 1): if n == 1: L.append((i)) else: for i2 in range(i, m + 1): if n == 2: L.append((i, i2)) else: for i3 in range(...
import itertools n, m, q = list(map(int, input().split())) l = [list(map(int, input().split())) for i in range(q)] M = [i + 1 for i in range(m)] L = [] for i in itertools.combinations_with_replacement(M, n): L.append(i) ans = [] for i in range(len(L)): ct = 0 for j in range(q): if L[i][l[j][1] - 1]...
false
69.387755
[ "+import itertools", "+", "+M = [i + 1 for i in range(m)]", "-for i in range(1, m + 1):", "- if n == 1:", "- L.append((i))", "- else:", "- for i2 in range(i, m + 1):", "- if n == 2:", "- L.append((i, i2))", "- else:", "- f...
false
0.095533
0.065864
1.450462
[ "s317854809", "s770760639" ]
u978178314
p02761
python
s433280068
s702581801
201
173
41,456
38,384
Accepted
Accepted
13.93
N, M = list(map(int, input().split())) SC = [list(map(int, input().split())) for _ in range(M)] i = 10**(N-1) if N > 1 else 0 while i < 10**N: n = [(i//10**j)%10 for j in reversed(list(range(N)))] f = True for s, c in SC: if n[s-1] != c: f = False if f: break i += 1 if i >= 10**N: ...
N, M = list(map(int, input().split())) num = [-1]*N err = False for _ in range(M): s, c = list(map(int, input().split())) if num[s-1] == -1: num[s-1] = c else: if num[s-1] != c: err = True if err or (N > 1 and num[0] == 0): print((-1)) else: ans = 0 i = 0 n = 0 while i < N:...
16
24
344
445
N, M = list(map(int, input().split())) SC = [list(map(int, input().split())) for _ in range(M)] i = 10 ** (N - 1) if N > 1 else 0 while i < 10**N: n = [(i // 10**j) % 10 for j in reversed(list(range(N)))] f = True for s, c in SC: if n[s - 1] != c: f = False if f: break i ...
N, M = list(map(int, input().split())) num = [-1] * N err = False for _ in range(M): s, c = list(map(int, input().split())) if num[s - 1] == -1: num[s - 1] = c else: if num[s - 1] != c: err = True if err or (N > 1 and num[0] == 0): print((-1)) else: ans = 0 i = 0 ...
false
33.333333
[ "-SC = [list(map(int, input().split())) for _ in range(M)]", "-i = 10 ** (N - 1) if N > 1 else 0", "-while i < 10**N:", "- n = [(i // 10**j) % 10 for j in reversed(list(range(N)))]", "- f = True", "- for s, c in SC:", "- if n[s - 1] != c:", "- f = False", "- if f:", "...
false
0.037756
0.071249
0.52992
[ "s433280068", "s702581801" ]
u975445930
p02682
python
s588575400
s349425548
24
21
9,172
9,068
Accepted
Accepted
12.5
a,b,c,k = list(map(int, input().split())) if k<=a: print(k) elif a < k and k <= a+b: print(a) elif k > a+b: print((a-(k-a-b)))
a,b,c,k = list(map(int, input().split())) A = min(a,k) k -= A B = min(b,k) k -= B print((A-k))
7
6
136
91
a, b, c, k = list(map(int, input().split())) if k <= a: print(k) elif a < k and k <= a + b: print(a) elif k > a + b: print((a - (k - a - b)))
a, b, c, k = list(map(int, input().split())) A = min(a, k) k -= A B = min(b, k) k -= B print((A - k))
false
14.285714
[ "-if k <= a:", "- print(k)", "-elif a < k and k <= a + b:", "- print(a)", "-elif k > a + b:", "- print((a - (k - a - b)))", "+A = min(a, k)", "+k -= A", "+B = min(b, k)", "+k -= B", "+print((A - k))" ]
false
0.038046
0.038266
0.994273
[ "s588575400", "s349425548" ]
u670180528
p03785
python
s446187815
s371299953
129
101
14,436
14,436
Accepted
Accepted
21.71
from collections import deque n,c,k,*t = list(map(int,open(0).read().split())) d = deque(sorted(t)+[float("inf")]) f = d[0] cnt = ans = 0 while d: if d[0]-f <= k: del d[0] cnt += 1 if cnt == c: f = d[0] cnt = 0 ans += 1 else: f = d.popleft() cnt = 1 ans += 1 print((ans-(c==1)))
from collections import deque def solve(): n,c,k,*t = list(map(int,open(0).read().split())) d = deque(sorted(t)+[float("inf")]) fir = d[0] cnt = ans = 0 while d: if d[0]-fir <= k: del d[0] cnt += 1 if cnt == c: fir = d[0] cnt = 0 ans += 1 else: fir = d.popleft() cnt...
18
24
310
392
from collections import deque n, c, k, *t = list(map(int, open(0).read().split())) d = deque(sorted(t) + [float("inf")]) f = d[0] cnt = ans = 0 while d: if d[0] - f <= k: del d[0] cnt += 1 if cnt == c: f = d[0] cnt = 0 ans += 1 else: f = d.pop...
from collections import deque def solve(): n, c, k, *t = list(map(int, open(0).read().split())) d = deque(sorted(t) + [float("inf")]) fir = d[0] cnt = ans = 0 while d: if d[0] - fir <= k: del d[0] cnt += 1 if cnt == c: fir = d[0] ...
false
25
[ "-n, c, k, *t = list(map(int, open(0).read().split()))", "-d = deque(sorted(t) + [float(\"inf\")])", "-f = d[0]", "-cnt = ans = 0", "-while d:", "- if d[0] - f <= k:", "- del d[0]", "- cnt += 1", "- if cnt == c:", "- f = d[0]", "- cnt = 0", "+", ...
false
0.091604
0.118891
0.770481
[ "s446187815", "s371299953" ]
u141786930
p03078
python
s293616715
s666091381
1,761
740
158,892
8,508
Accepted
Accepted
57.98
# D - Cake 123 import heapq import itertools x, y, z, k = list(map(int, input().split())) A = list(int(a) for a in input().split()) B = list(int(b) for b in input().split()) C = list(int(c) for c in input().split()) hq = [] for i, j in itertools.product(A, B): heapq.heappush(hq, (i+j)*-1) AB = [...
# D - Cake 123 import heapq import itertools x, y, z, k = list(map(int, input().split())) A = list(int(a) for a in input().split()) B = list(int(b) for b in input().split()) C = list(int(c) for c in input().split()) A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) hq = [] for i in r...
25
41
524
825
# D - Cake 123 import heapq import itertools x, y, z, k = list(map(int, input().split())) A = list(int(a) for a in input().split()) B = list(int(b) for b in input().split()) C = list(int(c) for c in input().split()) hq = [] for i, j in itertools.product(A, B): heapq.heappush(hq, (i + j) * -1) AB = [] while len(hq)...
# D - Cake 123 import heapq import itertools x, y, z, k = list(map(int, input().split())) A = list(int(a) for a in input().split()) B = list(int(b) for b in input().split()) C = list(int(c) for c in input().split()) A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) hq = [] for i in range(x): for j in ...
false
39.02439
[ "+A.sort(reverse=True)", "+B.sort(reverse=True)", "+C.sort(reverse=True)", "+hq = []", "+for i in range(x):", "+ for j in range(y):", "+ for l in range(z):", "+ if (i + 1) * (j + 1) * (l + 1) <= k:", "+ heapq.heappush(hq, (A[i] + B[j] + C[l]) * -1)", "+ ...
false
0.065132
0.057182
1.139042
[ "s293616715", "s666091381" ]
u644907318
p03937
python
s002240082
s741775731
167
66
38,356
62,312
Accepted
Accepted
60.48
H,W = list(map(int,input().split())) A = [input().strip() for _ in range(H)] r = 0 c = 0 for i in range(H): for j in range(1,W): if A[i][j]==A[i][j-1]=="#": r += 1 for j in range(W): for i in range(1,H): if A[i][j]==A[i-1][j]=="#": c += 1 if r==W-1 and c==H-1:...
H,W = list(map(int,input().split())) A = [list(input().strip()) for _ in range(H)] x = [0,0] A[0][0] = "." while True: if x[0]==H-1 and x[1]==W-1:break if x[0]<H-1 and A[x[0]+1][x[1]]=="#": A[x[0]+1][x[1]]="." x = [x[0]+1,x[1]] elif x[1]<W-1 and A[x[0]][x[1]+1]=="#": A[x[0]...
16
27
369
796
H, W = list(map(int, input().split())) A = [input().strip() for _ in range(H)] r = 0 c = 0 for i in range(H): for j in range(1, W): if A[i][j] == A[i][j - 1] == "#": r += 1 for j in range(W): for i in range(1, H): if A[i][j] == A[i - 1][j] == "#": c += 1 if r == W - 1 and...
H, W = list(map(int, input().split())) A = [list(input().strip()) for _ in range(H)] x = [0, 0] A[0][0] = "." while True: if x[0] == H - 1 and x[1] == W - 1: break if x[0] < H - 1 and A[x[0] + 1][x[1]] == "#": A[x[0] + 1][x[1]] = "." x = [x[0] + 1, x[1]] elif x[1] < W - 1 and A[x[0]]...
false
40.740741
[ "-A = [input().strip() for _ in range(H)]", "-r = 0", "-c = 0", "+A = [list(input().strip()) for _ in range(H)]", "+x = [0, 0]", "+A[0][0] = \".\"", "+while True:", "+ if x[0] == H - 1 and x[1] == W - 1:", "+ break", "+ if x[0] < H - 1 and A[x[0] + 1][x[1]] == \"#\":", "+ A[x...
false
0.041895
0.036909
1.135094
[ "s002240082", "s741775731" ]
u936985471
p03167
python
s087781327
s634642434
685
598
49,448
49,696
Accepted
Accepted
12.7
import sys readline = sys.stdin.readline H,W = list(map(int,readline().split())) DIV = 10 ** 9 + 7 G = [None] * H for i in range(H): G[i] = readline().rstrip() dp = [[0] * (W + 1) for i in range(H + 1)] dp[0][1] = 1 for i in range(H): for j in range(W): if G[i][j] == "#": dp[i + 1][j + 1...
import sys readline = sys.stdin.readline H,W = list(map(int,readline().split())) G = [readline().rstrip() for i in range(H)] DIV = 10 ** 9 + 7 dp = [[0] * (W + 1) for i in range(H + 1)] dp[0][1] = 1 for i in range(H): for j in range(W): if G[i][j] == "#": dp[i + 1][j + 1] = 0 continue ...
21
18
443
418
import sys readline = sys.stdin.readline H, W = list(map(int, readline().split())) DIV = 10**9 + 7 G = [None] * H for i in range(H): G[i] = readline().rstrip() dp = [[0] * (W + 1) for i in range(H + 1)] dp[0][1] = 1 for i in range(H): for j in range(W): if G[i][j] == "#": dp[i + 1][j + 1] =...
import sys readline = sys.stdin.readline H, W = list(map(int, readline().split())) G = [readline().rstrip() for i in range(H)] DIV = 10**9 + 7 dp = [[0] * (W + 1) for i in range(H + 1)] dp[0][1] = 1 for i in range(H): for j in range(W): if G[i][j] == "#": dp[i + 1][j + 1] = 0 contin...
false
14.285714
[ "+G = [readline().rstrip() for i in range(H)]", "-G = [None] * H", "-for i in range(H):", "- G[i] = readline().rstrip()", "- else:", "- dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1]", "- dp[i + 1][j + 1] %= DIV", "+ continue", "+ dp[i + 1][j + 1] = ...
false
0.044772
0.044424
1.007823
[ "s087781327", "s634642434" ]
u525065967
p02603
python
s072157970
s461115133
32
28
9,056
9,108
Accepted
Accepted
12.5
n = int(eval(input())) A = [0] + [*list(map(int, input().split()))] dp_stock = [0]*(n+1) dp_yen = [0]*(n+1) dp_yen[0] = 1000 for day in range(1, n+1): dp_stock[day] = max(dp_stock[day-1], dp_yen[day-1] // A[day]) remain = dp_yen[day-1] - dp_stock[day-1]*A[day-1] dp_yen[day] = max(dp_yen[day-1], rema...
n = int(eval(input())) A = [0] + [*list(map(int, input().split()))] + [0] dp_yen = [0]*(n+1) dp_yen[1] = 1000 for day in range(1, n): stock = 0 if A[day] > 0: stock = dp_yen[day] // A[day] remain = dp_yen[day] - stock*A[day] dp_yen[day+1] = max(dp_yen[day], remain + stock * A[day+1]) print((dp_...
10
10
357
315
n = int(eval(input())) A = [0] + [*list(map(int, input().split()))] dp_stock = [0] * (n + 1) dp_yen = [0] * (n + 1) dp_yen[0] = 1000 for day in range(1, n + 1): dp_stock[day] = max(dp_stock[day - 1], dp_yen[day - 1] // A[day]) remain = dp_yen[day - 1] - dp_stock[day - 1] * A[day - 1] dp_yen[day] = max(dp_ye...
n = int(eval(input())) A = [0] + [*list(map(int, input().split()))] + [0] dp_yen = [0] * (n + 1) dp_yen[1] = 1000 for day in range(1, n): stock = 0 if A[day] > 0: stock = dp_yen[day] // A[day] remain = dp_yen[day] - stock * A[day] dp_yen[day + 1] = max(dp_yen[day], remain + stock * A[day + 1]) p...
false
0
[ "-A = [0] + [*list(map(int, input().split()))]", "-dp_stock = [0] * (n + 1)", "+A = [0] + [*list(map(int, input().split()))] + [0]", "-dp_yen[0] = 1000", "-for day in range(1, n + 1):", "- dp_stock[day] = max(dp_stock[day - 1], dp_yen[day - 1] // A[day])", "- remain = dp_yen[day - 1] - dp_stock[da...
false
0.04153
0.036596
1.134829
[ "s072157970", "s461115133" ]
u957167787
p03408
python
s912276667
s135139969
20
17
3,060
3,060
Accepted
Accepted
15
N = int(eval(input())) # 青いカードの枚数 s = [eval(input()) for _ in range(N)] # 青いカードに書かれている文字列 M = int(eval(input())) # 赤いカードの枚数 t = [eval(input()) for _ in range(M)] count = [s.count(s[i]) - t.count(s[i]) for i in range(N)] # sにある要素で得点をリストに入れる(tのみにある文字列は答えになり得ない) ans = max(0, max(count)) # countが全て負だったら0を返す print...
N = int(eval(input())) # 青いカードの枚数 s = [eval(input()) for _ in range(N)] # 青いカードに書かれている文字列 M = int(eval(input())) # 赤いカードの枚数 t = [eval(input()) for _ in range(M)] sset = list(set(s)) # set型のままではインデックスを選べないので注意,この文はなくても良いがforループの短縮に繋がる count = [s.count(sset[i]) - t.count(sset[i]) for i in range(len(sset))] # sにある要...
9
10
302
391
N = int(eval(input())) # 青いカードの枚数 s = [eval(input()) for _ in range(N)] # 青いカードに書かれている文字列 M = int(eval(input())) # 赤いカードの枚数 t = [eval(input()) for _ in range(M)] count = [ s.count(s[i]) - t.count(s[i]) for i in range(N) ] # sにある要素で得点をリストに入れる(tのみにある文字列は答えになり得ない) ans = max(0, max(count)) # countが全て負だったら0を返す prin...
N = int(eval(input())) # 青いカードの枚数 s = [eval(input()) for _ in range(N)] # 青いカードに書かれている文字列 M = int(eval(input())) # 赤いカードの枚数 t = [eval(input()) for _ in range(M)] sset = list(set(s)) # set型のままではインデックスを選べないので注意,この文はなくても良いがforループの短縮に繋がる count = [ s.count(sset[i]) - t.count(sset[i]) for i in range(len(sset)) ] # s...
false
10
[ "+sset = list(set(s)) # set型のままではインデックスを選べないので注意,この文はなくても良いがforループの短縮に繋がる", "- s.count(s[i]) - t.count(s[i]) for i in range(N)", "+ s.count(sset[i]) - t.count(sset[i]) for i in range(len(sset))", "-ans = max(0, max(count)) # countが全て負だったら0を返す", "+ans = max(0, max(count)) # countの最大値が負だったら0を返す" ]
false
0.050279
0.049774
1.010135
[ "s912276667", "s135139969" ]
u133936772
p03212
python
s351507827
s602681081
103
50
3,060
3,060
Accepted
Accepted
51.46
n = int(eval(input())) import itertools as it ans = 0 for i in range(11): for p in it.product(*['357']*i): if len(set(p))>2 and int(''.join(p))<=n: ans += 1 print(ans)
n = eval(input()) import itertools as it print((sum(len(set(p))>2 and int(''.join(p))<=int(n) for i in range(len(n)+1) for p in it.product('357',repeat=i))))
8
3
180
151
n = int(eval(input())) import itertools as it ans = 0 for i in range(11): for p in it.product(*["357"] * i): if len(set(p)) > 2 and int("".join(p)) <= n: ans += 1 print(ans)
n = eval(input()) import itertools as it print( ( sum( len(set(p)) > 2 and int("".join(p)) <= int(n) for i in range(len(n) + 1) for p in it.product("357", repeat=i) ) ) )
false
62.5
[ "-n = int(eval(input()))", "+n = eval(input())", "-ans = 0", "-for i in range(11):", "- for p in it.product(*[\"357\"] * i):", "- if len(set(p)) > 2 and int(\"\".join(p)) <= n:", "- ans += 1", "-print(ans)", "+print(", "+ (", "+ sum(", "+ len(set(p)) >...
false
0.151804
0.038194
3.97456
[ "s351507827", "s602681081" ]
u368796742
p02821
python
s886460501
s860469127
440
347
23,420
23,412
Accepted
Accepted
21.14
def main(): import bisect import numpy as np n,k = list(map(int,input().split())) l = list(map(int,input().split())) l.sort() l1 = np.array(l) def bise(x): y = np.searchsorted(l1,x-l1) return n*n-y.sum() left = -1 right = l[-1]*2+1 while right > le...
def main(): import bisect import numpy as np n,k = list(map(int,input().split())) l = list(map(int,input().split())) l.sort() l = np.array(l) def bise(x): y = np.searchsorted(l,x-l) return n*n-y.sum() left = -1 right = l[-1]*2+1 while right > left+...
34
32
754
714
def main(): import bisect import numpy as np n, k = list(map(int, input().split())) l = list(map(int, input().split())) l.sort() l1 = np.array(l) def bise(x): y = np.searchsorted(l1, x - l1) return n * n - y.sum() left = -1 right = l[-1] * 2 + 1 while right > l...
def main(): import bisect import numpy as np n, k = list(map(int, input().split())) l = list(map(int, input().split())) l.sort() l = np.array(l) def bise(x): y = np.searchsorted(l, x - l) return n * n - y.sum() left = -1 right = l[-1] * 2 + 1 while right > left...
false
5.882353
[ "- l1 = np.array(l)", "+ l = np.array(l)", "- y = np.searchsorted(l1, x - l1)", "+ y = np.searchsorted(l, x - l)", "- count = 0", "- acc = [0]", "- for i in l:", "- acc.append(acc[-1] + i)", "- for i in l:", "- index = bisect.bisect_left(l, right - i)"...
false
0.261779
0.483343
0.541602
[ "s886460501", "s860469127" ]
u539367121
p02989
python
s926675450
s143051198
116
68
20,668
20,708
Accepted
Accepted
41.38
from bisect import bisect_left n=int(eval(input())) d=list(map(int,input().split())) d=sorted(d) ans=0 for i in range(1,10**5+1): p=bisect_left(d,i) ans+=1 if p==(n-p) else 0 print(ans)
n=int(eval(input())) d=sorted(list(map(int,input().split()))) ans=d[n//2]-d[n//2-1] print(ans)
12
4
197
92
from bisect import bisect_left n = int(eval(input())) d = list(map(int, input().split())) d = sorted(d) ans = 0 for i in range(1, 10**5 + 1): p = bisect_left(d, i) ans += 1 if p == (n - p) else 0 print(ans)
n = int(eval(input())) d = sorted(list(map(int, input().split()))) ans = d[n // 2] - d[n // 2 - 1] print(ans)
false
66.666667
[ "-from bisect import bisect_left", "-", "-d = list(map(int, input().split()))", "-d = sorted(d)", "-ans = 0", "-for i in range(1, 10**5 + 1):", "- p = bisect_left(d, i)", "- ans += 1 if p == (n - p) else 0", "+d = sorted(list(map(int, input().split())))", "+ans = d[n // 2] - d[n // 2 - 1]" ]
false
0.073647
0.044044
1.672105
[ "s926675450", "s143051198" ]
u562935282
p03095
python
s354817481
s015791514
751
28
3,444
3,820
Accepted
Accepted
96.27
from collections import defaultdict mod = 10 ** 9 + 7 n = int(eval(input())) s = eval(input()) d = defaultdict(int) ans = 0 for c in s: d[c] += 1 t = 1 for chr_, cnt in list(d.items()): if chr_ == c: continue t *= cnt + 1 ans = (ans + t) % mod print(ans)...
from collections import Counter from functools import reduce from operator import mul mod = 10 ** 9 + 7 def my_mul(a, b): return a * b % mod n = int(eval(input())) s = eval(input()) cnt = Counter(s) print((reduce(my_mul, (v + 1 for v in list(cnt.values()))) - 1)) # 同じ文字列でも、異なる位置から作られたものは区別...
19
24
303
517
from collections import defaultdict mod = 10**9 + 7 n = int(eval(input())) s = eval(input()) d = defaultdict(int) ans = 0 for c in s: d[c] += 1 t = 1 for chr_, cnt in list(d.items()): if chr_ == c: continue t *= cnt + 1 ans = (ans + t) % mod print(ans)
from collections import Counter from functools import reduce from operator import mul mod = 10**9 + 7 def my_mul(a, b): return a * b % mod n = int(eval(input())) s = eval(input()) cnt = Counter(s) print((reduce(my_mul, (v + 1 for v in list(cnt.values()))) - 1)) # 同じ文字列でも、異なる位置から作られたものは区別するため、2 # N − 1 通りのすべての部...
false
20.833333
[ "-from collections import defaultdict", "+from collections import Counter", "+from functools import reduce", "+from operator import mul", "+", "+", "+def my_mul(a, b):", "+ return a * b % mod", "+", "+", "-d = defaultdict(int)", "-ans = 0", "-for c in s:", "- d[c] += 1", "- t = ...
false
0.040194
0.040031
1.004083
[ "s354817481", "s015791514" ]
u952708174
p03331
python
s516562927
s695701216
289
17
3,188
3,060
Accepted
Accepted
94.12
def a_digits_sum(N): def digit_sum(n): # 非負整数nの各桁の和 str_n = str(n) ret = 0 for c in str_n: ret += int(c) return ret ans = float('inf') for A in range(1, N): B = N - A ans = min(ans, digit_sum(A) + digit_sum(B)) return ans N = i...
def a_digits_sum(N): # A+B のk桁目を c_k、Nのk桁目をn_kとおくと、筆算の考え方より、 # c_k=n_k となるようにすればいい。つまり解はNの各桁の和に等しい。 # ただし、Nが10の冪乗のときは、上の考え方では片方がNに等しくなってしまう。 # この場合、 N=10^k とすると、 A=a*10^(k-1), B=b*10^(k-1) (ただし a+b=10) # の形にするしかない。よってA+Bの各桁の和は常に10。 ans = 0 n = str(N) for c in n: ans += i...
16
17
355
465
def a_digits_sum(N): def digit_sum(n): # 非負整数nの各桁の和 str_n = str(n) ret = 0 for c in str_n: ret += int(c) return ret ans = float("inf") for A in range(1, N): B = N - A ans = min(ans, digit_sum(A) + digit_sum(B)) return ans N = int(eval(input...
def a_digits_sum(N): # A+B のk桁目を c_k、Nのk桁目をn_kとおくと、筆算の考え方より、 # c_k=n_k となるようにすればいい。つまり解はNの各桁の和に等しい。 # ただし、Nが10の冪乗のときは、上の考え方では片方がNに等しくなってしまう。 # この場合、 N=10^k とすると、 A=a*10^(k-1), B=b*10^(k-1) (ただし a+b=10) # の形にするしかない。よってA+Bの各桁の和は常に10。 ans = 0 n = str(N) for c in n: ans += int(c) ...
false
5.882353
[ "- def digit_sum(n): # 非負整数nの各桁の和", "- str_n = str(n)", "- ret = 0", "- for c in str_n:", "- ret += int(c)", "- return ret", "-", "- ans = float(\"inf\")", "- for A in range(1, N):", "- B = N - A", "- ans = min(ans, digit_sum(A) + di...
false
0.101347
0.035937
2.820106
[ "s516562927", "s695701216" ]
u086566114
p02412
python
s728305362
s199712455
30
20
6,416
6,356
Accepted
Accepted
33.33
def get_num(n, x): ans = 0 for n3 in range(min(n, x - 2), (x + 2) / 3, -1): for n2 in range(min(n3 - 1, x - n3 - 1), (x - n3 + 1) / 2 - 1, -1): for n1 in range(min(n2 - 1, x - n3 - n2), 0, -1): if n3 == x - n1 - n2: ans += 1 brea...
def get_num(n, x): ans = 0 for n3 in range(min(n, x - 3), (x + 2) / 3, -1): for n2 in range(min(n3 - 1, x - n3 - 1), (x - n3 + 1) / 2 - 1, -1): for n1 in range(min(n2 - 1, x - n3 - n2), 0, -1): if n3 == x - n1 - n2: ans += 1 brea...
19
24
524
629
def get_num(n, x): ans = 0 for n3 in range(min(n, x - 2), (x + 2) / 3, -1): for n2 in range(min(n3 - 1, x - n3 - 1), (x - n3 + 1) / 2 - 1, -1): for n1 in range(min(n2 - 1, x - n3 - n2), 0, -1): if n3 == x - n1 - n2: ans += 1 break r...
def get_num(n, x): ans = 0 for n3 in range(min(n, x - 3), (x + 2) / 3, -1): for n2 in range(min(n3 - 1, x - n3 - 1), (x - n3 + 1) / 2 - 1, -1): for n1 in range(min(n2 - 1, x - n3 - n2), 0, -1): if n3 == x - n1 - n2: ans += 1 break r...
false
20.833333
[ "- for n3 in range(min(n, x - 2), (x + 2) / 3, -1):", "+ for n3 in range(min(n, x - 3), (x + 2) / 3, -1):", "+data = []", "- print((0))", "+ # print(0)", "+ data.append(0)", "- print((get_num(n, x)))", "+ # print(get_num(n, x))", "+ data.append(get_num...
false
0.056926
0.057934
0.982598
[ "s728305362", "s199712455" ]
u241159583
p03487
python
s411337989
s075517654
91
76
18,676
22,480
Accepted
Accepted
16.48
from collections import Counter n = int(eval(input())) a = Counter(list(map(int, input().split()))) ans = 0 for x,y in list(a.items()): if x == y: continue if x < y: ans += y-x else: ans += y print(ans)
from collections import Counter n = int(eval(input())) a = Counter(list(map(int, input().split()))) ans = 0 for x,y in list(a.items()): if y<x: ans += y else:ans += y-x print(ans)
10
8
212
182
from collections import Counter n = int(eval(input())) a = Counter(list(map(int, input().split()))) ans = 0 for x, y in list(a.items()): if x == y: continue if x < y: ans += y - x else: ans += y print(ans)
from collections import Counter n = int(eval(input())) a = Counter(list(map(int, input().split()))) ans = 0 for x, y in list(a.items()): if y < x: ans += y else: ans += y - x print(ans)
false
20
[ "- if x == y:", "- continue", "- if x < y:", "+ if y < x:", "+ ans += y", "+ else:", "- else:", "- ans += y" ]
false
0.047924
0.048457
0.988988
[ "s411337989", "s075517654" ]
u852690916
p02763
python
s386018392
s058281367
1,933
728
435,904
165,220
Accepted
Accepted
62.34
import sys input = sys.stdin.readline def main(): N = int(eval(input())) S = list(input().rstrip()) c = lambda x: ord(x) - ord('a') tree = [SegmentTree(N, lambda x,y:x|y) for _ in range(26)] for i, l in enumerate(S): tree[c(l)].update(i, 1) Q = int(eval(input())) for _ ...
import sys input = sys.stdin.readline def main(): N = int(eval(input())) S = ['$'] + list(input().rstrip()) c = lambda x: ord(x) - ord('a') bit = [BinaryIndexedTree(N) for _ in range(26)] for i, l in enumerate(S): if i == 0: continue bit[c(l)].add(i, 1) Q = int(eval...
67
52
2,512
1,507
import sys input = sys.stdin.readline def main(): N = int(eval(input())) S = list(input().rstrip()) c = lambda x: ord(x) - ord("a") tree = [SegmentTree(N, lambda x, y: x | y) for _ in range(26)] for i, l in enumerate(S): tree[c(l)].update(i, 1) Q = int(eval(input())) for _ in rang...
import sys input = sys.stdin.readline def main(): N = int(eval(input())) S = ["$"] + list(input().rstrip()) c = lambda x: ord(x) - ord("a") bit = [BinaryIndexedTree(N) for _ in range(26)] for i, l in enumerate(S): if i == 0: continue bit[c(l)].add(i, 1) Q = int(eva...
false
22.38806
[ "- S = list(input().rstrip())", "+ S = [\"$\"] + list(input().rstrip())", "- tree = [SegmentTree(N, lambda x, y: x | y) for _ in range(26)]", "+ bit = [BinaryIndexedTree(N) for _ in range(26)]", "- tree[c(l)].update(i, 1)", "+ if i == 0:", "+ continue", "+ b...
false
0.121068
0.036381
3.327753
[ "s386018392", "s058281367" ]
u189487046
p03400
python
s609859354
s762092298
19
17
3,064
3,060
Accepted
Accepted
10.53
n = int(eval(input())) d, x = list(map(int, input().split())) # 各参加者がチョコレートを食べる日付を取得してリストへ格納する al = [0 for _ in range(n)] for i in range(n): al[i] = int(eval(input())) # 1日目が経過した状態にする ans = n eat_count = [1 for _ in range(n)] next_eat = [0 for _ in range(n)] for i in range(n): next_eat[i] = al[i]...
n = int(eval(input())) d, x = list(map(int, input().split())) # 各参加者がチョコレートを食べる日付を取得してリストへ格納する al = [0 for _ in range(n)] for i in range(n): al[i] = int(eval(input())) ans = 0 for i in al: ans += ((d-1)//i) ans += 1 print((ans+x))
28
14
627
238
n = int(eval(input())) d, x = list(map(int, input().split())) # 各参加者がチョコレートを食べる日付を取得してリストへ格納する al = [0 for _ in range(n)] for i in range(n): al[i] = int(eval(input())) # 1日目が経過した状態にする ans = n eat_count = [1 for _ in range(n)] next_eat = [0 for _ in range(n)] for i in range(n): next_eat[i] = al[i] * eat_count[i]...
n = int(eval(input())) d, x = list(map(int, input().split())) # 各参加者がチョコレートを食べる日付を取得してリストへ格納する al = [0 for _ in range(n)] for i in range(n): al[i] = int(eval(input())) ans = 0 for i in al: ans += (d - 1) // i ans += 1 print((ans + x))
false
50
[ "-# 1日目が経過した状態にする", "-ans = n", "-eat_count = [1 for _ in range(n)]", "-next_eat = [0 for _ in range(n)]", "-for i in range(n):", "- next_eat[i] = al[i] * eat_count[i] + 1", "- eat_count[i] = 2", "-# 2日目以降の食べた個数を求める", "-for day in range(1, d + 1):", "- if not (day in next_eat):", "- ...
false
0.044779
0.155276
0.288385
[ "s609859354", "s762092298" ]
u077291787
p03157
python
s859481657
s204021820
542
398
149,252
12,568
Accepted
Accepted
26.57
# aising2019C - Alternating Path import sys sys.setrecursionlimit(10 ** 9) def dfs(x: int, y: int) -> None: global blk, wht cur = S[x][y] S[x][y] = 2 # make the grid visited if cur: blk += 1 else: wht += 1 for dx, dy in dxy: nx, ny = x + dx, y + dy ...
# aising2019C - Alternating Path def dfs(sx: int, sy: int) -> None: color = [0] * 2 s_col = S[sx][sy] color[s_col] += 1 S[sx][sy] = 2 # make the grid visited stack = [(sx, sy, s_col)] while stack: x, y, col = stack.pop() for dx, dy in dxy: nx, ny = x + dx, ...
39
36
917
1,027
# aising2019C - Alternating Path import sys sys.setrecursionlimit(10**9) def dfs(x: int, y: int) -> None: global blk, wht cur = S[x][y] S[x][y] = 2 # make the grid visited if cur: blk += 1 else: wht += 1 for dx, dy in dxy: nx, ny = x + dx, y + dy if 0 <= nx < ...
# aising2019C - Alternating Path def dfs(sx: int, sy: int) -> None: color = [0] * 2 s_col = S[sx][sy] color[s_col] += 1 S[sx][sy] = 2 # make the grid visited stack = [(sx, sy, s_col)] while stack: x, y, col = stack.pop() for dx, dy in dxy: nx, ny = x + dx, y + dy ...
false
7.692308
[ "-import sys", "-", "-sys.setrecursionlimit(10**9)", "-", "-", "-def dfs(x: int, y: int) -> None:", "- global blk, wht", "- cur = S[x][y]", "- S[x][y] = 2 # make the grid visited", "- if cur:", "- blk += 1", "- else:", "- wht += 1", "- for dx, dy in dxy:", ...
false
0.045261
0.036674
1.234124
[ "s859481657", "s204021820" ]
u595289165
p02948
python
s144003675
s952656901
779
643
38,188
31,676
Accepted
Accepted
17.46
import heapq n, m = list(map(int, input().split())) work = [list(map(int, input().split())) for _ in range(n)] work.sort() cd = [] heapq.heapify(cd) cnt = 0 ans = 0 # b, a # aの条件 for k in range(m+1): # a = kの仕事をheappush for i in range(cnt, n): a, b = work[i] if a == k: ...
import heapq n, m = list(map(int, input().split())) work = [list(map(int, input().split())) for _ in range(n)] work.sort() cd = [] heapq.heapify(cd) cnt = 0 ans = 0 # b, a # aの条件 for k in range(m+1): # a = kの仕事をheappush for i in range(cnt, n): a, b = work[i] if a == k: ...
32
32
536
528
import heapq n, m = list(map(int, input().split())) work = [list(map(int, input().split())) for _ in range(n)] work.sort() cd = [] heapq.heapify(cd) cnt = 0 ans = 0 # b, a # aの条件 for k in range(m + 1): # a = kの仕事をheappush for i in range(cnt, n): a, b = work[i] if a == k: heapq.heapp...
import heapq n, m = list(map(int, input().split())) work = [list(map(int, input().split())) for _ in range(n)] work.sort() cd = [] heapq.heapify(cd) cnt = 0 ans = 0 # b, a # aの条件 for k in range(m + 1): # a = kの仕事をheappush for i in range(cnt, n): a, b = work[i] if a == k: heapq.heapp...
false
0
[ "- heapq.heappush(cd, [-b, a])", "+ heapq.heappush(cd, -b)", "- ans -= heapq.heappop(cd)[0]", "+ ans -= heapq.heappop(cd)" ]
false
0.049986
0.041369
1.208299
[ "s144003675", "s952656901" ]
u077291787
p03356
python
s566387665
s470231491
518
473
25,184
25,560
Accepted
Accepted
8.69
# ARC097D - Equals (ABC097D) import sys input = sys.stdin.readline class UnionFind: def __init__(self, N): self.parent = [i for i in range(N + 1)] self.rank = [0] * (N + 1) def find(self, x): # find the group (root) of a vertex if self.parent[x] == x: return x...
# ABC097D - Equals (ARC097D) import sys input = sys.stdin.readline class UnionFind: def __init__(self, N): # construct a Union-Find tree (1-idx) self.parent = [i for i in range(N + 1)] self.rank = [0] * (N + 1) def find(self, x): # find the group (root) of a vertex if sel...
46
46
1,433
1,472
# ARC097D - Equals (ABC097D) import sys input = sys.stdin.readline class UnionFind: def __init__(self, N): self.parent = [i for i in range(N + 1)] self.rank = [0] * (N + 1) def find(self, x): # find the group (root) of a vertex if self.parent[x] == x: return x se...
# ABC097D - Equals (ARC097D) import sys input = sys.stdin.readline class UnionFind: def __init__(self, N): # construct a Union-Find tree (1-idx) self.parent = [i for i in range(N + 1)] self.rank = [0] * (N + 1) def find(self, x): # find the group (root) of a vertex if self.parent[x...
false
0
[ "-# ARC097D - Equals (ABC097D)", "+# ABC097D - Equals (ARC097D)", "- def __init__(self, N):", "+ def __init__(self, N): # construct a Union-Find tree (1-idx)" ]
false
0.046009
0.034623
1.328869
[ "s566387665", "s470231491" ]
u150984829
p02248
python
s189741083
s889658440
2,120
1,790
47,924
7,520
Accepted
Accepted
15.57
T,P=input(),input() for x in[i for i,c in enumerate(T)if P[0]==c]:P!=T[x:x+len(P)]or print(x)
def f(): T,P=input(),input() for i in range(len(T)):P!=T[i:i+len(P)]or print(i) f()
2
4
95
89
T, P = input(), input() for x in [i for i, c in enumerate(T) if P[0] == c]: P != T[x : x + len(P)] or print(x)
def f(): T, P = input(), input() for i in range(len(T)): P != T[i : i + len(P)] or print(i) f()
false
50
[ "-T, P = input(), input()", "-for x in [i for i, c in enumerate(T) if P[0] == c]:", "- P != T[x : x + len(P)] or print(x)", "+def f():", "+ T, P = input(), input()", "+ for i in range(len(T)):", "+ P != T[i : i + len(P)] or print(i)", "+", "+", "+f()" ]
false
0.036985
0.043831
0.843804
[ "s189741083", "s889658440" ]
u603958124
p03910
python
s801232354
s404669528
45
39
13,832
10,564
Accepted
Accepted
13.33
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement from collections import deque,defaultdict,Counter from bisect import bisect_left,bisect_right from opera...
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement from collections import deque,defaultdict,Counter from bisect import bisect_left,bisect_right from opera...
36
31
1,019
912
from math import ( ceil, floor, factorial, gcd, sqrt, log2, cos, sin, tan, acos, asin, atan, degrees, radians, pi, inf, comb, ) from itertools import ( accumulate, groupby, permutations, combinations, product, combinations_with_...
from math import ( ceil, floor, factorial, gcd, sqrt, log2, cos, sin, tan, acos, asin, atan, degrees, radians, pi, inf, comb, ) from itertools import ( accumulate, groupby, permutations, combinations, product, combinations_with_...
false
13.888889
[ "+n = INT()", "-", "-", "-def dfs(m):", "- if m == 1:", "- ans.append(1)", "- return 0", "- elif m == 2:", "- ans.append(2)", "- return 0", "- else:", "- k = ceil(sqrt(1 + 8 * m)) // 2", "- ans.append(k)", "- dfs(m - k)", "-", "...
false
0.040238
0.040151
1.002162
[ "s801232354", "s404669528" ]
u077291787
p02913
python
s599275394
s585088874
587
347
60,124
27,348
Accepted
Accepted
40.89
# ABC141E - Who Says a Pun? class RollingHash: def __init__(self, source: str, base=1007, mod=10 ** 9 + 7): self.source = source self.length = len(source) self.base = base self.mod = mod self.hash = self._get_hash_from_zero() self.power = self._get_base_pow() ...
from typing import List class RollingHash: __slots__ = ["source", "length", "base", "mod", "hash", "power"] def __init__(self, source: str, base: int = 1007, mod: int = 10 ** 9 + 7): self.source = source self.length = len(source) self.base = base self.mod = mod ...
49
60
1,615
1,881
# ABC141E - Who Says a Pun? class RollingHash: def __init__(self, source: str, base=1007, mod=10**9 + 7): self.source = source self.length = len(source) self.base = base self.mod = mod self.hash = self._get_hash_from_zero() self.power = self._get_base_pow() def _...
from typing import List class RollingHash: __slots__ = ["source", "length", "base", "mod", "hash", "power"] def __init__(self, source: str, base: int = 1007, mod: int = 10**9 + 7): self.source = source self.length = len(source) self.base = base self.mod = mod self.hash...
false
18.333333
[ "-# ABC141E - Who Says a Pun?", "+from typing import List", "+", "+", "- def __init__(self, source: str, base=1007, mod=10**9 + 7):", "+ __slots__ = [\"source\", \"length\", \"base\", \"mod\", \"hash\", \"power\"]", "+", "+ def __init__(self, source: str, base: int = 1007, mod: int = 10**9 + ...
false
0.041321
0.111488
0.37063
[ "s599275394", "s585088874" ]
u706929073
p02887
python
s950600993
s041887298
43
37
3,316
4,664
Accepted
Accepted
13.95
n = int(eval(input())) s = eval(input()) count = 1 for i in range(1, n): count += (1 if s[i] != s[i-1] else 0) print(count)
n = int(eval(input())) s = list(eval(input())) prev = s[0] count = 1 for s_i in s[1::]: if prev != s_i: count += 1 prev = s_i print(count)
7
10
123
157
n = int(eval(input())) s = eval(input()) count = 1 for i in range(1, n): count += 1 if s[i] != s[i - 1] else 0 print(count)
n = int(eval(input())) s = list(eval(input())) prev = s[0] count = 1 for s_i in s[1::]: if prev != s_i: count += 1 prev = s_i print(count)
false
30
[ "-s = eval(input())", "+s = list(eval(input()))", "+prev = s[0]", "-for i in range(1, n):", "- count += 1 if s[i] != s[i - 1] else 0", "+for s_i in s[1::]:", "+ if prev != s_i:", "+ count += 1", "+ prev = s_i" ]
false
0.086923
0.036487
2.3823
[ "s950600993", "s041887298" ]
u624475441
p03666
python
s619780324
s331003260
242
221
3,060
3,060
Accepted
Accepted
8.68
N, A, B, C, D = list(map(int, input().split())) lb, ub = A, A for _ in range(1, N): if (lb + ub) / 2 < B: lb, ub = lb + C, ub + D else: lb, ub = lb - D, ub - C if lb <= B <= ub: print('YES') else: print('NO')
N, A, B, C, D = list(map(int, input().split())) for m in range(N): if C * (N - 1 - m) - D * m <= B - A <= D * (N - 1 - m) - C * m: print('YES') break else: print('NO')
11
7
244
191
N, A, B, C, D = list(map(int, input().split())) lb, ub = A, A for _ in range(1, N): if (lb + ub) / 2 < B: lb, ub = lb + C, ub + D else: lb, ub = lb - D, ub - C if lb <= B <= ub: print("YES") else: print("NO")
N, A, B, C, D = list(map(int, input().split())) for m in range(N): if C * (N - 1 - m) - D * m <= B - A <= D * (N - 1 - m) - C * m: print("YES") break else: print("NO")
false
36.363636
[ "-lb, ub = A, A", "-for _ in range(1, N):", "- if (lb + ub) / 2 < B:", "- lb, ub = lb + C, ub + D", "- else:", "- lb, ub = lb - D, ub - C", "-if lb <= B <= ub:", "- print(\"YES\")", "+for m in range(N):", "+ if C * (N - 1 - m) - D * m <= B - A <= D * (N - 1 - m) - C * m:"...
false
0.089431
0.079721
1.121799
[ "s619780324", "s331003260" ]
u477977638
p02936
python
s366203515
s397700580
1,851
613
116,204
99,652
Accepted
Accepted
66.88
from collections import deque n,q=list(map(int,input().split())) li=[[] for i in range(n+1)] ans=[0]*(n+1) for i in range(n-1): a,b=list(map(int,input().split())) li[a].append(b) li[b].append(a) for i in range(q): p,x=list(map(int,input().split())) ans[p]+=x Q=deque([1]) sumi=set([1]) ...
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines from collections import deque def main(): n,q=list(map(int,input().split())) li=[[] for i in range(n+1)] ans=[0]*(n+1) for i in range(n-1): a,b=list(map(int,input().split())...
30
42
485
718
from collections import deque n, q = list(map(int, input().split())) li = [[] for i in range(n + 1)] ans = [0] * (n + 1) for i in range(n - 1): a, b = list(map(int, input().split())) li[a].append(b) li[b].append(a) for i in range(q): p, x = list(map(int, input().split())) ans[p] += x Q = deque([1])...
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines from collections import deque def main(): n, q = list(map(int, input().split())) li = [[] for i in range(n + 1)] ans = [0] * (n + 1) for i in range(n - 1): a, b = list(map(int, input(...
false
28.571429
[ "+import sys", "+", "+read = sys.stdin.buffer.read", "+input = sys.stdin.buffer.readline", "+inputs = sys.stdin.buffer.readlines", "-n, q = list(map(int, input().split()))", "-li = [[] for i in range(n + 1)]", "-ans = [0] * (n + 1)", "-for i in range(n - 1):", "- a, b = list(map(int, input().sp...
false
0.058578
0.042127
1.390508
[ "s366203515", "s397700580" ]
u762420987
p03013
python
s711353569
s659481567
258
180
13,216
13,192
Accepted
Accepted
30.23
N, M = list(map(int, input().split())) aset = set([int(eval(input())) for _ in range(M)]) dp = [0] * (N + 1) dp[0] = 1 for i in range(N): for j in range(i + 1, min(N, i + 2) + 1): if j not in aset: dp[j] += dp[i] dp[j] %= 10**9 + 7 print((dp[N]))
N, M = list(map(int, input().split())) aset = set([int(eval(input())) for _ in range(M)]) dp = [0] * (N + 1) dp[0] = 1 if 1 not in aset: dp[1] = 1 for i in range(2, N + 1): if i in aset: dp[i] = 0 else: dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7) print((dp[-1]))
10
12
278
290
N, M = list(map(int, input().split())) aset = set([int(eval(input())) for _ in range(M)]) dp = [0] * (N + 1) dp[0] = 1 for i in range(N): for j in range(i + 1, min(N, i + 2) + 1): if j not in aset: dp[j] += dp[i] dp[j] %= 10**9 + 7 print((dp[N]))
N, M = list(map(int, input().split())) aset = set([int(eval(input())) for _ in range(M)]) dp = [0] * (N + 1) dp[0] = 1 if 1 not in aset: dp[1] = 1 for i in range(2, N + 1): if i in aset: dp[i] = 0 else: dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7) print((dp[-1]))
false
16.666667
[ "-for i in range(N):", "- for j in range(i + 1, min(N, i + 2) + 1):", "- if j not in aset:", "- dp[j] += dp[i]", "- dp[j] %= 10**9 + 7", "-print((dp[N]))", "+if 1 not in aset:", "+ dp[1] = 1", "+for i in range(2, N + 1):", "+ if i in aset:", "+ dp[i] ...
false
0.038973
0.040878
0.953419
[ "s711353569", "s659481567" ]
u088553842
p03834
python
s056542971
s996349103
28
25
8,972
9,024
Accepted
Accepted
10.71
s=eval(input());print((s[:5],s[6:13],s[14:]))
print((input().replace(',',' ')))
1
1
37
31
s = eval(input()) print((s[:5], s[6:13], s[14:]))
print((input().replace(",", " ")))
false
0
[ "-s = eval(input())", "-print((s[:5], s[6:13], s[14:]))", "+print((input().replace(\",\", \" \")))" ]
false
0.045119
0.045613
0.989157
[ "s056542971", "s996349103" ]
u481187938
p02834
python
s944129198
s848612382
562
275
270,932
107,704
Accepted
Accepted
51.07
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools import math, fractions import sys, copy def L(): return sys.stdin.readline...
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools import math, fractions import sys, copy def L(): return sys.stdin.readline...
65
76
2,460
2,764
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools import math, fractions import sys, copy def L(): return sys.stdin.readline().spl...
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools import math, fractions import sys, copy def L(): return sys.stdin.readline().spl...
false
14.473684
[ "-def parent_children(start, g):", "+def adjacency_list(N, edges):", "+ g = make_list(N, 0)", "+ for a, b in edges:", "+ g[a].append(b), g[b].append(a)", "+ return g", "+", "+", "+def tree_utils(start, g):", "-def adjacency_list(N, edges):", "- g = make_list(N, 0)", "- fo...
false
0.045909
0.056258
0.81604
[ "s944129198", "s848612382" ]
u685662874
p03013
python
s587737412
s488881027
248
208
9,600
7,832
Accepted
Accepted
16.13
N, M=list(map(int, input().split())) items=[int(eval(input())) for i in range(M)] mod=10**9+7 dp=[0 for i in range(N+1)] dp[0] = 1 is_broken =[1 for i in range(N+1)] for i in range(M): is_broken[items[i]] = 0 for i in range(N): if i-1 >= 0: dp[i+1] = dp[i]*is_broken[i] + dp[i-1]*is_broken[...
N, M=list(map(int, input().split())) mod=10**9+7 dp=[0 for i in range(N+2)] dp[N] = 1 is_broken =[False for i in range(N+1)] for i in range(M): a=int(eval(input())) is_broken[a] = True for i in reversed(list(range(N))): if is_broken[i]: dp[i] = 0 continue dp[i] = (dp[i+1]...
18
18
397
341
N, M = list(map(int, input().split())) items = [int(eval(input())) for i in range(M)] mod = 10**9 + 7 dp = [0 for i in range(N + 1)] dp[0] = 1 is_broken = [1 for i in range(N + 1)] for i in range(M): is_broken[items[i]] = 0 for i in range(N): if i - 1 >= 0: dp[i + 1] = dp[i] * is_broken[i] + dp[i - 1] *...
N, M = list(map(int, input().split())) mod = 10**9 + 7 dp = [0 for i in range(N + 2)] dp[N] = 1 is_broken = [False for i in range(N + 1)] for i in range(M): a = int(eval(input())) is_broken[a] = True for i in reversed(list(range(N))): if is_broken[i]: dp[i] = 0 continue dp[i] = (dp[i + 1...
false
0
[ "-items = [int(eval(input())) for i in range(M)]", "-dp = [0 for i in range(N + 1)]", "-dp[0] = 1", "-is_broken = [1 for i in range(N + 1)]", "+dp = [0 for i in range(N + 2)]", "+dp[N] = 1", "+is_broken = [False for i in range(N + 1)]", "- is_broken[items[i]] = 0", "-for i in range(N):", "- ...
false
0.035755
0.035104
1.018542
[ "s587737412", "s488881027" ]
u102461423
p03034
python
s932273539
s230699006
1,634
873
23,300
18,552
Accepted
Accepted
46.57
import numpy as np N = int(eval(input())) S = np.array([int(x) for x in input().split()],dtype=np.int64) # 右移動着地点:等差数列、ゴール含む # 左移動着地点:等差数列、スタート含む answer = 0 for d in range(1,N): # d = A-B cum_left = np.cumsum(S[::d]) cum_right = np.cumsum(S[::-1][::d]) score = cum_left + cum_right # 等差数列の長さ-1 ->...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) S = np.array(read().split(),np.int64) def F(d): # 公差を固定 L = S[:-d:d].cumsum() R = S[::-1][:-d:d].cumsum() if (N-1)%d == 0: ...
35
43
725
980
import numpy as np N = int(eval(input())) S = np.array([int(x) for x in input().split()], dtype=np.int64) # 右移動着地点:等差数列、ゴール含む # 左移動着地点:等差数列、スタート含む answer = 0 for d in range(1, N): # d = A-B cum_left = np.cumsum(S[::d]) cum_right = np.cumsum(S[::-1][::d]) score = cum_left + cum_right # 等差数列の長さ-1 -> 得点 ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) S = np.array(read().split(), np.int64) def F(d): # 公差を固定 L = S[:-d:d].cumsum() R = S[::-1][:-d:d].cumsum() if (N - 1) % d == 0: n = (N - ...
false
18.604651
[ "+import sys", "+", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "-N = int(eval(input()))", "-S = np.array([int(x) for x in input().split()], dtype=np.int64)", "-# 右移動着地点:等差数列、ゴール含む", "-# 左移動着地点:等差数列、スタート含む", "-answer = 0", ...
false
0.293432
0.537464
0.545956
[ "s932273539", "s230699006" ]
u077291787
p03478
python
s332745312
s232528772
36
31
3,060
3,064
Accepted
Accepted
13.89
# ABC083B - Some Sums n, a, b = list(map(int, input().rstrip().split())) total = 0 for i in range(1, n + 1): if a <= sum(list(map(int, list(str(i))))) <= b: total += i print(total)
# ABC083B - Some Sums def main(): n, a, b = list(map(int, input().rstrip().split())) ans = 0 for i in range(1, n + 1): if a <= sum(map(int, list(str(i)))) <= b: ans += i print(ans) if __name__ == "__main__": main()
7
12
198
267
# ABC083B - Some Sums n, a, b = list(map(int, input().rstrip().split())) total = 0 for i in range(1, n + 1): if a <= sum(list(map(int, list(str(i))))) <= b: total += i print(total)
# ABC083B - Some Sums def main(): n, a, b = list(map(int, input().rstrip().split())) ans = 0 for i in range(1, n + 1): if a <= sum(map(int, list(str(i)))) <= b: ans += i print(ans) if __name__ == "__main__": main()
false
41.666667
[ "-n, a, b = list(map(int, input().rstrip().split()))", "-total = 0", "-for i in range(1, n + 1):", "- if a <= sum(list(map(int, list(str(i))))) <= b:", "- total += i", "-print(total)", "+def main():", "+ n, a, b = list(map(int, input().rstrip().split()))", "+ ans = 0", "+ for i ...
false
0.037235
0.047054
0.791325
[ "s332745312", "s232528772" ]
u312025627
p02863
python
s830489041
s169657058
356
279
146,044
145,508
Accepted
Accepted
21.63
def main(): N, T = (int(i) for i in input().split()) AB = [[int(i) for i in input().split()] for j in range(N)] AB.sort() A = [a[0] for a in AB] B = [b[1] for b in AB] dp1 = [[0]*(T+1) for _ in range(N+1)] for i in range(N): for j in range(T): dp1[i+1][j] = max...
def main(): N, T = (int(i) for i in input().split()) AB = [[int(i) for i in input().split()] for j in range(N)] AB.sort() A = [a[0] for a in AB] B = [b[1] for b in AB] ans = 0 dp1 = [[0]*(T+1) for _ in range(N+1)] for i in range(N): for j in range(T): t = ...
23
22
604
581
def main(): N, T = (int(i) for i in input().split()) AB = [[int(i) for i in input().split()] for j in range(N)] AB.sort() A = [a[0] for a in AB] B = [b[1] for b in AB] dp1 = [[0] * (T + 1) for _ in range(N + 1)] for i in range(N): for j in range(T): dp1[i + 1][j] = max(dp...
def main(): N, T = (int(i) for i in input().split()) AB = [[int(i) for i in input().split()] for j in range(N)] AB.sort() A = [a[0] for a in AB] B = [b[1] for b in AB] ans = 0 dp1 = [[0] * (T + 1) for _ in range(N + 1)] for i in range(N): for j in range(T): t = j - A[...
false
4.347826
[ "+ ans = 0", "- dp1[i + 1][j] = max(dp1[i + 1][j], dp1[i][j])", "- dp1[i + 1][j] = max(dp1[i + 1][j], dp1[i][t] + B[i])", "- ans = 0", "- for i in range(N):", "+ dp1[i + 1][j] = max(dp1[i][j], dp1[i][t] + B[i])", "+ else:", "+ ...
false
0.060137
0.107451
0.559673
[ "s830489041", "s169657058" ]
u901180556
p04029
python
s398516194
s125699573
21
17
2,940
2,940
Accepted
Accepted
19.05
N = int(eval(input())) num = 0 for i in range(1,N+1): num += i print(num)
N = int(eval(input())) print((sum([i for i in range(1, N+1)])))
5
2
73
56
N = int(eval(input())) num = 0 for i in range(1, N + 1): num += i print(num)
N = int(eval(input())) print((sum([i for i in range(1, N + 1)])))
false
60
[ "-num = 0", "-for i in range(1, N + 1):", "- num += i", "-print(num)", "+print((sum([i for i in range(1, N + 1)])))" ]
false
0.008131
0.042296
0.192245
[ "s398516194", "s125699573" ]
u814986259
p03627
python
s879006120
s049549057
116
96
21,412
18,592
Accepted
Accepted
17.24
import collections N = int(eval(input())) A = list(map(int, input().split())) dic = collections.defaultdict(int) for x in A: dic[x] += 1 dic = list(dic.items()) dic = [x for x in dic if x[1] >= 2] dic = sorted(dic, reverse=True, key=lambda x: x[0]) if len(dic) >= 2: if dic[0][1] >= 4: ...
import heapq import collections N = int(eval(input())) A = list(map(int, input().split())) table = collections.defaultdict(int) hq = [0, 0] for x in A: table[x] += 1 if table[x] == 2: heapq.heappush(hq, -x) table[x] = 0 print((heapq.heappop(hq) * heapq.heappop(hq)))
21
13
416
296
import collections N = int(eval(input())) A = list(map(int, input().split())) dic = collections.defaultdict(int) for x in A: dic[x] += 1 dic = list(dic.items()) dic = [x for x in dic if x[1] >= 2] dic = sorted(dic, reverse=True, key=lambda x: x[0]) if len(dic) >= 2: if dic[0][1] >= 4: print((dic[0][0] ...
import heapq import collections N = int(eval(input())) A = list(map(int, input().split())) table = collections.defaultdict(int) hq = [0, 0] for x in A: table[x] += 1 if table[x] == 2: heapq.heappush(hq, -x) table[x] = 0 print((heapq.heappop(hq) * heapq.heappop(hq)))
false
38.095238
[ "+import heapq", "-dic = collections.defaultdict(int)", "+table = collections.defaultdict(int)", "+hq = [0, 0]", "- dic[x] += 1", "-dic = list(dic.items())", "-dic = [x for x in dic if x[1] >= 2]", "-dic = sorted(dic, reverse=True, key=lambda x: x[0])", "-if len(dic) >= 2:", "- if dic[0][1] ...
false
0.046043
0.043924
1.048246
[ "s879006120", "s049549057" ]
u952708174
p02861
python
s957759907
s252390103
375
17
3,064
3,188
Accepted
Accepted
95.47
def c_average_length(): from itertools import permutations from math import factorial N = int(eval(input())) Positions = [[int(i) for i in input().split()] for j in range(N)] ans = 0.0 for route in permutations(list(range(N)), N): tmp = 0.0 for i in range(N - 1): ...
def c_average_length(): N = int(eval(input())) Positions = [[int(i) for i in input().split()] for j in range(N)] ans = 0.0 for i in range(N): for j in range(i + 1, N): ans += ((Positions[i][0] - Positions[j][0])**2 + (Positions[i][1] - Positions[j][1])**2...
18
12
592
373
def c_average_length(): from itertools import permutations from math import factorial N = int(eval(input())) Positions = [[int(i) for i in input().split()] for j in range(N)] ans = 0.0 for route in permutations(list(range(N)), N): tmp = 0.0 for i in range(N - 1): cur...
def c_average_length(): N = int(eval(input())) Positions = [[int(i) for i in input().split()] for j in range(N)] ans = 0.0 for i in range(N): for j in range(i + 1, N): ans += ( (Positions[i][0] - Positions[j][0]) ** 2 + (Positions[i][1] - Positions[j][...
false
33.333333
[ "- from itertools import permutations", "- from math import factorial", "-", "- for route in permutations(list(range(N)), N):", "- tmp = 0.0", "- for i in range(N - 1):", "- cur_v = route[i]", "- next_v = route[i + 1]", "- tmp += (", "- ...
false
0.044517
0.038626
1.152514
[ "s957759907", "s252390103" ]
u392319141
p03688
python
s530222528
s094308086
59
53
14,008
22,636
Accepted
Accepted
10.17
N = int(eval(input())) A = list(map(int, input().split())) minColor = min(A) maxColor = max(A) if minColor == maxColor: if minColor == N - 1: # 各色の猫が1匹ずつ print('Yes') elif minColor * 2 <= N: # 各色の猫が2匹以上 print('Yes') else: print('No') exit() if minColor + 1 != ...
from collections import Counter N = int(eval(input())) A = Counter(list(map(int, input().split()))) if len(list(A.keys())) >= 3: print('No') exit() if len(list(A.keys())) == 1: p = list(A.keys())[0] print(('Yes' if 2 * p <= N or p == N - 1 else 'No')) exit() p1, p2 = sorted(A.keys(...
39
16
700
383
N = int(eval(input())) A = list(map(int, input().split())) minColor = min(A) maxColor = max(A) if minColor == maxColor: if minColor == N - 1: # 各色の猫が1匹ずつ print("Yes") elif minColor * 2 <= N: # 各色の猫が2匹以上 print("Yes") else: print("No") exit() if minColor + 1 != maxColor: prin...
from collections import Counter N = int(eval(input())) A = Counter(list(map(int, input().split()))) if len(list(A.keys())) >= 3: print("No") exit() if len(list(A.keys())) == 1: p = list(A.keys())[0] print(("Yes" if 2 * p <= N or p == N - 1 else "No")) exit() p1, p2 = sorted(A.keys()) print(("Yes" i...
false
58.974359
[ "+from collections import Counter", "+", "-A = list(map(int, input().split()))", "-minColor = min(A)", "-maxColor = max(A)", "-if minColor == maxColor:", "- if minColor == N - 1: # 各色の猫が1匹ずつ", "- print(\"Yes\")", "- elif minColor * 2 <= N: # 各色の猫が2匹以上", "- print(\"Yes\")", ...
false
0.040494
0.041533
0.974978
[ "s530222528", "s094308086" ]
u536034761
p02555
python
s948602992
s321910314
33
29
10,164
9,144
Accepted
Accepted
12.12
from functools import lru_cache import sys sys.setrecursionlimit(2000) mod = 10 ** 9 + 7 @lru_cache(maxsize=None) def dp(i): if i == 1 or i == 2: return 0 elif i == 3 or i == 4: return 1 else: return (dp(i - 3) + dp(i - 1)) % mod S = int(eval(input())) print((dp(...
S = int(eval(input())) if S == 1 or S == 2: print((0)) elif S == 3: print((1)) else: mod = 10 ** 9 + 7 dp = [0 for _ in range(S)] dp[0] = dp[1] = 0 dp[2] = dp[3] = 1 for i in range(3, S): dp[i] = (dp[i - 3] + dp[i - 1]) % mod print((dp[-1]))
18
17
317
289
from functools import lru_cache import sys sys.setrecursionlimit(2000) mod = 10**9 + 7 @lru_cache(maxsize=None) def dp(i): if i == 1 or i == 2: return 0 elif i == 3 or i == 4: return 1 else: return (dp(i - 3) + dp(i - 1)) % mod S = int(eval(input())) print((dp(S)))
S = int(eval(input())) if S == 1 or S == 2: print((0)) elif S == 3: print((1)) else: mod = 10**9 + 7 dp = [0 for _ in range(S)] dp[0] = dp[1] = 0 dp[2] = dp[3] = 1 for i in range(3, S): dp[i] = (dp[i - 3] + dp[i - 1]) % mod print((dp[-1]))
false
5.555556
[ "-from functools import lru_cache", "-import sys", "-", "-sys.setrecursionlimit(2000)", "-mod = 10**9 + 7", "-", "-", "-@lru_cache(maxsize=None)", "-def dp(i):", "- if i == 1 or i == 2:", "- return 0", "- elif i == 3 or i == 4:", "- return 1", "- else:", "- ...
false
0.046002
0.045653
1.007642
[ "s948602992", "s321910314" ]
u282228874
p03062
python
s220266292
s992233195
104
62
14,284
14,412
Accepted
Accepted
40.38
n = int(eval(input())) A = list(map(int,input().split())) cnt = 0 for a in A: if a < 0: cnt += 1 res = 0 A = [abs(a) for a in A] A.sort() for a in A: res += a if cnt%2 == 1: res -= 2*A[0] print(res)
n = int(eval(input())) A = list(map(int,input().split())) cnt = 0 for a in A: if a < 0: cnt += 1 A = [abs(a) for a in A] res = sum(A) if cnt%2 == 1: res -= 2*min(A) print(res)
14
11
229
195
n = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for a in A: if a < 0: cnt += 1 res = 0 A = [abs(a) for a in A] A.sort() for a in A: res += a if cnt % 2 == 1: res -= 2 * A[0] print(res)
n = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for a in A: if a < 0: cnt += 1 A = [abs(a) for a in A] res = sum(A) if cnt % 2 == 1: res -= 2 * min(A) print(res)
false
21.428571
[ "-res = 0", "-A.sort()", "-for a in A:", "- res += a", "+res = sum(A)", "- res -= 2 * A[0]", "+ res -= 2 * min(A)" ]
false
0.035068
0.083991
0.417524
[ "s220266292", "s992233195" ]
u860002137
p02923
python
s914442328
s319161948
279
79
23,388
20,540
Accepted
Accepted
71.68
import numpy as np N = int(eval(input())) H = np.array(list(map(int, input().split()))) diff = H[:-1] - H[1:] ans = 0 tmp = 0 for d in diff: if d>=0: tmp += 1 if ans<tmp: ans = tmp else: tmp = 0 print(ans)
n = int(eval(input())) h = list(map(int, input().split())) tmp = 0 ans = 0 for i in range(n - 1): if h[i] >= h[i + 1]: tmp += 1 else: ans = max(ans, tmp) tmp = 0 ans = max(ans, tmp) print(ans)
17
14
262
233
import numpy as np N = int(eval(input())) H = np.array(list(map(int, input().split()))) diff = H[:-1] - H[1:] ans = 0 tmp = 0 for d in diff: if d >= 0: tmp += 1 if ans < tmp: ans = tmp else: tmp = 0 print(ans)
n = int(eval(input())) h = list(map(int, input().split())) tmp = 0 ans = 0 for i in range(n - 1): if h[i] >= h[i + 1]: tmp += 1 else: ans = max(ans, tmp) tmp = 0 ans = max(ans, tmp) print(ans)
false
17.647059
[ "-import numpy as np", "-", "-N = int(eval(input()))", "-H = np.array(list(map(int, input().split())))", "-diff = H[:-1] - H[1:]", "+n = int(eval(input()))", "+h = list(map(int, input().split()))", "+tmp = 0", "-tmp = 0", "-for d in diff:", "- if d >= 0:", "+for i in range(n - 1):", "+ ...
false
0.258778
0.036736
7.044342
[ "s914442328", "s319161948" ]
u642012866
p02898
python
s287337429
s420981340
48
42
11,916
9,992
Accepted
Accepted
12.5
N, K = list(map(int, input().split())) h = list(map(int, input().split())) cnt = 0 for f in h: if f >= K: cnt += 1 print(cnt)
N, K = list(map(int, input().split())) print((len([0 for x in map(int, input().split()) if x >= K])))
7
2
137
94
N, K = list(map(int, input().split())) h = list(map(int, input().split())) cnt = 0 for f in h: if f >= K: cnt += 1 print(cnt)
N, K = list(map(int, input().split())) print((len([0 for x in map(int, input().split()) if x >= K])))
false
71.428571
[ "-h = list(map(int, input().split()))", "-cnt = 0", "-for f in h:", "- if f >= K:", "- cnt += 1", "-print(cnt)", "+print((len([0 for x in map(int, input().split()) if x >= K])))" ]
false
0.035566
0.036039
0.986873
[ "s287337429", "s420981340" ]
u073729602
p02982
python
s223066846
s235492276
29
25
9,456
9,336
Accepted
Accepted
13.79
import itertools n, d = list(map(int, input().split())) x = [] s = [] for i in range(n): s.append(i) a = list(map(int, input().split())) x.append(a) ans = 0 for v in itertools.combinations(s, 2): t = 0 for i in range(d): t += (x[v[0]][i] - x[v[1]][i])**2 if (t**0.5).is_int...
# 少しめんどくさい方法です。 import itertools n, d = list(map(int, input().split())) x = [] s = [] # 組み合わせ用の変数。 for i in range(n): s.append(i) a = list(map(int, input().split())) x.append(a) # 単純に組み合わせで判定する。 ans = 0 for v in itertools.combinations(s, 2): t = 0 # 距離を判定する。 for i in range(d): ...
17
20
351
430
import itertools n, d = list(map(int, input().split())) x = [] s = [] for i in range(n): s.append(i) a = list(map(int, input().split())) x.append(a) ans = 0 for v in itertools.combinations(s, 2): t = 0 for i in range(d): t += (x[v[0]][i] - x[v[1]][i]) ** 2 if (t**0.5).is_integer(): ...
# 少しめんどくさい方法です。 import itertools n, d = list(map(int, input().split())) x = [] s = [] # 組み合わせ用の変数。 for i in range(n): s.append(i) a = list(map(int, input().split())) x.append(a) # 単純に組み合わせで判定する。 ans = 0 for v in itertools.combinations(s, 2): t = 0 # 距離を判定する。 for i in range(d): t += (x[...
false
15
[ "+# 少しめんどくさい方法です。", "-s = []", "+s = [] # 組み合わせ用の変数。", "+# 単純に組み合わせで判定する。", "+ # 距離を判定する。", "+ # 少数かどうか?" ]
false
0.038007
0.037758
1.006601
[ "s223066846", "s235492276" ]
u353797797
p03163
python
s960002875
s129759163
1,956
1,468
9,460
7,668
Accepted
Accepted
24.95
import sys input=sys.stdin.readline n, cap = list(map(int, input().split())) val =[0]*(cap+1) def nap(n,cap): for _ in range(n): w, v = list(map(int, input().split())) for wk in range(cap,w-1,-1): nv=val[wk-w]+v if val[wk]<nv: val[wk]=nv retur...
import sys input = sys.stdin.readline def nap(n, cap): val = [0] * (cap + 1) for _ in range(n): w, v = list(map(int, input().split())) for wk in range(cap, w - 1, -1): nv = val[wk - w] + v if val[wk] < nv: val[wk] = nv return max(val) ...
14
18
338
373
import sys input = sys.stdin.readline n, cap = list(map(int, input().split())) val = [0] * (cap + 1) def nap(n, cap): for _ in range(n): w, v = list(map(int, input().split())) for wk in range(cap, w - 1, -1): nv = val[wk - w] + v if val[wk] < nv: val[wk] = ...
import sys input = sys.stdin.readline def nap(n, cap): val = [0] * (cap + 1) for _ in range(n): w, v = list(map(int, input().split())) for wk in range(cap, w - 1, -1): nv = val[wk - w] + v if val[wk] < nv: val[wk] = nv return max(val) n, cap = lis...
false
22.222222
[ "-n, cap = list(map(int, input().split()))", "-val = [0] * (cap + 1)", "+ val = [0] * (cap + 1)", "+n, cap = list(map(int, input().split()))" ]
false
0.043849
0.045413
0.965554
[ "s960002875", "s129759163" ]
u539692012
p02659
python
s555026473
s400239062
24
22
9,160
9,156
Accepted
Accepted
8.33
a, b = input().split() a = int(a) b = int(b.replace('.', '')) c = str(a * b)[:-2] if c == '': print((0)) else: print(c)
a,b=list(map(int,input().replace('.','').split())) print((a*b//100))
8
2
133
61
a, b = input().split() a = int(a) b = int(b.replace(".", "")) c = str(a * b)[:-2] if c == "": print((0)) else: print(c)
a, b = list(map(int, input().replace(".", "").split())) print((a * b // 100))
false
75
[ "-a, b = input().split()", "-a = int(a)", "-b = int(b.replace(\".\", \"\"))", "-c = str(a * b)[:-2]", "-if c == \"\":", "- print((0))", "-else:", "- print(c)", "+a, b = list(map(int, input().replace(\".\", \"\").split()))", "+print((a * b // 100))" ]
false
0.033053
0.066159
0.499605
[ "s555026473", "s400239062" ]
u212328220
p03835
python
s750594762
s430731456
1,451
1,147
3,064
9,172
Accepted
Accepted
20.95
K, S = list(map(int, input().split())) counter = 0 for x in range(K+1): for y in range(K+1): z = S - x - y if 0 <= z <= K: counter += 1 print(counter)
k, s = list(map(int,input().split())) cnt = 0 for x in range(k+1): for y in range(k+1): z = s - x - y if 0 <= z <= k: cnt += 1 print(cnt)
9
9
186
172
K, S = list(map(int, input().split())) counter = 0 for x in range(K + 1): for y in range(K + 1): z = S - x - y if 0 <= z <= K: counter += 1 print(counter)
k, s = list(map(int, input().split())) cnt = 0 for x in range(k + 1): for y in range(k + 1): z = s - x - y if 0 <= z <= k: cnt += 1 print(cnt)
false
0
[ "-K, S = list(map(int, input().split()))", "-counter = 0", "-for x in range(K + 1):", "- for y in range(K + 1):", "- z = S - x - y", "- if 0 <= z <= K:", "- counter += 1", "-print(counter)", "+k, s = list(map(int, input().split()))", "+cnt = 0", "+for x in range(k + 1...
false
0.055409
0.054698
1.012986
[ "s750594762", "s430731456" ]
u775586391
p00044
python
s446622175
s223461181
150
70
8,216
7,924
Accepted
Accepted
53.33
import sys def furui(n): l = [1 for i in range(n+1)] l[0] = 0 l[1] = 0 for i in range(2,n+1): if l[i] == 1: for j in range(2,n//i+1): l[i*j] = 0 l2 = [] for i in range (len(l)): if l[i] == 1: l2.append(i) return l2 for line in sys.stdin: n = int(line) l ...
MAX = 60000 lst = [i for i in range(MAX)] lst[0] = lst[1] = 0 for i in range(MAX): if lst[i] != 0: for j in range(i * 2, MAX, i): lst[j] = 0 while 0 == 0: try: n = int(eval(input())) i = n - 1 j = n + 1 while lst[i] == 0: i -= 1 while lst[j] == 0: j += 1 ...
34
19
583
385
import sys def furui(n): l = [1 for i in range(n + 1)] l[0] = 0 l[1] = 0 for i in range(2, n + 1): if l[i] == 1: for j in range(2, n // i + 1): l[i * j] = 0 l2 = [] for i in range(len(l)): if l[i] == 1: l2.append(i) return l2 for li...
MAX = 60000 lst = [i for i in range(MAX)] lst[0] = lst[1] = 0 for i in range(MAX): if lst[i] != 0: for j in range(i * 2, MAX, i): lst[j] = 0 while 0 == 0: try: n = int(eval(input())) i = n - 1 j = n + 1 while lst[i] == 0: i -= 1 while lst[j...
false
44.117647
[ "-import sys", "-", "-", "-def furui(n):", "- l = [1 for i in range(n + 1)]", "- l[0] = 0", "- l[1] = 0", "- for i in range(2, n + 1):", "- if l[i] == 1:", "- for j in range(2, n // i + 1):", "- l[i * j] = 0", "- l2 = []", "- for i in range(...
false
0.041708
0.076095
0.548107
[ "s446622175", "s223461181" ]
u369133448
p02584
python
s421986675
s138616180
36
32
9,152
9,128
Accepted
Accepted
11.11
x,k,d=list(map(int,input().split())) x=abs(x) sa=x//d ans=x pbk,mbk=0,0 bk1,bk2,bk3=1,1,1 mansbk,pansbk=0,0 if sa>=k: ans=x-d*k else: ans=x-d*sa k=k-sa for i in range(k): mansbk=abs(ans-d) pansbk=abs(ans+d) if mansbk!=pansbk: ans=min(mansbk,pansbk) if bk3!=1: bk...
x,k,d=list(map(int,input().split())) x=abs(x) m=min(k,x//d) x-=d*m k-=m k%=2 x-=d*k print((abs(x)))
30
8
593
98
x, k, d = list(map(int, input().split())) x = abs(x) sa = x // d ans = x pbk, mbk = 0, 0 bk1, bk2, bk3 = 1, 1, 1 mansbk, pansbk = 0, 0 if sa >= k: ans = x - d * k else: ans = x - d * sa k = k - sa for i in range(k): mansbk = abs(ans - d) pansbk = abs(ans + d) if mansbk != pansbk:...
x, k, d = list(map(int, input().split())) x = abs(x) m = min(k, x // d) x -= d * m k -= m k %= 2 x -= d * k print((abs(x)))
false
73.333333
[ "-sa = x // d", "-ans = x", "-pbk, mbk = 0, 0", "-bk1, bk2, bk3 = 1, 1, 1", "-mansbk, pansbk = 0, 0", "-if sa >= k:", "- ans = x - d * k", "-else:", "- ans = x - d * sa", "- k = k - sa", "- for i in range(k):", "- mansbk = abs(ans - d)", "- pansbk = abs(ans + d)", ...
false
0.046057
0.045852
1.004476
[ "s421986675", "s138616180" ]
u254871849
p03416
python
s838954646
s673810390
20
18
3,064
3,064
Accepted
Accepted
10
import sys from bisect import bisect_left as bi_l, bisect_right as bi_r a, b = list(map(int, sys.stdin.readline().split())) def main(): palindromic_nums = [] for i in range(1, 10): for j in range(10): for k in range(10): x = [i, j, k, j, i] palind...
import sys def cnt(n): m = str(n) l = len(m) if l == 1: return n + 1 tot = 0 tot += pow(10, (l - 1) // 2) * (int(m[0]) - 1) tot += pow(10, l // 2) - 1 - 9 * pow(10, l // 2 - 1) * (l & 1 ^ 1) while l >= 2: l -= 2 if l == 0: tot += m[1] >= m[0] elif l == 1:...
18
26
512
672
import sys from bisect import bisect_left as bi_l, bisect_right as bi_r a, b = list(map(int, sys.stdin.readline().split())) def main(): palindromic_nums = [] for i in range(1, 10): for j in range(10): for k in range(10): x = [i, j, k, j, i] palindromic_nums...
import sys def cnt(n): m = str(n) l = len(m) if l == 1: return n + 1 tot = 0 tot += pow(10, (l - 1) // 2) * (int(m[0]) - 1) tot += pow(10, l // 2) - 1 - 9 * pow(10, l // 2 - 1) * (l & 1 ^ 1) while l >= 2: l -= 2 if l == 0: tot += m[1] >= m[0] eli...
false
30.769231
[ "-from bisect import bisect_left as bi_l, bisect_right as bi_r", "+", "+", "+def cnt(n):", "+ m = str(n)", "+ l = len(m)", "+ if l == 1:", "+ return n + 1", "+ tot = 0", "+ tot += pow(10, (l - 1) // 2) * (int(m[0]) - 1)", "+ tot += pow(10, l // 2) - 1 - 9 * pow(10, l // ...
false
0.045957
0.037793
1.216003
[ "s838954646", "s673810390" ]
u969850098
p02762
python
s331439565
s101550108
1,573
1,198
110,112
31,872
Accepted
Accepted
23.84
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): ...
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): ...
73
76
1,869
1,902
class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = se...
class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = se...
false
3.947368
[ "- N, M, K = map(int, input().split())", "+ N, M, K = list(map(int, input().split()))", "- a, b = map(int, input().split())", "+ a, b = list(map(int, input().split()))", "- a, b = map(int, input().split())", "+ a, b = list(map(int, input().split()))", "+ ans = []", ...
false
0.037009
0.036465
1.014904
[ "s331439565", "s101550108" ]
u470560351
p02793
python
s011528002
s791623598
1,894
1,658
6,136
6,200
Accepted
Accepted
12.46
from fractions import gcd N=int(eval(input())) a_list = tuple(int(i) for i in input().split()) MOD = 10**9+7 def cal_lcm(a, b): return int(a*b//gcd(a,b)) lcm = 1 for i in range(N): lcm = cal_lcm(lcm, a_list[i]) ans = 0 for i in range(N): ans += lcm//a_list[i] print((ans%MOD))
import sys input = sys.stdin.readline from fractions import gcd N=int(eval(input())) a_list = list(map(int, input().split())) MOD = 10**9+7 def cal_lcm(a, b): return int(a*b//gcd(a,b)) lcm = 1 ans = 0 for i in range(N): lcm_ = cal_lcm(lcm, a_list[i]) ans = ans*(lcm_//lcm) ans = (ans + (lcm_...
17
20
297
359
from fractions import gcd N = int(eval(input())) a_list = tuple(int(i) for i in input().split()) MOD = 10**9 + 7 def cal_lcm(a, b): return int(a * b // gcd(a, b)) lcm = 1 for i in range(N): lcm = cal_lcm(lcm, a_list[i]) ans = 0 for i in range(N): ans += lcm // a_list[i] print((ans % MOD))
import sys input = sys.stdin.readline from fractions import gcd N = int(eval(input())) a_list = list(map(int, input().split())) MOD = 10**9 + 7 def cal_lcm(a, b): return int(a * b // gcd(a, b)) lcm = 1 ans = 0 for i in range(N): lcm_ = cal_lcm(lcm, a_list[i]) ans = ans * (lcm_ // lcm) ans = ans + ...
false
15
[ "+import sys", "+", "+input = sys.stdin.readline", "-a_list = tuple(int(i) for i in input().split())", "+a_list = list(map(int, input().split()))", "-for i in range(N):", "- lcm = cal_lcm(lcm, a_list[i])", "- ans += lcm // a_list[i]", "+ lcm_ = cal_lcm(lcm, a_list[i])", "+ ans = ans * ...
false
0.058931
0.060342
0.976619
[ "s011528002", "s791623598" ]
u547167033
p03608
python
s241084985
s545397695
674
458
18,868
46,840
Accepted
Accepted
32.05
from itertools import permutations from scipy.sparse.csgraph import floyd_warshall n,m,r=list(map(int,input().split())) vis=list(map(int,input().split())) INF=10**18 path=[[INF]*n for i in range(n)] for i in range(m): a,b,c=list(map(int,input().split())) path[a-1][b-1]=c path[b-1][a-1]=c path=floyd_wars...
import itertools n,m,r=list(map(int,input().split())) point=list(map(int,input().split())) g=[[10**9]*n for i in range(n)] for _ in range(m): u,v,c=list(map(int,input().split())) g[u-1][v-1]=g[v-1][u-1]=c for k in range(n): for i in range(n): for j in range(n): g[i][j]=min(g[i][j],g[i][k]+g[k]...
18
20
471
493
from itertools import permutations from scipy.sparse.csgraph import floyd_warshall n, m, r = list(map(int, input().split())) vis = list(map(int, input().split())) INF = 10**18 path = [[INF] * n for i in range(n)] for i in range(m): a, b, c = list(map(int, input().split())) path[a - 1][b - 1] = c path[b - 1...
import itertools n, m, r = list(map(int, input().split())) point = list(map(int, input().split())) g = [[10**9] * n for i in range(n)] for _ in range(m): u, v, c = list(map(int, input().split())) g[u - 1][v - 1] = g[v - 1][u - 1] = c for k in range(n): for i in range(n): for j in range(n): ...
false
10
[ "-from itertools import permutations", "-from scipy.sparse.csgraph import floyd_warshall", "+import itertools", "-vis = list(map(int, input().split()))", "-INF = 10**18", "-path = [[INF] * n for i in range(n)]", "-for i in range(m):", "- a, b, c = list(map(int, input().split()))", "- path[a - ...
false
0.343318
0.036406
9.43021
[ "s241084985", "s545397695" ]
u373047809
p02744
python
s756898408
s118686402
156
135
24,176
24,436
Accepted
Accepted
13.46
k = "a", for _ in range(int(eval(input())) - 1): k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)} for i in sorted(k):print(i)
k = "a", for _ in range(int(eval(input())) - 1): k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)} print((*sorted(k)))
4
4
132
122
k = ("a",) for _ in range(int(eval(input())) - 1): k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)} for i in sorted(k): print(i)
k = ("a",) for _ in range(int(eval(input())) - 1): k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)} print((*sorted(k)))
false
0
[ "-for i in sorted(k):", "- print(i)", "+print((*sorted(k)))" ]
false
0.037045
0.118021
0.313882
[ "s756898408", "s118686402" ]
u268793453
p03295
python
s501197200
s638001266
568
440
29,964
22,916
Accepted
Accepted
22.54
from operator import itemgetter n, m = [int(i) for i in input().split()] A, B = list(zip(*[[int(i) for i in input().split()] for j in range(m)])) A, B = list(zip(*sorted(zip(A, B), key=itemgetter(1, 0)))) last = -1 ans = 0 for a, b in zip(A, B): if last <= a: ans += 1 last = b pr...
n, m = [int(i) for i in input().split()] A = [[int(i) for i in input().split()] for j in range(m)] A.sort(key=lambda a:a[1]) ans = 0 i = 0 while i < m: b = A[i][1] ans += 1 i += 1 while i < m: if A[i][0] >= b: break i += 1 print(ans)
16
17
316
296
from operator import itemgetter n, m = [int(i) for i in input().split()] A, B = list(zip(*[[int(i) for i in input().split()] for j in range(m)])) A, B = list(zip(*sorted(zip(A, B), key=itemgetter(1, 0)))) last = -1 ans = 0 for a, b in zip(A, B): if last <= a: ans += 1 last = b print(ans)
n, m = [int(i) for i in input().split()] A = [[int(i) for i in input().split()] for j in range(m)] A.sort(key=lambda a: a[1]) ans = 0 i = 0 while i < m: b = A[i][1] ans += 1 i += 1 while i < m: if A[i][0] >= b: break i += 1 print(ans)
false
5.882353
[ "-from operator import itemgetter", "-", "-A, B = list(zip(*[[int(i) for i in input().split()] for j in range(m)]))", "-A, B = list(zip(*sorted(zip(A, B), key=itemgetter(1, 0))))", "-last = -1", "+A = [[int(i) for i in input().split()] for j in range(m)]", "+A.sort(key=lambda a: a[1])", "-for a, b in ...
false
0.042228
0.048889
0.863754
[ "s501197200", "s638001266" ]
u102461423
p03822
python
s815454261
s044325287
400
339
28,244
32,312
Accepted
Accepted
15.25
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,*P = list(map(int,read().split())) graph = [[] for _ in range(N+1)] for i,x in enumerate(P,2): graph[i].append(x) graph[x].append(i) root = 1 parent = [0] * (N+1) order = [] st...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def dfs_order(G, root=1): parent = [0] * (N + 1) order = [] stack = [root] while stack: x = stack.pop() order.append(x) for y in G[x]: i...
37
41
768
884
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, *P = list(map(int, read().split())) graph = [[] for _ in range(N + 1)] for i, x in enumerate(P, 2): graph[i].append(x) graph[x].append(i) root = 1 parent = [0] * (N + 1) order = [] stack = [ro...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def dfs_order(G, root=1): parent = [0] * (N + 1) order = [] stack = [root] while stack: x = stack.pop() order.append(x) for y in G[x]: if y == parent...
false
9.756098
[ "-N, *P = list(map(int, read().split()))", "-graph = [[] for _ in range(N + 1)]", "-for i, x in enumerate(P, 2):", "- graph[i].append(x)", "- graph[x].append(i)", "-root = 1", "-parent = [0] * (N + 1)", "-order = []", "-stack = [root]", "-while stack:", "- x = stack.pop()", "- orde...
false
0.071408
0.048246
1.480096
[ "s815454261", "s044325287" ]
u117078923
p02923
python
s720827408
s571532174
95
80
15,020
15,020
Accepted
Accepted
15.79
N=int(eval(input())) H=list(map(int,input().split())) ans=0 tmp=0 for i in range(N-1): if H[i]>=H[i+1]: tmp+=1 else: tmp=0 ans=max(ans,tmp) print(ans)
n=int(eval(input())) h=list(int(x) for x in input().split()) length=0 max_length=0 for i in range(n-1): if h[i]>=h[i+1]: length+=1 if length>max_length: max_length=length else: length=0 print(max_length)
11
14
182
234
N = int(eval(input())) H = list(map(int, input().split())) ans = 0 tmp = 0 for i in range(N - 1): if H[i] >= H[i + 1]: tmp += 1 else: tmp = 0 ans = max(ans, tmp) print(ans)
n = int(eval(input())) h = list(int(x) for x in input().split()) length = 0 max_length = 0 for i in range(n - 1): if h[i] >= h[i + 1]: length += 1 if length > max_length: max_length = length else: length = 0 print(max_length)
false
21.428571
[ "-N = int(eval(input()))", "-H = list(map(int, input().split()))", "-ans = 0", "-tmp = 0", "-for i in range(N - 1):", "- if H[i] >= H[i + 1]:", "- tmp += 1", "+n = int(eval(input()))", "+h = list(int(x) for x in input().split())", "+length = 0", "+max_length = 0", "+for i in range(n ...
false
0.039031
0.038736
1.007621
[ "s720827408", "s571532174" ]
u066692421
p03069
python
s486716032
s363173521
138
118
3,500
3,500
Accepted
Accepted
14.49
n = int(eval(input())) s = eval(input()) white = 0 black = 0 for i in range(n): if s[i] == ".": white += 1 ans = float("inf") for j in range(n + 1): if white + black < ans: ans = white + black if j == n: break if s[j] == ".": white -= 1 else: b...
n = int(eval(input())) s = eval(input()) white = 0 black = 0 for i in range(n): if s[i] == ".": white += 1 ans = white + black for j in range(n): if s[j] == ".": white -= 1 else: black += 1 if white + black < ans: ans = white + black print(ans)
18
16
329
295
n = int(eval(input())) s = eval(input()) white = 0 black = 0 for i in range(n): if s[i] == ".": white += 1 ans = float("inf") for j in range(n + 1): if white + black < ans: ans = white + black if j == n: break if s[j] == ".": white -= 1 else: black += 1 print(...
n = int(eval(input())) s = eval(input()) white = 0 black = 0 for i in range(n): if s[i] == ".": white += 1 ans = white + black for j in range(n): if s[j] == ".": white -= 1 else: black += 1 if white + black < ans: ans = white + black print(ans)
false
11.111111
[ "-ans = float(\"inf\")", "-for j in range(n + 1):", "- if white + black < ans:", "- ans = white + black", "- if j == n:", "- break", "+ans = white + black", "+for j in range(n):", "+ if white + black < ans:", "+ ans = white + black" ]
false
0.036165
0.038927
0.929032
[ "s486716032", "s363173521" ]
u002459665
p02843
python
s490279732
s928059205
30
18
3,060
3,060
Accepted
Accepted
40
import math def main(): X = int(eval(input())) ans = False for i in range(X+1): mx = 105 * i mn = 100 * i if mn <= X <= mx: ans = True if ans: print((1)) else: print((0)) if __name__ == "__main__": main()
import math def main(): X = int(eval(input())) # ans = False c = X // 100 mx = 105 * c mn = 100 * c if mn <= X <= mx: print((1)) else: print((0)) if __name__ == "__main__": main()
17
15
288
233
import math def main(): X = int(eval(input())) ans = False for i in range(X + 1): mx = 105 * i mn = 100 * i if mn <= X <= mx: ans = True if ans: print((1)) else: print((0)) if __name__ == "__main__": main()
import math def main(): X = int(eval(input())) # ans = False c = X // 100 mx = 105 * c mn = 100 * c if mn <= X <= mx: print((1)) else: print((0)) if __name__ == "__main__": main()
false
11.764706
[ "- ans = False", "- for i in range(X + 1):", "- mx = 105 * i", "- mn = 100 * i", "- if mn <= X <= mx:", "- ans = True", "- if ans:", "+ # ans = False", "+ c = X // 100", "+ mx = 105 * c", "+ mn = 100 * c", "+ if mn <= X <= mx:" ]
false
0.118486
0.041998
2.821231
[ "s490279732", "s928059205" ]
u113835532
p03378
python
s072309587
s129407543
29
26
8,912
9,076
Accepted
Accepted
10.34
import bisect x = int(input().split()[2]) a = list(map(int, input().split())) i = bisect.bisect(a, x) print((min(i, len(a) - i)))
import bisect def answer(n: int, m: int, x: int, a: []) -> int: i = bisect.bisect_left(a, x) return min(i, len(a) - i) def main(): n, m, x = list(map(int, input().split())) a = list(map(int, input().split())) print((answer(n, m, x, a))) if __name__ == '__main__': main()
7
16
135
307
import bisect x = int(input().split()[2]) a = list(map(int, input().split())) i = bisect.bisect(a, x) print((min(i, len(a) - i)))
import bisect def answer(n: int, m: int, x: int, a: []) -> int: i = bisect.bisect_left(a, x) return min(i, len(a) - i) def main(): n, m, x = list(map(int, input().split())) a = list(map(int, input().split())) print((answer(n, m, x, a))) if __name__ == "__main__": main()
false
56.25
[ "-x = int(input().split()[2])", "-a = list(map(int, input().split()))", "-i = bisect.bisect(a, x)", "-print((min(i, len(a) - i)))", "+", "+def answer(n: int, m: int, x: int, a: []) -> int:", "+ i = bisect.bisect_left(a, x)", "+ return min(i, len(a) - i)", "+", "+", "+def main():", "+ ...
false
0.045442
0.113854
0.399122
[ "s072309587", "s129407543" ]
u330799501
p02885
python
s449682758
s698591512
32
27
9,088
9,148
Accepted
Accepted
15.62
a, b = list(map(int, input().split())) ans = a - b * 2 if ans < 0: ans = 0 print (ans)
#k = int(input()) #s = input() #a, b = map(int, input().split()) #s, t = map(str, input().split()) #l = list(map(int, input().split())) a, b = list(map(int, input().split())) ans = a - b * 2 if (ans >= 0): print(ans) else: print((0))
8
15
95
252
a, b = list(map(int, input().split())) ans = a - b * 2 if ans < 0: ans = 0 print(ans)
# k = int(input()) # s = input() # a, b = map(int, input().split()) # s, t = map(str, input().split()) # l = list(map(int, input().split())) a, b = list(map(int, input().split())) ans = a - b * 2 if ans >= 0: print(ans) else: print((0))
false
46.666667
[ "+# k = int(input())", "+# s = input()", "+# a, b = map(int, input().split())", "+# s, t = map(str, input().split())", "+# l = list(map(int, input().split()))", "-if ans < 0:", "- ans = 0", "-print(ans)", "+if ans >= 0:", "+ print(ans)", "+else:", "+ print((0))" ]
false
0.035848
0.084397
0.424757
[ "s449682758", "s698591512" ]
u759518460
p02582
python
s598386341
s780903886
75
65
61,888
61,776
Accepted
Accepted
13.33
import sys input = lambda: sys.stdin.readline().rstrip() def main(): S = eval(input()) ans = 0 if S[0] == 'R' and S[1] == 'R' and S[2] == 'R': ans = 3 elif (S[0] == 'R' and S[1] == 'R') or S[1] == 'R' and S[2] == 'R': ans = 2 elif 'R' in S: ans = 1 else: ...
import sys input = lambda: sys.stdin.readline().rstrip() def main(): S = eval(input()) ans = 0 cnt = 0 for i in range(len(S)): if S[i] == 'R': cnt += 1 ans = max(ans, cnt) else: cnt = 0 # if S[0] == 'R' and S[1] == 'R' and S[2] == 'R'...
18
25
385
559
import sys input = lambda: sys.stdin.readline().rstrip() def main(): S = eval(input()) ans = 0 if S[0] == "R" and S[1] == "R" and S[2] == "R": ans = 3 elif (S[0] == "R" and S[1] == "R") or S[1] == "R" and S[2] == "R": ans = 2 elif "R" in S: ans = 1 else: ans = ...
import sys input = lambda: sys.stdin.readline().rstrip() def main(): S = eval(input()) ans = 0 cnt = 0 for i in range(len(S)): if S[i] == "R": cnt += 1 ans = max(ans, cnt) else: cnt = 0 # if S[0] == 'R' and S[1] == 'R' and S[2] == 'R': # ...
false
28
[ "- if S[0] == \"R\" and S[1] == \"R\" and S[2] == \"R\":", "- ans = 3", "- elif (S[0] == \"R\" and S[1] == \"R\") or S[1] == \"R\" and S[2] == \"R\":", "- ans = 2", "- elif \"R\" in S:", "- ans = 1", "- else:", "- ans = 0", "+ cnt = 0", "+ for i in ran...
false
0.040324
0.064155
0.628542
[ "s598386341", "s780903886" ]
u197615397
p02343
python
s284207260
s669768932
750
320
8,492
7,232
Accepted
Accepted
57.33
n, q = map(int, input().split()) forest = [-1]*n def get_root(x: int) -> int: if forest[x] < 0: return x else: forest[x] = get_root(forest[x]) return forest[x] def unite(x: int, y: int) -> None: root_x, root_y = get_root(x), get_root(y) if root_x != root_y: ...
def get_root(nodes, x: int) -> int: if nodes[x] < 0: return x else: nodes[x] = get_root(nodes, nodes[x]) return nodes[x] def unite(nodes, x: int, y: int) -> None: root_x, root_y = get_root(nodes, x), get_root(nodes, y) if root_x != root_y: bigroot, smallroot ...
27
31
697
876
n, q = map(int, input().split()) forest = [-1] * n def get_root(x: int) -> int: if forest[x] < 0: return x else: forest[x] = get_root(forest[x]) return forest[x] def unite(x: int, y: int) -> None: root_x, root_y = get_root(x), get_root(y) if root_x != root_y: bigroot,...
def get_root(nodes, x: int) -> int: if nodes[x] < 0: return x else: nodes[x] = get_root(nodes, nodes[x]) return nodes[x] def unite(nodes, x: int, y: int) -> None: root_x, root_y = get_root(nodes, x), get_root(nodes, y) if root_x != root_y: bigroot, smallroot = ( ...
false
12.903226
[ "-n, q = map(int, input().split())", "-forest = [-1] * n", "+def get_root(nodes, x: int) -> int:", "+ if nodes[x] < 0:", "+ return x", "+ else:", "+ nodes[x] = get_root(nodes, nodes[x])", "+ return nodes[x]", "-def get_root(x: int) -> int:", "- if forest[x] < 0:", "...
false
0.101739
0.034584
2.941798
[ "s284207260", "s669768932" ]
u139614630
p02948
python
s886508584
s142807556
1,736
440
20,024
21,788
Accepted
Accepted
74.65
#!/usr/bin/env python3 from collections import deque class PriorityQueue: def __init__(self, size): self.tree = [None] * size self.bottom = 0 def add(self, data): n = self.bottom self.bottom += 1 self.tree[n] = data while n != 0: par...
#!/usr/bin/env python3 from collections import deque import heapq def solve(N, M, A, B): ans = 0 # 日付順にソートする all_works = deque(sorted(zip(A, B), key=lambda x: x[0])) pq = [] for d in range(1, M+1): # print('d=', d) # 今日が期限の仕事があれば追加 while all_works and all_w...
96
36
2,497
779
#!/usr/bin/env python3 from collections import deque class PriorityQueue: def __init__(self, size): self.tree = [None] * size self.bottom = 0 def add(self, data): n = self.bottom self.bottom += 1 self.tree[n] = data while n != 0: parent = (n - 1) //...
#!/usr/bin/env python3 from collections import deque import heapq def solve(N, M, A, B): ans = 0 # 日付順にソートする all_works = deque(sorted(zip(A, B), key=lambda x: x[0])) pq = [] for d in range(1, M + 1): # print('d=', d) # 今日が期限の仕事があれば追加 while all_works and all_works[0][0] == d...
false
62.5
[ "-", "-", "-class PriorityQueue:", "- def __init__(self, size):", "- self.tree = [None] * size", "- self.bottom = 0", "-", "- def add(self, data):", "- n = self.bottom", "- self.bottom += 1", "- self.tree[n] = data", "- while n != 0:", "- ...
false
0.040578
0.041233
0.984128
[ "s886508584", "s142807556" ]
u046187684
p02814
python
s698737535
s701945041
494
159
17,132
17,132
Accepted
Accepted
67.81
from fractions import gcd from functools import reduce def lcm(a, b): return a * b // gcd(a, b) def count(n): c = 0 while n % 2 == 0: c += 1 n //= 2 return c def solve(string): n, m, *a = list(map(int, string.split())) c = len(bin(a[0]).split("1")[-1]) ...
from fractions import gcd def lcm(a, b): return a * b // gcd(a, b) def solve(string): n, m, *a = list(map(int, string.split())) c = 2**len(bin(a[0]).split("1")[-1]) l = a[0] for _a in a: if _a % c or not _a // c % 2: return "0" l = lcm(l, _a) return...
29
21
544
442
from fractions import gcd from functools import reduce def lcm(a, b): return a * b // gcd(a, b) def count(n): c = 0 while n % 2 == 0: c += 1 n //= 2 return c def solve(string): n, m, *a = list(map(int, string.split())) c = len(bin(a[0]).split("1")[-1]) for _a in a: ...
from fractions import gcd def lcm(a, b): return a * b // gcd(a, b) def solve(string): n, m, *a = list(map(int, string.split())) c = 2 ** len(bin(a[0]).split("1")[-1]) l = a[0] for _a in a: if _a % c or not _a // c % 2: return "0" l = lcm(l, _a) return str(max((m -...
false
27.586207
[ "-from functools import reduce", "-def count(n):", "- c = 0", "- while n % 2 == 0:", "- c += 1", "- n //= 2", "- return c", "-", "-", "- c = len(bin(a[0]).split(\"1\")[-1])", "+ c = 2 ** len(bin(a[0]).split(\"1\")[-1])", "+ l = a[0]", "- if count(_a) !=...
false
0.055111
0.107997
0.510302
[ "s698737535", "s701945041" ]
u577170763
p03160
python
s341389179
s175919977
135
112
13,924
13,924
Accepted
Accepted
17.04
# import sys # sys.setrecursionlimit(10**5) # from collections import defaultdict geta = lambda fn: list(map(fn, input().split())) gete = lambda fn: fn(eval(input())) N = gete(int) h = geta(int) dp = [0 for _ in range(N)] dp[0], dp[1] = 0, abs(h[0] - h[1]) for i in range(2, N): dp[i] = min(dp[i - 2]...
# import sys # sys.setrecursionlimit(10**5) # from collections import defaultdict geta = lambda fn: list(map(fn, input().split())) gete = lambda fn: fn(eval(input())) def main(): N = gete(int) h = geta(int) dp = [0 for _ in range(N)] dp[0], dp[1] = 0, abs(h[0] - h[1]) for i in range(...
17
22
410
498
# import sys # sys.setrecursionlimit(10**5) # from collections import defaultdict geta = lambda fn: list(map(fn, input().split())) gete = lambda fn: fn(eval(input())) N = gete(int) h = geta(int) dp = [0 for _ in range(N)] dp[0], dp[1] = 0, abs(h[0] - h[1]) for i in range(2, N): dp[i] = min(dp[i - 2] + abs(h[i] - h[...
# import sys # sys.setrecursionlimit(10**5) # from collections import defaultdict geta = lambda fn: list(map(fn, input().split())) gete = lambda fn: fn(eval(input())) def main(): N = gete(int) h = geta(int) dp = [0 for _ in range(N)] dp[0], dp[1] = 0, abs(h[0] - h[1]) for i in range(2, N): ...
false
22.727273
[ "-N = gete(int)", "-h = geta(int)", "-dp = [0 for _ in range(N)]", "-dp[0], dp[1] = 0, abs(h[0] - h[1])", "-for i in range(2, N):", "- dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]))", "-print((dp[N - 1]))", "+", "+", "+def main():", "+ N = gete(int)", "+ ...
false
0.10025
0.076919
1.303312
[ "s341389179", "s175919977" ]
u419686324
p03545
python
s711133516
s178739335
23
17
3,572
3,060
Accepted
Accepted
26.09
s = [int(x) for x in eval(input())] import functools @functools.lru_cache(maxsize=None) def f(c, n): if n == 4: if c == 7: return [] else: return None v = s[n] for o in ['+', '-']: ret = f(eval('%d%s%d'% (c,o,v)), n + 1) if ret is not Non...
s = [int(x) for x in eval(input())] def f(c, n): if n == 4: if eval(c) == 7: return c + "=7" else: return None v = s[n] for o in ['+', '-']: ret = f('%s%s%d' % (c,o,v), n + 1) if ret: return ret print((f(str(s[0]), 1)))
16
14
413
306
s = [int(x) for x in eval(input())] import functools @functools.lru_cache(maxsize=None) def f(c, n): if n == 4: if c == 7: return [] else: return None v = s[n] for o in ["+", "-"]: ret = f(eval("%d%s%d" % (c, o, v)), n + 1) if ret is not None: ...
s = [int(x) for x in eval(input())] def f(c, n): if n == 4: if eval(c) == 7: return c + "=7" else: return None v = s[n] for o in ["+", "-"]: ret = f("%s%s%d" % (c, o, v), n + 1) if ret: return ret print((f(str(s[0]), 1)))
false
12.5
[ "-import functools", "-@functools.lru_cache(maxsize=None)", "- if c == 7:", "- return []", "+ if eval(c) == 7:", "+ return c + \"=7\"", "- ret = f(eval(\"%d%s%d\" % (c, o, v)), n + 1)", "- if ret is not None:", "- return [o, v] + ret", "...
false
0.040343
0.045799
0.880862
[ "s711133516", "s178739335" ]
u634079249
p03673
python
s794839020
s567054869
222
120
24,052
29,124
Accepted
Accepted
45.95
import sys import os import math import bisect import collections import itertools import heapq import re import queue ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: list(map(int, sys.stdin.buffer.readline().split())) fl = lambda: list(map(float, sys.stdin.buffer.readline().split())) ...
import sys, os, math, bisect, itertools, collections, heapq, queue # from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall from decimal import Decimal from collections import defaultdict # import fractions sys.setrecursionlimit(10000000) ii = lambda: int(sys.stdin.buffer.readline().rstrip()) ...
43
39
1,053
1,169
import sys import os import math import bisect import collections import itertools import heapq import re import queue ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: list(map(int, sys.stdin.buffer.readline().split())) fl = lambda: list(map(float, sys.stdin.buffer.readline().split())) iln = lambda ...
import sys, os, math, bisect, itertools, collections, heapq, queue # from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall from decimal import Decimal from collections import defaultdict # import fractions sys.setrecursionlimit(10000000) ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda...
false
9.302326
[ "-import sys", "-import os", "-import math", "-import bisect", "-import collections", "-import itertools", "-import heapq", "-import re", "-import queue", "+import sys, os, math, bisect, itertools, collections, heapq, queue", "+# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshal...
false
0.054174
0.040275
1.345104
[ "s794839020", "s567054869" ]
u595289165
p03045
python
s661734624
s792752501
496
360
7,856
81,652
Accepted
Accepted
27.42
class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): ...
class UnionFind1: def __init__(self, n): self.n = n self.par = [-1] * (n+1) def root(self, x): if self.par[x] < 0: return x self.par[x] = self.root(self.par[x]) return self.par[x] def unite(self, x, y): if self.same(x, y): ...
40
42
884
885
class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = se...
class UnionFind1: def __init__(self, n): self.n = n self.par = [-1] * (n + 1) def root(self, x): if self.par[x] < 0: return x self.par[x] = self.root(self.par[x]) return self.par[x] def unite(self, x, y): if self.same(x, y): return ...
false
4.761905
[ "-class UnionFind:", "+class UnionFind1:", "- self.parents = [-1] * n", "+ self.par = [-1] * (n + 1)", "- def find(self, x):", "- if self.parents[x] < 0:", "+ def root(self, x):", "+ if self.par[x] < 0:", "- else:", "- self.parents[x] = self.find...
false
0.061341
0.039006
1.57261
[ "s661734624", "s792752501" ]
u396495667
p02958
python
s858820227
s313061512
19
17
2,940
2,940
Accepted
Accepted
10.53
n = int(eval(input())) p = [int(x) for x in input().split()] cnt =0 for i in range(n): if p[i] ==(i+1): continue else: cnt +=1 if cnt <= 2: print('YES') else: print('NO')
n =int(eval(input())) p = [int(_) for _ in input().split()] cnt =0 for i in range(len(p)): if p[i] !=(i+1): cnt +=1 print(('YES' if cnt <=2 else 'NO'))
14
7
195
156
n = int(eval(input())) p = [int(x) for x in input().split()] cnt = 0 for i in range(n): if p[i] == (i + 1): continue else: cnt += 1 if cnt <= 2: print("YES") else: print("NO")
n = int(eval(input())) p = [int(_) for _ in input().split()] cnt = 0 for i in range(len(p)): if p[i] != (i + 1): cnt += 1 print(("YES" if cnt <= 2 else "NO"))
false
50
[ "-p = [int(x) for x in input().split()]", "+p = [int(_) for _ in input().split()]", "-for i in range(n):", "- if p[i] == (i + 1):", "- continue", "- else:", "+for i in range(len(p)):", "+ if p[i] != (i + 1):", "-if cnt <= 2:", "- print(\"YES\")", "-else:", "- print(\"NO\"...
false
0.06997
0.051955
1.346724
[ "s858820227", "s313061512" ]
u389910364
p03837
python
s946878743
s914551203
303
163
19,904
12,748
Accepted
Accepted
46.2
import os import sys import numpy as np from scipy.sparse.csgraph import csgraph_from_dense, dijkstra if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10 ** 18 N, M = list(map(int, sys.stdin.readline().split())) ABC = [list(map(int...
import os import sys import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10 ** 18 N, M = list(map(int, sys.stdin.readline().split())) ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)] D = np.f...
22
29
533
612
import os import sys import numpy as np from scipy.sparse.csgraph import csgraph_from_dense, dijkstra if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10**18 N, M = list(map(int, sys.stdin.readline().split())) ABC = [list(map(int, sys.stdin.readlin...
import os import sys import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10**18 N, M = list(map(int, sys.stdin.readline().split())) ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)] D = np.full((N, N), IINF) for...
false
24.137931
[ "-from scipy.sparse.csgraph import csgraph_from_dense, dijkstra", "-D = np.zeros((N, N))", "+D = np.full((N, N), IINF)", "-min_dist = dijkstra(csgraph_from_dense(D), directed=False)", "-print(((min_dist < D).sum()))", "+ D[b - 1][a - 1] = c", "+# warshall floyd", "+for via in range(N):", "+ D ...
false
0.736744
1.088422
0.676892
[ "s946878743", "s914551203" ]
u463950771
p03078
python
s177030648
s015361432
2,000
654
160,584
8,708
Accepted
Accepted
67.3
x,y,z,k = list(map(int,input().split())) lisa = list(map(int,input().split())) lisb = list(map(int,input().split())) lisc = list(map(int,input().split())) lisa.sort(reverse=True) lisb.sort(reverse=True) lisc.sort(reverse=True) an = [] ans = [] for num in lisb: for nu in lisa: an.append(num+nu) a...
X, Y, Z, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) result = [] for i in range(X): for j in range(Y): for k in range(Z): ...
20
20
492
512
x, y, z, k = list(map(int, input().split())) lisa = list(map(int, input().split())) lisb = list(map(int, input().split())) lisc = list(map(int, input().split())) lisa.sort(reverse=True) lisb.sort(reverse=True) lisc.sort(reverse=True) an = [] ans = [] for num in lisb: for nu in lisa: an.append(num + nu) an.s...
X, Y, Z, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) result = [] for i in range(X): for j in range(Y): for k in range(Z): if (i + 1) ...
false
0
[ "-x, y, z, k = list(map(int, input().split()))", "-lisa = list(map(int, input().split()))", "-lisb = list(map(int, input().split()))", "-lisc = list(map(int, input().split()))", "-lisa.sort(reverse=True)", "-lisb.sort(reverse=True)", "-lisc.sort(reverse=True)", "-an = []", "-ans = []", "-for num i...
false
0.04328
0.070196
0.61656
[ "s177030648", "s015361432" ]
u064027771
p02861
python
s421513244
s006261427
11
10
2,692
2,568
Accepted
Accepted
9.09
def d(a,b): return ((a[0]-b[0])**2+(a[1]-b[1])**2)**(.5) n = int(input()) l = [list(map(int,input().split())) for i in range(n)] s = 0 for i in range(n): for j in range(n): if i !=j: s += d(l[i],l[j]) print(s/n)
n = int(input()) l = [list(map(int,input().split())) for i in range(n)] print(sum(((l[i][0]-l[j][0])**2+(l[i][1]-l[j][1])**2)**(.5) for i in range(n) for j in range(n) if i !=j)/n)
10
3
249
183
def d(a, b): return ((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2) ** (0.5) n = int(input()) l = [list(map(int, input().split())) for i in range(n)] s = 0 for i in range(n): for j in range(n): if i != j: s += d(l[i], l[j]) print(s / n)
n = int(input()) l = [list(map(int, input().split())) for i in range(n)] print( sum( ((l[i][0] - l[j][0]) ** 2 + (l[i][1] - l[j][1]) ** 2) ** (0.5) for i in range(n) for j in range(n) if i != j ) / n )
false
70
[ "-def d(a, b):", "- return ((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2) ** (0.5)", "-", "-", "-s = 0", "-for i in range(n):", "- for j in range(n):", "- if i != j:", "- s += d(l[i], l[j])", "-print(s / n)", "+print(", "+ sum(", "+ ((l[i][0] - l[j][0]) ** 2 + (l...
false
0.043122
0.043623
0.988525
[ "s421513244", "s006261427" ]
u334712262
p02698
python
s495896796
s752448516
1,814
1,321
551,636
383,228
Accepted
Accepted
27.18
# -*- coding: utf-8 -*- import bisect import sys sys.setrecursionlimit(100000) input = sys.stdin.buffer.readline INF = 2**62-1 def read_int(): return int(input()) def read_int_n(): return list(map(int, input().split())) def read_float(): return float(input()) def read_float_n()...
# -*- coding: utf-8 -*- import bisect import sys sys.setrecursionlimit(100000) input = sys.stdin.buffer.readline INF = 2**62-1 def read_int(): return int(input()) def read_int_n(): return list(map(int, input().split())) def read_float(): return float(input()) def read_float_n()...
100
94
1,756
1,602
# -*- coding: utf-8 -*- import bisect import sys sys.setrecursionlimit(100000) input = sys.stdin.buffer.readline INF = 2**62 - 1 def read_int(): return int(input()) def read_int_n(): return list(map(int, input().split())) def read_float(): return float(input()) def read_float_n(): return list(m...
# -*- coding: utf-8 -*- import bisect import sys sys.setrecursionlimit(100000) input = sys.stdin.buffer.readline INF = 2**62 - 1 def read_int(): return int(input()) def read_int_n(): return list(map(int, input().split())) def read_float(): return float(input()) def read_float_n(): return list(m...
false
6
[ "- if len(dp) <= i:", "- dp.append(A[v])", "- ans[v] = len(dp)", "- dfs(v, u, dp)", "- dp.pop()", "- else:", "- b = dp[i]", "- dp[i] = A[v]", "- ans[v] = len(dp)", "- ...
false
0.047109
0.040136
1.173731
[ "s495896796", "s752448516" ]
u773265208
p02848
python
s428031713
s124842687
33
30
4,468
3,060
Accepted
Accepted
9.09
n = int(input()) s = input() for i in range(len(s)): num = int(ord(s[i])+n) if num > 90: num -= 26 print(chr(num),end="")
n = int(eval(input())) s = eval(input()) ans = "" for i in range(len(s)): num = ord(s[i])+n if num > 90: num -= 26 ans += chr(num) print(ans)
9
12
137
149
n = int(input()) s = input() for i in range(len(s)): num = int(ord(s[i]) + n) if num > 90: num -= 26 print(chr(num), end="")
n = int(eval(input())) s = eval(input()) ans = "" for i in range(len(s)): num = ord(s[i]) + n if num > 90: num -= 26 ans += chr(num) print(ans)
false
25
[ "-n = int(input())", "-s = input()", "+n = int(eval(input()))", "+s = eval(input())", "+ans = \"\"", "- num = int(ord(s[i]) + n)", "+ num = ord(s[i]) + n", "- print(chr(num), end=\"\")", "+ ans += chr(num)", "+print(ans)" ]
false
0.076986
0.056397
1.365076
[ "s428031713", "s124842687" ]
u968404618
p03254
python
s099743674
s155367407
33
28
9,132
9,088
Accepted
Accepted
15.15
import sys input = lambda :sys.stdin.readline().rstrip() N, x = list(map(int, input().split())) A = sorted(list(map(int, input().split()))) if x > sum(A): cnt = -1 else: cnt = 0 for i in range(N): if x - A[i] >= 0: cnt += 1 x -= A[i] if x <= 0: break #print(...
n, x = list(map(int, input().split())) A = sorted(list(map(int, input().split()))) if sum(A) < x: cnt = -1 else: cnt = 0 for a in A: x -= a if x >= 0: cnt += 1 if x <= 0: print(cnt) exit() print(cnt)
20
16
335
258
import sys input = lambda: sys.stdin.readline().rstrip() N, x = list(map(int, input().split())) A = sorted(list(map(int, input().split()))) if x > sum(A): cnt = -1 else: cnt = 0 for i in range(N): if x - A[i] >= 0: cnt += 1 x -= A[i] if x <= 0: break # print(cnt, x) print(cn...
n, x = list(map(int, input().split())) A = sorted(list(map(int, input().split()))) if sum(A) < x: cnt = -1 else: cnt = 0 for a in A: x -= a if x >= 0: cnt += 1 if x <= 0: print(cnt) exit() print(cnt)
false
20
[ "-import sys", "-", "-input = lambda: sys.stdin.readline().rstrip()", "-N, x = list(map(int, input().split()))", "+n, x = list(map(int, input().split()))", "-if x > sum(A):", "+if sum(A) < x:", "-for i in range(N):", "- if x - A[i] >= 0:", "+for a in A:", "+ x -= a", "+ if x >= 0:", ...
false
0.046456
0.090875
0.511206
[ "s099743674", "s155367407" ]
u729133443
p02921
python
s274739459
s279388613
166
31
38,256
9,072
Accepted
Accepted
81.33
print((sum(i==j for i,j in zip(*open(0)))-1))
print((3-sum(i!=j for i,j in zip(*open(0)))))
1
1
43
43
print((sum(i == j for i, j in zip(*open(0))) - 1))
print((3 - sum(i != j for i, j in zip(*open(0)))))
false
0
[ "-print((sum(i == j for i, j in zip(*open(0))) - 1))", "+print((3 - sum(i != j for i, j in zip(*open(0)))))" ]
false
0.036541
0.096582
0.378341
[ "s274739459", "s279388613" ]
u796842765
p02773
python
s159723614
s010007478
781
720
54,276
49,224
Accepted
Accepted
7.81
N = int(eval(input())) S = [eval(input()) for _ in range(N)] import collections max = max(collections.Counter(S).values()) letter = [a for a , b in collections.Counter(S).most_common() if b == max] for a in sorted(letter): print(a)
N = int(eval(input())) S = [eval(input()) for _ in range(N)] import collections c = collections.Counter(S) A = sorted(list(c.items()), key=lambda x: x[1], reverse=True) count = 0 B = [] for a, b in A: if b >= count: B.append(a) count = b else: break C = sorted(B) for a in...
7
17
229
319
N = int(eval(input())) S = [eval(input()) for _ in range(N)] import collections max = max(collections.Counter(S).values()) letter = [a for a, b in collections.Counter(S).most_common() if b == max] for a in sorted(letter): print(a)
N = int(eval(input())) S = [eval(input()) for _ in range(N)] import collections c = collections.Counter(S) A = sorted(list(c.items()), key=lambda x: x[1], reverse=True) count = 0 B = [] for a, b in A: if b >= count: B.append(a) count = b else: break C = sorted(B) for a in C: print(a...
false
58.823529
[ "-max = max(collections.Counter(S).values())", "-letter = [a for a, b in collections.Counter(S).most_common() if b == max]", "-for a in sorted(letter):", "+c = collections.Counter(S)", "+A = sorted(list(c.items()), key=lambda x: x[1], reverse=True)", "+count = 0", "+B = []", "+for a, b in A:", "+ ...
false
0.008666
0.075191
0.115254
[ "s159723614", "s010007478" ]
u285891772
p02845
python
s271836893
s610524992
110
97
22,328
22,488
Accepted
Accepted
11.82
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemge...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemge...
36
34
1,124
1,077
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, ) from itertools import ( accumulate, permutations, combinations, ...
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, ) from itertools import ( accumulate, permutations, combinations, ...
false
5.555556
[ "+cnt = [0] * (max(A) + 2)", "+cnt[0] = 3", "-cnt = [0, 0, 0]", "-for i in range(N):", "- ans = ans * cnt.count(A[i]) % mod", "- if A[i] in cnt:", "- cnt[cnt.index(A[i])] += 1", "- else:", "- print((0))", "- exit()", "+for a in A:", "+ ans *= cnt[a] - cnt[a + 1...
false
0.047487
0.047709
0.995344
[ "s271836893", "s610524992" ]
u883040023
p02629
python
s984087344
s921572121
30
27
9,224
8,904
Accepted
Accepted
10
n = int(eval(input())) kugiri = [0,26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134,146813779479510,3817158266467286] ans = "" for i in range(len(kugiri)): if n <= kugiri[i]: keta = i break n -= kugiri[i-1] for i in range(keta): moji = -(-n // 2...
N = int(eval(input())) ans = '' for i in range(1, 99): if N <= 26 ** i: N -= 1 for j in range(i): ans += chr(ord('a') + N % 26) N //= 26 break else: N -= 26 ** i print((ans[::-1]))
18
17
418
285
n = int(eval(input())) kugiri = [ 0, 26, 702, 18278, 475254, 12356630, 321272406, 8353082582, 217180147158, 5646683826134, 146813779479510, 3817158266467286, ] ans = "" for i in range(len(kugiri)): if n <= kugiri[i]: keta = i break n -= kugiri[i - 1] f...
N = int(eval(input())) ans = "" for i in range(1, 99): if N <= 26**i: N -= 1 for j in range(i): ans += chr(ord("a") + N % 26) N //= 26 break else: N -= 26**i print((ans[::-1]))
false
5.555556
[ "-n = int(eval(input()))", "-kugiri = [", "- 0,", "- 26,", "- 702,", "- 18278,", "- 475254,", "- 12356630,", "- 321272406,", "- 8353082582,", "- 217180147158,", "- 5646683826134,", "- 146813779479510,", "- 3817158266467286,", "-]", "+N = int(eval(inp...
false
0.040121
0.041426
0.968495
[ "s984087344", "s921572121" ]
u244416763
p02989
python
s092571771
s366450051
83
76
14,556
14,396
Accepted
Accepted
8.43
n = int(eval(input())) d = list(map(int, input().split())) if(len(d)%2 == 0): d.sort() t = int(len(d)/2)-1 s = d[t] m = s i = t while (d[t+1] > s): s += 1 print((s-m)) else: print((0))
n = int(eval(input())) d = list(map(int, input().split())) if(len(d)%2 == 0): d.sort() t = int(len(d)/2)-1 print((d[t+1] - d[t])) else: print((0))
13
8
226
159
n = int(eval(input())) d = list(map(int, input().split())) if len(d) % 2 == 0: d.sort() t = int(len(d) / 2) - 1 s = d[t] m = s i = t while d[t + 1] > s: s += 1 print((s - m)) else: print((0))
n = int(eval(input())) d = list(map(int, input().split())) if len(d) % 2 == 0: d.sort() t = int(len(d) / 2) - 1 print((d[t + 1] - d[t])) else: print((0))
false
38.461538
[ "- s = d[t]", "- m = s", "- i = t", "- while d[t + 1] > s:", "- s += 1", "- print((s - m))", "+ print((d[t + 1] - d[t]))" ]
false
0.113523
0.068792
1.650228
[ "s092571771", "s366450051" ]
u934442292
p03044
python
s622099751
s821838482
533
299
79,408
50,080
Accepted
Accepted
43.9
import sys input = sys.stdin.readline sys.setrecursionlimit(100000) N = int(eval(input())) G = [[] for _ in range(N)] for _ in range(N - 1): u, v, w = list(map(int, input().split())) u -= 1 v -= 1 G[u].append((v, w)) G[v].append((u, w)) C = [-1] * N def dfs(pos, color): C[po...
import sys from collections import deque input = sys.stdin.readline def main(): N = int(eval(input())) G = [[] for _ in range(N)] for i in range(N - 1): u, v, w = list(map(int, input().split())) u -= 1 v -= 1 G[u].append((v, w)) G[v].append((u, w)) ...
34
35
602
737
import sys input = sys.stdin.readline sys.setrecursionlimit(100000) N = int(eval(input())) G = [[] for _ in range(N)] for _ in range(N - 1): u, v, w = list(map(int, input().split())) u -= 1 v -= 1 G[u].append((v, w)) G[v].append((u, w)) C = [-1] * N def dfs(pos, color): C[pos] = color for...
import sys from collections import deque input = sys.stdin.readline def main(): N = int(eval(input())) G = [[] for _ in range(N)] for i in range(N - 1): u, v, w = list(map(int, input().split())) u -= 1 v -= 1 G[u].append((v, w)) G[v].append((u, w)) ans = [-1] *...
false
2.857143
[ "+from collections import deque", "-sys.setrecursionlimit(100000)", "-N = int(eval(input()))", "-G = [[] for _ in range(N)]", "-for _ in range(N - 1):", "- u, v, w = list(map(int, input().split()))", "- u -= 1", "- v -= 1", "- G[u].append((v, w))", "- G[v].append((u, w))", "-C = [...
false
0.111378
0.088771
1.254662
[ "s622099751", "s821838482" ]
u707124227
p02709
python
s142304741
s628140163
1,202
367
50,140
100,744
Accepted
Accepted
69.47
import sys import numpy as np def f(n,a_): a=[] for i,ai in enumerate(a_): a.append([1+i,ai]) a.sort(key=lambda x:x[1],reverse=True) dp=np.zeros((n+1,n+1),np.int64) #dp[i,j]:i人目までを配置し終えていて、そのうちj人を右に置いた時の最大値。j<=i dp[1,1]=a[0][1]*(n-a[0][0]) dp[1,0]=a[0][1]*(a[0][0...
n=int(eval(input())) a_=list(map(int,input().split())) a=[[i+1,ai] for i,ai in enumerate(a_)] a.sort(key=lambda x:x[1],reverse=True) dp=[[0]*(n+1) for _ in range(n+1)] # dp[i][j]:大きい順にi+j人のうち、i人を左に、j人を右に移した時の最大値。 dp[1][0]=a[0][1]*abs(a[0][0]-1) dp[0][1]=a[0][1]*abs(a[0][0]-n) for k in range(2,n+1): for i i...
25
22
1,008
715
import sys import numpy as np def f(n, a_): a = [] for i, ai in enumerate(a_): a.append([1 + i, ai]) a.sort(key=lambda x: x[1], reverse=True) dp = np.zeros( (n + 1, n + 1), np.int64 ) # dp[i,j]:i人目までを配置し終えていて、そのうちj人を右に置いた時の最大値。j<=i dp[1, 1] = a[0][1] * (n - a[0][0]) dp[1, ...
n = int(eval(input())) a_ = list(map(int, input().split())) a = [[i + 1, ai] for i, ai in enumerate(a_)] a.sort(key=lambda x: x[1], reverse=True) dp = [[0] * (n + 1) for _ in range(n + 1)] # dp[i][j]:大きい順にi+j人のうち、i人を左に、j人を右に移した時の最大値。 dp[1][0] = a[0][1] * abs(a[0][0] - 1) dp[0][1] = a[0][1] * abs(a[0][0] - n) for k in r...
false
12
[ "-import sys", "-import numpy as np", "-", "-", "-def f(n, a_):", "- a = []", "- for i, ai in enumerate(a_):", "- a.append([1 + i, ai])", "- a.sort(key=lambda x: x[1], reverse=True)", "- dp = np.zeros(", "- (n + 1, n + 1), np.int64", "- ) # dp[i,j]:i人目までを配置し終えていて、...
false
0.315265
0.037751
8.351186
[ "s142304741", "s628140163" ]
u923279197
p02763
python
s040905389
s725344817
1,870
756
394,184
79,892
Accepted
Accepted
59.57
class Binary_Indexed_Tree: def __init__(self, n): self.size = n self.tree = [0 for _ in range(n+1)] # a[i]にxを加算(1 <= i <= n) 1-indexed def add(self, i, x): while i <= self.size: self.tree[i] += x i += i & (-i) # a[1] から a[t] までの合計を得る (1 <= t <...
class OR_seg: def __init__(self,n,init_val,ide_ele = 0): # set_val self.ide_ele = ide_ele self.n = n self.num = 2 ** (self.n - 1).bit_length() self.seg = [self.ide_ele] * 2 * self.num for i in range(n): self.seg[i + self.num - 1] = init_val[i] ...
50
74
1,318
1,904
class Binary_Indexed_Tree: def __init__(self, n): self.size = n self.tree = [0 for _ in range(n + 1)] # a[i]にxを加算(1 <= i <= n) 1-indexed def add(self, i, x): while i <= self.size: self.tree[i] += x i += i & (-i) # a[1] から a[t] までの合計を得る (1 <= t <= n) ...
class OR_seg: def __init__(self, n, init_val, ide_ele=0): # set_val self.ide_ele = ide_ele self.n = n self.num = 2 ** (self.n - 1).bit_length() self.seg = [self.ide_ele] * 2 * self.num for i in range(n): self.seg[i + self.num - 1] = init_val[i] ...
false
32.432432
[ "-class Binary_Indexed_Tree:", "- def __init__(self, n):", "- self.size = n", "- self.tree = [0 for _ in range(n + 1)]", "+class OR_seg:", "+ def __init__(self, n, init_val, ide_ele=0):", "+ # set_val", "+ self.ide_ele = ide_ele", "+ self.n = n", "+ ...
false
0.066669
0.041339
1.61275
[ "s040905389", "s725344817" ]
u231095456
p03295
python
s455921627
s639502528
372
282
18,260
23,884
Accepted
Accepted
24.19
N, M = list(map(int,input().split())) ls = [tuple(map(int,input().split())) for _ in range(M)] ls.sort(key=lambda x:x[1]) l = 0 ans = 0 for a,b in ls: if l <= a: l = b ans += 1 print(ans)
N,M = list(map(int,input().split())) ls = [tuple(map(int,input().split())) for _ in range(M)] ls.sort(key=lambda x:x[1],reverse=True) ls.sort(key=lambda x:x[0],reverse=True) r = N cnt = 0 for i in range(M): a,b = ls[i] if b <= r: cnt += 1 r = a print(cnt)
10
12
210
284
N, M = list(map(int, input().split())) ls = [tuple(map(int, input().split())) for _ in range(M)] ls.sort(key=lambda x: x[1]) l = 0 ans = 0 for a, b in ls: if l <= a: l = b ans += 1 print(ans)
N, M = list(map(int, input().split())) ls = [tuple(map(int, input().split())) for _ in range(M)] ls.sort(key=lambda x: x[1], reverse=True) ls.sort(key=lambda x: x[0], reverse=True) r = N cnt = 0 for i in range(M): a, b = ls[i] if b <= r: cnt += 1 r = a print(cnt)
false
16.666667
[ "-ls.sort(key=lambda x: x[1])", "-l = 0", "-ans = 0", "-for a, b in ls:", "- if l <= a:", "- l = b", "- ans += 1", "-print(ans)", "+ls.sort(key=lambda x: x[1], reverse=True)", "+ls.sort(key=lambda x: x[0], reverse=True)", "+r = N", "+cnt = 0", "+for i in range(M):", "+ ...
false
0.070276
0.038009
1.848895
[ "s455921627", "s639502528" ]
u644907318
p02767
python
s873256562
s266120440
73
62
63,776
63,732
Accepted
Accepted
15.07
N = int(eval(input())) X = list(map(int,input().split())) cmin = 10**6 for i in range(1,101): cnt = 0 for j in range(N): cnt += (i-X[j])**2 cmin = min(cmin,cnt) print(cmin)
N = int(eval(input())) X = list(map(int,input().split())) cmin = 10**6+10 for i in range(101): cnt = 0 for j in range(N): cnt += (i-X[j])**2 cmin = min(cmin,cnt) print(cmin)
9
9
194
195
N = int(eval(input())) X = list(map(int, input().split())) cmin = 10**6 for i in range(1, 101): cnt = 0 for j in range(N): cnt += (i - X[j]) ** 2 cmin = min(cmin, cnt) print(cmin)
N = int(eval(input())) X = list(map(int, input().split())) cmin = 10**6 + 10 for i in range(101): cnt = 0 for j in range(N): cnt += (i - X[j]) ** 2 cmin = min(cmin, cnt) print(cmin)
false
0
[ "-cmin = 10**6", "-for i in range(1, 101):", "+cmin = 10**6 + 10", "+for i in range(101):" ]
false
0.040874
0.124043
0.329514
[ "s873256562", "s266120440" ]
u250944591
p03844
python
s677452376
s293961854
32
29
9,028
8,956
Accepted
Accepted
9.38
print((eval(input().replace(' ',''))))
print((eval(input())))
1
1
36
20
print((eval(input().replace(" ", ""))))
print((eval(input())))
false
0
[ "-print((eval(input().replace(\" \", \"\"))))", "+print((eval(input())))" ]
false
0.107609
0.109204
0.985393
[ "s677452376", "s293961854" ]
u027685417
p02850
python
s927636009
s609164105
1,406
574
61,968
96,424
Accepted
Accepted
59.17
import sys input = sys.stdin.readline n = int(eval(input())) GRAPH = {i:[] for i in range(1, n + 1)} EDGES = [] for _ in range(n - 1): a, b = list(map(int, input().split())) GRAPH[a].append(b) GRAPH[b].append(a) EDGES.append((a, b)) PREV = {1:0} Q = [1] while Q: now = Q.pop(0) ...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**9) n = int(eval(input())) GRAPH = {i:[] for i in range(1, n + 1)} EDGES = [] for _ in range(n - 1): a, b = list(map(int, input().split())) GRAPH[a].append(b) GRAPH[b].append(a) EDGES.append((a, b)) def dfs(now, prev = 0):...
51
44
1,078
942
import sys input = sys.stdin.readline n = int(eval(input())) GRAPH = {i: [] for i in range(1, n + 1)} EDGES = [] for _ in range(n - 1): a, b = list(map(int, input().split())) GRAPH[a].append(b) GRAPH[b].append(a) EDGES.append((a, b)) PREV = {1: 0} Q = [1] while Q: now = Q.pop(0) for vertex in G...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**9) n = int(eval(input())) GRAPH = {i: [] for i in range(1, n + 1)} EDGES = [] for _ in range(n - 1): a, b = list(map(int, input().split())) GRAPH[a].append(b) GRAPH[b].append(a) EDGES.append((a, b)) def dfs(now, prev=0): a, b = min(n...
false
13.72549
[ "+sys.setrecursionlimit(10**9)", "-PREV = {1: 0}", "-Q = [1]", "-while Q:", "- now = Q.pop(0)", "- for vertex in GRAPH[now]:", "- if vertex == PREV[now]:", "- continue", "- next = vertex", "- PREV[next] = now", "- Q.append(next)", "-COLORS = {(0, 1)...
false
0.039058
0.038802
1.006602
[ "s927636009", "s609164105" ]
u984730891
p03447
python
s416777865
s672167237
19
17
3,060
2,940
Accepted
Accepted
10.53
x = int(eval(input())) a = int(eval(input())) b = int(eval(input())) print(((x - a) % b))
n = int(eval(input())) a = int(eval(input())) b = int(eval(input())) print(((n - a) % b))
4
4
72
72
x = int(eval(input())) a = int(eval(input())) b = int(eval(input())) print(((x - a) % b))
n = int(eval(input())) a = int(eval(input())) b = int(eval(input())) print(((n - a) % b))
false
0
[ "-x = int(eval(input()))", "+n = int(eval(input()))", "-print(((x - a) % b))", "+print(((n - a) % b))" ]
false
0.060363
0.068808
0.877263
[ "s416777865", "s672167237" ]
u075012704
p03283
python
s690849471
s229290674
1,820
1,681
33,932
76,504
Accepted
Accepted
7.64
N, M, Q = list(map(int, input().split())) class Ruisekiwa2D: def __init__(self, h, w): self.H = h self.W = w self.G = [[0] * w for _ in range(h)] def load(self, points): # 問題によってイメージしやすいよう書き換えてください # load終了時にcalcが呼ばれることに注意してください for x, y in points: ...
N, M, Q = list(map(int, input().split())) X = [] for i in range(M): l, r = list(map(int, input().split())) l, r = l - 1, r - 1 X.append((l, r)) class Ruisekiwa2D: def __init__(self, h, w): self.H = h self.W = w self.G = [[0] * w for _ in range(h)] def load(se...
63
60
1,816
1,752
N, M, Q = list(map(int, input().split())) class Ruisekiwa2D: def __init__(self, h, w): self.H = h self.W = w self.G = [[0] * w for _ in range(h)] def load(self, points): # 問題によってイメージしやすいよう書き換えてください # load終了時にcalcが呼ばれることに注意してください for x, y in points: ...
N, M, Q = list(map(int, input().split())) X = [] for i in range(M): l, r = list(map(int, input().split())) l, r = l - 1, r - 1 X.append((l, r)) class Ruisekiwa2D: def __init__(self, h, w): self.H = h self.W = w self.G = [[0] * w for _ in range(h)] def load(self, points): ...
false
4.761905
[ "+X = []", "+for i in range(M):", "+ l, r = list(map(int, input().split()))", "+ l, r = l - 1, r - 1", "+ X.append((l, r))", "- # load終了時にcalcが呼ばれることに注意してください", "- self.calc()", "- self.calc()", "-I = []", "-for i in range(M):", "- l, r = list(map(int, input().sp...
false
0.04574
0.077787
0.58801
[ "s690849471", "s229290674" ]
u794544096
p02707
python
s222143487
s744885005
187
172
92,312
92,168
Accepted
Accepted
8.02
n = int(eval(input())) a = list(map(int, input().split())) list= [0]*n for i in a: list[i-1] += 1 for j in list: print(j)
n = int(eval(input())) a = list(map(int, input().split())) li = [0]*n for i in a: li[i-1] += 1 #print(li) for j in li: print(j)
9
12
133
144
n = int(eval(input())) a = list(map(int, input().split())) list = [0] * n for i in a: list[i - 1] += 1 for j in list: print(j)
n = int(eval(input())) a = list(map(int, input().split())) li = [0] * n for i in a: li[i - 1] += 1 # print(li) for j in li: print(j)
false
25
[ "-list = [0] * n", "+li = [0] * n", "- list[i - 1] += 1", "-for j in list:", "+ li[i - 1] += 1", "+# print(li)", "+for j in li:" ]
false
0.086253
0.038934
2.215346
[ "s222143487", "s744885005" ]
u863370423
p03447
python
s042990466
s481703759
17
10
2,940
2,568
Accepted
Accepted
41.18
x = int(eval(input())) a = int(eval(input())) b = int(eval(input())) x = x-a num = x//b print((x-(num*b)))
x = eval(input()) a = eval(input()) b = eval(input()) x -= a print(x % b)
8
5
95
58
x = int(eval(input())) a = int(eval(input())) b = int(eval(input())) x = x - a num = x // b print((x - (num * b)))
x = eval(input()) a = eval(input()) b = eval(input()) x -= a print(x % b)
false
37.5
[ "-x = int(eval(input()))", "-a = int(eval(input()))", "-b = int(eval(input()))", "-x = x - a", "-num = x // b", "-print((x - (num * b)))", "+x = eval(input())", "+a = eval(input())", "+b = eval(input())", "+x -= a", "+print(x % b)" ]
false
0.03611
0.036467
0.990213
[ "s042990466", "s481703759" ]
u875291233
p02564
python
s708668677
s757263595
1,405
1,170
232,608
187,704
Accepted
Accepted
16.73
def SCC_Tarjan(g): def dfs(v): nonlocal idx pre[v] = low[v] = idx idx += 1 S.append(v) #onS[v] = 1 for c in g[v]: if pre[c] == -1: dfs(c) low[v] = min(low[v], low[c]) #elif onS[c]: else: ...
def SCC_Tarjan(g): n = len(g) order = [-1]*n # 負なら未処理、[0,n) ならpre-order, n ならvisited low = [0]*n ord_now = 0 parent = [-1]*n gp = [0]*n gp_num = 0 S = [] q = [] for i in range(n): if order[i] == -1: q.append(i) while q: ...
66
69
1,581
1,988
def SCC_Tarjan(g): def dfs(v): nonlocal idx pre[v] = low[v] = idx idx += 1 S.append(v) # onS[v] = 1 for c in g[v]: if pre[c] == -1: dfs(c) low[v] = min(low[v], low[c]) # elif onS[c]: else: ...
def SCC_Tarjan(g): n = len(g) order = [-1] * n # 負なら未処理、[0,n) ならpre-order, n ならvisited low = [0] * n ord_now = 0 parent = [-1] * n gp = [0] * n gp_num = 0 S = [] q = [] for i in range(n): if order[i] == -1: q.append(i) while q: v =...
false
4.347826
[ "- def dfs(v):", "- nonlocal idx", "- pre[v] = low[v] = idx", "- idx += 1", "- S.append(v)", "- # onS[v] = 1", "- for c in g[v]:", "- if pre[c] == -1:", "- dfs(c)", "- low[v] = min(low[v], low[c])", "- ...
false
0.038054
0.038718
0.982847
[ "s708668677", "s757263595" ]
u888092736
p03426
python
s934791981
s596945433
609
557
36,256
27,368
Accepted
Accepted
8.54
from itertools import accumulate def get_dist(cur, nxt): return abs(cur[0] - nxt[0]) + abs(cur[1] - nxt[1]) H, W, D = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(H)] pos = {} for i in range(H): for j in range(W): pos[A[i][j] - 1] = (i, j) acc ...
def get_dist(cur, nxt): return abs(cur[0] - nxt[0]) + abs(cur[1] - nxt[1]) H, W, D = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(H)] pos = {} for i in range(H): for j in range(W): pos[A[i][j]] = (i, j) acc = [0] * (H * W + 1) for i in range(D + 1,...
33
21
704
502
from itertools import accumulate def get_dist(cur, nxt): return abs(cur[0] - nxt[0]) + abs(cur[1] - nxt[1]) H, W, D = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(H)] pos = {} for i in range(H): for j in range(W): pos[A[i][j] - 1] = (i, j) acc = [] for i in ran...
def get_dist(cur, nxt): return abs(cur[0] - nxt[0]) + abs(cur[1] - nxt[1]) H, W, D = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(H)] pos = {} for i in range(H): for j in range(W): pos[A[i][j]] = (i, j) acc = [0] * (H * W + 1) for i in range(D + 1, H * W + 1): ...
false
36.363636
[ "-from itertools import accumulate", "-", "-", "- pos[A[i][j] - 1] = (i, j)", "-acc = []", "-for i in range(D):", "- res = [0]", "- now = i", "- while now + D < H * W:", "- nxt = now + D", "- res.append(get_dist(pos[now], pos[nxt]))", "- now = nxt", "- ...
false
0.067501
0.039231
1.720609
[ "s934791981", "s596945433" ]
u873482706
p00180
python
s445988015
s127671285
30
20
4,332
4,316
Accepted
Accepted
33.33
def f(s, cost, route, ans): route.append(s) ans += cost[s] del cost[s] for k, c in list(data.items()): a, b = k if s == a: if not b in route: if not b in cost or c < cost[b]: cost[b] = c elif s == b: if not a ...
def f(s, cost, route, ans): route.append(s) ans += cost[s] del cost[s] for k, c in list(data.items()): if s in k: a, b = k b = b if s == a else a if not b in route: if not b in cost or c < cost[b]: cost[b] = c ...
29
26
793
696
def f(s, cost, route, ans): route.append(s) ans += cost[s] del cost[s] for k, c in list(data.items()): a, b = k if s == a: if not b in route: if not b in cost or c < cost[b]: cost[b] = c elif s == b: if not a in route: ...
def f(s, cost, route, ans): route.append(s) ans += cost[s] del cost[s] for k, c in list(data.items()): if s in k: a, b = k b = b if s == a else a if not b in route: if not b in cost or c < cost[b]: cost[b] = c if cost: ...
false
10.344828
[ "- a, b = k", "- if s == a:", "+ if s in k:", "+ a, b = k", "+ b = b if s == a else a", "- elif s == b:", "- if not a in route:", "- if not a in cost or c < cost[a]:", "- cost[a] = c" ]
false
0.065721
0.065172
1.008426
[ "s445988015", "s127671285" ]
u588341295
p02743
python
s230306508
s307816651
37
18
5,032
3,064
Accepted
Accepted
51.35
# -*- coding: utf-8 -*- import sys from decimal import Decimal 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)]...
# -*- 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 ...
28
26
852
785
# -*- coding: utf-8 -*- import sys from decimal import Decimal 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 ...
# -*- 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
7.142857
[ "-from decimal import Decimal", "-EPS = 10**-14", "-if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():", "+if c - a - b >= 0 and 4 * a * b < pow(c - a - b, 2):" ]
false
0.043459
0.049098
0.885159
[ "s230306508", "s307816651" ]
u083960235
p03738
python
s098361660
s596952051
47
38
5,528
5,144
Accepted
Accepted
19.15
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii...
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii...
29
29
840
841
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_upper...
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_upper...
false
0
[ "-a = INT()", "-b = INT()", "-if a > b:", "+A = INT()", "+B = INT()", "+if A > B:", "-elif a < b:", "+elif A < B:" ]
false
0.036979
0.042617
0.867702
[ "s098361660", "s596952051" ]
u357751375
p03296
python
s037752678
s613204844
33
28
9,176
9,100
Accepted
Accepted
15.15
n = int(eval(input())) a = list(map(int,input().split())) p = 0 x = 0 y = 1 for i in range(n): if a[i] != x: if y == 1: x = a[i] else: p += y // 2 x = a[i] y = 1 else: y += 1 if y == 1: print(p) else: print((p ...
n = int(eval(input())) a = list(map(int,input().split())) x = a[0] y = 1 ans = 0 for i in range(1,n): if a[i] == x: y += 1 else: ans += y // 2 x = a[i] y = 1 print((ans + y // 2))
21
13
322
223
n = int(eval(input())) a = list(map(int, input().split())) p = 0 x = 0 y = 1 for i in range(n): if a[i] != x: if y == 1: x = a[i] else: p += y // 2 x = a[i] y = 1 else: y += 1 if y == 1: print(p) else: print((p + y // 2))
n = int(eval(input())) a = list(map(int, input().split())) x = a[0] y = 1 ans = 0 for i in range(1, n): if a[i] == x: y += 1 else: ans += y // 2 x = a[i] y = 1 print((ans + y // 2))
false
38.095238
[ "-p = 0", "-x = 0", "+x = a[0]", "-for i in range(n):", "- if a[i] != x:", "- if y == 1:", "- x = a[i]", "- else:", "- p += y // 2", "- x = a[i]", "- y = 1", "+ans = 0", "+for i in range(1, n):", "+ if a[i] == x:", "+ ...
false
0.041949
0.042509
0.986834
[ "s037752678", "s613204844" ]
u761320129
p03682
python
s882446657
s822214517
1,111
731
53,524
53,224
Accepted
Accepted
34.2
import sys input = sys.stdin.readline N = int(eval(input())) XY = [tuple(map(int,input().split() + [i])) for i in range(N)] class UnionFind: def __init__(self,N): self.parent = [i for i in range(N)] self._size = [1] * N self.count = 0 def root(self,a): if self.parent[...
import sys input = sys.stdin.readline N = int(eval(input())) XYI = [tuple(map(int,input().split() + [i])) for i in range(N)] sx = sorted(XYI, key=lambda x:x[0]) sy = sorted(XYI, key=lambda x:x[1]) es = [] for (x0,_,i0),(x1,_,i1) in zip(sx,sx[1:]): es.append((x1-x0, i0, i1)) for (_,y0,i0),(_,y1,i1) in zip...
46
45
1,236
1,245
import sys input = sys.stdin.readline N = int(eval(input())) XY = [tuple(map(int, input().split() + [i])) for i in range(N)] class UnionFind: def __init__(self, N): self.parent = [i for i in range(N)] self._size = [1] * N self.count = 0 def root(self, a): if self.parent[a] ==...
import sys input = sys.stdin.readline N = int(eval(input())) XYI = [tuple(map(int, input().split() + [i])) for i in range(N)] sx = sorted(XYI, key=lambda x: x[0]) sy = sorted(XYI, key=lambda x: x[1]) es = [] for (x0, _, i0), (x1, _, i1) in zip(sx, sx[1:]): es.append((x1 - x0, i0, i1)) for (_, y0, i0), (_, y1, i1) ...
false
2.173913
[ "-XY = [tuple(map(int, input().split() + [i])) for i in range(N)]", "+XYI = [tuple(map(int, input().split() + [i])) for i in range(N)]", "+sx = sorted(XYI, key=lambda x: x[0])", "+sy = sorted(XYI, key=lambda x: x[1])", "+es = []", "+for (x0, _, i0), (x1, _, i1) in zip(sx, sx[1:]):", "+ es.append((x1 ...
false
0.045559
0.188726
0.241402
[ "s882446657", "s822214517" ]
u063052907
p03478
python
s517977524
s676291046
34
31
3,060
2,940
Accepted
Accepted
8.82
# coding: utf-8 N, A, B = list(map(int, input().split())) ans = 0 for x in range(1, N+1): z = str(x) sum_x = sum(int(y) for y in z) if A <= sum_x <= B: ans += x print(ans)
# coding: utf-8 N, A, B = list(map(int, input().split())) ans = 0 for x in range(1, N+1): sum_x = sum(map(int, str(x))) if A <= sum_x <= B: ans += x print(ans)
9
8
193
176
# coding: utf-8 N, A, B = list(map(int, input().split())) ans = 0 for x in range(1, N + 1): z = str(x) sum_x = sum(int(y) for y in z) if A <= sum_x <= B: ans += x print(ans)
# coding: utf-8 N, A, B = list(map(int, input().split())) ans = 0 for x in range(1, N + 1): sum_x = sum(map(int, str(x))) if A <= sum_x <= B: ans += x print(ans)
false
11.111111
[ "- z = str(x)", "- sum_x = sum(int(y) for y in z)", "+ sum_x = sum(map(int, str(x)))" ]
false
0.047194
0.044317
1.064904
[ "s517977524", "s676291046" ]