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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u222668979 | p02948 | python | s019037242 | s711735657 | 363 | 335 | 106,136 | 113,736 | Accepted | Accepted | 7.71 | from collections import defaultdict
from heapq import heappush, heappop, merge
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
day = defaultdict(list)
for a, b in ab:
heappush(day[a], -b)
work, ans = [], 0
for i in range(1, m + 1):
for j in day[i]:
... | from collections import defaultdict
from heapq import heappush, heappop, merge
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
day = defaultdict(list)
for a, b in ab:
day[a].append(b)
work, ans = [], 0
for i in range(1, m + 1):
for j in day[i]:
... | 17 | 17 | 406 | 403 | from collections import defaultdict
from heapq import heappush, heappop, merge
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
day = defaultdict(list)
for a, b in ab:
heappush(day[a], -b)
work, ans = [], 0
for i in range(1, m + 1):
for j in day[i]:
heappu... | from collections import defaultdict
from heapq import heappush, heappop, merge
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
day = defaultdict(list)
for a, b in ab:
day[a].append(b)
work, ans = [], 0
for i in range(1, m + 1):
for j in day[i]:
heappush(w... | false | 0 | [
"- heappush(day[a], -b)",
"+ day[a].append(b)",
"- heappush(work, j)",
"+ heappush(work, -j)"
] | false | 0.043236 | 0.043908 | 0.984699 | [
"s019037242",
"s711735657"
] |
u238001675 | p02409 | python | s114988369 | s239149349 | 30 | 20 | 5,644 | 5,628 | Accepted | Accepted | 33.33 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
tenant = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(sys.stdin.readline())
for i in range(n):
b, f, r, v = map(int, sys.stdin.readline().split())
tenant[b-1][f-1][r-1] += v
separator = '#' * 20
for b in range(4):
... | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
tenant = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(sys.stdin.readline())
for i in range(n):
b, f, r, v = list(map(int, sys.stdin.readline().split()))
tenant[b-1][f-1][r-1] += v
ROOM_STR = '{:2}' * 10 # width:2 10... | 21 | 20 | 490 | 508 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
tenant = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(sys.stdin.readline())
for i in range(n):
b, f, r, v = map(int, sys.stdin.readline().split())
tenant[b - 1][f - 1][r - 1] += v
separator = "#" * 20
for b in range(4):
for f i... | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
tenant = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(sys.stdin.readline())
for i in range(n):
b, f, r, v = list(map(int, sys.stdin.readline().split()))
tenant[b - 1][f - 1][r - 1] += v
ROOM_STR = "{:2}" * 10 # width:2 10 rooms
se... | false | 4.761905 | [
"- b, f, r, v = map(int, sys.stdin.readline().split())",
"+ b, f, r, v = list(map(int, sys.stdin.readline().split()))",
"+ROOM_STR = \"{:2}\" * 10 # width:2 10 rooms",
"- for r in range(10):",
"- print(\" \", tenant[b][f][r], sep=\"\", end=\"\")",
"- print()",
"+ p... | false | 0.037887 | 0.144796 | 0.261657 | [
"s114988369",
"s239149349"
] |
u891516200 | p02730 | python | s322856783 | s413271418 | 29 | 26 | 8,988 | 9,068 | Accepted | Accepted | 10.34 | S = eval(input())
N = len(S)
one = S[:int((N-1) / 2)]
two = S[int((N+3) / 2)-1:]
if S == S[::-1]:
if one == one[::-1]:
if two == two[::-1]:
print('Yes')
exit()
print('No')
| S = eval(input())
N = len(S)
one = S[:(N-1) // 2]
two = S[(N+3) // 2 - 1:]
if S == S[::-1]:
if one == one[::-1]:
if two == two[::-1]:
print('Yes')
exit()
print('No')
| 13 | 13 | 217 | 211 | S = eval(input())
N = len(S)
one = S[: int((N - 1) / 2)]
two = S[int((N + 3) / 2) - 1 :]
if S == S[::-1]:
if one == one[::-1]:
if two == two[::-1]:
print("Yes")
exit()
print("No")
| S = eval(input())
N = len(S)
one = S[: (N - 1) // 2]
two = S[(N + 3) // 2 - 1 :]
if S == S[::-1]:
if one == one[::-1]:
if two == two[::-1]:
print("Yes")
exit()
print("No")
| false | 0 | [
"-one = S[: int((N - 1) / 2)]",
"-two = S[int((N + 3) / 2) - 1 :]",
"+one = S[: (N - 1) // 2]",
"+two = S[(N + 3) // 2 - 1 :]"
] | false | 0.049053 | 0.046145 | 1.06301 | [
"s322856783",
"s413271418"
] |
u860829879 | p02580 | python | s871285175 | s216596635 | 990 | 730 | 134,444 | 228,556 | Accepted | Accepted | 26.26 | from collections import Counter
h,w,m=list(map(int,input().split()))
hw=[list(map(int,input().split())) for _ in range(m)]
hlst=[x for x,_ in hw]
wlst=[x for _,x in hw]
hcnt=Counter(hlst)
wcnt=Counter(wlst)
_,hmax=hcnt.most_common(1)[0]
_,wmax=wcnt.most_common(1)[0]
hcand=set([k for k,v in list(hcnt.... | from collections import Counter
h,w,m=list(map(int,input().split()))
hw=[list(map(int,input().split())) for _ in range(m)]
hlst=[x for x,_ in hw]
wlst=[x for _,x in hw]
hcnt=Counter(hlst)
wcnt=Counter(wlst)
_,hmax=hcnt.most_common(1)[0]
_,wmax=wcnt.most_common(1)[0]
hcand=set([k for k,v in list(hcnt.it... | 27 | 22 | 564 | 537 | from collections import Counter
h, w, m = list(map(int, input().split()))
hw = [list(map(int, input().split())) for _ in range(m)]
hlst = [x for x, _ in hw]
wlst = [x for _, x in hw]
hcnt = Counter(hlst)
wcnt = Counter(wlst)
_, hmax = hcnt.most_common(1)[0]
_, wmax = wcnt.most_common(1)[0]
hcand = set([k for k, v in l... | from collections import Counter
h, w, m = list(map(int, input().split()))
hw = [list(map(int, input().split())) for _ in range(m)]
hlst = [x for x, _ in hw]
wlst = [x for _, x in hw]
hcnt = Counter(hlst)
wcnt = Counter(wlst)
_, hmax = hcnt.most_common(1)[0]
_, wmax = wcnt.most_common(1)[0]
hcand = set([k for k, v in l... | false | 18.518519 | [
"-ng = []",
"-for hh, ww in hw:",
"- if hh in hcand and ww in wcand:",
"- ng.append((hh, ww))",
"+ng = [(hh, ww) for hh, ww in hw if ((hh in hcand) and (ww in wcand))]"
] | false | 0.034033 | 0.036738 | 0.926359 | [
"s871285175",
"s216596635"
] |
u629540524 | p03328 | python | s751489707 | s873784231 | 26 | 23 | 9,032 | 8,996 | Accepted | Accepted | 11.54 | a,b = list(map(int,input().split()))
c = b-a
for i in range(1,999):
x= (i+1)*i//2
y= (i+2)*(i+1)//2
if y-x == c:
print((x-a))
break | a,b = list(map(int,input().split()))
c = b-a
print(((c+1)*c//2-b)) | 8 | 3 | 158 | 60 | a, b = list(map(int, input().split()))
c = b - a
for i in range(1, 999):
x = (i + 1) * i // 2
y = (i + 2) * (i + 1) // 2
if y - x == c:
print((x - a))
break
| a, b = list(map(int, input().split()))
c = b - a
print(((c + 1) * c // 2 - b))
| false | 62.5 | [
"-for i in range(1, 999):",
"- x = (i + 1) * i // 2",
"- y = (i + 2) * (i + 1) // 2",
"- if y - x == c:",
"- print((x - a))",
"- break",
"+print(((c + 1) * c // 2 - b))"
] | false | 0.007625 | 0.038161 | 0.199825 | [
"s751489707",
"s873784231"
] |
u197237612 | p02639 | python | s752080516 | s310779107 | 26 | 24 | 9,136 | 9,036 | Accepted | Accepted | 7.69 | x1, x2, x3, x4, x5 = list(map(int, input().split()))
if x1 ==0:
print((1))
if x2 ==0:
print((2))
if x3 ==0:
print((3))
if x4 ==0:
print((4))
if x5 ==0:
print((5)) | x = list(map(int, input().split()))
for i in range(5):
if x[i] == 0:
print((i + 1)) | 16 | 5 | 182 | 92 | x1, x2, x3, x4, x5 = list(map(int, input().split()))
if x1 == 0:
print((1))
if x2 == 0:
print((2))
if x3 == 0:
print((3))
if x4 == 0:
print((4))
if x5 == 0:
print((5))
| x = list(map(int, input().split()))
for i in range(5):
if x[i] == 0:
print((i + 1))
| false | 68.75 | [
"-x1, x2, x3, x4, x5 = list(map(int, input().split()))",
"-if x1 == 0:",
"- print((1))",
"-if x2 == 0:",
"- print((2))",
"-if x3 == 0:",
"- print((3))",
"-if x4 == 0:",
"- print((4))",
"-if x5 == 0:",
"- print((5))",
"+x = list(map(int, input().split()))",
"+for i in range(5):... | false | 0.046969 | 0.0469 | 1.001475 | [
"s752080516",
"s310779107"
] |
u634079249 | p02947 | python | s041613670 | s812155308 | 211 | 183 | 21,032 | 21,040 | Accepted | Accepted | 13.27 | import sys
import os
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
N = int(sys.stdin.readline().rstrip())
lines = ["".join(sorted(line.rstrip())) for line in sys.stdin.readlines()]
ret = 0
sortedlines = {}
for n in range(N):
item = lines[... | import sys
import os
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
N = int(sys.stdin.readline().rstrip())
lines = ["".join(sorted(line.rstrip())) for line in sys.stdin.readlines()]
ret = 0
sortedlines = {}
for n in range(N):
item = lines[... | 26 | 26 | 546 | 542 | import sys
import os
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
N = int(sys.stdin.readline().rstrip())
lines = ["".join(sorted(line.rstrip())) for line in sys.stdin.readlines()]
ret = 0
sortedlines = {}
for n in range(N):
item = lines[n]
if it... | import sys
import os
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
N = int(sys.stdin.readline().rstrip())
lines = ["".join(sorted(line.rstrip())) for line in sys.stdin.readlines()]
ret = 0
sortedlines = {}
for n in range(N):
item = lines[n]
if it... | false | 0 | [
"- ret += sortedlines[item] - 1",
"+ ret += sortedlines[item]",
"- sortedlines[item] = 1",
"+ sortedlines[item] = 0"
] | false | 0.035869 | 0.042979 | 0.834572 | [
"s041613670",
"s812155308"
] |
u539367121 | p02937 | python | s668513847 | s078007368 | 165 | 144 | 18,148 | 17,920 | Accepted | Accepted | 12.73 | import bisect
s=eval(input())
t=eval(input())
n=len(s)*2
dic={}
for idx,i in enumerate(s*2):
if i in list(dic.keys()):
dic[i].append(idx)
else:
dic[i]=[idx]
#print(dic)
ans=k=0
before='-1'
for i in t:
if i not in list(dic.keys()):
print((-1))
exit()
t=bisect.bisect_l... | import bisect
s=eval(input())
t=eval(input())
n=len(s)
dic={}
for idx,i in enumerate(s*2):
if i in list(dic.keys()):
dic[i].append(idx)
else:
dic[i]=[idx]
ans,p=0,-1
for i in t:
if i not in list(dic.keys()):
print((-1))
exit()
p=dic[i][bisect.bisect_left(dic[i], p+1)]
if ... | 31 | 24 | 429 | 341 | import bisect
s = eval(input())
t = eval(input())
n = len(s) * 2
dic = {}
for idx, i in enumerate(s * 2):
if i in list(dic.keys()):
dic[i].append(idx)
else:
dic[i] = [idx]
# print(dic)
ans = k = 0
before = "-1"
for i in t:
if i not in list(dic.keys()):
print((-1))
exit()
... | import bisect
s = eval(input())
t = eval(input())
n = len(s)
dic = {}
for idx, i in enumerate(s * 2):
if i in list(dic.keys()):
dic[i].append(idx)
else:
dic[i] = [idx]
ans, p = 0, -1
for i in t:
if i not in list(dic.keys()):
print((-1))
exit()
p = dic[i][bisect.bisect_le... | false | 22.580645 | [
"-n = len(s) * 2",
"+n = len(s)",
"-# print(dic)",
"-ans = k = 0",
"-before = \"-1\"",
"+ans, p = 0, -1",
"- t = bisect.bisect_left(dic[i], ans % n)",
"- if before == i:",
"- t += 1",
"- if len(dic[i]) == t:",
"- t = 0",
"- k += n",
"- ans = dic[i][t] + k",
... | false | 0.095708 | 0.039364 | 2.431372 | [
"s668513847",
"s078007368"
] |
u780475861 | p03503 | python | s254859400 | s217468379 | 382 | 119 | 3,064 | 3,064 | Accepted | Accepted | 68.85 | n = int(eval(input()))
flst = []
for _ in range(n):
flst.append([int(i) for i in input().split()])
plst = []
for _ in range(n):
plst.append([int(i) for i in input().split()])
m = - 1 << 30
for i in range(1, 1 << 10):
r = 0
for j in range(n):
c = 0
for k in range(10):
if (i >> k & 1) &... | n = int(eval(input()))
flst = []
for _ in range(n):
flst.append(int(''.join(input().split()), 2))
plst = []
for _ in range(n):
plst.append([int(i) for i in input().split()])
m = - 1 << 30
for i in range(1, 1 << 10):
r = 0
for j in range(n):
s = i & flst[j]
c = 0
while s:
s &= s... | 18 | 19 | 391 | 382 | n = int(eval(input()))
flst = []
for _ in range(n):
flst.append([int(i) for i in input().split()])
plst = []
for _ in range(n):
plst.append([int(i) for i in input().split()])
m = -1 << 30
for i in range(1, 1 << 10):
r = 0
for j in range(n):
c = 0
for k in range(10):
if (i >> ... | n = int(eval(input()))
flst = []
for _ in range(n):
flst.append(int("".join(input().split()), 2))
plst = []
for _ in range(n):
plst.append([int(i) for i in input().split()])
m = -1 << 30
for i in range(1, 1 << 10):
r = 0
for j in range(n):
s = i & flst[j]
c = 0
while s:
... | false | 5.263158 | [
"- flst.append([int(i) for i in input().split()])",
"+ flst.append(int(\"\".join(input().split()), 2))",
"+ s = i & flst[j]",
"- for k in range(10):",
"- if (i >> k & 1) & flst[j][k]:",
"- c += 1",
"+ while s:",
"+ s &= s - 1",
"+ ... | false | 0.045463 | 0.066466 | 0.68401 | [
"s254859400",
"s217468379"
] |
u581187895 | p03565 | python | s043680955 | s898875356 | 21 | 17 | 3,188 | 3,064 | Accepted | Accepted | 19.05 | import re
# 正解法 S=?b?? T=ab -> ans:abaa
def solve(s, t):
s = s.replace('?', '.')
ls, lt = len(s), len(t)
if ls < lt:
return 'UNRESTORABLE'
ans = []
for i in range(ls - lt + 1):
m = re.match(s[i:i + lt], t)
if m is None:
continue
ans.appen... | def is_word(i):
# T文字の長さを切り取り
sub_S = S[i:i+len(T)]
for s, t in zip(sub_S, T):
if s == "?":
continue
if s != t:
return False
return True
S = eval(input())
rep_S = S.replace("?", "a")
T = eval(input())
word_L = []
for i in range(len(S)-len(T)+1):
if is_word(i):
s = re... | 23 | 25 | 508 | 441 | import re
# 正解法 S=?b?? T=ab -> ans:abaa
def solve(s, t):
s = s.replace("?", ".")
ls, lt = len(s), len(t)
if ls < lt:
return "UNRESTORABLE"
ans = []
for i in range(ls - lt + 1):
m = re.match(s[i : i + lt], t)
if m is None:
continue
ans.append((s[:i] + t ... | def is_word(i):
# T文字の長さを切り取り
sub_S = S[i : i + len(T)]
for s, t in zip(sub_S, T):
if s == "?":
continue
if s != t:
return False
return True
S = eval(input())
rep_S = S.replace("?", "a")
T = eval(input())
word_L = []
for i in range(len(S) - len(T) + 1):
if i... | false | 8 | [
"-import re",
"-",
"-# 正解法 S=?b?? T=ab -> ans:abaa",
"-def solve(s, t):",
"- s = s.replace(\"?\", \".\")",
"- ls, lt = len(s), len(t)",
"- if ls < lt:",
"- return \"UNRESTORABLE\"",
"- ans = []",
"- for i in range(ls - lt + 1):",
"- m = re.match(s[i : i + lt], t)",... | false | 0.052259 | 0.048286 | 1.082281 | [
"s043680955",
"s898875356"
] |
u318233626 | p02713 | python | s007279715 | s510966168 | 1,832 | 1,285 | 9,192 | 84,864 | Accepted | Accepted | 29.86 | from math import gcd
k = int(eval(input()))
ans = 0
for h in range(1,k+1):
for i in range(1, k+1):
for j in range(1, k+1):
ans += gcd(h, gcd(i, j))
print(ans)
| from sys import setrecursionlimit
setrecursionlimit(1000000)
def Euclid_algorithm(a:int, b:int)->int:
if a < b:
a, b = b, a
else:
pass
if b == 0:
return a
else:
return Euclid_algorithm(b, a % b)
k = int(eval(input()))
ans = 0
for h in range(1, k+1):
... | 8 | 20 | 184 | 447 | from math import gcd
k = int(eval(input()))
ans = 0
for h in range(1, k + 1):
for i in range(1, k + 1):
for j in range(1, k + 1):
ans += gcd(h, gcd(i, j))
print(ans)
| from sys import setrecursionlimit
setrecursionlimit(1000000)
def Euclid_algorithm(a: int, b: int) -> int:
if a < b:
a, b = b, a
else:
pass
if b == 0:
return a
else:
return Euclid_algorithm(b, a % b)
k = int(eval(input()))
ans = 0
for h in range(1, k + 1):
for i i... | false | 60 | [
"-from math import gcd",
"+from sys import setrecursionlimit",
"+",
"+setrecursionlimit(1000000)",
"+",
"+",
"+def Euclid_algorithm(a: int, b: int) -> int:",
"+ if a < b:",
"+ a, b = b, a",
"+ else:",
"+ pass",
"+ if b == 0:",
"+ return a",
"+ else:",
"+ ... | false | 0.196544 | 0.03691 | 5.324958 | [
"s007279715",
"s510966168"
] |
u650022417 | p02390 | python | s822499428 | s119138685 | 20 | 10 | 5,656 | 4,644 | Accepted | Accepted | 50 | from math import modf
S = int(eval(input()))
decimal_min, h = modf(S/3600)
decimal_sec, m = modf(decimal_min * 60)
s = round(decimal_sec * 60)
print((str(int(h)) + ':' + str(int(m)) + ':' + str(s)))
| S =int(eval(input()))
h = int(S // 3600)
m = int(S % 3600 // 60)
s = int(S % 3600 % 60)
print((str(h) + ':' + str(m) + ':' + str(s)))
| 7 | 5 | 198 | 130 | from math import modf
S = int(eval(input()))
decimal_min, h = modf(S / 3600)
decimal_sec, m = modf(decimal_min * 60)
s = round(decimal_sec * 60)
print((str(int(h)) + ":" + str(int(m)) + ":" + str(s)))
| S = int(eval(input()))
h = int(S // 3600)
m = int(S % 3600 // 60)
s = int(S % 3600 % 60)
print((str(h) + ":" + str(m) + ":" + str(s)))
| false | 28.571429 | [
"-from math import modf",
"-",
"-decimal_min, h = modf(S / 3600)",
"-decimal_sec, m = modf(decimal_min * 60)",
"-s = round(decimal_sec * 60)",
"-print((str(int(h)) + \":\" + str(int(m)) + \":\" + str(s)))",
"+h = int(S // 3600)",
"+m = int(S % 3600 // 60)",
"+s = int(S % 3600 % 60)",
"+print((str(... | false | 0.042765 | 0.038102 | 1.122398 | [
"s822499428",
"s119138685"
] |
u437351386 | p03209 | python | s318321286 | s584009654 | 70 | 27 | 61,868 | 9,172 | Accepted | Accepted | 61.43 | #再帰の深さが1000を超えそうなときはこれをやっておく
import sys
sys.setrecursionlimit(10**7)
n,x=list(map(int,input().split()))
a=[0]*(n+1)
p=[0]*(n+1)
a[0]=1
p[0]=1
for i in range(n):
a[i+1]=2*a[i]+3
p[i+1]=2*p[i]+1
def func(i,x):
if i==0:
if x<=0:
return 0
elif x>=1:
return 1
mid=(a[i]+1)//... | n,x=list(map(int,input().split()))
#lレベルバーガーの下からx層に含まれるパティーの数
a=[1]*(n+1)
p=[1]*(n+1)
for i in range(1,n+1):
a[i]=a[i-1]*2+3
p[i]=p[i-1]*2+1
def count(l,x):
if l==0:
if x>=1:
return 1
else:
return 0
else:
if x==1:
return 0
elif x<a[l-1]+2:
return coun... | 29 | 29 | 461 | 498 | # 再帰の深さが1000を超えそうなときはこれをやっておく
import sys
sys.setrecursionlimit(10**7)
n, x = list(map(int, input().split()))
a = [0] * (n + 1)
p = [0] * (n + 1)
a[0] = 1
p[0] = 1
for i in range(n):
a[i + 1] = 2 * a[i] + 3
p[i + 1] = 2 * p[i] + 1
def func(i, x):
if i == 0:
if x <= 0:
return 0
... | n, x = list(map(int, input().split()))
# lレベルバーガーの下からx層に含まれるパティーの数
a = [1] * (n + 1)
p = [1] * (n + 1)
for i in range(1, n + 1):
a[i] = a[i - 1] * 2 + 3
p[i] = p[i - 1] * 2 + 1
def count(l, x):
if l == 0:
if x >= 1:
return 1
else:
return 0
else:
if x == ... | false | 0 | [
"-# 再帰の深さが1000を超えそうなときはこれをやっておく",
"-import sys",
"-",
"-sys.setrecursionlimit(10**7)",
"-a = [0] * (n + 1)",
"-p = [0] * (n + 1)",
"-a[0] = 1",
"-p[0] = 1",
"-for i in range(n):",
"- a[i + 1] = 2 * a[i] + 3",
"- p[i + 1] = 2 * p[i] + 1",
"+# lレベルバーガーの下からx層に含まれるパティーの数",
"+a = [1] * (n +... | false | 0.081511 | 0.111859 | 0.7287 | [
"s318321286",
"s584009654"
] |
u738898077 | p02596 | python | s218663616 | s568772078 | 667 | 123 | 63,176 | 63,284 | Accepted | Accepted | 81.56 | # def div(n):
# ans = []
# for i in range(1,int(n**(1/2)+2)):
# if n%i == 0:
# ans.append(i)
# ans.append(n//i)
# ans = set(ans)
# return ans
k = int(eval(input()))
# print(div(k))
a = 7
if k % 2 == 0:
print((-1))
exit()
for i in range(1,10**8+2):
... | # def div(n):
# ans = []
# for i in range(1,int(n**(1/2)+2)):
# if n%i == 0:
# ans.append(i)
# ans.append(n//i)
# ans = set(ans)
# return ans
k = int(eval(input()))
# print(div(k))
a = 7
for i in range(1,10**7+2):
if a%k == 0:
print(i)
... | 23 | 20 | 417 | 375 | # def div(n):
# ans = []
# for i in range(1,int(n**(1/2)+2)):
# if n%i == 0:
# ans.append(i)
# ans.append(n//i)
# ans = set(ans)
# return ans
k = int(eval(input()))
# print(div(k))
a = 7
if k % 2 == 0:
print((-1))
exit()
for i in range(1, 10**8 + 2):
if a % k ... | # def div(n):
# ans = []
# for i in range(1,int(n**(1/2)+2)):
# if n%i == 0:
# ans.append(i)
# ans.append(n//i)
# ans = set(ans)
# return ans
k = int(eval(input()))
# print(div(k))
a = 7
for i in range(1, 10**7 + 2):
if a % k == 0:
print(i)
exit()
... | false | 13.043478 | [
"-if k % 2 == 0:",
"- print((-1))",
"- exit()",
"-for i in range(1, 10**8 + 2):",
"+for i in range(1, 10**7 + 2):",
"- a = a % k",
"+ a %= k"
] | false | 0.100704 | 0.648915 | 0.155189 | [
"s218663616",
"s568772078"
] |
u645250356 | p03330 | python | s658066318 | s496966801 | 294 | 192 | 46,040 | 6,644 | Accepted | Accepted | 34.69 | from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
de... | from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
de... | 60 | 43 | 1,616 | 1,288 | from collections import Counter, defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpl_str():
return list(sys.stdin.... | from collections import Counter, defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpl_str():
return list(sys.stdin.... | false | 28.333333 | [
"+dd = [d0, d1, d2]",
"- if (x + y + 2) % 3 == 0:",
"- d0[c[x][y]] += 1",
"- elif (x + y + 2) % 3 == 1:",
"- d1[c[x][y]] += 1",
"- else:",
"- d2[c[x][y]] += 1",
"-# print(d0)",
"-# print(d1)",
"-# print(d2)",
"-res0 = []",
"-res1 = []",
"... | false | 0.038458 | 0.03818 | 1.007285 | [
"s658066318",
"s496966801"
] |
u585482323 | p03494 | python | s907495220 | s998085577 | 211 | 165 | 39,664 | 38,384 | Accepted | Accepted | 21.8 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in... | 98 | 44 | 1,634 | 998 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(... | false | 55.102041 | [
"-from collections import defaultdict",
"-from collections import deque",
"+from collections import defaultdict, deque",
"+from itertools import permutations",
"-import random",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return [int(x) for x in sys.stdin.readline().split()]",
"-... | false | 0.098031 | 0.038172 | 2.568107 | [
"s907495220",
"s998085577"
] |
u506858457 | p02629 | python | s071805740 | s915287265 | 67 | 28 | 61,992 | 9,192 | Accepted | Accepted | 58.21 | def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
ans=''
N=II()
N-=1
for l in range(1,15):
if N>=26**l:
N-=26**l
continue
for i in range(l):
d=N%26
ans+=chr(d+ord('a'))
N//=26
ans=ans[::-1]
bre... | def II(): return int(eval(input()))
N=II()
N-=1
i=1
while N>=(26**i):
N-=26**i
i+=1
ans=''
for j in range(i):
q,mod=divmod(N,26)
ans=ans+chr(mod+ord('a'))
N=q
ans=ans[::-1]
print(ans) | 17 | 14 | 323 | 200 | def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
ans = ""
N = II()
N -= 1
for l in range(1, 15):
if N >= 26**l:
N -= 26**l
continue
for i in range(l):
d = N % 26
ans += chr(d + ... | def II():
return int(eval(input()))
N = II()
N -= 1
i = 1
while N >= (26**i):
N -= 26**i
i += 1
ans = ""
for j in range(i):
q, mod = divmod(N, 26)
ans = ans + chr(mod + ord("a"))
N = q
ans = ans[::-1]
print(ans)
| false | 17.647059 | [
"-def MI():",
"- return list(map(int, input().split()))",
"-",
"-",
"-def LI():",
"- return list(map(int, input().split()))",
"-",
"-",
"-ans = \"\"",
"-for l in range(1, 15):",
"- if N >= 26**l:",
"- N -= 26**l",
"- continue",
"- for i in range(l):",
"- ... | false | 0.037869 | 0.040001 | 0.946687 | [
"s071805740",
"s915287265"
] |
u926678805 | p03947 | python | s508457974 | s803365767 | 33 | 19 | 3,188 | 3,188 | Accepted | Accepted | 42.42 | s=eval(input())
c=s[0]
ans=0
for cn in s:
if cn!=c:
c=cn
ans+=1
print(ans) | s=eval(input())
print((s.count('WB')+s.count('BW'))) | 8 | 2 | 95 | 45 | s = eval(input())
c = s[0]
ans = 0
for cn in s:
if cn != c:
c = cn
ans += 1
print(ans)
| s = eval(input())
print((s.count("WB") + s.count("BW")))
| false | 75 | [
"-c = s[0]",
"-ans = 0",
"-for cn in s:",
"- if cn != c:",
"- c = cn",
"- ans += 1",
"-print(ans)",
"+print((s.count(\"WB\") + s.count(\"BW\")))"
] | false | 0.044113 | 0.045512 | 0.969247 | [
"s508457974",
"s803365767"
] |
u761320129 | p03253 | python | s885473496 | s803672401 | 151 | 131 | 15,844 | 21,844 | Accepted | Accepted | 13.25 | N,M = list(map(int,input().split()))
MOD = 10**9+7
MAXN = N+200
fac = [1,1] + [0]*MAXN
finv = [1,1] + [0]*MAXN
inv = [0,1] + [0]*MAXN
for i in range(2,MAXN+2):
fac[i] = fac[i-1] * i % MOD
inv[i] = -inv[MOD%i] * (MOD // i) % MOD
finv[i] = finv[i-1] * inv[i] % MOD
def ncr(n,r):
if n < r: retu... | N,M = list(map(int,input().split()))
MOD = 10**9+7
MAXN = N+100
fac = [1,1] + [0]*MAXN
finv = [1,1] + [0]*MAXN
inv = [0,1] + [0]*MAXN
for i in range(2,MAXN+2):
fac[i] = fac[i-1] * i % MOD
inv[i] = -inv[MOD%i] * (MOD // i) % MOD
finv[i] = finv[i-1] * inv[i] % MOD
def comb(n,r):
if n < r: ret... | 38 | 36 | 808 | 762 | N, M = list(map(int, input().split()))
MOD = 10**9 + 7
MAXN = N + 200
fac = [1, 1] + [0] * MAXN
finv = [1, 1] + [0] * MAXN
inv = [0, 1] + [0] * MAXN
for i in range(2, MAXN + 2):
fac[i] = fac[i - 1] * i % MOD
inv[i] = -inv[MOD % i] * (MOD // i) % MOD
finv[i] = finv[i - 1] * inv[i] % MOD
def ncr(n, r):
... | N, M = list(map(int, input().split()))
MOD = 10**9 + 7
MAXN = N + 100
fac = [1, 1] + [0] * MAXN
finv = [1, 1] + [0] * MAXN
inv = [0, 1] + [0] * MAXN
for i in range(2, MAXN + 2):
fac[i] = fac[i - 1] * i % MOD
inv[i] = -inv[MOD % i] * (MOD // i) % MOD
finv[i] = finv[i - 1] * inv[i] % MOD
def comb(n, r):
... | false | 5.263158 | [
"-MAXN = N + 200",
"+MAXN = N + 100",
"-def ncr(n, r):",
"+def comb(n, r):",
"-",
"-",
"-def nhr(n, r):",
"- return ncr(n + r - 1, r)",
"-factors = factorize(M)",
"-for v in list(factors.values()):",
"- n = nhr(N, v)",
"- ans *= n",
"+f = factorize(M)",
"+for v in list(f.values())... | false | 0.066512 | 0.119553 | 0.556339 | [
"s885473496",
"s803672401"
] |
u174394352 | p03160 | python | s584861562 | s232235337 | 1,505 | 232 | 213,112 | 52,208 | Accepted | Accepted | 84.58 | def memoize(f):
cache={}
def helper(*args):
if args not in cache:
cache[args] = f(*args)
return cache[args]
return helper
N = int(eval(input()))
h = list(map(int,input().split()))
import sys
sys.setrecursionlimit(1000000)
@memoize
def f(n):
if n==1:
... | N = int(eval(input()))
h = list(map(int,input().split()))
d = [0]*N
for i in range(1,N):
if i==1:
d[i]=abs(h[1]-h[0])
elif i==2:
d[i]=abs(h[2]-h[0])
else:
d[i]=min(d[i-1]+abs(h[i]-h[i-1]),d[i-2]+abs(h[i]-h[i-2]))
print((d[N-1]))
| 26 | 14 | 518 | 273 | def memoize(f):
cache = {}
def helper(*args):
if args not in cache:
cache[args] = f(*args)
return cache[args]
return helper
N = int(eval(input()))
h = list(map(int, input().split()))
import sys
sys.setrecursionlimit(1000000)
@memoize
def f(n):
if n == 1:
return... | N = int(eval(input()))
h = list(map(int, input().split()))
d = [0] * N
for i in range(1, N):
if i == 1:
d[i] = abs(h[1] - h[0])
elif i == 2:
d[i] = abs(h[2] - h[0])
else:
d[i] = min(d[i - 1] + abs(h[i] - h[i - 1]), d[i - 2] + abs(h[i] - h[i - 2]))
print((d[N - 1]))
| false | 46.153846 | [
"-def memoize(f):",
"- cache = {}",
"-",
"- def helper(*args):",
"- if args not in cache:",
"- cache[args] = f(*args)",
"- return cache[args]",
"-",
"- return helper",
"-",
"-",
"-import sys",
"-",
"-sys.setrecursionlimit(1000000)",
"-",
"-",
"-@memo... | false | 0.039277 | 0.043789 | 0.896956 | [
"s584861562",
"s232235337"
] |
u789436713 | p02819 | python | s148083480 | s100018166 | 21 | 19 | 3,064 | 3,316 | Accepted | Accepted | 9.52 | from sys import stdin
input=stdin.readline
def isPrime(x):
for div in range(2, x // 2 + 1):
if x % div == 0:
return False
return True
X = int(eval(input()))
if isPrime(X):
print(X)
exit()
while (X < 10 ** 5):
X+=1
if isPrime(X):
print(X)
exit()
#100000より大きい素... | from sys import stdin
import math
input=stdin.readline
def isPrime(x):
if x % 2 == 0:
return False
for div in range(3, math.floor(x **(0.5)) + 1,2):
if x % div == 0:
return False
return True
X = int(eval(input()))
if X == 2:
print((2))
exit()
if X % 2 == 0:
X+=1
if ... | 25 | 31 | 338 | 419 | from sys import stdin
input = stdin.readline
def isPrime(x):
for div in range(2, x // 2 + 1):
if x % div == 0:
return False
return True
X = int(eval(input()))
if isPrime(X):
print(X)
exit()
while X < 10**5:
X += 1
if isPrime(X):
print(X)
exit()
# 100000より... | from sys import stdin
import math
input = stdin.readline
def isPrime(x):
if x % 2 == 0:
return False
for div in range(3, math.floor(x ** (0.5)) + 1, 2):
if x % div == 0:
return False
return True
X = int(eval(input()))
if X == 2:
print((2))
exit()
if X % 2 == 0:
X... | false | 19.354839 | [
"+import math",
"- for div in range(2, x // 2 + 1):",
"+ if x % 2 == 0:",
"+ return False",
"+ for div in range(3, math.floor(x ** (0.5)) + 1, 2):",
"+if X == 2:",
"+ print((2))",
"+ exit()",
"+if X % 2 == 0:",
"+ X += 1",
"-while X < 10**5:",
"- X += 1",
"+while ... | false | 0.04444 | 0.008617 | 5.157402 | [
"s148083480",
"s100018166"
] |
u418149936 | p02755 | python | s668687441 | s461417306 | 43 | 29 | 9,152 | 9,064 | Accepted | Accepted | 32.56 | A, B = list(map(int, input().split(' ')))
rst = -1
for i in range(1, 100000):
if i * 8 // 100 == A and i * 10 // 100 == B:
rst = i
break
print(rst) | A, B = list(map(int, input().split(' ')))
for i in range(1, 1500):
if i * 8 // 100 == A and i * 10 // 100 == B:
print(i)
break
else:
print((-1)) | 7 | 7 | 167 | 166 | A, B = list(map(int, input().split(" ")))
rst = -1
for i in range(1, 100000):
if i * 8 // 100 == A and i * 10 // 100 == B:
rst = i
break
print(rst)
| A, B = list(map(int, input().split(" ")))
for i in range(1, 1500):
if i * 8 // 100 == A and i * 10 // 100 == B:
print(i)
break
else:
print((-1))
| false | 0 | [
"-rst = -1",
"-for i in range(1, 100000):",
"+for i in range(1, 1500):",
"- rst = i",
"+ print(i)",
"-print(rst)",
"+else:",
"+ print((-1))"
] | false | 0.062922 | 0.045231 | 1.391115 | [
"s668687441",
"s461417306"
] |
u440566786 | p02859 | python | s788922824 | s113116410 | 190 | 164 | 38,464 | 38,256 | Accepted | Accepted | 13.68 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
r=int(eval(input()))
print((r*r))
resolve() | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
print((int(eval(input()))**2))
resolve() | 9 | 8 | 184 | 175 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
r = int(eval(input()))
print((r * r))
resolve()
| import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
print((int(eval(input())) ** 2))
resolve()
| false | 11.111111 | [
"- r = int(eval(input()))",
"- print((r * r))",
"+ print((int(eval(input())) ** 2))"
] | false | 0.039189 | 0.080682 | 0.485729 | [
"s788922824",
"s113116410"
] |
u707808519 | p02642 | python | s233568000 | s776533710 | 522 | 415 | 39,680 | 39,668 | Accepted | Accepted | 20.5 | n = int(eval(input()))
a = [int(i) for i in input().split()]
max_a = max(a)
flag = [True for i in range(max_a+1)]
dup = set()
for i in range(n):
if a[i] in dup:
flag[a[i]] = False
else:
dup.add(a[i])
for j in range(2*a[i], max_a+1, a[i]):
flag[j] = False
ans = 0
fo... | n = int(eval(input()))
a = [int(i) for i in input().split()]
max_a = max(a)
flag = [True for i in range(max_a+1)]
dup = set()
for i in range(n):
if a[i] in dup:
flag[a[i]] = False
else:
dup.add(a[i])
for j in range(2*a[i], max_a+1, a[i]):
flag[j] = False
ans... | 19 | 19 | 355 | 363 | n = int(eval(input()))
a = [int(i) for i in input().split()]
max_a = max(a)
flag = [True for i in range(max_a + 1)]
dup = set()
for i in range(n):
if a[i] in dup:
flag[a[i]] = False
else:
dup.add(a[i])
for j in range(2 * a[i], max_a + 1, a[i]):
flag[j] = False
ans = 0
for i in a:
... | n = int(eval(input()))
a = [int(i) for i in input().split()]
max_a = max(a)
flag = [True for i in range(max_a + 1)]
dup = set()
for i in range(n):
if a[i] in dup:
flag[a[i]] = False
else:
dup.add(a[i])
for j in range(2 * a[i], max_a + 1, a[i]):
flag[j] = False
ans = 0
for i i... | false | 0 | [
"- for j in range(2 * a[i], max_a + 1, a[i]):",
"- flag[j] = False",
"+ for j in range(2 * a[i], max_a + 1, a[i]):",
"+ flag[j] = False"
] | false | 0.038453 | 0.082811 | 0.464343 | [
"s233568000",
"s776533710"
] |
u498487134 | p02960 | python | s502764405 | s574769691 | 719 | 429 | 61,788 | 95,920 | Accepted | Accepted | 40.33 | S=eval(input())
N=len(S)
mod=13
mod2=10**9+7
#上からi桁目までみて,あまりがjになるものの個数
dp=[[0]*mod for _ in range(N+1)]
dp[0][0]=1
for i in range(N):
if S[i]!="?":
for j in range(mod):
dp[i+1][(10*j+int(S[i]))%mod]=dp[i][j]
else:
for j in range(mod):
for k in range(10)... |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
S=eval(input())
N=len(S)
dp=[[0]*13 for _ in range(N+1)]
dp[0][0]=1
for i in range(N):
s=S[i]
... | 20 | 35 | 394 | 766 | S = eval(input())
N = len(S)
mod = 13
mod2 = 10**9 + 7
# 上からi桁目までみて,あまりがjになるものの個数
dp = [[0] * mod for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
if S[i] != "?":
for j in range(mod):
dp[i + 1][(10 * j + int(S[i])) % mod] = dp[i][j]
else:
for j in range(mod):
for k ... | def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
S = eval(input())
N = len(S)
dp = [[0] * 13 for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
s = S[i]
... | false | 42.857143 | [
"-S = eval(input())",
"-N = len(S)",
"-mod = 13",
"-mod2 = 10**9 + 7",
"-# 上からi桁目までみて,あまりがjになるものの個数",
"-dp = [[0] * mod for _ in range(N + 1)]",
"-dp[0][0] = 1",
"-for i in range(N):",
"- if S[i] != \"?\":",
"- for j in range(mod):",
"- dp[i + 1][(10 * j + int(S[i])) % mod] ... | false | 0.039113 | 0.035727 | 1.094756 | [
"s502764405",
"s574769691"
] |
u844005364 | p03854 | python | s821859738 | s556495482 | 207 | 19 | 3,956 | 3,188 | Accepted | Accepted | 90.82 | def word_break(s, words):
ok = [True]
word_length = max(len(word) for word in words)
for i in range(1, len(s) + 1):
ok += any(ok[j] and s[j:i] in words for j in range(max(0, i - word_length), i)),
return ok[-1]
s = eval(input())
words = {"eraser", "erase", "dreamer", "dream"}
print((... | s = eval(input())
if s.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream",""):
print("NO")
else:
print("YES") | 11 | 5 | 353 | 143 | def word_break(s, words):
ok = [True]
word_length = max(len(word) for word in words)
for i in range(1, len(s) + 1):
ok += (
any(ok[j] and s[j:i] in words for j in range(max(0, i - word_length), i)),
)
return ok[-1]
s = eval(input())
words = {"eraser", "erase", "dreamer", "d... | s = eval(input())
if (
s.replace("eraser", "")
.replace("erase", "")
.replace("dreamer", "")
.replace("dream", "")
):
print("NO")
else:
print("YES")
| false | 54.545455 | [
"-def word_break(s, words):",
"- ok = [True]",
"- word_length = max(len(word) for word in words)",
"- for i in range(1, len(s) + 1):",
"- ok += (",
"- any(ok[j] and s[j:i] in words for j in range(max(0, i - word_length), i)),",
"- )",
"- return ok[-1]",
"-",
"-... | false | 0.036522 | 0.035728 | 1.022222 | [
"s821859738",
"s556495482"
] |
u225388820 | p02669 | python | s526325866 | s671154721 | 275 | 228 | 10,936 | 11,336 | Accepted | Accepted | 17.09 | def f(k):
if k==1:return d
if k==0:return 0
if k in m:return m[k]
s=min(k*d,f(k//2)+a+k%2*d,f((k+1)//2)+a+-k%2*d,f(k//3)+b+k%3*d,f((k+2)//3)+b+-k%3*d,f(k//5)+c+k%5*d,f((k+4)//5)+c+-k%5*d)
m[k]=s
return s
for _ in range(int(eval(input()))):
m={}
n,a,b,c,d=list(map(int,input().spl... | from functools import lru_cache
for _ in range(int(eval(input()))):
n,a,b,c,d=list(map(int,input().split()))
@lru_cache(None)
def f(k):
if k==0:return 0
if k==1:return d
return min(k*d,f(k//5)+c+k%5*d,f(k//3)+b+k%3*d,f(k//2)+a+k%2*d,f((k+4)//5)+c+-k%5*d,f((k+2)//3)+b+-k%3*d,f(... | 11 | 9 | 331 | 344 | def f(k):
if k == 1:
return d
if k == 0:
return 0
if k in m:
return m[k]
s = min(
k * d,
f(k // 2) + a + k % 2 * d,
f((k + 1) // 2) + a + -k % 2 * d,
f(k // 3) + b + k % 3 * d,
f((k + 2) // 3) + b + -k % 3 * d,
f(k // 5) + c + k % 5... | from functools import lru_cache
for _ in range(int(eval(input()))):
n, a, b, c, d = list(map(int, input().split()))
@lru_cache(None)
def f(k):
if k == 0:
return 0
if k == 1:
return d
return min(
k * d,
f(k // 5) + c + k % 5 * d,
... | false | 18.181818 | [
"-def f(k):",
"- if k == 1:",
"- return d",
"- if k == 0:",
"- return 0",
"- if k in m:",
"- return m[k]",
"- s = min(",
"- k * d,",
"- f(k // 2) + a + k % 2 * d,",
"- f((k + 1) // 2) + a + -k % 2 * d,",
"- f(k // 3) + b + k % 3 * d,... | false | 0.136031 | 0.156721 | 0.867984 | [
"s526325866",
"s671154721"
] |
u879921371 | p02623 | python | s460671808 | s509318973 | 705 | 568 | 53,688 | 58,560 | Accepted | Accepted | 19.43 | import numpy as np
def main():
n,m,k=list(map(int,input().split()))
a=np.array(list(map(int,input().split())))
b=np.array(list(map(int,input().split())))
a=np.cumsum(a)
b=np.cumsum(b)
k+=1
a0=np.searchsorted(a,k)
b0=np.searchsorted(b,k)
if a0>b0:
r=a0
else:
r=b0
for i in rang... | import numpy as np
def main():
n,m,k=list(map(int,input().split()))
a=list(map(int,input().split()))
b=np.array(list(map(int,input().split())))
b=np.cumsum(b)
k0=k+1
b0=np.searchsorted(b,k0)
r=b0
i=0
for i, ia in enumerate(a):
k0=k0-ia
if k0<=0:
break
b0=np.searchsort... | 22 | 21 | 426 | 383 | import numpy as np
def main():
n, m, k = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
b = np.array(list(map(int, input().split())))
a = np.cumsum(a)
b = np.cumsum(b)
k += 1
a0 = np.searchsorted(a, k)
b0 = np.searchsorted(b, k)
if a0 > b0:
r ... | import numpy as np
def main():
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = np.array(list(map(int, input().split())))
b = np.cumsum(b)
k0 = k + 1
b0 = np.searchsorted(b, k0)
r = b0
i = 0
for i, ia in enumerate(a):
k0 = k0 - ia
if... | false | 4.545455 | [
"- a = np.array(list(map(int, input().split())))",
"+ a = list(map(int, input().split()))",
"- a = np.cumsum(a)",
"- k += 1",
"- a0 = np.searchsorted(a, k)",
"- b0 = np.searchsorted(b, k)",
"- if a0 > b0:",
"- r = a0",
"- else:",
"- r = b0",
"- for i in r... | false | 0.492684 | 0.512333 | 0.961647 | [
"s460671808",
"s509318973"
] |
u102461423 | p02561 | python | s625905004 | s903624936 | 1,474 | 529 | 117,656 | 69,656 | Accepted | Accepted | 64.11 | import sys
import itertools
import numpy as np
import networkx as nx
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
S = np.frombuffer(read(), 'S1').reshape(N, -1)[:, :M].astype('U1')
G = nx.DiGraph()
G.ad... | import sys
import itertools
import numpy as np
import networkx as nx
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
S = np.frombuffer(read(), 'S1').reshape(N, -1)[:, :M].astype('U1')
A = []
B = []
E = []... | 47 | 52 | 1,403 | 1,191 | import sys
import itertools
import numpy as np
import networkx as nx
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
S = np.frombuffer(read(), "S1").reshape(N, -1)[:, :M].astype("U1")
G = nx.DiGraph()
G.add_nodes_from(["... | import sys
import itertools
import numpy as np
import networkx as nx
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
S = np.frombuffer(read(), "S1").reshape(N, -1)[:, :M].astype("U1")
A = []
B = []
E = []
for i, j in ite... | false | 9.615385 | [
"-G = nx.DiGraph()",
"-G.add_nodes_from([\"S\", \"T\"])",
"+A = []",
"+B = []",
"+E = []",
"- if (i + j) % 2 == 0:",
"- G.add_edge(\"S\", (i, j), capacity=1)",
"+ elif (i + j) & 1:",
"+ A.append((i, j))",
"- G.add_edge((i, j), \"T\", capacity=1)",
"- if (i + j) % 2 ... | false | 0.361561 | 0.203194 | 1.77939 | [
"s625905004",
"s903624936"
] |
u597374218 | p02947 | python | s992909593 | s675122597 | 522 | 477 | 21,988 | 24,652 | Accepted | Accepted | 8.62 | N=int(eval(input()))
dictionary={}
count=0
for i in range(N):
s=str(sorted(eval(input())))
if s in dictionary:
dictionary[s]+=1
count+=dictionary[s]
else:
dictionary[s]=0
print(count) | import collections
N=int(eval(input()))
s=[str(sorted(eval(input()))) for i in range(N)]
c=collections.Counter(s)
print((sum((v*(v-1))//2 for v in list(c.values())))) | 11 | 5 | 217 | 150 | N = int(eval(input()))
dictionary = {}
count = 0
for i in range(N):
s = str(sorted(eval(input())))
if s in dictionary:
dictionary[s] += 1
count += dictionary[s]
else:
dictionary[s] = 0
print(count)
| import collections
N = int(eval(input()))
s = [str(sorted(eval(input()))) for i in range(N)]
c = collections.Counter(s)
print((sum((v * (v - 1)) // 2 for v in list(c.values()))))
| false | 54.545455 | [
"+import collections",
"+",
"-dictionary = {}",
"-count = 0",
"-for i in range(N):",
"- s = str(sorted(eval(input())))",
"- if s in dictionary:",
"- dictionary[s] += 1",
"- count += dictionary[s]",
"- else:",
"- dictionary[s] = 0",
"-print(count)",
"+s = [str(so... | false | 0.037508 | 0.059597 | 0.629357 | [
"s992909593",
"s675122597"
] |
u685684561 | p02713 | python | s866111797 | s436594797 | 1,490 | 768 | 9,244 | 9,080 | Accepted | Accepted | 48.46 | K=int(eval(input()))
import sys
def gcd(a,b):
if b!=0:
return (gcd(b,a%b))
else:
return (a)
def GCD(a,b,c):
k=gcd(a,b)
return (gcd(k,c))
s=0
if K==198:
print((10493367))
sys.exit()
elif K==199:
print((10611772))
sys.exit()
else:
for i in range(... | K=int(eval(input()))
import sys
def gcd(a,b):
if b!=0:
return (gcd(b,a%b))
else:
return (a)
s=0
for i in range(1,K+1):
for j in range(i,K+1):
m=gcd(i,j)
for k in range(j,K+1):
if i==j and j==k:
s=s+gcd(m,k)
elif i==j a... | 33 | 23 | 680 | 481 | K = int(eval(input()))
import sys
def gcd(a, b):
if b != 0:
return gcd(b, a % b)
else:
return a
def GCD(a, b, c):
k = gcd(a, b)
return gcd(k, c)
s = 0
if K == 198:
print((10493367))
sys.exit()
elif K == 199:
print((10611772))
sys.exit()
else:
for i in range(1, K... | K = int(eval(input()))
import sys
def gcd(a, b):
if b != 0:
return gcd(b, a % b)
else:
return a
s = 0
for i in range(1, K + 1):
for j in range(i, K + 1):
m = gcd(i, j)
for k in range(j, K + 1):
if i == j and j == k:
s = s + gcd(m, k)
... | false | 30.30303 | [
"-def GCD(a, b, c):",
"- k = gcd(a, b)",
"- return gcd(k, c)",
"-",
"-",
"-if K == 198:",
"- print((10493367))",
"- sys.exit()",
"-elif K == 199:",
"- print((10611772))",
"- sys.exit()",
"-else:",
"- for i in range(1, K + 1):",
"- for j in range(i, K + 1):",
"... | false | 0.121013 | 0.074348 | 1.627666 | [
"s866111797",
"s436594797"
] |
u594244257 | p03835 | python | s800734139 | s058046283 | 1,683 | 902 | 2,940 | 3,060 | Accepted | Accepted | 46.41 | K,S = list(map(int, input().split()))
ret = 0
for A in range(S+1):
if A > K: continue
for B in range(S+1-A):
if B > K:continue
# print(A,B,S-A-B)
if S-A-B <= K:
# print(A,B,S-A-B)
ret += 1
print(ret) | K,S = list(map(int, input().split()))
# debug
# print([(A,B,S-A-B) for A in range(K+1) for B in range(K+1) if 0 <= S-A-B <= K])
print((sum(1 for A in range(K+1) for B in range(K+1) if 0 <= S-A-B <= K))) | 11 | 4 | 260 | 197 | K, S = list(map(int, input().split()))
ret = 0
for A in range(S + 1):
if A > K:
continue
for B in range(S + 1 - A):
if B > K:
continue
# print(A,B,S-A-B)
if S - A - B <= K:
# print(A,B,S-A-B)
ret += 1
print(ret)
| K, S = list(map(int, input().split()))
# debug
# print([(A,B,S-A-B) for A in range(K+1) for B in range(K+1) if 0 <= S-A-B <= K])
print((sum(1 for A in range(K + 1) for B in range(K + 1) if 0 <= S - A - B <= K)))
| false | 63.636364 | [
"-ret = 0",
"-for A in range(S + 1):",
"- if A > K:",
"- continue",
"- for B in range(S + 1 - A):",
"- if B > K:",
"- continue",
"- # print(A,B,S-A-B)",
"- if S - A - B <= K:",
"- # print(A,B,S-A-B)",
"- ret += 1",
"-print(ret)... | false | 0.06737 | 0.088503 | 0.761209 | [
"s800734139",
"s058046283"
] |
u729133443 | p03031 | python | s342006001 | s294320154 | 229 | 67 | 44,780 | 3,064 | Accepted | Accepted | 70.74 | n,m=list(map(int,input().split()))
s=eval('list(map(int,input().split()[1:])),'*m)
*p,=list(map(int,input().split()))
a=0
r=range
for i in r(1<<n):
c=[0]*m
for j in r(n):
for k in r(m):c[k]+=i>>j&1and j+1in s[k]
a+=all(j==i%2for i,j in zip(c,p))
print(a) | I=lambda:list(map(int,input().split()))
n,m=I()
s=eval('I(),'*m)
p=I()
a=0
r=range
for i in r(1<<n):
c=[0]*m
for j in r(n):
for k in r(m):c[k]+=i>>j&1and j+1in s[k][1:]
a+=all(j==i%2for i,j in zip(c,p))
print(a) | 11 | 12 | 257 | 227 | n, m = list(map(int, input().split()))
s = eval("list(map(int,input().split()[1:]))," * m)
(*p,) = list(map(int, input().split()))
a = 0
r = range
for i in r(1 << n):
c = [0] * m
for j in r(n):
for k in r(m):
c[k] += i >> j & 1 and j + 1 in s[k]
a += all(j == i % 2 for i, j in zip(c, p))... | I = lambda: list(map(int, input().split()))
n, m = I()
s = eval("I()," * m)
p = I()
a = 0
r = range
for i in r(1 << n):
c = [0] * m
for j in r(n):
for k in r(m):
c[k] += i >> j & 1 and j + 1 in s[k][1:]
a += all(j == i % 2 for i, j in zip(c, p))
print(a)
| false | 8.333333 | [
"-n, m = list(map(int, input().split()))",
"-s = eval(\"list(map(int,input().split()[1:])),\" * m)",
"-(*p,) = list(map(int, input().split()))",
"+I = lambda: list(map(int, input().split()))",
"+n, m = I()",
"+s = eval(\"I(),\" * m)",
"+p = I()",
"- c[k] += i >> j & 1 and j + 1 in s[k]",
... | false | 0.041707 | 0.176435 | 0.236387 | [
"s342006001",
"s294320154"
] |
u877470159 | p02973 | python | s641137708 | s504848351 | 760 | 298 | 47,832 | 45,532 | Accepted | Accepted | 60.79 | n=int(eval(input()))
tail=[int(eval(input()))]
import bisect
from collections import deque
tail=deque(tail)
c=1
for i in range(n-1):
a=int(eval(input()))
p=bisect.bisect_left(tail,a)
if p==0:
tail.appendleft(a)
c+=1
else:
tail[p-1]=a
print(c)
| import sys
input=sys.stdin.readline
n=int(eval(input()))
a_list=[int(eval(input())) for i in range(n)]
a_list.reverse()
INF=10**10
dp=[INF]*n
import bisect
for i in range(n):
a=a_list[i]
x=bisect.bisect_right(dp,a)
dp[x]=a
ans=0
for i in range(n):
if dp[i]!=INF:
ans=i+1
print(ans... | 15 | 17 | 279 | 310 | n = int(eval(input()))
tail = [int(eval(input()))]
import bisect
from collections import deque
tail = deque(tail)
c = 1
for i in range(n - 1):
a = int(eval(input()))
p = bisect.bisect_left(tail, a)
if p == 0:
tail.appendleft(a)
c += 1
else:
tail[p - 1] = a
print(c)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
a_list = [int(eval(input())) for i in range(n)]
a_list.reverse()
INF = 10**10
dp = [INF] * n
import bisect
for i in range(n):
a = a_list[i]
x = bisect.bisect_right(dp, a)
dp[x] = a
ans = 0
for i in range(n):
if dp[i] != INF:
ans = i ... | false | 11.764706 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-tail = [int(eval(input()))]",
"+a_list = [int(eval(input())) for i in range(n)]",
"+a_list.reverse()",
"+INF = 10**10",
"+dp = [INF] * n",
"-from collections import deque",
"-tail = deque(tail)",
"-c = 1",
"-for i in range(n - 1):",
"- ... | false | 0.037166 | 0.037946 | 0.979431 | [
"s641137708",
"s504848351"
] |
u002459665 | p03339 | python | s072134914 | s707348840 | 418 | 252 | 48,628 | 15,392 | Accepted | Accepted | 39.71 | N = int(eval(input()))
S = eval(input())
A = []
w = 0
for si in S:
if si == 'W':
w += 1
A.append([w])
# E = []
e = 0
for i, si in enumerate(S[::-1]):
if si == 'E':
e += 1
# E.append(e)
A[-1 * i - 1].append(e)
# E = E[::-1]
# for i in range(N):
# A[i][1] = E... | N = int(eval(input()))
S = eval(input())
ans = N
A = []
w = 0
for si in S:
if si == 'W':
w += 1
A.append(w)
e = 0
for i, si in enumerate(S[::-1]):
if si == 'E':
e += 1
ans = min(ans, A[-1 * i - 1] + e - 1)
print(ans) | 26 | 18 | 387 | 256 | N = int(eval(input()))
S = eval(input())
A = []
w = 0
for si in S:
if si == "W":
w += 1
A.append([w])
# E = []
e = 0
for i, si in enumerate(S[::-1]):
if si == "E":
e += 1
# E.append(e)
A[-1 * i - 1].append(e)
# E = E[::-1]
# for i in range(N):
# A[i][1] = E[i]
ans = N
for ai in A... | N = int(eval(input()))
S = eval(input())
ans = N
A = []
w = 0
for si in S:
if si == "W":
w += 1
A.append(w)
e = 0
for i, si in enumerate(S[::-1]):
if si == "E":
e += 1
ans = min(ans, A[-1 * i - 1] + e - 1)
print(ans)
| false | 30.769231 | [
"+ans = N",
"- A.append([w])",
"-# E = []",
"+ A.append(w)",
"- # E.append(e)",
"- A[-1 * i - 1].append(e)",
"-# E = E[::-1]",
"-# for i in range(N):",
"-# A[i][1] = E[i]",
"-ans = N",
"-for ai in A:",
"- ans = min(ans, ai[0] + ai[1] - 1)",
"+ ans = min(ans, A[-1 * i - ... | false | 0.046551 | 0.046805 | 0.99458 | [
"s072134914",
"s707348840"
] |
u653485478 | p03285 | python | s292731592 | s739183435 | 20 | 18 | 3,060 | 2,940 | Accepted | Accepted | 10 | n = int(eval(input()))
string = "No"
for i in range(1, n+1):
for j in range(1, n+1):
if n % (4 * i + 7 * j) == 0:
string = "Yes"
break
elif n % (4 * i) == 0:
string = "Yes"
break
elif n % (7 * j) == 0:
... | n = int(eval(input()))
string = "No"
for i in range(n+1):
for j in range(n+1):
if n == 4*i + 7*j :
string = "Yes"
break
print(string) | 15 | 9 | 385 | 188 | n = int(eval(input()))
string = "No"
for i in range(1, n + 1):
for j in range(1, n + 1):
if n % (4 * i + 7 * j) == 0:
string = "Yes"
break
elif n % (4 * i) == 0:
string = "Yes"
break
elif n % (7 * j) == 0:
string = "Yes"
... | n = int(eval(input()))
string = "No"
for i in range(n + 1):
for j in range(n + 1):
if n == 4 * i + 7 * j:
string = "Yes"
break
print(string)
| false | 40 | [
"-for i in range(1, n + 1):",
"- for j in range(1, n + 1):",
"- if n % (4 * i + 7 * j) == 0:",
"- string = \"Yes\"",
"- break",
"- elif n % (4 * i) == 0:",
"- string = \"Yes\"",
"- break",
"- elif n % (7 * j) == 0:",
"+for i in ra... | false | 0.044189 | 0.034771 | 1.270883 | [
"s292731592",
"s739183435"
] |
u075012704 | p03142 | python | s640397717 | s850836801 | 1,326 | 1,127 | 117,040 | 90,800 | Accepted | Accepted | 15.01 | import sys
sys.setrecursionlimit(10 ** 9)
N, M = list(map(int, input().split()))
G = [[] for i in range(N)]
G_rev = [set() for i in range(N)]
for i in range(N - 1 + M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
G[a].append(b)
# 親と子を逆に
G_rev[b].add(a)
def topological... | import sys
sys.setrecursionlimit(10 ** 9)
N, M = list(map(int, input().split()))
G = [[] for i in range(N)]
for i in range(N - 1 + M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
G[a].append(b)
def topological_sort(g):
topological_list = []
visited = set()
def d... | 53 | 50 | 1,099 | 1,064 | import sys
sys.setrecursionlimit(10**9)
N, M = list(map(int, input().split()))
G = [[] for i in range(N)]
G_rev = [set() for i in range(N)]
for i in range(N - 1 + M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
G[a].append(b)
# 親と子を逆に
G_rev[b].add(a)
def topological_sort(g):
to... | import sys
sys.setrecursionlimit(10**9)
N, M = list(map(int, input().split()))
G = [[] for i in range(N)]
for i in range(N - 1 + M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
G[a].append(b)
def topological_sort(g):
topological_list = []
visited = set()
def dfs(n):
fo... | false | 5.660377 | [
"-G_rev = [set() for i in range(N)]",
"- # 親と子を逆に",
"- G_rev[b].add(a)",
"-parents = [set(G_rev[i]) for i in range(N)]",
"-for t in topological_order[::-1]:",
"- for p in G_rev[t]:",
"- parents[t] |= parents[p]",
"-ans = [-1] * N",
"-for t in topological_order:",
"- for child in... | false | 0.037453 | 0.007998 | 4.682655 | [
"s640397717",
"s850836801"
] |
u504836877 | p02885 | python | s002767401 | s497308544 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | A,B = list(map(int, input().split()))
print((max(0, A-2*B))) | A,B = list(map(int, input().split()))
if A <= 2*B:
print((0))
else:
print((A-2*B)) | 3 | 6 | 55 | 86 | A, B = list(map(int, input().split()))
print((max(0, A - 2 * B)))
| A, B = list(map(int, input().split()))
if A <= 2 * B:
print((0))
else:
print((A - 2 * B))
| false | 50 | [
"-print((max(0, A - 2 * B)))",
"+if A <= 2 * B:",
"+ print((0))",
"+else:",
"+ print((A - 2 * B))"
] | false | 0.045665 | 0.043903 | 1.040153 | [
"s002767401",
"s497308544"
] |
u347640436 | p02862 | python | s452420706 | s133282084 | 272 | 217 | 29,300 | 35,260 | Accepted | Accepted | 20.22 | p = 1000000007
X, Y = list(map(int, input().split()))
if (X + Y) % 3 != 0:
print((0))
exit()
a = (2 * Y - X) // 3
b = (2 * X - Y) // 3
if a < 0 or b < 0:
print((0))
exit()
n = a + b
fac = [0] * (n + 1)
fac[0] = 1
for i in range(n):
fac[i + 1] = fac[i] * (i + 1) % p
def m... | # フェルマーの小定理
X, Y = list(map(int, input().split()))
m = 1000000007
if (X + Y) % 3 != 0:
print((0))
exit()
a = (2 * Y - X) // 3
b = (2 * X - Y) // 3
if a < 0 or b < 0:
print((0))
exit()
n = a + b
fac = [0] * (n + 1)
fac[0] = 1
for i in range(n):
fac[i + 1] = fac[i] * (i + 1) %... | 31 | 32 | 508 | 521 | p = 1000000007
X, Y = list(map(int, input().split()))
if (X + Y) % 3 != 0:
print((0))
exit()
a = (2 * Y - X) // 3
b = (2 * X - Y) // 3
if a < 0 or b < 0:
print((0))
exit()
n = a + b
fac = [0] * (n + 1)
fac[0] = 1
for i in range(n):
fac[i + 1] = fac[i] * (i + 1) % p
def mcomb(n, k):
if n == 0 a... | # フェルマーの小定理
X, Y = list(map(int, input().split()))
m = 1000000007
if (X + Y) % 3 != 0:
print((0))
exit()
a = (2 * Y - X) // 3
b = (2 * X - Y) // 3
if a < 0 or b < 0:
print((0))
exit()
n = a + b
fac = [0] * (n + 1)
fac[0] = 1
for i in range(n):
fac[i + 1] = fac[i] * (i + 1) % m
def mcomb(n, k):
... | false | 3.125 | [
"-p = 1000000007",
"+# フェルマーの小定理",
"+m = 1000000007",
"- fac[i + 1] = fac[i] * (i + 1) % p",
"+ fac[i + 1] = fac[i] * (i + 1) % m",
"- return fac[n] * pow(fac[n - k], p - 2, p) * pow(fac[k], p - 2, p) % p",
"+ return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m"
] | false | 0.165931 | 0.180234 | 0.920641 | [
"s452420706",
"s133282084"
] |
u330799501 | p03803 | python | s947421812 | s339459102 | 27 | 24 | 9,108 | 9,068 | Accepted | Accepted | 11.11 | #k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
a, b = list(map(int, input().split()))
if a == 1:
a = 14
if b == 1:
b = 14
if a > b:
print("Alice"... | #k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
a, b = list(map(int, input().split()))
if (a == 1):
a = 14
if (b == 1):
b = 14
if (a > b):
print("... | 21 | 21 | 376 | 383 | # k = int(input())
# s = input()
# a, b = map(int, input().split())
# s, t = map(str, input().split())
# l = list(map(int, input().split()))
# l = [list(map(int,input().split())) for i in range(n)]
a, b = list(map(int, input().split()))
if a == 1:
a = 14
if b == 1:
b = 14
if a > b:
print("Alice")
elif a == ... | # k = int(input())
# s = input()
# a, b = map(int, input().split())
# s, t = map(str, input().split())
# l = list(map(int, input().split()))
# l = [list(map(int,input().split())) for i in range(n)]
a, b = list(map(int, input().split()))
if a == 1:
a = 14
if b == 1:
b = 14
if a > b:
print("Alice")
elif a < b... | false | 0 | [
"-elif a == b:",
"+elif a < b:",
"+ print(\"Bob\")",
"+else:",
"-else:",
"- print(\"Bob\")"
] | false | 0.150897 | 0.044144 | 3.41826 | [
"s947421812",
"s339459102"
] |
u744920373 | p02743 | python | s272743421 | s204620768 | 89 | 19 | 5,076 | 3,060 | Accepted | Accepted | 78.65 | from decimal import *
getcontext().prec = 7000
#import numpy as np
a, b, c = list(map(float, input().split()))
##print(a**0.5, b**0.5, c**0.5)
if Decimal(a).sqrt()+ Decimal(b).sqrt() < Decimal(c).sqrt():
print('Yes')
else:
print('No') | a, b, c = list(map(int, input().split()))
if c < (a+b):
print('No')
elif 4*a*b < (c-a-b)**2:
print('Yes')
else:
print('No') | 11 | 8 | 248 | 137 | from decimal import *
getcontext().prec = 7000
# import numpy as np
a, b, c = list(map(float, input().split()))
##print(a**0.5, b**0.5, c**0.5)
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if c < (a + b):
print("No")
elif 4 * a * b < (c - a - b) ** 2:
print("Yes")
else:
print("No")
| false | 27.272727 | [
"-from decimal import *",
"-",
"-getcontext().prec = 7000",
"-# import numpy as np",
"-a, b, c = list(map(float, input().split()))",
"-##print(a**0.5, b**0.5, c**0.5)",
"-if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():",
"+a, b, c = list(map(int, input().split()))",
"+if c < (a + b):",... | false | 0.235341 | 0.037134 | 6.337618 | [
"s272743421",
"s204620768"
] |
u581187895 | p03339 | python | s455415611 | s361944234 | 404 | 129 | 27,036 | 3,676 | Accepted | Accepted | 68.07 | N = int(eval(input()))
S = eval(input())
E = [0]*(N)
W = [0]*(N)
# 反対方向の人を数え上げ
for i in range(N):
if S[i] == "E":
E[i] = 1
else:
W[i] = 1
# リーダーより前を累積和していく
for i in range(1, N):
W[i] += W[i-1]
E[i] += E[i-1]
ans = float("inf")
for i in range(N):
sm = 0
if 0 < i:
s... | N = int(eval(input()))
S = eval(input())
pos = 0
minpos = 0
mini = 0
for i in range(N):
if S[i] == "W":
pos += 1
else:
pos -= 1
if pos < minpos:
minpos = pos
mini = i
s1 = S[0:mini].count("W")
s2 = S[mini+1:N].count("E")
print((s1+s2)) | 27 | 19 | 386 | 264 | N = int(eval(input()))
S = eval(input())
E = [0] * (N)
W = [0] * (N)
# 反対方向の人を数え上げ
for i in range(N):
if S[i] == "E":
E[i] = 1
else:
W[i] = 1
# リーダーより前を累積和していく
for i in range(1, N):
W[i] += W[i - 1]
E[i] += E[i - 1]
ans = float("inf")
for i in range(N):
sm = 0
if 0 < i:
s... | N = int(eval(input()))
S = eval(input())
pos = 0
minpos = 0
mini = 0
for i in range(N):
if S[i] == "W":
pos += 1
else:
pos -= 1
if pos < minpos:
minpos = pos
mini = i
s1 = S[0:mini].count("W")
s2 = S[mini + 1 : N].count("E")
print((s1 + s2))
| false | 29.62963 | [
"-E = [0] * (N)",
"-W = [0] * (N)",
"-# 反対方向の人を数え上げ",
"+pos = 0",
"+minpos = 0",
"+mini = 0",
"- if S[i] == \"E\":",
"- E[i] = 1",
"+ if S[i] == \"W\":",
"+ pos += 1",
"- W[i] = 1",
"-# リーダーより前を累積和していく",
"-for i in range(1, N):",
"- W[i] += W[i - 1]",
"- ... | false | 0.04296 | 0.043421 | 0.989383 | [
"s455415611",
"s361944234"
] |
u133936772 | p02714 | python | s954027099 | s059211628 | 756 | 254 | 9,184 | 68,248 | Accepted | Accepted | 66.4 | n,s=open(0);n=int(n);c=s.count;print((c('R')*c('G')*c('B')-sum(s[i]!=s[j]!=s[i+j>>1]!=s[i]for i in range(n)for j in range(i+2,n,2)))) | n,s=open(0);n=int(n);c=s.count;print((c('R')*c('G')*c('B')-sum(s[i]!=s[i+j>>1]!=s[j]!=s[i]for i in range(n)for j in range(i+2,n,2)))) | 1 | 1 | 131 | 131 | n, s = open(0)
n = int(n)
c = s.count
print(
(
c("R") * c("G") * c("B")
- sum(
s[i] != s[j] != s[i + j >> 1] != s[i]
for i in range(n)
for j in range(i + 2, n, 2)
)
)
)
| n, s = open(0)
n = int(n)
c = s.count
print(
(
c("R") * c("G") * c("B")
- sum(
s[i] != s[i + j >> 1] != s[j] != s[i]
for i in range(n)
for j in range(i + 2, n, 2)
)
)
)
| false | 0 | [
"- s[i] != s[j] != s[i + j >> 1] != s[i]",
"+ s[i] != s[i + j >> 1] != s[j] != s[i]"
] | false | 0.037439 | 0.04506 | 0.830865 | [
"s954027099",
"s059211628"
] |
u923279197 | p02925 | python | s060491698 | s581200238 | 2,000 | 505 | 59,736 | 64,220 | Accepted | Accepted | 74.75 | import time
start = time.time()
n = int(eval(input()))
a = [list(map(int,input().split())) for _ in range(n)]
s = [0 for i in range(n)] #それぞれ何試合目か
ans = 0
need = n*(n-1)//2
while need:
c = [0 for i in range(n)] #今日試合をするかどうか
ans += 1
for first in range(n):
if c[first] == 0 and s[first] < n... | from collections import deque
n = int(eval(input()))
a = [list([int(x)-1 for x in input().split()]) + [-1] for _ in range(n)]
l,day = [0]*n,[0]*n
que = deque([i for i in range(n)])
while que:
u = que.popleft()
v = a[u][l[u]]
if a[v][l[v]] == u:
day[u] = max(day[u],day[v]) + 1
... | 28 | 25 | 808 | 497 | import time
start = time.time()
n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
s = [0 for i in range(n)] # それぞれ何試合目か
ans = 0
need = n * (n - 1) // 2
while need:
c = [0 for i in range(n)] # 今日試合をするかどうか
ans += 1
for first in range(n):
if c[first] == 0 and s[first] < ... | from collections import deque
n = int(eval(input()))
a = [list([int(x) - 1 for x in input().split()]) + [-1] for _ in range(n)]
l, day = [0] * n, [0] * n
que = deque([i for i in range(n)])
while que:
u = que.popleft()
v = a[u][l[u]]
if a[v][l[v]] == u:
day[u] = max(day[u], day[v]) + 1
day[v... | false | 10.714286 | [
"-import time",
"+from collections import deque",
"-start = time.time()",
"-a = [list(map(int, input().split())) for _ in range(n)]",
"-s = [0 for i in range(n)] # それぞれ何試合目か",
"-ans = 0",
"-need = n * (n - 1) // 2",
"-while need:",
"- c = [0 for i in range(n)] # 今日試合をするかどうか",
"- ans += 1",... | false | 0.035671 | 0.03364 | 1.060374 | [
"s060491698",
"s581200238"
] |
u076917070 | p03231 | python | s274501094 | s342209049 | 60 | 36 | 5,460 | 5,344 | Accepted | Accepted | 40 | import sys
input=sys.stdin.readline
import bisect
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
def main():
N,M = list(map(int,input().split()))
S = input().strip()
T = input().strip()
m = lcm(N,M)
for i in range(M):
si = i*m//M
ti = i*m//... | import sys
input=sys.stdin.readline
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
def main():
N,M = list(map(int,input().split()))
S = input().strip()
T = input().strip()
L = lcm(N,M)
for i in range(fractions.gcd(N,M)):
if S[i*L//M] != T[i*L//N]:
... | 23 | 20 | 467 | 413 | import sys
input = sys.stdin.readline
import bisect
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
def main():
N, M = list(map(int, input().split()))
S = input().strip()
T = input().strip()
m = lcm(N, M)
for i in range(M):
si = i * m // M
ti = i * m //... | import sys
input = sys.stdin.readline
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
def main():
N, M = list(map(int, input().split()))
S = input().strip()
T = input().strip()
L = lcm(N, M)
for i in range(fractions.gcd(N, M)):
if S[i * L // M] != T[i * L // N]... | false | 13.043478 | [
"-import bisect",
"- m = lcm(N, M)",
"- for i in range(M):",
"- si = i * m // M",
"- ti = i * m // N",
"- if si < N and ti < M and S[si] != T[ti]:",
"+ L = lcm(N, M)",
"+ for i in range(fractions.gcd(N, M)):",
"+ if S[i * L // M] != T[i * L // N]:",
"- pr... | false | 0.102224 | 0.056907 | 1.796325 | [
"s274501094",
"s342209049"
] |
u072717685 | p03730 | python | s574482499 | s089246790 | 66 | 25 | 61,896 | 9,160 | Accepted | Accepted | 62.12 | import sys
read = sys.stdin.read
from math import gcd
def main():
a, b, c = list(map(int, input().split()))
gac = gcd(a, -b)
if c % gac == 0:
print('YES')
else:
print('NO')
if __name__ == '__main__':
main()
| import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
a, b, c = list(map(int, input().split()))
num = 2
rem = a % b
if rem == c:
print('YES')
sys.exit()
while True:
rem_t = (a * num) % b
if rem_t == c:
print('YES')
... | 13 | 23 | 250 | 471 | import sys
read = sys.stdin.read
from math import gcd
def main():
a, b, c = list(map(int, input().split()))
gac = gcd(a, -b)
if c % gac == 0:
print("YES")
else:
print("NO")
if __name__ == "__main__":
main()
| import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
a, b, c = list(map(int, input().split()))
num = 2
rem = a % b
if rem == c:
print("YES")
sys.exit()
while True:
rem_t = (a * num) % b
if rem_t == c:
print("YES")
sys... | false | 43.478261 | [
"-from math import gcd",
"+readlines = sys.stdin.readlines",
"- gac = gcd(a, -b)",
"- if c % gac == 0:",
"+ num = 2",
"+ rem = a % b",
"+ if rem == c:",
"- else:",
"- print(\"NO\")",
"+ sys.exit()",
"+ while True:",
"+ rem_t = (a * num) % b",
"+ ... | false | 0.045388 | 0.037396 | 1.213707 | [
"s574482499",
"s089246790"
] |
u391875425 | p03112 | python | s228610644 | s439064398 | 1,256 | 1,050 | 78,808 | 16,128 | Accepted | Accepted | 16.4 | import bisect
import sys
A, B, Q = list(map(int, input().split()))
INF = 10 ** 13
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
for q in range(Q):
x = int(sys.stdin.readline())
b, d = bisect.bisect_right(s, x), bisect.bisect_right... | import bisect
import sys
A, B, Q = list(map(int, input().split()))
INF = 10 ** 13
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
xs = [int(sys.stdin.readline()) for i in range(Q)]
for x in xs:
b, d = bisect.bisect_right(s, x), bisect.b... | 15 | 15 | 515 | 525 | import bisect
import sys
A, B, Q = list(map(int, input().split()))
INF = 10**13
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
for q in range(Q):
x = int(sys.stdin.readline())
b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
... | import bisect
import sys
A, B, Q = list(map(int, input().split()))
INF = 10**13
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
xs = [int(sys.stdin.readline()) for i in range(Q)]
for x in xs:
b, d = bisect.bisect_right(s, x), bisect.bisect_rig... | false | 0 | [
"-for q in range(Q):",
"- x = int(sys.stdin.readline())",
"+xs = [int(sys.stdin.readline()) for i in range(Q)]",
"+for x in xs:"
] | false | 0.040639 | 0.039801 | 1.021046 | [
"s228610644",
"s439064398"
] |
u123756661 | p03212 | python | s280635884 | s616018848 | 421 | 179 | 49,884 | 38,384 | Accepted | Accepted | 57.48 | t=["0","3","5","7"]
s=["3","5","7"]
n=int(eval(input()))
ans=chk=0
for a in t:
for b in t:
for c in t:
for d in t:
for e in t:
for f in t:
for g in s:
for h in s:
f... | def f(a,b):
#a=7,5,3 b=0-7
#no=0, 3=1, 5=2, 7=4, all=7
if a==7 and b>=4: return b
if a==7 and b<4: return b+4
if a==5 and b in (2,3,6,7): return b
if a==5 and b not in (2,3,6,7): return b+2
if a==3 and b in (1,3,5,7): return b
if a==3 and b not in (1,3,5,7): return b+1
n=eval(input()... | 18 | 50 | 591 | 1,543 | t = ["0", "3", "5", "7"]
s = ["3", "5", "7"]
n = int(eval(input()))
ans = chk = 0
for a in t:
for b in t:
for c in t:
for d in t:
for e in t:
for f in t:
for g in s:
for h in s:
... | def f(a, b):
# a=7,5,3 b=0-7
# no=0, 3=1, 5=2, 7=4, all=7
if a == 7 and b >= 4:
return b
if a == 7 and b < 4:
return b + 4
if a == 5 and b in (2, 3, 6, 7):
return b
if a == 5 and b not in (2, 3, 6, 7):
return b + 2
if a == 3 and b in (1, 3, 5, 7):
ret... | false | 64 | [
"-t = [\"0\", \"3\", \"5\", \"7\"]",
"-s = [\"3\", \"5\", \"7\"]",
"-n = int(eval(input()))",
"-ans = chk = 0",
"-for a in t:",
"- for b in t:",
"- for c in t:",
"- for d in t:",
"- for e in t:",
"- for f in t:",
"- fo... | false | 0.486111 | 0.035252 | 13.789511 | [
"s280635884",
"s616018848"
] |
u332385682 | p03745 | python | s737292177 | s108088497 | 79 | 67 | 14,484 | 14,224 | Accepted | Accepted | 15.19 | import sys
def solve():
n = int(input())
A = [int(i) for i in input().split()]
flag = 0
l = 0
r = 0
cnt = 0
while r < n - 1:
if A[r] == A[r + 1]:
r += 1
elif A[r] < A[r + 1]:
if flag == 2:
cnt += 1
fl... | import sys
def solve():
n = int(eval(input()))
a = [int(i) for i in input().split()]
ans = 0
mode = 0
for i in range(1, n):
if a[i] > a[i - 1]:
if mode == -1:
ans += 1
mode = 0
else:
mode = 1
... | 45 | 32 | 915 | 571 | import sys
def solve():
n = int(input())
A = [int(i) for i in input().split()]
flag = 0
l = 0
r = 0
cnt = 0
while r < n - 1:
if A[r] == A[r + 1]:
r += 1
elif A[r] < A[r + 1]:
if flag == 2:
cnt += 1
flag = 0
... | import sys
def solve():
n = int(eval(input()))
a = [int(i) for i in input().split()]
ans = 0
mode = 0
for i in range(1, n):
if a[i] > a[i - 1]:
if mode == -1:
ans += 1
mode = 0
else:
mode = 1
elif a[i] < a[i - ... | false | 28.888889 | [
"- n = int(input())",
"- A = [int(i) for i in input().split()]",
"- flag = 0",
"- l = 0",
"- r = 0",
"- cnt = 0",
"- while r < n - 1:",
"- if A[r] == A[r + 1]:",
"- r += 1",
"- elif A[r] < A[r + 1]:",
"- if flag == 2:",
"- ... | false | 0.039091 | 0.039312 | 0.994385 | [
"s737292177",
"s108088497"
] |
u133936772 | p03693 | python | s466185894 | s088016911 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | print(('YNEOS'[int(input().replace(' ',''))%4>0::2])) | print(('YNEOS'[int(input()[::2])%4>0::2])) | 1 | 1 | 51 | 40 | print(("YNEOS"[int(input().replace(" ", "")) % 4 > 0 :: 2]))
| print(("YNEOS"[int(input()[::2]) % 4 > 0 :: 2]))
| false | 0 | [
"-print((\"YNEOS\"[int(input().replace(\" \", \"\")) % 4 > 0 :: 2]))",
"+print((\"YNEOS\"[int(input()[::2]) % 4 > 0 :: 2]))"
] | false | 0.044237 | 0.048618 | 0.909887 | [
"s466185894",
"s088016911"
] |
u813450984 | p03645 | python | s211997517 | s486163814 | 1,038 | 717 | 65,088 | 30,136 | Accepted | Accepted | 30.92 | n, m = list(map(int, input().split()))
ship = []
flag = False
for i in range(n):
ship.append([])
for i in range(m):
temp = list(map(int, input().split()))
ship[temp[0]-1].append(temp)
for i in range(len(ship[0])):
now = ship[0][i]
if [now[1], n] in ship[now[1]-1]:
flag = True
break
... | n, m = list(map(int, input().split()))
l = []
for i in range(200001):
l.append([])
for i in range(m):
a, b = list(map(int, input().split()))
l[a].append(b)
def f():
for i in l[1]:
if n in l[i]:
return 'POSSIBLE'
return 'IMPOSSIBLE'
print((f())) | 20 | 15 | 373 | 268 | n, m = list(map(int, input().split()))
ship = []
flag = False
for i in range(n):
ship.append([])
for i in range(m):
temp = list(map(int, input().split()))
ship[temp[0] - 1].append(temp)
for i in range(len(ship[0])):
now = ship[0][i]
if [now[1], n] in ship[now[1] - 1]:
flag = True
bre... | n, m = list(map(int, input().split()))
l = []
for i in range(200001):
l.append([])
for i in range(m):
a, b = list(map(int, input().split()))
l[a].append(b)
def f():
for i in l[1]:
if n in l[i]:
return "POSSIBLE"
return "IMPOSSIBLE"
print((f()))
| false | 25 | [
"-ship = []",
"-flag = False",
"-for i in range(n):",
"- ship.append([])",
"+l = []",
"+for i in range(200001):",
"+ l.append([])",
"- temp = list(map(int, input().split()))",
"- ship[temp[0] - 1].append(temp)",
"-for i in range(len(ship[0])):",
"- now = ship[0][i]",
"- if [n... | false | 0.040764 | 0.332261 | 0.122686 | [
"s211997517",
"s486163814"
] |
u347600233 | p02837 | python | s904527718 | s527494129 | 178 | 120 | 3,064 | 3,064 | Accepted | Accepted | 32.58 | def is_consistent(bit, t_tuple):
mask, tf = t_tuple
if (bit & mask) == (tf & mask):
return True
else:
return False
n = int(eval(input()))
testimony = [0] * n
for i in range(n):
mask, tf = 0, 0
for j in range(int(eval(input()))):
x, y = list(map(int, input().split... | def is_consistent(bit, testimony):
all_consistence = True
for shift in range(n):
if (bit >> shift) & 1:
mask, tf = testimony[shift]
if (bit & mask) != (tf & mask):
all_consistence = False
return all_consistence
n = int(eval(input()))
testimony = [0]... | 30 | 24 | 792 | 709 | def is_consistent(bit, t_tuple):
mask, tf = t_tuple
if (bit & mask) == (tf & mask):
return True
else:
return False
n = int(eval(input()))
testimony = [0] * n
for i in range(n):
mask, tf = 0, 0
for j in range(int(eval(input()))):
x, y = list(map(int, input().split()))
... | def is_consistent(bit, testimony):
all_consistence = True
for shift in range(n):
if (bit >> shift) & 1:
mask, tf = testimony[shift]
if (bit & mask) != (tf & mask):
all_consistence = False
return all_consistence
n = int(eval(input()))
testimony = [0] * n
for ... | false | 20 | [
"-def is_consistent(bit, t_tuple):",
"- mask, tf = t_tuple",
"- if (bit & mask) == (tf & mask):",
"- return True",
"- else:",
"- return False",
"+def is_consistent(bit, testimony):",
"+ all_consistence = True",
"+ for shift in range(n):",
"+ if (bit >> shift) & ... | false | 0.046829 | 0.044237 | 1.058596 | [
"s904527718",
"s527494129"
] |
u405866707 | p03295 | python | s393658878 | s639018010 | 525 | 451 | 37,564 | 29,936 | Accepted | Accepted | 14.1 | N, M = list(map(int, input().split()))
bridges = []
for i in range(M):
bridges.append(list(map(int, input().split())))
intervals = sorted(bridges, key=lambda x: (x[1], x[0]))
#print(bridges)
count=1
done=[intervals[0]]
for interval in intervals:
#print(interval)
if not interval[0] < done[-1][1]:
... | N, M = list(map(int, input().split()))
bridges = []
for i in range(M):
bridges.append(list(map(int, input().split())))
intervals = sorted(bridges, key=lambda x: x[1])
#print(bridges)
count=1
done=[intervals[0]]
for interval in intervals:
#print(interval)
# we cut the last bridage of last process... | 19 | 20 | 380 | 430 | N, M = list(map(int, input().split()))
bridges = []
for i in range(M):
bridges.append(list(map(int, input().split())))
intervals = sorted(bridges, key=lambda x: (x[1], x[0]))
# print(bridges)
count = 1
done = [intervals[0]]
for interval in intervals:
# print(interval)
if not interval[0] < done[-1][1]:
... | N, M = list(map(int, input().split()))
bridges = []
for i in range(M):
bridges.append(list(map(int, input().split())))
intervals = sorted(bridges, key=lambda x: x[1])
# print(bridges)
count = 1
done = [intervals[0]]
for interval in intervals:
# print(interval)
# we cut the last bridage of last processed int... | false | 5 | [
"-intervals = sorted(bridges, key=lambda x: (x[1], x[0]))",
"+intervals = sorted(bridges, key=lambda x: x[1])",
"+ # we cut the last bridage of last processed interval"
] | false | 0.037846 | 0.03492 | 1.083811 | [
"s393658878",
"s639018010"
] |
u255943004 | p02553 | python | s772862224 | s392079688 | 66 | 32 | 61,500 | 9,164 | Accepted | Accepted | 51.52 | a,b,c,d = list(map(int,input().split()))
print((max([a*c,a*d,b*c,b*d])))
| a,b,c,d = list(map(int,input().split()))
ans=[]
for X in [a,b]:
for Y in [c,d]:
ans.append(X*Y)
print((max(ans)))
| 2 | 6 | 66 | 117 | a, b, c, d = list(map(int, input().split()))
print((max([a * c, a * d, b * c, b * d])))
| a, b, c, d = list(map(int, input().split()))
ans = []
for X in [a, b]:
for Y in [c, d]:
ans.append(X * Y)
print((max(ans)))
| false | 66.666667 | [
"-print((max([a * c, a * d, b * c, b * d])))",
"+ans = []",
"+for X in [a, b]:",
"+ for Y in [c, d]:",
"+ ans.append(X * Y)",
"+print((max(ans)))"
] | false | 0.080679 | 0.036236 | 2.226499 | [
"s772862224",
"s392079688"
] |
u589843455 | p04001 | python | s457918518 | s920273590 | 27 | 19 | 3,064 | 3,060 | Accepted | Accepted | 29.63 | S = eval(input())
num = len(S) - 1
sum = 0
for i in range(2**num):
op = [''] * (num+1)
formula = ''
for j in range(num):
if ((i >> j) & 1):
op[j] = '+'
for a,b in zip(S,op):
formula += a + b
sum += eval(formula)
print(sum) | S = eval(input())
num = len(S) - 1
sum = 0
for i in range(2**num):
k = 0
for j in range(num):
if ((i >> j) & 1):
sum += int(S[k:j+1])
k = j + 1
sum += int(S[k:])
print(sum) | 15 | 13 | 256 | 202 | S = eval(input())
num = len(S) - 1
sum = 0
for i in range(2**num):
op = [""] * (num + 1)
formula = ""
for j in range(num):
if (i >> j) & 1:
op[j] = "+"
for a, b in zip(S, op):
formula += a + b
sum += eval(formula)
print(sum)
| S = eval(input())
num = len(S) - 1
sum = 0
for i in range(2**num):
k = 0
for j in range(num):
if (i >> j) & 1:
sum += int(S[k : j + 1])
k = j + 1
sum += int(S[k:])
print(sum)
| false | 13.333333 | [
"- op = [\"\"] * (num + 1)",
"- formula = \"\"",
"+ k = 0",
"- op[j] = \"+\"",
"- for a, b in zip(S, op):",
"- formula += a + b",
"- sum += eval(formula)",
"+ sum += int(S[k : j + 1])",
"+ k = j + 1",
"+ sum += int(S[k:])"
] | false | 0.038824 | 0.038493 | 1.008598 | [
"s457918518",
"s920273590"
] |
u882209234 | p03578 | python | s375222804 | s451434372 | 368 | 319 | 35,420 | 56,800 | Accepted | Accepted | 13.32 | N = int(eval(input()))
D = list(map(int,input().split()))
M = int(eval(input()))
T = list(map(int,input().split()))
if N < M:
print('NO')
else:
D.sort()
T.sort()
cnt = 0
i = 0
for t in T:
while i < N:
if D[i] == t:
cnt += 1
i +... | N = int(eval(input()))
D = list(map(int,input().split()))
M = int(eval(input()))
T = list(map(int,input().split()))
from collections import Counter
cD = Counter(D)
cT = Counter(T)
ans = 'YES'
for k in cT:
if (k not in list(cD.keys())) or (cT[k] > cD[k]):
ans = 'NO'
break
print(ans) | 21 | 15 | 408 | 300 | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
if N < M:
print("NO")
else:
D.sort()
T.sort()
cnt = 0
i = 0
for t in T:
while i < N:
if D[i] == t:
cnt += 1
i += 1
... | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
from collections import Counter
cD = Counter(D)
cT = Counter(T)
ans = "YES"
for k in cT:
if (k not in list(cD.keys())) or (cT[k] > cD[k]):
ans = "NO"
break
print(ans)
| false | 28.571429 | [
"-if N < M:",
"- print(\"NO\")",
"-else:",
"- D.sort()",
"- T.sort()",
"- cnt = 0",
"- i = 0",
"- for t in T:",
"- while i < N:",
"- if D[i] == t:",
"- cnt += 1",
"- i += 1",
"- break",
"- i += 1",
... | false | 0.036343 | 0.037434 | 0.970844 | [
"s375222804",
"s451434372"
] |
u594244257 | p02953 | python | s020180996 | s620754641 | 60 | 49 | 11,152 | 14,252 | Accepted | Accepted | 18.33 | def solve(N, H):
max_h = 0
ret = True
for h in H:
if max_h-h >= 2:
ret = False
break
max_h = max(max_h, h)
print(('Yes' if ret else 'No'))
N = int(eval(input()))
H = list(map(int, input().split()))
solve(N,H) | def solve():
N = int(eval(input()))
H = list(map(int, input().split()))
h_max = H[0]
ret = True
for h in H:
if h_max-1 > h:
ret = False
break
if h_max < h:
h_max = h
print(('Yes' if ret else 'No'))
solve() | 14 | 14 | 265 | 291 | def solve(N, H):
max_h = 0
ret = True
for h in H:
if max_h - h >= 2:
ret = False
break
max_h = max(max_h, h)
print(("Yes" if ret else "No"))
N = int(eval(input()))
H = list(map(int, input().split()))
solve(N, H)
| def solve():
N = int(eval(input()))
H = list(map(int, input().split()))
h_max = H[0]
ret = True
for h in H:
if h_max - 1 > h:
ret = False
break
if h_max < h:
h_max = h
print(("Yes" if ret else "No"))
solve()
| false | 0 | [
"-def solve(N, H):",
"- max_h = 0",
"+def solve():",
"+ N = int(eval(input()))",
"+ H = list(map(int, input().split()))",
"+ h_max = H[0]",
"- if max_h - h >= 2:",
"+ if h_max - 1 > h:",
"- max_h = max(max_h, h)",
"+ if h_max < h:",
"+ h_max = h... | false | 0.095754 | 0.145773 | 0.656872 | [
"s020180996",
"s620754641"
] |
u840579553 | p02725 | python | s821508820 | s742570006 | 250 | 137 | 71,884 | 26,176 | Accepted | Accepted | 45.2 | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools impo... | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools impo... | 92 | 106 | 2,056 | 2,141 | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations... | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations... | false | 13.207547 | [
"+from collections import deque, defaultdict, Counter",
"+import math",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"+",
"+",
"+def lcm(a, b):",
"+ \"\"\"a,bの最小公倍数\"\"\"",
"+ return a * b // gcd(a, b)",
"+",
"+",
"- K, N = wi()",
"+ k, n =... | false | 0.122234 | 0.088356 | 1.383434 | [
"s821508820",
"s742570006"
] |
u100800700 | p03494 | python | s764280293 | s955981819 | 21 | 18 | 3,060 | 2,940 | Accepted | Accepted | 14.29 | #Shift only
N = int(eval(input()))
A = list(map(int,input().split()))
count = [0]*N
for a in range(N):
count_local = 0
while A[a]%2 == 0:
A[a] = A[a]/2
count_local += 1
if count_local >= count[a]:
count[a] = count_local
print((min(count))) | c=0;N,*A=list(map(int,open(0).read().split())) #open(0).read()でどんな形も読み込み可能。
while all([i&1==0 for i in A]):A=list([i>>1 for i in A]);c+=1
print(c) | 13 | 3 | 288 | 148 | # Shift only
N = int(eval(input()))
A = list(map(int, input().split()))
count = [0] * N
for a in range(N):
count_local = 0
while A[a] % 2 == 0:
A[a] = A[a] / 2
count_local += 1
if count_local >= count[a]:
count[a] = count_local
print((min(count)))
| c = 0
N, *A = list(map(int, open(0).read().split())) # open(0).read()でどんな形も読み込み可能。
while all([i & 1 == 0 for i in A]):
A = list([i >> 1 for i in A])
c += 1
print(c)
| false | 76.923077 | [
"-# Shift only",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-count = [0] * N",
"-for a in range(N):",
"- count_local = 0",
"- while A[a] % 2 == 0:",
"- A[a] = A[a] / 2",
"- count_local += 1",
"- if count_local >= count[a]:",
"- count... | false | 0.087302 | 0.048166 | 1.81253 | [
"s764280293",
"s955981819"
] |
u297574184 | p02804 | python | s766350104 | s140428538 | 190 | 159 | 14,416 | 19,912 | Accepted | Accepted | 16.32 | MOD = 10**9 + 7
def getInvs(n, MOD):
invs = [1] * (n+1)
for x in range(2, n+1):
invs[x] = (-(MOD//x) * invs[MOD%x]) % MOD
return invs
def getCombKs(n, k, invs, MOD):
combKs = [0] * (n+1)
combKs[k] = 1
for x in range(k+1, n+1):
combKs[x] = (combKs[x-1] * x * invs[x-k... | MOD = 10**9 + 7
N, K = list(map(int, input().split()))
As = list(map(int, input().split()))
def getInvs(n, MOD):
invs = [1] * (n+1)
for x in range(2, n+1):
invs[x] = (-(MOD//x) * invs[MOD%x]) % MOD
return invs
invs = getInvs(N, MOD)
def getCombKs(n, k, invs, MOD):
combKs = [0] * (n... | 31 | 30 | 661 | 669 | MOD = 10**9 + 7
def getInvs(n, MOD):
invs = [1] * (n + 1)
for x in range(2, n + 1):
invs[x] = (-(MOD // x) * invs[MOD % x]) % MOD
return invs
def getCombKs(n, k, invs, MOD):
combKs = [0] * (n + 1)
combKs[k] = 1
for x in range(k + 1, n + 1):
combKs[x] = (combKs[x - 1] * x * in... | MOD = 10**9 + 7
N, K = list(map(int, input().split()))
As = list(map(int, input().split()))
def getInvs(n, MOD):
invs = [1] * (n + 1)
for x in range(2, n + 1):
invs[x] = (-(MOD // x) * invs[MOD % x]) % MOD
return invs
invs = getInvs(N, MOD)
def getCombKs(n, k, invs, MOD):
combKs = [0] * (n... | false | 3.225806 | [
"+N, K = list(map(int, input().split()))",
"+As = list(map(int, input().split()))",
"+",
"+",
"+invs = getInvs(N, MOD)",
"-N, K = list(map(int, input().split()))",
"-As = list(map(int, input().split()))",
"+combKs = getCombKs(N, K - 1, invs, MOD)",
"-invs = getInvs(N, MOD)",
"-combKs = getCombKs(N... | false | 0.036957 | 0.036706 | 1.006855 | [
"s766350104",
"s140428538"
] |
u261260430 | p02939 | python | s796282553 | s274022564 | 82 | 48 | 3,500 | 3,500 | Accepted | Accepted | 41.46 | s = eval(input())
ans = 0
t = p = ''
for i in range(len(s)):
t += s[i]
if t == p:
continue
p = t
t = ''
ans += 1
print(ans) | def solve():
s = eval(input())
ans = 0
t = p = ''
for i in range(len(s)):
t += s[i]
if t == p:
continue
p = t
t = ''
ans += 1
print(ans)
solve() | 13 | 17 | 145 | 194 | s = eval(input())
ans = 0
t = p = ""
for i in range(len(s)):
t += s[i]
if t == p:
continue
p = t
t = ""
ans += 1
print(ans)
| def solve():
s = eval(input())
ans = 0
t = p = ""
for i in range(len(s)):
t += s[i]
if t == p:
continue
p = t
t = ""
ans += 1
print(ans)
solve()
| false | 23.529412 | [
"-s = eval(input())",
"-ans = 0",
"-t = p = \"\"",
"-for i in range(len(s)):",
"- t += s[i]",
"- if t == p:",
"- continue",
"- p = t",
"- t = \"\"",
"- ans += 1",
"-print(ans)",
"+def solve():",
"+ s = eval(input())",
"+ ans = 0",
"+ t = p = \"\"",
"+ ... | false | 0.044989 | 0.042871 | 1.049404 | [
"s796282553",
"s274022564"
] |
u606045429 | p02928 | python | s863312779 | s430695411 | 38 | 32 | 3,188 | 3,188 | Accepted | Accepted | 15.79 | class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] +=... | class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] +=... | 36 | 37 | 726 | 757 | class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] += x
... | class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] += x
... | false | 2.702703 | [
"+max_A = 2000",
"-bit = Bit(2020)",
"+# internal inversion",
"+bit = Bit(max_A)",
"-bit = Bit(2020)",
"-Y = 0",
"-for i, p in enumerate(A * 2):",
"+# external inversion",
"+Y = -X",
"+for i, p in enumerate(A):",
"- Y += i + 1 - bit.sum(p)",
"-Y -= 2 * X",
"+ Y += i + N + 1 - bit.sum(p... | false | 0.137756 | 0.041739 | 3.300447 | [
"s863312779",
"s430695411"
] |
u537905693 | p02911 | python | s748789524 | s504115200 | 357 | 269 | 9,448 | 4,732 | Accepted | Accepted | 24.65 | #!/usr/bin/env python
# coding: utf-8
from collections import Counter
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def main():
n, k, q = rli()
ca = Counter()
for _ in range(q):
a = ri()... | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def check(s):
for i in range(len(s)):
if s[i] != s[len(s)-1-i]:
return False
return True
def m... | 29 | 32 | 505 | 608 | #!/usr/bin/env python
# coding: utf-8
from collections import Counter
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def main():
n, k, q = rli()
ca = Counter()
for _ in range(q):
a = ri()
ca[a] ... | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def check(s):
for i in range(len(s)):
if s[i] != s[len(s) - 1 - i]:
return False
return True
def main():
... | false | 9.375 | [
"-from collections import Counter",
"-",
"-",
"+def check(s):",
"+ for i in range(len(s)):",
"+ if s[i] != s[len(s) - 1 - i]:",
"+ return False",
"+ return True",
"+",
"+",
"- ca = Counter()",
"- for _ in range(q):",
"+ solve = [0 for _ in range(n + 1)]",
"... | false | 0.044219 | 0.048204 | 0.917344 | [
"s748789524",
"s504115200"
] |
u312025627 | p03761 | python | s299808498 | s399309233 | 208 | 25 | 38,768 | 3,316 | Accepted | Accepted | 87.98 | def main():
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
seted_s = set(s[0])
for i in s:
seted_s = seted_s & set(i)
from collections import defaultdict
dicted_s = defaultdict(int)
for i in seted_s:
for ss in s:
dicted_s[i] = min((dicted_s... | def main():
N = int(eval(input()))
A = [eval(input()) for i in range(N)]
from collections import Counter
c = Counter(A[0])
for a in A[1:]:
d = Counter(a)
c = c & d
print(("".join(sorted(c.elements()))))
if __name__ == '__main__':
main()
| 20 | 13 | 506 | 281 | def main():
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
seted_s = set(s[0])
for i in s:
seted_s = seted_s & set(i)
from collections import defaultdict
dicted_s = defaultdict(int)
for i in seted_s:
for ss in s:
dicted_s[i] = min((dicted_s[i] if di... | def main():
N = int(eval(input()))
A = [eval(input()) for i in range(N)]
from collections import Counter
c = Counter(A[0])
for a in A[1:]:
d = Counter(a)
c = c & d
print(("".join(sorted(c.elements()))))
if __name__ == "__main__":
main()
| false | 35 | [
"- n = int(eval(input()))",
"- s = [eval(input()) for i in range(n)]",
"- seted_s = set(s[0])",
"- for i in s:",
"- seted_s = seted_s & set(i)",
"- from collections import defaultdict",
"+ N = int(eval(input()))",
"+ A = [eval(input()) for i in range(N)]",
"+ from coll... | false | 0.037607 | 0.037384 | 1.005959 | [
"s299808498",
"s399309233"
] |
u347640436 | p03163 | python | s295271752 | s678216837 | 1,949 | 658 | 135,680 | 107,352 | Accepted | Accepted | 66.24 | from functools import cmp_to_key
n, w = [int(e) for e in input().split()]
d = [[int(e) for e in input().split()] for i in range(n)]
d.sort(key = cmp_to_key(lambda x, y: x[1] / x[0] - y[1] / y[0]))
t = {}
t[w] = 0
for i in range(n):
keys = list(sorted(t.keys())) # sort しないと品物iを複数回ナップサックに詰める可能性がある
tw, tv = d[... | from functools import cmp_to_key
n, w = [int(e) for e in input().split()]
d = [[int(e) for e in input().split()] for i in range(n)]
d.sort(key = cmp_to_key(lambda x, y: y[1] / y[0] - x[1] / x[0]))
t = {}
t[w] = 0
for i in range(n):
keys = list(sorted(t.keys())) # sort しないと品物iを複数回ナップサックに詰める可能性がある
tw, tv = d[... | 20 | 20 | 558 | 558 | from functools import cmp_to_key
n, w = [int(e) for e in input().split()]
d = [[int(e) for e in input().split()] for i in range(n)]
d.sort(key=cmp_to_key(lambda x, y: x[1] / x[0] - y[1] / y[0]))
t = {}
t[w] = 0
for i in range(n):
keys = list(sorted(t.keys())) # sort しないと品物iを複数回ナップサックに詰める可能性がある
tw, tv = d[i]
... | from functools import cmp_to_key
n, w = [int(e) for e in input().split()]
d = [[int(e) for e in input().split()] for i in range(n)]
d.sort(key=cmp_to_key(lambda x, y: y[1] / y[0] - x[1] / x[0]))
t = {}
t[w] = 0
for i in range(n):
keys = list(sorted(t.keys())) # sort しないと品物iを複数回ナップサックに詰める可能性がある
tw, tv = d[i]
... | false | 0 | [
"-d.sort(key=cmp_to_key(lambda x, y: x[1] / x[0] - y[1] / y[0]))",
"+d.sort(key=cmp_to_key(lambda x, y: y[1] / y[0] - x[1] / x[0]))"
] | false | 0.0399 | 0.042788 | 0.9325 | [
"s295271752",
"s678216837"
] |
u202406075 | p02854 | python | s323375737 | s009149469 | 121 | 99 | 26,060 | 26,024 | Accepted | Accepted | 18.18 | import sys
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
ave = sum(a)/2
for i in range(n):
cnt += a[i]
if cnt == ave:
print((0))
sys.exit()
elif cnt > ave:
x = ave -cnt +a[i]
if x >= cnt -ave:
x = cnt -ave
b... | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
ave = sum(a)/2
for i in range(n):
cnt += a[i]
if cnt >= ave:
ans = min(cnt*2-ave*2, ave*2-(cnt-a[i])*2)
break
print((int(ans))) | 22 | 14 | 335 | 227 | import sys
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
ave = sum(a) / 2
for i in range(n):
cnt += a[i]
if cnt == ave:
print((0))
sys.exit()
elif cnt > ave:
x = ave - cnt + a[i]
if x >= cnt - ave:
x = cnt - ave
break
print((int(x * 2... | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
ave = sum(a) / 2
for i in range(n):
cnt += a[i]
if cnt >= ave:
ans = min(cnt * 2 - ave * 2, ave * 2 - (cnt - a[i]) * 2)
break
print((int(ans)))
| false | 36.363636 | [
"-import sys",
"-",
"- if cnt == ave:",
"- print((0))",
"- sys.exit()",
"- elif cnt > ave:",
"- x = ave - cnt + a[i]",
"- if x >= cnt - ave:",
"- x = cnt - ave",
"+ if cnt >= ave:",
"+ ans = min(cnt * 2 - ave * 2, ave * 2 - (cnt - a[i]) * 2)... | false | 0.181995 | 0.13831 | 1.315847 | [
"s323375737",
"s009149469"
] |
u360116509 | p03147 | python | s380879334 | s039500164 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | def main():
N = int(eval(input()))
h = list(map(int, input().split()))
c = h[0]
for i in range(N - 1):
if h[i + 1] > h[i]:
c += h[i + 1] - h[i]
print(c)
main()
| N = int(eval(input()))
H = list(map(int, input().split()))
ans = H[0]
for i in range(N - 1):
if H[i + 1] > H[i]:
ans += H[i + 1] - H[i]
print(ans)
| 11 | 8 | 206 | 161 | def main():
N = int(eval(input()))
h = list(map(int, input().split()))
c = h[0]
for i in range(N - 1):
if h[i + 1] > h[i]:
c += h[i + 1] - h[i]
print(c)
main()
| N = int(eval(input()))
H = list(map(int, input().split()))
ans = H[0]
for i in range(N - 1):
if H[i + 1] > H[i]:
ans += H[i + 1] - H[i]
print(ans)
| false | 27.272727 | [
"-def main():",
"- N = int(eval(input()))",
"- h = list(map(int, input().split()))",
"- c = h[0]",
"- for i in range(N - 1):",
"- if h[i + 1] > h[i]:",
"- c += h[i + 1] - h[i]",
"- print(c)",
"-",
"-",
"-main()",
"+N = int(eval(input()))",
"+H = list(map(int,... | false | 0.051598 | 0.050398 | 1.023799 | [
"s380879334",
"s039500164"
] |
u187516587 | p02901 | python | s342217854 | s785288988 | 1,718 | 323 | 55,560 | 50,396 | Accepted | Accepted | 81.2 | from itertools import product
N,M=list(map(int,input().split()))
l=list(product((0,1),repeat=N))
L=len(l)
for i in range(2**N):
l[i]=[l[i],1300000]
r=(2048,1024,512,256,128,64,32,16,8,4,2,1)
l[0][1]=0
for i in range(M):
a,b=list(map(int,input().split()))
c=tuple(map(int,input().split()))
t=[0... | N,M=list(map(int,input().split()))
L=2**N
l=[float("inf")]*L
l[0]=0
r=(1,2,4,8,16,32,64,128,256,512,1024,2048)
for i in range(M):
s=0
a,b=list(map(int,input().split()))
c=tuple(map(int,input().split()))
for j in c:
s+=r[j-1]
for j in range(L):
l[j|s]=min(l[j|s],l[j]+a)
i... | 24 | 17 | 586 | 370 | from itertools import product
N, M = list(map(int, input().split()))
l = list(product((0, 1), repeat=N))
L = len(l)
for i in range(2**N):
l[i] = [l[i], 1300000]
r = (2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1)
l[0][1] = 0
for i in range(M):
a, b = list(map(int, input().split()))
c = tuple(map(int, i... | N, M = list(map(int, input().split()))
L = 2**N
l = [float("inf")] * L
l[0] = 0
r = (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048)
for i in range(M):
s = 0
a, b = list(map(int, input().split()))
c = tuple(map(int, input().split()))
for j in c:
s += r[j - 1]
for j in range(L):
l[... | false | 29.166667 | [
"-from itertools import product",
"-",
"-l = list(product((0, 1), repeat=N))",
"-L = len(l)",
"-for i in range(2**N):",
"- l[i] = [l[i], 1300000]",
"-r = (2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1)",
"-l[0][1] = 0",
"+L = 2**N",
"+l = [float(\"inf\")] * L",
"+l[0] = 0",
"+r = (1, 2,... | false | 0.007073 | 0.037391 | 0.189175 | [
"s342217854",
"s785288988"
] |
u934442292 | p02584 | python | s610211668 | s862998037 | 31 | 28 | 9,176 | 9,168 | Accepted | Accepted | 9.68 | import sys
input = sys.stdin.readline
def main():
X, K, D = list(map(int, input().split()))
X = abs(X)
q, r = divmod(X, D)
if K <= q:
ans = (q - K) * D + r
else:
if (K - q) % 2 == 0:
ans = r
else:
ans = D - r
print(ans)
... | import sys
input = sys.stdin.readline
def main():
X, K, D = list(map(int, input().split()))
X = abs(X)
q, r = divmod(X, D)
if K < q:
ans = X - D * K
else:
if (K - q) % 2 == 0:
ans = r
else:
ans = D - r
print(ans)
if __na... | 23 | 23 | 353 | 346 | import sys
input = sys.stdin.readline
def main():
X, K, D = list(map(int, input().split()))
X = abs(X)
q, r = divmod(X, D)
if K <= q:
ans = (q - K) * D + r
else:
if (K - q) % 2 == 0:
ans = r
else:
ans = D - r
print(ans)
if __name__ == "__main_... | import sys
input = sys.stdin.readline
def main():
X, K, D = list(map(int, input().split()))
X = abs(X)
q, r = divmod(X, D)
if K < q:
ans = X - D * K
else:
if (K - q) % 2 == 0:
ans = r
else:
ans = D - r
print(ans)
if __name__ == "__main__":
... | false | 0 | [
"- if K <= q:",
"- ans = (q - K) * D + r",
"+ if K < q:",
"+ ans = X - D * K"
] | false | 0.045428 | 0.045622 | 0.995754 | [
"s610211668",
"s862998037"
] |
u740284863 | p03352 | python | s549285335 | s064646743 | 77 | 21 | 2,940 | 2,940 | Accepted | Accepted | 72.73 | n = int(eval(input()))
l = []
for i in range(1,n+1):
for j in range(2,100):
if i**j <= n:
l.append(i**j)
print((max(l))) | n = int(eval(input()))
l = []
for i in range(1,n+1):
for j in range(2,10):
if i**j <= n:
l.append(i**j)
print((max(l))) | 7 | 7 | 142 | 141 | n = int(eval(input()))
l = []
for i in range(1, n + 1):
for j in range(2, 100):
if i**j <= n:
l.append(i**j)
print((max(l)))
| n = int(eval(input()))
l = []
for i in range(1, n + 1):
for j in range(2, 10):
if i**j <= n:
l.append(i**j)
print((max(l)))
| false | 0 | [
"- for j in range(2, 100):",
"+ for j in range(2, 10):"
] | false | 0.083948 | 0.082147 | 1.021921 | [
"s549285335",
"s064646743"
] |
u367701763 | p02793 | python | s622529845 | s418963305 | 191 | 102 | 57,220 | 90,116 | Accepted | Accepted | 46.6 | import sys
input = sys.stdin.readline
from collections import defaultdict
class PrimeFactor():
def __init__(self, n): # エラトステネス O(N loglog N)
self.n = n
self.table = list(range(n+1))
self.table[2::2] = [2]*(n//2)
for p in range(3, int(n**0.5) + 2, 2):
... | # https://atcoder.jp/contests/abc152/submissions/9693323
import sys
read = sys.stdin.read
N, *A = list(map(int, read().split()))
mod = 10 ** 9 + 7
def min_factor(n):
sieve = list(range(n + 1))
sieve[2::2] = [2] * (n // 2)
for i in range(3, int(n ** 0.5) + 2, 2):
if sieve[i] == i:
... | 76 | 47 | 2,198 | 970 | import sys
input = sys.stdin.readline
from collections import defaultdict
class PrimeFactor:
def __init__(self, n): # エラトステネス O(N loglog N)
self.n = n
self.table = list(range(n + 1))
self.table[2::2] = [2] * (n // 2)
for p in range(3, int(n**0.5) + 2, 2):
if self.tabl... | # https://atcoder.jp/contests/abc152/submissions/9693323
import sys
read = sys.stdin.read
N, *A = list(map(int, read().split()))
mod = 10**9 + 7
def min_factor(n):
sieve = list(range(n + 1))
sieve[2::2] = [2] * (n // 2)
for i in range(3, int(n**0.5) + 2, 2):
if sieve[i] == i:
sieve[i ... | false | 38.157895 | [
"+# https://atcoder.jp/contests/abc152/submissions/9693323",
"-input = sys.stdin.readline",
"-from collections import defaultdict",
"+read = sys.stdin.read",
"+N, *A = list(map(int, read().split()))",
"+mod = 10**9 + 7",
"-class PrimeFactor:",
"- def __init__(self, n): # エラトステネス O(N loglog N)",
... | false | 0.304945 | 0.289752 | 1.052434 | [
"s622529845",
"s418963305"
] |
u340781749 | p03086 | python | s104389228 | s232260901 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | s = eval(input())
ans = 0
for l in range(len(s)):
for r in range(l, len(s) + 1):
t = s[l:r]
if all(c in 'ACGT' for c in t):
ans = max(ans, len(t))
print(ans)
| s = eval(input())
ans = 0
tmp = 0
for c in s:
if c in 'ACGT':
tmp += 1
ans = max(ans, tmp)
else:
tmp = 0
print(ans)
| 8 | 10 | 191 | 151 | s = eval(input())
ans = 0
for l in range(len(s)):
for r in range(l, len(s) + 1):
t = s[l:r]
if all(c in "ACGT" for c in t):
ans = max(ans, len(t))
print(ans)
| s = eval(input())
ans = 0
tmp = 0
for c in s:
if c in "ACGT":
tmp += 1
ans = max(ans, tmp)
else:
tmp = 0
print(ans)
| false | 20 | [
"-for l in range(len(s)):",
"- for r in range(l, len(s) + 1):",
"- t = s[l:r]",
"- if all(c in \"ACGT\" for c in t):",
"- ans = max(ans, len(t))",
"+tmp = 0",
"+for c in s:",
"+ if c in \"ACGT\":",
"+ tmp += 1",
"+ ans = max(ans, tmp)",
"+ else:",
... | false | 0.064411 | 0.131257 | 0.490726 | [
"s104389228",
"s232260901"
] |
u837673618 | p02721 | python | s731219355 | s791892858 | 194 | 77 | 23,452 | 23,968 | Accepted | Accepted | 60.31 | def solve():
N, K, C = list(map(int, input().split()))
workable = [i for i, s in enumerate(eval(input())) if s=="o"]
if len(workable) == K:
return workable
def to_left():
prev = workable[-1]+C+1
for x in reversed(workable):
if prev - x > C:
yield x
prev = x
lat... | def solve():
N, K, C = list(map(int, input().split()))
workable = [i+1 for i, s in enumerate(eval(input())) if s=="o"]
if len(workable) == K:
return workable
latest = set()
prev = workable[-1]+C+1
for x in reversed(workable):
if prev - x > C:
latest.add(x)
prev = x
... | 26 | 24 | 569 | 536 | def solve():
N, K, C = list(map(int, input().split()))
workable = [i for i, s in enumerate(eval(input())) if s == "o"]
if len(workable) == K:
return workable
def to_left():
prev = workable[-1] + C + 1
for x in reversed(workable):
if prev - x > C:
yiel... | def solve():
N, K, C = list(map(int, input().split()))
workable = [i + 1 for i, s in enumerate(eval(input())) if s == "o"]
if len(workable) == K:
return workable
latest = set()
prev = workable[-1] + C + 1
for x in reversed(workable):
if prev - x > C:
latest.add(x)
... | false | 7.692308 | [
"- workable = [i for i, s in enumerate(eval(input())) if s == \"o\"]",
"+ workable = [i + 1 for i, s in enumerate(eval(input())) if s == \"o\"]",
"-",
"- def to_left():",
"- prev = workable[-1] + C + 1",
"- for x in reversed(workable):",
"- if prev - x > C:",
"- ... | false | 0.075962 | 0.091159 | 0.833292 | [
"s731219355",
"s791892858"
] |
u754022296 | p03487 | python | s743609057 | s332256424 | 195 | 79 | 14,712 | 18,676 | Accepted | Accepted | 59.49 | import bisect
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
c = 0
temp = 0
for i in sorted(list(set(A))):
d = bisect.bisect_right(A, i)
if d-temp >= i:
c += d-temp - i
else:
c += d-temp
temp = d
print(c) | from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
C = Counter(A)
ans = 0
for k, v in list(C.items()):
if v >= k:
ans += v-k
else:
ans += v
print(ans) | 14 | 11 | 248 | 200 | import bisect
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
c = 0
temp = 0
for i in sorted(list(set(A))):
d = bisect.bisect_right(A, i)
if d - temp >= i:
c += d - temp - i
else:
c += d - temp
temp = d
print(c)
| from collections import Counter
n = int(eval(input()))
A = list(map(int, input().split()))
C = Counter(A)
ans = 0
for k, v in list(C.items()):
if v >= k:
ans += v - k
else:
ans += v
print(ans)
| false | 21.428571 | [
"-import bisect",
"+from collections import Counter",
"-A = sorted(list(map(int, input().split())))",
"-c = 0",
"-temp = 0",
"-for i in sorted(list(set(A))):",
"- d = bisect.bisect_right(A, i)",
"- if d - temp >= i:",
"- c += d - temp - i",
"+A = list(map(int, input().split()))",
"+... | false | 0.039674 | 0.075437 | 0.525924 | [
"s743609057",
"s332256424"
] |
u597374218 | p03485 | python | s118177616 | s280017042 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | import math
a,b=list(map(int,input().split()))
print((math.ceil((a+b)/2))) | print((-~sum(map(int,input().split()))//2)) | 3 | 1 | 68 | 41 | import math
a, b = list(map(int, input().split()))
print((math.ceil((a + b) / 2)))
| print((-~sum(map(int, input().split())) // 2))
| false | 66.666667 | [
"-import math",
"-",
"-a, b = list(map(int, input().split()))",
"-print((math.ceil((a + b) / 2)))",
"+print((-~sum(map(int, input().split())) // 2))"
] | false | 0.084403 | 0.08059 | 1.047304 | [
"s118177616",
"s280017042"
] |
u924691798 | p03821 | python | s854083508 | s559595378 | 373 | 207 | 14,904 | 14,836 | Accepted | Accepted | 44.5 | N = int(eval(input()))
A = [0]*N
B = [0]*N
for i in range(N):
a, b = list(map(int, input().split()))
A[i] = a
B[i] = b
ans = 0
for i in range(N-1,-1,-1):
A[i] += ans
ans += B[i]*((A[i]+B[i]-1)//B[i]) - A[i]
print(ans)
| import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [0]*N
B = [0]*N
for i in range(N):
a, b = list(map(int, input().split()))
A[i] = a
B[i] = b
ans = 0
for i in range(N-1,-1,-1):
A[i] += ans
if A[i]%B[i] != 0:
ans += B[i]-(A[i]%B[i])
print(ans)
| 12 | 16 | 237 | 290 | N = int(eval(input()))
A = [0] * N
B = [0] * N
for i in range(N):
a, b = list(map(int, input().split()))
A[i] = a
B[i] = b
ans = 0
for i in range(N - 1, -1, -1):
A[i] += ans
ans += B[i] * ((A[i] + B[i] - 1) // B[i]) - A[i]
print(ans)
| import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [0] * N
B = [0] * N
for i in range(N):
a, b = list(map(int, input().split()))
A[i] = a
B[i] = b
ans = 0
for i in range(N - 1, -1, -1):
A[i] += ans
if A[i] % B[i] != 0:
ans += B[i] - (A[i] % B[i])
print(ans)
| false | 25 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"- ans += B[i] * ((A[i] + B[i] - 1) // B[i]) - A[i]",
"+ if A[i] % B[i] != 0:",
"+ ans += B[i] - (A[i] % B[i])"
] | false | 0.063366 | 0.037089 | 1.708478 | [
"s854083508",
"s559595378"
] |
u347640436 | p02642 | python | s274166929 | s285532475 | 1,943 | 1,644 | 51,976 | 44,340 | Accepted | Accepted | 15.39 | N = int(eval(input()))
A = list(map(int, input().split()))
t = [True] * (10 ** 6 + 1)
d = {}
for a in A:
d.setdefault(a, 0)
d[a] += 1
A = sorted(set(A))
for a in A:
if d[a] > 1:
t[a] = False
for i in range(a + a, 10 ** 6 + 1, a):
t[i] = False
result = 0
for a in A:
... | N = int(eval(input()))
A = list(map(int, input().split()))
d = {}
for a in A:
d.setdefault(a, 0)
d[a] += 1
A = sorted(set(A))
t = [True] * (10 ** 6 + 1)
for a in A:
for i in range(a + a, 10 ** 6 + 1, a):
t[i] = False
for a in d:
if d[a] > 1:
t[a] = False
result = ... | 21 | 24 | 362 | 379 | N = int(eval(input()))
A = list(map(int, input().split()))
t = [True] * (10**6 + 1)
d = {}
for a in A:
d.setdefault(a, 0)
d[a] += 1
A = sorted(set(A))
for a in A:
if d[a] > 1:
t[a] = False
for i in range(a + a, 10**6 + 1, a):
t[i] = False
result = 0
for a in A:
if t[a]:
resul... | N = int(eval(input()))
A = list(map(int, input().split()))
d = {}
for a in A:
d.setdefault(a, 0)
d[a] += 1
A = sorted(set(A))
t = [True] * (10**6 + 1)
for a in A:
for i in range(a + a, 10**6 + 1, a):
t[i] = False
for a in d:
if d[a] > 1:
t[a] = False
result = 0
for a in A:
if t[a]:
... | false | 12.5 | [
"-t = [True] * (10**6 + 1)",
"+t = [True] * (10**6 + 1)",
"+ for i in range(a + a, 10**6 + 1, a):",
"+ t[i] = False",
"+for a in d:",
"- for i in range(a + a, 10**6 + 1, a):",
"- t[i] = False"
] | false | 0.18336 | 0.489459 | 0.374618 | [
"s274166929",
"s285532475"
] |
u756782069 | p02621 | python | s821064221 | s776565382 | 29 | 26 | 9,076 | 8,780 | Accepted | Accepted | 10.34 | def main():
a = int(eval(input()))
print((int(a+a*a+a**3)))
if __name__ == "__main__":
main() | a = int(eval(input()))
print((a*(a*a+a+1))) | 6 | 2 | 103 | 36 | def main():
a = int(eval(input()))
print((int(a + a * a + a**3)))
if __name__ == "__main__":
main()
| a = int(eval(input()))
print((a * (a * a + a + 1)))
| false | 66.666667 | [
"-def main():",
"- a = int(eval(input()))",
"- print((int(a + a * a + a**3)))",
"-",
"-",
"-if __name__ == \"__main__\":",
"- main()",
"+a = int(eval(input()))",
"+print((a * (a * a + a + 1)))"
] | false | 0.050402 | 0.036692 | 1.373653 | [
"s821064221",
"s776565382"
] |
u423966555 | p02820 | python | s210398103 | s346753351 | 391 | 75 | 23,452 | 3,316 | Accepted | Accepted | 80.82 | N, K = list(map(int, input().split())) #N回ジャンケン, K回前と同じ手を出せない
R, S, P = list(map(int, input().split()))
T = eval(input())
t_k = [[] for i in range(K)]
for i in range(N):
t_k[i%K].append(T[i])
hand = ['r', 's', 'p']
ans = 0
for i_k in t_k:
n = len(i_k)
dp = [[0,0,0] for i in range(n+1)]
... |
N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
score = {'r': P, 's': R, 'p': S}
ans = 0
for r in range(K):
i = r
p = '' #一個前の文字
while i<N:
if T[i] == p:
p = ''
else:
ans += score[T[i]]
... | 31 | 20 | 780 | 340 | N, K = list(map(int, input().split())) # N回ジャンケン, K回前と同じ手を出せない
R, S, P = list(map(int, input().split()))
T = eval(input())
t_k = [[] for i in range(K)]
for i in range(N):
t_k[i % K].append(T[i])
hand = ["r", "s", "p"]
ans = 0
for i_k in t_k:
n = len(i_k)
dp = [[0, 0, 0] for i in range(n + 1)]
cnt = 1
... | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
score = {"r": P, "s": R, "p": S}
ans = 0
for r in range(K):
i = r
p = "" # 一個前の文字
while i < N:
if T[i] == p:
p = ""
else:
ans += score[T[i]]
p = T[i]
... | false | 35.483871 | [
"-N, K = list(map(int, input().split())) # N回ジャンケン, K回前と同じ手を出せない",
"+N, K = list(map(int, input().split()))",
"-t_k = [[] for i in range(K)]",
"-for i in range(N):",
"- t_k[i % K].append(T[i])",
"-hand = [\"r\", \"s\", \"p\"]",
"+score = {\"r\": P, \"s\": R, \"p\": S}",
"-for i_k in t_k:",
"- ... | false | 0.128013 | 0.038362 | 3.336938 | [
"s210398103",
"s346753351"
] |
u608088992 | p03356 | python | s241539462 | s330569707 | 635 | 522 | 13,812 | 18,544 | Accepted | Accepted | 17.8 | N, M = list(map(int, input().split()))
P = [int(p) for p in input().split()]
Par = [int(i) for i in range(N+1)]
Rank = [0 for i in range(N+1)]
def find(i, Par):
if Par[i] == i:
return i
else:
Par[i] = find(Par[i], Par)
return Par[i]
def Unite(x, y):
rx, ry = find(x, Pa... | import sys
class UFT: #Union-find tree class
def __init__(self, N):
self.tree = [int(i) for i in range(N)]
self.rank = [0 for i in range(N)]
def find(self, a):
if self.tree[a] == a: return a
else:
self.tree[a] = self.find(self.tree[a])
retur... | 31 | 41 | 743 | 1,094 | N, M = list(map(int, input().split()))
P = [int(p) for p in input().split()]
Par = [int(i) for i in range(N + 1)]
Rank = [0 for i in range(N + 1)]
def find(i, Par):
if Par[i] == i:
return i
else:
Par[i] = find(Par[i], Par)
return Par[i]
def Unite(x, y):
rx, ry = find(x, Par), fin... | import sys
class UFT: # Union-find tree class
def __init__(self, N):
self.tree = [int(i) for i in range(N)]
self.rank = [0 for i in range(N)]
def find(self, a):
if self.tree[a] == a:
return a
else:
self.tree[a] = self.find(self.tree[a])
ret... | false | 24.390244 | [
"-N, M = list(map(int, input().split()))",
"-P = [int(p) for p in input().split()]",
"-Par = [int(i) for i in range(N + 1)]",
"-Rank = [0 for i in range(N + 1)]",
"+import sys",
"-def find(i, Par):",
"- if Par[i] == i:",
"- return i",
"- else:",
"- Par[i] = find(Par[i], Par)",
... | false | 0.050771 | 0.050283 | 1.009723 | [
"s241539462",
"s330569707"
] |
u548545174 | p03945 | python | s294708306 | s699183907 | 45 | 18 | 3,188 | 3,188 | Accepted | Accepted | 60 | S = eval(input())
cnt = 0
before = ""
for i in range(len(S)):
if S[i] != before:
cnt += 1
before = S[i]
print((cnt-1)) | S = eval(input())
print((S.count("BW") + S.count("WB"))) | 9 | 3 | 135 | 51 | S = eval(input())
cnt = 0
before = ""
for i in range(len(S)):
if S[i] != before:
cnt += 1
before = S[i]
print((cnt - 1))
| S = eval(input())
print((S.count("BW") + S.count("WB")))
| false | 66.666667 | [
"-cnt = 0",
"-before = \"\"",
"-for i in range(len(S)):",
"- if S[i] != before:",
"- cnt += 1",
"- before = S[i]",
"-print((cnt - 1))",
"+print((S.count(\"BW\") + S.count(\"WB\")))"
] | false | 0.056792 | 0.143241 | 0.396474 | [
"s294708306",
"s699183907"
] |
u814986259 | p03835 | python | s642778420 | s939984146 | 1,993 | 1,122 | 2,940 | 2,940 | Accepted | Accepted | 43.7 | K,S=list(map(int,input().split()))
ans=0
for i in range(K+1):
for j in range(K+1):
if S-(i+j) >=0 and S-(i+j)<=K:
ans+=1
print(ans)
| K, S = list(map(int, input().split()))
ans = 0
for i in range(K+1):
for j in range(min(K, S - i)+1):
if S - (i+j) <= K:
ans += 1
print(ans)
| 7 | 7 | 144 | 164 | K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
for j in range(K + 1):
if S - (i + j) >= 0 and S - (i + j) <= K:
ans += 1
print(ans)
| K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
for j in range(min(K, S - i) + 1):
if S - (i + j) <= K:
ans += 1
print(ans)
| false | 0 | [
"- for j in range(K + 1):",
"- if S - (i + j) >= 0 and S - (i + j) <= K:",
"+ for j in range(min(K, S - i) + 1):",
"+ if S - (i + j) <= K:"
] | false | 0.065409 | 0.037811 | 1.729871 | [
"s642778420",
"s939984146"
] |
u901582103 | p03137 | python | s935269451 | s015056242 | 129 | 108 | 13,960 | 13,960 | Accepted | Accepted | 16.28 | n,m=list(map(int,input().split()))
X=sorted(map(int,input().split()))
if n>=m:
r=0
else:
L=[]
for i in range(m-1):
l=X[i+1]-X[i]
L.append(l)
L.sort(reverse=True)
r=X[-1]-X[0]
for j in range(n-1):
r-=L[j]
print(r) | n,m=list(map(int,input().split()))
X=sorted(map(int,input().split()))
L=sorted([X[i+1]-X[i] for i in range(m-1)])
if n>=m:
print((0))
else:
print((sum(L)-sum([L[-i-1] for i in range(n-1)]))) | 14 | 7 | 267 | 194 | n, m = list(map(int, input().split()))
X = sorted(map(int, input().split()))
if n >= m:
r = 0
else:
L = []
for i in range(m - 1):
l = X[i + 1] - X[i]
L.append(l)
L.sort(reverse=True)
r = X[-1] - X[0]
for j in range(n - 1):
r -= L[j]
print(r)
| n, m = list(map(int, input().split()))
X = sorted(map(int, input().split()))
L = sorted([X[i + 1] - X[i] for i in range(m - 1)])
if n >= m:
print((0))
else:
print((sum(L) - sum([L[-i - 1] for i in range(n - 1)])))
| false | 50 | [
"+L = sorted([X[i + 1] - X[i] for i in range(m - 1)])",
"- r = 0",
"+ print((0))",
"- L = []",
"- for i in range(m - 1):",
"- l = X[i + 1] - X[i]",
"- L.append(l)",
"- L.sort(reverse=True)",
"- r = X[-1] - X[0]",
"- for j in range(n - 1):",
"- r -= L[j]"... | false | 0.048783 | 0.008236 | 5.923136 | [
"s935269451",
"s015056242"
] |
u377989038 | p03147 | python | s730540344 | s680231510 | 31 | 18 | 3,444 | 3,064 | Accepted | Accepted | 41.94 | import copy
n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
tmp = 0
for i in range(n):
ans += h[i]
tmp = copy.deepcopy(h)
tmp_ = tmp[i]
for j in range(i, n):
if h[j] - tmp_ >= 0:
h[j] -= tmp_
else:
tmp_ = tmp[j]
h[j... | n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
tmp = 0
for i in range(n):
ans += h[i]
tmp = int(h[i])
for j in range(i, n):
if h[j] - tmp >= 0:
h[j] -= tmp
else:
tmp = int(h[j])
h[j] = 0
print(ans) | 19 | 17 | 334 | 294 | import copy
n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
tmp = 0
for i in range(n):
ans += h[i]
tmp = copy.deepcopy(h)
tmp_ = tmp[i]
for j in range(i, n):
if h[j] - tmp_ >= 0:
h[j] -= tmp_
else:
tmp_ = tmp[j]
h[j] = 0
print(ans)
| n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
tmp = 0
for i in range(n):
ans += h[i]
tmp = int(h[i])
for j in range(i, n):
if h[j] - tmp >= 0:
h[j] -= tmp
else:
tmp = int(h[j])
h[j] = 0
print(ans)
| false | 10.526316 | [
"-import copy",
"-",
"- tmp = copy.deepcopy(h)",
"- tmp_ = tmp[i]",
"+ tmp = int(h[i])",
"- if h[j] - tmp_ >= 0:",
"- h[j] -= tmp_",
"+ if h[j] - tmp >= 0:",
"+ h[j] -= tmp",
"- tmp_ = tmp[j]",
"+ tmp = int(h[j])"
] | false | 0.039119 | 0.043527 | 0.898727 | [
"s730540344",
"s680231510"
] |
u811733736 | p02418 | python | s980711279 | s799852062 | 90 | 50 | 7,472 | 7,588 | Accepted | Accepted | 44.44 | if __name__ == '__main__':
s_txt = eval(input())
p_txt = eval(input())
base_txt = s_txt * 2
base_txt = base_txt[:-1] # s_txt=='hoge', p_txt=='hogehoge' ??????????????´???????????£??????????????????????????????????????????????????????
if p_txt in base_txt:
print('Yes')
else:
... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_D&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
s = input().strip()
p = input().strip()
s = s + s[:-1]
if p in s:
print('Yes')
else:
... | 11 | 24 | 327 | 394 | if __name__ == "__main__":
s_txt = eval(input())
p_txt = eval(input())
base_txt = s_txt * 2
base_txt = base_txt[
:-1
] # s_txt=='hoge', p_txt=='hogehoge' ??????????????´???????????£??????????????????????????????????????????????????????
if p_txt in base_txt:
print("Yes")
else... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_D&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
s = input().strip()
p = input().strip()
s = s + s[:-1]
if p in s:
print("Yes")
else:
print("No")
if _... | false | 54.166667 | [
"-if __name__ == \"__main__\":",
"- s_txt = eval(input())",
"- p_txt = eval(input())",
"- base_txt = s_txt * 2",
"- base_txt = base_txt[",
"- :-1",
"- ] # s_txt=='hoge', p_txt=='hogehoge' ??????????????´???????????£??????????????????????????????????????????????????????",
"- i... | false | 0.089869 | 0.080394 | 1.117863 | [
"s980711279",
"s799852062"
] |
u852690916 | p02762 | python | s895170935 | s689234247 | 1,780 | 1,533 | 137,432 | 113,440 | Accepted | Accepted | 13.88 | N,M,K=map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(M)]
CD = [tuple(map(int, input().split())) for _ in range(K)]
def root(x,P):
l = []
n = x
p = P[n]
while p >= 0:
l.append(n)
n = p
p = P[p]
for a in l: P[a] = n
return n
... | N, M, K=list(map(int, input().split()))
class UnionFindTree:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
def root(self, x):
p, seq = self.parent[x], list()
while p >= 0:
seq.append(x)
x, p = p, self.parent[p]
for c in seq: self... | 46 | 43 | 971 | 1,249 | N, M, K = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(M)]
CD = [tuple(map(int, input().split())) for _ in range(K)]
def root(x, P):
l = []
n = x
p = P[n]
while p >= 0:
l.append(n)
n = p
p = P[p]
for a in l:
P[a] = n
return n
... | N, M, K = list(map(int, input().split()))
class UnionFindTree:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
def root(self, x):
p, seq = self.parent[x], list()
while p >= 0:
seq.append(x)
x, p = p, self.parent[p]
for c in seq:
... | false | 6.521739 | [
"-N, M, K = map(int, input().split())",
"-AB = [tuple(map(int, input().split())) for _ in range(M)]",
"-CD = [tuple(map(int, input().split())) for _ in range(K)]",
"+N, M, K = list(map(int, input().split()))",
"-def root(x, P):",
"- l = []",
"- n = x",
"- p = P[n]",
"- while p >= 0:",
... | false | 0.038824 | 0.039729 | 0.97721 | [
"s895170935",
"s689234247"
] |
u918770092 | p03814 | python | s301906846 | s552245143 | 23 | 18 | 3,640 | 3,500 | Accepted | Accepted | 21.74 | #AtoZString
import re
s = str(eval(input()))
S = (re.findall('A+[a-zA-z]+Z', s))
ss = S[0]
print((len(ss))) | #AtoZString
s = str(eval(input()))
print((s.rfind('Z') - s.find('A') + 1)) | 6 | 3 | 104 | 68 | # AtoZString
import re
s = str(eval(input()))
S = re.findall("A+[a-zA-z]+Z", s)
ss = S[0]
print((len(ss)))
| # AtoZString
s = str(eval(input()))
print((s.rfind("Z") - s.find("A") + 1))
| false | 50 | [
"-import re",
"-",
"-S = re.findall(\"A+[a-zA-z]+Z\", s)",
"-ss = S[0]",
"-print((len(ss)))",
"+print((s.rfind(\"Z\") - s.find(\"A\") + 1))"
] | false | 0.043602 | 0.143199 | 0.304483 | [
"s301906846",
"s552245143"
] |
u759076129 | p03598 | python | s043348813 | s249454628 | 32 | 24 | 9,180 | 8,976 | Accepted | Accepted | 25 | N = int(eval(input())) # ボールの数
K = int(eval(input())) # Bの位置
xs = [int(i) for i in input().split()] # ボールの位置
half = K / 2
total = 0
for x in xs:
if x < half:
total += 2*x
else:
total += 2*(K-x)
print(total)
| N = int(eval(input())) # ボールの数
K = int(eval(input())) # Bの位置
xs = [int(i) for i in input().split()] # ボールの位置
half = K / 2
total = 0
for x in xs:
if x < half:
total += x
else:
total += (K-x)
# 最後に二倍すればよい
print((2*total))
| 14 | 16 | 235 | 249 | N = int(eval(input())) # ボールの数
K = int(eval(input())) # Bの位置
xs = [int(i) for i in input().split()] # ボールの位置
half = K / 2
total = 0
for x in xs:
if x < half:
total += 2 * x
else:
total += 2 * (K - x)
print(total)
| N = int(eval(input())) # ボールの数
K = int(eval(input())) # Bの位置
xs = [int(i) for i in input().split()] # ボールの位置
half = K / 2
total = 0
for x in xs:
if x < half:
total += x
else:
total += K - x
# 最後に二倍すればよい
print((2 * total))
| false | 12.5 | [
"- total += 2 * x",
"+ total += x",
"- total += 2 * (K - x)",
"-print(total)",
"+ total += K - x",
"+# 最後に二倍すればよい",
"+print((2 * total))"
] | false | 0.037199 | 0.037946 | 0.980304 | [
"s043348813",
"s249454628"
] |
u745087332 | p03231 | python | s106797816 | s182172331 | 22 | 18 | 3,828 | 3,316 | Accepted | Accepted | 18.18 | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float('inf')
def inpl(): return list(map(int, input().split()))
# 整数(x, y)最大公約数を求める
def gcd(x, y):
if x % y == 0:
return y
else:
x, y = y, x % y
return gcd(x, y)
# 整数(x, y)最小公倍数を求める
def lcm(x, y):
... | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float('inf')
def inpl(): return list(map(int, input().split()))
# 整数(x, y)最大公約数を求める
def gcd(x, y):
if x % y == 0:
return y
else:
x, y = y, x % y
return gcd(x, y)
# 整数(x, y)最小公倍数を求める
def lcm(x, y):
... | 56 | 48 | 961 | 821 | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float("inf")
def inpl():
return list(map(int, input().split()))
# 整数(x, y)最大公約数を求める
def gcd(x, y):
if x % y == 0:
return y
else:
x, y = y, x % y
return gcd(x, y)
# 整数(x, y)最小公倍数を求める
def lcm(x, y):
return x * y // g... | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float("inf")
def inpl():
return list(map(int, input().split()))
# 整数(x, y)最大公約数を求める
def gcd(x, y):
if x % y == 0:
return y
else:
x, y = y, x % y
return gcd(x, y)
# 整数(x, y)最小公倍数を求める
def lcm(x, y):
return x * y // g... | false | 14.285714 | [
"- # 文字列Xのk * D + 1(k = 0 ~ L // D)番目の文字は",
"- # Sのk * D // ln + 1(k = 0 ~ D // lm)文字目と、",
"- # Tのk * D // lm + 1(k = 0 ~ D // ln)文字目の",
"- # 両方で使われる",
"+ # 文字列Xのk * lcm(L/N, L/M) (k = 0 ~ gcd(N, M) - 1)番目の文字は",
"+ # S[k * lcm(L/N, L/M) / (L/N)]と",
"+ # T[k * lcm(L/N, L/M) / (L/M)]で... | false | 0.074698 | 0.121986 | 0.612344 | [
"s106797816",
"s182172331"
] |
u726615467 | p03038 | python | s499543671 | s147831559 | 897 | 538 | 89,604 | 36,088 | Accepted | Accepted | 40.02 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
table = {}
for Ai in A:
table[str(Ai)] = 0
for Bi, Ci in BC:
table[str(Ci)] = 0
for Ai in A:
table[str(Ai)] += 1
for Bi, Ci in BC:
table[str(Ci)] += ... | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
A.sort()
BC.sort(key=lambda x: -x[1])
idx = 0
X = [0] * N
for Bi, Ci in BC:
for _ in range(Bi):
if idx >= N: break
X[idx] = Ci
idx += 1
#
... | 31 | 22 | 666 | 424 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
table = {}
for Ai in A:
table[str(Ai)] = 0
for Bi, Ci in BC:
table[str(Ci)] = 0
for Ai in A:
table[str(Ai)] += 1
for Bi, Ci in BC:
table[str(Ci)] += Bi
table2 = [(int(key),... | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
A.sort()
BC.sort(key=lambda x: -x[1])
idx = 0
X = [0] * N
for Bi, Ci in BC:
for _ in range(Bi):
if idx >= N:
break
X[idx] = Ci
idx += 1
#
if... | false | 29.032258 | [
"-table = {}",
"-for Ai in A:",
"- table[str(Ai)] = 0",
"+A.sort()",
"+BC.sort(key=lambda x: -x[1])",
"+idx = 0",
"+X = [0] * N",
"- table[str(Ci)] = 0",
"-for Ai in A:",
"- table[str(Ai)] += 1",
"-for Bi, Ci in BC:",
"- table[str(Ci)] += Bi",
"-table2 = [(int(key), value) for ke... | false | 0.039069 | 0.045701 | 0.854871 | [
"s499543671",
"s147831559"
] |
u572142121 | p02781 | python | s691302614 | s985378381 | 20 | 18 | 3,188 | 3,064 | Accepted | Accepted | 10 | N=eval(input())
K=int(eval(input()))
S="0"*(100-len(N))+N
DP=[[[0]*2 for _ in range(K+2)] for _ in range(101)]
DP[0][0][0] = 1
for i in range(100):
for j in range(K+1):
#SがN以下かわからないまま、「0」の文字をなぞるとき、0でない数字jはそのまま
if S[i]=='0':
DP[i+1][j][0]+=DP[i][j][0]
#SがN以下かわからないまま、「0」以外の文字をなぞるとき... | N=eval(input())
K=int(eval(input()))
S="0"*(100-len(N))+N
DP=[[[0]*2 for _ in range(K+2)] for _ in range(101)]
DP[0][0][0] = 1
for i in range(100):
for j in range(K+1):
#SがN以下かわからないまま、「0」の文字をなぞるとき、0でない数字jはそのまま
if S[i]=='0':
DP[i+1][j][0]+=DP[i][j][0]
#SがN以下かわからないまま、「0」以外の文字をなぞるとき... | 25 | 26 | 656 | 692 | N = eval(input())
K = int(eval(input()))
S = "0" * (100 - len(N)) + N
DP = [[[0] * 2 for _ in range(K + 2)] for _ in range(101)]
DP[0][0][0] = 1
for i in range(100):
for j in range(K + 1):
# SがN以下かわからないまま、「0」の文字をなぞるとき、0でない数字jはそのまま
if S[i] == "0":
DP[i + 1][j][0] += DP[i][j][0]
# ... | N = eval(input())
K = int(eval(input()))
S = "0" * (100 - len(N)) + N
DP = [[[0] * 2 for _ in range(K + 2)] for _ in range(101)]
DP[0][0][0] = 1
for i in range(100):
for j in range(K + 1):
# SがN以下かわからないまま、「0」の文字をなぞるとき、0でない数字jはそのまま
if S[i] == "0":
DP[i + 1][j][0] += DP[i][j][0]
# ... | false | 3.846154 | [
"- DP[i + 1][j][1] += DP[i][j][1]",
"- if int(S[i]) > 0:",
"- # 0以外の文字がくると、",
"- DP[i + 1][j][1] += DP[i][j][0]",
"+ DP[i + 1][j][1] += sum(DP[i][j])",
"+ if int(S[i]) == 0:",
"+ # あとは数字が同じとはいえ000…と埋めるしかないパターン",
"+ DP[i + 1][j][1]... | false | 0.04727 | 0.056666 | 0.834191 | [
"s691302614",
"s985378381"
] |
u024782094 | p02659 | python | s304916179 | s624240412 | 63 | 26 | 61,700 | 10,064 | Accepted | Accepted | 58.73 | a,b=list(map(float,input().split()))
a=int(a)
b=int(b*1000)
print(((a*b)//1000)) | from decimal import Decimal
a,b=list(map(Decimal,input().split()))
print((int(a*b))) | 4 | 3 | 75 | 78 | a, b = list(map(float, input().split()))
a = int(a)
b = int(b * 1000)
print(((a * b) // 1000))
| from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((int(a * b)))
| false | 25 | [
"-a, b = list(map(float, input().split()))",
"-a = int(a)",
"-b = int(b * 1000)",
"-print(((a * b) // 1000))",
"+from decimal import Decimal",
"+",
"+a, b = list(map(Decimal, input().split()))",
"+print((int(a * b)))"
] | false | 0.032674 | 0.037138 | 0.87981 | [
"s304916179",
"s624240412"
] |
u893063840 | p03862 | python | s661841941 | s870824655 | 112 | 94 | 14,252 | 20,048 | Accepted | Accepted | 16.07 | # -*- coding: utf-8 -*-
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = max(0, a[0] - x)
a[0] -= cnt
for i in range(1, n):
eat = max(0, a[i-1] + a[i] - x)
a[i] -= eat
cnt += eat
print(cnt)
| n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = max(0, a[0] - x)
a[0] -= cnt
for i in range(1, n):
cnt_now = max(0, a[i-1] + a[i] - x)
a[i] -= cnt_now
cnt += cnt_now
print(cnt)
| 13 | 11 | 243 | 228 | # -*- coding: utf-8 -*-
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = max(0, a[0] - x)
a[0] -= cnt
for i in range(1, n):
eat = max(0, a[i - 1] + a[i] - x)
a[i] -= eat
cnt += eat
print(cnt)
| n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = max(0, a[0] - x)
a[0] -= cnt
for i in range(1, n):
cnt_now = max(0, a[i - 1] + a[i] - x)
a[i] -= cnt_now
cnt += cnt_now
print(cnt)
| false | 15.384615 | [
"-# -*- coding: utf-8 -*-",
"- eat = max(0, a[i - 1] + a[i] - x)",
"- a[i] -= eat",
"- cnt += eat",
"+ cnt_now = max(0, a[i - 1] + a[i] - x)",
"+ a[i] -= cnt_now",
"+ cnt += cnt_now"
] | false | 0.18789 | 0.043315 | 4.337799 | [
"s661841941",
"s870824655"
] |
u539367121 | p02881 | python | s963074270 | s780947251 | 334 | 143 | 9,384 | 9,416 | Accepted | Accepted | 57.19 | n=int(eval(input()))
ans=float('inf')
a=1
while n**0.5>=a:
if n%a==0:
ans=min(ans,a+n//a-2)
a+=1
print(ans)
| n=int(eval(input()))
ans=float('inf')
for a in range(1,int(n**0.5+1)):
if n%a==0:
ans=min(ans,a+n//a-2)
print(ans)
| 8 | 6 | 117 | 120 | n = int(eval(input()))
ans = float("inf")
a = 1
while n**0.5 >= a:
if n % a == 0:
ans = min(ans, a + n // a - 2)
a += 1
print(ans)
| n = int(eval(input()))
ans = float("inf")
for a in range(1, int(n**0.5 + 1)):
if n % a == 0:
ans = min(ans, a + n // a - 2)
print(ans)
| false | 25 | [
"-a = 1",
"-while n**0.5 >= a:",
"+for a in range(1, int(n**0.5 + 1)):",
"- a += 1"
] | false | 0.095854 | 0.085298 | 1.123757 | [
"s963074270",
"s780947251"
] |
u218843509 | p03613 | python | s519712709 | s254263220 | 164 | 141 | 14,564 | 14,564 | Accepted | Accepted | 14.02 | from collections import Counter
from operator import itemgetter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
def num(n):
if n in list(c.keys()):
return c[n]
else:
return 0
ans = 0
for i in range(99998):
candidate = num(i) + num(i+1) + num(i+2)
if candidate > a... | from collections import Counter
from operator import itemgetter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
def num(n):
if n in list(c.keys()):
return c[n]
else:
return 0
candidate = num(0) + num(1) + num(2)
ans = candidate
for i in range(1, 99998):
candidate ... | 22 | 24 | 344 | 398 | from collections import Counter
from operator import itemgetter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
def num(n):
if n in list(c.keys()):
return c[n]
else:
return 0
ans = 0
for i in range(99998):
candidate = num(i) + num(i + 1) + num(i + 2)
if can... | from collections import Counter
from operator import itemgetter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
def num(n):
if n in list(c.keys()):
return c[n]
else:
return 0
candidate = num(0) + num(1) + num(2)
ans = candidate
for i in range(1, 99998):
candida... | false | 8.333333 | [
"-ans = 0",
"-for i in range(99998):",
"- candidate = num(i) + num(i + 1) + num(i + 2)",
"+candidate = num(0) + num(1) + num(2)",
"+ans = candidate",
"+for i in range(1, 99998):",
"+ candidate -= num(i - 1)",
"+ candidate += num(i + 2)"
] | false | 0.223184 | 0.176429 | 1.265004 | [
"s519712709",
"s254263220"
] |
u088552457 | p03835 | python | s631508549 | s622557053 | 1,554 | 277 | 2,940 | 41,196 | Accepted | Accepted | 82.18 | k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if z >= 0 and z <= k:
count += 1
print(count) | k, s = list(map(int, input().split()))
ans = 0
for x in range(k+1):
for y in range(k+1):
z = s - x - y
if x+y+z != s:
continue
if z >= 0 and z <= k:
ans += 1
print(ans) | 10 | 13 | 175 | 215 | k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if z >= 0 and z <= k:
count += 1
print(count)
| k, s = list(map(int, input().split()))
ans = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if x + y + z != s:
continue
if z >= 0 and z <= k:
ans += 1
print(ans)
| false | 23.076923 | [
"-count = 0",
"+ans = 0",
"+ if x + y + z != s:",
"+ continue",
"- count += 1",
"-print(count)",
"+ ans += 1",
"+print(ans)"
] | false | 0.076434 | 0.035105 | 2.177278 | [
"s631508549",
"s622557053"
] |
u638795007 | p03108 | python | s191087618 | s296873273 | 919 | 665 | 108,764 | 36,316 | Accepted | Accepted | 27.64 | class UnionFind():
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
#要素xが属するグループの根を返す
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
... | def ABC120_D():
class UnionFind():
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
# 要素xが属するグループの根を返す
if self.parent[x] < 0:
return x
else:
... | 83 | 96 | 2,108 | 2,805 | class UnionFind:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
# 要素xが属するグループの根を返す
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return sel... | def ABC120_D():
class UnionFind:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
# 要素xが属するグループの根を返す
if self.parent[x] < 0:
return x
else:
self.pare... | false | 13.541667 | [
"-class UnionFind:",
"- def __init__(self, n):",
"- self.parent = [-1 for _ in range(n)]",
"- # 正==子: 根の頂点番号 / 負==根: 連結頂点数",
"+def ABC120_D():",
"+ class UnionFind:",
"+ def __init__(self, n):",
"+ self.parent = [-1 for _ in range(n)]",
"+ # 正==子: 根の頂... | false | 0.040466 | 0.061666 | 0.656205 | [
"s191087618",
"s296873273"
] |
u767797498 | p02701 | python | s647916117 | s750430166 | 264 | 74 | 31,048 | 39,296 | Accepted | Accepted | 71.97 | # -*- coding: utf-8 -*-
import io
import sys
import math
def solve():
# implement process
pass
def main():
# input
n = int(eval(input()))
s_set = set()
for _ in range(n):
s_set.add(eval(input()))
# process
ans = str( len(s_set) )
# output
... | # -*- coding: utf-8 -*-
import io
import sys
import math
def solve():
# implement process
pass
def main():
# input
n, *a = open(0).read().split()
# process
s_list = list(a)
ans = str( len( set(s_list)) )
# output
print(ans)
return ans
#... | 57 | 55 | 921 | 893 | # -*- coding: utf-8 -*-
import io
import sys
import math
def solve():
# implement process
pass
def main():
# input
n = int(eval(input()))
s_set = set()
for _ in range(n):
s_set.add(eval(input()))
# process
ans = str(len(s_set))
# output
print(ans)
return ans
###... | # -*- coding: utf-8 -*-
import io
import sys
import math
def solve():
# implement process
pass
def main():
# input
n, *a = open(0).read().split()
# process
s_list = list(a)
ans = str(len(set(s_list)))
# output
print(ans)
return ans
### DEBUG I/O ###
_DEB = 0 # 1:ON / 0:OFF... | false | 3.508772 | [
"- n = int(eval(input()))",
"- s_set = set()",
"- for _ in range(n):",
"- s_set.add(eval(input()))",
"+ n, *a = open(0).read().split()",
"- ans = str(len(s_set))",
"+ s_list = list(a)",
"+ ans = str(len(set(s_list)))"
] | false | 0.040196 | 0.03538 | 1.136127 | [
"s647916117",
"s750430166"
] |
u775681539 | p03013 | python | s448181814 | s637388673 | 56 | 50 | 14,164 | 14,164 | Accepted | Accepted | 10.71 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, M, *a = list(map(int, read().split()))
A = set()
P = (10**9)+7
for i in a:
A.add(i)
dp = [0 for _ in range(N+1)]
dp[0] = 1
if not (1 i... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, M, *a = list(map(int, read().split()))
A = {i for i in a}
P = (10**9)+7
dp = [0]*(N+1)
dp[0] = 1
if not (1 in A):
dp[1] = 1
... | 27 | 25 | 538 | 498 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, M, *a = list(map(int, read().split()))
A = set()
P = (10**9) + 7
for i in a:
A.add(i)
dp = [0 for _ in range(N + 1)]
dp[0] = 1
if not (1 in A):
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, M, *a = list(map(int, read().split()))
A = {i for i in a}
P = (10**9) + 7
dp = [0] * (N + 1)
dp[0] = 1
if not (1 in A):
dp[1] = 1
for i in range(2, N ... | false | 7.407407 | [
"- A = set()",
"+ A = {i for i in a}",
"- for i in a:",
"- A.add(i)",
"- dp = [0 for _ in range(N + 1)]",
"+ dp = [0] * (N + 1)"
] | false | 0.036434 | 0.041261 | 0.883015 | [
"s448181814",
"s637388673"
] |
u392319141 | p03958 | python | s899864426 | s388473308 | 22 | 17 | 3,060 | 2,940 | Accepted | Accepted | 22.73 | from heapq import heapify, heappop, heappush
K, T = list(map(int, input().split()))
A = [-a for a in map(int, input().split())]
heapify(A)
while len(A) > 1:
a, b = -heappop(A), -heappop(A)
heappush(A, -(a - b))
print((max(0, -A[0] - 1))) | K, T = list(map(int, input().split()))
A = list(map(int, input().split()))
maxA = max(A)
ans = maxA - 1 - (K - maxA)
print((max(ans, 0))) | 11 | 5 | 250 | 133 | from heapq import heapify, heappop, heappush
K, T = list(map(int, input().split()))
A = [-a for a in map(int, input().split())]
heapify(A)
while len(A) > 1:
a, b = -heappop(A), -heappop(A)
heappush(A, -(a - b))
print((max(0, -A[0] - 1)))
| K, T = list(map(int, input().split()))
A = list(map(int, input().split()))
maxA = max(A)
ans = maxA - 1 - (K - maxA)
print((max(ans, 0)))
| false | 54.545455 | [
"-from heapq import heapify, heappop, heappush",
"-",
"-A = [-a for a in map(int, input().split())]",
"-heapify(A)",
"-while len(A) > 1:",
"- a, b = -heappop(A), -heappop(A)",
"- heappush(A, -(a - b))",
"-print((max(0, -A[0] - 1)))",
"+A = list(map(int, input().split()))",
"+maxA = max(A)",
... | false | 0.048078 | 0.108986 | 0.441135 | [
"s899864426",
"s388473308"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.