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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u910288980 | p03361 | python | s127158358 | s867411217 | 22 | 20 | 3,064 | 3,064 | Accepted | Accepted | 9.09 | h,w = list(map(int, input().split()))
s = [eval(input()) for _ in range(h)]
def check():
for i in range(h):
for j in range(w):
if s[i][j] == '.':
continue
def ok(x,y):
return x>=0 and x<h and y>=0 and y<w and s[x][y]=='#'
if ... | h,w = list(map(int, input().split()))
B = '.'*(w+2)
s = [B]
s.extend(['.' + eval(input()) + '.' for _ in range(h)])
s.append(B)
def check():
for i in range(1,h+1):
for j in range(1,w+1):
if s[i][j] == '.':
continue
if all([s[x][y]=='.' for x,y in [(i-1,j),... | 18 | 16 | 463 | 424 | h, w = list(map(int, input().split()))
s = [eval(input()) for _ in range(h)]
def check():
for i in range(h):
for j in range(w):
if s[i][j] == ".":
continue
def ok(x, y):
return x >= 0 and x < h and y >= 0 and y < w and s[x][y] == "#"
if... | h, w = list(map(int, input().split()))
B = "." * (w + 2)
s = [B]
s.extend(["." + eval(input()) + "." for _ in range(h)])
s.append(B)
def check():
for i in range(1, h + 1):
for j in range(1, w + 1):
if s[i][j] == ".":
continue
if all(
[
... | false | 11.111111 | [
"-s = [eval(input()) for _ in range(h)]",
"+B = \".\" * (w + 2)",
"+s = [B]",
"+s.extend([\".\" + eval(input()) + \".\" for _ in range(h)])",
"+s.append(B)",
"- for i in range(h):",
"- for j in range(w):",
"+ for i in range(1, h + 1):",
"+ for j in range(1, w + 1):",
"-",
"- ... | false | 0.049741 | 0.046553 | 1.068481 | [
"s127158358",
"s867411217"
] |
u046187684 | p02911 | python | s338763530 | s605177537 | 188 | 172 | 15,036 | 14,552 | Accepted | Accepted | 8.51 | from collections import Counter
def solve(string):
n, k, q, *a = list(map(int, string.split()))
a = Counter(a)
return "\n".join(["Yes" if a.get(i + 1, 0) > q - k else "No" for i in range(n)])
if __name__ == '__main__':
n, m, q = list(map(int, input().split()))
print((solve('{} {} {}\n... | def solve(string):
n, k, q, *a = list(map(int, string.split()))
t, b = [0] * n, q - k
for _a in a:
t[_a - 1] += 1
return "\n".join(["Yes" if _t > b else "No" for _t in t])
if __name__ == '__main__':
n, m, q = list(map(int, input().split()))
print((solve('{} {} {}\n'.format(n,... | 12 | 11 | 368 | 357 | from collections import Counter
def solve(string):
n, k, q, *a = list(map(int, string.split()))
a = Counter(a)
return "\n".join(["Yes" if a.get(i + 1, 0) > q - k else "No" for i in range(n)])
if __name__ == "__main__":
n, m, q = list(map(int, input().split()))
print(
(
solve(... | def solve(string):
n, k, q, *a = list(map(int, string.split()))
t, b = [0] * n, q - k
for _a in a:
t[_a - 1] += 1
return "\n".join(["Yes" if _t > b else "No" for _t in t])
if __name__ == "__main__":
n, m, q = list(map(int, input().split()))
print(
(
solve(
... | false | 8.333333 | [
"-from collections import Counter",
"-",
"-",
"- a = Counter(a)",
"- return \"\\n\".join([\"Yes\" if a.get(i + 1, 0) > q - k else \"No\" for i in range(n)])",
"+ t, b = [0] * n, q - k",
"+ for _a in a:",
"+ t[_a - 1] += 1",
"+ return \"\\n\".join([\"Yes\" if _t > b else \"No\" ... | false | 0.035795 | 0.036852 | 0.971307 | [
"s338763530",
"s605177537"
] |
u941407962 | p02904 | python | s904059995 | s592485487 | 420 | 386 | 101,372 | 106,020 | Accepted | Accepted | 8.1 | n, k = list(map(int, input().split()))
xs = list(map(int, input().split()))
from collections import deque
def slide_max(k, l):
rs = []
dq = deque()
for i, x in enumerate(l):
while True:
if not len(dq):
dq.append(i)
break
lxi = dq[-... | n, k = list(map(int, input().split()))
xs = list(map(int, input().split()))
from collections import deque
def slide_max(k, l):
rs, rrs = [], set()
dq = deque()
for i, x in enumerate(l):
while True:
if not len(dq):
dq.append(i)
break
... | 89 | 56 | 1,732 | 1,404 | n, k = list(map(int, input().split()))
xs = list(map(int, input().split()))
from collections import deque
def slide_max(k, l):
rs = []
dq = deque()
for i, x in enumerate(l):
while True:
if not len(dq):
dq.append(i)
break
lxi = dq[-1]
... | n, k = list(map(int, input().split()))
xs = list(map(int, input().split()))
from collections import deque
def slide_max(k, l):
rs, rrs = [], set()
dq = deque()
for i, x in enumerate(l):
while True:
if not len(dq):
dq.append(i)
break
lxi = dq[... | false | 37.078652 | [
"- rs = []",
"+ rs, rrs = [], set()",
"+ rrs = set()",
"+ if len(dq) == k:",
"+ rrs.add(i + 1 - k)",
"- return rs",
"+ return rs, rrs",
"-maxs, mins = slide_max(k, xs), slide_min(k, xs)",
"-aa, bb = xs[:k], xs[k:]",
"-b, nb, bx = aa[0], aa[1], aa[-1]",
"-ba = Non... | false | 0.061793 | 0.03731 | 1.656216 | [
"s904059995",
"s592485487"
] |
u966695411 | p03948 | python | s336603857 | s361995482 | 139 | 112 | 14,680 | 15,020 | Accepted | Accepted | 19.42 | #! /usr/bin/env python3
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
pu = -1
SPU = set([])
SPD = []
b = 0
c = 0
for i in A[:-1][::-1]:
if i > A[pu]:
pu = -c-2
elif i < A[pu] and A[pu]-i >= b:
SPU.add(pu)
b = A[pu]-i
SPD += [b]
c ... | #! /usr/bin/env python3
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
p = -1
dif = h = hc = lc = c = 0
for i in A[-2::-1]:
a, b = A[p], A[p]-i
if i > a:
p = -c-2
elif b >= dif:
if a != h : h, hc = a, hc+1
if b > dif : dif, lc = b, 0
... | 19 | 16 | 356 | 353 | #! /usr/bin/env python3
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
pu = -1
SPU = set([])
SPD = []
b = 0
c = 0
for i in A[:-1][::-1]:
if i > A[pu]:
pu = -c - 2
elif i < A[pu] and A[pu] - i >= b:
SPU.add(pu)
b = A[pu] - i
SPD += [b]
c += 1
print(... | #! /usr/bin/env python3
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
p = -1
dif = h = hc = lc = c = 0
for i in A[-2::-1]:
a, b = A[p], A[p] - i
if i > a:
p = -c - 2
elif b >= dif:
if a != h:
h, hc = a, hc + 1
if b > dif:
dif, lc =... | false | 15.789474 | [
"-pu = -1",
"-SPU = set([])",
"-SPD = []",
"-b = 0",
"-c = 0",
"-for i in A[:-1][::-1]:",
"- if i > A[pu]:",
"- pu = -c - 2",
"- elif i < A[pu] and A[pu] - i >= b:",
"- SPU.add(pu)",
"- b = A[pu] - i",
"- SPD += [b]",
"+p = -1",
"+dif = h = hc = lc = c = 0... | false | 0.037741 | 0.035719 | 1.056615 | [
"s336603857",
"s361995482"
] |
u840310460 | p03610 | python | s326808488 | s859914344 | 180 | 21 | 41,840 | 3,572 | Accepted | Accepted | 88.33 | s = eval(input())
FF = lambda x: [x[i] for i in range(len(x)) if (i+1) % 2 != 0]
BA = FF(s)
BA
print(("".join(BA))) | S = eval(input())
ans = [S[i] for i in range(0, len(S), 2)]
print(("".join(ans)))
| 5 | 3 | 111 | 80 | s = eval(input())
FF = lambda x: [x[i] for i in range(len(x)) if (i + 1) % 2 != 0]
BA = FF(s)
BA
print(("".join(BA)))
| S = eval(input())
ans = [S[i] for i in range(0, len(S), 2)]
print(("".join(ans)))
| false | 40 | [
"-s = eval(input())",
"-FF = lambda x: [x[i] for i in range(len(x)) if (i + 1) % 2 != 0]",
"-BA = FF(s)",
"-BA",
"-print((\"\".join(BA)))",
"+S = eval(input())",
"+ans = [S[i] for i in range(0, len(S), 2)]",
"+print((\"\".join(ans)))"
] | false | 0.078693 | 0.041145 | 1.912587 | [
"s326808488",
"s859914344"
] |
u190405389 | p03495 | python | s445372139 | s570039578 | 130 | 110 | 26,012 | 92,272 | Accepted | Accepted | 15.38 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [0]*200000
c = []
ans = 0
for x in a:
b[x-1] += 1
for x in b:
if x > 0:
c.append(x)
c.sort()
y = len(c) - k
if y > 0:
ans = sum(c[:y])
print(ans) | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = [0]*(n+1)
for x in a:
b[x]+=1
b.sort(reverse=1)
print((sum(b[k:])))
| 22 | 10 | 266 | 152 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [0] * 200000
c = []
ans = 0
for x in a:
b[x - 1] += 1
for x in b:
if x > 0:
c.append(x)
c.sort()
y = len(c) - k
if y > 0:
ans = sum(c[:y])
print(ans)
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [0] * (n + 1)
for x in a:
b[x] += 1
b.sort(reverse=1)
print((sum(b[k:])))
| false | 54.545455 | [
"-b = [0] * 200000",
"-c = []",
"-ans = 0",
"+b = [0] * (n + 1)",
"- b[x - 1] += 1",
"-for x in b:",
"- if x > 0:",
"- c.append(x)",
"-c.sort()",
"-y = len(c) - k",
"-if y > 0:",
"- ans = sum(c[:y])",
"-print(ans)",
"+ b[x] += 1",
"+b.sort(reverse=1)",
"+print((sum(b... | false | 0.05659 | 0.043284 | 1.307413 | [
"s445372139",
"s570039578"
] |
u579699847 | p02983 | python | s344199723 | s549767971 | 659 | 51 | 3,060 | 3,060 | Accepted | Accepted | 92.26 | L, R = list(map(int, input().split()))
modL = L % 2019
modR = R % 2019
min2019 = 2019
if R - L >= 2018:
print((0))
else:
for j in range(modL, modR+1):
for k in range(j+1 , modR+1):
min2019 = min(min2019, j * k % 2019)
print(min2019) | L, R = list(map(int, input().split()))
modL = L % 2019
modR = R % 2019
min2019 = 2019
if R - L >= 2018:
print((0))
elif modL <=3 and modR >=673:
print((0))
else:
for j in range(modL, modR+1):
for k in range(j+1, modR+1):
min2019 = min(min2019, j * k % 2019)
print(min2... | 12 | 15 | 268 | 315 | L, R = list(map(int, input().split()))
modL = L % 2019
modR = R % 2019
min2019 = 2019
if R - L >= 2018:
print((0))
else:
for j in range(modL, modR + 1):
for k in range(j + 1, modR + 1):
min2019 = min(min2019, j * k % 2019)
print(min2019)
| L, R = list(map(int, input().split()))
modL = L % 2019
modR = R % 2019
min2019 = 2019
if R - L >= 2018:
print((0))
elif modL <= 3 and modR >= 673:
print((0))
else:
for j in range(modL, modR + 1):
for k in range(j + 1, modR + 1):
min2019 = min(min2019, j * k % 2019)
print(min2019)
| false | 20 | [
"+elif modL <= 3 and modR >= 673:",
"+ print((0))"
] | false | 0.215895 | 0.062942 | 3.43005 | [
"s344199723",
"s549767971"
] |
u671060652 | p02946 | python | s033585454 | s965256579 | 179 | 65 | 38,384 | 62,536 | Accepted | Accepted | 63.69 | k, x = list(map(int, input().split()))
nums = []
for i in range(x - k+1, k+x):
nums.append(str(i))
print((" ".join(nums))) | k, x = map(int, input().split())
for i in range(x-k+1,x+k):
print(i,end=" ")
print("")
| 6 | 5 | 124 | 95 | k, x = list(map(int, input().split()))
nums = []
for i in range(x - k + 1, k + x):
nums.append(str(i))
print((" ".join(nums)))
| k, x = map(int, input().split())
for i in range(x - k + 1, x + k):
print(i, end=" ")
print("")
| false | 16.666667 | [
"-k, x = list(map(int, input().split()))",
"-nums = []",
"-for i in range(x - k + 1, k + x):",
"- nums.append(str(i))",
"-print((\" \".join(nums)))",
"+k, x = map(int, input().split())",
"+for i in range(x - k + 1, x + k):",
"+ print(i, end=\" \")",
"+print(\"\")"
] | false | 0.063084 | 0.065447 | 0.963894 | [
"s033585454",
"s965256579"
] |
u627803856 | p03476 | python | s024280066 | s884499994 | 987 | 473 | 53,464 | 80,864 | Accepted | Accepted | 52.08 | # O(nloglogn) https://mathtrain.jp/eratosthenes
def sieve(n):
s = [True] * n
s[0] = s[1] = False
for x in range(2, int(n ** 0.5) + 1):
if s[x]:
for i in range(2 * x, n, x):
s[i] = False
return s
is_prime = sieve(10 ** 5 + 1)
is_like2017 = [False] * (10 ** 5 + 1)
for i in range(10**5 + 1):
if... | q = int(eval(input()))
def is_prime(n):
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
return False
return n != 1
def main(n):
return 1 if is_prime(n) and is_prime((n + 1) // 2) else 0
MAX = 10 ** 5 + 100
A = [main(i) for i in range(MAX)]
# 累積和
acc = [0] * (MAX + 1... | 31 | 22 | 655 | 489 | # O(nloglogn) https://mathtrain.jp/eratosthenes
def sieve(n):
s = [True] * n
s[0] = s[1] = False
for x in range(2, int(n**0.5) + 1):
if s[x]:
for i in range(2 * x, n, x):
s[i] = False
return s
is_prime = sieve(10**5 + 1)
is_like2017 = [False] * (10**5 + 1)
for i in ... | q = int(eval(input()))
def is_prime(n):
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return n != 1
def main(n):
return 1 if is_prime(n) and is_prime((n + 1) // 2) else 0
MAX = 10**5 + 100
A = [main(i) for i in range(MAX)]
# 累積和
acc = [0] * (MAX + 1)
for i in rang... | false | 29.032258 | [
"-# O(nloglogn) https://mathtrain.jp/eratosthenes",
"-def sieve(n):",
"- s = [True] * n",
"- s[0] = s[1] = False",
"- for x in range(2, int(n**0.5) + 1):",
"- if s[x]:",
"- for i in range(2 * x, n, x):",
"- s[i] = False",
"- return s",
"+q = int(eval(in... | false | 0.111838 | 0.58061 | 0.192622 | [
"s024280066",
"s884499994"
] |
u258073778 | p03370 | python | s018766024 | s422432046 | 525 | 17 | 3,064 | 2,940 | Accepted | Accepted | 96.76 | N, X = list(map(int, input().split()))
mn = [0]*N
for i in range(N):
mn[i] = int(eval(input()))
ans = N
x = X - sum(mn)
while(x >= min(mn)):
if x // min(mn) == 0:
mn[mn.index(min(mn))] = 1000000
else:
x -= min(mn)
ans += 1
print(ans) | N, X = list(map(int, input().split()))
mn = [int(eval(input())) for i in range(N)]
print(((X - sum(mn))//min(mn) + len(mn))) | 17 | 5 | 267 | 116 | N, X = list(map(int, input().split()))
mn = [0] * N
for i in range(N):
mn[i] = int(eval(input()))
ans = N
x = X - sum(mn)
while x >= min(mn):
if x // min(mn) == 0:
mn[mn.index(min(mn))] = 1000000
else:
x -= min(mn)
ans += 1
print(ans)
| N, X = list(map(int, input().split()))
mn = [int(eval(input())) for i in range(N)]
print(((X - sum(mn)) // min(mn) + len(mn)))
| false | 70.588235 | [
"-mn = [0] * N",
"-for i in range(N):",
"- mn[i] = int(eval(input()))",
"-ans = N",
"-x = X - sum(mn)",
"-while x >= min(mn):",
"- if x // min(mn) == 0:",
"- mn[mn.index(min(mn))] = 1000000",
"- else:",
"- x -= min(mn)",
"- ans += 1",
"-print(ans)",
"+mn = [int(... | false | 0.088051 | 0.035801 | 2.459443 | [
"s018766024",
"s422432046"
] |
u411203878 | p02724 | python | s435679812 | s428467254 | 162 | 62 | 38,384 | 61,836 | Accepted | Accepted | 61.73 | n=int(eval(input()))
x=n//500
y=(n-x*500)//5
print((x*1000+y*5)) | n = int(eval(input()))
shou500 = n//500
shou5 = (n-shou500*500)//5
print((shou500*1000+shou5*5)) | 7 | 7 | 65 | 97 | n = int(eval(input()))
x = n // 500
y = (n - x * 500) // 5
print((x * 1000 + y * 5))
| n = int(eval(input()))
shou500 = n // 500
shou5 = (n - shou500 * 500) // 5
print((shou500 * 1000 + shou5 * 5))
| false | 0 | [
"-x = n // 500",
"-y = (n - x * 500) // 5",
"-print((x * 1000 + y * 5))",
"+shou500 = n // 500",
"+shou5 = (n - shou500 * 500) // 5",
"+print((shou500 * 1000 + shou5 * 5))"
] | false | 0.035049 | 0.12269 | 0.285671 | [
"s435679812",
"s428467254"
] |
u577244731 | p02577 | python | s665608373 | s545837038 | 750 | 203 | 11,176 | 9,108 | Accepted | Accepted | 72.93 | N = int(eval(input()))
N_sum = sum(list(map(int, str(N))))
if N % 9 == 0 and N_sum % 9 == 0:
print('Yes')
else:
print('No') | N = int(eval(input()))
if N % 9 == 0:
print('Yes')
else:
print('No') | 8 | 6 | 134 | 77 | N = int(eval(input()))
N_sum = sum(list(map(int, str(N))))
if N % 9 == 0 and N_sum % 9 == 0:
print("Yes")
else:
print("No")
| N = int(eval(input()))
if N % 9 == 0:
print("Yes")
else:
print("No")
| false | 25 | [
"-N_sum = sum(list(map(int, str(N))))",
"-if N % 9 == 0 and N_sum % 9 == 0:",
"+if N % 9 == 0:"
] | false | 0.102651 | 0.036893 | 2.782409 | [
"s665608373",
"s545837038"
] |
u945181840 | p02856 | python | s737147822 | s947271486 | 168 | 139 | 21,316 | 24,132 | Accepted | Accepted | 17.26 | import sys
read = sys.stdin.read
M = int(eval(input()))
dc = list(map(int, read().split()))
dig_sum = 0
dig = 0
for d, c in zip(*[iter(dc)] * 2):
dig_sum += d * c
dig += c
answer = (dig_sum - 1) // 9 + dig - 1
print(answer) | import sys
read = sys.stdin.read
M = int(eval(input()))
dc = list(map(int, read().split()))
dig = [0] * 10
cnt = 0
answer = 0
for d, c in zip(*[iter(dc)] * 2):
dig[d] += c
trans = dict()
for i in range(10):
if i < 5:
trans[i] = i + i
elif i == 5:
trans[i] = 1
else:
... | 13 | 56 | 233 | 1,114 | import sys
read = sys.stdin.read
M = int(eval(input()))
dc = list(map(int, read().split()))
dig_sum = 0
dig = 0
for d, c in zip(*[iter(dc)] * 2):
dig_sum += d * c
dig += c
answer = (dig_sum - 1) // 9 + dig - 1
print(answer)
| import sys
read = sys.stdin.read
M = int(eval(input()))
dc = list(map(int, read().split()))
dig = [0] * 10
cnt = 0
answer = 0
for d, c in zip(*[iter(dc)] * 2):
dig[d] += c
trans = dict()
for i in range(10):
if i < 5:
trans[i] = i + i
elif i == 5:
trans[i] = 1
else:
trans[i] = tr... | false | 76.785714 | [
"-dig_sum = 0",
"-dig = 0",
"+dig = [0] * 10",
"+cnt = 0",
"+answer = 0",
"- dig_sum += d * c",
"- dig += c",
"-answer = (dig_sum - 1) // 9 + dig - 1",
"+ dig[d] += c",
"+trans = dict()",
"+for i in range(10):",
"+ if i < 5:",
"+ trans[i] = i + i",
"+ elif i == 5:",
... | false | 0.034984 | 0.048542 | 0.7207 | [
"s737147822",
"s947271486"
] |
u688587139 | p02984 | python | s052898977 | s175304233 | 128 | 109 | 117,684 | 95,720 | Accepted | Accepted | 14.84 | N = int(eval(input()))
A = list(map(int, input().split()))
R = []
'''プラススタート、マイナススタートの累積和を取る'''
plus_start = []
minus_start = []
'''後ろからの累積和'''
plus_start_rev = []
minus_start_rev = []
tmp = 0
pm = -1
for i in range(N):
pm *= -1
tmp += A[i] * pm
plus_start.append(tmp)
tmp = 0
pm = -1
fo... | N = int(eval(input()))
A = list(map(int, input().split()))
R = []
tmp = 0
pm = -1
for i in range(N):
pm *= -1
tmp += A[i] * pm
R.append(tmp)
for i in range(1, N):
tmp = 2 * A[i-1] - R[i-1]
R.append(tmp)
print((*R)) | 51 | 16 | 936 | 240 | N = int(eval(input()))
A = list(map(int, input().split()))
R = []
"""プラススタート、マイナススタートの累積和を取る"""
plus_start = []
minus_start = []
"""後ろからの累積和"""
plus_start_rev = []
minus_start_rev = []
tmp = 0
pm = -1
for i in range(N):
pm *= -1
tmp += A[i] * pm
plus_start.append(tmp)
tmp = 0
pm = -1
for i in range(-1, -N -... | N = int(eval(input()))
A = list(map(int, input().split()))
R = []
tmp = 0
pm = -1
for i in range(N):
pm *= -1
tmp += A[i] * pm
R.append(tmp)
for i in range(1, N):
tmp = 2 * A[i - 1] - R[i - 1]
R.append(tmp)
print((*R))
| false | 68.627451 | [
"-\"\"\"プラススタート、マイナススタートの累積和を取る\"\"\"",
"-plus_start = []",
"-minus_start = []",
"-\"\"\"後ろからの累積和\"\"\"",
"-plus_start_rev = []",
"-minus_start_rev = []",
"- plus_start.append(tmp)",
"-tmp = 0",
"-pm = -1",
"-for i in range(-1, -N - 1, -1):",
"- pm *= -1",
"- tmp += A[i] * pm",
"- ... | false | 0.036899 | 0.040329 | 0.914948 | [
"s052898977",
"s175304233"
] |
u074230519 | p02971 | python | s147960212 | s746682565 | 665 | 565 | 18,648 | 12,508 | Accepted | Accepted | 15.04 | # -*- coding: utf-8 -*-
N = int(eval(input()))
values = [0]*N
value_count_map = {}
max_value = 0
next_max_value = max_value
for i in range(N):
in_value = int(eval(input()))
values[i] = in_value
value_count = 0
if in_value in value_count_map:
value_count = value_count_map[in_valu... | # -*- coding: utf-8 -*-
N = int(eval(input()))
values = [0]*N
max_value_count = 0
max_value = 0
next_max_value = max_value
for i in range(N):
in_value = int(eval(input()))
values[i] = in_value
if in_value == max_value:
max_value_count = max_value_count + 1
elif in_value > max_... | 30 | 27 | 729 | 633 | # -*- coding: utf-8 -*-
N = int(eval(input()))
values = [0] * N
value_count_map = {}
max_value = 0
next_max_value = max_value
for i in range(N):
in_value = int(eval(input()))
values[i] = in_value
value_count = 0
if in_value in value_count_map:
value_count = value_count_map[in_value]
value_co... | # -*- coding: utf-8 -*-
N = int(eval(input()))
values = [0] * N
max_value_count = 0
max_value = 0
next_max_value = max_value
for i in range(N):
in_value = int(eval(input()))
values[i] = in_value
if in_value == max_value:
max_value_count = max_value_count + 1
elif in_value > max_value:
ne... | false | 10 | [
"-value_count_map = {}",
"+max_value_count = 0",
"- value_count = 0",
"- if in_value in value_count_map:",
"- value_count = value_count_map[in_value]",
"- value_count_map[in_value] = value_count + 1",
"- if in_value > max_value:",
"+ if in_value == max_value:",
"+ max_va... | false | 0.077118 | 0.129255 | 0.59664 | [
"s147960212",
"s746682565"
] |
u836737505 | p03455 | python | s439178753 | s586245413 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | a,b = list(map(int, input().split()))
print(("Odd" if (a*b)%2 else "Even")) | a,b = list(map(int, input().split()))
print(("Odd" if a*b%2 else "Even")) | 2 | 2 | 68 | 66 | a, b = list(map(int, input().split()))
print(("Odd" if (a * b) % 2 else "Even"))
| a, b = list(map(int, input().split()))
print(("Odd" if a * b % 2 else "Even"))
| false | 0 | [
"-print((\"Odd\" if (a * b) % 2 else \"Even\"))",
"+print((\"Odd\" if a * b % 2 else \"Even\"))"
] | false | 0.044844 | 0.045508 | 0.985418 | [
"s439178753",
"s586245413"
] |
u974792613 | p02813 | python | s733332903 | s426143188 | 89 | 43 | 8,052 | 3,060 | Accepted | Accepted | 51.69 | import itertools
def checkArrays(arr1, arr2):
if len(arr1) != len(arr2):
return False
for i in range(len(arr1)):
if arr1[i] != arr2[i]:
return False
return True
n = int(eval(input()))
arrays = list(itertools.permutations([i for i in range(1, n + 1)]))
p ... | import itertools
n = int(eval(input()))
array = [i for i in range(1, n + 1)]
gen_array = itertools.permutations(array, n)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
idx = 1
for lis in gen_array:
if list(lis) == a:
num_a = idx
if list(lis) == b:
num... | 31 | 19 | 571 | 366 | import itertools
def checkArrays(arr1, arr2):
if len(arr1) != len(arr2):
return False
for i in range(len(arr1)):
if arr1[i] != arr2[i]:
return False
return True
n = int(eval(input()))
arrays = list(itertools.permutations([i for i in range(1, n + 1)]))
p = list(map(int, input(... | import itertools
n = int(eval(input()))
array = [i for i in range(1, n + 1)]
gen_array = itertools.permutations(array, n)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
idx = 1
for lis in gen_array:
if list(lis) == a:
num_a = idx
if list(lis) == b:
num_b = idx
idx +... | false | 38.709677 | [
"-",
"-def checkArrays(arr1, arr2):",
"- if len(arr1) != len(arr2):",
"- return False",
"- for i in range(len(arr1)):",
"- if arr1[i] != arr2[i]:",
"- return False",
"- return True",
"-",
"-",
"-arrays = list(itertools.permutations([i for i in range(1, n + 1)]))... | false | 0.040084 | 0.040526 | 0.989092 | [
"s733332903",
"s426143188"
] |
u163783894 | p02605 | python | s368115572 | s162495743 | 1,828 | 1,666 | 274,340 | 276,236 | Accepted | Accepted | 8.86 | import sys
from collections import defaultdict
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = ... | from collections import defaultdict
from bisect import bisect_left
INF = 10**18
def calc(data, p, q):
ret = INF
for k in list(data.keys()):
for i in range(len(data[k][p])):
now = data[k][p][i]
j = bisect_left(data[k][q], now)
if j < len(data[k][q]):... | 130 | 62 | 3,621 | 1,495 | import sys
from collections import defaultdict
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode("utf-8")
in_nl = lambda: list... | from collections import defaultdict
from bisect import bisect_left
INF = 10**18
def calc(data, p, q):
ret = INF
for k in list(data.keys()):
for i in range(len(data[k][p])):
now = data[k][p][i]
j = bisect_left(data[k][q], now)
if j < len(data[k][q]):
... | false | 52.307692 | [
"-import sys",
"-import bisect",
"+from bisect import bisect_left",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"-in_n = lambda: int(readline())",
"-in_nn = lambda: list(map(int, readline().split()))",
"-in_s = lambda: readline... | false | 0.045313 | 0.049349 | 0.918223 | [
"s368115572",
"s162495743"
] |
u282228874 | p03029 | python | s912554354 | s515169951 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | a,p = list(map(int,input().split()))
print(((3*a+p)//2)) | a,b = list(map(int,input().split()))
print(((3*a+b)//2)) | 2 | 2 | 49 | 49 | a, p = list(map(int, input().split()))
print(((3 * a + p) // 2))
| a, b = list(map(int, input().split()))
print(((3 * a + b) // 2))
| false | 0 | [
"-a, p = list(map(int, input().split()))",
"-print(((3 * a + p) // 2))",
"+a, b = list(map(int, input().split()))",
"+print(((3 * a + b) // 2))"
] | false | 0.094507 | 0.101357 | 0.932419 | [
"s912554354",
"s515169951"
] |
u794173881 | p02768 | python | s476512195 | s535567403 | 348 | 197 | 54,260 | 54,256 | Accepted | Accepted | 43.39 | class Combination:
'''MOD上の
計算量:階乗・逆元テーブルの作成O(N)
nCkを求めるO(1)'''
def __init__(self, n, MOD):
self.fact = [1]
for i in range(1, n + 1):
self.fact.append(self.fact[-1] * i % MOD)
self.inv_fact = [pow(self.fact[i], MOD - 2, MOD) for i in range(n + 1)]
s... | class Combination:
"""階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う"""
def __init__(self, n, MOD):
self.fact = [1]
for i in range(1, n + 1):
self.fact.append(self.fact[-1] * i % MOD)
self.inv_fact = [0] * (n + 1)
self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
... | 53 | 53 | 1,412 | 1,537 | class Combination:
"""MOD上の
計算量:階乗・逆元テーブルの作成O(N)
nCkを求めるO(1)"""
def __init__(self, n, MOD):
self.fact = [1]
for i in range(1, n + 1):
self.fact.append(self.fact[-1] * i % MOD)
self.inv_fact = [pow(self.fact[i], MOD - 2, MOD) for i in range(n + 1)]
self.MOD = ... | class Combination:
"""階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う"""
def __init__(self, n, MOD):
self.fact = [1]
for i in range(1, n + 1):
self.fact.append(self.fact[-1] * i % MOD)
self.inv_fact = [0] * (n + 1)
self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
... | false | 0 | [
"- \"\"\"MOD上の",
"- 計算量:階乗・逆元テーブルの作成O(N)",
"- nCkを求めるO(1)\"\"\"",
"+ \"\"\"階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う\"\"\"",
"- self.inv_fact = [pow(self.fact[i], MOD - 2, MOD) for i in range(n + 1)]",
"+ self.inv_fact = [0] * (n + 1)",
"+ self.inv_fact[n] = pow(self.fact... | false | 1.471592 | 0.263942 | 5.575432 | [
"s476512195",
"s535567403"
] |
u580977620 | p02402 | python | s866573324 | s898812406 | 50 | 10 | 7,124 | 5,404 | Accepted | Accepted | 80 | n = int(input())
a = list(map(int, input().split()))
print(min(a), max(a), sum(a)) | N = eval(input())
l = list(map(int, input().split()))
print(('%d %d %d' % (min(l), max(l), sum(l))))
| 4 | 5 | 87 | 98 | n = int(input())
a = list(map(int, input().split()))
print(min(a), max(a), sum(a))
| N = eval(input())
l = list(map(int, input().split()))
print(("%d %d %d" % (min(l), max(l), sum(l))))
| false | 20 | [
"-n = int(input())",
"-a = list(map(int, input().split()))",
"-print(min(a), max(a), sum(a))",
"+N = eval(input())",
"+l = list(map(int, input().split()))",
"+print((\"%d %d %d\" % (min(l), max(l), sum(l))))"
] | false | 0.036999 | 0.036286 | 1.01965 | [
"s866573324",
"s898812406"
] |
u638456847 | p02685 | python | s749223274 | s768055265 | 852 | 317 | 9,220 | 32,956 | Accepted | Accepted | 62.79 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
# 0^0 = 1
def main():
N,M,K = list(map(int, readline().split()))
MOD = 998244353
if M == 1:
if K == N - 1:
print((1))
else:
print((0))
exit()
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
fac = [1, 1] # 元テーブル
f_inv = [1, 1] # 逆元テーブル
inv = [0, 1] # 逆元テーブル計算用テーブル
def prepare(n, mod):
for i in range(2, n+1):
fac.append((fac[-1] * i) % mod)
inv.append((-inv[mod % i] * (m... | 38 | 53 | 691 | 1,046 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
# 0^0 = 1
def main():
N, M, K = list(map(int, readline().split()))
MOD = 998244353
if M == 1:
if K == N - 1:
print((1))
else:
print((0))
exit()
m = pow(M - 1, N... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
fac = [1, 1] # 元テーブル
f_inv = [1, 1] # 逆元テーブル
inv = [0, 1] # 逆元テーブル計算用テーブル
def prepare(n, mod):
for i in range(2, n + 1):
fac.append((fac[-1] * i) % mod)
inv.append((-inv[mod % i] * (mod // i)) % mod)... | false | 28.301887 | [
"-# 0^0 = 1",
"+fac = [1, 1] # 元テーブル",
"+f_inv = [1, 1] # 逆元テーブル",
"+inv = [0, 1] # 逆元テーブル計算用テーブル",
"+",
"+",
"+def prepare(n, mod):",
"+ for i in range(2, n + 1):",
"+ fac.append((fac[-1] * i) % mod)",
"+ inv.append((-inv[mod % i] * (mod // i)) % mod)",
"+ f_inv.appen... | false | 0.066548 | 0.155516 | 0.427917 | [
"s749223274",
"s768055265"
] |
u489959379 | p02803 | python | s706876570 | s337413299 | 239 | 219 | 9,376 | 10,488 | Accepted | Accepted | 8.37 | import sys
from collections import deque
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
start = []
for h in range(H):
for w in range(W):
if S[h]... | import sys
from collections import deque
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
H, W = list(map(int, input().split()))
grid = [eval(input()) for _ in range(H)]
res = []
for sh in range(H):
for sw in range(W):
if grid[sh... | 46 | 36 | 1,308 | 1,126 | import sys
from collections import deque
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
start = []
for h in range(H):
for w in range(W):
if S[h][w] != "#":
... | import sys
from collections import deque
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
H, W = list(map(int, input().split()))
grid = [eval(input()) for _ in range(H)]
res = []
for sh in range(H):
for sw in range(W):
if grid[sh][sw] == "#":
... | false | 21.73913 | [
"- S = [list(eval(input())) for _ in range(H)]",
"- start = []",
"- for h in range(H):",
"- for w in range(W):",
"- if S[h][w] != \"#\":",
"- start.append([h, w])",
"- res = 0",
"- for sh, sw in start:",
"- maze = [[f_inf] * W for _ in range(H)]... | false | 0.036092 | 0.035582 | 1.014314 | [
"s706876570",
"s337413299"
] |
u222668979 | p02579 | python | s669365386 | s173180534 | 1,228 | 1,083 | 98,356 | 96,700 | Accepted | Accepted | 11.81 | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10 ** 9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
while len(que) > 0:
x, y = que.popleft()
num = product([-2, -1, 0, 1, 2], repeat=2)
near = [(x + dx, y + dy) for... | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10 ** 9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
while len(que) > 0:
x, y = que.popleft()
if (x, y) == (Dw - 1, Dh - 1):
return dist[y][x]
for i, ... | 34 | 33 | 986 | 933 | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10**9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
while len(que) > 0:
x, y = que.popleft()
num = product([-2, -1, 0, 1, 2], repeat=2)
near = [(x + dx, y + dy) for dx, dy in num]... | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10**9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
while len(que) > 0:
x, y = que.popleft()
if (x, y) == (Dw - 1, Dh - 1):
return dist[y][x]
for i, j in product(list(... | false | 2.941176 | [
"- num = product([-2, -1, 0, 1, 2], repeat=2)",
"- near = [(x + dx, y + dy) for dx, dy in num]",
"- for i, j in near:",
"- cnt = abs(x - i) + abs(y - j) >= 2",
"+ for i, j in product(list(range(-2, 3)), repeat=2):",
"+ cnt = abs(i) + abs(j) >= 2",
"+ ... | false | 0.097809 | 0.035844 | 2.728757 | [
"s669365386",
"s173180534"
] |
u080364835 | p03160 | python | s462646077 | s551774266 | 133 | 123 | 13,928 | 13,976 | Accepted | Accepted | 7.52 | n = int(eval(input()))
hl = list(map(int, input().split()))
cost = [0] * n
cost[0] = 0
cost[1] = abs(hl[0] - hl[1])
for i in range(2, n):
cost[i] = (min(cost[i-1] + abs(hl[i] - hl[i-1]),
(cost[i-2] + abs(hl[i] - hl[i-2]))))
print((cost[-1])) | n = int(eval(input()))
h = list(map(int, input().split()))
cost = [1001001001] * n
cost[0] = 0
cost[1] = abs(h[1] - h[0])
for i in range(2, n):
cost[i] = min((cost[i-2] + abs(h[i] - h[i-2])),
cost[i-1] + abs(h[i] - h[i-1]))
print((cost[-1])) | 13 | 12 | 276 | 269 | n = int(eval(input()))
hl = list(map(int, input().split()))
cost = [0] * n
cost[0] = 0
cost[1] = abs(hl[0] - hl[1])
for i in range(2, n):
cost[i] = min(
cost[i - 1] + abs(hl[i] - hl[i - 1]), (cost[i - 2] + abs(hl[i] - hl[i - 2]))
)
print((cost[-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
cost = [1001001001] * n
cost[0] = 0
cost[1] = abs(h[1] - h[0])
for i in range(2, n):
cost[i] = min(
(cost[i - 2] + abs(h[i] - h[i - 2])), cost[i - 1] + abs(h[i] - h[i - 1])
)
print((cost[-1]))
| false | 7.692308 | [
"-hl = list(map(int, input().split()))",
"-cost = [0] * n",
"+h = list(map(int, input().split()))",
"+cost = [1001001001] * n",
"-cost[1] = abs(hl[0] - hl[1])",
"+cost[1] = abs(h[1] - h[0])",
"- cost[i - 1] + abs(hl[i] - hl[i - 1]), (cost[i - 2] + abs(hl[i] - hl[i - 2]))",
"+ (cost[i - 2... | false | 0.044989 | 0.088904 | 0.506046 | [
"s462646077",
"s551774266"
] |
u581187895 | p03485 | python | s162120438 | s594668479 | 151 | 17 | 12,392 | 2,940 | Accepted | Accepted | 88.74 | import math
import numpy as np
arr = list(map(int, input().split()))
print((math.ceil(np.mean(arr)))) | a, b = list(map(int, input().split()))
print((-(-(a+b)//2)))
| 4 | 2 | 103 | 54 | import math
import numpy as np
arr = list(map(int, input().split()))
print((math.ceil(np.mean(arr))))
| a, b = list(map(int, input().split()))
print((-(-(a + b) // 2)))
| false | 50 | [
"-import math",
"-import numpy as np",
"-",
"-arr = list(map(int, input().split()))",
"-print((math.ceil(np.mean(arr))))",
"+a, b = list(map(int, input().split()))",
"+print((-(-(a + b) // 2)))"
] | false | 0.235674 | 0.045974 | 5.126249 | [
"s162120438",
"s594668479"
] |
u662841603 | p03808 | python | s598634005 | s426584874 | 177 | 104 | 11,348 | 11,348 | Accepted | Accepted | 41.24 | import sys
n = eval(input())
v = list(map(int, input().split(' ')))
startHere = [0 for i in range(n)]
if sum(v) % ((n * (n + 1)) / 2) != 0:
print("NO")
sys.exit()
operations = sum(v) / ((n * (n + 1)) / 2)
for i in range(n):
diff = v[(i + 1) % n] - v[i]
startHere[i] = (operations - diff) / n
c... | import sys
n = eval(input())
v = list(map(int, input().split(' ')))
startHere = [0 for i in range(n)]
if sum(v) % ((n * (n + 1)) / 2) != 0:
print("NO")
sys.exit()
operations = sum(v) / ((n * (n + 1)) / 2)
operationsFound = 0
for i in range(n):
diff = v[(i + 1) % n] - v[i]
if (operations - diff)... | 35 | 26 | 712 | 500 | import sys
n = eval(input())
v = list(map(int, input().split(" ")))
startHere = [0 for i in range(n)]
if sum(v) % ((n * (n + 1)) / 2) != 0:
print("NO")
sys.exit()
operations = sum(v) / ((n * (n + 1)) / 2)
for i in range(n):
diff = v[(i + 1) % n] - v[i]
startHere[i] = (operations - diff) / n
contributio... | import sys
n = eval(input())
v = list(map(int, input().split(" ")))
startHere = [0 for i in range(n)]
if sum(v) % ((n * (n + 1)) / 2) != 0:
print("NO")
sys.exit()
operations = sum(v) / ((n * (n + 1)) / 2)
operationsFound = 0
for i in range(n):
diff = v[(i + 1) % n] - v[i]
if (operations - diff) % n != ... | false | 25.714286 | [
"+operationsFound = 0",
"- startHere[i] = (operations - diff) / n",
"-contribution = 0",
"-gathered = 0",
"-for i in range(n):",
"- v[i] -= contribution",
"- gathered += startHere[i % n]",
"- contribution += gathered",
"-for i in range(n):",
"- v[i] -= contribution",
"- gathere... | false | 0.044215 | 0.058786 | 0.752129 | [
"s598634005",
"s426584874"
] |
u375616706 | p02845 | python | s131840178 | s575549372 | 251 | 224 | 52,952 | 52,908 | Accepted | Accepted | 10.76 | N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9+7
ans = 1
dp = [0]*3
for a in A:
cnt = 0
for i in range(3):
if a == dp[i]:
cnt += 1
for i in range(3):
if a == dp[i]:
dp[i] += 1
break
ans = ans*cnt % MOD
print(ans... | N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9+7
ans = 1
dp = [0]*3
for a in A:
ans = ans*dp.count(a) % MOD
try:
dp[dp.index(a)] += 1
except ValueError:
break
print(ans)
| 17 | 13 | 316 | 229 | N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 1
dp = [0] * 3
for a in A:
cnt = 0
for i in range(3):
if a == dp[i]:
cnt += 1
for i in range(3):
if a == dp[i]:
dp[i] += 1
break
ans = ans * cnt % MOD
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 1
dp = [0] * 3
for a in A:
ans = ans * dp.count(a) % MOD
try:
dp[dp.index(a)] += 1
except ValueError:
break
print(ans)
| false | 23.529412 | [
"- cnt = 0",
"- for i in range(3):",
"- if a == dp[i]:",
"- cnt += 1",
"- for i in range(3):",
"- if a == dp[i]:",
"- dp[i] += 1",
"- break",
"- ans = ans * cnt % MOD",
"+ ans = ans * dp.count(a) % MOD",
"+ try:",
"+ dp[dp... | false | 0.043901 | 0.044363 | 0.989573 | [
"s131840178",
"s575549372"
] |
u604774382 | p02417 | python | s714833017 | s459335202 | 30 | 10 | 6,724 | 4,236 | Accepted | Accepted | 66.67 | import sys
chash = {}
for i in range( ord( 'a' ), ord( 'z' )+1 ):
chash[ chr( i ) ] = 0
for line in sys.stdin:
for i in range( len( line ) ):
if line[i].isalpha():
chash[ line[i].lower() ] += 1
for i in range( ord( 'a' ), ord( 'z' )+1 ):
print(( "{:s} : {:d}".format( ch... | import sys
chash = {}
for i in range( ord( 'a' ), ord( 'z' )+1 ):
chash[ chr( i ) ] = 0
while True:
line = sys.stdin.readline().rstrip()
if not line:
break
for i in range( len( line ) ):
if line[i].isalpha():
chash[ line[i].lower() ] += 1
for i in range( o... | 13 | 16 | 348 | 412 | import sys
chash = {}
for i in range(ord("a"), ord("z") + 1):
chash[chr(i)] = 0
for line in sys.stdin:
for i in range(len(line)):
if line[i].isalpha():
chash[line[i].lower()] += 1
for i in range(ord("a"), ord("z") + 1):
print(("{:s} : {:d}".format(chr(i), chash[chr(i)])))
| import sys
chash = {}
for i in range(ord("a"), ord("z") + 1):
chash[chr(i)] = 0
while True:
line = sys.stdin.readline().rstrip()
if not line:
break
for i in range(len(line)):
if line[i].isalpha():
chash[line[i].lower()] += 1
for i in range(ord("a"), ord("z") + 1):
print(... | false | 18.75 | [
"-for line in sys.stdin:",
"+while True:",
"+ line = sys.stdin.readline().rstrip()",
"+ if not line:",
"+ break"
] | false | 0.036132 | 0.040919 | 0.883026 | [
"s714833017",
"s459335202"
] |
u075595666 | p03040 | python | s704353227 | s384022863 | 1,888 | 730 | 124,880 | 109,140 | Accepted | Accepted | 61.33 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from bisect import insort
class BIT():
def __init__(self, n):
'''
n = 要素数
添字は i = 0 ~ n-1 となる
'''
self.n = n
self.bit = [0] * (n + 1)
def add(self, i, x):
'''... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
self.depth = n.bit_length()
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
... | 83 | 73 | 1,812 | 1,717 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from bisect import insort
class BIT:
def __init__(self, n):
"""
n = 要素数
添字は i = 0 ~ n-1 となる
"""
self.n = n
self.bit = [0] * (n + 1)
def add(self, i, x):
"""i番目の要素にxを加算する"""
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
self.depth = n.bit_length()
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -... | false | 12.048193 | [
"-from bisect import insort",
"-class BIT:",
"+class Bit:",
"- \"\"\"",
"- n = 要素数",
"- 添字は i = 0 ~ n-1 となる",
"- \"\"\"",
"- self.n = n",
"- self.bit = [0] * (n + 1)",
"+ self.size = n",
"+ self.tree = [0] * (n + 1)",
"+ self.depth... | false | 0.08278 | 0.09225 | 0.897345 | [
"s704353227",
"s384022863"
] |
u324314500 | p03073 | python | s978114328 | s451738883 | 52 | 44 | 3,188 | 3,188 | Accepted | Accepted | 15.38 | import sys
def i2s():
return sys.stdin.readline()
def ii2ss(n):
return [sys.stdin.readline() for _ in range(n)]
def sp2nn(sp, sep=' '):
return [int(s) for s in sp.split(sep)]
def ss2nn(ss):
return [int(s) for s in list(ss)]
def main(S):
S = S.rstrip()
c0 = 0
c1 = 0
... | # AtCoder Beginner Contest 124
# https://atcoder.jp/contests/abc124
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(... | 27 | 32 | 490 | 794 | import sys
def i2s():
return sys.stdin.readline()
def ii2ss(n):
return [sys.stdin.readline() for _ in range(n)]
def sp2nn(sp, sep=" "):
return [int(s) for s in sp.split(sep)]
def ss2nn(ss):
return [int(s) for s in list(ss)]
def main(S):
S = S.rstrip()
c0 = 0
c1 = 0
for i, s in ... | # AtCoder Beginner Contest 124
# https://atcoder.jp/contests/abc124
import sys
s2nn = lambda s: [int(c) for c in s.split(" ")]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii... | false | 15.625 | [
"+# AtCoder Beginner Contest 124",
"+# https://atcoder.jp/contests/abc124",
"-",
"-def i2s():",
"- return sys.stdin.readline()",
"-",
"-",
"-def ii2ss(n):",
"- return [sys.stdin.readline() for _ in range(n)]",
"-",
"-",
"-def sp2nn(sp, sep=\" \"):",
"- return [int(s) for s in sp.spl... | false | 0.04484 | 0.106296 | 0.421838 | [
"s978114328",
"s451738883"
] |
u968166680 | p02630 | python | s496361117 | s848345904 | 226 | 148 | 113,532 | 36,420 | Accepted | Accepted | 34.51 | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
A = list(map(int, readline().split()))
Q, *BC = list(map(int, read().s... | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
A = list(map(int, readline().split()))
Q, *BC = list(map(int, read().s... | 30 | 32 | 580 | 606 | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
A = list(map(int, readline().split()))
Q, *BC = list(map(int, read().split()))
tot... | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
A = list(map(int, readline().split()))
Q, *BC = list(map(int, read().split()))
tot... | false | 6.25 | [
"- d = Counter(A)",
"+ d = [0] * (10**5 + 1)",
"+ for a in A:",
"+ d[a] += 1",
"- total -= b * d[b]",
"- total += c * d[b]",
"+ total += (c - b) * d[b]"
] | false | 0.038346 | 0.044228 | 0.866999 | [
"s496361117",
"s848345904"
] |
u072717685 | p03944 | python | s853199573 | s387618524 | 60 | 18 | 3,064 | 3,064 | Accepted | Accepted | 70 | W, H, N = list(map(int, input().split()))
paint_dot = {}
for _ in range(N):
t1, t2, t3 = list(map(int,input().split()))
paint_dot[(t1, t2)] = t3
mat = [[1]*W for i in range(H)]
for key in paint_dot:
x = paint_dot[key]
if x == 1:
for row in mat:
for i in range(key[0]):
row[i] = 0... | W, H, N = list(map(int, input().split()))
paint_dot = {}
for _ in range(N):
t1, t2, t3 = list(map(int,input().split()))
paint_dot[(t1, t2)] = t3
pattern_H = [1]*H
pattern_W = [1]*W
for key in paint_dot:
if paint_dot[key] == 1:
for i in range(key[0]):
pattern_W[i] = 0
elif paint_dot[key]... | 30 | 25 | 640 | 567 | W, H, N = list(map(int, input().split()))
paint_dot = {}
for _ in range(N):
t1, t2, t3 = list(map(int, input().split()))
paint_dot[(t1, t2)] = t3
mat = [[1] * W for i in range(H)]
for key in paint_dot:
x = paint_dot[key]
if x == 1:
for row in mat:
for i in range(key[0]):
... | W, H, N = list(map(int, input().split()))
paint_dot = {}
for _ in range(N):
t1, t2, t3 = list(map(int, input().split()))
paint_dot[(t1, t2)] = t3
pattern_H = [1] * H
pattern_W = [1] * W
for key in paint_dot:
if paint_dot[key] == 1:
for i in range(key[0]):
pattern_W[i] = 0
elif paint_... | false | 16.666667 | [
"-mat = [[1] * W for i in range(H)]",
"+pattern_H = [1] * H",
"+pattern_W = [1] * W",
"- x = paint_dot[key]",
"- if x == 1:",
"- for row in mat:",
"- for i in range(key[0]):",
"- row[i] = 0",
"- elif x == 2:",
"- for row in mat:",
"- fo... | false | 0.053896 | 0.052363 | 1.02928 | [
"s853199573",
"s387618524"
] |
u079022693 | p02695 | python | s197031517 | s463313058 | 794 | 643 | 136,408 | 125,668 | Accepted | Accepted | 19.02 | from sys import stdin
import itertools
import numpy as np
from numba import njit
@njit(cache=True)
def f():
max_res=0
for i in range(l):
res=0
for j in range(Q):
if arrays[i][b[j]-1]-arrays[i][a[j]-1]==c[j]:
res+=d[j]
max_res=max(max_res,res)
... | from sys import stdin
import itertools
import numpy as np
from numba import njit
@njit("i8(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:,:])",cache=True)
def f(l,Q,a,b,c,d,arrays):
max_res=0
for i in range(l):
res=0
for j in range(Q):
if arrays[i][b[j]-1]-arrays[i][a[j]-1]==c[j]:
... | 30 | 34 | 722 | 902 | from sys import stdin
import itertools
import numpy as np
from numba import njit
@njit(cache=True)
def f():
max_res = 0
for i in range(l):
res = 0
for j in range(Q):
if arrays[i][b[j] - 1] - arrays[i][a[j] - 1] == c[j]:
res += d[j]
max_res = max(max_res, res... | from sys import stdin
import itertools
import numpy as np
from numba import njit
@njit("i8(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:,:])", cache=True)
def f(l, Q, a, b, c, d, arrays):
max_res = 0
for i in range(l):
res = 0
for j in range(Q):
if arrays[i][b[j] - 1] - arrays[i][a[j] - 1] ==... | false | 11.764706 | [
"-@njit(cache=True)",
"-def f():",
"+@njit(\"i8(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:,:])\", cache=True)",
"+def f(l, Q, a, b, c, d, arrays):",
"-# 入力",
"-readline = stdin.readline",
"-N, M, Q = list(map(int, readline().split()))",
"-a = np.zeros(Q, dtype=np.int64)",
"-b = np.zeros(Q, dtype=np.int64)",... | false | 0.342299 | 0.329423 | 1.039086 | [
"s197031517",
"s463313058"
] |
u113971909 | p02984 | python | s753395286 | s879960737 | 192 | 129 | 24,776 | 14,028 | Accepted | Accepted | 32.81 | N=int(eval(input()))
k=N//2
D=list(map(int,input().split()))
DD=D[:]+D[:]
DS=[0]*(2*N+1)
for i in range(0,2*N-2,2):
DS[i+2]=DS[i]+DD[i]
DS[i+3]=DS[i+1]+DD[i+1]
T=sum(D)
ret=[0]*N
for i in range(N):
ret[i]=T-2*(DS[i+1+2*k]-DS[i+1])
print((*ret))
| N=int(eval(input()))
D=list(map(int,input().split()))
ret=[0]*N
ret[0]=sum(D)-2*sum(D[1:N:2])
for i in range(1,N):
ret[i]=2*D[i-1]-ret[i-1]
print((*ret)) | 13 | 7 | 255 | 153 | N = int(eval(input()))
k = N // 2
D = list(map(int, input().split()))
DD = D[:] + D[:]
DS = [0] * (2 * N + 1)
for i in range(0, 2 * N - 2, 2):
DS[i + 2] = DS[i] + DD[i]
DS[i + 3] = DS[i + 1] + DD[i + 1]
T = sum(D)
ret = [0] * N
for i in range(N):
ret[i] = T - 2 * (DS[i + 1 + 2 * k] - DS[i + 1])
print((*ret)... | N = int(eval(input()))
D = list(map(int, input().split()))
ret = [0] * N
ret[0] = sum(D) - 2 * sum(D[1:N:2])
for i in range(1, N):
ret[i] = 2 * D[i - 1] - ret[i - 1]
print((*ret))
| false | 46.153846 | [
"-k = N // 2",
"-DD = D[:] + D[:]",
"-DS = [0] * (2 * N + 1)",
"-for i in range(0, 2 * N - 2, 2):",
"- DS[i + 2] = DS[i] + DD[i]",
"- DS[i + 3] = DS[i + 1] + DD[i + 1]",
"-T = sum(D)",
"-for i in range(N):",
"- ret[i] = T - 2 * (DS[i + 1 + 2 * k] - DS[i + 1])",
"+ret[0] = sum(D) - 2 * sum... | false | 0.038657 | 0.066321 | 0.582873 | [
"s753395286",
"s879960737"
] |
u707124227 | p03274 | python | s172717329 | s151106128 | 117 | 94 | 14,780 | 14,380 | Accepted | Accepted | 19.66 | n,k=list(map(int,input().split()))
x=list(map(int,input().split()))
xp=[xi for xi in x if xi>=0]
xm=[xi for xi in x if xi<0]
xm.sort(reverse=True)
ans=3*10**8
for i in range(k+1):
# xpからi個のろうそくをつける。xmからはk-i個火をつける
if i>len(xp) or k-i>len(xm):
continue
a=xp[i-1] if len(xp)>0 and i>0 else 0
... | def main():
import bisect
n,k=list(map(int,input().split()))
x=list(map(int,input().split()))
ans=abs(x[0])*2+abs(x[-1])*2
if 0 in x:
r=x.index(0)
l=max(0,r-(k-1))
else:
r=bisect.bisect_right(x,0)
l=max(0,r-k)
ans=2*abs(x[0])+2*abs(x[-1])
for i in range(l,min(n-k+1,r+1)):
... | 15 | 23 | 404 | 560 | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
xp = [xi for xi in x if xi >= 0]
xm = [xi for xi in x if xi < 0]
xm.sort(reverse=True)
ans = 3 * 10**8
for i in range(k + 1):
# xpからi個のろうそくをつける。xmからはk-i個火をつける
if i > len(xp) or k - i > len(xm):
continue
a = xp[i - 1] if len(x... | def main():
import bisect
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = abs(x[0]) * 2 + abs(x[-1]) * 2
if 0 in x:
r = x.index(0)
l = max(0, r - (k - 1))
else:
r = bisect.bisect_right(x, 0)
l = max(0, r - k)
ans = 2 * abs(x[0... | false | 34.782609 | [
"-n, k = list(map(int, input().split()))",
"-x = list(map(int, input().split()))",
"-xp = [xi for xi in x if xi >= 0]",
"-xm = [xi for xi in x if xi < 0]",
"-xm.sort(reverse=True)",
"-ans = 3 * 10**8",
"-for i in range(k + 1):",
"- # xpからi個のろうそくをつける。xmからはk-i個火をつける",
"- if i > len(xp) or k - i ... | false | 0.037986 | 0.039052 | 0.972704 | [
"s172717329",
"s151106128"
] |
u633068244 | p00707 | python | s426828307 | s631179510 | 430 | 300 | 4,360 | 4,324 | Accepted | Accepted | 30.23 | while 1:
W,H = list(map(int,input().split()))
if W == 0: break
C = [list(input()) for _ in range(H)]
dp = [["0"]*W for _ in range(H)]
ans = 0
for h in range(H):
for w in range(W):
if C[h][w].isdigit():
dp[h][w] = str(max(int(dp[h][w]),int(C[h][w... | while 1:
W,H = list(map(int,input().split()))
if W == 0: break
C = [list(input()) for _ in range(H)]
dp = [[0]*W for _ in range(H)]
ans = 0
for h in range(H):
for w in range(W):
if C[h][w].isdigit():
dp[h][w] = max(dp[h][w],int(C[h][w]))
... | 15 | 14 | 564 | 530 | while 1:
W, H = list(map(int, input().split()))
if W == 0:
break
C = [list(input()) for _ in range(H)]
dp = [["0"] * W for _ in range(H)]
ans = 0
for h in range(H):
for w in range(W):
if C[h][w].isdigit():
dp[h][w] = str(max(int(dp[h][w]), int(C[h][w])... | while 1:
W, H = list(map(int, input().split()))
if W == 0:
break
C = [list(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
ans = 0
for h in range(H):
for w in range(W):
if C[h][w].isdigit():
dp[h][w] = max(dp[h][w], int(C[h][w]))
... | false | 6.666667 | [
"- dp = [[\"0\"] * W for _ in range(H)]",
"+ dp = [[0] * W for _ in range(H)]",
"- dp[h][w] = str(max(int(dp[h][w]), int(C[h][w])))",
"+ dp[h][w] = max(dp[h][w], int(C[h][w]))",
"- dp[h][w] = str(max(int(dp[h][w]), int(dp[h][w - 1] + C[h][w])))",
"+ ... | false | 0.107687 | 0.071177 | 1.512937 | [
"s426828307",
"s631179510"
] |
u796942881 | p03137 | python | s058180184 | s307188289 | 94 | 72 | 13,964 | 15,116 | Accepted | Accepted | 23.4 | def main():
N, M, *X = list(map(int, open(0).read().split()))
X.sort()
D = [j - i for i, j in zip(X, X[1:])]
D.sort()
print((0 if M <= N else sum(D[:M - N])))
return
main()
| def main():
N, M, *X = list(map(int, open(0).read().split()))
X = sorted(set(X))
D = [j - i for i, j in zip(X, X[1:])]
D.sort()
print((0 if M <= N else sum(D[:M - N])))
return
main()
| 10 | 10 | 200 | 210 | def main():
N, M, *X = list(map(int, open(0).read().split()))
X.sort()
D = [j - i for i, j in zip(X, X[1:])]
D.sort()
print((0 if M <= N else sum(D[: M - N])))
return
main()
| def main():
N, M, *X = list(map(int, open(0).read().split()))
X = sorted(set(X))
D = [j - i for i, j in zip(X, X[1:])]
D.sort()
print((0 if M <= N else sum(D[: M - N])))
return
main()
| false | 0 | [
"- X.sort()",
"+ X = sorted(set(X))"
] | false | 0.04008 | 0.040677 | 0.985334 | [
"s058180184",
"s307188289"
] |
u941753895 | p03658 | python | s056030701 | s229894482 | 22 | 18 | 3,316 | 2,940 | Accepted | Accepted | 18.18 | n,k=list(map(int,input().split()))
l=list(map(int,input().split()))
l.sort()
a=l[-k:]
print((sum(a))) | # 入力
N,K=list(map(int,input().split()))
l=list(map(int,input().split()))
l.sort()
l.reverse()
# K個の和を出力
print((sum(l[:K]))) | 5 | 9 | 97 | 125 | n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort()
a = l[-k:]
print((sum(a)))
| # 入力
N, K = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort()
l.reverse()
# K個の和を出力
print((sum(l[:K])))
| false | 44.444444 | [
"-n, k = list(map(int, input().split()))",
"+# 入力",
"+N, K = list(map(int, input().split()))",
"-a = l[-k:]",
"-print((sum(a)))",
"+l.reverse()",
"+# K個の和を出力",
"+print((sum(l[:K])))"
] | false | 0.035974 | 0.034926 | 1.030002 | [
"s056030701",
"s229894482"
] |
u546338822 | p02912 | python | s936071693 | s805877704 | 164 | 129 | 14,180 | 20,464 | Accepted | Accepted | 21.34 | def main():
import heapq
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
heap = []
for i in range(n):
heapq.heappush(heap,-1*a[i])
for i in range(m):
a = int(heapq.heappop(heap)/2)
heapq.heappush(heap,a)
print((-1*sum(heap)))
i... | def main():
import heapq
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
A = []
for i in range(n):
heapq.heappush(A,-1*a[i])
for i in range(m):
a = heapq.heappop(A)
a = (-1*a)//2
heapq.heappush(A,-1*a)
print((-1*sum(A)))
i... | 16 | 15 | 349 | 350 | def main():
import heapq
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
heap = []
for i in range(n):
heapq.heappush(heap, -1 * a[i])
for i in range(m):
a = int(heapq.heappop(heap) / 2)
heapq.heappush(heap, a)
print((-1 * sum(heap)))
if _... | def main():
import heapq
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
A = []
for i in range(n):
heapq.heappush(A, -1 * a[i])
for i in range(m):
a = heapq.heappop(A)
a = (-1 * a) // 2
heapq.heappush(A, -1 * a)
print((-1 * sum(A)))... | false | 6.25 | [
"- heap = []",
"+ A = []",
"- heapq.heappush(heap, -1 * a[i])",
"+ heapq.heappush(A, -1 * a[i])",
"- a = int(heapq.heappop(heap) / 2)",
"- heapq.heappush(heap, a)",
"- print((-1 * sum(heap)))",
"+ a = heapq.heappop(A)",
"+ a = (-1 * a) // 2",
"+ ... | false | 0.173302 | 0.047341 | 3.660706 | [
"s936071693",
"s805877704"
] |
u360116509 | p03722 | python | s432457141 | s472438773 | 1,372 | 580 | 3,304 | 3,420 | Accepted | Accepted | 57.73 | def main():
N, M = list(map(int, input().split()))
g = []
d = [float('INF')] * (N + 1)
d[1] = 0
for _ in range(M):
a, b, c = list(map(int, input().split()))
g.append((a, b, -c))
for i in range(2 * N):
for x, y, z in g:
if d[x] != float('INF') and d[y... | def main():
N, M = list(map(int, input().split()))
g = []
INF = 10 ** 9 * 1000
d = [INF] * (N + 1)
d[1] = 0
for _ in range(M):
a, b, c = list(map(int, input().split()))
g.append((a, b, -c))
for i in range(2 * N):
for x, y, z in g:
if d[x] != INF... | 20 | 21 | 488 | 496 | def main():
N, M = list(map(int, input().split()))
g = []
d = [float("INF")] * (N + 1)
d[1] = 0
for _ in range(M):
a, b, c = list(map(int, input().split()))
g.append((a, b, -c))
for i in range(2 * N):
for x, y, z in g:
if d[x] != float("INF") and d[y] > d[x] +... | def main():
N, M = list(map(int, input().split()))
g = []
INF = 10**9 * 1000
d = [INF] * (N + 1)
d[1] = 0
for _ in range(M):
a, b, c = list(map(int, input().split()))
g.append((a, b, -c))
for i in range(2 * N):
for x, y, z in g:
if d[x] != INF and d[y] > d... | false | 4.761905 | [
"- d = [float(\"INF\")] * (N + 1)",
"+ INF = 10**9 * 1000",
"+ d = [INF] * (N + 1)",
"- if d[x] != float(\"INF\") and d[y] > d[x] + z:",
"+ if d[x] != INF and d[y] > d[x] + z:"
] | false | 0.042243 | 0.103265 | 0.40907 | [
"s432457141",
"s472438773"
] |
u794544096 | p03352 | python | s027001761 | s135184049 | 70 | 61 | 61,520 | 62,236 | Accepted | Accepted | 12.86 | x = int(eval(input()))
r = 1
for b in range(1, int(x**0.5 + 1)):
for p in range(2, 11):
if b**p > x:
break
r = max(r, b**p)
print(r) | x = int(eval(input()))
cnt = []
for b in range(1, int(x**0.5)+1):
for p in range(2, 11):
if b**p <= x:
cnt.append(b**p)
print((max(cnt))) | 10 | 8 | 177 | 173 | x = int(eval(input()))
r = 1
for b in range(1, int(x**0.5 + 1)):
for p in range(2, 11):
if b**p > x:
break
r = max(r, b**p)
print(r)
| x = int(eval(input()))
cnt = []
for b in range(1, int(x**0.5) + 1):
for p in range(2, 11):
if b**p <= x:
cnt.append(b**p)
print((max(cnt)))
| false | 20 | [
"-r = 1",
"-for b in range(1, int(x**0.5 + 1)):",
"+cnt = []",
"+for b in range(1, int(x**0.5) + 1):",
"- if b**p > x:",
"- break",
"- r = max(r, b**p)",
"-print(r)",
"+ if b**p <= x:",
"+ cnt.append(b**p)",
"+print((max(cnt)))"
] | false | 0.036548 | 0.042628 | 0.857386 | [
"s027001761",
"s135184049"
] |
u177040005 | p03633 | python | s307410796 | s727809838 | 149 | 18 | 12,428 | 3,060 | Accepted | Accepted | 87.92 | import numpy as np
def gcd(a,b):
while b:
a,b = b,a%b
return a
def lcm_base(x, y):
return x*y // gcd(x, y)
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
ans = 1
for t in T:
ans = lcm_base(ans,t)
print(ans)
| N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
def gcd(a,b):#gcd :: greatest common divisor(最大公約数) :: G
if b == 0:
return a
else:
return gcd(b, a%b)
def lcm(X,Y):#lcm :: least common multiple(最小公約数)) :: L
return X*Y // gcd(X,Y) # XY = GL
ans = 1
for t in T:... | 18 | 16 | 260 | 344 | import numpy as np
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm_base(x, y):
return x * y // gcd(x, y)
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
ans = 1
for t in T:
ans = lcm_base(ans, t)
print(ans)
| N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
def gcd(a, b): # gcd :: greatest common divisor(最大公約数) :: G
if b == 0:
return a
else:
return gcd(b, a % b)
def lcm(X, Y): # lcm :: least common multiple(最小公約数)) :: L
return X * Y // gcd(X, Y) # XY = GL
ans = 1
for t i... | false | 11.111111 | [
"-import numpy as np",
"+N = int(eval(input()))",
"+T = [int(eval(input())) for _ in range(N)]",
"-def gcd(a, b):",
"- while b:",
"- a, b = b, a % b",
"- return a",
"+def gcd(a, b): # gcd :: greatest common divisor(最大公約数) :: G",
"+ if b == 0:",
"+ return a",
"+ else:",... | false | 0.036383 | 0.056353 | 0.645629 | [
"s307410796",
"s727809838"
] |
u761320129 | p03478 | python | s548955418 | s585648985 | 33 | 30 | 2,940 | 2,940 | Accepted | Accepted | 9.09 | N,A,B = list(map(int,input().split()))
ans = 0
for n in range(1,N+1):
s = sum(map(int,list(str(n))))
if A <= s <= B:
ans += n
print(ans)
| N,A,B = list(map(int,input().split()))
ans = 0
for n in range(1,N+1):
s = sum(map(int,str(n)))
if A <= s <= B: ans += n
print(ans) | 7 | 6 | 153 | 137 | N, A, B = list(map(int, input().split()))
ans = 0
for n in range(1, N + 1):
s = sum(map(int, list(str(n))))
if A <= s <= B:
ans += n
print(ans)
| N, A, B = list(map(int, input().split()))
ans = 0
for n in range(1, N + 1):
s = sum(map(int, str(n)))
if A <= s <= B:
ans += n
print(ans)
| false | 14.285714 | [
"- s = sum(map(int, list(str(n))))",
"+ s = sum(map(int, str(n)))"
] | false | 0.104146 | 0.037894 | 2.748349 | [
"s548955418",
"s585648985"
] |
u981931040 | p02623 | python | s040268244 | s806981897 | 192 | 146 | 132,824 | 118,092 | Accepted | Accepted | 23.96 | import bisect
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
A_cumulative_sum = [0]
B_cumulative_sum = [B[0]]
for i in range(N):
A_cumulative_sum.append(A[i] + A_cumulative_sum[i])
for i in range(1, M):
B_cumulative_sum.append(... |
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
'''
with open('./b09.txt') as f:
N, M, K = map(int, f.readline().split())
A = list(map(int, f.readline().split()))
B = list(map(int, f.readline().split()))
'''
A_cnt = 0
B_cnt = 0
a... | 25 | 41 | 732 | 859 | import bisect
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
A_cumulative_sum = [0]
B_cumulative_sum = [B[0]]
for i in range(N):
A_cumulative_sum.append(A[i] + A_cumulative_sum[i])
for i in range(1, M):
B_cumulative_sum.append(B[i] + B_... | N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
"""
with open('./b09.txt') as f:
N, M, K = map(int, f.readline().split())
A = list(map(int, f.readline().split()))
B = list(map(int, f.readline().split()))
"""
A_cnt = 0
B_cnt = 0
ans = 0
nowK =... | false | 39.02439 | [
"-import bisect",
"-",
"+\"\"\"",
"+with open('./b09.txt') as f:",
"+ N, M, K = map(int, f.readline().split())",
"+ A = list(map(int, f.readline().split()))",
"+ B = list(map(int, f.readline().split()))",
"+\"\"\"",
"+A_cnt = 0",
"+B_cnt = 0",
"-A_cumulative_sum = [0]",
"-B_cumulative... | false | 0.042493 | 0.160842 | 0.264188 | [
"s040268244",
"s806981897"
] |
u063596417 | p04044 | python | s292004095 | s280848960 | 63 | 30 | 62,444 | 9,116 | Accepted | Accepted | 52.38 | n, l = list(map(int, input().split()))
s = [eval(input()) for _ in range(n)]
s.sort()
print((''.join(s)))
| def main():
n, _ = list(map(int, input().split()))
s = [eval(input()) for _ in range(n)]
s.sort()
print((''.join(s)))
if __name__ == '__main__':
main()
| 4 | 9 | 95 | 168 | n, l = list(map(int, input().split()))
s = [eval(input()) for _ in range(n)]
s.sort()
print(("".join(s)))
| def main():
n, _ = list(map(int, input().split()))
s = [eval(input()) for _ in range(n)]
s.sort()
print(("".join(s)))
if __name__ == "__main__":
main()
| false | 55.555556 | [
"-n, l = list(map(int, input().split()))",
"-s = [eval(input()) for _ in range(n)]",
"-s.sort()",
"-print((\"\".join(s)))",
"+def main():",
"+ n, _ = list(map(int, input().split()))",
"+ s = [eval(input()) for _ in range(n)]",
"+ s.sort()",
"+ print((\"\".join(s)))",
"+",
"+",
"+if... | false | 0.072507 | 0.007094 | 10.220517 | [
"s292004095",
"s280848960"
] |
u423966555 | p03497 | python | s938475082 | s016994952 | 181 | 154 | 44,316 | 43,292 | Accepted | Accepted | 14.92 | from collections import defaultdict
N, K = list(map(int, input().split()))
A = list(map(int ,input().split()))
d = defaultdict(int)
for i in A:
d[i] += 1
d_ = sorted(list(d.items()), key=lambda x:x[1], reverse=True)
n =len(d_)
ans = 0
if n <= K:
print((0))
exit()
else:
for i in range(K,... | from collections import Counter
N, K = list(map(int, input().split()))
A = list(map(int ,input().split()))
d = Counter(A)
d_ = sorted(list(d.items()), key=lambda x:x[1], reverse=True)
n =len(d_)
ans = 0
if n <= K:
print((0))
exit()
else:
for i in range(K,n):
ans += d_[i][1]
print(an... | 18 | 16 | 346 | 308 | from collections import defaultdict
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
d = defaultdict(int)
for i in A:
d[i] += 1
d_ = sorted(list(d.items()), key=lambda x: x[1], reverse=True)
n = len(d_)
ans = 0
if n <= K:
print((0))
exit()
else:
for i in range(K, n):
a... | from collections import Counter
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
d = Counter(A)
d_ = sorted(list(d.items()), key=lambda x: x[1], reverse=True)
n = len(d_)
ans = 0
if n <= K:
print((0))
exit()
else:
for i in range(K, n):
ans += d_[i][1]
print(ans)
| false | 11.111111 | [
"-from collections import defaultdict",
"+from collections import Counter",
"-d = defaultdict(int)",
"-for i in A:",
"- d[i] += 1",
"+d = Counter(A)"
] | false | 0.079806 | 0.076982 | 1.036688 | [
"s938475082",
"s016994952"
] |
u673361376 | p03252 | python | s300079204 | s902766632 | 223 | 198 | 68,088 | 42,460 | Accepted | Accepted | 11.21 | from collections import Counter
S,T = Counter([s for s in eval(input())]), Counter([s for s in eval(input())])
print(('Yes' if Counter(list(S.values())) == Counter(list(T.values())) else 'No')) | import collections
cntS = collections.Counter(eval(input()))
cntT = collections.Counter(eval(input()))
if sorted(cntS.values()) == sorted(cntT.values()):
print('Yes')
else:
print('No')
| 4 | 10 | 172 | 193 | from collections import Counter
S, T = Counter([s for s in eval(input())]), Counter([s for s in eval(input())])
print(("Yes" if Counter(list(S.values())) == Counter(list(T.values())) else "No"))
| import collections
cntS = collections.Counter(eval(input()))
cntT = collections.Counter(eval(input()))
if sorted(cntS.values()) == sorted(cntT.values()):
print("Yes")
else:
print("No")
| false | 60 | [
"-from collections import Counter",
"+import collections",
"-S, T = Counter([s for s in eval(input())]), Counter([s for s in eval(input())])",
"-print((\"Yes\" if Counter(list(S.values())) == Counter(list(T.values())) else \"No\"))",
"+cntS = collections.Counter(eval(input()))",
"+cntT = collections.Count... | false | 0.036896 | 0.036208 | 1.018987 | [
"s300079204",
"s902766632"
] |
u723711163 | p03031 | python | s413521378 | s426451902 | 220 | 40 | 43,740 | 9,184 | Accepted | Accepted | 81.82 | N,M = list(map(int,input().split()))
bulbs = []
for _ in range(M):
bulbs.append(list(map(int,input().split())))
P = list(map(int,input().split()))
res = 0
for i in range(1<<N):
on = []
for j in range(N):
if (i>>j)&1:
on.append(j)
ok = True
for i,b in enumerate(bulbs):
b = [ k-1 fo... | # N switches, M bulbs
N,M = list(map(int,input().split()))
K = []
for i in range(M):
lst = list(map(int,input().split()))
K.append([i-1 for i in lst[1:] ])
P = list(map(int,input().split()))
res = 0
for i in range(1<<N):
on = []
for j in range(N):
if (i>>j)&1:
on.append(j)
flg = T... | 27 | 32 | 486 | 529 | N, M = list(map(int, input().split()))
bulbs = []
for _ in range(M):
bulbs.append(list(map(int, input().split())))
P = list(map(int, input().split()))
res = 0
for i in range(1 << N):
on = []
for j in range(N):
if (i >> j) & 1:
on.append(j)
ok = True
for i, b in enumerate(bulbs):
... | # N switches, M bulbs
N, M = list(map(int, input().split()))
K = []
for i in range(M):
lst = list(map(int, input().split()))
K.append([i - 1 for i in lst[1:]])
P = list(map(int, input().split()))
res = 0
for i in range(1 << N):
on = []
for j in range(N):
if (i >> j) & 1:
on.append(j)... | false | 15.625 | [
"+# N switches, M bulbs",
"-bulbs = []",
"-for _ in range(M):",
"- bulbs.append(list(map(int, input().split())))",
"+K = []",
"+for i in range(M):",
"+ lst = list(map(int, input().split()))",
"+ K.append([i - 1 for i in lst[1:]])",
"- ok = True",
"- for i, b in enumerate(bulbs):",
... | false | 0.040271 | 0.039262 | 1.025677 | [
"s413521378",
"s426451902"
] |
u759412327 | p03680 | python | s510724514 | s851766320 | 201 | 153 | 13,724 | 13,028 | Accepted | Accepted | 23.88 | N = int(eval(input()))
a = [0] + [int(eval(input())) for _ in range(N)]
x = 1
visited = set([1])
answer = 0
while True:
x = a[x]
if x in visited:
answer = -1
break
visited.add(x)
answer += 1
if x == 2:
break
print(answer)
| N = int(eval(input()))
A = [int(eval(input())) for n in range(N)]
B = 0
for n in range(N):
B = A[B]-1
if B==1:
print((n+1))
exit()
print((-1)) | 17 | 11 | 254 | 150 | N = int(eval(input()))
a = [0] + [int(eval(input())) for _ in range(N)]
x = 1
visited = set([1])
answer = 0
while True:
x = a[x]
if x in visited:
answer = -1
break
visited.add(x)
answer += 1
if x == 2:
break
print(answer)
| N = int(eval(input()))
A = [int(eval(input())) for n in range(N)]
B = 0
for n in range(N):
B = A[B] - 1
if B == 1:
print((n + 1))
exit()
print((-1))
| false | 35.294118 | [
"-a = [0] + [int(eval(input())) for _ in range(N)]",
"-x = 1",
"-visited = set([1])",
"-answer = 0",
"-while True:",
"- x = a[x]",
"- if x in visited:",
"- answer = -1",
"- break",
"- visited.add(x)",
"- answer += 1",
"- if x == 2:",
"- break",
"-print(a... | false | 0.20818 | 0.102623 | 2.028588 | [
"s510724514",
"s851766320"
] |
u638795007 | p02930 | python | s528790628 | s619052245 | 153 | 96 | 13,684 | 11,468 | Accepted | Accepted | 37.25 | def examA():
N = DI()/dec(7)
ans = N
print(N)
return
def examB():
ans = 0
print(ans)
return
def examC():
ans = 0
print(ans)
return
def examD():
N = I()
n = (N-1).bit_length()
V = [[-1]*(1<<n) for i in range(1<<n)]
#print(V)
for i in ran... | def examA():
N = DI()/dec(7)
ans = N
print(N)
return
def examB():
ans = 0
print(ans)
return
def examC():
ans = 0
print(ans)
return
def examD():
N = I()
n = (N-1).bit_length()
V = [[-1]*(1<<n) for i in range(1<<n)]
#print(V)
for i in ran... | 99 | 117 | 2,269 | 2,700 | def examA():
N = DI() / dec(7)
ans = N
print(N)
return
def examB():
ans = 0
print(ans)
return
def examC():
ans = 0
print(ans)
return
def examD():
N = I()
n = (N - 1).bit_length()
V = [[-1] * (1 << n) for i in range(1 << n)]
# print(V)
for i in range(n):
... | def examA():
N = DI() / dec(7)
ans = N
print(N)
return
def examB():
ans = 0
print(ans)
return
def examC():
ans = 0
print(ans)
return
def examD():
N = I()
n = (N - 1).bit_length()
V = [[-1] * (1 << n) for i in range(1 << n)]
# print(V)
for i in range(n):
... | false | 15.384615 | [
"+ for v in ans:",
"+ print((\" \".join(map(str, v))))",
"+ return",
"+",
"+",
"+# 解説",
"+def examD2():",
"+ N = I()",
"+ ans = [[-1] * (N - 1 - i) for i in range(N - 1)]",
"+ n = N.bit_length()",
"+ for i in range(N):",
"+ for j in range(i + 1, N):",
"+ ... | false | 0.101749 | 0.04202 | 2.421449 | [
"s528790628",
"s619052245"
] |
u102461423 | p02632 | python | s417616065 | s769385426 | 1,403 | 817 | 185,240 | 163,172 | Accepted | Accepted | 41.77 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
@njit
def fact_table(N, MOD):
inv = np.empty(N, np.int64)
inv[0] = 0
inv[1] = 1
for n in range(2, N):
q... | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
def main(K, N, MOD):
def fact_table(N, MOD):
inv = np.empty(N, np.int64)
inv[0] = 0
inv[1] = 1
... | 46 | 56 | 1,143 | 1,463 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
@njit
def fact_table(N, MOD):
inv = np.empty(N, np.int64)
inv[0] = 0
inv[1] = 1
for n in range(2, N):
q, r = divmod(MOD... | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
def main(K, N, MOD):
def fact_table(N, MOD):
inv = np.empty(N, np.int64)
inv[0] = 0
inv[1] = 1
for n in ran... | false | 17.857143 | [
"-@njit",
"-def fact_table(N, MOD):",
"- inv = np.empty(N, np.int64)",
"- inv[0] = 0",
"- inv[1] = 1",
"- for n in range(2, N):",
"- q, r = divmod(MOD, n)",
"- inv[n] = inv[r] * (-q) % MOD",
"- fact = np.empty(N, np.int64)",
"- fact[0] = 1",
"- for n in range(1... | false | 0.209699 | 0.740954 | 0.283012 | [
"s417616065",
"s769385426"
] |
u151005508 | p03575 | python | s551313819 | s162912327 | 180 | 22 | 39,664 | 3,316 | Accepted | Accepted | 87.78 | # pythonでスタック、キューを実現するためにdequeをimport
from collections import deque
N, M = list(map(int, input().split()))
# 辺集合EとグラフGの構築
G = [[] for _ in range(N)]
E = []
for _ in range(M):
a, b = list(map(int, input().split()))
# 入力は1-indexedだがこれを扱いやすいように0-indexedに変更
a -= 1
b -= 1
E.append((a, b))
... | # pythonでスタック、キューを実現するためにdequeをimport
from collections import deque
N, M = list(map(int, input().split()))
# 辺集合EとグラフGの構築
G = [[] for _ in range(N)]
E = []
for _ in range(M):
a, b = list(map(int, input().split()))
# 入力は1-indexedだがこれを扱いやすいように0-indexedに変更
a -= 1
b -= 1
E.append((a, b))
... | 49 | 47 | 1,113 | 1,039 | # pythonでスタック、キューを実現するためにdequeをimport
from collections import deque
N, M = list(map(int, input().split()))
# 辺集合EとグラフGの構築
G = [[] for _ in range(N)]
E = []
for _ in range(M):
a, b = list(map(int, input().split()))
# 入力は1-indexedだがこれを扱いやすいように0-indexedに変更
a -= 1
b -= 1
E.append((a, b))
G[a].appen... | # pythonでスタック、キューを実現するためにdequeをimport
from collections import deque
N, M = list(map(int, input().split()))
# 辺集合EとグラフGの構築
G = [[] for _ in range(N)]
E = []
for _ in range(M):
a, b = list(map(int, input().split()))
# 入力は1-indexedだがこれを扱いやすいように0-indexedに変更
a -= 1
b -= 1
E.append((a, b))
G[a].appen... | false | 4.081633 | [
"- seen = [False] * N",
"+ seen = set()",
"- seen[0] = True",
"- seen_nodes_num = 0",
"+ seen.add(0)",
"- seen_nodes_num += 1",
"- if seen[neighbor] == False:",
"- seen[neighbor] = True",
"+ if neighbor not in seen:",
"+ see... | false | 0.036382 | 0.034968 | 1.040422 | [
"s551313819",
"s162912327"
] |
u844646164 | p03073 | python | s147587399 | s399562767 | 109 | 94 | 5,536 | 3,956 | Accepted | Accepted | 13.76 | s = list(map(int, eval(input())))
ideal1 = [0 for _ in range(len(s))]
for i in range(len(s)):
if i % 2 == 0:
ideal1[i] = 1
else:
ideal1[i] = 0
ideal2 = [0 for _ in range(len(s))]
for i in range(len(s)):
if i % 2 == 0:
ideal2[i] = 0
else:
ideal2[i] = 1
count1 = 0
count2 = 0
... | S = list(eval(input()))
ans1 = 0
ans2 = 0
# 10101010...
for i in range(len(S)):
if i % 2 == 0:
if S[i] == '0':
ans1 += 1
if i % 2 != 0:
if S[i] == '1':
ans1 += 1
# 01010101...
for i in range(len(S)):
if i % 2 == 0:
if S[i] == '1':
ans2 += 1
if i % 2 != 0:
if ... | 27 | 21 | 457 | 367 | s = list(map(int, eval(input())))
ideal1 = [0 for _ in range(len(s))]
for i in range(len(s)):
if i % 2 == 0:
ideal1[i] = 1
else:
ideal1[i] = 0
ideal2 = [0 for _ in range(len(s))]
for i in range(len(s)):
if i % 2 == 0:
ideal2[i] = 0
else:
ideal2[i] = 1
count1 = 0
count2 = ... | S = list(eval(input()))
ans1 = 0
ans2 = 0
# 10101010...
for i in range(len(S)):
if i % 2 == 0:
if S[i] == "0":
ans1 += 1
if i % 2 != 0:
if S[i] == "1":
ans1 += 1
# 01010101...
for i in range(len(S)):
if i % 2 == 0:
if S[i] == "1":
ans2 += 1
if ... | false | 22.222222 | [
"-s = list(map(int, eval(input())))",
"-ideal1 = [0 for _ in range(len(s))]",
"-for i in range(len(s)):",
"+S = list(eval(input()))",
"+ans1 = 0",
"+ans2 = 0",
"+# 10101010...",
"+for i in range(len(S)):",
"- ideal1[i] = 1",
"- else:",
"- ideal1[i] = 0",
"-ideal2 = [0 for _ in... | false | 0.048246 | 0.048448 | 0.995823 | [
"s147587399",
"s399562767"
] |
u737758066 | p02830 | python | s524044646 | s155679902 | 174 | 160 | 38,256 | 38,384 | Accepted | Accepted | 8.05 | n = int(eval(input()))
s, t = list(map(str, input().split()))
u = ""
for i in range(n):
u += s[i]
u += t[i]
print(u)
| n = int(eval(input()))
s, t = input().split()
ans = ""
for i in range(n):
ans += s[i] + t[i]
print(ans)
| 7 | 7 | 119 | 109 | n = int(eval(input()))
s, t = list(map(str, input().split()))
u = ""
for i in range(n):
u += s[i]
u += t[i]
print(u)
| n = int(eval(input()))
s, t = input().split()
ans = ""
for i in range(n):
ans += s[i] + t[i]
print(ans)
| false | 0 | [
"-s, t = list(map(str, input().split()))",
"-u = \"\"",
"+s, t = input().split()",
"+ans = \"\"",
"- u += s[i]",
"- u += t[i]",
"-print(u)",
"+ ans += s[i] + t[i]",
"+print(ans)"
] | false | 0.039004 | 0.06798 | 0.57376 | [
"s524044646",
"s155679902"
] |
u366644013 | p03251 | python | s926037952 | s651317356 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | il = lambda: list(map(int, input().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]
n, m, x, y = il()
xs = il()
ys = il()
a = max(xs)
b = min(ys)
if x < a and b <= y and a < b:
print("No War")
else:
print("War") | from sys import stdin
il = lambda: list(map(int, input().split()))
IL = lambda: list(map(int, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]
n, m, x, y = IL()
xs = IL()
ys = IL()
a = max(xs)
b = min(ys)
if x < a and b <= y and a < b:
print("No War")
el... | 12 | 14 | 254 | 341 | il = lambda: list(map(int, input().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]
n, m, x, y = il()
xs = il()
ys = il()
a = max(xs)
b = min(ys)
if x < a and b <= y and a < b:
print("No War")
else:
print("War")
| from sys import stdin
il = lambda: list(map(int, input().split()))
IL = lambda: list(map(int, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]
n, m, x, y = IL()
xs = IL()
ys = IL()
a = max(xs)
b = min(ys)
if x < a and b <= y and a < b:
print("No War")
else:
prin... | false | 14.285714 | [
"+from sys import stdin",
"+",
"+IL = lambda: list(map(int, stdin.readline().rstrip().split()))",
"-n, m, x, y = il()",
"-xs = il()",
"-ys = il()",
"+n, m, x, y = IL()",
"+xs = IL()",
"+ys = IL()"
] | false | 0.040578 | 0.041137 | 0.986412 | [
"s926037952",
"s651317356"
] |
u490489966 | p02582 | python | s641157839 | s828601648 | 28 | 25 | 9,044 | 9,100 | Accepted | Accepted | 10.71 | #A
stri=eval(input())
ans=0
s=0
for i in range(3):
if stri[i]=="R":
s+=1
else:
if ans<s:
ans=s
s=0
if ans<s:
ans=s
print(ans) | # A
s = eval(input())
count = 0
ans = 0
for i in range(len(s)):
if s[i] == "R":
count += 1
else:
if ans < count:
ans = count
count = 0
if ans < count:
ans = count
print(ans)
| 14 | 14 | 180 | 229 | # A
stri = eval(input())
ans = 0
s = 0
for i in range(3):
if stri[i] == "R":
s += 1
else:
if ans < s:
ans = s
s = 0
if ans < s:
ans = s
print(ans)
| # A
s = eval(input())
count = 0
ans = 0
for i in range(len(s)):
if s[i] == "R":
count += 1
else:
if ans < count:
ans = count
count = 0
if ans < count:
ans = count
print(ans)
| false | 0 | [
"-stri = eval(input())",
"+s = eval(input())",
"+count = 0",
"-s = 0",
"-for i in range(3):",
"- if stri[i] == \"R\":",
"- s += 1",
"+for i in range(len(s)):",
"+ if s[i] == \"R\":",
"+ count += 1",
"- if ans < s:",
"- ans = s",
"- s = 0",
"-if ... | false | 0.038521 | 0.038855 | 0.991399 | [
"s641157839",
"s828601648"
] |
u888092736 | p03967 | python | s448137042 | s171647407 | 45 | 36 | 9,108 | 9,396 | Accepted | Accepted | 20 | S = eval(input())
cur = "g"
acd = 0
tcd = 0
for c in S:
if cur != c:
if cur == "p":
acd += 1
else:
tcd += 1
cur = "p" if cur == "g" else "g"
print((acd - tcd))
| from collections import Counter
S = Counter(eval(input()))
print(((S["g"] - S["p"]) // 2))
| 13 | 4 | 213 | 87 | S = eval(input())
cur = "g"
acd = 0
tcd = 0
for c in S:
if cur != c:
if cur == "p":
acd += 1
else:
tcd += 1
cur = "p" if cur == "g" else "g"
print((acd - tcd))
| from collections import Counter
S = Counter(eval(input()))
print(((S["g"] - S["p"]) // 2))
| false | 69.230769 | [
"-S = eval(input())",
"-cur = \"g\"",
"-acd = 0",
"-tcd = 0",
"-for c in S:",
"- if cur != c:",
"- if cur == \"p\":",
"- acd += 1",
"- else:",
"- tcd += 1",
"- cur = \"p\" if cur == \"g\" else \"g\"",
"-print((acd - tcd))",
"+from collections import ... | false | 0.043217 | 0.080349 | 0.537868 | [
"s448137042",
"s171647407"
] |
u899909022 | p02912 | python | s600497339 | s662585820 | 257 | 161 | 15,020 | 14,224 | Accepted | Accepted | 37.35 | n, m = list(map(int,input().split()))
A = list(map(int,input().split()))
A = [x * -1 for x in A]
A.sort()
import heapq
import bisect
heapq.heapify(A)
for _ in range(m):
min_ = heapq.heappop(A)
tmp = min_ * -1 // 2 * -1
index = bisect.bisect_left(A, tmp)
heapq.heappush(A,tmp)
print((sum(A) * ... | n, m = list(map(int,input().split()))
A = [x * -1 for x in list(map(int,input().split()))]
import heapq
heapq.heapify(A)
for _ in range(m):
min_ = heapq.heappop(A)
tmp = min_ * -1 // 2 * -1
heapq.heappush(A,tmp)
print((sum(A) * -1))
| 13 | 9 | 317 | 245 | n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [x * -1 for x in A]
A.sort()
import heapq
import bisect
heapq.heapify(A)
for _ in range(m):
min_ = heapq.heappop(A)
tmp = min_ * -1 // 2 * -1
index = bisect.bisect_left(A, tmp)
heapq.heappush(A, tmp)
print((sum(A) * -1))
| n, m = list(map(int, input().split()))
A = [x * -1 for x in list(map(int, input().split()))]
import heapq
heapq.heapify(A)
for _ in range(m):
min_ = heapq.heappop(A)
tmp = min_ * -1 // 2 * -1
heapq.heappush(A, tmp)
print((sum(A) * -1))
| false | 30.769231 | [
"-A = list(map(int, input().split()))",
"-A = [x * -1 for x in A]",
"-A.sort()",
"+A = [x * -1 for x in list(map(int, input().split()))]",
"-import bisect",
"- index = bisect.bisect_left(A, tmp)"
] | false | 0.041609 | 0.063134 | 0.65905 | [
"s600497339",
"s662585820"
] |
u763968347 | p03470 | python | s155204765 | s185949854 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | #coding : utf-8
n = int(eval(input()))
d = []
for i in range(n):
d.append(int(eval(input())))
d_uniq = list(set(d))
print((len(d_uniq))) | N = int(eval(input()))
d = {}
for _ in range(N):
i = int(eval(input()))
if i in list(d.keys()):
d[i] += 1
else:
d[i] = 1
print((len(d))) | 8 | 11 | 134 | 156 | # coding : utf-8
n = int(eval(input()))
d = []
for i in range(n):
d.append(int(eval(input())))
d_uniq = list(set(d))
print((len(d_uniq)))
| N = int(eval(input()))
d = {}
for _ in range(N):
i = int(eval(input()))
if i in list(d.keys()):
d[i] += 1
else:
d[i] = 1
print((len(d)))
| false | 27.272727 | [
"-# coding : utf-8",
"-n = int(eval(input()))",
"-d = []",
"-for i in range(n):",
"- d.append(int(eval(input())))",
"-d_uniq = list(set(d))",
"-print((len(d_uniq)))",
"+N = int(eval(input()))",
"+d = {}",
"+for _ in range(N):",
"+ i = int(eval(input()))",
"+ if i in list(d.keys()):",
... | false | 0.09881 | 0.035957 | 2.74801 | [
"s155204765",
"s185949854"
] |
u078042885 | p00322 | python | s851878658 | s422315783 | 1,480 | 730 | 7,728 | 7,804 | Accepted | Accepted | 50.68 | import itertools
u=[1,2,3,4,5,6,7,8,9]
a=0
n=list(map(int,input().split()))
for x in itertools.permutations(u):
f=0
for i in range(9):
if n[i]!=-1 and n[i]!=x[i]:f=1
if f:continue
if x[0]+x[2]+x[5]-x[8]+(x[1]+x[4]-x[7])*10+(x[3]-x[6])*100==0:a+=1
print(a) | def f(n,x):
for i in range(9):
if n[i] != -1 and n[i] != x[i]: return 1
import itertools
u=[1,2,3,4,5,6,7,8,9]
a=0
n=list(map(int,input().split()))
for x in itertools.permutations(u):
if f(n,x):continue
if x[0]+x[2]+x[5]-x[8]+(x[1]+x[4]-x[7])*10+(x[3]-x[6])*100==0:a+=1
print(a) | 11 | 11 | 289 | 308 | import itertools
u = [1, 2, 3, 4, 5, 6, 7, 8, 9]
a = 0
n = list(map(int, input().split()))
for x in itertools.permutations(u):
f = 0
for i in range(9):
if n[i] != -1 and n[i] != x[i]:
f = 1
if f:
continue
if x[0] + x[2] + x[5] - x[8] + (x[1] + x[4] - x[7]) * 10 + (x[3] - x[6... | def f(n, x):
for i in range(9):
if n[i] != -1 and n[i] != x[i]:
return 1
import itertools
u = [1, 2, 3, 4, 5, 6, 7, 8, 9]
a = 0
n = list(map(int, input().split()))
for x in itertools.permutations(u):
if f(n, x):
continue
if x[0] + x[2] + x[5] - x[8] + (x[1] + x[4] - x[7]) * 10... | false | 0 | [
"+def f(n, x):",
"+ for i in range(9):",
"+ if n[i] != -1 and n[i] != x[i]:",
"+ return 1",
"+",
"+",
"- f = 0",
"- for i in range(9):",
"- if n[i] != -1 and n[i] != x[i]:",
"- f = 1",
"- if f:",
"+ if f(n, x):"
] | false | 0.845074 | 0.727953 | 1.16089 | [
"s851878658",
"s422315783"
] |
u983918956 | p03212 | python | s024320648 | s259065320 | 144 | 42 | 7,540 | 3,060 | Accepted | Accepted | 70.83 | from collections import deque
N = int(eval(input()))
ans = 0
option = ["7","5","3"]
dq = deque()
for s in option:
dq.append(s)
def judge(string):
bit = [0]*3
chenge = {"7":0, "5":1, "3":2}
for s in string:
bit[chenge[s]] = 1
return all(bit)
while dq:
n = dq.popleft()
... | N = int(eval(input()))
ans = 0
def dfs(n=0,a=0,b=0,c=0):
if n > N:
return
if a*b*c > 0:
global ans
ans += 1
dfs(10*n+3,a+1,b,c)
dfs(10*n+5,a,b+1,c)
dfs(10*n+7,a,b,c+1)
dfs()
print(ans) | 26 | 14 | 476 | 236 | from collections import deque
N = int(eval(input()))
ans = 0
option = ["7", "5", "3"]
dq = deque()
for s in option:
dq.append(s)
def judge(string):
bit = [0] * 3
chenge = {"7": 0, "5": 1, "3": 2}
for s in string:
bit[chenge[s]] = 1
return all(bit)
while dq:
n = dq.popleft()
if i... | N = int(eval(input()))
ans = 0
def dfs(n=0, a=0, b=0, c=0):
if n > N:
return
if a * b * c > 0:
global ans
ans += 1
dfs(10 * n + 3, a + 1, b, c)
dfs(10 * n + 5, a, b + 1, c)
dfs(10 * n + 7, a, b, c + 1)
dfs()
print(ans)
| false | 46.153846 | [
"-from collections import deque",
"-",
"-option = [\"7\", \"5\", \"3\"]",
"-dq = deque()",
"-for s in option:",
"- dq.append(s)",
"-def judge(string):",
"- bit = [0] * 3",
"- chenge = {\"7\": 0, \"5\": 1, \"3\": 2}",
"- for s in string:",
"- bit[chenge[s]] = 1",
"- return... | false | 0.111259 | 0.040886 | 2.721209 | [
"s024320648",
"s259065320"
] |
u116038906 | p02683 | python | s036161700 | s132009187 | 182 | 166 | 27,376 | 27,100 | Accepted | Accepted | 8.79 | from itertools import combinations
import numpy as np
import sys
input = sys.stdin.readline
#買う本
N, M, X = list(map(int, input().split()))
C_np = np.array([list(map(int, input().split())) for _ in range(N)], dtype=int)
all_book= [i for i in range(N)]
flag =False
price_list =[]
#C_np ... | # 初期入力
from itertools import combinations
from itertools import product
import numpy as np
import sys
input = sys.stdin.readline
N,M,X = (int(x) for x in input().split())
C = [list(map(int, input().split())) for i in range(N)]
all_book= [i for i in range(N)] #買う本
price_list =[]
flag ... | 26 | 30 | 865 | 958 | from itertools import combinations
import numpy as np
import sys
input = sys.stdin.readline
# 買う本
N, M, X = list(map(int, input().split()))
C_np = np.array([list(map(int, input().split())) for _ in range(N)], dtype=int)
all_book = [i for i in range(N)]
flag = False
price_list = []
# C_np =np.array(C,dtype=int)
... | # 初期入力
from itertools import combinations
from itertools import product
import numpy as np
import sys
input = sys.stdin.readline
N, M, X = (int(x) for x in input().split())
C = [list(map(int, input().split())) for i in range(N)]
all_book = [i for i in range(N)] # 買う本
price_list = []
flag = False
C_np = np.array(C, dt... | false | 13.333333 | [
"+# 初期入力",
"+from itertools import product",
"-# 買う本",
"-N, M, X = list(map(int, input().split()))",
"-C_np = np.array([list(map(int, input().split())) for _ in range(N)], dtype=int)",
"-all_book = [i for i in range(N)]",
"+N, M, X = (int(x) for x in input().split())",
"+C = [list(map(int, input().spl... | false | 0.232634 | 0.304409 | 0.764214 | [
"s036161700",
"s132009187"
] |
u952708174 | p03645 | python | s566734558 | s018031573 | 1,264 | 647 | 54,980 | 42,524 | Accepted | Accepted | 48.81 | def Q3(N, M, *arg):
import numpy as np
route = np.reshape(np.array(*arg), (M, 2))
string = 'IMPOSSIBLE'
p = [False] * N
q = [False] * N
for x in route:
if x[0] == 1:
p[x[1]] = True
elif x[1] == N:
q[x[0]] = True
for i in range(N):
i... | def c_cat_snuke_and_a_voyage(N, M, I):
p = [False] * N # 島1と島iに辺があるならTrue,なければFalse(0-indexed)
q = [False] * N # 島iと島Nに辺があるならTrue,なければFalse(0-indexed)
for a, b in I:
if a == 1: # 出発地が島1なら
p[b] = True
elif b == N: # 目的地が島Nなら
q[a] = True
ans = 'IMPOSSIBL... | 21 | 18 | 582 | 595 | def Q3(N, M, *arg):
import numpy as np
route = np.reshape(np.array(*arg), (M, 2))
string = "IMPOSSIBLE"
p = [False] * N
q = [False] * N
for x in route:
if x[0] == 1:
p[x[1]] = True
elif x[1] == N:
q[x[0]] = True
for i in range(N):
if p[i] and ... | def c_cat_snuke_and_a_voyage(N, M, I):
p = [False] * N # 島1と島iに辺があるならTrue,なければFalse(0-indexed)
q = [False] * N # 島iと島Nに辺があるならTrue,なければFalse(0-indexed)
for a, b in I:
if a == 1: # 出発地が島1なら
p[b] = True
elif b == N: # 目的地が島Nなら
q[a] = True
ans = "IMPOSSIBLE"
f... | false | 14.285714 | [
"-def Q3(N, M, *arg):",
"- import numpy as np",
"-",
"- route = np.reshape(np.array(*arg), (M, 2))",
"- string = \"IMPOSSIBLE\"",
"- p = [False] * N",
"- q = [False] * N",
"- for x in route:",
"- if x[0] == 1:",
"- p[x[1]] = True",
"- elif x[1] == N:",
... | false | 0.192186 | 0.039879 | 4.819218 | [
"s566734558",
"s018031573"
] |
u047796752 | p02658 | python | s203392741 | s309905279 | 98 | 88 | 82,924 | 96,016 | Accepted | Accepted | 10.2 | import sys
input = sys.stdin.readline
from collections import *
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = 1
for Ai in A:
ans *= Ai
if ans>10**18:
print((-1))
exit()
print(ans) | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
s = set(A)
if 0 in s:
print((0))
exit()
now = 1
for Ai in A:
if now*Ai>10**18:
print((-1))
exit()
now *= Ai
print(now) | 17 | 21 | 255 | 267 | import sys
input = sys.stdin.readline
from collections import *
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = 1
for Ai in A:
ans *= Ai
if ans > 10**18:
print((-1))
exit()
print(ans)
| import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
s = set(A)
if 0 in s:
print((0))
exit()
now = 1
for Ai in A:
if now * Ai > 10**18:
print((-1))
exit()
now *= Ai
print(now)
| false | 19.047619 | [
"-from collections import *",
"-",
"-A.sort()",
"-ans = 1",
"+s = set(A)",
"+if 0 in s:",
"+ print((0))",
"+ exit()",
"+now = 1",
"- ans *= Ai",
"- if ans > 10**18:",
"+ if now * Ai > 10**18:",
"-print(ans)",
"+ now *= Ai",
"+print(now)"
] | false | 0.080082 | 0.043705 | 1.832328 | [
"s203392741",
"s309905279"
] |
u282228874 | p03495 | python | s059138402 | s614325771 | 116 | 99 | 32,564 | 32,564 | Accepted | Accepted | 14.66 | from collections import Counter
n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
D = Counter(A)
V = []
for v in list(D.values()):
V.append(v)
V.sort(reverse=True)
print((max(n-sum(V[:k]),0))) | from collections import Counter
n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
D = Counter(A)
V = sorted(list(D.values()),reverse=True)
print((max(n-sum(V[:k]),0))) | 11 | 8 | 216 | 184 | from collections import Counter
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
D = Counter(A)
V = []
for v in list(D.values()):
V.append(v)
V.sort(reverse=True)
print((max(n - sum(V[:k]), 0)))
| from collections import Counter
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
D = Counter(A)
V = sorted(list(D.values()), reverse=True)
print((max(n - sum(V[:k]), 0)))
| false | 27.272727 | [
"-V = []",
"-for v in list(D.values()):",
"- V.append(v)",
"-V.sort(reverse=True)",
"+V = sorted(list(D.values()), reverse=True)"
] | false | 0.039817 | 0.05663 | 0.703108 | [
"s059138402",
"s614325771"
] |
u201928947 | p02936 | python | s020543509 | s127982227 | 1,702 | 828 | 65,652 | 159,120 | Accepted | Accepted | 51.35 | from collections import deque
n,q = list(map(int,input().split()))
lst = [[]for i in range(n)]
ans = [0 for i in range(n)]
for i in range(n-1):
a,b = list(map(int,input().split()))
lst[a-1].append(b)
lst[b-1].append(a)
for i in range(q):
p,x = list(map(int,input().split()))
ans[p-1] += x
... | from collections import deque
N,Q = list(map(int,input().split()))
tree = [[] for _ in range(N+1)]
counter = [0]*(N+1)
for i in range(N-1):
a,b = list(map(int,input().split()))
tree[a].append(b)
tree[b].append(a)
for i in range(Q):
p,x = list(map(int,input().split()))
counter[p] += x
alre... | 19 | 23 | 482 | 521 | from collections import deque
n, q = list(map(int, input().split()))
lst = [[] for i in range(n)]
ans = [0 for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
lst[a - 1].append(b)
lst[b - 1].append(a)
for i in range(q):
p, x = list(map(int, input().split()))
ans[p - 1] ... | from collections import deque
N, Q = list(map(int, input().split()))
tree = [[] for _ in range(N + 1)]
counter = [0] * (N + 1)
for i in range(N - 1):
a, b = list(map(int, input().split()))
tree[a].append(b)
tree[b].append(a)
for i in range(Q):
p, x = list(map(int, input().split()))
counter[p] += x
... | false | 17.391304 | [
"-n, q = list(map(int, input().split()))",
"-lst = [[] for i in range(n)]",
"-ans = [0 for i in range(n)]",
"-for i in range(n - 1):",
"+N, Q = list(map(int, input().split()))",
"+tree = [[] for _ in range(N + 1)]",
"+counter = [0] * (N + 1)",
"+for i in range(N - 1):",
"- lst[a - 1].append(b)",
... | false | 0.104876 | 0.138803 | 0.755573 | [
"s020543509",
"s127982227"
] |
u614314290 | p03208 | python | s484728569 | s794865680 | 176 | 127 | 25,064 | 19,252 | Accepted | Accepted | 27.84 | import sys
from operator import itemgetter as ig
from collections import defaultdict as dd
# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
return int(n) - 1
def input():
return next(args)
def parse(*params):
if len(params) == 1:
return params[0](next(args))
r... | import sys
from operator import itemgetter as ig
from collections import defaultdict as dd
# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
return int(n) - 1
def input():
return next(args)
def parse(*params):
if len(params) == 1:
return params[0](next(args))
r... | 40 | 34 | 910 | 754 | import sys
from operator import itemgetter as ig
from collections import defaultdict as dd
# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
return int(n) - 1
def input():
return next(args)
def parse(*params):
if len(params) == 1:
return params[0](next(args))
return tup... | import sys
from operator import itemgetter as ig
from collections import defaultdict as dd
# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
return int(n) - 1
def input():
return next(args)
def parse(*params):
if len(params) == 1:
return params[0](next(args))
return tup... | false | 15 | [
"- l, r = 0, K",
"- sum_h = [0]",
"- for n in range(1, N):",
"- sum_h += [sum_h[-1] + (h[n] - h[n - 1])]",
"- debug(sum_h)",
"- diff_h = tuple(sum_h[l + K - 1] - sum_h[l] for l in range(N - K + 1))",
"- debug(diff_h)",
"+ diff_h = tuple(h[l + K - 1] - h[l] for l in range(N ... | false | 0.037801 | 0.007769 | 4.86541 | [
"s484728569",
"s794865680"
] |
u657076895 | p02389 | python | s344222616 | s674176006 | 30 | 20 | 6,276 | 5,684 | Accepted | Accepted | 33.33 | import sys
from functools import reduce
for line in sys.stdin:
nums = list([int(x) for x in line.split()])
menseki = reduce(lambda x, y: x * y, nums)
syuu = reduce(lambda x, y: x + y, nums) * 2
print((str(menseki) + " " + str(syuu)))
| import sys
import operator
for line in sys.stdin:
nums = list(map(int, line.split()))
strings = list(map(str, [operator.mul(*nums),
operator.add(*nums) * 2]))
print((" ".join(strings)))
| 9 | 9 | 263 | 224 | import sys
from functools import reduce
for line in sys.stdin:
nums = list([int(x) for x in line.split()])
menseki = reduce(lambda x, y: x * y, nums)
syuu = reduce(lambda x, y: x + y, nums) * 2
print((str(menseki) + " " + str(syuu)))
| import sys
import operator
for line in sys.stdin:
nums = list(map(int, line.split()))
strings = list(map(str, [operator.mul(*nums), operator.add(*nums) * 2]))
print((" ".join(strings)))
| false | 0 | [
"-from functools import reduce",
"+import operator",
"- nums = list([int(x) for x in line.split()])",
"- menseki = reduce(lambda x, y: x * y, nums)",
"- syuu = reduce(lambda x, y: x + y, nums) * 2",
"- print((str(menseki) + \" \" + str(syuu)))",
"+ nums = list(map(int, line.split()))",
... | false | 0.048803 | 0.050008 | 0.97591 | [
"s344222616",
"s674176006"
] |
u925406312 | p03416 | python | s436269815 | s430817571 | 61 | 56 | 2,940 | 2,940 | Accepted | Accepted | 8.2 | A,B = list(map(int,input().split()))
count = 0
for i in range(A, B + 1):
aa =str(i)
rslt = aa[::-1]
if aa == rslt:
count += 1
print(count) | A,B = list(map(int,input().split()))
su = abs(A -B)
count = 0
for i in range(A, B + 1):
aa =str(i)
rslt = aa[::-1]
if aa == rslt:
count += 1
print(count) | 9 | 9 | 161 | 175 | A, B = list(map(int, input().split()))
count = 0
for i in range(A, B + 1):
aa = str(i)
rslt = aa[::-1]
if aa == rslt:
count += 1
print(count)
| A, B = list(map(int, input().split()))
su = abs(A - B)
count = 0
for i in range(A, B + 1):
aa = str(i)
rslt = aa[::-1]
if aa == rslt:
count += 1
print(count)
| false | 0 | [
"+su = abs(A - B)"
] | false | 0.04663 | 0.043687 | 1.067366 | [
"s436269815",
"s430817571"
] |
u994521204 | p02913 | python | s157480318 | s825086980 | 797 | 103 | 53,724 | 75,676 | Accepted | Accepted | 87.08 | # suffix array
# z-algorithm
# rolling-hash
# dp
n = int(eval(input()))
s = eval(input())
# z-algorithm
# i左端
# j iからの距離
# k i-i+jの間を進みながら比較
ans = 0
for num in range(n - 1):
S = s[num:]
A = [0] * (n - num)
A[0] = n - num
i = 1
j = 0
while i < n - num:
while i + j < n ... | # 32bitのMod一つでRollingHashを行った場合、
# 10**5個程度のHashを生成するだけでも
# 半分以上の確率でどこかのHashが衝突していることが分かります
# 小文字アルファベットの時のbese
base = 27 # alphabet
def getnum(x):
return ord(x) - ord("a") + 1
# rolling hash実装
# 必要な定数
# mod = 1<<61-1としたときの高速余り計算
m30 = (1 << 30) - 1
m31 = (1 << 31) - 1
m61 = (1 << 61) - 1... | 34 | 91 | 670 | 1,772 | # suffix array
# z-algorithm
# rolling-hash
# dp
n = int(eval(input()))
s = eval(input())
# z-algorithm
# i左端
# j iからの距離
# k i-i+jの間を進みながら比較
ans = 0
for num in range(n - 1):
S = s[num:]
A = [0] * (n - num)
A[0] = n - num
i = 1
j = 0
while i < n - num:
while i + j < n - num and S[j] == S[... | # 32bitのMod一つでRollingHashを行った場合、
# 10**5個程度のHashを生成するだけでも
# 半分以上の確率でどこかのHashが衝突していることが分かります
# 小文字アルファベットの時のbese
base = 27 # alphabet
def getnum(x):
return ord(x) - ord("a") + 1
# rolling hash実装
# 必要な定数
# mod = 1<<61-1としたときの高速余り計算
m30 = (1 << 30) - 1
m31 = (1 << 31) - 1
m61 = (1 << 61) - 1
mod = m61
positive_de... | false | 62.637363 | [
"-# suffix array",
"-# z-algorithm",
"-# rolling-hash",
"-# dp",
"+# 32bitのMod一つでRollingHashを行った場合、",
"+# 10**5個程度のHashを生成するだけでも",
"+# 半分以上の確率でどこかのHashが衝突していることが分かります",
"+# 小文字アルファベットの時のbese",
"+base = 27 # alphabet",
"+",
"+",
"+def getnum(x):",
"+ return ord(x) - ord(\"a\") + 1",
"+"... | false | 0.040001 | 0.140465 | 0.284776 | [
"s157480318",
"s825086980"
] |
u332385682 | p04040 | python | s909694836 | s815005891 | 324 | 235 | 26,740 | 20,340 | Accepted | Accepted | 27.47 | from sys import stdin, stdout, stderr
mod = 10**9 + 7
def solve():
def binom(n, k):
res = (modfact[n] * factinv[k]) % mod
res = (res * factinv[n - k]) % mod
return res
h, w, a, b = list(map(int, input().split()))
ans = 0
modfact = [1] * (h + w)
factinv = [1] *... | from sys import stdin, stdout, stderr
mod = 10**9 + 7
def solve():
def binom(n, k):
res = (modfact[n] * factinv[k]) % mod
res = (res * factinv[n - k]) % mod
return res
h, w, a, b = list(map(int, input().split()))
ans = 0
modfact = [1] * (h + w)
factinv = [1] *... | 29 | 32 | 729 | 784 | from sys import stdin, stdout, stderr
mod = 10**9 + 7
def solve():
def binom(n, k):
res = (modfact[n] * factinv[k]) % mod
res = (res * factinv[n - k]) % mod
return res
h, w, a, b = list(map(int, input().split()))
ans = 0
modfact = [1] * (h + w)
factinv = [1] * (h + w)
... | from sys import stdin, stdout, stderr
mod = 10**9 + 7
def solve():
def binom(n, k):
res = (modfact[n] * factinv[k]) % mod
res = (res * factinv[n - k]) % mod
return res
h, w, a, b = list(map(int, input().split()))
ans = 0
modfact = [1] * (h + w)
factinv = [1] * (h + w)
... | false | 9.375 | [
"- inv[i] = (-(mod // i) * inv[mod % i]) % mod",
"- factinv[i] = (inv[i] * factinv[i - 1]) % mod",
"+ factinv[h + w - 1] = pow(modfact[h + w - 1], mod - 2, mod)",
"+ for i in range(h + w - 2, 0, -1):",
"+ factinv[i] = (factinv[i + 1] * (i + 1)) % mod"
] | false | 0.236988 | 0.128936 | 1.838025 | [
"s909694836",
"s815005891"
] |
u681444474 | p02887 | python | s015916764 | s439306019 | 274 | 181 | 75,256 | 49,392 | Accepted | Accepted | 33.94 | import copy
N = int(eval(input()))
S = list(eval(input()))
l = copy.deepcopy(S)
for i in range(N-1):
if S[i] == S[i+1]:
l[i]=0
l_=[i for i in l if i!=0]
print((len(l_))) | N = int(eval(input()))
S=list(eval(input()))
cnt=0
for i in range(N-1):
if S[i]==S[i+1]:
cnt+=1
print((len(S)-cnt)) | 12 | 8 | 177 | 119 | import copy
N = int(eval(input()))
S = list(eval(input()))
l = copy.deepcopy(S)
for i in range(N - 1):
if S[i] == S[i + 1]:
l[i] = 0
l_ = [i for i in l if i != 0]
print((len(l_)))
| N = int(eval(input()))
S = list(eval(input()))
cnt = 0
for i in range(N - 1):
if S[i] == S[i + 1]:
cnt += 1
print((len(S) - cnt))
| false | 33.333333 | [
"-import copy",
"-",
"-l = copy.deepcopy(S)",
"+cnt = 0",
"- l[i] = 0",
"-l_ = [i for i in l if i != 0]",
"-print((len(l_)))",
"+ cnt += 1",
"+print((len(S) - cnt))"
] | false | 0.04504 | 0.077888 | 0.578271 | [
"s015916764",
"s439306019"
] |
u734589227 | p02971 | python | s042958036 | s993575196 | 1,236 | 355 | 38,356 | 13,404 | Accepted | Accepted | 71.28 | import sys
input = sys.stdin.readline
import numpy as np
n = int(eval(input()))
num = [eval(input()) for _ in range(n)]
num = np.array(num).astype("int64")
#ma=max(num)
#ind=num.index(ma)
sorted_num=sorted(num)
ma=sorted_num[-1]
ma2=sorted_num[-2]
for i in range(n):
if ma != num[i]:
print((st... | import sys
input = sys.stdin.readline
n = int(eval(input()))
num = [int(eval(input())) for _ in range(n)]
ma=max(num)
ind=num.index(ma)
ma2=sorted(num)[-2]
for i in range(n):
if ind==i:
print(ma2)
else:
print(ma) | 16 | 13 | 365 | 239 | import sys
input = sys.stdin.readline
import numpy as np
n = int(eval(input()))
num = [eval(input()) for _ in range(n)]
num = np.array(num).astype("int64")
# ma=max(num)
# ind=num.index(ma)
sorted_num = sorted(num)
ma = sorted_num[-1]
ma2 = sorted_num[-2]
for i in range(n):
if ma != num[i]:
print((str(ma)... | import sys
input = sys.stdin.readline
n = int(eval(input()))
num = [int(eval(input())) for _ in range(n)]
ma = max(num)
ind = num.index(ma)
ma2 = sorted(num)[-2]
for i in range(n):
if ind == i:
print(ma2)
else:
print(ma)
| false | 18.75 | [
"-import numpy as np",
"-",
"-num = [eval(input()) for _ in range(n)]",
"-num = np.array(num).astype(\"int64\")",
"-# ma=max(num)",
"-# ind=num.index(ma)",
"-sorted_num = sorted(num)",
"-ma = sorted_num[-1]",
"-ma2 = sorted_num[-2]",
"+num = [int(eval(input())) for _ in range(n)]",
"+ma = max(nu... | false | 0.85541 | 0.037843 | 22.604355 | [
"s042958036",
"s993575196"
] |
u980322611 | p02793 | python | s037515975 | s184827789 | 942 | 823 | 67,432 | 47,964 | Accepted | Accepted | 12.63 | N = int(eval(input()))
A = list(map(int,input().split()))
mod = 10**9 + 7
from fractions import gcd
def lcm(a,b):
return a//gcd(a,b)*b
AA = 1
for i in range(N):
AA = lcm(AA,A[i])
AA %= mod
ans = 0
for i in range(N):
ans += AA*pow(A[i],mod-2,mod)
print((ans%mod)) | N = int(eval(input()))
A = list(map(int,input().split()))
mod = 10**9 + 7
def p_prime(n):
prime = [2]
for i in range(3,n+1):
flag = 0
for j in prime:
if i%j == 0:
flag = 1
break
if i**0.5 < j:
break
... | 19 | 49 | 295 | 954 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
from fractions import gcd
def lcm(a, b):
return a // gcd(a, b) * b
AA = 1
for i in range(N):
AA = lcm(AA, A[i])
AA %= mod
ans = 0
for i in range(N):
ans += AA * pow(A[i], mod - 2, mod)
print((ans % mod))
| N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
def p_prime(n):
prime = [2]
for i in range(3, n + 1):
flag = 0
for j in prime:
if i % j == 0:
flag = 1
break
if i**0.5 < j:
break
if flag =... | false | 61.22449 | [
"-from fractions import gcd",
"-def lcm(a, b):",
"- return a // gcd(a, b) * b",
"+def p_prime(n):",
"+ prime = [2]",
"+ for i in range(3, n + 1):",
"+ flag = 0",
"+ for j in prime:",
"+ if i % j == 0:",
"+ flag = 1",
"+ break",
"+... | false | 0.04105 | 0.080262 | 0.511454 | [
"s037515975",
"s184827789"
] |
u022979415 | p02691 | python | s779432652 | s882783011 | 228 | 180 | 65,152 | 46,156 | Accepted | Accepted | 21.05 | from collections import Counter
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
b = []
c = []
for i in range(n):
b.append(a[i] + i + 1)
c.append(i + 1 - a[i])
b = list(Counter(b).items())
c = Counter(c)
answer = 0
for i, n in b:
... | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
b = []
c = {}
answer = 0
for i in range(n):
b.append(a[i] + i + 1)
tmp = -a[i] + i + 1
if tmp in c:
c[tmp] += 1
else:
c[tmp] = 1
for i in range(n):
... | 23 | 22 | 431 | 429 | from collections import Counter
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
b = []
c = []
for i in range(n):
b.append(a[i] + i + 1)
c.append(i + 1 - a[i])
b = list(Counter(b).items())
c = Counter(c)
answer = 0
for i, n in b:
if i i... | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
b = []
c = {}
answer = 0
for i in range(n):
b.append(a[i] + i + 1)
tmp = -a[i] + i + 1
if tmp in c:
c[tmp] += 1
else:
c[tmp] = 1
for i in range(n):
if b[i] i... | false | 4.347826 | [
"-from collections import Counter",
"-",
"-",
"- c = []",
"+ c = {}",
"+ answer = 0",
"- c.append(i + 1 - a[i])",
"- b = list(Counter(b).items())",
"- c = Counter(c)",
"- answer = 0",
"- for i, n in b:",
"- if i in c:",
"- answer += n * c[i]",
... | false | 0.039018 | 0.041301 | 0.944722 | [
"s779432652",
"s882783011"
] |
u305366205 | p02773 | python | s548824627 | s473813148 | 992 | 717 | 48,640 | 45,040 | Accepted | Accepted | 27.72 | import collections
n = int(input())
dd = collections.defaultdict(int)
for _ in range(n):
dd[input()] += 1
ans = []
for key in dd.keys():
ans.append((dd[key], key))
ans.sort(reverse=True)
ans2 = [ans[0][1]]
for i in range(1, len(ans)):
if ans[i - 1][0] != ans[i][0]:
break
ans2.append... | import collections
n = int(input())
s = [input() for _ in range(n)]
s = collections.Counter(s).most_common()
ans = []
for i in range(1, len(s) + 1):
ans.append(s[i - 1][0])
if i == len(s):
break
if s[i - 1][1] != s[i][1]:
break
ans.sort()
print(*ans, sep='\n')
| 16 | 13 | 368 | 300 | import collections
n = int(input())
dd = collections.defaultdict(int)
for _ in range(n):
dd[input()] += 1
ans = []
for key in dd.keys():
ans.append((dd[key], key))
ans.sort(reverse=True)
ans2 = [ans[0][1]]
for i in range(1, len(ans)):
if ans[i - 1][0] != ans[i][0]:
break
ans2.append(ans[i][1])
... | import collections
n = int(input())
s = [input() for _ in range(n)]
s = collections.Counter(s).most_common()
ans = []
for i in range(1, len(s) + 1):
ans.append(s[i - 1][0])
if i == len(s):
break
if s[i - 1][1] != s[i][1]:
break
ans.sort()
print(*ans, sep="\n")
| false | 18.75 | [
"-dd = collections.defaultdict(int)",
"-for _ in range(n):",
"- dd[input()] += 1",
"+s = [input() for _ in range(n)]",
"+s = collections.Counter(s).most_common()",
"-for key in dd.keys():",
"- ans.append((dd[key], key))",
"-ans.sort(reverse=True)",
"-ans2 = [ans[0][1]]",
"-for i in range(1, ... | false | 0.030871 | 0.031331 | 0.985316 | [
"s548824627",
"s473813148"
] |
u994988729 | p03062 | python | s706324376 | s273550867 | 387 | 312 | 23,292 | 24,804 | Accepted | Accepted | 19.38 | from numpy import sign
n=int(eval(input()))
a=list(map(int,input().split()))
a_abs=list(map(abs,a))
a_abs.sort()
plmi=1
for i in a:
plmi*=sign(i)
if plmi==-1:
ans=sum(a_abs[1:])-a_abs[0]
elif plmi==1 or plmi==0:
ans=sum(a_abs)
print(ans) | import numpy as np
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int64)
neg = np.count_nonzero(A[A < 0])
ans = np.abs(A).sum()
if neg % 2 == 1:
v = np.abs(A).min()
ans -= 2 * v
print(ans)
| 15 | 11 | 259 | 218 | from numpy import sign
n = int(eval(input()))
a = list(map(int, input().split()))
a_abs = list(map(abs, a))
a_abs.sort()
plmi = 1
for i in a:
plmi *= sign(i)
if plmi == -1:
ans = sum(a_abs[1:]) - a_abs[0]
elif plmi == 1 or plmi == 0:
ans = sum(a_abs)
print(ans)
| import numpy as np
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int64)
neg = np.count_nonzero(A[A < 0])
ans = np.abs(A).sum()
if neg % 2 == 1:
v = np.abs(A).min()
ans -= 2 * v
print(ans)
| false | 26.666667 | [
"-from numpy import sign",
"+import numpy as np",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-a_abs = list(map(abs, a))",
"-a_abs.sort()",
"-plmi = 1",
"-for i in a:",
"- plmi *= sign(i)",
"-if plmi == -1:",
"- ans = sum(a_abs[1:]) - a_abs[0]",
"-elif plmi == 1 o... | false | 0.230212 | 0.225964 | 1.018796 | [
"s706324376",
"s273550867"
] |
u757117214 | p02659 | python | s074537622 | s031003197 | 91 | 21 | 71,280 | 9,172 | Accepted | Accepted | 76.92 | from decimal import Decimal
A,B = input().split()
a = Decimal(A)
b = Decimal(B)
print((int(a*b))) | A,B = input().split()
A = int(A)
B = int(B.replace(".",""))
print((A * B // 100)) | 6 | 4 | 101 | 82 | from decimal import Decimal
A, B = input().split()
a = Decimal(A)
b = Decimal(B)
print((int(a * b)))
| A, B = input().split()
A = int(A)
B = int(B.replace(".", ""))
print((A * B // 100))
| false | 33.333333 | [
"-from decimal import Decimal",
"-",
"-a = Decimal(A)",
"-b = Decimal(B)",
"-print((int(a * b)))",
"+A = int(A)",
"+B = int(B.replace(\".\", \"\"))",
"+print((A * B // 100))"
] | false | 0.100167 | 0.091921 | 1.089712 | [
"s074537622",
"s031003197"
] |
u563952871 | p02676 | python | s178615136 | s516035144 | 28 | 25 | 9,160 | 9,152 | Accepted | Accepted | 10.71 | K = int(eval(input()))
S = eval(input())
if len(S) > K:
print((S[:K] + '...'))
else:
print(S)
| K = int(eval(input()))
S = eval(input())
print((S[:K] + '...' if len(S) > K else S))
| 8 | 4 | 94 | 75 | K = int(eval(input()))
S = eval(input())
if len(S) > K:
print((S[:K] + "..."))
else:
print(S)
| K = int(eval(input()))
S = eval(input())
print((S[:K] + "..." if len(S) > K else S))
| false | 50 | [
"-if len(S) > K:",
"- print((S[:K] + \"...\"))",
"-else:",
"- print(S)",
"+print((S[:K] + \"...\" if len(S) > K else S))"
] | false | 0.035425 | 0.037206 | 0.952121 | [
"s178615136",
"s516035144"
] |
u074220993 | p03426 | python | s017489714 | s787063192 | 921 | 659 | 129,316 | 48,664 | Accepted | Accepted | 28.45 | H, W, D = list(map(int, input().split()))
Aindex = [0] * (H*W)
for h in range(H):
w = 0
for A in input().split():
Aindex[int(A)-1] = (h,w)
w += 1
import numpy as np
v, h = int(np.ceil(H*W/D)), D
Mp = np.zeros((v, h)) #MpをMod D別に計算する予定
mp = lambda X, Y: abs(X[0]-Y[0]) + abs(X[1]-Y[1]... | H, W, D = list(map(int, input().split()))
Aindex = [0] * (H*W)
for h in range(H):
w = 0
for A in input().split():
Aindex[int(A)-1] = (h,w)
w += 1
import numpy as np
v, h = int(np.ceil(H*W/D)), D
Mp = np.zeros((v, h), dtype='int64') #MpをMod D別に計算する予定
mp = lambda X, Y: abs(X[0]-Y[0]) ... | 24 | 24 | 653 | 662 | H, W, D = list(map(int, input().split()))
Aindex = [0] * (H * W)
for h in range(H):
w = 0
for A in input().split():
Aindex[int(A) - 1] = (h, w)
w += 1
import numpy as np
v, h = int(np.ceil(H * W / D)), D
Mp = np.zeros((v, h)) # MpをMod D別に計算する予定
mp = lambda X, Y: abs(X[0] - Y[0]) + abs(X[1] - Y... | H, W, D = list(map(int, input().split()))
Aindex = [0] * (H * W)
for h in range(H):
w = 0
for A in input().split():
Aindex[int(A) - 1] = (h, w)
w += 1
import numpy as np
v, h = int(np.ceil(H * W / D)), D
Mp = np.zeros((v, h), dtype="int64") # MpをMod D別に計算する予定
mp = lambda X, Y: abs(X[0] - Y[0])... | false | 0 | [
"-Mp = np.zeros((v, h)) # MpをMod D別に計算する予定",
"+Mp = np.zeros((v, h), dtype=\"int64\") # MpをMod D別に計算する予定",
"-Query = [(int(x) for x in input().split()) for _ in range(Q)]",
"+Query = [tuple(map(int, input().split())) for _ in range(Q)]",
"- print((int(ans)))",
"+ print(ans)"
] | false | 0.332639 | 0.315465 | 1.05444 | [
"s017489714",
"s787063192"
] |
u325282913 | p03087 | python | s167189755 | s447469215 | 422 | 368 | 10,300 | 52,952 | Accepted | Accepted | 12.8 | N, Q = list(map(int, input().split()))
S = eval(input())
cnt_array = [0] * (N+1)
ans = [0] * Q
for i in range(N):
if i != N-1 and S[i] == 'A' and S[i+1] == 'C':
cnt_array[i+1] = 1 + cnt_array[i]
else:
cnt_array[i+1] = cnt_array[i]
for i in range(Q):
l, r = list(map(int, input().spl... | import sys
input = sys.stdin.readline
N, Q = list(map(int,input().split()))
S = eval(input())
S_array = [0] * N
for i in range(N):
S_array[i] = S_array[i-1]
if S[i-1] == 'A' and S[i] == 'C':
S_array[i] += 1
for _ in range(Q):
l, r = list(map(int,input().split()))
print((S_array[r-1]-S... | 14 | 12 | 383 | 313 | N, Q = list(map(int, input().split()))
S = eval(input())
cnt_array = [0] * (N + 1)
ans = [0] * Q
for i in range(N):
if i != N - 1 and S[i] == "A" and S[i + 1] == "C":
cnt_array[i + 1] = 1 + cnt_array[i]
else:
cnt_array[i + 1] = cnt_array[i]
for i in range(Q):
l, r = list(map(int, input().spl... | import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
S = eval(input())
S_array = [0] * N
for i in range(N):
S_array[i] = S_array[i - 1]
if S[i - 1] == "A" and S[i] == "C":
S_array[i] += 1
for _ in range(Q):
l, r = list(map(int, input().split()))
print((S_array[r - 1] - S... | false | 14.285714 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-cnt_array = [0] * (N + 1)",
"-ans = [0] * Q",
"+S_array = [0] * N",
"- if i != N - 1 and S[i] == \"A\" and S[i + 1] == \"C\":",
"- cnt_array[i + 1] = 1 + cnt_array[i]",
"- else:",
"- cnt_array[i + 1] = cnt_array[i]",
"-for ... | false | 0.038522 | 0.070213 | 0.548646 | [
"s167189755",
"s447469215"
] |
u201234972 | p03846 | python | s753566104 | s349959965 | 80 | 68 | 14,820 | 14,820 | Accepted | Accepted | 15 | from collections import Counter
N = int( eval(input()))
A = Counter(list( map( int, input().split())))
Q = 10**9 + 7
ans = 1
for i in range(N-1, 0, -2):
if A[i] == 2:
ans *= 2
ans %= Q
else:
ans = 0
break
if N%2 == 1:
if A[0] != 1:
ans = 0
print(ans)
| from collections import Counter
N = int( eval(input()))
A = Counter(list( map( int, input().split())))
Q = 10**9 + 7
ans = 1
for i in range(N-1, 0, -2):
if A[i] == 1:
ans = 0
break
if N%2 == 1:
if A[0] != 1:
ans = 0
print((ans*pow(2,N//2,Q))) | 16 | 13 | 312 | 278 | from collections import Counter
N = int(eval(input()))
A = Counter(list(map(int, input().split())))
Q = 10**9 + 7
ans = 1
for i in range(N - 1, 0, -2):
if A[i] == 2:
ans *= 2
ans %= Q
else:
ans = 0
break
if N % 2 == 1:
if A[0] != 1:
ans = 0
print(ans)
| from collections import Counter
N = int(eval(input()))
A = Counter(list(map(int, input().split())))
Q = 10**9 + 7
ans = 1
for i in range(N - 1, 0, -2):
if A[i] == 1:
ans = 0
break
if N % 2 == 1:
if A[0] != 1:
ans = 0
print((ans * pow(2, N // 2, Q)))
| false | 18.75 | [
"- if A[i] == 2:",
"- ans *= 2",
"- ans %= Q",
"- else:",
"+ if A[i] == 1:",
"-print(ans)",
"+print((ans * pow(2, N // 2, Q)))"
] | false | 0.054801 | 0.052228 | 1.049264 | [
"s753566104",
"s349959965"
] |
u334712262 | p02642 | python | s944846353 | s877173304 | 1,902 | 661 | 124,520 | 219,824 | Accepted | Accepted | 65.25 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutati... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().spli... | 137 | 81 | 2,704 | 1,393 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def r... | false | 40.875912 | [
"-import bisect",
"-import heapq",
"-import math",
"-import random",
"-from collections import Counter, defaultdict, deque",
"-from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal",
"-from functools import lru_cache, reduce",
"-from itertools import combinations, combinations_with_replacement, pr... | false | 0.039727 | 0.006808 | 5.835463 | [
"s944846353",
"s877173304"
] |
u811512248 | p03045 | python | s872205160 | s616518464 | 1,256 | 460 | 143,464 | 7,156 | Accepted | Accepted | 63.38 | import sys
sys.setrecursionlimit(10**8)
N, M = list(map(int, input().split()))
num_edges = M
edges = [list(map(int, input().split())) for i in range(num_edges)]
adj = [[] for i in range(N+1)]
for ed in edges:
adj[ed[0]] += [[ed[1], ed[2]]]
adj[ed[1]] += [[ed[0], ed[2]]]
col_list = [-1 for i in range(N+... | class UnionFind():
def __init__(self,size):
self.table=[-1]*size
def root(self,x):
while self.table[x]>=0:
x=self.table[x]
return x
def unite(self,x,y):
s1=self.root(x)
s2=self.root(y)
if s1!=s2:
if self.table[s1]>self.table[... | 22 | 28 | 615 | 774 | import sys
sys.setrecursionlimit(10**8)
N, M = list(map(int, input().split()))
num_edges = M
edges = [list(map(int, input().split())) for i in range(num_edges)]
adj = [[] for i in range(N + 1)]
for ed in edges:
adj[ed[0]] += [[ed[1], ed[2]]]
adj[ed[1]] += [[ed[0], ed[2]]]
col_list = [-1 for i in range(N + 1)]
... | class UnionFind:
def __init__(self, size):
self.table = [-1] * size
def root(self, x):
while self.table[x] >= 0:
x = self.table[x]
return x
def unite(self, x, y):
s1 = self.root(x)
s2 = self.root(y)
if s1 != s2:
if self.table[s1] > se... | false | 21.428571 | [
"-import sys",
"+class UnionFind:",
"+ def __init__(self, size):",
"+ self.table = [-1] * size",
"-sys.setrecursionlimit(10**8)",
"-N, M = list(map(int, input().split()))",
"-num_edges = M",
"-edges = [list(map(int, input().split())) for i in range(num_edges)]",
"-adj = [[] for i in range(... | false | 0.073553 | 0.081413 | 0.903453 | [
"s872205160",
"s616518464"
] |
u799691369 | p02761 | python | s870343590 | s938260378 | 21 | 18 | 3,444 | 3,064 | Accepted | Accepted | 14.29 | N, M = list(map(int, input().split()))
A = [float('inf') for _ in range(N)]
for i in range(M):
s, c = list(map(int, input().split()))
s -= 1
if A[s] != float('inf') and A[s] != c:
print((-1))
exit()
A[s] = min(A[s], c)
#A[s] = c
for i in range(1, N):
if A[i... | N, M = list(map(int, input().split()))
SC = [[] for _ in range(N)]
error = False
for _ in range(M):
s, c = list(map(int, input().split()))
s -= 1
if SC[s] and SC[s] != c:
error = True
break
else:
SC[s] = c
if error:
print((-1))
elif SC[0] == 0 and len(SC) > 1... | 31 | 27 | 571 | 580 | N, M = list(map(int, input().split()))
A = [float("inf") for _ in range(N)]
for i in range(M):
s, c = list(map(int, input().split()))
s -= 1
if A[s] != float("inf") and A[s] != c:
print((-1))
exit()
A[s] = min(A[s], c)
# A[s] = c
for i in range(1, N):
if A[i] == float("inf"):
... | N, M = list(map(int, input().split()))
SC = [[] for _ in range(N)]
error = False
for _ in range(M):
s, c = list(map(int, input().split()))
s -= 1
if SC[s] and SC[s] != c:
error = True
break
else:
SC[s] = c
if error:
print((-1))
elif SC[0] == 0 and len(SC) > 1:
print((-1))... | false | 12.903226 | [
"-A = [float(\"inf\") for _ in range(N)]",
"-for i in range(M):",
"+SC = [[] for _ in range(N)]",
"+error = False",
"+for _ in range(M):",
"- if A[s] != float(\"inf\") and A[s] != c:",
"- print((-1))",
"- exit()",
"- A[s] = min(A[s], c)",
"- # A[s] = c",
"-for i in range(1... | false | 0.113196 | 0.043958 | 2.575065 | [
"s870343590",
"s938260378"
] |
u037430802 | p03329 | python | s280930574 | s705126476 | 844 | 414 | 3,188 | 3,188 | Accepted | Accepted | 50.95 | import bisect
N = int(eval(input()))
ans = N
sixs = [1]
i = 6
while i <= N:
sixs.append(i)
i *= 6
nines = [1]
i = 9
while i <= N:
nines.append(i)
i *= 9
for i in range(N+1):
#iの分だけ6**xで構成
cnt = 0
a = i
b = N-i
while a > 0:
idx = bisect.bisect_right(sixs... | from bisect import bisect_right
def main():
N = int(eval(input()))
sixs = [1]
i = 6
while i <= N:
sixs.append(i)
i *= 6
nines = [1]
i = 9
while i <= N:
nines.append(i)
i *= 9
"""
i円分を6**xxx で、 残りを9**yyyと1*zzzで構成する。これらを全通り試す
... | 33 | 44 | 587 | 885 | import bisect
N = int(eval(input()))
ans = N
sixs = [1]
i = 6
while i <= N:
sixs.append(i)
i *= 6
nines = [1]
i = 9
while i <= N:
nines.append(i)
i *= 9
for i in range(N + 1):
# iの分だけ6**xで構成
cnt = 0
a = i
b = N - i
while a > 0:
idx = bisect.bisect_right(sixs, a)
cnt ... | from bisect import bisect_right
def main():
N = int(eval(input()))
sixs = [1]
i = 6
while i <= N:
sixs.append(i)
i *= 6
nines = [1]
i = 9
while i <= N:
nines.append(i)
i *= 9
"""
i円分を6**xxx で、 残りを9**yyyと1*zzzで構成する。これらを全通り試す
"""
ans = N
fo... | false | 25 | [
"-import bisect",
"+from bisect import bisect_right",
"-N = int(eval(input()))",
"-ans = N",
"-sixs = [1]",
"-i = 6",
"-while i <= N:",
"- sixs.append(i)",
"- i *= 6",
"-nines = [1]",
"-i = 9",
"-while i <= N:",
"- nines.append(i)",
"- i *= 9",
"-for i in range(N + 1):",
"-... | false | 0.302807 | 0.071665 | 4.225293 | [
"s280930574",
"s705126476"
] |
u077291787 | p03073 | python | s276279324 | s062335089 | 44 | 39 | 3,188 | 3,188 | Accepted | Accepted | 11.36 | # ABC124C - Coloring Colorfully
import sys
input = sys.stdin.readline
s = input().rstrip()
a = s[0]
ans = 0
for i, j in enumerate(s):
if i % 2 == 0:
if j != a:
ans += 1
else:
if j == a:
ans += 1
print(ans) | # ABC124C - Coloring Colorfully
def main():
s = eval(input())
a, ans = s[0], 0
for i, j in enumerate(s):
if (i % 2 and j == a) or (not i % 2 and j != a):
ans += 1
print(ans)
if __name__ == "__main__":
main() | 15 | 12 | 268 | 254 | # ABC124C - Coloring Colorfully
import sys
input = sys.stdin.readline
s = input().rstrip()
a = s[0]
ans = 0
for i, j in enumerate(s):
if i % 2 == 0:
if j != a:
ans += 1
else:
if j == a:
ans += 1
print(ans)
| # ABC124C - Coloring Colorfully
def main():
s = eval(input())
a, ans = s[0], 0
for i, j in enumerate(s):
if (i % 2 and j == a) or (not i % 2 and j != a):
ans += 1
print(ans)
if __name__ == "__main__":
main()
| false | 20 | [
"-import sys",
"+def main():",
"+ s = eval(input())",
"+ a, ans = s[0], 0",
"+ for i, j in enumerate(s):",
"+ if (i % 2 and j == a) or (not i % 2 and j != a):",
"+ ans += 1",
"+ print(ans)",
"-input = sys.stdin.readline",
"-s = input().rstrip()",
"-a = s[0]",
"-an... | false | 0.047929 | 0.047854 | 1.001553 | [
"s276279324",
"s062335089"
] |
u815878613 | p02630 | python | s520475925 | s040806945 | 316 | 287 | 40,428 | 40,280 | Accepted | Accepted | 9.18 | from collections import Counter
import sys
readline = sys.stdin.buffer.readline
N = int(readline())
A = list(map(int, readline().split()))
Q = int(readline())
BC = [list(map(int, readline().split())) for _ in range(Q)]
d = Counter(A)
sub_s = sum(A)
for b, c in BC:
sub_s += d[b] * (c - b)
... | from collections import Counter
import sys
readline = sys.stdin.buffer.readline
N = int(readline())
A = tuple(map(int, readline().split()))
Q = int(readline())
BC = [list(map(int, readline().split())) for _ in range(Q)]
d = Counter(A)
sub_s = sum(A)
for b, c in BC:
sub_s += d[b] * (c - b)
... | 22 | 22 | 369 | 370 | from collections import Counter
import sys
readline = sys.stdin.buffer.readline
N = int(readline())
A = list(map(int, readline().split()))
Q = int(readline())
BC = [list(map(int, readline().split())) for _ in range(Q)]
d = Counter(A)
sub_s = sum(A)
for b, c in BC:
sub_s += d[b] * (c - b)
d[c] += d[b]
d[b] ... | from collections import Counter
import sys
readline = sys.stdin.buffer.readline
N = int(readline())
A = tuple(map(int, readline().split()))
Q = int(readline())
BC = [list(map(int, readline().split())) for _ in range(Q)]
d = Counter(A)
sub_s = sum(A)
for b, c in BC:
sub_s += d[b] * (c - b)
d[c] += d[b]
d[b]... | false | 0 | [
"-A = list(map(int, readline().split()))",
"+A = tuple(map(int, readline().split()))"
] | false | 0.044748 | 0.049344 | 0.906844 | [
"s520475925",
"s040806945"
] |
u870518235 | p03457 | python | s351154331 | s958181747 | 528 | 320 | 59,028 | 3,060 | Accepted | Accepted | 39.39 | N = int(eval(input()))
D = [input().split() for i in range(N)]
DD = []
for i in range(N):
DD.append([int(D[i][0]),int(D[i][1]),int(D[i][2])])
diff = [[0,0,0],[DD[0][0]-0,DD[0][1]-0,DD[0][2]-0]]
for i in range(N-1):
diff.append([DD[i+1][0]-DD[i][0],DD[i+1][1]-DD[i][1],DD[i+1][2]-DD[i][2]])
def ... | N = int(eval(input()))
for _ in range(N):
t, x, y = list(map(int, input().split()))
if x + y > t or (t + x + y)%2 != 0:
print("No")
quit()
print("Yes") | 30 | 7 | 647 | 169 | N = int(eval(input()))
D = [input().split() for i in range(N)]
DD = []
for i in range(N):
DD.append([int(D[i][0]), int(D[i][1]), int(D[i][2])])
diff = [[0, 0, 0], [DD[0][0] - 0, DD[0][1] - 0, DD[0][2] - 0]]
for i in range(N - 1):
diff.append(
[DD[i + 1][0] - DD[i][0], DD[i + 1][1] - DD[i][1], DD[i + 1][... | N = int(eval(input()))
for _ in range(N):
t, x, y = list(map(int, input().split()))
if x + y > t or (t + x + y) % 2 != 0:
print("No")
quit()
print("Yes")
| false | 76.666667 | [
"-D = [input().split() for i in range(N)]",
"-DD = []",
"-for i in range(N):",
"- DD.append([int(D[i][0]), int(D[i][1]), int(D[i][2])])",
"-diff = [[0, 0, 0], [DD[0][0] - 0, DD[0][1] - 0, DD[0][2] - 0]]",
"-for i in range(N - 1):",
"- diff.append(",
"- [DD[i + 1][0] - DD[i][0], DD[i + 1][... | false | 0.04118 | 0.054262 | 0.758913 | [
"s351154331",
"s958181747"
] |
u158290747 | p02586 | python | s796950757 | s035620367 | 1,310 | 1,204 | 156,636 | 156,244 | Accepted | Accepted | 8.09 | R,C,K=list(map(int,input().split()))
l=[[0] * C for i in range(R)]
for i in range(K):
a,b,c=list(map(int,input().split()))
a-=1
b-=1
l[a][b]=c
dp=[0]*C
for i in range(R):
ndp=[0]*C
kdp=[0]*4
kdp[0]=dp[0]
kdp[1]=l[i][0]+dp[0]
ndp[0]=kdp[1]
for j in range(1,C):
kdp[0]=max(kdp[0],dp[... | R,C,K=list(map(int,input().split()))
l=[[0] * C for i in range(R)]
for i in range(K):
a,b,c=list(map(int,input().split()))
a-=1
b-=1
l[a][b]=c
dp=[0]*C
for i in range(R):
ndp=[0]*C
kdp=[0]*4
for j in range(0,C):
kdp[0]=max(kdp[0],dp[j])
for k in range(2,-1,-1):
kdp[k+1]=max(kdp... | 21 | 18 | 433 | 376 | R, C, K = list(map(int, input().split()))
l = [[0] * C for i in range(R)]
for i in range(K):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
l[a][b] = c
dp = [0] * C
for i in range(R):
ndp = [0] * C
kdp = [0] * 4
kdp[0] = dp[0]
kdp[1] = l[i][0] + dp[0]
ndp[0] = kdp[1]
for... | R, C, K = list(map(int, input().split()))
l = [[0] * C for i in range(R)]
for i in range(K):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
l[a][b] = c
dp = [0] * C
for i in range(R):
ndp = [0] * C
kdp = [0] * 4
for j in range(0, C):
kdp[0] = max(kdp[0], dp[j])
for k... | false | 14.285714 | [
"- kdp[0] = dp[0]",
"- kdp[1] = l[i][0] + dp[0]",
"- ndp[0] = kdp[1]",
"- for j in range(1, C):",
"+ for j in range(0, C):"
] | false | 0.102505 | 0.043093 | 2.378677 | [
"s796950757",
"s035620367"
] |
u368780724 | p03182 | python | s546494788 | s717345561 | 1,408 | 1,249 | 108,372 | 107,348 | Accepted | Accepted | 11.29 | import sys
class Lazysegtree:
#RAQ
def __init__(self, A, intv, initialize = True, segf = min):
#区間は 1-indexed で管理
self.N = len(A)
self.N0 = 2**(self.N-1).bit_length()
self.intv = intv
self.segf = segf
self.lazy = [0]*(2*self.N0)
if initialize:
... | import sys
class Lazysegtree:
#RAQ
def __init__(self, A, intv, initialize = True, segf = min):
#区間は 1-indexed で管理
self.N = len(A)
self.N0 = 2**(self.N-1).bit_length()
self.intv = intv
self.segf = segf
self.lazy = [0]*(2*self.N0)
if initialize:
... | 102 | 103 | 2,812 | 2,813 | import sys
class Lazysegtree:
# RAQ
def __init__(self, A, intv, initialize=True, segf=min):
# 区間は 1-indexed で管理
self.N = len(A)
self.N0 = 2 ** (self.N - 1).bit_length()
self.intv = intv
self.segf = segf
self.lazy = [0] * (2 * self.N0)
if initialize:
... | import sys
class Lazysegtree:
# RAQ
def __init__(self, A, intv, initialize=True, segf=min):
# 区間は 1-indexed で管理
self.N = len(A)
self.N0 = 2 ** (self.N - 1).bit_length()
self.intv = intv
self.segf = segf
self.lazy = [0] * (2 * self.N0)
if initialize:
... | false | 0.970874 | [
"- dp.add(i, i + 1, res + t)",
"+ dp.update(i, res + t)"
] | false | 0.031705 | 0.033817 | 0.937561 | [
"s546494788",
"s717345561"
] |
u648868410 | p02579 | python | s202786178 | s546511660 | 1,909 | 474 | 24,404 | 109,736 | Accepted | Accepted | 75.17 | # import numpy as np
from collections import deque
def solve(): #H, W, CH, CW, DH, DW, S):
H,W=list(map(int,input().split()))
CH,CW=list(map(int,input().split()))
DH,DW=list(map(int,input().split()))
S=[eval(input()) for _ in range(H)]
# 後の条件分岐を簡略化するためワープしても迷路外に出ないように壁で囲む
S = ['##{}##'.format(row) for... | # import numpy as np
from collections import deque
# 関数化しただけで、実行速度が半分になった部分あり。。。
def solve(): #H, W, CH, CW, DH, DW, S):
H,W=list(map(int,input().split()))
CH,CW=list(map(int,input().split()))
DH,DW=list(map(int,input().split()))
S=[eval(input()) for _ in range(H)]
# 後の条件分岐を簡略化するためワープしても迷路外に出ないように壁で囲む
... | 74 | 75 | 1,610 | 1,641 | # import numpy as np
from collections import deque
def solve(): # H, W, CH, CW, DH, DW, S):
H, W = list(map(int, input().split()))
CH, CW = list(map(int, input().split()))
DH, DW = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
# 後の条件分岐を簡略化するためワープしても迷路外に出ないように壁で囲む
S = [... | # import numpy as np
from collections import deque
# 関数化しただけで、実行速度が半分になった部分あり。。。
def solve(): # H, W, CH, CW, DH, DW, S):
H, W = list(map(int, input().split()))
CH, CW = list(map(int, input().split()))
DH, DW = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
# 後の条件分岐を簡略化するためワ... | false | 1.333333 | [
"-",
"+# 関数化しただけで、実行速度が半分になった部分あり。。。"
] | false | 0.080295 | 0.035796 | 2.243135 | [
"s202786178",
"s546511660"
] |
u277312083 | p02791 | python | s750939084 | s201810754 | 137 | 110 | 24,744 | 24,744 | Accepted | Accepted | 19.71 | n = int(eval(input()))
p = list(map(int, input().split( )))
c = 1
m = p[0]
for a in p[1:]:
m = min(m, a)
if m == a:
c += 1
print(c) | n = int(eval(input()))
p = list(map(int, input().split( )))
c = 0
m = p[0]
for i in range(n):
if m >= p[i]:
c += 1
m = p[i]
print(c) | 9 | 9 | 149 | 154 | n = int(eval(input()))
p = list(map(int, input().split()))
c = 1
m = p[0]
for a in p[1:]:
m = min(m, a)
if m == a:
c += 1
print(c)
| n = int(eval(input()))
p = list(map(int, input().split()))
c = 0
m = p[0]
for i in range(n):
if m >= p[i]:
c += 1
m = p[i]
print(c)
| false | 0 | [
"-c = 1",
"+c = 0",
"-for a in p[1:]:",
"- m = min(m, a)",
"- if m == a:",
"+for i in range(n):",
"+ if m >= p[i]:",
"+ m = p[i]"
] | false | 0.121629 | 0.101594 | 1.197207 | [
"s750939084",
"s201810754"
] |
u630511239 | p02633 | python | s725624312 | s939908544 | 32 | 29 | 9,128 | 9,112 | Accepted | Accepted | 9.38 | X = int(eval(input()))
import math
A = X // math.gcd(360, X)
ans = 360 * A // X
print(ans) | X = int(eval(input()))
import math
ans = 360 // math.gcd(360, X)
print(ans) | 5 | 4 | 88 | 72 | X = int(eval(input()))
import math
A = X // math.gcd(360, X)
ans = 360 * A // X
print(ans)
| X = int(eval(input()))
import math
ans = 360 // math.gcd(360, X)
print(ans)
| false | 20 | [
"-A = X // math.gcd(360, X)",
"-ans = 360 * A // X",
"+ans = 360 // math.gcd(360, X)"
] | false | 0.045511 | 0.045993 | 0.989515 | [
"s725624312",
"s939908544"
] |
u577311000 | p00118 | python | s821518889 | s948860740 | 120 | 110 | 15,568 | 15,644 | Accepted | Accepted | 8.33 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
# for dh,dv in [[0,1],[0,-1],[1,0],[-1,0]]:
# search(values,hp+dh,vp+dv,item)
s... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
# for dh,dv in [[0,1],[0,-1],[1,0],[-1,0]]:
# search(values,hp+dh,vp+dv,item)
s... | 42 | 38 | 1,075 | 937 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)
def search(values, hp, vp, item):
if not (0 <= hp < len(values)):
return
if not (0 <= vp < len(values[hp])):
return
if item != values[hp][vp]:
return
values[hp][vp] = True
# for dh,dv in [[0,1],[0,-1],[1,0],[... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)
def search(values, hp, vp, item):
if not (0 <= hp < len(values)):
return
if not (0 <= vp < len(values[hp])):
return
if item != values[hp][vp]:
return
values[hp][vp] = True
# for dh,dv in [[0,1],[0,-1],[1,0],[... | false | 9.52381 | [
"- line, values = input().strip(), list()",
"+ line = input().strip()",
"- value = list()",
"+ values = list()",
"- value.append(list(x for x in input().strip()))",
"- # \t\t\tvalue.append(list(input().strip()))",
"- print((solve(value)))",
"- # \t\t... | false | 0.114383 | 0.049315 | 2.319455 | [
"s821518889",
"s948860740"
] |
u811733736 | p00092 | python | s758086083 | s621143930 | 3,380 | 2,730 | 34,152 | 34,240 | Accepted | Accepted | 19.23 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0092
"""
import sys
def find_square0(data):
max_size = 0
lmap = [] # dp??¨???2?¬??????????
# '.'????????????1??????'*'????????????0????????????
for row in data:
temp = []
for c in row:
... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0092
"""
import sys
def find_square2(data):
max_size = 0
dp = [[0]*len(data[0]) for _ in range(len(data))] # dp??¨???2?¬??????????
# '.'????????????1??????'*'????????????0????????????
for y, row in enumerat... | 111 | 42 | 3,689 | 1,287 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0092
"""
import sys
def find_square0(data):
max_size = 0
lmap = [] # dp??¨???2?¬??????????
# '.'????????????1??????'*'????????????0????????????
for row in data:
temp = []
for c in row:
if ... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0092
"""
import sys
def find_square2(data):
max_size = 0
dp = [[0] * len(data[0]) for _ in range(len(data))] # dp??¨???2?¬??????????
# '.'????????????1??????'*'????????????0????????????
for y, row in enumerate(data):... | false | 62.162162 | [
"-def find_square0(data):",
"- max_size = 0",
"- lmap = [] # dp??¨???2?¬??????????",
"- # '.'????????????1??????'*'????????????0????????????",
"- for row in data:",
"- temp = []",
"- for c in row:",
"- if c == \".\":",
"- temp.append(1)",
"- ... | false | 0.036523 | 0.035969 | 1.015406 | [
"s758086083",
"s621143930"
] |
u454022848 | p02389 | python | s168391200 | s435383160 | 30 | 10 | 6,724 | 6,268 | Accepted | Accepted | 66.67 | def prod(int_list):
p = 1
for i in int_list:
p *= i
return p
int_ary = [int(s) for s in input().split(" ")]
print((prod(int_ary), 2 * sum(int_ary))) | # encoding:utf-8
input = list(map(int, input().split()))
height = input[0]
width = input[1]
area = height * width
circumference = (height + width) * 2
print((area), end=' ')
print(circumference) | 8 | 9 | 160 | 191 | def prod(int_list):
p = 1
for i in int_list:
p *= i
return p
int_ary = [int(s) for s in input().split(" ")]
print((prod(int_ary), 2 * sum(int_ary)))
| # encoding:utf-8
input = list(map(int, input().split()))
height = input[0]
width = input[1]
area = height * width
circumference = (height + width) * 2
print((area), end=" ")
print(circumference)
| false | 11.111111 | [
"-def prod(int_list):",
"- p = 1",
"- for i in int_list:",
"- p *= i",
"- return p",
"-",
"-",
"-int_ary = [int(s) for s in input().split(\" \")]",
"-print((prod(int_ary), 2 * sum(int_ary)))",
"+# encoding:utf-8",
"+input = list(map(int, input().split()))",
"+height = input[0]"... | false | 0.034207 | 0.033707 | 1.014824 | [
"s168391200",
"s435383160"
] |
u062147869 | p03553 | python | s292730176 | s991232408 | 200 | 29 | 42,716 | 3,444 | Accepted | Accepted | 85.5 | N=int(eval(input()))
P=[int(i) for i in input().split()]
inf = 10**20
table=[[0]*(N+2) for i in range(N+2)]
for i in range(1,N+1):
if P[i-1]>0:
table[i][N+1]=P[i-1]
else:
table[0][i]=-P[i-1]
for j in range(2*i,N+1,i):
table[i][j]=inf
#print(table)
def fk(x,t,f):
#pri... | from collections import deque
N=int(eval(input()))
P=[int(i) for i in input().split()]
inf = 10**20
table=[[0]*(N+2) for i in range(N+2)]
for i in range(1,N+1):
if P[i-1]>0:
table[i][N+1]=P[i-1]
else:
table[0][i]=-P[i-1]
for j in range(2*i,N+1,i):
table[i][j]=inf
... | 36 | 52 | 788 | 1,166 | N = int(eval(input()))
P = [int(i) for i in input().split()]
inf = 10**20
table = [[0] * (N + 2) for i in range(N + 2)]
for i in range(1, N + 1):
if P[i - 1] > 0:
table[i][N + 1] = P[i - 1]
else:
table[0][i] = -P[i - 1]
for j in range(2 * i, N + 1, i):
table[i][j] = inf
# print(table... | from collections import deque
N = int(eval(input()))
P = [int(i) for i in input().split()]
inf = 10**20
table = [[0] * (N + 2) for i in range(N + 2)]
for i in range(1, N + 1):
if P[i - 1] > 0:
table[i][N + 1] = P[i - 1]
else:
table[0][i] = -P[i - 1]
for j in range(2 * i, N + 1, i):
... | false | 30.769231 | [
"+from collections import deque",
"+",
"-# print(table)",
"-def fk(x, t, f):",
"- # print(x)",
"- visit[x] = True",
"- if x == t:",
"+",
"+",
"+def bfs(x):",
"+ visit[x] = 0",
"+ h = deque()",
"+ h.append(x)",
"+ while h:",
"+ y = h.popleft()",
"+ for... | false | 0.046007 | 0.042519 | 1.082031 | [
"s292730176",
"s991232408"
] |
u345483150 | p02791 | python | s101311728 | s522290816 | 117 | 108 | 24,744 | 24,744 | Accepted | Accepted | 7.69 | n=int(eval(input()))
p=list(map(int,input().split()))
a=p[0]
cnt=1
for i in range(n):
if p[i]<a:
cnt+=1
a=p[i]
if p[i]==1:
break
print(cnt) | n=int(eval(input()))
p=list(map(int,input().split()))
a=p[0]
cnt=1
for i in p:
if i<a:
cnt+=1
a=i
if i==1:
break
print(cnt) | 11 | 11 | 183 | 167 | n = int(eval(input()))
p = list(map(int, input().split()))
a = p[0]
cnt = 1
for i in range(n):
if p[i] < a:
cnt += 1
a = p[i]
if p[i] == 1:
break
print(cnt)
| n = int(eval(input()))
p = list(map(int, input().split()))
a = p[0]
cnt = 1
for i in p:
if i < a:
cnt += 1
a = i
if i == 1:
break
print(cnt)
| false | 0 | [
"-for i in range(n):",
"- if p[i] < a:",
"+for i in p:",
"+ if i < a:",
"- a = p[i]",
"- if p[i] == 1:",
"+ a = i",
"+ if i == 1:"
] | false | 0.041704 | 0.040888 | 1.019959 | [
"s101311728",
"s522290816"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.