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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u923668099 | p02343 | python | s623871998 | s811147112 | 500 | 380 | 14,132 | 10,400 | Accepted | Accepted | 24 | import sys
sys.setrecursionlimit(10**5)
def solve():
n, q = map(int, sys.stdin.readline().split())
uf = UnionFind(n)
ans = []
for lp in range(q):
c, x, y = map(int, sys.stdin.readline().split())
if c == 0:
uf.unite(x, y)
else:
ans.append... | import sys
def solve():
n, q = map(int, sys.stdin.readline().split())
uf = UnionFind(n)
ans = []
for lp in range(q):
c, x, y = map(int, sys.stdin.readline().split())
if c == 0:
uf.unite(x, y)
else:
ans.append(1 if uf.same(x, y) else 0)
... | 49 | 62 | 1,124 | 1,391 | import sys
sys.setrecursionlimit(10**5)
def solve():
n, q = map(int, sys.stdin.readline().split())
uf = UnionFind(n)
ans = []
for lp in range(q):
c, x, y = map(int, sys.stdin.readline().split())
if c == 0:
uf.unite(x, y)
else:
ans.append(1 if uf.is_same... | import sys
def solve():
n, q = map(int, sys.stdin.readline().split())
uf = UnionFind(n)
ans = []
for lp in range(q):
c, x, y = map(int, sys.stdin.readline().split())
if c == 0:
uf.unite(x, y)
else:
ans.append(1 if uf.same(x, y) else 0)
print(*ans, se... | false | 20.967742 | [
"-",
"-sys.setrecursionlimit(10**5)",
"- ans.append(1 if uf.is_same(x, y) else 0)",
"+ ans.append(1 if uf.same(x, y) else 0)",
"- # self.rank = [0] * n",
"+ self.rank = [0] * n",
"- if x != self.root[x]:",
"- self.root[x] = self.find_root(self.root... | false | 0.035939 | 0.042338 | 0.848861 | [
"s623871998",
"s811147112"
] |
u037754315 | p02658 | python | s879068609 | s873324681 | 89 | 48 | 21,640 | 21,496 | Accepted | Accepted | 46.07 | N = int(eval(input()))
A = list(map(int, input().split()))
limit = 10 ** 18
A.sort()
result = A[0]
for a in A[1:]:
result *= a
if result > limit:
print((-1))
exit()
print(result) | N = int(eval(input()))
A = list(map(int,input().split()))
ans = 1
if 0 in A:
ans = 0
N = 0
for i in range(N):
ans *= A[i]
if ans > 10**18:
ans = -1
break
print(ans) | 12 | 15 | 206 | 191 | N = int(eval(input()))
A = list(map(int, input().split()))
limit = 10**18
A.sort()
result = A[0]
for a in A[1:]:
result *= a
if result > limit:
print((-1))
exit()
print(result)
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
if 0 in A:
ans = 0
N = 0
for i in range(N):
ans *= A[i]
if ans > 10**18:
ans = -1
break
print(ans)
| false | 20 | [
"-limit = 10**18",
"-A.sort()",
"-result = A[0]",
"-for a in A[1:]:",
"- result *= a",
"- if result > limit:",
"- print((-1))",
"- exit()",
"-print(result)",
"+ans = 1",
"+if 0 in A:",
"+ ans = 0",
"+ N = 0",
"+for i in range(N):",
"+ ans *= A[i]",
"+ if... | false | 0.03821 | 0.076687 | 0.498262 | [
"s879068609",
"s873324681"
] |
u627600101 | p02579 | python | s022191123 | s102481261 | 673 | 317 | 99,548 | 94,696 | Accepted | Accepted | 52.9 | from collections import deque
H, W = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
Ch += 1
Cw += 1
Dh += 1
Dw += 1
lim = 10**6
S = ['#'*(W+4)]
S.append('#'*(W+4))
for k in range(H):
S.append('##' + eval(input()) + '##')
S.append('#... | from collections import deque
H, W = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
Ch += 1
Cw += 1
Dh += 1
Dw += 1
lim = 10**6
S = ['#'*(W+4)]
S.append('#'*(W+4))
for k in range(H):
S.append('##' + eval(input()) + '##')
S.append('#... | 138 | 136 | 3,245 | 2,987 | from collections import deque
H, W = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
Ch += 1
Cw += 1
Dh += 1
Dw += 1
lim = 10**6
S = ["#" * (W + 4)]
S.append("#" * (W + 4))
for k in range(H):
S.append("##" + eval(input()) + "##")
S.append("#" * (W +... | from collections import deque
H, W = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
Ch += 1
Cw += 1
Dh += 1
Dw += 1
lim = 10**6
S = ["#" * (W + 4)]
S.append("#" * (W + 4))
for k in range(H):
S.append("##" + eval(input()) + "##")
S.append("#" * (W +... | false | 1.449275 | [
"+rev = [[-1 for _ in range(W + 4)] for _ in range(H + 4)]",
"+ rev[k][j] = lim",
"+rev[Dh][Dw] = 0",
"+jump = [",
"+ (2, 2),",
"+ (2, 1),",
"+ (2, 0),",
"+ (2, -1),",
"+ (2, -2),",
"+ (1, 2),",
"+ (1, 1),",
"+ (1, -1),",
"+ (1, -2),",
"+ (0, 2),",
... | false | 0.057387 | 0.063805 | 0.899415 | [
"s022191123",
"s102481261"
] |
u606045429 | p03132 | python | s443440453 | s473631075 | 368 | 265 | 11,036 | 11,036 | Accepted | Accepted | 27.99 | L, *A = list(map(int, open(0)))
D = [(2, 1), (1, 0), (0, 1)]
s0 = s1 = s2 = s3 = s4 = 0
for a in A:
e, o = D[(a - 1) % 2 + 1 if a else 0]
s0 += a
s1 = min(s0, s1 + e)
s2 = min(s1, s2 + o)
s3 = min(s2, s3 + e)
s4 = min(s3, s4 + a)
print((min(s0, s1, s2, s3, s4)))
| L, *A = list(map(int, open(0)))
D = [(2, 1), (1, 0), (0, 1)]
s0 = s1 = s2 = s3 = s4 = 0
for a in A:
e, o = D[(a - 1) % 2 + 1 if a else 0]
s0 += a
s1 = s0 if s0 < s1 + e else s1 + e
s2 = s1 if s1 < s2 + o else s2 + o
s3 = s2 if s2 < s3 + e else s3 + e
s4 = s3 if s3 < s4 + a else ... | 16 | 16 | 299 | 355 | L, *A = list(map(int, open(0)))
D = [(2, 1), (1, 0), (0, 1)]
s0 = s1 = s2 = s3 = s4 = 0
for a in A:
e, o = D[(a - 1) % 2 + 1 if a else 0]
s0 += a
s1 = min(s0, s1 + e)
s2 = min(s1, s2 + o)
s3 = min(s2, s3 + e)
s4 = min(s3, s4 + a)
print((min(s0, s1, s2, s3, s4)))
| L, *A = list(map(int, open(0)))
D = [(2, 1), (1, 0), (0, 1)]
s0 = s1 = s2 = s3 = s4 = 0
for a in A:
e, o = D[(a - 1) % 2 + 1 if a else 0]
s0 += a
s1 = s0 if s0 < s1 + e else s1 + e
s2 = s1 if s1 < s2 + o else s2 + o
s3 = s2 if s2 < s3 + e else s3 + e
s4 = s3 if s3 < s4 + a else s4 + a
print((min... | false | 0 | [
"- s1 = min(s0, s1 + e)",
"- s2 = min(s1, s2 + o)",
"- s3 = min(s2, s3 + e)",
"- s4 = min(s3, s4 + a)",
"+ s1 = s0 if s0 < s1 + e else s1 + e",
"+ s2 = s1 if s1 < s2 + o else s2 + o",
"+ s3 = s2 if s2 < s3 + e else s3 + e",
"+ s4 = s3 if s3 < s4 + a else s4 + a"
] | false | 0.053905 | 0.035171 | 1.532634 | [
"s443440453",
"s473631075"
] |
u460172144 | p02288 | python | s138159973 | s429941624 | 1,050 | 790 | 74,128 | 72,888 | Accepted | Accepted | 24.76 |
def maxHeapify(i):
l =2*i
r = 2*i+1
# print(A[i])
largest =0
if l <=H and A[l]> A[i]:
largest = l
else:
largest = i
if r <= H and A[r] > A[largest]:
largest = r
if largest != i :
A[i],A[largest] = A[largest],A[i]
maxHeapify(la... |
def maxHeapify(i):
l =2*i
r = 2*i+1
# print(A[i])
largest =0
if l <=H and A[l]> A[i]:
largest = l
else:
largest = i
if r <= H and A[r] > A[largest]:
largest = r
if largest != i :
A[i],A[largest] = A[largest],A[i]
maxHeapify(la... | 36 | 36 | 536 | 548 | def maxHeapify(i):
l = 2 * i
r = 2 * i + 1
# print(A[i])
largest = 0
if l <= H and A[l] > A[i]:
largest = l
else:
largest = i
if r <= H and A[r] > A[largest]:
largest = r
if largest != i:
A[i], A[largest] = A[largest], A[i]
maxHeapify(largest)
... | def maxHeapify(i):
l = 2 * i
r = 2 * i + 1
# print(A[i])
largest = 0
if l <= H and A[l] > A[i]:
largest = l
else:
largest = i
if r <= H and A[r] > A[largest]:
largest = r
if largest != i:
A[i], A[largest] = A[largest], A[i]
maxHeapify(largest)
... | false | 0 | [
"-print(*A[1:])",
"+print(\" \".join(Astr[1:]))"
] | false | 0.043362 | 0.040124 | 1.080692 | [
"s138159973",
"s429941624"
] |
u939702463 | p03434 | python | s450863986 | s111949389 | 20 | 17 | 2,940 | 3,060 | Accepted | Accepted | 15 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = sum(a[0::2]) - sum(a[1::2])
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
a.reverse()
print((sum(a[::2]) - sum(a[1::2])))
| 8 | 6 | 129 | 114 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = sum(a[0::2]) - sum(a[1::2])
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
a.reverse()
print((sum(a[::2]) - sum(a[1::2])))
| false | 25 | [
"-a.sort(reverse=True)",
"-ans = sum(a[0::2]) - sum(a[1::2])",
"-print(ans)",
"+a.sort()",
"+a.reverse()",
"+print((sum(a[::2]) - sum(a[1::2])))"
] | false | 0.038636 | 0.092157 | 0.419239 | [
"s450863986",
"s111949389"
] |
u113835532 | p03207 | python | s893847348 | s770378587 | 30 | 26 | 9,140 | 9,180 | Accepted | Accepted | 13.33 | n = int(eval(input()))
p = list(int(eval(input())) for _ in range(n))
p.append(p.pop(p.index(max(p))) // 2)
print((sum(p))) | def answer(n: int, p: []) -> int:
p.append(p.pop(p.index(max(p))) // 2)
return sum(p)
def main():
n = int(eval(input()))
p = list(int(eval(input())) for _ in range(n))
print((answer(n, p)))
if __name__ == '__main__':
main() | 4 | 13 | 112 | 249 | n = int(eval(input()))
p = list(int(eval(input())) for _ in range(n))
p.append(p.pop(p.index(max(p))) // 2)
print((sum(p)))
| def answer(n: int, p: []) -> int:
p.append(p.pop(p.index(max(p))) // 2)
return sum(p)
def main():
n = int(eval(input()))
p = list(int(eval(input())) for _ in range(n))
print((answer(n, p)))
if __name__ == "__main__":
main()
| false | 69.230769 | [
"-n = int(eval(input()))",
"-p = list(int(eval(input())) for _ in range(n))",
"-p.append(p.pop(p.index(max(p))) // 2)",
"-print((sum(p)))",
"+def answer(n: int, p: []) -> int:",
"+ p.append(p.pop(p.index(max(p))) // 2)",
"+ return sum(p)",
"+",
"+",
"+def main():",
"+ n = int(eval(input... | false | 0.035994 | 0.035092 | 1.025684 | [
"s893847348",
"s770378587"
] |
u814171899 | p03310 | python | s777265120 | s053998282 | 946 | 847 | 25,536 | 24,180 | Accepted | Accepted | 10.47 | from itertools import accumulate
n=int(eval(input()))
a=list(map(int, input().split()))
acc=list(accumulate(a))
sumA=acc[-1]
cut=[0, 1, 2, len(a)-1]
score=[acc[cut[0]], acc[cut[1]]-acc[cut[0]], acc[cut[2]]-acc[cut[1]], acc[cut[3]]-acc[cut[2]]]
ans=max(score)-min(score)
for i in range(1,len(a)-1):
cut[1]=i ... | from itertools import accumulate
n=int(eval(input()))
a=list(map(int, input().split()))
acc=list(accumulate(a))
left=0; right=2
ans=float('inf')
for center in range(1,n-1):
while abs(acc[center]-acc[left]-acc[left]) > abs(acc[center]-acc[left+1]-acc[left+1]):
left+=1
while abs(acc[n-1]-acc[rig... | 18 | 15 | 740 | 563 | from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
acc = list(accumulate(a))
sumA = acc[-1]
cut = [0, 1, 2, len(a) - 1]
score = [
acc[cut[0]],
acc[cut[1]] - acc[cut[0]],
acc[cut[2]] - acc[cut[1]],
acc[cut[3]] - acc[cut[2]],
]
ans = max(score) - min(score)
for i ... | from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
acc = list(accumulate(a))
left = 0
right = 2
ans = float("inf")
for center in range(1, n - 1):
while abs(acc[center] - acc[left] - acc[left]) > abs(
acc[center] - acc[left + 1] - acc[left + 1]
):
left +=... | false | 16.666667 | [
"-sumA = acc[-1]",
"-cut = [0, 1, 2, len(a) - 1]",
"-score = [",
"- acc[cut[0]],",
"- acc[cut[1]] - acc[cut[0]],",
"- acc[cut[2]] - acc[cut[1]],",
"- acc[cut[3]] - acc[cut[2]],",
"-]",
"-ans = max(score) - min(score)",
"-for i in range(1, len(a) - 1):",
"- cut[1] = i",
"- whi... | false | 0.050774 | 0.087914 | 0.577549 | [
"s777265120",
"s053998282"
] |
u102461423 | p02649 | python | s122055425 | s924769178 | 575 | 193 | 110,580 | 30,448 | Accepted | Accepted | 66.43 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit('(i4[::1],i4,i8[::1])', cache=True)
def main(A, B, C):
counts = np.zeros(1 << 18, np.int32)
popcount = np.zeros(1 << B, np.int32)
... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(A, B, C):
counts = np.zeros(1 << 18, np.int32)
popcount = np.zeros(1 << B, np.int32)
for i in range(B):
popcount[1 << i:1 << i + 1] = popcount[... | 70 | 68 | 1,756 | 1,690 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit("(i4[::1],i4,i8[::1])", cache=True)
def main(A, B, C):
counts = np.zeros(1 << 18, np.int32)
popcount = np.zeros(1 << B, np.int32)
for i in ra... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(A, B, C):
counts = np.zeros(1 << 18, np.int32)
popcount = np.zeros(1 << B, np.int32)
for i in range(B):
popcount[1 << i : 1 << i + 1] = popcount[: 1 << i... | false | 2.857143 | [
"-from numba import njit",
"-@njit(\"(i4[::1],i4,i8[::1])\", cache=True)"
] | false | 0.217477 | 0.281103 | 0.773656 | [
"s122055425",
"s924769178"
] |
u611090896 | p03292 | python | s927777772 | s799764096 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a,b,c = sorted(map(int,input().split()))
print((c-b + b-a)) | *a, = list(map(int,input().split()))
print((max(a)-min(a)))
| 2 | 2 | 58 | 53 | a, b, c = sorted(map(int, input().split()))
print((c - b + b - a))
| (*a,) = list(map(int, input().split()))
print((max(a) - min(a)))
| false | 0 | [
"-a, b, c = sorted(map(int, input().split()))",
"-print((c - b + b - a))",
"+(*a,) = list(map(int, input().split()))",
"+print((max(a) - min(a)))"
] | false | 0.045701 | 0.117712 | 0.388245 | [
"s927777772",
"s799764096"
] |
u608088992 | p03295 | python | s525917130 | s585108558 | 506 | 236 | 21,648 | 22,852 | Accepted | Accepted | 53.36 | N, M = list(map(int, input().split()))
AB = []
for i in range(M):
AB.append([int(i) for i in input().split()])
AB.sort()
MinBar = 1
abar = AB[0][0]
bbar = AB[0][1]
for i in range(1, M):
if AB[i][0] < bbar:
bbar = min(bbar, AB[i][1])
else:
MinBar += 1
abar = AB[i][0]
... | import sys
from operator import itemgetter
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
Cut = [[int(i) - 1 for i in input().split()] for _ in range(M)]
Cut.sort(key = itemgetter(1))
count = 1
cindex = 1
cutPlace = Cut[0][1]
while cindex < M:
... | 17 | 23 | 351 | 544 | N, M = list(map(int, input().split()))
AB = []
for i in range(M):
AB.append([int(i) for i in input().split()])
AB.sort()
MinBar = 1
abar = AB[0][0]
bbar = AB[0][1]
for i in range(1, M):
if AB[i][0] < bbar:
bbar = min(bbar, AB[i][1])
else:
MinBar += 1
abar = AB[i][0]
bbar = AB... | import sys
from operator import itemgetter
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
Cut = [[int(i) - 1 for i in input().split()] for _ in range(M)]
Cut.sort(key=itemgetter(1))
count = 1
cindex = 1
cutPlace = Cut[0][1]
while cindex < M:
if C... | false | 26.086957 | [
"-N, M = list(map(int, input().split()))",
"-AB = []",
"-for i in range(M):",
"- AB.append([int(i) for i in input().split()])",
"-AB.sort()",
"-MinBar = 1",
"-abar = AB[0][0]",
"-bbar = AB[0][1]",
"-for i in range(1, M):",
"- if AB[i][0] < bbar:",
"- bbar = min(bbar, AB[i][1])",
"... | false | 0.037657 | 0.036898 | 1.020552 | [
"s525917130",
"s585108558"
] |
u057109575 | p03045 | python | s257087407 | s261972208 | 858 | 392 | 94,040 | 107,524 | Accepted | Accepted | 54.31 | N, M = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(M)]
class UnionFind:
def __init__(self, n):
self.par = list(range(n))
self.rank = [0] * n
def find(self, x):
if self.par[x] == x:
return x
else:
... |
class UnionFind:
def __init__(self, n):
self.par = list(range(n))
self.rank = [0] * n
self.size = [1] * n
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
... | 36 | 48 | 882 | 1,040 | N, M = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(M)]
class UnionFind:
def __init__(self, n):
self.par = list(range(n))
self.rank = [0] * n
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] =... | class UnionFind:
def __init__(self, n):
self.par = list(range(n))
self.rank = [0] * n
self.size = [1] * n
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
def unite(sel... | false | 25 | [
"-N, M = list(map(int, input().split()))",
"-edges = [list(map(int, input().split())) for _ in range(M)]",
"-",
"-",
"+ self.size = [1] * n",
"+ self.size[x] += self.size[y]",
"- def get_par(self):",
"- return self.par",
"+ def is_same(self, x, y):",
"+ return sel... | false | 0.043965 | 0.043212 | 1.017434 | [
"s257087407",
"s261972208"
] |
u317710033 | p03493 | python | s849698042 | s313095233 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a = eval(input())
one_number = a.count('1')
print(( 1 * one_number)) | a = eval(input())
if a == '111':
print((3))
elif a == '110' or a== '101' or a == '011':
print((2))
elif a == '100' or a == '010' or a == '001':
print((1))
else:
print((0)) | 3 | 9 | 62 | 173 | a = eval(input())
one_number = a.count("1")
print((1 * one_number))
| a = eval(input())
if a == "111":
print((3))
elif a == "110" or a == "101" or a == "011":
print((2))
elif a == "100" or a == "010" or a == "001":
print((1))
else:
print((0))
| false | 66.666667 | [
"-one_number = a.count(\"1\")",
"-print((1 * one_number))",
"+if a == \"111\":",
"+ print((3))",
"+elif a == \"110\" or a == \"101\" or a == \"011\":",
"+ print((2))",
"+elif a == \"100\" or a == \"010\" or a == \"001\":",
"+ print((1))",
"+else:",
"+ print((0))"
] | false | 0.047276 | 0.047558 | 0.99408 | [
"s849698042",
"s313095233"
] |
u869790980 | p03238 | python | s328156511 | s296358773 | 422 | 56 | 85,060 | 64,264 | Accepted | Accepted | 86.73 | n = int(input())
if n == 1: print('Hello World')
elif n == 2: print(int(input())+int(input())) | print('Hello World' if int(input()) == 1 else (int(input())+int(input()))) | 3 | 1 | 106 | 85 | n = int(input())
if n == 1:
print("Hello World")
elif n == 2:
print(int(input()) + int(input()))
| print("Hello World" if int(input()) == 1 else (int(input()) + int(input())))
| false | 66.666667 | [
"-n = int(input())",
"-if n == 1:",
"- print(\"Hello World\")",
"-elif n == 2:",
"- print(int(input()) + int(input()))",
"+print(\"Hello World\" if int(input()) == 1 else (int(input()) + int(input())))"
] | false | 0.055729 | 0.037448 | 1.4882 | [
"s328156511",
"s296358773"
] |
u512212329 | p02691 | python | s991719566 | s888533797 | 206 | 189 | 67,032 | 67,200 | Accepted | Accepted | 8.25 | # class Map(dict):
# def __missing__(self, key):
# # この割当てなしのほうが速い。
# # self[key] = 0
# return 0
def main():
int(eval(input()))
d = {}
ans = 0
for i, height in enumerate(input().split()):
height = int(height)
# 引き算のほうの i は足し算のよりも大きい。
... | # class Map(dict):
# def __missing__(self, key):
# # この割当てなしのほうが速い。
# # self[key] = 0
# return 0
def main():
int(eval(input()))
d = {}
ans = 0
d_setdefault = d.setdefault
for i, height in enumerate(input().split()):
height = int(height)
#... | 28 | 29 | 584 | 617 | # class Map(dict):
# def __missing__(self, key):
# # この割当てなしのほうが速い。
# # self[key] = 0
# return 0
def main():
int(eval(input()))
d = {}
ans = 0
for i, height in enumerate(input().split()):
height = int(height)
# 引き算のほうの i は足し算のよりも大きい。
# 従って,このように順番に見ていく... | # class Map(dict):
# def __missing__(self, key):
# # この割当てなしのほうが速い。
# # self[key] = 0
# return 0
def main():
int(eval(input()))
d = {}
ans = 0
d_setdefault = d.setdefault
for i, height in enumerate(input().split()):
height = int(height)
# 引き算のほうの i は足し算のより... | false | 3.448276 | [
"+ d_setdefault = d.setdefault",
"- d.setdefault(i + height, 0)",
"+ d_setdefault(i + height, 0)",
"- ans += d.setdefault(i - height, 0)",
"+ ans += d_setdefault(i - height, 0)"
] | false | 0.046453 | 0.047804 | 0.971754 | [
"s991719566",
"s888533797"
] |
u814271993 | p02983 | python | s016638589 | s575549252 | 80 | 73 | 9,168 | 9,076 | Accepted | Accepted | 8.75 | import sys
l, r = list(map(int, input().split()))
ans = 10 ** 10
for i in range(l, r):
for j in range(i+1, r+1):
if (i * j) % 2019 == 0:
print((0))
sys.exit()
ans = min(ans, (i*j) % 2019)
print(ans) | l, r = list(map(int, input().split()))
ans = 10 ** 10
for i in range(l, r):
for j in range(i+1, r+1):
if (i * j) % 2019 == 0:
print((0))
exit()
ans = min(ans, (i*j) % 2019)
print(ans) | 11 | 9 | 224 | 205 | import sys
l, r = list(map(int, input().split()))
ans = 10**10
for i in range(l, r):
for j in range(i + 1, r + 1):
if (i * j) % 2019 == 0:
print((0))
sys.exit()
ans = min(ans, (i * j) % 2019)
print(ans)
| l, r = list(map(int, input().split()))
ans = 10**10
for i in range(l, r):
for j in range(i + 1, r + 1):
if (i * j) % 2019 == 0:
print((0))
exit()
ans = min(ans, (i * j) % 2019)
print(ans)
| false | 18.181818 | [
"-import sys",
"-",
"- sys.exit()",
"+ exit()"
] | false | 0.038476 | 0.032771 | 1.174063 | [
"s016638589",
"s575549252"
] |
u843175622 | p04034 | python | s995948804 | s259642135 | 358 | 230 | 5,552 | 11,408 | Accepted | Accepted | 35.75 | n, m = list(map(int, input().split()))
B = [1] * n
R = [0] * n
R[0] = 1
for _ in range(m):
x, y = list(map(int, input().split()))
x -= 1; y -= 1
if B[x] == 1 and R[x] == 1:
R[x] = 0; R[y] = 1
elif B[x] > 1 and R[x] == 1:
R[y] = 1
B[x] -= 1; B[y] += 1
print((len([... | n, m = list(map(int, input().split()))
red = [False] * n
ball = [1] * n
red[0] = True
for _ in range(m):
x, y = [int(x) - 1 for x in input().split()]
if red[x]:
red[y] = True
if ball[x] == 1:
red[x] = False
ball[y] += 1
ball[x] -= 1
print((len(list([x for x in... | 16 | 15 | 330 | 335 | n, m = list(map(int, input().split()))
B = [1] * n
R = [0] * n
R[0] = 1
for _ in range(m):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
if B[x] == 1 and R[x] == 1:
R[x] = 0
R[y] = 1
elif B[x] > 1 and R[x] == 1:
R[y] = 1
B[x] -= 1
B[y] += 1
print((len([i for i ... | n, m = list(map(int, input().split()))
red = [False] * n
ball = [1] * n
red[0] = True
for _ in range(m):
x, y = [int(x) - 1 for x in input().split()]
if red[x]:
red[y] = True
if ball[x] == 1:
red[x] = False
ball[y] += 1
ball[x] -= 1
print((len(list([x for x in red if x]))))
| false | 6.25 | [
"-B = [1] * n",
"-R = [0] * n",
"-R[0] = 1",
"+red = [False] * n",
"+ball = [1] * n",
"+red[0] = True",
"- x, y = list(map(int, input().split()))",
"- x -= 1",
"- y -= 1",
"- if B[x] == 1 and R[x] == 1:",
"- R[x] = 0",
"- R[y] = 1",
"- elif B[x] > 1 and R[x] == 1... | false | 0.075239 | 0.034531 | 2.178862 | [
"s995948804",
"s259642135"
] |
u949338836 | p02272 | python | s287066787 | s519674111 | 4,580 | 3,620 | 63,720 | 63,780 | Accepted | Accepted | 20.96 | #coding:utf-8
#1_5_B
def merge_sort(array):
if len(array) > 1:
L, countL = merge_sort(array[0:len(array)//2])
R, countR = merge_sort(array[len(array)//2:])
return merge(L, R, countL+countR)
if len(array) == 1:
return [array, 0]
def merge(L, R, count=0):
L.append... | #coding:utf-8
#1_5_B
def merge(array, left, mid, right):
global cnt
n1 = mid - left
n2 = right - mid
L = array[left:mid] + [sentinel]
R = array[mid:right] + [sentinel]
i = j = 0
for k in range(left, right):
if L[i] <= R[j]:
array[k] = L[i]
i += 1
... | 33 | 33 | 784 | 766 | # coding:utf-8
# 1_5_B
def merge_sort(array):
if len(array) > 1:
L, countL = merge_sort(array[0 : len(array) // 2])
R, countR = merge_sort(array[len(array) // 2 :])
return merge(L, R, countL + countR)
if len(array) == 1:
return [array, 0]
def merge(L, R, count=0):
L.append(... | # coding:utf-8
# 1_5_B
def merge(array, left, mid, right):
global cnt
n1 = mid - left
n2 = right - mid
L = array[left:mid] + [sentinel]
R = array[mid:right] + [sentinel]
i = j = 0
for k in range(left, right):
if L[i] <= R[j]:
array[k] = L[i]
i += 1
els... | false | 0 | [
"-def merge_sort(array):",
"- if len(array) > 1:",
"- L, countL = merge_sort(array[0 : len(array) // 2])",
"- R, countR = merge_sort(array[len(array) // 2 :])",
"- return merge(L, R, countL + countR)",
"- if len(array) == 1:",
"- return [array, 0]",
"+def merge(array,... | false | 0.041749 | 0.04232 | 0.986514 | [
"s287066787",
"s519674111"
] |
u794910686 | p02848 | python | s839042251 | s280459734 | 30 | 20 | 3,060 | 3,060 | Accepted | Accepted | 33.33 | E=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
N=int(eval(input()))
S=list(eval(input()))
while(N>=26):
N-=26
for i in range(len(S)):
if N+E.index(S[i])<=25:
S[i]=E[N+E.index(S[i])]
elif N+E.index(S[i])>=26:
S[i]=E[N+E.index(S[i])-26]
print(("".join(S)))
| z="ABCDEFGHIJKLMNOPQRSTUVWXYZ"*2
n=int(eval(input()))%26
s=eval(input())
out=[]
for a in s:
out.append(z[z.find(a)+n])
print(("".join(out)))
| 17 | 7 | 281 | 137 | E = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
N = int(eval(input()))
S = list(eval(input()))
while N >= 26:
N -= 26
for i in range(len(S)):
if N + E.index(S[i]) <= 25:
S[i] = E[N + E.index(S[i])]
elif N + E.index(S[i]) >= 26:
S[i] = E[N + E.index(S[i]) - 26]
print(("".join(S)))
| z = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" * 2
n = int(eval(input())) % 26
s = eval(input())
out = []
for a in s:
out.append(z[z.find(a) + n])
print(("".join(out)))
| false | 58.823529 | [
"-E = list(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\")",
"-N = int(eval(input()))",
"-S = list(eval(input()))",
"-while N >= 26:",
"- N -= 26",
"-for i in range(len(S)):",
"- if N + E.index(S[i]) <= 25:",
"- S[i] = E[N + E.index(S[i])]",
"- elif N + E.index(S[i]) >= 26:",
"- S[i] = E[N ... | false | 0.034737 | 0.036553 | 0.950316 | [
"s839042251",
"s280459734"
] |
u076917070 | p02834 | python | s367910940 | s812739765 | 758 | 428 | 41,964 | 33,424 | Accepted | Accepted | 43.54 | import sys
input = sys.stdin.readline
import heapq
def dijkstra(s, E):
inf = float("inf")
d = [inf for i in range(len(E))]
d[s] = 0
q = [(0, s)]
while q:
c, p = heapq.heappop(q)
if d[p] < c:
continue
for cost, to in E[p]:
if d[to] > d[... | import sys
input = sys.stdin.readline
def treeDist(u, E):
D = [-1]*len(E)
q = [(u, 0)]
while q:
i, d = q.pop()
if D[i] != -1:
continue
D[i] = d
for j in E[i]:
q.append((j, d+1))
return D
def main():
N, u, v = list(map(int,... | 39 | 36 | 865 | 705 | import sys
input = sys.stdin.readline
import heapq
def dijkstra(s, E):
inf = float("inf")
d = [inf for i in range(len(E))]
d[s] = 0
q = [(0, s)]
while q:
c, p = heapq.heappop(q)
if d[p] < c:
continue
for cost, to in E[p]:
if d[to] > d[p] + cost:
... | import sys
input = sys.stdin.readline
def treeDist(u, E):
D = [-1] * len(E)
q = [(u, 0)]
while q:
i, d = q.pop()
if D[i] != -1:
continue
D[i] = d
for j in E[i]:
q.append((j, d + 1))
return D
def main():
N, u, v = list(map(int, input().spli... | false | 7.692308 | [
"-import heapq",
"-def dijkstra(s, E):",
"- inf = float(\"inf\")",
"- d = [inf for i in range(len(E))]",
"- d[s] = 0",
"- q = [(0, s)]",
"+def treeDist(u, E):",
"+ D = [-1] * len(E)",
"+ q = [(u, 0)]",
"- c, p = heapq.heappop(q)",
"- if d[p] < c:",
"+ i, ... | false | 0.062998 | 0.114215 | 0.55157 | [
"s367910940",
"s812739765"
] |
u143509139 | p03203 | python | s964885676 | s966864625 | 1,459 | 1,118 | 67,672 | 67,924 | Accepted | Accepted | 23.37 | h, w, n = list(map(int, input().split()))
li = []
l = [w] * h
for _ in range(n):
x, y = list(map(int, input().split()))
li.append((x - 1, y - 1))
li.sort()
cnt = 0
ans = h
for x, y in li:
if x - cnt == y:
cnt += 1
elif x - cnt > y:
ans = min(ans, x)
print(ans)
| h, w, n = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(n)]
l.sort(key=lambda x: (x[1], x[0]))
t = 0
a = [h + 1]
for x, y in l:
if x > y + t:
a.append(x)
elif x == y + t:
t += 1
print((min(a) - 1))
| 16 | 11 | 297 | 262 | h, w, n = list(map(int, input().split()))
li = []
l = [w] * h
for _ in range(n):
x, y = list(map(int, input().split()))
li.append((x - 1, y - 1))
li.sort()
cnt = 0
ans = h
for x, y in li:
if x - cnt == y:
cnt += 1
elif x - cnt > y:
ans = min(ans, x)
print(ans)
| h, w, n = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(n)]
l.sort(key=lambda x: (x[1], x[0]))
t = 0
a = [h + 1]
for x, y in l:
if x > y + t:
a.append(x)
elif x == y + t:
t += 1
print((min(a) - 1))
| false | 31.25 | [
"-li = []",
"-l = [w] * h",
"-for _ in range(n):",
"- x, y = list(map(int, input().split()))",
"- li.append((x - 1, y - 1))",
"-li.sort()",
"-cnt = 0",
"-ans = h",
"-for x, y in li:",
"- if x - cnt == y:",
"- cnt += 1",
"- elif x - cnt > y:",
"- ans = min(ans, x)",
... | false | 0.040778 | 0.035667 | 1.143296 | [
"s964885676",
"s966864625"
] |
u163907160 | p02695 | python | s958271581 | s024299160 | 197 | 169 | 77,092 | 72,260 | Accepted | Accepted | 14.21 | import math
#X=int(input())
N,M,Q=list(map(int,input().split()))
S=[[]for i in range(Q)]
for i in range(Q):
a=list(map(int,input().split()))
S[i]=a
ans=0
T=0
for a in range(1,M+1):
for b in range(a, M+1):
for c in range(b, M+1):
for d in range(c, M+1):
for e ... | import math
import sys
sys.setrecursionlimit(10**7)
#X=int(input())
N,M,Q=list(map(int,input().split()))
S=[[]for i in range(Q)]
for i in range(Q):
a=list(map(int,input().split()))
S[i]=a
ans=0
T=0
def solve(l):
global ans
if len(l)>=N:
tmp=0
for k in range(Q):
... | 27 | 24 | 1,030 | 504 | import math
# X=int(input())
N, M, Q = list(map(int, input().split()))
S = [[] for i in range(Q)]
for i in range(Q):
a = list(map(int, input().split()))
S[i] = a
ans = 0
T = 0
for a in range(1, M + 1):
for b in range(a, M + 1):
for c in range(b, M + 1):
for d in range(c, M + 1):
... | import math
import sys
sys.setrecursionlimit(10**7)
# X=int(input())
N, M, Q = list(map(int, input().split()))
S = [[] for i in range(Q)]
for i in range(Q):
a = list(map(int, input().split()))
S[i] = a
ans = 0
T = 0
def solve(l):
global ans
if len(l) >= N:
tmp = 0
for k in range(Q):
... | false | 11.111111 | [
"+import sys",
"+sys.setrecursionlimit(10**7)",
"-for a in range(1, M + 1):",
"- for b in range(a, M + 1):",
"- for c in range(b, M + 1):",
"- for d in range(c, M + 1):",
"- for e in range(d, M + 1):",
"- for f in range(e, M + 1):",
"- ... | false | 0.084121 | 0.056025 | 1.501509 | [
"s958271581",
"s024299160"
] |
u875291233 | p02937 | python | s080085398 | s815255115 | 823 | 245 | 103,904 | 103,772 | Accepted | Accepted | 70.23 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意
ss = eval(input())
t = eval(input())
s = ss+ss
l = len(s)
d = [[-1]*26 for _ in range(l)]
#now = [-1]*27
prev = [-1]*27
ans = -1
for i,c in enumerate(s):
# if now[j] ==... | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意
s = eval(input())
t = eval(input())
ls = len(s)
ss = s+s
#table[ord(t)-97][i] = 文字tがi番目orそれ以降で登場する最初のindex
table = [[-1]*(ls*2) for _ in range(26)]
prev = [-1]*26
for i,c in enumerate... | 69 | 37 | 941 | 639 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline # 文字列入力のときは注意
ss = eval(input())
t = eval(input())
s = ss + ss
l = len(s)
d = [[-1] * 26 for _ in range(l)]
# now = [-1]*27
prev = [-1] * 27
ans = -1
for i, c in enumerate(s):
# if now[j] == -1: continue... | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline # 文字列入力のときは注意
s = eval(input())
t = eval(input())
ls = len(s)
ss = s + s
# table[ord(t)-97][i] = 文字tがi番目orそれ以降で登場する最初のindex
table = [[-1] * (ls * 2) for _ in range(26)]
prev = [-1] * 26
for i, c in enumerate(ss):
... | false | 46.376812 | [
"-ss = eval(input())",
"+s = eval(input())",
"-s = ss + ss",
"-l = len(s)",
"-d = [[-1] * 26 for _ in range(l)]",
"-# now = [-1]*27",
"-prev = [-1] * 27",
"-ans = -1",
"-for i, c in enumerate(s):",
"- # if now[j] == -1: continue",
"- # if d[now[j]][ord(c)-97] == -1:",
"- ... | false | 0.042268 | 0.036729 | 1.150812 | [
"s080085398",
"s815255115"
] |
u952708174 | p03476 | python | s746394731 | s373594048 | 409 | 372 | 24,944 | 33,260 | Accepted | Accepted | 9.05 | def d_2017LikeNumber(Q, I): # Q:クエリの数、I:探索区間の左端と右端
def prime_list(M):
# 0以上M以下の素数のリスト
s = [True] * (M + 1) # i番目の要素はiが素数ならTrue、非素数ならFalse
s[0] = s[1] = False
for x in range(2, int(M**0.5) + 1):
if s[x]:
for i in range(x + x, len(s), x):
... | def d_2017_like_number():
Q = int(eval(input()))
I = [[int(i) for i in input().split()] for j in range(Q)]
def prime_table(n):
"""n 以下の整数がそれぞれ素数かどうかのリスト (エラトステネスの篩)"""
is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False # 0と1は素数でない
for j in range(2, int(n*... | 34 | 31 | 1,079 | 1,076 | def d_2017LikeNumber(Q, I): # Q:クエリの数、I:探索区間の左端と右端
def prime_list(M):
# 0以上M以下の素数のリスト
s = [True] * (M + 1) # i番目の要素はiが素数ならTrue、非素数ならFalse
s[0] = s[1] = False
for x in range(2, int(M**0.5) + 1):
if s[x]:
for i in range(x + x, len(s), x):
... | def d_2017_like_number():
Q = int(eval(input()))
I = [[int(i) for i in input().split()] for j in range(Q)]
def prime_table(n):
"""n 以下の整数がそれぞれ素数かどうかのリスト (エラトステネスの篩)"""
is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False # 0と1は素数でない
for j in range(2, int(n**0.5) + ... | false | 8.823529 | [
"-def d_2017LikeNumber(Q, I): # Q:クエリの数、I:探索区間の左端と右端",
"- def prime_list(M):",
"- # 0以上M以下の素数のリスト",
"- s = [True] * (M + 1) # i番目の要素はiが素数ならTrue、非素数ならFalse",
"- s[0] = s[1] = False",
"- for x in range(2, int(M**0.5) + 1):",
"- if s[x]:",
"- for... | false | 0.007836 | 0.075851 | 0.103307 | [
"s746394731",
"s373594048"
] |
u581980068 | p03059 | python | s025961675 | s967765030 | 11 | 10 | 2,568 | 2,568 | Accepted | Accepted | 9.09 | [A, B, T] = list(map(int, input().split()))
biscuits = 0
time = 0
while time < (T + 0.5 - A):
biscuits = biscuits + B
time = time + A
print(biscuits) | [A, B, T] = list(map(int, input().split()))
biscuits = B * (T / A)
print(biscuits) | 7 | 3 | 156 | 81 | [A, B, T] = list(map(int, input().split()))
biscuits = 0
time = 0
while time < (T + 0.5 - A):
biscuits = biscuits + B
time = time + A
print(biscuits)
| [A, B, T] = list(map(int, input().split()))
biscuits = B * (T / A)
print(biscuits)
| false | 57.142857 | [
"-biscuits = 0",
"-time = 0",
"-while time < (T + 0.5 - A):",
"- biscuits = biscuits + B",
"- time = time + A",
"+biscuits = B * (T / A)"
] | false | 0.055889 | 0.035361 | 1.580538 | [
"s025961675",
"s967765030"
] |
u751549333 | p02595 | python | s233229012 | s209170176 | 555 | 497 | 24,932 | 9,540 | Accepted | Accepted | 10.45 | n , d = list(map(int, input().split()))
x = []
y = []
for i in range(n):
a = list(map(int, (input().split())))
x.append(a[0])
y.append(a[1])
ans = 0
for i in range(n):
if (x[i] ** 2 + y[i] ** 2) ** (0.5) <= d:
ans += 1
print(ans) | n , d = list(map(int, input().split()))
ans = 0
for _ in range(n):
p, q = list(map(int, input().split()))
if (p ** 2 + q ** 2) ** 0.5 <= d:
ans += 1
print(ans) | 14 | 9 | 289 | 206 | n, d = list(map(int, input().split()))
x = []
y = []
for i in range(n):
a = list(map(int, (input().split())))
x.append(a[0])
y.append(a[1])
ans = 0
for i in range(n):
if (x[i] ** 2 + y[i] ** 2) ** (0.5) <= d:
ans += 1
print(ans)
| n, d = list(map(int, input().split()))
ans = 0
for _ in range(n):
p, q = list(map(int, input().split()))
if (p**2 + q**2) ** 0.5 <= d:
ans += 1
print(ans)
| false | 35.714286 | [
"-x = []",
"-y = []",
"-for i in range(n):",
"- a = list(map(int, (input().split())))",
"- x.append(a[0])",
"- y.append(a[1])",
"-for i in range(n):",
"- if (x[i] ** 2 + y[i] ** 2) ** (0.5) <= d:",
"+for _ in range(n):",
"+ p, q = list(map(int, input().split()))",
"+ if (p**2 +... | false | 0.071146 | 0.056632 | 1.256282 | [
"s233229012",
"s209170176"
] |
u729133443 | p03087 | python | s677514387 | s060060277 | 1,025 | 894 | 53,964 | 7,768 | Accepted | Accepted | 12.78 | I=lambda:list(map(int,input().split()))
n,q=I()
s=eval(input())
a=[0]
for i in range(n):a+=[a[i]+(s[i-1:i+1]=='AC')]
for _ in[0]*q:l,r=I();print((a[r]-a[l])) | I=lambda:list(map(int,input().split()));n,q=I();s=eval(input());a=[0]
for i in range(n):a+=[a[i]+(s[i-1:i+1]=='AC')]
while q:l,r=I();print((a[r]-a[l]));q-=1 | 6 | 3 | 148 | 144 | I = lambda: list(map(int, input().split()))
n, q = I()
s = eval(input())
a = [0]
for i in range(n):
a += [a[i] + (s[i - 1 : i + 1] == "AC")]
for _ in [0] * q:
l, r = I()
print((a[r] - a[l]))
| I = lambda: list(map(int, input().split()))
n, q = I()
s = eval(input())
a = [0]
for i in range(n):
a += [a[i] + (s[i - 1 : i + 1] == "AC")]
while q:
l, r = I()
print((a[r] - a[l]))
q -= 1
| false | 50 | [
"-for _ in [0] * q:",
"+while q:",
"+ q -= 1"
] | false | 0.047119 | 0.047116 | 1.000077 | [
"s677514387",
"s060060277"
] |
u041932988 | p02596 | python | s918440104 | s528419778 | 1,665 | 181 | 8,900 | 9,068 | Accepted | Accepted | 89.13 | def f(K):
sum = 0
for i in range(K+1):
sum += (pow(10, i, K)*7)
sum %= K
if sum == 0:
return i+1
return -1
K = int(eval(input()))
print((f(K)))
| def f(K):
sum = 0
p10 = 1
for i in range(K+1):
sum += p10*7
p10 *= 10
p10 %= K
sum %= K
if sum == 0:
return i+1
return -1
K = int(eval(input()))
print((f(K)))
| 14 | 17 | 201 | 239 | def f(K):
sum = 0
for i in range(K + 1):
sum += pow(10, i, K) * 7
sum %= K
if sum == 0:
return i + 1
return -1
K = int(eval(input()))
print((f(K)))
| def f(K):
sum = 0
p10 = 1
for i in range(K + 1):
sum += p10 * 7
p10 *= 10
p10 %= K
sum %= K
if sum == 0:
return i + 1
return -1
K = int(eval(input()))
print((f(K)))
| false | 17.647059 | [
"+ p10 = 1",
"- sum += pow(10, i, K) * 7",
"+ sum += p10 * 7",
"+ p10 *= 10",
"+ p10 %= K"
] | false | 1.00686 | 0.06896 | 14.600623 | [
"s918440104",
"s528419778"
] |
u057415180 | p03456 | python | s773702594 | s981740880 | 50 | 18 | 2,940 | 2,940 | Accepted | Accepted | 64 | a, b = list(map(str, input().split()))
c = int(a + b)
for i in range(c):
if i**2 == c:
ans = 'Yes'
break
else:
ans = 'No'
print(ans) | a, b = list(map(str, input().split()))
c = int(a + b)
for i in range(4, 317):
if i**2 == c:
ans = 'Yes'
break
else:
ans = 'No'
print(ans) | 11 | 11 | 170 | 175 | a, b = list(map(str, input().split()))
c = int(a + b)
for i in range(c):
if i**2 == c:
ans = "Yes"
break
else:
ans = "No"
print(ans)
| a, b = list(map(str, input().split()))
c = int(a + b)
for i in range(4, 317):
if i**2 == c:
ans = "Yes"
break
else:
ans = "No"
print(ans)
| false | 0 | [
"-for i in range(c):",
"+for i in range(4, 317):"
] | false | 0.057242 | 0.036911 | 1.550818 | [
"s773702594",
"s981740880"
] |
u171276253 | p03448 | python | s535423356 | s631146251 | 49 | 45 | 3,064 | 2,940 | Accepted | Accepted | 8.16 | a, b, c, x = list(map(int, [eval(input()) for i in range(4)]))
ans = 0
for a in range(a + 1):
for b in range(b + 1):
for c in range(c + 1):
if a*500 + b*100 + c*50 == x:
ans += 1
print(ans) | a, b, c, x = list(map(int, [eval(input()) for i in range(4)]))
ans = [ a for a1 in range(a+1) for b1 in range(b+1) for c1 in range(c+1) if a1*500 + b1*100+ c1*50 == x ]
print((len(ans))) | 8 | 3 | 224 | 174 | a, b, c, x = list(map(int, [eval(input()) for i in range(4)]))
ans = 0
for a in range(a + 1):
for b in range(b + 1):
for c in range(c + 1):
if a * 500 + b * 100 + c * 50 == x:
ans += 1
print(ans)
| a, b, c, x = list(map(int, [eval(input()) for i in range(4)]))
ans = [
a
for a1 in range(a + 1)
for b1 in range(b + 1)
for c1 in range(c + 1)
if a1 * 500 + b1 * 100 + c1 * 50 == x
]
print((len(ans)))
| false | 62.5 | [
"-ans = 0",
"-for a in range(a + 1):",
"- for b in range(b + 1):",
"- for c in range(c + 1):",
"- if a * 500 + b * 100 + c * 50 == x:",
"- ans += 1",
"-print(ans)",
"+ans = [",
"+ a",
"+ for a1 in range(a + 1)",
"+ for b1 in range(b + 1)",
"+ for... | false | 0.148164 | 0.117462 | 1.261373 | [
"s535423356",
"s631146251"
] |
u585482323 | p02788 | python | s156613977 | s684217240 | 1,907 | 1,700 | 134,948 | 106,920 | Accepted | Accepted | 10.85 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in... | 96 | 65 | 2,430 | 1,472 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(... | false | 32.291667 | [
"-import operator",
"-",
"-",
"-class SegmentTree:",
"- def __init__(self, size, default, op=operator.add):",
"- self.size = 2 ** size.bit_length()",
"- self.dat = [default] * (self.size * 2)",
"- self.op = op",
"-",
"- def update(self, i, x):",
"- i += self.siz... | false | 0.090695 | 0.034914 | 2.597685 | [
"s156613977",
"s684217240"
] |
u844646164 | p03449 | python | s140117813 | s149918906 | 165 | 75 | 13,428 | 62,064 | Accepted | Accepted | 54.55 | import numpy as np
N = int(eval(input()))
A = np.array(list(map(int, input().split())))
B = np.array(list(map(int, input().split())))
A_sum = np.cumsum(A)
B_sum = np.cumsum(B[::-1])[::-1]
li = []
for i in range(N):
li.append(A_sum[i]+B_sum[i])
print((max(li))) | N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(2)]
b = [0] + A[0]
c = [0] + A[1]
if N == 1:
print((A[0][0] + A[1][0]))
exit()
for i in range(1, N):
b[i+1] += b[i]
c[i+1] += c[i]
ans = 0
for i in range(1, N):
tmp = (b[i]-b[0]) + (c[-1]-c[i-1])
ans ... | 10 | 20 | 265 | 341 | import numpy as np
N = int(eval(input()))
A = np.array(list(map(int, input().split())))
B = np.array(list(map(int, input().split())))
A_sum = np.cumsum(A)
B_sum = np.cumsum(B[::-1])[::-1]
li = []
for i in range(N):
li.append(A_sum[i] + B_sum[i])
print((max(li)))
| N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(2)]
b = [0] + A[0]
c = [0] + A[1]
if N == 1:
print((A[0][0] + A[1][0]))
exit()
for i in range(1, N):
b[i + 1] += b[i]
c[i + 1] += c[i]
ans = 0
for i in range(1, N):
tmp = (b[i] - b[0]) + (c[-1] - c[i - 1])
ans = max(ans, ... | false | 50 | [
"-import numpy as np",
"-",
"-A = np.array(list(map(int, input().split())))",
"-B = np.array(list(map(int, input().split())))",
"-A_sum = np.cumsum(A)",
"-B_sum = np.cumsum(B[::-1])[::-1]",
"-li = []",
"-for i in range(N):",
"- li.append(A_sum[i] + B_sum[i])",
"-print((max(li)))",
"+A = [list... | false | 0.22304 | 0.041452 | 5.380692 | [
"s140117813",
"s149918906"
] |
u952708174 | p03013 | python | s529960776 | s287779434 | 589 | 174 | 462,708 | 13,216 | Accepted | Accepted | 70.46 | def c_typical_stairs(N, M, A, MOD=10**9 + 7):
a = set(A)
stairs = [0] * (N + 100)
stairs[0] = 1
for i in range(N):
if i + 1 <= N and (i + 1) not in a:
stairs[i + 1] += stairs[i]
if i + 2 <= N and (i + 2) not in a:
stairs[i + 2] += stairs[i]
return sta... | def c_typical_stairs(N, M, A, MOD=(10**9 + 7)):
a = set(A)
stairs = [0] * (N + 1)
stairs[0] = 1
for i in range(1, N + 1):
if i in a:
continue
if i - 1 >= 0:
stairs[i] += stairs[i - 1]
stairs[i] %= MOD
if i - 2 >= 0:
stair... | 14 | 18 | 448 | 515 | def c_typical_stairs(N, M, A, MOD=10**9 + 7):
a = set(A)
stairs = [0] * (N + 100)
stairs[0] = 1
for i in range(N):
if i + 1 <= N and (i + 1) not in a:
stairs[i + 1] += stairs[i]
if i + 2 <= N and (i + 2) not in a:
stairs[i + 2] += stairs[i]
return stairs[N] % ... | def c_typical_stairs(N, M, A, MOD=(10**9 + 7)):
a = set(A)
stairs = [0] * (N + 1)
stairs[0] = 1
for i in range(1, N + 1):
if i in a:
continue
if i - 1 >= 0:
stairs[i] += stairs[i - 1]
stairs[i] %= MOD
if i - 2 >= 0:
stairs[i] += sta... | false | 22.222222 | [
"-def c_typical_stairs(N, M, A, MOD=10**9 + 7):",
"+def c_typical_stairs(N, M, A, MOD=(10**9 + 7)):",
"- stairs = [0] * (N + 100)",
"+ stairs = [0] * (N + 1)",
"- for i in range(N):",
"- if i + 1 <= N and (i + 1) not in a:",
"- stairs[i + 1] += stairs[i]",
"- if i + 2... | false | 0.042371 | 0.128305 | 0.330237 | [
"s529960776",
"s287779434"
] |
u525065967 | p02597 | python | s631850174 | s195106831 | 50 | 29 | 10,624 | 9,368 | Accepted | Accepted | 42 | n = int(eval(input()))
C = list(eval(input()))
r = C.count('R')
c = 0
for i in range(r, n):
if C[i] == 'R': c += 1
print(c)
| _ = int(eval(input()))
C = eval(input())
print((C[C.count('R'):].count('R')))
| 7 | 3 | 122 | 66 | n = int(eval(input()))
C = list(eval(input()))
r = C.count("R")
c = 0
for i in range(r, n):
if C[i] == "R":
c += 1
print(c)
| _ = int(eval(input()))
C = eval(input())
print((C[C.count("R") :].count("R")))
| false | 57.142857 | [
"-n = int(eval(input()))",
"-C = list(eval(input()))",
"-r = C.count(\"R\")",
"-c = 0",
"-for i in range(r, n):",
"- if C[i] == \"R\":",
"- c += 1",
"-print(c)",
"+_ = int(eval(input()))",
"+C = eval(input())",
"+print((C[C.count(\"R\") :].count(\"R\")))"
] | false | 0.039964 | 0.037204 | 1.074195 | [
"s631850174",
"s195106831"
] |
u746419473 | p02879 | python | s644828600 | s856828721 | 19 | 17 | 3,060 | 3,064 | Accepted | Accepted | 10.53 | a, b = list(map(int, input().split()))
print((a*b if len(str(a)) == len(str(b)) == 1 else -1))
| a, b = list(map(int, input().split()))
print((a*b if a <= 9 and b <= 9 else -1))
| 3 | 2 | 90 | 74 | a, b = list(map(int, input().split()))
print((a * b if len(str(a)) == len(str(b)) == 1 else -1))
| a, b = list(map(int, input().split()))
print((a * b if a <= 9 and b <= 9 else -1))
| false | 33.333333 | [
"-print((a * b if len(str(a)) == len(str(b)) == 1 else -1))",
"+print((a * b if a <= 9 and b <= 9 else -1))"
] | false | 0.039492 | 0.03943 | 1.001566 | [
"s644828600",
"s856828721"
] |
u934442292 | p03355 | python | s159359609 | s289756480 | 38 | 33 | 4,984 | 4,980 | Accepted | Accepted | 13.16 | import sys
from string import ascii_lowercase as AL
input = sys.stdin.readline
def main():
s = input().rstrip()
K = int(eval(input()))
N = len(s)
total = 0
for al in AL:
induces = []
for i in range(N):
if al == s[i]:
induces.append(i)
... | import sys
input = sys.stdin.readline
def main():
s = input().rstrip()
K = int(eval(input()))
N = len(s)
sub = []
for i in range(N):
for j in range(K):
sub.append(s[i:i+j+1])
sub = set(sub)
sub = sorted(sub)
ans = sub[K-1]
print(ans)
if _... | 36 | 22 | 796 | 349 | import sys
from string import ascii_lowercase as AL
input = sys.stdin.readline
def main():
s = input().rstrip()
K = int(eval(input()))
N = len(s)
total = 0
for al in AL:
induces = []
for i in range(N):
if al == s[i]:
induces.append(i)
if not ind... | import sys
input = sys.stdin.readline
def main():
s = input().rstrip()
K = int(eval(input()))
N = len(s)
sub = []
for i in range(N):
for j in range(K):
sub.append(s[i : i + j + 1])
sub = set(sub)
sub = sorted(sub)
ans = sub[K - 1]
print(ans)
if __name__ == "_... | false | 38.888889 | [
"-from string import ascii_lowercase as AL",
"- total = 0",
"- for al in AL:",
"- induces = []",
"- for i in range(N):",
"- if al == s[i]:",
"- induces.append(i)",
"- if not induces:",
"- continue",
"- match = [al]",
"- ... | false | 0.042129 | 0.03708 | 1.136188 | [
"s159359609",
"s289756480"
] |
u729133443 | p02760 | python | s076839438 | s810166060 | 19 | 17 | 3,060 | 3,064 | Accepted | Accepted | 10.53 | a=open(0).read().split();print(('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,3,6},{0,4,8},{1,4,7},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2])) | a=open(0).read().split();print(('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,3,6},{0,4,8},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2])) | 1 | 1 | 140 | 132 | a = open(0).read().split()
print(
(
"YNeos"[
all(
t - set(map(a.index, a[10:]))
for t in (
{0, 3, 6},
{0, 4, 8},
{1, 4, 7},
{2, 4, 6},
{2, 5, 8},
... | a = open(0).read().split()
print(
(
"YNeos"[
all(
t - set(map(a.index, a[10:]))
for t in (
{0, 3, 6},
{0, 4, 8},
{2, 4, 6},
{2, 5, 8},
{3, 4, 5},
... | false | 0 | [
"- {1, 4, 7},"
] | false | 0.031973 | 0.062704 | 0.509898 | [
"s076839438",
"s810166060"
] |
u747602774 | p02781 | python | s621463451 | s534303348 | 46 | 42 | 3,192 | 3,316 | Accepted | Accepted | 8.7 | import itertools
N = eval(input())
K = int(eval(input()))
lN = len(N)
if K == 1:
ans = int(N[0])+9*(lN-1)
print(ans)
elif K == 2:
not0 = 1000
for i in range(1,lN):
if int(N[i]) != 0:
not0 = i
break
ans = 0
n = [i for i in range(lN)]
... | import itertools
N = eval(input())
K = int(eval(input()))
lN = len(N)
if K == 1:
ans = int(N[0])+9*(lN-1)
print(ans)
elif K == 2:
not0 = 1000
for i in range(1,lN):
if int(N[i]) != 0:
not0 = i
break
ans = 0
n = [i for i in range(lN)]
fo... | 67 | 62 | 1,659 | 1,464 | import itertools
N = eval(input())
K = int(eval(input()))
lN = len(N)
if K == 1:
ans = int(N[0]) + 9 * (lN - 1)
print(ans)
elif K == 2:
not0 = 1000
for i in range(1, lN):
if int(N[i]) != 0:
not0 = i
break
ans = 0
n = [i for i in range(lN)]
for v in itertools.... | import itertools
N = eval(input())
K = int(eval(input()))
lN = len(N)
if K == 1:
ans = int(N[0]) + 9 * (lN - 1)
print(ans)
elif K == 2:
not0 = 1000
for i in range(1, lN):
if int(N[i]) != 0:
not0 = i
break
ans = 0
n = [i for i in range(lN)]
for v in itertools.... | false | 7.462687 | [
"- if not0s == v[2]:",
"+ if not0s >= v[2]:",
"- elif not0s < v[2]:",
"+ else:",
"- # ans += int(N[0])*int(N[v[1]])*9",
"- else:",
"- ans += max(0, int(N[0]) - 1) * 9 * 9",
"- ... | false | 0.088823 | 0.083043 | 1.069597 | [
"s621463451",
"s534303348"
] |
u709304134 | p03031 | python | s040016518 | s998875152 | 255 | 28 | 12,536 | 3,064 | Accepted | Accepted | 89.02 | #coding:utf-8
import itertools
import numpy as np
ls_S = []
N,M = list(map(int,input().split()))
for m in range(M):
S = list(map(int,input().split()))
S = [s-1 for s in S]
ls_S.append(S[1:])
ptns = list(itertools.product(list(range(0,2)), repeat=N))
ptns = np.array(ptns)
#print (ptns)
#print (ls... | from itertools import product
N, M = list(map(int,input().split()))
S = []
for m in range(M):
s = list(map(int,input().split()))
S.append(s[1:])
P = list(map(int,input().split()))
ans = 0
for c in product([0,1],repeat=N):
ok = True
for m in range(M):
sm = 0
for s in S[m]:
... | 30 | 22 | 682 | 463 | # coding:utf-8
import itertools
import numpy as np
ls_S = []
N, M = list(map(int, input().split()))
for m in range(M):
S = list(map(int, input().split()))
S = [s - 1 for s in S]
ls_S.append(S[1:])
ptns = list(itertools.product(list(range(0, 2)), repeat=N))
ptns = np.array(ptns)
# print (ptns)
# print (ls_S... | from itertools import product
N, M = list(map(int, input().split()))
S = []
for m in range(M):
s = list(map(int, input().split()))
S.append(s[1:])
P = list(map(int, input().split()))
ans = 0
for c in product([0, 1], repeat=N):
ok = True
for m in range(M):
sm = 0
for s in S[m]:
... | false | 26.666667 | [
"-# coding:utf-8",
"-import itertools",
"-import numpy as np",
"+from itertools import product",
"-ls_S = []",
"+S = []",
"- S = list(map(int, input().split()))",
"- S = [s - 1 for s in S]",
"- ls_S.append(S[1:])",
"-ptns = list(itertools.product(list(range(0, 2)), repeat=N))",
"-ptns =... | false | 0.160085 | 0.035969 | 4.450621 | [
"s040016518",
"s998875152"
] |
u474202990 | p02678 | python | s209773504 | s510598521 | 620 | 566 | 104,784 | 105,056 | Accepted | Accepted | 8.71 | import queue
import sys
imput = sys.stdin.readline
n,m = list(map(int,input().split()))
conne = [[] for _ in range(n)]
dist = [99999]*(n)
par = [0] * (n)
for i in range(m):
a,b = list(map(int,input().split()))
conne[a-1].append(b-1)
conne[b-1].append(a-1)
q=queue.Queue()
dist[0] = ... | import queue
import sys
imput = sys.stdin.readline
n,m = list(map(int,input().split()))
conne = [[] for _ in range(n+1)]
dist = [99999]*(n+1)
par = [0] * (n+1)
for i in range(m):
a,b = list(map(int,input().split()))
conne[a].append(b)
conne[b].append(a)
q=queue.Queue()
dist[1] = 0
... | 34 | 35 | 569 | 567 | import queue
import sys
imput = sys.stdin.readline
n, m = list(map(int, input().split()))
conne = [[] for _ in range(n)]
dist = [99999] * (n)
par = [0] * (n)
for i in range(m):
a, b = list(map(int, input().split()))
conne[a - 1].append(b - 1)
conne[b - 1].append(a - 1)
q = queue.Queue()
dist[0] = 0
q.put((... | import queue
import sys
imput = sys.stdin.readline
n, m = list(map(int, input().split()))
conne = [[] for _ in range(n + 1)]
dist = [99999] * (n + 1)
par = [0] * (n + 1)
for i in range(m):
a, b = list(map(int, input().split()))
conne[a].append(b)
conne[b].append(a)
q = queue.Queue()
dist[1] = 0
q.put((1, 0... | false | 2.857143 | [
"-conne = [[] for _ in range(n)]",
"-dist = [99999] * (n)",
"-par = [0] * (n)",
"+conne = [[] for _ in range(n + 1)]",
"+dist = [99999] * (n + 1)",
"+par = [0] * (n + 1)",
"- conne[a - 1].append(b - 1)",
"- conne[b - 1].append(a - 1)",
"+ conne[a].append(b)",
"+ conne[b].append(a)",
... | false | 0.08647 | 0.105892 | 0.816585 | [
"s209773504",
"s510598521"
] |
u645250356 | p03038 | python | s797826633 | s729522175 | 431 | 243 | 34,916 | 34,336 | Accepted | Accepted | 43.62 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 29 | 28 | 728 | 687 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 3.448276 | [
"-from heapq import heappop, heappush, heapify",
"+from heapq import heappop, heappush",
"-lm = sum(x[1] for x in bc)",
"-now = 0",
"-alt = 0",
"-while now < n and alt < m:",
"- c, b = bc[alt]",
"- if a[now] > b:",
"+ind = -1",
"+now = -1",
"+cnt = 0",
"+for i in range(n):",
"+ if c... | false | 0.042392 | 0.07197 | 0.589025 | [
"s797826633",
"s729522175"
] |
u016302627 | p02684 | python | s792127780 | s617451695 | 152 | 104 | 32,280 | 94,196 | Accepted | Accepted | 31.58 | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
visit = [-1] * n #到達しているかどうかを管理
D = [1] # 循環するもののindexを格納
tmp = A[0] #初期位置
ct = 1
while visit[tmp - 1] == -1:
D.append(tmp)
visit[tmp - 1] = ct #到達済に変更
if k == ct:
print(tmp)
exit()
ct += ... | import sys
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
visit = [-1] * n #到達しているかどうかを管理
D = [1] # 循環するもののindexを格納
tmp = A[0] #初期位置
ct = 1
while visit[tmp - 1] == -1:
D.append(tmp)
visit[tmp - 1] = ct #到達済に変更
if k == ct:
print(tmp)
sys.... | 23 | 25 | 435 | 453 | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
visit = [-1] * n # 到達しているかどうかを管理
D = [1] # 循環するもののindexを格納
tmp = A[0] # 初期位置
ct = 1
while visit[tmp - 1] == -1:
D.append(tmp)
visit[tmp - 1] = ct # 到達済に変更
if k == ct:
print(tmp)
exit()
ct += 1
tmp = A[tmp ... | import sys
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
visit = [-1] * n # 到達しているかどうかを管理
D = [1] # 循環するもののindexを格納
tmp = A[0] # 初期位置
ct = 1
while visit[tmp - 1] == -1:
D.append(tmp)
visit[tmp - 1] = ct # 到達済に変更
if k == ct:
print(tmp)
sys.exit()
ct += 1
... | false | 8 | [
"+import sys",
"+",
"- exit()",
"+ sys.exit()"
] | false | 0.042486 | 0.041556 | 1.022376 | [
"s792127780",
"s617451695"
] |
u279460955 | p02904 | python | s110964169 | s124048511 | 247 | 222 | 103,560 | 103,684 | Accepted | Accepted | 10.12 | class SegTree: # 0-index !!!
"""
fx: モノイドXでの二項演算
ex: モノイドXでの単位元
init(seq, fx, ex): 配列seqで初期化 O(N)
update(i, x): i番目の値をxに更新 O(logN)
query(l, r): 区間[l,r)をfxしたものを返す O(logN)
get(i): i番目の値を返す
show(): 配列を返す
"""
def __init__(self, seq, fx, ex):
self.n = len(seq)
... | class SegTree: # 0-index !!!
def __init__(self, seq, fx, ex):
self.n = len(seq)
self.fx = fx
self.ex = ex
self.size = 1<<(self.n - 1).bit_length()
self.tree = [ex] * (self.size * 2)
# build
for i, x in enumerate(seq, start=self.size):
sel... | 84 | 59 | 2,377 | 1,723 | class SegTree: # 0-index !!!
"""
fx: モノイドXでの二項演算
ex: モノイドXでの単位元
init(seq, fx, ex): 配列seqで初期化 O(N)
update(i, x): i番目の値をxに更新 O(logN)
query(l, r): 区間[l,r)をfxしたものを返す O(logN)
get(i): i番目の値を返す
show(): 配列を返す
"""
def __init__(self, seq, fx, ex):
self.n = len(seq)
self.f... | class SegTree: # 0-index !!!
def __init__(self, seq, fx, ex):
self.n = len(seq)
self.fx = fx
self.ex = ex
self.size = 1 << (self.n - 1).bit_length()
self.tree = [ex] * (self.size * 2)
# build
for i, x in enumerate(seq, start=self.size):
self.tree[... | false | 29.761905 | [
"- \"\"\"",
"- fx: モノイドXでの二項演算",
"- ex: モノイドXでの単位元",
"- init(seq, fx, ex): 配列seqで初期化 O(N)",
"- update(i, x): i番目の値をxに更新 O(logN)",
"- query(l, r): 区間[l,r)をfxしたものを返す O(logN)",
"- get(i): i番目の値を返す",
"- show(): 配列を返す",
"- \"\"\"",
"-",
"- def set(self, i, x): # O(log(n... | false | 0.05937 | 0.037493 | 1.583499 | [
"s110964169",
"s124048511"
] |
u102461423 | p02956 | python | s186881598 | s654842799 | 1,840 | 979 | 74,684 | 178,216 | Accepted | Accepted | 46.79 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 998244353
N = int(readline())
m = list(map(int,read().split()))
Y = [y for x,y in sorted(zip(m,m))] # Y座標昇順
# 座圧
Y_rank = {y:i for i,y in enumerate(sorted(Y),1)}... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 998244353
N = int(eval(input()))
XY = [[int(x) for x in input().split()] for _ in range(N)]
XY.sort() # X ascending
X,Y = list(zip(*XY))
Y_rank = {x:i for i,x in enumerate(sorted(Y),1)}
def BIT_update(tree,x):
while x <= N:
... | 66 | 57 | 1,451 | 1,077 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 998244353
N = int(readline())
m = list(map(int, read().split()))
Y = [y for x, y in sorted(zip(m, m))] # Y座標昇順
# 座圧
Y_rank = {y: i for i, y in enumerate(sorted(Y), 1)}
Y = [Y_r... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
MOD = 998244353
N = int(eval(input()))
XY = [[int(x) for x in input().split()] for _ in range(N)]
XY.sort() # X ascending
X, Y = list(zip(*XY))
Y_rank = {x: i for i, x in enumerate(sorted(Y), 1)}
def BIT_update(tree, x):
while x <= N:
tr... | false | 13.636364 | [
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"-import numpy as np",
"-",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**7)",
"-N = int(readline())",
"-m = list(map(int, read().split()))",
"-Y = [y for x, y in sorte... | false | 0.365962 | 0.037911 | 9.653302 | [
"s186881598",
"s654842799"
] |
u476590491 | p02579 | python | s715939809 | s564473313 | 1,365 | 1,062 | 202,092 | 182,884 | Accepted | Accepted | 22.2 | # -*- coding: utf-8 -*-
from collections import deque
q = deque()
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
ch -= 1
cw -= 1
dh -= 1
dw -= 1
# mylist = [[]]
ban_list = [[-1 for j in range(w)] for i in range(h)]
cost_list... | # -*- coding: utf-8 -*-
from collections import deque
q = deque()
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
ch -= 1
cw -= 1
dh -= 1
dw -= 1
ban_list = [[-999 for j in range(w)] for i in range(h)]
for i in range(h):
... | 125 | 121 | 2,575 | 2,633 | # -*- coding: utf-8 -*-
from collections import deque
q = deque()
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
ch -= 1
cw -= 1
dh -= 1
dw -= 1
# mylist = [[]]
ban_list = [[-1 for j in range(w)] for i in range(h)]
cost_list = [[-1 for j in rang... | # -*- coding: utf-8 -*-
from collections import deque
q = deque()
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
ch -= 1
cw -= 1
dh -= 1
dw -= 1
ban_list = [[-999 for j in range(w)] for i in range(h)]
for i in range(h):
# 文字列の入力
s = eval... | false | 3.2 | [
"-# mylist = [[]]",
"-ban_list = [[-1 for j in range(w)] for i in range(h)]",
"-cost_list = [[-1 for j in range(w)] for i in range(h)]",
"-# print(mylist)",
"+ban_list = [[-999 for j in range(w)] for i in range(h)]",
"-# cost_list[ch][cw] = 0",
"-# # 最後デバッグ",
"-# for li in ban_list:",
"-# print(li... | false | 0.072879 | 0.082036 | 0.888375 | [
"s715939809",
"s564473313"
] |
u203843959 | p02689 | python | s408905960 | s059299090 | 496 | 371 | 46,008 | 45,228 | Accepted | Accepted | 25.2 | N,M=list(map(int,input().split()))
hlist=list(map(int,input().split()))
graph=[set() for _ in range(N+1)]
for _ in range(M):
a,b=list(map(int,input().split()))
graph[a].add(b)
graph[b].add(a)
#print(graph)
high_list=[0]*(N+1)
for i in range(1,N+1):
if high_list[i]==-1:
continue
h=hlist... | N,M=list(map(int,input().split()))
hlist=list(map(int,input().split()))
graph=[set() for _ in range(N+1)]
for _ in range(M):
a,b=list(map(int,input().split()))
graph[a].add(b)
graph[b].add(a)
#print(graph)
answer=0
for i in range(1,N+1):
h=hlist[i-1]
for s in graph[i]:
if h<=hlist[s-1]:
... | 32 | 20 | 585 | 359 | N, M = list(map(int, input().split()))
hlist = list(map(int, input().split()))
graph = [set() for _ in range(N + 1)]
for _ in range(M):
a, b = list(map(int, input().split()))
graph[a].add(b)
graph[b].add(a)
# print(graph)
high_list = [0] * (N + 1)
for i in range(1, N + 1):
if high_list[i] == -1:
... | N, M = list(map(int, input().split()))
hlist = list(map(int, input().split()))
graph = [set() for _ in range(N + 1)]
for _ in range(M):
a, b = list(map(int, input().split()))
graph[a].add(b)
graph[b].add(a)
# print(graph)
answer = 0
for i in range(1, N + 1):
h = hlist[i - 1]
for s in graph[i]:
... | false | 37.5 | [
"-high_list = [0] * (N + 1)",
"+answer = 0",
"- if high_list[i] == -1:",
"- continue",
"- high_list[i] = -1",
"- if h >= hlist[s - 1]:",
"- high_list[s] = -1",
"- if high_list[i] == 0:",
"- high_list[i] = 1",
"-answer = 0",
"-for i in range(1, N +... | false | 0.037811 | 0.03729 | 1.013966 | [
"s408905960",
"s059299090"
] |
u312025627 | p03036 | python | s838217011 | s921992348 | 163 | 85 | 38,384 | 61,892 | Accepted | Accepted | 47.85 | r, d, x = list(map(int,input().split()))
after = r * x - d
for i in range(1,11):
print(after)
after = r * after - d | def main():
r, D, x = (int(i) for i in input().split())
for i in range(10):
nx = r*x - D
print(nx)
x = nx
if __name__ == '__main__':
main()
| 5 | 11 | 121 | 189 | r, d, x = list(map(int, input().split()))
after = r * x - d
for i in range(1, 11):
print(after)
after = r * after - d
| def main():
r, D, x = (int(i) for i in input().split())
for i in range(10):
nx = r * x - D
print(nx)
x = nx
if __name__ == "__main__":
main()
| false | 54.545455 | [
"-r, d, x = list(map(int, input().split()))",
"-after = r * x - d",
"-for i in range(1, 11):",
"- print(after)",
"- after = r * after - d",
"+def main():",
"+ r, D, x = (int(i) for i in input().split())",
"+ for i in range(10):",
"+ nx = r * x - D",
"+ print(nx)",
"+ ... | false | 0.034626 | 0.034312 | 1.009159 | [
"s838217011",
"s921992348"
] |
u086056891 | p03212 | python | s775616571 | s744630649 | 57 | 52 | 3,060 | 2,940 | Accepted | Accepted | 8.77 | n = int(eval(input()))
def solve(s):
if int(s) > n:
return 0
if '7' in s and '5' in s and '3' in s:
count = 1
else:
count = 0
count += solve(s + '7')
count += solve(s + '5')
count += solve(s + '3')
return count
print((solve('0'))) | def dfs(s):
if int(s) > n:
return 0
return ('7' in s and '5' in s and '3' in s) + dfs(s + '7') + dfs(s + '5') + dfs(s + '3')
n = int(eval(input()))
print((dfs('0'))) | 15 | 8 | 290 | 182 | n = int(eval(input()))
def solve(s):
if int(s) > n:
return 0
if "7" in s and "5" in s and "3" in s:
count = 1
else:
count = 0
count += solve(s + "7")
count += solve(s + "5")
count += solve(s + "3")
return count
print((solve("0")))
| def dfs(s):
if int(s) > n:
return 0
return (
("7" in s and "5" in s and "3" in s)
+ dfs(s + "7")
+ dfs(s + "5")
+ dfs(s + "3")
)
n = int(eval(input()))
print((dfs("0")))
| false | 46.666667 | [
"-n = int(eval(input()))",
"+def dfs(s):",
"+ if int(s) > n:",
"+ return 0",
"+ return (",
"+ (\"7\" in s and \"5\" in s and \"3\" in s)",
"+ + dfs(s + \"7\")",
"+ + dfs(s + \"5\")",
"+ + dfs(s + \"3\")",
"+ )",
"-def solve(s):",
"- if int(s) > n:... | false | 0.045025 | 0.043051 | 1.045849 | [
"s775616571",
"s744630649"
] |
u192154323 | p02720 | python | s596606434 | s637594839 | 357 | 219 | 10,904 | 13,368 | Accepted | Accepted | 38.66 | from collections import deque
k = int(eval(input()))
d = deque([i for i in range(1,10)])
count = 0
while True:
num = d.popleft()
count += 1
if count == k:
break
str_num = str(num)
next_digit_ls = [int(str_num[-1]) - 1, int(str_num[-1]), int(str_num[-1]) + 1]
for digit in nex... | k = int(eval(input()))
lun_ls = []
def change_to_num(ls):
ls = list(map(str, ls))
strnum = ''.join(ls)
return int(strnum)
def lun(num):
'''
渡された数が上限行ってなければlun_lsに追加して、次の数で再帰呼出
'''
if num > 3234566667:
return
lun_ls.append(num)
last = num % 10
for nex in ... | 16 | 26 | 414 | 551 | from collections import deque
k = int(eval(input()))
d = deque([i for i in range(1, 10)])
count = 0
while True:
num = d.popleft()
count += 1
if count == k:
break
str_num = str(num)
next_digit_ls = [int(str_num[-1]) - 1, int(str_num[-1]), int(str_num[-1]) + 1]
for digit in next_digit_ls:... | k = int(eval(input()))
lun_ls = []
def change_to_num(ls):
ls = list(map(str, ls))
strnum = "".join(ls)
return int(strnum)
def lun(num):
"""
渡された数が上限行ってなければlun_lsに追加して、次の数で再帰呼出
"""
if num > 3234566667:
return
lun_ls.append(num)
last = num % 10
for nex in range(last - 1... | false | 38.461538 | [
"-from collections import deque",
"+k = int(eval(input()))",
"+lun_ls = []",
"-k = int(eval(input()))",
"-d = deque([i for i in range(1, 10)])",
"-count = 0",
"-while True:",
"- num = d.popleft()",
"- count += 1",
"- if count == k:",
"- break",
"- str_num = str(num)",
"- ... | false | 0.113239 | 0.352551 | 0.321199 | [
"s596606434",
"s637594839"
] |
u397638621 | p02712 | python | s116341535 | s422289655 | 159 | 121 | 9,148 | 29,896 | Accepted | Accepted | 23.9 | N = int(eval(input()))
a = 0
for i in range(1, N + 1):
if i % 5 != 0 and i % 3 != 0:
a += i
print(a)
| N = int(eval(input()))
print((sum([i for i in range(1, N+1) if i%5!=0 and i%3!=0]))) | 6 | 2 | 112 | 77 | N = int(eval(input()))
a = 0
for i in range(1, N + 1):
if i % 5 != 0 and i % 3 != 0:
a += i
print(a)
| N = int(eval(input()))
print((sum([i for i in range(1, N + 1) if i % 5 != 0 and i % 3 != 0])))
| false | 66.666667 | [
"-a = 0",
"-for i in range(1, N + 1):",
"- if i % 5 != 0 and i % 3 != 0:",
"- a += i",
"-print(a)",
"+print((sum([i for i in range(1, N + 1) if i % 5 != 0 and i % 3 != 0])))"
] | false | 0.224432 | 0.099278 | 2.260657 | [
"s116341535",
"s422289655"
] |
u390901183 | p02699 | python | s958864127 | s040171356 | 23 | 19 | 9,148 | 9,100 | Accepted | Accepted | 17.39 | s, w = list(map(int, input().split()))
if w >= s:
print('unsafe')
else:
print('safe')
| s, w = list(map(int, input().split()))
print(('un' * (w >= s) + 'safe')) | 6 | 2 | 94 | 65 | s, w = list(map(int, input().split()))
if w >= s:
print("unsafe")
else:
print("safe")
| s, w = list(map(int, input().split()))
print(("un" * (w >= s) + "safe"))
| false | 66.666667 | [
"-if w >= s:",
"- print(\"unsafe\")",
"-else:",
"- print(\"safe\")",
"+print((\"un\" * (w >= s) + \"safe\"))"
] | false | 0.043053 | 0.099394 | 0.433149 | [
"s958864127",
"s040171356"
] |
u691018832 | p03503 | python | s698028512 | s250648623 | 321 | 282 | 3,188 | 3,188 | Accepted | Accepted | 12.15 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
import itertools
n = int(readline())
f = [list(map(int, readline().split())) for _ in range(n)]
p = [list(map(int, readline().split())) for _ in range(n)]
bit =... | 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 = int(readline())
f = [list(map(int, readline().split())) for _ in range(n)]
p = [list(map(int, readline().split())) for _ in ran... | 28 | 23 | 728 | 628 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
import itertools
n = int(readline())
f = [list(map(int, readline().split())) for _ in range(n)]
p = [list(map(int, readline().split())) for _ in range(n)]
bit = list(itertoo... | 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 = int(readline())
f = [list(map(int, readline().split())) for _ in range(n)]
p = [list(map(int, readline().split())) for _ in range(n)]
ans =... | false | 17.857143 | [
"-import itertools",
"+from itertools import product",
"-bit = list(itertools.product([0, 1], repeat=10))",
"-bit.pop(0)",
"-for i in range(2**10 - 1):",
"- memo = 0",
"- flag = False",
"- for j in range(n):",
"+for bit in list(product([0, 1], repeat=10))[1:]:",
"+ v = 0",
"+ for ... | false | 0.137934 | 0.100756 | 1.368988 | [
"s698028512",
"s250648623"
] |
u411203878 | p03352 | python | s067273596 | s290145978 | 164 | 65 | 38,384 | 61,876 | Accepted | Accepted | 60.37 | n=int(eval(input()))
ans = 1
i = 2
while i**2 <= n:
u = 2
while i**u <= n:
ans = max(i**u, ans)
u += 1
i += 1
print(ans) | N = int(eval(input()))
ans = 1
for i in range(2,N+1):
tmp = 2
while i**tmp<=N:
ans = max(ans,i**tmp)
tmp += 1
print(ans) | 13 | 9 | 157 | 147 | n = int(eval(input()))
ans = 1
i = 2
while i**2 <= n:
u = 2
while i**u <= n:
ans = max(i**u, ans)
u += 1
i += 1
print(ans)
| N = int(eval(input()))
ans = 1
for i in range(2, N + 1):
tmp = 2
while i**tmp <= N:
ans = max(ans, i**tmp)
tmp += 1
print(ans)
| false | 30.769231 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-i = 2",
"-while i**2 <= n:",
"- u = 2",
"- while i**u <= n:",
"- ans = max(i**u, ans)",
"- u += 1",
"- i += 1",
"+for i in range(2, N + 1):",
"+ tmp = 2",
"+ while i**tmp <= N:",
"+ ans = max(ans, i**... | false | 0.036098 | 0.036214 | 0.996799 | [
"s067273596",
"s290145978"
] |
u535659144 | p03212 | python | s663129226 | s906921945 | 420 | 305 | 50,392 | 48,104 | Accepted | Accepted | 27.38 | def cnct(lint,lim):
global list753
global list357
global list333
lint1=str(lint)+"3"
lint1int=int(lint1)
if lint1int<=lim and not lint1int in list357:
list357.add(lint1int)
cnct(lint1int,lim)
lint2=str(lint)+"5"
lint2int=int(lint2)
if lint2int<=lim and not ... | def cnct(lint,lim):
global list753
global list357
global list333
lint1int=lint*10+3
if lint1int<=lim and not lint1int in list357:
list357.add(lint1int)
cnct(lint1int,lim)
lint2int=lint*10+5
if lint2int<=lim and not lint2int in list357:
list357.add(lint2int)
... | 53 | 33 | 1,434 | 829 | def cnct(lint, lim):
global list753
global list357
global list333
lint1 = str(lint) + "3"
lint1int = int(lint1)
if lint1int <= lim and not lint1int in list357:
list357.add(lint1int)
cnct(lint1int, lim)
lint2 = str(lint) + "5"
lint2int = int(lint2)
if lint2int <= lim a... | def cnct(lint, lim):
global list753
global list357
global list333
lint1int = lint * 10 + 3
if lint1int <= lim and not lint1int in list357:
list357.add(lint1int)
cnct(lint1int, lim)
lint2int = lint * 10 + 5
if lint2int <= lim and not lint2int in list357:
list357.add(li... | false | 37.735849 | [
"- lint1 = str(lint) + \"3\"",
"- lint1int = int(lint1)",
"+ lint1int = lint * 10 + 3",
"- lint2 = str(lint) + \"5\"",
"- lint2int = int(lint2)",
"+ lint2int = lint * 10 + 5",
"- lint3 = str(lint) + \"7\"",
"- lint3int = int(lint3)",
"+ lint3int = lint * 10 + 7",
"- l... | false | 0.953141 | 0.045101 | 21.133274 | [
"s663129226",
"s906921945"
] |
u327125861 | p02397 | python | s602226851 | s642007298 | 70 | 60 | 7,640 | 7,472 | Accepted | Accepted | 14.29 | while 1:
n = input().split()
a = int(n[0])
b = int(n[1])
if a == 0 and b == 0:
break
if a > b:
bf = a
a = b
b = bf
print((str(a) + " " + str(b))) | while True:
s = input().rstrip().split(' ')
x = int(s[0])
y = int(s[1])
if x == 0 and y == 0: break
if x > y:
x,y = y,x
print((str(x) + " " + str(y))) | 11 | 8 | 167 | 163 | while 1:
n = input().split()
a = int(n[0])
b = int(n[1])
if a == 0 and b == 0:
break
if a > b:
bf = a
a = b
b = bf
print((str(a) + " " + str(b)))
| while True:
s = input().rstrip().split(" ")
x = int(s[0])
y = int(s[1])
if x == 0 and y == 0:
break
if x > y:
x, y = y, x
print((str(x) + " " + str(y)))
| false | 27.272727 | [
"-while 1:",
"- n = input().split()",
"- a = int(n[0])",
"- b = int(n[1])",
"- if a == 0 and b == 0:",
"+while True:",
"+ s = input().rstrip().split(\" \")",
"+ x = int(s[0])",
"+ y = int(s[1])",
"+ if x == 0 and y == 0:",
"- if a > b:",
"- bf = a",
"- ... | false | 0.083705 | 0.106423 | 0.78653 | [
"s602226851",
"s642007298"
] |
u145145077 | p02995 | python | s350161885 | s015644529 | 234 | 32 | 27,204 | 9,216 | Accepted | Accepted | 86.32 | a,b,c,d=list(map(int,input().split()))
def calc_div_num(a,b,x):
return b//x - (a-1)//x
num_c = calc_div_num(a, b, c)
num_d = calc_div_num(a, b, d)
import numpy as np
import math
#lcd = np.lcm(c, d)
lcd = c*d/math.gcd(c,d)
num_lcd = calc_div_num(a, b, int(lcd))
result = b-a+1 - (num_c+num_d-num_lcd)
... | a,b,c,d=list(map(int,input().split()))
def calc_div_num(a,b,x):
return b//x - (a-1)//x
num_c = b//c - (a-1)//c
num_d = b//d - (a-1)//d
import math
lcd = int(c * d / math.gcd(c,d))
num_lcd = b//lcd - (a-1)//lcd
result = b-a+1 - (num_c+num_d-num_lcd)
print(result) | 16 | 14 | 328 | 275 | a, b, c, d = list(map(int, input().split()))
def calc_div_num(a, b, x):
return b // x - (a - 1) // x
num_c = calc_div_num(a, b, c)
num_d = calc_div_num(a, b, d)
import numpy as np
import math
# lcd = np.lcm(c, d)
lcd = c * d / math.gcd(c, d)
num_lcd = calc_div_num(a, b, int(lcd))
result = b - a + 1 - (num_c + ... | a, b, c, d = list(map(int, input().split()))
def calc_div_num(a, b, x):
return b // x - (a - 1) // x
num_c = b // c - (a - 1) // c
num_d = b // d - (a - 1) // d
import math
lcd = int(c * d / math.gcd(c, d))
num_lcd = b // lcd - (a - 1) // lcd
result = b - a + 1 - (num_c + num_d - num_lcd)
print(result)
| false | 12.5 | [
"-num_c = calc_div_num(a, b, c)",
"-num_d = calc_div_num(a, b, d)",
"-import numpy as np",
"+num_c = b // c - (a - 1) // c",
"+num_d = b // d - (a - 1) // d",
"-# lcd = np.lcm(c, d)",
"-lcd = c * d / math.gcd(c, d)",
"-num_lcd = calc_div_num(a, b, int(lcd))",
"+lcd = int(c * d / math.gcd(c, d))",
... | false | 0.036371 | 0.035596 | 1.021773 | [
"s350161885",
"s015644529"
] |
u775681539 | p02850 | python | s267355888 | s091465882 | 1,085 | 475 | 60,420 | 83,488 | Accepted | Accepted | 56.22 | #python3
from collections import deque
class Edge:
def __init__(self, to, d):
self.to = to
self.d = d
def main():
n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n-1):
a, b = [int(x)-1 for x in input().split()]
g[a].append(Edge(b, i))
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
class Edge:
def __init__(self, to, id):
self.to = to
self.id = id
def main():
n = int(readline())
g = [[] for _ in range(n)]... | 53 | 55 | 1,137 | 1,287 | # python3
from collections import deque
class Edge:
def __init__(self, to, d):
self.to = to
self.d = d
def main():
n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n - 1):
a, b = [int(x) - 1 for x in input().split()]
g[a].append(Edge(b, i))
g[b... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
class Edge:
def __init__(self, to, id):
self.to = to
self.id = id
def main():
n = int(readline())
g = [[] for _ in range(n)]
for i in ran... | false | 3.636364 | [
"-# python3",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"- def __init__(self, to, d):",
"+ def __init__(self, to, id):",
"- self.d = d",
"+ self.id = id",
"- n = int(eval(input()... | false | 0.063494 | 0.078142 | 0.812544 | [
"s267355888",
"s091465882"
] |
u554781254 | p02760 | python | s397170186 | s466452559 | 183 | 148 | 38,384 | 12,444 | Accepted | Accepted | 19.13 | table_1 = input().split()
table_2 = input().split()
table_3 = input().split()
bingo_card = table_1 + table_2 + table_3
N = int(eval(input()))
for _ in range(N):
b = str(int(eval(input())))
if b in bingo_card:
bingo_card[bingo_card.index(b)] = True
if bingo_card[0] == bingo_card[1]... | import numpy as np
def main():
bingo_card = np.array([list(map(int, input().split())) for _ in range(3)])
counter = int(eval(input()))
for _ in range(counter):
bingo_card = np.where(bingo_card == int(eval(input())), 0, bingo_card)
vertical_bingo = min(np.sum(bingo_card, axis=0)) ==... | 30 | 25 | 879 | 775 | table_1 = input().split()
table_2 = input().split()
table_3 = input().split()
bingo_card = table_1 + table_2 + table_3
N = int(eval(input()))
for _ in range(N):
b = str(int(eval(input())))
if b in bingo_card:
bingo_card[bingo_card.index(b)] = True
if bingo_card[0] == bingo_card[1] == bingo_card[2]:
... | import numpy as np
def main():
bingo_card = np.array([list(map(int, input().split())) for _ in range(3)])
counter = int(eval(input()))
for _ in range(counter):
bingo_card = np.where(bingo_card == int(eval(input())), 0, bingo_card)
vertical_bingo = min(np.sum(bingo_card, axis=0)) == 0
horiz... | false | 16.666667 | [
"-table_1 = input().split()",
"-table_2 = input().split()",
"-table_3 = input().split()",
"-bingo_card = table_1 + table_2 + table_3",
"-N = int(eval(input()))",
"-for _ in range(N):",
"- b = str(int(eval(input())))",
"- if b in bingo_card:",
"- bingo_card[bingo_card.index(b)] = True",
... | false | 0.039543 | 0.347043 | 0.113944 | [
"s397170186",
"s466452559"
] |
u326609687 | p03141 | python | s206671957 | s065990200 | 510 | 382 | 27,904 | 44,084 | Accepted | Accepted | 25.1 | import numpy as np
N = int(eval(input()))
x = []
y = []
for i in range(N):
a, b = [int(_) for _ in input().split()]
x.append(a)
y.append(b)
nx = np.array(x)
ny = np.array(y)
ns = nx + ny
arr = np.array([nx, ny, ns]).T
arr = arr[np.argsort(arr[:, 2])][::-1, :]
n = np.sum(arr[0::2, 0]) - np.s... | import numpy as np
N = int(eval(input()))
x = []
for i in range(N):
x.extend(input().split())
a = np.array(x, dtype='int').reshape((N, 2))
s = a[:,0:1] + a[:,1:2]
a = np.hstack((a, s))
a = a[np.argsort(a[:, 2])][::-1, :]
n = np.sum(a[0::2, 0]) - np.sum(a[1::2, 1])
print(n) | 17 | 13 | 340 | 285 | import numpy as np
N = int(eval(input()))
x = []
y = []
for i in range(N):
a, b = [int(_) for _ in input().split()]
x.append(a)
y.append(b)
nx = np.array(x)
ny = np.array(y)
ns = nx + ny
arr = np.array([nx, ny, ns]).T
arr = arr[np.argsort(arr[:, 2])][::-1, :]
n = np.sum(arr[0::2, 0]) - np.sum(arr[1::2, 1])... | import numpy as np
N = int(eval(input()))
x = []
for i in range(N):
x.extend(input().split())
a = np.array(x, dtype="int").reshape((N, 2))
s = a[:, 0:1] + a[:, 1:2]
a = np.hstack((a, s))
a = a[np.argsort(a[:, 2])][::-1, :]
n = np.sum(a[0::2, 0]) - np.sum(a[1::2, 1])
print(n)
| false | 23.529412 | [
"-y = []",
"- a, b = [int(_) for _ in input().split()]",
"- x.append(a)",
"- y.append(b)",
"-nx = np.array(x)",
"-ny = np.array(y)",
"-ns = nx + ny",
"-arr = np.array([nx, ny, ns]).T",
"-arr = arr[np.argsort(arr[:, 2])][::-1, :]",
"-n = np.sum(arr[0::2, 0]) - np.sum(arr[1::2, 1])",
"+ ... | false | 0.182283 | 0.273801 | 0.66575 | [
"s206671957",
"s065990200"
] |
u372550522 | p03111 | python | s977553879 | s185881075 | 1,226 | 72 | 3,064 | 3,064 | Accepted | Accepted | 94.13 | n, A, B, C = (int(i) for i in input().split())
l = [int(eval(input())) for i in range(n)]
a = []
b = []
c = []
def furiwake(x):
global a
global b
global c
a = []
b = []
c = []
for i in range(1, n+1):
if dig4(x, i) == 0:
a.append(l[i-1])
if dig4(x,... | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
if cur == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
ret0 = dfs(cur + 1, a, b, c)
ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
ret2 = dfs(cur +... | 36 | 14 | 784 | 442 | n, A, B, C = (int(i) for i in input().split())
l = [int(eval(input())) for i in range(n)]
a = []
b = []
c = []
def furiwake(x):
global a
global b
global c
a = []
b = []
c = []
for i in range(1, n + 1):
if dig4(x, i) == 0:
a.append(l[i - 1])
if dig4(x, i) == 1:
... | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for i in range(N)]
INF = 10**9
def dfs(cur, a, b, c):
if cur == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
ret0 = dfs(cur + 1, a, b, c)
ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
ret2 = d... | false | 61.111111 | [
"-n, A, B, C = (int(i) for i in input().split())",
"-l = [int(eval(input())) for i in range(n)]",
"-a = []",
"-b = []",
"-c = []",
"+N, A, B, C = list(map(int, input().split()))",
"+l = [int(eval(input())) for i in range(N)]",
"+INF = 10**9",
"-def furiwake(x):",
"- global a",
"- global b"... | false | 2.029042 | 0.060822 | 33.360389 | [
"s977553879",
"s185881075"
] |
u887080340 | p02975 | python | s280531302 | s583727885 | 87 | 52 | 14,468 | 14,468 | Accepted | Accepted | 40.23 | import collections
N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
C = collections.Counter(a)
L = len(C)
e = list(C.keys())
if (L == 1) and (C[0] > 0):
print("Yes")
elif (L == 2) and (C[e[0]] * 2 == C[e[1]]):
print((((e[0] ^ e[0] == e[1]) or (e[1] ^ e[1] == e[0])) and "Yes" or ... | import collections
N = int(eval(input()))
a = list(map(int, input().split()))
C = collections.Counter(a)
L = len(C)
e = list(C.keys())
if (L == 1) and (C[0] > 0):
print("Yes")
elif (L == 2) and (C[e[0]] * 2 == C[e[1]]):
print((((e[0] ^ e[0] == e[1]) or (e[1] ^ e[1] == e[0])) and "Yes" or "No"))
elif... | 17 | 15 | 463 | 451 | import collections
N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
C = collections.Counter(a)
L = len(C)
e = list(C.keys())
if (L == 1) and (C[0] > 0):
print("Yes")
elif (L == 2) and (C[e[0]] * 2 == C[e[1]]):
print((((e[0] ^ e[0] == e[1]) or (e[1] ^ e[1] == e[0])) and "Yes" or "No"))
elif (... | import collections
N = int(eval(input()))
a = list(map(int, input().split()))
C = collections.Counter(a)
L = len(C)
e = list(C.keys())
if (L == 1) and (C[0] > 0):
print("Yes")
elif (L == 2) and (C[e[0]] * 2 == C[e[1]]):
print((((e[0] ^ e[0] == e[1]) or (e[1] ^ e[1] == e[0])) and "Yes" or "No"))
elif (L == 3) a... | false | 11.764706 | [
"-a.sort()"
] | false | 0.120954 | 0.108671 | 1.113026 | [
"s280531302",
"s583727885"
] |
u811733736 | p02316 | python | s943470300 | s629090496 | 890 | 690 | 44,248 | 17,872 | Accepted | Accepted | 22.47 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_C&lang=jp
"""
import sys
input = sys.stdin.readline
def solve_knapsack(weight, items):
dp = [[0]*(weight+1) for _ in range(len(items))]
for i, item in enumerate(items[1:]):
for w in range(1, weight+1)... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_C&lang=jp
AC
"""
import sys
input = sys.stdin.readline
def solve_knapsack(weight, items):
dp = [[0]*(weight+1) for _ in range(len(items))]
for i, item in enumerate(items[1:]):
for w in range(1, weigh... | 30 | 32 | 819 | 901 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_C&lang=jp
"""
import sys
input = sys.stdin.readline
def solve_knapsack(weight, items):
dp = [[0] * (weight + 1) for _ in range(len(items))]
for i, item in enumerate(items[1:]):
for w in range(1, weight + 1):
... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_C&lang=jp
AC
"""
import sys
input = sys.stdin.readline
def solve_knapsack(weight, items):
dp = [[0] * (weight + 1) for _ in range(len(items))]
for i, item in enumerate(items[1:]):
for w in range(1, weight + 1):... | false | 6.25 | [
"+AC",
"- dp[i + 1][w] = max(",
"- (item[0] + dp[i][w - item[1]]),",
"- dp[i][w],",
"- (item[0] + dp[i + 1][w - item[1]]),",
"- )",
"+ # dp[i+1][w] = max((item[0] + dp[i][w-item[1]]), dp[i][w], (item[0... | false | 0.125867 | 0.091886 | 1.369818 | [
"s943470300",
"s629090496"
] |
u077291787 | p02913 | python | s121730485 | s543312275 | 409 | 226 | 20,172 | 11,576 | Accepted | Accepted | 44.74 | # ABC141E - Who Says a Pun?
class RollingHash:
def __init__(self, source: str, base=1000000007, mod=9007199254740997):
self.source = source
self.length = len(source)
self.base = base
self.mod = mod
self.hash = self._get_hash_from_zero()
self.power = self._get_... | # ABC141E - Who Says a Pun?
class RollingHash:
def __init__(self, source: str, base=1000000007, mod=9007199254740997):
self.source = source
self.length = len(source)
self.base = base
self.mod = mod
self.hash = self._get_hash_from_zero()
self.power = self._get_... | 49 | 49 | 1,645 | 1,643 | # ABC141E - Who Says a Pun?
class RollingHash:
def __init__(self, source: str, base=1000000007, mod=9007199254740997):
self.source = source
self.length = len(source)
self.base = base
self.mod = mod
self.hash = self._get_hash_from_zero()
self.power = self._get_base_pow... | # ABC141E - Who Says a Pun?
class RollingHash:
def __init__(self, source: str, base=1000000007, mod=9007199254740997):
self.source = source
self.length = len(source)
self.base = base
self.mod = mod
self.hash = self._get_hash_from_zero()
self.power = self._get_base_pow... | false | 0 | [
"- rh, ok, ng = RollingHash(S, 1007, 10**9 + 7), 0, N // 2 + 1",
"+ rh, ok, ng = RollingHash(S, 27, 10**9 + 7), 0, N // 2 + 1"
] | false | 0.046483 | 0.072482 | 0.641305 | [
"s121730485",
"s543312275"
] |
u677440371 | p03290 | python | s037442357 | s089881905 | 786 | 709 | 3,064 | 3,188 | Accepted | Accepted | 9.8 | d,g = list(map(int, input().split()))
p = []
c = []
for i in range(d):
a,b = list(map(int, input().split()))
p.append(a)
c.append(b)
dp = [0 for i in range(sum(p) + 2)]
for i in range(1,d+1):
count_max = p[i-1]
bonus = c[i-1]
for j in range(sum(p)+1,0,-1):
for k in ran... | d,g = list(map(int, input().split()))
P = []
C = []
PC = []
for i in range(d):
p,c = list(map(int, input().split()))
P.append(p)
C.append(c)
PC.append((p,c))
P_sum = sum(P)
dp = [0 for i in range(P_sum + 1)]
for i,j in enumerate(PC):
for k in range(P_sum, -1, -1):
for l i... | 26 | 26 | 654 | 657 | d, g = list(map(int, input().split()))
p = []
c = []
for i in range(d):
a, b = list(map(int, input().split()))
p.append(a)
c.append(b)
dp = [0 for i in range(sum(p) + 2)]
for i in range(1, d + 1):
count_max = p[i - 1]
bonus = c[i - 1]
for j in range(sum(p) + 1, 0, -1):
for k in range(1, ... | d, g = list(map(int, input().split()))
P = []
C = []
PC = []
for i in range(d):
p, c = list(map(int, input().split()))
P.append(p)
C.append(c)
PC.append((p, c))
P_sum = sum(P)
dp = [0 for i in range(P_sum + 1)]
for i, j in enumerate(PC):
for k in range(P_sum, -1, -1):
for l in range(1, j[0] ... | false | 0 | [
"-p = []",
"-c = []",
"+P = []",
"+C = []",
"+PC = []",
"- a, b = list(map(int, input().split()))",
"- p.append(a)",
"- c.append(b)",
"-dp = [0 for i in range(sum(p) + 2)]",
"-for i in range(1, d + 1):",
"- count_max = p[i - 1]",
"- bonus = c[i - 1]",
"- for j in range(sum(... | false | 0.007571 | 0.052944 | 0.143005 | [
"s037442357",
"s089881905"
] |
u842170774 | p03547 | python | s744283370 | s490219842 | 32 | 28 | 9,016 | 8,864 | Accepted | Accepted | 12.5 | a,b=input().split();print((['=','<','>'][(a!=b)+(a>b)])) | a,b=input().split();print(("=<>"[(a!=b)+(a>b)])) | 1 | 1 | 54 | 46 | a, b = input().split()
print((["=", "<", ">"][(a != b) + (a > b)]))
| a, b = input().split()
print(("=<>"[(a != b) + (a > b)]))
| false | 0 | [
"-print(([\"=\", \"<\", \">\"][(a != b) + (a > b)]))",
"+print((\"=<>\"[(a != b) + (a > b)]))"
] | false | 0.054854 | 0.03486 | 1.573549 | [
"s744283370",
"s490219842"
] |
u580873239 | p03037 | python | s329962661 | s146068094 | 372 | 313 | 27,340 | 12,408 | Accepted | Accepted | 15.86 | n,m=list(map(int,input().split()))
li=[]
for i in range(m):
a=list(map(int,input().split()))
li.append(a)
l=0
r=n
for i in range(m):
if li[i][0]>l:
l=li[i][0]
if li[i][1]<r:
r=li[i][1]
print((max(0,r-l+1)))
| n,m=list(map(int,input().split()))
L=[]
R=[]
for i in range(m):
l,r=list(map(int,input().split()))
L.append(l)
R.append(r)
a=max(L)
b=min(R)
li=[i for i in range(a,b+1)]
print((len(li)))
| 14 | 12 | 248 | 197 | n, m = list(map(int, input().split()))
li = []
for i in range(m):
a = list(map(int, input().split()))
li.append(a)
l = 0
r = n
for i in range(m):
if li[i][0] > l:
l = li[i][0]
if li[i][1] < r:
r = li[i][1]
print((max(0, r - l + 1)))
| n, m = list(map(int, input().split()))
L = []
R = []
for i in range(m):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
a = max(L)
b = min(R)
li = [i for i in range(a, b + 1)]
print((len(li)))
| false | 14.285714 | [
"-li = []",
"+L = []",
"+R = []",
"- a = list(map(int, input().split()))",
"- li.append(a)",
"-l = 0",
"-r = n",
"-for i in range(m):",
"- if li[i][0] > l:",
"- l = li[i][0]",
"- if li[i][1] < r:",
"- r = li[i][1]",
"-print((max(0, r - l + 1)))",
"+ l, r = list... | false | 0.006447 | 0.037077 | 0.17389 | [
"s329962661",
"s146068094"
] |
u645250356 | p02773 | python | s759324187 | s201915961 | 1,950 | 670 | 131,908 | 197,044 | Accepted | Accepted | 65.64 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 27 | 34 | 672 | 756 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 20.588235 | [
"-from heapq import heappop, heappush, heapify",
"-import sys, bisect, math, itertools, fractions, pprint",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"-s = [eval(input()) for i in range(n)]",
"-l = []",
"... | false | 0.039431 | 0.046456 | 0.848779 | [
"s759324187",
"s201915961"
] |
u761320129 | p03687 | python | s941651854 | s404845301 | 48 | 44 | 3,064 | 3,064 | Accepted | Accepted | 8.33 | S = eval(input())
ans = len(S)
for i in range(26):
c = chr(ord('a') + i)
if not c in S: continue
s = S
ope = 0
while any(a!=c for a in s):
t = ''
for a,b in zip(s,s[1:]):
if a==c or b==c:
t += c
else:
t += '-'
... | S = eval(input())
ans = len(S)
for i in range(26):
c = chr(ord('a') + i)
if c not in S: continue
cnt = 0
s = S
while any(a!=c for a in s):
t = ''
for a,b in zip(s,s[1:]):
if c==a or c==b:
t += c
else:
t += a
... | 19 | 19 | 380 | 378 | S = eval(input())
ans = len(S)
for i in range(26):
c = chr(ord("a") + i)
if not c in S:
continue
s = S
ope = 0
while any(a != c for a in s):
t = ""
for a, b in zip(s, s[1:]):
if a == c or b == c:
t += c
else:
t += "-"
... | S = eval(input())
ans = len(S)
for i in range(26):
c = chr(ord("a") + i)
if c not in S:
continue
cnt = 0
s = S
while any(a != c for a in s):
t = ""
for a, b in zip(s, s[1:]):
if c == a or c == b:
t += c
else:
t += a
... | false | 0 | [
"- if not c in S:",
"+ if c not in S:",
"+ cnt = 0",
"- ope = 0",
"- if a == c or b == c:",
"+ if c == a or c == b:",
"- t += \"-\"",
"+ t += a",
"- ope += 1",
"- ans = min(ans, ope)",
"+ cnt += 1",
"+ ans = mi... | false | 0.033239 | 0.06677 | 0.497814 | [
"s941651854",
"s404845301"
] |
u050428930 | p04001 | python | s950940259 | s536571007 | 27 | 20 | 3,060 | 3,064 | Accepted | Accepted | 25.93 | a=list(eval(input()))
ans=0
for i in range(1<<(len(a)-1)):
s=a[0]
for j in range(len(a)-1):
if i & (1<<j):
s+="+"
s+=a[j+1]
ans+=eval(s)
print(ans) | N=int(eval(input()))
m=list(map(int,str(N)))[::-1]
p=0
n=len(str(N))
if n==1:
print(N)
exit()
for i in range(2**(n-1)):
s=(["0"]*8+list(bin(i)[2:]))[::-1]
s=s[:n-1]
p+=m[0]
q=0
for i in range(n-1):
if s[i]=="0":
q+=1
p+=(10**q)*(m[i+1])
... | 10 | 22 | 194 | 402 | a = list(eval(input()))
ans = 0
for i in range(1 << (len(a) - 1)):
s = a[0]
for j in range(len(a) - 1):
if i & (1 << j):
s += "+"
s += a[j + 1]
ans += eval(s)
print(ans)
| N = int(eval(input()))
m = list(map(int, str(N)))[::-1]
p = 0
n = len(str(N))
if n == 1:
print(N)
exit()
for i in range(2 ** (n - 1)):
s = (["0"] * 8 + list(bin(i)[2:]))[::-1]
s = s[: n - 1]
p += m[0]
q = 0
for i in range(n - 1):
if s[i] == "0":
q += 1
p += (1... | false | 54.545455 | [
"-a = list(eval(input()))",
"-ans = 0",
"-for i in range(1 << (len(a) - 1)):",
"- s = a[0]",
"- for j in range(len(a) - 1):",
"- if i & (1 << j):",
"- s += \"+\"",
"- s += a[j + 1]",
"- ans += eval(s)",
"-print(ans)",
"+N = int(eval(input()))",
"+m = list(map(... | false | 0.046505 | 0.045978 | 1.011456 | [
"s950940259",
"s536571007"
] |
u802963389 | p03436 | python | s006430867 | s640911266 | 29 | 26 | 3,572 | 3,316 | Accepted | Accepted | 10.34 | from collections import deque
"""
-1 -> not visited
else -> step count
"""
def bfs(maze, visited, sh, sw):
stack = deque([[sh, sw]])
visited[sh][sw] = 1
while stack:
h, w = stack.popleft()
# ゴールの条件
if h == H - 1 and w == W - 1:
break
for j, k in ([1, ... | from collections import deque
def dfs(sx, sy):
stack = deque()
stack.append([sx, sy])
visited[sy][sx] = 1
while stack:
x, y = stack.popleft()
if x == w - 1 and y == h - 1:
break
for dx, dy in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
if 0 <= x + dx < w and 0 <= y + dy < h:
... | 41 | 31 | 1,105 | 757 | from collections import deque
"""
-1 -> not visited
else -> step count
"""
def bfs(maze, visited, sh, sw):
stack = deque([[sh, sw]])
visited[sh][sw] = 1
while stack:
h, w = stack.popleft()
# ゴールの条件
if h == H - 1 and w == W - 1:
break
for j, k in ([1, 0], [-1, 0... | from collections import deque
def dfs(sx, sy):
stack = deque()
stack.append([sx, sy])
visited[sy][sx] = 1
while stack:
x, y = stack.popleft()
if x == w - 1 and y == h - 1:
break
for dx, dy in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
if 0 <= x + dx < w and 0 <... | false | 24.390244 | [
"-\"\"\"",
"--1 -> not visited",
"-else -> step count",
"-\"\"\"",
"+",
"+def dfs(sx, sy):",
"+ stack = deque()",
"+ stack.append([sx, sy])",
"+ visited[sy][sx] = 1",
"+ while stack:",
"+ x, y = stack.popleft()",
"+ if x == w - 1 and y == h - 1:",
"+ brea... | false | 0.048974 | 0.04878 | 1.00399 | [
"s006430867",
"s640911266"
] |
u916242112 | p02628 | python | s248568129 | s676811106 | 33 | 26 | 9,256 | 8,888 | Accepted | Accepted | 21.21 | N, K = list(map(int,input().split()))
p = list(map(int,input().split()))
list.sort(p)
total = 0
for i in range(K):
total += p[i]
print(total) | N,K = list(map(int,input().split()))
list = list(map(int,input().split()))
list.sort()
total=0
for i in range(K):
total+=list[i]
print(total) | 8 | 9 | 144 | 146 | N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
list.sort(p)
total = 0
for i in range(K):
total += p[i]
print(total)
| N, K = list(map(int, input().split()))
list = list(map(int, input().split()))
list.sort()
total = 0
for i in range(K):
total += list[i]
print(total)
| false | 11.111111 | [
"-p = list(map(int, input().split()))",
"-list.sort(p)",
"+list = list(map(int, input().split()))",
"+list.sort()",
"- total += p[i]",
"+ total += list[i]"
] | false | 0.10476 | 0.043071 | 2.43223 | [
"s248568129",
"s676811106"
] |
u037430802 | p03353 | python | s086977786 | s326530497 | 38 | 33 | 5,068 | 4,464 | Accepted | Accepted | 13.16 | s = eval(input())
k = int(eval(input()))
ans = []
for i in range(1,k+1):
for j in range(len(s)):
if j+i > len(s): break
ans.append(s[j:j+i])
ans = list(sorted(set(ans))) #setはsortedではソートできる。リストでソートしてsetにすると順序は保証されない
if k != 1:
print((ans[k-1]))
else:
print((min(list(s)))) | s = eval(input())
K = int(eval(input()))
substrings = set()
for k in range(1,K+1):
for i in range(len(s)):
substrings.add(s[i:i+k])
ans = sorted(substrings)
print((ans[K-1])) | 16 | 11 | 291 | 185 | s = eval(input())
k = int(eval(input()))
ans = []
for i in range(1, k + 1):
for j in range(len(s)):
if j + i > len(s):
break
ans.append(s[j : j + i])
ans = list(sorted(set(ans))) # setはsortedではソートできる。リストでソートしてsetにすると順序は保証されない
if k != 1:
print((ans[k - 1]))
else:
print((min(list(... | s = eval(input())
K = int(eval(input()))
substrings = set()
for k in range(1, K + 1):
for i in range(len(s)):
substrings.add(s[i : i + k])
ans = sorted(substrings)
print((ans[K - 1]))
| false | 31.25 | [
"-k = int(eval(input()))",
"-ans = []",
"-for i in range(1, k + 1):",
"- for j in range(len(s)):",
"- if j + i > len(s):",
"- break",
"- ans.append(s[j : j + i])",
"-ans = list(sorted(set(ans))) # setはsortedではソートできる。リストでソートしてsetにすると順序は保証されない",
"-if k != 1:",
"- prin... | false | 0.113749 | 0.040912 | 2.780342 | [
"s086977786",
"s326530497"
] |
u416011173 | p02726 | python | s219922962 | s381037724 | 1,996 | 1,626 | 3,444 | 3,444 | Accepted | Accepted | 18.54 | # -*- coding: utf-8 -*-
# D - Line++
# 標準入力の取得
N,X,Y = list(map(int, input().split()))
# 求解
# (i, j)間の最短距離はmin{|j-i|, |X-i|+1+|j-Y|, |Y-i|+1+|j-X|}であるため、
# (i, j)が決まれば、最短距離はO(1)で決まる。したがって、全(i, j)について、最短距離を求める。
k_list = [0 for i in range(1,N)]
for i in range(1, N):
diff_X_i = abs(X - i)
diff_Y_i = ab... | # -*- coding: utf-8 -*-
# D - Line++
# 標準入力の取得
N,X,Y = list(map(int, input().split()))
# 求解
# (i, j)間の最短距離はmin{|j-i|, |X-i|+1+|j-Y|}であるため、
# (i, j)が決まれば、最短距離はO(1)で決まる。したがって、全(i, j)について、最短距離を求める。
k_list = [0 for i in range(1,N)]
for i in range(1, N):
for j in range(i+1, N+1):
min_path = min([abs(... | 22 | 17 | 605 | 422 | # -*- coding: utf-8 -*-
# D - Line++
# 標準入力の取得
N, X, Y = list(map(int, input().split()))
# 求解
# (i, j)間の最短距離はmin{|j-i|, |X-i|+1+|j-Y|, |Y-i|+1+|j-X|}であるため、
# (i, j)が決まれば、最短距離はO(1)で決まる。したがって、全(i, j)について、最短距離を求める。
k_list = [0 for i in range(1, N)]
for i in range(1, N):
diff_X_i = abs(X - i)
diff_Y_i = abs(Y - i)
... | # -*- coding: utf-8 -*-
# D - Line++
# 標準入力の取得
N, X, Y = list(map(int, input().split()))
# 求解
# (i, j)間の最短距離はmin{|j-i|, |X-i|+1+|j-Y|}であるため、
# (i, j)が決まれば、最短距離はO(1)で決まる。したがって、全(i, j)について、最短距離を求める。
k_list = [0 for i in range(1, N)]
for i in range(1, N):
for j in range(i + 1, N + 1):
min_path = min([abs(j - i... | false | 22.727273 | [
"-# (i, j)間の最短距離はmin{|j-i|, |X-i|+1+|j-Y|, |Y-i|+1+|j-X|}であるため、",
"+# (i, j)間の最短距離はmin{|j-i|, |X-i|+1+|j-Y|}であるため、",
"- diff_X_i = abs(X - i)",
"- diff_Y_i = abs(Y - i)",
"- diff_j_i = abs(j - i)",
"- diff_j_X = abs(j - X)",
"- diff_j_Y = abs(j - Y)",
"- min_path = mi... | false | 0.0414 | 0.041609 | 0.994997 | [
"s219922962",
"s381037724"
] |
u608088992 | p03449 | python | s661030647 | s110294272 | 25 | 22 | 3,316 | 3,316 | Accepted | Accepted | 12 | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [[int(a) for a in input().split()] for _ in range(2)]
move = ((1, 0), (0, 1))
maxN = [[0 for _ in range(N)] for i in range(2)]
q = deque()
q.append((0, 0, A[0][0]))
whi... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [[int(a) for a in input().split()] for _ in range(2)]
M = ((1, 0), (0, 1))
q = deque()
q.append((0, 0, 0))
C = [[0] * N for _ in range(2)]
while q:
i, j, n = q... | 24 | 25 | 653 | 621 | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [[int(a) for a in input().split()] for _ in range(2)]
move = ((1, 0), (0, 1))
maxN = [[0 for _ in range(N)] for i in range(2)]
q = deque()
q.append((0, 0, A[0][0]))
while q:
... | import sys
from collections import deque
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [[int(a) for a in input().split()] for _ in range(2)]
M = ((1, 0), (0, 1))
q = deque()
q.append((0, 0, 0))
C = [[0] * N for _ in range(2)]
while q:
i, j, n = q.popleft()
... | false | 4 | [
"- move = ((1, 0), (0, 1))",
"- maxN = [[0 for _ in range(N)] for i in range(2)]",
"+ M = ((1, 0), (0, 1))",
"- q.append((0, 0, A[0][0]))",
"+ q.append((0, 0, 0))",
"+ C = [[0] * N for _ in range(2)]",
"- nx, ny, np = q.popleft()",
"- maxN[nx][ny] = max(maxN[nx][ny], np... | false | 0.035907 | 0.036991 | 0.970715 | [
"s661030647",
"s110294272"
] |
u573754721 | p02952 | python | s405302728 | s983728385 | 172 | 57 | 38,896 | 2,940 | Accepted | Accepted | 66.86 | N = int(eval(input()))
c = 0
for i in range(1,N + 1):
if len(str(i))%2 == 1:
c += 1
print(c)
| n=int(eval(input()))
c=0
for i in range(1,n+1):
if len(str(i))%2!=0:
c+=1
print(c)
| 8 | 6 | 115 | 100 | N = int(eval(input()))
c = 0
for i in range(1, N + 1):
if len(str(i)) % 2 == 1:
c += 1
print(c)
| n = int(eval(input()))
c = 0
for i in range(1, n + 1):
if len(str(i)) % 2 != 0:
c += 1
print(c)
| false | 25 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-for i in range(1, N + 1):",
"- if len(str(i)) % 2 == 1:",
"+for i in range(1, n + 1):",
"+ if len(str(i)) % 2 != 0:"
] | false | 0.054625 | 0.112358 | 0.486166 | [
"s405302728",
"s983728385"
] |
u175111751 | p02420 | python | s148740790 | s044153794 | 50 | 30 | 7,976 | 7,640 | Accepted | Accepted | 40 | from collections import deque
while True:
s = eval(input())
if s == '-': break
else: ds = deque(s)
ds.rotate(sum([int(eval(input())) for _ in range(int(eval(input())))])*-1)
print((''.join(ds))) | while True:
s = eval(input())
if s == '-': break
l = sum([int(eval(input())) for _ in range(int(eval(input())))]) % len(s)
print((s[l:]+s[:l])) | 7 | 5 | 200 | 143 | from collections import deque
while True:
s = eval(input())
if s == "-":
break
else:
ds = deque(s)
ds.rotate(sum([int(eval(input())) for _ in range(int(eval(input())))]) * -1)
print(("".join(ds)))
| while True:
s = eval(input())
if s == "-":
break
l = sum([int(eval(input())) for _ in range(int(eval(input())))]) % len(s)
print((s[l:] + s[:l]))
| false | 28.571429 | [
"-from collections import deque",
"-",
"- else:",
"- ds = deque(s)",
"- ds.rotate(sum([int(eval(input())) for _ in range(int(eval(input())))]) * -1)",
"- print((\"\".join(ds)))",
"+ l = sum([int(eval(input())) for _ in range(int(eval(input())))]) % len(s)",
"+ print((s[l:] + s[:l... | false | 0.037187 | 0.036868 | 1.008672 | [
"s148740790",
"s044153794"
] |
u296150111 | p03031 | python | s716920386 | s828359867 | 56 | 33 | 3,064 | 3,064 | Accepted | Accepted | 41.07 | ks=[]
n,m=list(map(int,input().split()))
for i in range(m):
ks.append(list(map(int,input().split())))
p=list(map(int,input().split()))
ans_ans=0
for i in range(2**n):
num="0"*10+bin(i)
ans=0
for j in range(m):
cnt=0
for k in range(n):
if num[-k-1]=="1" and k+1 in ks[j][1:]:
cnt+=1
if cnt%... | n,m=list(map(int,input().split()))
ks=[]
for _ in range(m):
rr=list(map(int,input().split()))
ks.append(rr)
p=list(map(int,input().split()))
def two(x):
return "0"*(n-len(bin(x)[2:]))+bin(x)[2:]
ans=0
for i in range(2**n):
r=two(i)
f=1
for j in range(m):
cnt=0
for k in range(ks[j][0]):
if r[... | 22 | 22 | 385 | 404 | ks = []
n, m = list(map(int, input().split()))
for i in range(m):
ks.append(list(map(int, input().split())))
p = list(map(int, input().split()))
ans_ans = 0
for i in range(2**n):
num = "0" * 10 + bin(i)
ans = 0
for j in range(m):
cnt = 0
for k in range(n):
if num[-k - 1] == "... | n, m = list(map(int, input().split()))
ks = []
for _ in range(m):
rr = list(map(int, input().split()))
ks.append(rr)
p = list(map(int, input().split()))
def two(x):
return "0" * (n - len(bin(x)[2:])) + bin(x)[2:]
ans = 0
for i in range(2**n):
r = two(i)
f = 1
for j in range(m):
cnt =... | false | 0 | [
"+n, m = list(map(int, input().split()))",
"-n, m = list(map(int, input().split()))",
"-for i in range(m):",
"- ks.append(list(map(int, input().split())))",
"+for _ in range(m):",
"+ rr = list(map(int, input().split()))",
"+ ks.append(rr)",
"-ans_ans = 0",
"+",
"+",
"+def two(x):",
"+... | false | 0.066273 | 0.112023 | 0.591601 | [
"s716920386",
"s828359867"
] |
u771007149 | p02678 | python | s018909000 | s691665218 | 781 | 665 | 34,312 | 34,208 | Accepted | Accepted | 14.85 | #D
from collections import deque
n,m = list(map(int,input().split()))
#インデックス→各部屋番号(-1),つながってる部屋の番号を格納
graph = [[] for _ in range(n)]
for _ in range(m):
a,b = list(map(int,input().split()))
graph[a-1].append(b-1)
graph[b-1].append(a-1)
#各部屋から1までの距離(初期値999)
bango = [-999 for _ in range(n)]
... | from collections import deque
n,m = list(map(int,input().split()))
graph = [[] for _ in range(n)]
for _ in range(m):
a,b = list(map(int,input().split()))
graph[a-1].append(b-1)
graph[b-1].append(a-1)
#部屋から1までの距離(深さ)
dist = [-100 for _ in range(n)]
dist[0] = 0
#幅優先探索でdistを更新
#pに今いる位置を格... | 31 | 30 | 630 | 568 | # D
from collections import deque
n, m = list(map(int, input().split()))
# インデックス→各部屋番号(-1),つながってる部屋の番号を格納
graph = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
# 各部屋から1までの距離(初期値999)
bango = [-999 for _ in range(n)]
ba... | from collections import deque
n, m = list(map(int, input().split()))
graph = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
# 部屋から1までの距離(深さ)
dist = [-100 for _ in range(n)]
dist[0] = 0
# 幅優先探索でdistを更新
# pに今いる位置を格納
p = d... | false | 3.225806 | [
"-# D",
"-# インデックス→各部屋番号(-1),つながってる部屋の番号を格納",
"-# 各部屋から1までの距離(初期値999)",
"-bango = [-999 for _ in range(n)]",
"-bango[0] = 0",
"-# p->今いる部屋",
"+# 部屋から1までの距離(深さ)",
"+dist = [-100 for _ in range(n)]",
"+dist[0] = 0",
"+# 幅優先探索でdistを更新",
"+# pに今いる位置を格納",
"-while not len(p) == 0:",
"- x = p.po... | false | 0.068928 | 0.063616 | 1.083497 | [
"s018909000",
"s691665218"
] |
u296518383 | p03503 | python | s732000208 | s307907955 | 272 | 212 | 3,956 | 42,092 | Accepted | Accepted | 22.06 | N=int(eval(input()))
M=[[0 for i in range(2**10)] for j in range(N)]
K=[0]*(2**10)
F=[list(map(int,input().split())) for _ in range(N)]
P=[list(map(int,input().split())) for _ in range(N)]
for i in range(2**10):
for j in range(10):
for k in range(N):
if (i>>9-j)&1 and F[k][j]:
#print(i,j)... | N = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
answer = []
for i in range(1, 2 ** 10):
tmp = 0
for j in range(N):
cnt = 0
for k in range(10):
if (i >> k) & 1 and F[j][k]:
cnt += 1
tmp += P[... | 17 | 16 | 426 | 367 | N = int(eval(input()))
M = [[0 for i in range(2**10)] for j in range(N)]
K = [0] * (2**10)
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
for i in range(2**10):
for j in range(10):
for k in range(N):
if (i >> 9 - j) & 1 and F[k][j]... | N = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
answer = []
for i in range(1, 2**10):
tmp = 0
for j in range(N):
cnt = 0
for k in range(10):
if (i >> k) & 1 and F[j][k]:
cnt += 1
... | false | 5.882353 | [
"-M = [[0 for i in range(2**10)] for j in range(N)]",
"-K = [0] * (2**10)",
"-for i in range(2**10):",
"- for j in range(10):",
"- for k in range(N):",
"- if (i >> 9 - j) & 1 and F[k][j]:",
"- # print(i,j)",
"- M[k][i] += 1",
"-for i in range(2**10)... | false | 0.064485 | 0.107066 | 0.602298 | [
"s732000208",
"s307907955"
] |
u535803878 | p02579 | python | s805655677 | s621658690 | 1,611 | 821 | 123,920 | 117,872 | Accepted | Accepted | 49.04 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
import numpy as np
from numba import njit, b1, i4, i8, f8
from heapq import heappop as hpp, heappush as hp
h,w = list(map(int, input().split()))
ch,cw = list(map(int... | import numpy as np
from numba import njit, b1, i4, i8, f8
from heapq import heappop as hpp, heappush as hp
@njit((b1[:, :],i8,i8,i8,i8), cache=True)
def main(ss,ch,cw,dh,dw):
inf = 1<<30
h,w = ss.shape
start = ch*w+cw
goal = dh*w+dw
n = h*w
seen = np.full(n, inf, np.int64)
seen[... | 63 | 63 | 1,586 | 1,592 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
import numpy as np
from numba import njit, b1, i4, i8, f8
from heapq import heappop as hpp, heappush as hp
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input()... | import numpy as np
from numba import njit, b1, i4, i8, f8
from heapq import heappop as hpp, heappush as hp
@njit((b1[:, :], i8, i8, i8, i8), cache=True)
def main(ss, ch, cw, dh, dw):
inf = 1 << 30
h, w = ss.shape
start = ch * w + cw
goal = dh * w + dw
n = h * w
seen = np.full(n, inf, np.int64)... | false | 0 | [
"-import sys",
"-",
"-input = lambda: sys.stdin.readline().rstrip()",
"-sys.setrecursionlimit(max(1000, 10**9))",
"-write = lambda x: sys.stdout.write(x + \"\\n\")",
"-",
"-h, w = list(map(int, input().split()))",
"-ch, cw = list(map(int, input().split()))",
"-dh, dw = list(map(int, input().split())... | false | 0.174209 | 0.17406 | 1.000853 | [
"s805655677",
"s621658690"
] |
u201234972 | p03855 | python | s206542960 | s065129841 | 1,473 | 1,290 | 61,952 | 62,012 | Accepted | Accepted | 12.42 | from collections import defaultdict
def find(x, A):
p = A[x]
if p == x:
return x
a = find(p, A)
A[x] = a
find(a,A)
return a
N, K, L = list(map( int, input().split()))
V = [ i for i in range(N)]
W = [ i for i in range(N)]
for _ in range(K):
p, q = list(map( int, input()... | from collections import defaultdict
def find(x, A): #unionfind
p = A[x]
if p == x:
return x
a = find(p, A)
A[x] = a
return a
N, K, L = list(map( int, input().split()))
V = [ i for i in range(N)]
W = [ i for i in range(N)]
for _ in range(K):
p, q = list(map( int, input().spl... | 35 | 34 | 744 | 753 | from collections import defaultdict
def find(x, A):
p = A[x]
if p == x:
return x
a = find(p, A)
A[x] = a
find(a, A)
return a
N, K, L = list(map(int, input().split()))
V = [i for i in range(N)]
W = [i for i in range(N)]
for _ in range(K):
p, q = list(map(int, input().split()))
... | from collections import defaultdict
def find(x, A): # unionfind
p = A[x]
if p == x:
return x
a = find(p, A)
A[x] = a
return a
N, K, L = list(map(int, input().split()))
V = [i for i in range(N)]
W = [i for i in range(N)]
for _ in range(K):
p, q = list(map(int, input().split()))
p... | false | 2.857143 | [
"-def find(x, A):",
"+def find(x, A): # unionfind",
"- find(a, A)",
"-d = defaultdict(int)",
"+d = defaultdict(int) # デフォルトで0を返す。"
] | false | 0.040269 | 0.043916 | 0.916947 | [
"s206542960",
"s065129841"
] |
u186838327 | p02983 | python | s024629244 | s922457367 | 300 | 234 | 40,812 | 41,196 | Accepted | Accepted | 22 | import itertools
l, r = list(map(int, input().split()))
if r-l >= 2018:
print((0))
else:
l_mod = l%2019
r_mod = r%2019
min_mod = float('inf')
if l_mod <= r_mod:
for c in itertools.combinations(list(range(l_mod, r_mod+1)), 2):
min_mod = min(min_mod, (c[0]*c[1])%2019)
print(min_mod)
... | l, r = list(map(int, input().split()))
if r-l+1 >= 2019:
print((0))
else:
l %= 2019
r %= 2019
if l <= r:
ans = float('inf')
for i in range(l, r):
for j in range(i+1, r+1):
ans = min(ans, (i*j)%2019)
else:
ans = 0
print(ans) | 19 | 14 | 340 | 304 | import itertools
l, r = list(map(int, input().split()))
if r - l >= 2018:
print((0))
else:
l_mod = l % 2019
r_mod = r % 2019
min_mod = float("inf")
if l_mod <= r_mod:
for c in itertools.combinations(list(range(l_mod, r_mod + 1)), 2):
min_mod = min(min_mod, (c[0] * c[1]) % 2019)
... | l, r = list(map(int, input().split()))
if r - l + 1 >= 2019:
print((0))
else:
l %= 2019
r %= 2019
if l <= r:
ans = float("inf")
for i in range(l, r):
for j in range(i + 1, r + 1):
ans = min(ans, (i * j) % 2019)
else:
ans = 0
print(ans)
| false | 26.315789 | [
"-import itertools",
"-",
"-if r - l >= 2018:",
"+if r - l + 1 >= 2019:",
"- l_mod = l % 2019",
"- r_mod = r % 2019",
"- min_mod = float(\"inf\")",
"- if l_mod <= r_mod:",
"- for c in itertools.combinations(list(range(l_mod, r_mod + 1)), 2):",
"- min_mod = min(min_mod... | false | 0.037463 | 0.070883 | 0.528519 | [
"s024629244",
"s922457367"
] |
u911449886 | p02901 | python | s463128377 | s756832665 | 1,985 | 329 | 96,292 | 76,512 | Accepted | Accepted | 83.43 | from sys import stdin
def getval():
n,m = list(map(int,input().split()))
ab = []
c = []
def tobit(arr):
idx = len(arr)-1
s = ""
for i in range(n-1,-1,-1):
if arr[idx]-1==i and idx!=-1:
s = "".join([s,"1"])
idx -= 1
... | from sys import stdin
def getval():
n,m = list(map(int,input().split()))
ab = []
c = []
def tobit(arr):
idx = len(arr)-1
s = ""
for i in range(n-1,-1,-1):
if arr[idx]-1==i and idx!=-1:
s = "".join([s,"1"])
idx -= 1
... | 66 | 52 | 1,778 | 1,391 | from sys import stdin
def getval():
n, m = list(map(int, input().split()))
ab = []
c = []
def tobit(arr):
idx = len(arr) - 1
s = ""
for i in range(n - 1, -1, -1):
if arr[idx] - 1 == i and idx != -1:
s = "".join([s, "1"])
idx -= 1
... | from sys import stdin
def getval():
n, m = list(map(int, input().split()))
ab = []
c = []
def tobit(arr):
idx = len(arr) - 1
s = ""
for i in range(n - 1, -1, -1):
if arr[idx] - 1 == i and idx != -1:
s = "".join([s, "1"])
idx -= 1
... | false | 21.212121 | [
"-",
"- def intersect(bit1, bit2):",
"- s = \"\"",
"- for i in range(n):",
"- if bit1[i] == \"1\" or bit2[i] == \"1\":",
"- s = \"\".join([s, \"1\"])",
"- else:",
"- s = \"\".join([s, \"0\"])",
"- return int(s, 2)",
"-",
... | false | 0.045701 | 0.217982 | 0.209656 | [
"s463128377",
"s756832665"
] |
u596276291 | p03795 | python | s353238210 | s742115141 | 33 | 27 | 3,444 | 3,944 | Accepted | Accepted | 18.18 | from collections import defaultdict
def main():
N = int(eval(input()))
print((800 * N - (N // 15) * 200))
if __name__ == '__main__':
main()
| from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.se... | 10 | 30 | 157 | 778 | from collections import defaultdict
def main():
N = int(eval(input()))
print((800 * N - (N // 15) * 200))
if __name__ == "__main__":
main()
| from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecurs... | false | 66.666667 | [
"-from collections import defaultdict",
"+from collections import defaultdict, Counter",
"+from itertools import product, groupby, count, permutations, combinations",
"+from math import pi, sqrt",
"+from collections import deque",
"+from bisect import bisect, bisect_left, bisect_right",
"+from string im... | false | 0.045981 | 0.037633 | 1.221819 | [
"s353238210",
"s742115141"
] |
u057109575 | p02949 | python | s221975053 | s405160049 | 969 | 507 | 65,368 | 87,988 | Accepted | Accepted | 47.68 | import sys
sys.setrecursionlimit(10 ** 9)
N, M, P = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
edges = [[] for _ in range(N)]
to = [[] for _ in range(N)]
ot = [[] for _ in range(N)]
for a, b, c in X:
a -= 1
b -= 1
c = -(c - P)
edges[a].append... | from collections import deque
import sys
sys.setrecursionlimit(10 ** 9)
N, M, P = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
to = [[] for _ in range(N + 1)]
ot = [[] for _ in range(N + 1)]
edges = [[] for _ in range(N + 1)]
for a, b, c in X:
edges[a].appen... | 67 | 62 | 1,228 | 1,213 | import sys
sys.setrecursionlimit(10**9)
N, M, P = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
edges = [[] for _ in range(N)]
to = [[] for _ in range(N)]
ot = [[] for _ in range(N)]
for a, b, c in X:
a -= 1
b -= 1
c = -(c - P)
edges[a].append((b, c))
to[a]... | from collections import deque
import sys
sys.setrecursionlimit(10**9)
N, M, P = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
to = [[] for _ in range(N + 1)]
ot = [[] for _ in range(N + 1)]
edges = [[] for _ in range(N + 1)]
for a, b, c in X:
edges[a].append((b, c - P))
... | false | 7.462687 | [
"+from collections import deque",
"-edges = [[] for _ in range(N)]",
"-to = [[] for _ in range(N)]",
"-ot = [[] for _ in range(N)]",
"+to = [[] for _ in range(N + 1)]",
"+ot = [[] for _ in range(N + 1)]",
"+edges = [[] for _ in range(N + 1)]",
"- a -= 1",
"- b -= 1",
"- c = -(c - P)",
"... | false | 0.06444 | 0.064443 | 0.999963 | [
"s221975053",
"s405160049"
] |
u343977188 | p02708 | python | s911084455 | s249046595 | 171 | 146 | 9,168 | 9,124 | Accepted | Accepted | 14.62 | N,K=list(map(int,input().split()))
p=10**9 + 7
ans=0
for i in range(K-1,N+1):
L_min=i*(i+1)//2
L_max=(N*(N+1)//2)-((N-i-1)*(N-i)//2)
ans += (L_max-L_min+1)%p
print((ans%p)) | N,K=list(map(int,input().split()))
p=10**9 + 7
L_min,L_max=0,0
for i in range(K-1,N+1):
L_min+=i*(i+1)//2 - 1
L_max+=(N*(N+1)//2)-((N-i-1)*(N-i)//2)
ans = (L_max-L_min)%p
print(ans)
| 8 | 8 | 177 | 187 | N, K = list(map(int, input().split()))
p = 10**9 + 7
ans = 0
for i in range(K - 1, N + 1):
L_min = i * (i + 1) // 2
L_max = (N * (N + 1) // 2) - ((N - i - 1) * (N - i) // 2)
ans += (L_max - L_min + 1) % p
print((ans % p))
| N, K = list(map(int, input().split()))
p = 10**9 + 7
L_min, L_max = 0, 0
for i in range(K - 1, N + 1):
L_min += i * (i + 1) // 2 - 1
L_max += (N * (N + 1) // 2) - ((N - i - 1) * (N - i) // 2)
ans = (L_max - L_min) % p
print(ans)
| false | 0 | [
"-ans = 0",
"+L_min, L_max = 0, 0",
"- L_min = i * (i + 1) // 2",
"- L_max = (N * (N + 1) // 2) - ((N - i - 1) * (N - i) // 2)",
"- ans += (L_max - L_min + 1) % p",
"-print((ans % p))",
"+ L_min += i * (i + 1) // 2 - 1",
"+ L_max += (N * (N + 1) // 2) - ((N - i - 1) * (N - i) // 2)",
... | false | 0.061995 | 0.0608 | 1.019651 | [
"s911084455",
"s249046595"
] |
u440180827 | p00008 | python | s099222929 | s930449618 | 200 | 60 | 7,476 | 7,688 | Accepted | Accepted | 70 | import sys
for line in sys.stdin:
n = int(line)
count = 0
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
if i + j + k + l == n:
count += 1
print(count) | import sys
t = [0 for i in range(10000)]
c = 0
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
t[c] = i + j + k + l
c += 1
for line in sys.stdin:
print((t.count(int(line)))) | 11 | 11 | 290 | 273 | import sys
for line in sys.stdin:
n = int(line)
count = 0
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
if i + j + k + l == n:
count += 1
print(count)
| import sys
t = [0 for i in range(10000)]
c = 0
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
t[c] = i + j + k + l
c += 1
for line in sys.stdin:
print((t.count(int(line))))
| false | 0 | [
"+t = [0 for i in range(10000)]",
"+c = 0",
"+for i in range(10):",
"+ for j in range(10):",
"+ for k in range(10):",
"+ for l in range(10):",
"+ t[c] = i + j + k + l",
"+ c += 1",
"- n = int(line)",
"- count = 0",
"- for i in range(10)... | false | 0.040095 | 0.039528 | 1.014324 | [
"s099222929",
"s930449618"
] |
u349449706 | p02536 | python | s106024220 | s892217958 | 325 | 291 | 82,228 | 86,840 | Accepted | Accepted | 10.46 | N, M = list(map(int, input().split()))
F = [[] for _ in range(N)]
P = [0] * N
for i in range(M):
A, B = list(map(int, input().split()))
F[A-1].append(B-1)
F[B-1].append(A-1)
c=0
l = []
for i in range(N):
if P[i] == 0:
c+=1
l.append(i)
while len(l)>0:
p=l... | N, M = list(map(int, input().split()))
Ne = [[] for _ in range(N)]
C = [0] * N
for i in range(M):
A, B = list(map(int, input().split()))
Ne[A-1].append(B-1)
Ne[B-1].append(A-1)
c=0
l = []
for i in range(N):
if C[i] == 0:
c+=1
l.append(i)
while len(l)>0:
... | 20 | 20 | 441 | 445 | N, M = list(map(int, input().split()))
F = [[] for _ in range(N)]
P = [0] * N
for i in range(M):
A, B = list(map(int, input().split()))
F[A - 1].append(B - 1)
F[B - 1].append(A - 1)
c = 0
l = []
for i in range(N):
if P[i] == 0:
c += 1
l.append(i)
while len(l) > 0:
p =... | N, M = list(map(int, input().split()))
Ne = [[] for _ in range(N)]
C = [0] * N
for i in range(M):
A, B = list(map(int, input().split()))
Ne[A - 1].append(B - 1)
Ne[B - 1].append(A - 1)
c = 0
l = []
for i in range(N):
if C[i] == 0:
c += 1
l.append(i)
while len(l) > 0:
... | false | 0 | [
"-F = [[] for _ in range(N)]",
"-P = [0] * N",
"+Ne = [[] for _ in range(N)]",
"+C = [0] * N",
"- F[A - 1].append(B - 1)",
"- F[B - 1].append(A - 1)",
"+ Ne[A - 1].append(B - 1)",
"+ Ne[B - 1].append(A - 1)",
"- if P[i] == 0:",
"+ if C[i] == 0:",
"- p = l.pop()",
"... | false | 0.067303 | 0.048069 | 1.400117 | [
"s106024220",
"s892217958"
] |
u186838327 | p03045 | python | s267354940 | s249413003 | 896 | 375 | 73,560 | 64,304 | Accepted | Accepted | 58.15 | class UnionFind():
def __init__(self, n):
self.n = n
# n+1なのはノード番号とリストのインデックスを一致させるため
# root[x]<0ならそのノードが根かつその絶対値が木の要素数
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_Root(self.ro... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
g = [[] for _ in range(n)]
for i in range(m):
x, y, z = list(map(int, input().split()))
x, y = x-1, y-1
g[x].append(y)
g[y].append(x)
s = []
visit = [-1]*n
cnt = 0
for i in range(n):
if visit[i] == -1:
... | 42 | 26 | 1,028 | 566 | class UnionFind:
def __init__(self, n):
self.n = n
# n+1なのはノード番号とリストのインデックスを一致させるため
# root[x]<0ならそのノードが根かつその絶対値が木の要素数
self.root = [-1] * (n + 1)
self.rnk = [0] * (n + 1)
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
s... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
g = [[] for _ in range(n)]
for i in range(m):
x, y, z = list(map(int, input().split()))
x, y = x - 1, y - 1
g[x].append(y)
g[y].append(x)
s = []
visit = [-1] * n
cnt = 0
for i in range(n):
if visit[i] == -1:
s.appe... | false | 38.095238 | [
"-class UnionFind:",
"- def __init__(self, n):",
"- self.n = n",
"- # n+1なのはノード番号とリストのインデックスを一致させるため",
"- # root[x]<0ならそのノードが根かつその絶対値が木の要素数",
"- self.root = [-1] * (n + 1)",
"- self.rnk = [0] * (n + 1)",
"+import sys",
"- def Find_Root(self, x):",
"- ... | false | 0.056021 | 0.048153 | 1.163398 | [
"s267354940",
"s249413003"
] |
u699296734 | p03606 | python | s932150591 | s214209319 | 129 | 58 | 16,772 | 9,500 | Accepted | Accepted | 55.04 | n = int(eval(input()))
seat = [0] * 10 ** 6
for i in range(n):
l, r = list(map(int, input().split()))
for j in range(l, r + 1):
seat[j - 1] = 1
res = 0
for i in range(10 ** 6):
if seat[i] == 1:
res += 1
print(res)
| n = int(eval(input()))
seat = [0] * (10 ** 5 + 1)
for i in range(n):
l, r = list(map(int, input().split()))
seat[l - 1] += 1
seat[r] -= 1
for i in range(1, 10 ** 5):
seat[i] += seat[i - 1]
res = 0
for i in range(10 ** 5):
if seat[i] == 1:
res += 1
print(res)
| 12 | 15 | 242 | 291 | n = int(eval(input()))
seat = [0] * 10**6
for i in range(n):
l, r = list(map(int, input().split()))
for j in range(l, r + 1):
seat[j - 1] = 1
res = 0
for i in range(10**6):
if seat[i] == 1:
res += 1
print(res)
| n = int(eval(input()))
seat = [0] * (10**5 + 1)
for i in range(n):
l, r = list(map(int, input().split()))
seat[l - 1] += 1
seat[r] -= 1
for i in range(1, 10**5):
seat[i] += seat[i - 1]
res = 0
for i in range(10**5):
if seat[i] == 1:
res += 1
print(res)
| false | 20 | [
"-seat = [0] * 10**6",
"+seat = [0] * (10**5 + 1)",
"- for j in range(l, r + 1):",
"- seat[j - 1] = 1",
"+ seat[l - 1] += 1",
"+ seat[r] -= 1",
"+for i in range(1, 10**5):",
"+ seat[i] += seat[i - 1]",
"-for i in range(10**6):",
"+for i in range(10**5):"
] | false | 0.203606 | 0.110124 | 1.84888 | [
"s932150591",
"s214209319"
] |
u870178975 | p02861 | python | s959599192 | s838518559 | 412 | 169 | 3,064 | 38,384 | Accepted | Accepted | 58.98 | import math
import itertools
a=[]
ans=0
n=int(eval(input()))
m=1
for i in range(1,n+1):
m*=i
for i in range(n):
x,y=list(map(int,input().split()))
a.append([x,y])
for t in itertools.permutations(list(range(n)),n):
for i in range(n-1):
ans+=math.sqrt((a[t[i]][0]-a[t[i+1]][0])**2+(a[t[i]][1]-... | def resolve():
n=int(eval(input()))
x = [0] * n
y = [0] * n
ans=0
t=1
for i in range(1,n):
t*=i
for i in range(n):
x[i], y[i] = list(map(int, input().split()))
for i in range(n):
for j in range(i+1,n):
ans+=((x[i]-x[j])**2+(y[i]-y[j])**2)**... | 16 | 15 | 342 | 342 | import math
import itertools
a = []
ans = 0
n = int(eval(input()))
m = 1
for i in range(1, n + 1):
m *= i
for i in range(n):
x, y = list(map(int, input().split()))
a.append([x, y])
for t in itertools.permutations(list(range(n)), n):
for i in range(n - 1):
ans += math.sqrt(
(a[t[i]][... | def resolve():
n = int(eval(input()))
x = [0] * n
y = [0] * n
ans = 0
t = 1
for i in range(1, n):
t *= i
for i in range(n):
x[i], y[i] = list(map(int, input().split()))
for i in range(n):
for j in range(i + 1, n):
ans += ((x[i] - x[j]) ** 2 + (y[i] - y... | false | 6.25 | [
"-import math",
"-import itertools",
"+def resolve():",
"+ n = int(eval(input()))",
"+ x = [0] * n",
"+ y = [0] * n",
"+ ans = 0",
"+ t = 1",
"+ for i in range(1, n):",
"+ t *= i",
"+ for i in range(n):",
"+ x[i], y[i] = list(map(int, input().split()))",
"+... | false | 0.083213 | 0.046776 | 1.778975 | [
"s959599192",
"s838518559"
] |
u300645821 | p01314 | python | s444379156 | s702001484 | 30 | 10 | 7,520 | 6,264 | Accepted | Accepted | 66.67 | #!/usr/bin/python
import sys
if sys.version_info[0]>=3: raw_input=input
try:
while True:
n=int(input())
if n==0: break
r=0
i=1
while 1:
n-=i
if n<i: break
i+=1
if n%i==0: r+=1
print(r)
except EOFError:
pass | #!/usr/bin/python
import sys
if sys.version_info[0]>=3: raw_input=input
try:
while True:
n=int(input())
if n==0: break
r=0
i=1
while 1:
n-=i
i+=1
if n<i: break
if n%i==0: r+=1
print(r)
except EOFError:
pass | 18 | 18 | 254 | 254 | #!/usr/bin/python
import sys
if sys.version_info[0] >= 3:
raw_input = input
try:
while True:
n = int(input())
if n == 0:
break
r = 0
i = 1
while 1:
n -= i
if n < i:
break
i += 1
if n % i == 0:
... | #!/usr/bin/python
import sys
if sys.version_info[0] >= 3:
raw_input = input
try:
while True:
n = int(input())
if n == 0:
break
r = 0
i = 1
while 1:
n -= i
i += 1
if n < i:
break
if n % i == 0:
... | false | 0 | [
"+ i += 1",
"- i += 1"
] | false | 0.107456 | 0.077249 | 1.391025 | [
"s444379156",
"s702001484"
] |
u119148115 | p03564 | python | s461390826 | s736450645 | 87 | 66 | 61,940 | 61,860 | Accepted | Accepted | 24.14 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | import sys
def I(): return int(sys.stdin.readline().rstrip())
N,K = I(),I()
print((min(2**i+K*(N-i) for i in range(N+1))))
| 20 | 6 | 609 | 128 | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | import sys
def I():
return int(sys.stdin.readline().rstrip())
N, K = I(), I()
print((min(2**i + K * (N - i) for i in range(N + 1))))
| false | 70 | [
"-",
"-sys.setrecursionlimit(10**7)",
"-def MI():",
"- return list(map(int, sys.stdin.readline().rstrip().split()))",
"-",
"-",
"-def LI():",
"- return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり",
"-",
"-",
"-def LI2():",
"- return list(map(int, sys.stdin.readline()... | false | 0.007809 | 0.04075 | 0.19162 | [
"s461390826",
"s736450645"
] |
u698762975 | p02264 | python | s103147270 | s611630885 | 410 | 350 | 14,464 | 13,300 | Accepted | Accepted | 14.63 | from collections import deque
def solve(n,t):
q=deque([])
for i in range(n):
l=list(input().split())
q.append(l)
time=0
while not len(q)==0:
x=q.popleft()
if int(x[1])-t>0:
x[1]=str(int(x[1])-t)
time+=t
q.append(x)
else:
print((x[0]+" "+str(time+int(x[1]... | import collections
q=collections.deque()
n,m=list(map(int,input().split()))
for i in range(n):
a,b=input().split()
b=int(b)
q.append([a,b])
t=0
while len(q)!=0:
n=q.popleft()
if n[1]<=m:
t+=n[1]
print((n[0],str(t)))
else:
t+=m
n[1]-=m
q.append(n)
| 18 | 17 | 388 | 287 | from collections import deque
def solve(n, t):
q = deque([])
for i in range(n):
l = list(input().split())
q.append(l)
time = 0
while not len(q) == 0:
x = q.popleft()
if int(x[1]) - t > 0:
x[1] = str(int(x[1]) - t)
time += t
q.append(x... | import collections
q = collections.deque()
n, m = list(map(int, input().split()))
for i in range(n):
a, b = input().split()
b = int(b)
q.append([a, b])
t = 0
while len(q) != 0:
n = q.popleft()
if n[1] <= m:
t += n[1]
print((n[0], str(t)))
else:
t += m
n[1] -= m
... | false | 5.555556 | [
"-from collections import deque",
"+import collections",
"-",
"-def solve(n, t):",
"- q = deque([])",
"- for i in range(n):",
"- l = list(input().split())",
"- q.append(l)",
"- time = 0",
"- while not len(q) == 0:",
"- x = q.popleft()",
"- if int(x[1]) -... | false | 0.047115 | 0.04653 | 1.01257 | [
"s103147270",
"s611630885"
] |
u729133443 | p02782 | python | s099356940 | s087073780 | 424 | 348 | 82,164 | 82,164 | Accepted | Accepted | 17.92 | def main():
M=10**9+7
r1,c1,r2,c2=list(map(int,input().split()))
n=r2+c2+2
fac=[0]*(n+1)
fac[0]=1
for i in range(1,n+1):fac[i]=fac[i-1]*i%M
f=lambda r,c:fac[r+c+2]*pow(fac[c+1],M-2,M)*pow(fac[r+1],M-2,M)-c-r-2
print(((f(r2,c2)-f(r2,c1-1)-f(r1-1,c2)+f(r1-1,c1-1))%M))
main() | def main():
M=10**9+7
r1,c1,r2,c2=list(map(int,input().split()))
n=r2+c2+2
fac=[0]*(n+1)
fac[0]=before=1
for i in range(1,n+1):fac[i]=before=before*i%M
f=lambda r,c:fac[r+c+2]*pow(fac[c+1],M-2,M)*pow(fac[r+1],M-2,M)-c-r-2
print(((f(r2,c2)-f(r2,c1-1)-f(r1-1,c2)+f(r1-1,c1-1))%M))
main() | 10 | 10 | 290 | 302 | def main():
M = 10**9 + 7
r1, c1, r2, c2 = list(map(int, input().split()))
n = r2 + c2 + 2
fac = [0] * (n + 1)
fac[0] = 1
for i in range(1, n + 1):
fac[i] = fac[i - 1] * i % M
f = (
lambda r, c: fac[r + c + 2]
* pow(fac[c + 1], M - 2, M)
* pow(fac[r + 1], M - ... | def main():
M = 10**9 + 7
r1, c1, r2, c2 = list(map(int, input().split()))
n = r2 + c2 + 2
fac = [0] * (n + 1)
fac[0] = before = 1
for i in range(1, n + 1):
fac[i] = before = before * i % M
f = (
lambda r, c: fac[r + c + 2]
* pow(fac[c + 1], M - 2, M)
* pow(fa... | false | 0 | [
"- fac[0] = 1",
"+ fac[0] = before = 1",
"- fac[i] = fac[i - 1] * i % M",
"+ fac[i] = before = before * i % M"
] | false | 0.050143 | 0.050329 | 0.996299 | [
"s099356940",
"s087073780"
] |
u519939795 | p03408 | python | s986683172 | s719212421 | 21 | 17 | 3,316 | 3,060 | Accepted | Accepted | 19.05 | from collections import Counter
N=int(eval(input()))
S=Counter([eval(input()) for i in range(N)])
M=int(eval(input()))
T=Counter([eval(input()) for i in range(M)])
ans=0
for key in list(S.keys()):
ans = max(S.get(key)-T.get(key,0),ans)
print(ans) | n=int(eval(input()))
s=[eval(input()) for i in range(n)]
m=int(eval(input()))
t=[eval(input()) for i in range(m)]
li=list(set(s))
print((max(0,max(s.count(li[i])-t.count(li[i]) for i in range(len(li)))))) | 9 | 6 | 228 | 183 | from collections import Counter
N = int(eval(input()))
S = Counter([eval(input()) for i in range(N)])
M = int(eval(input()))
T = Counter([eval(input()) for i in range(M)])
ans = 0
for key in list(S.keys()):
ans = max(S.get(key) - T.get(key, 0), ans)
print(ans)
| n = int(eval(input()))
s = [eval(input()) for i in range(n)]
m = int(eval(input()))
t = [eval(input()) for i in range(m)]
li = list(set(s))
print((max(0, max(s.count(li[i]) - t.count(li[i]) for i in range(len(li))))))
| false | 33.333333 | [
"-from collections import Counter",
"-",
"-N = int(eval(input()))",
"-S = Counter([eval(input()) for i in range(N)])",
"-M = int(eval(input()))",
"-T = Counter([eval(input()) for i in range(M)])",
"-ans = 0",
"-for key in list(S.keys()):",
"- ans = max(S.get(key) - T.get(key, 0), ans)",
"-print... | false | 0.0412 | 0.041434 | 0.994374 | [
"s986683172",
"s719212421"
] |
u977389981 | p03273 | python | s570904508 | s773904180 | 25 | 19 | 3,316 | 3,064 | Accepted | Accepted | 24 | h, w = list(map(int, input().split()))
A = []
for i in range(h):
s = list(eval(input()))
if '#' in s:
A.append(s)
B = [[0] * w for i in range(len(A))]
for i in range(len(A)):
for j in range(w):
if A[i][j] == '#':
B[i][j] += 1
C = [0] * w
for ... | h, w = list(map(int, input().split()))
A = []
for i in range(h):
s = list(eval(input()))
if '#' in s:
A.append(s)
h2 = len(A)
for j in range(w - 1, -1, -1):
for i in range(h2):
if A[i][j] == '#':
break
elif i == h2 - 1:
for k in range(h2):
... | 27 | 19 | 598 | 382 | h, w = list(map(int, input().split()))
A = []
for i in range(h):
s = list(eval(input()))
if "#" in s:
A.append(s)
B = [[0] * w for i in range(len(A))]
for i in range(len(A)):
for j in range(w):
if A[i][j] == "#":
B[i][j] += 1
C = [0] * w
for i in range(len(A)):
for j in range... | h, w = list(map(int, input().split()))
A = []
for i in range(h):
s = list(eval(input()))
if "#" in s:
A.append(s)
h2 = len(A)
for j in range(w - 1, -1, -1):
for i in range(h2):
if A[i][j] == "#":
break
elif i == h2 - 1:
for k in range(h2):
del ... | false | 29.62963 | [
"-B = [[0] * w for i in range(len(A))]",
"-for i in range(len(A)):",
"- for j in range(w):",
"+h2 = len(A)",
"+for j in range(w - 1, -1, -1):",
"+ for i in range(h2):",
"- B[i][j] += 1",
"-C = [0] * w",
"-for i in range(len(A)):",
"- for j in range(w):",
"- C[j] += B[i... | false | 0.046948 | 0.072305 | 0.649308 | [
"s570904508",
"s773904180"
] |
u588341295 | p03478 | python | s217180264 | s230165776 | 38 | 28 | 3,060 | 3,060 | Accepted | Accepted | 26.32 | # -*- coding: utf-8 -*-
N, A, B = list(map(int, input().split()))
ans = 0
# 1~Nのループ
for i in range(1, N+1):
sum1 = 0
num = i
# 各桁の値を合計していく
for j in range(len(str(i))):
sum1 += num % 10
num = int(num / 10)
# 条件に合っていれば答えに足す
if sum1 >= A and sum1 <= B:
ans... | # -*- coding: utf-8 -*-
N, A, B = list(map(int, input().split()))
ans = 0
# 1~Nのループ
for i in range(1, N+1):
sum1 = 0
num = i
# 各桁の値を合計していく
while num > 0:
sum1 += num % 10
num //= 10
# 条件に合っていれば答えに足す
if sum1 >= A and sum1 <= B:
ans += i
print(ans) | 19 | 19 | 333 | 310 | # -*- coding: utf-8 -*-
N, A, B = list(map(int, input().split()))
ans = 0
# 1~Nのループ
for i in range(1, N + 1):
sum1 = 0
num = i
# 各桁の値を合計していく
for j in range(len(str(i))):
sum1 += num % 10
num = int(num / 10)
# 条件に合っていれば答えに足す
if sum1 >= A and sum1 <= B:
ans += i
print(ans)
| # -*- coding: utf-8 -*-
N, A, B = list(map(int, input().split()))
ans = 0
# 1~Nのループ
for i in range(1, N + 1):
sum1 = 0
num = i
# 各桁の値を合計していく
while num > 0:
sum1 += num % 10
num //= 10
# 条件に合っていれば答えに足す
if sum1 >= A and sum1 <= B:
ans += i
print(ans)
| false | 0 | [
"- for j in range(len(str(i))):",
"+ while num > 0:",
"- num = int(num / 10)",
"+ num //= 10"
] | false | 0.03831 | 0.045165 | 0.848222 | [
"s217180264",
"s230165776"
] |
u690536347 | p02843 | python | s219436709 | s692247578 | 186 | 35 | 3,828 | 3,828 | Accepted | Accepted | 81.18 | X = int(eval(input()))
dp = [0]*(X+1)
dp[0] = 1
for i in range(X+1):
for j in [100, 101, 102, 103, 104, 105]:
if i-j>=0 and dp[i-j]:
dp[i] = 1
print((dp[X])) | X = int(eval(input()))
dp = [0]*(X+1)
dp[0] = 1
for i in range(100, X+1):
dp[i] = dp[i-100] or dp[i-101] or dp[i-102] or dp[i-103] or dp[i-104] or dp[i-105]
print((dp[X])) | 10 | 8 | 184 | 176 | X = int(eval(input()))
dp = [0] * (X + 1)
dp[0] = 1
for i in range(X + 1):
for j in [100, 101, 102, 103, 104, 105]:
if i - j >= 0 and dp[i - j]:
dp[i] = 1
print((dp[X]))
| X = int(eval(input()))
dp = [0] * (X + 1)
dp[0] = 1
for i in range(100, X + 1):
dp[i] = (
dp[i - 100]
or dp[i - 101]
or dp[i - 102]
or dp[i - 103]
or dp[i - 104]
or dp[i - 105]
)
print((dp[X]))
| false | 20 | [
"-for i in range(X + 1):",
"- for j in [100, 101, 102, 103, 104, 105]:",
"- if i - j >= 0 and dp[i - j]:",
"- dp[i] = 1",
"+for i in range(100, X + 1):",
"+ dp[i] = (",
"+ dp[i - 100]",
"+ or dp[i - 101]",
"+ or dp[i - 102]",
"+ or dp[i - 103]",
... | false | 0.040891 | 0.03695 | 1.106646 | [
"s219436709",
"s692247578"
] |
u086503932 | p03785 | python | s124510697 | s359129073 | 273 | 184 | 7,384 | 81,068 | Accepted | Accepted | 32.6 | N,C,K = list(map(int,input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
i = 0
ans = 0
while i < N:
tmp = i+1
while tmp < N:
if tmp < i+C and T[tmp] <= T[i]+K:
tmp += 1
else:
break
ans += 1
i = tmp
print(ans) | N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
T.append(10**12)
ans = 0
now = T[0]
i = 0
while i < N:
ans += 1
num = 0
while i < N and T[i] <= now+K and num < C:
num += 1
i += 1
now = T[i]
print(ans)
| 16 | 18 | 258 | 290 | N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
i = 0
ans = 0
while i < N:
tmp = i + 1
while tmp < N:
if tmp < i + C and T[tmp] <= T[i] + K:
tmp += 1
else:
break
ans += 1
i = tmp
print(ans)
| N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for _ in range(N)]
T.sort()
T.append(10**12)
ans = 0
now = T[0]
i = 0
while i < N:
ans += 1
num = 0
while i < N and T[i] <= now + K and num < C:
num += 1
i += 1
now = T[i]
print(ans)
| false | 11.111111 | [
"+T.append(10**12)",
"+ans = 0",
"+now = T[0]",
"-ans = 0",
"- tmp = i + 1",
"- while tmp < N:",
"- if tmp < i + C and T[tmp] <= T[i] + K:",
"- tmp += 1",
"- else:",
"- break",
"- i = tmp",
"+ num = 0",
"+ while i < N and T[i] <= now + K and... | false | 0.096876 | 0.056925 | 1.701833 | [
"s124510697",
"s359129073"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.