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
u706695185
p03240
python
s881592433
s105605041
127
115
3,064
3,064
Accepted
Accepted
9.45
N = int(eval(input())) xyh = [list(map(int, input().split())) for i in range(N)] for cx in range(101): for cy in range(101): needH = -1 for x, y, h in xyh: if h > 0: # この頂点から見て、頂上がcx, cyのときどのくらいの高さがあってほしいか tmp = h + abs(cx - x) + abs(cy - y) ...
N = int(eval(input())) xyh = [list(map(int, input().split())) for i in range(N)] for cx in range(101): for cy in range(101): needH = -1 for x, y, h in xyh: if h > 0: # この頂点から見て、頂上がcx, cyのときどのくらいの高さがあってほしいか tmp = h + abs(cx - x) + abs(cy - y) ...
32
32
849
853
N = int(eval(input())) xyh = [list(map(int, input().split())) for i in range(N)] for cx in range(101): for cy in range(101): needH = -1 for x, y, h in xyh: if h > 0: # この頂点から見て、頂上がcx, cyのときどのくらいの高さがあってほしいか tmp = h + abs(cx - x) + abs(cy - y) ...
N = int(eval(input())) xyh = [list(map(int, input().split())) for i in range(N)] for cx in range(101): for cy in range(101): needH = -1 for x, y, h in xyh: if h > 0: # この頂点から見て、頂上がcx, cyのときどのくらいの高さがあってほしいか tmp = h + abs(cx - x) + abs(cy - y) ...
false
0
[ "- if needH > dist:", "+ if needH - dist > 0:" ]
false
0.046494
0.042904
1.083667
[ "s881592433", "s105605041" ]
u633068244
p01224
python
s608389837
s116268856
50
40
4,244
4,224
Accepted
Accepted
20
def div(n): ls = [] i = 2 while i*i <= n: c = 0 if n%i==0: while n%i==0: n /= i c += 1 if c > 0: ls.append([i,c]) i += 1 if n > 1: ls.append([n,1]) ans = 1 for b,p in ls: ans *= (b**(p+1)-1)/(b-1) return ans while 1: n = eval(input()) if n == 0: break d = div(...
def SumOfDiv(n): i = 2 ans = 1 while i*i <= n: c = 0 while n%i==0: n /= i c += 1 if c > 0: ans *= (i**(c+1)-1)/(i-1) i += 1 if n > 1: ans *= (1+n) return ans while 1: n = eval(input()) if n == 0: break d = SumOfDiv(n) - n if d == n: print("perfect number") elif d < ...
29
25
436
378
def div(n): ls = [] i = 2 while i * i <= n: c = 0 if n % i == 0: while n % i == 0: n /= i c += 1 if c > 0: ls.append([i, c]) i += 1 if n > 1: ls.append([n, 1]) ans = 1 for b, p in ls: ans *= (...
def SumOfDiv(n): i = 2 ans = 1 while i * i <= n: c = 0 while n % i == 0: n /= i c += 1 if c > 0: ans *= (i ** (c + 1) - 1) / (i - 1) i += 1 if n > 1: ans *= 1 + n return ans while 1: n = eval(input()) if n == 0: ...
false
13.793103
[ "-def div(n):", "- ls = []", "+def SumOfDiv(n):", "+ ans = 1", "- if n % i == 0:", "- while n % i == 0:", "- n /= i", "- c += 1", "+ while n % i == 0:", "+ n /= i", "+ c += 1", "- ls.append([i, c])", ...
false
0.130585
0.047853
2.728897
[ "s608389837", "s116268856" ]
u777283665
p03673
python
s206535729
s932051301
177
48
25,156
24,388
Accepted
Accepted
72.88
n = int(eval(input())) a = list(map(int, input().split())) if n % 2 == 1: print((*(a[0::2][::-1] + a[1::2]))) else: print((*(a[1::2][::-1] + a[0::2])))
n = int(eval(input())) a = input().split() if n % 2 == 1: print((" ".join((a[0::2][::-1] + a[1::2])))) else: print((" ".join((a[1::2][::-1] + a[0::2]))))
7
7
156
158
n = int(eval(input())) a = list(map(int, input().split())) if n % 2 == 1: print((*(a[0::2][::-1] + a[1::2]))) else: print((*(a[1::2][::-1] + a[0::2])))
n = int(eval(input())) a = input().split() if n % 2 == 1: print((" ".join((a[0::2][::-1] + a[1::2])))) else: print((" ".join((a[1::2][::-1] + a[0::2]))))
false
0
[ "-a = list(map(int, input().split()))", "+a = input().split()", "- print((*(a[0::2][::-1] + a[1::2])))", "+ print((\" \".join((a[0::2][::-1] + a[1::2]))))", "- print((*(a[1::2][::-1] + a[0::2])))", "+ print((\" \".join((a[1::2][::-1] + a[0::2]))))" ]
false
0.038108
0.078095
0.487976
[ "s206535729", "s932051301" ]
u608088992
p03244
python
s939465062
s820142496
110
92
17,312
17,696
Accepted
Accepted
16.36
N = int(eval(input())) V = [int(_) for _ in input().split()] odd = {} even = {} for i in range(N): if i%2==0: if V[i] in even: even[V[i]] += 1 else: even[V[i]] = 1 else: if V[i] in odd: odd[V[i]] += 1 else: odd[V[i]]...
import sys def solve(): input = sys.stdin.readline N = int(eval(input())) H = N // 2 V = [int(v) for v in input().split()] odd, even = dict(), dict() for i, v in enumerate(V): if i % 2 == 0: if v in even: even[v] += 1 else: even[v] = 1 else: ...
33
34
862
990
N = int(eval(input())) V = [int(_) for _ in input().split()] odd = {} even = {} for i in range(N): if i % 2 == 0: if V[i] in even: even[V[i]] += 1 else: even[V[i]] = 1 else: if V[i] in odd: odd[V[i]] += 1 else: odd[V[i]] = 1 maxEven...
import sys def solve(): input = sys.stdin.readline N = int(eval(input())) H = N // 2 V = [int(v) for v in input().split()] odd, even = dict(), dict() for i, v in enumerate(V): if i % 2 == 0: if v in even: even[v] += 1 else: even[v...
false
2.941176
[ "-N = int(eval(input()))", "-V = [int(_) for _ in input().split()]", "-odd = {}", "-even = {}", "-for i in range(N):", "- if i % 2 == 0:", "- if V[i] in even:", "- even[V[i]] += 1", "+import sys", "+", "+", "+def solve():", "+ input = sys.stdin.readline", "+ N = ...
false
0.04823
0.048944
0.985415
[ "s939465062", "s820142496" ]
u102126195
p03209
python
s687230168
s938860713
123
68
61,564
61,644
Accepted
Accepted
44.72
n, x = list(map(int, input().split())) t = [1] p = [1] for i in range(1, n+1): t.append(3+2*t[i-1]) p.append(1+2*p[i-1]) def pathi(n, x): if n == 0: return 0 if x <= 0 else 1 elif x <= t[n-1] + 1: return pathi(n-1, x-1) else: return p[n-1] + 1 + pathi(n-1, x...
n, x = list(map(int, input().split())) t = [1] p = [1] for i in range(1, n+1): t.append(3+2*t[i-1]) p.append(1+2*p[i-1]) def pathi(n, x): if n == 0: if x >= 1: return 1 return 0 elif x == 1: return 0 elif x <= t[n-1] + 1: return pathi(n...
18
24
346
461
n, x = list(map(int, input().split())) t = [1] p = [1] for i in range(1, n + 1): t.append(3 + 2 * t[i - 1]) p.append(1 + 2 * p[i - 1]) def pathi(n, x): if n == 0: return 0 if x <= 0 else 1 elif x <= t[n - 1] + 1: return pathi(n - 1, x - 1) else: return p[n - 1] + 1 + pathi(...
n, x = list(map(int, input().split())) t = [1] p = [1] for i in range(1, n + 1): t.append(3 + 2 * t[i - 1]) p.append(1 + 2 * p[i - 1]) def pathi(n, x): if n == 0: if x >= 1: return 1 return 0 elif x == 1: return 0 elif x <= t[n - 1] + 1: return pathi(n -...
false
25
[ "- return 0 if x <= 0 else 1", "+ if x >= 1:", "+ return 1", "+ return 0", "+ elif x == 1:", "+ return 0", "+ elif x == t[n - 1] + 2:", "+ return p[n - 1] + 1" ]
false
0.043702
0.044617
0.9795
[ "s687230168", "s938860713" ]
u454093752
p03044
python
s137472670
s929822794
904
398
90,528
106,320
Accepted
Accepted
55.97
from _collections import deque N = int(eval(input())) T = [[] for _ in range(N)] for i in range(N-1): u,v,w = list(map(int,input().split())) T[u-1].append([v-1,w%2]) T[v-1].append([u-1,w%2]) ans = [0]*N used_1 = [0]*N used_2 = [0]*N for i in range(N): if used_1[i] == 0: used_1[i] =...
from collections import deque N = int(eval(input())) T = [[] for _ in range(N)] for i in range(N-1): u, v, w = list(map(int, input().split())) u, v, w = u-1, v-1, w % 2 T[u].append([v, w]) T[v].append([u, w]) Ans = [-1]*N P = deque([0]) Ans[0] = 0 while(len(P) > 0): a = P.popleft() ...
100
23
3,098
538
from _collections import deque N = int(eval(input())) T = [[] for _ in range(N)] for i in range(N - 1): u, v, w = list(map(int, input().split())) T[u - 1].append([v - 1, w % 2]) T[v - 1].append([u - 1, w % 2]) ans = [0] * N used_1 = [0] * N used_2 = [0] * N for i in range(N): if used_1[i] == 0: ...
from collections import deque N = int(eval(input())) T = [[] for _ in range(N)] for i in range(N - 1): u, v, w = list(map(int, input().split())) u, v, w = u - 1, v - 1, w % 2 T[u].append([v, w]) T[v].append([u, w]) Ans = [-1] * N P = deque([0]) Ans[0] = 0 while len(P) > 0: a = P.popleft() for i...
false
77
[ "-from _collections import deque", "+from collections import deque", "- T[u - 1].append([v - 1, w % 2])", "- T[v - 1].append([u - 1, w % 2])", "-ans = [0] * N", "-used_1 = [0] * N", "-used_2 = [0] * N", "-for i in range(N):", "- if used_1[i] == 0:", "- used_1[i] = 1", "- u...
false
0.038147
0.043393
0.879105
[ "s137472670", "s929822794" ]
u131984977
p02402
python
s316112582
s134821557
50
40
8,028
8,028
Accepted
Accepted
20
from sys import stdin count = int(stdin.readline()) ns = [int(n) for n in stdin.readline().split(' ')] minimum = None maximum = None total = 0 for n in ns: if minimum == None or minimum > n: minimum = n if maximum == None or maximum < n: maximum = n total += n print((mini...
eval(input()) data = [int(x) for x in input().split()] print((min(data), max(data), sum(data)))
17
4
339
91
from sys import stdin count = int(stdin.readline()) ns = [int(n) for n in stdin.readline().split(" ")] minimum = None maximum = None total = 0 for n in ns: if minimum == None or minimum > n: minimum = n if maximum == None or maximum < n: maximum = n total += n print((minimum, maximum, total...
eval(input()) data = [int(x) for x in input().split()] print((min(data), max(data), sum(data)))
false
76.470588
[ "-from sys import stdin", "-", "-count = int(stdin.readline())", "-ns = [int(n) for n in stdin.readline().split(\" \")]", "-minimum = None", "-maximum = None", "-total = 0", "-for n in ns:", "- if minimum == None or minimum > n:", "- minimum = n", "- if maximum == None or maximum < ...
false
0.045345
0.038497
1.177868
[ "s316112582", "s134821557" ]
u608088992
p03040
python
s239749364
s587550958
765
675
19,304
19,068
Accepted
Accepted
11.76
import sys, math, collections, heapq, itertools from bisect import bisect_left F = sys.stdin def single_input(): return F.readline().strip("\n") def line_input(): return F.readline().strip("\n").split() def gcd(a, b): a, b = max(a, b), min(a, b) while a % b > 0: a, b = b, a % b return b def sol...
import sys, heapq F = sys.stdin def single_input(): return F.readline().strip("\n") def line_input(): return F.readline().strip("\n").split() def solve(): Q = int(single_input()) n, a, b = list(map(int, line_input())) left, right = [-a], [a] heapq.heapify(left) heapq.heapify(right) ...
41
38
1,320
1,211
import sys, math, collections, heapq, itertools from bisect import bisect_left F = sys.stdin def single_input(): return F.readline().strip("\n") def line_input(): return F.readline().strip("\n").split() def gcd(a, b): a, b = max(a, b), min(a, b) while a % b > 0: a, b = b, a % b return...
import sys, heapq F = sys.stdin def single_input(): return F.readline().strip("\n") def line_input(): return F.readline().strip("\n").split() def solve(): Q = int(single_input()) n, a, b = list(map(int, line_input())) left, right = [-a], [a] heapq.heapify(left) heapq.heapify(right) ...
false
7.317073
[ "-import sys, math, collections, heapq, itertools", "-from bisect import bisect_left", "+import sys, heapq", "-def gcd(a, b):", "- a, b = max(a, b), min(a, b)", "- while a % b > 0:", "- a, b = b, a % b", "- return b", "-", "-", "+ ans = \"\"", "- print((-1 * left[...
false
0.041235
0.042956
0.959956
[ "s239749364", "s587550958" ]
u347600233
p02684
python
s768665835
s024298454
1,568
177
32,252
32,304
Accepted
Accepted
88.71
n, k = list(map(int, input().split())) a = [int(i) - 1 for i in input().split()] ans = 0 while k: if k & 1: ans = a[ans] c = [a[a[i]] for i in range(n)] a = c[:] k >>= 1 print((ans + 1))
n, k = list(map(int,input().split())) a = [int(i) for i in input().split()] s = [] ord = [-1] * (n+1) c, l = 1, 0 v = 1 while (ord[v] == -1): ord[v] = len(s) s.append(v) v = a[v-1] c = len(s) - ord[v] l = ord[v] print((s[k] if (k < l) else s[l + (k - l) % c]))
10
14
211
282
n, k = list(map(int, input().split())) a = [int(i) - 1 for i in input().split()] ans = 0 while k: if k & 1: ans = a[ans] c = [a[a[i]] for i in range(n)] a = c[:] k >>= 1 print((ans + 1))
n, k = list(map(int, input().split())) a = [int(i) for i in input().split()] s = [] ord = [-1] * (n + 1) c, l = 1, 0 v = 1 while ord[v] == -1: ord[v] = len(s) s.append(v) v = a[v - 1] c = len(s) - ord[v] l = ord[v] print((s[k] if (k < l) else s[l + (k - l) % c]))
false
28.571429
[ "-a = [int(i) - 1 for i in input().split()]", "-ans = 0", "-while k:", "- if k & 1:", "- ans = a[ans]", "- c = [a[a[i]] for i in range(n)]", "- a = c[:]", "- k >>= 1", "-print((ans + 1))", "+a = [int(i) for i in input().split()]", "+s = []", "+ord = [-1] * (n + 1)", "+c, l...
false
0.042363
0.038034
1.113811
[ "s768665835", "s024298454" ]
u994988729
p03457
python
s435042447
s508033979
346
246
17,312
27,340
Accepted
Accepted
28.9
n=int(input()) txy=[] for _ in range(n): t,x,y=map(int, input().split()) txy.append((t,x,y)) def isOk(txy): now_pos=0 now_t=0 for t,x,y in txy: move=x+y-now_pos time=t-now_t if time>=move and time%2==move%2: continue else: ret...
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N = int(eval(input())) TXY = [list(map(int, input().split())) for _ in range(N)] nx, ny = 0, 0 time = 0 ans = "Yes" for i in range(N): t, x, y = TXY[i] dt = t - time move = abs(nx - x) + abs(ny - y) if move > d...
20
24
392
457
n = int(input()) txy = [] for _ in range(n): t, x, y = map(int, input().split()) txy.append((t, x, y)) def isOk(txy): now_pos = 0 now_t = 0 for t, x, y in txy: move = x + y - now_pos time = t - now_t if time >= move and time % 2 == move % 2: continue els...
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) N = int(eval(input())) TXY = [list(map(int, input().split())) for _ in range(N)] nx, ny = 0, 0 time = 0 ans = "Yes" for i in range(N): t, x, y = TXY[i] dt = t - time move = abs(nx - x) + abs(ny - y) if move > dt: ans = "N...
false
16.666667
[ "-n = int(input())", "-txy = []", "-for _ in range(n):", "- t, x, y = map(int, input().split())", "- txy.append((t, x, y))", "+import sys", "-", "-def isOk(txy):", "- now_pos = 0", "- now_t = 0", "- for t, x, y in txy:", "- move = x + y - now_pos", "- time = t - ...
false
0.036134
0.039172
0.922443
[ "s435042447", "s508033979" ]
u078214750
p03455
python
s133246292
s530833610
32
27
9,036
9,152
Accepted
Accepted
15.62
a, b = list(map(int, input().split())) if (a*b%2 == 0): print('Even') else: print('Odd')
a, b = list(map(int, input().split())) print(('Even' if a*b%2 == 0 else 'Odd'))
5
2
90
72
a, b = list(map(int, input().split())) if a * b % 2 == 0: print("Even") else: print("Odd")
a, b = list(map(int, input().split())) print(("Even" if a * b % 2 == 0 else "Odd"))
false
60
[ "-if a * b % 2 == 0:", "- print(\"Even\")", "-else:", "- print(\"Odd\")", "+print((\"Even\" if a * b % 2 == 0 else \"Odd\"))" ]
false
0.040417
0.057324
0.70507
[ "s133246292", "s530833610" ]
u623814058
p03244
python
s029070259
s986258105
99
78
25,360
25,196
Accepted
Accepted
21.21
N=int(eval(input())) *V,=list(map(int,input().split())) import collections import collections c1=collections.Counter(V[0::2]) c1=sorted(list(c1.items()), key=lambda x: x[1], reverse=True) e=c1[0][0] c2=collections.Counter(V[1::2]) c2=sorted(list(c2.items()), key=lambda x: x[1], reverse=True) o=c2[0][0] ...
N=int(eval(input())) *V,=list(map(int,input().split())) import collections c1=collections.Counter(V[0::2]).most_common() c2=collections.Counter(V[1::2]).most_common() c1.append([0,0]) c2.append([0,0]) if c1[0][0]!=c2[0][0]: print((N-c1[0][1]-c2[0][1])) else: print((min(N-c1[0][1]-c2[1][1],N-c1[1][1]...
43
12
1,163
316
N = int(eval(input())) (*V,) = list(map(int, input().split())) import collections import collections c1 = collections.Counter(V[0::2]) c1 = sorted(list(c1.items()), key=lambda x: x[1], reverse=True) e = c1[0][0] c2 = collections.Counter(V[1::2]) c2 = sorted(list(c2.items()), key=lambda x: x[1], reverse=True) o = c2[0]...
N = int(eval(input())) (*V,) = list(map(int, input().split())) import collections c1 = collections.Counter(V[0::2]).most_common() c2 = collections.Counter(V[1::2]).most_common() c1.append([0, 0]) c2.append([0, 0]) if c1[0][0] != c2[0][0]: print((N - c1[0][1] - c2[0][1])) else: print((min(N - c1[0][1] - c2[1][1...
false
72.093023
[ "-import collections", "-c1 = collections.Counter(V[0::2])", "-c1 = sorted(list(c1.items()), key=lambda x: x[1], reverse=True)", "-e = c1[0][0]", "-c2 = collections.Counter(V[1::2])", "-c2 = sorted(list(c2.items()), key=lambda x: x[1], reverse=True)", "-o = c2[0][0]", "-cnt = 0", "-if e != o:", "-...
false
0.047278
0.043332
1.091056
[ "s029070259", "s986258105" ]
u523087093
p02579
python
s232262323
s761722660
677
613
129,064
123,672
Accepted
Accepted
9.45
#----------[インポート]----------# from collections import deque def main(): #----------[入力受取・初期設定]----------# H, W = list(map(int, input().split())) C = tuple(map(int, input().split())) # 魔法の位置 D = tuple(map(int, input().split())) # ゴール D_y = D[0] -1 # 0スタート D_x = D[1] -1 # 0スタート S = ...
#----------[インポート]----------# from collections import deque #----------[入力受取・初期設定]----------# H, W = list(map(int, input().split())) C = tuple(map(int, input().split())) # 魔法の位置 D = tuple(map(int, input().split())) # ゴール D_y = D[0] -1 # 0スタート D_x = D[1] -1 # 0スタート S = [list(eval(input())) for _ in range(H)] vi...
58
50
2,105
1,852
# ----------[インポート]----------# from collections import deque def main(): # ----------[入力受取・初期設定]----------# H, W = list(map(int, input().split())) C = tuple(map(int, input().split())) # 魔法の位置 D = tuple(map(int, input().split())) # ゴール D_y = D[0] - 1 # 0スタート D_x = D[1] - 1 # 0スタート S = [...
# ----------[インポート]----------# from collections import deque # ----------[入力受取・初期設定]----------# H, W = list(map(int, input().split())) C = tuple(map(int, input().split())) # 魔法の位置 D = tuple(map(int, input().split())) # ゴール D_y = D[0] - 1 # 0スタート D_x = D[1] - 1 # 0スタート S = [list(eval(input())) for _ in range(H)] vi...
false
13.793103
[ "-", "-def main():", "- H, W = list(map(int, input().split()))", "- C = tuple(map(int, input().split())) # 魔法の位置", "- D = tuple(map(int, input().split())) # ゴール", "- D_y = D[0] - 1 # 0スタート", "- D_x = D[1] - 1 # 0スタート", "- S = [list(eval(input())) for _ in range(H)]", "- visi...
false
0.037553
0.038489
0.975673
[ "s232262323", "s761722660" ]
u607816468
p02576
python
s650320190
s327617105
30
24
9,148
9,072
Accepted
Accepted
20
N, X, T = list(map(int, input().split())) count = N // X if N % X != 0: count += 1 print((count * T))
N, X, T = list(map(int, input().split())) times = N // X if N % X != 0: times += 1 print((T * times))
7
5
106
100
N, X, T = list(map(int, input().split())) count = N // X if N % X != 0: count += 1 print((count * T))
N, X, T = list(map(int, input().split())) times = N // X if N % X != 0: times += 1 print((T * times))
false
28.571429
[ "-count = N // X", "+times = N // X", "- count += 1", "-print((count * T))", "+ times += 1", "+print((T * times))" ]
false
0.068191
0.041197
1.655227
[ "s650320190", "s327617105" ]
u884323674
p03160
python
s046754761
s217306878
293
136
95,936
13,980
Accepted
Accepted
53.58
import sys sys.setrecursionlimit(1000000) # 入力 N = int(eval(input())) H = [int(i) for i in input().split()] # メモ用のDPテーブルを生成 dp = [float("inf") for i in range(N)] # 足場iにたどり着く最初コストを返す def rec(i): # ベースケースをセット if i == 0: return 0 # メモをチェック if dp[i] < float("inf"): ...
N = int(eval(input())) H = [int(i) for i in input().split()] dp = [float("inf")] * N dp[0], dp[1] = 0, abs(H[1]-H[0]) for i in range(2, N): dp[i] = min(dp[i], dp[i-1]+abs(H[i]-H[i-1]), dp[i-2]+abs(H[i]-H[i-2])) print((dp[N-1]))
31
9
563
237
import sys sys.setrecursionlimit(1000000) # 入力 N = int(eval(input())) H = [int(i) for i in input().split()] # メモ用のDPテーブルを生成 dp = [float("inf") for i in range(N)] # 足場iにたどり着く最初コストを返す def rec(i): # ベースケースをセット if i == 0: return 0 # メモをチェック if dp[i] < float("inf"): return dp[i] # i-1から遷...
N = int(eval(input())) H = [int(i) for i in input().split()] dp = [float("inf")] * N dp[0], dp[1] = 0, abs(H[1] - H[0]) for i in range(2, N): dp[i] = min( dp[i], dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]) ) print((dp[N - 1]))
false
70.967742
[ "-import sys", "-", "-sys.setrecursionlimit(1000000)", "-# 入力", "-# メモ用のDPテーブルを生成", "-dp = [float(\"inf\") for i in range(N)]", "-# 足場iにたどり着く最初コストを返す", "-def rec(i):", "- # ベースケースをセット", "- if i == 0:", "- return 0", "- # メモをチェック", "- if dp[i] < float(\"inf\"):", "- ...
false
0.038546
0.037743
1.021268
[ "s046754761", "s217306878" ]
u380524497
p02773
python
s099076637
s106734496
821
454
32,480
34,652
Accepted
Accepted
44.7
from collections import defaultdict dict = defaultdict(int) n = int(eval(input())) for _ in range(n): s = eval(input()) dict[s] += 1 maxim = max(dict.values()) candidates = [] for key, count in list(dict.items()): if count == maxim: candidates.append(key) candidates.sort() ...
import sys input = sys.stdin.readline from collections import defaultdict dict = defaultdict(int) n = int(input()) for _ in range(n): s = input() dict[s] += 1 maxim = max(dict.values()) candidates = [] for key, count in dict.items(): if count == maxim: candidates.append(key) ...
21
22
340
371
from collections import defaultdict dict = defaultdict(int) n = int(eval(input())) for _ in range(n): s = eval(input()) dict[s] += 1 maxim = max(dict.values()) candidates = [] for key, count in list(dict.items()): if count == maxim: candidates.append(key) candidates.sort() for ans in candidates: ...
import sys input = sys.stdin.readline from collections import defaultdict dict = defaultdict(int) n = int(input()) for _ in range(n): s = input() dict[s] += 1 maxim = max(dict.values()) candidates = [] for key, count in dict.items(): if count == maxim: candidates.append(key) candidates.sort() prin...
false
4.545455
[ "+import sys", "+", "+input = sys.stdin.readline", "-n = int(eval(input()))", "+n = int(input())", "- s = eval(input())", "+ s = input()", "-for key, count in list(dict.items()):", "+for key, count in dict.items():", "-for ans in candidates:", "- print(ans)", "+print(*candidates, sep=...
false
0.044218
0.044276
0.998706
[ "s099076637", "s106734496" ]
u798093965
p02683
python
s229813258
s443343744
95
87
69,740
68,796
Accepted
Accepted
8.42
n,m,x=list(map(int,input().split())) a=[list(map(int, input().split())) for i in range(n)] bb=[0]*m c=[] cc=0 for i in range(n): cc+=a[i][0] for i in range(m): for j in range(n): bb[i]+=a[j][i+1] if any(bb[k]< x for k in range(m)): print((-1)) """ d=[[] for i in range(m)] money=0 i=0 d...
n,m,x=list(map(int,input().split())) b=[list(map(int,input().split())) for _ in range(n)] ans = 100000000 for i in range(1<<n): money = 0 s=[0]*m for j in range(n): if(i>>j)&1: money +=b[j][0] for k in range(1,m+1): s[k-1]+=b[j][k] if min(s)>=x:...
53
17
1,053
403
n, m, x = list(map(int, input().split())) a = [list(map(int, input().split())) for i in range(n)] bb = [0] * m c = [] cc = 0 for i in range(n): cc += a[i][0] for i in range(m): for j in range(n): bb[i] += a[j][i + 1] if any(bb[k] < x for k in range(m)): print((-1)) """ d=[[] for i in range(m)] money...
n, m, x = list(map(int, input().split())) b = [list(map(int, input().split())) for _ in range(n)] ans = 100000000 for i in range(1 << n): money = 0 s = [0] * m for j in range(n): if (i >> j) & 1: money += b[j][0] for k in range(1, m + 1): s[k - 1] += b[j][k] ...
false
67.924528
[ "-a = [list(map(int, input().split())) for i in range(n)]", "-bb = [0] * m", "-c = []", "-cc = 0", "-for i in range(n):", "- cc += a[i][0]", "-for i in range(m):", "+b = [list(map(int, input().split())) for _ in range(n)]", "+ans = 100000000", "+for i in range(1 << n):", "+ money = 0", "...
false
0.090435
0.044991
2.010041
[ "s229813258", "s443343744" ]
u340781749
p03311
python
s569002705
s895174841
1,615
192
26,180
25,196
Accepted
Accepted
88.11
def bisect(l, r): while l < r: m = (l + r) // 2 s1 = sum(abs(am - m) for am in aam) s2 = sum(abs(am - m - 1) for am in aam) if s1 < s2: r = m else: l = m + 1 return l n = int(eval(input())) aaa = list(map(int, input().split())) aam ...
n = int(eval(input())) aaa = list(map(int, input().split())) aam = [a - i - 1 for i, a in enumerate(aaa)] aam.sort() b = aam[n // 2] print((sum(abs(am - b) for am in aam)))
18
6
443
170
def bisect(l, r): while l < r: m = (l + r) // 2 s1 = sum(abs(am - m) for am in aam) s2 = sum(abs(am - m - 1) for am in aam) if s1 < s2: r = m else: l = m + 1 return l n = int(eval(input())) aaa = list(map(int, input().split())) aam = [a - i - 1 f...
n = int(eval(input())) aaa = list(map(int, input().split())) aam = [a - i - 1 for i, a in enumerate(aaa)] aam.sort() b = aam[n // 2] print((sum(abs(am - b) for am in aam)))
false
66.666667
[ "-def bisect(l, r):", "- while l < r:", "- m = (l + r) // 2", "- s1 = sum(abs(am - m) for am in aam)", "- s2 = sum(abs(am - m - 1) for am in aam)", "- if s1 < s2:", "- r = m", "- else:", "- l = m + 1", "- return l", "-", "-", "-a...
false
0.043273
0.046473
0.93114
[ "s569002705", "s895174841" ]
u723792785
p02614
python
s049286746
s673192532
88
53
68,488
9,068
Accepted
Accepted
39.77
h, w, k = list(map(int, input().split())) ans = 0 s = [eval(input()) for _ in range(h)] for hi in range(2**h): hl = [] for hj in range(h): if (hi >> hj) & 1: hl.append(hj) tmp = s[:] for j in hl: tmp[j] = "."*w for wi in range(2**w): wl = [] for wj in range(w): if (wi >> wj) & 1: w...
import itertools h, w, k = list(map(int, input().split())) ans = 0 s = [eval(input()) for _ in range(h)] for hi in itertools.product([0, 1], repeat=h): tmp = s[:] for j in range(h): if hi[j] == 1: tmp[j] = "."*w for wi in itertools.product([0, 1], repeat=w): cnt = 0 for i in range(h): for j i...
25
19
481
419
h, w, k = list(map(int, input().split())) ans = 0 s = [eval(input()) for _ in range(h)] for hi in range(2**h): hl = [] for hj in range(h): if (hi >> hj) & 1: hl.append(hj) tmp = s[:] for j in hl: tmp[j] = "." * w for wi in range(2**w): wl = [] for wj in ra...
import itertools h, w, k = list(map(int, input().split())) ans = 0 s = [eval(input()) for _ in range(h)] for hi in itertools.product([0, 1], repeat=h): tmp = s[:] for j in range(h): if hi[j] == 1: tmp[j] = "." * w for wi in itertools.product([0, 1], repeat=w): cnt = 0 fo...
false
24
[ "+import itertools", "+", "-for hi in range(2**h):", "- hl = []", "- for hj in range(h):", "- if (hi >> hj) & 1:", "- hl.append(hj)", "+for hi in itertools.product([0, 1], repeat=h):", "- for j in hl:", "- tmp[j] = \".\" * w", "- for wi in range(2**w):", "-...
false
0.038388
0.045767
0.83876
[ "s049286746", "s673192532" ]
u537782349
p03086
python
s007396985
s303144366
19
17
3,060
3,060
Accepted
Accepted
10.53
a = eval(input()) b = 0 c = 0 for i in range(len(a)): if a[i] in list("ACGT"): b += 1 c = max(c, b) else: b = 0 print(c)
a = eval(input()) b = 0 c = list("ACGT") for i in range(len(a)): if a[i] in c: b = max(b, 1) for j in range(i + 1, len(a)): if a[j] in c: b = max(b, j - i + 1) else: break print(b)
10
12
156
262
a = eval(input()) b = 0 c = 0 for i in range(len(a)): if a[i] in list("ACGT"): b += 1 c = max(c, b) else: b = 0 print(c)
a = eval(input()) b = 0 c = list("ACGT") for i in range(len(a)): if a[i] in c: b = max(b, 1) for j in range(i + 1, len(a)): if a[j] in c: b = max(b, j - i + 1) else: break print(b)
false
16.666667
[ "-c = 0", "+c = list(\"ACGT\")", "- if a[i] in list(\"ACGT\"):", "- b += 1", "- c = max(c, b)", "- else:", "- b = 0", "-print(c)", "+ if a[i] in c:", "+ b = max(b, 1)", "+ for j in range(i + 1, len(a)):", "+ if a[j] in c:", "+ ...
false
0.051761
0.035596
1.454125
[ "s007396985", "s303144366" ]
u450983668
p02882
python
s200308493
s048880983
19
17
3,060
3,060
Accepted
Accepted
10.53
def main(): a, b, x = list(map(int, input().split())) vm = a*a*b if x==vm: return 0 elif x>vm/2: return 90-math.degrees(math.atan(a**3/(2*(vm-x)))) else: return 90-math.degrees(math.atan(2*x/(a*b*b))) if __name__ == '__main__': import math print((main()))
def main(): a, b, x = list(map(int, input().split())) vm = a*a*b if x>vm/2: return math.degrees(math.atan(2*(vm-x)/a**3)) else: return math.degrees(math.atan(a*b*b/(2*x))) if __name__ == '__main__': import math print((main()))
13
10
286
247
def main(): a, b, x = list(map(int, input().split())) vm = a * a * b if x == vm: return 0 elif x > vm / 2: return 90 - math.degrees(math.atan(a**3 / (2 * (vm - x)))) else: return 90 - math.degrees(math.atan(2 * x / (a * b * b))) if __name__ == "__main__": import math ...
def main(): a, b, x = list(map(int, input().split())) vm = a * a * b if x > vm / 2: return math.degrees(math.atan(2 * (vm - x) / a**3)) else: return math.degrees(math.atan(a * b * b / (2 * x))) if __name__ == "__main__": import math print((main()))
false
23.076923
[ "- if x == vm:", "- return 0", "- elif x > vm / 2:", "- return 90 - math.degrees(math.atan(a**3 / (2 * (vm - x))))", "+ if x > vm / 2:", "+ return math.degrees(math.atan(2 * (vm - x) / a**3))", "- return 90 - math.degrees(math.atan(2 * x / (a * b * b)))", "+ ...
false
0.043565
0.102923
0.423273
[ "s200308493", "s048880983" ]
u352394527
p00157
python
s927598266
s772519066
320
180
5,724
5,640
Accepted
Accepted
43.75
while True: n = int(eval(input())) if n == 0: break hr_lst = [] for _ in range(n): h, r = list(map(int, input().split())) hr_lst.append((h, r)) m = int(eval(input())) for _ in range(m): h, r = list(map(int, input().split())) hr_lst.append((h, r)) hr_lst.sort(reverse...
while True: n = int(eval(input())) if n == 0: break hr_lst = [] for _ in range(n): h, r = list(map(int, input().split())) hr_lst.append((h, r)) m = int(eval(input())) for _ in range(m): h, r = list(map(int, input().split())) hr_lst.append((h, r)) hr_lst.sort(reverse...
33
35
729
764
while True: n = int(eval(input())) if n == 0: break hr_lst = [] for _ in range(n): h, r = list(map(int, input().split())) hr_lst.append((h, r)) m = int(eval(input())) for _ in range(m): h, r = list(map(int, input().split())) hr_lst.append((h, r)) hr_ls...
while True: n = int(eval(input())) if n == 0: break hr_lst = [] for _ in range(n): h, r = list(map(int, input().split())) hr_lst.append((h, r)) m = int(eval(input())) for _ in range(m): h, r = list(map(int, input().split())) hr_lst.append((h, r)) hr_ls...
false
5.714286
[ "+ dpv1 = dp[v - 1] + 1", "- dp[y] = max(dp[y], dp[v - 1] + 1)", "+ if dp[y] < dpv1:", "+ dp[y] = dpv1" ]
false
0.046062
0.088409
0.521014
[ "s927598266", "s772519066" ]
u511824539
p02755
python
s157893549
s750768325
33
29
9,116
9,092
Accepted
Accepted
12.12
a, b = list(map(int, input().split())) for i in range(b*10, (b+1)*10): if int(i * 0.08) == a: print(i) break else: print((-1))
a, b = list(map(int, input().split())) raw_b = b*10 for i in range(raw_b, raw_b+10): if int(i * 0.08) == a: print(i) break else: print((-1))
7
8
148
163
a, b = list(map(int, input().split())) for i in range(b * 10, (b + 1) * 10): if int(i * 0.08) == a: print(i) break else: print((-1))
a, b = list(map(int, input().split())) raw_b = b * 10 for i in range(raw_b, raw_b + 10): if int(i * 0.08) == a: print(i) break else: print((-1))
false
12.5
[ "-for i in range(b * 10, (b + 1) * 10):", "+raw_b = b * 10", "+for i in range(raw_b, raw_b + 10):" ]
false
0.038664
0.10514
0.367742
[ "s157893549", "s750768325" ]
u533039576
p02868
python
s425253753
s001999368
1,924
711
123,952
43,792
Accepted
Accepted
63.05
import sys input = sys.stdin.readline INF = 1 << 50 class SegTree(): def __init__(self, n_, ele_id, operation_func): self.n = 1 while self.n < n_: self.n *= 2 self.data = [ele_id] * (2 * self.n - 1) self.ele_id = ele_id self.operation_func = operatio...
from heapq import heappush, heappop import sys input = sys.stdin.readline # def dijkstra(graph: list, node: int, start: int) -> list: # # graph[node] = [(cost, to)] # INF = float('inf') # dist = [INF] * node # # dist[start] = 0 # heap = [(0, start)] # while heap: # cost, t...
80
52
2,231
1,528
import sys input = sys.stdin.readline INF = 1 << 50 class SegTree: def __init__(self, n_, ele_id, operation_func): self.n = 1 while self.n < n_: self.n *= 2 self.data = [ele_id] * (2 * self.n - 1) self.ele_id = ele_id self.operation_func = operation_func d...
from heapq import heappush, heappop import sys input = sys.stdin.readline # def dijkstra(graph: list, node: int, start: int) -> list: # # graph[node] = [(cost, to)] # INF = float('inf') # dist = [INF] * node # # dist[start] = 0 # heap = [(0, start)] # while heap: # cost, thisNode = heap...
false
35
[ "+from heapq import heappush, heappop", "-INF = 1 << 50", "-", "-", "-class SegTree:", "- def __init__(self, n_, ele_id, operation_func):", "- self.n = 1", "- while self.n < n_:", "- self.n *= 2", "- self.data = [ele_id] * (2 * self.n - 1)", "- self.ele_...
false
0.037612
0.039805
0.944901
[ "s425253753", "s001999368" ]
u372144784
p03353
python
s132864927
s242207363
769
197
41,824
43,632
Accepted
Accepted
74.38
s = eval(input()) k = int(eval(input())) lst = [] m = min(5,len(s)) while True: if m<=0: break for i in range(len(s)-m+1): q = s[i:i+m] if not q in lst: lst.append(q) m -= 1 lst.sort() print((lst[k-1]))
s = list(eval(input())) k = int(eval(input())) candidate = [] for i in range(len(s)): for j in range(k+1): candidate.append(s[i:i+j]) for i in range(len(candidate)): candidate[i] = "".join(candidate[i]) candidate = list(set(candidate)) candidate.sort() print((candidate[k]))
15
12
251
289
s = eval(input()) k = int(eval(input())) lst = [] m = min(5, len(s)) while True: if m <= 0: break for i in range(len(s) - m + 1): q = s[i : i + m] if not q in lst: lst.append(q) m -= 1 lst.sort() print((lst[k - 1]))
s = list(eval(input())) k = int(eval(input())) candidate = [] for i in range(len(s)): for j in range(k + 1): candidate.append(s[i : i + j]) for i in range(len(candidate)): candidate[i] = "".join(candidate[i]) candidate = list(set(candidate)) candidate.sort() print((candidate[k]))
false
20
[ "-s = eval(input())", "+s = list(eval(input()))", "-lst = []", "-m = min(5, len(s))", "-while True:", "- if m <= 0:", "- break", "- for i in range(len(s) - m + 1):", "- q = s[i : i + m]", "- if not q in lst:", "- lst.append(q)", "- m -= 1", "-lst.sort...
false
0.054267
0.065833
0.824312
[ "s132864927", "s242207363" ]
u460386402
p02628
python
s812923160
s714190313
29
24
9,200
9,232
Accepted
Accepted
17.24
n,k=list(map(int,input().split())) p=list(map(int,input().split())) count=0 p.sort() for i in range(k): count+=p[i] print(count)
n,k=list(map(int,input().split())) p=sorted(list(map(int,input().split()))) print((sum(p[:k])))
9
3
136
89
n, k = list(map(int, input().split())) p = list(map(int, input().split())) count = 0 p.sort() for i in range(k): count += p[i] print(count)
n, k = list(map(int, input().split())) p = sorted(list(map(int, input().split()))) print((sum(p[:k])))
false
66.666667
[ "-p = list(map(int, input().split()))", "-count = 0", "-p.sort()", "-for i in range(k):", "- count += p[i]", "-print(count)", "+p = sorted(list(map(int, input().split())))", "+print((sum(p[:k])))" ]
false
0.043745
0.042425
1.03111
[ "s812923160", "s714190313" ]
u985929170
p02583
python
s918221068
s453612472
131
110
9,208
9,048
Accepted
Accepted
16.03
from itertools import combinations [N],*li = [list(map(int,i.split())) for i in open(0)] li = li[0] count = 0 for k in combinations(li,3): k = sorted(list(k)) if k[2]<k[0]+k[1] and k[0]!=k[1] and k[1]!= k[2]: count += 1 print(count)
N = int(eval(input())) li = list(map(int,input().split())) from itertools import combinations ans = 0 for k in combinations(li,3): k = list(k) k.sort() if k[0]+k[1]>k[2] and k[0]!=k[1] and k[1]!=k[2]: ans += 1 print(ans)
10
12
258
247
from itertools import combinations [N], *li = [list(map(int, i.split())) for i in open(0)] li = li[0] count = 0 for k in combinations(li, 3): k = sorted(list(k)) if k[2] < k[0] + k[1] and k[0] != k[1] and k[1] != k[2]: count += 1 print(count)
N = int(eval(input())) li = list(map(int, input().split())) from itertools import combinations ans = 0 for k in combinations(li, 3): k = list(k) k.sort() if k[0] + k[1] > k[2] and k[0] != k[1] and k[1] != k[2]: ans += 1 print(ans)
false
16.666667
[ "+N = int(eval(input()))", "+li = list(map(int, input().split()))", "-[N], *li = [list(map(int, i.split())) for i in open(0)]", "-li = li[0]", "-count = 0", "+ans = 0", "- k = sorted(list(k))", "- if k[2] < k[0] + k[1] and k[0] != k[1] and k[1] != k[2]:", "- count += 1", "-print(count...
false
0.045023
0.037819
1.190499
[ "s918221068", "s453612472" ]
u707124227
p03061
python
s283253858
s874409958
987
163
63,856
14,488
Accepted
Accepted
83.49
n=int(eval(input())) a=list(map(int,input().split())) def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return ...
n=int(eval(input())) a=list(map(int,input().split())) def gcd(a, b): while b: a, b = b, a%b return a al=[] ar=[] tmp=a[0] al.append(a[0]) for ai in a[1:]: tmp=gcd(ai,tmp) al.append(tmp) ar.append(a[-1]) tmp=a[-1] for ai in a[:-1][::-1]: tmp=gcd(ai,tmp) ar.append(tmp) ans=ar[n-2] for i...
25
24
665
403
n = int(eval(input())) a = list(map(int, input().split())) def make_divisors(n): lower_divisors, upper_divisors = [], [] i = 1 while i * i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n // i) i += 1 return l...
n = int(eval(input())) a = list(map(int, input().split())) def gcd(a, b): while b: a, b = b, a % b return a al = [] ar = [] tmp = a[0] al.append(a[0]) for ai in a[1:]: tmp = gcd(ai, tmp) al.append(tmp) ar.append(a[-1]) tmp = a[-1] for ai in a[:-1][::-1]: tmp = gcd(ai, tmp) ar.append(...
false
4
[ "-def make_divisors(n):", "- lower_divisors, upper_divisors = [], []", "- i = 1", "- while i * i <= n:", "- if n % i == 0:", "- lower_divisors.append(i)", "- if i != n // i:", "- upper_divisors.append(n // i)", "- i += 1", "- return lo...
false
0.039616
0.037576
1.054298
[ "s283253858", "s874409958" ]
u396495667
p04043
python
s329772120
s705853511
178
17
38,256
2,940
Accepted
Accepted
90.45
a,b,c = list(map(int, input().split())) if a+b+c ==17: print('YES') else: print('NO')
a,b,c = list(map(int,input().split())) print(('YES' if (a+b+c)==17 else 'NO'))
6
2
89
71
a, b, c = list(map(int, input().split())) if a + b + c == 17: print("YES") else: print("NO")
a, b, c = list(map(int, input().split())) print(("YES" if (a + b + c) == 17 else "NO"))
false
66.666667
[ "-if a + b + c == 17:", "- print(\"YES\")", "-else:", "- print(\"NO\")", "+print((\"YES\" if (a + b + c) == 17 else \"NO\"))" ]
false
0.05315
0.051658
1.028885
[ "s329772120", "s705853511" ]
u887207211
p03379
python
s250484791
s759115196
310
278
25,472
26,180
Accepted
Accepted
10.32
N = int(eval(input())) X = list(map(int,input().split())) sort_X = sorted(X) l, r = sort_X[N//2-1], sort_X[N//2] for x in X: if(x <= l): print(r) else: print(l)
N = int(eval(input())) X = list(map(int,input().split())) sort_X = sorted(X) l = sort_X[N//2-1] r = sort_X[N//2] for x in X: if(x <= l): print(r) else: print(l)
9
10
174
175
N = int(eval(input())) X = list(map(int, input().split())) sort_X = sorted(X) l, r = sort_X[N // 2 - 1], sort_X[N // 2] for x in X: if x <= l: print(r) else: print(l)
N = int(eval(input())) X = list(map(int, input().split())) sort_X = sorted(X) l = sort_X[N // 2 - 1] r = sort_X[N // 2] for x in X: if x <= l: print(r) else: print(l)
false
10
[ "-l, r = sort_X[N // 2 - 1], sort_X[N // 2]", "+l = sort_X[N // 2 - 1]", "+r = sort_X[N // 2]" ]
false
0.04427
0.045359
0.975981
[ "s250484791", "s759115196" ]
u160414758
p03681
python
s015873597
s404975987
704
442
5,180
4,096
Accepted
Accepted
37.22
from math import factorial MOD = 10**9+7 N,M = list(map(int,input().split())) ans = 0 if abs(N-M) > 1: pass elif abs(N-M) ==1: ans = factorial(N)*factorial(M) % MOD elif N==M: ans = 2*factorial(N)*factorial(M) % MOD print(ans)
from math import factorial MOD = 10**9+7 N,M = list(map(int,input().split())) ans = 0 if abs(N-M) > 1: pass elif abs(N-M) ==1: ans = (factorial(N) % MOD * factorial(M) % MOD) % MOD elif N==M: ans = ( 2 * factorial(N) % MOD * factorial(M) % MOD) % MOD print(ans)
12
12
244
279
from math import factorial MOD = 10**9 + 7 N, M = list(map(int, input().split())) ans = 0 if abs(N - M) > 1: pass elif abs(N - M) == 1: ans = factorial(N) * factorial(M) % MOD elif N == M: ans = 2 * factorial(N) * factorial(M) % MOD print(ans)
from math import factorial MOD = 10**9 + 7 N, M = list(map(int, input().split())) ans = 0 if abs(N - M) > 1: pass elif abs(N - M) == 1: ans = (factorial(N) % MOD * factorial(M) % MOD) % MOD elif N == M: ans = (2 * factorial(N) % MOD * factorial(M) % MOD) % MOD print(ans)
false
0
[ "- ans = factorial(N) * factorial(M) % MOD", "+ ans = (factorial(N) % MOD * factorial(M) % MOD) % MOD", "- ans = 2 * factorial(N) * factorial(M) % MOD", "+ ans = (2 * factorial(N) % MOD * factorial(M) % MOD) % MOD" ]
false
0.039752
0.039134
1.015779
[ "s015873597", "s404975987" ]
u857293613
p02861
python
s841173534
s139613440
414
18
8,100
3,064
Accepted
Accepted
95.65
import itertools import math n = int(eval(input())) lis1 = [] for i in range(n): lis1.append(list(map(int, input().split()))) S = 0 for i in list(itertools.permutations(list(range(n)))): for j in range(n-1): S += math.sqrt((lis1[i[j]][0]-lis1[i[j+1]][0])**2 + (lis1[i[j]][1]-lis1[i[j+1]][1])**2)...
n = int(eval(input())) lis = [] for i in range(n): lis.append(list(map(int, input().split()))) s = 0 for i in range(n): for j in range(i,n): s += ((lis[i][0] - lis[j][0])**2 + (lis[i][1] - lis[j][1])**2)**(1/2) print((s*2/n))
13
9
358
241
import itertools import math n = int(eval(input())) lis1 = [] for i in range(n): lis1.append(list(map(int, input().split()))) S = 0 for i in list(itertools.permutations(list(range(n)))): for j in range(n - 1): S += math.sqrt( (lis1[i[j]][0] - lis1[i[j + 1]][0]) ** 2 + (lis1[i[j]...
n = int(eval(input())) lis = [] for i in range(n): lis.append(list(map(int, input().split()))) s = 0 for i in range(n): for j in range(i, n): s += ((lis[i][0] - lis[j][0]) ** 2 + (lis[i][1] - lis[j][1]) ** 2) ** (1 / 2) print((s * 2 / n))
false
30.769231
[ "-import itertools", "-import math", "-", "-lis1 = []", "+lis = []", "- lis1.append(list(map(int, input().split())))", "-S = 0", "-for i in list(itertools.permutations(list(range(n)))):", "- for j in range(n - 1):", "- S += math.sqrt(", "- (lis1[i[j]][0] - lis1[i[j + 1]][...
false
0.033544
0.036311
0.923804
[ "s841173534", "s139613440" ]
u504588563
p03295
python
s195775510
s856521202
571
522
48,984
18,996
Accepted
Accepted
8.58
n,m=[int(x) for x in input().split()] isA,atob=[0]*n,[n+1]*n for _ in [0]*m: ai,bi=[int(x) for x in input().split()] isA[ai-1]=1 atob[ai-1]=min(atob[ai-1],bi-1) bstack=n+1 ans=0 for a in range(n): if bstack==a: ans+=1 bstack=n+1 if isA[a]==0: continue bstack...
n,m=list(map(int,input().split())) ab=[] for i in range(m): a,b=[int(x) -1 for x in input().split()] ab.append((a,b)) ab=sorted(ab,key=lambda x: x[1]) ans=0 last_bridge=-1 for a,b in ab: # print(a,b) if last_bridge<a: last_bridge=b-1 ans+=1 print(ans)
16
14
352
290
n, m = [int(x) for x in input().split()] isA, atob = [0] * n, [n + 1] * n for _ in [0] * m: ai, bi = [int(x) for x in input().split()] isA[ai - 1] = 1 atob[ai - 1] = min(atob[ai - 1], bi - 1) bstack = n + 1 ans = 0 for a in range(n): if bstack == a: ans += 1 bstack = n + 1 if isA[a] ...
n, m = list(map(int, input().split())) ab = [] for i in range(m): a, b = [int(x) - 1 for x in input().split()] ab.append((a, b)) ab = sorted(ab, key=lambda x: x[1]) ans = 0 last_bridge = -1 for a, b in ab: # print(a,b) if last_bridge < a: last_bridge = b - 1 ans += 1 print(ans)
false
12.5
[ "-n, m = [int(x) for x in input().split()]", "-isA, atob = [0] * n, [n + 1] * n", "-for _ in [0] * m:", "- ai, bi = [int(x) for x in input().split()]", "- isA[ai - 1] = 1", "- atob[ai - 1] = min(atob[ai - 1], bi - 1)", "-bstack = n + 1", "+n, m = list(map(int, input().split()))", "+ab = []"...
false
0.007507
0.053156
0.14122
[ "s195775510", "s856521202" ]
u785578220
p03031
python
s021823253
s668822120
67
23
3,188
3,064
Accepted
Accepted
65.67
N,M = list(map(int,input().split())) s = [] for i in range(M): dp = [0]*(N) k,*tmp = list(map(int,input().split())) for j in tmp:dp[j-1]=1 s.append(dp) p = list(map(int,input().split())) ans = 0 for i in range(1<<N): tmp = 0 dp = [0]*M for I in range(M): for j in range(N...
N,M = list(map(int, input().split())) S = [] for i in range(M): tmp = list(map(int, input().split())) t = 0 for j in tmp[1:]: t += 1 << (j - 1) S.append(t) P = list(map(int, input().split())) ans = 0 for i in range(1 << N): f = 0 for s, p in zip(S, P): t = i & s ...
24
21
478
437
N, M = list(map(int, input().split())) s = [] for i in range(M): dp = [0] * (N) k, *tmp = list(map(int, input().split())) for j in tmp: dp[j - 1] = 1 s.append(dp) p = list(map(int, input().split())) ans = 0 for i in range(1 << N): tmp = 0 dp = [0] * M for I in range(M): for j...
N, M = list(map(int, input().split())) S = [] for i in range(M): tmp = list(map(int, input().split())) t = 0 for j in tmp[1:]: t += 1 << (j - 1) S.append(t) P = list(map(int, input().split())) ans = 0 for i in range(1 << N): f = 0 for s, p in zip(S, P): t = i & s c = bin(...
false
12.5
[ "-s = []", "+S = []", "- dp = [0] * (N)", "- k, *tmp = list(map(int, input().split()))", "- for j in tmp:", "- dp[j - 1] = 1", "- s.append(dp)", "-p = list(map(int, input().split()))", "+ tmp = list(map(int, input().split()))", "+ t = 0", "+ for j in tmp[1:]:", "+ ...
false
0.036271
0.038109
0.951771
[ "s021823253", "s668822120" ]
u429029348
p03146
python
s885841291
s837330568
31
28
9,084
9,180
Accepted
Accepted
9.68
s=int(eval(input())) if s==1 or s==2 or s==4: cnt=0 else: cnt=0 while s!=4: if s%2==0: s=s/2 cnt+=1 else: s=3*s+1 cnt+=1 print((cnt+4))
s=int(eval(input())) a=[s] cnt=0 for i in range(10**6): if s%2==0: s=s/2 cnt+=1 if s in a: break a.append(s) else: s=3*s+1 cnt+=1 if s in a: break a.append(s) print((cnt+1))
15
20
182
244
s = int(eval(input())) if s == 1 or s == 2 or s == 4: cnt = 0 else: cnt = 0 while s != 4: if s % 2 == 0: s = s / 2 cnt += 1 else: s = 3 * s + 1 cnt += 1 print((cnt + 4))
s = int(eval(input())) a = [s] cnt = 0 for i in range(10**6): if s % 2 == 0: s = s / 2 cnt += 1 if s in a: break a.append(s) else: s = 3 * s + 1 cnt += 1 if s in a: break a.append(s) print((cnt + 1))
false
25
[ "-if s == 1 or s == 2 or s == 4:", "- cnt = 0", "-else:", "- cnt = 0", "- while s != 4:", "- if s % 2 == 0:", "- s = s / 2", "- cnt += 1", "- else:", "- s = 3 * s + 1", "- cnt += 1", "-print((cnt + 4))", "+a = [s]", "+cnt =...
false
0.036444
0.040843
0.892287
[ "s885841291", "s837330568" ]
u254871849
p03775
python
s515389464
s736458655
29
26
3,060
3,060
Accepted
Accepted
10.34
import sys n = int(sys.stdin.readline().rstrip()) def main(): a = 1 for i in range(1, int(n ** 0.5) + 1): if n % i == 0: a = i b = n // a ans = len(str(b)) return ans if __name__ == '__main__': ans = main() print(ans)
import sys def divisors(n): res = [] for i in range(1, int(n ** 0.5) + 1): if n % i: continue res.append(i) return res n = int(sys.stdin.readline().rstrip()) def main(): res = divisors(n) print((len(str(n // res[-1])))) if __name__ == '__main__': main()
16
17
283
298
import sys n = int(sys.stdin.readline().rstrip()) def main(): a = 1 for i in range(1, int(n**0.5) + 1): if n % i == 0: a = i b = n // a ans = len(str(b)) return ans if __name__ == "__main__": ans = main() print(ans)
import sys def divisors(n): res = [] for i in range(1, int(n**0.5) + 1): if n % i: continue res.append(i) return res n = int(sys.stdin.readline().rstrip()) def main(): res = divisors(n) print((len(str(n // res[-1])))) if __name__ == "__main__": main()
false
5.882353
[ "+", "+", "+def divisors(n):", "+ res = []", "+ for i in range(1, int(n**0.5) + 1):", "+ if n % i:", "+ continue", "+ res.append(i)", "+ return res", "+", "- a = 1", "- for i in range(1, int(n**0.5) + 1):", "- if n % i == 0:", "- a ...
false
0.007101
0.083533
0.085009
[ "s515389464", "s736458655" ]
u496212176
p02629
python
s608093940
s838232387
34
30
9,160
9,204
Accepted
Accepted
11.76
n = int(eval(input())) cha = "abcdefghijklmnopqrstuvwxyz" ans = "" while n>=1: ans += cha[((n-1)%26)] n=(n-1)//26 print((ans[::-1]))
n = int(eval(input())) cha = "abcdefghijklmnopqrstuvwxyz" ans = [] while n >= 1: mod = (n - 1) % 26 ans.append(mod) n = (n - 1) // 26 ans_s = '' for tmp in reversed(ans): ans_s += cha[tmp] print(ans_s)
7
12
138
227
n = int(eval(input())) cha = "abcdefghijklmnopqrstuvwxyz" ans = "" while n >= 1: ans += cha[((n - 1) % 26)] n = (n - 1) // 26 print((ans[::-1]))
n = int(eval(input())) cha = "abcdefghijklmnopqrstuvwxyz" ans = [] while n >= 1: mod = (n - 1) % 26 ans.append(mod) n = (n - 1) // 26 ans_s = "" for tmp in reversed(ans): ans_s += cha[tmp] print(ans_s)
false
41.666667
[ "-ans = \"\"", "+ans = []", "- ans += cha[((n - 1) % 26)]", "+ mod = (n - 1) % 26", "+ ans.append(mod)", "-print((ans[::-1]))", "+ans_s = \"\"", "+for tmp in reversed(ans):", "+ ans_s += cha[tmp]", "+print(ans_s)" ]
false
0.097772
0.099456
0.983064
[ "s608093940", "s838232387" ]
u340781749
p02585
python
s735115735
s582571252
885
47
10,488
12,064
Accepted
Accepted
94.69
from itertools import accumulate def solve(n, k, ppp, ccc): NINF = -(10 ** 18) ans = NINF checked = [False] * n for s in range(n): if checked[s] == True: continue checked[s] = True scores = [ccc[ppp[s]]] v = ppp[s] while v != s: ...
from collections import Counter from heapq import heapify, heappop, heappush from itertools import accumulate def solve(n, k, ppp, ccc): NINF = -(10 ** 18) ans = NINF checked = [False] * n for s in range(n): if checked[s] == True: continue checked[s] = True ...
42
57
967
1,438
from itertools import accumulate def solve(n, k, ppp, ccc): NINF = -(10**18) ans = NINF checked = [False] * n for s in range(n): if checked[s] == True: continue checked[s] = True scores = [ccc[ppp[s]]] v = ppp[s] while v != s: scores.appe...
from collections import Counter from heapq import heapify, heappop, heappush from itertools import accumulate def solve(n, k, ppp, ccc): NINF = -(10**18) ans = NINF checked = [False] * n for s in range(n): if checked[s] == True: continue checked[s] = True scores = [...
false
26.315789
[ "+from collections import Counter", "+from heapq import heapify, heappop, heappush", "- tmp = max(max(acc[i + 1 : i + m + 1]) - acc[i] for i in range(l))", "- ans = max(ans, tmp, loop * d + tmp)", "+ base = max(0, loop * d)", "+ range_max = [-a for a in acc[1 : m + 1]]", "+ ...
false
0.041515
0.037414
1.109629
[ "s735115735", "s582571252" ]
u848535504
p02747
python
s282109455
s027711641
32
26
8,872
8,892
Accepted
Accepted
18.75
S = eval(input()) if S == "hi" * (len(S)//2): print("Yes") else: print("No")
S = eval(input()) if len(S)//2 * "hi" == S: print("Yes") else: print("No")
6
5
84
80
S = eval(input()) if S == "hi" * (len(S) // 2): print("Yes") else: print("No")
S = eval(input()) if len(S) // 2 * "hi" == S: print("Yes") else: print("No")
false
16.666667
[ "-if S == \"hi\" * (len(S) // 2):", "+if len(S) // 2 * \"hi\" == S:" ]
false
0.03594
0.053847
0.667454
[ "s282109455", "s027711641" ]
u131984977
p02399
python
s492194710
s399840807
70
30
14,716
6,740
Accepted
Accepted
57.14
import sys from decimal import Decimal (a, b) = [Decimal(i) for i in sys.stdin.readline().split(' ')] print((a // b, a % b, round(a / b, 5)))
(a, b) = [int(x) for x in input().split()] di = a // b m = a % b df = a / b print(('{0} {1} {2:.8f}'.format(di, m, df)))
6
7
148
126
import sys from decimal import Decimal (a, b) = [Decimal(i) for i in sys.stdin.readline().split(" ")] print((a // b, a % b, round(a / b, 5)))
(a, b) = [int(x) for x in input().split()] di = a // b m = a % b df = a / b print(("{0} {1} {2:.8f}".format(di, m, df)))
false
14.285714
[ "-import sys", "-from decimal import Decimal", "-", "-(a, b) = [Decimal(i) for i in sys.stdin.readline().split(\" \")]", "-print((a // b, a % b, round(a / b, 5)))", "+(a, b) = [int(x) for x in input().split()]", "+di = a // b", "+m = a % b", "+df = a / b", "+print((\"{0} {1} {2:.8f}\".format(di, m...
false
0.059338
0.037507
1.582073
[ "s492194710", "s399840807" ]
u969190727
p03175
python
s428677089
s113639774
734
667
74,288
31,824
Accepted
Accepted
9.13
import sys input=lambda: sys.stdin.readline().rstrip() mod=10**9+7 n=int(eval(input())) edge=[[] for i in range(n)] for i in range(n-1): a,b=list(map(int,input().split())) edge[a-1].append(b-1) edge[b-1].append(a-1) Ans=[] inf=10**6 #親と入次数を求める Par=[inf]*n Par[0]=-1 Deg=[0]*n Deg[0]=0 Chk=[0] wh...
import sys input=lambda: sys.stdin.readline().rstrip() mod=10**9+7 n=int(eval(input())) edge=[[] for i in range(n)] for i in range(n-1): a,b=list(map(int,input().split())) edge[a-1].append(b-1) edge[b-1].append(a-1) Ans=[] inf=10**6 #親と入次数を求める Par=[inf]*n Par[0]=-1 Deg=[0]*n Deg[0]=0 Chk=[0] wh...
57
57
1,022
1,032
import sys input = lambda: sys.stdin.readline().rstrip() mod = 10**9 + 7 n = int(eval(input())) edge = [[] for i in range(n)] for i in range(n - 1): a, b = list(map(int, input().split())) edge[a - 1].append(b - 1) edge[b - 1].append(a - 1) Ans = [] inf = 10**6 # 親と入次数を求める Par = [inf] * n Par[0] = -1 Deg = ...
import sys input = lambda: sys.stdin.readline().rstrip() mod = 10**9 + 7 n = int(eval(input())) edge = [[] for i in range(n)] for i in range(n - 1): a, b = list(map(int, input().split())) edge[a - 1].append(b - 1) edge[b - 1].append(a - 1) Ans = [] inf = 10**6 # 親と入次数を求める Par = [inf] * n Par[0] = -1 Deg = ...
false
0
[ "- c1 *= C1[g] + C2[g]", "- c2 *= C1[g]", "- C1[v] = c1 % mod", "- C2[v] = c2 % mod", "+ c1 = ((C1[g] + C2[g]) * c1) % mod", "+ c2 = (C1[g] * c2) % mod", "+ C1[v] = c1", "+ C2[v] = c2" ]
false
0.107247
0.042806
2.505418
[ "s428677089", "s113639774" ]
u177388368
p03229
python
s241688915
s681801651
261
206
8,244
13,636
Accepted
Accepted
21.07
from collections import deque n=int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) a.sort() a=deque(a) mid = a[(n-1)//2] midi = abs(a[(n-1)//2-1] - mid) mida = abs(a[(n-1)//2+1] - mid) rev = False omi = a[0] oma = a[-1] ans = abs(oma - omi) for i in range(len(a)//2...
n=int(eval(input())) a=[] for i in range(n): aa=int(eval(input())) a.append(aa) from collections import deque a.sort() a=deque(a) omi=a.popleft() oma=a.pop() ans=abs(oma-omi) ret=True while len(a)>1: mi=a.popleft() ma=a.pop() if ret: mi,ma=ma,mi ans+=abs(omi-mi)+...
40
30
559
443
from collections import deque n = int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) a.sort() a = deque(a) mid = a[(n - 1) // 2] midi = abs(a[(n - 1) // 2 - 1] - mid) mida = abs(a[(n - 1) // 2 + 1] - mid) rev = False omi = a[0] oma = a[-1] ans = abs(oma - omi) for i in range(len(a) // 2): ...
n = int(eval(input())) a = [] for i in range(n): aa = int(eval(input())) a.append(aa) from collections import deque a.sort() a = deque(a) omi = a.popleft() oma = a.pop() ans = abs(oma - omi) ret = True while len(a) > 1: mi = a.popleft() ma = a.pop() if ret: mi, ma = ma, mi ans += abs(om...
false
25
[ "-from collections import deque", "-", "- a.append(int(eval(input())))", "+ aa = int(eval(input()))", "+ a.append(aa)", "+from collections import deque", "+", "-mid = a[(n - 1) // 2]", "-midi = abs(a[(n - 1) // 2 - 1] - mid)", "-mida = abs(a[(n - 1) // 2 + 1] - mid)", "-rev = False", ...
false
0.037235
0.056914
0.654244
[ "s241688915", "s681801651" ]
u171115409
p02713
python
s038749199
s346355653
1,098
341
9,140
9,216
Accepted
Accepted
68.94
# -*- coding: utf-8 -*- K = int(eval(input())) def gcd(p, q): if(p % q == 0): return q else: return gcd(q, p % q) sum1 = 0 for a in range(1, K+1): for b in range(a+1, K+1): for c in range(b+1, K+1): sum1 += gcd(a, gcd(b, c)) sum2 = 0 for a in range(1, K+1): for c in range(a...
# -*- coding: utf-8 -*- K = int(eval(input())) def gcd(p, q): if(p % q == 0): return q else: return gcd(q, p % q) sum1 = 0 for c in range(1, K+1): for b in range(c+1, K+1): d = gcd(b, c) for a in range(b+1, K+1): sum1 += gcd(a, d) sum2 = 0 for a in range(1, K+1): for c...
26
27
443
454
# -*- coding: utf-8 -*- K = int(eval(input())) def gcd(p, q): if p % q == 0: return q else: return gcd(q, p % q) sum1 = 0 for a in range(1, K + 1): for b in range(a + 1, K + 1): for c in range(b + 1, K + 1): sum1 += gcd(a, gcd(b, c)) sum2 = 0 for a in range(1, K + 1):...
# -*- coding: utf-8 -*- K = int(eval(input())) def gcd(p, q): if p % q == 0: return q else: return gcd(q, p % q) sum1 = 0 for c in range(1, K + 1): for b in range(c + 1, K + 1): d = gcd(b, c) for a in range(b + 1, K + 1): sum1 += gcd(a, d) sum2 = 0 for a in ra...
false
3.703704
[ "-for a in range(1, K + 1):", "- for b in range(a + 1, K + 1):", "- for c in range(b + 1, K + 1):", "- sum1 += gcd(a, gcd(b, c))", "+for c in range(1, K + 1):", "+ for b in range(c + 1, K + 1):", "+ d = gcd(b, c)", "+ for a in range(b + 1, K + 1):", "+ ...
false
0.135671
0.051938
2.612169
[ "s038749199", "s346355653" ]
u347640436
p03032
python
s300541678
s568876283
41
37
3,064
3,064
Accepted
Accepted
9.76
n, k = list(map(int, input().split())) v = [int(e) for e in input().split()] m = min(n, k) result = 0 for i in range(m + 1): for j in range(i + 1): t = v[:j] t.extend(v[n - (i - j):]) t.sort() l = k - i while len(t) > 0 and l > 0 and t[0] < 0: t.pop(0) l -= 1 m = sum(t...
n, k = list(map(int, input().split())) v = list(map(int, input().split())) m = min(n, k) result = 0 for i in range(m + 1): for j in range(i + 1): t = v[:j] t.extend(v[n - (i - j):]) t.sort(reverse = True) l = k - i while len(t) > 0 and l > 0 and t[-1] < 0: t.pop() l -= 1 ...
17
15
369
360
n, k = list(map(int, input().split())) v = [int(e) for e in input().split()] m = min(n, k) result = 0 for i in range(m + 1): for j in range(i + 1): t = v[:j] t.extend(v[n - (i - j) :]) t.sort() l = k - i while len(t) > 0 and l > 0 and t[0] < 0: t.pop(0) ...
n, k = list(map(int, input().split())) v = list(map(int, input().split())) m = min(n, k) result = 0 for i in range(m + 1): for j in range(i + 1): t = v[:j] t.extend(v[n - (i - j) :]) t.sort(reverse=True) l = k - i while len(t) > 0 and l > 0 and t[-1] < 0: t.pop() ...
false
11.764706
[ "-v = [int(e) for e in input().split()]", "+v = list(map(int, input().split()))", "- t.sort()", "+ t.sort(reverse=True)", "- while len(t) > 0 and l > 0 and t[0] < 0:", "- t.pop(0)", "+ while len(t) > 0 and l > 0 and t[-1] < 0:", "+ t.pop()", "- ...
false
0.038974
0.038618
1.009225
[ "s300541678", "s568876283" ]
u970197315
p02844
python
s188387253
s827859253
527
304
42,076
73,864
Accepted
Accepted
42.31
n=int(eval(input())) s=eval(input()) ans=0 for i in range(1000): t_str=str(i) t_len=len(t_str) t_str=(3-t_len)*"0"+t_str cur_idx=0 ok=0 for j,ss in enumerate(s): if ss==t_str[cur_idx]: cur_idx+=1 ok+=1 if cur_idx==3:break if cur_idx==3: ans+=1 print(ans)
n = int(eval(input())) s = eval(input()) ans = 0 for i in range(1000): tmp = str(i).zfill(3) number = [tmp[0],tmp[1],tmp[2],"OK"] pos = 0 for ss in s: if ss == number[pos] and pos < 3: pos += 1 if number[pos] == "OK": ans += 1 print(ans)
18
13
300
285
n = int(eval(input())) s = eval(input()) ans = 0 for i in range(1000): t_str = str(i) t_len = len(t_str) t_str = (3 - t_len) * "0" + t_str cur_idx = 0 ok = 0 for j, ss in enumerate(s): if ss == t_str[cur_idx]: cur_idx += 1 ok += 1 if cur_idx == 3: ...
n = int(eval(input())) s = eval(input()) ans = 0 for i in range(1000): tmp = str(i).zfill(3) number = [tmp[0], tmp[1], tmp[2], "OK"] pos = 0 for ss in s: if ss == number[pos] and pos < 3: pos += 1 if number[pos] == "OK": ans += 1 print(ans)
false
27.777778
[ "- t_str = str(i)", "- t_len = len(t_str)", "- t_str = (3 - t_len) * \"0\" + t_str", "- cur_idx = 0", "- ok = 0", "- for j, ss in enumerate(s):", "- if ss == t_str[cur_idx]:", "- cur_idx += 1", "- ok += 1", "- if cur_idx == 3:", "- ...
false
0.080409
0.079846
1.007052
[ "s188387253", "s827859253" ]
u819048695
p03040
python
s204803186
s337385571
1,280
759
110,936
107,996
Accepted
Accepted
40.7
from heapq import heappop,heappush q=int(eval(input())) query=[list(map(int,input().split())) for _ in range(q)] inf=10**12 left=[inf] left_sum=0 right=[inf] right_sum=0 cnt=0 b=0 for i in range(q): if query[i][0]==1: a=query[i][1] b+=query[i][2] if cnt==0: d=rig...
from heapq import heappop,heappush import sys input=sys.stdin.readline q=int(eval(input())) query=[list(map(int,input().split())) for _ in range(q)] inf=10**12 left=[inf] left_sum=0 right=[inf] right_sum=0 cnt=0 b=0 for i in range(q): if query[i][0]==1: a=query[i][1] b+=query[i][2...
43
46
1,047
1,087
from heapq import heappop, heappush q = int(eval(input())) query = [list(map(int, input().split())) for _ in range(q)] inf = 10**12 left = [inf] left_sum = 0 right = [inf] right_sum = 0 cnt = 0 b = 0 for i in range(q): if query[i][0] == 1: a = query[i][1] b += query[i][2] if cnt == 0: ...
from heapq import heappop, heappush import sys input = sys.stdin.readline q = int(eval(input())) query = [list(map(int, input().split())) for _ in range(q)] inf = 10**12 left = [inf] left_sum = 0 right = [inf] right_sum = 0 cnt = 0 b = 0 for i in range(q): if query[i][0] == 1: a = query[i][1] b += ...
false
6.521739
[ "+import sys", "+input = sys.stdin.readline" ]
false
0.082066
0.084477
0.971465
[ "s204803186", "s337385571" ]
u643714578
p03207
python
s162121679
s050116823
20
17
2,940
2,940
Accepted
Accepted
15
n=int(eval(input())) a=[int(eval(input())) for i in range(n)] print((int(sum(a)-max(a)/2)))
N = int(eval(input())) L = [int(eval(input())) for i in range(N)] print((sum(L)-int(max(L)/2)))
3
3
79
83
n = int(eval(input())) a = [int(eval(input())) for i in range(n)] print((int(sum(a) - max(a) / 2)))
N = int(eval(input())) L = [int(eval(input())) for i in range(N)] print((sum(L) - int(max(L) / 2)))
false
0
[ "-n = int(eval(input()))", "-a = [int(eval(input())) for i in range(n)]", "-print((int(sum(a) - max(a) / 2)))", "+N = int(eval(input()))", "+L = [int(eval(input())) for i in range(N)]", "+print((sum(L) - int(max(L) / 2)))" ]
false
0.149086
0.069975
2.130572
[ "s162121679", "s050116823" ]
u678167152
p02996
python
s171376341
s469902660
1,015
894
53,612
53,728
Accepted
Accepted
11.92
N = int(eval(input())) X=[0]*N for i in range(N): X[i] = list(map(int, input().split())) X.sort(key=lambda x:x[1]) def check(): now = 0 for i in range(N): now += X[i][0] if now > X[i][1]: return 'No' return 'Yes' print((check()))
def check(): N = int(eval(input())) X = [list(map(int, input().split())) for _ in range(N)] X.sort(key=lambda x:x[1]) now = 0 for a,b in X: now += a if now>b: return 'No' return 'Yes' print((check()))
13
11
277
254
N = int(eval(input())) X = [0] * N for i in range(N): X[i] = list(map(int, input().split())) X.sort(key=lambda x: x[1]) def check(): now = 0 for i in range(N): now += X[i][0] if now > X[i][1]: return "No" return "Yes" print((check()))
def check(): N = int(eval(input())) X = [list(map(int, input().split())) for _ in range(N)] X.sort(key=lambda x: x[1]) now = 0 for a, b in X: now += a if now > b: return "No" return "Yes" print((check()))
false
15.384615
[ "-N = int(eval(input()))", "-X = [0] * N", "-for i in range(N):", "- X[i] = list(map(int, input().split()))", "-X.sort(key=lambda x: x[1])", "-", "-", "+ N = int(eval(input()))", "+ X = [list(map(int, input().split())) for _ in range(N)]", "+ X.sort(key=lambda x: x[1])", "- for i ...
false
0.067819
0.036756
1.845108
[ "s171376341", "s469902660" ]
u179376941
p02844
python
s952361874
s572641409
1,877
1,039
9,400
9,380
Accepted
Accepted
44.65
n = int(eval(input())) numbers = eval(input()) lst = [] ans = [] for i in range(n): pin = '' if numbers[i] not in lst: pin += numbers[i] lst.append(pin) lst2 = [] for j in range(i+1, n): pin += numbers[j] if pin[1] not in lst2: lst2.append(pin[1]) lst3 = [...
n = int(eval(input())) numbers = eval(input()) lst = set() ans = [] for i in range(n): pin = '' if numbers[i] not in lst: pin += numbers[i] lst.add(pin) lst2 = set() for j in range(i+1, n): pin += numbers[j] if pin[1] not in lst2: lst2.add(pin[1]) lst3 = s...
30
30
1,137
1,138
n = int(eval(input())) numbers = eval(input()) lst = [] ans = [] for i in range(n): pin = "" if numbers[i] not in lst: pin += numbers[i] lst.append(pin) lst2 = [] for j in range(i + 1, n): pin += numbers[j] if pin[1] not in lst2: lst2.appen...
n = int(eval(input())) numbers = eval(input()) lst = set() ans = [] for i in range(n): pin = "" if numbers[i] not in lst: pin += numbers[i] lst.add(pin) lst2 = set() for j in range(i + 1, n): pin += numbers[j] if pin[1] not in lst2: lst2.ad...
false
0
[ "-lst = []", "+lst = set()", "- lst.append(pin)", "- lst2 = []", "+ lst.add(pin)", "+ lst2 = set()", "- lst2.append(pin[1])", "- lst3 = []", "+ lst2.add(pin[1])", "+ lst3 = set()", "- l...
false
0.038664
0.068442
0.564908
[ "s952361874", "s572641409" ]
u194297606
p02987
python
s477458601
s446083387
21
18
3,316
2,940
Accepted
Accepted
14.29
import collections S = eval(input()) c = collections.Counter(S) x = c.most_common() if x[0][1] == 2: if x[1][1] == 2: print('Yes') else: print('No') else: print('No')
s = eval(input()) for a in s: if s.count(a) != 2: print('No') break else: print('Yes')
11
7
198
110
import collections S = eval(input()) c = collections.Counter(S) x = c.most_common() if x[0][1] == 2: if x[1][1] == 2: print("Yes") else: print("No") else: print("No")
s = eval(input()) for a in s: if s.count(a) != 2: print("No") break else: print("Yes")
false
36.363636
[ "-import collections", "-", "-S = eval(input())", "-c = collections.Counter(S)", "-x = c.most_common()", "-if x[0][1] == 2:", "- if x[1][1] == 2:", "- print(\"Yes\")", "- else:", "+s = eval(input())", "+for a in s:", "+ if s.count(a) != 2:", "+ break", "- print(\"...
false
0.041816
0.040813
1.024563
[ "s477458601", "s446083387" ]
u729133443
p02788
python
s907290934
s248277736
1,632
791
131,852
48,852
Accepted
Accepted
51.53
from subprocess import* call(("pypy3","-c",""" from bisect import* def _add(data,k,x): while k<=N: data[k]+=x k+=k&-k def add(l,r,x): _add(data0,l,-x*(l-1)) _add(data0,r,x*(r-1)) _add(data1,l,x) _add(data1,r,-x) def _get(data,k): s=0 while k: s+=data[k]...
from bisect import* n,d,a,*t=list(map(int,open(0).read().split())) c=[0]*-~n z=sorted(zip(*[iter(t)]*2)) y=[x for x,_ in z] s=0 for i,(x,h)in enumerate(z): c[i]+=c[i-1] h-=c[i] t=0--max(0,h)//a c[i]+=t*a c[bisect(y,x+d+d)]-=t*a s+=t print(s)
34
14
730
272
from subprocess import * call( ( "pypy3", "-c", """ from bisect import* def _add(data,k,x): while k<=N: data[k]+=x k+=k&-k def add(l,r,x): _add(data0,l,-x*(l-1)) _add(data0,r,x*(r-1)) _add(data1,l,x) _add(data1,r,-x) def _get(data,k): s=0 while k:...
from bisect import * n, d, a, *t = list(map(int, open(0).read().split())) c = [0] * -~n z = sorted(zip(*[iter(t)] * 2)) y = [x for x, _ in z] s = 0 for i, (x, h) in enumerate(z): c[i] += c[i - 1] h -= c[i] t = 0 - -max(0, h) // a c[i] += t * a c[bisect(y, x + d + d)] -= t * a s += t print(s)
false
58.823529
[ "-from subprocess import *", "+from bisect import *", "-call(", "- (", "- \"pypy3\",", "- \"-c\",", "- \"\"\"", "-from bisect import*", "-def _add(data,k,x):", "- while k<=N:", "- data[k]+=x", "- k+=k&-k", "-def add(l,r,x):", "- _add(data0,l,-x*(...
false
0.05516
0.043611
1.264816
[ "s907290934", "s248277736" ]
u077291787
p02972
python
s016136104
s262115209
587
166
13,356
12,720
Accepted
Accepted
71.72
# ABC134D - Preparing Boxes def main(): n = int(eval(input())) A = [0] + list(map(int, input().rstrip().split())) B = [0] * (n + 1) for i in range(n, 0, -1): cnt, p = 0, 2 while i * p <= n: cnt += B[i * p] p += 1 if cnt % 2 != A[i]: ...
# ABC134D - Preparing Boxes # Better ver. def main(): n = int(eval(input())) A = [0] + list(map(int, input().rstrip().split())) for i in range(n // 2, 0, -1): # second half: no multiples A[i] = sum(A[i::i]) % 2 ans = [i for i, j in enumerate(A) if j] print((len(ans))) # all cells: ...
22
14
527
410
# ABC134D - Preparing Boxes def main(): n = int(eval(input())) A = [0] + list(map(int, input().rstrip().split())) B = [0] * (n + 1) for i in range(n, 0, -1): cnt, p = 0, 2 while i * p <= n: cnt += B[i * p] p += 1 if cnt % 2 != A[i]: B[i] += 1 ...
# ABC134D - Preparing Boxes # Better ver. def main(): n = int(eval(input())) A = [0] + list(map(int, input().rstrip().split())) for i in range(n // 2, 0, -1): # second half: no multiples A[i] = sum(A[i::i]) % 2 ans = [i for i, j in enumerate(A) if j] print((len(ans))) # all cells: [1] -> l...
false
36.363636
[ "+# Better ver.", "- B = [0] * (n + 1)", "- for i in range(n, 0, -1):", "- cnt, p = 0, 2", "- while i * p <= n:", "- cnt += B[i * p]", "- p += 1", "- if cnt % 2 != A[i]:", "- B[i] += 1", "- total = sum(B)", "- if total == 0:", "...
false
0.043813
0.038162
1.148079
[ "s016136104", "s262115209" ]
u024715419
p02392
python
s062270799
s219954368
30
20
7,644
7,428
Accepted
Accepted
33.33
l = input().split() if int(l[0]) < int(l[1]) and int(l[1]) < int(l[2]): print("Yes") else: print("No")
inp=input().split() if inp[0] < inp[1] and inp[1] < inp[2]: print("Yes") else: print("No")
5
5
114
102
l = input().split() if int(l[0]) < int(l[1]) and int(l[1]) < int(l[2]): print("Yes") else: print("No")
inp = input().split() if inp[0] < inp[1] and inp[1] < inp[2]: print("Yes") else: print("No")
false
0
[ "-l = input().split()", "-if int(l[0]) < int(l[1]) and int(l[1]) < int(l[2]):", "+inp = input().split()", "+if inp[0] < inp[1] and inp[1] < inp[2]:" ]
false
0.034039
0.035953
0.946762
[ "s062270799", "s219954368" ]
u500376440
p03835
python
s722592924
s102480979
1,150
85
9,140
67,332
Accepted
Accepted
92.61
K,S=list(map(int,input().split())) ans=0 for X in range(K+1): for Y in range(K+1): Z=S-X-Y if 0<=Z<=K: ans+=1 print(ans)
import sys def input(): return sys.stdin.readline().rstrip() K,S=list(map(int,input().split())) cnt=0 for X in range(K+1): for Y in range(K+1): Z=S-X-Y if 0<=Z<=K: cnt+=1 print(cnt)
8
14
138
210
K, S = list(map(int, input().split())) ans = 0 for X in range(K + 1): for Y in range(K + 1): Z = S - X - Y if 0 <= Z <= K: ans += 1 print(ans)
import sys def input(): return sys.stdin.readline().rstrip() K, S = list(map(int, input().split())) cnt = 0 for X in range(K + 1): for Y in range(K + 1): Z = S - X - Y if 0 <= Z <= K: cnt += 1 print(cnt)
false
42.857143
[ "+import sys", "+", "+", "+def input():", "+ return sys.stdin.readline().rstrip()", "+", "+", "-ans = 0", "+cnt = 0", "- ans += 1", "-print(ans)", "+ cnt += 1", "+print(cnt)" ]
false
0.138995
0.035439
3.922138
[ "s722592924", "s102480979" ]
u057993957
p02761
python
s608165052
s172064053
149
18
12,472
3,060
Accepted
Accepted
87.92
from sys import stdin import sys import numpy as np import collections from functools import cmp_to_key import heapq ## input functions for me def rsa(sep = ''): if sep == '' : return input().split() else: return input().split(sep) def rip(sep = ''): if sep == '' : return l...
n, m = list(map(int, input().split())) sc = [list(map(int,input().split())) for i in range(m)] for i in range(0, 10**n): str_i = str(i) if len(str_i) != n: continue chk = True for s, c in sc: chk &= str_i[s-1] == str(c) if chk: print(i) exit() print((-1))
44
18
959
309
from sys import stdin import sys import numpy as np import collections from functools import cmp_to_key import heapq ## input functions for me def rsa(sep=""): if sep == "": return input().split() else: return input().split(sep) def rip(sep=""): if sep == "": return list(map(int,...
n, m = list(map(int, input().split())) sc = [list(map(int, input().split())) for i in range(m)] for i in range(0, 10**n): str_i = str(i) if len(str_i) != n: continue chk = True for s, c in sc: chk &= str_i[s - 1] == str(c) if chk: print(i) exit() print((-1))
false
59.090909
[ "-from sys import stdin", "-import sys", "-import numpy as np", "-import collections", "-from functools import cmp_to_key", "-import heapq", "-", "-## input functions for me", "-def rsa(sep=\"\"):", "- if sep == \"\":", "- return input().split()", "- else:", "- return in...
false
0.037816
0.007644
4.947302
[ "s608165052", "s172064053" ]
u011062360
p03013
python
s947989385
s579278676
185
162
13,216
18,104
Accepted
Accepted
12.43
n, m = list(map(int, input().split())) list_score = set([int(eval(input())) for _ in range(m)]) dp = [0] * (n + 1) mod = pow(10, 9) + 7 dp[0] = 1 if 1 in list_score: dp[1] = 0 else: dp[1] = 1 for i in range(2, n + 1): if i not in list_score: dp[i] = dp[i - 1] + dp[i - 2] dp...
n, m = list(map(int, input().split())) set_A = set() dp = [0]*n mod = pow(10, 9) + 7 for _ in range(m): set_A.add(int(eval(input()))) if 1 not in set_A: dp[0] = 1 if 2 not in set_A and n != 1: dp[1] = 1 + dp[0] for i in range(2, n): if i + 1 not in set_A: dp[i] += (dp[i-1] + dp...
18
18
334
336
n, m = list(map(int, input().split())) list_score = set([int(eval(input())) for _ in range(m)]) dp = [0] * (n + 1) mod = pow(10, 9) + 7 dp[0] = 1 if 1 in list_score: dp[1] = 0 else: dp[1] = 1 for i in range(2, n + 1): if i not in list_score: dp[i] = dp[i - 1] + dp[i - 2] dp[i] %= mod print((...
n, m = list(map(int, input().split())) set_A = set() dp = [0] * n mod = pow(10, 9) + 7 for _ in range(m): set_A.add(int(eval(input()))) if 1 not in set_A: dp[0] = 1 if 2 not in set_A and n != 1: dp[1] = 1 + dp[0] for i in range(2, n): if i + 1 not in set_A: dp[i] += (dp[i - 1] + dp[i - 2]) % mod...
false
0
[ "-list_score = set([int(eval(input())) for _ in range(m)])", "-dp = [0] * (n + 1)", "+set_A = set()", "+dp = [0] * n", "-dp[0] = 1", "-if 1 in list_score:", "- dp[1] = 0", "-else:", "- dp[1] = 1", "-for i in range(2, n + 1):", "- if i not in list_score:", "- dp[i] = dp[i - 1] +...
false
0.045998
0.046217
0.99526
[ "s947989385", "s579278676" ]
u808373096
p03854
python
s308709418
s120629858
89
67
3,188
3,188
Accepted
Accepted
24.72
S = eval(input()) while len(S) > 0: if ''.join(S[-5:]) == 'dream' or ''.join(S[-5:]) == 'erase': S = S[:-5] elif ''.join(S[-6:]) == 'eraser': S = S[:-6] elif ''.join(S[-7:]) == 'dreamer': S = S[:-7] else: print('NO') quit() print('YES')
S = eval(input()) while len(S) > 0: if S[-5:] == 'dream' or S[-5:] == 'erase': S = S[:-5] elif S[-6:] == 'eraser': S = S[:-6] elif S[-7:] == 'dreamer': S = S[:-7] else: print('NO') quit() print('YES')
12
12
297
261
S = eval(input()) while len(S) > 0: if "".join(S[-5:]) == "dream" or "".join(S[-5:]) == "erase": S = S[:-5] elif "".join(S[-6:]) == "eraser": S = S[:-6] elif "".join(S[-7:]) == "dreamer": S = S[:-7] else: print("NO") quit() print("YES")
S = eval(input()) while len(S) > 0: if S[-5:] == "dream" or S[-5:] == "erase": S = S[:-5] elif S[-6:] == "eraser": S = S[:-6] elif S[-7:] == "dreamer": S = S[:-7] else: print("NO") quit() print("YES")
false
0
[ "- if \"\".join(S[-5:]) == \"dream\" or \"\".join(S[-5:]) == \"erase\":", "+ if S[-5:] == \"dream\" or S[-5:] == \"erase\":", "- elif \"\".join(S[-6:]) == \"eraser\":", "+ elif S[-6:] == \"eraser\":", "- elif \"\".join(S[-7:]) == \"dreamer\":", "+ elif S[-7:] == \"dreamer\":" ]
false
0.042761
0.044608
0.958591
[ "s308709418", "s120629858" ]
u517797706
p02756
python
s489252371
s323716912
987
405
10,420
12,348
Accepted
Accepted
58.97
if __name__ == '__main__': s = eval(input()) n = int(eval(input())) rvcnt = 0 tmp = "S" tmp_before = "" tmp_after = "" for _ in range(n): q = eval(input()) if len(q) == 1: rvcnt += 1 else: i,f,c = list(map(str,q.split())) if f == "1":#先頭に追加 if rvcnt % 2 == 0: #先頭に追...
from collections import deque if __name__ == '__main__': s = eval(input()) n = int(eval(input())) rvflg = False d_st = deque() d_ed = deque() for _ in range(n): q = eval(input()) if len(q) == 1: if rvflg: rvflg = False e...
43
41
701
936
if __name__ == "__main__": s = eval(input()) n = int(eval(input())) rvcnt = 0 tmp = "S" tmp_before = "" tmp_after = "" for _ in range(n): q = eval(input()) if len(q) == 1: rvcnt += 1 else: i, f, c = list(map(str, q.split())) if f ==...
from collections import deque if __name__ == "__main__": s = eval(input()) n = int(eval(input())) rvflg = False d_st = deque() d_ed = deque() for _ in range(n): q = eval(input()) if len(q) == 1: if rvflg: rvflg = False else: ...
false
4.651163
[ "+from collections import deque", "+", "- rvcnt = 0", "- tmp = \"S\"", "- tmp_before = \"\"", "- tmp_after = \"\"", "+ rvflg = False", "+ d_st = deque()", "+ d_ed = deque()", "- rvcnt += 1", "+ if rvflg:", "+ rvflg = False", "+ ...
false
0.135341
0.064643
2.093688
[ "s489252371", "s323716912" ]
u499381410
p02911
python
s298083695
s418860099
360
316
50,908
50,268
Accepted
Accepted
12.22
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fr...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fr...
41
45
1,072
1,058
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor from functoo...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor from functoo...
false
8.888889
[ "-L = IR(q)", "-point = [k] * n", "-limit = q", "-for i in L:", "- point[i - 1] += 1", "-for j in point:", "- if j <= limit:", "+L = [k - q] * n", "+A = IR(q)", "+for l in A:", "+ L[l - 1] += 1", "+for j in range(n):", "+ if L[j] > 0:", "+ print(\"Yes\")", "+ else:"...
false
0.042651
0.04719
0.903812
[ "s298083695", "s418860099" ]
u348805958
p02642
python
s182618013
s589679808
192
167
40,068
98,092
Accepted
Accepted
13.02
#!python3 import sys iim = lambda: list(map(int, sys.stdin.readline().rstrip().split())) def resolve(): it = list(map(int, sys.stdin.read().split())) N = next(it) A = [next(it) for i in range(N)] if N == 1: print((1)) return ax = max(A)+1 dp = [0]*ax for a...
#!python3 import sys iim = lambda: list(map(int, sys.stdin.readline().rstrip().split())) def resolve(): it = list(map(int, sys.stdin.read().split())) N = next(it) A = [next(it) for i in range(N)] if N == 1: print((1)) return ax = max(A)+1 dp = [0]*ax for a...
33
35
632
674
#!python3 import sys iim = lambda: list(map(int, sys.stdin.readline().rstrip().split())) def resolve(): it = list(map(int, sys.stdin.read().split())) N = next(it) A = [next(it) for i in range(N)] if N == 1: print((1)) return ax = max(A) + 1 dp = [0] * ax for ai in A: ...
#!python3 import sys iim = lambda: list(map(int, sys.stdin.readline().rstrip().split())) def resolve(): it = list(map(int, sys.stdin.read().split())) N = next(it) A = [next(it) for i in range(N)] if N == 1: print((1)) return ax = max(A) + 1 dp = [0] * ax for ai in A: ...
false
5.714286
[ "- dp[ai] += 1", "+ dp[ai] = 1", "+ else:", "+ dp[ai] = 2" ]
false
0.05798
0.055235
1.049713
[ "s182618013", "s589679808" ]
u539367121
p02780
python
s417047841
s318219377
177
145
31,876
31,820
Accepted
Accepted
18.08
N, K = list(map(int, input().split())) P = [(int(x)+1)/2 for x in input().split()] Q=[0]*(N+1) for n in range(N): Q[n+1]=Q[n]+P[n] ans=0 for n in range(K,N+1): ans=max(ans, Q[n]-Q[n-K]) print(ans)
N, K = list(map(int, input().split())) P = [(int(x)+1)/2 for x in input().split()] total=ans=sum(P[:K]) for n in range(K,N): total+=P[n]-P[n-K] ans=max(ans, total) print(ans)
12
9
208
183
N, K = list(map(int, input().split())) P = [(int(x) + 1) / 2 for x in input().split()] Q = [0] * (N + 1) for n in range(N): Q[n + 1] = Q[n] + P[n] ans = 0 for n in range(K, N + 1): ans = max(ans, Q[n] - Q[n - K]) print(ans)
N, K = list(map(int, input().split())) P = [(int(x) + 1) / 2 for x in input().split()] total = ans = sum(P[:K]) for n in range(K, N): total += P[n] - P[n - K] ans = max(ans, total) print(ans)
false
25
[ "-Q = [0] * (N + 1)", "-for n in range(N):", "- Q[n + 1] = Q[n] + P[n]", "-ans = 0", "-for n in range(K, N + 1):", "- ans = max(ans, Q[n] - Q[n - K])", "+total = ans = sum(P[:K])", "+for n in range(K, N):", "+ total += P[n] - P[n - K]", "+ ans = max(ans, total)" ]
false
0.04606
0.047414
0.971442
[ "s417047841", "s318219377" ]
u810356688
p02990
python
s893630744
s412722507
1,257
30
3,940
4,056
Accepted
Accepted
97.61
import sys def input(): return sys.stdin.readline().rstrip() from functools import reduce def mod_comb4(n,r,mod=10**9+7): if r==1:return n elif r==0:return 1 else: num=reduce(lambda x,y:x*y%mod,list(range(n,n-r,-1))) den=reduce(lambda x,y:x*y%mod,list(range(1,r+1))) return n...
import sys def input(): return sys.stdin.readline().rstrip() from functools import reduce def mod_comb4(n,r,mod=10**9+7): if r==1:return n elif r==0:return 1 else: num=reduce(lambda x,y:x*y%mod,list(range(n,n-r,-1))) den=reduce(lambda x,y:x*y%mod,list(range(1,r+1))) return n...
18
35
523
1,280
import sys def input(): return sys.stdin.readline().rstrip() from functools import reduce def mod_comb4(n, r, mod=10**9 + 7): if r == 1: return n elif r == 0: return 1 else: num = reduce(lambda x, y: x * y % mod, list(range(n, n - r, -1))) den = reduce(lambda x, y: ...
import sys def input(): return sys.stdin.readline().rstrip() from functools import reduce def mod_comb4(n, r, mod=10**9 + 7): if r == 1: return n elif r == 0: return 1 else: num = reduce(lambda x, y: x * y % mod, list(range(n, n - r, -1))) den = reduce(lambda x, y: ...
false
48.571429
[ "+class mod_comb3:", "+ def __init__(self, mod=10**9 + 7, n_max=1):", "+ self.mod, self.n_max = mod, n_max", "+ self.fact, self.inv, self.factinv = [1, 1], [0, 1], [1, 1]", "+ if 1 < n_max:", "+ setup_table(n_max)", "+", "+ def comb(self, n, r):", "+ if r...
false
0.106243
0.046579
2.280925
[ "s893630744", "s412722507" ]
u431981421
p03493
python
s387727113
s289046769
19
17
2,940
2,940
Accepted
Accepted
10.53
a = list(eval(input())) c = 0 if a[0] == '1': c += 1 if a[1] == '1': c += 1 if a[2] == '1': c += 1 print(c)
li = list(eval(input())) count = 0 for i in li: if i == '1': count += 1 print(count)
10
8
117
93
a = list(eval(input())) c = 0 if a[0] == "1": c += 1 if a[1] == "1": c += 1 if a[2] == "1": c += 1 print(c)
li = list(eval(input())) count = 0 for i in li: if i == "1": count += 1 print(count)
false
20
[ "-a = list(eval(input()))", "-c = 0", "-if a[0] == \"1\":", "- c += 1", "-if a[1] == \"1\":", "- c += 1", "-if a[2] == \"1\":", "- c += 1", "-print(c)", "+li = list(eval(input()))", "+count = 0", "+for i in li:", "+ if i == \"1\":", "+ count += 1", "+print(count)" ]
false
0.049118
0.009145
5.370747
[ "s387727113", "s289046769" ]
u952467214
p02807
python
s879781863
s232340019
747
207
14,252
15,376
Accepted
Accepted
72.29
n = int(eval(input())) x = list( map(int, input().split())) def extgcd(a,b): r = [1,0,a] w = [0,1,b] while w[2]!=1: q = r[2]//w[2] r2 = w w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]] r = r2 w = w2 #[x,y] return [w[0],w[1]] def mod_inv(a,mod): ...
n = int(eval(input())) x = list( map(int, input().split())) MOD = 10**9 + 7 def make_mod_inv(l,p): # lまでの逆元を作る mod_inv = [0, 1] + [0] * (l+3) # inv[n] = n^(-1) mod p, 0! = 1 だけど便宜上inv[0]=0にしてる for i in range(2, l+5): mod_inv[i] = -mod_inv[p % i] * (p // i) % p return mod_inv mod_inv = ma...
40
30
707
649
n = int(eval(input())) x = list(map(int, input().split())) def extgcd(a, b): r = [1, 0, a] w = [0, 1, b] while w[2] != 1: q = r[2] // w[2] r2 = w w2 = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]] r = r2 w = w2 # [x,y] return [w[0], w[1]] def mod_inv...
n = int(eval(input())) x = list(map(int, input().split())) MOD = 10**9 + 7 def make_mod_inv(l, p): # lまでの逆元を作る mod_inv = [0, 1] + [0] * (l + 3) # inv[n] = n^(-1) mod p, 0! = 1 だけど便宜上inv[0]=0にしてる for i in range(2, l + 5): mod_inv[i] = -mod_inv[p % i] * (p // i) % p return mod_inv mod_inv = make...
false
25
[ "+MOD = 10**9 + 7", "-def extgcd(a, b):", "- r = [1, 0, a]", "- w = [0, 1, b]", "- while w[2] != 1:", "- q = r[2] // w[2]", "- r2 = w", "- w2 = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]]", "- r = r2", "- w = w2", "- # [x,y]", "- return...
false
0.037828
0.070185
0.538968
[ "s879781863", "s232340019" ]
u212786022
p02696
python
s579084273
s383833432
22
20
9,068
9,100
Accepted
Accepted
9.09
a, b, n = list(map(int, input().split())) x = min(b-1, n) ans = int((a*x)/b) - a*int(x/b) print(ans)
a, b, n = list(map(int, input().split())) x = min(b-1, n) ans = int(a*x/b) - a*int(x/b) print(ans)
4
4
98
96
a, b, n = list(map(int, input().split())) x = min(b - 1, n) ans = int((a * x) / b) - a * int(x / b) print(ans)
a, b, n = list(map(int, input().split())) x = min(b - 1, n) ans = int(a * x / b) - a * int(x / b) print(ans)
false
0
[ "-ans = int((a * x) / b) - a * int(x / b)", "+ans = int(a * x / b) - a * int(x / b)" ]
false
0.035228
0.059692
0.590171
[ "s579084273", "s383833432" ]
u186838327
p03472
python
s407517979
s705471721
625
202
51,288
86,652
Accepted
Accepted
67.68
n, h = list(map(int, input().split())) A = [0]*n B = [0]*n for i in range(n): A[i], B[i] = list(map(int, input().split())) A.sort(reverse=True) B.sort(reverse=True) c = 0 for j in range(n): if B[j] >= A[0]: c += 1 h -= B[j] if h <= 0: print(c) exit() else: break if...
n, h = list(map(int, input().split())) #AB = [] A = [] B = [] for i in range(n): a, b = list(map(int, input().split())) A.append(a) B.append(b) #AB.append((a, b)) x = max(A) B.sort(reverse=True) ans = 0 for i, b in enumerate(B): if b > x: h -= b ans += 1 else: ...
24
24
375
405
n, h = list(map(int, input().split())) A = [0] * n B = [0] * n for i in range(n): A[i], B[i] = list(map(int, input().split())) A.sort(reverse=True) B.sort(reverse=True) c = 0 for j in range(n): if B[j] >= A[0]: c += 1 h -= B[j] if h <= 0: print(c) exit() else:...
n, h = list(map(int, input().split())) # AB = [] A = [] B = [] for i in range(n): a, b = list(map(int, input().split())) A.append(a) B.append(b) # AB.append((a, b)) x = max(A) B.sort(reverse=True) ans = 0 for i, b in enumerate(B): if b > x: h -= b ans += 1 else: break ...
false
0
[ "-A = [0] * n", "-B = [0] * n", "+# AB = []", "+A = []", "+B = []", "- A[i], B[i] = list(map(int, input().split()))", "-A.sort(reverse=True)", "+ a, b = list(map(int, input().split()))", "+ A.append(a)", "+ B.append(b)", "+ # AB.append((a, b))", "+x = max(A)", "-c = 0", "-fo...
false
0.035112
0.03426
1.024882
[ "s407517979", "s705471721" ]
u145950990
p03110
python
s427141560
s850086625
160
17
38,256
2,940
Accepted
Accepted
89.38
n = int(eval(input())) ans = 0 for i in range(n): x,u = input().split() x = float(x) ans += x if u=='JPY' else x*380000 print(ans)
n = int(eval(input())) ans = 0 for i in range(n): x,u = input().split() x = float(x) if u=='JPY': ans += x else: ans += x* 380000 print(ans)
7
10
142
176
n = int(eval(input())) ans = 0 for i in range(n): x, u = input().split() x = float(x) ans += x if u == "JPY" else x * 380000 print(ans)
n = int(eval(input())) ans = 0 for i in range(n): x, u = input().split() x = float(x) if u == "JPY": ans += x else: ans += x * 380000 print(ans)
false
30
[ "- ans += x if u == \"JPY\" else x * 380000", "+ if u == \"JPY\":", "+ ans += x", "+ else:", "+ ans += x * 380000" ]
false
0.07853
0.036212
2.168589
[ "s427141560", "s850086625" ]
u562935282
p03061
python
s325555667
s334819552
1,577
72
103,520
14,180
Accepted
Accepted
95.43
# http://tsutaj.hatenablog.com/entry/2017/03/29/204841 from fractions import gcd class SegmentTree: def __init__(self, v): sz = len(v) self.n = 1 while self.n < sz: self.n *= 2 self.node = [0 for _ in range(2 * self.n - 1)] # 元配列 v をセグメント木で表現する ...
n = int(eval(input())) a = tuple(map(int, input().split())) st = set() for tar in a[:2]: i = 1 while i * i <= tar: if tar % i == 0: st.add(i) st.add(tar // i) i += 1 for d in sorted(st, reverse=True): cnt = 0 for aa in a: if aa % d != 0: ...
67
22
1,783
420
# http://tsutaj.hatenablog.com/entry/2017/03/29/204841 from fractions import gcd class SegmentTree: def __init__(self, v): sz = len(v) self.n = 1 while self.n < sz: self.n *= 2 self.node = [0 for _ in range(2 * self.n - 1)] # 元配列 v をセグメント木で表現する # 最下段のノード...
n = int(eval(input())) a = tuple(map(int, input().split())) st = set() for tar in a[:2]: i = 1 while i * i <= tar: if tar % i == 0: st.add(i) st.add(tar // i) i += 1 for d in sorted(st, reverse=True): cnt = 0 for aa in a: if aa % d != 0: cnt +=...
false
67.164179
[ "-# http://tsutaj.hatenablog.com/entry/2017/03/29/204841", "-from fractions import gcd", "-", "-", "-class SegmentTree:", "- def __init__(self, v):", "- sz = len(v)", "- self.n = 1", "- while self.n < sz:", "- self.n *= 2", "- self.node = [0 for _ in ran...
false
0.18474
0.041816
4.417894
[ "s325555667", "s334819552" ]
u803617136
p02801
python
s734019014
s416784935
167
17
38,256
2,940
Accepted
Accepted
89.82
Z = eval(input()) print((chr(ord(Z) + 1)))
print((chr(ord(eval(input())) + 1)))
2
1
35
28
Z = eval(input()) print((chr(ord(Z) + 1)))
print((chr(ord(eval(input())) + 1)))
false
50
[ "-Z = eval(input())", "-print((chr(ord(Z) + 1)))", "+print((chr(ord(eval(input())) + 1)))" ]
false
0.042778
0.043469
0.984083
[ "s734019014", "s416784935" ]
u392319141
p03651
python
s953978274
s086807075
146
83
14,224
14,224
Accepted
Accepted
43.15
N, K = list(map(int, input().split())) A = list(map(int, input().split())) def gcd(n, m) : n, m = max(n, m), min(n, m) if m == 0 : return n return gcd(m, n % m) dis = A[0] for a in A : dis = gcd(dis, a) for a in A : if a < K : continue if (a - K) % dis == 0 : ...
N, K = list(map(int, input().split())) A = list(map(int, input().split())) def gcd(n, m): if m == 0: return n return gcd(m, n % m) G = A[0] for a in A: G = gcd(G, a) for a in A: if K <= a and (a - K) % G == 0: print('POSSIBLE') exit() print('IMPOSSIBLE')
21
18
387
310
N, K = list(map(int, input().split())) A = list(map(int, input().split())) def gcd(n, m): n, m = max(n, m), min(n, m) if m == 0: return n return gcd(m, n % m) dis = A[0] for a in A: dis = gcd(dis, a) for a in A: if a < K: continue if (a - K) % dis == 0: print("POSSIBL...
N, K = list(map(int, input().split())) A = list(map(int, input().split())) def gcd(n, m): if m == 0: return n return gcd(m, n % m) G = A[0] for a in A: G = gcd(G, a) for a in A: if K <= a and (a - K) % G == 0: print("POSSIBLE") exit() print("IMPOSSIBLE")
false
14.285714
[ "- n, m = max(n, m), min(n, m)", "-dis = A[0]", "+G = A[0]", "- dis = gcd(dis, a)", "+ G = gcd(G, a)", "- if a < K:", "- continue", "- if (a - K) % dis == 0:", "+ if K <= a and (a - K) % G == 0:", "- break", "-else:", "- print(\"IMPOSSIBLE\")", "+ ex...
false
0.039587
0.040035
0.98882
[ "s953978274", "s086807075" ]
u034128150
p02913
python
s752057945
s663536519
116
100
75,988
75,756
Accepted
Accepted
13.79
class RollingHash: def __init__(self, string, root, mod): self.root = root self.mod = mod self.hs = [0] * (len(string) + 1) self.pw = [1] * (len(string) + 1) for i in range(len(string)): self.hs[i + 1] = (self.hs[i] * self.root + ord(string[i])) % self.mo...
class RollingHash: def __init__(self, string, root, mod): self.root = root self.mod = mod self.hs = [0] * (len(string) + 1) self.pw = [1] * (len(string) + 1) for i in range(len(string)): self.hs[i + 1] = (self.hs[i] * self.root + ord(string[i])) % self.mo...
85
81
2,426
2,289
class RollingHash: def __init__(self, string, root, mod): self.root = root self.mod = mod self.hs = [0] * (len(string) + 1) self.pw = [1] * (len(string) + 1) for i in range(len(string)): self.hs[i + 1] = (self.hs[i] * self.root + ord(string[i])) % self.mod ...
class RollingHash: def __init__(self, string, root, mod): self.root = root self.mod = mod self.hs = [0] * (len(string) + 1) self.pw = [1] * (len(string) + 1) for i in range(len(string)): self.hs[i + 1] = (self.hs[i] * self.root + ord(string[i])) % self.mod ...
false
4.705882
[ "-POSITIVIZER = RHMOD << 61", "- ret = self.hs[r] - self.hs[l] * self.pw[r - l] + POSITIVIZER", "- ret = (ret >> 61) + (ret & RHMOD)", "- if ret >= RHMOD:", "- ret -= RHMOD", "- return ret", "+ return (self.hs[r] - self.hs[l] * self.pw[r - l]) % RHMOD" ]
false
0.038928
0.111227
0.349992
[ "s752057945", "s663536519" ]
u729133443
p02713
python
s207041524
s471823637
555
217
68,392
89,476
Accepted
Accepted
60.9
from math import gcd k=int(eval(input()))+1 print((sum(gcd(c,gcd(a,b))for a in range(1,k)for b in range(1,k)for c in range(1,k))))
from numpy import*;f=gcd.outer;r=list(range(1,int(eval(input()))+1));print((sum(f(f(r,r),r))))
3
1
124
80
from math import gcd k = int(eval(input())) + 1 print( ( sum( gcd(c, gcd(a, b)) for a in range(1, k) for b in range(1, k) for c in range(1, k) ) ) )
from numpy import * f = gcd.outer r = list(range(1, int(eval(input())) + 1)) print((sum(f(f(r, r), r))))
false
66.666667
[ "-from math import gcd", "+from numpy import *", "-k = int(eval(input())) + 1", "-print(", "- (", "- sum(", "- gcd(c, gcd(a, b))", "- for a in range(1, k)", "- for b in range(1, k)", "- for c in range(1, k)", "- )", "- )", "-)",...
false
0.128275
0.33988
0.377413
[ "s207041524", "s471823637" ]
u562400059
p02681
python
s235860308
s546811885
24
22
9,028
9,048
Accepted
Accepted
8.33
S = eval(input()) T = eval(input()) if S == T[0:len(S)]: print('Yes') else: print('No')
S = eval(input()) T = eval(input()) print(('Yes' if S == T[:-1] else 'No'))
7
4
91
66
S = eval(input()) T = eval(input()) if S == T[0 : len(S)]: print("Yes") else: print("No")
S = eval(input()) T = eval(input()) print(("Yes" if S == T[:-1] else "No"))
false
42.857143
[ "-if S == T[0 : len(S)]:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+print((\"Yes\" if S == T[:-1] else \"No\"))" ]
false
0.046766
0.040844
1.144999
[ "s235860308", "s546811885" ]
u616217092
p03353
python
s729835607
s485748207
40
26
16,248
15,604
Accepted
Accepted
35
from sys import stdin from string import ascii_lowercase def main(): s = stdin.readline().rstrip() K = int(stdin.readline().rstrip()) result = [] for c in ascii_lowercase: for text in sorted([s[i:] for i, x in enumerate(s) if x == c]): for i in range(len(text)): ...
from sys import stdin def main(): s = stdin.readline().rstrip() K = int(stdin.readline().rstrip()) result = set() for c in sorted(list(set(s))): for x in sorted([s[i:] for i, x in enumerate(s) if x == c]): for y in [x[:j + 1] for j in range(len(x))]: resul...
20
18
569
492
from sys import stdin from string import ascii_lowercase def main(): s = stdin.readline().rstrip() K = int(stdin.readline().rstrip()) result = [] for c in ascii_lowercase: for text in sorted([s[i:] for i, x in enumerate(s) if x == c]): for i in range(len(text)): if ...
from sys import stdin def main(): s = stdin.readline().rstrip() K = int(stdin.readline().rstrip()) result = set() for c in sorted(list(set(s))): for x in sorted([s[i:] for i, x in enumerate(s) if x == c]): for y in [x[: j + 1] for j in range(len(x))]: result.add(y) ...
false
10
[ "-from string import ascii_lowercase", "- result = []", "- for c in ascii_lowercase:", "- for text in sorted([s[i:] for i, x in enumerate(s) if x == c]):", "- for i in range(len(text)):", "- if not text[: i + 1] in result:", "- result.append(text...
false
0.101003
0.037647
2.682902
[ "s729835607", "s485748207" ]
u796942881
p02911
python
s079324152
s969346653
95
85
18,152
14,324
Accepted
Accepted
10.53
from collections import Counter from sys import stdin def main(): lines = stdin.readlines() N, K, Q = list(map(int, lines[0].split())) A = Counter([int(i) - 1 for i in lines[1:]]) print(("\n".join(["Yes" if Q < K + A[i] else "No" for i in range(0, N)]))) return main()
from collections import Counter def main(): N, K, Q, *A = list(map(int, open(0).read().split())) A = Counter(A) print(("\n".join(["Yes" if Q < K + A[i] else "No" for i in range(1, N + 1)]))) return main()
13
12
297
249
from collections import Counter from sys import stdin def main(): lines = stdin.readlines() N, K, Q = list(map(int, lines[0].split())) A = Counter([int(i) - 1 for i in lines[1:]]) print(("\n".join(["Yes" if Q < K + A[i] else "No" for i in range(0, N)]))) return main()
from collections import Counter def main(): N, K, Q, *A = list(map(int, open(0).read().split())) A = Counter(A) print(("\n".join(["Yes" if Q < K + A[i] else "No" for i in range(1, N + 1)]))) return main()
false
7.692308
[ "-from sys import stdin", "- lines = stdin.readlines()", "- N, K, Q = list(map(int, lines[0].split()))", "- A = Counter([int(i) - 1 for i in lines[1:]])", "- print((\"\\n\".join([\"Yes\" if Q < K + A[i] else \"No\" for i in range(0, N)])))", "+ N, K, Q, *A = list(map(int, open(0).read().spl...
false
0.052137
0.05183
1.005916
[ "s079324152", "s969346653" ]
u877470159
p03030
python
s901804444
s279261287
191
168
38,704
38,256
Accepted
Accepted
12.04
n=int(eval(input())) List=[] for i in range(n): s,p=input().split() p=int(p) List.append([s,p,i+1]) List.sort() S=List[0][0] k=[] for i in List: if i[0]==S: k.append([i[1],i[2]]) else: k.sort(reverse=True) for j in k: print((j[1])) S=i[0] ...
n=int(eval(input())) List=[] for i in range(n): s,p=input().split() p=-int(p) List.append([s,p,i+1]) List.sort() for i in List: print((i[2]))
22
9
408
158
n = int(eval(input())) List = [] for i in range(n): s, p = input().split() p = int(p) List.append([s, p, i + 1]) List.sort() S = List[0][0] k = [] for i in List: if i[0] == S: k.append([i[1], i[2]]) else: k.sort(reverse=True) for j in k: print((j[1])) S = ...
n = int(eval(input())) List = [] for i in range(n): s, p = input().split() p = -int(p) List.append([s, p, i + 1]) List.sort() for i in List: print((i[2]))
false
59.090909
[ "- p = int(p)", "+ p = -int(p)", "-S = List[0][0]", "-k = []", "- if i[0] == S:", "- k.append([i[1], i[2]])", "- else:", "- k.sort(reverse=True)", "- for j in k:", "- print((j[1]))", "- S = i[0]", "- k = []", "- k.append([i[1],...
false
0.0363
0.037661
0.963864
[ "s901804444", "s279261287" ]
u608241985
p02688
python
s194571816
s784165824
32
28
9,136
9,188
Accepted
Accepted
12.5
n, k = list(map(int, input().split())) A = set([]) for i in range(k): d = eval(input()) A = A | set(map(int, input().split())) ans = 0 for i in range(n): if i+1 not in A: ans += 1 print(ans)
n, k = list(map(int, input().split())) A = set([]) for i in range(k): d = eval(input()) A = A | set(map(int, input().split())) print((n-len(A)))
12
8
211
147
n, k = list(map(int, input().split())) A = set([]) for i in range(k): d = eval(input()) A = A | set(map(int, input().split())) ans = 0 for i in range(n): if i + 1 not in A: ans += 1 print(ans)
n, k = list(map(int, input().split())) A = set([]) for i in range(k): d = eval(input()) A = A | set(map(int, input().split())) print((n - len(A)))
false
33.333333
[ "-ans = 0", "-for i in range(n):", "- if i + 1 not in A:", "- ans += 1", "-print(ans)", "+print((n - len(A)))" ]
false
0.061929
0.152553
0.405953
[ "s194571816", "s784165824" ]
u298101891
p04029
python
s739365431
s230746564
28
24
9,084
8,912
Accepted
Accepted
14.29
n=int(eval(input())) sum=0 for i in range(1,n+1): sum+=i print(sum)
sum = 0 for i in range(1,int(eval(input()))+1): sum += i print(sum)
5
4
70
69
n = int(eval(input())) sum = 0 for i in range(1, n + 1): sum += i print(sum)
sum = 0 for i in range(1, int(eval(input())) + 1): sum += i print(sum)
false
20
[ "-n = int(eval(input()))", "-for i in range(1, n + 1):", "+for i in range(1, int(eval(input())) + 1):" ]
false
0.102505
0.040273
2.545236
[ "s739365431", "s230746564" ]
u094102716
p02595
python
s846921262
s760192035
939
560
116,556
97,540
Accepted
Accepted
40.36
a = list(map(int, input().split())) xy = [list(map(int, input().split())) for _ in range(a[0])] x, y = [list(i) for i in zip(*xy)] c = 0 for i in range(a[0]): if a[1]**2 >= x[i]**2 +y[i]**2: c += 1 print(c)
(n,d),*z = [list(map(int,t.split()))for t in open(0)] print((sum(x*x+y*y<=d*d for x,y in z)))
8
2
213
86
a = list(map(int, input().split())) xy = [list(map(int, input().split())) for _ in range(a[0])] x, y = [list(i) for i in zip(*xy)] c = 0 for i in range(a[0]): if a[1] ** 2 >= x[i] ** 2 + y[i] ** 2: c += 1 print(c)
(n, d), *z = [list(map(int, t.split())) for t in open(0)] print((sum(x * x + y * y <= d * d for x, y in z)))
false
75
[ "-a = list(map(int, input().split()))", "-xy = [list(map(int, input().split())) for _ in range(a[0])]", "-x, y = [list(i) for i in zip(*xy)]", "-c = 0", "-for i in range(a[0]):", "- if a[1] ** 2 >= x[i] ** 2 + y[i] ** 2:", "- c += 1", "-print(c)", "+(n, d), *z = [list(map(int, t.split())) ...
false
0.04607
0.040565
1.135695
[ "s846921262", "s760192035" ]
u211109468
p03157
python
s490911763
s644442085
225
186
78,016
71,820
Accepted
Accepted
17.33
from collections import deque dx,dy = [1, 0, -1, 0], [0, 1, 0, -1] H, W = list(map(int, input().split())) seen = [[False]*W for _ in range(H)] c,S = 0,[] for _ in range(H): S.append(eval(input())) for i in range(H): for j in range(W): if (S[i][j]=='#') and (not seen[i][j]): d = deque() d.appe...
from collections import deque H, W = list(map(int, input().split())) seen = [[False]*W for _ in range(H)] dx,dy = [1, 0, -1, 0], [0, 1, 0, -1] c,S = 0,[] for _ in range(H): S.append(eval(input())) for i in range(H): for j in range(W): if (S[i][j]=='#') and (not seen[i][j]): d = deque() d.append...
33
31
768
754
from collections import deque dx, dy = [1, 0, -1, 0], [0, 1, 0, -1] H, W = list(map(int, input().split())) seen = [[False] * W for _ in range(H)] c, S = 0, [] for _ in range(H): S.append(eval(input())) for i in range(H): for j in range(W): if (S[i][j] == "#") and (not seen[i][j]): d = deque...
from collections import deque H, W = list(map(int, input().split())) seen = [[False] * W for _ in range(H)] dx, dy = [1, 0, -1, 0], [0, 1, 0, -1] c, S = 0, [] for _ in range(H): S.append(eval(input())) for i in range(H): for j in range(W): if (S[i][j] == "#") and (not seen[i][j]): d = deque...
false
6.060606
[ "-dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]", "+dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]", "- if S[px][py] == \"#\" and S[nx][ny] == \".\":", "+ if (S[px][py] == \"#\" and S[nx][ny] == \".\") or (", "+ S[px][py] == \".\" and S[nx][ny] == \"#\"", "+ ...
false
0.045533
0.190112
0.239505
[ "s490911763", "s644442085" ]
u334712262
p02564
python
s685244110
s828201307
1,981
1,710
317,556
332,696
Accepted
Accepted
13.68
from collections import defaultdict import sys input = sys.stdin.buffer.readline def scc(V, E): # g = defaultdict(list) g = [[] for _ in range(len(V))] # rg = defaultdict(list) rg = [[] for _ in range(len(V))] for u, v in E: g[u].append(v) rg[v].append(u) o =...
from collections import defaultdict import sys input = sys.stdin.buffer.readline def scc(V, E): g = defaultdict(list) # g = [[] for _ in range(len(V))] rg = defaultdict(list) # rg = [[] for _ in range(len(V))] for u, v in E: g[u].append(v) rg[v].append(u) o =...
103
103
2,008
2,008
from collections import defaultdict import sys input = sys.stdin.buffer.readline def scc(V, E): # g = defaultdict(list) g = [[] for _ in range(len(V))] # rg = defaultdict(list) rg = [[] for _ in range(len(V))] for u, v in E: g[u].append(v) rg[v].append(u) o = [] done = set...
from collections import defaultdict import sys input = sys.stdin.buffer.readline def scc(V, E): g = defaultdict(list) # g = [[] for _ in range(len(V))] rg = defaultdict(list) # rg = [[] for _ in range(len(V))] for u, v in E: g[u].append(v) rg[v].append(u) o = [] done = set...
false
0
[ "- # g = defaultdict(list)", "- g = [[] for _ in range(len(V))]", "- # rg = defaultdict(list)", "- rg = [[] for _ in range(len(V))]", "+ g = defaultdict(list)", "+ # g = [[] for _ in range(len(V))]", "+ rg = defaultdict(list)", "+ # rg = [[] for _ in range(len(V))]" ]
false
0.06168
0.046336
1.331145
[ "s685244110", "s828201307" ]
u285681431
p02862
python
s234301785
s622914782
1,142
251
127,924
213,168
Accepted
Accepted
78.02
##################################################### # 組み合わせを10**9+7で割った余り、を高速に求めるアルゴリズム # https://drken1215.hatenablog.com/entry/2018/06/08/210000 # https://qiita.com/derodero24/items/91b6468e66923a87f39f # 全然理解できていない MOD = 10**9 + 7 def comb(n, r): if (r < 0 and r > n): return 0 r = min(...
# 逆元を利用した組み合わせの計算 ############################################################# def cmb(n, r, mod): if (r < 0 or r > n): return 0 r = min(r, n - r) return g1[n] * g2[r] * g2[n - r] % mod # 問題に応じて変える、素数の時しか動作しない mod = 10**9 + 7 # 問題に応じて変える、上限 N = 10**6 # 元テーブル g1 = [1, 1] # 逆元テ...
51
47
1,104
940
##################################################### # 組み合わせを10**9+7で割った余り、を高速に求めるアルゴリズム # https://drken1215.hatenablog.com/entry/2018/06/08/210000 # https://qiita.com/derodero24/items/91b6468e66923a87f39f # 全然理解できていない MOD = 10**9 + 7 def comb(n, r): if r < 0 and r > n: return 0 r = min(r, n - r) ...
# 逆元を利用した組み合わせの計算 ############################################################# def cmb(n, r, mod): if r < 0 or r > n: return 0 r = min(r, n - r) return g1[n] * g2[r] * g2[n - r] % mod # 問題に応じて変える、素数の時しか動作しない mod = 10**9 + 7 # 問題に応じて変える、上限 N = 10**6 # 元テーブル g1 = [1, 1] # 逆元テーブル g2 = [1, 1] # 逆元テーブ...
false
7.843137
[ "-#####################################################", "-# 組み合わせを10**9+7で割った余り、を高速に求めるアルゴリズム", "-# https://drken1215.hatenablog.com/entry/2018/06/08/210000", "-# https://qiita.com/derodero24/items/91b6468e66923a87f39f", "-# 全然理解できていない", "-MOD = 10**9 + 7", "+# 逆元を利用した組み合わせの計算", "+##################...
false
1.372378
2.169506
0.632576
[ "s234301785", "s622914782" ]
u919633157
p03331
python
s105190962
s492915503
332
178
3,864
3,864
Accepted
Accepted
46.39
def wa(t): sum=0 while t>0: sum+=t%10 t//=10 return sum n=int(eval(input())) ans=[] for i in range(1,n): ans.append(wa(i)+wa(n-i)) if wa(i)+wa(n-i)==1: print(i) print((min(ans)))
def wa(t): sum=0 while t>0: sum+=t%10 t//=10 return sum n=int(eval(input())) ans=[] for i in range(1,n): ans.append(wa(i)+wa(n-i)) print((min(ans)))
14
12
227
183
def wa(t): sum = 0 while t > 0: sum += t % 10 t //= 10 return sum n = int(eval(input())) ans = [] for i in range(1, n): ans.append(wa(i) + wa(n - i)) if wa(i) + wa(n - i) == 1: print(i) print((min(ans)))
def wa(t): sum = 0 while t > 0: sum += t % 10 t //= 10 return sum n = int(eval(input())) ans = [] for i in range(1, n): ans.append(wa(i) + wa(n - i)) print((min(ans)))
false
14.285714
[ "- if wa(i) + wa(n - i) == 1:", "- print(i)" ]
false
0.073925
0.059827
1.235646
[ "s105190962", "s492915503" ]
u189326411
p03694
python
s602647016
s388852075
20
17
2,940
2,940
Accepted
Accepted
15
n = int(eval(input())) lst = sorted(map(int, input().split())) print((lst[-1]-lst[0]))
n = eval(input()) lst = list(map(int, input().split())) print((max(lst)-min(lst)))
3
3
81
77
n = int(eval(input())) lst = sorted(map(int, input().split())) print((lst[-1] - lst[0]))
n = eval(input()) lst = list(map(int, input().split())) print((max(lst) - min(lst)))
false
0
[ "-n = int(eval(input()))", "-lst = sorted(map(int, input().split()))", "-print((lst[-1] - lst[0]))", "+n = eval(input())", "+lst = list(map(int, input().split()))", "+print((max(lst) - min(lst)))" ]
false
0.047604
0.045999
1.034892
[ "s602647016", "s388852075" ]
u845573105
p02579
python
s861544651
s257173046
866
731
100,268
92,316
Accepted
Accepted
15.59
H, W = list(map(int, input().split())) ch, cw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) f = [[s=="." for s in eval(input())] for h in range(H)] ans = [[-1 for w in range(W)]for h in range(H)] nextQ = [(ch-1)*1000 + cw-1] ans[ch-1][cw-1] = 0 while len(nextQ)>0: Q = list(n...
H, W = list(map(int, input().split())) ch, cw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) f = [[s=="." for s in eval(input())] for h in range(H)] ans = [[-1 for w in range(W)]for h in range(H)] nextQ = [(ch-1)*1000 + cw-1] ans[ch-1][cw-1] = 0 while len(nextQ)>0: Q = list(n...
50
46
1,536
1,377
H, W = list(map(int, input().split())) ch, cw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) f = [[s == "." for s in eval(input())] for h in range(H)] ans = [[-1 for w in range(W)] for h in range(H)] nextQ = [(ch - 1) * 1000 + cw - 1] ans[ch - 1][cw - 1] = 0 while len(nextQ) > 0: Q = lis...
H, W = list(map(int, input().split())) ch, cw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) f = [[s == "." for s in eval(input())] for h in range(H)] ans = [[-1 for w in range(W)] for h in range(H)] nextQ = [(ch - 1) * 1000 + cw - 1] ans[ch - 1][cw - 1] = 0 while len(nextQ) > 0: Q = lis...
false
8
[ "- visited.add((nh + dh) * 1000 + nw + dw)", "+ nextQ -= {(nh + dh) * 1000 + nw + dw}", "- elif ans[nh + dh][nw + dw] > ans[nh][nw]:", "- nextQ.add((nh + dh) * 1000 + nw + dw)", "- ans[nh + dh][nw ...
false
0.037469
0.079405
0.471867
[ "s861544651", "s257173046" ]
u163829702
p02683
python
s684757304
s775597058
90
81
9,228
9,160
Accepted
Accepted
10
N, M, X = list(map(int, input().split())) CA = [list(map(int, input().split())) for _ in range(N)] ans = 10 ** 18 for i in range(2 ** N): cost = 0 each_alg = [0 for _ in range(M)] for j in range(N): if (i >> j) & 1: cost += CA[j][0] for k in range(M): ...
N, M, X = list(map(int, input().split())) cost = [] A = [] for _ in range(N): ca = list(map(int, input().split())) cost.append(ca[0]) A.append(ca[1:]) ans = 10**9 for bit in range(2**N): alg = [0]*M c = 0 for i in range(N): if bit >> i & 1 == 1: for j in range(...
19
24
462
486
N, M, X = list(map(int, input().split())) CA = [list(map(int, input().split())) for _ in range(N)] ans = 10**18 for i in range(2**N): cost = 0 each_alg = [0 for _ in range(M)] for j in range(N): if (i >> j) & 1: cost += CA[j][0] for k in range(M): each_alg[k] ...
N, M, X = list(map(int, input().split())) cost = [] A = [] for _ in range(N): ca = list(map(int, input().split())) cost.append(ca[0]) A.append(ca[1:]) ans = 10**9 for bit in range(2**N): alg = [0] * M c = 0 for i in range(N): if bit >> i & 1 == 1: for j in range(M): ...
false
20.833333
[ "-CA = [list(map(int, input().split())) for _ in range(N)]", "-ans = 10**18", "-for i in range(2**N):", "- cost = 0", "- each_alg = [0 for _ in range(M)]", "- for j in range(N):", "- if (i >> j) & 1:", "- cost += CA[j][0]", "- for k in range(M):", "- ...
false
0.050386
0.048204
1.045268
[ "s684757304", "s775597058" ]
u397384480
p02936
python
s158391233
s584950158
818
752
94,100
93,972
Accepted
Accepted
8.07
from collections import deque import sys input = sys.stdin.readline N,Q = list(map(int,input().split())) graph = [[] for i in range(N)] for i in range(N-1): a,b = list(map(int,input().split())) graph[a-1].append(b-1) graph[b-1].append(a-1) #print(graph) v = [0]*N for i in range(Q): p,x...
from collections import deque import sys input = sys.stdin.readline N,Q = list(map(int,input().split())) graph = [[] for i in range(N)] for i in range(N-1): a,b = list(map(int,input().split())) graph[a-1].append(b-1) graph[b-1].append(a-1) #print(graph) v = [0]*N for i in range(Q): p,x...
31
31
597
593
from collections import deque import sys input = sys.stdin.readline N, Q = list(map(int, input().split())) graph = [[] for i in range(N)] for i in range(N - 1): a, b = list(map(int, input().split())) graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) # print(graph) v = [0] * N for i in range(Q): p, ...
from collections import deque import sys input = sys.stdin.readline N, Q = list(map(int, input().split())) graph = [[] for i in range(N)] for i in range(N - 1): a, b = list(map(int, input().split())) graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) # print(graph) v = [0] * N for i in range(Q): p, ...
false
0
[ "- now = stack.popleft()", "+ now = stack.pop()" ]
false
0.039217
0.037179
1.05483
[ "s158391233", "s584950158" ]
u347600233
p03038
python
s306002679
s235731800
524
325
32,872
28,960
Accepted
Accepted
37.98
n, m = list(map(int, input().split())) cards = sorted(list(map(int, input().split()))) ope = [list(map(int, input().split())) for i in range(m)] ope.sort(key=lambda x: x[1], reverse=True) i, j, k = 0, 0, 0 while i < n and j < m and cards[i] < ope[j][1]: cards[i] = ope[j][1] i += 1 k += 1 if k >...
n, m = list(map(int, input().split())) a = sorted([int(i) for i in input().split()]) bc = sorted([tuple(map(int, input().split())) for i in range(m)], key=lambda x: x[1], reverse=True) i = 0 for b, c in bc: while b: if i < n and a[i] < c: a[i] = c b -= 1 else: ...
13
13
376
357
n, m = list(map(int, input().split())) cards = sorted(list(map(int, input().split()))) ope = [list(map(int, input().split())) for i in range(m)] ope.sort(key=lambda x: x[1], reverse=True) i, j, k = 0, 0, 0 while i < n and j < m and cards[i] < ope[j][1]: cards[i] = ope[j][1] i += 1 k += 1 if k >= ope[j][...
n, m = list(map(int, input().split())) a = sorted([int(i) for i in input().split()]) bc = sorted( [tuple(map(int, input().split())) for i in range(m)], key=lambda x: x[1], reverse=True, ) i = 0 for b, c in bc: while b: if i < n and a[i] < c: a[i] = c b -= 1 else: ...
false
0
[ "-cards = sorted(list(map(int, input().split())))", "-ope = [list(map(int, input().split())) for i in range(m)]", "-ope.sort(key=lambda x: x[1], reverse=True)", "-i, j, k = 0, 0, 0", "-while i < n and j < m and cards[i] < ope[j][1]:", "- cards[i] = ope[j][1]", "- i += 1", "- k += 1", "- ...
false
0.07632
0.04141
1.843042
[ "s306002679", "s235731800" ]
u232852711
p03032
python
s926002372
s973509527
1,674
29
3,572
3,064
Accepted
Accepted
98.27
from collections import deque from copy import deepcopy import heapq n, k = list(map(int, input().split())) v = list(map(int, input().split())) v_sorted = sorted(v) ans = 0 for i in range(k+1): for nl in range(i+1): nr = min(k - nl, n-nl) ansl, ansr = 0, 0 for n_trash in range...
n, k = list(map(int, input().split())) v = list(map(int, input().split())) ans = 0 for lr in range(min(n, k)+1): for l in range(lr+1): r = lr - l jewels = v[:l]+v[-r:] if r > 0 else v[:l] n_release = k - lr ans_cur = 0 for j in sorted(jewels): if j < 0...
37
18
1,027
470
from collections import deque from copy import deepcopy import heapq n, k = list(map(int, input().split())) v = list(map(int, input().split())) v_sorted = sorted(v) ans = 0 for i in range(k + 1): for nl in range(i + 1): nr = min(k - nl, n - nl) ansl, ansr = 0, 0 for n_trash in range(nl): ...
n, k = list(map(int, input().split())) v = list(map(int, input().split())) ans = 0 for lr in range(min(n, k) + 1): for l in range(lr + 1): r = lr - l jewels = v[:l] + v[-r:] if r > 0 else v[:l] n_release = k - lr ans_cur = 0 for j in sorted(jewels): if j < 0 and n...
false
51.351351
[ "-from collections import deque", "-from copy import deepcopy", "-import heapq", "-", "-v_sorted = sorted(v)", "-for i in range(k + 1):", "- for nl in range(i + 1):", "- nr = min(k - nl, n - nl)", "- ansl, ansr = 0, 0", "- for n_trash in range(nl):", "- ansll, ...
false
0.043323
0.041052
1.055332
[ "s926002372", "s973509527" ]
u368249389
p04029
python
s343910711
s626861336
188
17
38,256
2,940
Accepted
Accepted
90.96
# Problem A - キャンディーとN人の子供イージー # input process N = int(eval(input())) ans = N * (1 + N) ans = ans // 2 print(ans)
# Problem A - キャンディーとN人の子供イージー # input n = int(eval(input())) # initialization ans = (n * (n + 1)) // 2 # output print(ans)
9
9
119
128
# Problem A - キャンディーとN人の子供イージー # input process N = int(eval(input())) ans = N * (1 + N) ans = ans // 2 print(ans)
# Problem A - キャンディーとN人の子供イージー # input n = int(eval(input())) # initialization ans = (n * (n + 1)) // 2 # output print(ans)
false
0
[ "-# input process", "-N = int(eval(input()))", "-ans = N * (1 + N)", "-ans = ans // 2", "+# input", "+n = int(eval(input()))", "+# initialization", "+ans = (n * (n + 1)) // 2", "+# output" ]
false
0.035188
0.033984
1.035418
[ "s343910711", "s626861336" ]
u371763408
p03607
python
s050902360
s321164173
216
197
16,640
16,604
Accepted
Accepted
8.8
import collections ans = 0 n = int(eval(input())) nums = [int(eval(input())) for i in range(n)] con = collections.Counter(nums) for i in list(con.values()): if i % 2 != 0: ans += 1 print(ans)
from collections import Counter n=int(eval(input())) A=Counter([int(eval(input())) for i in range(n)]) ans=sum([1 if i%2==1 else 0 for i in list(A.values())]) print(ans)
10
5
189
155
import collections ans = 0 n = int(eval(input())) nums = [int(eval(input())) for i in range(n)] con = collections.Counter(nums) for i in list(con.values()): if i % 2 != 0: ans += 1 print(ans)
from collections import Counter n = int(eval(input())) A = Counter([int(eval(input())) for i in range(n)]) ans = sum([1 if i % 2 == 1 else 0 for i in list(A.values())]) print(ans)
false
50
[ "-import collections", "+from collections import Counter", "-ans = 0", "-nums = [int(eval(input())) for i in range(n)]", "-con = collections.Counter(nums)", "-for i in list(con.values()):", "- if i % 2 != 0:", "- ans += 1", "+A = Counter([int(eval(input())) for i in range(n)])", "+ans = ...
false
0.107604
0.034503
3.118709
[ "s050902360", "s321164173" ]
u263830634
p02892
python
s275457394
s820704169
365
254
44,396
18,552
Accepted
Accepted
30.41
#直径が答えになるわけではない N = int(eval(input())) S = [list(map(int, eval(input()))) for _ in range(N)] # for s in S: # print (s) lst = [0] * N lst[0] = 1 stack = [0] flag = True while len(stack) != 0: tmp = stack.pop() for index, x in enumerate(S[tmp]): if x == 0: continue ...
N = int(eval(input())) S = [list(map(int, eval(input()))) for _ in range(N)] lst = [0] * N lst[0] = 1 stack = [0] flag = True while len(stack) != 0: tmp = stack.pop() for index, x in enumerate(S[tmp]): if x == 0: continue if lst[index] == 0: lst[index] = -...
48
34
979
717
# 直径が答えになるわけではない N = int(eval(input())) S = [list(map(int, eval(input()))) for _ in range(N)] # for s in S: # print (s) lst = [0] * N lst[0] = 1 stack = [0] flag = True while len(stack) != 0: tmp = stack.pop() for index, x in enumerate(S[tmp]): if x == 0: continue if lst[index] =...
N = int(eval(input())) S = [list(map(int, eval(input()))) for _ in range(N)] lst = [0] * N lst[0] = 1 stack = [0] flag = True while len(stack) != 0: tmp = stack.pop() for index, x in enumerate(S[tmp]): if x == 0: continue if lst[index] == 0: lst[index] = -lst[tmp] ...
false
29.166667
[ "-# 直径が答えになるわけではない", "-# for s in S:", "-# print (s)", "-INF = 10**9", "-for i in range(N):", "- for j in range(N):", "- if S[i][j] == 0 and i != j:", "- S[i][j] = INF", "-for k in range(N):", "- for i in range(N):", "- for j in range(N):", "- S[i]...
false
0.044024
0.041967
1.049016
[ "s275457394", "s820704169" ]
u807028974
p02536
python
s647444211
s237121210
1,185
885
40,084
34,544
Accepted
Accepted
25.32
# import sys # import math #sqrt,gcd,pi # import decimal import queue # queue import bisect # import heapq # priolity-queue # from time import time # from itertools import product,permutations,\ # combinations,combinations_with_replacement # 重複あり順列、順列、組み合わせ、重複あり組み合わせ # import collections # deque # from o...
# queueのライブラリをインポート import queue n,m = list(map(int,input().split())) # 各都市から繋がっている都市を記録 road = [[] for i in range(n)] for i in range(m): a,b = list(map(int,input().split())) road[a-1].append(b-1) road[b-1].append(a-1) ans = 0 # まだ訪れていない都市を記録 city = set(i for i in range(n)) # まだ訪れていない都市がある間繰り返す whi...
49
33
1,188
697
# import sys # import math #sqrt,gcd,pi # import decimal import queue # queue import bisect # import heapq # priolity-queue # from time import time # from itertools import product,permutations,\ # combinations,combinations_with_replacement # 重複あり順列、順列、組み合わせ、重複あり組み合わせ # import collections # deque # from operator impor...
# queueのライブラリをインポート import queue n, m = list(map(int, input().split())) # 各都市から繋がっている都市を記録 road = [[] for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) road[a - 1].append(b - 1) road[b - 1].append(a - 1) ans = 0 # まだ訪れていない都市を記録 city = set(i for i in range(n)) # まだ訪れていない都市がある間繰り返す...
false
32.653061
[ "-# import sys", "-# import math #sqrt,gcd,pi", "-# import decimal", "-import queue # queue", "-import bisect", "+# queueのライブラリをインポート", "+import queue", "-# import heapq # priolity-queue", "-# from time import time", "-# from itertools import product,permutations,\\", "-# combinations,combinati...
false
0.047231
0.047214
1.000347
[ "s647444211", "s237121210" ]
u608088992
p03007
python
s880952009
s380411120
275
213
22,740
28,340
Accepted
Accepted
22.55
import sys, math, collections, heapq, itertools from bisect import bisect_left def solve(): file = sys.stdin.readline #single: int(file()), line: map(int, file().split()) INF = 10 ** 25 mod = 7 + 10 ** 9 N = int(file()) A = [int(a) for a in file().split()] A.sort() ans = 0 ...
import sys def solve(): input = sys.stdin.readline N = int(eval(input())) A = [int(a) for a in input().split()] A.sort() DP = [[None, None] for _ in range(N)] DP[0][0] = -A[0] DP[0][1] = -10 ** 20 for i in range(1, N): DP[i][0] = DP[i-1][0] - A[i] DP[i][1] ...
49
35
1,293
822
import sys, math, collections, heapq, itertools from bisect import bisect_left def solve(): file = sys.stdin.readline # single: int(file()), line: map(int, file().split()) INF = 10**25 mod = 7 + 10**9 N = int(file()) A = [int(a) for a in file().split()] A.sort() ans = 0 out = [] i...
import sys def solve(): input = sys.stdin.readline N = int(eval(input())) A = [int(a) for a in input().split()] A.sort() DP = [[None, None] for _ in range(N)] DP[0][0] = -A[0] DP[0][1] = -(10**20) for i in range(1, N): DP[i][0] = DP[i - 1][0] - A[i] DP[i][1] = max(DP[i ...
false
28.571429
[ "-import sys, math, collections, heapq, itertools", "-from bisect import bisect_left", "+import sys", "- file = sys.stdin.readline # single: int(file()), line: map(int, file().split())", "- INF = 10**25", "- mod = 7 + 10**9", "- N = int(file())", "- A = [int(a) for a in file().split()]...
false
0.034844
0.043423
0.802431
[ "s880952009", "s380411120" ]
u282228874
p03807
python
s450457362
s038401077
57
42
14,108
14,108
Accepted
Accepted
26.32
n = int(eval(input())) A = list(map(int,input().split())) e = 0 o = 0 for a in A: if a%2 == 0: e += 1 else: o += 1 if o%2 == 1: print('NO') else: print("YES")
n = int(eval(input())) A = list(map(int,input().split())) if sum(A)%2 == 1: print('NO') else: print("YES")
15
7
200
115
n = int(eval(input())) A = list(map(int, input().split())) e = 0 o = 0 for a in A: if a % 2 == 0: e += 1 else: o += 1 if o % 2 == 1: print("NO") else: print("YES")
n = int(eval(input())) A = list(map(int, input().split())) if sum(A) % 2 == 1: print("NO") else: print("YES")
false
53.333333
[ "-e = 0", "-o = 0", "-for a in A:", "- if a % 2 == 0:", "- e += 1", "- else:", "- o += 1", "-if o % 2 == 1:", "+if sum(A) % 2 == 1:" ]
false
0.041106
0.040464
1.015847
[ "s450457362", "s038401077" ]
u102461423
p02971
python
s418033226
s930664573
415
292
33,928
50,848
Accepted
Accepted
29.64
import sys input = sys.stdin.readline import numpy as np N = int(eval(input())) A = np.array([int(eval(input())) for _ in range(N)]) from_left = np.maximum.accumulate(A) from_right = np.maximum.accumulate(A[::-1])[::-1] from_left, from_right from_left = [0] + from_left.tolist()[:-1] from_right = from...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) A = np.zeros(N+2,np.int32) A[1:-1] = np.array(read().split(),np.int32) A from_left = np.maximum.accumulate(A) from_right = np.maximum.accumulate(A[...
18
18
405
425
import sys input = sys.stdin.readline import numpy as np N = int(eval(input())) A = np.array([int(eval(input())) for _ in range(N)]) from_left = np.maximum.accumulate(A) from_right = np.maximum.accumulate(A[::-1])[::-1] from_left, from_right from_left = [0] + from_left.tolist()[:-1] from_right = from_right[1:].tolist...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) A = np.zeros(N + 2, np.int32) A[1:-1] = np.array(read().split(), np.int32) A from_left = np.maximum.accumulate(A) from_right = np.maximum.accumulate(A[::-1])[::-1]...
false
0
[ "-input = sys.stdin.readline", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "-N = int(eval(input()))", "-A = np.array([int(eval(input())) for _ in range(N)])", "+N = int(readline())", "+A = np.zeros(N + 2, np.int32)", "+A[1:-1] ...
false
0.353019
0.920637
0.383451
[ "s418033226", "s930664573" ]
u533039576
p03855
python
s376672268
s186438687
1,871
1,635
161,668
160,196
Accepted
Accepted
12.61
import sys from collections import defaultdict input = sys.stdin.readline sys.setrecursionlimit(10**8) class UnionFind(): def __init__(self, n): self.par = [-1 for i in range(n)] def root(self, x): if self.par[x] < 0: return x else: self.par[x] = se...
import sys from collections import defaultdict input = sys.stdin.readline sys.setrecursionlimit(10**8) class UnionFind(): def __init__(self, n): self.par = [-1 for i in range(n)] def root(self, x): if self.par[x] < 0: return x else: self.par[x] = se...
58
58
1,469
1,399
import sys from collections import defaultdict input = sys.stdin.readline sys.setrecursionlimit(10**8) class UnionFind: def __init__(self, n): self.par = [-1 for i in range(n)] def root(self, x): if self.par[x] < 0: return x else: self.par[x] = self.root(self....
import sys from collections import defaultdict input = sys.stdin.readline sys.setrecursionlimit(10**8) class UnionFind: def __init__(self, n): self.par = [-1 for i in range(n)] def root(self, x): if self.par[x] < 0: return x else: self.par[x] = self.root(self....
false
0
[ "-memo = dict()", "+memo = defaultdict(int)", "- if (uf_r.root(i), uf_t.root(i)) not in memo:", "- memo[(uf_r.root(i), uf_t.root(i))] = len(", "- root_r[uf_r.root(i)] & root_t[uf_t.root(i)]", "- )", "+ memo[(uf_r.root(i), uf_t.root(i))] += 1", "+for i in range(n):" ]
false
0.039688
0.039937
0.993776
[ "s376672268", "s186438687" ]
u533039576
p02727
python
s642337731
s153361468
476
237
110,120
23,328
Accepted
Accepted
50.21
from heapq import heappush, heappop, heapify x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) # print(p) # print(q) # print(r) ar = p...
x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r += p[:x] r += q[:y] r.sort(reverse=True) ans = sum(r[:x + y]) print(ans)
41
14
890
283
from heapq import heappush, heappop, heapify x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) # print(p) # print(q) # print(r) ar = p[:x] ag = q[:y] ...
x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r += p[:x] r += q[:y] r.sort(reverse=True) ans = sum(r[: x + y]) print(ans)
false
65.853659
[ "-from heapq import heappush, heappop, heapify", "-", "+r += p[:x]", "+r += q[:y]", "-# print(p)", "-# print(q)", "-# print(r)", "-ar = p[:x]", "-ag = q[:y]", "-heapify(ar)", "-heapify(ag)", "-for i in range(c):", "- if r[i] > ar[0] and r[i] > ag[0]:", "- if ar[0] < ag[0]:", "-...
false
0.10147
0.044661
2.271974
[ "s642337731", "s153361468" ]
u329455846
p02922
python
s524982253
s580220479
20
17
2,940
3,060
Accepted
Accepted
15
A,B = list(map(int,input().split())) start = 1 for i in range(20): if start >= B: print(i) break start += A - 1
import sys sys.setrecursionlimit(10**6) A,B = list(map(int,input().split())) cnt = 0 tmp = A while True: cnt += 1 if tmp >= B: break else: tmp += (A - 1) if B ==1: print((0)) else: print(cnt)
8
16
138
236
A, B = list(map(int, input().split())) start = 1 for i in range(20): if start >= B: print(i) break start += A - 1
import sys sys.setrecursionlimit(10**6) A, B = list(map(int, input().split())) cnt = 0 tmp = A while True: cnt += 1 if tmp >= B: break else: tmp += A - 1 if B == 1: print((0)) else: print(cnt)
false
50
[ "+import sys", "+", "+sys.setrecursionlimit(10**6)", "-start = 1", "-for i in range(20):", "- if start >= B:", "- print(i)", "+cnt = 0", "+tmp = A", "+while True:", "+ cnt += 1", "+ if tmp >= B:", "- start += A - 1", "+ else:", "+ tmp += A - 1", "+if B == 1...
false
0.055634
0.100558
0.55325
[ "s524982253", "s580220479" ]
u077291787
p04034
python
s004923753
s951117957
356
192
18,848
18,856
Accepted
Accepted
46.07
# AGC002B - Box and Ball def main(): N, M = tuple(map(int, input().split())) X = tuple(tuple(map(int, input().split())) for _ in range(M)) R = [0] * (N + 1) # red ball may be in box i R[1] = 1 C = [1] * (N + 1) # number of balls in box i (count) for x, y in X: if R[x]: ...
# AGC002B - Box and Ball import sys input = sys.stdin.readline def main(): N, M = tuple(map(int, input().split())) X = tuple(tuple(map(int, input().split())) for _ in range(M)) R = [0] * (N + 1) # red ball may be in box i R[1] = 1 C = [1] * (N + 1) # number of balls in box i (count) ...
20
23
498
540
# AGC002B - Box and Ball def main(): N, M = tuple(map(int, input().split())) X = tuple(tuple(map(int, input().split())) for _ in range(M)) R = [0] * (N + 1) # red ball may be in box i R[1] = 1 C = [1] * (N + 1) # number of balls in box i (count) for x, y in X: if R[x]: R[y]...
# AGC002B - Box and Ball import sys input = sys.stdin.readline def main(): N, M = tuple(map(int, input().split())) X = tuple(tuple(map(int, input().split())) for _ in range(M)) R = [0] * (N + 1) # red ball may be in box i R[1] = 1 C = [1] * (N + 1) # number of balls in box i (count) for x, ...
false
13.043478
[ "+import sys", "+", "+input = sys.stdin.readline", "+", "+" ]
false
0.038464
0.058831
0.653802
[ "s004923753", "s951117957" ]