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
u606090886
p02989
python
s373709386
s742562643
835
76
14,556
14,396
Accepted
Accepted
90.9
n = int(eval(input())) d = list(map(int,input().split())) d.sort() while len(d) > 0: x = d.pop() y = d.pop(0) print((x - y))
n = int(eval(input())) d = list(map(int,input().split())) d.sort() h = len(d)//2 x = d[h] y = d[h - 1] print((x - y))
7
7
138
116
n = int(eval(input())) d = list(map(int, input().split())) d.sort() while len(d) > 0: x = d.pop() y = d.pop(0) print((x - y))
n = int(eval(input())) d = list(map(int, input().split())) d.sort() h = len(d) // 2 x = d[h] y = d[h - 1] print((x - y))
false
0
[ "-while len(d) > 0:", "- x = d.pop()", "- y = d.pop(0)", "+h = len(d) // 2", "+x = d[h]", "+y = d[h - 1]" ]
false
0.082499
0.03438
2.399627
[ "s373709386", "s742562643" ]
u803848678
p03525
python
s947761312
s490534460
207
186
40,944
40,304
Accepted
Accepted
10.14
n = int(eval(input())) d = list(map(int, input().split())) h = [0]*13 for i in d: h[i] += 1 ans = 0 def rec(now, state): global ans if now == 13: state.sort() m = float("Inf") for i in range(len(state)): m = min(m, min(abs(state[i-1]-state[i]), 24-abs(state[...
n = int(eval(input())) a = [0]*13 for i in map(int, input().split()): a[i] += 1 ans = 0 if any(i>2 for i in a) or a[0] or a[12]>1: pass else: s = [[0]] for i in range(1, 13): nxt = [] if a[i] == 0: nxt = s elif a[i] == 1: for si in s: ...
41
31
1,004
720
n = int(eval(input())) d = list(map(int, input().split())) h = [0] * 13 for i in d: h[i] += 1 ans = 0 def rec(now, state): global ans if now == 13: state.sort() m = float("Inf") for i in range(len(state)): m = min( m, min(abs(state[i - 1] - state[i]), 24...
n = int(eval(input())) a = [0] * 13 for i in map(int, input().split()): a[i] += 1 ans = 0 if any(i > 2 for i in a) or a[0] or a[12] > 1: pass else: s = [[0]] for i in range(1, 13): nxt = [] if a[i] == 0: nxt = s elif a[i] == 1: for si in s: ...
false
24.390244
[ "-d = list(map(int, input().split()))", "-h = [0] * 13", "-for i in d:", "- h[i] += 1", "+a = [0] * 13", "+for i in map(int, input().split()):", "+ a[i] += 1", "-", "-", "-def rec(now, state):", "- global ans", "- if now == 13:", "- state.sort()", "- m = float(\"I...
false
0.057186
0.039069
1.463697
[ "s947761312", "s490534460" ]
u489959379
p03565
python
s826705707
s328886888
23
17
3,444
3,064
Accepted
Accepted
26.09
import copy s = eval(input()) t = eval(input()) n = len(t) ans = set() flg = False for i in range(len(s)): tmp = s[i: i + n] for j in range(n): try: if tmp[j] != "?" and tmp[j] != t[j]: flg = False break else: flg ...
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): s = eval(input()) t = eval(input()) n = len(s) res = [] for i in range(n): ss = list(s) if (s[i] == t[0] or s[i] == "?") and i + len(t) <= n: pos = 0 ...
34
38
727
857
import copy s = eval(input()) t = eval(input()) n = len(t) ans = set() flg = False for i in range(len(s)): tmp = s[i : i + n] for j in range(n): try: if tmp[j] != "?" and tmp[j] != t[j]: flg = False break else: flg = True e...
import sys sys.setrecursionlimit(10**7) f_inf = float("inf") mod = 10**9 + 7 def resolve(): s = eval(input()) t = eval(input()) n = len(s) res = [] for i in range(n): ss = list(s) if (s[i] == t[0] or s[i] == "?") and i + len(t) <= n: pos = 0 for j in range(...
false
10.526316
[ "-import copy", "+import sys", "-s = eval(input())", "-t = eval(input())", "-n = len(t)", "-ans = set()", "-flg = False", "-for i in range(len(s)):", "- tmp = s[i : i + n]", "- for j in range(n):", "- try:", "- if tmp[j] != \"?\" and tmp[j] != t[j]:", "- ...
false
0.041863
0.037874
1.105314
[ "s826705707", "s328886888" ]
u695811449
p03847
python
s725438402
s407398317
20
18
3,064
3,064
Accepted
Accepted
10
N=int(eval(input())) mod=10**9+7 ANSLIST=[1] for i in range(61): ANSLIST.append((ANSLIST[-1]*3-1)%mod) ANS=[1, 2, 4, 5] ANSDICT=dict() def ans(k): if 0<=k<=3: return ANS[k] if ANSDICT.get(k)!=None: return ANSDICT[k] for i in range(61): if k==2**i-2: ...
import sys sys.setrecursionlimit(10**9) N=int(eval(input())) mod=10**9+7 DP=dict() DP[(0,0)]=1#a+b,a^b DP[(1,0)]=1 DP[(1,1)]=2 def ans(S,X): #print(S,X) if DP.get((S,X))!=None: return DP[(S,X)] if S==0: return 1 #if X>S: # return ans(S,S) DP[(S,X)]=...
27
26
558
556
N = int(eval(input())) mod = 10**9 + 7 ANSLIST = [1] for i in range(61): ANSLIST.append((ANSLIST[-1] * 3 - 1) % mod) ANS = [1, 2, 4, 5] ANSDICT = dict() def ans(k): if 0 <= k <= 3: return ANS[k] if ANSDICT.get(k) != None: return ANSDICT[k] for i in range(61): if k == 2**i - 2: ...
import sys sys.setrecursionlimit(10**9) N = int(eval(input())) mod = 10**9 + 7 DP = dict() DP[(0, 0)] = 1 # a+b,a^b DP[(1, 0)] = 1 DP[(1, 1)] = 2 def ans(S, X): # print(S,X) if DP.get((S, X)) != None: return DP[(S, X)] if S == 0: return 1 # if X>S: # return ans(S,S) DP[(S,...
false
3.703704
[ "+import sys", "+", "+sys.setrecursionlimit(10**9)", "-ANSLIST = [1]", "-for i in range(61):", "- ANSLIST.append((ANSLIST[-1] * 3 - 1) % mod)", "-ANS = [1, 2, 4, 5]", "-ANSDICT = dict()", "+DP = dict()", "+DP[(0, 0)] = 1 # a+b,a^b", "+DP[(1, 0)] = 1", "+DP[(1, 1)] = 2", "-def ans(k):", ...
false
0.249291
0.041599
5.992705
[ "s725438402", "s407398317" ]
u912237403
p02264
python
s307502598
s808995947
740
620
13,496
29,352
Accepted
Accepted
16.22
n, q = list(map(int, input().split())) que = [] for i in range(n): name, time = input().split() que.append([name, int(time)]) stime = 0 while que: job = que.pop(0) if job[1]<=q: stime += job[1] print(job[0], stime) else: stime += q job[1] -= q ...
import sys class Queue: class Cell: def __init__(self, x, y = None): self.data = x self.next = y def __init__(self): self.size = 0 self.rear = None def enqueue(self, x): if self.size == 0: self.rear = Queue.Cell(x) ...
17
56
338
1,271
n, q = list(map(int, input().split())) que = [] for i in range(n): name, time = input().split() que.append([name, int(time)]) stime = 0 while que: job = que.pop(0) if job[1] <= q: stime += job[1] print(job[0], stime) else: stime += q job[1] -= q que.append(job...
import sys class Queue: class Cell: def __init__(self, x, y=None): self.data = x self.next = y def __init__(self): self.size = 0 self.rear = None def enqueue(self, x): if self.size == 0: self.rear = Queue.Cell(x) self.rear.n...
false
69.642857
[ "+import sys", "+", "+", "+class Queue:", "+ class Cell:", "+ def __init__(self, x, y=None):", "+ self.data = x", "+ self.next = y", "+", "+ def __init__(self):", "+ self.size = 0", "+ self.rear = None", "+", "+ def enqueue(self, x):", ...
false
0.067427
0.036611
1.841747
[ "s307502598", "s808995947" ]
u875361824
p03243
python
s443394303
s196521267
29
17
3,316
3,060
Accepted
Accepted
41.38
def main(): N = int(eval(input())) for i in range(N, 999+1): if len(set(list(str(i)))) == 1: print(i) return if __name__ == '__main__': main()
def main(): N = int(eval(input())) ans1 = AC1(N) ans2 = AC2(N) assert ans1 == ans2 print(ans1) def AC1(N): for i in range(N, 999+1): if len(set(list(str(i)))) == 1: return i def AC2(N): for i in range(1, 9+1): if N <= 111 * i: ...
11
24
194
373
def main(): N = int(eval(input())) for i in range(N, 999 + 1): if len(set(list(str(i)))) == 1: print(i) return if __name__ == "__main__": main()
def main(): N = int(eval(input())) ans1 = AC1(N) ans2 = AC2(N) assert ans1 == ans2 print(ans1) def AC1(N): for i in range(N, 999 + 1): if len(set(list(str(i)))) == 1: return i def AC2(N): for i in range(1, 9 + 1): if N <= 111 * i: return 111 * i ...
false
54.166667
[ "+ ans1 = AC1(N)", "+ ans2 = AC2(N)", "+ assert ans1 == ans2", "+ print(ans1)", "+", "+", "+def AC1(N):", "- print(i)", "- return", "+ return i", "+", "+", "+def AC2(N):", "+ for i in range(1, 9 + 1):", "+ if N <= 111 * i:", "+ ...
false
0.035671
0.036927
0.965982
[ "s443394303", "s196521267" ]
u761320129
p02873
python
s488465495
s013358025
351
184
4,212
6,300
Accepted
Accepted
47.58
S = eval(input()) i = 0 ans = 0 l = r = 0 while i < len(S) and S[i] == '>': l += 1 i += 1 ans += l*(l+1)//2 while i < len(S): l = r = 0 while i < len(S) and S[i] == '<': l += 1 i += 1 while i < len(S) and S[i] == '>': r += 1 i += 1 mx,mn = max(...
S = eval(input()) ls = [] rs = [] if S[0] == '>': ls.append(0) pre = None seq = 0 for c in S: if c == pre: seq += 1 else: if pre: if pre=='<': ls.append(seq) else: rs.append(seq) seq = 1 pre = c if pre=...
22
30
390
513
S = eval(input()) i = 0 ans = 0 l = r = 0 while i < len(S) and S[i] == ">": l += 1 i += 1 ans += l * (l + 1) // 2 while i < len(S): l = r = 0 while i < len(S) and S[i] == "<": l += 1 i += 1 while i < len(S) and S[i] == ">": r += 1 i += 1 mx, mn = max(l, r), min(l,...
S = eval(input()) ls = [] rs = [] if S[0] == ">": ls.append(0) pre = None seq = 0 for c in S: if c == pre: seq += 1 else: if pre: if pre == "<": ls.append(seq) else: rs.append(seq) seq = 1 pre = c if pre == "<": ls.a...
false
26.666667
[ "-i = 0", "+ls = []", "+rs = []", "+if S[0] == \">\":", "+ ls.append(0)", "+pre = None", "+seq = 0", "+for c in S:", "+ if c == pre:", "+ seq += 1", "+ else:", "+ if pre:", "+ if pre == \"<\":", "+ ls.append(seq)", "+ else:", ...
false
0.042282
0.081525
0.518636
[ "s488465495", "s013358025" ]
u861109991
p02727
python
s349956331
s013451846
449
253
34,004
24,864
Accepted
Accepted
43.65
import numpy as np x, y, a, b, c = list(map(int, input().split())) p = sorted(list(map(int, input().split()))) q = sorted(list(map(int, input().split()))) r = sorted(list(map(int, input().split()))) filt_p = p[-x:] filt_q = q[-y:] filt_p.extend(filt_q) filt_p.extend(r) all_apples = sorted(filt_p) ans = np...
x, y, a, b, c = list(map(int, input().split())) p = sorted(list(map(int, input().split()))) q = sorted(list(map(int, input().split()))) r = sorted(list(map(int, input().split()))) filt_p = p[-x:] filt_q = q[-y:] filt_p.extend(filt_q) filt_p.extend(r) all_apples = sorted(filt_p) ans = sum(all_apples[-x-y:])...
15
14
366
334
import numpy as np x, y, a, b, c = list(map(int, input().split())) p = sorted(list(map(int, input().split()))) q = sorted(list(map(int, input().split()))) r = sorted(list(map(int, input().split()))) filt_p = p[-x:] filt_q = q[-y:] filt_p.extend(filt_q) filt_p.extend(r) all_apples = sorted(filt_p) ans = np.sum(np.array...
x, y, a, b, c = list(map(int, input().split())) p = sorted(list(map(int, input().split()))) q = sorted(list(map(int, input().split()))) r = sorted(list(map(int, input().split()))) filt_p = p[-x:] filt_q = q[-y:] filt_p.extend(filt_q) filt_p.extend(r) all_apples = sorted(filt_p) ans = sum(all_apples[-x - y :]) print((st...
false
6.666667
[ "-import numpy as np", "-", "-ans = np.sum(np.array(all_apples)[-x - y :])", "+ans = sum(all_apples[-x - y :])" ]
false
0.304141
0.084857
3.584177
[ "s349956331", "s013451846" ]
u936985471
p02901
python
s987138786
s163990262
1,991
1,067
3,188
3,188
Accepted
Accepted
46.41
n,m=list(map(int,input().split())) cost=[0]*m keys=[0]*m for i in range(m): a,b=list(map(int,input().split())) cost[i]=a k=list(map(int,input().split())) for j in range(b): keys[i]|=(1<<(k[j]-1)) INF=10**9+1 dp=[INF]*(2**n) dp[0]=0 for i in range(len(keys)): for j in range(len(dp)-1,-1,-1):...
n,m=list(map(int,input().split())) cost=[0]*m keys=[0]*m for i in range(m): a,b=list(map(int,input().split())) cost[i]=a k=list(map(int,input().split())) for j in range(b): keys[i]|=(1<<(k[j]-1)) INF=10**9+1 dp=[INF]*(2**n) dp[0]=0 for i in range(len(keys)): for j in range(len(dp)-1,-1,-1):...
21
23
436
460
n, m = list(map(int, input().split())) cost = [0] * m keys = [0] * m for i in range(m): a, b = list(map(int, input().split())) cost[i] = a k = list(map(int, input().split())) for j in range(b): keys[i] |= 1 << (k[j] - 1) INF = 10**9 + 1 dp = [INF] * (2**n) dp[0] = 0 for i in range(len(keys)): ...
n, m = list(map(int, input().split())) cost = [0] * m keys = [0] * m for i in range(m): a, b = list(map(int, input().split())) cost[i] = a k = list(map(int, input().split())) for j in range(b): keys[i] |= 1 << (k[j] - 1) INF = 10**9 + 1 dp = [INF] * (2**n) dp[0] = 0 for i in range(len(keys)): ...
false
8.695652
[ "- dp[j | keys[i]] = min(dp[j | keys[i]], dp[j] + cost[i])", "+ if dp[j | keys[i]] > dp[j] + cost[i]:", "+ dp[j | keys[i]] = dp[j] + cost[i]" ]
false
0.087313
0.075906
1.150276
[ "s987138786", "s163990262" ]
u989962753
p03370
python
s204782853
s258082921
45
17
3,064
3,064
Accepted
Accepted
62.22
n, x = input().split() n = int(n) x = int(x) m = [] i_min = 0 result = 0 #リストに値を読み込み for i in range(n): m.append(int(eval(input()))) #一個ずつ作る for i in range(len(m)): x = x - m[i] result = result + 1 #最小量の粉量を確定 for i in range(len(m)): if m[i_min] > m[i]: i_min = i #i_minを作れるだけ作る for i in ran...
#定義 n, x = input().split() n = int(n) x = int(x) m = [] i_min = 0 gokei = 0 #リストに数値を読み込み for i in range(n): m.append(int(eval(input()))) #一個ずつの合計 for i in range(len(m)): gokei = gokei + m[i] if m[i_min] > m[i]: i_min = i #残量を出す x = x - gokei print((n + int(x/m[i_min])))
26
18
431
289
n, x = input().split() n = int(n) x = int(x) m = [] i_min = 0 result = 0 # リストに値を読み込み for i in range(n): m.append(int(eval(input()))) # 一個ずつ作る for i in range(len(m)): x = x - m[i] result = result + 1 # 最小量の粉量を確定 for i in range(len(m)): if m[i_min] > m[i]: i_min = i # i_minを作れるだけ作る for i in range...
# 定義 n, x = input().split() n = int(n) x = int(x) m = [] i_min = 0 gokei = 0 # リストに数値を読み込み for i in range(n): m.append(int(eval(input()))) # 一個ずつの合計 for i in range(len(m)): gokei = gokei + m[i] if m[i_min] > m[i]: i_min = i # 残量を出す x = x - gokei print((n + int(x / m[i_min])))
false
30.769231
[ "+# 定義", "-result = 0", "-# リストに値を読み込み", "+gokei = 0", "+# リストに数値を読み込み", "-# 一個ずつ作る", "+# 一個ずつの合計", "- x = x - m[i]", "- result = result + 1", "-# 最小量の粉量を確定", "-for i in range(len(m)):", "+ gokei = gokei + m[i]", "-# i_minを作れるだけ作る", "-for i in range(x):", "- if x >= m[i_min]:...
false
0.037992
0.0384
0.989386
[ "s204782853", "s258082921" ]
u729133443
p02763
python
s167836915
s147643770
661
329
257,212
57,620
Accepted
Accepted
50.23
def main(): import sys input=sys.stdin.buffer.readline n=int(eval(input()))+1 data=[[0]*n*2for _ in range(26)] def update(i,x): i+=n for d in data: j=i if d[j]: d[j]=0 j//=2 while j: d[j]=d[j+j]|d[j-~j] j//=2 break d=d...
def main(): import sys input=sys.stdin.buffer.readline n=int(eval(input()))+1 data=[0]*n*2 def update(i,x): i+=n data[i]=x i//=2 while i: data[i]=data[i*2]|data[i*2+1] i//=2 def query(l,r): l+=n r+=n s=0 while l<r: if l&1: s|=data[l...
52
35
1,026
740
def main(): import sys input = sys.stdin.buffer.readline n = int(eval(input())) + 1 data = [[0] * n * 2 for _ in range(26)] def update(i, x): i += n for d in data: j = i if d[j]: d[j] = 0 j //= 2 while j: ...
def main(): import sys input = sys.stdin.buffer.readline n = int(eval(input())) + 1 data = [0] * n * 2 def update(i, x): i += n data[i] = x i //= 2 while i: data[i] = data[i * 2] | data[i * 2 + 1] i //= 2 def query(l, r): l += n ...
false
32.692308
[ "- data = [[0] * n * 2 for _ in range(26)]", "+ data = [0] * n * 2", "- for d in data:", "- j = i", "- if d[j]:", "- d[j] = 0", "- j //= 2", "- while j:", "- d[j] = d[j + j] | d[j - ~j]", "- ...
false
0.04653
0.037942
1.226353
[ "s167836915", "s147643770" ]
u852690916
p03356
python
s296007967
s956220015
490
418
13,876
61,584
Accepted
Accepted
14.69
import sys def main(): input = sys.stdin.readline N, M = list(map(int, input().split())) P = list([int(x)-1 for x in input().split()]) uf = UnionFindTree(N) for _ in range(M): x,y = list(map(int, input().split())) uf.union(x-1,y-1) ind = [-1] * N for i in ra...
import sys def main(): input = sys.stdin.readline N,M=list(map(int, input().split())) *P,=list(map(int, input().split())) P=[-1]+P uf=UnionFindTree(N+1) for _ in range(M): x,y=list(map(int, input().split())) uf.union(P[x],P[y]) ans=0 for i in range(1,N+1): ...
42
35
1,032
908
import sys def main(): input = sys.stdin.readline N, M = list(map(int, input().split())) P = list([int(x) - 1 for x in input().split()]) uf = UnionFindTree(N) for _ in range(M): x, y = list(map(int, input().split())) uf.union(x - 1, y - 1) ind = [-1] * N for i in range(N): ...
import sys def main(): input = sys.stdin.readline N, M = list(map(int, input().split())) (*P,) = list(map(int, input().split())) P = [-1] + P uf = UnionFindTree(N + 1) for _ in range(M): x, y = list(map(int, input().split())) uf.union(P[x], P[y]) ans = 0 for i in range(...
false
16.666667
[ "- P = list([int(x) - 1 for x in input().split()])", "- uf = UnionFindTree(N)", "+ (*P,) = list(map(int, input().split()))", "+ P = [-1] + P", "+ uf = UnionFindTree(N + 1)", "- uf.union(x - 1, y - 1)", "- ind = [-1] * N", "- for i in range(N):", "- ind[P[i]] = i", ...
false
0.088023
0.049166
1.790311
[ "s296007967", "s956220015" ]
u989345508
p03732
python
s109478185
s122122032
390
214
3,192
3,188
Accepted
Accepted
45.13
n,w=list(map(int,input().split())) wv=[list(map(int,input().split())) for i in range(n)] wv.sort(key=lambda x:-x[1]) wv.sort(key=lambda x:x[0]) #print(wv) w0=wv[0][0] x=[[0],[0],[0],[0]] for i in range(n): if wv[i][0]==w0: k=wv[i][1]+x[0][-1] l=len(x[0]) if l*w0<=w:x[0].append(k) ...
n,w=list(map(int,input().split())) wv=[list(map(int,input().split())) for i in range(n)] wv.sort(key=lambda x:-x[1]) wv.sort(key=lambda x:x[0]) #print(wv) w0=wv[0][0] x=[[0],[0],[0],[0]] for i in range(n): if wv[i][0]==w0: k=wv[i][1]+x[0][-1] l=len(x[0]) if l*w0<=w:x[0].append(k) ...
38
40
1,073
1,131
n, w = list(map(int, input().split())) wv = [list(map(int, input().split())) for i in range(n)] wv.sort(key=lambda x: -x[1]) wv.sort(key=lambda x: x[0]) # print(wv) w0 = wv[0][0] x = [[0], [0], [0], [0]] for i in range(n): if wv[i][0] == w0: k = wv[i][1] + x[0][-1] l = len(x[0]) if l * w0 <=...
n, w = list(map(int, input().split())) wv = [list(map(int, input().split())) for i in range(n)] wv.sort(key=lambda x: -x[1]) wv.sort(key=lambda x: x[0]) # print(wv) w0 = wv[0][0] x = [[0], [0], [0], [0]] for i in range(n): if wv[i][0] == w0: k = wv[i][1] + x[0][-1] l = len(x[0]) if l * w0 <=...
false
5
[ "- ma_sub = 0", "+ ma_sub = 0", "- ma = max(ma, ma_sub)", "+ ma = max(ma, ma_sub)", "+ else:", "+ break" ]
false
0.147182
0.085914
1.713133
[ "s109478185", "s122122032" ]
u911153222
p03162
python
s651357234
s824586717
461
290
22,796
22,772
Accepted
Accepted
37.09
def vacation(): n = int(eval(input())) dp = [[]]*n for i in range(n): a, b, c = list(map(int, input().split())) if i == 0: dp[i] = [a, b, c] else: dp[i] = [a + max(dp[i-1][1], dp[i-1][2]), b + max(dp[i-1][0], dp[i-1][2]), c + max(dp[i-1][0], dp[i-1][1]...
import sys input = sys.stdin.readline def vacation(): n = int(eval(input())) dp = [[]]*n for i in range(n): a, b, c = list(map(int, input().split())) if i == 0: dp[i] = [a, b, c] else: dp[i] = [a + max(dp[i-1][1], dp[i-1][2]), b + max(dp[i-1][0],...
14
18
383
427
def vacation(): n = int(eval(input())) dp = [[]] * n for i in range(n): a, b, c = list(map(int, input().split())) if i == 0: dp[i] = [a, b, c] else: dp[i] = [ a + max(dp[i - 1][1], dp[i - 1][2]), b + max(dp[i - 1][0], dp[i - 1][...
import sys input = sys.stdin.readline def vacation(): n = int(eval(input())) dp = [[]] * n for i in range(n): a, b, c = list(map(int, input().split())) if i == 0: dp[i] = [a, b, c] else: dp[i] = [ a + max(dp[i - 1][1], dp[i - 1][2]), ...
false
22.222222
[ "+import sys", "+", "+input = sys.stdin.readline", "+", "+" ]
false
0.036454
0.199683
0.182561
[ "s651357234", "s824586717" ]
u411923565
p03687
python
s825342661
s186066674
35
28
9,316
9,112
Accepted
Accepted
20
#41 A - Shrinking import collections s = list(eval(input())) cnt = collections.Counter(s) valcnt = list(cnt.values()) M = max(valcnt) # 出現回数が最多の文字リスト mkeys = [i for i,v in list(cnt.items()) if v == M] ans = len(s) for key in s: m = 0 cnt = 0 # 最多の文字の区間の最大値がその文字の最小値 for S in s: i...
s = list(eval(input())) ans = len(s) for t in s: m = 0 cnt = 0 # 同じ文字の区間の最大値がその文字の最小値 for S in s: if S == t: m = max(m,cnt) cnt = 0 else: cnt += 1 m = max(m,cnt) ans = min(ans,m) print(ans)
24
16
462
276
# 41 A - Shrinking import collections s = list(eval(input())) cnt = collections.Counter(s) valcnt = list(cnt.values()) M = max(valcnt) # 出現回数が最多の文字リスト mkeys = [i for i, v in list(cnt.items()) if v == M] ans = len(s) for key in s: m = 0 cnt = 0 # 最多の文字の区間の最大値がその文字の最小値 for S in s: if S == key: ...
s = list(eval(input())) ans = len(s) for t in s: m = 0 cnt = 0 # 同じ文字の区間の最大値がその文字の最小値 for S in s: if S == t: m = max(m, cnt) cnt = 0 else: cnt += 1 m = max(m, cnt) ans = min(ans, m) print(ans)
false
33.333333
[ "-# 41 A - Shrinking", "-import collections", "-", "-cnt = collections.Counter(s)", "-valcnt = list(cnt.values())", "-M = max(valcnt)", "-# 出現回数が最多の文字リスト", "-mkeys = [i for i, v in list(cnt.items()) if v == M]", "-for key in s:", "+for t in s:", "- # 最多の文字の区間の最大値がその文字の最小値", "+ # 同じ文字の区間の...
false
0.04184
0.042773
0.978183
[ "s825342661", "s186066674" ]
u094191970
p03555
python
s870469690
s953964422
31
28
9,032
9,036
Accepted
Accepted
9.68
c1=eval(input()) c2=eval(input()) if c1==c2[::-1] and c2==c1[::-1]: print('YES') else: print('NO')
c1=eval(input()) c2=eval(input()) print(('YES' if c1==c2[::-1]else 'NO'))
7
4
97
63
c1 = eval(input()) c2 = eval(input()) if c1 == c2[::-1] and c2 == c1[::-1]: print("YES") else: print("NO")
c1 = eval(input()) c2 = eval(input()) print(("YES" if c1 == c2[::-1] else "NO"))
false
42.857143
[ "-if c1 == c2[::-1] and c2 == c1[::-1]:", "- print(\"YES\")", "-else:", "- print(\"NO\")", "+print((\"YES\" if c1 == c2[::-1] else \"NO\"))" ]
false
0.049052
0.067283
0.729038
[ "s870469690", "s953964422" ]
u379142263
p03611
python
s973423249
s361457351
168
144
17,336
14,320
Accepted
Accepted
14.29
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import math import collections n = int(eval(input())) a = sorted(list(map(int,input().split()))) c = collections.Counter(a) item = [] for key,Value in list(c.items()): item.append([key,V...
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import math import collections n = int(eval(input())) a = sorted(list(map(int,input().split()))) x = [0]*100002 for i in range(n): x[a[i]]+=1 ans = 0 for i in range(100000): c = x[...
38
17
880
368
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify, heappop, heappush, heappushpop import math import collections n = int(eval(input())) a = sorted(list(map(int, input().split()))) c = collections.Counter(a) item = [] for key, Value in list(c.items()): item.append([key, Value]...
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify, heappop, heappush, heappushpop import math import collections n = int(eval(input())) a = sorted(list(map(int, input().split()))) x = [0] * 100002 for i in range(n): x[a[i]] += 1 ans = 0 for i in range(100000): c = x[i] + ...
false
55.263158
[ "-c = collections.Counter(a)", "-item = []", "-for key, Value in list(c.items()):", "- item.append([key, Value])", "-koho = []", "-if len(item) == 1:", "- print((item[0][1]))", "- sys.exit()", "-if item[1][0] - item[0][0] == 1:", "- cnt = item[1][1] + item[0][1]", "-else:", "- c...
false
0.050608
0.112829
0.448542
[ "s973423249", "s361457351" ]
u780475861
p02782
python
s576270520
s377550644
955
357
161,324
90,600
Accepted
Accepted
62.62
import sys read = sys.stdin.read mod = 10 ** 9 + 7 r1, c1, r2, c2 = map(int, read().split()) def prepare(n, MOD): # 1! - n! の計算 f = 1 factorials = [1] # 0!の分 for m in range(1, n + 1): f *= m f %= MOD factorials.append(f) # n!^-1 の計算 inv = pow(f, MOD - 2,...
import numpy as np import sys read = sys.stdin.read r1, c1, r2, c2 = map(int, read().split()) MOD = 10 ** 9 + 7 def cumprod(A, MOD=MOD): L = len(A) Lsq = int(L**.5 + 1) A = np.resize(A, Lsq**2).reshape(Lsq, Lsq) for n in range(1, Lsq): A[:, n] *= A[:, n - 1] A[:, n] %= MOD...
61
47
1,145
1,141
import sys read = sys.stdin.read mod = 10**9 + 7 r1, c1, r2, c2 = map(int, read().split()) def prepare(n, MOD): # 1! - n! の計算 f = 1 factorials = [1] # 0!の分 for m in range(1, n + 1): f *= m f %= MOD factorials.append(f) # n!^-1 の計算 inv = pow(f, MOD - 2, MOD) # n!^-...
import numpy as np import sys read = sys.stdin.read r1, c1, r2, c2 = map(int, read().split()) MOD = 10**9 + 7 def cumprod(A, MOD=MOD): L = len(A) Lsq = int(L**0.5 + 1) A = np.resize(A, Lsq**2).reshape(Lsq, Lsq) for n in range(1, Lsq): A[:, n] *= A[:, n - 1] A[:, n] %= MOD for n in...
false
22.95082
[ "+import numpy as np", "-mod = 10**9 + 7", "+MOD = 10**9 + 7", "-def prepare(n, MOD):", "- # 1! - n! の計算", "- f = 1", "- factorials = [1] # 0!の分", "- for m in range(1, n + 1):", "- f *= m", "- f %= MOD", "- factorials.append(f)", "- # n!^-1 の計算", "- in...
false
0.041371
0.037366
1.107178
[ "s576270520", "s377550644" ]
u798803522
p00710
python
s898148512
s230744036
70
60
7,664
7,672
Accepted
Accepted
14.29
cond = [int(n) for n in input().split(" ")] while True: case = [] cards = [n for n in range(1,cond[0] + 1)] cards.sort(reverse = True) for c in range(cond[1]): case = [int(n) for n in input().split(" ")] case[0] -= 1 #print(cards[case[0]:case[0]+case[1]],cards[case[1]:c...
cards,trial = (int(n) for n in input().split(" ")) while True: cards = list(reversed([int(n) for n in range(1,(cards)+1)])) for n in range(trial): num,change = (int(n) for n in input().split(" ")) num -= 1 disp = cards[num:num+change] cards[change:change+num] = cards[:num]...
20
13
695
478
cond = [int(n) for n in input().split(" ")] while True: case = [] cards = [n for n in range(1, cond[0] + 1)] cards.sort(reverse=True) for c in range(cond[1]): case = [int(n) for n in input().split(" ")] case[0] -= 1 # print(cards[case[0]:case[0]+case[1]],cards[case[1]:case[0]+cas...
cards, trial = (int(n) for n in input().split(" ")) while True: cards = list(reversed([int(n) for n in range(1, (cards) + 1)])) for n in range(trial): num, change = (int(n) for n in input().split(" ")) num -= 1 disp = cards[num : num + change] cards[change : change + num] = cards...
false
35
[ "-cond = [int(n) for n in input().split(\" \")]", "+cards, trial = (int(n) for n in input().split(\" \"))", "- case = []", "- cards = [n for n in range(1, cond[0] + 1)]", "- cards.sort(reverse=True)", "- for c in range(cond[1]):", "- case = [int(n) for n in input().split(\" \")]", "...
false
0.046255
0.089391
0.517444
[ "s898148512", "s230744036" ]
u782685137
p03228
python
s322018155
s110237313
19
17
3,316
2,940
Accepted
Accepted
10.53
a,b,k=list(map(int,input().split())) for i in range(k): if i%2==0: a = a//2 b += a else: b = b//2 a += b print((a,b))
a,b,k=list(map(int,input().split())) for i in range(k): if i%2>0:b//=2;a+=b else:a//=2;b+=a print((a,b))
9
5
157
108
a, b, k = list(map(int, input().split())) for i in range(k): if i % 2 == 0: a = a // 2 b += a else: b = b // 2 a += b print((a, b))
a, b, k = list(map(int, input().split())) for i in range(k): if i % 2 > 0: b //= 2 a += b else: a //= 2 b += a print((a, b))
false
44.444444
[ "- if i % 2 == 0:", "- a = a // 2", "+ if i % 2 > 0:", "+ b //= 2", "+ a += b", "+ else:", "+ a //= 2", "- else:", "- b = b // 2", "- a += b" ]
false
0.048419
0.04938
0.980552
[ "s322018155", "s110237313" ]
u175034939
p03262
python
s759516348
s672145086
113
76
14,252
14,252
Accepted
Accepted
32.74
n,m = list(map(int,input().split())) aa = list(map(int,input().split())) bb = [abs(a-m) for a in aa] def gcd(a,b): while b: a, b = b, a % b return a if len(aa) == 1: print((abs(aa[0]-m))) else: while len(bb) > 1: a, b = bb.pop(), bb.pop() bb.append(gcd(a,b)...
n,m = list(map(int,input().split())) aa = list(map(int,input().split())) bb = [abs(a-m) for a in aa] def gcd(a,b): while b: a, b = b, a % b return a ans = bb[0] if len(aa) == 1: print((abs(aa[0]-m))) else: for b in bb: ans = gcd(ans,b) print(ans)
17
19
331
302
n, m = list(map(int, input().split())) aa = list(map(int, input().split())) bb = [abs(a - m) for a in aa] def gcd(a, b): while b: a, b = b, a % b return a if len(aa) == 1: print((abs(aa[0] - m))) else: while len(bb) > 1: a, b = bb.pop(), bb.pop() bb.append(gcd(a, b)) prin...
n, m = list(map(int, input().split())) aa = list(map(int, input().split())) bb = [abs(a - m) for a in aa] def gcd(a, b): while b: a, b = b, a % b return a ans = bb[0] if len(aa) == 1: print((abs(aa[0] - m))) else: for b in bb: ans = gcd(ans, b) print(ans)
false
10.526316
[ "+ans = bb[0]", "- while len(bb) > 1:", "- a, b = bb.pop(), bb.pop()", "- bb.append(gcd(a, b))", "- print((bb[0]))", "+ for b in bb:", "+ ans = gcd(ans, b)", "+ print(ans)" ]
false
0.036301
0.036324
0.999382
[ "s759516348", "s672145086" ]
u777299405
p00028
python
s660888061
s572138074
50
30
7,892
7,812
Accepted
Accepted
40
import sys import collections l = [] for line in sys.stdin: l.append(int(line)) counted = collections.Counter(l).most_common() maxv = counted[0][1] for k, v in counted: if v == maxv: print(k) else: break
import sys import collections l = [] for line in sys.stdin: l.append(int(line)) counted = collections.Counter(l).most_common() maxv = counted[0][1] for k, v in counted: if v == maxv: print(k)
14
12
246
220
import sys import collections l = [] for line in sys.stdin: l.append(int(line)) counted = collections.Counter(l).most_common() maxv = counted[0][1] for k, v in counted: if v == maxv: print(k) else: break
import sys import collections l = [] for line in sys.stdin: l.append(int(line)) counted = collections.Counter(l).most_common() maxv = counted[0][1] for k, v in counted: if v == maxv: print(k)
false
14.285714
[ "- else:", "- break" ]
false
0.044237
0.122219
0.361945
[ "s660888061", "s572138074" ]
u606878291
p03111
python
s013999371
s437097956
1,698
188
9,280
9,204
Accepted
Accepted
88.93
from itertools import product, permutations N, A, B, C = list(map(int, input().split(' '))) L = [int(eval(input())) for _ in range(N)] ans = 10 ** 9 for groups in product(list(range(4)), repeat=N): items = [] group_a = [] group_b = [] group_c = [] for group, length in zip(groups, L): ...
from itertools import product N, A, B, C = list(map(int, input().split(' '))) L = [int(eval(input())) for _ in range(N)] ans = 10 ** 9 for groups in product(list(range(4)), repeat=N): length_a = 0 length_b = 0 length_c = 0 cost_a = -10 cost_b = -10 cost_c = -10 for group, le...
50
38
1,431
827
from itertools import product, permutations N, A, B, C = list(map(int, input().split(" "))) L = [int(eval(input())) for _ in range(N)] ans = 10**9 for groups in product(list(range(4)), repeat=N): items = [] group_a = [] group_b = [] group_c = [] for group, length in zip(groups, L): if group...
from itertools import product N, A, B, C = list(map(int, input().split(" "))) L = [int(eval(input())) for _ in range(N)] ans = 10**9 for groups in product(list(range(4)), repeat=N): length_a = 0 length_b = 0 length_c = 0 cost_a = -10 cost_b = -10 cost_c = -10 for group, length in zip(groups...
false
24
[ "-from itertools import product, permutations", "+from itertools import product", "- items = []", "- group_a = []", "- group_b = []", "- group_c = []", "+ length_a = 0", "+ length_b = 0", "+ length_c = 0", "+ cost_a = -10", "+ cost_b = -10", "+ cost_c = -10", "-...
false
1.124074
0.14058
7.995961
[ "s013999371", "s437097956" ]
u271261336
p02268
python
s566055188
s230948466
260
80
14,852
14,756
Accepted
Accepted
69.23
n = eval(input()) S = list(map(int,input().split())) m = eval(input()) T = list(map(int,input().split())) C=0 def binarySearch(A,p): lens = len(A) ll = -1 ul = lens-1 ms=(ll+ul)/2 while (ll+1<ul): ms=(ll+ul)/2 if A[ms] >= p: ul =ms elif A[ms] < p: ...
n = eval(input()) S = set([int(s) for s in input().split()]) m = eval(input()) T = set([int(s) for s in input().split()]) print(len(S&T))
22
5
412
136
n = eval(input()) S = list(map(int, input().split())) m = eval(input()) T = list(map(int, input().split())) C = 0 def binarySearch(A, p): lens = len(A) ll = -1 ul = lens - 1 ms = (ll + ul) / 2 while ll + 1 < ul: ms = (ll + ul) / 2 if A[ms] >= p: ul = ms elif A[m...
n = eval(input()) S = set([int(s) for s in input().split()]) m = eval(input()) T = set([int(s) for s in input().split()]) print(len(S & T))
false
77.272727
[ "-S = list(map(int, input().split()))", "+S = set([int(s) for s in input().split()])", "-T = list(map(int, input().split()))", "-C = 0", "-", "-", "-def binarySearch(A, p):", "- lens = len(A)", "- ll = -1", "- ul = lens - 1", "- ms = (ll + ul) / 2", "- while ll + 1 < ul:", "- ...
false
0.081647
0.066937
1.219744
[ "s566055188", "s230948466" ]
u440566786
p03476
python
s188043613
s369857241
1,404
377
8,600
52,440
Accepted
Accepted
73.15
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.readline().rstrip() def resolve(): def prime(n): if n<=1: return False A = [i for i in range(2, n+1)] P = [] lim = n**.5 while True: prime = A[0] ...
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.readline().rstrip() def resolve(): c=10**5+1 # S[i]: iがprimeかを指すboolean S=[1]*c S[0]=0; S[1]=0 for i in range(2,c): if S[i]==0: continue for j in range(2*i,c,i): ...
43
28
1,004
660
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.readline().rstrip() def resolve(): def prime(n): if n <= 1: return False A = [i for i in range(2, n + 1)] P = [] lim = n**0.5 while True: prime...
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.readline().rstrip() def resolve(): c = 10**5 + 1 # S[i]: iがprimeかを指すboolean S = [1] * c S[0] = 0 S[1] = 0 for i in range(2, c): if S[i] == 0: continue for j in...
false
34.883721
[ "- def prime(n):", "- if n <= 1:", "- return False", "- A = [i for i in range(2, n + 1)]", "- P = []", "- lim = n**0.5", "- while True:", "- prime = A[0]", "- if prime > lim:", "- break", "- P.append...
false
1.030468
0.080229
12.844099
[ "s188043613", "s369857241" ]
u400336986
p02370
python
s366934787
s585745698
290
230
12,412
11,420
Accepted
Accepted
20.69
import queue nv, ne = map(int, input().split(' ')) in_degs = [0] * nv q = queue.Queue() outs = {} o = [] for _ in range(ne): s, t = map(int, input().split(' ')) if s in outs: outs[s].append(t) else: outs[s] = [t] in_degs[t] += 1 for i in range(nv): if in_degs[i] == 0: q.put(i) ...
nv, ne = map(int, input().split(' ')) in_degs = [0] * nv q = [] outs = {} o = [] for _ in range(ne): s, t = map(int, input().split(' ')) if s in outs: outs[s].append(t) else: outs[s] = [t] in_degs[t] += 1 for i in range(nv): if in_degs[i] == 0: q.append(i) while len(q) > 0: ...
29
27
529
506
import queue nv, ne = map(int, input().split(" ")) in_degs = [0] * nv q = queue.Queue() outs = {} o = [] for _ in range(ne): s, t = map(int, input().split(" ")) if s in outs: outs[s].append(t) else: outs[s] = [t] in_degs[t] += 1 for i in range(nv): if in_degs[i] == 0: q.put(...
nv, ne = map(int, input().split(" ")) in_degs = [0] * nv q = [] outs = {} o = [] for _ in range(ne): s, t = map(int, input().split(" ")) if s in outs: outs[s].append(t) else: outs[s] = [t] in_degs[t] += 1 for i in range(nv): if in_degs[i] == 0: q.append(i) while len(q) > 0: ...
false
6.896552
[ "-import queue", "-", "-q = queue.Queue()", "+q = []", "- q.put(i)", "-while not q.empty():", "- v = q.get()", "+ q.append(i)", "+while len(q) > 0:", "+ v = q.pop(0)", "- q.put(out)", "+ q.append(out)" ]
false
0.040347
0.037152
1.085982
[ "s366934787", "s585745698" ]
u023127434
p03494
python
s067017069
s902843873
30
25
9,176
9,192
Accepted
Accepted
16.67
N = int(eval(input())) A = list(map(int, input().split())) count = 0 while all(a % 2 == 0 for a in A): A = [a / 2 for a in A] count += 1 print(count)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 while all(i % 2 == 0 for i in a): a = [i / 2 for i in a] ans += 1 print(ans)
7
7
157
147
N = int(eval(input())) A = list(map(int, input().split())) count = 0 while all(a % 2 == 0 for a in A): A = [a / 2 for a in A] count += 1 print(count)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 while all(i % 2 == 0 for i in a): a = [i / 2 for i in a] ans += 1 print(ans)
false
0
[ "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "-count = 0", "-while all(a % 2 == 0 for a in A):", "- A = [a / 2 for a in A]", "- count += 1", "-print(count)", "+n = int(eval(input()))", "+a = list(map(int, input().split()))", "+ans = 0", "+while all(i % 2 == 0 for i in...
false
0.07616
0.039827
1.912257
[ "s067017069", "s902843873" ]
u828766688
p03636
python
s764218436
s999372511
178
17
38,384
2,940
Accepted
Accepted
90.45
s = eval(input()) ans = s[0] + str(len(s)-2) + s[-1] print(ans)
s = eval(input()) n = len (s) - 2 n = str (n) print(( s[0] + n + s[-1] ))
6
4
66
70
s = eval(input()) ans = s[0] + str(len(s) - 2) + s[-1] print(ans)
s = eval(input()) n = len(s) - 2 n = str(n) print((s[0] + n + s[-1]))
false
33.333333
[ "-ans = s[0] + str(len(s) - 2) + s[-1]", "-print(ans)", "+n = len(s) - 2", "+n = str(n)", "+print((s[0] + n + s[-1]))" ]
false
0.043347
0.037431
1.158032
[ "s764218436", "s999372511" ]
u644778646
p02925
python
s925251824
s607140684
1,973
1,277
221,240
154,828
Accepted
Accepted
35.28
import math import collections import heapq from collections import defaultdict import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def main(): n = int(eval(input())) maxv = n*(n-1)//2 a = [list(map(int, input().split())) for i in range(n)] for i in range(n): for...
import math import collections import heapq from collections import defaultdict import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def main(): n = int(eval(input())) maxv = n*(n-1)//2 a = [list(map(int, input().split())) for i in range(n)] for i in range(n): for...
72
71
1,765
1,623
import math import collections import heapq from collections import defaultdict import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) def main(): n = int(eval(input())) maxv = n * (n - 1) // 2 a = [list(map(int, input().split())) for i in range(n)] for i in range(n): for j in ran...
import math import collections import heapq from collections import defaultdict import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) def main(): n = int(eval(input())) maxv = n * (n - 1) // 2 a = [list(map(int, input().split())) for i in range(n)] for i in range(n): for j in ran...
false
1.388889
[ "- if i < j: # 3-1はダメ", "+ if i < j:", "+ # 頂点間の辺を貼る", "+ # a[i][j]にIDを代入する Id[1][3]=1 => a[1][3] = a[3][1] = 1", "- # a[i][j]にIDを代入する Id[1][3]=1 => a[1][3] = a[3][1] = 1", "- # x = i", "- # y = a[i][j]", "- # if x > y:", "...
false
0.113747
0.135161
0.841563
[ "s925251824", "s607140684" ]
u389910364
p03061
python
s688165916
s133913593
1,473
306
102,248
22,468
Accepted
Accepted
79.23
import fractions import operator import sys sys.setrecursionlimit(10000) INF = float('inf') class SegmentTree: # http://tsutaj.hatenablog.com/entry/2017/03/29/204841 def __init__(self, size, fn=operator.add, default=0): """ :param int size: :param callable fn: 区間に適用する関数。引...
import bisect import cmath import heapq import itertools import math import operator import os import re import string import sys from collections import Counter, deque, defaultdict from copy import deepcopy from decimal import Decimal from fractions import gcd from functools import lru_cache, reduce fro...
89
45
2,320
1,032
import fractions import operator import sys sys.setrecursionlimit(10000) INF = float("inf") class SegmentTree: # http://tsutaj.hatenablog.com/entry/2017/03/29/204841 def __init__(self, size, fn=operator.add, default=0): """ :param int size: :param callable fn: 区間に適用する関数。引数を 2 つ取る。min,...
import bisect import cmath import heapq import itertools import math import operator import os import re import string import sys from collections import Counter, deque, defaultdict from copy import deepcopy from decimal import Decimal from fractions import gcd from functools import lru_cache, reduce from operator impo...
false
49.438202
[ "-import fractions", "+import bisect", "+import cmath", "+import heapq", "+import itertools", "+import math", "+import os", "+import re", "+import string", "+from collections import Counter, deque, defaultdict", "+from copy import deepcopy", "+from decimal import Decimal", "+from fractions i...
false
0.045879
0.071156
0.644767
[ "s688165916", "s133913593" ]
u556215526
p03448
python
s614215601
s839109564
57
45
3,064
3,064
Accepted
Accepted
21.05
fh = int(eval(input())) oh = int(eval(input())) ft = int(eval(input())) om = int(eval(input())) count = 0 for i in range(fh + 1): for j in range(oh + 1): for k in range(ft + 1): nm = 0 nm = i * 500 + j * 100 + k * 50 if om == nm: count +=1 ...
fh = int(eval(input())) oh = int(eval(input())) ft = int(eval(input())) om = int(eval(input())) count = 0 for i in range(fh + 1): if om < i * 500: break for j in range(oh + 1): if om < i * 500 + j * 100: break for k in range(ft + 1): nm = 0 ...
15
20
308
402
fh = int(eval(input())) oh = int(eval(input())) ft = int(eval(input())) om = int(eval(input())) count = 0 for i in range(fh + 1): for j in range(oh + 1): for k in range(ft + 1): nm = 0 nm = i * 500 + j * 100 + k * 50 if om == nm: count += 1 print(count)
fh = int(eval(input())) oh = int(eval(input())) ft = int(eval(input())) om = int(eval(input())) count = 0 for i in range(fh + 1): if om < i * 500: break for j in range(oh + 1): if om < i * 500 + j * 100: break for k in range(ft + 1): nm = 0 nm = i * 50...
false
25
[ "+ if om < i * 500:", "+ break", "+ if om < i * 500 + j * 100:", "+ break" ]
false
0.10229
0.049009
2.087158
[ "s614215601", "s839109564" ]
u981931040
p03945
python
s323537282
s240198031
186
33
49,904
3,188
Accepted
Accepted
82.26
S = list(eval(input())) now = S[0] ans = 0 for i in range(1,len(S)): if now != S[i]: ans += 1 now = S[i] print(ans)
S = eval(input()) now = S[0] ans = 0 for stone in S: if stone != now: now = stone ans += 1 print(ans)
8
8
136
122
S = list(eval(input())) now = S[0] ans = 0 for i in range(1, len(S)): if now != S[i]: ans += 1 now = S[i] print(ans)
S = eval(input()) now = S[0] ans = 0 for stone in S: if stone != now: now = stone ans += 1 print(ans)
false
0
[ "-S = list(eval(input()))", "+S = eval(input())", "-for i in range(1, len(S)):", "- if now != S[i]:", "+for stone in S:", "+ if stone != now:", "+ now = stone", "- now = S[i]" ]
false
0.036312
0.08202
0.442726
[ "s323537282", "s240198031" ]
u844789719
p02802
python
s315133497
s433469705
518
102
68,568
26,040
Accepted
Accepted
80.31
N, M = [int(_) for _ in input().split()] PS = [input().split() for _ in range(M)] count = [0] * (N + 1) isac = [0] * (N + 1) for p, s in PS: p = int(p) if isac[p] == 1: continue if s == 'AC': isac[p] = 1 else: count[p] += 1 wa = 0 ac = 0 for i in range(N + 1): ...
N, M, *PS = open(0).read().split() N, M = [int(_) for _ in [N, M]] cor = [0] * (N + 1) pen = [0] * (N + 1) for p, s in zip(PS[::2], PS[1::2]): p = int(p) if cor[p] == 1: continue if s == 'AC': cor[p] = 1 else: pen[p] += 1 ans = [0, 0] for i in range(1, N + 1): i...
19
19
393
405
N, M = [int(_) for _ in input().split()] PS = [input().split() for _ in range(M)] count = [0] * (N + 1) isac = [0] * (N + 1) for p, s in PS: p = int(p) if isac[p] == 1: continue if s == "AC": isac[p] = 1 else: count[p] += 1 wa = 0 ac = 0 for i in range(N + 1): if isac[i] == 1...
N, M, *PS = open(0).read().split() N, M = [int(_) for _ in [N, M]] cor = [0] * (N + 1) pen = [0] * (N + 1) for p, s in zip(PS[::2], PS[1::2]): p = int(p) if cor[p] == 1: continue if s == "AC": cor[p] = 1 else: pen[p] += 1 ans = [0, 0] for i in range(1, N + 1): if cor[i] == 0:...
false
0
[ "-N, M = [int(_) for _ in input().split()]", "-PS = [input().split() for _ in range(M)]", "-count = [0] * (N + 1)", "-isac = [0] * (N + 1)", "-for p, s in PS:", "+N, M, *PS = open(0).read().split()", "+N, M = [int(_) for _ in [N, M]]", "+cor = [0] * (N + 1)", "+pen = [0] * (N + 1)", "+for p, s in ...
false
0.045486
0.060456
0.752372
[ "s315133497", "s433469705" ]
u519832983
p02657
python
s958063886
s279450236
24
22
9,152
9,096
Accepted
Accepted
8.33
A, B = list(map(int, input().split())) print((A * B))
import math A, B = list(map(float, input().split())) B *= 100 mul = math.floor(A * B) print((int(mul/100)))
2
5
46
103
A, B = list(map(int, input().split())) print((A * B))
import math A, B = list(map(float, input().split())) B *= 100 mul = math.floor(A * B) print((int(mul / 100)))
false
60
[ "-A, B = list(map(int, input().split()))", "-print((A * B))", "+import math", "+", "+A, B = list(map(float, input().split()))", "+B *= 100", "+mul = math.floor(A * B)", "+print((int(mul / 100)))" ]
false
0.039321
0.040109
0.980354
[ "s958063886", "s279450236" ]
u136090046
p03157
python
s483471535
s900688714
725
641
186,020
185,848
Accepted
Accepted
11.59
def main(): from collections import defaultdict import sys sys.setrecursionlimit(10 ** 9) H, W = list(map(int, input().split())) G = [list(eval(input())) for i in range(H)] Visited = [[0] * W for i in range(H)] direction = [[0, 1], [0, -1], [1, 0], [-1, 0]] ...
def main(): from collections import defaultdict import sys sys.setrecursionlimit(10 ** 9) H, W = list(map(int, input().split())) G = [list(input()) for i in range(H)] Visited = [[0] * W for i in range(H)] direction = [[0, 1], [0, -1], [1, 0], [-1, 0]] def ...
58
58
1,476
1,484
def main(): from collections import defaultdict import sys sys.setrecursionlimit(10**9) H, W = list(map(int, input().split())) G = [list(eval(input())) for i in range(H)] Visited = [[0] * W for i in range(H)] direction = [[0, 1], [0, -1], [1, 0], [-1, 0]] def dfs(ny, nx, color): ...
def main(): from collections import defaultdict import sys sys.setrecursionlimit(10**9) H, W = list(map(int, input().split())) G = [list(input()) for i in range(H)] Visited = [[0] * W for i in range(H)] direction = [[0, 1], [0, -1], [1, 0], [-1, 0]] def dfs(ny, nx, color): for ...
false
0
[ "- G = [list(eval(input())) for i in range(H)]", "+ G = [list(input()) for i in range(H)]" ]
false
0.058267
0.057191
1.018822
[ "s483471535", "s900688714" ]
u484229314
p02990
python
s940997825
s813299751
213
27
3,444
3,444
Accepted
Accepted
87.32
from math import factorial N, K = [int(_) for _ in input().split()] # N = 10 MOD = 10 ** 9 + 7 kaijo = [0] * (N + 1) kaijo[0] = kaijo[1] = 1 for i in range(2, N + 1): kaijo[i] = (kaijo[i - 1] * i) % MOD gyaku = [0] * (N + 1) gyaku[0] = gyaku[1] = 1 for i in range(2, N + 1): # gyaku[i] = (gyak...
from math import factorial N, K = [int(_) for _ in input().split()] # N = 10 MOD = 10 ** 9 + 7 kaijo = [0] * (N + 1) kaijo[0] = kaijo[1] = 1 for i in range(2, N + 1): kaijo[i] = (kaijo[i - 1] * i) % MOD gyaku = [0] * (N + 1) gyaku[0] = gyaku[1] = 1 for i in range(2, N + 1): # gyaku[i] = (gyak...
35
35
760
760
from math import factorial N, K = [int(_) for _ in input().split()] # N = 10 MOD = 10**9 + 7 kaijo = [0] * (N + 1) kaijo[0] = kaijo[1] = 1 for i in range(2, N + 1): kaijo[i] = (kaijo[i - 1] * i) % MOD gyaku = [0] * (N + 1) gyaku[0] = gyaku[1] = 1 for i in range(2, N + 1): # gyaku[i] = (gyaku[i - 1] * pow(i, MO...
from math import factorial N, K = [int(_) for _ in input().split()] # N = 10 MOD = 10**9 + 7 kaijo = [0] * (N + 1) kaijo[0] = kaijo[1] = 1 for i in range(2, N + 1): kaijo[i] = (kaijo[i - 1] * i) % MOD gyaku = [0] * (N + 1) gyaku[0] = gyaku[1] = 1 for i in range(2, N + 1): # gyaku[i] = (gyaku[i - 1] * pow(i, MO...
false
0
[ "- # return (kaijo[n] * gyaku[n - k] * gyaku[k]) % MOD", "- return factorial(n) // (factorial(n - k) * factorial(k))", "+ return (kaijo[n] * gyaku[n - k] * gyaku[k]) % MOD", "+ # return factorial(n) // (factorial(n - k) * factorial(k))" ]
false
0.075459
0.039583
1.906346
[ "s940997825", "s813299751" ]
u614314290
p02996
python
s172959969
s896409337
1,034
764
69,928
31,852
Accepted
Accepted
26.11
N = int(eval(input())) AB = [list(map(int, input().split())) for _ in range(N)] ab = sorted(AB, key=lambda x:(x[1],x[0])) now = 0 for a, b in ab: if b < now + a: print("No") break else: now += a else: print("Yes")
from operator import itemgetter as ig # 定数 INF = float("inf") MOD = int(1e9 + 7) # エントリーポイント def main(): N = int(eval(input())) AB = (tuple(map(int, input().split())) for _ in range(N)) ab = sorted(AB, key=ig(1)) sum_a = 0 for a, b in ab: sum_a += a if b < sum_a: ...
14
20
232
395
N = int(eval(input())) AB = [list(map(int, input().split())) for _ in range(N)] ab = sorted(AB, key=lambda x: (x[1], x[0])) now = 0 for a, b in ab: if b < now + a: print("No") break else: now += a else: print("Yes")
from operator import itemgetter as ig # 定数 INF = float("inf") MOD = int(1e9 + 7) # エントリーポイント def main(): N = int(eval(input())) AB = (tuple(map(int, input().split())) for _ in range(N)) ab = sorted(AB, key=ig(1)) sum_a = 0 for a, b in ab: sum_a += a if b < sum_a: print("...
false
30
[ "-N = int(eval(input()))", "-AB = [list(map(int, input().split())) for _ in range(N)]", "-ab = sorted(AB, key=lambda x: (x[1], x[0]))", "-now = 0", "-for a, b in ab:", "- if b < now + a:", "- print(\"No\")", "- break", "+from operator import itemgetter as ig", "+", "+# 定数", "+...
false
0.102947
0.047085
2.18642
[ "s172959969", "s896409337" ]
u753803401
p02983
python
s775719219
s086360035
198
176
40,688
38,768
Accepted
Accepted
11.11
def slove(): import sys input = sys.stdin.readline l, r = list(map(int, input().rstrip('\n').split())) m = 10 ** 10 for i in range(l, r + 1): for j in range(i + 1, r + 1): m = min(m, (i * j) % 2019) if m == 0: print(m) exit() ...
import sys def slove(): input = sys.stdin.readline l, r = list(map(int, input().rstrip('\n').split())) mt = 10 ** 10 for i in range(l, r + 1): for j in range(i + 1, r + 1): mt = min(mt, (i * j) % 2019) if mt == 0: print(mt) ex...
16
18
379
385
def slove(): import sys input = sys.stdin.readline l, r = list(map(int, input().rstrip("\n").split())) m = 10**10 for i in range(l, r + 1): for j in range(i + 1, r + 1): m = min(m, (i * j) % 2019) if m == 0: print(m) exit() print(m...
import sys def slove(): input = sys.stdin.readline l, r = list(map(int, input().rstrip("\n").split())) mt = 10**10 for i in range(l, r + 1): for j in range(i + 1, r + 1): mt = min(mt, (i * j) % 2019) if mt == 0: print(mt) exit() print...
false
11.111111
[ "+import sys", "+", "+", "- import sys", "-", "- m = 10**10", "+ mt = 10**10", "- m = min(m, (i * j) % 2019)", "- if m == 0:", "- print(m)", "+ mt = min(mt, (i * j) % 2019)", "+ if mt == 0:", "+ print(mt)", ...
false
0.049121
0.07713
0.636862
[ "s775719219", "s086360035" ]
u254871849
p03327
python
s146905306
s944248323
20
17
3,316
2,940
Accepted
Accepted
15
# author: kagemeka # created: 2019-11-08 02:12:52(JST) ## internal modules import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator ## external modu...
import sys n = int(sys.stdin.readline().rstrip()) def main(): return 'ABC' if n < 1000 else 'ABD' if __name__ == '__main__': ans = main() print(ans)
31
10
689
172
# author: kagemeka # created: 2019-11-08 02:12:52(JST) ## internal modules import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator ## external modules # import ...
import sys n = int(sys.stdin.readline().rstrip()) def main(): return "ABC" if n < 1000 else "ABD" if __name__ == "__main__": ans = main() print(ans)
false
67.741935
[ "-# author: kagemeka", "-# created: 2019-11-08 02:12:52(JST)", "-## internal modules", "-# import collections", "-# import math", "-# import string", "-# import bisect", "-# import re", "-# import itertools", "-# import statistics", "-# import fun...
false
0.042351
0.041982
1.00878
[ "s146905306", "s944248323" ]
u987164499
p03549
python
s368208444
s437502929
327
27
18,388
9,408
Accepted
Accepted
91.74
from sys import stdin import math import bisect import heapq import numpy as np n,m = [int(x) for x in stdin.readline().rstrip().split()] print(((100*(n-m)+1900*m)*2**m))
n,m = list(map(int,input().split())) # 全ての問題に正解する確率 all_ac = (0.5)**m print((int((1900*m+100*(n-m))/all_ac)))
8
6
176
108
from sys import stdin import math import bisect import heapq import numpy as np n, m = [int(x) for x in stdin.readline().rstrip().split()] print(((100 * (n - m) + 1900 * m) * 2**m))
n, m = list(map(int, input().split())) # 全ての問題に正解する確率 all_ac = (0.5) ** m print((int((1900 * m + 100 * (n - m)) / all_ac)))
false
25
[ "-from sys import stdin", "-import math", "-import bisect", "-import heapq", "-import numpy as np", "-", "-n, m = [int(x) for x in stdin.readline().rstrip().split()]", "-print(((100 * (n - m) + 1900 * m) * 2**m))", "+n, m = list(map(int, input().split()))", "+# 全ての問題に正解する確率", "+all_ac = (0.5) **...
false
0.036827
0.037077
0.993253
[ "s368208444", "s437502929" ]
u844789719
p03287
python
s385011624
s690523011
110
78
14,424
21,336
Accepted
Accepted
29.09
N, M = [int(_) for _ in input().split()] A = [int(_) for _ in input().split()] cumsum = 0 count = {} for i in range(N): cumsum += A[i] cumsum %= M count[cumsum] = count.get(cumsum, 0) + 1 ans = count.get(0, 0) for k in count: n = count[k] ans += (n * (n - 1)) // 2 print(ans)
import itertools, collections N, M = [int(_) for _ in input().split()] A = [int(_) for _ in input().split()] cum = [0] + [c % M for c in itertools.accumulate(A)] cnt = collections.Counter(cum) ans = sum(v * (v - 1) // 2 for v in list(cnt.values())) print(ans)
13
7
307
260
N, M = [int(_) for _ in input().split()] A = [int(_) for _ in input().split()] cumsum = 0 count = {} for i in range(N): cumsum += A[i] cumsum %= M count[cumsum] = count.get(cumsum, 0) + 1 ans = count.get(0, 0) for k in count: n = count[k] ans += (n * (n - 1)) // 2 print(ans)
import itertools, collections N, M = [int(_) for _ in input().split()] A = [int(_) for _ in input().split()] cum = [0] + [c % M for c in itertools.accumulate(A)] cnt = collections.Counter(cum) ans = sum(v * (v - 1) // 2 for v in list(cnt.values())) print(ans)
false
46.153846
[ "+import itertools, collections", "+", "-cumsum = 0", "-count = {}", "-for i in range(N):", "- cumsum += A[i]", "- cumsum %= M", "- count[cumsum] = count.get(cumsum, 0) + 1", "-ans = count.get(0, 0)", "-for k in count:", "- n = count[k]", "- ans += (n * (n - 1)) // 2", "+cum =...
false
0.036817
0.036977
0.995663
[ "s385011624", "s690523011" ]
u072717685
p02613
python
s976186929
s139237318
175
142
69,960
16,552
Accepted
Accepted
18.86
import sys read = sys.stdin.read readline = sys.stdin.readline from itertools import accumulate from collections import deque from math import sqrt from collections import defaultdict def main(): n = int(input()) cnt = defaultdict(int) for _ in range(n): s = input() cnt[s] += 1 ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines from collections import Counter def main(): n = int(eval(input())) d1 = {'AC':0, 'WA':0, 'TLE': 0,'RE':0} s = [] for _ in range(n): s.append(eval(input())) sa = Counter(s) for k, v ...
23
21
561
503
import sys read = sys.stdin.read readline = sys.stdin.readline from itertools import accumulate from collections import deque from math import sqrt from collections import defaultdict def main(): n = int(input()) cnt = defaultdict(int) for _ in range(n): s = input() cnt[s] += 1 print(...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines from collections import Counter def main(): n = int(eval(input())) d1 = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0} s = [] for _ in range(n): s.append(eval(input())) sa = Counter(s) for k, v in li...
false
8.695652
[ "-from itertools import accumulate", "-from collections import deque", "-from math import sqrt", "-from collections import defaultdict", "+readlines = sys.stdin.readlines", "+from collections import Counter", "- n = int(input())", "- cnt = defaultdict(int)", "+ n = int(eval(input()))", "+...
false
0.046772
0.047008
0.99498
[ "s976186929", "s139237318" ]
u729133443
p03280
python
s152356268
s677692104
161
17
38,384
2,940
Accepted
Accepted
89.44
eval('print(('+input().replace(' ','-1)*(')+'-1))')
a,b=list(map(int,input().split()));print((~-a*~-b))
1
1
51
43
eval("print((" + input().replace(" ", "-1)*(") + "-1))")
a, b = list(map(int, input().split())) print((~-a * ~-b))
false
0
[ "-eval(\"print((\" + input().replace(\" \", \"-1)*(\") + \"-1))\")", "+a, b = list(map(int, input().split()))", "+print((~-a * ~-b))" ]
false
0.112128
0.03925
2.856767
[ "s152356268", "s677692104" ]
u073852194
p02772
python
s465430170
s793806280
183
17
38,384
2,940
Accepted
Accepted
90.71
N = int(eval(input())) A = list(map(int,input().split())) for i in range(N): if A[i]%2 == 0: if A[i]%3!=0 and A[i]%5!=0: print('DENIED') break else: print('APPROVED')
#!/usr/bin/env python3 #import sys; sys.stdin=open('input_file.txt') #------------------------------------------ N = int(eval(input())) A = list(map(int,input().split())) for i in range(N): if A[i]%2 == 0 and A[i]%3!=0 and A[i]%5!=0: print('DENIED') break else: print('APPROVED')
9
11
208
308
N = int(eval(input())) A = list(map(int, input().split())) for i in range(N): if A[i] % 2 == 0: if A[i] % 3 != 0 and A[i] % 5 != 0: print("DENIED") break else: print("APPROVED")
#!/usr/bin/env python3 # import sys; sys.stdin=open('input_file.txt') # ------------------------------------------ N = int(eval(input())) A = list(map(int, input().split())) for i in range(N): if A[i] % 2 == 0 and A[i] % 3 != 0 and A[i] % 5 != 0: print("DENIED") break else: print("APPROVED")
false
18.181818
[ "+#!/usr/bin/env python3", "+# import sys; sys.stdin=open('input_file.txt')", "- if A[i] % 2 == 0:", "- if A[i] % 3 != 0 and A[i] % 5 != 0:", "- print(\"DENIED\")", "- break", "+ if A[i] % 2 == 0 and A[i] % 3 != 0 and A[i] % 5 != 0:", "+ print(\"DENIED\")", ...
false
0.042028
0.035385
1.187727
[ "s465430170", "s793806280" ]
u547167033
p03078
python
s723426342
s410824121
895
789
4,084
4,084
Accepted
Accepted
11.84
from heapq import nlargest x,y,z,k=list(map(int,input().split())) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) ab=nlargest(k,(x+y for x in a for y in b)) abc=nlargest(k,(xy+z for xy in ab for z in c)) for i in abc: print(i)
from heapq import nlargest x,y,z,k=list(map(int,input().split())) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) ab=nlargest(k,(x+y for x in a for y in b)) abc=nlargest(k,(x+y for x in ab for y in c)) for i in abc: print(i)
9
9
281
279
from heapq import nlargest x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) ab = nlargest(k, (x + y for x in a for y in b)) abc = nlargest(k, (xy + z for xy in ab for z in c)) for i in abc: print(i)
from heapq import nlargest x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) ab = nlargest(k, (x + y for x in a for y in b)) abc = nlargest(k, (x + y for x in ab for y in c)) for i in abc: print(i)
false
0
[ "-abc = nlargest(k, (xy + z for xy in ab for z in c))", "+abc = nlargest(k, (x + y for x in ab for y in c))" ]
false
0.104998
0.039402
2.664824
[ "s723426342", "s410824121" ]
u941438707
p03818
python
s437821335
s731442800
54
47
20,084
22,464
Accepted
Accepted
12.96
n,*a=list(map(int,open(0).read().split())) b=len(set(a)) print((b-(n-b)%2))
_,a=open(0);b=len(set(a.split()));print((b+b%2-1))
3
1
69
48
n, *a = list(map(int, open(0).read().split())) b = len(set(a)) print((b - (n - b) % 2))
_, a = open(0) b = len(set(a.split())) print((b + b % 2 - 1))
false
66.666667
[ "-n, *a = list(map(int, open(0).read().split()))", "-b = len(set(a))", "-print((b - (n - b) % 2))", "+_, a = open(0)", "+b = len(set(a.split()))", "+print((b + b % 2 - 1))" ]
false
0.125197
0.0474
2.641313
[ "s437821335", "s731442800" ]
u389910364
p03157
python
s678236870
s726328939
1,958
1,001
249,956
13,928
Accepted
Accepted
48.88
import bisect import heapq import itertools import math import operator import os import re import string import sys from collections import Counter, deque, defaultdict from copy import deepcopy from decimal import Decimal from fractions import gcd from functools import lru_cache, reduce from operator imp...
import itertools import itertools import os import sys from collections import deque import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 H, W = list(map(int, sys.stdin.readline().split()...
52
42
1,276
1,058
import bisect import heapq import itertools import math import operator import os import re import string import sys from collections import Counter, deque, defaultdict from copy import deepcopy from decimal import Decimal from fractions import gcd from functools import lru_cache, reduce from operator import itemgetter...
import itertools import itertools import os import sys from collections import deque import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 H, W = list(map(int, sys.stdin.readline().split())) S = [list(sys.stdin....
false
19.230769
[ "-import bisect", "-import heapq", "-import math", "-import operator", "+import itertools", "-import re", "-import string", "-from collections import Counter, deque, defaultdict", "-from copy import deepcopy", "-from decimal import Decimal", "-from fractions import gcd", "-from functools impor...
false
0.515246
0.283858
1.815154
[ "s678236870", "s726328939" ]
u145231176
p03426
python
s065410416
s814436874
678
621
121,688
102,744
Accepted
Accepted
8.41
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
109
116
2,727
2,753
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
false
6.034483
[ "+\"\"\"", "+# 飛ばし累積和", "+N = 10", "+num = [i for i in range(1, N + 1)]", "+D = 2", "+lista = [0] * N", "+for i in range(D):", "+ for j in range(i, N, D):", "+ if j == i:", "+ lista[j] = num[j]", "+ else:", "+ lista[j] = num[j] + lista[j - D]", "+# [1, ...
false
0.040488
0.043838
0.923576
[ "s065410416", "s814436874" ]
u433532588
p03290
python
s839930867
s695880361
147
23
3,316
3,064
Accepted
Accepted
84.35
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) ############################## D, G = list(map(int, input().split())) P = [] * D C = [] * D for i in range(D): p, c = list(map(int, input().split())) P.append(p) C.append(c) ans = float('inf') for i in range(1<<D): tot...
import sys input = sys.stdin.readline sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 # A = [ int(input()) for _ in range(N) ] ############################## D, G = list(map(int, input().split())) P = [] C = [] for i in range(D): p, c = list(map(int, input().split())) P.append(p) ...
40
50
839
990
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) ############################## D, G = list(map(int, input().split())) P = [] * D C = [] * D for i in range(D): p, c = list(map(int, input().split())) P.append(p) C.append(c) ans = float("inf") for i in range(1 << D): total = 0 num =...
import sys input = sys.stdin.readline sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 # A = [ int(input()) for _ in range(N) ] ############################## D, G = list(map(int, input().split())) P = [] C = [] for i in range(D): p, c = list(map(int, input().split())) P.append(p) C.app...
false
20
[ "-sys.setrecursionlimit(10**6)", "+sys.setrecursionlimit(2147483647)", "+INF = float(\"inf\")", "+MOD = 10**9 + 7", "+# A = [ int(input()) for _ in range(N) ]", "-P = [] * D", "-C = [] * D", "+P = []", "+C = []", "-ans = float(\"inf\")", "+ans = INF", "- total = 0", "- num = 0", "+ ...
false
0.097983
0.040138
2.441162
[ "s839930867", "s695880361" ]
u965436898
p02887
python
s808011539
s771106325
295
42
51,552
3,316
Accepted
Accepted
85.76
import re n = int(eval(input())) s = eval(input()) ans = s for i in range(26): ans = re.sub("([a-z])\\1","\\1",ans) print((len(ans)))
#import re n = int(eval(input())) s = eval(input()) ans = 1 for i in range(1,len(s)): if s[i] != s[i-1]: ans += 1 print(ans) # またはa-zまで正規表現をかます # for i in range(26): # ans = re.sub("([a-z])\\1","\\1",ans) # print(len(ans))
7
15
128
236
import re n = int(eval(input())) s = eval(input()) ans = s for i in range(26): ans = re.sub("([a-z])\\1", "\\1", ans) print((len(ans)))
# import re n = int(eval(input())) s = eval(input()) ans = 1 for i in range(1, len(s)): if s[i] != s[i - 1]: ans += 1 print(ans) # またはa-zまで正規表現をかます # for i in range(26): # ans = re.sub("([a-z])\\1","\\1",ans) # print(len(ans))
false
53.333333
[ "-import re", "-", "+# import re", "-ans = s", "-for i in range(26):", "- ans = re.sub(\"([a-z])\\\\1\", \"\\\\1\", ans)", "-print((len(ans)))", "+ans = 1", "+for i in range(1, len(s)):", "+ if s[i] != s[i - 1]:", "+ ans += 1", "+print(ans)", "+# またはa-zまで正規表現をかます", "+# for i i...
false
0.047269
0.034449
1.372144
[ "s808011539", "s771106325" ]
u212328220
p02732
python
s118820344
s925199882
433
278
26,772
33,920
Accepted
Accepted
35.8
from collections import Counter N = int(eval(input())) al = list(map(int, input().split())) C = Counter(al) # print(C) # print(C.values()) ans = 0 for i in list(C.values()): ans += i * (i - 1) / 2 for a in al: k = C[a] print((int(ans - (k * (k - 1) / 2) + (k - 1) * (k - 2) / 2)))
import math from collections import Counter import itertools n = int(eval(input())) al = list(map(int,input().split())) C_al = Counter(al) all = 0 for i in list(C_al.values()): all += i*(i-1)/2 for i in al: k = C_al[i] print((int(all - (k * (k - 1) / 2) + (k - 1) * (k - 2) / 2)))
14
17
294
304
from collections import Counter N = int(eval(input())) al = list(map(int, input().split())) C = Counter(al) # print(C) # print(C.values()) ans = 0 for i in list(C.values()): ans += i * (i - 1) / 2 for a in al: k = C[a] print((int(ans - (k * (k - 1) / 2) + (k - 1) * (k - 2) / 2)))
import math from collections import Counter import itertools n = int(eval(input())) al = list(map(int, input().split())) C_al = Counter(al) all = 0 for i in list(C_al.values()): all += i * (i - 1) / 2 for i in al: k = C_al[i] print((int(all - (k * (k - 1) / 2) + (k - 1) * (k - 2) / 2)))
false
17.647059
[ "+import math", "+import itertools", "-N = int(eval(input()))", "+n = int(eval(input()))", "-C = Counter(al)", "-# print(C)", "-# print(C.values())", "-ans = 0", "-for i in list(C.values()):", "- ans += i * (i - 1) / 2", "-for a in al:", "- k = C[a]", "- print((int(ans - (k * (k - 1...
false
0.042137
0.045996
0.916101
[ "s118820344", "s925199882" ]
u366959492
p02861
python
s893109430
s925920234
231
213
41,068
40,812
Accepted
Accepted
7.79
n=int(eval(input())) s=0 xy=[tuple(map(int,input().split())) for _ in range(n)] import itertools l=[i for i in range(1,n+1)] for y in itertools.permutations(l): for i in range(n-1): s+=((xy[y[i]-1][0]-xy[y[i+1]-1][0])**2+(xy[y[i]-1][1]-xy[y[i+1]-1][1])**2)**0.5 e=1 for i in range(1,n+1): e*=i ...
n=int(eval(input())) xy=[list(map(int,input().split())) for _ in range(n)] import itertools as it ans=0 for i in it.permutations(list(range(n)),n): x=xy[i[0]][0] y=xy[i[0]][1] for k in range(1,n): j=i[k] ans+=((x-xy[j][0])**2+(y-xy[j][1])**2)**0.5 x=xy[j][0] y=xy[j...
12
16
326
366
n = int(eval(input())) s = 0 xy = [tuple(map(int, input().split())) for _ in range(n)] import itertools l = [i for i in range(1, n + 1)] for y in itertools.permutations(l): for i in range(n - 1): s += ( (xy[y[i] - 1][0] - xy[y[i + 1] - 1][0]) ** 2 + (xy[y[i] - 1][1] - xy[y[i + 1] - ...
n = int(eval(input())) xy = [list(map(int, input().split())) for _ in range(n)] import itertools as it ans = 0 for i in it.permutations(list(range(n)), n): x = xy[i[0]][0] y = xy[i[0]][1] for k in range(1, n): j = i[k] ans += ((x - xy[j][0]) ** 2 + (y - xy[j][1]) ** 2) ** 0.5 x = xy...
false
25
[ "-s = 0", "-xy = [tuple(map(int, input().split())) for _ in range(n)]", "-import itertools", "+xy = [list(map(int, input().split())) for _ in range(n)]", "+import itertools as it", "-l = [i for i in range(1, n + 1)]", "-for y in itertools.permutations(l):", "- for i in range(n - 1):", "- s...
false
0.044363
0.045499
0.975024
[ "s893109430", "s925920234" ]
u899909022
p03044
python
s068373810
s108059662
1,346
813
46,032
47,444
Accepted
Accepted
39.6
n=int(eval(input())) L=[[] for i in range(n)] for i in range(n-1): u,v,w=list(map(int, input().split())) u-=1 v-=1 L[u].append([v,w]) L[v].append([u,w]) ans=[-1]*n ans[0]=0 que=[0] import queue que=queue.Queue() que.put(0) while not que.empty(): v=que.get() for u, w in L[v]: ...
n=int(eval(input())) L=[[] for i in range(n)] for i in range(n-1): u,v,w=list(map(int, input().split())) u-=1 v-=1 L[u].append([v,w]) L[v].append([u,w]) ans=[-1]*n ans[0]=0 from collections import deque stack=deque([]) stack.append(0) while stack: v=stack.popleft() for u, w in...
23
22
431
448
n = int(eval(input())) L = [[] for i in range(n)] for i in range(n - 1): u, v, w = list(map(int, input().split())) u -= 1 v -= 1 L[u].append([v, w]) L[v].append([u, w]) ans = [-1] * n ans[0] = 0 que = [0] import queue que = queue.Queue() que.put(0) while not que.empty(): v = que.get() for u...
n = int(eval(input())) L = [[] for i in range(n)] for i in range(n - 1): u, v, w = list(map(int, input().split())) u -= 1 v -= 1 L[u].append([v, w]) L[v].append([u, w]) ans = [-1] * n ans[0] = 0 from collections import deque stack = deque([]) stack.append(0) while stack: v = stack.popleft() ...
false
4.347826
[ "-que = [0]", "-import queue", "+from collections import deque", "-que = queue.Queue()", "-que.put(0)", "-while not que.empty():", "- v = que.get()", "+stack = deque([])", "+stack.append(0)", "+while stack:", "+ v = stack.popleft()", "- que.put(u)", "+ stack.appendleft(u)...
false
0.089925
0.087046
1.033078
[ "s068373810", "s108059662" ]
u313111801
p03036
python
s246004669
s722191812
31
26
9,084
9,108
Accepted
Accepted
16.13
import itertools x=[0]*1000 r,D,x[0]=list(map(int,input().split())) for i in range(0,99): x[i+1]=r*x[i]-D for i in range(10): print((x[i+1]))
import itertools r,D,x=list(map(int,input().split())) for i in range(10): x=r*x-D print(x)
8
6
150
99
import itertools x = [0] * 1000 r, D, x[0] = list(map(int, input().split())) for i in range(0, 99): x[i + 1] = r * x[i] - D for i in range(10): print((x[i + 1]))
import itertools r, D, x = list(map(int, input().split())) for i in range(10): x = r * x - D print(x)
false
25
[ "-x = [0] * 1000", "-r, D, x[0] = list(map(int, input().split()))", "-for i in range(0, 99):", "- x[i + 1] = r * x[i] - D", "+r, D, x = list(map(int, input().split()))", "- print((x[i + 1]))", "+ x = r * x - D", "+ print(x)" ]
false
0.135387
0.035728
3.789416
[ "s246004669", "s722191812" ]
u315354220
p03030
python
s676569451
s798800601
19
17
3,064
3,060
Accepted
Accepted
10.53
N = int(eval(input())) xy = [] for i in range(N): x, y = list(map(str, input().split())) y = int(y) xy.append([x, y]) sort_xy = sorted(sorted(xy), key=lambda x: (x[0],-x[1])) for i in range(N): for j in range(N): if sort_xy[i][0] == xy[j][0]: if sort_xy[i][1] == xy[j]...
N = int(eval(input())) xy = [] for i in range(N): x, y = input().split() xy.append([i + 1, x, int(y)]) sort_xy = sorted(sorted(xy), key=lambda x: (x[1],-x[2])) for i in range(N): print((sort_xy[i][0]))
15
11
342
219
N = int(eval(input())) xy = [] for i in range(N): x, y = list(map(str, input().split())) y = int(y) xy.append([x, y]) sort_xy = sorted(sorted(xy), key=lambda x: (x[0], -x[1])) for i in range(N): for j in range(N): if sort_xy[i][0] == xy[j][0]: if sort_xy[i][1] == xy[j][1]: ...
N = int(eval(input())) xy = [] for i in range(N): x, y = input().split() xy.append([i + 1, x, int(y)]) sort_xy = sorted(sorted(xy), key=lambda x: (x[1], -x[2])) for i in range(N): print((sort_xy[i][0]))
false
26.666667
[ "- x, y = list(map(str, input().split()))", "- y = int(y)", "- xy.append([x, y])", "-sort_xy = sorted(sorted(xy), key=lambda x: (x[0], -x[1]))", "+ x, y = input().split()", "+ xy.append([i + 1, x, int(y)])", "+sort_xy = sorted(sorted(xy), key=lambda x: (x[1], -x[2]))", "- for j in ra...
false
0.044746
0.044292
1.010238
[ "s676569451", "s798800601" ]
u961674365
p02690
python
s408747860
s589095713
1,131
51
9,164
8,996
Accepted
Accepted
95.49
x=int(eval(input())) for i in range(-1000,1000,1): for j in range(-1000,1000,1): if i**5-j**5==x: print((i,j)) exit()
x=int(eval(input())) for i in range(-150,150,1): for j in range(-150,150,1): if i**5-j**5==x: print((i,j)) exit()
6
6
150
147
x = int(eval(input())) for i in range(-1000, 1000, 1): for j in range(-1000, 1000, 1): if i**5 - j**5 == x: print((i, j)) exit()
x = int(eval(input())) for i in range(-150, 150, 1): for j in range(-150, 150, 1): if i**5 - j**5 == x: print((i, j)) exit()
false
0
[ "-for i in range(-1000, 1000, 1):", "- for j in range(-1000, 1000, 1):", "+for i in range(-150, 150, 1):", "+ for j in range(-150, 150, 1):" ]
false
2.76462
0.067004
41.260381
[ "s408747860", "s589095713" ]
u391589398
p02659
python
s194581081
s903027279
28
22
10,068
9,160
Accepted
Accepted
21.43
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[0]) * 100 + int(b[2]) * 10 + int(b[3]) print((a*b//100))
3
4
83
102
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[0]) * 100 + int(b[2]) * 10 + int(b[3]) 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[0]) * 100 + int(b[2]) * 10 + int(b[3])", "+print((a * b // 100))" ]
false
0.039147
0.035797
1.09359
[ "s194581081", "s903027279" ]
u600402037
p03731
python
s909550198
s900619809
186
150
25,200
26,832
Accepted
Accepted
19.35
N, T = list(map(int, input().split())) TL = [-T] + list(map(int, input().split())) answer = 0 for i in range(1, N+1): answer += T answer -= max(0, TL[i-1] + T - TL[i]) print(answer)
N, T = list(map(int, input().split())) TL = list(map(int, input().split())) answer = T for i in range(N-1): answer += min(TL[i+1] - TL[i], T) print(answer)
8
7
191
160
N, T = list(map(int, input().split())) TL = [-T] + list(map(int, input().split())) answer = 0 for i in range(1, N + 1): answer += T answer -= max(0, TL[i - 1] + T - TL[i]) print(answer)
N, T = list(map(int, input().split())) TL = list(map(int, input().split())) answer = T for i in range(N - 1): answer += min(TL[i + 1] - TL[i], T) print(answer)
false
12.5
[ "-TL = [-T] + list(map(int, input().split()))", "-answer = 0", "-for i in range(1, N + 1):", "- answer += T", "- answer -= max(0, TL[i - 1] + T - TL[i])", "+TL = list(map(int, input().split()))", "+answer = T", "+for i in range(N - 1):", "+ answer += min(TL[i + 1] - TL[i], T)" ]
false
0.075989
0.089372
0.850256
[ "s909550198", "s900619809" ]
u602740328
p03625
python
s686933763
s532755370
472
104
32,060
14,252
Accepted
Accepted
77.97
import numpy as np def search(A): B = list(set(A)) B.sort(reverse=True) if len(A)-len(B) == 0: return 0 a1 = 0 An = np.array(A) for n,(i, j) in enumerate(zip(An[0:-1], An[1:])): if i == j: a1 = i break del(A[:n+2]) return a1 N = int(eval(input())) A = list(map(int,...
def search(A): B = list(set(A)) if len(A)-len(B) == 0: return 0 a1 = 0 for n,(i, j) in enumerate(zip(A[0:-1], A[1:])): if i == j: a1 = i break del(A[:n+2]) return a1 N = int(eval(input())) A = list(map(int, input().split())) A = [a for a in A] A.sort(reverse=True) a1 = s...
25
21
453
385
import numpy as np def search(A): B = list(set(A)) B.sort(reverse=True) if len(A) - len(B) == 0: return 0 a1 = 0 An = np.array(A) for n, (i, j) in enumerate(zip(An[0:-1], An[1:])): if i == j: a1 = i break del A[: n + 2] return a1 N = int(eval(i...
def search(A): B = list(set(A)) if len(A) - len(B) == 0: return 0 a1 = 0 for n, (i, j) in enumerate(zip(A[0:-1], A[1:])): if i == j: a1 = i break del A[: n + 2] return a1 N = int(eval(input())) A = list(map(int, input().split())) A = [a for a in A] A.sor...
false
16
[ "-import numpy as np", "-", "-", "- B.sort(reverse=True)", "- An = np.array(A)", "- for n, (i, j) in enumerate(zip(An[0:-1], An[1:])):", "+ for n, (i, j) in enumerate(zip(A[0:-1], A[1:])):" ]
false
0.174386
0.035934
4.852996
[ "s686933763", "s532755370" ]
u347640436
p03231
python
s409907677
s502474300
80
50
17,464
5,344
Accepted
Accepted
37.5
from fractions import gcd def lcm(x, y): return x // gcd(x, y) * y N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) L = lcm(N, M) X = {} for i in range(N): X[(L // N) * i] = S[i] for i in range(M): if (L // M) * i in X and X[(L // M) * i] != T[i]: ...
from fractions import gcd def lcm(x, y): return x // gcd(x, y) * y N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) for i in range(N): if M * i % N == 0 and S[i] != T[M * i // N]: print((-1)) exit() print((lcm(N, M)))
22
16
338
265
from fractions import gcd def lcm(x, y): return x // gcd(x, y) * y N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) L = lcm(N, M) X = {} for i in range(N): X[(L // N) * i] = S[i] for i in range(M): if (L // M) * i in X and X[(L // M) * i] != T[i]: print((-1)) ex...
from fractions import gcd def lcm(x, y): return x // gcd(x, y) * y N, M = list(map(int, input().split())) S = eval(input()) T = eval(input()) for i in range(N): if M * i % N == 0 and S[i] != T[M * i // N]: print((-1)) exit() print((lcm(N, M)))
false
27.272727
[ "-L = lcm(N, M)", "-X = {}", "- X[(L // N) * i] = S[i]", "-for i in range(M):", "- if (L // M) * i in X and X[(L // M) * i] != T[i]:", "+ if M * i % N == 0 and S[i] != T[M * i // N]:", "-print(L)", "+print((lcm(N, M)))" ]
false
0.091946
0.047463
1.937214
[ "s409907677", "s502474300" ]
u543954314
p03987
python
s601222921
s483658196
416
325
35,880
40,532
Accepted
Accepted
21.88
n = int(eval(input())) a = list(map(int,input().split())) p = [0]*(n+1) ans = 0 for i in range(n): p[a[i]] = i+1 l = [i-1 for i in range(n+2)] l[0] = 0 r = [i+1 for i in range(n+2)] r[-1] = n+1 for i in range(n,0,-1): ans += (p[i]-l[p[i]])*(r[p[i]]-p[i])*i l[r[p[i]]] = l[p[i]] r[l[p[i]]] = r[p[i]] ...
N = int(eval(input())) a = list(map(int, input().split())) # indexをソート b = [0] * N for i in range(N): b[a[i] - 1] = i # 初期化 端っこ対策としてひとつ余計に取っている left = [0] * (N + 1) right = [0] * (N + 1) for i in range(N + 1): left[i] = i-1 right[i] = i+1 # 更新 for idx in reversed(b): left[right[idx]]...
15
25
325
456
n = int(eval(input())) a = list(map(int, input().split())) p = [0] * (n + 1) ans = 0 for i in range(n): p[a[i]] = i + 1 l = [i - 1 for i in range(n + 2)] l[0] = 0 r = [i + 1 for i in range(n + 2)] r[-1] = n + 1 for i in range(n, 0, -1): ans += (p[i] - l[p[i]]) * (r[p[i]] - p[i]) * i l[r[p[i]]] = l[p[i]] ...
N = int(eval(input())) a = list(map(int, input().split())) # indexをソート b = [0] * N for i in range(N): b[a[i] - 1] = i # 初期化 端っこ対策としてひとつ余計に取っている left = [0] * (N + 1) right = [0] * (N + 1) for i in range(N + 1): left[i] = i - 1 right[i] = i + 1 # 更新 for idx in reversed(b): left[right[idx]] = left[idx] ...
false
40
[ "-n = int(eval(input()))", "+N = int(eval(input()))", "-p = [0] * (n + 1)", "+# indexをソート", "+b = [0] * N", "+for i in range(N):", "+ b[a[i] - 1] = i", "+# 初期化 端っこ対策としてひとつ余計に取っている", "+left = [0] * (N + 1)", "+right = [0] * (N + 1)", "+for i in range(N + 1):", "+ left[i] = i - 1", "+ ...
false
0.008527
0.034264
0.24886
[ "s601222921", "s483658196" ]
u127499732
p03037
python
s853655455
s645480898
117
68
18,292
23,540
Accepted
Accepted
41.88
def main(): IN= open(0).read().split()[2:] left,right=-1*float("inf"),float("inf") for L,R in zip(IN[::2],IN[1::2]): L,R=int(L),int(R) if right<L or R<left: print((0)) break else: tmp=sorted([left,right,L,R]) left,right=tmp[1],tmp[2] else: print((right-lef...
def main(): IN=list(map(int,open(0).read().split()[2:]));L,R=max(IN[::2]),min(IN[1::2]);print((R-L+1 if R>=L else 0)) if __name__=="__main__": main()
17
4
361
154
def main(): IN = open(0).read().split()[2:] left, right = -1 * float("inf"), float("inf") for L, R in zip(IN[::2], IN[1::2]): L, R = int(L), int(R) if right < L or R < left: print((0)) break else: tmp = sorted([left, right, L, R]) left,...
def main(): IN = list(map(int, open(0).read().split()[2:])) L, R = max(IN[::2]), min(IN[1::2]) print((R - L + 1 if R >= L else 0)) if __name__ == "__main__": main()
false
76.470588
[ "- IN = open(0).read().split()[2:]", "- left, right = -1 * float(\"inf\"), float(\"inf\")", "- for L, R in zip(IN[::2], IN[1::2]):", "- L, R = int(L), int(R)", "- if right < L or R < left:", "- print((0))", "- break", "- else:", "- tmp =...
false
0.041772
0.047046
0.887895
[ "s853655455", "s645480898" ]
u727801592
p03835
python
s525909615
s942520919
1,691
1,466
2,940
3,060
Accepted
Accepted
13.31
K,S=list(map(int,input().split())) crt=0 for x in range(K+1): for y in range(K+1): if S-K<=x+y<=S: crt+=1 print(crt)
K,S=list(map(int,input().split())) crt=0 for x in range(0,K+1): for y in range(0,K+1): z=S-x-y if 0<=z<=K: crt+=1 print(crt)
7
8
128
141
K, S = list(map(int, input().split())) crt = 0 for x in range(K + 1): for y in range(K + 1): if S - K <= x + y <= S: crt += 1 print(crt)
K, S = list(map(int, input().split())) crt = 0 for x in range(0, K + 1): for y in range(0, K + 1): z = S - x - y if 0 <= z <= K: crt += 1 print(crt)
false
12.5
[ "-for x in range(K + 1):", "- for y in range(K + 1):", "- if S - K <= x + y <= S:", "+for x in range(0, K + 1):", "+ for y in range(0, K + 1):", "+ z = S - x - y", "+ if 0 <= z <= K:" ]
false
0.12338
0.046225
2.66909
[ "s525909615", "s942520919" ]
u790710233
p02803
python
s786040602
s394163398
1,587
1,332
3,944
4,080
Accepted
Accepted
16.07
# 上下左右どこでもいける # BFS from queue import Queue h, w = list(map(int, input().split())) MAZE = ['#'*(w+2)] for _ in range(h): MAZE.append("#"+eval(input())+"#") else: MAZE.append('#'*(w+2)) INF = 10**3 directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] def bfs(init_x, init_y): dp = [[INF]*(w+2) fo...
from queue import Queue h, w = list(map(int, input().split())) MAZE = ['#'*(w+2)] for _ in range(h): MAZE.append("#"+eval(input())+"#") else: MAZE.append('#'*(w+2)) INF = 10**3 directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] def bfs(init_x, init_y): dist = [[INF]*(w+2) for _ in range(h+2)] ...
42
38
1,036
911
# 上下左右どこでもいける # BFS from queue import Queue h, w = list(map(int, input().split())) MAZE = ["#" * (w + 2)] for _ in range(h): MAZE.append("#" + eval(input()) + "#") else: MAZE.append("#" * (w + 2)) INF = 10**3 directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] def bfs(init_x, init_y): dp = [[INF] * (w + 2) f...
from queue import Queue h, w = list(map(int, input().split())) MAZE = ["#" * (w + 2)] for _ in range(h): MAZE.append("#" + eval(input()) + "#") else: MAZE.append("#" * (w + 2)) INF = 10**3 directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] def bfs(init_x, init_y): dist = [[INF] * (w + 2) for _ in range(h + ...
false
9.52381
[ "-# 上下左右どこでもいける", "-# BFS", "- dp = [[INF] * (w + 2) for _ in range(h + 2)]", "- resisterd = [[0] * (w + 2) for _ in range(h + 2)]", "+ dist = [[INF] * (w + 2) for _ in range(h + 2)]", "- dp[init_x][init_y] = 0", "+ dist[init_x][init_y] = 0", "- if resisterd[x + i][y + j]:", ...
false
0.048329
0.083027
0.582083
[ "s786040602", "s394163398" ]
u754022296
p02913
python
s942751655
s272790413
1,069
959
232,072
231,944
Accepted
Accepted
10.29
n = int(eval(input())) S = eval(input()) dp = [[0]*n for _ in range(n)] for i in range(n-1, -1, -1): for j in range(n-1, -1, -1): if i == n-1: dp[i][j] = int(S[i] == S[j]) elif j == n-1: dp[i][j] = dp[j][i] else: if S[i] == S[j]: dp[i][j] = dp[i+1][j+1] + 1 ans = 0 f...
def main(): n = int(eval(input())) S = eval(input()) ans = 0 dp = [[0]*n for _ in range(n)] for j in range(n-1, 0, -1): for i in range(j-1, -1, -1): if j == n-1: dp[i][j] = int(S[i] == S[j]) else: if S[i] == S[j]: dp[i][j] = dp[i+1][j+1] + 1 ans = ma...
17
16
399
386
n = int(eval(input())) S = eval(input()) dp = [[0] * n for _ in range(n)] for i in range(n - 1, -1, -1): for j in range(n - 1, -1, -1): if i == n - 1: dp[i][j] = int(S[i] == S[j]) elif j == n - 1: dp[i][j] = dp[j][i] else: if S[i] == S[j]: ...
def main(): n = int(eval(input())) S = eval(input()) ans = 0 dp = [[0] * n for _ in range(n)] for j in range(n - 1, 0, -1): for i in range(j - 1, -1, -1): if j == n - 1: dp[i][j] = int(S[i] == S[j]) else: if S[i] == S[j]: ...
false
5.882353
[ "-n = int(eval(input()))", "-S = eval(input())", "-dp = [[0] * n for _ in range(n)]", "-for i in range(n - 1, -1, -1):", "- for j in range(n - 1, -1, -1):", "- if i == n - 1:", "- dp[i][j] = int(S[i] == S[j])", "- elif j == n - 1:", "- dp[i][j] = dp[j][i]", "...
false
0.038438
0.041929
0.916722
[ "s942751655", "s272790413" ]
u408260374
p00271
python
s848648087
s108041583
40
30
6,724
6,728
Accepted
Accepted
25
while True: try: a, b = list(map(int, input().split())) print((a-b)) except: break
for i in range(7): a, b = list(map(int, input().split())) print((a-b))
6
3
111
72
while True: try: a, b = list(map(int, input().split())) print((a - b)) except: break
for i in range(7): a, b = list(map(int, input().split())) print((a - b))
false
50
[ "-while True:", "- try:", "- a, b = list(map(int, input().split()))", "- print((a - b))", "- except:", "- break", "+for i in range(7):", "+ a, b = list(map(int, input().split()))", "+ print((a - b))" ]
false
0.070485
0.18954
0.371874
[ "s848648087", "s108041583" ]
u025945210
p02639
python
s354106609
s301536559
24
22
8,964
9,016
Accepted
Accepted
8.33
x = list(map(int,input().split())) for i in range(5): if x[i] == 0: print((i+1))
x = list(map(int,input().split())) for i in range(0, 5): if x[i] != 0: pass else: print((i+1))
4
6
93
118
x = list(map(int, input().split())) for i in range(5): if x[i] == 0: print((i + 1))
x = list(map(int, input().split())) for i in range(0, 5): if x[i] != 0: pass else: print((i + 1))
false
33.333333
[ "-for i in range(5):", "- if x[i] == 0:", "+for i in range(0, 5):", "+ if x[i] != 0:", "+ pass", "+ else:" ]
false
0.042166
0.040517
1.040713
[ "s354106609", "s301536559" ]
u314050667
p03557
python
s300444719
s953890438
913
280
33,488
26,760
Accepted
Accepted
69.33
import numpy as np import sys input = sys.stdin.readline N = int(eval(input())) A = np.array(input().split(), dtype=np.int64) B = np.array(input().split(), dtype=np.int64) C = np.array(input().split(), dtype=np.int64) A.sort() C.sort() ans = 0 for i in range(N): b = B[i] A_cnt = np.searchsorted(A, ...
import numpy as np import sys input = sys.stdin.readline N = int(eval(input())) A = np.array(input().split(), dtype=np.int64) B = np.array(input().split(), dtype=np.int64) C = np.array(input().split(), dtype=np.int64) A.sort() C.sort() A_cnt = np.searchsorted(A, B, side='left') C_cnt = np.searchsorted(...
20
18
416
382
import numpy as np import sys input = sys.stdin.readline N = int(eval(input())) A = np.array(input().split(), dtype=np.int64) B = np.array(input().split(), dtype=np.int64) C = np.array(input().split(), dtype=np.int64) A.sort() C.sort() ans = 0 for i in range(N): b = B[i] A_cnt = np.searchsorted(A, b, side="lef...
import numpy as np import sys input = sys.stdin.readline N = int(eval(input())) A = np.array(input().split(), dtype=np.int64) B = np.array(input().split(), dtype=np.int64) C = np.array(input().split(), dtype=np.int64) A.sort() C.sort() A_cnt = np.searchsorted(A, B, side="left") C_cnt = np.searchsorted(C, B, side="righ...
false
10
[ "-ans = 0", "-for i in range(N):", "- b = B[i]", "- A_cnt = np.searchsorted(A, b, side=\"left\")", "- C_cnt = np.searchsorted(C, b, side=\"right\")", "- ans += A_cnt * (N - C_cnt)", "+A_cnt = np.searchsorted(A, B, side=\"left\")", "+C_cnt = np.searchsorted(C, B, side=\"right\")", "+ans =...
false
0.224964
0.226142
0.994788
[ "s300444719", "s953890438" ]
u601393594
p03737
python
s113974632
s899042218
31
27
9,096
9,048
Accepted
Accepted
12.9
def generate_acronym(l1: list) -> str: answer = "" for i, word in enumerate(l1): # answer.append(word[0].upper()) answer += word[0].upper() return answer lists = list(map(str, input().split())) print((generate_acronym(lists)))
def generate_acronym(l1: list) -> str: answer = "" for word in l1: # answer.append(word[0].upper()) answer += word[0].upper() return answer lists = list(map(str, input().split())) print((generate_acronym(lists)))
11
11
266
252
def generate_acronym(l1: list) -> str: answer = "" for i, word in enumerate(l1): # answer.append(word[0].upper()) answer += word[0].upper() return answer lists = list(map(str, input().split())) print((generate_acronym(lists)))
def generate_acronym(l1: list) -> str: answer = "" for word in l1: # answer.append(word[0].upper()) answer += word[0].upper() return answer lists = list(map(str, input().split())) print((generate_acronym(lists)))
false
0
[ "- for i, word in enumerate(l1):", "+ for word in l1:" ]
false
0.037992
0.037131
1.023192
[ "s113974632", "s899042218" ]
u925782032
p03008
python
s511959529
s725749638
1,923
1,750
227,820
227,820
Accepted
Accepted
9
import sys range = xrange input = raw_input n = int(eval(input())) A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] DP = [0]*(n+1) DP[n] = n for j in range(3): sell = A[j] get_back = B[j] if get_back > sell: for i in reversed(list(range(sell,len(DP)))): ...
import sys range = xrange input = raw_input n = int(eval(input())) A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] DP = [0]*(n+1) DP[n] = n for j in range(3): sell = A[j] extra = B[j] - sell if extra > 0: for i in reversed(list(range(sell,len(DP)))): ...
36
31
791
685
import sys range = xrange input = raw_input n = int(eval(input())) A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] DP = [0] * (n + 1) DP[n] = n for j in range(3): sell = A[j] get_back = B[j] if get_back > sell: for i in reversed(list(range(sell, len(DP)))): v...
import sys range = xrange input = raw_input n = int(eval(input())) A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] DP = [0] * (n + 1) DP[n] = n for j in range(3): sell = A[j] extra = B[j] - sell if extra > 0: for i in reversed(list(range(sell, len(DP)))): if ...
false
13.888889
[ "- get_back = B[j]", "- if get_back > sell:", "+ extra = B[j] - sell", "+ if extra > 0:", "- val1 = DP[i - sell]", "- val2 = DP[i] + get_back - sell", "- if val2 > val1:", "- DP[i - sell] = val2", "+ if DP[i] + extra > DP[i - sel...
false
0.040151
0.036937
1.087007
[ "s511959529", "s725749638" ]
u488601719
p00722
python
s772661694
s340450360
620
410
61,752
45,892
Accepted
Accepted
33.87
prime = [False] * (10 ** 6) prime[0] = True prime[1] = True for i in range(2, 10 ** 6): if prime[i] == False: for j in range(i * 2, 10 ** 6, i): prime[j] = True while True: a, d, n = list(map(int, input().split())) if a == 0: break cnt = 0 for i in ran...
import math prime = [False] * (10 ** 6) prime[0] = True prime[1] = True limit = int(math.sqrt(10 ** 6) + 1) for i in range(2, limit): if prime[i] == False: for j in range(i * 2, 10 ** 6, i): prime[j] = True while True: a, d, n = list(map(int, input().split())) if a =...
22
26
451
503
prime = [False] * (10**6) prime[0] = True prime[1] = True for i in range(2, 10**6): if prime[i] == False: for j in range(i * 2, 10**6, i): prime[j] = True while True: a, d, n = list(map(int, input().split())) if a == 0: break cnt = 0 for i in range(a, 10**6, d): i...
import math prime = [False] * (10**6) prime[0] = True prime[1] = True limit = int(math.sqrt(10**6) + 1) for i in range(2, limit): if prime[i] == False: for j in range(i * 2, 10**6, i): prime[j] = True while True: a, d, n = list(map(int, input().split())) if a == 0: break cnt...
false
15.384615
[ "+import math", "+", "-for i in range(2, 10**6):", "+limit = int(math.sqrt(10**6) + 1)", "+for i in range(2, limit):" ]
false
2.092515
0.536579
3.899733
[ "s772661694", "s340450360" ]
u912237403
p00071
python
s122989119
s085413340
20
10
4,288
4,284
Accepted
Accepted
50
def bomb(x,y): global M s=M[y+2] R=[-3,-2,-1,1,2,3] if s[x+2]=="0":return M[y+2]=s[:x+2]+"0"+s[x+3:] for d in R: bomb(x+d,y) bomb(x,y+d) return A=list(range(14)) B=list(range(8)) M=["00000000000000" for i in A] z="000" n=eval(input()) for i in range(n): ...
def bomb(x,y): global M s=M[y+2] R=[-3,-2,-1,1,2,3] if s[x+2]=="0":return M[y+2]=s[:x+2]+"0"+s[x+3:] for d in R: bomb(x+d,y) bomb(x,y+d) return A=list(range(14)) B=list(range(3,11)) M=["00000000000000" for i in A] z="000" n=eval(input()) for i in range(n): ...
26
26
483
482
def bomb(x, y): global M s = M[y + 2] R = [-3, -2, -1, 1, 2, 3] if s[x + 2] == "0": return M[y + 2] = s[: x + 2] + "0" + s[x + 3 :] for d in R: bomb(x + d, y) bomb(x, y + d) return A = list(range(14)) B = list(range(8)) M = ["00000000000000" for i in A] z = "000" n ...
def bomb(x, y): global M s = M[y + 2] R = [-3, -2, -1, 1, 2, 3] if s[x + 2] == "0": return M[y + 2] = s[: x + 2] + "0" + s[x + 3 :] for d in R: bomb(x + d, y) bomb(x, y + d) return A = list(range(14)) B = list(range(3, 11)) M = ["00000000000000" for i in A] z = "000...
false
0
[ "-B = list(range(8))", "+B = list(range(3, 11))", "- M[j + 3] = z + input() + z", "+ M[j] = z + input() + z", "- print(M[j + 3][3:-3])", "+ print(M[j][3:-3])" ]
false
0.038078
0.070829
0.537597
[ "s122989119", "s085413340" ]
u562935282
p03045
python
s186053600
s165585332
596
524
5,488
63,152
Accepted
Accepted
12.08
class UnionFind(): def __init__(self, n): self.parent = [-1 for _ in range(n)] # 正==子: 根の頂点番号 / 負==根: 連結頂点数 def find(self, x): if self.parent[x] < 0: return x else: self.parent[x] = self.find(self.parent[x]) return self.parent[x] ...
import sys input = sys.stdin.readline class UnionFind: def __init__(self, n): self.v = [-1 for _ in range(n)] # 根(負): 連結頂点数 * (-1) / 子(正): 根の頂点番号(0-indexed) def find(self, x): # xを含む木における根の頂点番号を返す if self.v[x] < 0: # (負)は根 return x else: # 根の頂点番号 ...
44
46
1,038
1,278
class UnionFind: def __init__(self, n): self.parent = [-1 for _ in range(n)] # 正==子: 根の頂点番号 / 負==根: 連結頂点数 def find(self, x): if self.parent[x] < 0: return x else: self.parent[x] = self.find(self.parent[x]) return self.parent[x] def unite(...
import sys input = sys.stdin.readline class UnionFind: def __init__(self, n): self.v = [-1 for _ in range(n)] # 根(負): 連結頂点数 * (-1) / 子(正): 根の頂点番号(0-indexed) def find(self, x): # xを含む木における根の頂点番号を返す if self.v[x] < 0: # (負)は根 return x else: # 根の頂点番号 self.v[x]...
false
4.347826
[ "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "- self.parent = [-1 for _ in range(n)]", "- # 正==子: 根の頂点番号 / 負==根: 連結頂点数", "+ self.v = [-1 for _ in range(n)] # 根(負): 連結頂点数 * (-1) / 子(正): 根の頂点番号(0-indexed)", "- def find(self, x):", "- if self.parent[x] ...
false
0.08775
0.041607
2.109006
[ "s186053600", "s165585332" ]
u994988729
p02684
python
s524127534
s481726516
1,497
1,176
207,408
207,096
Accepted
Accepted
21.44
N, K = list(map(int, input().split())) D = K.bit_length() to = [[0] * D for _ in range(N)] for i, a in enumerate(map(int, input().split())): to[i][0] = a - 1 for j in range(D - 1): for i in range(N): to[i][j+1] = to[to[i][j]][j] v = 0 for i in reversed(list(range(D))): if (K >> i) & ...
def main(): N, K = list(map(int, input().split())) D = K.bit_length() to = [[0] * D for _ in range(N)] for i, a in enumerate(map(int, input().split())): to[i][0] = a - 1 for j in range(D - 1): for i in range(N): to[i][j+1] = to[to[i][j]][j] v = 0 f...
17
22
348
457
N, K = list(map(int, input().split())) D = K.bit_length() to = [[0] * D for _ in range(N)] for i, a in enumerate(map(int, input().split())): to[i][0] = a - 1 for j in range(D - 1): for i in range(N): to[i][j + 1] = to[to[i][j]][j] v = 0 for i in reversed(list(range(D))): if (K >> i) & 1: v =...
def main(): N, K = list(map(int, input().split())) D = K.bit_length() to = [[0] * D for _ in range(N)] for i, a in enumerate(map(int, input().split())): to[i][0] = a - 1 for j in range(D - 1): for i in range(N): to[i][j + 1] = to[to[i][j]][j] v = 0 for i in revers...
false
22.727273
[ "-N, K = list(map(int, input().split()))", "-D = K.bit_length()", "-to = [[0] * D for _ in range(N)]", "-for i, a in enumerate(map(int, input().split())):", "- to[i][0] = a - 1", "-for j in range(D - 1):", "- for i in range(N):", "- to[i][j + 1] = to[to[i][j]][j]", "-v = 0", "-for i i...
false
0.041561
0.084544
0.491594
[ "s524127534", "s481726516" ]
u006880673
p03546
python
s661243419
s086979748
427
76
82,728
68,176
Accepted
Accepted
82.2
H, W = list(map(int, input().split())) c = [list(map(int, input().split())) for _ in range(10)] counter = {i: 0 for i in range(-1, 10)} for i in range(H): tmp = list(map(int, input().split())) for j in range(W): counter[tmp[j]] += 1 MAX = 10**4 INF = float("inf") def f(start): if start =...
"""ABC079D Wall 別解 ワーシャルフロイドでやった場合 """ H, W = list(map(int, input().split())) c = [list(map(int, input().split())) for _ in range(10)] counter = {i: 0 for i in range(-1, 10)} for i in range(H): tmp = list(map(int, input().split())) for j in range(W): counter[tmp[j]] += 1 dp = c.copy() f...
27
24
693
561
H, W = list(map(int, input().split())) c = [list(map(int, input().split())) for _ in range(10)] counter = {i: 0 for i in range(-1, 10)} for i in range(H): tmp = list(map(int, input().split())) for j in range(W): counter[tmp[j]] += 1 MAX = 10**4 INF = float("inf") def f(start): if start == 1: ...
"""ABC079D Wall 別解 ワーシャルフロイドでやった場合 """ H, W = list(map(int, input().split())) c = [list(map(int, input().split())) for _ in range(10)] counter = {i: 0 for i in range(-1, 10)} for i in range(H): tmp = list(map(int, input().split())) for j in range(W): counter[tmp[j]] += 1 dp = c.copy() for k in range(10)...
false
11.111111
[ "+\"\"\"ABC079D Wall 別解", "+ワーシャルフロイドでやった場合", "+\"\"\"", "-MAX = 10**4", "-INF = float(\"inf\")", "-", "-", "-def f(start):", "- if start == 1:", "- return 0", "- dp = [[INF] * MAX for _ in range(10)]", "- dp[start][0] = 0", "- for i in range(1, MAX):", "- for new...
false
0.796691
0.037407
21.297684
[ "s661243419", "s086979748" ]
u667084803
p02722
python
s593316661
s623377446
627
94
9,692
67,760
Accepted
Accepted
85.01
N = int(eval(input())) def divisors(n): ret1 = [] ret2 = [] i = 1 while i**2 <= N: if n%i == 0: ret1 += [i] ret2 += [n//i] i += 1 return ret1 + ret2 ans1 = set(divisors(N-1)) ans2_cand = set(divisors(N)) ans2 = 0 for k in ans2_cand: if k...
N = int(eval(input())) def divisors(n): ret1 = [] ret2 = [] i = 1 while i**2 <= N: if n%i == 0: ret1 += [i] ret2 += [n//i] i += 1 return ret1 + ret2 ans1 = len(set(divisors(N-1))) - 1 ans2_cand = set(divisors(N)) ans2 = 0 for k in ans2_cand: ...
26
26
448
449
N = int(eval(input())) def divisors(n): ret1 = [] ret2 = [] i = 1 while i**2 <= N: if n % i == 0: ret1 += [i] ret2 += [n // i] i += 1 return ret1 + ret2 ans1 = set(divisors(N - 1)) ans2_cand = set(divisors(N)) ans2 = 0 for k in ans2_cand: if k == 1: ...
N = int(eval(input())) def divisors(n): ret1 = [] ret2 = [] i = 1 while i**2 <= N: if n % i == 0: ret1 += [i] ret2 += [n // i] i += 1 return ret1 + ret2 ans1 = len(set(divisors(N - 1))) - 1 ans2_cand = set(divisors(N)) ans2 = 0 for k in ans2_cand: if k...
false
0
[ "-ans1 = set(divisors(N - 1))", "+ans1 = len(set(divisors(N - 1))) - 1", "-print((len(ans1) + ans2 - 1))", "+print((ans1 + ans2))" ]
false
0.297016
0.118909
2.497852
[ "s593316661", "s623377446" ]
u347640436
p02971
python
s714386283
s855124506
709
559
15,636
14,112
Accepted
Accepted
21.16
# 累積和(max) N = int(eval(input())) a = [int(eval(input())) for _ in range(N)] lcm = a[:] rcm = a[:] for i in range(1, N): lcm[i] = max(lcm[i], lcm[i - 1]) for i in range(N - 2, -1, -1): rcm[i] = max(rcm[i], rcm[i + 1]) print((rcm[1])) for i in range(1, N - 1): print((max(lcm[i - 1], rcm[i + 1]))) print...
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] b = A[:] b.sort(reverse=True) for i in range(N): if A[i] != b[0]: print((b[0])) else: print((b[1]))
13
10
317
184
# 累積和(max) N = int(eval(input())) a = [int(eval(input())) for _ in range(N)] lcm = a[:] rcm = a[:] for i in range(1, N): lcm[i] = max(lcm[i], lcm[i - 1]) for i in range(N - 2, -1, -1): rcm[i] = max(rcm[i], rcm[i + 1]) print((rcm[1])) for i in range(1, N - 1): print((max(lcm[i - 1], rcm[i + 1]))) print((lcm[...
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] b = A[:] b.sort(reverse=True) for i in range(N): if A[i] != b[0]: print((b[0])) else: print((b[1]))
false
23.076923
[ "-# 累積和(max)", "-a = [int(eval(input())) for _ in range(N)]", "-lcm = a[:]", "-rcm = a[:]", "-for i in range(1, N):", "- lcm[i] = max(lcm[i], lcm[i - 1])", "-for i in range(N - 2, -1, -1):", "- rcm[i] = max(rcm[i], rcm[i + 1])", "-print((rcm[1]))", "-for i in range(1, N - 1):", "- print...
false
0.042669
0.043471
0.981563
[ "s714386283", "s855124506" ]
u138486156
p03147
python
s696691566
s843915206
134
18
3,064
2,940
Accepted
Accepted
86.57
n = int(eval(input())) h = list(map(int, input().split())) c = 0 while any(h): ans = 0 for l in range(n): tmp = 0 r = l while h[r]: tmp += 1 r += 1 if r == n: break if ans < tmp: x = l y ...
n = int(eval(input())) h = list(map(int, input().split())) ans = h[0] for i in range(n-1): ans += max(h[i+1]-h[i], 0) print(ans)
22
7
409
134
n = int(eval(input())) h = list(map(int, input().split())) c = 0 while any(h): ans = 0 for l in range(n): tmp = 0 r = l while h[r]: tmp += 1 r += 1 if r == n: break if ans < tmp: x = l y = r a...
n = int(eval(input())) h = list(map(int, input().split())) ans = h[0] for i in range(n - 1): ans += max(h[i + 1] - h[i], 0) print(ans)
false
68.181818
[ "-c = 0", "-while any(h):", "- ans = 0", "- for l in range(n):", "- tmp = 0", "- r = l", "- while h[r]:", "- tmp += 1", "- r += 1", "- if r == n:", "- break", "- if ans < tmp:", "- x = l", "- ...
false
0.05745
0.034448
1.667762
[ "s696691566", "s843915206" ]
u374051158
p03457
python
s191938573
s561548312
420
375
28,148
27,380
Accepted
Accepted
10.71
N = int(eval(input())) txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)] result = True for i in range(N): dt = txy[i + 1][0] - txy[i][0] dist = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2]) if(dist > dt): result = False if(dist % 2 != dt % 2): resul...
N = int(eval(input())) txy = [list(map(int, input().split())) for _ in range(N)] result = True for pol in txy: dist = abs(pol[1]) + abs(pol[2]) if(dist > pol[0]): result = False if(dist % 2 != pol[0] % 2): result = False print((("No", "Yes")[result]))
12
11
355
272
N = int(eval(input())) txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)] result = True for i in range(N): dt = txy[i + 1][0] - txy[i][0] dist = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2]) if dist > dt: result = False if dist % 2 != dt % 2: result...
N = int(eval(input())) txy = [list(map(int, input().split())) for _ in range(N)] result = True for pol in txy: dist = abs(pol[1]) + abs(pol[2]) if dist > pol[0]: result = False if dist % 2 != pol[0] % 2: result = False print((("No", "Yes")[result]))
false
8.333333
[ "-txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]", "+txy = [list(map(int, input().split())) for _ in range(N)]", "-for i in range(N):", "- dt = txy[i + 1][0] - txy[i][0]", "- dist = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])", "- if dist > dt:", "+f...
false
0.060472
0.038491
1.571089
[ "s191938573", "s561548312" ]
u642874916
p03476
python
s495974097
s325103198
518
462
80,728
78,552
Accepted
Accepted
10.81
from heapq import heappush, heappop, heapify from collections import deque, defaultdict, Counter import itertools from itertools import permutations, combinations, accumulate import sys import bisect import string import math import time from fractions import gcd #import random def I(): return int(inpu...
from heapq import heappush, heappop, heapify from collections import deque, defaultdict, Counter import itertools from itertools import permutations, combinations, accumulate import sys import bisect import string import math import time from fractions import gcd #import random def I(): return int(inpu...
94
91
1,736
1,788
from heapq import heappush, heappop, heapify from collections import deque, defaultdict, Counter import itertools from itertools import permutations, combinations, accumulate import sys import bisect import string import math import time from fractions import gcd # import random def I(): return int(input()) def ...
from heapq import heappush, heappop, heapify from collections import deque, defaultdict, Counter import itertools from itertools import permutations, combinations, accumulate import sys import bisect import string import math import time from fractions import gcd # import random def I(): return int(input()) def ...
false
3.191489
[ "-", "-", "-def is_prime(n):", "- \"\"\"", "- nの素数判定", "- :param int n:", "- :rtype: Bool", "- \"\"\"", "- if n == 1:", "- return False", "+# エラトステネスのふるい 素数の列挙", "+def primes(n):", "+ is_prime = [1] * (n + 1)", "+ is_prime[0] = 0", "+ is_prime[1] = 0", ...
false
0.858953
0.344281
2.494917
[ "s495974097", "s325103198" ]
u227082700
p02954
python
s606884795
s942120276
141
130
7,168
6,400
Accepted
Accepted
7.8
s=eval(input()) n=len(s) ans=[1]*n anss=[0]*n for i in range(n): if s[i]=="R": if s[i+1]=="R": ans[i+1]+=ans[i] ans[i]=0 else: anss[i+1]+=ans[i]//2 anss[i]+=0--ans[i]//2 for i in range(n-1,-1,-1): if s[i]=="L": if s[i-1]=="L": ans[i-1]+=ans[i] ans[i]=0...
s=eval(input()) n=len(s) ans=[1]*n for i in range(1,n-1): if s[i-1]==s[i]=="R": ans[i+1]+=ans[i-1] ans[i-1]=0 for i in range(n-2,0,-1): if s[i]==s[i+1]=="L": ans[i-1]+=ans[i+1] ans[i+1]=0 print((*ans))
21
12
396
214
s = eval(input()) n = len(s) ans = [1] * n anss = [0] * n for i in range(n): if s[i] == "R": if s[i + 1] == "R": ans[i + 1] += ans[i] ans[i] = 0 else: anss[i + 1] += ans[i] // 2 anss[i] += 0 - -ans[i] // 2 for i in range(n - 1, -1, -1): if s[i] == ...
s = eval(input()) n = len(s) ans = [1] * n for i in range(1, n - 1): if s[i - 1] == s[i] == "R": ans[i + 1] += ans[i - 1] ans[i - 1] = 0 for i in range(n - 2, 0, -1): if s[i] == s[i + 1] == "L": ans[i - 1] += ans[i + 1] ans[i + 1] = 0 print((*ans))
false
42.857143
[ "-anss = [0] * n", "-for i in range(n):", "- if s[i] == \"R\":", "- if s[i + 1] == \"R\":", "- ans[i + 1] += ans[i]", "- ans[i] = 0", "- else:", "- anss[i + 1] += ans[i] // 2", "- anss[i] += 0 - -ans[i] // 2", "-for i in range(n - 1, -1,...
false
0.042698
0.043594
0.979429
[ "s606884795", "s942120276" ]
u312025627
p03828
python
s529456672
s959301301
204
168
39,280
38,640
Accepted
Accepted
17.65
def main(): N = int(eval(input())) MOD = 10**9 + 7 ans = 1 primes = sorted(Eratosthenes(N)) for p in primes: cur = 0 k = 1 while p**k <= N: cur += N//(p**k) k += 1 ans = ans * (cur+1) % MOD print((ans%MOD)) def Eratosthenes(x...
def main(): N = int(eval(input())) MOD = 10**9 + 7 def Eratosthenes(sup: int) -> set: from math import sqrt primes = {i for i in range(2, sup+1)} for i in range(2, int(sqrt(sup+1))+1): if i in primes: mul = 2 while i*mul <= sup: ...
29
30
681
691
def main(): N = int(eval(input())) MOD = 10**9 + 7 ans = 1 primes = sorted(Eratosthenes(N)) for p in primes: cur = 0 k = 1 while p**k <= N: cur += N // (p**k) k += 1 ans = ans * (cur + 1) % MOD print((ans % MOD)) def Eratosthenes(x: int) ...
def main(): N = int(eval(input())) MOD = 10**9 + 7 def Eratosthenes(sup: int) -> set: from math import sqrt primes = {i for i in range(2, sup + 1)} for i in range(2, int(sqrt(sup + 1)) + 1): if i in primes: mul = 2 while i * mul <= sup: ...
false
3.333333
[ "+", "+ def Eratosthenes(sup: int) -> set:", "+ from math import sqrt", "+", "+ primes = {i for i in range(2, sup + 1)}", "+ for i in range(2, int(sqrt(sup + 1)) + 1):", "+ if i in primes:", "+ mul = 2", "+ while i * mul <= sup:", "+...
false
0.080347
0.096757
0.830397
[ "s529456672", "s959301301" ]
u733011130
p02597
python
s976779952
s783672683
112
80
73,772
80,844
Accepted
Accepted
28.57
import sys readline = sys.stdin.readline from collections import deque def solve(): N = int(readline()) C = readline().rstrip() R, W = 'R', 'W' reds = deque(i for i in range(len(C)) if C[i] == 'R') whites = deque(i for i in range(len(C)) if C[i] == 'W') count = 0 while len(wh...
import sys readline = sys.stdin.readline def solve(): N = int(readline()) C = readline().rstrip() reds = [i for i in range(len(C)) if C[i] == 'R'] whites = [i for i in range(len(C)) if C[i] == 'W'] i = 0 n = min(len(reds), len(whites)) while i < n and reds[-1-i] > whites[i]: ...
21
18
474
365
import sys readline = sys.stdin.readline from collections import deque def solve(): N = int(readline()) C = readline().rstrip() R, W = "R", "W" reds = deque(i for i in range(len(C)) if C[i] == "R") whites = deque(i for i in range(len(C)) if C[i] == "W") count = 0 while len(whites) > 0 and...
import sys readline = sys.stdin.readline def solve(): N = int(readline()) C = readline().rstrip() reds = [i for i in range(len(C)) if C[i] == "R"] whites = [i for i in range(len(C)) if C[i] == "W"] i = 0 n = min(len(reds), len(whites)) while i < n and reds[-1 - i] > whites[i]: i +...
false
14.285714
[ "-from collections import deque", "- R, W = \"R\", \"W\"", "- reds = deque(i for i in range(len(C)) if C[i] == \"R\")", "- whites = deque(i for i in range(len(C)) if C[i] == \"W\")", "- count = 0", "- while len(whites) > 0 and len(reds) > 0 and whites[0] < reds[-1]:", "- reds.pop()...
false
0.035553
0.069107
0.514466
[ "s976779952", "s783672683" ]
u146816547
p01126
python
s691017639
s094551666
180
160
4,936
4,908
Accepted
Accepted
11.11
while True: n, m, a = list(map(int, input().split())) if n == 0 and m == 0 and a == 0: break hl = [list(map(int, input().split())) for _ in range(m)] hl.sort(key=lambda x:x[0], reverse=True) ans = a for i in range(m): if ans == hl[i][1]: ans = hl[i][2...
while True: n, m, a = list(map(int, input().split())) if n == 0 and m == 0 and a == 0: break hl = [list(map(int, input().split())) for _ in range(m)] hl.sort(reverse=True) ans = a for i in range(m): if ans == hl[i][1]: ans = hl[i][2] elif ans...
19
19
396
377
while True: n, m, a = list(map(int, input().split())) if n == 0 and m == 0 and a == 0: break hl = [list(map(int, input().split())) for _ in range(m)] hl.sort(key=lambda x: x[0], reverse=True) ans = a for i in range(m): if ans == hl[i][1]: ans = hl[i][2] elif a...
while True: n, m, a = list(map(int, input().split())) if n == 0 and m == 0 and a == 0: break hl = [list(map(int, input().split())) for _ in range(m)] hl.sort(reverse=True) ans = a for i in range(m): if ans == hl[i][1]: ans = hl[i][2] elif ans == hl[i][2]: ...
false
0
[ "- hl.sort(key=lambda x: x[0], reverse=True)", "+ hl.sort(reverse=True)" ]
false
0.036494
0.045744
0.797796
[ "s691017639", "s094551666" ]
u028973125
p03545
python
s981788517
s465249957
184
29
38,512
9,220
Accepted
Accepted
84.24
import sys from pprint import pprint from operator import add, sub from collections import deque s =[int(s_i) for s_i in sys.stdin.readline().strip()] # pprint(s) for op1 in (add, sub): for op2 in (add, sub): for op3 in (add, sub): if op3 ( op2 ( op1 (s[0], s[1]), s[2]), s[3]) =...
import sys tmp = list(sys.stdin.readline().strip()) nums = list(map(int, tmp)) for a in range(2): for b in range(2): for c in range(2): tmp = nums[0] exp = str(nums[0]) if a == 0: tmp += nums[1] exp += "+" else: ...
18
34
608
892
import sys from pprint import pprint from operator import add, sub from collections import deque s = [int(s_i) for s_i in sys.stdin.readline().strip()] # pprint(s) for op1 in (add, sub): for op2 in (add, sub): for op3 in (add, sub): if op3(op2(op1(s[0], s[1]), s[2]), s[3]) == 7: ...
import sys tmp = list(sys.stdin.readline().strip()) nums = list(map(int, tmp)) for a in range(2): for b in range(2): for c in range(2): tmp = nums[0] exp = str(nums[0]) if a == 0: tmp += nums[1] exp += "+" else: ...
false
47.058824
[ "-from pprint import pprint", "-from operator import add, sub", "-from collections import deque", "-s = [int(s_i) for s_i in sys.stdin.readline().strip()]", "-# pprint(s)", "-for op1 in (add, sub):", "- for op2 in (add, sub):", "- for op3 in (add, sub):", "- if op3(op2(op1(s[0],...
false
0.037843
0.169076
0.223819
[ "s981788517", "s465249957" ]
u968166680
p03003
python
s262465182
s067543245
163
139
98,444
98,352
Accepted
Accepted
14.72
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, M = list(map(int, readline().split())) S = list(map(int, readline().split())) T = list(map(int, readline().split())) ...
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, M = list(map(int, readline().split())) S = list(map(int, readline().split())) T = list(map(int, readline().split())) ...
34
34
793
798
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, M = list(map(int, readline().split())) S = list(map(int, readline().split())) T = list(map(int, readline().split())) dp = [[0] * (M...
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, M = list(map(int, readline().split())) S = list(map(int, readline().split())) T = list(map(int, readline().split())) dp = [[0] * (M...
false
0
[ "- dp[0][0] = 1", "- dp[i + 1][j + 1] = (dp[i][j + 1] + dp[i + 1][j] - dp[i][j]) % MOD", "- dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % MOD", "+ dp[i + 1][j + 1] = (dp[i][j + 1] + dp[i + 1][j]) % MOD", "+ else:", "+ dp[i + 1][j +...
false
0.115676
0.143553
0.805808
[ "s262465182", "s067543245" ]
u312025627
p03006
python
s447623232
s360134766
190
174
39,152
39,280
Accepted
Accepted
8.42
def main(): N = int(input()) A = [[int(i) for i in input().split()] for j in range(N)] if N == 1: return print(1) A.sort() from collections import defaultdict cnt = defaultdict(int) for i in range(N): for j in range(i+1, N): # print(A[i], A[j], (A[j][0] ...
def main(): import sys input = sys.stdin.buffer.readline N = int(eval(input())) XY = [[int(i) for i in input().split()] for j in range(N)] XY.sort() from collections import Counter c = Counter() for i in range(N-1): for j in range(i+1, N): p = XY[j][0] - XY[...
19
19
550
496
def main(): N = int(input()) A = [[int(i) for i in input().split()] for j in range(N)] if N == 1: return print(1) A.sort() from collections import defaultdict cnt = defaultdict(int) for i in range(N): for j in range(i + 1, N): # print(A[i], A[j], (A[j][0] - A[i][...
def main(): import sys input = sys.stdin.buffer.readline N = int(eval(input())) XY = [[int(i) for i in input().split()] for j in range(N)] XY.sort() from collections import Counter c = Counter() for i in range(N - 1): for j in range(i + 1, N): p = XY[j][0] - XY[i][0...
false
0
[ "- N = int(input())", "- A = [[int(i) for i in input().split()] for j in range(N)]", "- if N == 1:", "- return print(1)", "- A.sort()", "- from collections import defaultdict", "+ import sys", "- cnt = defaultdict(int)", "- for i in range(N):", "+ input = sys.stdi...
false
0.041288
0.045932
0.898895
[ "s447623232", "s360134766" ]
u831053714
p02639
python
s900105979
s128039467
28
20
9,108
9,156
Accepted
Accepted
28.57
L=[int(x) for x in input().split(" ")] print((L.index(0)+1))
L=[int(x) for x in input().split(" ")] print((L.index(0)+1)) L.clear()
2
3
59
70
L = [int(x) for x in input().split(" ")] print((L.index(0) + 1))
L = [int(x) for x in input().split(" ")] print((L.index(0) + 1)) L.clear()
false
33.333333
[ "+L.clear()" ]
false
0.039213
0.040031
0.979555
[ "s900105979", "s128039467" ]
u298297089
p03238
python
s138934698
s377867595
168
17
38,384
2,940
Accepted
Accepted
89.88
N = int(eval(input())) if N == 1: print('Hello World') else: print((int(eval(input())) + int(eval(input()))))
n = int(eval(input())) if n == 1: print('Hello World') else : print((int(eval(input())) + int(eval(input()))))
5
5
98
98
N = int(eval(input())) if N == 1: print("Hello World") else: print((int(eval(input())) + int(eval(input()))))
n = int(eval(input())) if n == 1: print("Hello World") else: print((int(eval(input())) + int(eval(input()))))
false
0
[ "-N = int(eval(input()))", "-if N == 1:", "+n = int(eval(input()))", "+if n == 1:" ]
false
0.043833
0.040867
1.072589
[ "s138934698", "s377867595" ]
u669819350
p02720
python
s204062925
s150979380
201
108
46,428
11,980
Accepted
Accepted
46.27
def solve(K): ref = [[['0'], ['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']]] if K < 10: return ref[0][K][0] rest = K - 9 i = 0 while True: i += 1 ref.append([[] for _ in range(10)]) for j in range(10): if j == 0: ...
from collections import deque def solve(K): stack = deque([1, 2, 3, 4, 5, 6, 7, 8, 9]) for _ in range(K): num = stack.popleft() one_digit = num % 10 if one_digit % 10 == 0: nexts = [num * 10, num * 10 + 1] elif one_digit % 10 == 9: nexts = [num ...
30
21
971
600
def solve(K): ref = [[["0"], ["1"], ["2"], ["3"], ["4"], ["5"], ["6"], ["7"], ["8"], ["9"]]] if K < 10: return ref[0][K][0] rest = K - 9 i = 0 while True: i += 1 ref.append([[] for _ in range(10)]) for j in range(10): if j == 0: for r in re...
from collections import deque def solve(K): stack = deque([1, 2, 3, 4, 5, 6, 7, 8, 9]) for _ in range(K): num = stack.popleft() one_digit = num % 10 if one_digit % 10 == 0: nexts = [num * 10, num * 10 + 1] elif one_digit % 10 == 9: nexts = [num * 10 + 8,...
false
30
[ "+from collections import deque", "+", "+", "- ref = [[[\"0\"], [\"1\"], [\"2\"], [\"3\"], [\"4\"], [\"5\"], [\"6\"], [\"7\"], [\"8\"], [\"9\"]]]", "- if K < 10:", "- return ref[0][K][0]", "- rest = K - 9", "- i = 0", "- while True:", "- i += 1", "- ref.append...
false
0.039712
0.044871
0.885045
[ "s204062925", "s150979380" ]
u843175622
p02580
python
s308251016
s706260971
561
265
114,620
34,652
Accepted
Accepted
52.76
import numpy as np import sys from numba import njit, i4 read = sys.stdin.read @njit((i4[:],), cache=True) def solve(stdin): h, w, m = stdin[:3] row = np.zeros(h, np.int32) col = np.zeros(w, np.int32) for i in range(3, m * 2 + 3, 2): y, x = stdin[i: i + 2] - 1 row[y] += 1 col[x] += 1 max_c...
import numpy as np import sys read = sys.stdin.read if sys.argv[-1] == 'ONLINE_JUDGE': from numba.pycc import CC cc = CC('unko') @cc.export('solve', '(i4[:],)') def solve(stdin): h, w, m = stdin[:3] row = np.zeros(h, np.int32) col = np.zeros(w, np.int32) for i in range(3, m * 2 + 3, 2): ...
27
34
672
800
import numpy as np import sys from numba import njit, i4 read = sys.stdin.read @njit((i4[:],), cache=True) def solve(stdin): h, w, m = stdin[:3] row = np.zeros(h, np.int32) col = np.zeros(w, np.int32) for i in range(3, m * 2 + 3, 2): y, x = stdin[i : i + 2] - 1 row[y] += 1 col...
import numpy as np import sys read = sys.stdin.read if sys.argv[-1] == "ONLINE_JUDGE": from numba.pycc import CC cc = CC("unko") @cc.export("solve", "(i4[:],)") def solve(stdin): h, w, m = stdin[:3] row = np.zeros(h, np.int32) col = np.zeros(w, np.int32) for i in range...
false
20.588235
[ "-from numba import njit, i4", "+if sys.argv[-1] == \"ONLINE_JUDGE\":", "+ from numba.pycc import CC", "+ cc = CC(\"unko\")", "-@njit((i4[:],), cache=True)", "-def solve(stdin):", "- h, w, m = stdin[:3]", "- row = np.zeros(h, np.int32)", "- col = np.zeros(w, np.int32)", "- for i ...
false
0.496764
0.18224
2.725881
[ "s308251016", "s706260971" ]
u447342168
p03449
python
s035159594
s734506011
151
21
12,444
3,316
Accepted
Accepted
86.09
import numpy as np N = int(eval(input())) first = np.array([int(i) for i in input().split()]) second = np.array([int(i) for i in input().split()]) fstsum = np.cumsum(first) scdsum = np.cumsum(second[::-1])[::-1] result = 0 for i in range(N): res = fstsum[i] + scdsum[i] if result < res: result ...
N = int(eval(input())) first = [int(i) for i in input().split()] second = [int(i) for i in input().split()] result = 0 for i in range(N+1): res = sum(first[:i]) + sum(second[i-1:]) if result < res: result = res print(result)
12
9
334
242
import numpy as np N = int(eval(input())) first = np.array([int(i) for i in input().split()]) second = np.array([int(i) for i in input().split()]) fstsum = np.cumsum(first) scdsum = np.cumsum(second[::-1])[::-1] result = 0 for i in range(N): res = fstsum[i] + scdsum[i] if result < res: result = res pri...
N = int(eval(input())) first = [int(i) for i in input().split()] second = [int(i) for i in input().split()] result = 0 for i in range(N + 1): res = sum(first[:i]) + sum(second[i - 1 :]) if result < res: result = res print(result)
false
25
[ "-import numpy as np", "-", "-first = np.array([int(i) for i in input().split()])", "-second = np.array([int(i) for i in input().split()])", "-fstsum = np.cumsum(first)", "-scdsum = np.cumsum(second[::-1])[::-1]", "+first = [int(i) for i in input().split()]", "+second = [int(i) for i in input().split(...
false
0.206114
0.035027
5.884406
[ "s035159594", "s734506011" ]
u794173881
p03321
python
s944343577
s452499186
1,127
594
96,088
114,780
Accepted
Accepted
47.29
from collections import deque n, m = list(map(int, input().split())) info = [list(map(int, input().split())) for i in range(m)] matrix = [[0]*n for i in range(n)] for i in range(m): a, b = info[i] a -= 1 b -= 1 matrix[a][b] = 1 matrix[b][a] = 1 graph = [[] for i in range(n)] for i...
import sys input = sys.stdin.readline def is_bipartite(graph, s): """二部グラフ判定する""" n = len(graph) col = [-1] * n col[s] = 0 stack = [s] used[s] = True while stack: v = stack.pop() for nxt_v in graph[v]: used[nxt_v] = True if col[nxt_v] ...
67
88
1,626
2,101
from collections import deque n, m = list(map(int, input().split())) info = [list(map(int, input().split())) for i in range(m)] matrix = [[0] * n for i in range(n)] for i in range(m): a, b = info[i] a -= 1 b -= 1 matrix[a][b] = 1 matrix[b][a] = 1 graph = [[] for i in range(n)] for i in range(n): ...
import sys input = sys.stdin.readline def is_bipartite(graph, s): """二部グラフ判定する""" n = len(graph) col = [-1] * n col[s] = 0 stack = [s] used[s] = True while stack: v = stack.pop() for nxt_v in graph[v]: used[nxt_v] = True if col[nxt_v] == -1: ...
false
23.863636
[ "-from collections import deque", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "+def is_bipartite(graph, s):", "+ \"\"\"二部グラフ判定する\"\"\"", "+ n = len(graph)", "+ col = [-1] * n", "+ col[s] = 0", "+ stack = [s]", "+ used[s] = True", "+ while stack:", "+...
false
0.036672
0.062964
0.582426
[ "s944343577", "s452499186" ]
u580697892
p02689
python
s959995530
s384970397
306
265
24,520
20,108
Accepted
Accepted
13.4
#coding: utf-8 #coding: utf-8 N, M = list(map(int, input().split())) H = list(map(int, input().split())) d = {i:H[i-1] for i in range(1, N+1)} F = [True for _ in range(N)] for i in range(M): a, b = list(map(int, input().split())) if d[a] <= H[b-1]: F[a-1] = False if d[b] <= H[a-1]: ...
#coding: utf-8 N, M = list(map(int, input().split())) H = list(map(int, input().split())) ans = [True for _ in range(N)] for i in range(M): a, b = list(map(int, input().split())) if H[a-1] <= H[b-1]: ans[a-1] = False if H[b-1] <= H[a-1]: ans[b-1] = False print((sum(ans)))
13
12
339
299
# coding: utf-8 # coding: utf-8 N, M = list(map(int, input().split())) H = list(map(int, input().split())) d = {i: H[i - 1] for i in range(1, N + 1)} F = [True for _ in range(N)] for i in range(M): a, b = list(map(int, input().split())) if d[a] <= H[b - 1]: F[a - 1] = False if d[b] <= H[a - 1]: ...
# coding: utf-8 N, M = list(map(int, input().split())) H = list(map(int, input().split())) ans = [True for _ in range(N)] for i in range(M): a, b = list(map(int, input().split())) if H[a - 1] <= H[b - 1]: ans[a - 1] = False if H[b - 1] <= H[a - 1]: ans[b - 1] = False print((sum(ans)))
false
7.692308
[ "-# coding: utf-8", "-d = {i: H[i - 1] for i in range(1, N + 1)}", "-F = [True for _ in range(N)]", "+ans = [True for _ in range(N)]", "- if d[a] <= H[b - 1]:", "- F[a - 1] = False", "- if d[b] <= H[a - 1]:", "- F[b - 1] = False", "-print((sum(F)))", "+ if H[a - 1] <= H[b - ...
false
0.114618
0.114174
1.003891
[ "s959995530", "s384970397" ]
u044952145
p02838
python
s702206290
s487518546
1,539
919
122,936
137,400
Accepted
Accepted
40.29
N = int(eval(input())) A = list(map(int, input().split())) each_bit_sum = [{"0": 0, "1": 0} for _ in range(62)] result = 0 for a in A: for i, b in enumerate(format(a, "b").zfill(62)[::-1]): each_bit_sum[i][b] += 1 for i, b in enumerate(each_bit_sum): result += ((b["0"] * b["1"]) * (2**i)) ...
N = int(eval(input())) A = list(map(int, input().split())) result = 0 for i in range(60): on = sum([(1 << i) & a for a in A]) >> i result += (on * (N - on)) << i result %= ((10**9) + 7) print(result)
13
10
363
218
N = int(eval(input())) A = list(map(int, input().split())) each_bit_sum = [{"0": 0, "1": 0} for _ in range(62)] result = 0 for a in A: for i, b in enumerate(format(a, "b").zfill(62)[::-1]): each_bit_sum[i][b] += 1 for i, b in enumerate(each_bit_sum): result += ((b["0"] * b["1"]) * (2**i)) % ((10**9) + 7...
N = int(eval(input())) A = list(map(int, input().split())) result = 0 for i in range(60): on = sum([(1 << i) & a for a in A]) >> i result += (on * (N - on)) << i result %= (10**9) + 7 print(result)
false
23.076923
[ "-each_bit_sum = [{\"0\": 0, \"1\": 0} for _ in range(62)]", "-for a in A:", "- for i, b in enumerate(format(a, \"b\").zfill(62)[::-1]):", "- each_bit_sum[i][b] += 1", "-for i, b in enumerate(each_bit_sum):", "- result += ((b[\"0\"] * b[\"1\"]) * (2**i)) % ((10**9) + 7)", "-print((result % ...
false
0.03774
0.046578
0.810258
[ "s702206290", "s487518546" ]
u113835532
p03738
python
s063934268
s647516105
30
27
9,084
9,080
Accepted
Accepted
10
def answer(a: str, b: str) -> str: if a == b: return 'EQUAL' if a < b or len(a) < len(b): return 'LESS' if a > b or len(a) > len(b): return 'GREATER' def main(): a = eval(input()) b = eval(input()) print((answer(a, b))) if __name__ == '__main__': ...
def answer(a: int, b: int) -> str: if a == b: return 'EQUAL' if a < b: return 'LESS' if a > b: return 'GREATER' def main(): a = int(eval(input())) b = int(eval(input())) print((answer(a, b))) if __name__ == '__main__': main()
19
19
315
287
def answer(a: str, b: str) -> str: if a == b: return "EQUAL" if a < b or len(a) < len(b): return "LESS" if a > b or len(a) > len(b): return "GREATER" def main(): a = eval(input()) b = eval(input()) print((answer(a, b))) if __name__ == "__main__": main()
def answer(a: int, b: int) -> str: if a == b: return "EQUAL" if a < b: return "LESS" if a > b: return "GREATER" def main(): a = int(eval(input())) b = int(eval(input())) print((answer(a, b))) if __name__ == "__main__": main()
false
0
[ "-def answer(a: str, b: str) -> str:", "+def answer(a: int, b: int) -> str:", "- if a < b or len(a) < len(b):", "+ if a < b:", "- if a > b or len(a) > len(b):", "+ if a > b:", "- a = eval(input())", "- b = eval(input())", "+ a = int(eval(input()))", "+ b = int(eval(input())...
false
0.035358
0.03445
1.026364
[ "s063934268", "s647516105" ]
u205561862
p03294
python
s701970175
s341207962
21
18
3,316
3,188
Accepted
Accepted
14.29
N=eval(input());print((sum(list(map(int,input().split())))-int(N)))
N=eval(input());print((sum(map(int,input().split()))-int(N)))
1
1
60
54
N = eval(input()) print((sum(list(map(int, input().split()))) - int(N)))
N = eval(input()) print((sum(map(int, input().split())) - int(N)))
false
0
[ "-print((sum(list(map(int, input().split()))) - int(N)))", "+print((sum(map(int, input().split())) - int(N)))" ]
false
0.112145
0.045822
2.447391
[ "s701970175", "s341207962" ]
u123756661
p02812
python
s900952739
s634625616
162
73
38,256
61,828
Accepted
Accepted
54.94
n=int(eval(input())) s=eval(input())+"xxxxxxxx" ans=chk=0 for i in range(n): w=s[i]+s[i+1]+s[i+2] if w=="ABC": ans+=1 print(ans)
n=int(eval(input())) s=eval(input())+"XXX" ans=0 for i in range(n): if s[i]+s[i+1]+s[i+2]=="ABC": ans+=1 print(ans)
8
6
140
112
n = int(eval(input())) s = eval(input()) + "xxxxxxxx" ans = chk = 0 for i in range(n): w = s[i] + s[i + 1] + s[i + 2] if w == "ABC": ans += 1 print(ans)
n = int(eval(input())) s = eval(input()) + "XXX" ans = 0 for i in range(n): if s[i] + s[i + 1] + s[i + 2] == "ABC": ans += 1 print(ans)
false
25
[ "-s = eval(input()) + \"xxxxxxxx\"", "-ans = chk = 0", "+s = eval(input()) + \"XXX\"", "+ans = 0", "- w = s[i] + s[i + 1] + s[i + 2]", "- if w == \"ABC\":", "+ if s[i] + s[i + 1] + s[i + 2] == \"ABC\":" ]
false
0.096042
0.056585
1.6973
[ "s900952739", "s634625616" ]
u620238824
p02690
python
s308076339
s376851515
629
76
73,340
9,076
Accepted
Accepted
87.92
x = int(eval(input())) y = 10**4 for i in range(y): for j in range(-y,y): if i ** 5 - j ** 5 == x: print((i, j)) exit()
x = int(eval(input())) for i in range(-200,200): for j in range(-200, 200): if i ** 5 - j ** 5 == x: print((i, j)) exit()
8
7
155
156
x = int(eval(input())) y = 10**4 for i in range(y): for j in range(-y, y): if i**5 - j**5 == x: print((i, j)) exit()
x = int(eval(input())) for i in range(-200, 200): for j in range(-200, 200): if i**5 - j**5 == x: print((i, j)) exit()
false
12.5
[ "-y = 10**4", "-for i in range(y):", "- for j in range(-y, y):", "+for i in range(-200, 200):", "+ for j in range(-200, 200):" ]
false
0.241379
0.147381
1.63779
[ "s308076339", "s376851515" ]
u839188633
p03132
python
s595554663
s677210746
1,089
979
67,852
67,788
Accepted
Accepted
10.1
a = [int(eval(input())) for _ in range(int(eval(input())))] dp = [[0] * 5 for _ in range(len(a) + 1)] for i, x in enumerate(a): y = x % 2 + (x == 0) * 2 z = (x + 1) % 2 dp[i+1][0] = min(dp[i][0:1]) + x dp[i+1][1] = min(dp[i][0:2]) + y dp[i+1][2] = min(dp[i][0:3]) + z dp[i+1][3]...
a = [int(eval(input())) for _ in range(int(eval(input())))] dp = [[0] * 5 for _ in range(len(a) + 1)] for i, x in enumerate(a): y = x % 2 + (x == 0) * 2 z = (x + 1) % 2 dp[i+1][0] = dp[i][0] + x dp[i+1][1] = min(dp[i][:2]) + y dp[i+1][2] = min(dp[i][:3]) + z dp[i+1][3] = min(dp...
15
15
390
375
a = [int(eval(input())) for _ in range(int(eval(input())))] dp = [[0] * 5 for _ in range(len(a) + 1)] for i, x in enumerate(a): y = x % 2 + (x == 0) * 2 z = (x + 1) % 2 dp[i + 1][0] = min(dp[i][0:1]) + x dp[i + 1][1] = min(dp[i][0:2]) + y dp[i + 1][2] = min(dp[i][0:3]) + z dp[i + 1][3] = min(dp[...
a = [int(eval(input())) for _ in range(int(eval(input())))] dp = [[0] * 5 for _ in range(len(a) + 1)] for i, x in enumerate(a): y = x % 2 + (x == 0) * 2 z = (x + 1) % 2 dp[i + 1][0] = dp[i][0] + x dp[i + 1][1] = min(dp[i][:2]) + y dp[i + 1][2] = min(dp[i][:3]) + z dp[i + 1][3] = min(dp[i][:4]) +...
false
0
[ "- dp[i + 1][0] = min(dp[i][0:1]) + x", "- dp[i + 1][1] = min(dp[i][0:2]) + y", "- dp[i + 1][2] = min(dp[i][0:3]) + z", "- dp[i + 1][3] = min(dp[i][0:4]) + y", "- dp[i + 1][4] = min(dp[i][0:5]) + x", "+ dp[i + 1][0] = dp[i][0] + x", "+ dp[i + 1][1] = min(dp[i][:2]) + y", "+ dp[...
false
0.037144
0.042266
0.878812
[ "s595554663", "s677210746" ]