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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u200887663 | p02780 | python | s820654849 | s703907988 | 224 | 172 | 25,060 | 24,812 | Accepted | Accepted | 23.21 | n,k=list(map(int,input().split()))
pl=list(map(int,input().split()))
cuml=[]
cum=0
for i in range(n):
cum+=(pl[i]+1)/2
cuml.append(cum)
mx=0
for i in range(n-(k-1)):
if i==0:
mx=max(cuml[i+k-1],mx)
else:
mx=max(cuml[i+k-1]-cuml[i-1],mx)
print(('{:.9f}'.format(mx)))
| #n=int(input())
n,k=list(map(int,input().split()))
pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
expl=[0.0]
ansl=[]
cum=0
for i in range(n):
cum+=(1+pl[i])/2
expl.append(cum)
for i in range(n-k+1):
ansl.append(expl[i+k]-expl[i])
print(('{:.9f}'.for... | 15 | 16 | 305 | 328 | n, k = list(map(int, input().split()))
pl = list(map(int, input().split()))
cuml = []
cum = 0
for i in range(n):
cum += (pl[i] + 1) / 2
cuml.append(cum)
mx = 0
for i in range(n - (k - 1)):
if i == 0:
mx = max(cuml[i + k - 1], mx)
else:
mx = max(cuml[i + k - 1] - cuml[i - 1], mx)
print(("... | # n=int(input())
n, k = list(map(int, input().split()))
pl = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
expl = [0.0]
ansl = []
cum = 0
for i in range(n):
cum += (1 + pl[i]) / 2
expl.append(cum)
for i in range(n - k + 1):
ansl.append(expl[i + k] - expl[i])
print(("... | false | 6.25 | [
"+# n=int(input())",
"-cuml = []",
"+# l=[list(map(int,input().split())) for i in range(n)]",
"+expl = [0.0]",
"+ansl = []",
"- cum += (pl[i] + 1) / 2",
"- cuml.append(cum)",
"-mx = 0",
"-for i in range(n - (k - 1)):",
"- if i == 0:",
"- mx = max(cuml[i + k - 1], mx)",
"- el... | false | 0.04224 | 0.036434 | 1.15936 | [
"s820654849",
"s703907988"
] |
u188827677 | p02779 | python | s975771588 | s316240555 | 263 | 80 | 26,808 | 32,692 | Accepted | Accepted | 69.58 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(set(a))
if sorted(a) == sorted(b):
print('YES')
else:
print('NO') | n = int(eval(input()))
a = list(input().split())
b = list(set(a))
if len(a) == len(b):
print('YES')
else:
print('NO') | 9 | 8 | 141 | 123 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(set(a))
if sorted(a) == sorted(b):
print("YES")
else:
print("NO")
| n = int(eval(input()))
a = list(input().split())
b = list(set(a))
if len(a) == len(b):
print("YES")
else:
print("NO")
| false | 11.111111 | [
"-a = list(map(int, input().split()))",
"+a = list(input().split())",
"-if sorted(a) == sorted(b):",
"+if len(a) == len(b):"
] | false | 0.043331 | 0.077147 | 0.561663 | [
"s975771588",
"s316240555"
] |
u062484507 | p03013 | python | s717029191 | s523821020 | 96 | 85 | 18,932 | 18,352 | Accepted | Accepted | 11.46 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7
n, m = list(map(int, readline().split()))
a = list(map(int, read().split()))
dp = [0] * (n + 1)
ok = [1] * (n + 1)
for i in a:
ok[i] = 0
dp[0] = 1
dp[1] = 1 * ok[1]
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7
n, m = list(map(int, readline().split()))
a = list(map(int, read().split()))
dp = [0] * (n + 1)
ng = [0] * (n + 1)
for i in a:
ng[i] = 1
dp[0] = 1
if ng[1] != 1:
... | 28 | 33 | 548 | 646 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
n, m = list(map(int, readline().split()))
a = list(map(int, read().split()))
dp = [0] * (n + 1)
ok = [1] * (n + 1)
for i in a:
ok[i] = 0
dp[0] = 1
dp[1] = 1 * ok[1]
for i in range(2, ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
n, m = list(map(int, readline().split()))
a = list(map(int, read().split()))
dp = [0] * (n + 1)
ng = [0] * (n + 1)
for i in a:
ng[i] = 1
dp[0] = 1
if ng[1] != 1:
dp[1] = 1
for i i... | false | 15.151515 | [
"-ok = [1] * (n + 1)",
"+ng = [0] * (n + 1)",
"- ok[i] = 0",
"+ ng[i] = 1",
"-dp[1] = 1 * ok[1]",
"+if ng[1] != 1:",
"+ dp[1] = 1",
"- if ok[i - 1] == 0 and ok[i - 2] == 0:",
"+ if ng[i - 1] == 1 and ng[i - 2] == 1:",
"+ elif ng[i - 1] == 1:",
"+ dp[i] = dp[i - 2]",
"+... | false | 0.168819 | 0.042133 | 4.006841 | [
"s717029191",
"s523821020"
] |
u375616706 | p03733 | python | s846619780 | s582336360 | 151 | 135 | 25,200 | 26,836 | Accepted | Accepted | 10.6 | N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = 0
for i in range(1, N):
if t[i]-t[i-1] <= T:
ans += t[i]-t[i-1]
else:
ans += T
print((ans+T))
| N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
print((T+sum(min(T, t[i]-t[i-1]) for i in range(1, N))))
| 11 | 3 | 203 | 126 | N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = 0
for i in range(1, N):
if t[i] - t[i - 1] <= T:
ans += t[i] - t[i - 1]
else:
ans += T
print((ans + T))
| N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
print((T + sum(min(T, t[i] - t[i - 1]) for i in range(1, N))))
| false | 72.727273 | [
"-ans = 0",
"-for i in range(1, N):",
"- if t[i] - t[i - 1] <= T:",
"- ans += t[i] - t[i - 1]",
"- else:",
"- ans += T",
"-print((ans + T))",
"+print((T + sum(min(T, t[i] - t[i - 1]) for i in range(1, N))))"
] | false | 0.045596 | 0.041532 | 1.097839 | [
"s846619780",
"s582336360"
] |
u774160580 | p03805 | python | s606389491 | s971034571 | 33 | 30 | 3,064 | 3,064 | Accepted | Accepted | 9.09 | import itertools as it
N, M = list(map(int, input().split()))
graph = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
graph[a].append(b)
graph[b].append(a)
ans = 0
for path in it.permutations(list(range(N))):
if path[0] != 0:
... | import itertools as it
N, M = list(map(int, input().split()))
graph = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
graph[a].append(b)
graph[b].append(a)
ans = 0
for path in it.permutations(list(range(N))):
if path[0] != 0:
... | 21 | 21 | 545 | 542 | import itertools as it
N, M = list(map(int, input().split()))
graph = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
graph[a].append(b)
graph[b].append(a)
ans = 0
for path in it.permutations(list(range(N))):
if path[0] != 0:
continue
... | import itertools as it
N, M = list(map(int, input().split()))
graph = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
graph[a].append(b)
graph[b].append(a)
ans = 0
for path in it.permutations(list(range(N))):
if path[0] != 0:
break
is... | false | 0 | [
"- continue",
"+ break"
] | false | 0.154226 | 0.007329 | 21.043367 | [
"s606389491",
"s971034571"
] |
u011634450 | p03069 | python | s526916020 | s737724629 | 94 | 51 | 3,624 | 11,136 | Accepted | Accepted | 45.74 | def C(N, S):
cand = "#" * N
n_diff_chars = sum(a!=b for a, b in zip(cand, S))
min_n_diff_chars = n_diff_chars
for c in S:
if c == ".":
n_diff_chars -= 1
else:
n_diff_chars += 1
min_n_diff_chars = min(min_n_diff_chars, n_diff_chars)
print(min_... | def C(N, S):
n_diff_chars = S.count(".")
cand_list = [n_diff_chars]
for c in S:
if c == ".":
n_diff_chars -= 1
else:
n_diff_chars += 1
cand_list.append(n_diff_chars)
print((min(cand_list)))
if __name__ == "__main__":
N = int(eval(input()... | 17 | 16 | 417 | 344 | def C(N, S):
cand = "#" * N
n_diff_chars = sum(a != b for a, b in zip(cand, S))
min_n_diff_chars = n_diff_chars
for c in S:
if c == ".":
n_diff_chars -= 1
else:
n_diff_chars += 1
min_n_diff_chars = min(min_n_diff_chars, n_diff_chars)
print(min_n_diff_c... | def C(N, S):
n_diff_chars = S.count(".")
cand_list = [n_diff_chars]
for c in S:
if c == ".":
n_diff_chars -= 1
else:
n_diff_chars += 1
cand_list.append(n_diff_chars)
print((min(cand_list)))
if __name__ == "__main__":
N = int(eval(input()))
S = ev... | false | 5.882353 | [
"- cand = \"#\" * N",
"- n_diff_chars = sum(a != b for a, b in zip(cand, S))",
"- min_n_diff_chars = n_diff_chars",
"+ n_diff_chars = S.count(\".\")",
"+ cand_list = [n_diff_chars]",
"- min_n_diff_chars = min(min_n_diff_chars, n_diff_chars)",
"- print(min_n_diff_chars)",
"+ ... | false | 0.033199 | 0.031459 | 1.055308 | [
"s526916020",
"s737724629"
] |
u102461423 | p03053 | python | s817866212 | s998340422 | 980 | 239 | 105,976 | 20,256 | Accepted | Accepted | 75.61 | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
H,W = list(map(int,input().split()))
INF = 10**18
q = []
visited = [[True]*(W+2)]
visited += [[True] + [x == '#' for x in input().rstrip()] + [True] for _ in range(H)]
visited.append([True]*(W+2))
for i in range(1,H+1):
for j in rang... | import numpy as np
import sys
# 距離K以内にxが居ない
# xからの距離を測る
buf = sys.stdin.buffer
R,C = list(map(int,buf.readline().split()))
black = np.zeros((R+2,C+2),dtype=np.bool)
black[1:-1,1:] = (np.frombuffer(buf.read(R*(C+1)),dtype='S1') == b'#').reshape(R,C+1)
INF = 10 ** 9
dist = np.zeros((R,C),dtype=np.int32)
dis... | 39 | 26 | 836 | 683 | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
H, W = list(map(int, input().split()))
INF = 10**18
q = []
visited = [[True] * (W + 2)]
visited += [[True] + [x == "#" for x in input().rstrip()] + [True] for _ in range(H)]
visited.append([True] * (W + 2))
for i in range(1, H + 1):
for j in range(... | import numpy as np
import sys
# 距離K以内にxが居ない
# xからの距離を測る
buf = sys.stdin.buffer
R, C = list(map(int, buf.readline().split()))
black = np.zeros((R + 2, C + 2), dtype=np.bool)
black[1:-1, 1:] = (np.frombuffer(buf.read(R * (C + 1)), dtype="S1") == b"#").reshape(
R, C + 1
)
INF = 10**9
dist = np.zeros((R, C), dtype=np.... | false | 33.333333 | [
"+import numpy as np",
"-sys.setrecursionlimit(10**6)",
"-input = sys.stdin.readline",
"-H, W = list(map(int, input().split()))",
"-INF = 10**18",
"-q = []",
"-visited = [[True] * (W + 2)]",
"-visited += [[True] + [x == \"#\" for x in input().rstrip()] + [True] for _ in range(H)]",
"-visited.append(... | false | 0.038041 | 0.43517 | 0.087417 | [
"s817866212",
"s998340422"
] |
u038021590 | p03165 | python | s682286850 | s820584475 | 992 | 328 | 405,896 | 144,656 | Accepted | Accepted | 66.94 | from collections import deque
s = eval(input())
t = eval(input())
ls = len(s)
lt = len(t)
DP_len = [[0] * (lt + 1) for i in range(ls + 1)]
Prev =[[0] * (lt + 1) for i in range(ls + 1)]
for i in range(1, ls + 1):
for j in range(1, lt + 1):
if s[i - 1] == t[j - 1]:
if max(DP_len[i - 1]... | S = eval(input())
T = eval(input())
ls = len(S)
lt = len(T)
DP = [[0] * (lt + 1) for _ in range(ls + 1)]
Ans = []
for i, s in enumerate(S, 1):
for j, t in enumerate(T, 1):
if s == t:
DP[i][j] = DP[i - 1][j - 1] + 1
else:
DP[i][j] = max(DP[i - 1][j], DP[i][j - 1])... | 42 | 25 | 1,244 | 574 | from collections import deque
s = eval(input())
t = eval(input())
ls = len(s)
lt = len(t)
DP_len = [[0] * (lt + 1) for i in range(ls + 1)]
Prev = [[0] * (lt + 1) for i in range(ls + 1)]
for i in range(1, ls + 1):
for j in range(1, lt + 1):
if s[i - 1] == t[j - 1]:
if (
max(DP_le... | S = eval(input())
T = eval(input())
ls = len(S)
lt = len(T)
DP = [[0] * (lt + 1) for _ in range(ls + 1)]
Ans = []
for i, s in enumerate(S, 1):
for j, t in enumerate(T, 1):
if s == t:
DP[i][j] = DP[i - 1][j - 1] + 1
else:
DP[i][j] = max(DP[i - 1][j], DP[i][j - 1])
cnts = ls
cn... | false | 40.47619 | [
"-from collections import deque",
"-",
"-s = eval(input())",
"-t = eval(input())",
"-ls = len(s)",
"-lt = len(t)",
"-DP_len = [[0] * (lt + 1) for i in range(ls + 1)]",
"-Prev = [[0] * (lt + 1) for i in range(ls + 1)]",
"-for i in range(1, ls + 1):",
"- for j in range(1, lt + 1):",
"- i... | false | 0.060887 | 0.087081 | 0.699203 | [
"s682286850",
"s820584475"
] |
u131984977 | p02392 | python | s163637605 | s421725295 | 40 | 30 | 6,724 | 6,724 | Accepted | Accepted | 25 | x = input().split(' ')
a = int(x[0])
b = int(x[1])
c = int(x[2])
if a < b < c:
print('Yes')
else:
print('No') | (a, b, c) = input().rstrip().split()
a = int(a)
b = int(b)
c = int(c)
if a < b < c:
print('Yes')
else:
print('No') | 9 | 9 | 126 | 131 | x = input().split(" ")
a = int(x[0])
b = int(x[1])
c = int(x[2])
if a < b < c:
print("Yes")
else:
print("No")
| (a, b, c) = input().rstrip().split()
a = int(a)
b = int(b)
c = int(c)
if a < b < c:
print("Yes")
else:
print("No")
| false | 0 | [
"-x = input().split(\" \")",
"-a = int(x[0])",
"-b = int(x[1])",
"-c = int(x[2])",
"+(a, b, c) = input().rstrip().split()",
"+a = int(a)",
"+b = int(b)",
"+c = int(c)"
] | false | 0.046463 | 0.042875 | 1.083683 | [
"s163637605",
"s421725295"
] |
u361381049 | p02848 | python | s995767506 | s689053233 | 24 | 21 | 3,188 | 3,188 | Accepted | Accepted | 12.5 | n = int(eval(input()))
s = list(eval(input()))
a = []
for i in range(len(s)):
b = ord(s[i])
b -= 65
b += n
b = b % 26
b += 65
b = chr(b)
a.append(b)
a= ''.join(a)
print(a) | n = int(eval(input()))
s = list(eval(input()))
a = []
for i in range(len(s)):
b = chr((ord(s[i]) -65 + n) % 26 + 65)
a.append(b)
a= ''.join(a)
print(a) | 18 | 9 | 200 | 154 | n = int(eval(input()))
s = list(eval(input()))
a = []
for i in range(len(s)):
b = ord(s[i])
b -= 65
b += n
b = b % 26
b += 65
b = chr(b)
a.append(b)
a = "".join(a)
print(a)
| n = int(eval(input()))
s = list(eval(input()))
a = []
for i in range(len(s)):
b = chr((ord(s[i]) - 65 + n) % 26 + 65)
a.append(b)
a = "".join(a)
print(a)
| false | 50 | [
"- b = ord(s[i])",
"- b -= 65",
"- b += n",
"- b = b % 26",
"- b += 65",
"- b = chr(b)",
"+ b = chr((ord(s[i]) - 65 + n) % 26 + 65)"
] | false | 0.044846 | 0.044193 | 1.014777 | [
"s995767506",
"s689053233"
] |
u073852194 | p03078 | python | s642659489 | s474110949 | 396 | 302 | 58,588 | 52,188 | Accepted | Accepted | 23.74 | import heapq
import collections
x,y,z,k = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
heap = []
heapq.heapify(heap)
heapq.heappush(heap,(-(A[0]+B[0]... | from heapq import heappop, heappush, heapify
X, Y, Z, K = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
heap = list()
used = set()
res = list()
heap... | 34 | 32 | 1,030 | 940 | import heapq
import collections
x, y, z, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
heap = []
heapq.heapify(heap)
heapq.heappush(heap, (-(A[0] + B[0] + C[0... | from heapq import heappop, heappush, heapify
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
heap = list()
used = set()
res = list()
heappush(heap, (-(... | false | 5.882353 | [
"-import heapq",
"-import collections",
"+from heapq import heappop, heappush, heapify",
"-x, y, z, k = list(map(int, input().split()))",
"+X, Y, Z, K = list(map(int, input().split()))",
"-heap = []",
"-heapq.heapify(heap)",
"-heapq.heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0))",
"-dictionary = c... | false | 0.036606 | 0.04611 | 0.793871 | [
"s642659489",
"s474110949"
] |
u921615009 | p03262 | python | s215628278 | s915334603 | 462 | 131 | 23,132 | 14,748 | Accepted | Accepted | 71.65 | from functools import reduce
import numpy as np
def gcd(a, b):
if b > 0:
return gcd(b, a%b)
else:
return a
def gcd_list(arg_list):
return reduce(gcd, arg_list)
N, X = tuple(map(int, input().split(" ")))
Xs = [X] + list(map(int, input().split(" ")))
Xs = list(map(abs, np.diff... | from functools import *
N, X = list(map(int, input().split(" ")))
xs = list(map(int, input().split(" ")))
xs = list([X-x if X>x else x-X for x in xs])
def gcd(a, b):
if b == 0:
return a
return gcd(b, a%b)
r = reduce(gcd, xs)
print(r)
| 17 | 10 | 349 | 265 | from functools import reduce
import numpy as np
def gcd(a, b):
if b > 0:
return gcd(b, a % b)
else:
return a
def gcd_list(arg_list):
return reduce(gcd, arg_list)
N, X = tuple(map(int, input().split(" ")))
Xs = [X] + list(map(int, input().split(" ")))
Xs = list(map(abs, np.diff(Xs)))
r ... | from functools import *
N, X = list(map(int, input().split(" ")))
xs = list(map(int, input().split(" ")))
xs = list([X - x if X > x else x - X for x in xs])
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
r = reduce(gcd, xs)
print(r)
| false | 41.176471 | [
"-from functools import reduce",
"-import numpy as np",
"+from functools import *",
"+",
"+N, X = list(map(int, input().split(\" \")))",
"+xs = list(map(int, input().split(\" \")))",
"+xs = list([X - x if X > x else x - X for x in xs])",
"- if b > 0:",
"- return gcd(b, a % b)",
"- els... | false | 0.199841 | 0.066273 | 3.015416 | [
"s215628278",
"s915334603"
] |
u072053884 | p02417 | python | s464910903 | s560349443 | 70 | 30 | 7,916 | 7,980 | Accepted | Accepted | 57.14 | import string
import sys
input_str = ""
for i in sys.stdin:
input_str += i
for i in range(26):
char = string.ascii_lowercase[i]
CHAR = string.ascii_uppercase[i]
cnt = input_str.count(char) + input_str.count(CHAR)
print(("{0} : {1}".format(char, cnt))) | import string
import sys
input_str = sys.stdin.read()
for i in range(26):
char = string.ascii_lowercase[i]
CHAR = string.ascii_uppercase[i]
cnt = input_str.count(char) + input_str.count(CHAR)
print(("{0} : {1}".format(char, cnt))) | 13 | 10 | 284 | 255 | import string
import sys
input_str = ""
for i in sys.stdin:
input_str += i
for i in range(26):
char = string.ascii_lowercase[i]
CHAR = string.ascii_uppercase[i]
cnt = input_str.count(char) + input_str.count(CHAR)
print(("{0} : {1}".format(char, cnt)))
| import string
import sys
input_str = sys.stdin.read()
for i in range(26):
char = string.ascii_lowercase[i]
CHAR = string.ascii_uppercase[i]
cnt = input_str.count(char) + input_str.count(CHAR)
print(("{0} : {1}".format(char, cnt)))
| false | 23.076923 | [
"-input_str = \"\"",
"-for i in sys.stdin:",
"- input_str += i",
"+input_str = sys.stdin.read()"
] | false | 0.042555 | 0.043664 | 0.974599 | [
"s464910903",
"s560349443"
] |
u754022296 | p03627 | python | s088066984 | s356582107 | 100 | 72 | 18,600 | 22,132 | Accepted | Accepted | 28 | from collections import defaultdict
n = int(eval(input()))
A = list(map(int, input().split()))
d = defaultdict(int)
l = []
for key in A:
d[key] += 1
if d[key] == 2:
l.append(key)
d[key] = 0
if len(l) < 2:
print((0))
else:
l.sort(reverse=True)
print((l[0]*l[1])) | from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
C = Counter(A)
L = []
for k, v in list(C.items()):
if v >= 2:
L.append(k)
if v >= 4:
L.append(k)
if len(L) < 2:
print((0))
else:
L.sort()
ans = L[-1] * L[-2]
print(ans) | 16 | 17 | 285 | 282 | from collections import defaultdict
n = int(eval(input()))
A = list(map(int, input().split()))
d = defaultdict(int)
l = []
for key in A:
d[key] += 1
if d[key] == 2:
l.append(key)
d[key] = 0
if len(l) < 2:
print((0))
else:
l.sort(reverse=True)
print((l[0] * l[1]))
| from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
C = Counter(A)
L = []
for k, v in list(C.items()):
if v >= 2:
L.append(k)
if v >= 4:
L.append(k)
if len(L) < 2:
print((0))
else:
L.sort()
ans = L[-1] * L[-2]
print(ans)
| false | 5.882353 | [
"-from collections import defaultdict",
"+from collections import Counter",
"-d = defaultdict(int)",
"-l = []",
"-for key in A:",
"- d[key] += 1",
"- if d[key] == 2:",
"- l.append(key)",
"- d[key] = 0",
"-if len(l) < 2:",
"+C = Counter(A)",
"+L = []",
"+for k, v in list(C... | false | 0.046692 | 0.045454 | 1.027239 | [
"s088066984",
"s356582107"
] |
u238667145 | p02388 | python | s329469583 | s776315486 | 30 | 20 | 6,724 | 7,792 | Accepted | Accepted | 33.33 | x = int(eval(input()))
print((x*x*x)) | import math
print((int(math.pow(int(eval(input())), 3)))) | 2 | 3 | 30 | 52 | x = int(eval(input()))
print((x * x * x))
| import math
print((int(math.pow(int(eval(input())), 3))))
| false | 33.333333 | [
"-x = int(eval(input()))",
"-print((x * x * x))",
"+import math",
"+",
"+print((int(math.pow(int(eval(input())), 3))))"
] | false | 0.037797 | 0.042111 | 0.897571 | [
"s329469583",
"s776315486"
] |
u571128069 | p03062 | python | s407379969 | s987496393 | 101 | 79 | 11,668 | 11,212 | Accepted | Accepted | 21.78 | from itertools import *
N = int(eval(input()))
An = list(map(int, input().split()))
total = 0
minim = 1000000000
num_negs = 0
for a in An:
if a < 0:
num_negs += 1
a *= -1
pass
total += a
minim = min(minim, a)
pass
if num_negs % 2:
print((total - 2*minim... |
N = int(eval(input()))
An = list(map(int, input().split()))
total = 0
minim = 1000000000
num_negs = 0
for a in An:
if a < 0:
num_negs += 1
a *= -1
pass
total += a
minim = minim if minim < a else a
pass
if num_negs % 2:
print((total - 2*minim))
else:
... | 23 | 22 | 344 | 331 | from itertools import *
N = int(eval(input()))
An = list(map(int, input().split()))
total = 0
minim = 1000000000
num_negs = 0
for a in An:
if a < 0:
num_negs += 1
a *= -1
pass
total += a
minim = min(minim, a)
pass
if num_negs % 2:
print((total - 2 * minim))
else:
print(t... | N = int(eval(input()))
An = list(map(int, input().split()))
total = 0
minim = 1000000000
num_negs = 0
for a in An:
if a < 0:
num_negs += 1
a *= -1
pass
total += a
minim = minim if minim < a else a
pass
if num_negs % 2:
print((total - 2 * minim))
else:
print(total)
pas... | false | 4.347826 | [
"-from itertools import *",
"-",
"- minim = min(minim, a)",
"+ minim = minim if minim < a else a"
] | false | 0.045133 | 0.04454 | 1.013323 | [
"s407379969",
"s987496393"
] |
u584658281 | p02707 | python | s531841195 | s238813596 | 220 | 146 | 36,148 | 32,260 | Accepted | Accepted | 33.64 | N = int(eval(input()))
A = list(map(int,input().split()))
from collections import defaultdict
d = defaultdict(int)
for ai in A:
d[ai] += 1
for n in range(1,N+1):
print((d[n])) | N=int(eval(input()))
A=list(map(int,input().split()))
c = [0]*(N+1)
for ai in A:
c[ai] +=1
for i in c[1:]:
print(i) | 11 | 8 | 184 | 123 | N = int(eval(input()))
A = list(map(int, input().split()))
from collections import defaultdict
d = defaultdict(int)
for ai in A:
d[ai] += 1
for n in range(1, N + 1):
print((d[n]))
| N = int(eval(input()))
A = list(map(int, input().split()))
c = [0] * (N + 1)
for ai in A:
c[ai] += 1
for i in c[1:]:
print(i)
| false | 27.272727 | [
"-from collections import defaultdict",
"-",
"-d = defaultdict(int)",
"+c = [0] * (N + 1)",
"- d[ai] += 1",
"-for n in range(1, N + 1):",
"- print((d[n]))",
"+ c[ai] += 1",
"+for i in c[1:]:",
"+ print(i)"
] | false | 0.034286 | 0.035202 | 0.973982 | [
"s531841195",
"s238813596"
] |
u414980766 | p02887 | python | s596840388 | s125839960 | 69 | 42 | 3,316 | 3,316 | Accepted | Accepted | 39.13 | N = int(eval(input()))
S = eval(input())
res = 0
i = 0
while i < N:
j = 1
while i + j < N and S[i] == S[i + j]:
j += 1
i += j
res += 1
print(res) | N = int(eval(input()))
S = eval(input())
res = 1
a = S[0]
for i in range(N):
if a != S[i]:
res += 1
a = S[i]
print(res) | 12 | 10 | 169 | 137 | N = int(eval(input()))
S = eval(input())
res = 0
i = 0
while i < N:
j = 1
while i + j < N and S[i] == S[i + j]:
j += 1
i += j
res += 1
print(res)
| N = int(eval(input()))
S = eval(input())
res = 1
a = S[0]
for i in range(N):
if a != S[i]:
res += 1
a = S[i]
print(res)
| false | 16.666667 | [
"-res = 0",
"-i = 0",
"-while i < N:",
"- j = 1",
"- while i + j < N and S[i] == S[i + j]:",
"- j += 1",
"- i += j",
"- res += 1",
"+res = 1",
"+a = S[0]",
"+for i in range(N):",
"+ if a != S[i]:",
"+ res += 1",
"+ a = S[i]"
] | false | 0.032347 | 0.040966 | 0.789598 | [
"s596840388",
"s125839960"
] |
u596276291 | p03550 | python | s375852860 | s615853056 | 736 | 27 | 48,728 | 4,080 | Accepted | Accepted | 96.33 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.se... | 63 | 33 | 1,337 | 844 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")
impor... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecurs... | false | 47.619048 | [
"-",
"-INF = float(\"inf\")",
"-a = []",
"-memo = []",
"-# 相手がi番目を引いたときにだせる最大/最小のスコア",
"-def dfs(turn, i):",
"- global memo, a",
"- if memo[turn][i] != -1:",
"- return memo[turn][i]",
"- ans = 0 if turn == 0 else INF",
"- for j in range(i + 1, len(a)):",
"- if j == le... | false | 0.077276 | 0.036099 | 2.14069 | [
"s375852860",
"s615853056"
] |
u389910364 | p03483 | python | s964231920 | s490175381 | 893 | 292 | 10,016 | 62,136 | Accepted | Accepted | 67.3 | import os
import sys
from collections import Counter
class BinaryIndexedTree:
# http://hos.ac/slides/20140319_bit.pdf
def __init__(self, size):
"""
:param int size:
"""
self._bit = [0] * size
self._size = size
def add(self, i, w):
"""
... | import os
import sys
from collections import Counter
class BinaryIndexedTree:
# http://hos.ac/slides/20140319_bit.pdf
def __init__(self, size):
"""
:param int size:
"""
self._bit = [0] * size
self._size = size
def add(self, i, w):
"""
... | 116 | 117 | 2,405 | 2,458 | import os
import sys
from collections import Counter
class BinaryIndexedTree:
# http://hos.ac/slides/20140319_bit.pdf
def __init__(self, size):
"""
:param int size:
"""
self._bit = [0] * size
self._size = size
def add(self, i, w):
"""
i 番目に w を加える
... | import os
import sys
from collections import Counter
class BinaryIndexedTree:
# http://hos.ac/slides/20140319_bit.pdf
def __init__(self, size):
"""
:param int size:
"""
self._bit = [0] * size
self._size = size
def add(self, i, w):
"""
i 番目に w を加える
... | false | 0.854701 | [
"+# PyPy だと文字列結合がめちゃくちゃ遅いっぽい",
"-ls = \"\"",
"-mid = \"\"",
"-rs = \"\"",
"+ls = []",
"+mid = []",
"+rs = []",
"- ls += c",
"+ ls.append(c)",
"- mid += c",
"+ mid.append(c)",
"- rs += c",
"+ rs.append(c)",
"- ls +... | false | 0.037327 | 0.046596 | 0.801063 | [
"s964231920",
"s490175381"
] |
u562935282 | p02861 | python | s356096165 | s051624200 | 377 | 294 | 3,188 | 3,572 | Accepted | Accepted | 22.02 | from itertools import permutations
n = int(eval(input()))
*ps, = (tuple(map(int, input().split())) for _ in range(n))
ret = 0
for perm in permutations(ps):
it = iter(perm)
p = next(it)
for q in it:
ret += ((p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2) ** 0.5
p = q
def fact(n):
... | def main():
from collections import namedtuple
from itertools import permutations
from math import factorial
City = namedtuple('City', 'x y')
def dist(a: City, b: City) -> float:
dx = a.x - b.x
dy = a.y - b.y
return (dx * dx + dy * dy) ** 0.5
N = int(eval(i... | 22 | 44 | 400 | 887 | from itertools import permutations
n = int(eval(input()))
(*ps,) = (tuple(map(int, input().split())) for _ in range(n))
ret = 0
for perm in permutations(ps):
it = iter(perm)
p = next(it)
for q in it:
ret += ((p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2) ** 0.5
p = q
def fact(n):
if n == 0:... | def main():
from collections import namedtuple
from itertools import permutations
from math import factorial
City = namedtuple("City", "x y")
def dist(a: City, b: City) -> float:
dx = a.x - b.x
dy = a.y - b.y
return (dx * dx + dy * dy) ** 0.5
N = int(eval(input()))
... | false | 50 | [
"-from itertools import permutations",
"+def main():",
"+ from collections import namedtuple",
"+ from itertools import permutations",
"+ from math import factorial",
"-n = int(eval(input()))",
"-(*ps,) = (tuple(map(int, input().split())) for _ in range(n))",
"-ret = 0",
"-for perm in permu... | false | 0.088203 | 0.07196 | 1.225715 | [
"s356096165",
"s051624200"
] |
u163783894 | p02659 | python | s780795528 | s084777755 | 24 | 20 | 10,072 | 9,172 | Accepted | Accepted | 16.67 | import sys
import decimal
input = lambda: sys.stdin.readline().rstrip()
def solve():
A, B = input().split()
A = int(A)
B = decimal.Decimal(B)
print((int(A * B)))
if __name__ == '__main__':
solve()
| import sys
input = lambda: sys.stdin.readline().rstrip()
def solve():
A, B = input().split()
A = int(A)
B = B.replace('.', '')
B = int(B)
ans = (A * B) // 100
print(ans)
if __name__ == '__main__':
solve()
| 14 | 17 | 232 | 255 | import sys
import decimal
input = lambda: sys.stdin.readline().rstrip()
def solve():
A, B = input().split()
A = int(A)
B = decimal.Decimal(B)
print((int(A * B)))
if __name__ == "__main__":
solve()
| import sys
input = lambda: sys.stdin.readline().rstrip()
def solve():
A, B = input().split()
A = int(A)
B = B.replace(".", "")
B = int(B)
ans = (A * B) // 100
print(ans)
if __name__ == "__main__":
solve()
| false | 17.647059 | [
"-import decimal",
"- B = decimal.Decimal(B)",
"- print((int(A * B)))",
"+ B = B.replace(\".\", \"\")",
"+ B = int(B)",
"+ ans = (A * B) // 100",
"+ print(ans)"
] | false | 0.047969 | 0.047191 | 1.016496 | [
"s780795528",
"s084777755"
] |
u852690916 | p03411 | python | s719660241 | s939431208 | 172 | 68 | 39,024 | 67,792 | Accepted | Accepted | 60.47 | N=int(eval(input()))
RED=[tuple(map(int, input().split())) for _ in range(N)]
BLUE=[tuple(map(int, input().split())) for _ in range(N)]
RED.sort(key=lambda x:x[1], reverse=True)
BLUE.sort(key=lambda x:x[0])
ans=0
r_used=[False]*N
for b in BLUE:
for j,r in enumerate(RED):
if r_used[j]: continue
... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, AB, CD):
ans = 0
AB.sort(key=lambda x: x[0], reverse=True)
for a, b in AB:
CD.sort(key=lambda x: x[1])
idx = 0
while idx < len(CD):
c, d = CD[idx]
if a < c and b < d:
... | 17 | 26 | 429 | 677 | N = int(eval(input()))
RED = [tuple(map(int, input().split())) for _ in range(N)]
BLUE = [tuple(map(int, input().split())) for _ in range(N)]
RED.sort(key=lambda x: x[1], reverse=True)
BLUE.sort(key=lambda x: x[0])
ans = 0
r_used = [False] * N
for b in BLUE:
for j, r in enumerate(RED):
if r_used[j]:
... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, AB, CD):
ans = 0
AB.sort(key=lambda x: x[0], reverse=True)
for a, b in AB:
CD.sort(key=lambda x: x[1])
idx = 0
while idx < len(CD):
c, d = CD[idx]
if a < c and b < d:
break... | false | 34.615385 | [
"-N = int(eval(input()))",
"-RED = [tuple(map(int, input().split())) for _ in range(N)]",
"-BLUE = [tuple(map(int, input().split())) for _ in range(N)]",
"-RED.sort(key=lambda x: x[1], reverse=True)",
"-BLUE.sort(key=lambda x: x[0])",
"-ans = 0",
"-r_used = [False] * N",
"-for b in BLUE:",
"- for... | false | 0.118544 | 0.083809 | 1.414456 | [
"s719660241",
"s939431208"
] |
u726615467 | p02861 | python | s843264967 | s845241893 | 109 | 17 | 8,052 | 3,060 | Accepted | Accepted | 84.4 | N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
import math
dist = [[0] * N for _ in range(N)]
for i in range(N - 1):
xi, yi = xy[i]
for j in range(i + 1, N):
xj, yj = xy[j]
dist[i][j] = math.sqrt((xi - xj) ** 2 + (yi - yj) ** 2)
dist[j][i] = ... | N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
import math
dist_sum = 0
for i in range(N):
xi, yi = xy[i]
for j in range(N):
xj, yj = xy[j]
dist_sum += math.sqrt((xi - xj) ** 2 + (yi - yj) ** 2)
print((dist_sum / N)) | 23 | 13 | 533 | 280 | N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
import math
dist = [[0] * N for _ in range(N)]
for i in range(N - 1):
xi, yi = xy[i]
for j in range(i + 1, N):
xj, yj = xy[j]
dist[i][j] = math.sqrt((xi - xj) ** 2 + (yi - yj) ** 2)
dist[j][i] = dist[i][j]
i... | N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
import math
dist_sum = 0
for i in range(N):
xi, yi = xy[i]
for j in range(N):
xj, yj = xy[j]
dist_sum += math.sqrt((xi - xj) ** 2 + (yi - yj) ** 2)
print((dist_sum / N))
| false | 43.478261 | [
"-dist = [[0] * N for _ in range(N)]",
"-for i in range(N - 1):",
"+dist_sum = 0",
"+for i in range(N):",
"- for j in range(i + 1, N):",
"+ for j in range(N):",
"- dist[i][j] = math.sqrt((xi - xj) ** 2 + (yi - yj) ** 2)",
"- dist[j][i] = dist[i][j]",
"-import itertools",
"-",
... | false | 0.039407 | 0.155815 | 0.25291 | [
"s843264967",
"s845241893"
] |
u606045429 | p02971 | python | s272330540 | s492881630 | 1,161 | 528 | 86,360 | 14,112 | Accepted | Accepted | 54.52 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
# http://tjkendev.github.io/procon-library/python/range_query/rmq_segment_tree.html
# N: 処理する区間の長さ
N0 = 2**(N-1).bit_length()
INF = 2**31-1
data = [0]*(2*N0)
# a_k の値を x に更新
def update(k, x):
k += N0-1
data[k] = x
while k >= 0:... | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
B = sorted(A)
f, s = B[-1], B[-2]
for a in A:
if a == f:
print(s)
else:
print(f) | 44 | 11 | 846 | 170 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
# http://tjkendev.github.io/procon-library/python/range_query/rmq_segment_tree.html
# N: 処理する区間の長さ
N0 = 2 ** (N - 1).bit_length()
INF = 2**31 - 1
data = [0] * (2 * N0)
# a_k の値を x に更新
def update(k, x):
k += N0 - 1
data[k] = x
while k >= 0:
... | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
B = sorted(A)
f, s = B[-1], B[-2]
for a in A:
if a == f:
print(s)
else:
print(f)
| false | 75 | [
"-# http://tjkendev.github.io/procon-library/python/range_query/rmq_segment_tree.html",
"-# N: 処理する区間の長さ",
"-N0 = 2 ** (N - 1).bit_length()",
"-INF = 2**31 - 1",
"-data = [0] * (2 * N0)",
"-# a_k の値を x に更新",
"-def update(k, x):",
"- k += N0 - 1",
"- data[k] = x",
"- while k >= 0:",
"- ... | false | 0.078918 | 0.037085 | 2.128029 | [
"s272330540",
"s492881630"
] |
u264265458 | p03035 | python | s446862327 | s061989976 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | i=list(map(int,input().split()))
if i[0]>=13:
print((i[1]))
elif 6<=i[0]<=12:
print((int(i[1]/2)))
else :
print((0))
| a,b=list(map(int,input().split()))
print((b if a>12 else int(b/2) if 5<a and a<13 else 0)) | 8 | 2 | 125 | 83 | i = list(map(int, input().split()))
if i[0] >= 13:
print((i[1]))
elif 6 <= i[0] <= 12:
print((int(i[1] / 2)))
else:
print((0))
| a, b = list(map(int, input().split()))
print((b if a > 12 else int(b / 2) if 5 < a and a < 13 else 0))
| false | 75 | [
"-i = list(map(int, input().split()))",
"-if i[0] >= 13:",
"- print((i[1]))",
"-elif 6 <= i[0] <= 12:",
"- print((int(i[1] / 2)))",
"-else:",
"- print((0))",
"+a, b = list(map(int, input().split()))",
"+print((b if a > 12 else int(b / 2) if 5 < a and a < 13 else 0))"
] | false | 0.068208 | 0.072253 | 0.94401 | [
"s446862327",
"s061989976"
] |
u480138356 | p02925 | python | s720704118 | s988835928 | 1,812 | 1,359 | 35,064 | 36,992 | Accepted | Accepted | 25 | import time
def main():
N = int(eval(input()))
a = [list(map(int, input().split())) for i in range(N)]
start = time.time()
now = [0] * N
day = 0
gamed_day = [-1] * N
finished = 0
while True:
if time.time() - start > 1.6:
print(((N*(N-1))//2))
b... | def main():
N = int(eval(input()))
a = [list(map(int, input().split())) for i in range(N)]
now = [0] * N
day = 0
gamed_day = [-1] * N
ind = [i for i in range(N)]
while len(ind) > 0:
next_ = []
while len(ind) > 0:
i = ind.pop(-1)
... | 45 | 44 | 1,405 | 1,249 | import time
def main():
N = int(eval(input()))
a = [list(map(int, input().split())) for i in range(N)]
start = time.time()
now = [0] * N
day = 0
gamed_day = [-1] * N
finished = 0
while True:
if time.time() - start > 1.6:
print(((N * (N - 1)) // 2))
break... | def main():
N = int(eval(input()))
a = [list(map(int, input().split())) for i in range(N)]
now = [0] * N
day = 0
gamed_day = [-1] * N
ind = [i for i in range(N)]
while len(ind) > 0:
next_ = []
while len(ind) > 0:
i = ind.pop(-1)
if now[i] < N - 1 and g... | false | 2.222222 | [
"-import time",
"-",
"-",
"- start = time.time()",
"- finished = 0",
"- while True:",
"- if time.time() - start > 1.6:",
"- print(((N * (N - 1)) // 2))",
"- break",
"- had_game = False",
"- all_finish = True",
"- for i in range(N - 1, ... | false | 0.077454 | 0.041519 | 1.865537 | [
"s720704118",
"s988835928"
] |
u312078744 | p03739 | python | s061469772 | s651864437 | 126 | 94 | 14,504 | 14,468 | Accepted | Accepted | 25.4 | n = int(eval(input()))
a = list(map(int, input().split()))
# プラススタート ------------------
ans01 = 0
temp = a[0]
if (temp > 0):
pass
else:
add = abs(temp) + 1
ans01 += add
temp = 1
for i in range(1, n):
tar = temp + a[i]
if (tar * temp < 0):
temp = tar
else:
... | n = int(eval(input()))
a = list(map(int, input().split()))
def calc(val):
# valには、1か−1を入れる。
if (val * a[0] > 0):
# 狙った符号のパターン
temp = a[0]
ans01 = 0
else:
# 違うパターン
add = abs(a[0]) + 1
ans01 = add
temp = val
for i in range(1, n):... | 52 | 36 | 911 | 639 | n = int(eval(input()))
a = list(map(int, input().split()))
# プラススタート ------------------
ans01 = 0
temp = a[0]
if temp > 0:
pass
else:
add = abs(temp) + 1
ans01 += add
temp = 1
for i in range(1, n):
tar = temp + a[i]
if tar * temp < 0:
temp = tar
else:
add = abs(tar) + 1
... | n = int(eval(input()))
a = list(map(int, input().split()))
def calc(val):
# valには、1か−1を入れる。
if val * a[0] > 0:
# 狙った符号のパターン
temp = a[0]
ans01 = 0
else:
# 違うパターン
add = abs(a[0]) + 1
ans01 = add
temp = val
for i in range(1, n):
tar = temp +... | false | 30.769231 | [
"-ans01 = 0",
"-temp = a[0]",
"-if temp > 0:",
"- pass",
"-else:",
"- add = abs(temp) + 1",
"- ans01 += add",
"- temp = 1",
"-for i in range(1, n):",
"- tar = temp + a[i]",
"- if tar * temp < 0:",
"- temp = tar",
"+",
"+",
"+def calc(val):",
"+ # valには、1か−1を... | false | 0.062208 | 0.100219 | 0.620723 | [
"s061469772",
"s651864437"
] |
u282228874 | p03325 | python | s015203098 | s751312462 | 88 | 81 | 4,148 | 4,212 | Accepted | Accepted | 7.95 | N = int(eval(input()))
A = list(map(int,input().split()))
res = 0
for a in A:
while a%2 == 0:
res += 1
a //= 2
print(res) | n = int(eval(input()))
A = list(map(int,input().split()))
res = 0
for a in A:
while a%2 == 0:
res += 1
a //= 2
print(res) | 8 | 8 | 142 | 142 | N = int(eval(input()))
A = list(map(int, input().split()))
res = 0
for a in A:
while a % 2 == 0:
res += 1
a //= 2
print(res)
| n = int(eval(input()))
A = list(map(int, input().split()))
res = 0
for a in A:
while a % 2 == 0:
res += 1
a //= 2
print(res)
| false | 0 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))"
] | false | 0.038636 | 0.040613 | 0.95132 | [
"s015203098",
"s751312462"
] |
u991567869 | p02958 | python | s762998711 | s945011577 | 23 | 17 | 3,444 | 2,940 | Accepted | Accepted | 26.09 | import copy
n = int(eval(input()))
p = list(map(int, input().split()))
q = copy.copy(p)
q.sort()
c = 0
for i in range(n):
if p[i] != q[i]:
c = c + 1
if c == 2 or c == 0:
print("YES")
else:
print("NO") | n = int(eval(input()))
p = list(map(int, input().split()))
c = 0
for i in range(n):
if p[i] != i + 1:
c = c + 1
if c == 2 or c == 0:
print("YES")
else:
print("NO") | 16 | 12 | 232 | 190 | import copy
n = int(eval(input()))
p = list(map(int, input().split()))
q = copy.copy(p)
q.sort()
c = 0
for i in range(n):
if p[i] != q[i]:
c = c + 1
if c == 2 or c == 0:
print("YES")
else:
print("NO")
| n = int(eval(input()))
p = list(map(int, input().split()))
c = 0
for i in range(n):
if p[i] != i + 1:
c = c + 1
if c == 2 or c == 0:
print("YES")
else:
print("NO")
| false | 25 | [
"-import copy",
"-",
"-q = copy.copy(p)",
"-q.sort()",
"- if p[i] != q[i]:",
"+ if p[i] != i + 1:"
] | false | 0.04063 | 0.070676 | 0.574884 | [
"s762998711",
"s945011577"
] |
u628285938 | p02888 | python | s964496688 | s556818635 | 1,978 | 1,241 | 9,232 | 9,344 | Accepted | Accepted | 37.26 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 9 20:56:06 2020
@author: liang
"""
N = int(eval(input()))
L = [int(x) for x in input().split()]
L.sort()
ans = 0
#print(L)
for i in range(N-2):
#print("1:",i)
p = i+2
#以下O(2?N) 定数倍が遅い
for j in range(i+1,N-1):
#print("2",i,j)
... | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 9 21:39:55 2020
@author: liang
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 9 20:56:06 2020
@author: liang
"""
N = int(eval(input()))
L = [int(x) for x in input().split()]
from bisect import bisect_left
L.sort()
ans = 0
#print(L)
for i i... | 26 | 37 | 499 | 681 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 9 20:56:06 2020
@author: liang
"""
N = int(eval(input()))
L = [int(x) for x in input().split()]
L.sort()
ans = 0
# print(L)
for i in range(N - 2):
# print("1:",i)
p = i + 2
# 以下O(2?N) 定数倍が遅い
for j in range(i + 1, N - 1):
# print("2",i,j)
wh... | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 9 21:39:55 2020
@author: liang
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 9 20:56:06 2020
@author: liang
"""
N = int(eval(input()))
L = [int(x) for x in input().split()]
from bisect import bisect_left
L.sort()
ans = 0
# print(L)
for i in range(N - 2):
# prin... | false | 29.72973 | [
"+# -*- coding: utf-8 -*-",
"+\"\"\"",
"+Created on Wed Sep 9 21:39:55 2020",
"+@author: liang",
"+\"\"\"",
"+from bisect import bisect_left",
"+",
"- p = i + 2",
"- # 以下O(2?N) 定数倍が遅い",
"+ # p = i+2",
"+ # 以下O(2N) 定数倍が遅い",
"- while p < N and L[p] < L[i] + L[j]:",
"- ... | false | 0.038204 | 0.067277 | 0.567864 | [
"s964496688",
"s556818635"
] |
u813098295 | p02688 | python | s593746250 | s970252759 | 25 | 21 | 9,184 | 9,068 | Accepted | Accepted | 16 | N, K = list(map(int, input().split()))
snuke = [False] * N
for i in range(K):
d = int(eval(input()))
a = list(map(int, input().split()))
for j in range(d):
snuke[a[j] - 1] = True
ans = 0
for i in range(N):
if not snuke[i]:
ans += 1
print(ans)
| N, K = list(map(int, input().split()))
snukes = [0 for _ in range(N)]
for _ in range(K):
d = int(eval(input()))
A = list(map(int, input().split()))
for a in A:
snukes[a - 1] += 1
print((snukes.count(0))) | 15 | 10 | 280 | 214 | N, K = list(map(int, input().split()))
snuke = [False] * N
for i in range(K):
d = int(eval(input()))
a = list(map(int, input().split()))
for j in range(d):
snuke[a[j] - 1] = True
ans = 0
for i in range(N):
if not snuke[i]:
ans += 1
print(ans)
| N, K = list(map(int, input().split()))
snukes = [0 for _ in range(N)]
for _ in range(K):
d = int(eval(input()))
A = list(map(int, input().split()))
for a in A:
snukes[a - 1] += 1
print((snukes.count(0)))
| false | 33.333333 | [
"-snuke = [False] * N",
"-for i in range(K):",
"+snukes = [0 for _ in range(N)]",
"+for _ in range(K):",
"- a = list(map(int, input().split()))",
"- for j in range(d):",
"- snuke[a[j] - 1] = True",
"-ans = 0",
"-for i in range(N):",
"- if not snuke[i]:",
"- ans += 1",
"-... | false | 0.044996 | 0.039771 | 1.131365 | [
"s593746250",
"s970252759"
] |
u631277801 | p03287 | python | s362846534 | s972951376 | 99 | 84 | 16,300 | 17,796 | Accepted | Accepted | 15.15 | from itertools import accumulate
from collections import defaultdict
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
#1 累積和をとる
B = [0] + list(accumulate(A))
#2 そのmodをとる
B = [b%M for b in B]
#3 1~Nまで、辞書内の当該キーをansにプラスしながら進む
cnt = defaultdict(int)
ans = 0
for b in B:
ans... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readl... | 21 | 30 | 360 | 708 | from itertools import accumulate
from collections import defaultdict
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
# 1 累積和をとる
B = [0] + list(accumulate(A))
# 2 そのmodをとる
B = [b % M for b in B]
# 3 1~Nまで、辞書内の当該キーをansにプラスしながら進む
cnt = defaultdict(int)
ans = 0
for b in B:
ans += cnt[b]
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 30 | [
"+import sys",
"+",
"+stdin = sys.stdin",
"+sys.setrecursionlimit(10**5)",
"+",
"+",
"+def li():",
"+ return list(map(int, stdin.readline().split()))",
"+",
"+",
"+def li_():",
"+ return [int(x) - 1 for x in stdin.readline().split()]",
"+",
"+",
"+def lf():",
"+ return list(ma... | false | 0.047207 | 0.044016 | 1.0725 | [
"s362846534",
"s972951376"
] |
u777923818 | p03734 | python | s946474204 | s690039208 | 784 | 626 | 3,188 | 3,188 | Accepted | Accepted | 20.15 | # -*- coding: utf-8 -*-
from itertools import accumulate, product
from operator import itemgetter
def inpl(): return tuple(map(int, input().split()))
N, W = inpl()
I = [inpl() for _ in range(N)]
w1 = I[0][0]
A = {w1 + x: [] for x in range(4)}
for w, v in I:
A[w].append(v)
for k, v in list(A.items())... | # -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
from itertools import accumulate, product
N, W = inpl()
A = []
for _ in range(N):
A.append(inpl())
B = [[] for _ in range(4)]
w1 = A[0][0]
for w, v in A:
B[w-w1].append(v)
B = [sorted(b, reverse=True) for b in B]
C =... | 28 | 27 | 698 | 635 | # -*- coding: utf-8 -*-
from itertools import accumulate, product
from operator import itemgetter
def inpl():
return tuple(map(int, input().split()))
N, W = inpl()
I = [inpl() for _ in range(N)]
w1 = I[0][0]
A = {w1 + x: [] for x in range(4)}
for w, v in I:
A[w].append(v)
for k, v in list(A.items()):
A[... | # -*- coding: utf-8 -*-
def inpl():
return list(map(int, input().split()))
from itertools import accumulate, product
N, W = inpl()
A = []
for _ in range(N):
A.append(inpl())
B = [[] for _ in range(4)]
w1 = A[0][0]
for w, v in A:
B[w - w1].append(v)
B = [sorted(b, reverse=True) for b in B]
C = [[0] + list... | false | 3.571429 | [
"-from itertools import accumulate, product",
"-from operator import itemgetter",
"+def inpl():",
"+ return list(map(int, input().split()))",
"-def inpl():",
"- return tuple(map(int, input().split()))",
"-",
"+from itertools import accumulate, product",
"-I = [inpl() for _ in range(N)]",
"-w... | false | 0.040194 | 0.041363 | 0.971726 | [
"s946474204",
"s690039208"
] |
u970197315 | p03574 | python | s993208960 | s538471416 | 26 | 24 | 3,192 | 3,448 | Accepted | Accepted | 7.69 | # ABC075 B - Minesweeper
H,W = list(map(int,input().split()))
G = [['' for _ in range(W+2)] for _ in range(H+2)]
Ans = [[0 for _ in range(W+2)] for _ in range(H+2)]
for i in range(1,H+1):
S = eval(input())
for j,s in enumerate(S):
G[i][j+1]= s
for i in range(1,H+1):
for j in range(W):... | h,w=list(map(int,input().split()))
s=[eval(input()) for i in range(h)]
a=[[0]*w for i in range(h)]
if h==1 and w==1:
if s[0]=="#":
print("#")
else:
print((0))
elif h==1 and w>1:
for i in range(w):
t=0
if i==0:
if s[0][i+1]=="#":t+=1
elif 0<i<w-1:
if s[0][i+1]=="#":t... | 74 | 110 | 2,060 | 2,745 | # ABC075 B - Minesweeper
H, W = list(map(int, input().split()))
G = [["" for _ in range(W + 2)] for _ in range(H + 2)]
Ans = [[0 for _ in range(W + 2)] for _ in range(H + 2)]
for i in range(1, H + 1):
S = eval(input())
for j, s in enumerate(S):
G[i][j + 1] = s
for i in range(1, H + 1):
for j in rang... | h, w = list(map(int, input().split()))
s = [eval(input()) for i in range(h)]
a = [[0] * w for i in range(h)]
if h == 1 and w == 1:
if s[0] == "#":
print("#")
else:
print((0))
elif h == 1 and w > 1:
for i in range(w):
t = 0
if i == 0:
if s[0][i + 1] == "#":
... | false | 32.727273 | [
"-# ABC075 B - Minesweeper",
"-H, W = list(map(int, input().split()))",
"-G = [[\"\" for _ in range(W + 2)] for _ in range(H + 2)]",
"-Ans = [[0 for _ in range(W + 2)] for _ in range(H + 2)]",
"-for i in range(1, H + 1):",
"- S = eval(input())",
"- for j, s in enumerate(S):",
"- G[i][j + ... | false | 0.037957 | 0.039056 | 0.971857 | [
"s993208960",
"s538471416"
] |
u399721252 | p02936 | python | s875683328 | s220537229 | 1,951 | 816 | 107,084 | 95,308 | Accepted | Accepted | 58.18 | n, q = [ int(v) for v in input().split() ]
value_list = [ 0 for i in range(n) ]
connect_list = [ [] for i in range(n) ]
for i in range(n-1):
a, b = [ int(v)-1 for v in input().split() ]
connect_list[a].append(b)
connect_list[b].append(a)
for i in range(q):
c, p = [ int(v)-1 for v in input().spli... | import sys
input = sys.stdin.readline
n, q = [ int(v) for v in input().split() ]
value_list = [ 0 for i in range(n) ]
connect_list = [ [] for i in range(n) ]
for i in range(n-1):
a, b = [ int(v)-1 for v in input().split() ]
connect_list[a].append(b)
connect_list[b].append(a)
for i in range(q):
... | 30 | 33 | 850 | 893 | n, q = [int(v) for v in input().split()]
value_list = [0 for i in range(n)]
connect_list = [[] for i in range(n)]
for i in range(n - 1):
a, b = [int(v) - 1 for v in input().split()]
connect_list[a].append(b)
connect_list[b].append(a)
for i in range(q):
c, p = [int(v) - 1 for v in input().split()]
va... | import sys
input = sys.stdin.readline
n, q = [int(v) for v in input().split()]
value_list = [0 for i in range(n)]
connect_list = [[] for i in range(n)]
for i in range(n - 1):
a, b = [int(v) - 1 for v in input().split()]
connect_list[a].append(b)
connect_list[b].append(a)
for i in range(q):
c, p = [int(... | false | 9.090909 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.037618 | 0.035919 | 1.047287 | [
"s875683328",
"s220537229"
] |
u553987207 | p02732 | python | s507738609 | s545859749 | 273 | 230 | 26,140 | 32,796 | Accepted | Accepted | 15.75 | N = int(eval(input()))
A = list(map(int, input().split()))
c = [0] * (N + 1)
for a in A:
c[a] += 1
total = sum([n * (n - 1) // 2 for n in c])
for a in A:
print((total - (c[a] - 1))) | N = int(eval(input()))
A = tuple(map(int, input().split()))
dupcount = [0] * (N + 1)
for a in A:
dupcount[a] += 1
allc = 0
for a in range(1, N + 1):
c = dupcount[a]
if c > 1:
allc += (c * (c - 1) // 2)
for a in A:
ans = allc
c = dupcount[a]
if c > 0:
ans -= (c... | 8 | 19 | 188 | 335 | N = int(eval(input()))
A = list(map(int, input().split()))
c = [0] * (N + 1)
for a in A:
c[a] += 1
total = sum([n * (n - 1) // 2 for n in c])
for a in A:
print((total - (c[a] - 1)))
| N = int(eval(input()))
A = tuple(map(int, input().split()))
dupcount = [0] * (N + 1)
for a in A:
dupcount[a] += 1
allc = 0
for a in range(1, N + 1):
c = dupcount[a]
if c > 1:
allc += c * (c - 1) // 2
for a in A:
ans = allc
c = dupcount[a]
if c > 0:
ans -= c - 1
print(ans)
| false | 57.894737 | [
"-A = list(map(int, input().split()))",
"-c = [0] * (N + 1)",
"+A = tuple(map(int, input().split()))",
"+dupcount = [0] * (N + 1)",
"- c[a] += 1",
"-total = sum([n * (n - 1) // 2 for n in c])",
"+ dupcount[a] += 1",
"+allc = 0",
"+for a in range(1, N + 1):",
"+ c = dupcount[a]",
"+ i... | false | 0.106438 | 0.035494 | 2.998747 | [
"s507738609",
"s545859749"
] |
u366959492 | p03044 | python | s556939054 | s298090833 | 911 | 764 | 70,432 | 70,688 | Accepted | Accepted | 16.14 | n=int(eval(input()))
l=[[] for _ in range(n+1)]
q=[(1,0)]
ans=[-1]*n
while n>1:
u,v,w=list(map(int,input().split()))
l[u]+=[(v,w)]
l[v]+=[(u,w)]
n-=1
while q:
u,w=q.pop()
ans[u-1]=w%2
for v,d in l[u]:
q+=[(v,w+d)]*(ans[v-1]<0)
print((*ans))
| n=int(input())
l=[[] for _ in range(n)]
for _ in range(n-1):
u,v,w=map(int,input().split())
u-=1
v-=1
l[u].append((v,w))
l[v].append((u,w))
iro=[-1]*n
iro[0]=1
from collections import deque
q=deque()
q.append(0)
while q:
v=q.popleft()
for i,w in l[v]:
if iro[i]!=-... | 15 | 26 | 277 | 479 | n = int(eval(input()))
l = [[] for _ in range(n + 1)]
q = [(1, 0)]
ans = [-1] * n
while n > 1:
u, v, w = list(map(int, input().split()))
l[u] += [(v, w)]
l[v] += [(u, w)]
n -= 1
while q:
u, w = q.pop()
ans[u - 1] = w % 2
for v, d in l[u]:
q += [(v, w + d)] * (ans[v - 1] < 0)
print((*... | n = int(input())
l = [[] for _ in range(n)]
for _ in range(n - 1):
u, v, w = map(int, input().split())
u -= 1
v -= 1
l[u].append((v, w))
l[v].append((u, w))
iro = [-1] * n
iro[0] = 1
from collections import deque
q = deque()
q.append(0)
while q:
v = q.popleft()
for i, w in l[v]:
if ... | false | 42.307692 | [
"-n = int(eval(input()))",
"-l = [[] for _ in range(n + 1)]",
"-q = [(1, 0)]",
"-ans = [-1] * n",
"-while n > 1:",
"- u, v, w = list(map(int, input().split()))",
"- l[u] += [(v, w)]",
"- l[v] += [(u, w)]",
"- n -= 1",
"+n = int(input())",
"+l = [[] for _ in range(n)]",
"+for _ in r... | false | 0.045187 | 0.09254 | 0.488296 | [
"s556939054",
"s298090833"
] |
u392319141 | p03106 | python | s267024063 | s662961493 | 35 | 17 | 5,048 | 2,940 | Accepted | Accepted | 51.43 | import fractions as fr
A , B , K = list(map(int,input().split())) # A,B <= 100
k = 0
R = int(max(fr.gcd(A,B),1))
for i in range(R,0,-1) :
if A % i == 0 and B % i == 0 :
k += 1
if k >= K :
print(i)
break
| A, B, K = list(map(int, input().split()))
ans = []
for i in range(1, 1000):
if A % i == 0 and B % i == 0:
ans.append(i)
ans.sort(reverse=True)
print((ans[K - 1]))
| 15 | 9 | 260 | 177 | import fractions as fr
A, B, K = list(map(int, input().split())) # A,B <= 100
k = 0
R = int(max(fr.gcd(A, B), 1))
for i in range(R, 0, -1):
if A % i == 0 and B % i == 0:
k += 1
if k >= K:
print(i)
break
| A, B, K = list(map(int, input().split()))
ans = []
for i in range(1, 1000):
if A % i == 0 and B % i == 0:
ans.append(i)
ans.sort(reverse=True)
print((ans[K - 1]))
| false | 40 | [
"-import fractions as fr",
"-",
"-A, B, K = list(map(int, input().split())) # A,B <= 100",
"-k = 0",
"-R = int(max(fr.gcd(A, B), 1))",
"-for i in range(R, 0, -1):",
"+A, B, K = list(map(int, input().split()))",
"+ans = []",
"+for i in range(1, 1000):",
"- k += 1",
"- if k >= K:",
... | false | 0.046257 | 0.038634 | 1.1973 | [
"s267024063",
"s662961493"
] |
u682672120 | p02574 | python | s801306850 | s393997230 | 518 | 433 | 196,824 | 187,512 | Accepted | Accepted | 16.41 | from collections import defaultdict
def gcd(a, b):
if a < b:
return gcd(b, a)
while b > 0:
a, b = b, a % b
return a
def sieve_of_eratosthenes_max(n):
sieve = [0] * (n+1)
sieve[0] = 0 #素数でない
sieve[1] = 1 #素数でない
for i in range(2, n+1):
if sieve[i] == 0:
... | from collections import defaultdict
import math
def gcd(a, b):
if a < b:
return gcd(b, a)
while b > 0:
a, b = b, a % b
return a
def sieve_of_eratosthenes(n):
sieve = list(range(n+1))
sieve[0] = 1 #素数でない
sieve[1] = 1 #素数でない
m = int(math.sqrt(n))
for i in r... | 53 | 55 | 1,197 | 1,245 | from collections import defaultdict
def gcd(a, b):
if a < b:
return gcd(b, a)
while b > 0:
a, b = b, a % b
return a
def sieve_of_eratosthenes_max(n):
sieve = [0] * (n + 1)
sieve[0] = 0 # 素数でない
sieve[1] = 1 # 素数でない
for i in range(2, n + 1):
if sieve[i] == 0:
... | from collections import defaultdict
import math
def gcd(a, b):
if a < b:
return gcd(b, a)
while b > 0:
a, b = b, a % b
return a
def sieve_of_eratosthenes(n):
sieve = list(range(n + 1))
sieve[0] = 1 # 素数でない
sieve[1] = 1 # 素数でない
m = int(math.sqrt(n))
for i in range(2,... | false | 3.636364 | [
"+import math",
"-def sieve_of_eratosthenes_max(n):",
"- sieve = [0] * (n + 1)",
"- sieve[0] = 0 # 素数でない",
"+def sieve_of_eratosthenes(n):",
"+ sieve = list(range(n + 1))",
"+ sieve[0] = 1 # 素数でない",
"- for i in range(2, n + 1):",
"- if sieve[i] == 0:",
"- for j i... | false | 0.042116 | 0.038272 | 1.100428 | [
"s801306850",
"s393997230"
] |
u259755734 | p02765 | python | s800339912 | s389353809 | 78 | 23 | 61,608 | 9,096 | Accepted | Accepted | 70.51 | n, r = list(map(int, input().split()))
if n >= 10:
print(r)
else:
print((r + 100*(10-n)))
| import sys
stdin = sys.stdin
ni = lambda: int(ns())
ns = lambda: stdin.readline().rstrip()
na = lambda: list(map(int, stdin.readline().split()))
# code here
N, R = na()
if N >= 10:
print(R)
else:
print((R + 100*(10-N)))
| 6 | 16 | 96 | 246 | n, r = list(map(int, input().split()))
if n >= 10:
print(r)
else:
print((r + 100 * (10 - n)))
| import sys
stdin = sys.stdin
ni = lambda: int(ns())
ns = lambda: stdin.readline().rstrip()
na = lambda: list(map(int, stdin.readline().split()))
# code here
N, R = na()
if N >= 10:
print(R)
else:
print((R + 100 * (10 - N)))
| false | 62.5 | [
"-n, r = list(map(int, input().split()))",
"-if n >= 10:",
"- print(r)",
"+import sys",
"+",
"+stdin = sys.stdin",
"+ni = lambda: int(ns())",
"+ns = lambda: stdin.readline().rstrip()",
"+na = lambda: list(map(int, stdin.readline().split()))",
"+# code here",
"+N, R = na()",
"+if N >= 10:",
... | false | 0.058666 | 0.054834 | 1.069886 | [
"s800339912",
"s389353809"
] |
u761320129 | p03488 | python | s778645867 | s661758647 | 1,265 | 1,050 | 3,816 | 3,820 | Accepted | Accepted | 17 | S = eval(input())
x,y = list(map(int,input().split()))
if 'T' not in S:
print(('Yes' if x==len(S) and y==0 else 'No'))
exit()
sp = S.split('T')
x -= len(sp[0])
v_moves = []
h_moves = []
for i,s in enumerate(sp[1:]):
if not s: continue
if i%2==0:
v_moves.append(len(s))
else... | S = eval(input())
X,Y = list(map(int,input().split()))
st = S.split('T')
X -= len(st[0])
xds = []
yds = []
for i,s in enumerate(st[1:]):
if i%2:
xds.append(len(s))
else:
yds.append(len(s))
def ok(to, ds):
dp = set([0])
for d in ds:
tmp = []
for v in d... | 52 | 25 | 954 | 465 | S = eval(input())
x, y = list(map(int, input().split()))
if "T" not in S:
print(("Yes" if x == len(S) and y == 0 else "No"))
exit()
sp = S.split("T")
x -= len(sp[0])
v_moves = []
h_moves = []
for i, s in enumerate(sp[1:]):
if not s:
continue
if i % 2 == 0:
v_moves.append(len(s))
else... | S = eval(input())
X, Y = list(map(int, input().split()))
st = S.split("T")
X -= len(st[0])
xds = []
yds = []
for i, s in enumerate(st[1:]):
if i % 2:
xds.append(len(s))
else:
yds.append(len(s))
def ok(to, ds):
dp = set([0])
for d in ds:
tmp = []
for v in dp:
... | false | 51.923077 | [
"-x, y = list(map(int, input().split()))",
"-if \"T\" not in S:",
"- print((\"Yes\" if x == len(S) and y == 0 else \"No\"))",
"- exit()",
"-sp = S.split(\"T\")",
"-x -= len(sp[0])",
"-v_moves = []",
"-h_moves = []",
"-for i, s in enumerate(sp[1:]):",
"- if not s:",
"- continue",
... | false | 0.043352 | 0.042895 | 1.010645 | [
"s778645867",
"s661758647"
] |
u312025627 | p03494 | python | s585779020 | s924848474 | 177 | 18 | 39,024 | 3,060 | Accepted | Accepted | 89.83 | n = int(eval(input()))
a = {int(i) for i in input().split()}
ans = 0
while not any(i&1 for i in a):
ans += 1
a = {i//2 for i in a}
print(ans) | n = int(eval(input()))
a = [int(i) for i in input().split()]
ans = 0
while not any(i&1 for i in a):
ans += 1
a = [i//2 for i in a]
print(ans) | 8 | 8 | 151 | 151 | n = int(eval(input()))
a = {int(i) for i in input().split()}
ans = 0
while not any(i & 1 for i in a):
ans += 1
a = {i // 2 for i in a}
print(ans)
| n = int(eval(input()))
a = [int(i) for i in input().split()]
ans = 0
while not any(i & 1 for i in a):
ans += 1
a = [i // 2 for i in a]
print(ans)
| false | 0 | [
"-a = {int(i) for i in input().split()}",
"+a = [int(i) for i in input().split()]",
"- a = {i // 2 for i in a}",
"+ a = [i // 2 for i in a]"
] | false | 0.043501 | 0.03601 | 1.208012 | [
"s585779020",
"s924848474"
] |
u414980766 | p02861 | python | s459910353 | s770175100 | 1,310 | 567 | 12,388 | 12,388 | Accepted | Accepted | 56.72 | from itertools import permutations as perm
import sys
import math
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
XY = np.array(read().split(), np.int64)
X = XY[0::2]
Y = XY[1::2]
res = 0
cnt = 0
for p in perm... | from itertools import permutations as perm
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
XY = list(map(int, read().split()))
X = XY[0::2]
Y = XY[1::2]
res = 0
cnt = 0
for p in perm(list(range(N))):... | 19 | 18 | 476 | 455 | from itertools import permutations as perm
import sys
import math
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
XY = np.array(read().split(), np.int64)
X = XY[0::2]
Y = XY[1::2]
res = 0
cnt = 0
for p in perm(list(range(N)... | from itertools import permutations as perm
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
XY = list(map(int, read().split()))
X = XY[0::2]
Y = XY[1::2]
res = 0
cnt = 0
for p in perm(list(range(N))):
for i in... | false | 5.263158 | [
"-import math",
"-XY = np.array(read().split(), np.int64)",
"+XY = list(map(int, read().split()))",
"- res += math.sqrt((X[p[i + 1]] - X[p[i]]) ** 2 + (Y[p[i + 1]] - Y[p[i]]) ** 2)",
"+ res += ((X[p[i + 1]] - X[p[i]]) ** 2 + (Y[p[i + 1]] - Y[p[i]]) ** 2) ** 0.5"
] | false | 0.362667 | 0.11371 | 3.189412 | [
"s459910353",
"s770175100"
] |
u077291787 | p03994 | python | s788943821 | s288410782 | 49 | 43 | 5,532 | 4,980 | Accepted | Accepted | 12.24 | # code-festival-2016-qualaC - 次のアルファベット / Next Letter
from string import ascii_lowercase as abc
def main():
S = input().rstrip()
K = int(eval(input()))
# dist[c] := distance to "a" through "z"
dist = {c: 26 - i for i, c in enumerate(abc)}
dist["a"] = 0
A = [dist[i] for i in S]
a... | # code-festival-2016-qualaC - 次のアルファベット / Next Letter
def main():
S = input().rstrip()
K = int(eval(input()))
abc = "abcdefghijklmnopqrstuvwxyz"
# dist[c] := distance to "a" through "z"
dist = {c: 26 - i for i, c in enumerate(abc)}
dist["a"] = 0
A = [dist[i] for i in S]
ans = ""... | 25 | 23 | 673 | 666 | # code-festival-2016-qualaC - 次のアルファベット / Next Letter
from string import ascii_lowercase as abc
def main():
S = input().rstrip()
K = int(eval(input()))
# dist[c] := distance to "a" through "z"
dist = {c: 26 - i for i, c in enumerate(abc)}
dist["a"] = 0
A = [dist[i] for i in S]
ans = ""
... | # code-festival-2016-qualaC - 次のアルファベット / Next Letter
def main():
S = input().rstrip()
K = int(eval(input()))
abc = "abcdefghijklmnopqrstuvwxyz"
# dist[c] := distance to "a" through "z"
dist = {c: 26 - i for i, c in enumerate(abc)}
dist["a"] = 0
A = [dist[i] for i in S]
ans = ""
for ... | false | 8 | [
"-from string import ascii_lowercase as abc",
"-",
"-",
"+ abc = \"abcdefghijklmnopqrstuvwxyz\""
] | false | 0.007625 | 0.094316 | 0.08085 | [
"s788943821",
"s288410782"
] |
u813102292 | p03031 | python | s466158928 | s601763540 | 41 | 27 | 3,064 | 3,064 | Accepted | Accepted | 34.15 | n, m = list(map(int, input().split()))
s = []
for i in range(m):
inputs = list(map(int, input().split()))
k = inputs[0]
s.append(inputs[1:])
p = list(map(int, input().split()))
res = 0
for i in range(2 ** n):
flag = True
bit_i = bin(i)[2:].zfill(n)
for j in range(m):
sum_... | N, M = list(map(int, input().split()))
S = []
for _ in range(M):
ks = list(map(int, input().split()))
S.append(ks[1:])
P = list(map(int, input().split()))
ans = 0
for i in range(2**N):
bi = str(bin(i))[2:]
bi = bi.zfill(N)
isAddable = True
for j in range(M):
s_sum = 0
... | 24 | 23 | 507 | 522 | n, m = list(map(int, input().split()))
s = []
for i in range(m):
inputs = list(map(int, input().split()))
k = inputs[0]
s.append(inputs[1:])
p = list(map(int, input().split()))
res = 0
for i in range(2**n):
flag = True
bit_i = bin(i)[2:].zfill(n)
for j in range(m):
sum_s = 0
for ... | N, M = list(map(int, input().split()))
S = []
for _ in range(M):
ks = list(map(int, input().split()))
S.append(ks[1:])
P = list(map(int, input().split()))
ans = 0
for i in range(2**N):
bi = str(bin(i))[2:]
bi = bi.zfill(N)
isAddable = True
for j in range(M):
s_sum = 0
for s in S[... | false | 4.166667 | [
"-n, m = list(map(int, input().split()))",
"-s = []",
"-for i in range(m):",
"- inputs = list(map(int, input().split()))",
"- k = inputs[0]",
"- s.append(inputs[1:])",
"-p = list(map(int, input().split()))",
"-res = 0",
"-for i in range(2**n):",
"- flag = True",
"- bit_i = bin(i)[... | false | 0.056822 | 0.03503 | 1.622086 | [
"s466158928",
"s601763540"
] |
u057109575 | p02900 | python | s602945522 | s595628072 | 185 | 76 | 38,512 | 62,848 | Accepted | Accepted | 58.92 | A, B = list(map(int, input().split()))
def prime_factor(n):
d = set()
for i in range(2, n + 1):
if i * i > n:
break
while n % i == 0:
d.add(i)
n //= i
if n != 1:
d.add(n)
return d
a = prime_factor(A)
b = prime_f... | A, B = list(map(int, input().split()))
def prime_factor(n):
res = set([1])
for i in range(2, n + 1):
if i * i > n:
break
while n % i == 0:
res.add(i)
n //= i
if n != 1:
res.add(n)
return res
... | 19 | 18 | 356 | 361 | A, B = list(map(int, input().split()))
def prime_factor(n):
d = set()
for i in range(2, n + 1):
if i * i > n:
break
while n % i == 0:
d.add(i)
n //= i
if n != 1:
d.add(n)
return d
a = prime_factor(A)
b = prime_factor(B)
print((len(set(a) & ... | A, B = list(map(int, input().split()))
def prime_factor(n):
res = set([1])
for i in range(2, n + 1):
if i * i > n:
break
while n % i == 0:
res.add(i)
n //= i
if n != 1:
res.add(n)
return res
print((len(prime_factor(A) & prime_factor(B))))
| false | 5.263158 | [
"- d = set()",
"+ res = set([1])",
"- d.add(i)",
"+ res.add(i)",
"- d.add(n)",
"- return d",
"+ res.add(n)",
"+ return res",
"-a = prime_factor(A)",
"-b = prime_factor(B)",
"-print((len(set(a) & set(b)) + 1))",
"+print((len(prime_factor(A) & prim... | false | 0.041918 | 0.077515 | 0.540773 | [
"s602945522",
"s595628072"
] |
u459639226 | p03137 | python | s499298863 | s160349993 | 131 | 114 | 13,960 | 13,968 | Accepted | Accepted | 12.98 | N, M = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
if M <= N:
print((0))
else:
Y = []
for i in range(1, len(X)):
Y.append(X[i] - X[i-1])
Y = sorted(Y)
if N == 1:
print((sum(Y)))
else:
print((sum(Y[:-(N-1)])))
| N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
t = [0] * (M - 1)
for i in range(1, M):
t[i - 1] = X[i] - X[i - 1]
t.sort(reverse=True)
print((sum(t[N - 1:])))
| 13 | 8 | 289 | 199 | N, M = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
if M <= N:
print((0))
else:
Y = []
for i in range(1, len(X)):
Y.append(X[i] - X[i - 1])
Y = sorted(Y)
if N == 1:
print((sum(Y)))
else:
print((sum(Y[: -(N - 1)])))
| N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
t = [0] * (M - 1)
for i in range(1, M):
t[i - 1] = X[i] - X[i - 1]
t.sort(reverse=True)
print((sum(t[N - 1 :])))
| false | 38.461538 | [
"-X = sorted(list(map(int, input().split())))",
"-if M <= N:",
"- print((0))",
"-else:",
"- Y = []",
"- for i in range(1, len(X)):",
"- Y.append(X[i] - X[i - 1])",
"- Y = sorted(Y)",
"- if N == 1:",
"- print((sum(Y)))",
"- else:",
"- print((sum(Y[: -(N - ... | false | 0.068976 | 0.042653 | 1.617154 | [
"s499298863",
"s160349993"
] |
u727051308 | p02576 | python | s352219319 | s361913894 | 32 | 25 | 9,084 | 8,932 | Accepted | Accepted | 21.88 | N, X, T = list(map(int,input().split()))
if N % X == 0:
print(( T*N // X ))
else:
print(( T*(N // X + 1)))
| N, X, T = list(map(int,input().split()))
if N % X == 0:
print(((N//X)*T))
else:
print(((N//X+1)*T)) | 6 | 5 | 107 | 97 | N, X, T = list(map(int, input().split()))
if N % X == 0:
print((T * N // X))
else:
print((T * (N // X + 1)))
| N, X, T = list(map(int, input().split()))
if N % X == 0:
print(((N // X) * T))
else:
print(((N // X + 1) * T))
| false | 16.666667 | [
"- print((T * N // X))",
"+ print(((N // X) * T))",
"- print((T * (N // X + 1)))",
"+ print(((N // X + 1) * T))"
] | false | 0.040537 | 0.044877 | 0.903292 | [
"s352219319",
"s361913894"
] |
u608088992 | p03449 | python | s110294272 | s653140383 | 22 | 18 | 3,316 | 3,064 | Accepted | Accepted | 18.18 | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [[int(a) for a in input().split()] for _ in range(2)]
M = ((1, 0), (0, 1))
q = deque()
q.append((0, 0, 0))
C = [[0] * N for _ in range(2)]
while q:
i, j, n = q... | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [[int(a) for a in input().split()] for _ in range(2)]
first = [0] * N
second = [0] * N
first[0] = A[0][0]
second[N-1] = A[1][N-1]
for i in range(1, N):
first[i] = first[i-1] + A[0][i]
... | 25 | 23 | 621 | 550 | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [[int(a) for a in input().split()] for _ in range(2)]
M = ((1, 0), (0, 1))
q = deque()
q.append((0, 0, 0))
C = [[0] * N for _ in range(2)]
while q:
i, j, n = q.popleft()
... | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [[int(a) for a in input().split()] for _ in range(2)]
first = [0] * N
second = [0] * N
first[0] = A[0][0]
second[N - 1] = A[1][N - 1]
for i in range(1, N):
first[i] = first[i - 1] + A[0][i]
se... | false | 8 | [
"-from collections import deque",
"- M = ((1, 0), (0, 1))",
"- q = deque()",
"- q.append((0, 0, 0))",
"- C = [[0] * N for _ in range(2)]",
"- while q:",
"- i, j, n = q.popleft()",
"- if n + A[i][j] > C[i][j]:",
"- C[i][j] = n + A[i][j]",
"- for di... | false | 0.036991 | 0.034968 | 1.057849 | [
"s110294272",
"s653140383"
] |
u279266699 | p02837 | python | s512940509 | s181985179 | 388 | 261 | 3,064 | 8,900 | Accepted | Accepted | 32.73 | n = int(eval(input()))
l = []
A = []
for i in range(n):
a = int(eval(input()))
A += [a]
l_1 = []
for j in range(a):
l_1 += [list(map(int, input().split()))]
l += [l_1]
ans = 0
for i in range(1 << n):
honest = []
liar = []
for j in range(n):
if ((i >> j)... | n = int(eval(input()))
num_of_sug = []
sug = []
for i in range(n):
m = int(eval(input()))
num_of_sug += [m]
sug += [[tuple(map(int, input().split())) for _ in range(m)]]
ans = 0
for i in range(2 ** n):
liar = []
honest = []
for j in range(n):
if ((i >> j) & 1):
... | 49 | 44 | 1,158 | 1,169 | n = int(eval(input()))
l = []
A = []
for i in range(n):
a = int(eval(input()))
A += [a]
l_1 = []
for j in range(a):
l_1 += [list(map(int, input().split()))]
l += [l_1]
ans = 0
for i in range(1 << n):
honest = []
liar = []
for j in range(n):
if (i >> j) & 1:
if... | n = int(eval(input()))
num_of_sug = []
sug = []
for i in range(n):
m = int(eval(input()))
num_of_sug += [m]
sug += [[tuple(map(int, input().split())) for _ in range(m)]]
ans = 0
for i in range(2**n):
liar = []
honest = []
for j in range(n):
if (i >> j) & 1:
if j + 1 in liar:
... | false | 10.204082 | [
"-l = []",
"-A = []",
"+num_of_sug = []",
"+sug = []",
"- a = int(eval(input()))",
"- A += [a]",
"- l_1 = []",
"- for j in range(a):",
"- l_1 += [list(map(int, input().split()))]",
"- l += [l_1]",
"+ m = int(eval(input()))",
"+ num_of_sug += [m]",
"+ sug += [[t... | false | 0.095863 | 0.036618 | 2.617935 | [
"s512940509",
"s181985179"
] |
u655834330 | p03127 | python | s566001117 | s073425573 | 380 | 316 | 23,132 | 27,532 | Accepted | Accepted | 16.84 |
import numpy as np
def submit():
n = int(eval(input()))
alist = list(map(int, input().split()))
while True:
curr_idx = np.argmin(alist)
curr_min = alist[curr_idx]
surplus_sum = 0
for i in range(len(alist)):
if i == curr_idx:
con... |
import numpy as np
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def submit():
n = int(eval(input()))
alist = list(map(int, input().split()))
g = alist[0]
for a in alist[1:]:
g = gcd(g, a)
print(g)
if __name__ == "__main__":
su... | 28 | 23 | 563 | 320 | import numpy as np
def submit():
n = int(eval(input()))
alist = list(map(int, input().split()))
while True:
curr_idx = np.argmin(alist)
curr_min = alist[curr_idx]
surplus_sum = 0
for i in range(len(alist)):
if i == curr_idx:
continue
... | import numpy as np
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def submit():
n = int(eval(input()))
alist = list(map(int, input().split()))
g = alist[0]
for a in alist[1:]:
g = gcd(g, a)
print(g)
if __name__ == "__main__":
submit()
| false | 17.857143 | [
"+",
"+",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"+ return gcd(b, a % b)",
"- while True:",
"- curr_idx = np.argmin(alist)",
"- curr_min = alist[curr_idx]",
"- surplus_sum = 0",
"- for i in range(len(alist)):",
"- if i == curr_id... | false | 0.164167 | 0.062008 | 2.647496 | [
"s566001117",
"s073425573"
] |
u185896732 | p03361 | python | s278969073 | s835178163 | 23 | 18 | 3,064 | 3,064 | Accepted | Accepted | 21.74 | #import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from copy import deepcopy
setrecursio... | h,w=list(map(int,input().split()))
s=[list(eval(input())) for _ in range(h)]
#print(s)
for i in range(h):
for j in range(w):
#print(i,j)
if s[i][j]=="#":
if i!=0:
if s[i-1][j]=="#":
continue
if i!=h-1:
if s[i+1][j... | 25 | 22 | 934 | 582 | # import pysnooper
# import os,re,sys,operator,math,heapq,string
# from collections import Counter,deque
# from operator import itemgetter
# from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin, setrecursionlimit
# from copy import deepcopy
setrecursion... | h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
# print(s)
for i in range(h):
for j in range(w):
# print(i,j)
if s[i][j] == "#":
if i != 0:
if s[i - 1][j] == "#":
continue
if i != h - 1:
if... | false | 12 | [
"-# import pysnooper",
"-# import os,re,sys,operator,math,heapq,string",
"-# from collections import Counter,deque",
"-# from operator import itemgetter",
"-# from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations",
"-from sys import stdin, setrecursionlimit",
"... | false | 0.036216 | 0.036049 | 1.004618 | [
"s278969073",
"s835178163"
] |
u078349616 | p03524 | python | s631112300 | s914330673 | 38 | 18 | 3,444 | 3,188 | Accepted | Accepted | 52.63 | from collections import defaultdict
S = eval(input())
d = defaultdict(int)
for i in range(len(S)):
d[S[i]] += 1
ma = max(d["a"], d["b"], d["c"])
mi = min(d["a"], d["b"], d["c"])
if ma-mi > 1:
print("NO")
else:
print("YES") | S = eval(input())
l = []
l.append(S.count("a"))
l.append(S.count("b"))
l.append(S.count("c"))
if max(l) - min(l) > 1:
print("NO")
else:
print("YES") | 15 | 9 | 240 | 154 | from collections import defaultdict
S = eval(input())
d = defaultdict(int)
for i in range(len(S)):
d[S[i]] += 1
ma = max(d["a"], d["b"], d["c"])
mi = min(d["a"], d["b"], d["c"])
if ma - mi > 1:
print("NO")
else:
print("YES")
| S = eval(input())
l = []
l.append(S.count("a"))
l.append(S.count("b"))
l.append(S.count("c"))
if max(l) - min(l) > 1:
print("NO")
else:
print("YES")
| false | 40 | [
"-from collections import defaultdict",
"-",
"-d = defaultdict(int)",
"-for i in range(len(S)):",
"- d[S[i]] += 1",
"-ma = max(d[\"a\"], d[\"b\"], d[\"c\"])",
"-mi = min(d[\"a\"], d[\"b\"], d[\"c\"])",
"-if ma - mi > 1:",
"+l = []",
"+l.append(S.count(\"a\"))",
"+l.append(S.count(\"b\"))",
... | false | 0.156033 | 0.007809 | 19.979954 | [
"s631112300",
"s914330673"
] |
u231848612 | p03061 | python | s344365714 | s066264191 | 215 | 198 | 14,052 | 14,440 | Accepted | Accepted | 7.91 | def GCD(a, b):
""" Euclidean algorithm"""
if a < b: (a, b) = (b, a)
if b == 0: return a
m = a % b
while m != 0:
a = b
b = m
m = a % b
return b
N = int(input())
A = [ int(v) for v in input().split() ]
if N < 2 and 1e5 < N: raise()
for v in A:
if v < 1... | def GCD(a, b):
""" Euclidean algorithm"""
if a < b: (a, b) = (b, a)
if b == 0: return a
m = a % b
while m != 0:
a = b
b = m
m = a % b
return b
N = int(input())
A = [ int(v) for v in input().split() ]
AR = list(reversed(A))
if N < 2 and 1e5 < N: raise()
f... | 43 | 37 | 752 | 686 | def GCD(a, b):
"""Euclidean algorithm"""
if a < b:
(a, b) = (b, a)
if b == 0:
return a
m = a % b
while m != 0:
a = b
b = m
m = a % b
return b
N = int(input())
A = [int(v) for v in input().split()]
if N < 2 and 1e5 < N:
raise ()
for v in A:
if v <... | def GCD(a, b):
"""Euclidean algorithm"""
if a < b:
(a, b) = (b, a)
if b == 0:
return a
m = a % b
while m != 0:
a = b
b = m
m = a % b
return b
N = int(input())
A = [int(v) for v in input().split()]
AR = list(reversed(A))
if N < 2 and 1e5 < N:
raise ()... | false | 13.953488 | [
"+AR = list(reversed(A))",
"-l_list = []",
"-l = 0",
"+l_list = [0]",
"- l = GCD(l, A[i])",
"+ l = GCD(l_list[i], A[i])",
"-r_list = []",
"-r = 0",
"-for i in range(-1, -(N + 1), -1):",
"- r = GCD(r, A[i])",
"+r_list = [0]",
"+for i in range(0, N):",
"+ r = GCD(r_list[i], AR[i])"... | false | 0.060012 | 0.037876 | 1.584429 | [
"s344365714",
"s066264191"
] |
u133936772 | p02642 | python | s601869809 | s457327089 | 725 | 415 | 33,292 | 33,016 | Accepted | Accepted | 42.76 | M=10**6+1
_,*l=list(map(int,open(0).read().split()))
a=[0]*M
for i in l:
if a[i]<2:
for j in range(i,M,i): a[j]+=2
a[i]-=1
print((a.count(1))) | M=10**6+1
_,*l=list(map(int,open(0).read().split()))
a=[0]*M
for i in l:
if a[i]<1:
for j in range(i*2,M,i): a[j]=2
a[i]+=1
print((a.count(1))) | 8 | 8 | 151 | 150 | M = 10**6 + 1
_, *l = list(map(int, open(0).read().split()))
a = [0] * M
for i in l:
if a[i] < 2:
for j in range(i, M, i):
a[j] += 2
a[i] -= 1
print((a.count(1)))
| M = 10**6 + 1
_, *l = list(map(int, open(0).read().split()))
a = [0] * M
for i in l:
if a[i] < 1:
for j in range(i * 2, M, i):
a[j] = 2
a[i] += 1
print((a.count(1)))
| false | 0 | [
"- if a[i] < 2:",
"- for j in range(i, M, i):",
"- a[j] += 2",
"- a[i] -= 1",
"+ if a[i] < 1:",
"+ for j in range(i * 2, M, i):",
"+ a[j] = 2",
"+ a[i] += 1"
] | false | 0.007295 | 0.241575 | 0.030198 | [
"s601869809",
"s457327089"
] |
u471797506 | p03142 | python | s590869202 | s659325031 | 1,266 | 799 | 182,360 | 116,748 | Accepted | Accepted | 36.89 | import sys
from collections import defaultdict
sys.setrecursionlimit(100000)
N, M = list(map(int, input().split()))
AB = defaultdict(list)
gain = [0]*N
for i in range(N + M - 1):
a, b = list(map(int, input().split()))
AB[a - 1].append(b - 1)
gain[b - 1] += 1
ans = [None]*N
def rec(u, p):
... | import sys
from collections import defaultdict
sys.setrecursionlimit(1000000)
N, M = list(map(int, input().split()))
AB = defaultdict(list)
gain = [0]*N
for i in range(N + M - 1):
a, b = list(map(int, input().split()))
AB[a - 1].append(b - 1)
gain[b - 1] += 1
ans = [None]*N
def rec(u, p):
... | 26 | 26 | 536 | 537 | import sys
from collections import defaultdict
sys.setrecursionlimit(100000)
N, M = list(map(int, input().split()))
AB = defaultdict(list)
gain = [0] * N
for i in range(N + M - 1):
a, b = list(map(int, input().split()))
AB[a - 1].append(b - 1)
gain[b - 1] += 1
ans = [None] * N
def rec(u, p):
ans[u] =... | import sys
from collections import defaultdict
sys.setrecursionlimit(1000000)
N, M = list(map(int, input().split()))
AB = defaultdict(list)
gain = [0] * N
for i in range(N + M - 1):
a, b = list(map(int, input().split()))
AB[a - 1].append(b - 1)
gain[b - 1] += 1
ans = [None] * N
def rec(u, p):
ans[u] ... | false | 0 | [
"-sys.setrecursionlimit(100000)",
"+sys.setrecursionlimit(1000000)"
] | false | 0.063937 | 0.035589 | 1.79654 | [
"s590869202",
"s659325031"
] |
u513081876 | p03625 | python | s910471910 | s498101313 | 229 | 73 | 21,540 | 22,104 | Accepted | Accepted | 68.12 | import collections
N = int(eval(input()))
A = [int(i) for i in input().split()]
dic = collections.Counter(A).most_common()
tmp = []
check = 0
dic.sort(reverse=True)
for a, b in dic:
if b >= 2:
check += 1
tmp.append(a)
if b>= 4:
break
if check == 2:
... | import collections
N = int(eval(input()))
a = [int(i) for i in input().split()]
check = []
dict = collections.Counter(a)
for a, b in list(dict.items()):
if b >= 2:
check.append(a)
if len(check) >=2:
check.sort()
if dict[check[-1]] >= 4:
print((check[-1] ** 2))
else:
... | 27 | 23 | 449 | 472 | import collections
N = int(eval(input()))
A = [int(i) for i in input().split()]
dic = collections.Counter(A).most_common()
tmp = []
check = 0
dic.sort(reverse=True)
for a, b in dic:
if b >= 2:
check += 1
tmp.append(a)
if b >= 4:
break
if check == 2:
break
if ... | import collections
N = int(eval(input()))
a = [int(i) for i in input().split()]
check = []
dict = collections.Counter(a)
for a, b in list(dict.items()):
if b >= 2:
check.append(a)
if len(check) >= 2:
check.sort()
if dict[check[-1]] >= 4:
print((check[-1] ** 2))
else:
print((chec... | false | 14.814815 | [
"-A = [int(i) for i in input().split()]",
"-dic = collections.Counter(A).most_common()",
"-tmp = []",
"-check = 0",
"-dic.sort(reverse=True)",
"-for a, b in dic:",
"+a = [int(i) for i in input().split()]",
"+check = []",
"+dict = collections.Counter(a)",
"+for a, b in list(dict.items()):",
"- ... | false | 0.043512 | 0.040897 | 1.063944 | [
"s910471910",
"s498101313"
] |
u097317219 | p04013 | python | s144152086 | s265726840 | 421 | 387 | 92,636 | 92,636 | Accepted | Accepted | 8.08 | n,a = list(map(int,input().split()))
x = list(map(int,input().split()))
max_x = max(x)
dp = [[[0]*(n*max_x+1) for i in range(n+1)] for j in range(n+1)]
dp[0][0][0] = 1
for i in range(n+1):
for j in range(n+1):
for k in range(n*max_x+1):
if i>=1 and k < x[i-1]:
dp[i][j][k] = dp[i-1][j][k]
... | n,a = list(map(int,input().split()))
x = list(map(int,input().split()))
max_x = max(max(x),a)
dp = [[[0]*(n*max_x+1) for i in range(n+1)] for j in range(n+1)]
dp[0][0][0] = 1
for i in range(n+1):
for j in range(n+1):
for k in range(n*max_x+1):
if i>=1 and k < x[i-1]:
dp[i][j][k] = dp[i-1][j... | 19 | 18 | 540 | 523 | n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
max_x = max(x)
dp = [[[0] * (n * max_x + 1) for i in range(n + 1)] for j in range(n + 1)]
dp[0][0][0] = 1
for i in range(n + 1):
for j in range(n + 1):
for k in range(n * max_x + 1):
if i >= 1 and k < x[i - 1]:
... | n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
max_x = max(max(x), a)
dp = [[[0] * (n * max_x + 1) for i in range(n + 1)] for j in range(n + 1)]
dp[0][0][0] = 1
for i in range(n + 1):
for j in range(n + 1):
for k in range(n * max_x + 1):
if i >= 1 and k < x[i - 1]:
... | false | 5.263158 | [
"-max_x = max(x)",
"+max_x = max(max(x), a)",
"- if j * a <= n * max_x + 1:",
"- ans += dp[n][j][j * a]",
"+ ans += dp[n][j][j * a]"
] | false | 0.035532 | 0.037165 | 0.956054 | [
"s144152086",
"s265726840"
] |
u325956328 | p02787 | python | s866157183 | s392977217 | 374 | 319 | 43,740 | 42,864 | Accepted | Accepted | 14.71 | H, N = list(map(int, input().split()))
dp = [10 ** 18] * (H + 1)
dp[0] = 0
for i in range(N):
a, b = list(map(int, input().split()))
for j in range(H):
nj = min(j + a, H) # nj: 次のjのindex, 配列外参照しないようにminをとる
dp[nj] = min(dp[nj], dp[j] + b)
print((dp[H]))
| def main():
H, N = list(map(int, input().split()))
dp = [10 ** 18] * (H + 1)
dp[0] = 0
for i in range(N):
a, b = list(map(int, input().split()))
for j in range(H):
nj = min(j + a, H) # nj: 次のjのindex, 配列外参照しないようにminをとる
dp[nj] = min(dp[nj], dp[j] + b)
... | 13 | 16 | 280 | 339 | H, N = list(map(int, input().split()))
dp = [10**18] * (H + 1)
dp[0] = 0
for i in range(N):
a, b = list(map(int, input().split()))
for j in range(H):
nj = min(j + a, H) # nj: 次のjのindex, 配列外参照しないようにminをとる
dp[nj] = min(dp[nj], dp[j] + b)
print((dp[H]))
| def main():
H, N = list(map(int, input().split()))
dp = [10**18] * (H + 1)
dp[0] = 0
for i in range(N):
a, b = list(map(int, input().split()))
for j in range(H):
nj = min(j + a, H) # nj: 次のjのindex, 配列外参照しないようにminをとる
dp[nj] = min(dp[nj], dp[j] + b)
print((dp[H... | false | 18.75 | [
"-H, N = list(map(int, input().split()))",
"-dp = [10**18] * (H + 1)",
"-dp[0] = 0",
"-for i in range(N):",
"- a, b = list(map(int, input().split()))",
"- for j in range(H):",
"- nj = min(j + a, H) # nj: 次のjのindex, 配列外参照しないようにminをとる",
"- dp[nj] = min(dp[nj], dp[j] + b)",
"-print... | false | 0.07441 | 0.065823 | 1.130459 | [
"s866157183",
"s392977217"
] |
u123756661 | p04000 | python | s045441429 | s638121950 | 1,654 | 841 | 163,288 | 139,512 | Accepted | Accepted | 49.15 | def sol():
import sys
input=sys.stdin.readline
h,w,n=list(map(int,input().split()))
d={}
for i in range(n):
y,x=list(map(int,input().split()))
if (y,x) in d:
d[(y,x)]+=1
else:
d[(y,x)]=1
if y+1<=h and (y+1,x) in d:
d[(y+... | def sol():
import sys
input=sys.stdin.readline
h,w,n=list(map(int,input().split()))
d={}
t=[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]
for i in range(n):
y,x=list(map(int,input().split()))
for a,b in t:
a+=y
b+=x
if 0<a<=... | 55 | 25 | 1,475 | 601 | def sol():
import sys
input = sys.stdin.readline
h, w, n = list(map(int, input().split()))
d = {}
for i in range(n):
y, x = list(map(int, input().split()))
if (y, x) in d:
d[(y, x)] += 1
else:
d[(y, x)] = 1
if y + 1 <= h and (y + 1, x) in d:
... | def sol():
import sys
input = sys.stdin.readline
h, w, n = list(map(int, input().split()))
d = {}
t = [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]
for i in range(n):
y, x = list(map(int, input().split()))
for a, b in t:
a += y
... | false | 54.545455 | [
"+ t = [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]",
"- if (y, x) in d:",
"- d[(y, x)] += 1",
"- else:",
"- d[(y, x)] = 1",
"- if y + 1 <= h and (y + 1, x) in d:",
"- d[(y + 1, x)] += 1",
"- elif y + 1 <= h:",... | false | 0.067012 | 0.038163 | 1.755947 | [
"s045441429",
"s638121950"
] |
u335830383 | p02993 | python | s384958935 | s377951929 | 163 | 18 | 38,384 | 2,940 | Accepted | Accepted | 88.96 | n = list(eval(input()))
flag = 1
for i in range(1,len(n)):
if n[i-1] == n[i]:
print("Bad")
flag = 0
break
if flag:
print("Good")
| s = eval(input())
last = s[0]
flag = 0
for i in s[1:]:
if i == last:
flag = 1
last = i
if flag:
print("Bad")
else:
print("Good") | 9 | 12 | 163 | 158 | n = list(eval(input()))
flag = 1
for i in range(1, len(n)):
if n[i - 1] == n[i]:
print("Bad")
flag = 0
break
if flag:
print("Good")
| s = eval(input())
last = s[0]
flag = 0
for i in s[1:]:
if i == last:
flag = 1
last = i
if flag:
print("Bad")
else:
print("Good")
| false | 25 | [
"-n = list(eval(input()))",
"-flag = 1",
"-for i in range(1, len(n)):",
"- if n[i - 1] == n[i]:",
"- print(\"Bad\")",
"- flag = 0",
"- break",
"+s = eval(input())",
"+last = s[0]",
"+flag = 0",
"+for i in s[1:]:",
"+ if i == last:",
"+ flag = 1",
"+ las... | false | 0.11645 | 0.036043 | 3.230872 | [
"s384958935",
"s377951929"
] |
u968166680 | p03600 | python | s696041557 | s959828399 | 494 | 426 | 42,588 | 42,332 | Accepted | Accepted | 13.77 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N = int(readline())
G = [list(map(int, readline().split())) for _ in range(N)]
ans = 0
for i in range(N):
for j in range(i + ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N = int(readline())
G = [list(map(int, readline().split())) for _ in range(N)]
ans = 0
for i in range(N):
for j in range(i + ... | 32 | 34 | 730 | 778 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N = int(readline())
G = [list(map(int, readline().split())) for _ in range(N)]
ans = 0
for i in range(N):
for j in range(i + 1, N):
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N = int(readline())
G = [list(map(int, readline().split())) for _ in range(N)]
ans = 0
for i in range(N):
for j in range(i + 1, N):
... | false | 5.882353 | [
"+ if k == i or k == j:",
"+ continue",
"- if k not in (i, j) and G[i][j] == G[i][k] + G[k][j]:",
"+ if G[i][j] == G[i][k] + G[k][j]:"
] | false | 0.040482 | 0.041933 | 0.965392 | [
"s696041557",
"s959828399"
] |
u354638986 | p03252 | python | s477787420 | s145656225 | 73 | 42 | 3,632 | 3,632 | Accepted | Accepted | 42.47 | def main():
s, t = eval(input()), eval(input())
s_dic, t_dic = {}, {}
for i, j in zip(s, t):
if i in s_dic and s_dic[i] != j:
print("No")
exit()
if j in t_dic and t_dic[j] != i:
print("No")
exit()
s_dic[i], t_dic[j] = j,... | def main():
s, t = eval(input()), eval(input())
used, dic = [0] * 512, {}
for i in range(26):
dic[chr(ord('a')+i)] = chr(ord('a')+i)
for i, j in zip(s, t):
if dic[i] == j:
used[ord(i)] = 1
continue
for k, v in list(dic.items()):
... | 20 | 30 | 375 | 629 | def main():
s, t = eval(input()), eval(input())
s_dic, t_dic = {}, {}
for i, j in zip(s, t):
if i in s_dic and s_dic[i] != j:
print("No")
exit()
if j in t_dic and t_dic[j] != i:
print("No")
exit()
s_dic[i], t_dic[j] = j, i
print("Ye... | def main():
s, t = eval(input()), eval(input())
used, dic = [0] * 512, {}
for i in range(26):
dic[chr(ord("a") + i)] = chr(ord("a") + i)
for i, j in zip(s, t):
if dic[i] == j:
used[ord(i)] = 1
continue
for k, v in list(dic.items()):
if v == j:
... | false | 33.333333 | [
"- s_dic, t_dic = {}, {}",
"+ used, dic = [0] * 512, {}",
"+ for i in range(26):",
"+ dic[chr(ord(\"a\") + i)] = chr(ord(\"a\") + i)",
"- if i in s_dic and s_dic[i] != j:",
"+ if dic[i] == j:",
"+ used[ord(i)] = 1",
"+ continue",
"+ for k, v... | false | 0.065451 | 0.045061 | 1.452491 | [
"s477787420",
"s145656225"
] |
u098012509 | p03854 | python | s665112913 | s625734973 | 38 | 24 | 3,956 | 3,188 | Accepted | Accepted | 36.84 | import sys
input = sys.stdin.readline
def main():
S = input().strip()
s = list(S)
n = len(s)
while n > 0:
if "".join(s[n - 5:n]) == "dream":
n -= 5
elif "".join(s[n - 5:n]) == "erase":
n -= 5
elif "".join(s[n - 7:n]) == "dreamer":
... | import sys
input = sys.stdin.readline
def main():
S = input().strip()
n = len(S)
while n > 0:
if S[n - 5:n] == "dream":
n -= 5
elif S[n - 5:n] == "erase":
n -= 5
elif S[n - 7:n] == "dreamer":
n -= 7
elif S[n - 6:n] == "era... | 29 | 28 | 540 | 487 | import sys
input = sys.stdin.readline
def main():
S = input().strip()
s = list(S)
n = len(s)
while n > 0:
if "".join(s[n - 5 : n]) == "dream":
n -= 5
elif "".join(s[n - 5 : n]) == "erase":
n -= 5
elif "".join(s[n - 7 : n]) == "dreamer":
n -=... | import sys
input = sys.stdin.readline
def main():
S = input().strip()
n = len(S)
while n > 0:
if S[n - 5 : n] == "dream":
n -= 5
elif S[n - 5 : n] == "erase":
n -= 5
elif S[n - 7 : n] == "dreamer":
n -= 7
elif S[n - 6 : n] == "eraser":
... | false | 3.448276 | [
"- s = list(S)",
"- n = len(s)",
"+ n = len(S)",
"- if \"\".join(s[n - 5 : n]) == \"dream\":",
"+ if S[n - 5 : n] == \"dream\":",
"- elif \"\".join(s[n - 5 : n]) == \"erase\":",
"+ elif S[n - 5 : n] == \"erase\":",
"- elif \"\".join(s[n - 7 : n]) == \"dreame... | false | 0.042972 | 0.036514 | 1.17686 | [
"s665112913",
"s625734973"
] |
u573754721 | p02910 | python | s235217336 | s806646293 | 181 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.61 | import sys
S = list(eval(input()))
odd = S[::2]
even = S[1::2]
flag = True
for i in odd:
if i == 'L':
flag = False
break
for j in even:
if j =='R':
flag = False
break
if flag:
print('Yes')
else:
print('No')
| s=eval(input())
for i in range(len(s)):
if i%2==0 and s[i]=='L':
print("No")
exit()
if i%2==1 and s[i]=='R':
print("No")
exit()
print('Yes')
| 23 | 10 | 312 | 206 | import sys
S = list(eval(input()))
odd = S[::2]
even = S[1::2]
flag = True
for i in odd:
if i == "L":
flag = False
break
for j in even:
if j == "R":
flag = False
break
if flag:
print("Yes")
else:
print("No")
| s = eval(input())
for i in range(len(s)):
if i % 2 == 0 and s[i] == "L":
print("No")
exit()
if i % 2 == 1 and s[i] == "R":
print("No")
exit()
print("Yes")
| false | 56.521739 | [
"-import sys",
"-",
"-S = list(eval(input()))",
"-odd = S[::2]",
"-even = S[1::2]",
"-flag = True",
"-for i in odd:",
"- if i == \"L\":",
"- flag = False",
"- break",
"-for j in even:",
"- if j == \"R\":",
"- flag = False",
"- break",
"-if flag:",
"- ... | false | 0.036909 | 0.041508 | 0.889188 | [
"s235217336",
"s806646293"
] |
u489959379 | p03026 | python | s653421160 | s601276216 | 66 | 61 | 18,236 | 22,304 | Accepted | Accepted | 7.58 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
res = 0
def resolve():
def dfs(v, p):
global res
c = C.pop(0)
T[v] = c
for u in edge[v]:
if u == p:
continue
else:
... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
res = 0
def resolve():
def dfs(v, p):
global res
c = C.pop(0)
T[v] = c
for u in edge[v]:
if u == p:
continue
else:
... | 42 | 37 | 896 | 763 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
res = 0
def resolve():
def dfs(v, p):
global res
c = C.pop(0)
T[v] = c
for u in edge[v]:
if u == p:
continue
else:
res +=... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
res = 0
def resolve():
def dfs(v, p):
global res
c = C.pop(0)
T[v] = c
for u in edge[v]:
if u == p:
continue
else:
res +=... | false | 11.904762 | [
"- cnt_edge = [0] * n",
"- cnt_edge[a - 1] += 1",
"- cnt_edge[b - 1] += 1",
"- start = cnt_edge.index(max(cnt_edge))",
"- dfs(start, -1)",
"+ dfs(0, -1)"
] | false | 0.065788 | 0.038841 | 1.693776 | [
"s653421160",
"s601276216"
] |
u498487134 | p02768 | python | s548630180 | s500065852 | 187 | 148 | 38,512 | 107,444 | Accepted | Accepted | 20.86 | n,a,b=list(map(int,input().split()))
mod=10**9+7
def cmb(n, r,mod):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
#X//Y
X=1
Y=1
for i in range(r):
X*=(n-i)
X%=mod
Y*=(i+1)
Y%=mod
inv=pow(Y,mod-2,mod)
retur... | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,a,b=MI()
M=2*(10**5) + 5
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: r... | 29 | 42 | 449 | 1,020 | n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
def cmb(n, r, mod):
if n - r < r:
r = n - r
if r == 0:
return 1
if r == 1:
return n
# X//Y
X = 1
Y = 1
for i in range(r):
X *= n - i
X %= mod
Y *= i + 1
Y %= mod
inv = pow(... | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N, a, b = MI()
M = 2 * (10**5) + 5
def cmb(n, r):
if n - r < r:
... | false | 30.952381 | [
"-n, a, b = list(map(int, input().split()))",
"-mod = 10**9 + 7",
"+import sys",
"+",
"+input = sys.stdin.readline",
"-def cmb(n, r, mod):",
"- if n - r < r:",
"- r = n - r",
"- if r == 0:",
"- return 1",
"- if r == 1:",
"- return n",
"- # X//Y",
"- X = ... | false | 0.207615 | 0.498484 | 0.416493 | [
"s548630180",
"s500065852"
] |
u367701763 | p02793 | python | s324628200 | s077985756 | 232 | 174 | 78,756 | 148,436 | Accepted | Accepted | 25 | from collections import Counter, defaultdict
# 拡張ユークリッド互除法
# ax + by = gcd(a,b)の最小整数解を返す
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y)
# mを法とするaの乗法的逆元
def modinv(a, m):
g, x, y = egcd(a, m)
if g != 1:
... | import sys
input = sys.stdin.readline
from collections import defaultdict
class PrimeFactor():
def __init__(self, n): # エラトステネス O(N loglog N)
self.n = n
self.table = [i if i % 2 else 2 for i in range(n + 1)]
self.table[0] = 0
for p in range(3, n + 1):
... | 66 | 77 | 1,231 | 2,208 | from collections import Counter, defaultdict
# 拡張ユークリッド互除法
# ax + by = gcd(a,b)の最小整数解を返す
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y)
# mを法とするaの乗法的逆元
def modinv(a, m):
g, x, y = egcd(a, m)
if g != 1:
raise E... | import sys
input = sys.stdin.readline
from collections import defaultdict
class PrimeFactor:
def __init__(self, n): # エラトステネス O(N loglog N)
self.n = n
self.table = [i if i % 2 else 2 for i in range(n + 1)]
self.table[0] = 0
for p in range(3, n + 1):
if self.table[p] =... | false | 14.285714 | [
"-from collections import Counter, defaultdict",
"+import sys",
"-# 拡張ユークリッド互除法",
"-# ax + by = gcd(a,b)の最小整数解を返す",
"-def egcd(a, b):",
"- if a == 0:",
"- return (b, 0, 1)",
"- else:",
"- g, y, x = egcd(b % a, a)",
"- return (g, x - (b // a) * y, y)",
"+input = sys.std... | false | 0.046654 | 1.291252 | 0.036131 | [
"s324628200",
"s077985756"
] |
u540761833 | p02948 | python | s573769164 | s654353342 | 498 | 355 | 23,752 | 23,752 | Accepted | Accepted | 28.71 | import heapq
N,M = list(map(int,input().split()))
AB = [[] for i in range(M+1)]
for i in range(N):
a,b = list(map(int,input().split()))
if a <= M:
AB[a].append(-b)
work = 0
AB2 = []
heapq.heapify(AB2)
for i in range(1,M+1):
for j in AB[i]:
heapq.heappush(AB2,j)
if len(AB2) >... | import sys
import heapq
input = sys.stdin.readline
N,M = list(map(int,input().split()))
AB = [[] for i in range(M+1)]
for i in range(N):
a,b = list(map(int,input().split()))
if a <= M:
AB[a].append(-b)
work = 0
AB2 = []
heapq.heapify(AB2)
for i in range(1,M+1):
for j in AB[i]:
... | 17 | 19 | 382 | 422 | import heapq
N, M = list(map(int, input().split()))
AB = [[] for i in range(M + 1)]
for i in range(N):
a, b = list(map(int, input().split()))
if a <= M:
AB[a].append(-b)
work = 0
AB2 = []
heapq.heapify(AB2)
for i in range(1, M + 1):
for j in AB[i]:
heapq.heappush(AB2, j)
if len(AB2) > 0... | import sys
import heapq
input = sys.stdin.readline
N, M = list(map(int, input().split()))
AB = [[] for i in range(M + 1)]
for i in range(N):
a, b = list(map(int, input().split()))
if a <= M:
AB[a].append(-b)
work = 0
AB2 = []
heapq.heapify(AB2)
for i in range(1, M + 1):
for j in AB[i]:
heap... | false | 10.526316 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.129693 | 0.087813 | 1.476916 | [
"s573769164",
"s654353342"
] |
u891635666 | p03283 | python | s660778449 | s225746665 | 1,203 | 506 | 60,380 | 54,748 | Accepted | Accepted | 57.94 | import itertools
import sys
input = sys.stdin.readline
n, m, q = list(map(int, input().split()))
ls = [[0] * n for _ in range(n)]
for _ in range(m):
l, r = list(map(int, input().split()))
ls[l - 1][r - l] += 1
for i in range(n):
ls[i] = list(itertools.accumulate(ls[i]))
for _ in range(q):
... | import sys
input = sys.stdin.readline
n, m, q = list(map(int, input().split()))
ls = [[0] * (n + 1) for _ in range(n + 1)]
for _ in range(m):
l, r = list(map(int, input().split()))
ls[l][r] += 1
for i in range(1, n + 1):
for j in range(1, n + 1):
ls[i][j] += ls[i - 1][j] + ls[i][j - 1] ... | 20 | 15 | 463 | 454 | import itertools
import sys
input = sys.stdin.readline
n, m, q = list(map(int, input().split()))
ls = [[0] * n for _ in range(n)]
for _ in range(m):
l, r = list(map(int, input().split()))
ls[l - 1][r - l] += 1
for i in range(n):
ls[i] = list(itertools.accumulate(ls[i]))
for _ in range(q):
l, r = list(m... | import sys
input = sys.stdin.readline
n, m, q = list(map(int, input().split()))
ls = [[0] * (n + 1) for _ in range(n + 1)]
for _ in range(m):
l, r = list(map(int, input().split()))
ls[l][r] += 1
for i in range(1, n + 1):
for j in range(1, n + 1):
ls[i][j] += ls[i - 1][j] + ls[i][j - 1] - ls[i - 1][... | false | 25 | [
"-import itertools",
"-ls = [[0] * n for _ in range(n)]",
"+ls = [[0] * (n + 1) for _ in range(n + 1)]",
"- ls[l - 1][r - l] += 1",
"-for i in range(n):",
"- ls[i] = list(itertools.accumulate(ls[i]))",
"+ ls[l][r] += 1",
"+for i in range(1, n + 1):",
"+ for j in range(1, n + 1):",
"+ ... | false | 0.041945 | 0.041023 | 1.022482 | [
"s660778449",
"s225746665"
] |
u133936772 | p02936 | python | s430626963 | s260991310 | 1,488 | 1,198 | 283,156 | 56,284 | Accepted | Accepted | 19.49 | import sys
sys.setrecursionlimit(10**6)
f=lambda:list(map(int,input().split()))
n,k=f()
g=[[] for _ in range(n)]
for i in range(n-1):
a,b=f()
g[a-1]+=[b-1]
g[b-1]+=[a-1]
l=[0]*n
for _ in range(k):
p,x=f()
l[p-1]+=x
def dfs(v,p=-1):
for c in g[v]:
if c==p: continue
l[c]+=l[v]
dfs... | f=lambda:list(map(int,input().split()))
n,k=f()
g=[[] for _ in range(n)]
for _ in range(n-1):
a,b=f()
g[a-1]+=[b-1]
g[b-1]+=[a-1]
l=[0]*n
for _ in range(k):
p,x=f()
l[p-1]+=x
u=[0]*n
q=[0]
while q:
v=q.pop()
u[v]=1
for c in g[v]:
if u[c]: continue
l[c]+=l[v]
q+=[c]
print(... | 20 | 21 | 338 | 317 | import sys
sys.setrecursionlimit(10**6)
f = lambda: list(map(int, input().split()))
n, k = f()
g = [[] for _ in range(n)]
for i in range(n - 1):
a, b = f()
g[a - 1] += [b - 1]
g[b - 1] += [a - 1]
l = [0] * n
for _ in range(k):
p, x = f()
l[p - 1] += x
def dfs(v, p=-1):
for c in g[v]:
... | f = lambda: list(map(int, input().split()))
n, k = f()
g = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = f()
g[a - 1] += [b - 1]
g[b - 1] += [a - 1]
l = [0] * n
for _ in range(k):
p, x = f()
l[p - 1] += x
u = [0] * n
q = [0]
while q:
v = q.pop()
u[v] = 1
for c in g[v]:
if ... | false | 4.761905 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"-for i in range(n - 1):",
"+for _ in range(n - 1):",
"-",
"-",
"-def dfs(v, p=-1):",
"+u = [0] * n",
"+q = [0]",
"+while q:",
"+ v = q.pop()",
"+ u[v] = 1",
"- if c == p:",
"+ if u[c]:",
"- dfs(c, v)",
"... | false | 0.043887 | 0.037453 | 1.171779 | [
"s430626963",
"s260991310"
] |
u371763408 | p03240 | python | s838218136 | s359624022 | 445 | 409 | 3,064 | 3,064 | Accepted | Accepted | 8.09 | N = int(eval(input()))
x, y, h = [0]*N, [0]*N, [0]*N
for i in range(N):
x[i], y[i], h[i] = list(map(int, input().split()))
for cx in range(0, 101):
for cy in range(0, 101):
for i in range(N):
if h[i] > 0:
H = h[i] + abs(x[i]-cx)+abs(y[i]-cy)
for i... | n = int(eval(input()))
xs = []
ys = []
hs = []
for i in range(n):
x,y,h = list(map(int,input().split()))
xs.append(x)
ys.append(y)
hs.append(h)
for x in range(101):
for y in range(101):
for i in range(n):
if hs[i] >0:
H = hs[i] + abs(xs[i]-x)+abs(ys[i]-y)
for i in range... | 17 | 22 | 470 | 428 | N = int(eval(input()))
x, y, h = [0] * N, [0] * N, [0] * N
for i in range(N):
x[i], y[i], h[i] = list(map(int, input().split()))
for cx in range(0, 101):
for cy in range(0, 101):
for i in range(N):
if h[i] > 0:
H = h[i] + abs(x[i] - cx) + abs(y[i] - cy)
for i in range... | n = int(eval(input()))
xs = []
ys = []
hs = []
for i in range(n):
x, y, h = list(map(int, input().split()))
xs.append(x)
ys.append(y)
hs.append(h)
for x in range(101):
for y in range(101):
for i in range(n):
if hs[i] > 0:
H = hs[i] + abs(xs[i] - x) + abs(ys[i] - y... | false | 22.727273 | [
"-N = int(eval(input()))",
"-x, y, h = [0] * N, [0] * N, [0] * N",
"-for i in range(N):",
"- x[i], y[i], h[i] = list(map(int, input().split()))",
"-for cx in range(0, 101):",
"- for cy in range(0, 101):",
"- for i in range(N):",
"- if h[i] > 0:",
"- H = h[i] + ... | false | 0.042506 | 0.041039 | 1.035761 | [
"s838218136",
"s359624022"
] |
u077291787 | p02558 | python | s195943610 | s796522838 | 255 | 219 | 84,944 | 83,928 | Accepted | Accepted | 14.12 | from typing import List
class UnionFind:
"""Union Find (Disjoint Set): O(α(N))
References:
https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp
https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html
"""
__slots__ = ["_data_size", "_roots"]
... | class UnionFind:
"""Union Find (Disjoint Set): O(α(N))
References:
https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp
https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html
"""
__slots__ = ["_data_size", "_roots"]
def __init__(self, data_s... | 64 | 48 | 1,940 | 1,451 | from typing import List
class UnionFind:
"""Union Find (Disjoint Set): O(α(N))
References:
https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp
https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html
"""
__slots__ = ["_data_size", "_roots"]
def __in... | class UnionFind:
"""Union Find (Disjoint Set): O(α(N))
References:
https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp
https://tumoiyorozu.github.io/single-file-ac-library/document_en/dsu.html
"""
__slots__ = ["_data_size", "_roots"]
def __init__(self, data_size: int)... | false | 25 | [
"-from typing import List",
"-",
"-",
"- def __len__(self) -> int:",
"- \"\"\"Count the number of groups (roots).\"\"\"",
"- return len(self.groups)",
"-",
"- @property",
"- def groups(self) -> List[int]:",
"- \"\"\"Return the set of groups (roots) in O(n).\"\"\"",
... | false | 0.069852 | 0.057357 | 1.217849 | [
"s195943610",
"s796522838"
] |
u509661905 | p03837 | python | s580895703 | s008429047 | 346 | 270 | 44,396 | 41,584 | Accepted | Accepted | 21.97 | #!/usr/bin/env pypy3
import collections
import itertools
INF = 10 ** 8
UNDEF = -1
def floyd_warshall_undirected(num_vs, edges):
n = num_vs
dist = [[INF for _ in range(n)] for _ in range(n)]
pred = [[UNDEF for _ in range(n)] for _ in range(n)]
for u in range(n):
dist[u][u] = 0... | #!/usr/bin/env pypy3
import collections
import itertools
INF = 10 ** 8
UNDEF = -1
def floyd_warshall(num_vs, edges):
n = num_vs
dist = [[INF for _ in range(n)] for _ in range(n)]
for u in range(n):
dist[u][u] = 0
for (u, v), c in list(edges.items()):
dist[u][v] = c
... | 62 | 46 | 1,563 | 1,005 | #!/usr/bin/env pypy3
import collections
import itertools
INF = 10**8
UNDEF = -1
def floyd_warshall_undirected(num_vs, edges):
n = num_vs
dist = [[INF for _ in range(n)] for _ in range(n)]
pred = [[UNDEF for _ in range(n)] for _ in range(n)]
for u in range(n):
dist[u][u] = 0
for (u, v), c ... | #!/usr/bin/env pypy3
import collections
import itertools
INF = 10**8
UNDEF = -1
def floyd_warshall(num_vs, edges):
n = num_vs
dist = [[INF for _ in range(n)] for _ in range(n)]
for u in range(n):
dist[u][u] = 0
for (u, v), c in list(edges.items()):
dist[u][v] = c
for t, u, v in it... | false | 25.806452 | [
"-def floyd_warshall_undirected(num_vs, edges):",
"+def floyd_warshall(num_vs, edges):",
"- pred = [[UNDEF for _ in range(n)] for _ in range(n)]",
"- dist[v][u] = c",
"- pred[u][v] = u",
"- pred[v][u] = v",
"- pred[u][v] = pred[t][v]",
"- return dist, pred",
"-"... | false | 0.039949 | 0.064394 | 0.620382 | [
"s580895703",
"s008429047"
] |
u731291894 | p03645 | python | s561779373 | s795735422 | 1,450 | 920 | 42,676 | 38,544 | Accepted | Accepted | 36.55 | # coding: utf-8
from queue import Queue
N, M = tuple(map(int, input().split()))
graph = [ [] for i in range(N+1)]
for i in range(M):
a, b = tuple(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
def is_reach(n):
dist = [0 for i in range(N+1)]
is_visit = [False for i i... | # coding: utf-8
N, M = tuple(map(int, input().split()))
graph = [ [] for i in range(N+1)]
for i in range(M):
a, b = tuple(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
res = "IMPOSSIBLE"
for i in range(2, N):
if 1 in graph[i] and N in graph[i]:
res = "POSSIBLE"... | 31 | 16 | 815 | 335 | # coding: utf-8
from queue import Queue
N, M = tuple(map(int, input().split()))
graph = [[] for i in range(N + 1)]
for i in range(M):
a, b = tuple(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
def is_reach(n):
dist = [0 for i in range(N + 1)]
is_visit = [False for i in range(N ... | # coding: utf-8
N, M = tuple(map(int, input().split()))
graph = [[] for i in range(N + 1)]
for i in range(M):
a, b = tuple(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
res = "IMPOSSIBLE"
for i in range(2, N):
if 1 in graph[i] and N in graph[i]:
res = "POSSIBLE"
print(res)
| false | 48.387097 | [
"-from queue import Queue",
"-",
"-",
"-",
"-def is_reach(n):",
"- dist = [0 for i in range(N + 1)]",
"- is_visit = [False for i in range(N + 1)]",
"- is_visit[1] = True",
"- q = Queue()",
"- q.put(1)",
"- while not q.empty():",
"- v = q.get()",
"- for u in gr... | false | 0.048967 | 0.046072 | 1.062852 | [
"s561779373",
"s795735422"
] |
u729972685 | p03166 | python | s882541278 | s760937979 | 1,114 | 733 | 155,140 | 116,444 | Accepted | Accepted | 34.2 | from sys import stdin, setrecursionlimit
from collections import defaultdict
input = stdin.readline
setrecursionlimit(200000)
N, M = list(map(int, input().split()))
# d = [0] * (N + 1)
adj = defaultdict(set)
for _ in range(M):
x, y = list(map(int, input().split()))
adj[x].add(y)
# d[y] += 1
dp ... | from sys import stdin, setrecursionlimit
from collections import defaultdict
input = stdin.readline
setrecursionlimit(200000)
N, M = list(map(int, input().split()))
# d = [0] * (N + 1)
adj = defaultdict(list)
for _ in range(M):
x, y = list(map(int, input().split()))
adj[x].append(y)
# d[y] += 1
... | 26 | 26 | 568 | 572 | from sys import stdin, setrecursionlimit
from collections import defaultdict
input = stdin.readline
setrecursionlimit(200000)
N, M = list(map(int, input().split()))
# d = [0] * (N + 1)
adj = defaultdict(set)
for _ in range(M):
x, y = list(map(int, input().split()))
adj[x].add(y)
# d[y] += 1
dp = [-1] * (N ... | from sys import stdin, setrecursionlimit
from collections import defaultdict
input = stdin.readline
setrecursionlimit(200000)
N, M = list(map(int, input().split()))
# d = [0] * (N + 1)
adj = defaultdict(list)
for _ in range(M):
x, y = list(map(int, input().split()))
adj[x].append(y)
# d[y] += 1
dp = [-1] *... | false | 0 | [
"-adj = defaultdict(set)",
"+adj = defaultdict(list)",
"- adj[x].add(y)",
"+ adj[x].append(y)"
] | false | 0.041174 | 0.062631 | 0.657403 | [
"s882541278",
"s760937979"
] |
u164727245 | p02598 | python | s157939991 | s965392114 | 240 | 190 | 50,932 | 51,204 | Accepted | Accepted | 20.83 | # coding: utf-8
import numpy as np
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = np.array(tuple(map(int, args[1].split())))
l, r = 0, np.max(A)
while l+1 < r:
m = (l+r)//2
if k < np.sum(-(-A//m)-1):
l = m
else:
r... | # coding: utf-8
import numpy as np
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = np.array(tuple(map(int, args[1].split())))
l, r = 0, np.max(A)
while l+1 < r:
m = (l+r)//2
if k < np.sum(np.ceil(A/m)-1):
l = m
else:
... | 21 | 21 | 422 | 426 | # coding: utf-8
import numpy as np
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = np.array(tuple(map(int, args[1].split())))
l, r = 0, np.max(A)
while l + 1 < r:
m = (l + r) // 2
if k < np.sum(-(-A // m) - 1):
l = m
else:
r = m
... | # coding: utf-8
import numpy as np
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = np.array(tuple(map(int, args[1].split())))
l, r = 0, np.max(A)
while l + 1 < r:
m = (l + r) // 2
if k < np.sum(np.ceil(A / m) - 1):
l = m
else:
r ... | false | 0 | [
"- if k < np.sum(-(-A // m) - 1):",
"+ if k < np.sum(np.ceil(A / m) - 1):"
] | false | 0.191433 | 0.767014 | 0.249582 | [
"s157939991",
"s965392114"
] |
u983918956 | p03111 | python | s980375689 | s096150854 | 236 | 67 | 3,188 | 3,064 | Accepted | Accepted | 71.61 | import itertools
N,A,B,C = list(map(int,input().split()))
l = [int(eval(input())) for i in range(N)]
inf = float('inf')
ans = inf
for pair in itertools.product(list(range(4)),repeat=N):
mA = 0 ; mB = 0; mC = 0; cnt = 0
for i in range(N):
if pair[i] == 1:
mA += l[i]
cnt ... | N,A,B,C = list(map(int,input().split()))
l = [int(eval(input())) for i in range(N)]
inf = float('inf')
def dfs(depth=0, a=0, b=0, c=0):
if depth == N:
if a*b*c != 0:
return abs(a-A) + abs(b-B) + abs(c-C) - 30
return inf
res0 = dfs(depth+1,a,b,c)
res1 = dfs(depth+1,a+l[... | 22 | 16 | 596 | 469 | import itertools
N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
inf = float("inf")
ans = inf
for pair in itertools.product(list(range(4)), repeat=N):
mA = 0
mB = 0
mC = 0
cnt = 0
for i in range(N):
if pair[i] == 1:
mA += l[i]
... | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
inf = float("inf")
def dfs(depth=0, a=0, b=0, c=0):
if depth == N:
if a * b * c != 0:
return abs(a - A) + abs(b - B) + abs(c - C) - 30
return inf
res0 = dfs(depth + 1, a, b, c)
res1 = dfs(de... | false | 27.272727 | [
"-import itertools",
"-",
"-ans = inf",
"-for pair in itertools.product(list(range(4)), repeat=N):",
"- mA = 0",
"- mB = 0",
"- mC = 0",
"- cnt = 0",
"- for i in range(N):",
"- if pair[i] == 1:",
"- mA += l[i]",
"- cnt += 1",
"- elif pair[i]... | false | 0.262571 | 0.056803 | 4.622488 | [
"s980375689",
"s096150854"
] |
u561083515 | p02775 | python | s449840390 | s168363148 | 585 | 479 | 20,452 | 20,452 | Accepted | Accepted | 18.12 | import sys
input = sys.stdin.readline
# たこ焼き器の価値
N = [0] + list(map(int, tuple(input().rstrip("\n"))))
# 支払額
Ncopy = N.copy()
def main():
# 紙幣の枚数
ans = 0
# 繰り上げ発生時に変更
flag = False
for i in range(len(N)-1, 0, -1):
# 繰り上げしない場合
if (Ncopy[i] <= 4) or (Ncopy[i] == 5 and... | #!/usr/bin/env python3
import sys
input = sys.stdin.readline
def main():
N = [0] + list(map(int, tuple(input().rstrip("\n"))))
Ncopy = N.copy()
ans = 0
flag = False
for i in range(len(N)-1, 0, -1):
if (Ncopy[i] <= 4) or (Ncopy[i] == 5 and N[i-1] <= 4):
ans += Ncopy[... | 36 | 30 | 719 | 659 | import sys
input = sys.stdin.readline
# たこ焼き器の価値
N = [0] + list(map(int, tuple(input().rstrip("\n"))))
# 支払額
Ncopy = N.copy()
def main():
# 紙幣の枚数
ans = 0
# 繰り上げ発生時に変更
flag = False
for i in range(len(N) - 1, 0, -1):
# 繰り上げしない場合
if (Ncopy[i] <= 4) or (Ncopy[i] == 5 and N[i - 1] <= 4... | #!/usr/bin/env python3
import sys
input = sys.stdin.readline
def main():
N = [0] + list(map(int, tuple(input().rstrip("\n"))))
Ncopy = N.copy()
ans = 0
flag = False
for i in range(len(N) - 1, 0, -1):
if (Ncopy[i] <= 4) or (Ncopy[i] == 5 and N[i - 1] <= 4):
ans += Ncopy[i]
... | false | 16.666667 | [
"+#!/usr/bin/env python3",
"-# たこ焼き器の価値",
"-N = [0] + list(map(int, tuple(input().rstrip(\"\\n\"))))",
"-# 支払額",
"-Ncopy = N.copy()",
"- # 紙幣の枚数",
"+ N = [0] + list(map(int, tuple(input().rstrip(\"\\n\"))))",
"+ Ncopy = N.copy()",
"- # 繰り上げ発生時に変更",
"- # 繰り上げしない場合",
"- #... | false | 0.037396 | 0.068809 | 0.543472 | [
"s449840390",
"s168363148"
] |
u645855527 | p02959 | python | s510122268 | s472224428 | 277 | 105 | 81,892 | 97,720 | Accepted | Accepted | 62.09 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
total = 0
for i in range(n):
if b[i] > a[i]:
total += a[i]
if b[i]-a[i] > a[i+1]:
total += a[i+1]
a[i+1] = 0
else:
total += b[i] - a[i]
... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
carry = 0
for a, b in zip(A, B):
a2 = max(0, a - carry)
if a2 < b:
ans += a
carry = b - a2
else:
ans += carry + b
carry = 0
ans += min(carry, A[-1])
prin... | 17 | 18 | 384 | 320 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
total = 0
for i in range(n):
if b[i] > a[i]:
total += a[i]
if b[i] - a[i] > a[i + 1]:
total += a[i + 1]
a[i + 1] = 0
else:
total += b[i] - a[i]
a[i +... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
carry = 0
for a, b in zip(A, B):
a2 = max(0, a - carry)
if a2 < b:
ans += a
carry = b - a2
else:
ans += carry + b
carry = 0
ans += min(carry, A[-1])
print(ans)
| false | 5.555556 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-total = 0",
"-for i in range(n):",
"- if b[i] > a[i]:",
"- total += a[i]",
"- if b[i] - a[i] > a[i + 1]:",
"- total += a[i + 1]",
"- a[i + 1] = 0",
... | false | 0.043285 | 0.035973 | 1.203262 | [
"s510122268",
"s472224428"
] |
u987164499 | p02767 | python | s073400871 | s234292587 | 23 | 21 | 2,940 | 3,064 | Accepted | Accepted | 8.7 | from sys import stdin
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
mi = 10**10
for i in range(100):
point = 0
for j in li:
point += (j-i)**2
mi = min(mi,point)
print(mi) | N = int(eval(input()))
X = list(map(int,input().split()))
min_power = 10**10
#どこの座標で集会をするか
for i in range(1,101):
power = 0
for j in X:
power += (j-i)**2
min_power = min(min_power,power)
print(min_power) | 10 | 13 | 242 | 232 | from sys import stdin
n = int(stdin.readline().rstrip())
li = list(map(int, stdin.readline().rstrip().split()))
mi = 10**10
for i in range(100):
point = 0
for j in li:
point += (j - i) ** 2
mi = min(mi, point)
print(mi)
| N = int(eval(input()))
X = list(map(int, input().split()))
min_power = 10**10
# どこの座標で集会をするか
for i in range(1, 101):
power = 0
for j in X:
power += (j - i) ** 2
min_power = min(min_power, power)
print(min_power)
| false | 23.076923 | [
"-from sys import stdin",
"-",
"-n = int(stdin.readline().rstrip())",
"-li = list(map(int, stdin.readline().rstrip().split()))",
"-mi = 10**10",
"-for i in range(100):",
"- point = 0",
"- for j in li:",
"- point += (j - i) ** 2",
"- mi = min(mi, point)",
"-print(mi)",
"+N = int... | false | 0.04244 | 0.043724 | 0.97063 | [
"s073400871",
"s234292587"
] |
u038404105 | p02684 | python | s004058094 | s131220017 | 149 | 133 | 32,400 | 32,328 | Accepted | Accepted | 10.74 | import sys
readline = sys.stdin.buffer.readline
def main():
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
now=1
flg = 0
path = [1]
pathcheck ={1}
while True:
now = a[now-1]
flg = flg + 1
if now in pathcheck:
fl... | import sys
readline = sys.stdin.buffer.readline
def main():
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
now=1
flg = 0
path = [1]
pathcheck ={1}
for i in range(min(k,n)):
now = a[now-1]
if now in pathcheck:
flg = -1
... | 35 | 32 | 663 | 613 | import sys
readline = sys.stdin.buffer.readline
def main():
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
now = 1
flg = 0
path = [1]
pathcheck = {1}
while True:
now = a[now - 1]
flg = flg + 1
if now in pathcheck:
flg = -1
... | import sys
readline = sys.stdin.buffer.readline
def main():
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
now = 1
flg = 0
path = [1]
pathcheck = {1}
for i in range(min(k, n)):
now = a[now - 1]
if now in pathcheck:
flg = -1
... | false | 8.571429 | [
"- while True:",
"+ for i in range(min(k, n)):",
"- flg = flg + 1",
"- if flg == k:",
"- break",
"- if flg == k:",
"+ if flg == 0:"
] | false | 0.083525 | 0.088102 | 0.948057 | [
"s004058094",
"s131220017"
] |
u227082700 | p03354 | python | s383193515 | s854271486 | 694 | 569 | 14,008 | 14,008 | Accepted | Accepted | 18.01 | n,m=list(map(int,input().split()))
p=list(map(int,input().split()))
ans=0
import sys;sys.setrecursionlimit(10**9)
class u():#UnionFind f-根探し u-連結 s-連結? c-要素数
def __init__(self,n):self.n,self.r=[-1]*n,[0]*n
def f(self,x):
if self.n[x]<0:return x
else:self.n[x]=self.f(self.n[x]);return self.n[x]
de... | n,m=list(map(int,input().split()));p=list(map(int,input().split()));z=0;import sys;sys.setrecursionlimit(10**9);f=[i for i in range(n)]
def r(f,x):
if f[x]!=x:f[x]=r(f,f[x])
return f[x]
def u(f,a,b):
x,y=r(f,a),r(f,b)
if x!=y:f[x]=y
for i in range(m):a,b=list(map(int,input().split()));u(f,a-1,b-1)
for i... | 22 | 10 | 681 | 353 | n, m = list(map(int, input().split()))
p = list(map(int, input().split()))
ans = 0
import sys
sys.setrecursionlimit(10**9)
class u: # UnionFind f-根探し u-連結 s-連結? c-要素数
def __init__(self, n):
self.n, self.r = [-1] * n, [0] * n
def f(self, x):
if self.n[x] < 0:
return x
els... | n, m = list(map(int, input().split()))
p = list(map(int, input().split()))
z = 0
import sys
sys.setrecursionlimit(10**9)
f = [i for i in range(n)]
def r(f, x):
if f[x] != x:
f[x] = r(f, f[x])
return f[x]
def u(f, a, b):
x, y = r(f, a), r(f, b)
if x != y:
f[x] = y
for i in range(m)... | false | 54.545455 | [
"-ans = 0",
"+z = 0",
"+f = [i for i in range(n)]",
"-class u: # UnionFind f-根探し u-連結 s-連結? c-要素数",
"- def __init__(self, n):",
"- self.n, self.r = [-1] * n, [0] * n",
"-",
"- def f(self, x):",
"- if self.n[x] < 0:",
"- return x",
"- else:",
"- ... | false | 0.047956 | 0.047976 | 0.999585 | [
"s383193515",
"s854271486"
] |
u252828980 | p02836 | python | s053336288 | s876455104 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | s = eval(input())
cnt = 0
for i in range(1,len(s)//2+1):
if s[i-1] != s[-i]:
#print(s[i-1],s[-i])
cnt += 1
print(cnt) | s = eval(input())
cnt = 0
for i in range(len(s)//2):
if s[i] != s[-(i+1)]:
cnt +=1
print(cnt) | 7 | 6 | 137 | 98 | s = eval(input())
cnt = 0
for i in range(1, len(s) // 2 + 1):
if s[i - 1] != s[-i]:
# print(s[i-1],s[-i])
cnt += 1
print(cnt)
| s = eval(input())
cnt = 0
for i in range(len(s) // 2):
if s[i] != s[-(i + 1)]:
cnt += 1
print(cnt)
| false | 14.285714 | [
"-for i in range(1, len(s) // 2 + 1):",
"- if s[i - 1] != s[-i]:",
"- # print(s[i-1],s[-i])",
"+for i in range(len(s) // 2):",
"+ if s[i] != s[-(i + 1)]:"
] | false | 0.048108 | 0.047631 | 1.010014 | [
"s053336288",
"s876455104"
] |
u347640436 | p02603 | python | s427772168 | s054299588 | 34 | 31 | 9,016 | 9,176 | Accepted | Accepted | 8.82 | N = int(eval(input()))
A = list(map(int, input().split()))
t = [-1] * (N + 1)
t[0] = 1000
for i in range(N):
t[i + 1] = max(t[i + 1], t[i])
k = t[i] // A[i]
y = t[i] % A[i]
for j in range(i + 1, N):
t[j + 1] = max(t[j + 1], k * A[j] + y)
print((t[N]))
| N = int(eval(input()))
A = list(map(int, input().split()))
t = [-1] * (N + 1)
t[0] = 1000
for i in range(N):
k = t[i] // A[i]
y = t[i] % A[i]
for j in range(i, N):
t[j + 1] = max(t[j + 1], k * A[j] + y)
print((t[N]))
| 12 | 11 | 280 | 240 | N = int(eval(input()))
A = list(map(int, input().split()))
t = [-1] * (N + 1)
t[0] = 1000
for i in range(N):
t[i + 1] = max(t[i + 1], t[i])
k = t[i] // A[i]
y = t[i] % A[i]
for j in range(i + 1, N):
t[j + 1] = max(t[j + 1], k * A[j] + y)
print((t[N]))
| N = int(eval(input()))
A = list(map(int, input().split()))
t = [-1] * (N + 1)
t[0] = 1000
for i in range(N):
k = t[i] // A[i]
y = t[i] % A[i]
for j in range(i, N):
t[j + 1] = max(t[j + 1], k * A[j] + y)
print((t[N]))
| false | 8.333333 | [
"- t[i + 1] = max(t[i + 1], t[i])",
"- for j in range(i + 1, N):",
"+ for j in range(i, N):"
] | false | 0.038946 | 0.047206 | 0.825021 | [
"s427772168",
"s054299588"
] |
u614181788 | p02573 | python | s284025149 | s087465061 | 777 | 567 | 14,736 | 107,228 | Accepted | Accepted | 27.03 | #UnionFind
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(s... | from collections import deque
n,m = list(map(int,input().split()))
V = [[] for i in range(n+1)]
for i in range(m):
a,b = list(map(int,input().split()))
V[a].append(b)
V[b].append(a)
reach = [0]*(n+1)
ans = 0
for i in range(1,n+1):
if reach[i] != 0:
pass
else:
q = d... | 60 | 30 | 1,419 | 672 | # UnionFind
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | from collections import deque
n, m = list(map(int, input().split()))
V = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
V[a].append(b)
V[b].append(a)
reach = [0] * (n + 1)
ans = 0
for i in range(1, n + 1):
if reach[i] != 0:
pass
else:
q = deque(... | false | 50 | [
"-# UnionFind",
"-class UnionFind:",
"- def __init__(self, n):",
"- self.n = n",
"- self.parents = [-1] * n",
"-",
"- def find(self, x):",
"- if self.parents[x] < 0:",
"- return x",
"- else:",
"- self.parents[x] = self.find(self.parents[x])... | false | 0.034965 | 0.035582 | 0.982649 | [
"s284025149",
"s087465061"
] |
u094191970 | p02795 | python | s635895371 | s972490946 | 27 | 17 | 3,316 | 2,940 | Accepted | Accepted | 37.04 | h=int(eval(input()))
w=int(eval(input()))
n=int(eval(input()))
if w>=h:
if n%w==0:
print((n//w))
else:
print((n//w+1))
else:
if n%h==0:
print((n//h))
else:
print((n//h+1)) | h=int(eval(input()))
w=int(eval(input()))
n=int(eval(input()))
mx=max(h,w)
if n%mx==0:
print((n//mx))
else:
print((n//mx+1)) | 14 | 8 | 171 | 111 | h = int(eval(input()))
w = int(eval(input()))
n = int(eval(input()))
if w >= h:
if n % w == 0:
print((n // w))
else:
print((n // w + 1))
else:
if n % h == 0:
print((n // h))
else:
print((n // h + 1))
| h = int(eval(input()))
w = int(eval(input()))
n = int(eval(input()))
mx = max(h, w)
if n % mx == 0:
print((n // mx))
else:
print((n // mx + 1))
| false | 42.857143 | [
"-if w >= h:",
"- if n % w == 0:",
"- print((n // w))",
"- else:",
"- print((n // w + 1))",
"+mx = max(h, w)",
"+if n % mx == 0:",
"+ print((n // mx))",
"- if n % h == 0:",
"- print((n // h))",
"- else:",
"- print((n // h + 1))",
"+ print((n // m... | false | 0.036184 | 0.037145 | 0.974119 | [
"s635895371",
"s972490946"
] |
u506858457 | p02873 | python | s661329394 | s851944285 | 402 | 346 | 23,336 | 23,336 | Accepted | Accepted | 13.93 | S=eval(input())
L=[0]*(len(S)+1)
#print(L)
for i in range(len(S)):
if S[i]=='<':
L[i+1]=max(L[i+1],L[i]+1)
for i in range(len(S)-1,-1,-1):
if S[i]=='>':
L[i]=max(L[i],L[i+1]+1)
print((sum(L))) | S=eval(input())
L=[0]*(len(S)+1)
#print(L)
for i in range(len(S)):
if S[i]=='<':
L[i+1]=L[i]+1
for i in range(len(S)-1,-1,-1):
if S[i]=='>':
L[i]=max(L[i],L[i+1]+1)
print((sum(L)))
| 10 | 10 | 205 | 194 | S = eval(input())
L = [0] * (len(S) + 1)
# print(L)
for i in range(len(S)):
if S[i] == "<":
L[i + 1] = max(L[i + 1], L[i] + 1)
for i in range(len(S) - 1, -1, -1):
if S[i] == ">":
L[i] = max(L[i], L[i + 1] + 1)
print((sum(L)))
| S = eval(input())
L = [0] * (len(S) + 1)
# print(L)
for i in range(len(S)):
if S[i] == "<":
L[i + 1] = L[i] + 1
for i in range(len(S) - 1, -1, -1):
if S[i] == ">":
L[i] = max(L[i], L[i + 1] + 1)
print((sum(L)))
| false | 0 | [
"- L[i + 1] = max(L[i + 1], L[i] + 1)",
"+ L[i + 1] = L[i] + 1"
] | false | 0.046254 | 0.046649 | 0.991539 | [
"s661329394",
"s851944285"
] |
u494037809 | p02659 | python | s497502209 | s340457995 | 112 | 21 | 27,180 | 9,100 | Accepted | Accepted | 81.25 | import math
import numpy as np
# math.floor
X = list(input().split())
A = int(X[0])
B = float(X[1])
# s = str(A*B)
ans = (A*int(B*100+0.5))//100
print(ans) | a,b = list(map(float,input().split()))
a = int(a)
b = round(float(b) * 100)
print((a*b//100)) | 12 | 6 | 169 | 94 | import math
import numpy as np
# math.floor
X = list(input().split())
A = int(X[0])
B = float(X[1])
# s = str(A*B)
ans = (A * int(B * 100 + 0.5)) // 100
print(ans)
| a, b = list(map(float, input().split()))
a = int(a)
b = round(float(b) * 100)
print((a * b // 100))
| false | 50 | [
"-import math",
"-import numpy as np",
"-",
"-# math.floor",
"-X = list(input().split())",
"-A = int(X[0])",
"-B = float(X[1])",
"-# s = str(A*B)",
"-ans = (A * int(B * 100 + 0.5)) // 100",
"-print(ans)",
"+a, b = list(map(float, input().split()))",
"+a = int(a)",
"+b = round(float(b) * 100)... | false | 0.056436 | 0.054621 | 1.033223 | [
"s497502209",
"s340457995"
] |
u695079172 | p02762 | python | s791959419 | s830727751 | 1,172 | 1,044 | 54,312 | 20,288 | Accepted | Accepted | 10.92 |
import sys
sys.setrecursionlimit(500000)
class UF:
#経路圧縮のみのunion find木
def __init__(self,n):
self.n = n
self.parents = [-1] * (n+1) #1-indexedにするために1個足している
self.rnks = [0] * (n+1)
def find(self,n):
if self.parents[n] < 0:
return n
else:
... | #import sys
#sys.setrecursionlimit(500000) マージテクをちゃんとしていればこんなものはいらないはず……
class UF:
#経路圧縮+マージテクのunion find木
def __init__(self,n):
self.n = n
self.parents = [-1] * (n+1) #1-indexedにするために1個足している
self.rnks = [0] * (n+1)
def find(self,n):
if self.parents[n] < 0:
... | 77 | 76 | 1,793 | 1,860 | import sys
sys.setrecursionlimit(500000)
class UF:
# 経路圧縮のみのunion find木
def __init__(self, n):
self.n = n
self.parents = [-1] * (n + 1) # 1-indexedにするために1個足している
self.rnks = [0] * (n + 1)
def find(self, n):
if self.parents[n] < 0:
return n
else:
... | # import sys
# sys.setrecursionlimit(500000) マージテクをちゃんとしていればこんなものはいらないはず……
class UF:
# 経路圧縮+マージテクのunion find木
def __init__(self, n):
self.n = n
self.parents = [-1] * (n + 1) # 1-indexedにするために1個足している
self.rnks = [0] * (n + 1)
def find(self, n):
if self.parents[n] < 0:
... | false | 1.298701 | [
"-import sys",
"-",
"-sys.setrecursionlimit(500000)",
"-",
"-",
"+# import sys",
"+# sys.setrecursionlimit(500000) マージテクをちゃんとしていればこんなものはいらないはず……",
"- # 経路圧縮のみのunion find木",
"+ # 経路圧縮+マージテクのunion find木",
"- if self.rnks[a_par] > self.rnks[b_par]:",
"+ if self.rnks[a_par] < sel... | false | 0.045948 | 0.045638 | 1.006795 | [
"s791959419",
"s830727751"
] |
u773981351 | p03944 | python | s107466899 | s349605242 | 46 | 18 | 3,192 | 3,064 | Accepted | Accepted | 60.87 | def init_rectangle(w, h):
rectangle = []
for x in range(w):
x_list = []
for y in range(h):
x_list.append(True)
rectangle.append(x_list)
return rectangle
def area(rectangle):
count = 0
for i in rectangle:
for j in i:
if j:
... | def area(x2, y2, points):
x1 = y1 = 0
for x, y, a in points:
if a == 1:
x1 = min(max(x1, x), x2)
elif a == 2:
x2 = max(min(x2, x), x1)
elif a == 3:
y1 = min(max(y1, y), y2)
else:
y2 = max(min(y2, y), y1)
return (x2 - ... | 47 | 18 | 1,204 | 511 | def init_rectangle(w, h):
rectangle = []
for x in range(w):
x_list = []
for y in range(h):
x_list.append(True)
rectangle.append(x_list)
return rectangle
def area(rectangle):
count = 0
for i in rectangle:
for j in i:
if j:
coun... | def area(x2, y2, points):
x1 = y1 = 0
for x, y, a in points:
if a == 1:
x1 = min(max(x1, x), x2)
elif a == 2:
x2 = max(min(x2, x), x1)
elif a == 3:
y1 = min(max(y1, y), y2)
else:
y2 = max(min(y2, y), y1)
return (x2 - x1) * (y2 -... | false | 61.702128 | [
"-def init_rectangle(w, h):",
"- rectangle = []",
"- for x in range(w):",
"- x_list = []",
"- for y in range(h):",
"- x_list.append(True)",
"- rectangle.append(x_list)",
"- return rectangle",
"-",
"-",
"-def area(rectangle):",
"- count = 0",
"- ... | false | 0.043665 | 0.087687 | 0.497965 | [
"s107466899",
"s349605242"
] |
u374841433 | p02755 | python | s803396400 | s078921968 | 1,779 | 313 | 21,428 | 20,252 | Accepted | Accepted | 82.41 | import math
import numpy as np
a,b=[int(v) for v in input().split()]
min_8=math.ceil(a/0.08)
max_8=(a+1)//0.08
min_10=math.ceil(b/0.1)
max_10=(b+1)//0.1
range_8 = np.arange(min_8,max_8+1).astype(int)
range_10 = np.arange(min_10,max_10+1).astype(int)
try:
print((min(np.intersect1d(range_8,range_1... | import math
import numpy as np
a, b = [int(v) for v in input().split()]
try:
print((min(np.intersect1d(np.arange(math.ceil(a/0.08), (a+1) //0.08+ 1).astype(int), np.arange(math.ceil(b/0.1), (b+1)//0.1 + 1).astype(int)))))
except:
print((-1))
| 18 | 12 | 350 | 262 | import math
import numpy as np
a, b = [int(v) for v in input().split()]
min_8 = math.ceil(a / 0.08)
max_8 = (a + 1) // 0.08
min_10 = math.ceil(b / 0.1)
max_10 = (b + 1) // 0.1
range_8 = np.arange(min_8, max_8 + 1).astype(int)
range_10 = np.arange(min_10, max_10 + 1).astype(int)
try:
print((min(np.intersect1d(range... | import math
import numpy as np
a, b = [int(v) for v in input().split()]
try:
print(
(
min(
np.intersect1d(
np.arange(math.ceil(a / 0.08), (a + 1) // 0.08 + 1).astype(int),
np.arange(math.ceil(b / 0.1), (b + 1) // 0.1 + 1).astype(int),
... | false | 33.333333 | [
"-min_8 = math.ceil(a / 0.08)",
"-max_8 = (a + 1) // 0.08",
"-min_10 = math.ceil(b / 0.1)",
"-max_10 = (b + 1) // 0.1",
"-range_8 = np.arange(min_8, max_8 + 1).astype(int)",
"-range_10 = np.arange(min_10, max_10 + 1).astype(int)",
"- print((min(np.intersect1d(range_8, range_10))))",
"+ print(",
... | false | 0.250564 | 0.462915 | 0.541275 | [
"s803396400",
"s078921968"
] |
u094191970 | p03786 | python | s327289546 | s065968600 | 848 | 117 | 14,512 | 14,320 | Accepted | Accepted | 86.2 | n=int(eval(input()))
a=sorted(list(map(int,input().split())))
ok=n-1
ng=-1
while abs(ok-ng)>1:
mid=(ok+ng)//2
inx=mid
bool=True
sum_mid=sum(a[:mid+1])
while bool and inx!=n-2:
if sum_mid*2>=a[inx+1]:
sum_mid+=a[inx+1]
inx+=1
else:
bool=False
if bool:
ok=mid
else:
ng=m... | n=int(eval(input()))
a=sorted(list(map(int,input().split())))
ans=1
sum=a[0]
for i in range(1,n):
if sum*2>=a[i]:
ans+=1
else:
ans=1
sum+=a[i]
print(ans) | 26 | 12 | 331 | 166 | n = int(eval(input()))
a = sorted(list(map(int, input().split())))
ok = n - 1
ng = -1
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
inx = mid
bool = True
sum_mid = sum(a[: mid + 1])
while bool and inx != n - 2:
if sum_mid * 2 >= a[inx + 1]:
sum_mid += a[inx + 1]
inx +=... | n = int(eval(input()))
a = sorted(list(map(int, input().split())))
ans = 1
sum = a[0]
for i in range(1, n):
if sum * 2 >= a[i]:
ans += 1
else:
ans = 1
sum += a[i]
print(ans)
| false | 53.846154 | [
"-ok = n - 1",
"-ng = -1",
"-while abs(ok - ng) > 1:",
"- mid = (ok + ng) // 2",
"- inx = mid",
"- bool = True",
"- sum_mid = sum(a[: mid + 1])",
"- while bool and inx != n - 2:",
"- if sum_mid * 2 >= a[inx + 1]:",
"- sum_mid += a[inx + 1]",
"- inx += ... | false | 0.041156 | 0.035028 | 1.17492 | [
"s327289546",
"s065968600"
] |
u373047809 | p03161 | python | s325214072 | s045021161 | 366 | 284 | 89,940 | 88,216 | Accepted | Accepted | 22.4 | n, k, *h = list(map(int, open(0).read().split()))
h += [0] * 200
dp = [0] + [float("inf")] * 100200
for i in range(1, n):
dp[i] = min(dp[i-a] + abs(h[i] - h[i-a]) for a in range(1, k + 1))
print((dp[n - 1])) | n, k, *h = list(map(int, open(0).read().split()))
dp = [0] * n
for i in range(1, n):
dp[i] = min(dp[i-a] + abs(h[i] - h[i-a]) for a in range(1, min(i, k) + 1))
print((dp[n - 1])) | 6 | 5 | 206 | 176 | n, k, *h = list(map(int, open(0).read().split()))
h += [0] * 200
dp = [0] + [float("inf")] * 100200
for i in range(1, n):
dp[i] = min(dp[i - a] + abs(h[i] - h[i - a]) for a in range(1, k + 1))
print((dp[n - 1]))
| n, k, *h = list(map(int, open(0).read().split()))
dp = [0] * n
for i in range(1, n):
dp[i] = min(dp[i - a] + abs(h[i] - h[i - a]) for a in range(1, min(i, k) + 1))
print((dp[n - 1]))
| false | 16.666667 | [
"-h += [0] * 200",
"-dp = [0] + [float(\"inf\")] * 100200",
"+dp = [0] * n",
"- dp[i] = min(dp[i - a] + abs(h[i] - h[i - a]) for a in range(1, k + 1))",
"+ dp[i] = min(dp[i - a] + abs(h[i] - h[i - a]) for a in range(1, min(i, k) + 1))"
] | false | 0.047779 | 0.043748 | 1.092142 | [
"s325214072",
"s045021161"
] |
u841568901 | p02791 | python | s527209748 | s136396355 | 158 | 126 | 25,768 | 32,192 | Accepted | Accepted | 20.25 | N = int(eval(input()))
P = [int(x) for x in input().split()]
R = 1000000
c = 0
for i in range(N):
if min(R, P[i])==P[i]:
c += 1
R = P[i]
else:
pass
print(c) | N = int(eval(input()))
P = list(map(int, input().split()))
m = P[0]
S = 0
for p in P:
if m>=p:
S += 1
m = min(m, p)
print(S) | 11 | 9 | 176 | 134 | N = int(eval(input()))
P = [int(x) for x in input().split()]
R = 1000000
c = 0
for i in range(N):
if min(R, P[i]) == P[i]:
c += 1
R = P[i]
else:
pass
print(c)
| N = int(eval(input()))
P = list(map(int, input().split()))
m = P[0]
S = 0
for p in P:
if m >= p:
S += 1
m = min(m, p)
print(S)
| false | 18.181818 | [
"-P = [int(x) for x in input().split()]",
"-R = 1000000",
"-c = 0",
"-for i in range(N):",
"- if min(R, P[i]) == P[i]:",
"- c += 1",
"- R = P[i]",
"- else:",
"- pass",
"-print(c)",
"+P = list(map(int, input().split()))",
"+m = P[0]",
"+S = 0",
"+for p in P:",
"... | false | 0.039282 | 0.038892 | 1.010032 | [
"s527209748",
"s136396355"
] |
u261103969 | p02646 | python | s134958083 | s954749643 | 61 | 20 | 61,700 | 9,092 | Accepted | Accepted | 67.21 | import sys
readline = sys.stdin.buffer.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
a, v = list(map(int, readline().split()))
b, w = list(map(int, readline().split()))
t = int(eval(input()))
dist = abs(b - a)
vel = v - w
if vel * t... | a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(eval(input()))
dist = abs(b - a)
r_vel = v - w
if r_vel * t >= dist:
print("YES")
else:
print("NO") | 24 | 11 | 410 | 188 | import sys
readline = sys.stdin.buffer.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
a, v = list(map(int, readline().split()))
b, w = list(map(int, readline().split()))
t = int(eval(input()))
dist = abs(b - a)
vel = v - w
if vel * t >= dist:
prin... | a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(eval(input()))
dist = abs(b - a)
r_vel = v - w
if r_vel * t >= dist:
print("YES")
else:
print("NO")
| false | 54.166667 | [
"-import sys",
"-",
"-readline = sys.stdin.buffer.readline",
"-MOD = 10**9 + 7",
"-INF = float(\"INF\")",
"-sys.setrecursionlimit(10**5)",
"-",
"-",
"-def main():",
"- a, v = list(map(int, readline().split()))",
"- b, w = list(map(int, readline().split()))",
"- t = int(eval(input()))"... | false | 0.060428 | 0.056266 | 1.073962 | [
"s134958083",
"s954749643"
] |
u353919145 | p03127 | python | s163029744 | s458815692 | 104 | 96 | 14,224 | 84,100 | Accepted | Accepted | 7.69 | n=int(eval(input()))
a=list(map(int,input().split()))
def gcd(a,b):
while(a%b!=0):
a,b=b,a%b
return b
a=list(sorted(a))
c=gcd(a[0],a[1])
for i in range(2,n):
c=gcd(a[i],c)
print(c)
| import sys
input=sys.stdin.buffer.readline
from math import*
n=int(eval(input()))
arr=list(map(int,input().split()))
ans=1
if n>2:
ans=gcd(arr[0],arr[1])
for i in range(2,n):
ans=gcd(ans,arr[i])
else:
ans=gcd(arr[0],arr[1])
print(ans) | 12 | 14 | 207 | 247 | n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(a, b):
while a % b != 0:
a, b = b, a % b
return b
a = list(sorted(a))
c = gcd(a[0], a[1])
for i in range(2, n):
c = gcd(a[i], c)
print(c)
| import sys
input = sys.stdin.buffer.readline
from math import *
n = int(eval(input()))
arr = list(map(int, input().split()))
ans = 1
if n > 2:
ans = gcd(arr[0], arr[1])
for i in range(2, n):
ans = gcd(ans, arr[i])
else:
ans = gcd(arr[0], arr[1])
print(ans)
| false | 14.285714 | [
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"+from math import *",
"+",
"-a = list(map(int, input().split()))",
"-",
"-",
"-def gcd(a, b):",
"- while a % b != 0:",
"- a, b = b, a % b",
"- return b",
"-",
"-",
"-a = list(sorted(a))",
"-c = gcd(a[0], a[1])",
... | false | 0.114432 | 0.007912 | 14.4638 | [
"s163029744",
"s458815692"
] |
u320567105 | p03127 | python | s171552382 | s124670880 | 90 | 57 | 14,252 | 14,252 | Accepted | Accepted | 36.67 | N = int(eval(input()))
#A = [int(i) for i in input().split()]
A = list(map(int,input().split()))
def gcp(a,b):
if b == 0:
return a
else:
return gcp(b,a%b)
a = A[0]
for i in range(1,N):
a = gcp(a,A[i])
print(a) | eval(input())
A = list(map(int,input().split()))
b = min(A)
for a in A:
while True:
if a%b == 0:
break
a,b = b, a%b
print(b) | 14 | 10 | 246 | 160 | N = int(eval(input()))
# A = [int(i) for i in input().split()]
A = list(map(int, input().split()))
def gcp(a, b):
if b == 0:
return a
else:
return gcp(b, a % b)
a = A[0]
for i in range(1, N):
a = gcp(a, A[i])
print(a)
| eval(input())
A = list(map(int, input().split()))
b = min(A)
for a in A:
while True:
if a % b == 0:
break
a, b = b, a % b
print(b)
| false | 28.571429 | [
"-N = int(eval(input()))",
"-# A = [int(i) for i in input().split()]",
"+eval(input())",
"-",
"-",
"-def gcp(a, b):",
"- if b == 0:",
"- return a",
"- else:",
"- return gcp(b, a % b)",
"-",
"-",
"-a = A[0]",
"-for i in range(1, N):",
"- a = gcp(a, A[i])",
"-print... | false | 0.102689 | 0.112311 | 0.914325 | [
"s171552382",
"s124670880"
] |
u325282913 | p02813 | python | s505162204 | s152223541 | 232 | 85 | 43,504 | 74,052 | Accepted | Accepted | 63.36 | import itertools
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
A = [i for i in range(1,N+1)]
count = 1
for i in itertools.permutations(A):
flg = True
for k in range(N):
if i[k] != P[k]:
flg = False
break
if flg:
... | import itertools
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
a = [i for i in range(1,N+1)]
cnt = 0
ans_a, ans_b = 0, 0
for target in itertools.permutations(a):
cnt += 1
if list(target) == P:
ans_a = cnt
if list(target) == Q:
ans_... | 23 | 14 | 504 | 346 | import itertools
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
A = [i for i in range(1, N + 1)]
count = 1
for i in itertools.permutations(A):
flg = True
for k in range(N):
if i[k] != P[k]:
flg = False
break
if flg:
a =... | import itertools
N = int(eval(input()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
a = [i for i in range(1, N + 1)]
cnt = 0
ans_a, ans_b = 0, 0
for target in itertools.permutations(a):
cnt += 1
if list(target) == P:
ans_a = cnt
if list(target) == Q:
ans_b = cnt
... | false | 39.130435 | [
"-A = [i for i in range(1, N + 1)]",
"-count = 1",
"-for i in itertools.permutations(A):",
"- flg = True",
"- for k in range(N):",
"- if i[k] != P[k]:",
"- flg = False",
"- break",
"- if flg:",
"- a = count",
"- flg = True",
"- for k in range(... | false | 0.053563 | 0.127117 | 0.421369 | [
"s505162204",
"s152223541"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.