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
u025235255
p03765
python
s887284816
s778909674
1,121
398
65,300
13,464
Accepted
Accepted
64.5
s, t, q = list(eval(input())), list(eval(input())), int(eval(input())) ssum, tsum = [0], [0] for i in range(len(s)): if s[i]=="A": ssum.append(ssum[-1]+1) else: ssum.append(ssum[-1]+2) for i in range(len(t)): if t[i]=="A": tsum.append(tsum[-1]+1) else: tsum.append(tsum[-1]+2) for i in range(q): ...
import sys input = sys.stdin.readline s, t, q = list(eval(input())), list(eval(input())), int(eval(input())) ssum, tsum = [0], [0] for i in range(len(s)): if s[i]=="A": ssum.append(ssum[-1]+1) else: ssum.append(ssum[-1]+2) for i in range(len(t)): if t[i]=="A": tsum.append(tsum[-1]+1) else: tsum...
13
15
448
488
s, t, q = list(eval(input())), list(eval(input())), int(eval(input())) ssum, tsum = [0], [0] for i in range(len(s)): if s[i] == "A": ssum.append(ssum[-1] + 1) else: ssum.append(ssum[-1] + 2) for i in range(len(t)): if t[i] == "A": tsum.append(tsum[-1] + 1) else: tsum.appe...
import sys input = sys.stdin.readline s, t, q = list(eval(input())), list(eval(input())), int(eval(input())) ssum, tsum = [0], [0] for i in range(len(s)): if s[i] == "A": ssum.append(ssum[-1] + 1) else: ssum.append(ssum[-1] + 2) for i in range(len(t)): if t[i] == "A": tsum.append(ts...
false
13.333333
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.042571
0.054959
0.774597
[ "s887284816", "s778909674" ]
u642874916
p02882
python
s265610367
s161978706
186
169
38,384
38,504
Accepted
Accepted
9.14
import math import os import sys # from fractions import gcd input = sys.stdin.readline sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 def main(): a, b, x = list(map(int, input().split())) h = x / float(a ** 2) remain = b - h ans = math.degree...
import math import os import sys # from fractions import gcd input = sys.stdin.readline sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 def main(): a, b, x = list(map(int, input().split())) area = x / a h = area / a remain = b - h if h >= b ...
35
26
756
521
import math import os import sys # from fractions import gcd input = sys.stdin.readline sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 def main(): a, b, x = list(map(int, input().split())) h = x / float(a**2) remain = b - h ans = math.degrees(math.atan2(remain, a /...
import math import os import sys # from fractions import gcd input = sys.stdin.readline sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 def main(): a, b, x = list(map(int, input().split())) area = x / a h = area / a remain = b - h if h >= b / 2: print((m...
false
25.714286
[ "- h = x / float(a**2)", "+ area = x / a", "+ h = area / a", "- ans = math.degrees(math.atan2(remain, a / 2))", "- limit = math.degrees(math.atan2(h, a / 2))", "- # limit = x / float(a ** 2)", "- # # limit_degree = math.degrees(math.atan2(limit, a))", "- # print(limit + h < b)"...
false
0.044528
0.113109
0.393673
[ "s265610367", "s161978706" ]
u620084012
p03679
python
s967306476
s571301977
164
17
38,256
2,940
Accepted
Accepted
89.63
X, A, B = list(map(int,input().split())) if A >= B: print("delicious") elif X+A >= B: print("safe") else: print("dangerous")
X, A, B = list(map(int,input().split())) if B <= A: print("delicious") elif B <= A+X: print("safe") else: print("dangerous")
7
7
137
137
X, A, B = list(map(int, input().split())) if A >= B: print("delicious") elif X + A >= B: print("safe") else: print("dangerous")
X, A, B = list(map(int, input().split())) if B <= A: print("delicious") elif B <= A + X: print("safe") else: print("dangerous")
false
0
[ "-if A >= B:", "+if B <= A:", "-elif X + A >= B:", "+elif B <= A + X:" ]
false
0.103099
0.039443
2.61385
[ "s967306476", "s571301977" ]
u677121387
p02607
python
s151871237
s968960679
32
26
9,160
9,164
Accepted
Accepted
18.75
n = int(eval(input())) a = [int(i) for i in input().split()] ans = 0 for x,i in enumerate(a,1): if x%2 == 1 and i%2 == 1: ans += 1 print(ans)
n = int(eval(input())) a = [int(i) for i in input().split()] ans = 0 for i in range(n): if i%2 == 0 and a[i]%2 == 1: ans += 1 print(ans)
6
6
144
139
n = int(eval(input())) a = [int(i) for i in input().split()] ans = 0 for x, i in enumerate(a, 1): if x % 2 == 1 and i % 2 == 1: ans += 1 print(ans)
n = int(eval(input())) a = [int(i) for i in input().split()] ans = 0 for i in range(n): if i % 2 == 0 and a[i] % 2 == 1: ans += 1 print(ans)
false
0
[ "-for x, i in enumerate(a, 1):", "- if x % 2 == 1 and i % 2 == 1:", "+for i in range(n):", "+ if i % 2 == 0 and a[i] % 2 == 1:" ]
false
0.0428
0.03997
1.070788
[ "s151871237", "s968960679" ]
u648868410
p02588
python
s832234934
s132742291
1,161
415
9,248
74,828
Accepted
Accepted
64.25
N=int(eval(input())) A=[] PRECISION_DIGITS=9 cnt={} for n in range(N): tmpA = float(eval(input())) tmpA = round(tmpA*(10**PRECISION_DIGITS)) #print(tmpA) two = 0 five = 0 while (tmpA % 2) == 0: two += 1 tmpA /= 2 while (tmpA % 5) == 0: five += 1 tmpA /= 5 if (two,five) in cnt: ...
N=int(eval(input())) A=[] PRECISION_DIGITS=9 cnt={} for n in range(N): tmpA = float(eval(input())) tmpA = round(tmpA*10**PRECISION_DIGITS) #print(tmpA) five = 0 two = 0 while (tmpA % 2) == 0: two += 1 tmpA //= 2 while (tmpA % 5) == 0: five += 1 tmpA //= 5 # (10**9) -> (two,five)=...
45
46
797
824
N = int(eval(input())) A = [] PRECISION_DIGITS = 9 cnt = {} for n in range(N): tmpA = float(eval(input())) tmpA = round(tmpA * (10**PRECISION_DIGITS)) # print(tmpA) two = 0 five = 0 while (tmpA % 2) == 0: two += 1 tmpA /= 2 while (tmpA % 5) == 0: five += 1 tmp...
N = int(eval(input())) A = [] PRECISION_DIGITS = 9 cnt = {} for n in range(N): tmpA = float(eval(input())) tmpA = round(tmpA * 10**PRECISION_DIGITS) # print(tmpA) five = 0 two = 0 while (tmpA % 2) == 0: two += 1 tmpA //= 2 while (tmpA % 5) == 0: five += 1 tmpA...
false
2.173913
[ "- tmpA = round(tmpA * (10**PRECISION_DIGITS))", "+ tmpA = round(tmpA * 10**PRECISION_DIGITS)", "+ five = 0", "- five = 0", "- tmpA /= 2", "+ tmpA //= 2", "- tmpA /= 5", "+ tmpA //= 5", "+ # (10**9) -> (two,five)=(9,9)", "+ two -= PRECISION_DIGITS", ...
false
0.037962
0.038121
0.995816
[ "s832234934", "s132742291" ]
u150984829
p00064
python
s016319183
s350467886
40
20
6,544
5,600
Accepted
Accepted
50
import re,sys print((sum([sum(map(int,re.sub("\D", " ", e).split()))for e in sys.stdin])))
import sys print((sum(map(int,''.join([' ',c][c.isdigit()]for e in sys.stdin for c in e).split()))))
2
2
90
100
import re, sys print((sum([sum(map(int, re.sub("\D", " ", e).split())) for e in sys.stdin])))
import sys print( ( sum( map( int, "".join([" ", c][c.isdigit()] for e in sys.stdin for c in e).split(), ) ) ) )
false
0
[ "-import re, sys", "+import sys", "-print((sum([sum(map(int, re.sub(\"\\D\", \" \", e).split())) for e in sys.stdin])))", "+print(", "+ (", "+ sum(", "+ map(", "+ int,", "+ \"\".join([\" \", c][c.isdigit()] for e in sys.stdin for c in e).split(),", ...
false
0.053856
0.051941
1.036874
[ "s016319183", "s350467886" ]
u756782069
p02621
python
s310268266
s821064221
32
29
9,048
9,076
Accepted
Accepted
9.38
a = int(eval(input())) b = [3, 14, 39, 84, 155, 258, 399, 584, 819, 1110] print((b[a-1]))
def main(): a = int(eval(input())) print((int(a+a*a+a**3))) if __name__ == "__main__": main()
3
6
83
103
a = int(eval(input())) b = [3, 14, 39, 84, 155, 258, 399, 584, 819, 1110] print((b[a - 1]))
def main(): a = int(eval(input())) print((int(a + a * a + a**3))) if __name__ == "__main__": main()
false
50
[ "-a = int(eval(input()))", "-b = [3, 14, 39, 84, 155, 258, 399, 584, 819, 1110]", "-print((b[a - 1]))", "+def main():", "+ a = int(eval(input()))", "+ print((int(a + a * a + a**3)))", "+", "+", "+if __name__ == \"__main__\":", "+ main()" ]
false
0.044193
0.050402
0.876812
[ "s310268266", "s821064221" ]
u397384480
p02949
python
s493946326
s034983743
1,675
601
75,952
70,304
Accepted
Accepted
64.12
import bisect import collections import copy import functools import heapq import math import sys from collections import deque from collections import defaultdict input = sys.stdin.readline MOD = 10**9+7 N,M,P = list(map(int,(input().split()))) line = [] for i in range(M): a,b,c = list(map(int,(inp...
import bisect import collections import copy import functools import heapq import math import sys from collections import deque from collections import defaultdict input = sys.stdin.readline MOD = 10**9+7 INF = float("inf") N,M,P = list(map(int,(input().split()))) line = [] for i in range(M): a,b,c...
42
61
1,279
1,714
import bisect import collections import copy import functools import heapq import math import sys from collections import deque from collections import defaultdict input = sys.stdin.readline MOD = 10**9 + 7 N, M, P = list(map(int, (input().split()))) line = [] for i in range(M): a, b, c = list(map(int, (input().sp...
import bisect import collections import copy import functools import heapq import math import sys from collections import deque from collections import defaultdict input = sys.stdin.readline MOD = 10**9 + 7 INF = float("inf") N, M, P = list(map(int, (input().split()))) line = [] for i in range(M): a, b, c = list(m...
false
31.147541
[ "+INF = float(\"inf\")", "-line.sort()", "-min_distance = [float(\"inf\")] * N # min_distance[i] は始点から街iまでの最短距離", "+min_distance = [INF] * N # min_distance[i] は始点から街iまでの最短距離", "-update = False", "-for _ in range(N):", "- for s, g, d in line: # [s,g,d] = [道路の始点,道路の終点,道路の長さ] について、すべての道路を見る", "- ...
false
0.035745
0.045487
0.785827
[ "s493946326", "s034983743" ]
u970197315
p03127
python
s664535009
s523622667
229
121
16,300
16,240
Accepted
Accepted
47.16
# ABC118 C - Monsters Battle Royale from fractions import gcd n = int(eval(input())) a = list(map(int,input().split())) ans = 10**10 for i in range(n-1): t = gcd(a[i],a[i+1]) ans = min(ans,t) print(ans)
from fractions import gcd n=int(eval(input())) a=list(map(int,input().split())) ans=10**18 t=0 for i in range(1,n): if i==1: t=gcd(a[0],a[1]) ans=min(ans,t) continue t=gcd(t,a[i]) ans=min(t,ans) print(ans)
11
14
217
232
# ABC118 C - Monsters Battle Royale from fractions import gcd n = int(eval(input())) a = list(map(int, input().split())) ans = 10**10 for i in range(n - 1): t = gcd(a[i], a[i + 1]) ans = min(ans, t) print(ans)
from fractions import gcd n = int(eval(input())) a = list(map(int, input().split())) ans = 10**18 t = 0 for i in range(1, n): if i == 1: t = gcd(a[0], a[1]) ans = min(ans, t) continue t = gcd(t, a[i]) ans = min(t, ans) print(ans)
false
21.428571
[ "-# ABC118 C - Monsters Battle Royale", "-ans = 10**10", "-for i in range(n - 1):", "- t = gcd(a[i], a[i + 1])", "- ans = min(ans, t)", "+ans = 10**18", "+t = 0", "+for i in range(1, n):", "+ if i == 1:", "+ t = gcd(a[0], a[1])", "+ ans = min(ans, t)", "+ continue...
false
0.050614
0.055486
0.912188
[ "s664535009", "s523622667" ]
u341087021
p03212
python
s206465452
s084693562
97
71
3,060
5,492
Accepted
Accepted
26.8
n = int(eval(input())) def nngg(m): if int(m) > n: return 0 ret = 1 if all(m.count(s)>0 for s in '375') else 0 for s in '357': ret += nngg(m+s) return ret print((nngg('0')))
n = int(eval(input())) tmpl = [['']] l = [] for i in range(1,10): #iは桁数 tmp = [] for x in tmpl[-1]: for s in '357': tmp.append(x+s) tmpl.append(tmp) l = l + tmp def check(s): if all(s.count(x) for x in '357'): return True else: return Fa...
11
28
209
446
n = int(eval(input())) def nngg(m): if int(m) > n: return 0 ret = 1 if all(m.count(s) > 0 for s in "375") else 0 for s in "357": ret += nngg(m + s) return ret print((nngg("0")))
n = int(eval(input())) tmpl = [[""]] l = [] for i in range(1, 10): # iは桁数 tmp = [] for x in tmpl[-1]: for s in "357": tmp.append(x + s) tmpl.append(tmp) l = l + tmp def check(s): if all(s.count(x) for x in "357"): return True else: return False ans = 0...
false
60.714286
[ "+tmpl = [[\"\"]]", "+l = []", "+for i in range(1, 10):", "+ # iは桁数", "+ tmp = []", "+ for x in tmpl[-1]:", "+ for s in \"357\":", "+ tmp.append(x + s)", "+ tmpl.append(tmp)", "+ l = l + tmp", "-def nngg(m):", "- if int(m) > n:", "- return 0", "- ...
false
0.050412
0.056815
0.887305
[ "s206465452", "s084693562" ]
u077291787
p03807
python
s935200099
s577515015
54
42
14,232
14,232
Accepted
Accepted
22.22
# AGC010A - Addition def main(): n = int(eval(input())) A = tuple(map(int, input().rstrip().split())) flg = sum(i % 2 == 1 for i in A) % 2 == 0 print(("YES" if flg else "NO")) if __name__ == "__main__": main()
# AGC010A - Addition def main(): n = int(eval(input())) A = tuple(map(int, input().rstrip().split())) print(("YES" if sum(A) % 2 == 0 else "NO")) if __name__ == "__main__": main()
10
9
232
197
# AGC010A - Addition def main(): n = int(eval(input())) A = tuple(map(int, input().rstrip().split())) flg = sum(i % 2 == 1 for i in A) % 2 == 0 print(("YES" if flg else "NO")) if __name__ == "__main__": main()
# AGC010A - Addition def main(): n = int(eval(input())) A = tuple(map(int, input().rstrip().split())) print(("YES" if sum(A) % 2 == 0 else "NO")) if __name__ == "__main__": main()
false
10
[ "- flg = sum(i % 2 == 1 for i in A) % 2 == 0", "- print((\"YES\" if flg else \"NO\"))", "+ print((\"YES\" if sum(A) % 2 == 0 else \"NO\"))" ]
false
0.041418
0.076913
0.538506
[ "s935200099", "s577515015" ]
u017810624
p02863
python
s449142993
s821593217
680
481
192,392
121,052
Accepted
Accepted
29.26
import sys input=sys.stdin.readline import copy def knapsack(N,W,weight,value): dp=[[999999999999 for i in range(W+1)] for j in range(N+1)] dp2=[[0 for i in range(W+1)] for j in range(N+1)] for i in range(W+1): dp[0][i]=0 for i in range(N): for w in range(W+1): if weight[i]<=w: if...
import sys input=sys.stdin.readline def knapsack(N,W,weight,value): dp=[[999999999999 for i in range(W+1)] for j in range(N+1)] for i in range(W+1): dp[0][i]=0 for i in range(N): for w in range(W+1): if weight[i]<=w: if dp[i][w-weight[i]]+value[i]>dp[i][w]: dp[i+1][w]=...
48
33
1,090
767
import sys input = sys.stdin.readline import copy def knapsack(N, W, weight, value): dp = [[999999999999 for i in range(W + 1)] for j in range(N + 1)] dp2 = [[0 for i in range(W + 1)] for j in range(N + 1)] for i in range(W + 1): dp[0][i] = 0 for i in range(N): for w in range(W + 1): ...
import sys input = sys.stdin.readline def knapsack(N, W, weight, value): dp = [[999999999999 for i in range(W + 1)] for j in range(N + 1)] for i in range(W + 1): dp[0][i] = 0 for i in range(N): for w in range(W + 1): if weight[i] <= w: if dp[i][w - weight[i]] +...
false
31.25
[ "-import copy", "- dp2 = [[0 for i in range(W + 1)] for j in range(N + 1)]", "- dp2[i + 1][w] = w - weight[i]", "- dp2[i + 1][w] = w", "- dp2[i + 1][w] = w", "- l = []", "- x = W", "- for i in range(n - 1, -1, -1):", "- if dp2[i...
false
0.100637
0.033277
3.024178
[ "s449142993", "s821593217" ]
u716530146
p03044
python
s558265686
s383065334
756
615
52,268
52,336
Accepted
Accepted
18.65
#!/usr/bin/env python3 n=int(eval(input())) uvw=[list(map(int,input().split())) for i in range(n-1)] graph=[[] for i in range(n+1)] color=[-1]*(n+1) for u,v,w in uvw: graph[u].append((v,w)) graph[v].append((u,w)) color[1]=1 ne=[1] while ne: t=ne.pop() for v,w in graph[t]: if color...
#!/usr/bin/env python3 import sys input = lambda: sys.stdin.readline()[:-1] sys.setrecursionlimit(10**8) n = int(eval(input())) uvw = [list(map(int, input().split())) for i in range(n-1)] graph = [[] for i in range(n+1)] color = [-1]*(n+1) for u, v, w in uvw: graph[u].append((v, w)) graph[v].appen...
20
25
456
577
#!/usr/bin/env python3 n = int(eval(input())) uvw = [list(map(int, input().split())) for i in range(n - 1)] graph = [[] for i in range(n + 1)] color = [-1] * (n + 1) for u, v, w in uvw: graph[u].append((v, w)) graph[v].append((u, w)) color[1] = 1 ne = [1] while ne: t = ne.pop() for v, w in graph[t]: ...
#!/usr/bin/env python3 import sys input = lambda: sys.stdin.readline()[:-1] sys.setrecursionlimit(10**8) n = int(eval(input())) uvw = [list(map(int, input().split())) for i in range(n - 1)] graph = [[] for i in range(n + 1)] color = [-1] * (n + 1) for u, v, w in uvw: graph[u].append((v, w)) graph[v].append((u,...
false
20
[ "+import sys", "+", "+input = lambda: sys.stdin.readline()[:-1]", "+sys.setrecursionlimit(10**8)" ]
false
0.094351
0.123396
0.764614
[ "s558265686", "s383065334" ]
u244416763
p02731
python
s932363941
s466524764
58
16
5,588
2,940
Accepted
Accepted
72.41
import decimal l = int(eval(input())) print(((l/3)**3))
print(((int(eval(input()))/3)**3))
3
1
49
26
import decimal l = int(eval(input())) print(((l / 3) ** 3))
print(((int(eval(input())) / 3) ** 3))
false
66.666667
[ "-import decimal", "-", "-l = int(eval(input()))", "-print(((l / 3) ** 3))", "+print(((int(eval(input())) / 3) ** 3))" ]
false
0.058683
0.171779
0.341621
[ "s932363941", "s466524764" ]
u296150111
p02695
python
s233331030
s915975235
1,440
786
9,136
16,132
Accepted
Accepted
45.42
n,m,q=list(map(int,input().split())) abcd=[] for _ in range(q): a,b,c,d=list(map(int,input().split())) abcd.append((a,b,c,d)) ans=0 import itertools p=itertools.combinations_with_replacement(list(range(1,m+1)),n) for x in p: r=0 for i in range(q): if x[abcd[i][1]-1]-x[abcd[i][0]-1]==abcd[i][2]: r+=...
n,m,q=list(map(int,input().split())) abcd=[] for _ in range(q): a,b,c,d=list(map(int,input().split())) abcd.append((a,b,c,d)) ans=0 p=[] import sys sys.setrecursionlimit(10**6) def dfs(x): if len(x)==n: p.append(x) else: for i in range(m-x[-1]+1): dfs(x+[x[-1]+i]) dfs([1]) # import itertools ...
15
25
341
506
n, m, q = list(map(int, input().split())) abcd = [] for _ in range(q): a, b, c, d = list(map(int, input().split())) abcd.append((a, b, c, d)) ans = 0 import itertools p = itertools.combinations_with_replacement(list(range(1, m + 1)), n) for x in p: r = 0 for i in range(q): if x[abcd[i][1] - 1] ...
n, m, q = list(map(int, input().split())) abcd = [] for _ in range(q): a, b, c, d = list(map(int, input().split())) abcd.append((a, b, c, d)) ans = 0 p = [] import sys sys.setrecursionlimit(10**6) def dfs(x): if len(x) == n: p.append(x) else: for i in range(m - x[-1] + 1): ...
false
40
[ "-import itertools", "+p = []", "+import sys", "-p = itertools.combinations_with_replacement(list(range(1, m + 1)), n)", "+sys.setrecursionlimit(10**6)", "+", "+", "+def dfs(x):", "+ if len(x) == n:", "+ p.append(x)", "+ else:", "+ for i in range(m - x[-1] + 1):", "+ ...
false
0.045718
0.080301
0.569334
[ "s233331030", "s915975235" ]
u000212387
p03317
python
s213937094
s654468146
39
17
13,880
3,060
Accepted
Accepted
56.41
n,k=list(map(int,input().split())) a=list(map(int, input().split())) print((-(-(n-1)//(k-1))))
n,k=list(map(int,input().split())) print((-(-(n-1)//(k-1))))
3
2
88
53
n, k = list(map(int, input().split())) a = list(map(int, input().split())) print((-(-(n - 1) // (k - 1))))
n, k = list(map(int, input().split())) print((-(-(n - 1) // (k - 1))))
false
33.333333
[ "-a = list(map(int, input().split()))" ]
false
0.041412
0.037802
1.095503
[ "s213937094", "s654468146" ]
u159994501
p03611
python
s348132006
s321556139
102
92
13,964
14,092
Accepted
Accepted
9.8
N = int(eval(input())) a = list(map(int, input().split())) L = [0] * 10 ** 5 for i in range(N): L[a[i]] += 1 s = L[0] + L[1] + L[2] A = s for i in range(10 ** 5-3): s += L[i+3] - L[i] A = max(A,s) print(A)
N = int(eval(input())) a = list(map(int, input().split())) num_list = [0 for _ in range(10 ** 5)] for i in a: if i > 0: num_list[i - 1] += 1 num_list[i] += 1 if i < 10 ** 5 - 1: num_list[i + 1] += 1 print((max(num_list)))
11
11
222
253
N = int(eval(input())) a = list(map(int, input().split())) L = [0] * 10**5 for i in range(N): L[a[i]] += 1 s = L[0] + L[1] + L[2] A = s for i in range(10**5 - 3): s += L[i + 3] - L[i] A = max(A, s) print(A)
N = int(eval(input())) a = list(map(int, input().split())) num_list = [0 for _ in range(10**5)] for i in a: if i > 0: num_list[i - 1] += 1 num_list[i] += 1 if i < 10**5 - 1: num_list[i + 1] += 1 print((max(num_list)))
false
0
[ "-L = [0] * 10**5", "-for i in range(N):", "- L[a[i]] += 1", "-s = L[0] + L[1] + L[2]", "-A = s", "-for i in range(10**5 - 3):", "- s += L[i + 3] - L[i]", "- A = max(A, s)", "-print(A)", "+num_list = [0 for _ in range(10**5)]", "+for i in a:", "+ if i > 0:", "+ num_list[i ...
false
0.134842
0.184648
0.730263
[ "s348132006", "s321556139" ]
u497952650
p03645
python
s489667751
s989238835
559
380
6,132
10,424
Accepted
Accepted
32.02
N,M = list(map(int,input().split())) goto_N = [0]*N from_1 = [0]*N for _ in range(M): a,b = list(map(int,input().split())) if a == 1: from_1[b] = 1 elif b == N: goto_N[a] = 1 for i in range(N): if goto_N[i] and from_1[i]: print("POSSIBLE") exit() prin...
N,M = list(map(int,input().split())) ##1からきている&&Nに行ける road = [0]*N for _ in range(M): a,b = list(map(int,input().split())) if a == 1: road[b-1] += 1 elif b == N: road[a-1] += 1 if 2 in road: print("POSSIBLE") else: print("IMPOSSIBLE")
18
17
323
278
N, M = list(map(int, input().split())) goto_N = [0] * N from_1 = [0] * N for _ in range(M): a, b = list(map(int, input().split())) if a == 1: from_1[b] = 1 elif b == N: goto_N[a] = 1 for i in range(N): if goto_N[i] and from_1[i]: print("POSSIBLE") exit() print("IMPOSSIBLE...
N, M = list(map(int, input().split())) ##1からきている&&Nに行ける road = [0] * N for _ in range(M): a, b = list(map(int, input().split())) if a == 1: road[b - 1] += 1 elif b == N: road[a - 1] += 1 if 2 in road: print("POSSIBLE") else: print("IMPOSSIBLE")
false
5.555556
[ "-goto_N = [0] * N", "-from_1 = [0] * N", "+##1からきている&&Nに行ける", "+road = [0] * N", "- from_1[b] = 1", "+ road[b - 1] += 1", "- goto_N[a] = 1", "-for i in range(N):", "- if goto_N[i] and from_1[i]:", "- print(\"POSSIBLE\")", "- exit()", "-print(\"IMPOSSIBLE\...
false
0.159919
0.146737
1.089835
[ "s489667751", "s989238835" ]
u761529120
p02888
python
s387070039
s742770300
795
668
42,460
41,836
Accepted
Accepted
15.97
import bisect def main(): N = int(eval(input())) L = list(map(int, input().split())) sort_L = sorted(L) cnt = 0 for i in range(N-2): for j in range(i+1,N-1): tmp = bisect.bisect_left(sort_L,sort_L[i] + sort_L[j]) if tmp - 1 > j: cnt += tmp ...
from bisect import bisect_right def main(): N = int(eval(input())) L = list(map(int, input().split())) sort_L = sorted(L) ans = 0 for i in range(N-2): for j in range(i,N-1): if i == j: continue ok = j ng = N tmp = ...
18
29
387
625
import bisect def main(): N = int(eval(input())) L = list(map(int, input().split())) sort_L = sorted(L) cnt = 0 for i in range(N - 2): for j in range(i + 1, N - 1): tmp = bisect.bisect_left(sort_L, sort_L[i] + sort_L[j]) if tmp - 1 > j: cnt += tmp - ...
from bisect import bisect_right def main(): N = int(eval(input())) L = list(map(int, input().split())) sort_L = sorted(L) ans = 0 for i in range(N - 2): for j in range(i, N - 1): if i == j: continue ok = j ng = N tmp = sort_L[...
false
37.931034
[ "-import bisect", "+from bisect import bisect_right", "- cnt = 0", "+ ans = 0", "- for j in range(i + 1, N - 1):", "- tmp = bisect.bisect_left(sort_L, sort_L[i] + sort_L[j])", "- if tmp - 1 > j:", "- cnt += tmp - j - 1", "- print(cnt)", "+ ...
false
0.036097
0.0322
1.121028
[ "s387070039", "s742770300" ]
u075836834
p02410
python
s791242774
s391031107
40
20
8,016
8,056
Accepted
Accepted
50
n,m=[int(i) for i in input().split()] A=[] b=[] for i in range(n): A.append([int(j) for j in input().split()]) for i in range(m): b.append(int(eval(input()))) for i in range(n): s=0 for j in range(m): s+=A[i][j]*b[j] print(s)
a,b=list(map(int,input().split())) A=[] B=[] for i in range(a): A.append([int(j) for j in input().split()]) for i in range(b): B.append(int(eval(input()))) for i in range(a): s=0 for j in range(b): s+=A[i][j]*B[j] print(s)
14
15
241
234
n, m = [int(i) for i in input().split()] A = [] b = [] for i in range(n): A.append([int(j) for j in input().split()]) for i in range(m): b.append(int(eval(input()))) for i in range(n): s = 0 for j in range(m): s += A[i][j] * b[j] print(s)
a, b = list(map(int, input().split())) A = [] B = [] for i in range(a): A.append([int(j) for j in input().split()]) for i in range(b): B.append(int(eval(input()))) for i in range(a): s = 0 for j in range(b): s += A[i][j] * B[j] print(s)
false
6.666667
[ "-n, m = [int(i) for i in input().split()]", "+a, b = list(map(int, input().split()))", "-b = []", "-for i in range(n):", "+B = []", "+for i in range(a):", "-for i in range(m):", "- b.append(int(eval(input())))", "-for i in range(n):", "+for i in range(b):", "+ B.append(int(eval(input())))...
false
0.113513
0.081296
1.396292
[ "s791242774", "s391031107" ]
u852690916
p02936
python
s588921931
s537715032
1,781
753
125,468
92,876
Accepted
Accepted
57.72
N, Q = list(map(int, input().split())) EDGES = [list(map(int, input().split())) for i in range(N-1)] OPES = [list(map(int, input().split())) for i in range(Q)] VALUES = [0 for i in range(N)] #operation1 for o in OPES: VALUES[o[0]-1] += o[1] #operation2 EDGES.sort(key=lambda e:e[0]) for e in EDGES: VAL...
import sys def main(): input = sys.stdin.readline N,Q=list(map(int, input().split())) G=[[] for _ in range(N)] for _ in range(N-1): a,b=list(map(int, input().split())) a,b=a-1,b-1 G[a].append(b) G[b].append(a) C=[0]*N for _ in range(Q): p,x=lis...
12
29
379
640
N, Q = list(map(int, input().split())) EDGES = [list(map(int, input().split())) for i in range(N - 1)] OPES = [list(map(int, input().split())) for i in range(Q)] VALUES = [0 for i in range(N)] # operation1 for o in OPES: VALUES[o[0] - 1] += o[1] # operation2 EDGES.sort(key=lambda e: e[0]) for e in EDGES: VALUES...
import sys def main(): input = sys.stdin.readline N, Q = list(map(int, input().split())) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = list(map(int, input().split())) a, b = a - 1, b - 1 G[a].append(b) G[b].append(a) C = [0] * N for _ in range(Q): ...
false
58.62069
[ "-N, Q = list(map(int, input().split()))", "-EDGES = [list(map(int, input().split())) for i in range(N - 1)]", "-OPES = [list(map(int, input().split())) for i in range(Q)]", "-VALUES = [0 for i in range(N)]", "-# operation1", "-for o in OPES:", "- VALUES[o[0] - 1] += o[1]", "-# operation2", "-EDG...
false
0.165808
0.043107
3.8464
[ "s588921931", "s537715032" ]
u897329068
p03745
python
s951230015
s019517194
1,014
78
23,140
14,252
Accepted
Accepted
92.31
import numpy N = int(eval(input())) AN = list(map(int,input().split())) ans = 1 #配列数。切らない場合1なので初期値1 beforeDiff = 0 #一つ前の差分値。初期値は任意 chgFlag = True #区切りフラグ。初期値は0番目に区切った扱いにするのでTrue for i in range(1,N): #i-1を参照するため1スタート diff = AN[i] - AN[i-1] if chgFlag or beforeDiff==0: #符号を維持(区切り直後、前回の差が0) ...
N = int(eval(input())) A = list(map(int,input().split())) ans = 1 sumDiff = 0 #この値の符号によって単純非減少、単純非増加を判定 #初期や区切った直後は0でそこからdiffを積み上げる。符号が異なる場合を前で除いているので #絶対値的に大きくだけで符号は変わらない。0のときも問題なく適用できる for i in range(1,len(A)): diff = A[i]-A[i-1] if sumDiff*diff < 0: #sumDiff,diff=(正,負),(負,正)のときだけ成立 どちらかが0の場合非成立 ...
22
18
589
483
import numpy N = int(eval(input())) AN = list(map(int, input().split())) ans = 1 # 配列数。切らない場合1なので初期値1 beforeDiff = 0 # 一つ前の差分値。初期値は任意 chgFlag = True # 区切りフラグ。初期値は0番目に区切った扱いにするのでTrue for i in range(1, N): # i-1を参照するため1スタート diff = AN[i] - AN[i - 1] if chgFlag or beforeDiff == 0: # 符号を維持(区切り直後、前回の差が0) ...
N = int(eval(input())) A = list(map(int, input().split())) ans = 1 sumDiff = 0 # この値の符号によって単純非減少、単純非増加を判定 # 初期や区切った直後は0でそこからdiffを積み上げる。符号が異なる場合を前で除いているので # 絶対値的に大きくだけで符号は変わらない。0のときも問題なく適用できる for i in range(1, len(A)): diff = A[i] - A[i - 1] if sumDiff * diff < 0: # sumDiff,diff=(正,負),(負,正)のときだけ成立 どちらかが0の場合非成立...
false
18.181818
[ "-import numpy", "-", "-AN = list(map(int, input().split()))", "-ans = 1 # 配列数。切らない場合1なので初期値1", "-beforeDiff = 0 # 一つ前の差分値。初期値は任意", "-chgFlag = True # 区切りフラグ。初期値は0番目に区切った扱いにするのでTrue", "-for i in range(1, N): # i-1を参照するため1スタート", "- diff = AN[i] - AN[i - 1]", "- if chgFlag or beforeDiff == 0...
false
0.282911
0.03752
7.540348
[ "s951230015", "s019517194" ]
u566428756
p02743
python
s440084681
s621157781
34
17
5,076
2,940
Accepted
Accepted
50
from decimal import Decimal a,b,c=list(map(int,input().split())) ab_=Decimal(a).sqrt()+Decimal(b).sqrt() c_=Decimal(c).sqrt() if ab_<c_: print('Yes') else: print('No')
a,b,c=list(map(int,input().split())) if c-a-b>0 and 4*a*b<(c-a-b)**2: print('Yes') else: print('No')
8
5
177
106
from decimal import Decimal a, b, c = list(map(int, input().split())) ab_ = Decimal(a).sqrt() + Decimal(b).sqrt() c_ = Decimal(c).sqrt() if ab_ < c_: print("Yes") else: print("No")
a, b, c = list(map(int, input().split())) if c - a - b > 0 and 4 * a * b < (c - a - b) ** 2: print("Yes") else: print("No")
false
37.5
[ "-from decimal import Decimal", "-", "-ab_ = Decimal(a).sqrt() + Decimal(b).sqrt()", "-c_ = Decimal(c).sqrt()", "-if ab_ < c_:", "+if c - a - b > 0 and 4 * a * b < (c - a - b) ** 2:" ]
false
0.035795
0.031836
1.124375
[ "s440084681", "s621157781" ]
u935558307
p03546
python
s213243952
s721434391
93
78
74,192
73,936
Accepted
Accepted
16.13
H,W = list(map(int,input().split())) C = [list(map(int,input().split())) for _ in range(10)] A = [list(map(int,input().split())) for _ in range(H)] dp = [float("INF")]*(10) dp[1] = 0 cnt = 0 while cnt <= 10: cnt += 1 for i in range(10): for j in range(10): dp[j] = min(dp[j],dp[i]+C...
H,W = list(map(int,input().split())) C = [list(map(int,input().split())) for _ in range(10)] A = [list(map(int,input().split())) for _ in range(H)] cost = [float("INF")]*(10) cost[1] = 0 cnt = 0 while cnt < 10: cnt += 1 for i in range(10): for j in range(10): cost[j] = min(cost[j...
18
19
450
460
H, W = list(map(int, input().split())) C = [list(map(int, input().split())) for _ in range(10)] A = [list(map(int, input().split())) for _ in range(H)] dp = [float("INF")] * (10) dp[1] = 0 cnt = 0 while cnt <= 10: cnt += 1 for i in range(10): for j in range(10): dp[j] = min(dp[j], dp[i] + C[...
H, W = list(map(int, input().split())) C = [list(map(int, input().split())) for _ in range(10)] A = [list(map(int, input().split())) for _ in range(H)] cost = [float("INF")] * (10) cost[1] = 0 cnt = 0 while cnt < 10: cnt += 1 for i in range(10): for j in range(10): cost[j] = min(cost[j], cos...
false
5.263158
[ "-dp = [float(\"INF\")] * (10)", "-dp[1] = 0", "+cost = [float(\"INF\")] * (10)", "+cost[1] = 0", "-while cnt <= 10:", "+while cnt < 10:", "- dp[j] = min(dp[j], dp[i] + C[j][i])", "-cost = 0", "+ cost[j] = min(cost[j], cost[i] + C[j][i])", "+ans = 0", "- cost += ...
false
0.037929
0.037438
1.013113
[ "s213243952", "s721434391" ]
u729133443
p03354
python
s637602871
s270460090
571
520
14,008
14,516
Accepted
Accepted
8.93
I=lambda:list(map(int,input().split()));n,m=I();p=I();l=[i for i in range(n+1)] def u(x): if l[x]!=x:l[x]=u(l[x]) return l[x] for _ in[0]*m:x,y=I();l[u(x)]=u(y) print((sum(u(i)==u(j)for i,j in enumerate(p,1))))
class UnionFind(): def __init__(self,size): self.table=[-1]*size def root(self,x): while self.table[x]>=0: x=self.table[x] return x def unite(self,x,y): s1=self.root(x) s2=self.root(y) if s1!=s2: if self.table[s1]>self.table[...
6
27
215
786
I = lambda: list(map(int, input().split())) n, m = I() p = I() l = [i for i in range(n + 1)] def u(x): if l[x] != x: l[x] = u(l[x]) return l[x] for _ in [0] * m: x, y = I() l[u(x)] = u(y) print((sum(u(i) == u(j) for i, j in enumerate(p, 1))))
class UnionFind: def __init__(self, size): self.table = [-1] * size def root(self, x): while self.table[x] >= 0: x = self.table[x] return x def unite(self, x, y): s1 = self.root(x) s2 = self.root(y) if s1 != s2: if self.table[s1] > se...
false
77.777778
[ "-I = lambda: list(map(int, input().split()))", "-n, m = I()", "-p = I()", "-l = [i for i in range(n + 1)]", "+class UnionFind:", "+ def __init__(self, size):", "+ self.table = [-1] * size", "+", "+ def root(self, x):", "+ while self.table[x] >= 0:", "+ x = self.ta...
false
0.036524
0.045939
0.795057
[ "s637602871", "s270460090" ]
u094999522
p03836
python
s748453232
s849024822
165
33
75,768
9,364
Accepted
Accepted
80
#!/usr/bin/env python3 sx, sy, tx, ty = map(int, input().split()) x = tx - sx y = ty - sy h = abs(sx - tx) v = abs(sy - ty) if h * v > 0: ans = [[1, 0]] * h + [[0, 1]] * v + [[-1, 0]] * h + [[0, -1]] * v ans += [[0, -1]] + [[1, 0]] * -~h + [[0, 1]] * -~v + [[-1, 0]] ans += [[0, 1]] + [[-1, 0]] * -~...
#!/usr/bin/env python3 sx, sy, tx, ty = map(int, input().split()) x = tx - sx y = ty - sy h = abs(sx - tx) v = abs(sy - ty) ans = [[1, 0]] * h + [[0, 1]] * v + [[-1, 0]] * h + [[0, -1]] * v ans += [[0, -1]] + [[1, 0]] * -~h + [[0, 1]] * -~v + [[-1, 0]] ans += [[0, 1]] + [[-1, 0]] * -~h + [[0, -1]] * -~v + [[1, ...
40
26
1,232
735
#!/usr/bin/env python3 sx, sy, tx, ty = map(int, input().split()) x = tx - sx y = ty - sy h = abs(sx - tx) v = abs(sy - ty) if h * v > 0: ans = [[1, 0]] * h + [[0, 1]] * v + [[-1, 0]] * h + [[0, -1]] * v ans += [[0, -1]] + [[1, 0]] * -~h + [[0, 1]] * -~v + [[-1, 0]] ans += [[0, 1]] + [[-1, 0]] * -~h + [[0, ...
#!/usr/bin/env python3 sx, sy, tx, ty = map(int, input().split()) x = tx - sx y = ty - sy h = abs(sx - tx) v = abs(sy - ty) ans = [[1, 0]] * h + [[0, 1]] * v + [[-1, 0]] * h + [[0, -1]] * v ans += [[0, -1]] + [[1, 0]] * -~h + [[0, 1]] * -~v + [[-1, 0]] ans += [[0, 1]] + [[-1, 0]] * -~h + [[0, -1]] * -~v + [[1, 0]] if x...
false
35
[ "-if h * v > 0:", "- ans = [[1, 0]] * h + [[0, 1]] * v + [[-1, 0]] * h + [[0, -1]] * v", "- ans += [[0, -1]] + [[1, 0]] * -~h + [[0, 1]] * -~v + [[-1, 0]]", "- ans += [[0, 1]] + [[-1, 0]] * -~h + [[0, -1]] * -~v + [[1, 0]]", "-elif h < 1:", "- ans = [[0, 1]] * v", "- ans += [[1, 0]] + [[0...
false
0.037836
0.03859
0.980478
[ "s748453232", "s849024822" ]
u392319141
p02722
python
s693638179
s702057944
426
209
3,188
3,188
Accepted
Accepted
50.94
N = int(eval(input())) def isOk(k): n = N while n % k == 0: n //= k return n % k == 1 if N <= 10**6: ans = 0 for i in range(2, N + 1): if isOk(i): ans += 1 print(ans) exit() ans = 0 V = set() for i in range(2, int(N**0.5) + 10): if isOk(i...
N = int(eval(input())) def isOk(k): n = N while n % k == 0: n //= k return n % k == 1 # 約数の全列挙 def divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n...
38
25
713
543
N = int(eval(input())) def isOk(k): n = N while n % k == 0: n //= k return n % k == 1 if N <= 10**6: ans = 0 for i in range(2, N + 1): if isOk(i): ans += 1 print(ans) exit() ans = 0 V = set() for i in range(2, int(N**0.5) + 10): if isOk(i): ans += ...
N = int(eval(input())) def isOk(k): n = N while n % k == 0: n //= k return n % k == 1 # 約数の全列挙 def divisors(n): divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) ...
false
34.210526
[ "-if N <= 10**6:", "- ans = 0", "- for i in range(2, N + 1):", "- if isOk(i):", "- ans += 1", "- print(ans)", "- exit()", "-ans = 0", "-V = set()", "-for i in range(2, int(N**0.5) + 10):", "- if isOk(i):", "- ans += 1", "- V.add(i)", "-divN = ...
false
0.283536
0.086842
3.264949
[ "s693638179", "s702057944" ]
u057109575
p03078
python
s198017073
s821697895
986
231
141,048
46,064
Accepted
Accepted
76.57
X, Y, Z, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) ans1 = [] for i in range(X): for j in range(Y): ans1.append(A[i] + B[j]) ans1 = sorted(ans1, reverse=True)[:K] ans = [] for i in range(le...
X, Y, Z, K = 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) ans = [] for i in range(X): for j in range(Y): if (i + 1) * (j + 1) > K: ...
20
22
453
549
X, Y, Z, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) ans1 = [] for i in range(X): for j in range(Y): ans1.append(A[i] + B[j]) ans1 = sorted(ans1, reverse=True)[:K] ans = [] for i in range(len(ans1)): for j in r...
X, Y, Z, K = 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) ans = [] for i in range(X): for j in range(Y): if (i + 1) * (j + 1) > K: break ...
false
9.090909
[ "-ans1 = []", "+A.sort(reverse=True)", "+B.sort(reverse=True)", "+C.sort(reverse=True)", "+ans = []", "- ans1.append(A[i] + B[j])", "-ans1 = sorted(ans1, reverse=True)[:K]", "-ans = []", "-for i in range(len(ans1)):", "- for j in range(Z):", "- ans.append(ans1[i] + C[j])", "+ ...
false
0.042117
0.036555
1.15216
[ "s198017073", "s821697895" ]
u896741788
p03724
python
s895749881
s129559211
315
244
3,828
31,388
Accepted
Accepted
22.54
n,m=list(map(int,input().split())) l=[0]*(n+1) for i in range(m): a,s=list(map(int,input().split())) l[a]+=1 l[s]+=1 for i in l: if i%2:print("NO");exit() print("YES")
n,m=list(map(int,input().split())) from collections import Counter as co from itertools import chain flatten=chain.from_iterable print(("YES" if all(i%2==0 for i in list(co(flatten([list(map(int,input().split())) for i in range(m)])).values())) else "NO"))
9
6
179
248
n, m = list(map(int, input().split())) l = [0] * (n + 1) for i in range(m): a, s = list(map(int, input().split())) l[a] += 1 l[s] += 1 for i in l: if i % 2: print("NO") exit() print("YES")
n, m = list(map(int, input().split())) from collections import Counter as co from itertools import chain flatten = chain.from_iterable print( ( "YES" if all( i % 2 == 0 for i in list( co( flatten([list(map(int, input().split())) for i in r...
false
33.333333
[ "-l = [0] * (n + 1)", "-for i in range(m):", "- a, s = list(map(int, input().split()))", "- l[a] += 1", "- l[s] += 1", "-for i in l:", "- if i % 2:", "- print(\"NO\")", "- exit()", "-print(\"YES\")", "+from collections import Counter as co", "+from itertools import ch...
false
0.048657
0.048644
1.000279
[ "s895749881", "s129559211" ]
u533232830
p02579
python
s963107857
s150800223
729
611
128,732
100,204
Accepted
Accepted
16.19
from collections import deque H, W = list(map(int, input().split())) Ch, Cw = list(map(int, input().split())) Dh, Dw = list(map(int, input().split())) Ch, Cw, Dh, Dw = Ch-1, Cw-1, Dh-1, Dw-1 maze = [list(eval(input())) for _ in range(H)] visit = [[-1] * W for _ in range(H)] visit[Ch][Cw] = 0 DQ = deque([(...
from collections import deque H, W = list(map(int, input().split())) Ch, Cw = list(map(int, input().split())) Dh, Dw = list(map(int, input().split())) Ch, Cw, Dh, Dw = Ch-1, Cw-1, Dh-1, Dw-1 maze = [eval(input()) for _ in range(H)] visit = [[-1] * W for _ in range(H)] visit[Ch][Cw] = 0 DQ = deque([[Ch, Cw...
44
39
1,137
990
from collections import deque H, W = list(map(int, input().split())) Ch, Cw = list(map(int, input().split())) Dh, Dw = list(map(int, input().split())) Ch, Cw, Dh, Dw = Ch - 1, Cw - 1, Dh - 1, Dw - 1 maze = [list(eval(input())) for _ in range(H)] visit = [[-1] * W for _ in range(H)] visit[Ch][Cw] = 0 DQ = deque([(Ch, C...
from collections import deque H, W = list(map(int, input().split())) Ch, Cw = list(map(int, input().split())) Dh, Dw = list(map(int, input().split())) Ch, Cw, Dh, Dw = Ch - 1, Cw - 1, Dh - 1, Dw - 1 maze = [eval(input()) for _ in range(H)] visit = [[-1] * W for _ in range(H)] visit[Ch][Cw] = 0 DQ = deque([[Ch, Cw]]) d...
false
11.363636
[ "-maze = [list(eval(input())) for _ in range(H)]", "+maze = [eval(input()) for _ in range(H)]", "-DQ = deque([(Ch, Cw)])", "+DQ = deque([[Ch, Cw]])", "- if (px, py) == (Dh, Dw):", "+ if px == Dh and py == Dw:", "- DQ.appendleft((nx, ny))", "+ DQ.appendleft([nx, ny])", "- ...
false
0.036451
0.036559
0.99704
[ "s963107857", "s150800223" ]
u136090046
p02972
python
s861925284
s628894897
513
378
9,148
17,600
Accepted
Accepted
26.32
n = int(eval(input())) a_array = [int(x) for x in input().split()] ans_array = [0 for x in range(n)] for index in reversed(list(range(1, n + 1))): if index > n // 2: ans_array[index - 1] = a_array[index - 1] elif index - 1 != 0: tmp = sum([ans_array[x] for x in range(index * 2 - 1, n, ind...
n = int(eval(input())) array = [int(x) for x in input().split()] ans = [0 for x in range(n)] res = [] count = 0 for i in reversed(list(range(n))): a = array[i] if a == 1 and sum([x for x in ans[i::i+1]]) % 2 == 0: ans[i] = 1 count += 1 res.append(str(i+1)) elif a == 0 and ...
24
19
802
458
n = int(eval(input())) a_array = [int(x) for x in input().split()] ans_array = [0 for x in range(n)] for index in reversed(list(range(1, n + 1))): if index > n // 2: ans_array[index - 1] = a_array[index - 1] elif index - 1 != 0: tmp = ( sum( [ ans_...
n = int(eval(input())) array = [int(x) for x in input().split()] ans = [0 for x in range(n)] res = [] count = 0 for i in reversed(list(range(n))): a = array[i] if a == 1 and sum([x for x in ans[i :: i + 1]]) % 2 == 0: ans[i] = 1 count += 1 res.append(str(i + 1)) elif a == 0 and sum([...
false
20.833333
[ "-a_array = [int(x) for x in input().split()]", "-ans_array = [0 for x in range(n)]", "-for index in reversed(list(range(1, n + 1))):", "- if index > n // 2:", "- ans_array[index - 1] = a_array[index - 1]", "- elif index - 1 != 0:", "- tmp = (", "- sum(", "- ...
false
0.126854
0.102895
1.232845
[ "s861925284", "s628894897" ]
u334712262
p03007
python
s920861971
s754247493
301
271
21,300
21,304
Accepted
Accepted
9.97
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, produc...
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, produc...
89
88
1,574
1,535
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permut...
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permut...
false
1.123596
[ "- heapq.heapify(A)", "- m = heapq.heappop(A)", "+ m = A.pop(0)", "- a = heapq.heappop(A)", "+ a = A.pop()" ]
false
0.007088
0.039289
0.180399
[ "s920861971", "s754247493" ]
u475503988
p03816
python
s797673025
s806559776
78
45
14,396
14,564
Accepted
Accepted
42.31
N = int(eval(input())) A = list(map(int, input().split())) MAX_A = 10**5 dp = [0] * (MAX_A + 1) for i in range(N): dp[A[i]] += 1 tmp = 0 for j in range(MAX_A + 1): if dp[j] > 0: tmp += dp[j] - 1 tmp += tmp % 2 print((N - tmp))
N = int(eval(input())) A = list(map(int, input().split())) s = set(A) k = len(s) if k % 2: ans = k else: ans = k - 1 print(ans)
13
9
247
137
N = int(eval(input())) A = list(map(int, input().split())) MAX_A = 10**5 dp = [0] * (MAX_A + 1) for i in range(N): dp[A[i]] += 1 tmp = 0 for j in range(MAX_A + 1): if dp[j] > 0: tmp += dp[j] - 1 tmp += tmp % 2 print((N - tmp))
N = int(eval(input())) A = list(map(int, input().split())) s = set(A) k = len(s) if k % 2: ans = k else: ans = k - 1 print(ans)
false
30.769231
[ "-MAX_A = 10**5", "-dp = [0] * (MAX_A + 1)", "-for i in range(N):", "- dp[A[i]] += 1", "-tmp = 0", "-for j in range(MAX_A + 1):", "- if dp[j] > 0:", "- tmp += dp[j] - 1", "-tmp += tmp % 2", "-print((N - tmp))", "+s = set(A)", "+k = len(s)", "+if k % 2:", "+ ans = k", "+el...
false
0.061927
0.042271
1.465
[ "s797673025", "s806559776" ]
u844005364
p02838
python
s668846448
s891578153
1,692
1,558
155,864
138,552
Accepted
Accepted
7.92
n = int(eval(input())) arr = list([format(int(n), '060b')[::-1] for n in input().split()]) mod = 10 ** 9 + 7 res = 0 power_of_two = 1 for d in range(60): one = sum(x[d] == "1" for x in arr) res += one * (n - one) * power_of_two res %= mod power_of_two *= 2 power_of_two %= mod print(...
n = int(eval(input())) arr = list(map(int, input().split())) mod = 10 ** 9 + 7 res = 0 for d in range(60): one = sum(x % 2 == 1 for x in arr) res += one * (n - one) * 2 ** d res %= mod arr = [x // 2 for x in arr] print(res)
15
13
324
249
n = int(eval(input())) arr = list([format(int(n), "060b")[::-1] for n in input().split()]) mod = 10**9 + 7 res = 0 power_of_two = 1 for d in range(60): one = sum(x[d] == "1" for x in arr) res += one * (n - one) * power_of_two res %= mod power_of_two *= 2 power_of_two %= mod print(res)
n = int(eval(input())) arr = list(map(int, input().split())) mod = 10**9 + 7 res = 0 for d in range(60): one = sum(x % 2 == 1 for x in arr) res += one * (n - one) * 2**d res %= mod arr = [x // 2 for x in arr] print(res)
false
13.333333
[ "-arr = list([format(int(n), \"060b\")[::-1] for n in input().split()])", "+arr = list(map(int, input().split()))", "-power_of_two = 1", "- one = sum(x[d] == \"1\" for x in arr)", "- res += one * (n - one) * power_of_two", "+ one = sum(x % 2 == 1 for x in arr)", "+ res += one * (n - one) * 2...
false
0.039617
0.04317
0.91771
[ "s668846448", "s891578153" ]
u134302690
p03502
python
s229454915
s828019688
166
17
38,384
2,940
Accepted
Accepted
89.76
def digit10(x): dten = 0 while(x>0): dten+=int(x%10) x/=10 return dten n = int(eval(input())) if n%digit10(n)==0: print("Yes") else: print("No")
S = eval(input()) N = int(S) fn = 0 for i in range(len(S)): fn += int(S[i]) print(("Yes" if N % fn == 0 else "No"))
12
6
186
116
def digit10(x): dten = 0 while x > 0: dten += int(x % 10) x /= 10 return dten n = int(eval(input())) if n % digit10(n) == 0: print("Yes") else: print("No")
S = eval(input()) N = int(S) fn = 0 for i in range(len(S)): fn += int(S[i]) print(("Yes" if N % fn == 0 else "No"))
false
50
[ "-def digit10(x):", "- dten = 0", "- while x > 0:", "- dten += int(x % 10)", "- x /= 10", "- return dten", "-", "-", "-n = int(eval(input()))", "-if n % digit10(n) == 0:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+S = eval(input())", "+N = int(S)", ...
false
0.100875
0.039016
2.585486
[ "s229454915", "s828019688" ]
u894258749
p02913
python
s737446251
s419143388
1,438
1,170
92,508
90,588
Accepted
Accepted
18.64
inpl = lambda: list(map(int,input().split())) N = int(eval(input())) S = eval(input()) character_pos = [ set() for _ in range(26) ] for i in range(N): character_pos[ord(S[i])-ord('a')].add(i) ans = 0 continue_list = dict() for i in range(N): s = S[i] new_continue_list = dict() for p in ch...
inpl = lambda: list(map(int,input().split())) N = int(eval(input())) S = eval(input()) character_pos = [ set() for _ in range(26) ] ans = 0 continue_list = dict() for i in range(N): s = S[i] new_continue_list = dict() cpos = character_pos[ord(s)-ord('a')] for p in cpos: new_continue_l...
26
23
708
649
inpl = lambda: list(map(int, input().split())) N = int(eval(input())) S = eval(input()) character_pos = [set() for _ in range(26)] for i in range(N): character_pos[ord(S[i]) - ord("a")].add(i) ans = 0 continue_list = dict() for i in range(N): s = S[i] new_continue_list = dict() for p in character_pos[or...
inpl = lambda: list(map(int, input().split())) N = int(eval(input())) S = eval(input()) character_pos = [set() for _ in range(26)] ans = 0 continue_list = dict() for i in range(N): s = S[i] new_continue_list = dict() cpos = character_pos[ord(s) - ord("a")] for p in cpos: new_continue_list[p] = 1...
false
11.538462
[ "-for i in range(N):", "- character_pos[ord(S[i]) - ord(\"a\")].add(i)", "- for p in character_pos[ord(s) - ord(\"a\")]:", "- if p < i:", "- new_continue_list[p] = 1", "+ cpos = character_pos[ord(s) - ord(\"a\")]", "+ for p in cpos:", "+ new_continue_list[p] = 1", ...
false
0.038091
0.091976
0.414141
[ "s737446251", "s419143388" ]
u782850731
p00092
python
s709052243
s801572038
2,440
1,950
4,348
4,324
Accepted
Accepted
20.08
#!/usr/bin/env python from sys import stdin, exit def main(readline=stdin.readline): while 1: n = int(readline()) if not n: exit() pre = [0] * (n+1) now = [0] * (n+1) maximum = 0 for _ in range(n): for x, c in enumerate(rea...
#!/usr/bin/env python from sys import stdin, exit def main(readline=stdin.readline): while 1: n = int(readline()) if not n: exit() pre = [0] * (n+1) now = [0] * (n+1) maximum = 0 for _ in range(n): for x, c in enumerate(rea...
30
28
706
660
#!/usr/bin/env python from sys import stdin, exit def main(readline=stdin.readline): while 1: n = int(readline()) if not n: exit() pre = [0] * (n + 1) now = [0] * (n + 1) maximum = 0 for _ in range(n): for x, c in enumerate(readline().rstrip(...
#!/usr/bin/env python from sys import stdin, exit def main(readline=stdin.readline): while 1: n = int(readline()) if not n: exit() pre = [0] * (n + 1) now = [0] * (n + 1) maximum = 0 for _ in range(n): for x, c in enumerate(readline().rstrip(...
false
6.666667
[ "- for x in range(1, n + 1):", "- pre[x] = now[x]", "- now[x] = 0", "+ pre = now", "+ now = [0] * (n + 1)" ]
false
0.061402
0.037269
1.647536
[ "s709052243", "s801572038" ]
u059210959
p03069
python
s240834247
s096293063
1,666
432
28,456
21,680
Accepted
Accepted
74.07
# encoding:utf-8 import copy import numpy as np import random import bisect #bisect_left これで二部探索の大小検索が行える import math N = int(eval(input())) S = str(eval(input())) ans = 10**6 blacks = [0 for i in range(N)] black = 0 white = 0 for i in range(N): if S[i] == "#": black += 1 else: ...
# encoding:utf-8 import copy import numpy as np import random import bisect #bisect_left これで二部探索の大小検索が行える import math N = int(eval(input())) S = str(eval(input())) # ans = 10**6 # blacks = [0 for i in range(N)] # black = 0 # white = 0 # for i in range(N): # if S[i] == "#": # black += 1 # ...
34
49
595
860
# encoding:utf-8 import copy import numpy as np import random import bisect # bisect_left これで二部探索の大小検索が行える import math N = int(eval(input())) S = str(eval(input())) ans = 10**6 blacks = [0 for i in range(N)] black = 0 white = 0 for i in range(N): if S[i] == "#": black += 1 else: white += 1 ...
# encoding:utf-8 import copy import numpy as np import random import bisect # bisect_left これで二部探索の大小検索が行える import math N = int(eval(input())) S = str(eval(input())) # ans = 10**6 # blacks = [0 for i in range(N)] # black = 0 # white = 0 # for i in range(N): # if S[i] == "#": # black += 1 # # else: # ...
false
30.612245
[ "-ans = 10**6", "-blacks = [0 for i in range(N)]", "-black = 0", "-white = 0", "+# ans = 10**6", "+# blacks = [0 for i in range(N)]", "+# black = 0", "+# white = 0", "+# for i in range(N):", "+# if S[i] == \"#\":", "+# black += 1", "+#", "+# else:", "+# white += 1",...
false
0.122964
0.045015
2.731627
[ "s240834247", "s096293063" ]
u136869985
p02741
python
s956596578
s136696783
19
17
3,316
3,060
Accepted
Accepted
10.53
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51] k = int(eval(input())) print((A[k - 1]))
print(([1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51][int(eval(input()))-1]))
3
1
138
91
A = [ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, ] k = int(eval(input())) print((A[k - 1]))
print( ( [ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, ...
false
66.666667
[ "-A = [", "- 1,", "- 1,", "- 1,", "- 2,", "- 1,", "- 2,", "- 1,", "- 5,", "- 2,", "- 2,", "- 1,", "- 5,", "- 1,", "- 2,", "- 1,", "- 14,", "- 1,", "- 5,", "- 1,", "- 5,", "- 2,", "- 2,", "- 1,", "- ...
false
0.05203
0.067177
0.774527
[ "s956596578", "s136696783" ]
u724687935
p02863
python
s023472306
s528709750
871
486
177,160
118,104
Accepted
Accepted
44.2
import sys N, T = list(map(int, input().split())) S = sys.stdin.readlines() A = [] B = [] for s in S: a, b = list(map(int, s.split())) A.append(a) B.append(b) dp1 = [[0] * T for _ in range(N + 1)] for i in range(N): for j in range(T): here = dp1[i][j] if j < A[i]: ...
N, T = list(map(int, input().split())) D = [tuple(map(int, input().split())) for _ in range(N)] D.sort() dp = [[0] * T for _ in range(N + 1)] for i in range(N): A, B = D[i] for j in range(T): here = dp[i][j] if j < A: dp[i + 1][j] = here else: dp[i + ...
38
25
877
552
import sys N, T = list(map(int, input().split())) S = sys.stdin.readlines() A = [] B = [] for s in S: a, b = list(map(int, s.split())) A.append(a) B.append(b) dp1 = [[0] * T for _ in range(N + 1)] for i in range(N): for j in range(T): here = dp1[i][j] if j < A[i]: dp1[i + 1]...
N, T = list(map(int, input().split())) D = [tuple(map(int, input().split())) for _ in range(N)] D.sort() dp = [[0] * T for _ in range(N + 1)] for i in range(N): A, B = D[i] for j in range(T): here = dp[i][j] if j < A: dp[i + 1][j] = here else: dp[i + 1][j] = max(h...
false
34.210526
[ "-import sys", "-", "-S = sys.stdin.readlines()", "-A = []", "-B = []", "-for s in S:", "- a, b = list(map(int, s.split()))", "- A.append(a)", "- B.append(b)", "-dp1 = [[0] * T for _ in range(N + 1)]", "+D = [tuple(map(int, input().split())) for _ in range(N)]", "+D.sort()", "+dp = ...
false
0.063781
0.035809
1.781142
[ "s023472306", "s528709750" ]
u254871849
p02923
python
s039292087
s569015898
67
59
14,092
14,092
Accepted
Accepted
11.94
# 2019-11-17 20:44:23(JST) import sys # import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r # import itertools # from functools import reduce # import operator as op # import re # import heapq # import a...
import sys n, *H = list(map(int, sys.stdin.read().split())) def main(): res = 0 cnt = 0 prev = 0 for h in H + [float('inf')]: if h <= prev: cnt += 1 else: res = max(res, cnt) cnt = 0 prev = h return res if __name__ =...
34
20
824
361
# 2019-11-17 20:44:23(JST) import sys # import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r # import itertools # from functools import reduce # import operator as op # import re # import heapq # import array # fro...
import sys n, *H = list(map(int, sys.stdin.read().split())) def main(): res = 0 cnt = 0 prev = 0 for h in H + [float("inf")]: if h <= prev: cnt += 1 else: res = max(res, cnt) cnt = 0 prev = h return res if __name__ == "__main__": a...
false
41.176471
[ "-# 2019-11-17 20:44:23(JST)", "-# import collections", "-# import math", "-# from string import ascii_lowercase, ascii_uppercase, digits", "-# from bisect import bisect_left as bi_l, bisect_right as bi_r", "-# import itertools", "-# from functools import reduce", "-# import operator as op", "-# imp...
false
0.040472
0.089327
0.45308
[ "s039292087", "s569015898" ]
u423585790
p03682
python
s013166240
s066143553
1,398
1,280
127,652
124,480
Accepted
Accepted
8.44
#!/usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random import itertools sys.setrecursionlimit(10**5) stdin = sys.stdin bisect_left = bisect.bisect_left bisect_right = bisect.bisect_right ...
#!/usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random import itertools sys.setrecursionlimit(10**5) stdin = sys.stdin bisect_left = bisect.bisect_left bisect_right = bisect.bisect_right ...
114
112
2,808
2,755
#!/usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random import itertools sys.setrecursionlimit(10**5) stdin = sys.stdin bisect_left = bisect.bisect_left bisect_right = bisect.bisect_right def LI():...
#!/usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random import itertools sys.setrecursionlimit(10**5) stdin = sys.stdin bisect_left = bisect.bisect_left bisect_right = bisect.bisect_right def LI():...
false
1.754386
[ "- def same(x, y):", "- return find(x) == find(y)", "-", "+ if x == y:", "+ return False", "- if not same(p0, p1):", "- unite(p0, p1)", "+ if unite(p0, p1):" ]
false
0.072625
0.097701
0.743347
[ "s013166240", "s066143553" ]
u633068244
p00089
python
s567584716
s777002004
400
10
4,400
4,316
Accepted
Accepted
97.5
def path(w,h,sm): global mx if w < 0 or len(inp[h])-1 < w: return 0 sm += inp[h][w] if sm < mx[h][w]: return 0 else: mx[h][w] = sm if h == c-1: return sm if h < c/2: return max(path(w,h+1,sm),path(w+1,h+1,sm)) else: return max(path(w,h+1,sm),path(w-1,h+1,sm)) c = 0 inp = [] while True: try: ...
def mx(inp,w,h): if h <= c/2: if w == 0: inp[h][w] += inp[h-1][w] elif w == len(inp[h])-1: inp[h][w] += inp[h-1][w-1] else: inp[h][w] += max(inp[h-1][w],inp[h-1][w-1]) else: inp[h][w] += max(inp[h-1][w],inp[h-1][w+1]) return inp c = 0 inp = [] while True: try: inp.append(list(map(int, input(...
20
22
470
458
def path(w, h, sm): global mx if w < 0 or len(inp[h]) - 1 < w: return 0 sm += inp[h][w] if sm < mx[h][w]: return 0 else: mx[h][w] = sm if h == c - 1: return sm if h < c / 2: return max(path(w, h + 1, sm), path(w + 1, h + 1, sm)) else: retur...
def mx(inp, w, h): if h <= c / 2: if w == 0: inp[h][w] += inp[h - 1][w] elif w == len(inp[h]) - 1: inp[h][w] += inp[h - 1][w - 1] else: inp[h][w] += max(inp[h - 1][w], inp[h - 1][w - 1]) else: inp[h][w] += max(inp[h - 1][w], inp[h - 1][w + 1]) ...
false
9.090909
[ "-def path(w, h, sm):", "- global mx", "- if w < 0 or len(inp[h]) - 1 < w:", "- return 0", "- sm += inp[h][w]", "- if sm < mx[h][w]:", "- return 0", "+def mx(inp, w, h):", "+ if h <= c / 2:", "+ if w == 0:", "+ inp[h][w] += inp[h - 1][w]", "+ ...
false
0.081578
0.037259
2.189469
[ "s567584716", "s777002004" ]
u645250356
p03665
python
s716190778
s426151264
200
37
39,916
5,084
Accepted
Accepted
81.5
from collections import Counter,defaultdict,deque from heapq import heapify,heappop,heappush import sys,bisect,math,itertools,string,queue sys.setrecursionlimit(10**8) mod = 10**9+7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return ...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def ...
28
29
811
711
from collections import Counter, defaultdict, deque from heapq import heapify, heappop, heappush import sys, bisect, math, itertools, string, queue sys.setrecursionlimit(10**8) mod = 10**9 + 7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def ...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, fractions sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().s...
false
3.448276
[ "-from heapq import heapify, heappop, heappush", "-import sys, bisect, math, itertools, string, queue", "+from heapq import heappop, heappush, heapify", "+import sys, bisect, math, itertools, fractions", "+INF = float(\"inf\")", "-def inpl_str():", "- return list(sys.stdin.readline().split())", "-"...
false
0.042333
0.033518
1.262994
[ "s716190778", "s426151264" ]
u918601425
p02616
python
s734892471
s563209085
267
236
31,756
31,716
Accepted
Accepted
11.61
MOD=10**9+7 N,K=[int(s) for s in input().split()] ls=[int(s) for s in input().split()] ans=set() ls=sorted(ls, key=lambda x: -abs(x)) mul=1 sign=0 zeroflag=0 flag=[0 for _ in range(N)] for i in range(K): flag[i]=1 if ls[i]<0: sign=(sign+1)%2 if sign==1: if 0 in ls: zeroflag=1 a=[0,0,0,0]...
MOD=10**9+7 N,K=[int(s) for s in input().split()] ls=[int(s) for s in input().split()] ls=sorted(ls, key=lambda x: -abs(x)) #かける数をフラグで管理 flag=[0 for _ in range(N)] sign=0 for i in range(K): flag[i]=1 if ls[i]<0: sign=(sign+1)%2 if sign==1: #絶対値が大きい順にかけた数は負か? #フラグのない負の数を、フラグのある正の数と取り換え可能か? ...
60
57
1,201
1,525
MOD = 10**9 + 7 N, K = [int(s) for s in input().split()] ls = [int(s) for s in input().split()] ans = set() ls = sorted(ls, key=lambda x: -abs(x)) mul = 1 sign = 0 zeroflag = 0 flag = [0 for _ in range(N)] for i in range(K): flag[i] = 1 if ls[i] < 0: sign = (sign + 1) % 2 if sign == 1: if 0 in ls: ...
MOD = 10**9 + 7 N, K = [int(s) for s in input().split()] ls = [int(s) for s in input().split()] ls = sorted(ls, key=lambda x: -abs(x)) # かける数をフラグで管理 flag = [0 for _ in range(N)] sign = 0 for i in range(K): flag[i] = 1 if ls[i] < 0: sign = (sign + 1) % 2 if sign == 1: # 絶対値が大きい順にかけた数は負か? # フラグのない負の数...
false
5
[ "-ans = set()", "-mul = 1", "+# かける数をフラグで管理", "+flag = [0 for _ in range(N)]", "-zeroflag = 0", "-flag = [0 for _ in range(N)]", "-if sign == 1:", "- if 0 in ls:", "- zeroflag = 1", "- a = [0, 0, 0, 0]", "- b = [0, 0, 0, 0]", "- for j in range(K, N):", "- if ls[j] >...
false
0.042001
0.037376
1.123757
[ "s734892471", "s563209085" ]
u350093546
p02555
python
s920672262
s086796430
97
81
68,156
65,080
Accepted
Accepted
16.49
s=int(eval(input())) mod=10**9+7 from operator import mul from functools import reduce def cmb(n,r): r = min(n-r,r) if r == 0: return 1 over = reduce(mul, list(range(n, n - r, -1))) under = reduce(mul, list(range(1,r + 1))) return over // under ans=0 for i in range(1,667): x=...
s=int(eval(input())) mod=10**9+7 dp=[0]*2001 for i in range(3,2001): dp[i]+=1 for j in range(i-3,-1,-1): dp[i]+=dp[j] dp[i]%=mod print((dp[s]))
25
15
394
173
s = int(eval(input())) mod = 10**9 + 7 from operator import mul from functools import reduce def cmb(n, r): r = min(n - r, r) if r == 0: return 1 over = reduce(mul, list(range(n, n - r, -1))) under = reduce(mul, list(range(1, r + 1))) return over // under ans = 0 for i in range(1, 667): ...
s = int(eval(input())) mod = 10**9 + 7 dp = [0] * 2001 for i in range(3, 2001): dp[i] += 1 for j in range(i - 3, -1, -1): dp[i] += dp[j] dp[i] %= mod print((dp[s]))
false
40
[ "-from operator import mul", "-from functools import reduce", "-", "-", "-def cmb(n, r):", "- r = min(n - r, r)", "- if r == 0:", "- return 1", "- over = reduce(mul, list(range(n, n - r, -1)))", "- under = reduce(mul, list(range(1, r + 1)))", "- return over // under", "-"...
false
0.051932
1.301695
0.039896
[ "s920672262", "s086796430" ]
u077291787
p02996
python
s879605381
s585586474
462
298
48,700
48,708
Accepted
Accepted
35.5
# ABC131D - Megalomania from itertools import accumulate from operator import itemgetter as gt def main(): N, *AB = list(map(int, open(0).read().split())) T, D = list(zip(*sorted([(i, j) for i, j in zip(*[iter(AB)] * 2)], key=gt(1)))) T = list(accumulate(T)) flg = all(t <= d for t, d in zip(T...
# ABC131D - Megalomania from operator import itemgetter as gt def main(): N, *AB = list(map(int, open(0).read().split())) cur, TD = 0, sorted([(i, j) for i, j in zip(*[iter(AB)] * 2)], key=gt(1)) for task, deadline in TD: # check all tasks greedily cur += task if cur > deadline: ...
15
17
434
465
# ABC131D - Megalomania from itertools import accumulate from operator import itemgetter as gt def main(): N, *AB = list(map(int, open(0).read().split())) T, D = list(zip(*sorted([(i, j) for i, j in zip(*[iter(AB)] * 2)], key=gt(1)))) T = list(accumulate(T)) flg = all(t <= d for t, d in zip(T, D)) # ...
# ABC131D - Megalomania from operator import itemgetter as gt def main(): N, *AB = list(map(int, open(0).read().split())) cur, TD = 0, sorted([(i, j) for i, j in zip(*[iter(AB)] * 2)], key=gt(1)) for task, deadline in TD: # check all tasks greedily cur += task if cur > deadline: # fail t...
false
11.764706
[ "-from itertools import accumulate", "- T, D = list(zip(*sorted([(i, j) for i, j in zip(*[iter(AB)] * 2)], key=gt(1))))", "- T = list(accumulate(T))", "- flg = all(t <= d for t, d in zip(T, D)) # all tasks finish within each deadline?", "- print((\"Yes\" if flg else \"No\"))", "+ cur, TD =...
false
0.137417
0.039228
3.503053
[ "s879605381", "s585586474" ]
u440566786
p03579
python
s518477078
s214065022
385
355
62,316
59,244
Accepted
Accepted
7.79
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda:sys.stdin.readline().rstrip() def resolve(): n,m=list(map(int,input().split())) E=[[] for _ in range(n)] for i in range(m): u,v=list(map(int,input().split())) u-=1; v-=1 E[u].append(v) ...
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda:sys.stdin.readline().rstrip() def resolve(): n,m=list(map(int,input().split())) E=[[] for _ in range(n)] for i in range(m): u,v=list(map(int,input().split())) u-=1; v-=1 E[u].append(v) ...
43
33
999
799
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.readline().rstrip() def resolve(): n, m = list(map(int, input().split())) E = [[] for _ in range(n)] for i in range(m): u, v = list(map(int, input().split())) u -= 1 v -= 1 ...
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.readline().rstrip() def resolve(): n, m = list(map(int, input().split())) E = [[] for _ in range(n)] for i in range(m): u, v = list(map(int, input().split())) u -= 1 v -= 1 ...
false
23.255814
[ "- if col[v] == col[nv]: # 二部グラフではない", "+ if col[v] == col[nv]: # 二部グラフではない -> 全部繋げられる", "- depth = [-1] * n", "- depth[0] = 0", "- Q = [0]", "- while Q:", "- v = Q.pop()", "- for nv in E[v]:", "- if depth[nv] != -1:", "- ...
false
0.039411
0.040468
0.973894
[ "s518477078", "s214065022" ]
u021019433
p02866
python
s203564728
s008989314
182
158
22,636
22,636
Accepted
Accepted
13.19
from collections import Counter M = 998244353 n = int(eval(input())) a = list(map(int, input().split())) x, c = next(a), Counter(a) r = 0 if x == c[0] == 0: r = p = 1 for i in range(1, n + 1): x = c[i] if x == 0: break r = r * pow(p, x, M) % M p = x; n -= p print(((r, 0)[n > 1...
from collections import Counter M = 998244353 n = int(eval(input())) a = list(map(int, input().split())) x, c = next(a), Counter(a) r = 0 if x == c[0] == 0: r = p = 1 try: for i in range(1, n + 1): x = c.get(i) r = r * pow(p, x, M) % M p = x; n -= p except: pass print((...
16
17
309
322
from collections import Counter M = 998244353 n = int(eval(input())) a = list(map(int, input().split())) x, c = next(a), Counter(a) r = 0 if x == c[0] == 0: r = p = 1 for i in range(1, n + 1): x = c[i] if x == 0: break r = r * pow(p, x, M) % M p = x n -= p pr...
from collections import Counter M = 998244353 n = int(eval(input())) a = list(map(int, input().split())) x, c = next(a), Counter(a) r = 0 if x == c[0] == 0: r = p = 1 try: for i in range(1, n + 1): x = c.get(i) r = r * pow(p, x, M) % M p = x n -= p ex...
false
5.882353
[ "- for i in range(1, n + 1):", "- x = c[i]", "- if x == 0:", "- break", "- r = r * pow(p, x, M) % M", "- p = x", "- n -= p", "+ try:", "+ for i in range(1, n + 1):", "+ x = c.get(i)", "+ r = r * pow(p, x, M) % M", ...
false
0.046562
0.081843
0.568922
[ "s203564728", "s008989314" ]
u077291787
p02996
python
s600630839
s064611791
654
439
45,928
33,488
Accepted
Accepted
32.87
# ABC131D - Megalomania import sys input = sys.stdin.readline from itertools import accumulate def main(): N = int(eval(input())) A = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1]) T, D = list(zip(*A)) # tasks, deadlines T = list(accumulate(T)) flg =...
# ABC131D - Megalomania import sys input = sys.stdin.readline from operator import itemgetter as get def main(): N = int(eval(input())) A = sorted( [tuple(map(int, input().split())) for _ in range(N)], key=get(1) ) cur = 0 for task, deadline in A: # check all tasks greedily ...
18
23
463
526
# ABC131D - Megalomania import sys input = sys.stdin.readline from itertools import accumulate def main(): N = int(eval(input())) A = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1]) T, D = list(zip(*A)) # tasks, deadlines T = list(accumulate(T)) flg = all(t <= d ...
# ABC131D - Megalomania import sys input = sys.stdin.readline from operator import itemgetter as get def main(): N = int(eval(input())) A = sorted([tuple(map(int, input().split())) for _ in range(N)], key=get(1)) cur = 0 for task, deadline in A: # check all tasks greedily cur += task ...
false
21.73913
[ "-from itertools import accumulate", "+from operator import itemgetter as get", "- A = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])", "- T, D = list(zip(*A)) # tasks, deadlines", "- T = list(accumulate(T))", "- flg = all(t <= d for t, d in zip(T, D)) # all...
false
0.035987
0.036945
0.974059
[ "s600630839", "s064611791" ]
u936985471
p04000
python
s583691820
s938762921
1,024
923
145,312
145,440
Accepted
Accepted
9.86
import sys readline = sys.stdin.readline H,W,N = list(map(int,readline().split())) from collections import defaultdict # 9x9のマスの左上のマスの座標をキーにして、各正方形の黒マス数をdictionaryで管理 # 10 ** 5 * 9程度 dic = defaultdict(int) for i in range(N): a,b = list(map(int,readline().split())) a,b = a - 1,b - 1 for A in rang...
import sys readline = sys.stdin.readline H,W,N = list(map(int,readline().split())) from collections import defaultdict # 9x9のマスの左上のマスの座標をキーにして、各正方形の黒マス数をdictionaryで管理 # 10 ** 5 * 9程度 dic = defaultdict(int) for i in range(N): a,b = list(map(int,readline().split())) a,b = a - 1,b - 1 for A in rang...
30
26
615
550
import sys readline = sys.stdin.readline H, W, N = list(map(int, readline().split())) from collections import defaultdict # 9x9のマスの左上のマスの座標をキーにして、各正方形の黒マス数をdictionaryで管理 # 10 ** 5 * 9程度 dic = defaultdict(int) for i in range(N): a, b = list(map(int, readline().split())) a, b = a - 1, b - 1 for A in range(m...
import sys readline = sys.stdin.readline H, W, N = list(map(int, readline().split())) from collections import defaultdict # 9x9のマスの左上のマスの座標をキーにして、各正方形の黒マス数をdictionaryで管理 # 10 ** 5 * 9程度 dic = defaultdict(int) for i in range(N): a, b = list(map(int, readline().split())) a, b = a - 1, b - 1 for A in range(m...
false
13.333333
[ "- if A < 0:", "- continue", "- if B < 0:", "- continue" ]
false
0.155956
0.171798
0.907786
[ "s583691820", "s938762921" ]
u945181840
p03682
python
s967193530
s198802969
742
293
49,012
36,040
Accepted
Accepted
60.51
import sys import numpy as np read = sys.stdin.read class UnionFind(): # 作りたい要素数nで初期化 # 使用するインスタンス変数の初期化 def __init__(self, n): self.n = n # root[x]<0ならそのノードが根かつその値が木の要素数 # rootノードでその木の要素数を記録する self.root = [-1]*(n+1) # 木をくっつける時にアンバランスにならないように調整する ...
import sys import numpy as np from scipy.sparse import coo_matrix from scipy.sparse.csgraph import minimum_spanning_tree read = sys.stdin.read N, *xy = list(map(int, read().split())) xy = np.array(xy, np.int64).reshape(N, 2) x = xy[:, 0] y = xy[:, 1] arg_x = np.argsort(x) arg_x1 = arg_x[1:] arg_x2 = arg_...
83
31
2,071
829
import sys import numpy as np read = sys.stdin.read class UnionFind: # 作りたい要素数nで初期化 # 使用するインスタンス変数の初期化 def __init__(self, n): self.n = n # root[x]<0ならそのノードが根かつその値が木の要素数 # rootノードでその木の要素数を記録する self.root = [-1] * (n + 1) # 木をくっつける時にアンバランスにならないように調整する self.rnk...
import sys import numpy as np from scipy.sparse import coo_matrix from scipy.sparse.csgraph import minimum_spanning_tree read = sys.stdin.read N, *xy = list(map(int, read().split())) xy = np.array(xy, np.int64).reshape(N, 2) x = xy[:, 0] y = xy[:, 1] arg_x = np.argsort(x) arg_x1 = arg_x[1:] arg_x2 = arg_x[:-1] arg_y =...
false
62.650602
[ "+from scipy.sparse import coo_matrix", "+from scipy.sparse.csgraph import minimum_spanning_tree", "-", "-", "-class UnionFind:", "- # 作りたい要素数nで初期化", "- # 使用するインスタンス変数の初期化", "- def __init__(self, n):", "- self.n = n", "- # root[x]<0ならそのノードが根かつその値が木の要素数", "- # rootノー...
false
0.226156
0.697627
0.324178
[ "s967193530", "s198802969" ]
u790710233
p02659
python
s075460629
s610262851
26
21
10,068
9,064
Accepted
Accepted
19.23
from decimal import Decimal a, b = list(map(Decimal, input().split())) print((int(a*b)))
a, b = input().split() a = int(a) b = int(b.replace('.', '')) print((a*b//100))
3
4
83
80
from decimal import Decimal a, b = list(map(Decimal, input().split())) print((int(a * b)))
a, b = input().split() a = int(a) b = int(b.replace(".", "")) print((a * b // 100))
false
25
[ "-from decimal import Decimal", "-", "-a, b = list(map(Decimal, input().split()))", "-print((int(a * b)))", "+a, b = input().split()", "+a = int(a)", "+b = int(b.replace(\".\", \"\"))", "+print((a * b // 100))" ]
false
0.039468
0.036415
1.083842
[ "s075460629", "s610262851" ]
u644907318
p04035
python
s203557716
s848044202
303
124
63,984
86,000
Accepted
Accepted
59.08
N,L = list(map(int,input().split())) A = list(map(int,input().split())) A.insert(0,0) flag = 0 for i in range(1,N): if A[i]+A[i+1]>=L: flag = i break if flag == 0: print("Impossible") else: print("Possible") if flag==1: for i in range(N-1,0,-1): print(i)...
N,L = list(map(int,input().split())) A = list(map(int,input().split())) A.insert(0,0) cmax = 0 ind = -1 for i in range(1,N): if A[i]+A[i+1]>cmax: cmax = A[i]+A[i+1] ind = i if cmax>=L: print("Possible") for i in range(1,ind): print(i) for i in range(N-1,ind-1,-1): ...
20
17
442
361
N, L = list(map(int, input().split())) A = list(map(int, input().split())) A.insert(0, 0) flag = 0 for i in range(1, N): if A[i] + A[i + 1] >= L: flag = i break if flag == 0: print("Impossible") else: print("Possible") if flag == 1: for i in range(N - 1, 0, -1): print...
N, L = list(map(int, input().split())) A = list(map(int, input().split())) A.insert(0, 0) cmax = 0 ind = -1 for i in range(1, N): if A[i] + A[i + 1] > cmax: cmax = A[i] + A[i + 1] ind = i if cmax >= L: print("Possible") for i in range(1, ind): print(i) for i in range(N - 1, ind -...
false
15
[ "-flag = 0", "+cmax = 0", "+ind = -1", "- if A[i] + A[i + 1] >= L:", "- flag = i", "- break", "-if flag == 0:", "+ if A[i] + A[i + 1] > cmax:", "+ cmax = A[i] + A[i + 1]", "+ ind = i", "+if cmax >= L:", "+ print(\"Possible\")", "+ for i in range(1, ind...
false
0.03827
0.037344
1.024791
[ "s203557716", "s848044202" ]
u532966492
p03313
python
s920687972
s968320229
1,812
1,098
57,620
130,124
Accepted
Accepted
39.4
def main(): n = int(eval(input())) a = list(map(int, input().split())) d = [None]*(2**n) d[0] = [a[0], 0, -1, -1] ans = 0 for i, t1 in enumerate(a[1:]): i += 1 t2, t3, t4 = i, -1, -1 for j in range(len(bin(i))-2): k = i & ~(1 << j) if k ...
def main(): n = int(eval(input())) a = list(map(int, input().split())) d = [[j, i, -1, -1] for i, j in enumerate(a)] ans = 0 for i in range(1, 2**n): t1, t2, t3, t4 = d[i] for j in range(len(bin(i))-2): t5, t6, t7, t8 = d[i & ~(1 << j)] if t5 > t1: ...
27
23
702
638
def main(): n = int(eval(input())) a = list(map(int, input().split())) d = [None] * (2**n) d[0] = [a[0], 0, -1, -1] ans = 0 for i, t1 in enumerate(a[1:]): i += 1 t2, t3, t4 = i, -1, -1 for j in range(len(bin(i)) - 2): k = i & ~(1 << j) if k == i: ...
def main(): n = int(eval(input())) a = list(map(int, input().split())) d = [[j, i, -1, -1] for i, j in enumerate(a)] ans = 0 for i in range(1, 2**n): t1, t2, t3, t4 = d[i] for j in range(len(bin(i)) - 2): t5, t6, t7, t8 = d[i & ~(1 << j)] if t5 > t1: ...
false
14.814815
[ "- d = [None] * (2**n)", "- d[0] = [a[0], 0, -1, -1]", "+ d = [[j, i, -1, -1] for i, j in enumerate(a)]", "- for i, t1 in enumerate(a[1:]):", "- i += 1", "- t2, t3, t4 = i, -1, -1", "+ for i in range(1, 2**n):", "+ t1, t2, t3, t4 = d[i]", "- k = i & ~(1...
false
0.043134
0.037376
1.154055
[ "s920687972", "s968320229" ]
u893063840
p03732
python
s924168815
s844859407
263
36
3,064
3,064
Accepted
Accepted
86.31
from itertools import accumulate n, W = list(map(int, input().split())) wv = [list(map(int, input().split())) for _ in range(n)] w1 = wv[0][0] weights = [[] for _ in range(4)] for w, v in wv: w_diff = w - w1 weights[w_diff].append(v) for i in range(4): weights[i].sort(reverse=True) acc =...
from itertools import accumulate n, W = list(map(int, input().split())) wv = [list(map(int, input().split())) for _ in range(n)] w1 = wv[0][0] weights = [[] for _ in range(4)] for w, v in wv: w_diff = w - w1 weights[w_diff].append(v) for i in range(4): weights[i].sort(reverse=True) acc =...
26
31
676
775
from itertools import accumulate n, W = list(map(int, input().split())) wv = [list(map(int, input().split())) for _ in range(n)] w1 = wv[0][0] weights = [[] for _ in range(4)] for w, v in wv: w_diff = w - w1 weights[w_diff].append(v) for i in range(4): weights[i].sort(reverse=True) acc = [[0] + list(accumu...
from itertools import accumulate n, W = list(map(int, input().split())) wv = [list(map(int, input().split())) for _ in range(n)] w1 = wv[0][0] weights = [[] for _ in range(4)] for w, v in wv: w_diff = w - w1 weights[w_diff].append(v) for i in range(4): weights[i].sort(reverse=True) acc = [[0] + list(accumu...
false
16.129032
[ "+l3 = len(weights[3])", "- for l, e4 in enumerate(acc[3]):", "- if w1 * i + (w1 + 1) * j + (w1 + 2) * k + (w1 + 3) * l <= W:", "- ans = max(ans, e1 + e2 + e3 + e4)", "+ w_sm = w1 * i + (w1 + 1) * j + (w1 + 2) * k", "+ if w_sm > W:", "+ ...
false
0.093148
0.039591
2.352752
[ "s924168815", "s844859407" ]
u863442865
p03503
python
s604898681
s015873982
175
74
3,316
3,064
Accepted
Accepted
57.71
def main(): import sys #input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter from collections import deque #dxy = [[0,1],[0,-1],[1,0],[-1,0]] #dxy = [[0,1],[0,-1],[1,0],[-1,0],[1,1],[1,-1],[-1,1],[-1,-1]] #mod = 1000000007 n = int(...
N=int(eval(input())) SO=[int(input().replace(' ',''), 2) for i in range(N)] PT=[list(map(int,input().split())) for i in range(N)] ret=-10**7*N for sp in range(1,2**10): r=0 for i in range(N): r+=PT[i][bin(SO[i] & sp).count('1')] ret=max(ret,r) print(ret)
34
10
848
267
def main(): import sys # input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter from collections import deque # dxy = [[0,1],[0,-1],[1,0],[-1,0]] # dxy = [[0,1],[0,-1],[1,0],[-1,0],[1,1],[1,-1],[-1,1],[-1,-1]] # mod = 1000000007 n = int(eval(inpu...
N = int(eval(input())) SO = [int(input().replace(" ", ""), 2) for i in range(N)] PT = [list(map(int, input().split())) for i in range(N)] ret = -(10**7) * N for sp in range(1, 2**10): r = 0 for i in range(N): r += PT[i][bin(SO[i] & sp).count("1")] ret = max(ret, r) print(ret)
false
70.588235
[ "-def main():", "- import sys", "-", "- # input = sys.stdin.readline", "- sys.setrecursionlimit(10000000)", "- from collections import Counter", "- from collections import deque", "-", "- # dxy = [[0,1],[0,-1],[1,0],[-1,0]]", "- # dxy = [[0,1],[0,-1],[1,0],[-1,0],[1,1],[1,-1],...
false
0.037769
0.036953
1.022074
[ "s604898681", "s015873982" ]
u729133443
p03807
python
s880209288
s407903654
52
40
11,104
11,104
Accepted
Accepted
23.08
eval(input());print(('YNEOS'[sum(int(i)%2for i in input().split())%2::2]))
eval(input());print(('YNEOS'[sum(map(int,input().split()))%2::2]))
1
1
66
58
eval(input()) print(("YNEOS"[sum(int(i) % 2 for i in input().split()) % 2 :: 2]))
eval(input()) print(("YNEOS"[sum(map(int, input().split())) % 2 :: 2]))
false
0
[ "-print((\"YNEOS\"[sum(int(i) % 2 for i in input().split()) % 2 :: 2]))", "+print((\"YNEOS\"[sum(map(int, input().split())) % 2 :: 2]))" ]
false
0.045679
0.042054
1.0862
[ "s880209288", "s407903654" ]
u488401358
p02983
python
s127184919
s833458057
535
43
3,060
3,060
Accepted
Accepted
91.96
L,R=list(map(int,input().split())) if R-L+1>=2019: print((0)) else: m=2019 for i in range(L,R): for j in range(i+1,R+1): x=(i*j)%2019 if x<m: m=x print(m)
L,R=list(map(int,input().split())) if R-L+1>=671: print((0)) else: m=2019 for i in range(L,R): for j in range(i+1,R+1): x=(i*j)%2019 if x<m: m=x print(m)
11
11
220
219
L, R = list(map(int, input().split())) if R - L + 1 >= 2019: print((0)) else: m = 2019 for i in range(L, R): for j in range(i + 1, R + 1): x = (i * j) % 2019 if x < m: m = x print(m)
L, R = list(map(int, input().split())) if R - L + 1 >= 671: print((0)) else: m = 2019 for i in range(L, R): for j in range(i + 1, R + 1): x = (i * j) % 2019 if x < m: m = x print(m)
false
0
[ "-if R - L + 1 >= 2019:", "+if R - L + 1 >= 671:" ]
false
0.040977
0.036393
1.125975
[ "s127184919", "s833458057" ]
u633068244
p00138
python
s447018738
s451613907
20
10
4,292
4,272
Accepted
Accepted
50
an1, at1, an2, at2 = 0, 1000, 0, 1000 for i in range(3): n1, t1, n2, t2 = 0, 1000, 0, 1000 for j in range(8): n, t = list(map(float, input().split())) if t < t1: if t2 < at1: an1 = n2; at1 = t2 elif t2 < at2: an2 = n2; at2 = t2 ...
def check(x,y): global an1,at1,an2,at2 if y < at1: an1,at1 = x,y elif y < at2: an2,at2 = x,y an1, at1, an2, at2 = 0, 1000, 0, 1000 for i in range(3): n1, t1, n2, t2 = 0, 1000, 0, 1000 for j in range(8): n, t = list(map(float, input().split())) if t < t1: ...
27
24
825
634
an1, at1, an2, at2 = 0, 1000, 0, 1000 for i in range(3): n1, t1, n2, t2 = 0, 1000, 0, 1000 for j in range(8): n, t = list(map(float, input().split())) if t < t1: if t2 < at1: an1 = n2 at1 = t2 elif t2 < at2: an2 = n2 ...
def check(x, y): global an1, at1, an2, at2 if y < at1: an1, at1 = x, y elif y < at2: an2, at2 = x, y an1, at1, an2, at2 = 0, 1000, 0, 1000 for i in range(3): n1, t1, n2, t2 = 0, 1000, 0, 1000 for j in range(8): n, t = list(map(float, input().split())) if t < t1: ...
false
11.111111
[ "+def check(x, y):", "+ global an1, at1, an2, at2", "+ if y < at1:", "+ an1, at1 = x, y", "+ elif y < at2:", "+ an2, at2 = x, y", "+", "+", "- if t2 < at1:", "- an1 = n2", "- at1 = t2", "- elif t2 < at2:", "- ...
false
0.076291
0.037782
2.019241
[ "s447018738", "s451613907" ]
u977389981
p03162
python
s030817301
s341933325
532
421
22,772
3,064
Accepted
Accepted
20.86
n = int(eval(input())) dp = [[0] * 3 for _ in range(n)] dp[0] = list(map(int, input().split())) for i in range(1, n): a, b, c = list(map(int, input().split())) dp[i][0] = a + max(dp[i - 1][1], dp[i - 1][2]) dp[i][1] = b + max(dp[i - 1][0], dp[i - 1][2]) dp[i][2] = c + max(dp[i - 1][0], dp[i - 1...
n = int(eval(input())) dp = [0] * 3 for i in range(n): a, b, c = list(map(int, input().split())) dp = [a + max(dp[1], dp[2]), b + max(dp[0], dp[2]), c + max(dp[0], dp[1])] print((max(dp)))
11
8
339
201
n = int(eval(input())) dp = [[0] * 3 for _ in range(n)] dp[0] = list(map(int, input().split())) for i in range(1, n): a, b, c = list(map(int, input().split())) dp[i][0] = a + max(dp[i - 1][1], dp[i - 1][2]) dp[i][1] = b + max(dp[i - 1][0], dp[i - 1][2]) dp[i][2] = c + max(dp[i - 1][0], dp[i - 1][1]) pri...
n = int(eval(input())) dp = [0] * 3 for i in range(n): a, b, c = list(map(int, input().split())) dp = [a + max(dp[1], dp[2]), b + max(dp[0], dp[2]), c + max(dp[0], dp[1])] print((max(dp)))
false
27.272727
[ "-dp = [[0] * 3 for _ in range(n)]", "-dp[0] = list(map(int, input().split()))", "-for i in range(1, n):", "+dp = [0] * 3", "+for i in range(n):", "- dp[i][0] = a + max(dp[i - 1][1], dp[i - 1][2])", "- dp[i][1] = b + max(dp[i - 1][0], dp[i - 1][2])", "- dp[i][2] = c + max(dp[i - 1][0], dp[i -...
false
0.036809
0.037635
0.978071
[ "s030817301", "s341933325" ]
u790710233
p03330
python
s952709806
s804361417
209
170
3,444
3,444
Accepted
Accepted
18.66
from collections import defaultdict import itertools n, c = list(map(int, input().split())) D = [list(map(int, input().split()))for _ in range(c)] # 集計 diago = [defaultdict(int)for _ in range(3)] for i in range(n): for j, color in enumerate(map(int, input().split())): color -= 1 if (i+j) ...
# リファクタ from collections import defaultdict import itertools n, c = list(map(int, input().split())) D = [list(map(int, input().split()))for _ in range(c)] # 集計 diago = [defaultdict(int)for _ in range(3)] for i in range(n): for j, color in enumerate(map(int, input().split())): diago[(i+j) % 3][col...
33
27
907
759
from collections import defaultdict import itertools n, c = list(map(int, input().split())) D = [list(map(int, input().split())) for _ in range(c)] # 集計 diago = [defaultdict(int) for _ in range(3)] for i in range(n): for j, color in enumerate(map(int, input().split())): color -= 1 if (i + j) % 3 ==...
# リファクタ from collections import defaultdict import itertools n, c = list(map(int, input().split())) D = [list(map(int, input().split())) for _ in range(c)] # 集計 diago = [defaultdict(int) for _ in range(3)] for i in range(n): for j, color in enumerate(map(int, input().split())): diago[(i + j) % 3][color - 1...
false
18.181818
[ "+# リファクタ", "- color -= 1", "- if (i + j) % 3 == 0:", "- diago[0][color] += 1", "- elif (i + j) % 3 == 1:", "- diago[1][color] += 1", "- else:", "- diago[2][color] += 1", "+ diago[(i + j) % 3][color - 1] += 1" ]
false
0.090348
0.08766
1.030664
[ "s952709806", "s804361417" ]
u440566786
p03163
python
s227042371
s417200681
1,674
405
145,668
118,128
Accepted
Accepted
75.81
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 def make_v(*args,e=0): from copy import deepcopy A=e for i in args[::-1]: A=[deepcopy(A) for _ in range(i)] return A input=lambda :sys.stdin.buffer.readline().rstrip() def resolve(): n,w=list(map(int,input().split()...
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.buffer.readline().rstrip() def resolve(): n,w=list(map(int,input().split())) W=[0]*(n+1) V=[0]*(n+1) for i in range(n): W[i+1],V[i+1]=list(map(int,input().split())) dp=[[0]*(w+1) for ...
25
20
683
561
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 def make_v(*args, e=0): from copy import deepcopy A = e for i in args[::-1]: A = [deepcopy(A) for _ in range(i)] return A input = lambda: sys.stdin.buffer.readline().rstrip() def resolve(): n, w = list(ma...
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.buffer.readline().rstrip() def resolve(): n, w = list(map(int, input().split())) W = [0] * (n + 1) V = [0] * (n + 1) for i in range(n): W[i + 1], V[i + 1] = list(map(int, input().split())...
false
20
[ "-", "-", "-def make_v(*args, e=0):", "- from copy import deepcopy", "-", "- A = e", "- for i in args[::-1]:", "- A = [deepcopy(A) for _ in range(i)]", "- return A", "-", "-", "- dp = make_v(n + 1, w + 1)", "+ dp = [[0] * (w + 1) for _ in range(n + 1)]" ]
false
0.050125
0.007729
6.485147
[ "s227042371", "s417200681" ]
u869790980
p03612
python
s549957349
s147287929
336
308
88,068
88,148
Accepted
Accepted
8.33
n = int(input()) count = 0 res = 0 ais = list(map(int , input().split())) for i,a in enumerate(ais): if a == i +1: count += 1 else: #flush the count res += (count + 1)/2# + 1 count = 0 if count: res += (count+1)/2 print(res)
n = int(input()) count = 0 res = 0 ais = list(map(int , input().split())) for i in range(n + 1): if (ais[i] if i < n else -1) != i + 1: #flush the count res += (count + 1)/2# + 1 count = 0 else: count +=1 print(res)
16
13
256
239
n = int(input()) count = 0 res = 0 ais = list(map(int, input().split())) for i, a in enumerate(ais): if a == i + 1: count += 1 else: # flush the count res += (count + 1) / 2 # + 1 count = 0 if count: res += (count + 1) / 2 print(res)
n = int(input()) count = 0 res = 0 ais = list(map(int, input().split())) for i in range(n + 1): if (ais[i] if i < n else -1) != i + 1: # flush the count res += (count + 1) / 2 # + 1 count = 0 else: count += 1 print(res)
false
18.75
[ "-for i, a in enumerate(ais):", "- if a == i + 1:", "- count += 1", "- else:", "+for i in range(n + 1):", "+ if (ais[i] if i < n else -1) != i + 1:", "-if count:", "- res += (count + 1) / 2", "+ else:", "+ count += 1" ]
false
0.123977
0.086826
1.427878
[ "s549957349", "s147287929" ]
u729133443
p02993
python
s146501960
s560190083
165
23
38,384
9,000
Accepted
Accepted
86.06
import re;print((re.search(r'(.)\1',eval(input()))and'Bad'or'Good'))
print(('Good'*eval('!='.join(eval(input())))or'Bad'))
1
1
60
45
import re print((re.search(r"(.)\1", eval(input())) and "Bad" or "Good"))
print(("Good" * eval("!=".join(eval(input()))) or "Bad"))
false
0
[ "-import re", "-", "-print((re.search(r\"(.)\\1\", eval(input())) and \"Bad\" or \"Good\"))", "+print((\"Good\" * eval(\"!=\".join(eval(input()))) or \"Bad\"))" ]
false
0.094571
0.039933
2.368252
[ "s146501960", "s560190083" ]
u729133443
p02841
python
s781241177
s551782200
174
17
38,384
2,940
Accepted
Accepted
90.23
a,b=open(0);print((+(a[:2]!=b[:2])))
print((+(input()[:2]!=input()[:2])))
1
1
34
34
a, b = open(0) print((+(a[:2] != b[:2])))
print((+(input()[:2] != input()[:2])))
false
0
[ "-a, b = open(0)", "-print((+(a[:2] != b[:2])))", "+print((+(input()[:2] != input()[:2])))" ]
false
0.143464
0.04007
3.580363
[ "s781241177", "s551782200" ]
u729133443
p02580
python
s291204280
s257692940
840
526
141,404
74,344
Accepted
Accepted
37.38
from collections import* (h,w,m),*z=[tuple(map(int,o.split()))for o in open(0)] s=set(z) y,x=[Counter(t).most_common()for t in zip(*z)] a,b=y[0][1],x[0][1] p=[i for i,v in y if v==a] q=[i for i,v in x if v==b] for i in p: for j in q: if(i,j)not in s:exit(print(a+b)) print(a+b-1)
*r,=c=[0]*9**6 _,*z=[[*list(map(int,t.split()))]for t in open(0)] for y,x in z:r[y]+=1;c[x]+=1 h,w=max(r),max(c) print((h+w-(r.count(h)*c.count(w)==sum(h+w==r[y]+c[x]for y,x in z))))
11
5
295
178
from collections import * (h, w, m), *z = [tuple(map(int, o.split())) for o in open(0)] s = set(z) y, x = [Counter(t).most_common() for t in zip(*z)] a, b = y[0][1], x[0][1] p = [i for i, v in y if v == a] q = [i for i, v in x if v == b] for i in p: for j in q: if (i, j) not in s: exit(print(a ...
(*r,) = c = [0] * 9**6 _, *z = [[*list(map(int, t.split()))] for t in open(0)] for y, x in z: r[y] += 1 c[x] += 1 h, w = max(r), max(c) print((h + w - (r.count(h) * c.count(w) == sum(h + w == r[y] + c[x] for y, x in z))))
false
54.545455
[ "-from collections import *", "-", "-(h, w, m), *z = [tuple(map(int, o.split())) for o in open(0)]", "-s = set(z)", "-y, x = [Counter(t).most_common() for t in zip(*z)]", "-a, b = y[0][1], x[0][1]", "-p = [i for i, v in y if v == a]", "-q = [i for i, v in x if v == b]", "-for i in p:", "- for j...
false
0.084917
0.263336
0.322466
[ "s291204280", "s257692940" ]
u105210954
p03163
python
s817843841
s353034179
205
185
92,852
14,796
Accepted
Accepted
9.76
import numpy as np def resolve(): n, w = list(map(int, input().split())) goods = np.array([list(map(int, input().split())) for _ in range(n)]) dp = np.zeros([n + 1, w + 1], dtype=int) for i in range(1, n + 1): tmp = np.zeros(w + 1, dtype=int) tmp[goods[i - 1][0]:] = dp[i - 1][:-...
import numpy as np def resolve(): n, w = list(map(int, input().split())) goods = np.array([list(map(int, input().split())) for _ in range(n)]) # dpテーブルを1次元にして破壊的に更新していくパターン dp = np.zeros([w + 1], dtype=int) for i in range(1, n + 1): tmp = np.zeros(w + 1, dtype=int) tm...
14
16
432
446
import numpy as np def resolve(): n, w = list(map(int, input().split())) goods = np.array([list(map(int, input().split())) for _ in range(n)]) dp = np.zeros([n + 1, w + 1], dtype=int) for i in range(1, n + 1): tmp = np.zeros(w + 1, dtype=int) tmp[goods[i - 1][0] :] = dp[i - 1][: -goods...
import numpy as np def resolve(): n, w = list(map(int, input().split())) goods = np.array([list(map(int, input().split())) for _ in range(n)]) # dpテーブルを1次元にして破壊的に更新していくパターン dp = np.zeros([w + 1], dtype=int) for i in range(1, n + 1): tmp = np.zeros(w + 1, dtype=int) tmp[goods[i - 1]...
false
12.5
[ "- dp = np.zeros([n + 1, w + 1], dtype=int)", "+ # dpテーブルを1次元にして破壊的に更新していくパターン", "+ dp = np.zeros([w + 1], dtype=int)", "- tmp[goods[i - 1][0] :] = dp[i - 1][: -goods[i - 1][0]] + goods[i - 1][1]", "- dp[i] = np.maximum(dp[i - 1], tmp)", "- print((dp[n][w]))", "+ tmp[goo...
false
0.162891
0.211986
0.768406
[ "s817843841", "s353034179" ]
u325282913
p03062
python
s607651244
s275626693
106
90
14,284
85,316
Accepted
Accepted
15.09
N = int(eval(input())) arr = list(map(int, input().split())) count = 0 gokei = 0 mi = float('inf') flg = False for i in arr: gokei += abs(i) mi = min(mi,abs(i)) if i < 0: count += 1 if i == 0: flg = True if flg or count % 2 == 0: print(gokei) else: print((gokei-mi...
N = int(eval(input())) arr = list(map(int, input().split())) cnt = 0 flg = False for i in range(N): if arr[i] == 0: flg = True if arr[i] < 0: cnt += 1 arr[i] = abs(arr[i]) if cnt % 2 == 0 or flg: print((sum(arr))) else: print((sum(arr) - min(arr)*2))
17
14
316
289
N = int(eval(input())) arr = list(map(int, input().split())) count = 0 gokei = 0 mi = float("inf") flg = False for i in arr: gokei += abs(i) mi = min(mi, abs(i)) if i < 0: count += 1 if i == 0: flg = True if flg or count % 2 == 0: print(gokei) else: print((gokei - mi * 2))
N = int(eval(input())) arr = list(map(int, input().split())) cnt = 0 flg = False for i in range(N): if arr[i] == 0: flg = True if arr[i] < 0: cnt += 1 arr[i] = abs(arr[i]) if cnt % 2 == 0 or flg: print((sum(arr))) else: print((sum(arr) - min(arr) * 2))
false
17.647059
[ "-count = 0", "-gokei = 0", "-mi = float(\"inf\")", "+cnt = 0", "-for i in arr:", "- gokei += abs(i)", "- mi = min(mi, abs(i))", "- if i < 0:", "- count += 1", "- if i == 0:", "+for i in range(N):", "+ if arr[i] == 0:", "-if flg or count % 2 == 0:", "- print(gokei)...
false
0.156146
0.042293
3.691995
[ "s607651244", "s275626693" ]
u137542041
p02837
python
s925939924
s521125834
338
278
3,064
3,064
Accepted
Accepted
17.75
N = int(eval(input())) XY = [] for _ in range(N): A = int(eval(input())) temp = [] for _ in range(A): temp.append(list(map(int, input().split()))) XY.append(temp) max_honest = 0 for c in range(1 << N): check = [0] * N contradict = False temp = c cnt2 = 0 ...
N = int(eval(input())) XY = [] for _ in range(N): A = int(eval(input())) temp = [] for _ in range(A): temp.append(list(map(int, input().split()))) XY.append(temp) max_honest = 0 for c in range(1 << N): check = [0] * N contradict = False cnt1 = 0 while c !...
47
41
889
741
N = int(eval(input())) XY = [] for _ in range(N): A = int(eval(input())) temp = [] for _ in range(A): temp.append(list(map(int, input().split()))) XY.append(temp) max_honest = 0 for c in range(1 << N): check = [0] * N contradict = False temp = c cnt2 = 0 while temp != 0: ...
N = int(eval(input())) XY = [] for _ in range(N): A = int(eval(input())) temp = [] for _ in range(A): temp.append(list(map(int, input().split()))) XY.append(temp) max_honest = 0 for c in range(1 << N): check = [0] * N contradict = False cnt1 = 0 while c != 0: if 1 & c: ...
false
12.765957
[ "- temp = c", "- cnt2 = 0", "- while temp != 0:", "- if 1 & temp:", "- check[cnt2] = 1", "- temp >>= 1", "- cnt2 += 1", "+ cnt1 = 0", "+ while c != 0:", "+ if 1 & c:", "+ check[cnt1] = 1", "+ c >>= 1", "+ cnt1 += ...
false
0.037176
0.038027
0.977624
[ "s925939924", "s521125834" ]
u724687935
p02762
python
s000244798
s729692707
1,754
971
122,144
127,012
Accepted
Accepted
44.64
class UnionFind(): def __init__(self, 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 = self.fi...
import sys class UnionFind(): def __init__(self, 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): ...
47
51
1,077
1,124
class UnionFind: def __init__(self, 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 = self.find(x) ...
import sys class UnionFind: def __init__(self, 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 = self.fin...
false
7.843137
[ "+import sys", "+", "+", "-for _ in range(M):", "- a, b = list(map(int, input().split()))", "+IN = sys.stdin.readlines()", "+for i in range(M):", "+ a, b = list(map(int, IN[i].split()))", "-for _ in range(K):", "- a, b = list(map(int, input().split()))", "+for i in range(M, M + K):", ...
false
0.090067
0.047234
1.906799
[ "s000244798", "s729692707" ]
u391875425
p03090
python
s579512461
s703698178
628
20
3,976
3,316
Accepted
Accepted
96.82
N = int(eval(input())) ans = [] lis = [] for i in range(N): lis.append(i + 1) if N % 2 == 0: M = (N - 2) * N // 2 for i in range(1, N): for j in range(1, N): if j != i and i != lis[-j]: tmp = sorted([i, lis[-j]]) if tmp not in ans: ...
N = int(eval(input())) ans = [] M = N + 1 * (N % 2 == 0) for i in range(1, N + 1): for j in range(i + 1, N + 1): if i + j == M: continue ans.append('{} {}'.format(i, j)) print((len(ans))) print(('\n'.join(ans)))
29
10
808
242
N = int(eval(input())) ans = [] lis = [] for i in range(N): lis.append(i + 1) if N % 2 == 0: M = (N - 2) * N // 2 for i in range(1, N): for j in range(1, N): if j != i and i != lis[-j]: tmp = sorted([i, lis[-j]]) if tmp not in ans: ans....
N = int(eval(input())) ans = [] M = N + 1 * (N % 2 == 0) for i in range(1, N + 1): for j in range(i + 1, N + 1): if i + j == M: continue ans.append("{} {}".format(i, j)) print((len(ans))) print(("\n".join(ans)))
false
65.517241
[ "-lis = []", "-for i in range(N):", "- lis.append(i + 1)", "-if N % 2 == 0:", "- M = (N - 2) * N // 2", "- for i in range(1, N):", "- for j in range(1, N):", "- if j != i and i != lis[-j]:", "- tmp = sorted([i, lis[-j]])", "- if tmp not in a...
false
0.076893
0.037523
2.04924
[ "s579512461", "s703698178" ]
u340781749
p03428
python
s261075906
s888169194
496
447
175,136
179,092
Accepted
Accepted
9.88
from collections import Counter import numpy as np def part(s, t): a = np.linspace(s, t, 1e5, endpoint=False) for i, v in list(Counter(np.argmax(np.dot(pts, [np.sin(a), np.cos(a)]), axis=0)).items()): ans[i] += v n = int(eval(input())) pts = [list(map(int, input().split())) for _ in range...
from collections import Counter import numpy as np def solve(n, pts): ans = [0] * n div = 200000 a = np.linspace(0, 2 * np.pi, div, endpoint=False) b = np.array([np.cos(a), np.sin(a)], dtype=np.float32) for i, v in list(Counter(np.argmax(np.dot(pts, b), axis=0)).items()): ans...
17
19
417
496
from collections import Counter import numpy as np def part(s, t): a = np.linspace(s, t, 1e5, endpoint=False) for i, v in list( Counter(np.argmax(np.dot(pts, [np.sin(a), np.cos(a)]), axis=0)).items() ): ans[i] += v n = int(eval(input())) pts = [list(map(int, input().split())) for _ in ra...
from collections import Counter import numpy as np def solve(n, pts): ans = [0] * n div = 200000 a = np.linspace(0, 2 * np.pi, div, endpoint=False) b = np.array([np.cos(a), np.sin(a)], dtype=np.float32) for i, v in list(Counter(np.argmax(np.dot(pts, b), axis=0)).items()): ans[i] = v / div ...
false
10.526316
[ "-def part(s, t):", "- a = np.linspace(s, t, 1e5, endpoint=False)", "- for i, v in list(", "- Counter(np.argmax(np.dot(pts, [np.sin(a), np.cos(a)]), axis=0)).items()", "- ):", "- ans[i] += v", "+def solve(n, pts):", "+ ans = [0] * n", "+ div = 200000", "+ a = np.lin...
false
0.224311
0.342649
0.654638
[ "s261075906", "s888169194" ]
u670180528
p03798
python
s200545502
s392423347
261
211
6,152
7,680
Accepted
Accepted
19.16
n=int(input()) s=[0+(m=="o") for m in input()] #o:1,x:0 #Sheep:1,wolf:0 def nxt(a,b,m): if a==b: return m else: return 1-m for a,b in ((1,1),(0,1),(1,0),(0,0)): c,d = a,b ans = [a,b] for i in range(n-2): a,b = b,nxt(a,b,s[i+1]) ans.append(b) if nxt(a,b,s[-1])==c and nxt(b,c,s[0])==d: ...
n,s=open(0);n=int(n) for a,b in ([0,0],[0,1],[1,0],[1,1]): r=[a,b] for i in range(n):a,b=b,s[-~i%n]=="xo"[a==b];r+=[b] if r[:2]==r[-2:]:print(*("WS"[i]for i in r[:-2]),sep="");exit() print(-1)
25
6
421
200
n = int(input()) s = [0 + (m == "o") for m in input()] # o:1,x:0 # Sheep:1,wolf:0 def nxt(a, b, m): if a == b: return m else: return 1 - m for a, b in ((1, 1), (0, 1), (1, 0), (0, 0)): c, d = a, b ans = [a, b] for i in range(n - 2): a, b = b, nxt(a, b, s[i + 1]) ans...
n, s = open(0) n = int(n) for a, b in ([0, 0], [0, 1], [1, 0], [1, 1]): r = [a, b] for i in range(n): a, b = b, s[-~i % n] == "xo"[a == b] r += [b] if r[:2] == r[-2:]: print(*("WS"[i] for i in r[:-2]), sep="") exit() print(-1)
false
76
[ "-n = int(input())", "-s = [0 + (m == \"o\") for m in input()]", "-# o:1,x:0", "-# Sheep:1,wolf:0", "-def nxt(a, b, m):", "- if a == b:", "- return m", "- else:", "- return 1 - m", "-", "-", "-for a, b in ((1, 1), (0, 1), (1, 0), (0, 0)):", "- c, d = a, b", "- ans...
false
0.068111
0.006979
9.758977
[ "s200545502", "s392423347" ]
u777864981
p03999
python
s003764487
s147957134
24
20
3,060
3,060
Accepted
Accepted
16.67
S = eval(input()) def DP(x , i): #print("x:i:",x,i) ans = 0 # iがSの長さになっていれば、評価する if i == len(S): # +が入っていればevalで評価する必要がある #print("評価") if '+' in x: return eval(x) else: return int(x) else: # i番目の数字の前に+を挟まない場合 ans...
s = eval(input()) n = int(s) r = 0 # bitの2進数表記で+を入れる位置を総当たりする for bit in range(2**(len(s)-1)): # eは先頭文字 e = s[0] # +が入る位置が、右からi桁目(0<= i <= Sの長さ-1)のとき for i in range(len(s)-1): if ((bit>>i)&1) == 1: # bitの2進数表記で右からi桁目が1のとき # '+'を入れる e += '+' ...
22
18
469
437
S = eval(input()) def DP(x, i): # print("x:i:",x,i) ans = 0 # iがSの長さになっていれば、評価する if i == len(S): # +が入っていればevalで評価する必要がある # print("評価") if "+" in x: return eval(x) else: return int(x) else: # i番目の数字の前に+を挟まない場合 ans += DP(x + S[...
s = eval(input()) n = int(s) r = 0 # bitの2進数表記で+を入れる位置を総当たりする for bit in range(2 ** (len(s) - 1)): # eは先頭文字 e = s[0] # +が入る位置が、右からi桁目(0<= i <= Sの長さ-1)のとき for i in range(len(s) - 1): if ((bit >> i) & 1) == 1: # bitの2進数表記で右からi桁目が1のとき # '+'を入れる e += "+" #...
false
18.181818
[ "-S = eval(input())", "-", "-", "-def DP(x, i):", "- # print(\"x:i:\",x,i)", "- ans = 0", "- # iがSの長さになっていれば、評価する", "- if i == len(S):", "- # +が入っていればevalで評価する必要がある", "- # print(\"評価\")", "- if \"+\" in x:", "- return eval(x)", "- else:", ...
false
0.047817
0.048973
0.97639
[ "s003764487", "s147957134" ]
u392319141
p03575
python
s144274346
s147135958
52
22
3,444
3,064
Accepted
Accepted
57.69
from collections import deque N, M = list(map(int, input().split())) edges = [] for _ in range(M): a, b = list(map(int, input().split())) a -= 1 b -= 1 edges.append((a, b)) ans = 0 for removeEdge in range(M): confilm = [False for _ in range(N)] que = deque([]) que.append(0)...
class UnionFind : def __init__(self, size) : self.parent = list(range(size)) self.height = [0] * size self.size = [1] * size self.component = size def root(self, index) : if self.parent[index] == index : # 根の場合 return index rootIndex = se...
33
54
739
1,600
from collections import deque N, M = list(map(int, input().split())) edges = [] for _ in range(M): a, b = list(map(int, input().split())) a -= 1 b -= 1 edges.append((a, b)) ans = 0 for removeEdge in range(M): confilm = [False for _ in range(N)] que = deque([]) que.append(0) while que: ...
class UnionFind: def __init__(self, size): self.parent = list(range(size)) self.height = [0] * size self.size = [1] * size self.component = size def root(self, index): if self.parent[index] == index: # 根の場合 return index rootIndex = self.root(self.par...
false
38.888889
[ "-from collections import deque", "+class UnionFind:", "+ def __init__(self, size):", "+ self.parent = list(range(size))", "+ self.height = [0] * size", "+ self.size = [1] * size", "+ self.component = size", "+", "+ def root(self, index):", "+ if self.paren...
false
0.07612
0.101377
0.750864
[ "s144274346", "s147135958" ]
u578441226
p02582
python
s556206770
s902070756
30
27
8,976
9,036
Accepted
Accepted
10
s = eval(input()) if s[0] == "R": if s[1] == "R": if s[2] == "R": print("3") else: print("2") else: print("1") elif s[1] == "R": if s[2] == "R": print("2") else: print("1") elif s[2] == "R": print("1") ...
s = eval(input()) r = ["RRS","RRR","RSR","SRR","SSR","RSS","SSS","SRS"] ra = [2,3,1,2,1,1,0,1] for i in range(8): if r[i] == s: print((ra[i]))
19
7
335
153
s = eval(input()) if s[0] == "R": if s[1] == "R": if s[2] == "R": print("3") else: print("2") else: print("1") elif s[1] == "R": if s[2] == "R": print("2") else: print("1") elif s[2] == "R": print("1") else: print("0")
s = eval(input()) r = ["RRS", "RRR", "RSR", "SRR", "SSR", "RSS", "SSS", "SRS"] ra = [2, 3, 1, 2, 1, 1, 0, 1] for i in range(8): if r[i] == s: print((ra[i]))
false
63.157895
[ "-if s[0] == \"R\":", "- if s[1] == \"R\":", "- if s[2] == \"R\":", "- print(\"3\")", "- else:", "- print(\"2\")", "- else:", "- print(\"1\")", "-elif s[1] == \"R\":", "- if s[2] == \"R\":", "- print(\"2\")", "- else:", "- ...
false
0.045996
0.045671
1.007123
[ "s556206770", "s902070756" ]
u747602774
p03379
python
s149111784
s087772656
353
306
26,772
25,620
Accepted
Accepted
13.31
N=int(eval(input())) X=list(map(int,input().split())) X_sort=sorted(X) if X_sort[N//2-1]==X_sort[N//2]: for n in range(N): print((X_sort[N//2])) else: if X_sort.count(X_sort[N//2-1])==1: for n in range(N): if X[n]>X_sort[N//2-1]: print((X_sort[N//2-1])) ...
N = int(eval(input())) X = list(map(int,input().split())) Xs = sorted(X) Bl = Xs[(N-1)//2] Br = Xs[N//2] for i in range(N): if Bl < X[i]: print(Bl) else: print(Br)
21
10
537
191
N = int(eval(input())) X = list(map(int, input().split())) X_sort = sorted(X) if X_sort[N // 2 - 1] == X_sort[N // 2]: for n in range(N): print((X_sort[N // 2])) else: if X_sort.count(X_sort[N // 2 - 1]) == 1: for n in range(N): if X[n] > X_sort[N // 2 - 1]: print((X_...
N = int(eval(input())) X = list(map(int, input().split())) Xs = sorted(X) Bl = Xs[(N - 1) // 2] Br = Xs[N // 2] for i in range(N): if Bl < X[i]: print(Bl) else: print(Br)
false
52.380952
[ "-X_sort = sorted(X)", "-if X_sort[N // 2 - 1] == X_sort[N // 2]:", "- for n in range(N):", "- print((X_sort[N // 2]))", "-else:", "- if X_sort.count(X_sort[N // 2 - 1]) == 1:", "- for n in range(N):", "- if X[n] > X_sort[N // 2 - 1]:", "- print((X_sort[...
false
0.198005
0.196521
1.007553
[ "s149111784", "s087772656" ]
u588341295
p03682
python
s620116160
s497681371
1,306
1,102
60,720
52,788
Accepted
Accepted
15.62
# -*- coding: utf-8 -*- """ ・最小全域木、Union-Find """ import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10 ** 9) from operator import itemgetter # Union-Find木 class UnionFind: def __init__(self, n): # 親要素のノード番号を格納。par[x] == xの時そのノードは根 # 1-indexedのままでOK...
# -*- coding: utf-8 -*- import sys from operator import itemgetter 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...
83
118
1,922
3,149
# -*- coding: utf-8 -*- """ ・最小全域木、Union-Find """ import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10**9) from operator import itemgetter # Union-Find木 class UnionFind: def __init__(self, n): # 親要素のノード番号を格納。par[x] == xの時そのノードは根 # 1-indexedのままでOK、その場合は[0]は未使用...
# -*- coding: utf-8 -*- import sys from operator import itemgetter 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 ...
false
29.661017
[ "-\"\"\"", "-・最小全域木、Union-Find", "-\"\"\"", "+from operator import itemgetter", "+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):", ...
false
0.112369
0.041715
2.693709
[ "s620116160", "s497681371" ]
u092301301
p02773
python
s936262601
s856915856
1,005
635
100,432
90,568
Accepted
Accepted
36.82
d={} ; a=[] from collections import Counter for _ in range(int(eval(input()))): s=eval(input()) a.append(s) d=Counter(a) maxx=max(d.values()) ans=[] for i in d: if d[i]==maxx: ans.append(i) ans.sort() for i in ans: print(i)
import sys input = lambda: sys.stdin.readline().rstrip() d={} ; a=[] from collections import Counter for _ in range(int(eval(input()))): s=eval(input()) a.append(s) d=Counter(a) maxx=max(d.values()) ans=[] for i in d: if d[i]==maxx: ans.append(i) ans.sort() for i in ans: print(i) ...
15
17
254
313
d = {} a = [] from collections import Counter for _ in range(int(eval(input()))): s = eval(input()) a.append(s) d = Counter(a) maxx = max(d.values()) ans = [] for i in d: if d[i] == maxx: ans.append(i) ans.sort() for i in ans: print(i)
import sys input = lambda: sys.stdin.readline().rstrip() d = {} a = [] from collections import Counter for _ in range(int(eval(input()))): s = eval(input()) a.append(s) d = Counter(a) maxx = max(d.values()) ans = [] for i in d: if d[i] == maxx: ans.append(i) ans.sort() for i in ans: print(i)
false
11.764706
[ "+import sys", "+", "+input = lambda: sys.stdin.readline().rstrip()" ]
false
0.102468
0.038157
2.685434
[ "s936262601", "s856915856" ]
u312025627
p02684
python
s726892345
s114244020
138
94
124,580
92,536
Accepted
Accepted
31.88
def main(): N, K = (int(i) for i in input().split()) A = [int(i) for i in input().split()] d = [] d_set = set() s = 1 for _ in range(N): if s in d_set: if K < len(d): return print(d[K]) idx = d.index(s) K -= idx ...
def main(): N, K = (int(i) for i in input().split()) A = [int(i) for i in input().split()] d = [-1]*(N+1) v = 1 i = 0 while d[v] == -1: d[v] = i v = A[v-1] i += 1 c_length = i - d[v] # 閉路長 pre_c_length = d[v] if K < i: return print(d.inde...
25
22
515
478
def main(): N, K = (int(i) for i in input().split()) A = [int(i) for i in input().split()] d = [] d_set = set() s = 1 for _ in range(N): if s in d_set: if K < len(d): return print(d[K]) idx = d.index(s) K -= idx d = d[idx:] ...
def main(): N, K = (int(i) for i in input().split()) A = [int(i) for i in input().split()] d = [-1] * (N + 1) v = 1 i = 0 while d[v] == -1: d[v] = i v = A[v - 1] i += 1 c_length = i - d[v] # 閉路長 pre_c_length = d[v] if K < i: return print(d.index(K)) ...
false
12
[ "- d = []", "- d_set = set()", "- s = 1", "- for _ in range(N):", "- if s in d_set:", "- if K < len(d):", "- return print(d[K])", "- idx = d.index(s)", "- K -= idx", "- d = d[idx:]", "- break", "- d...
false
0.031375
0.036569
0.857951
[ "s726892345", "s114244020" ]
u315485238
p03674
python
s503833779
s955206994
847
412
31,328
29,340
Accepted
Accepted
51.36
n = int(eval(input())) A= list(map(int, input().split())) mod = int(1e9+7) def invmod(a, mod): if a==1: return 1 return -invmod(mod%a, mod) * (mod//a) %mod memo={} for i, a in enumerate(A): if a in memo: L = memo[a] C = i - memo[a] -1 R = len(A) - i-1 break else: ...
n = int(eval(input())) A= list(map(int, input().split())) mod = 10**9+7 class combinationmod(): def __init__(self,MAX, mod): self.mod =mod self.fac=[0]*(MAX+1) self.finv=[0]*(MAX+1) self.inv=[0]*(MAX+1) self.fac[0]=self.fac[1]=1 self.finv[0]=self.finv[1]=1 self.inv[1]=1 ...
57
36
1,169
881
n = int(eval(input())) A = list(map(int, input().split())) mod = int(1e9 + 7) def invmod(a, mod): if a == 1: return 1 return -invmod(mod % a, mod) * (mod // a) % mod memo = {} for i, a in enumerate(A): if a in memo: L = memo[a] C = i - memo[a] - 1 R = len(A) - i - 1 ...
n = int(eval(input())) A = list(map(int, input().split())) mod = 10**9 + 7 class combinationmod: def __init__(self, MAX, mod): self.mod = mod self.fac = [0] * (MAX + 1) self.finv = [0] * (MAX + 1) self.inv = [0] * (MAX + 1) self.fac[0] = self.fac[1] = 1 self.finv[0]...
false
36.842105
[ "-mod = int(1e9 + 7)", "+mod = 10**9 + 7", "-def invmod(a, mod):", "- if a == 1:", "- return 1", "- return -invmod(mod % a, mod) * (mod // a) % mod", "+class combinationmod:", "+ def __init__(self, MAX, mod):", "+ self.mod = mod", "+ self.fac = [0] * (MAX + 1)", "+ ...
false
0.03432
0.057277
0.599188
[ "s503833779", "s955206994" ]
u301624971
p03262
python
s488878257
s593187184
103
92
16,284
16,268
Accepted
Accepted
10.68
import fractions from functools import reduce def gcd_list(numbers): return reduce(fractions.gcd, numbers) N,X=list(map(int,input().split())) W=list(map(int,input().split())) ans=[] for i in W: ans.append(abs(i-X)) print((gcd_list(ans)))
import fractions from functools import reduce def gcd_list(numbers): return reduce(fractions.gcd, numbers) def myAnswer(N:int,X:int,x:list) -> int: ans = [] for a in x: ans.append(abs(a-X)) return gcd_list(ans) def modelAnswer(): return def main(): N,X = list(map(int,input().s...
13
22
253
435
import fractions from functools import reduce def gcd_list(numbers): return reduce(fractions.gcd, numbers) N, X = list(map(int, input().split())) W = list(map(int, input().split())) ans = [] for i in W: ans.append(abs(i - X)) print((gcd_list(ans)))
import fractions from functools import reduce def gcd_list(numbers): return reduce(fractions.gcd, numbers) def myAnswer(N: int, X: int, x: list) -> int: ans = [] for a in x: ans.append(abs(a - X)) return gcd_list(ans) def modelAnswer(): return def main(): N, X = list(map(int, inp...
false
40.909091
[ "-N, X = list(map(int, input().split()))", "-W = list(map(int, input().split()))", "-ans = []", "-for i in W:", "- ans.append(abs(i - X))", "-print((gcd_list(ans)))", "+def myAnswer(N: int, X: int, x: list) -> int:", "+ ans = []", "+ for a in x:", "+ ans.append(abs(a - X))", "+ ...
false
0.059044
0.055651
1.06096
[ "s488878257", "s593187184" ]
u670180528
p03163
python
s260398047
s646730574
465
48
119,916
3,188
Accepted
Accepted
89.68
N,W=list(map(int,input().split())) dp=[[0]*(W+1) for _ in range(N+1)] for i in range(1,N+1): w,v=list(map(int,input().split())) for j in range(1,W+1): if j-w>=0: dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v) else: dp[i][j]=dp[i-1][j] print((dp[N][W]))
from heapq import heappop, heappush from operator import itemgetter def branchAndBound(N: int, M: int, V: list, W: list, R: list) -> int: def upperbound(w, v, i): rest = M - w _v = v for j in range(i + 1, N): if W[j] >= rest: rest -= W[j] ...
10
48
252
1,367
N, W = list(map(int, input().split())) dp = [[0] * (W + 1) for _ in range(N + 1)] for i in range(1, N + 1): w, v = list(map(int, input().split())) for j in range(1, W + 1): if j - w >= 0: dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v) else: dp[i][j] = dp[i - 1][j] pri...
from heapq import heappop, heappush from operator import itemgetter def branchAndBound(N: int, M: int, V: list, W: list, R: list) -> int: def upperbound(w, v, i): rest = M - w _v = v for j in range(i + 1, N): if W[j] >= rest: rest -= W[j] v += V[...
false
79.166667
[ "-N, W = list(map(int, input().split()))", "-dp = [[0] * (W + 1) for _ in range(N + 1)]", "-for i in range(1, N + 1):", "- w, v = list(map(int, input().split()))", "- for j in range(1, W + 1):", "- if j - w >= 0:", "- dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v)", "- ...
false
0.095185
0.042279
2.251353
[ "s260398047", "s646730574" ]
u982591663
p02791
python
s622771363
s101622851
146
90
24,872
24,744
Accepted
Accepted
38.36
#C N = int(eval(input())) P = list(map(int, input().split())) ans = 0 min_num = 10**6 for i in range(N): min_num = min(min_num, P[i]) if min_num >= P[i]: ans += 1 print(ans)
N = int(eval(input())) P = list(map(int, input().split())) min_tmp = N+1 ans = 0 for p in P: if min_tmp >= p: ans += 1 min_tmp = p else: continue print(ans)
12
14
204
199
# C N = int(eval(input())) P = list(map(int, input().split())) ans = 0 min_num = 10**6 for i in range(N): min_num = min(min_num, P[i]) if min_num >= P[i]: ans += 1 print(ans)
N = int(eval(input())) P = list(map(int, input().split())) min_tmp = N + 1 ans = 0 for p in P: if min_tmp >= p: ans += 1 min_tmp = p else: continue print(ans)
false
14.285714
[ "-# C", "+min_tmp = N + 1", "-min_num = 10**6", "-for i in range(N):", "- min_num = min(min_num, P[i])", "- if min_num >= P[i]:", "+for p in P:", "+ if min_tmp >= p:", "+ min_tmp = p", "+ else:", "+ continue" ]
false
0.092503
0.044682
2.070251
[ "s622771363", "s101622851" ]
u642528832
p03361
python
s977286350
s394428035
34
30
9,144
9,148
Accepted
Accepted
11.76
h, w = list(map(int, input().split())) table = [list(eval(input())) for _ in range(h)] mx = [0, 1, 0, -1] my = [1, 0, -1, 0] for i in range(h): for j in range(w): if table[i][j] == "#": for k in range(4): tx, ty = j + mx[k], i + my[k] if 0 <= tx < w and...
h, w = list(map(int, input().split())) table = [list(eval(input())) for _ in range(h)] mx = [0, 1, 0, -1]#yとの兼ね合いで片方は0にして上下左右判定 my = [1, 0, -1, 0]#xとの兼ね合いで片方は0にして上下左右判定 for i in range(h): for j in range(w): if table[i][j] == "#": for k in range(4): tx = j + mx[k]#左右判定 ...
17
18
463
583
h, w = list(map(int, input().split())) table = [list(eval(input())) for _ in range(h)] mx = [0, 1, 0, -1] my = [1, 0, -1, 0] for i in range(h): for j in range(w): if table[i][j] == "#": for k in range(4): tx, ty = j + mx[k], i + my[k] if 0 <= tx < w and 0 <= ty < ...
h, w = list(map(int, input().split())) table = [list(eval(input())) for _ in range(h)] mx = [0, 1, 0, -1] # yとの兼ね合いで片方は0にして上下左右判定 my = [1, 0, -1, 0] # xとの兼ね合いで片方は0にして上下左右判定 for i in range(h): for j in range(w): if table[i][j] == "#": for k in range(4): tx = j + mx[k] # 左右判定 ...
false
5.555556
[ "-mx = [0, 1, 0, -1]", "-my = [1, 0, -1, 0]", "+mx = [0, 1, 0, -1] # yとの兼ね合いで片方は0にして上下左右判定", "+my = [1, 0, -1, 0] # xとの兼ね合いで片方は0にして上下左右判定", "- tx, ty = j + mx[k], i + my[k]", "- if 0 <= tx < w and 0 <= ty < h and table[ty][tx] == \"#\":", "+ tx = j + mx[k] ...
false
0.034042
0.036302
0.937746
[ "s977286350", "s394428035" ]
u708255304
p03212
python
s323766253
s873524061
93
76
2,940
4,340
Accepted
Accepted
18.28
N = int(eval(input())) def dfs(s): # 文字列 s で始まる七五三数の個数 if int(s) > N: return 0 ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら+1 for c in '753': ret += dfs(s + c) return ret print((dfs('0'))) # 本当はdfs('')と書きたいがint(s)でエラーを吐かないように仕方なく
N = int(eval(input())) num_list = [] def dfs(num, add_num): num *= 10 num += add_num if num > N: return num_list.append(num) dfs(num, 7) dfs(num, 5) dfs(num, 3) return num_list dfs(3, 3) dfs(3, 5) dfs(3, 7) dfs(5, 3) dfs(5, 5) dfs(5, 7) dfs(7, 3)...
13
43
295
559
N = int(eval(input())) def dfs(s): # 文字列 s で始まる七五三数の個数 if int(s) > N: return 0 ret = 1 if all(s.count(c) > 0 for c in "753") else 0 # s 自体が七五三数なら+1 for c in "753": ret += dfs(s + c) return ret print((dfs("0"))) # 本当はdfs('')と書きたいがint(s)でエラーを吐かないように仕方なく
N = int(eval(input())) num_list = [] def dfs(num, add_num): num *= 10 num += add_num if num > N: return num_list.append(num) dfs(num, 7) dfs(num, 5) dfs(num, 3) return num_list dfs(3, 3) dfs(3, 5) dfs(3, 7) dfs(5, 3) dfs(5, 5) dfs(5, 7) dfs(7, 3) dfs(7, 5) dfs(7, 7) ans = 0 t...
false
69.767442
[ "+num_list = []", "-def dfs(s): # 文字列 s で始まる七五三数の個数", "- if int(s) > N:", "- return 0", "- ret = 1 if all(s.count(c) > 0 for c in \"753\") else 0 # s 自体が七五三数なら+1", "- for c in \"753\":", "- ret += dfs(s + c)", "- return ret", "+def dfs(num, add_num):", "+ num *= 10",...
false
0.067755
0.067689
1.000971
[ "s323766253", "s873524061" ]
u759412327
p03721
python
s710545773
s764106631
494
323
28,640
5,736
Accepted
Accepted
34.62
N,K = list(map(int, input().split())) s = sorted([list(map(int, input().split())) for i in range(N)]) t = 0 while K>0: K-=s[t][1] t+=1 print((s[t-1][0]))
N,K = list(map(int,input().split())) num = (10**5+1)*[0] tot = 0 for n in range(N): a,b=list(map(int,input().split())) num[a]+=b for n in range(10**5+1): tot+=num[n] if K<=tot: print(n) break
9
13
163
210
N, K = list(map(int, input().split())) s = sorted([list(map(int, input().split())) for i in range(N)]) t = 0 while K > 0: K -= s[t][1] t += 1 print((s[t - 1][0]))
N, K = list(map(int, input().split())) num = (10**5 + 1) * [0] tot = 0 for n in range(N): a, b = list(map(int, input().split())) num[a] += b for n in range(10**5 + 1): tot += num[n] if K <= tot: print(n) break
false
30.769231
[ "-s = sorted([list(map(int, input().split())) for i in range(N)])", "-t = 0", "-while K > 0:", "- K -= s[t][1]", "- t += 1", "-print((s[t - 1][0]))", "+num = (10**5 + 1) * [0]", "+tot = 0", "+for n in range(N):", "+ a, b = list(map(int, input().split()))", "+ num[a] += b", "+for n ...
false
0.039746
0.039036
1.018192
[ "s710545773", "s764106631" ]
u077291787
p03993
python
s807415999
s612212719
136
56
22,500
14,008
Accepted
Accepted
58.82
# code-festival-2016-qualaB - 仲良しうさぎ / Friendly Rabbits def main(): N = int(eval(input())) A = tuple(map(int, input().split())) ans, cand = 0, set() for i, j in enumerate(A, 1): i, j = min(i, j), max(i, j) if (i, j) in cand: ans += 1 else: cand |...
# code-festival-2016-qualaB - 仲良しうさぎ / Friendly Rabbits # exhaustive search def main(): N = int(eval(input())) A = [0] + list(map(int, input().split())) ans = sum(i == A[j] for i, j in enumerate(A[1:], 1)) // 2 print(ans) if __name__ == "__main__": main()
16
11
384
281
# code-festival-2016-qualaB - 仲良しうさぎ / Friendly Rabbits def main(): N = int(eval(input())) A = tuple(map(int, input().split())) ans, cand = 0, set() for i, j in enumerate(A, 1): i, j = min(i, j), max(i, j) if (i, j) in cand: ans += 1 else: cand |= {(i, j)}...
# code-festival-2016-qualaB - 仲良しうさぎ / Friendly Rabbits # exhaustive search def main(): N = int(eval(input())) A = [0] + list(map(int, input().split())) ans = sum(i == A[j] for i, j in enumerate(A[1:], 1)) // 2 print(ans) if __name__ == "__main__": main()
false
31.25
[ "+# exhaustive search", "- A = tuple(map(int, input().split()))", "- ans, cand = 0, set()", "- for i, j in enumerate(A, 1):", "- i, j = min(i, j), max(i, j)", "- if (i, j) in cand:", "- ans += 1", "- else:", "- cand |= {(i, j)}", "+ A = [0] + ...
false
0.150926
0.101971
1.480088
[ "s807415999", "s612212719" ]
u119148115
p02534
python
s296597965
s860848335
77
70
61,960
61,868
Accepted
Accepted
9.09
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし def ...
import sys def I(): return int(sys.stdin.readline().rstrip()) K = I() ans = '' for _ in range(K): ans += 'ACL' print(ans)
17
9
560
136
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり def LI2(): return list(map(int, sys.stdin.readline().r...
import sys def I(): return int(sys.stdin.readline().rstrip()) K = I() ans = "" for _ in range(K): ans += "ACL" print(ans)
false
47.058824
[ "-", "-sys.setrecursionlimit(10**7)", "-def MI():", "- return list(map(int, sys.stdin.readline().rstrip().split()))", "-", "-", "-def LI():", "- return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり", "-", "-", "-def LI2():", "- return list(map(int, sys.stdin.readline()...
false
0.042722
0.037855
1.128586
[ "s296597965", "s860848335" ]
u865298224
p02819
python
s941589233
s947681010
195
18
7,576
2,940
Accepted
Accepted
90.77
def get_sieve_of_eratosthenes(n): if not isinstance(n, int): raise TypeError('n is int type.') if n < 2: raise ValueError('n is more than 2') prime = [2] limit = int(n**0.5) data = [i + 1 for i in range(2, n, 2)] while True: p = data[0] if limit <= p: ...
def is_prime(n): i = 2 while(i**2 <= n): if n % i == 0: return False i += 1 return True def main(): X = int(eval(input())) for x in range(X, 2*X): if is_prime(x): print(x) break if __name__ == "__main__": main()
28
20
637
314
def get_sieve_of_eratosthenes(n): if not isinstance(n, int): raise TypeError("n is int type.") if n < 2: raise ValueError("n is more than 2") prime = [2] limit = int(n**0.5) data = [i + 1 for i in range(2, n, 2)] while True: p = data[0] if limit <= p: ...
def is_prime(n): i = 2 while i**2 <= n: if n % i == 0: return False i += 1 return True def main(): X = int(eval(input())) for x in range(X, 2 * X): if is_prime(x): print(x) break if __name__ == "__main__": main()
false
28.571429
[ "-def get_sieve_of_eratosthenes(n):", "- if not isinstance(n, int):", "- raise TypeError(\"n is int type.\")", "- if n < 2:", "- raise ValueError(\"n is more than 2\")", "- prime = [2]", "- limit = int(n**0.5)", "- data = [i + 1 for i in range(2, n, 2)]", "- while Tru...
false
0.052825
0.040658
1.299243
[ "s941589233", "s947681010" ]
u606878291
p03309
python
s890764699
s613134256
273
174
49,444
49,584
Accepted
Accepted
36.26
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split(' ')))) i = np.arange(1, N + 1) b = int(np.median(sorted(A - i))) print((np.sum(np.abs(A - (i + b)))))
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split(' ')))) diff = A - (np.arange(N) + 1) diff.sort() if N % 2 == 0: median = (diff[N // 2] + diff[N // 2 - 1]) // 2 else: median = diff[N // 2] print((np.sum(np.abs(diff - median))))
9
14
189
280
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split(" ")))) i = np.arange(1, N + 1) b = int(np.median(sorted(A - i))) print((np.sum(np.abs(A - (i + b)))))
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split(" ")))) diff = A - (np.arange(N) + 1) diff.sort() if N % 2 == 0: median = (diff[N // 2] + diff[N // 2 - 1]) // 2 else: median = diff[N // 2] print((np.sum(np.abs(diff - median))))
false
35.714286
[ "-i = np.arange(1, N + 1)", "-b = int(np.median(sorted(A - i)))", "-print((np.sum(np.abs(A - (i + b)))))", "+diff = A - (np.arange(N) + 1)", "+diff.sort()", "+if N % 2 == 0:", "+ median = (diff[N // 2] + diff[N // 2 - 1]) // 2", "+else:", "+ median = diff[N // 2]", "+print((np.sum(np.abs(dif...
false
0.486502
0.27415
1.774584
[ "s890764699", "s613134256" ]
u968166680
p03329
python
s614804012
s683470587
173
144
9,448
9,192
Accepted
Accepted
16.76
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N = int(readline()) amt = [1] a = 6 while a <= N: amt.append(a) a *= 6 a = 9 while a <= ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def f(n, a): ans = 0 while n > 0: ans += n % a n //= a return ans def main(): N = int(readline()) an...
37
31
622
477
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): N = int(readline()) amt = [1] a = 6 while a <= N: amt.append(a) a *= 6 a = 9 while a <= N: amt.append(...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def f(n, a): ans = 0 while n > 0: ans += n % a n //= a return ans def main(): N = int(readline()) ans = INF for i in ran...
false
16.216216
[ "+def f(n, a):", "+ ans = 0", "+ while n > 0:", "+ ans += n % a", "+ n //= a", "+ return ans", "+", "+", "- amt = [1]", "- a = 6", "- while a <= N:", "- amt.append(a)", "- a *= 6", "- a = 9", "- while a <= N:", "- amt.append(a)...
false
0.115372
0.121073
0.952913
[ "s614804012", "s683470587" ]
u242518667
p03478
python
s291689588
s080112766
33
28
2,940
2,940
Accepted
Accepted
15.15
n,a,b=list(map(int,input().split())) ans=0 for i in range(1,n+1): if a<=sum(map(int,list(str(i))))<=b: ans+=i print(ans)
n,a,b=list(map(int,input().split())) print((sum(i for i in range(n+1) if a<=sum(map(int,str(i)))<=b)))
7
3
133
97
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): if a <= sum(map(int, list(str(i)))) <= b: ans += i print(ans)
n, a, b = list(map(int, input().split())) print((sum(i for i in range(n + 1) if a <= sum(map(int, str(i))) <= b)))
false
57.142857
[ "-ans = 0", "-for i in range(1, n + 1):", "- if a <= sum(map(int, list(str(i)))) <= b:", "- ans += i", "-print(ans)", "+print((sum(i for i in range(n + 1) if a <= sum(map(int, str(i))) <= b)))" ]
false
0.041986
0.150813
0.278397
[ "s291689588", "s080112766" ]
u368796742
p03798
python
s527225572
s611890427
458
234
6,788
6,928
Accepted
Accepted
48.91
n = int(input()) l = list(input()) def che(k): if l[k] == "o": if ans[k] == 1: if ans[k-1]*ans[(k+1)%n] == 1: return True else: return False else: if ans[k-1]*ans[(k+1)%n] == -1: return True ...
n = int(input()) l = list(input()) l += l[0] check = [[1,1],[1,-1],[-1,1],[-1,-1]] for j,k in check: ans=[j,k] for i in range(1,n+1): if ans[i] == 1: if l[i] == "o": ans.append(ans[i-1]) else: ans.append(-ans[i-1]) ...
62
32
1,401
694
n = int(input()) l = list(input()) def che(k): if l[k] == "o": if ans[k] == 1: if ans[k - 1] * ans[(k + 1) % n] == 1: return True else: return False else: if ans[k - 1] * ans[(k + 1) % n] == -1: return True ...
n = int(input()) l = list(input()) l += l[0] check = [[1, 1], [1, -1], [-1, 1], [-1, -1]] for j, k in check: ans = [j, k] for i in range(1, n + 1): if ans[i] == 1: if l[i] == "o": ans.append(ans[i - 1]) else: ans.append(-ans[i - 1]) else: ...
false
48.387097
[ "-", "-", "-def che(k):", "- if l[k] == \"o\":", "- if ans[k] == 1:", "- if ans[k - 1] * ans[(k + 1) % n] == 1:", "- return True", "- else:", "- return False", "- else:", "- if ans[k - 1] * ans[(k + 1) % n] == -1:", ...
false
0.035032
0.035035
0.999912
[ "s527225572", "s611890427" ]
u296518383
p03607
python
s352760061
s867470028
231
96
19,816
16,620
Accepted
Accepted
58.44
import collections N=int(eval(input())) A=[int(eval(input())) for _ in range(N)] A=collections.Counter(A) A=list(A.items()) ans=0 for a in A: if a[1]%2==1: ans+=1 print(ans)
import sys input = sys.stdin.buffer.readline from collections import defaultdict N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] cnt = defaultdict(int) for a in A: if cnt[a]: cnt[a] = 0 else: cnt[a] = 1 print((sum(cnt.values())))
12
16
180
276
import collections N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] A = collections.Counter(A) A = list(A.items()) ans = 0 for a in A: if a[1] % 2 == 1: ans += 1 print(ans)
import sys input = sys.stdin.buffer.readline from collections import defaultdict N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] cnt = defaultdict(int) for a in A: if cnt[a]: cnt[a] = 0 else: cnt[a] = 1 print((sum(cnt.values())))
false
25
[ "-import collections", "+import sys", "+", "+input = sys.stdin.buffer.readline", "+from collections import defaultdict", "-A = collections.Counter(A)", "-A = list(A.items())", "-ans = 0", "+cnt = defaultdict(int)", "- if a[1] % 2 == 1:", "- ans += 1", "-print(ans)", "+ if cnt[a]...
false
0.044739
0.037312
1.199061
[ "s352760061", "s867470028" ]
u225020286
p02947
python
s601228695
s104845520
405
320
41,116
26,960
Accepted
Accepted
20.99
import collections N=int(eval(input())) S=[list(eval(input())) for i in range(N)] x=[] ans=0 for i in S: a=sorted(i) a="".join(a) x.append(a) x=collections.Counter(x) for i in list(x.values()): ans+=i*(i-1)/2 print((int(ans)))
import collections N=int(eval(input())) s=[eval(input()) for i in range(N)] S=[] ans=0 for i in s: a=sorted(i) a="".join(a) S.append(a) c=collections.Counter(S) d=list(map(int,list(c.values()))) for i in d: ans+=i*(i-1)/2 print((int(ans)))
14
15
236
245
import collections N = int(eval(input())) S = [list(eval(input())) for i in range(N)] x = [] ans = 0 for i in S: a = sorted(i) a = "".join(a) x.append(a) x = collections.Counter(x) for i in list(x.values()): ans += i * (i - 1) / 2 print((int(ans)))
import collections N = int(eval(input())) s = [eval(input()) for i in range(N)] S = [] ans = 0 for i in s: a = sorted(i) a = "".join(a) S.append(a) c = collections.Counter(S) d = list(map(int, list(c.values()))) for i in d: ans += i * (i - 1) / 2 print((int(ans)))
false
6.666667
[ "-S = [list(eval(input())) for i in range(N)]", "-x = []", "+s = [eval(input()) for i in range(N)]", "+S = []", "-for i in S:", "+for i in s:", "- x.append(a)", "-x = collections.Counter(x)", "-for i in list(x.values()):", "+ S.append(a)", "+c = collections.Counter(S)", "+d = list(map(in...
false
0.170584
0.087751
1.943961
[ "s601228695", "s104845520" ]
u426534722
p02279
python
s279624091
s971870683
660
560
34,844
34,520
Accepted
Accepted
15.15
import sys readline = sys.stdin.readline class Tree: __slots__ = ['id', 'p', 'depth', 'type', 'c'] def __init__(self): self.id = 0 self.p = -1 self.depth = -1 self.type = "leaf" self.c = [] def __str__(self): return f"node {self.id}: parent = {self....
import sys readline = sys.stdin.readline class Tree: __slots__ = ['id', 'p', 'depth', 'type', 'c'] def __init__(self, id): self.id = id self.p = -1 self.depth = -1 self.type = "leaf" self.c = [] def __str__(self): return f"node {self.id}: parent = {...
41
35
962
920
import sys readline = sys.stdin.readline class Tree: __slots__ = ["id", "p", "depth", "type", "c"] def __init__(self): self.id = 0 self.p = -1 self.depth = -1 self.type = "leaf" self.c = [] def __str__(self): return f"node {self.id}: parent = {self.p}, de...
import sys readline = sys.stdin.readline class Tree: __slots__ = ["id", "p", "depth", "type", "c"] def __init__(self, id): self.id = id self.p = -1 self.depth = -1 self.type = "leaf" self.c = [] def __str__(self): return f"node {self.id}: parent = {self.p...
false
14.634146
[ "- def __init__(self):", "- self.id = 0", "+ def __init__(self, id):", "+ self.id = id", "-li = tuple(Tree() for _ in range(n))", "+li = tuple(Tree(i) for i in range(n))", "- if k == 0:", "- c = []", "- else:", "+ if k != 0:", "- li[id].id = id", "- li...
false
0.049997
0.048304
1.035039
[ "s279624091", "s971870683" ]
u602500004
p02684
python
s063511731
s128338971
386
197
202,428
32,520
Accepted
Accepted
48.96
import bisect,collections,copy,heapq,itertools,math,string from collections import defaultdict as D from functools import reduce import numpy as np import sys import os from operator import mul sys.setrecursionlimit(10**7) def _S(): return sys.stdin.readline().rstrip() def I(): return int(_S()) def LS(): ...
import math import sys import os from operator import mul sys.setrecursionlimit(10**7) def _S(): return sys.stdin.readline().rstrip() def I(): return int(_S()) def LS(): return list(_S().split()) def LI(): return list(map(int,LS())) if os.getenv("LOCAL"): inputFile = basename_without_ext = os.path.s...
55
57
1,276
1,098
import bisect, collections, copy, heapq, itertools, math, string from collections import defaultdict as D from functools import reduce import numpy as np import sys import os from operator import mul sys.setrecursionlimit(10**7) def _S(): return sys.stdin.readline().rstrip() def I(): return int(_S()) def...
import math import sys import os from operator import mul sys.setrecursionlimit(10**7) def _S(): return sys.stdin.readline().rstrip() def I(): return int(_S()) def LS(): return list(_S().split()) def LI(): return list(map(int, LS())) if os.getenv("LOCAL"): inputFile = basename_without_ext...
false
3.508772
[ "-import bisect, collections, copy, heapq, itertools, math, string", "-from collections import defaultdict as D", "-from functools import reduce", "-import numpy as np", "+import math", "-# k: number of transfer", "+INF = float(\"inf\")", "-# 街の番号を0始まりに変更", "-# print(a)", "-s = set([0])", "-# 再帰...
false
0.064543
0.046668
1.383027
[ "s063511731", "s128338971" ]
u011062360
p02803
python
s043947866
s377148722
396
233
3,316
9,248
Accepted
Accepted
41.16
from collections import deque def bfs(h, w, s, sx, sy): dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] d = [[-1] * w for _ in range(h)] d[sx][sy] = 0 que = deque() que.append((sx, sy)) while que: x, y = que.popleft() for i in range(4): nx = x + dx[i] ...
h, w = list(map(int, input().split())) ma = [ list(eval(input())) for _ in range(h) ] d = [(1, 0), (-1, 0), (0, 1), (0, -1)] ans = 0 def bfs(sy, sx): if ma[sy][sx] == "#": return 0 q = [[sy, sx, 0]] flag = [[0] * w for _ in range(h)] flag[sy][sx] = 1 ans = 0 while True: ...
39
30
879
770
from collections import deque def bfs(h, w, s, sx, sy): dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] d = [[-1] * w for _ in range(h)] d[sx][sy] = 0 que = deque() que.append((sx, sy)) while que: x, y = que.popleft() for i in range(4): nx = x + dx[i] ny = y +...
h, w = list(map(int, input().split())) ma = [list(eval(input())) for _ in range(h)] d = [(1, 0), (-1, 0), (0, 1), (0, -1)] ans = 0 def bfs(sy, sx): if ma[sy][sx] == "#": return 0 q = [[sy, sx, 0]] flag = [[0] * w for _ in range(h)] flag[sy][sx] = 1 ans = 0 while True: if len(q)...
false
23.076923
[ "-from collections import deque", "+h, w = list(map(int, input().split()))", "+ma = [list(eval(input())) for _ in range(h)]", "+d = [(1, 0), (-1, 0), (0, 1), (0, -1)]", "+ans = 0", "-def bfs(h, w, s, sx, sy):", "- dx = [1, 0, -1, 0]", "- dy = [0, 1, 0, -1]", "- d = [[-1] * w for _ in range(...
false
0.1494
0.129012
1.158027
[ "s043947866", "s377148722" ]