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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u947883560 | p02792 | python | s821514943 | s225833845 | 307 | 222 | 44,524 | 40,556 | Accepted | Accepted | 27.69 | #!/usr/bin/env python3
import sys
import math
INF = float("inf")
def solve(N: int):
debug = False
SN = str(N)
keta = int(math.log10(N)+1)
count = 0
for i in range(1, N+1):
first = str(i)[0]
last = str(i)[-1]
if last == "0": # 考えない
contin... | #!/usr/bin/env python3
import sys
import math
INF = float("inf")
def solve(N: int):
table = [[0]*10 for _ in range(10)]
for i in range(1, N+1):
first = int(str(i)[0])
last = int(str(i)[-1])
table[first][last] += 1
count = 0
for i in range(10):
for j in... | 59 | 35 | 1,401 | 682 | #!/usr/bin/env python3
import sys
import math
INF = float("inf")
def solve(N: int):
debug = False
SN = str(N)
keta = int(math.log10(N) + 1)
count = 0
for i in range(1, N + 1):
first = str(i)[0]
last = str(i)[-1]
if last == "0": # 考えない
continue
# ひとけた
... | #!/usr/bin/env python3
import sys
import math
INF = float("inf")
def solve(N: int):
table = [[0] * 10 for _ in range(10)]
for i in range(1, N + 1):
first = int(str(i)[0])
last = int(str(i)[-1])
table[first][last] += 1
count = 0
for i in range(10):
for j in range(10):
... | false | 40.677966 | [
"- debug = False",
"- SN = str(N)",
"- keta = int(math.log10(N) + 1)",
"+ table = [[0] * 10 for _ in range(10)]",
"+ for i in range(1, N + 1):",
"+ first = int(str(i)[0])",
"+ last = int(str(i)[-1])",
"+ table[first][last] += 1",
"- for i in range(1, N + 1):",
... | false | 0.215198 | 0.074959 | 2.870859 | [
"s821514943",
"s225833845"
] |
u509739538 | p02678 | python | s109524851 | s809250540 | 1,101 | 1,014 | 35,308 | 35,236 | Accepted | Accepted | 7.9 | import queue
n,m = list(map(int, input().split()))
puted = [0]*(n+1)
ab = [[] for i in range(n+1)]
for i in range(m):
a,b = list(map(int, input().split()))
ab[a].append(b)
ab[b].append(a)
q = queue.Queue()
flg = [-1]*n
flg[0] = 0
q.put(1)
while not q.empty():
item = q.get()
for i in ab[item]:... | import queue
n,m = list(map(int, input().split()))
puted = [1]*(n+1)
ab = [[] for i in range(n+1)]
for i in range(m):
a,b = list(map(int, input().split()))
ab[a].append(b)
ab[b].append(a)
q = queue.Queue()
flg = [-1]*n
flg[0] = 0
q.put(1)
while not q.empty():
item = q.get()
for i in ab[item]:... | 31 | 31 | 487 | 484 | import queue
n, m = list(map(int, input().split()))
puted = [0] * (n + 1)
ab = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
ab[a].append(b)
ab[b].append(a)
q = queue.Queue()
flg = [-1] * n
flg[0] = 0
q.put(1)
while not q.empty():
item = q.get()
for i in ab[it... | import queue
n, m = list(map(int, input().split()))
puted = [1] * (n + 1)
ab = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
ab[a].append(b)
ab[b].append(a)
q = queue.Queue()
flg = [-1] * n
flg[0] = 0
q.put(1)
while not q.empty():
item = q.get()
for i in ab[it... | false | 0 | [
"-puted = [0] * (n + 1)",
"+puted = [1] * (n + 1)",
"- if puted[i] == 0:",
"+ if puted[i]:",
"- puted[i] = 1",
"+ puted[i] = 0"
] | false | 0.040145 | 0.040193 | 0.998799 | [
"s109524851",
"s809250540"
] |
u562935282 | p03714 | python | s254960053 | s932241989 | 453 | 371 | 37,468 | 37,212 | Accepted | Accepted | 18.1 | from heapq import heapify, heappop, heappush
from collections import deque
n = int(eval(input()))
a = list(map(int, input().split()))
L = a[:n]
sum_l = [sum(L)]
heapify(L)
ML = a[n:2 * n]
ML = deque(ML)
R = list([(-1) * x for x in a[2 * n:]])
sum_r = [sum(R)] # あとでReverseする
heapify(R)
MR = list([... | def main():
from heapq import heappush, heappushpop
n = int(eval(input()))
*a, = list(map(int, input().split())) # [0,n),[n,2n),[2n,3n)
to_rm = [0] * (n * 3)
h = []
for x in a[:n]:
heappush(h, x)
mid = tuple(enumerate(a[n:n * 2], n))
t = 0
for i, x in mid... | 48 | 41 | 905 | 827 | from heapq import heapify, heappop, heappush
from collections import deque
n = int(eval(input()))
a = list(map(int, input().split()))
L = a[:n]
sum_l = [sum(L)]
heapify(L)
ML = a[n : 2 * n]
ML = deque(ML)
R = list([(-1) * x for x in a[2 * n :]])
sum_r = [sum(R)] # あとでReverseする
heapify(R)
MR = list([(-1) * x for x in ... | def main():
from heapq import heappush, heappushpop
n = int(eval(input()))
(*a,) = list(map(int, input().split())) # [0,n),[n,2n),[2n,3n)
to_rm = [0] * (n * 3)
h = []
for x in a[:n]:
heappush(h, x)
mid = tuple(enumerate(a[n : n * 2], n))
t = 0
for i, x in mid:
mi = ... | false | 14.583333 | [
"-from heapq import heapify, heappop, heappush",
"-from collections import deque",
"+def main():",
"+ from heapq import heappush, heappushpop",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-L = a[:n]",
"-sum_l = [sum(L)]",
"-heapify(L)",
"-ML = a[n : 2 * n]",
"-ML = deq... | false | 0.036024 | 0.037711 | 0.955273 | [
"s254960053",
"s932241989"
] |
u693953100 | p03612 | python | s623627092 | s465244914 | 87 | 57 | 14,008 | 14,008 | Accepted | Accepted | 34.48 | n = int(eval(input()))
cnt = 0
p = list(map(int,input().split()))
for i in range(n):
if p[i]==i+1:
if i==0:
p[i+1],p[i] = p[i],p[i+1]
cnt+=1
elif i==n-1:
cnt+=1
break
elif p[i]==i+2:
p[i-1],p[i] = p[i],p[i-1]
... | def solve():
n = int(eval(input()))
l = list(map(int,input().split()))
res = 0
for i in range(n-1):
if l[i]==i+1:
l[i],l[i+1]=l[i+1],l[i]
res+=1
if l[n-1]==n:
res+=1
print(res)
if __name__=='__main__':
solve() | 18 | 13 | 408 | 283 | n = int(eval(input()))
cnt = 0
p = list(map(int, input().split()))
for i in range(n):
if p[i] == i + 1:
if i == 0:
p[i + 1], p[i] = p[i], p[i + 1]
cnt += 1
elif i == n - 1:
cnt += 1
break
elif p[i] == i + 2:
p[i - 1], p[i] = p[i], p... | def solve():
n = int(eval(input()))
l = list(map(int, input().split()))
res = 0
for i in range(n - 1):
if l[i] == i + 1:
l[i], l[i + 1] = l[i + 1], l[i]
res += 1
if l[n - 1] == n:
res += 1
print(res)
if __name__ == "__main__":
solve()
| false | 27.777778 | [
"-n = int(eval(input()))",
"-cnt = 0",
"-p = list(map(int, input().split()))",
"-for i in range(n):",
"- if p[i] == i + 1:",
"- if i == 0:",
"- p[i + 1], p[i] = p[i], p[i + 1]",
"- cnt += 1",
"- elif i == n - 1:",
"- cnt += 1",
"- brea... | false | 0.074446 | 0.043337 | 1.717834 | [
"s623627092",
"s465244914"
] |
u188827677 | p02802 | python | s729156517 | s591653232 | 282 | 189 | 4,596 | 10,284 | Accepted | Accepted | 32.98 | n,m = list(map(int, input().split()))
result = [False]*n
count = [0]*n
for _ in range(m):
p,s = input().split()
p = int(p)-1
if not result[p]:
if s == "AC": result[p] = True
else: count[p] += 1
ng = 0
for i in range(n):
if result[i]:
ng += count[i]
print((result.count(True),ng... | n,m = list(map(int, input().split()))
flag = [False]*n
wa = [0]*n
for _ in range(m):
p,s = input().split()
p = int(p)-1
if not flag[p]:
if s == "WA":
wa[p] += 1
else: flag[p] = True
count = 0
for i in range(n):
if flag[i]: count += wa[i]
print((flag.count(True), count)) | 16 | 17 | 314 | 303 | n, m = list(map(int, input().split()))
result = [False] * n
count = [0] * n
for _ in range(m):
p, s = input().split()
p = int(p) - 1
if not result[p]:
if s == "AC":
result[p] = True
else:
count[p] += 1
ng = 0
for i in range(n):
if result[i]:
ng += count[i]... | n, m = list(map(int, input().split()))
flag = [False] * n
wa = [0] * n
for _ in range(m):
p, s = input().split()
p = int(p) - 1
if not flag[p]:
if s == "WA":
wa[p] += 1
else:
flag[p] = True
count = 0
for i in range(n):
if flag[i]:
count += wa[i]
print((fla... | false | 5.882353 | [
"-result = [False] * n",
"-count = [0] * n",
"+flag = [False] * n",
"+wa = [0] * n",
"- if not result[p]:",
"- if s == \"AC\":",
"- result[p] = True",
"+ if not flag[p]:",
"+ if s == \"WA\":",
"+ wa[p] += 1",
"- count[p] += 1",
"-ng = 0",
... | false | 0.040214 | 0.040687 | 0.98836 | [
"s729156517",
"s591653232"
] |
u562935282 | p03209 | python | s681403384 | s666362472 | 22 | 18 | 3,444 | 3,064 | Accepted | Accepted | 18.18 | from collections import defaultdict
def burger(lv, x):
if d[(lv, x)] >= 0:
return d[(lv, x)]
if x < 1 or x > cnt[lv]:
d[(lv, x)] = 0
return d[(lv, x)]
# base case
if (lv, x) == (0, 1):
d[(lv, x)] = 1
return d[(lv, x)]
half = (cnt[lv] - 1) ... | def burger(n, x):
if x < 1:
return 0
# base case
if (n, x) == (0, 1):
return 1
if x <= 1 + size[n - 1]:
return burger(n - 1, x - 1)
else:
return p_num[n - 1] + 1 + burger(n - 1, min(x - 2 - size[n - 1], size[n - 1]))
# x-2-sizeだと前lvバーガー+バンのことがあり、バンを外... | 33 | 22 | 725 | 507 | from collections import defaultdict
def burger(lv, x):
if d[(lv, x)] >= 0:
return d[(lv, x)]
if x < 1 or x > cnt[lv]:
d[(lv, x)] = 0
return d[(lv, x)]
# base case
if (lv, x) == (0, 1):
d[(lv, x)] = 1
return d[(lv, x)]
half = (cnt[lv] - 1) // 2
if x <= ha... | def burger(n, x):
if x < 1:
return 0
# base case
if (n, x) == (0, 1):
return 1
if x <= 1 + size[n - 1]:
return burger(n - 1, x - 1)
else:
return p_num[n - 1] + 1 + burger(n - 1, min(x - 2 - size[n - 1], size[n - 1]))
# x-2-sizeだと前lvバーガー+バンのことがあり、バンを外す
n, x = lis... | false | 33.333333 | [
"-from collections import defaultdict",
"-",
"-",
"-def burger(lv, x):",
"- if d[(lv, x)] >= 0:",
"- return d[(lv, x)]",
"- if x < 1 or x > cnt[lv]:",
"- d[(lv, x)] = 0",
"- return d[(lv, x)]",
"+def burger(n, x):",
"+ if x < 1:",
"+ return 0",
"- if (... | false | 0.046526 | 0.047396 | 0.981642 | [
"s681403384",
"s666362472"
] |
u780342333 | p02400 | python | s478310197 | s747908439 | 30 | 20 | 7,604 | 5,584 | Accepted | Accepted | 33.33 | import math
n = float(eval(input()))
area = "%.6f" % float(n **2 * math.pi)
circ = "%.6f" % float(n * 2 * math.pi)
print((area, circ)) | pi = 3.14159265359
r = float(eval(input()))
print(f"{r*r*pi:.6f} {2*r*pi:.6f}")
| 5 | 4 | 131 | 78 | import math
n = float(eval(input()))
area = "%.6f" % float(n**2 * math.pi)
circ = "%.6f" % float(n * 2 * math.pi)
print((area, circ))
| pi = 3.14159265359
r = float(eval(input()))
print(f"{r*r*pi:.6f} {2*r*pi:.6f}")
| false | 20 | [
"-import math",
"-",
"-n = float(eval(input()))",
"-area = \"%.6f\" % float(n**2 * math.pi)",
"-circ = \"%.6f\" % float(n * 2 * math.pi)",
"-print((area, circ))",
"+pi = 3.14159265359",
"+r = float(eval(input()))",
"+print(f\"{r*r*pi:.6f} {2*r*pi:.6f}\")"
] | false | 0.035914 | 0.0364 | 0.986664 | [
"s478310197",
"s747908439"
] |
u463068683 | p03478 | python | s037490493 | s695148664 | 42 | 35 | 9,056 | 9,084 | Accepted | Accepted | 16.67 | n,a,b = list(map(int, input().split()))
ans = 0
for i in range(n):
s = str(i+1)
tmp = 0
for j in s:
tmp += int(j)
ans += i+1 if a <= tmp <= b else 0
print(ans) | n,a,b = list(map(int, input().split()))
ans = 0
for i in range(n):
s = i+1
tmp = 0
while s > 0:
tmp += s%10
s = s//10
ans += i+1 if a <= tmp <= b else 0
print(ans) | 9 | 10 | 173 | 182 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(n):
s = str(i + 1)
tmp = 0
for j in s:
tmp += int(j)
ans += i + 1 if a <= tmp <= b else 0
print(ans)
| n, a, b = list(map(int, input().split()))
ans = 0
for i in range(n):
s = i + 1
tmp = 0
while s > 0:
tmp += s % 10
s = s // 10
ans += i + 1 if a <= tmp <= b else 0
print(ans)
| false | 10 | [
"- s = str(i + 1)",
"+ s = i + 1",
"- for j in s:",
"- tmp += int(j)",
"+ while s > 0:",
"+ tmp += s % 10",
"+ s = s // 10"
] | false | 0.049048 | 0.114515 | 0.428317 | [
"s037490493",
"s695148664"
] |
u580607517 | p02258 | python | s610904854 | s653169748 | 1,590 | 1,470 | 10,404 | 16,768 | Accepted | Accepted | 7.55 | R = [0 for i in range(0,200000)]
n = int(input())
for i in range(n):
R[i] = int(eval(input()))
maxv = -2000000000
minv = R[0]
for j in range(1, n):
maxv = max(maxv, R[j]-minv)
minv = min(minv, R[j])
print(maxv) | n = int(input())
R = [eval(input()) for i in range(n)]
maxv = -2000000000
minv = R[0]
for j in range(1, n):
maxv = max(maxv, R[j]-minv)
minv = min(minv, R[j])
print(maxv) | 10 | 8 | 224 | 178 | R = [0 for i in range(0, 200000)]
n = int(input())
for i in range(n):
R[i] = int(eval(input()))
maxv = -2000000000
minv = R[0]
for j in range(1, n):
maxv = max(maxv, R[j] - minv)
minv = min(minv, R[j])
print(maxv)
| n = int(input())
R = [eval(input()) for i in range(n)]
maxv = -2000000000
minv = R[0]
for j in range(1, n):
maxv = max(maxv, R[j] - minv)
minv = min(minv, R[j])
print(maxv)
| false | 20 | [
"-R = [0 for i in range(0, 200000)]",
"-for i in range(n):",
"- R[i] = int(eval(input()))",
"+R = [eval(input()) for i in range(n)]"
] | false | 0.049601 | 0.045917 | 1.08025 | [
"s610904854",
"s653169748"
] |
u644516473 | p02762 | python | s587630781 | s023809765 | 807 | 724 | 79,824 | 90,716 | Accepted | Accepted | 10.29 | import sys
from collections import deque
readline = sys.stdin.readline
n, m, k = list(map(int, readline().split()))
friend = [set() for i in range(n)]
not_friend = [set() for i in range(n)]
for i in range(m):
a, b = list(map(int, readline().split()))
a -= 1
b -= 1
friend[a].add(b)
fri... | import sys
class UnionFind():
def __init__(self, n):
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | 41 | 53 | 1,052 | 1,231 | import sys
from collections import deque
readline = sys.stdin.readline
n, m, k = list(map(int, readline().split()))
friend = [set() for i in range(n)]
not_friend = [set() for i in range(n)]
for i in range(m):
a, b = list(map(int, readline().split()))
a -= 1
b -= 1
friend[a].add(b)
friend[b].add(a)
... | import sys
class UnionFind:
def __init__(self, n):
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.fin... | false | 22.641509 | [
"-from collections import deque",
"+",
"+",
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.parents = [-1] * n",
"+",
"+ def find(self, x):",
"+ if self.parents[x] < 0:",
"+ return x",
"+ else:",
"+ self.parents[x] = self.find(self.pare... | false | 0.048501 | 0.048639 | 0.997166 | [
"s587630781",
"s023809765"
] |
u404678206 | p02711 | python | s211843564 | s895175423 | 23 | 20 | 9,096 | 8,952 | Accepted | Accepted | 13.04 | n=eval(input())
print(('Yes' if '7' in n else 'No')) | print(('Yes' if '7' in eval(input()) else 'No')) | 2 | 1 | 45 | 40 | n = eval(input())
print(("Yes" if "7" in n else "No"))
| print(("Yes" if "7" in eval(input()) else "No"))
| false | 50 | [
"-n = eval(input())",
"-print((\"Yes\" if \"7\" in n else \"No\"))",
"+print((\"Yes\" if \"7\" in eval(input()) else \"No\"))"
] | false | 0.044377 | 0.093788 | 0.473158 | [
"s211843564",
"s895175423"
] |
u729133443 | p03987 | python | s373096848 | s421452763 | 1,259 | 980 | 25,884 | 101,564 | Accepted | Accepted | 22.16 | import bisect
class BTreeNode:
def __init__(self):
self.key = []
self.child = []
class BTree:
def __init__(self):
self.root = BTreeNode()
def search_higher(self, key):
ptr = self.root
ret = None
while ptr.child:
i = bisect.bis... | from bisect import*
class BTreeNode:
def __init__(self):self.key,self.child=[],[]
class BTree:
def __init__(self):self.root=BTreeNode()
def search_higher(self,key):
ptr=self.root
ret=None
while ptr.child:
i=bisect(ptr.key,key)
if i!=len(ptr.key):ret=... | 94 | 68 | 2,776 | 2,195 | import bisect
class BTreeNode:
def __init__(self):
self.key = []
self.child = []
class BTree:
def __init__(self):
self.root = BTreeNode()
def search_higher(self, key):
ptr = self.root
ret = None
while ptr.child:
i = bisect.bisect_right(ptr.key... | from bisect import *
class BTreeNode:
def __init__(self):
self.key, self.child = [], []
class BTree:
def __init__(self):
self.root = BTreeNode()
def search_higher(self, key):
ptr = self.root
ret = None
while ptr.child:
i = bisect(ptr.key, key)
... | false | 27.659574 | [
"-import bisect",
"+from bisect import *",
"- self.key = []",
"- self.child = []",
"+ self.key, self.child = [], []",
"- i = bisect.bisect_right(ptr.key, key)",
"+ i = bisect(ptr.key, key)",
"- i = bisect.bisect_right(ptr.key, key)",
"+ i = bi... | false | 0.036944 | 0.037905 | 0.974633 | [
"s373096848",
"s421452763"
] |
u222668979 | p03593 | python | s455937380 | s394536508 | 33 | 30 | 9,396 | 9,464 | Accepted | Accepted | 9.09 | from collections import Counter
h, w = list(map(int, input().split()))
a = Counter(''.join(eval(input()) for _ in range(h)))
center = h * w % 2
side = (h // 2) * (w % 2) + (w // 2) * (h % 2)
cnt = 0
for i in a:
if a[i] % 2 == 1:
a[i] -= 1
cnt += 1
if cnt != center:
print('No')
... | from collections import Counter
h, w = list(map(int, input().split()))
a = Counter(''.join(eval(input()) for _ in range(h)))
center = h * w % 2
side = (h // 2) * (w % 2) + (w // 2) * (h % 2)
cnt = 0
for i in a:
if a[i] % 2 == 1:
a[i] -= 1
cnt += 1
if cnt != center:
print('No')
... | 27 | 18 | 507 | 386 | from collections import Counter
h, w = list(map(int, input().split()))
a = Counter("".join(eval(input()) for _ in range(h)))
center = h * w % 2
side = (h // 2) * (w % 2) + (w // 2) * (h % 2)
cnt = 0
for i in a:
if a[i] % 2 == 1:
a[i] -= 1
cnt += 1
if cnt != center:
print("No")
exit()
cnt = ... | from collections import Counter
h, w = list(map(int, input().split()))
a = Counter("".join(eval(input()) for _ in range(h)))
center = h * w % 2
side = (h // 2) * (w % 2) + (w // 2) * (h % 2)
cnt = 0
for i in a:
if a[i] % 2 == 1:
a[i] -= 1
cnt += 1
if cnt != center:
print("No")
exit()
print(... | false | 33.333333 | [
"-cnt = 0",
"-for i in a:",
"- if a[i] % 4 == 2:",
"- a[i] -= 2",
"- cnt += 1",
"-if cnt > side:",
"- print(\"No\")",
"- exit()",
"-print((\"Yes\" if sum(a[i] % 4 for i in a) == 0 else \"No\"))",
"+print((\"Yes\" if sum(a[i] % 4 == 2 for i in a) <= side else \"No\"))"
] | false | 0.046109 | 0.045791 | 1.00694 | [
"s455937380",
"s394536508"
] |
u467736898 | p02822 | python | s273071945 | s709377118 | 1,390 | 556 | 87,672 | 79,712 | Accepted | Accepted | 60 | import os
import sys
import numpy as np
def solve(N, AB):
mod = 10**9+7
half = mod // 2 + 1
G = [[0]*0 for _ in range(N+1)]
for i in range(len(AB)):
a, b = AB[i]
G[a].append(b)
G[b].append(a)
P = [0] * (N+1)
Size = [0] * (N+1)
def dfs(v):
# siz... | import os
import sys
import numpy as np
def solve(N, AB):
mod = 10**9+7
half = mod // 2 + 1
G = [[0]*0 for _ in range(N+1)]
for i in range(len(AB)):
a, b = AB[i]
G[a].append(b)
G[b].append(a)
P = np.zeros(N+1, dtype=np.int64)
Size = np.zeros(N+1, dtype=np.in... | 88 | 111 | 2,233 | 3,020 | import os
import sys
import numpy as np
def solve(N, AB):
mod = 10**9 + 7
half = mod // 2 + 1
G = [[0] * 0 for _ in range(N + 1)]
for i in range(len(AB)):
a, b = AB[i]
G[a].append(b)
G[b].append(a)
P = [0] * (N + 1)
Size = [0] * (N + 1)
def dfs(v):
# siz = ... | import os
import sys
import numpy as np
def solve(N, AB):
mod = 10**9 + 7
half = mod // 2 + 1
G = [[0] * 0 for _ in range(N + 1)]
for i in range(len(AB)):
a, b = AB[i]
G[a].append(b)
G[b].append(a)
P = np.zeros(N + 1, dtype=np.int64)
Size = np.zeros(N + 1, dtype=np.int6... | false | 20.720721 | [
"- P = [0] * (N + 1)",
"- Size = [0] * (N + 1)",
"+ P = np.zeros(N + 1, dtype=np.int64)",
"+ Size = np.zeros(N + 1, dtype=np.int64)",
"- Prob = [0]",
"+ Prob = np.empty(202020, dtype=np.int64)",
"+ Prob[i] = 1 - h + mod",
"- Prob.append(1 - h)",
"- cp = cp ... | false | 0.293171 | 0.226008 | 1.29717 | [
"s273071945",
"s709377118"
] |
u367130284 | p03775 | python | s820638415 | s504137258 | 186 | 31 | 39,024 | 3,064 | Accepted | Accepted | 83.33 | import math
n=int(eval(input()))
l=[]
for i in range(1,int(math.sqrt(n))+2):
if n%i==0:
l+=[max(len(str(i)),len(str(n//i)))]
print((min(l))) | n=int(eval(input()))
l=[]
for i in range(1,int(n**0.5)+3):
if n%i==0:
l.append(max(len(str(i)),len(str(n//i))))
print((min(l))) | 7 | 6 | 150 | 136 | import math
n = int(eval(input()))
l = []
for i in range(1, int(math.sqrt(n)) + 2):
if n % i == 0:
l += [max(len(str(i)), len(str(n // i)))]
print((min(l)))
| n = int(eval(input()))
l = []
for i in range(1, int(n**0.5) + 3):
if n % i == 0:
l.append(max(len(str(i)), len(str(n // i))))
print((min(l)))
| false | 14.285714 | [
"-import math",
"-",
"-for i in range(1, int(math.sqrt(n)) + 2):",
"+for i in range(1, int(n**0.5) + 3):",
"- l += [max(len(str(i)), len(str(n // i)))]",
"+ l.append(max(len(str(i)), len(str(n // i))))"
] | false | 0.122639 | 0.040889 | 2.999333 | [
"s820638415",
"s504137258"
] |
u933096856 | p02418 | python | s219148017 | s432193246 | 50 | 20 | 7,556 | 7,580 | Accepted | Accepted | 60 | s,p=[eval(input()) for i in range(2)]
s=s*3
if p in s:
print('Yes')
else:
print('No') | s,p=[eval(input()) for i in range(2)]
s=s*2
if p in s:
print('Yes')
else:
print('No') | 6 | 6 | 92 | 92 | s, p = [eval(input()) for i in range(2)]
s = s * 3
if p in s:
print("Yes")
else:
print("No")
| s, p = [eval(input()) for i in range(2)]
s = s * 2
if p in s:
print("Yes")
else:
print("No")
| false | 0 | [
"-s = s * 3",
"+s = s * 2"
] | false | 0.110831 | 0.043207 | 2.565094 | [
"s219148017",
"s432193246"
] |
u046187684 | p03045 | python | s694772408 | s718072844 | 398 | 327 | 44,704 | 34,872 | Accepted | Accepted | 17.84 | from scipy.sparse import csr_matrix as csr
from scipy.sparse.csgraph import connected_components as cc
def solve(string):
n, m, *xyz = list(map(int, string.split()))
return str(cc(csr(([1] * m, (xyz[::3], xyz[1::3])), shape=(n + 1, n + 1)))[0] - 1)
if __name__ == '__main__':
n, m = list(map(in... | def solve(string):
n, m, *xyz = list(map(int, string.split()))
t = [-1] * (n + 1)
for x, y, z in zip(*[iter(xyz)] * 3):
def union(r1, r2):
new_root = min(r1, r2)
if r1 != r2:
t[max(r1, r2)] = new_root
def find(x):
if t[x] < 0:
... | 12 | 23 | 411 | 617 | from scipy.sparse import csr_matrix as csr
from scipy.sparse.csgraph import connected_components as cc
def solve(string):
n, m, *xyz = list(map(int, string.split()))
return str(cc(csr(([1] * m, (xyz[::3], xyz[1::3])), shape=(n + 1, n + 1)))[0] - 1)
if __name__ == "__main__":
n, m = list(map(int, input()... | def solve(string):
n, m, *xyz = list(map(int, string.split()))
t = [-1] * (n + 1)
for x, y, z in zip(*[iter(xyz)] * 3):
def union(r1, r2):
new_root = min(r1, r2)
if r1 != r2:
t[max(r1, r2)] = new_root
def find(x):
if t[x] < 0:
... | false | 47.826087 | [
"-from scipy.sparse import csr_matrix as csr",
"-from scipy.sparse.csgraph import connected_components as cc",
"-",
"-",
"- return str(cc(csr(([1] * m, (xyz[::3], xyz[1::3])), shape=(n + 1, n + 1)))[0] - 1)",
"+ t = [-1] * (n + 1)",
"+ for x, y, z in zip(*[iter(xyz)] * 3):",
"+",
"+ ... | false | 0.257289 | 0.037107 | 6.933738 | [
"s694772408",
"s718072844"
] |
u888092736 | p02716 | python | s233953995 | s237649854 | 690 | 599 | 58,312 | 58,476 | Accepted | Accepted | 13.19 | n = int(eval(input()))
A = list(map(int, input().split()))
inf = 10 ** 18
dp = [[-inf] * 3 for _ in range(n + 1)]
k = 1 + n % 2
dp[0][0] = 0
for i in range(n):
for j in range(k + 1):
if j < k:
dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j])
now = dp[i][j]
if (i... | from math import inf
n = int(eval(input()))
A = list(map(int, input().split()))
dp = [[-inf] * 3 for _ in range(n + 1)]
k = 1 + n % 2
dp[0][0] = 0
for i in range(n):
for j in range(k + 1):
if j < k:
dp[i + 1][j + 1] = dp[i][j]
now = dp[i][j]
if (i + j) % 2 == 0:... | 17 | 18 | 419 | 404 | n = int(eval(input()))
A = list(map(int, input().split()))
inf = 10**18
dp = [[-inf] * 3 for _ in range(n + 1)]
k = 1 + n % 2
dp[0][0] = 0
for i in range(n):
for j in range(k + 1):
if j < k:
dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j])
now = dp[i][j]
if (i + j) % 2 == 0:
... | from math import inf
n = int(eval(input()))
A = list(map(int, input().split()))
dp = [[-inf] * 3 for _ in range(n + 1)]
k = 1 + n % 2
dp[0][0] = 0
for i in range(n):
for j in range(k + 1):
if j < k:
dp[i + 1][j + 1] = dp[i][j]
now = dp[i][j]
if (i + j) % 2 == 0:
now ... | false | 5.555556 | [
"+from math import inf",
"+",
"-inf = 10**18",
"- dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j])",
"+ dp[i + 1][j + 1] = dp[i][j]"
] | false | 0.046454 | 0.04719 | 0.984394 | [
"s233953995",
"s237649854"
] |
u227550284 | p02688 | python | s710979962 | s288745709 | 23 | 21 | 9,096 | 9,208 | Accepted | Accepted | 8.7 | import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().split()))
li = []
for i in range(k):
d = int(eval(input()))
a_li = list(map(int, input().split()))
li += a_li
print((n - len(set(li))))
if __name__ == '__main__':
main()
| n, k = list(map(int, input().split()))
li = []
for i in range(k):
d = int(eval(input()))
a_li = list(map(int, input().split()))
li += a_li
print((n - len(set(li))))
| 18 | 10 | 302 | 175 | import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().split()))
li = []
for i in range(k):
d = int(eval(input()))
a_li = list(map(int, input().split()))
li += a_li
print((n - len(set(li))))
if __name__ == "__main__":
main()
| n, k = list(map(int, input().split()))
li = []
for i in range(k):
d = int(eval(input()))
a_li = list(map(int, input().split()))
li += a_li
print((n - len(set(li))))
| false | 44.444444 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"-def main():",
"- n, k = list(map(int, input().split()))",
"- li = []",
"- for i in range(k):",
"- d = int(eval(input()))",
"- a_li = list(map(int, input().split()))",
"- li += a_li",
"- print((n -... | false | 0.041918 | 0.113928 | 0.36794 | [
"s710979962",
"s288745709"
] |
u119148115 | p03747 | python | s319647330 | s594937694 | 176 | 146 | 92,388 | 94,772 | Accepted | Accepted | 17.05 | import sys
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,L,T = MI()
q,r = T//L,T % L
A = []
a = 0 # 開始時点で、(時計回りの蟻の数)-(半時計まわりの蟻)
for i in range(N):
x,w = MI()
if w == 1:
a += 1
for j in range(-1,2):
A.append(x+r+j*L)
else:
a -= 1... | import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
N,L,T = MI()
q,r = T//L,T % L
A = []
a = 0 # 開始時点で、(時計回りの蟻の数)-(半時計まわりの蟻)
for i in range(N):
x,w = MI()
a += (-2)*w+3
for j in range(-1,2):
A.append(x+r*((-2)*w+3)+j*L)
A.sort()
print(*[A[N+(i+q*a)%N] % L fo... | 22 | 16 | 476 | 347 | import sys
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, L, T = MI()
q, r = T // L, T % L
A = []
a = 0 # 開始時点で、(時計回りの蟻の数)-(半時計まわりの蟻)
for i in range(N):
x, w = MI()
if w == 1:
a += 1
for j in range(-1, 2):
A.append(x + r + j * L)
else:
... | import sys
def MI():
return map(int, sys.stdin.readline().rstrip().split())
N, L, T = MI()
q, r = T // L, T % L
A = []
a = 0 # 開始時点で、(時計回りの蟻の数)-(半時計まわりの蟻)
for i in range(N):
x, w = MI()
a += (-2) * w + 3
for j in range(-1, 2):
A.append(x + r * ((-2) * w + 3) + j * L)
A.sort()
print(*[A[N + ... | false | 27.272727 | [
"- return list(map(int, sys.stdin.readline().rstrip().split()))",
"+ return map(int, sys.stdin.readline().rstrip().split())",
"- if w == 1:",
"- a += 1",
"- for j in range(-1, 2):",
"- A.append(x + r + j * L)",
"- else:",
"- a -= 1",
"- for j in ran... | false | 0.071858 | 0.043688 | 1.64479 | [
"s319647330",
"s594937694"
] |
u380772254 | p03142 | python | s881359382 | s941831819 | 544 | 492 | 79,920 | 69,552 | Accepted | Accepted | 9.56 | import sys
def I(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')
N, M = MI()
nl = [list() for _ in range(N + 1)]
rev = [list() for _ in range(N + 1)]
deg... | import sys
def I(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')
# トポロジカルソート
# deg[i] := 頂点iの入次数
# returns := トポロジカルソートされた頂点番号のリスト
def tsort(deg, nl):
... | 43 | 45 | 914 | 992 | import sys
def I():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LMI():
return list(map(int, sys.stdin.readline().split()))
MOD = 10**9 + 7
INF = float("inf")
N, M = MI()
nl = [list() for _ in range(N + 1)]
rev = [list() for _ in range(N + 1)]
de... | import sys
def I():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LMI():
return list(map(int, sys.stdin.readline().split()))
MOD = 10**9 + 7
INF = float("inf")
# トポロジカルソート
# deg[i] := 頂点iの入次数
# returns := トポロジカルソートされた頂点番号のリスト
def tsort(deg, nl):
... | false | 4.444444 | [
"+# トポロジカルソート",
"+# deg[i] := 頂点iの入次数",
"+# returns := トポロジカルソートされた頂点番号のリスト",
"+def tsort(deg, nl):",
"+ tsorted = list()",
"+ stack = [i for i, x in enumerate(deg) if x == 0]",
"+ while len(stack) > 0:",
"+ v = stack.pop()",
"+ tsorted.append(v)",
"+ for next_v in nl... | false | 0.036924 | 0.037355 | 0.988474 | [
"s881359382",
"s941831819"
] |
u691018832 | p03031 | python | s919141965 | s308420946 | 47 | 31 | 3,188 | 3,064 | Accepted | Accepted | 34.04 | import sys
import itertools
input = sys.stdin.readline
n, m = list(map(int, input().split()))
s = []
p = [0] * m
cnt_k = 0
cnt_j = 0
ans = 0
for i in range(m):
s_k = list(map(int, input().split()))
s.append(s_k)
p = list(map(int, input().split()))
memo = list(itertools.product([0, 1], r... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from itertools import product
n, m = list(map(int, readline().split()))
ks = [list(map(int, readline().split()))[1:] for _ in range(m)]
p = list(map(int, readlin... | 33 | 24 | 630 | 616 | import sys
import itertools
input = sys.stdin.readline
n, m = list(map(int, input().split()))
s = []
p = [0] * m
cnt_k = 0
cnt_j = 0
ans = 0
for i in range(m):
s_k = list(map(int, input().split()))
s.append(s_k)
p = list(map(int, input().split()))
memo = list(itertools.product([0, 1], repeat=n))
for i in range... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from itertools import product
n, m = list(map(int, readline().split()))
ks = [list(map(int, readline().split()))[1:] for _ in range(m)]
p = list(map(int, readline().split())... | false | 27.272727 | [
"-import itertools",
"-input = sys.stdin.readline",
"-n, m = list(map(int, input().split()))",
"-s = []",
"-p = [0] * m",
"-cnt_k = 0",
"-cnt_j = 0",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+sys.setrecursionlimit(10**7... | false | 0.034464 | 0.037361 | 0.922478 | [
"s919141965",
"s308420946"
] |
u624689667 | p03164 | python | s994404373 | s883211853 | 1,140 | 712 | 312,648 | 176,708 | Accepted | Accepted | 37.54 | import collections
MAX_N = 110
MAX_V = 100100
Item = collections.namedtuple("Item", ("weight", "value"))
def main():
N, W = [int(i) for i in input().split()]
items = [Item(int(i), int(j)) for (i, j) in [input().split() for _ in range(N)]]
dp = [[float('inf')] * MAX_V for _ in range(MAX_N)]
... | import sys
import numpy as np
input = sys.stdin.readline
def main():
N, W = [int(i) for i in input().strip().split()]
MAX_V = 10**3 * N
dp = np.full([N + 1, MAX_V + 1], np.inf)
dp[0][0] = 0
for n in range(N):
w, v = [int(i) for i in input().strip().split()]
dp[n + 1... | 33 | 23 | 822 | 491 | import collections
MAX_N = 110
MAX_V = 100100
Item = collections.namedtuple("Item", ("weight", "value"))
def main():
N, W = [int(i) for i in input().split()]
items = [Item(int(i), int(j)) for (i, j) in [input().split() for _ in range(N)]]
dp = [[float("inf")] * MAX_V for _ in range(MAX_N)]
dp[0][0] =... | import sys
import numpy as np
input = sys.stdin.readline
def main():
N, W = [int(i) for i in input().strip().split()]
MAX_V = 10**3 * N
dp = np.full([N + 1, MAX_V + 1], np.inf)
dp[0][0] = 0
for n in range(N):
w, v = [int(i) for i in input().strip().split()]
dp[n + 1] = dp[n]
... | false | 30.30303 | [
"-import collections",
"+import sys",
"+import numpy as np",
"-MAX_N = 110",
"-MAX_V = 100100",
"-Item = collections.namedtuple(\"Item\", (\"weight\", \"value\"))",
"+input = sys.stdin.readline",
"- N, W = [int(i) for i in input().split()]",
"- items = [Item(int(i), int(j)) for (i, j) in [inpu... | false | 1.063825 | 0.278589 | 3.818614 | [
"s994404373",
"s883211853"
] |
u796942881 | p03087 | python | s649602491 | s364579935 | 194 | 169 | 23,648 | 23,648 | Accepted | Accepted | 12.89 | from sys import stdin
def main():
readline = stdin.readline
read = stdin.read
N, Q = list(map(int, readline().split()))
S = readline().strip()
* LR, = [int(x) - 1 for x in read().split()]
AC = []
pre = None
cnt = 0
for c in S:
if c == "A":
pre = "A... | from sys import stdin
def main():
readline = stdin.readline
read = stdin.read
N, Q = list(map(int, readline().split()))
S = readline().strip()
LR = [int(x) - 1 for x in read().split()]
AC = []
pre = None
cnt = 0
for c in S:
if c == "A":
pre = "A"
... | 27 | 27 | 573 | 566 | from sys import stdin
def main():
readline = stdin.readline
read = stdin.read
N, Q = list(map(int, readline().split()))
S = readline().strip()
(*LR,) = [int(x) - 1 for x in read().split()]
AC = []
pre = None
cnt = 0
for c in S:
if c == "A":
pre = "A"
eli... | from sys import stdin
def main():
readline = stdin.readline
read = stdin.read
N, Q = list(map(int, readline().split()))
S = readline().strip()
LR = [int(x) - 1 for x in read().split()]
AC = []
pre = None
cnt = 0
for c in S:
if c == "A":
pre = "A"
elif pr... | false | 0 | [
"- (*LR,) = [int(x) - 1 for x in read().split()]",
"+ LR = [int(x) - 1 for x in read().split()]"
] | false | 0.046882 | 0.047692 | 0.983022 | [
"s649602491",
"s364579935"
] |
u631277801 | p03964 | python | s576010605 | s143931181 | 23 | 21 | 3,316 | 3,188 | Accepted | Accepted | 8.7 | N = int(eval(input()))
TA = []
for i in range(N):
TA.append(list(map(int, input().split())))
t_real = [TA[0][0]]
a_real = [TA[0][1]]
for i in range(1,N):
t_cand = (t_real[i-1]//TA[i][0] + bool(t_real[i-1]%TA[i][0])) * TA[i][0]
a_cand = (a_real[i-1]//TA[i][1] + bool(a_real[i-1]%TA[i][1])) * TA[i]... | import sys
sdin = sys.stdin.readline
INF = float("inf")
n = int(sdin())
ta = []
for _ in range(n):
ta.append(tuple(map(int, sdin().split())))
t_real = [ta[0][0]]
a_real = [ta[0][1]]
for i in range(1,n):
t_k = t_real[i-1]//ta[i][0] + bool(t_real[i-1]%ta[i][0])
a_k = a_real[i-1]//ta... | 24 | 41 | 690 | 992 | N = int(eval(input()))
TA = []
for i in range(N):
TA.append(list(map(int, input().split())))
t_real = [TA[0][0]]
a_real = [TA[0][1]]
for i in range(1, N):
t_cand = (t_real[i - 1] // TA[i][0] + bool(t_real[i - 1] % TA[i][0])) * TA[i][0]
a_cand = (a_real[i - 1] // TA[i][1] + bool(a_real[i - 1] % TA[i][1])) * ... | import sys
sdin = sys.stdin.readline
INF = float("inf")
n = int(sdin())
ta = []
for _ in range(n):
ta.append(tuple(map(int, sdin().split())))
t_real = [ta[0][0]]
a_real = [ta[0][1]]
for i in range(1, n):
t_k = t_real[i - 1] // ta[i][0] + bool(t_real[i - 1] % ta[i][0])
a_k = a_real[i - 1] // ta[i][1] + bool... | false | 41.463415 | [
"-N = int(eval(input()))",
"-TA = []",
"-for i in range(N):",
"- TA.append(list(map(int, input().split())))",
"-t_real = [TA[0][0]]",
"-a_real = [TA[0][1]]",
"-for i in range(1, N):",
"- t_cand = (t_real[i - 1] // TA[i][0] + bool(t_real[i - 1] % TA[i][0])) * TA[i][0]",
"- a_cand = (a_real[i... | false | 0.089895 | 0.098274 | 0.914742 | [
"s576010605",
"s143931181"
] |
u633068244 | p00121 | python | s820701826 | s773210683 | 120 | 110 | 6,076 | 6,160 | Accepted | Accepted | 8.33 | move = [[1,4],[0,2,5],[1,3,6],[2,7],[0,5],[4,1,6],[5,2,7],[6,3]]
def swap(ls,p,q):
res = list(ls)
res[p],res[q] = res[q],res[p]
return "".join(res)
ans = {"01234567":0}
que = [["01234567",0]]
while que:
pzl,count = que.pop(0)
p = pzl.find("0")
for q in move[p]:
tmp = swap(... | move = [[1,4],[0,2,5],[1,3,6],[2,7],[0,5],[4,1,6],[5,2,7],[6,3]]
ans = {"01234567":0}
que = [["01234567",0]]
while que:
pzl,count = que.pop(0)
p = pzl.find("0")
for q in move[p]:
a,b = min(p,q),max(p,q)
tmp = pzl[:a]+pzl[b]+pzl[a+1:b]+pzl[a]+pzl[b+1:]
if tmp not in ans:
... | 23 | 19 | 525 | 486 | move = [[1, 4], [0, 2, 5], [1, 3, 6], [2, 7], [0, 5], [4, 1, 6], [5, 2, 7], [6, 3]]
def swap(ls, p, q):
res = list(ls)
res[p], res[q] = res[q], res[p]
return "".join(res)
ans = {"01234567": 0}
que = [["01234567", 0]]
while que:
pzl, count = que.pop(0)
p = pzl.find("0")
for q in move[p]:
... | move = [[1, 4], [0, 2, 5], [1, 3, 6], [2, 7], [0, 5], [4, 1, 6], [5, 2, 7], [6, 3]]
ans = {"01234567": 0}
que = [["01234567", 0]]
while que:
pzl, count = que.pop(0)
p = pzl.find("0")
for q in move[p]:
a, b = min(p, q), max(p, q)
tmp = pzl[:a] + pzl[b] + pzl[a + 1 : b] + pzl[a] + pzl[b + 1 :]... | false | 17.391304 | [
"-",
"-",
"-def swap(ls, p, q):",
"- res = list(ls)",
"- res[p], res[q] = res[q], res[p]",
"- return \"\".join(res)",
"-",
"-",
"- tmp = swap(pzl, p, q)",
"+ a, b = min(p, q), max(p, q)",
"+ tmp = pzl[:a] + pzl[b] + pzl[a + 1 : b] + pzl[a] + pzl[b + 1 :]"
] | false | 0.253509 | 0.318528 | 0.795878 | [
"s820701826",
"s773210683"
] |
u724563664 | p02720 | python | s852954855 | s268212523 | 247 | 223 | 3,188 | 3,064 | Accepted | Accepted | 9.72 | #coding:utf-8
def up(nums):
if len(nums) == nums.count(9):
nums = [1] + [0] * len(nums)
return nums
for i in list(reversed(list(range(len(nums))))):
if nums[i] > nums[i-1] or nums[i] == 9:
continue
else:
nums[i] += 1
for j in ... | #coding:utf-8
def up(nums):
if len(nums) == nums.count(9):
nums = [1] + [0] * len(nums)
return nums
for i in list(reversed(list(range(len(nums))))):
if nums[i] > nums[i-1] or nums[i] == 9:
continue
else:
nums[i] += 1
for j in ... | 39 | 30 | 876 | 652 | # coding:utf-8
def up(nums):
if len(nums) == nums.count(9):
nums = [1] + [0] * len(nums)
return nums
for i in list(reversed(list(range(len(nums))))):
if nums[i] > nums[i - 1] or nums[i] == 9:
continue
else:
nums[i] += 1
for j in range(i + 1, le... | # coding:utf-8
def up(nums):
if len(nums) == nums.count(9):
nums = [1] + [0] * len(nums)
return nums
for i in list(reversed(list(range(len(nums))))):
if nums[i] > nums[i - 1] or nums[i] == 9:
continue
else:
nums[i] += 1
for j in range(i + 1, le... | false | 23.076923 | [
"- if j == len(nums) - 1:",
"- nums[j] = max(nums[j - 1] - 1, 0)",
"- else:",
"- nums[j] = max(nums[j - 1] - 1, 0)",
"+ nums[j] = max(nums[j - 1] - 1, 0)",
"- if k < 10:",
"- print(k)",
"- return",
"-... | false | 0.072225 | 0.069847 | 1.034053 | [
"s852954855",
"s268212523"
] |
u185896732 | p02927 | python | s093433603 | s037084206 | 27 | 24 | 3,064 | 3,060 | Accepted | Accepted | 11.11 | #import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_r... | m,d=list(map(int,input().split()))
ans=0
for month in range(1,m+1):
for day in range(1,d+1):
day=str(day)
if len(day)!=2:
continue
if int(day[0])*int(day[1])!=month:
continue
if int(day[0])<2 or int(day[1])<2:
continue
#print(mon... | 31 | 14 | 862 | 349 | # import pysnooper
# import numpy
# import os,re,sys,operator
# from collections import Counter,deque
# from operator import itemgetter,mul
# from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin, setrecursionlimit
# from bisect import bisect_left,bisect... | m, d = list(map(int, input().split()))
ans = 0
for month in range(1, m + 1):
for day in range(1, d + 1):
day = str(day)
if len(day) != 2:
continue
if int(day[0]) * int(day[1]) != month:
continue
if int(day[0]) < 2 or int(day[1]) < 2:
continue
... | false | 54.83871 | [
"-# import pysnooper",
"-# import numpy",
"-# import os,re,sys,operator",
"-# from collections import Counter,deque",
"-# from operator import itemgetter,mul",
"-# from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations",
"-from sys import stdin, setrecursionlimi... | false | 0.040187 | 0.047544 | 0.845257 | [
"s093433603",
"s037084206"
] |
u796942881 | p02819 | python | s618465518 | s075379586 | 40 | 17 | 3,060 | 2,940 | Accepted | Accepted | 57.5 | def isPrime(n):
# 素数判定
if n < 2:
return False
for i in range(2, n + 1):
if n < i ** 2:
break
if n % i == 0:
return False
return True
def main():
X = int(eval(input()))
while True:
if isPrime(X):
print(X)
... | def isPrime(n):
# 素数判定
if n == 2:
return True
if n < 2 or n % 2 == 0:
return False
m = 3
while m * m <= n:
if n % m == 0:
return False
m += 2
return True
def main():
X = int(eval(input()))
while True:
if isPrime(X):
... | 23 | 25 | 367 | 394 | def isPrime(n):
# 素数判定
if n < 2:
return False
for i in range(2, n + 1):
if n < i**2:
break
if n % i == 0:
return False
return True
def main():
X = int(eval(input()))
while True:
if isPrime(X):
print(X)
break
... | def isPrime(n):
# 素数判定
if n == 2:
return True
if n < 2 or n % 2 == 0:
return False
m = 3
while m * m <= n:
if n % m == 0:
return False
m += 2
return True
def main():
X = int(eval(input()))
while True:
if isPrime(X):
print(... | false | 8 | [
"- if n < 2:",
"+ if n == 2:",
"+ return True",
"+ if n < 2 or n % 2 == 0:",
"- for i in range(2, n + 1):",
"- if n < i**2:",
"- break",
"- if n % i == 0:",
"+ m = 3",
"+ while m * m <= n:",
"+ if n % m == 0:",
"+ m += 2"
] | false | 0.067435 | 0.036873 | 1.828855 | [
"s618465518",
"s075379586"
] |
u047796752 | p03298 | python | s589813252 | s263459420 | 1,873 | 663 | 245,628 | 235,856 | Accepted | Accepted | 64.6 | from collections import *
N = int(eval(input()))
s = list(eval(input()))
cnt = defaultdict(lambda : defaultdict(int))
for S in range(2**N):
red, blue = [], []
for i in range(N):
if (S>>i)&1:
red.append(s[i])
else:
blue.append(s[i])
cnt[''.jo... | import sys
input = sys.stdin.readline
from collections import *
N = int(eval(input()))
s = input()[:-1]
cnt = defaultdict(int)
for S in range(1<<N):
red, blue = [], []
for i in range(N):
if (S>>i)&1:
red.append(s[i])
else:
blue.append(s[i])
... | 32 | 34 | 602 | 623 | from collections import *
N = int(eval(input()))
s = list(eval(input()))
cnt = defaultdict(lambda: defaultdict(int))
for S in range(2**N):
red, blue = [], []
for i in range(N):
if (S >> i) & 1:
red.append(s[i])
else:
blue.append(s[i])
cnt["".join(red)]["".join(blue)]... | import sys
input = sys.stdin.readline
from collections import *
N = int(eval(input()))
s = input()[:-1]
cnt = defaultdict(int)
for S in range(1 << N):
red, blue = [], []
for i in range(N):
if (S >> i) & 1:
red.append(s[i])
else:
blue.append(s[i])
cnt[("".join(red), ... | false | 5.882353 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-s = list(eval(input()))",
"-cnt = defaultdict(lambda: defaultdict(int))",
"-for S in range(2**N):",
"+s = input()[:-1]",
"+cnt = defaultdict(int)",
"+for S in range(1 << N):",
"- cnt[\"\".join(red)][\"\".join(blue)] += 1",
"-s.reverse()",
... | false | 0.037646 | 0.672768 | 0.055956 | [
"s589813252",
"s263459420"
] |
u285891772 | p03556 | python | s422458650 | s047114533 | 68 | 48 | 5,576 | 5,324 | Accepted | Accepted | 29.41 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | 25 | 23 | 871 | 819 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_... | false | 8 | [
"-for i in range(N, 0, -1):",
"- if sqrt(i) == int(sqrt(i)):",
"- print(i)",
"- exit()",
"+print((int(sqrt(N)) ** 2))"
] | false | 0.039527 | 0.037969 | 1.041027 | [
"s422458650",
"s047114533"
] |
u327466606 | p03329 | python | s630134336 | s702691097 | 322 | 281 | 3,828 | 2,940 | Accepted | Accepted | 12.73 | from itertools import count
n = int(eval(input()))
dp = [0]*(n+1)
def it(n):
yield 1
m = 6
while m <= n:
yield m
m *= 6
m = 9
while m <= n:
yield m
m *= 9
for i in range(1,n+1):
dp[i] = min(dp[i-t] for t in it(i))+1
print((dp[n]))
| def it(n,p):
while n > 0:
yield n%p
n //= p
cost = lambda *a: sum(it(*a))
n = int(eval(input()))
print((min(cost(x,6)+cost(n-x,9) for x in range(n+1)))) | 22 | 8 | 278 | 162 | from itertools import count
n = int(eval(input()))
dp = [0] * (n + 1)
def it(n):
yield 1
m = 6
while m <= n:
yield m
m *= 6
m = 9
while m <= n:
yield m
m *= 9
for i in range(1, n + 1):
dp[i] = min(dp[i - t] for t in it(i)) + 1
print((dp[n]))
| def it(n, p):
while n > 0:
yield n % p
n //= p
cost = lambda *a: sum(it(*a))
n = int(eval(input()))
print((min(cost(x, 6) + cost(n - x, 9) for x in range(n + 1))))
| false | 63.636364 | [
"-from itertools import count",
"-",
"-n = int(eval(input()))",
"-dp = [0] * (n + 1)",
"+def it(n, p):",
"+ while n > 0:",
"+ yield n % p",
"+ n //= p",
"-def it(n):",
"- yield 1",
"- m = 6",
"- while m <= n:",
"- yield m",
"- m *= 6",
"- m = 9"... | false | 0.221882 | 0.070371 | 3.153014 | [
"s630134336",
"s702691097"
] |
u143492911 | p03945 | python | s567114674 | s374505118 | 54 | 47 | 3,188 | 3,956 | Accepted | Accepted | 12.96 | s=eval(input())
count=1
for i in range(len(s)-1):
if s[i]=="B":
if s[i+1]=="W":
count+=1
elif s[i]=="W":
if s[i+1]=="B":
count+=1
print((count-1)) | s=list(eval(input()))
count=0
for i in range(len(s)-1):
if s[i]!=s[i+1]:
count+=1
print(count) | 10 | 6 | 195 | 105 | s = eval(input())
count = 1
for i in range(len(s) - 1):
if s[i] == "B":
if s[i + 1] == "W":
count += 1
elif s[i] == "W":
if s[i + 1] == "B":
count += 1
print((count - 1))
| s = list(eval(input()))
count = 0
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
count += 1
print(count)
| false | 40 | [
"-s = eval(input())",
"-count = 1",
"+s = list(eval(input()))",
"+count = 0",
"- if s[i] == \"B\":",
"- if s[i + 1] == \"W\":",
"- count += 1",
"- elif s[i] == \"W\":",
"- if s[i + 1] == \"B\":",
"- count += 1",
"-print((count - 1))",
"+ if s[i] != ... | false | 0.035467 | 0.035574 | 0.996992 | [
"s567114674",
"s374505118"
] |
u285443936 | p03240 | python | s594270759 | s410013800 | 386 | 39 | 12,564 | 3,064 | Accepted | Accepted | 89.9 | import numpy as np
N = int(eval(input()))
point = [[int(item) for item in input().split()] for _ in range(N)]
point.sort(key=lambda x:x[2], reverse=True)
ans = np.zeros((101,101))
for i,p in enumerate(point):
if i == 0:
for j in range(101):
for k in range(101):
H = p[2] + abs(j - p[... | N = int(eval(input()))
P = [list(map(int, input().split())) for i in range(N)]
C = [[0]*101 for i in range(101)]
P.sort(key=lambda x:x[2], reverse=True)
for X in range(101):
for Y in range(101):
tmp1 = -1
flg = 0
for i in range(N):
x,y,h = P[i]
if h != 0 and tmp1 == -1:
tmp1... | 26 | 25 | 667 | 637 | import numpy as np
N = int(eval(input()))
point = [[int(item) for item in input().split()] for _ in range(N)]
point.sort(key=lambda x: x[2], reverse=True)
ans = np.zeros((101, 101))
for i, p in enumerate(point):
if i == 0:
for j in range(101):
for k in range(101):
H = p[2] + abs... | N = int(eval(input()))
P = [list(map(int, input().split())) for i in range(N)]
C = [[0] * 101 for i in range(101)]
P.sort(key=lambda x: x[2], reverse=True)
for X in range(101):
for Y in range(101):
tmp1 = -1
flg = 0
for i in range(N):
x, y, h = P[i]
if h != 0 and tmp1... | false | 3.846154 | [
"-import numpy as np",
"-",
"-point = [[int(item) for item in input().split()] for _ in range(N)]",
"-point.sort(key=lambda x: x[2], reverse=True)",
"-ans = np.zeros((101, 101))",
"-for i, p in enumerate(point):",
"- if i == 0:",
"- for j in range(101):",
"- for k in range(101):... | false | 0.496145 | 0.044235 | 11.216104 | [
"s594270759",
"s410013800"
] |
u698849142 | p03048 | python | s506794289 | s129510099 | 380 | 293 | 40,684 | 40,684 | Accepted | Accepted | 22.89 | r,g,b,n = list(map(int, input().split(" ")))
l = sorted([r,g,b])
count=0
for i in range(int(n/l[2])+1):
for j in range(int(n/l[1])+1):
x = l[2]*i
y = l[1]*j
if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
count = count + 1
print(count) | r,g,b,n = list(map(int, input().split(" ")))
l = sorted([r,g,b])
count=0
for i in range(int(n/l[2])+1):
for j in range(int(n/l[1])+1):
x = l[2]*i
y = l[1]*j
if (n-x-y) < 0:
break
if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
count = count + 1
print(count) | 10 | 12 | 269 | 313 | r, g, b, n = list(map(int, input().split(" ")))
l = sorted([r, g, b])
count = 0
for i in range(int(n / l[2]) + 1):
for j in range(int(n / l[1]) + 1):
x = l[2] * i
y = l[1] * j
if (n - x - y) >= 0 and (n - x - y) % l[0] == 0:
count = count + 1
print(count)
| r, g, b, n = list(map(int, input().split(" ")))
l = sorted([r, g, b])
count = 0
for i in range(int(n / l[2]) + 1):
for j in range(int(n / l[1]) + 1):
x = l[2] * i
y = l[1] * j
if (n - x - y) < 0:
break
if (n - x - y) >= 0 and (n - x - y) % l[0] == 0:
count = c... | false | 16.666667 | [
"+ if (n - x - y) < 0:",
"+ break"
] | false | 0.200624 | 0.054526 | 3.679403 | [
"s506794289",
"s129510099"
] |
u691018832 | p03831 | python | s540899360 | s141974399 | 91 | 82 | 14,252 | 12,496 | Accepted | Accepted | 9.89 | import sys
import math
input = sys.stdin.readline
n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
k = math.floor(b / a)
ans = 0
for i in range(1, n):
if k >= x[i] - x[i - 1]:
ans += (x[i] - x[i - 1]) * a
else:
ans += b
print(ans)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n, a, b = list(map(int, readline().split()))
x = list(map(int, readline().split()))
ans = 0
for bf, af in zip(x, x[1:]):
ans += min((af - bf) * a, b)
print(a... | 14 | 12 | 292 | 318 | import sys
import math
input = sys.stdin.readline
n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
k = math.floor(b / a)
ans = 0
for i in range(1, n):
if k >= x[i] - x[i - 1]:
ans += (x[i] - x[i - 1]) * a
else:
ans += b
print(ans)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n, a, b = list(map(int, readline().split()))
x = list(map(int, readline().split()))
ans = 0
for bf, af in zip(x, x[1:]):
ans += min((af - bf) * a, b)
print(ans)
| false | 14.285714 | [
"-import math",
"-input = sys.stdin.readline",
"-n, a, b = list(map(int, input().split()))",
"-x = list(map(int, input().split()))",
"-k = math.floor(b / a)",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+sys.setrecursionlimit(... | false | 0.043589 | 0.112253 | 0.388309 | [
"s540899360",
"s141974399"
] |
u072717685 | p03845 | python | s820344868 | s623847995 | 30 | 22 | 3,444 | 3,444 | Accepted | Accepted | 26.67 | import copy
n = int(eval(input()))
t = [int(i) for i in input().split()]
m = int(eval(input()))
for _ in range(m):
p, x = list(map(int, input().split()))
t_copy = copy.deepcopy(t)
t_copy[p-1] = x
print((sum(t_copy))) | import copy
n = int(eval(input()))
t = [int(i) for i in input().split()]
m = int(eval(input()))
sum_t = sum(t)
for _ in range(m):
p, x = list(map(int, input().split()))
print((sum_t - (t[p-1] - x))) | 9 | 8 | 212 | 191 | import copy
n = int(eval(input()))
t = [int(i) for i in input().split()]
m = int(eval(input()))
for _ in range(m):
p, x = list(map(int, input().split()))
t_copy = copy.deepcopy(t)
t_copy[p - 1] = x
print((sum(t_copy)))
| import copy
n = int(eval(input()))
t = [int(i) for i in input().split()]
m = int(eval(input()))
sum_t = sum(t)
for _ in range(m):
p, x = list(map(int, input().split()))
print((sum_t - (t[p - 1] - x)))
| false | 11.111111 | [
"+sum_t = sum(t)",
"- t_copy = copy.deepcopy(t)",
"- t_copy[p - 1] = x",
"- print((sum(t_copy)))",
"+ print((sum_t - (t[p - 1] - x)))"
] | false | 0.038476 | 0.099771 | 0.385645 | [
"s820344868",
"s623847995"
] |
u896741788 | p03298 | python | s335710047 | s830654882 | 2,703 | 1,409 | 129,496 | 150,056 | Accepted | Accepted | 47.87 | def t():
n=int(eval(input()))
s=eval(input())
from collections import defaultdict
l,r=s[:n],s[-1:-n-1:-1]
d=defaultdict(int)
for i in range(2**n):
a={j for j in range(n)if (i>>j)%2}
d[("".join(l[p] for p in sorted(list(a))),"".join(l[o] for o in range(n)if o not in a))]+=... | def f():
n,s=int(eval(input())),eval(input())
a,b=s[n-1::-1],s[n:]
from collections import defaultdict
ad=defaultdict(int)
bd=defaultdict(int)
for i in range(2**n):
sa,ta,sb,tb="","","",""
for j in range(n):
if i%2:
sa+=a[j]
... | 17 | 24 | 549 | 563 | def t():
n = int(eval(input()))
s = eval(input())
from collections import defaultdict
l, r = s[:n], s[-1 : -n - 1 : -1]
d = defaultdict(int)
for i in range(2**n):
a = {j for j in range(n) if (i >> j) % 2}
d[
(
"".join(l[p] for p in sorted(list(a))),
... | def f():
n, s = int(eval(input())), eval(input())
a, b = s[n - 1 :: -1], s[n:]
from collections import defaultdict
ad = defaultdict(int)
bd = defaultdict(int)
for i in range(2**n):
sa, ta, sb, tb = "", "", "", ""
for j in range(n):
if i % 2:
sa += a[j... | false | 29.166667 | [
"-def t():",
"- n = int(eval(input()))",
"- s = eval(input())",
"+def f():",
"+ n, s = int(eval(input())), eval(input())",
"+ a, b = s[n - 1 :: -1], s[n:]",
"- l, r = s[:n], s[-1 : -n - 1 : -1]",
"- d = defaultdict(int)",
"+ ad = defaultdict(int)",
"+ bd = defaultdict(int)"... | false | 0.041529 | 0.06346 | 0.654412 | [
"s335710047",
"s830654882"
] |
u608088992 | p03044 | python | s868811286 | s694368973 | 461 | 390 | 43,216 | 44,920 | Accepted | Accepted | 15.4 | import sys, math, collections, heapq, itertools
F = sys.stdin
def single_input(): return F.readline().strip("\n")
def line_input(): return F.readline().strip("\n").split()
def solve():
N = int(single_input())
edge = [[] for i in range(N)]
for i in range(N-1):
u, v, w = list(map(int, line_i... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
Edge = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
Edge[u-1].append((v-1, w))
Edge[v-1].append((u-1, w))
Col = [-1... | 30 | 28 | 868 | 703 | import sys, math, collections, heapq, itertools
F = sys.stdin
def single_input():
return F.readline().strip("\n")
def line_input():
return F.readline().strip("\n").split()
def solve():
N = int(single_input())
edge = [[] for i in range(N)]
for i in range(N - 1):
u, v, w = list(map(int,... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
Edge = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
Edge[u - 1].append((v - 1, w))
Edge[v - 1].append((u - 1, w))
Col = [-1] * ... | false | 6.666667 | [
"-import sys, math, collections, heapq, itertools",
"-",
"-F = sys.stdin",
"-",
"-",
"-def single_input():",
"- return F.readline().strip(\"\\n\")",
"-",
"-",
"-def line_input():",
"- return F.readline().strip(\"\\n\").split()",
"+import sys",
"+from collections import deque",
"- ... | false | 0.085393 | 0.042488 | 2.009823 | [
"s868811286",
"s694368973"
] |
u960080897 | p02659 | python | s650402305 | s591248880 | 28 | 21 | 10,056 | 9,096 | Accepted | Accepted | 25 | from decimal import *
a, b = list(map(Decimal, input().split()))
print((int(a * b))) | a, b = input().split()
a = int(a)
b = int(b.replace('.',''))
print((a * b // 100))
| 3 | 4 | 78 | 84 | from decimal import *
a, b = list(map(Decimal, input().split()))
print((int(a * b)))
| a, b = input().split()
a = int(a)
b = int(b.replace(".", ""))
print((a * b // 100))
| false | 25 | [
"-from decimal import *",
"-",
"-a, b = list(map(Decimal, input().split()))",
"-print((int(a * b)))",
"+a, b = input().split()",
"+a = int(a)",
"+b = int(b.replace(\".\", \"\"))",
"+print((a * b // 100))"
] | false | 0.116283 | 0.036701 | 3.168343 | [
"s650402305",
"s591248880"
] |
u203843959 | p03476 | python | s509387317 | s419537347 | 1,084 | 861 | 4,980 | 7,924 | Accepted | Accepted | 20.57 | Q=int(eval(input()))
def isPrime(x):
for i in range(2,int(x**0.5)+1):
if x%i==0:
return False
else:
return True
plist=[False]*(10**5+3)
for i in range(3,10**5+3,2):
if isPrime(i) and isPrime((i+1)//2):
plist[i]=True
#print(plist[:10])
slist=[0]*(10**5+3)
for i in range(3,10**5... | Q=int(eval(input()))
def prime_sieve(n):
prime_list=[True]*n
prime_list[0]=False
prime_list[1]=False
for i in range(2,int(n**0.5)+1):
if not prime_list[i]:
continue
else:
for j in range(i**2,n,i):
prime_list[j]=False
return prime_list
#return [i for i in range(n... | 26 | 33 | 501 | 722 | Q = int(eval(input()))
def isPrime(x):
for i in range(2, int(x**0.5) + 1):
if x % i == 0:
return False
else:
return True
plist = [False] * (10**5 + 3)
for i in range(3, 10**5 + 3, 2):
if isPrime(i) and isPrime((i + 1) // 2):
plist[i] = True
# print(plist[:10])
slist =... | Q = int(eval(input()))
def prime_sieve(n):
prime_list = [True] * n
prime_list[0] = False
prime_list[1] = False
for i in range(2, int(n**0.5) + 1):
if not prime_list[i]:
continue
else:
for j in range(i**2, n, i):
prime_list[j] = False
return p... | false | 21.212121 | [
"-def isPrime(x):",
"- for i in range(2, int(x**0.5) + 1):",
"- if x % i == 0:",
"- return False",
"- else:",
"- return True",
"+def prime_sieve(n):",
"+ prime_list = [True] * n",
"+ prime_list[0] = False",
"+ prime_list[1] = False",
"+ for i in range(2... | false | 0.479231 | 0.080041 | 5.987317 | [
"s509387317",
"s419537347"
] |
u499381410 | p02614 | python | s928994053 | s506272761 | 328 | 144 | 77,796 | 83,580 | Accepted | Accepted | 56.1 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, acos, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, acos, ... | 48 | 42 | 1,356 | 1,278 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, acos, asin, at... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, acos, asin, at... | false | 12.5 | [
"+C = SR(h)",
"-C = SR(h)",
"-for hbit in range(2**h):",
"- for wbit in range(2**w):",
"- ret = 0",
"- for hi in range(h):",
"- for wi in range(w):",
"- if (hbit >> hi & 1) and (wbit >> wi & 1) and C[hi][wi] == \"#\":",
"- ret += 1",
"-... | false | 0.037532 | 0.036864 | 1.018124 | [
"s928994053",
"s506272761"
] |
u608088992 | p02844 | python | s269334987 | s878702053 | 1,815 | 893 | 48,732 | 25,716 | Accepted | Accepted | 50.8 | import sys
from itertools import combinations, permutations
def solve():
input = sys.stdin.readline
N = int(eval(input()))
S = eval(input())
left = [set() for _ in range(N)]
right = [set() for _ in range(N)]
for i in range(N - 1):
left[i+1] |= left[i] | {int(S[i])}
ri... | def solve():
N = int(eval(input()))
S = list(eval(input()))
right = [set() for _ in range(N)]
for i in reversed(list(range(N - 1))): right[i] = right[i + 1] | {S[i + 1]}
left = {S[0]}
PIN = set()
for i in range(1, N - 1):
for ln in left:
for rn in right[i]:
... | 23 | 19 | 609 | 464 | import sys
from itertools import combinations, permutations
def solve():
input = sys.stdin.readline
N = int(eval(input()))
S = eval(input())
left = [set() for _ in range(N)]
right = [set() for _ in range(N)]
for i in range(N - 1):
left[i + 1] |= left[i] | {int(S[i])}
right[N - ... | def solve():
N = int(eval(input()))
S = list(eval(input()))
right = [set() for _ in range(N)]
for i in reversed(list(range(N - 1))):
right[i] = right[i + 1] | {S[i + 1]}
left = {S[0]}
PIN = set()
for i in range(1, N - 1):
for ln in left:
for rn in right[i]:
... | false | 17.391304 | [
"-import sys",
"-from itertools import combinations, permutations",
"-",
"-",
"- input = sys.stdin.readline",
"- S = eval(input())",
"- left = [set() for _ in range(N)]",
"+ S = list(eval(input()))",
"- for i in range(N - 1):",
"- left[i + 1] |= left[i] | {int(S[i])}",
"- ... | false | 0.038628 | 0.06677 | 0.578527 | [
"s269334987",
"s878702053"
] |
u188827677 | p02995 | python | s958892512 | s969276294 | 26 | 23 | 9,080 | 9,052 | Accepted | Accepted | 11.54 | from math import gcd
a,b,c,d = list(map(int, input().split()))
t = c*d//gcd(c,d)
x = (a-1) - ((a-1)//c + (a-1)//d) + (a-1)//t
y = b - (b//c + b//d) + b//t
print((y-x)) | from math import gcd
a,b,c,d = list(map(int, input().split()))
s = b - ((b//c)+(b//d)) + b//((c*d)//gcd(c,d))
t = (a-1) - (((a-1)//c)+((a-1)//d)) + (a-1)//((c*d)//gcd(c,d))
print((s-t)) | 8 | 6 | 168 | 183 | from math import gcd
a, b, c, d = list(map(int, input().split()))
t = c * d // gcd(c, d)
x = (a - 1) - ((a - 1) // c + (a - 1) // d) + (a - 1) // t
y = b - (b // c + b // d) + b // t
print((y - x))
| from math import gcd
a, b, c, d = list(map(int, input().split()))
s = b - ((b // c) + (b // d)) + b // ((c * d) // gcd(c, d))
t = (a - 1) - (((a - 1) // c) + ((a - 1) // d)) + (a - 1) // ((c * d) // gcd(c, d))
print((s - t))
| false | 25 | [
"-t = c * d // gcd(c, d)",
"-x = (a - 1) - ((a - 1) // c + (a - 1) // d) + (a - 1) // t",
"-y = b - (b // c + b // d) + b // t",
"-print((y - x))",
"+s = b - ((b // c) + (b // d)) + b // ((c * d) // gcd(c, d))",
"+t = (a - 1) - (((a - 1) // c) + ((a - 1) // d)) + (a - 1) // ((c * d) // gcd(c, d))",
"+pr... | false | 0.057622 | 0.10306 | 0.55911 | [
"s958892512",
"s969276294"
] |
u179169725 | p03838 | python | s847838835 | s694322226 | 68 | 61 | 61,640 | 61,960 | Accepted | Accepted | 10.29 | # https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け
x, y = list(map(int, input().split()))
if x * y < 0: # 異符号ならば答えは一つ
print((abs(abs(x) - abs(y)) + 1))
exit()
elif 0 <= x < y:
print((y - x))
exit()
elif 0 < y < x:
print((2 + x - y))
exit()
elif ... | # https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け
x, y = list(map(int, input().split()))
if x * y < 0: # 異符号ならば答えは一つ
print((abs(abs(x) - abs(y)) + 1))
elif 0 <= x < y:
print((y - x))
elif 0 < y < x:
print((2 + x - y))
elif y == 0 and y < x:
print((1 + x)... | 28 | 20 | 529 | 425 | # https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け
x, y = list(map(int, input().split()))
if x * y < 0: # 異符号ならば答えは一つ
print((abs(abs(x) - abs(y)) + 1))
exit()
elif 0 <= x < y:
print((y - x))
exit()
elif 0 < y < x:
print((2 + x - y))
exit()
elif y == 0 and y < x:... | # https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け
x, y = list(map(int, input().split()))
if x * y < 0: # 異符号ならば答えは一つ
print((abs(abs(x) - abs(y)) + 1))
elif 0 <= x < y:
print((y - x))
elif 0 < y < x:
print((2 + x - y))
elif y == 0 and y < x:
print((1 + x))
elif x < y <=... | false | 28.571429 | [
"- exit()",
"- exit()",
"- exit()",
"- exit()",
"- exit()",
"- exit()",
"- exit()",
"-raise ValueError()"
] | false | 0.039652 | 0.084016 | 0.471961 | [
"s847838835",
"s694322226"
] |
u353919145 | p02879 | python | s583071387 | s427020781 | 348 | 28 | 84,932 | 9,048 | Accepted | Accepted | 91.95 | s = input()
a,b = s.split(' ')
a,b = int(a),int(b)
def mul(a,b):
if a <= 9 and a >=1 and (1 <= b <= 9):
return a * b
else:
return -1
print(mul(a,b)) | a,b = input().split()
a=int(a)
b=int(b)
if a>=1 and a<=9 and b>=1 and b<=9:
print((a*b))
else: print("-1") | 11 | 8 | 187 | 117 | s = input()
a, b = s.split(" ")
a, b = int(a), int(b)
def mul(a, b):
if a <= 9 and a >= 1 and (1 <= b <= 9):
return a * b
else:
return -1
print(mul(a, b))
| a, b = input().split()
a = int(a)
b = int(b)
if a >= 1 and a <= 9 and b >= 1 and b <= 9:
print((a * b))
else:
print("-1")
| false | 27.272727 | [
"-s = input()",
"-a, b = s.split(\" \")",
"-a, b = int(a), int(b)",
"-",
"-",
"-def mul(a, b):",
"- if a <= 9 and a >= 1 and (1 <= b <= 9):",
"- return a * b",
"- else:",
"- return -1",
"-",
"-",
"-print(mul(a, b))",
"+a, b = input().split()",
"+a = int(a)",
"+b = i... | false | 0.037567 | 0.037281 | 1.007677 | [
"s583071387",
"s427020781"
] |
u119148115 | p02606 | python | s306569044 | s697927240 | 77 | 65 | 61,740 | 61,832 | Accepted | Accepted | 15.58 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.st... | import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
L,R,d = LI()
print((R//d-(L-1)//d)) | 13 | 6 | 462 | 128 | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().rstrip())) # 空白なし
def S():
return sys.stdin.readline().rstrip()
def L... | import sys
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
L, R, d = LI()
print((R // d - (L - 1) // d))
| false | 53.846154 | [
"-",
"-sys.setrecursionlimit(10**7)",
"-",
"-",
"-def I():",
"- return int(sys.stdin.readline().rstrip())",
"-def LI2():",
"- return list(map(int, sys.stdin.readline().rstrip())) # 空白なし",
"-",
"-",
"-def S():",
"- return sys.stdin.readline().rstrip()",
"-",
"-",
"-def LS():",
... | false | 0.036201 | 0.035591 | 1.017161 | [
"s306569044",
"s697927240"
] |
u563722393 | p03067 | python | s151681934 | s381937086 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | A, B, C = ( int(i) for i in input().split() )
if A <= C <= B:
print('Yes')
elif B <= C <= A:
print('Yes')
else:
print('No') | A, B, C = ( int(i) for i in input().split() )
if A < C < B:
print('Yes')
elif B < C < A:
print('Yes')
else:
print('No') | 8 | 8 | 137 | 133 | A, B, C = (int(i) for i in input().split())
if A <= C <= B:
print("Yes")
elif B <= C <= A:
print("Yes")
else:
print("No")
| A, B, C = (int(i) for i in input().split())
if A < C < B:
print("Yes")
elif B < C < A:
print("Yes")
else:
print("No")
| false | 0 | [
"-if A <= C <= B:",
"+if A < C < B:",
"-elif B <= C <= A:",
"+elif B < C < A:"
] | false | 0.16366 | 0.094964 | 1.723386 | [
"s151681934",
"s381937086"
] |
u573754721 | p02916 | python | s354398092 | s656251402 | 177 | 17 | 38,384 | 3,064 | Accepted | Accepted | 90.4 | N = int(eval(input()))
li_a =list(map(int, input().split()))
li_b =list(map(int, input().split()))
li_c =list(map(int, input().split()))
before = -99
points = 0
for i in li_a:
points += li_b[i - 1]
if before + 1 == i:
points += li_c[i - 2]
before = i
print(points) | n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=sum(b)
add_s=0
for i in range(n-1):
if a[i]==a[i+1]-1:
add_s += c[a[i]-1]
print((s+add_s)) | 13 | 11 | 301 | 233 | N = int(eval(input()))
li_a = list(map(int, input().split()))
li_b = list(map(int, input().split()))
li_c = list(map(int, input().split()))
before = -99
points = 0
for i in li_a:
points += li_b[i - 1]
if before + 1 == i:
points += li_c[i - 2]
before = i
print(points)
| n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
s = sum(b)
add_s = 0
for i in range(n - 1):
if a[i] == a[i + 1] - 1:
add_s += c[a[i] - 1]
print((s + add_s))
| false | 15.384615 | [
"-N = int(eval(input()))",
"-li_a = list(map(int, input().split()))",
"-li_b = list(map(int, input().split()))",
"-li_c = list(map(int, input().split()))",
"-before = -99",
"-points = 0",
"-for i in li_a:",
"- points += li_b[i - 1]",
"- if before + 1 == i:",
"- points += li_c[i - 2]",... | false | 0.095129 | 0.045709 | 2.081173 | [
"s354398092",
"s656251402"
] |
u588093355 | p03371 | python | s336631257 | s554721032 | 65 | 17 | 3,060 | 2,940 | Accepted | Accepted | 73.85 | #!/usr/bin/env python3
def main():
(A,B,C,X,Y) = list(map(int,input().split()))
lim = max(X, Y)
vmin = min(X, Y)
minCost = 5000 * 10**5 * 2
for t in range(lim+1):
if t <= vmin:
cost = (X - t) * A + (Y - t) * B + t * 2 * C
elif X <= Y:
cost = (Y - t... | def main():
(A,B,C,X,Y) = list(map(int,input().split()))
if X < Y:
X, Y = Y, X
A, B = B, A
print((min(A + B, 2 * C) * Y + min(A, 2*C) * (X - Y)))
main()
| 19 | 8 | 465 | 181 | #!/usr/bin/env python3
def main():
(A, B, C, X, Y) = list(map(int, input().split()))
lim = max(X, Y)
vmin = min(X, Y)
minCost = 5000 * 10**5 * 2
for t in range(lim + 1):
if t <= vmin:
cost = (X - t) * A + (Y - t) * B + t * 2 * C
elif X <= Y:
cost = (Y - t) * B... | def main():
(A, B, C, X, Y) = list(map(int, input().split()))
if X < Y:
X, Y = Y, X
A, B = B, A
print((min(A + B, 2 * C) * Y + min(A, 2 * C) * (X - Y)))
main()
| false | 57.894737 | [
"-#!/usr/bin/env python3",
"- lim = max(X, Y)",
"- vmin = min(X, Y)",
"- minCost = 5000 * 10**5 * 2",
"- for t in range(lim + 1):",
"- if t <= vmin:",
"- cost = (X - t) * A + (Y - t) * B + t * 2 * C",
"- elif X <= Y:",
"- cost = (Y - t) * B + t * 2 * C... | false | 0.119247 | 0.137557 | 0.866891 | [
"s336631257",
"s554721032"
] |
u340040203 | p02773 | python | s067019954 | s749861752 | 551 | 446 | 59,496 | 35,896 | Accepted | Accepted | 19.06 | import sys
import collections
input = lambda: sys.stdin.readline().rstrip()
def main():
n = int(input())
s = [input() for _ in range(n)]
cnt = collections.Counter(s)
values, counts = zip(*cnt.most_common())
d = sorted(values[:counts.count(counts[0])])
print(*d, sep='\n')
if __name_... | import sys
import collections
input = lambda: sys.stdin.readline().rstrip()
def main():
n = int(input())
s = [input() for _ in range(n)]
cnt = collections.Counter(s)
cnt_max = max(cnt.values())
d = [k for k, v in cnt.items() if v == cnt_max]
d = sorted(d)
print(*d, sep='\n')
i... | 14 | 15 | 348 | 357 | import sys
import collections
input = lambda: sys.stdin.readline().rstrip()
def main():
n = int(input())
s = [input() for _ in range(n)]
cnt = collections.Counter(s)
values, counts = zip(*cnt.most_common())
d = sorted(values[: counts.count(counts[0])])
print(*d, sep="\n")
if __name__ == "__... | import sys
import collections
input = lambda: sys.stdin.readline().rstrip()
def main():
n = int(input())
s = [input() for _ in range(n)]
cnt = collections.Counter(s)
cnt_max = max(cnt.values())
d = [k for k, v in cnt.items() if v == cnt_max]
d = sorted(d)
print(*d, sep="\n")
if __name__... | false | 6.666667 | [
"- values, counts = zip(*cnt.most_common())",
"- d = sorted(values[: counts.count(counts[0])])",
"+ cnt_max = max(cnt.values())",
"+ d = [k for k, v in cnt.items() if v == cnt_max]",
"+ d = sorted(d)"
] | false | 0.082543 | 0.066678 | 1.237936 | [
"s067019954",
"s749861752"
] |
u773265208 | p03545 | python | s826556825 | s197492778 | 168 | 17 | 38,384 | 3,060 | Accepted | Accepted | 89.88 | import sys
s = eval(input())
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
ans = a
for i in range(2):
if i == 0:
ans += b
s1 = '+'
else:
ans -= b
s1 = '-'
for j in range(2):
if j == 0:
ans += c
s2 = '+'
else:
ans -= c
s2 = '-'
for k in range(2):
if k... | import sys
s = eval(input())
n = 3
for i in range(2**(n)):
op = ["-"]*3
for j in range(n):
if i & (1<<j):
op[j] = "+"
res = ""
for a,b in zip(s,op+[""]):
res += a+b
if eval(res) == 7:
print((res+'=7'))
sys.exit()
| 49 | 17 | 631 | 240 | import sys
s = eval(input())
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
ans = a
for i in range(2):
if i == 0:
ans += b
s1 = "+"
else:
ans -= b
s1 = "-"
for j in range(2):
if j == 0:
ans += c
s2 = "+"
else:
ans ... | import sys
s = eval(input())
n = 3
for i in range(2 ** (n)):
op = ["-"] * 3
for j in range(n):
if i & (1 << j):
op[j] = "+"
res = ""
for a, b in zip(s, op + [""]):
res += a + b
if eval(res) == 7:
print((res + "=7"))
sys.exit()
| false | 65.306122 | [
"-a = int(s[0])",
"-b = int(s[1])",
"-c = int(s[2])",
"-d = int(s[3])",
"-ans = a",
"-for i in range(2):",
"- if i == 0:",
"- ans += b",
"- s1 = \"+\"",
"- else:",
"- ans -= b",
"- s1 = \"-\"",
"- for j in range(2):",
"- if j == 0:",
"- ... | false | 0.112082 | 0.040709 | 2.753217 | [
"s826556825",
"s197492778"
] |
u867826040 | p02779 | python | s484140285 | s206341950 | 170 | 101 | 38,836 | 27,968 | Accepted | Accepted | 40.59 | s = int(eval(input()))
a = list(map(str, input().split()))
n = {}
for i in a:
n.setdefault(i, 0)
for i in a:
n[i] += 1
x = 0
for i in list(n.values()):
if x <= i:
x = i
if x == 1:
print("YES")
else:
print("NO") | n = eval(input())
a = list(map(int,input().split()))
if len(set(a)) == len(a):
print("YES")
elif len(set(a)) != len(a):
print("NO") | 15 | 6 | 226 | 134 | s = int(eval(input()))
a = list(map(str, input().split()))
n = {}
for i in a:
n.setdefault(i, 0)
for i in a:
n[i] += 1
x = 0
for i in list(n.values()):
if x <= i:
x = i
if x == 1:
print("YES")
else:
print("NO")
| n = eval(input())
a = list(map(int, input().split()))
if len(set(a)) == len(a):
print("YES")
elif len(set(a)) != len(a):
print("NO")
| false | 60 | [
"-s = int(eval(input()))",
"-a = list(map(str, input().split()))",
"-n = {}",
"-for i in a:",
"- n.setdefault(i, 0)",
"-for i in a:",
"- n[i] += 1",
"-x = 0",
"-for i in list(n.values()):",
"- if x <= i:",
"- x = i",
"-if x == 1:",
"+n = eval(input())",
"+a = list(map(int, ... | false | 0.037025 | 0.036709 | 1.008623 | [
"s484140285",
"s206341950"
] |
u585482323 | p02881 | python | s303955015 | s473473699 | 197 | 180 | 39,664 | 38,512 | Accepted | Accepted | 8.63 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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 sys.stdin.readline()... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | 56 | 38 | 1,249 | 944 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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 sys.stdin... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | false | 32.142857 | [
"+from itertools import permutations, accumulate",
"-import random",
"- return [int(x) for x in sys.stdin.readline().split()]",
"+ return [int(x) for x in sys.stdin.buffer.readline().split()]",
"- return int(sys.stdin.readline())",
"+ return int(sys.stdin.buffer.readline())",
"- def f(n):... | false | 0.039361 | 0.041394 | 0.950888 | [
"s303955015",
"s473473699"
] |
u475065881 | p03283 | python | s429719626 | s698825334 | 584 | 528 | 8,676 | 8,668 | Accepted | Accepted | 9.59 | import sys
from itertools import accumulate
N, M, Q = list(map(int, sys.stdin.readline().split()))
LR = [[0 for _ in range(N-i)] for i in range(N)]
for i in range(M):
L, R = list(map(int, sys.stdin.readline().split()))
LR[L-1][R-L] += 1
for i in range(N-2,-1,-1):
for j, (acc, pre) in enumerate(zip(acc... | import sys
from itertools import accumulate
N, M, Q = list(map(int, sys.stdin.readline().split()))
LR = [[0 for _ in range(N-i)] for i in range(N)]
for i in range(M):
L, R = list(map(int, sys.stdin.readline().split()))
LR[L-1][R-L] += 1
for i in range(N-2,-1,-1):
acc = accumulate(LR[i])
next(acc)... | 16 | 18 | 479 | 492 | import sys
from itertools import accumulate
N, M, Q = list(map(int, sys.stdin.readline().split()))
LR = [[0 for _ in range(N - i)] for i in range(N)]
for i in range(M):
L, R = list(map(int, sys.stdin.readline().split()))
LR[L - 1][R - L] += 1
for i in range(N - 2, -1, -1):
for j, (acc, pre) in enumerate(zi... | import sys
from itertools import accumulate
N, M, Q = list(map(int, sys.stdin.readline().split()))
LR = [[0 for _ in range(N - i)] for i in range(N)]
for i in range(M):
L, R = list(map(int, sys.stdin.readline().split()))
LR[L - 1][R - L] += 1
for i in range(N - 2, -1, -1):
acc = accumulate(LR[i])
next(... | false | 11.111111 | [
"- for j, (acc, pre) in enumerate(zip(accumulate(LR[i]), [0] + LR[i + 1])):",
"- LR[i][j] = acc + pre",
"+ acc = accumulate(LR[i])",
"+ next(acc)",
"+ for j in range(1, N - i):",
"+ LR[i][j] = next(acc) + LR[i + 1][j - 1]"
] | false | 0.046814 | 0.04835 | 0.968237 | [
"s429719626",
"s698825334"
] |
u817760251 | p02983 | python | s457457617 | s376391570 | 886 | 774 | 2,940 | 2,940 | Accepted | Accepted | 12.64 | l, r = list(map(int, input().split()))
mod = 2019
if r - l > 3000:
print((0))
else:
ans = mod
for i in range(l, r + 1):
for j in range(r, l, -1):
#print(str(i) + ' ' + str(j))
if j <= i: break
ans = min(ans, (i * j) % mod)
print(ans)
| l, r = list(map(int, input().split()))
if r - l > 3000:
print((0))
else:
ans = 3000
for i in range(l, r + 1):
for j in range(i + 1, r + 1):
ans = min(ans, i * j % 2019)
print(ans)
| 13 | 10 | 274 | 202 | l, r = list(map(int, input().split()))
mod = 2019
if r - l > 3000:
print((0))
else:
ans = mod
for i in range(l, r + 1):
for j in range(r, l, -1):
# print(str(i) + ' ' + str(j))
if j <= i:
break
ans = min(ans, (i * j) % mod)
print(ans)
| l, r = list(map(int, input().split()))
if r - l > 3000:
print((0))
else:
ans = 3000
for i in range(l, r + 1):
for j in range(i + 1, r + 1):
ans = min(ans, i * j % 2019)
print(ans)
| false | 23.076923 | [
"-mod = 2019",
"- ans = mod",
"+ ans = 3000",
"- for j in range(r, l, -1):",
"- # print(str(i) + ' ' + str(j))",
"- if j <= i:",
"- break",
"- ans = min(ans, (i * j) % mod)",
"+ for j in range(i + 1, r + 1):",
"+ ans = ... | false | 0.124502 | 0.107316 | 1.160146 | [
"s457457617",
"s376391570"
] |
u003475507 | p03037 | python | s054848442 | s939962239 | 359 | 124 | 16,628 | 9,076 | Accepted | Accepted | 65.46 | n,a = list(map(int,input().split()))
m = [tuple(map(int,input().split())) for _ in range(a)]
l,r=m[0][0],m[0][1]
for i in range(1,a):
l = max(m[i][0],l)
r = min(m[i][1],r)
print((max(r-l+1,0)))
| import sys
sys.setrecursionlimit(10000000)
input=sys.stdin.readline
n,m = list(map(int,input().split()))
ansl=-1
ansr=10**6
for _ in range(m):
l,r=list(map(int,input().split()))
ansl=max(ansl,l)
ansr=min(ansr,r)
print((max(ansr-ansl+1,0))) | 10 | 15 | 206 | 255 | n, a = list(map(int, input().split()))
m = [tuple(map(int, input().split())) for _ in range(a)]
l, r = m[0][0], m[0][1]
for i in range(1, a):
l = max(m[i][0], l)
r = min(m[i][1], r)
print((max(r - l + 1, 0)))
| import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
n, m = list(map(int, input().split()))
ansl = -1
ansr = 10**6
for _ in range(m):
l, r = list(map(int, input().split()))
ansl = max(ansl, l)
ansr = min(ansr, r)
print((max(ansr - ansl + 1, 0)))
| false | 33.333333 | [
"-n, a = list(map(int, input().split()))",
"-m = [tuple(map(int, input().split())) for _ in range(a)]",
"-l, r = m[0][0], m[0][1]",
"-for i in range(1, a):",
"- l = max(m[i][0], l)",
"- r = min(m[i][1], r)",
"-print((max(r - l + 1, 0)))",
"+import sys",
"+",
"+sys.setrecursionlimit(10000000)... | false | 0.03676 | 0.03752 | 0.979748 | [
"s054848442",
"s939962239"
] |
u498487134 | p03780 | python | s311433104 | s104954443 | 1,079 | 197 | 39,536 | 39,408 | Accepted | Accepted | 81.74 | def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
N,K=MI()
a=LI()#下位の連続するn枚が不要なはず
a.sort()
for i in range(N):#K以上ならば必要
if a[i]>=K:
a=a[:i]
break
N=len(a... | def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
N,K=MI()
a=LI()#下位の連続するn枚が不要なはず
a.sort(reverse=True)
#大きい方から順に足していき,K未満の最大の和を作っておく.これに対して,足してK以上になるのならそれは必要.K未満なら端しておく.
#最終的に必要なもののうち最も小さ... | 61 | 27 | 1,201 | 521 | def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
N, K = MI()
a = LI() # 下位の連続するn枚が不要なはず
a.sort()
for i in range(N): # K以上ならば必要
if a[i] >= K:
a = a[:i]
break... | def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
N, K = MI()
a = LI() # 下位の連続するn枚が不要なはず
a.sort(reverse=True)
# 大きい方から順に足していき,K未満の最大の和を作っておく.これに対して,足してK以上になるのならそれは必要.K未満なら端しておく.
# 最終的に必要... | false | 55.737705 | [
"- a.sort()",
"- for i in range(N): # K以上ならば必要",
"- if a[i] >= K:",
"- a = a[:i]",
"- break",
"- N = len(a)",
"- # x番目の数が必要かどうかの判定",
"- # 必要なものだけで構成された集合をもとに考えれば良いわけではない,不必要な分も考えなければならない",
"- def ch(x):",
"- # 使い回す,i番目まででjが作れるか",
"- d... | false | 0.038636 | 0.038869 | 0.994004 | [
"s311433104",
"s104954443"
] |
u046187684 | p02714 | python | s888595580 | s733868360 | 1,456 | 480 | 9,292 | 9,480 | Accepted | Accepted | 67.03 | def count_bigger(a, b):
i = j = 0
c = []
while i < len(a) and j < len(b):
if a[i] >= b[j]:
j += 1
continue
c.append(len(b) - j)
i += 1
if len(c) < len(a):
c += [0] * (len(a) - len(c))
for i in range(len(c) - 1, 0, -1):
c[i -... | from itertools import product
def solve(string):
n, s = string.split()
r, g, b = [], [], []
r2, g2, b2 = set([]), set([]), set([])
for i, _s in enumerate(s):
if _s == "R":
r.append(i)
r2.add(2 * i)
if _s == "G":
g.append(i)
g... | 44 | 30 | 1,066 | 773 | def count_bigger(a, b):
i = j = 0
c = []
while i < len(a) and j < len(b):
if a[i] >= b[j]:
j += 1
continue
c.append(len(b) - j)
i += 1
if len(c) < len(a):
c += [0] * (len(a) - len(c))
for i in range(len(c) - 1, 0, -1):
c[i - 1] += c[i]
... | from itertools import product
def solve(string):
n, s = string.split()
r, g, b = [], [], []
r2, g2, b2 = set([]), set([]), set([])
for i, _s in enumerate(s):
if _s == "R":
r.append(i)
r2.add(2 * i)
if _s == "G":
g.append(i)
g2.add(2 * i)
... | false | 31.818182 | [
"-def count_bigger(a, b):",
"- i = j = 0",
"- c = []",
"- while i < len(a) and j < len(b):",
"- if a[i] >= b[j]:",
"- j += 1",
"- continue",
"- c.append(len(b) - j)",
"- i += 1",
"- if len(c) < len(a):",
"- c += [0] * (len(a) - len(c)... | false | 0.033543 | 0.036625 | 0.915859 | [
"s888595580",
"s733868360"
] |
u475503988 | p03090 | python | s281686292 | s842994103 | 32 | 26 | 3,996 | 3,956 | Accepted | Accepted | 18.75 | n = int(eval(input()))
ans = []
if n % 2 == 0:
temp = n + 1
else:
temp = n
for i in range(1, n):
for j in range(i+1, n+1):
if i + j != temp:
ans.append((i, j))
print((len(ans)))
for a in ans:
print((a[0], a[1])) | n = int(eval(input()))
ans = []
if n % 2 == 0:
temp = n + 1
else:
temp = n
for i in range(1, n):
for j in range(i+1, n+1):
if i + j == temp:
continue
else:
ans.append((i, j))
print((len(ans)))
for a in ans:
print((a[0], a[1]))
| 16 | 18 | 255 | 293 | n = int(eval(input()))
ans = []
if n % 2 == 0:
temp = n + 1
else:
temp = n
for i in range(1, n):
for j in range(i + 1, n + 1):
if i + j != temp:
ans.append((i, j))
print((len(ans)))
for a in ans:
print((a[0], a[1]))
| n = int(eval(input()))
ans = []
if n % 2 == 0:
temp = n + 1
else:
temp = n
for i in range(1, n):
for j in range(i + 1, n + 1):
if i + j == temp:
continue
else:
ans.append((i, j))
print((len(ans)))
for a in ans:
print((a[0], a[1]))
| false | 11.111111 | [
"- if i + j != temp:",
"+ if i + j == temp:",
"+ continue",
"+ else:"
] | false | 0.035311 | 0.038653 | 0.913539 | [
"s281686292",
"s842994103"
] |
u540761833 | p02873 | python | s633650625 | s032876886 | 241 | 133 | 6,300 | 12,336 | Accepted | Accepted | 44.81 | S = eval(input())
ans = 0
a = []
up = True
count = 0
for i in S:
if up:
if i == '>':
a.append(count)
count = 1
up = False
else:
count += 1
else:
if i == '<':
a.append(count)
count = 1
up ... | S = input().replace('><','> <').split()
ans = 0
for s in S:
up = s.count('<')
down = len(s)-up
if up < down:
up -= 1
ans += up*(up+1)//2 + down*(down+1)//2
else:
down -= 1
ans += up*(up+1)//2 + down*(down+1)//2
print(ans) | 28 | 12 | 543 | 288 | S = eval(input())
ans = 0
a = []
up = True
count = 0
for i in S:
if up:
if i == ">":
a.append(count)
count = 1
up = False
else:
count += 1
else:
if i == "<":
a.append(count)
count = 1
up = True
el... | S = input().replace("><", "> <").split()
ans = 0
for s in S:
up = s.count("<")
down = len(s) - up
if up < down:
up -= 1
ans += up * (up + 1) // 2 + down * (down + 1) // 2
else:
down -= 1
ans += up * (up + 1) // 2 + down * (down + 1) // 2
print(ans)
| false | 57.142857 | [
"-S = eval(input())",
"+S = input().replace(\"><\", \"> <\").split()",
"-a = []",
"-up = True",
"-count = 0",
"-for i in S:",
"- if up:",
"- if i == \">\":",
"- a.append(count)",
"- count = 1",
"- up = False",
"- else:",
"- count +... | false | 0.03666 | 0.042438 | 0.863848 | [
"s633650625",
"s032876886"
] |
u888337853 | p02574 | python | s726892318 | s259370557 | 1,467 | 1,345 | 303,840 | 305,520 | Accepted | Accepted | 8.32 | import sys
import math
import collections
import bisect
import itertools
import decimal
# import numpy as np
# sys.setrecursionlimit(10 ** 6)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353
ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: list(map(int, sys.stdin.readline().rstrip().spli... | import sys
import math
import collections
import bisect
import itertools
import decimal
# import numpy as np
# sys.setrecursionlimit(10 ** 6)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353
ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: list(map(int, sys.stdin.readline().rstrip().spli... | 113 | 64 | 2,561 | 1,363 | import sys
import math
import collections
import bisect
import itertools
import decimal
# import numpy as np
# sys.setrecursionlimit(10 ** 6)
INF = 10**20
MOD = 10**9 + 7
# MOD = 998244353
ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na = lambda: li... | import sys
import math
import collections
import bisect
import itertools
import decimal
# import numpy as np
# sys.setrecursionlimit(10 ** 6)
INF = 10**20
MOD = 10**9 + 7
# MOD = 998244353
ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na = lambda: li... | false | 43.362832 | [
"-class UnionFind:",
"- def __init__(self, n):",
"- self.n = n",
"- self.parents = [-1] * n",
"-",
"- def find(self, x):",
"- if self.parents[x] < 0:",
"- return x",
"- else:",
"- self.parents[x] = self.find(self.parents[x])",
"- ... | false | 0.051487 | 0.048819 | 1.054666 | [
"s726892318",
"s259370557"
] |
u558242240 | p02695 | python | s049764615 | s519366853 | 938 | 727 | 9,200 | 9,248 | Accepted | Accepted | 22.49 | n, m, q = list(map(int, input().split()))
abcd = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
import itertools
for i in itertools.combinations_with_replacement(list(range(1, m+1)), n):
sumd = 0
for j in abcd:
if i[j[1]-1] - i[j[0]-1] == j[2]:
sumd += j[3]
ans =... | n, m, q = list(map(int, input().split()))
abcd = [tuple(map(int, input().split())) for _ in range(q)]
import sys
sys.setrecursionlimit(10**6)
ans = [0]
def dfs(idx, now):
if idx == n:
#print(now)
sumd = 0
for j in abcd:
if now[j[1]-1] - now[j[0]-1] == j[2]:
... | 12 | 26 | 335 | 593 | n, m, q = list(map(int, input().split()))
abcd = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
import itertools
for i in itertools.combinations_with_replacement(list(range(1, m + 1)), n):
sumd = 0
for j in abcd:
if i[j[1] - 1] - i[j[0] - 1] == j[2]:
sumd += j[3]
ans = max... | n, m, q = list(map(int, input().split()))
abcd = [tuple(map(int, input().split())) for _ in range(q)]
import sys
sys.setrecursionlimit(10**6)
ans = [0]
def dfs(idx, now):
if idx == n:
# print(now)
sumd = 0
for j in abcd:
if now[j[1] - 1] - now[j[0] - 1] == j[2]:
... | false | 53.846154 | [
"-ans = 0",
"-import itertools",
"+import sys",
"-for i in itertools.combinations_with_replacement(list(range(1, m + 1)), n):",
"- sumd = 0",
"- for j in abcd:",
"- if i[j[1] - 1] - i[j[0] - 1] == j[2]:",
"- sumd += j[3]",
"- ans = max(ans, sumd)",
"-print(ans)",
"+sys... | false | 0.042776 | 0.051303 | 0.833789 | [
"s049764615",
"s519366853"
] |
u724687935 | p03780 | python | s330886358 | s796536708 | 1,974 | 815 | 42,068 | 39,792 | Accepted | Accepted | 58.71 | def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
# [ok, ng) - Maximum
# (ng, ok] - Minimum
# ok が 最終的な答え
ok = N
ng = -1
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
n = mid
dp = [0] * (K + 1)
... | def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
# [ok, ng) - Maximum
# (ng, ok] - Minimum
# ok が 最終的な答え
ok = N
ng = -1
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
n = mid
dp = [0] * (K + 1)
... | 31 | 31 | 687 | 682 | def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
# [ok, ng) - Maximum
# (ng, ok] - Minimum
# ok が 最終的な答え
ok = N
ng = -1
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
n = mid
dp = [0] * (K + 1)
dp[0] = 1
... | def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
# [ok, ng) - Maximum
# (ng, ok] - Minimum
# ok が 最終的な答え
ok = N
ng = -1
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
n = mid
dp = [0] * (K + 1)
dp[0] = 1
... | false | 0 | [
"- for j in range(K, -1, -1):",
"- dp[min(K, j + a)] |= dp[j]",
"+ for j in range(K, a - 1, -1):",
"+ dp[j] |= dp[j - a]"
] | false | 0.040824 | 0.034811 | 1.172737 | [
"s330886358",
"s796536708"
] |
u596536048 | p04011 | python | s130896526 | s477760990 | 31 | 28 | 9,016 | 9,024 | Accepted | Accepted | 9.68 | N, K, X, Y = (int(eval(input())) for i in range(4))
print((K * X + (N - K) * Y if N > K else N * X)) | N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
if N > K:
print((K * X + (N - K) * Y))
else:
print((N * X)) | 2 | 8 | 93 | 132 | N, K, X, Y = (int(eval(input())) for i in range(4))
print((K * X + (N - K) * Y if N > K else N * X))
| N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
if N > K:
print((K * X + (N - K) * Y))
else:
print((N * X))
| false | 75 | [
"-N, K, X, Y = (int(eval(input())) for i in range(4))",
"-print((K * X + (N - K) * Y if N > K else N * X))",
"+N = int(eval(input()))",
"+K = int(eval(input()))",
"+X = int(eval(input()))",
"+Y = int(eval(input()))",
"+if N > K:",
"+ print((K * X + (N - K) * Y))",
"+else:",
"+ print((N * X))... | false | 0.037092 | 0.03818 | 0.971517 | [
"s130896526",
"s477760990"
] |
u357751375 | p03370 | python | s796366171 | s175824441 | 42 | 28 | 9,040 | 9,032 | Accepted | Accepted | 33.33 | n,x = list(map(int,input().split()))
m = list(int(eval(input())) for i in range(n))
m.sort()
z = sum(m)
s = n
while x > z:
z += m[0]
if x >= z:
s += 1
print(s) | n,x = list(map(int,input().split()))
m = list(int(eval(input())) for i in range(n))
m.sort()
z = sum(m)
print((n+(x-z)//m[0])) | 13 | 5 | 178 | 116 | n, x = list(map(int, input().split()))
m = list(int(eval(input())) for i in range(n))
m.sort()
z = sum(m)
s = n
while x > z:
z += m[0]
if x >= z:
s += 1
print(s)
| n, x = list(map(int, input().split()))
m = list(int(eval(input())) for i in range(n))
m.sort()
z = sum(m)
print((n + (x - z) // m[0]))
| false | 61.538462 | [
"-s = n",
"-while x > z:",
"- z += m[0]",
"- if x >= z:",
"- s += 1",
"-print(s)",
"+print((n + (x - z) // m[0]))"
] | false | 0.049095 | 0.048457 | 1.013171 | [
"s796366171",
"s175824441"
] |
u325282913 | p02900 | python | s954197094 | s275315771 | 219 | 198 | 3,060 | 38,512 | Accepted | Accepted | 9.59 | import math
def trial_division(n):
a = [1]
for i in range(2,int(math.sqrt(n)) + 1):
while n % i == 0:
n //= i
a.append(i)
a.append(n)
return a
A, B = list(map(int, input().split()))
ans = set(trial_division(A)) & set(trial_division(B))
print((len(ans))) | import math
def trial_division(n):
a = [1]
for i in range(2,int(math.sqrt(n)) + 1):
while n % i == 0:
n //= i
a.append(i)
a.append(n)
return a
A, B = list(map(int, input().split()))
print((len(set(trial_division(A))&set(trial_division(B))))) | 12 | 12 | 304 | 293 | import math
def trial_division(n):
a = [1]
for i in range(2, int(math.sqrt(n)) + 1):
while n % i == 0:
n //= i
a.append(i)
a.append(n)
return a
A, B = list(map(int, input().split()))
ans = set(trial_division(A)) & set(trial_division(B))
print((len(ans)))
| import math
def trial_division(n):
a = [1]
for i in range(2, int(math.sqrt(n)) + 1):
while n % i == 0:
n //= i
a.append(i)
a.append(n)
return a
A, B = list(map(int, input().split()))
print((len(set(trial_division(A)) & set(trial_division(B)))))
| false | 0 | [
"-ans = set(trial_division(A)) & set(trial_division(B))",
"-print((len(ans)))",
"+print((len(set(trial_division(A)) & set(trial_division(B)))))"
] | false | 0.036044 | 0.048522 | 0.742835 | [
"s954197094",
"s275315771"
] |
u905203728 | p03127 | python | s320882791 | s998016214 | 137 | 121 | 14,252 | 16,280 | Accepted | Accepted | 11.68 | n=int(eval(input()))
A=sorted(list(map(int,input().split())))
minA=min(A)
while len(A)!=1:
B=[]
for i in range(len(A)):
if A[i]%minA!=0:
B.append(A[i]%minA)
B.append(minA)
A=B
minA=min(A)
print(minA) | from fractions import gcd
from functools import reduce
def lcm_list(numbers):
return reduce(gcd,numbers)
n=int(eval(input()))
A=sorted(list(map(int,input().split())))
print((lcm_list(A))) | 13 | 11 | 246 | 197 | n = int(eval(input()))
A = sorted(list(map(int, input().split())))
minA = min(A)
while len(A) != 1:
B = []
for i in range(len(A)):
if A[i] % minA != 0:
B.append(A[i] % minA)
B.append(minA)
A = B
minA = min(A)
print(minA)
| from fractions import gcd
from functools import reduce
def lcm_list(numbers):
return reduce(gcd, numbers)
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
print((lcm_list(A)))
| false | 15.384615 | [
"+from fractions import gcd",
"+from functools import reduce",
"+",
"+",
"+def lcm_list(numbers):",
"+ return reduce(gcd, numbers)",
"+",
"+",
"-minA = min(A)",
"-while len(A) != 1:",
"- B = []",
"- for i in range(len(A)):",
"- if A[i] % minA != 0:",
"- B.append(... | false | 0.039222 | 0.054267 | 0.722754 | [
"s320882791",
"s998016214"
] |
u340064601 | p02556 | python | s051551656 | s626842150 | 992 | 515 | 62,856 | 58,088 | Accepted | Accepted | 48.08 | input=__import__('sys').stdin.readline
def getdist(a,b):return abs(a[0]-b[0])+abs(a[1]-b[1])
n=int(eval(input()))
s=[]
for _ in range(n):s.append([*list(map(int,input().split()))])
ans=0
sx=sorted(s)
sy=sorted(s,key=lambda x:x[1])
ans=max(ans,getdist(sx[-1],sx[-2]))
ans=max(ans,getdist(sx[0],sx[1]))
ans=max(a... | input=__import__('sys').stdin.readline
def getdist(a,b):return abs(a[0]-b[0])+abs(a[1]-b[1])
n=int(eval(input()))
s=[]
for _ in range(n):s.append([*list(map(int,input().split()))])
ans=0
def ff1(x):return x[0]+x[1]
def ff2(x):return x[0]-x[1]
f1=sorted(s,key=ff1)
f2=sorted(s,key=ff2)
ans=max(ans,getdist(f1[0]... | 33 | 17 | 1,027 | 509 | input = __import__("sys").stdin.readline
def getdist(a, b):
return abs(a[0] - b[0]) + abs(a[1] - b[1])
n = int(eval(input()))
s = []
for _ in range(n):
s.append([*list(map(int, input().split()))])
ans = 0
sx = sorted(s)
sy = sorted(s, key=lambda x: x[1])
ans = max(ans, getdist(sx[-1], sx[-2]))
ans = max(ans... | input = __import__("sys").stdin.readline
def getdist(a, b):
return abs(a[0] - b[0]) + abs(a[1] - b[1])
n = int(eval(input()))
s = []
for _ in range(n):
s.append([*list(map(int, input().split()))])
ans = 0
def ff1(x):
return x[0] + x[1]
def ff2(x):
return x[0] - x[1]
f1 = sorted(s, key=ff1)
f2 ... | false | 48.484848 | [
"-sx = sorted(s)",
"-sy = sorted(s, key=lambda x: x[1])",
"-ans = max(ans, getdist(sx[-1], sx[-2]))",
"-ans = max(ans, getdist(sx[0], sx[1]))",
"-ans = max(ans, getdist(sy[-1], sy[-2]))",
"-ans = max(ans, getdist(sy[0], sy[1]))",
"-",
"-",
"-def ff1(x):",
"- return abs(x[0] + x[1])",
"-",
"... | false | 0.044778 | 0.044682 | 1.002133 | [
"s051551656",
"s626842150"
] |
u671252250 | p03733 | python | s921578438 | s474086981 | 278 | 161 | 86,608 | 26,836 | Accepted | Accepted | 42.09 | # coding: utf-8
# Your code here!
N, T = list(map(int, input().split()))
a = list(map(int, input().split()))
total_t, crrnt_t, a_len = 0, 0, len(a)
for i in range(a_len - 1):
if a[i] + T > a[i + 1]:
total_t += a[i + 1] - a[i]
else:
total_t += T
crrnt_t = a[i + 1]
print((to... | # coding: utf-8
# Your code here!
N, T = list(map(int, input().split()))
a = list(map(int, input().split()))
total_t, a_len = 0, len(a)
for i in range(a_len - 1):
if a[i] + T > a[i + 1]:
total_t += a[i + 1] - a[i]
else:
total_t += T
print((total_t + T)) | 15 | 14 | 323 | 287 | # coding: utf-8
# Your code here!
N, T = list(map(int, input().split()))
a = list(map(int, input().split()))
total_t, crrnt_t, a_len = 0, 0, len(a)
for i in range(a_len - 1):
if a[i] + T > a[i + 1]:
total_t += a[i + 1] - a[i]
else:
total_t += T
crrnt_t = a[i + 1]
print((total_t + T))
| # coding: utf-8
# Your code here!
N, T = list(map(int, input().split()))
a = list(map(int, input().split()))
total_t, a_len = 0, len(a)
for i in range(a_len - 1):
if a[i] + T > a[i + 1]:
total_t += a[i + 1] - a[i]
else:
total_t += T
print((total_t + T))
| false | 6.666667 | [
"-total_t, crrnt_t, a_len = 0, 0, len(a)",
"+total_t, a_len = 0, len(a)",
"- crrnt_t = a[i + 1]"
] | false | 0.057323 | 0.057478 | 0.997307 | [
"s921578438",
"s474086981"
] |
u197300773 | p03039 | python | s908313838 | s832320472 | 802 | 84 | 3,064 | 3,064 | Accepted | Accepted | 89.53 | def modinv(a):
b=MOD
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
(a, b) = (b, a % b)
(x, lastx) = (lastx - q * x, x)
(y, lasty) = (lasty - q * y, y)
return lastx%MOD
MOD=10**9+7
N,M,K=list(map(int,input().split()))
b=1
for i in ra... | def comb(n, k):
x, y = 1, 1
k = min(k, n-k)
for i in range(k):
x *= n - i
x %= MOD
y *= i + 1
y %= MOD
return x*pow(y, MOD-2, MOD) % MOD
def modinv(a):
b=MOD
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
... | 30 | 37 | 516 | 662 | def modinv(a):
b = MOD
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
(a, b) = (b, a % b)
(x, lastx) = (lastx - q * x, x)
(y, lasty) = (lasty - q * y, y)
return lastx % MOD
MOD = 10**9 + 7
N, M, K = list(map(int, input().split()))
b = 1
for i in ra... | def comb(n, k):
x, y = 1, 1
k = min(k, n - k)
for i in range(k):
x *= n - i
x %= MOD
y *= i + 1
y %= MOD
return x * pow(y, MOD - 2, MOD) % MOD
def modinv(a):
b = MOD
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
(a, b) ... | false | 18.918919 | [
"+def comb(n, k):",
"+ x, y = 1, 1",
"+ k = min(k, n - k)",
"+ for i in range(k):",
"+ x *= n - i",
"+ x %= MOD",
"+ y *= i + 1",
"+ y %= MOD",
"+ return x * pow(y, MOD - 2, MOD) % MOD",
"+",
"+",
"-b = 1",
"-for i in range(1, K - 1):",
"- b = (b ... | false | 0.078488 | 0.032571 | 2.409769 | [
"s908313838",
"s832320472"
] |
u191874006 | p03323 | python | s761511932 | s608191884 | 150 | 17 | 12,508 | 2,940 | Accepted | Accepted | 88.67 | #!/usr/bin/env python3
import numpy as np
import math
import re
import functools
n = eval(input())
n = re.split(" ",n)
a = int(n[0])
b = int(n[1])
if(a > 8 or b > 8):
print(":(")
else:
print("Yay!") | #!/usr/bin/env python3
#ABC100 A
A,B = list(map(int,input().split()))
f = 1
if A > 8:
f = 0
if B > 8:
f = 0
if f:
print('Yay!')
else:
print(':(')
| 16 | 14 | 218 | 171 | #!/usr/bin/env python3
import numpy as np
import math
import re
import functools
n = eval(input())
n = re.split(" ", n)
a = int(n[0])
b = int(n[1])
if a > 8 or b > 8:
print(":(")
else:
print("Yay!")
| #!/usr/bin/env python3
# ABC100 A
A, B = list(map(int, input().split()))
f = 1
if A > 8:
f = 0
if B > 8:
f = 0
if f:
print("Yay!")
else:
print(":(")
| false | 12.5 | [
"-import numpy as np",
"-import math",
"-import re",
"-import functools",
"-",
"-n = eval(input())",
"-n = re.split(\" \", n)",
"-a = int(n[0])",
"-b = int(n[1])",
"-if a > 8 or b > 8:",
"+# ABC100 A",
"+A, B = list(map(int, input().split()))",
"+f = 1",
"+if A > 8:",
"+ f = 0",
"+i... | false | 0.093269 | 0.037777 | 2.468897 | [
"s761511932",
"s608191884"
] |
u767797498 | p03785 | python | s705453743 | s415781314 | 1,004 | 223 | 13,344 | 13,308 | Accepted | Accepted | 77.79 | n,c,k=list(map(int,input().split()))
t=[int(eval(input())) for x in range(n)]
t.sort()
i=0
cnt=0
while i<n:
departure=t[i]+k
p=0
for j in range(i,n):
if t[j] > departure:
break
p+=1
i+=min(c,p)
cnt+=1
print(cnt)
| n,c,k=list(map(int,input().split()))
t=[int(eval(input())) for x in range(n)]
t.sort()
i=0
cnt=0
while i<n:
departure=t[i]+k
p=0
for j in range(i,n):
if t[j] > departure or p==c:
break
p+=1
i+=p
cnt+=1
print(cnt) | 17 | 16 | 242 | 240 | n, c, k = list(map(int, input().split()))
t = [int(eval(input())) for x in range(n)]
t.sort()
i = 0
cnt = 0
while i < n:
departure = t[i] + k
p = 0
for j in range(i, n):
if t[j] > departure:
break
p += 1
i += min(c, p)
cnt += 1
print(cnt)
| n, c, k = list(map(int, input().split()))
t = [int(eval(input())) for x in range(n)]
t.sort()
i = 0
cnt = 0
while i < n:
departure = t[i] + k
p = 0
for j in range(i, n):
if t[j] > departure or p == c:
break
p += 1
i += p
cnt += 1
print(cnt)
| false | 5.882353 | [
"- if t[j] > departure:",
"+ if t[j] > departure or p == c:",
"- i += min(c, p)",
"+ i += p"
] | false | 0.067087 | 0.0762 | 0.880398 | [
"s705453743",
"s415781314"
] |
u820685137 | p02573 | python | s587070612 | s351311461 | 732 | 582 | 16,788 | 16,688 | Accepted | Accepted | 20.49 | """D."""
import sys
#def input() -> str: # noqa: A001
# """Input."""
# return sys.stdin.readline()[:-1]
class UnionFindTree:
"""Union-find."""
def __init__(self, n: int) -> None:
"""Init."""
self.n = n
self.rank = [-1] * n
def find_root(self, x: int) -> ... | """D."""
import sys
def input() -> str: # noqa: A001
"""Input."""
return sys.stdin.readline()[:-1]
class UnionFindTree:
"""Union-find."""
def __init__(self, n: int) -> None:
"""Init."""
self.n = n
self.rank = [-1] * n
def find_root(self, x: int) -> i... | 63 | 64 | 1,353 | 1,352 | """D."""
import sys
# def input() -> str: # noqa: A001
# """Input."""
# return sys.stdin.readline()[:-1]
class UnionFindTree:
"""Union-find."""
def __init__(self, n: int) -> None:
"""Init."""
self.n = n
self.rank = [-1] * n
def find_root(self, x: int) -> int:
"""Fin... | """D."""
import sys
def input() -> str: # noqa: A001
"""Input."""
return sys.stdin.readline()[:-1]
class UnionFindTree:
"""Union-find."""
def __init__(self, n: int) -> None:
"""Init."""
self.n = n
self.rank = [-1] * n
def find_root(self, x: int) -> int:
"""Find... | false | 1.5625 | [
"-# def input() -> str: # noqa: A001",
"-# \"\"\"Input.\"\"\"",
"-# return sys.stdin.readline()[:-1]",
"+",
"+def input() -> str: # noqa: A001",
"+ \"\"\"Input.\"\"\"",
"+ return sys.stdin.readline()[:-1]",
"+",
"+"
] | false | 0.037818 | 0.039129 | 0.966494 | [
"s587070612",
"s351311461"
] |
u970197315 | p03672 | python | s199818212 | s266385803 | 64 | 17 | 3,064 | 2,940 | Accepted | Accepted | 73.44 | # ABC066 B - ss
S = eval(input())
N = len(S)
ans = 0
for i in range(1,N):
ss = S[0:N-i]
if len(ss)%2 == 1:
continue
n = len(ss)//2
sf = ss[0:n]
st = ss[n:N+1]
if sf == st:
ans = max(ans,len(ss))
print(ans) | s=eval(input())
n=len(s)
for i in range(n-1,1,-1):
t=s[:i]
nt=len(t)
if nt%2==1:
continue
if t[nt//2:]==t[:nt//2]:
print(nt)
exit() | 15 | 10 | 254 | 174 | # ABC066 B - ss
S = eval(input())
N = len(S)
ans = 0
for i in range(1, N):
ss = S[0 : N - i]
if len(ss) % 2 == 1:
continue
n = len(ss) // 2
sf = ss[0:n]
st = ss[n : N + 1]
if sf == st:
ans = max(ans, len(ss))
print(ans)
| s = eval(input())
n = len(s)
for i in range(n - 1, 1, -1):
t = s[:i]
nt = len(t)
if nt % 2 == 1:
continue
if t[nt // 2 :] == t[: nt // 2]:
print(nt)
exit()
| false | 33.333333 | [
"-# ABC066 B - ss",
"-S = eval(input())",
"-N = len(S)",
"-ans = 0",
"-for i in range(1, N):",
"- ss = S[0 : N - i]",
"- if len(ss) % 2 == 1:",
"+s = eval(input())",
"+n = len(s)",
"+for i in range(n - 1, 1, -1):",
"+ t = s[:i]",
"+ nt = len(t)",
"+ if nt % 2 == 1:",
"- n... | false | 0.038349 | 0.037775 | 1.015193 | [
"s199818212",
"s266385803"
] |
u070201429 | p03425 | python | s559744611 | s551792877 | 147 | 68 | 9,204 | 9,216 | Accepted | Accepted | 53.74 | n = int(eval(input()))
m, a, r, c, h = 0, 0, 0, 0, 0
for _ in range(n):
i = eval(input())
i = i[0]
if i == 'M':
m += 1
elif i == 'A':
a += 1
elif i == 'R':
r += 1
elif i == 'C':
c += 1
elif i == 'H':
h += 1
ans = 0
from itertools impo... | from sys import stdin
def input():
return stdin.readline().strip()
n = int(eval(input()))
m, a, r, c, h = 0, 0, 0, 0, 0
for _ in range(n):
i = eval(input())
i = i[0]
if i == 'M':
m += 1
elif i == 'A':
a += 1
elif i == 'R':
r += 1
elif i == 'C':
... | 22 | 26 | 418 | 494 | n = int(eval(input()))
m, a, r, c, h = 0, 0, 0, 0, 0
for _ in range(n):
i = eval(input())
i = i[0]
if i == "M":
m += 1
elif i == "A":
a += 1
elif i == "R":
r += 1
elif i == "C":
c += 1
elif i == "H":
h += 1
ans = 0
from itertools import combinations
f... | from sys import stdin
def input():
return stdin.readline().strip()
n = int(eval(input()))
m, a, r, c, h = 0, 0, 0, 0, 0
for _ in range(n):
i = eval(input())
i = i[0]
if i == "M":
m += 1
elif i == "A":
a += 1
elif i == "R":
r += 1
elif i == "C":
c += 1
... | false | 15.384615 | [
"+from sys import stdin",
"+",
"+",
"+def input():",
"+ return stdin.readline().strip()",
"+",
"+"
] | false | 0.211736 | 0.045613 | 4.641996 | [
"s559744611",
"s551792877"
] |
u512342660 | p02469 | python | s823284888 | s883182838 | 4,230 | 10 | 6,420 | 6,448 | Accepted | Accepted | 99.76 | n = eval(input())
nums = list(map(int,input().split()))
nums = sorted(nums)
i=n-2
x=1
while True:
if i<0:
break
tmp =nums[n-1]*x
if tmp%nums[i]==0:
i-=1
else:
x+=1
i=n-2
print(tmp) | n = eval(input())
nums = list(map(int,input().split()))
x = 2
checklist = [0 for i in range(n)]
table = []
while x<=max(nums):
i=0
while i<n:
if nums[i]%x==0:
checklist[i]=0
nums[i] = nums[i]/x
else:
checklist[i]=1
i+=1
if 0 in checkl... | 15 | 30 | 234 | 565 | n = eval(input())
nums = list(map(int, input().split()))
nums = sorted(nums)
i = n - 2
x = 1
while True:
if i < 0:
break
tmp = nums[n - 1] * x
if tmp % nums[i] == 0:
i -= 1
else:
x += 1
i = n - 2
print(tmp)
| n = eval(input())
nums = list(map(int, input().split()))
x = 2
checklist = [0 for i in range(n)]
table = []
while x <= max(nums):
i = 0
while i < n:
if nums[i] % x == 0:
checklist[i] = 0
nums[i] = nums[i] / x
else:
checklist[i] = 1
i += 1
if 0 in c... | false | 50 | [
"-nums = sorted(nums)",
"-i = n - 2",
"-x = 1",
"-while True:",
"- if i < 0:",
"- break",
"- tmp = nums[n - 1] * x",
"- if tmp % nums[i] == 0:",
"- i -= 1",
"+x = 2",
"+checklist = [0 for i in range(n)]",
"+table = []",
"+while x <= max(nums):",
"+ i = 0",
"+ ... | false | 0.052099 | 0.052042 | 1.001105 | [
"s823284888",
"s883182838"
] |
u226108478 | p03331 | python | s849745630 | s406898853 | 437 | 17 | 3,060 | 2,940 | Accepted | Accepted | 96.11 | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
def sum_digit(number):
string = str(number)
array = list(map(int, list(string)))
return sum(array)
if __name__ == '__main__':
n = int(eval(input()))
a = 0
digit_sum_min = 1000000
for i in range(1, n):
... | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
if __name__ == '__main__':
n = int(eval(input()))
# See:
# https://www.youtube.com/watch?v=Ommfmx2wtuY
if (n == 10) or (n == 100) or (n == 1000) or (n == 10000) or (n == 100000):
print((10))
else:
print((su... | 26 | 15 | 489 | 344 | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
def sum_digit(number):
string = str(number)
array = list(map(int, list(string)))
return sum(array)
if __name__ == "__main__":
n = int(eval(input()))
a = 0
digit_sum_min = 1000000
for i in range(1, n):
a = i
b = n -... | # -*- coding: utf-8 -*-
# AtCoder Grand Contest
# Problem A
if __name__ == "__main__":
n = int(eval(input()))
# See:
# https://www.youtube.com/watch?v=Ommfmx2wtuY
if (n == 10) or (n == 100) or (n == 1000) or (n == 10000) or (n == 100000):
print((10))
else:
print((sum(list(map(int, li... | false | 42.307692 | [
"-def sum_digit(number):",
"- string = str(number)",
"- array = list(map(int, list(string)))",
"- return sum(array)",
"-",
"-",
"- a = 0",
"- digit_sum_min = 1000000",
"- for i in range(1, n):",
"- a = i",
"- b = n - a",
"- sum_a = sum_digit(a)",
"- ... | false | 0.294769 | 0.037483 | 7.864144 | [
"s849745630",
"s406898853"
] |
u803617136 | p02923 | python | s397262241 | s049361125 | 216 | 95 | 63,984 | 14,252 | Accepted | Accepted | 56.02 | N = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(1, N):
if h[i] <= h[i - 1]:
cnt += 1
else:
ans = max(ans, cnt)
cnt = 0
ans = max(ans, cnt)
print(ans)
| n = int(eval(input()))
height = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(1, n):
if height[i] > height[i - 1]:
cnt = 0
else:
cnt += 1
ans = max(ans, cnt)
print(ans) | 13 | 12 | 231 | 219 | N = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(1, N):
if h[i] <= h[i - 1]:
cnt += 1
else:
ans = max(ans, cnt)
cnt = 0
ans = max(ans, cnt)
print(ans)
| n = int(eval(input()))
height = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(1, n):
if height[i] > height[i - 1]:
cnt = 0
else:
cnt += 1
ans = max(ans, cnt)
print(ans)
| false | 7.692308 | [
"-N = int(eval(input()))",
"-h = list(map(int, input().split()))",
"+n = int(eval(input()))",
"+height = list(map(int, input().split()))",
"-for i in range(1, N):",
"- if h[i] <= h[i - 1]:",
"+for i in range(1, n):",
"+ if height[i] > height[i - 1]:",
"+ cnt = 0",
"+ else:",
"- ... | false | 0.043938 | 0.037501 | 1.171649 | [
"s397262241",
"s049361125"
] |
u965436898 | p03266 | python | s039444554 | s619296924 | 93 | 20 | 4,596 | 3,060 | Accepted | Accepted | 78.49 | n,k = list(map(int,input().split()))
num = [0] * k
ans = 0
for i in range(1,n + 1):
num[i%k] += 1
for a in range(k):
b = (k - a) % k
c = (k - a) % k
if (b + c) % k != 0:
continue
ans += num[a] * num[b] * num[c]
print(ans) | n,k = list(map(int,input().split()))
def gcd(a,b):
if b == 0:
return a
return gcd(b,a % b)
def lcm(a,b):
return a * b // gcd(a,b)
if k % 2 != 0:
elements = n // k
print((elements**3))
else:
a = n // k
b = (n + (k//2)) // k
print((a**3 + b ** 3)) | 12 | 14 | 240 | 268 | n, k = list(map(int, input().split()))
num = [0] * k
ans = 0
for i in range(1, n + 1):
num[i % k] += 1
for a in range(k):
b = (k - a) % k
c = (k - a) % k
if (b + c) % k != 0:
continue
ans += num[a] * num[b] * num[c]
print(ans)
| n, k = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return a * b // gcd(a, b)
if k % 2 != 0:
elements = n // k
print((elements**3))
else:
a = n // k
b = (n + (k // 2)) // k
print((a**3 + b**3))
| false | 14.285714 | [
"-num = [0] * k",
"-ans = 0",
"-for i in range(1, n + 1):",
"- num[i % k] += 1",
"-for a in range(k):",
"- b = (k - a) % k",
"- c = (k - a) % k",
"- if (b + c) % k != 0:",
"- continue",
"- ans += num[a] * num[b] * num[c]",
"-print(ans)",
"+",
"+",
"+def gcd(a, b):",
... | false | 0.039785 | 0.123799 | 0.321367 | [
"s039444554",
"s619296924"
] |
u506705885 | p02394 | python | s358999731 | s834141460 | 60 | 30 | 7,724 | 5,596 | Accepted | Accepted | 50 | All=input().split()
W=int(All[0])
H=int(All[1])
x=int(All[2])
y=int(All[3])
r=int(All[4])
if x+r<=W and x-r>=0 and y+r<=H and y-r>=0:
print('Yes')
else:
print('No') | W,H,x,y,r=list(map(int,input().split()))
if x+r>W or y+r>H or x-r<0 or y-r<0:
print("No")
else:
print("Yes") | 10 | 5 | 181 | 114 | All = input().split()
W = int(All[0])
H = int(All[1])
x = int(All[2])
y = int(All[3])
r = int(All[4])
if x + r <= W and x - r >= 0 and y + r <= H and y - r >= 0:
print("Yes")
else:
print("No")
| W, H, x, y, r = list(map(int, input().split()))
if x + r > W or y + r > H or x - r < 0 or y - r < 0:
print("No")
else:
print("Yes")
| false | 50 | [
"-All = input().split()",
"-W = int(All[0])",
"-H = int(All[1])",
"-x = int(All[2])",
"-y = int(All[3])",
"-r = int(All[4])",
"-if x + r <= W and x - r >= 0 and y + r <= H and y - r >= 0:",
"+W, H, x, y, r = list(map(int, input().split()))",
"+if x + r > W or y + r > H or x - r < 0 or y - r < 0:",
... | false | 0.046728 | 0.04701 | 0.993998 | [
"s358999731",
"s834141460"
] |
u987164499 | p03574 | python | s668421136 | s729571784 | 33 | 25 | 3,188 | 3,064 | Accepted | Accepted | 24.24 | from sys import stdin,setrecursionlimit
setrecursionlimit(10 ** 7)
h,w = list(map(int,stdin.readline().rstrip().split()))
s = [stdin.readline().rstrip() for _ in range(h)]
li = [[0 for i in range(w)]for j in range(h)]
x = [-1,0,1]
y = [-1,0,1]
for i in range(h):
for j in range(w):
count = 0... | h,w = list(map(int,input().split()))
s = ["."*(w+2)]
for _ in range(h):
s.append("."+eval(input())+".")
s.append("."*(w+2))
li = [[0 for j in range(w)]for i in range(h)]
h += 2
w += 2
for i in range(1,h-1):
for j in range(1,w-1):
if s[i][j] == "#":
li[i-1][j-1] = "#"
... | 30 | 30 | 786 | 658 | from sys import stdin, setrecursionlimit
setrecursionlimit(10**7)
h, w = list(map(int, stdin.readline().rstrip().split()))
s = [stdin.readline().rstrip() for _ in range(h)]
li = [[0 for i in range(w)] for j in range(h)]
x = [-1, 0, 1]
y = [-1, 0, 1]
for i in range(h):
for j in range(w):
count = 0
f... | h, w = list(map(int, input().split()))
s = ["." * (w + 2)]
for _ in range(h):
s.append("." + eval(input()) + ".")
s.append("." * (w + 2))
li = [[0 for j in range(w)] for i in range(h)]
h += 2
w += 2
for i in range(1, h - 1):
for j in range(1, w - 1):
if s[i][j] == "#":
li[i - 1][j - 1] = "#"... | false | 0 | [
"-from sys import stdin, setrecursionlimit",
"-",
"-setrecursionlimit(10**7)",
"-h, w = list(map(int, stdin.readline().rstrip().split()))",
"-s = [stdin.readline().rstrip() for _ in range(h)]",
"-li = [[0 for i in range(w)] for j in range(h)]",
"-x = [-1, 0, 1]",
"-y = [-1, 0, 1]",
"-for i in range(... | false | 0.066684 | 0.046602 | 1.430913 | [
"s668421136",
"s729571784"
] |
u753803401 | p03221 | python | s280405097 | s156329952 | 961 | 813 | 66,780 | 64,988 | Accepted | Accepted | 15.4 | def slove():
import sys
input = sys.stdin.readline
n, m = list(map(int, input().rstrip('\n').split()))
py = []
ls = [1] * (n + 1)
for i in range(m):
p, y = list(map(int, input().rstrip('\n').split()))
py.append([p, y, 0, i])
py.sort()
for i in range(m):
... | def slove():
import sys
input = sys.stdin.readline
n, m = list(map(int, input().rstrip('\n').split()))
py = []
pyn = [1] * n
for i in range(m):
p, y = list(map(int, input().rstrip('\n').split()))
py.append([p, y, i])
py.sort()
for i in range(len(py)):
p... | 26 | 25 | 671 | 643 | def slove():
import sys
input = sys.stdin.readline
n, m = list(map(int, input().rstrip("\n").split()))
py = []
ls = [1] * (n + 1)
for i in range(m):
p, y = list(map(int, input().rstrip("\n").split()))
py.append([p, y, 0, i])
py.sort()
for i in range(m):
py[i][2] ... | def slove():
import sys
input = sys.stdin.readline
n, m = list(map(int, input().rstrip("\n").split()))
py = []
pyn = [1] * n
for i in range(m):
p, y = list(map(int, input().rstrip("\n").split()))
py.append([p, y, i])
py.sort()
for i in range(len(py)):
py[i][1] = ... | false | 3.846154 | [
"- ls = [1] * (n + 1)",
"+ pyn = [1] * n",
"- py.append([p, y, 0, i])",
"+ py.append([p, y, i])",
"- for i in range(m):",
"- py[i][2] = ls[py[i][0]]",
"- ls[py[i][0]] += 1",
"- py.sort(key=lambda x: x[3])",
"- a = [\"0\"] * 6",
"- a = a + list(... | false | 0.044992 | 0.043913 | 1.024569 | [
"s280405097",
"s156329952"
] |
u030726788 | p03325 | python | s888361749 | s593859025 | 153 | 98 | 4,148 | 4,148 | Accepted | Accepted | 35.95 | N=int(eval(input()))
a=list(map(int,input().split()))
c=0
for i in range(N):
while(a[i]%2==0):
a[i]=a[i]/2
c+=1
print(c) | n = int(eval(input()))
a = list(map(int,input().split()))
c = 0
for i in range(n):
while(a[i] % 2 == 0):
c += 1
a[i] //= 2
print(c) | 8 | 11 | 141 | 158 | N = int(eval(input()))
a = list(map(int, input().split()))
c = 0
for i in range(N):
while a[i] % 2 == 0:
a[i] = a[i] / 2
c += 1
print(c)
| n = int(eval(input()))
a = list(map(int, input().split()))
c = 0
for i in range(n):
while a[i] % 2 == 0:
c += 1
a[i] //= 2
print(c)
| false | 27.272727 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-for i in range(N):",
"+for i in range(n):",
"- a[i] = a[i] / 2",
"+ a[i] //= 2"
] | false | 0.03712 | 0.03736 | 0.993554 | [
"s888361749",
"s593859025"
] |
u832039789 | p03569 | python | s348083381 | s485346259 | 67 | 57 | 3,316 | 3,316 | Accepted | Accepted | 14.93 | s = eval(input())
s_x = s.replace('x', '')
if s_x != s_x[::-1]:
print((-1))
exit()
res = 0
l, r = 0, len(s) - 1
while l < r:
if s[l] == s[r]:
l += 1
r -= 1
elif s[l] == 'x':
l += 1
res += 1
elif s[r] == 'x':
r -= 1
res += 1
els... | s = eval(input())
s_x = s.replace('x', '')
if s_x != s_x[::-1]:
print((-1))
exit()
res = 0
l, r = 0, len(s) - 1
while l < r:
if s[l] == s[r]:
l += 1
r -= 1
elif s[l] == 'x':
l += 1
res += 1
else:
r -= 1
res += 1
print(res)
| 23 | 20 | 362 | 304 | s = eval(input())
s_x = s.replace("x", "")
if s_x != s_x[::-1]:
print((-1))
exit()
res = 0
l, r = 0, len(s) - 1
while l < r:
if s[l] == s[r]:
l += 1
r -= 1
elif s[l] == "x":
l += 1
res += 1
elif s[r] == "x":
r -= 1
res += 1
else:
print((-1)... | s = eval(input())
s_x = s.replace("x", "")
if s_x != s_x[::-1]:
print((-1))
exit()
res = 0
l, r = 0, len(s) - 1
while l < r:
if s[l] == s[r]:
l += 1
r -= 1
elif s[l] == "x":
l += 1
res += 1
else:
r -= 1
res += 1
print(res)
| false | 13.043478 | [
"- elif s[r] == \"x\":",
"+ else:",
"- else:",
"- print((-1))",
"- exit()"
] | false | 0.075002 | 0.075456 | 0.993983 | [
"s348083381",
"s485346259"
] |
u345966487 | p04034 | python | s883685817 | s680004977 | 126 | 114 | 18,080 | 10,212 | Accepted | Accepted | 9.52 | import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
N, M = inm()
... | import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
N, M = inm()
... | 29 | 31 | 645 | 648 | import sys
sys.setrecursionlimit(10**8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
N, M = inm()
def solve():... | import sys
sys.setrecursionlimit(10**8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
N, M = inm()
def solve():... | false | 6.451613 | [
"- pos = {0}",
"- count = [1] * N",
"+ r = [False] * N",
"+ r[0] = True",
"+ cnt = [1] * N",
"- if x in pos:",
"- if count[x] == 1:",
"- pos.remove(x)",
"- pos.add(y)",
"- count[x] -= 1",
"- count[y] += 1",
"- return l... | false | 0.03578 | 0.056779 | 0.630161 | [
"s883685817",
"s680004977"
] |
u462831976 | p00111 | python | s646936406 | s616689910 | 70 | 60 | 11,756 | 11,708 | Accepted | Accepted | 14.29 | # -*- coding: utf-8 -*-
import sys
import os
import math
import re
import random
tableA = {
"A": "00000",
"B": "00001",
"C": "00010",
"D": "00011",
"E": "00100",
"F": "00101",
"G": "00110",
"H": "00111",
"I": "01000",
"J": "01001",
"K": "01010",
"L":... | # -*- coding: utf-8 -*-
import sys
import os
import math
import re
import random
tableA = {
"A": "00000",
"B": "00001",
"C": "00010",
"D": "00011",
"E": "00100",
"F": "00101",
"G": "00110",
"H": "00111",
"I": "01000",
"J": "01001",
"K": "01010",
"L":... | 97 | 98 | 1,724 | 1,747 | # -*- coding: utf-8 -*-
import sys
import os
import math
import re
import random
tableA = {
"A": "00000",
"B": "00001",
"C": "00010",
"D": "00011",
"E": "00100",
"F": "00101",
"G": "00110",
"H": "00111",
"I": "01000",
"J": "01001",
"K": "01010",
"L": "01011",
"M": "0... | # -*- coding: utf-8 -*-
import sys
import os
import math
import re
import random
tableA = {
"A": "00000",
"B": "00001",
"C": "00010",
"D": "00011",
"E": "00100",
"F": "00101",
"G": "00110",
"H": "00111",
"I": "01000",
"J": "01001",
"K": "01010",
"L": "01011",
"M": "0... | false | 1.020408 | [
"+ s = s.strip(\"\\n\")"
] | false | 0.044066 | 0.097436 | 0.452256 | [
"s646936406",
"s616689910"
] |
u497046426 | p03609 | python | s782050424 | s406697335 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | X, t = list(map(int, input().split()))
print((max(X - t, 0))) | X, t = list(map(int, input().split()))
print((max(0, X - t))) | 2 | 2 | 54 | 54 | X, t = list(map(int, input().split()))
print((max(X - t, 0)))
| X, t = list(map(int, input().split()))
print((max(0, X - t)))
| false | 0 | [
"-print((max(X - t, 0)))",
"+print((max(0, X - t)))"
] | false | 0.073815 | 0.069975 | 1.054888 | [
"s782050424",
"s406697335"
] |
u525065967 | p02608 | python | s304718754 | s127625940 | 833 | 549 | 10,756 | 9,436 | Accepted | Accepted | 34.09 | from logging import *
basicConfig(level=DEBUG, format='%(levelname)s: %(message)s')
disable(CRITICAL)
n = int(eval(input()))
f = [0]*(n+1)
x = 1
while x*x < n:
y = 1
while y*y < n:
if x*y >= n: continue
z = 1
while z*z < n:
k = x*x + y*y + z*z + x*y + y*z + z*... | n = int(eval(input()))
f = [0]*(n+1)
x = 1
while x*x < n:
y = 1
while y*y < n:
if x*y >= n: continue
z = 1
while z*z < n:
k = x*x + y*y + z*z + x*y + y*z + z*x
if 1 <= k <= n: f[k] += 1
z += 1
y += 1
x += 1
for i in range(1, n... | 24 | 15 | 557 | 331 | from logging import *
basicConfig(level=DEBUG, format="%(levelname)s: %(message)s")
disable(CRITICAL)
n = int(eval(input()))
f = [0] * (n + 1)
x = 1
while x * x < n:
y = 1
while y * y < n:
if x * y >= n:
continue
z = 1
while z * z < n:
k = x * x + y * y + z * z +... | n = int(eval(input()))
f = [0] * (n + 1)
x = 1
while x * x < n:
y = 1
while y * y < n:
if x * y >= n:
continue
z = 1
while z * z < n:
k = x * x + y * y + z * z + x * y + y * z + z * x
if 1 <= k <= n:
f[k] += 1
z += 1
... | false | 37.5 | [
"-from logging import *",
"-",
"-basicConfig(level=DEBUG, format=\"%(levelname)s: %(message)s\")",
"-disable(CRITICAL)",
"- debug(\"x {} y {} z {} k {}\".format(x, y, z, k))",
"- debug(\"f[{}] {}\".format(i, f[i]))"
] | false | 0.058818 | 0.04186 | 1.405097 | [
"s304718754",
"s127625940"
] |
u690536347 | p03128 | python | s062542296 | s979620808 | 198 | 86 | 42,476 | 4,316 | Accepted | Accepted | 56.57 | from collections import defaultdict as dd
n,m=list(map(int,input().split()))
*a,=list(map(int,input().split()))
dp=[-1]*(n+1)
ans = [0] * (n + 1)
cost={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
d={i:cost[i] for i in a}
dp[0] = 0
for i in range(1,n+1):
for j in range(10)[::-1]:
if not j in d:
... | n,m=map(int,input().split())
*a,=map(int,input().split())
cost={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
dp=[-1]*(n+1)
v=[0]*(n+1)
dp[0]=0
for i in range(1,n+1):
for j in range(10)[::-1]:
if not j in a or i<cost[j]:continue
if dp[i]<dp[i-cost[j]]+1:
dp[i]=dp[i-cost[j]]+1
... | 30 | 20 | 582 | 405 | from collections import defaultdict as dd
n, m = list(map(int, input().split()))
(*a,) = list(map(int, input().split()))
dp = [-1] * (n + 1)
ans = [0] * (n + 1)
cost = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
d = {i: cost[i] for i in a}
dp[0] = 0
for i in range(1, n + 1):
for j in range(10)[::-1]:
... | n, m = map(int, input().split())
(*a,) = map(int, input().split())
cost = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
dp = [-1] * (n + 1)
v = [0] * (n + 1)
dp[0] = 0
for i in range(1, n + 1):
for j in range(10)[::-1]:
if not j in a or i < cost[j]:
continue
if dp[i] < dp[i - co... | false | 33.333333 | [
"-from collections import defaultdict as dd",
"-",
"-n, m = list(map(int, input().split()))",
"-(*a,) = list(map(int, input().split()))",
"+n, m = map(int, input().split())",
"+(*a,) = map(int, input().split())",
"+cost = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}",
"-ans = [0] * (n + 1)",... | false | 0.145493 | 0.007104 | 20.481325 | [
"s062542296",
"s979620808"
] |
u150984829 | p00448 | python | s334181697 | s404166810 | 5,290 | 3,660 | 6,916 | 6,912 | Accepted | Accepted | 30.81 | for e in iter(input,'0 0'):
r=int(e.split()[0])
d=[int(''.join(x),2)for x in zip(*[input().split()for _ in[0]*r])]
a=0
for m in range(1<<~-r):
t=0
for s in d:
c=bin(m^s).count('1')
t+=c if c>r//2 else r-c
if a<t:a=t
print(a)
| def v():
for e in iter(input,'0 0'):
r=int(e.split()[0])
d=[int(''.join(x),2)for x in zip(*[input().split()for _ in[0]*r])]
a=0
for m in range(1<<~-r):
t=0
for s in d:
c=bin(m^s).count('1')
t+=c if c>r//2 else r-c
if a<t:a=t
print(a)
if'__main__'==__name__:v()
| 11 | 13 | 252 | 301 | for e in iter(input, "0 0"):
r = int(e.split()[0])
d = [int("".join(x), 2) for x in zip(*[input().split() for _ in [0] * r])]
a = 0
for m in range(1 << ~-r):
t = 0
for s in d:
c = bin(m ^ s).count("1")
t += c if c > r // 2 else r - c
if a < t:
... | def v():
for e in iter(input, "0 0"):
r = int(e.split()[0])
d = [int("".join(x), 2) for x in zip(*[input().split() for _ in [0] * r])]
a = 0
for m in range(1 << ~-r):
t = 0
for s in d:
c = bin(m ^ s).count("1")
t += c if c > r /... | false | 15.384615 | [
"-for e in iter(input, \"0 0\"):",
"- r = int(e.split()[0])",
"- d = [int(\"\".join(x), 2) for x in zip(*[input().split() for _ in [0] * r])]",
"- a = 0",
"- for m in range(1 << ~-r):",
"- t = 0",
"- for s in d:",
"- c = bin(m ^ s).count(\"1\")",
"- t ... | false | 0.035708 | 0.036981 | 0.965573 | [
"s334181697",
"s404166810"
] |
u451017206 | p03128 | python | s057979525 | s334439448 | 150 | 138 | 14,516 | 28,120 | Accepted | Accepted | 8 | N, M = list(map(int, input().split()))
A = [int(i) for i in input().split()]
# dp[i] = i本使ってできる最大の数
# xを作るために使うマッチの本数
h = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}
dp = [-1] * (N + 1)
dp[0] = 0
for i in range(N + 1):
for a in A:
if i - h[a] < 0: continue
dp[i] = max(10*dp[i-h[a... | N, M = list(map(int, input().split()))
A = [i for i in input().split()]
# dp[i] = i本使ってできる最大の数
def mx(a, b):
if a is not None and b is None:
return a
elif a is None and b is not None:
return b
if len(a) != len(b):
if len(a) > len(b):
return a
else:
... | 17 | 34 | 344 | 750 | N, M = list(map(int, input().split()))
A = [int(i) for i in input().split()]
# dp[i] = i本使ってできる最大の数
# xを作るために使うマッチの本数
h = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
dp = [-1] * (N + 1)
dp[0] = 0
for i in range(N + 1):
for a in A:
if i - h[a] < 0:
continue
dp[i] = max(10 * dp[... | N, M = list(map(int, input().split()))
A = [i for i in input().split()]
# dp[i] = i本使ってできる最大の数
def mx(a, b):
if a is not None and b is None:
return a
elif a is None and b is not None:
return b
if len(a) != len(b):
if len(a) > len(b):
return a
else:
ret... | false | 50 | [
"-A = [int(i) for i in input().split()]",
"+A = [i for i in input().split()]",
"+def mx(a, b):",
"+ if a is not None and b is None:",
"+ return a",
"+ elif a is None and b is not None:",
"+ return b",
"+ if len(a) != len(b):",
"+ if len(a) > len(b):",
"+ re... | false | 0.04039 | 0.042898 | 0.94155 | [
"s057979525",
"s334439448"
] |
u564589929 | p02947 | python | s142703621 | s823041447 | 1,685 | 355 | 40,016 | 19,880 | Accepted | Accepted | 78.93 | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(... | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(... | 46 | 47 | 1,036 | 1,063 | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def LLI(rows_number):
return [L... | # import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def LLI(rows_number):
return [L... | false | 2.12766 | [
"- S = [list(eval(input())) for _ in range(n)]",
"+ S = [\"\".join(sorted(eval(input()))) for _ in range(n)]",
"+ # print(S)",
"- c = sorted(list(Counter(s).items()), key=lambda x: x[0])",
"+ # c = sorted(Counter(s).items(), key=lambda x: x[0])",
"- key = c2s(c)",
"- ... | false | 0.046511 | 0.045765 | 1.016306 | [
"s142703621",
"s823041447"
] |
u929569377 | p03162 | python | s604340321 | s634823652 | 950 | 634 | 47,280 | 47,380 | Accepted | Accepted | 33.26 | N = int(eval(input()))
abc = [list([int(x) for x in input().split()]) for _ in range(N)]
happy = [[0] * 3 for _ in range(N)]
for i in range(3):
happy[0][i] = abc[0][i]
for i in range(1, N):
for j in range(3):
for k in range(3):
if j != k and happy[i][j] < happy[i - 1][k]:
happy[i][j] = happy[i... | N = int(eval(input()))
abc = [list([int(x) for x in input().split()]) for _ in range(N)]
happy = [[0] * 3 for _ in range(N)]
for i in range(3):
happy[0][i] = abc[0][i]
for i in range(1, N):
happy[i][0] = max(happy[i - 1][1], happy[i - 1][2]) + abc[i][0]
happy[i][1] = max(happy[i - 1][0], happy[i - 1][2]... | 16 | 14 | 420 | 463 | N = int(eval(input()))
abc = [list([int(x) for x in input().split()]) for _ in range(N)]
happy = [[0] * 3 for _ in range(N)]
for i in range(3):
happy[0][i] = abc[0][i]
for i in range(1, N):
for j in range(3):
for k in range(3):
if j != k and happy[i][j] < happy[i - 1][k]:
hap... | N = int(eval(input()))
abc = [list([int(x) for x in input().split()]) for _ in range(N)]
happy = [[0] * 3 for _ in range(N)]
for i in range(3):
happy[0][i] = abc[0][i]
for i in range(1, N):
happy[i][0] = max(happy[i - 1][1], happy[i - 1][2]) + abc[i][0]
happy[i][1] = max(happy[i - 1][0], happy[i - 1][2]) + ... | false | 12.5 | [
"- for j in range(3):",
"- for k in range(3):",
"- if j != k and happy[i][j] < happy[i - 1][k]:",
"- happy[i][j] = happy[i - 1][k]",
"- happy[i][j] += abc[i][j]",
"+ happy[i][0] = max(happy[i - 1][1], happy[i - 1][2]) + abc[i][0]",
"+ happy[i][1] = max(ha... | false | 0.042678 | 0.050888 | 0.83866 | [
"s604340321",
"s634823652"
] |
u679325651 | p03031 | python | s895113762 | s879641863 | 32 | 21 | 3,064 | 3,064 | Accepted | Accepted | 34.38 | N,M = [int(i) for i in input().split()] #Nがスイッチの数、Mは電球の数
sss = []
for i in range(M):
buff = [int(i)-1 for i in input().split()][1:]
onoff = [0 for i in range(N)]
for j in buff:
onoff[j]=1
sss.append(onoff)
ppp = [int(i) for i in input().split()]
ct=0
for i in range(1<<N):
bitc... | N,M = [int(i) for i in input().split()]
switches = []
for i in range(M):
buff = 0
k,*sss = [int(i) for i in input().split()]
for s in sss:
buff += 1 << (s-1)
switches.append(buff)
ppp = [int(i) for i in input().split()]
ans = 0
for i in range(1<<N):
for p,s in zip(ppp,switches):... | 21 | 21 | 510 | 464 | N, M = [int(i) for i in input().split()] # Nがスイッチの数、Mは電球の数
sss = []
for i in range(M):
buff = [int(i) - 1 for i in input().split()][1:]
onoff = [0 for i in range(N)]
for j in buff:
onoff[j] = 1
sss.append(onoff)
ppp = [int(i) for i in input().split()]
ct = 0
for i in range(1 << N):
bitcode ... | N, M = [int(i) for i in input().split()]
switches = []
for i in range(M):
buff = 0
k, *sss = [int(i) for i in input().split()]
for s in sss:
buff += 1 << (s - 1)
switches.append(buff)
ppp = [int(i) for i in input().split()]
ans = 0
for i in range(1 << N):
for p, s in zip(ppp, switches):
... | false | 0 | [
"-N, M = [int(i) for i in input().split()] # Nがスイッチの数、Mは電球の数",
"-sss = []",
"+N, M = [int(i) for i in input().split()]",
"+switches = []",
"- buff = [int(i) - 1 for i in input().split()][1:]",
"- onoff = [0 for i in range(N)]",
"- for j in buff:",
"- onoff[j] = 1",
"- sss.append(... | false | 0.078997 | 0.03743 | 2.110513 | [
"s895113762",
"s879641863"
] |
u761529120 | p03599 | python | s318945372 | s685146190 | 234 | 104 | 42,348 | 73,612 | Accepted | Accepted | 55.56 | A, B, C, D, E, F = list(map(int, input().split()))
ans = -1
sugar = 0
sugar_water = 0
for a in range(F // (A * 100) + 1):
for b in range((F - 100 * A * a) // (B * 100) + 1):
for c in range((F - 100 * A * a - 100 * B * b) // C + 1):
for d in range((F - 100 * A * a - 100 * B * b - C * c) ... | def main():
A, B, C, D, E, F = list(map(int, input().split()))
ans = -1
sugar = 0
sugar_water = 0
for a in range(F // (A * 100) + 1):
for b in range((F - 100 * A * a) // (B * 100) + 1):
for c in range((F - 100 * A * a - 100 * B * b) // C + 1):
for d in ran... | 18 | 21 | 666 | 786 | A, B, C, D, E, F = list(map(int, input().split()))
ans = -1
sugar = 0
sugar_water = 0
for a in range(F // (A * 100) + 1):
for b in range((F - 100 * A * a) // (B * 100) + 1):
for c in range((F - 100 * A * a - 100 * B * b) // C + 1):
for d in range((F - 100 * A * a - 100 * B * b - C * c) // D + 1)... | def main():
A, B, C, D, E, F = list(map(int, input().split()))
ans = -1
sugar = 0
sugar_water = 0
for a in range(F // (A * 100) + 1):
for b in range((F - 100 * A * a) // (B * 100) + 1):
for c in range((F - 100 * A * a - 100 * B * b) // C + 1):
for d in range((F - ... | false | 14.285714 | [
"-A, B, C, D, E, F = list(map(int, input().split()))",
"-ans = -1",
"-sugar = 0",
"-sugar_water = 0",
"-for a in range(F // (A * 100) + 1):",
"- for b in range((F - 100 * A * a) // (B * 100) + 1):",
"- for c in range((F - 100 * A * a - 100 * B * b) // C + 1):",
"- for d in range((... | false | 0.150107 | 0.101488 | 1.479057 | [
"s318945372",
"s685146190"
] |
u983647429 | p03449 | python | s952087029 | s759146874 | 23 | 17 | 3,064 | 2,940 | Accepted | Accepted | 26.09 | def main(input):
N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = [0] * N
for i in range(N):
ans[i] = sum(A1[:i+1]) + sum(A2[i:])
print((max(ans)))
import sys; sys.setrecursionlimit(50000)
if __name__ == "__main__":
if... | N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = [sum(A1[:i+1]) + sum(A2[i:]) for i in range(N)]
print((max(ans)))
| 16 | 5 | 480 | 165 | def main(input):
N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = [0] * N
for i in range(N):
ans[i] = sum(A1[: i + 1]) + sum(A2[i:])
print((max(ans)))
import sys
sys.setrecursionlimit(50000)
if __name__ == "__main__":
if len(sy... | N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = [sum(A1[: i + 1]) + sum(A2[i:]) for i in range(N)]
print((max(ans)))
| false | 68.75 | [
"-def main(input):",
"- N = int(eval(input()))",
"- A1 = list(map(int, input().split()))",
"- A2 = list(map(int, input().split()))",
"- ans = [0] * N",
"- for i in range(N):",
"- ans[i] = sum(A1[: i + 1]) + sum(A2[i:])",
"- print((max(ans)))",
"-",
"-",
"-import sys",
... | false | 0.038471 | 0.036991 | 1.040015 | [
"s952087029",
"s759146874"
] |
u879870653 | p03162 | python | s023158525 | s623240101 | 670 | 618 | 78,296 | 47,368 | Accepted | Accepted | 7.76 | N = int(eval(input()))
L = list(list(map(int,input().split())) for i in range(N))
dp = [[0,0,0] for i in range(N+1)]
for i in range(N) :
dp[i+1][0] = max(dp[i][1], dp[i][2]) + L[i][0]
dp[i+1][1] = max(dp[i][2], dp[i][0]) + L[i][1]
dp[i+1][2] = max(dp[i][0], dp[i][1]) + L[i][2]
ans = max(dp[N][0],... | N = int(eval(input()))
L = [list(map(int,input().split())) for i in range(N)]
dp = [[0,0,0] for i in range(N)]
dp[0] = L[0]
for i in range(1,N) :
dp[i][0] = max(dp[i-1][1] + L[i][0],dp[i-1][2] + L[i][0])
dp[i][1] = max(dp[i-1][2] + L[i][1],dp[i-1][0] + L[i][1])
dp[i][2] = max(dp[i-1][0] + L[i][2]... | 12 | 14 | 349 | 373 | N = int(eval(input()))
L = list(list(map(int, input().split())) for i in range(N))
dp = [[0, 0, 0] for i in range(N + 1)]
for i in range(N):
dp[i + 1][0] = max(dp[i][1], dp[i][2]) + L[i][0]
dp[i + 1][1] = max(dp[i][2], dp[i][0]) + L[i][1]
dp[i + 1][2] = max(dp[i][0], dp[i][1]) + L[i][2]
ans = max(dp[N][0], ... | N = int(eval(input()))
L = [list(map(int, input().split())) for i in range(N)]
dp = [[0, 0, 0] for i in range(N)]
dp[0] = L[0]
for i in range(1, N):
dp[i][0] = max(dp[i - 1][1] + L[i][0], dp[i - 1][2] + L[i][0])
dp[i][1] = max(dp[i - 1][2] + L[i][1], dp[i - 1][0] + L[i][1])
dp[i][2] = max(dp[i - 1][0] + L[i... | false | 14.285714 | [
"-L = list(list(map(int, input().split())) for i in range(N))",
"-dp = [[0, 0, 0] for i in range(N + 1)]",
"-for i in range(N):",
"- dp[i + 1][0] = max(dp[i][1], dp[i][2]) + L[i][0]",
"- dp[i + 1][1] = max(dp[i][2], dp[i][0]) + L[i][1]",
"- dp[i + 1][2] = max(dp[i][0], dp[i][1]) + L[i][2]",
"-a... | false | 0.036732 | 0.040839 | 0.899431 | [
"s023158525",
"s623240101"
] |
u421674761 | p02725 | python | s988705460 | s593721296 | 121 | 107 | 32,276 | 32,216 | Accepted | Accepted | 11.57 | k,n = list(map(int,input().split()))
a = list(map(int,input().split()))
b = []
for i in range(n-1):
kyori = a[i+1] - a[i]
b.append(kyori)
b.append(abs(a[0]+(k-a[-1])))
print((sum(b)-max(b)))
| k,n = list(map(int,input().split()))
a = list(map(int,input().split()))
b = []
for i in range(n-1):
b.append(a[i+1]-a[i])
b.append(a[0]+(k-a[-1]))
print((sum(b)-max(b)))
| 10 | 10 | 202 | 178 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
for i in range(n - 1):
kyori = a[i + 1] - a[i]
b.append(kyori)
b.append(abs(a[0] + (k - a[-1])))
print((sum(b) - max(b)))
| k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
for i in range(n - 1):
b.append(a[i + 1] - a[i])
b.append(a[0] + (k - a[-1]))
print((sum(b) - max(b)))
| false | 0 | [
"- kyori = a[i + 1] - a[i]",
"- b.append(kyori)",
"-b.append(abs(a[0] + (k - a[-1])))",
"+ b.append(a[i + 1] - a[i])",
"+b.append(a[0] + (k - a[-1]))"
] | false | 0.036245 | 0.036921 | 0.981691 | [
"s988705460",
"s593721296"
] |
u826263061 | p04031 | python | s572582291 | s668835983 | 23 | 18 | 3,064 | 3,060 | Accepted | Accepted | 21.74 | n = int(eval(input()))
a=list(map(int,input().split()))
#print(a)
amin = min(a)
amax = max(a)
min_sum=10**8
for x in range(amin,amax+1):
sum_for_x = sum([(y-x)**2 for y in a])
if sum_for_x < min_sum:
min_sum = sum_for_x
print(min_sum) | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 4 18:19:03 2018
@author: maezawa
"""
n = int(eval(input()))
a = list(map(int, input().split()))
mean_a = round(sum(a)/n)
ans = 0
for i in a:
ans += (i-mean_a)**2
print(ans) | 14 | 17 | 263 | 239 | n = int(eval(input()))
a = list(map(int, input().split()))
# print(a)
amin = min(a)
amax = max(a)
min_sum = 10**8
for x in range(amin, amax + 1):
sum_for_x = sum([(y - x) ** 2 for y in a])
if sum_for_x < min_sum:
min_sum = sum_for_x
print(min_sum)
| # -*- coding: utf-8 -*-
"""
Created on Sat Aug 4 18:19:03 2018
@author: maezawa
"""
n = int(eval(input()))
a = list(map(int, input().split()))
mean_a = round(sum(a) / n)
ans = 0
for i in a:
ans += (i - mean_a) ** 2
print(ans)
| false | 17.647059 | [
"+# -*- coding: utf-8 -*-",
"+\"\"\"",
"+Created on Sat Aug 4 18:19:03 2018",
"+@author: maezawa",
"+\"\"\"",
"-# print(a)",
"-amin = min(a)",
"-amax = max(a)",
"-min_sum = 10**8",
"-for x in range(amin, amax + 1):",
"- sum_for_x = sum([(y - x) ** 2 for y in a])",
"- if sum_for_x < min_... | false | 0.038519 | 0.04468 | 0.862109 | [
"s572582291",
"s668835983"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.