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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u297574184 | p02837 | python | s816027457 | s277761364 | 181 | 118 | 3,064 | 9,216 | Accepted | Accepted | 34.81 | N = int(eval(input()))
xyss = []
for i in range(N):
A = int(eval(input()))
xys = []
for j in range(A):
x, y = list(map(int, input().split()))
xys.append((x-1, y))
xyss.append(xys)
ans = 0
for S in range(2**N):
numHonest = 0
isOK = True
for i in range(N): # 人i
... | N = int(eval(input()))
xyss = [[] for _ in range(N)]
for i in range(N):
A = int(eval(input()))
for _ in range(A):
x, y = list(map(int, input().split()))
xyss[i].append((x-1, y))
ans = 0
for ptn in range(1<<N):
conflict = False
for i in range(N):
if (ptn>>i) & 1:
... | 32 | 25 | 645 | 585 | N = int(eval(input()))
xyss = []
for i in range(N):
A = int(eval(input()))
xys = []
for j in range(A):
x, y = list(map(int, input().split()))
xys.append((x - 1, y))
xyss.append(xys)
ans = 0
for S in range(2**N):
numHonest = 0
isOK = True
for i in range(N): # 人i
if (S... | N = int(eval(input()))
xyss = [[] for _ in range(N)]
for i in range(N):
A = int(eval(input()))
for _ in range(A):
x, y = list(map(int, input().split()))
xyss[i].append((x - 1, y))
ans = 0
for ptn in range(1 << N):
conflict = False
for i in range(N):
if (ptn >> i) & 1:
... | false | 21.875 | [
"-xyss = []",
"+xyss = [[] for _ in range(N)]",
"- xys = []",
"- for j in range(A):",
"+ for _ in range(A):",
"- xys.append((x - 1, y))",
"- xyss.append(xys)",
"+ xyss[i].append((x - 1, y))",
"-for S in range(2**N):",
"- numHonest = 0",
"- isOK = True",
"- fo... | false | 0.040395 | 0.04348 | 0.92904 | [
"s816027457",
"s277761364"
] |
u211236379 | p03071 | python | s348598466 | s571332123 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | A, B = list(map(int,input().split()))
ans = 0
if A <= B:
ans += B
if A <= B-1:
ans += B-1
else:
ans += A
else:
ans += A
if A-1 <= B:
ans += B
else:
ans += A-1
print(ans) | A, B = list(map(int, input().split()))
ans = 0
ans = max(ans, A + B)
ans = max(ans, A + A - 1)
ans = max(ans, B + B - 1)
print(ans)
| 15 | 7 | 233 | 133 | A, B = list(map(int, input().split()))
ans = 0
if A <= B:
ans += B
if A <= B - 1:
ans += B - 1
else:
ans += A
else:
ans += A
if A - 1 <= B:
ans += B
else:
ans += A - 1
print(ans)
| A, B = list(map(int, input().split()))
ans = 0
ans = max(ans, A + B)
ans = max(ans, A + A - 1)
ans = max(ans, B + B - 1)
print(ans)
| false | 53.333333 | [
"-if A <= B:",
"- ans += B",
"- if A <= B - 1:",
"- ans += B - 1",
"- else:",
"- ans += A",
"-else:",
"- ans += A",
"- if A - 1 <= B:",
"- ans += B",
"- else:",
"- ans += A - 1",
"+ans = max(ans, A + B)",
"+ans = max(ans, A + A - 1)",
"+ans =... | false | 0.048664 | 0.007959 | 6.114036 | [
"s348598466",
"s571332123"
] |
u222841610 | p03447 | python | s044009532 | s148442955 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
print(((x-a)%b)) | l = [int(eval(input())) for i in range(3)]
print(((l[0]-l[1]) % l[2])) | 4 | 2 | 69 | 64 | x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
print(((x - a) % b))
| l = [int(eval(input())) for i in range(3)]
print(((l[0] - l[1]) % l[2]))
| false | 50 | [
"-x = int(eval(input()))",
"-a = int(eval(input()))",
"-b = int(eval(input()))",
"-print(((x - a) % b))",
"+l = [int(eval(input())) for i in range(3)]",
"+print(((l[0] - l[1]) % l[2]))"
] | false | 0.057038 | 0.055896 | 1.020421 | [
"s044009532",
"s148442955"
] |
u678167152 | p03032 | python | s577669818 | s081983237 | 27 | 24 | 3,064 | 3,188 | Accepted | Accepted | 11.11 | def solve():
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
V *= 2
ans = 0
for i in range(N+1):
for j in range(N-1,2*N):
num = j-i+1
if num>K or num>N or num == 0:
continue
lis = V[i:j+1]
l... | N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
def solve(N,K,V):
ans = 0
V = V*2
for l in range(N+1):
for r in range(N-1,2*N):
n = r-l+1
if n == 0 or n>K or n>N:
continue
p = K-n
W = V[l:r+1]
... | 21 | 24 | 568 | 596 | def solve():
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
V *= 2
ans = 0
for i in range(N + 1):
for j in range(N - 1, 2 * N):
num = j - i + 1
if num > K or num > N or num == 0:
continue
lis = V[i : j + 1]
... | N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
def solve(N, K, V):
ans = 0
V = V * 2
for l in range(N + 1):
for r in range(N - 1, 2 * N):
n = r - l + 1
if n == 0 or n > K or n > N:
continue
p = K - n
W = V[... | false | 12.5 | [
"-def solve():",
"- N, K = list(map(int, input().split()))",
"- V = list(map(int, input().split()))",
"- V *= 2",
"+N, K = list(map(int, input().split()))",
"+V = list(map(int, input().split()))",
"+",
"+",
"+def solve(N, K, V):",
"- for i in range(N + 1):",
"- for j in range(... | false | 0.04186 | 0.097918 | 0.427501 | [
"s577669818",
"s081983237"
] |
u586857375 | p02712 | python | s938210618 | s757018648 | 112 | 24 | 30,020 | 9,180 | Accepted | Accepted | 78.57 | N = int(eval(input()))
none_num = [i for i in range(1, N+1) if i%3 != 0 and i%5 != 0]
none = sum(none_num)
print(none) | K = int(eval(input()))
x = (K+1) * K//2
num_devisible_three = (3+3*(K//3))*(K//3)//2
num_devisible_five = (5+5*(K//5))*(K//5)//2
num_devisible_fifteen = (15+15*(K//15))*(K//15)//2
print((x-num_devisible_three-num_devisible_five+num_devisible_fifteen)) | 4 | 6 | 115 | 248 | N = int(eval(input()))
none_num = [i for i in range(1, N + 1) if i % 3 != 0 and i % 5 != 0]
none = sum(none_num)
print(none)
| K = int(eval(input()))
x = (K + 1) * K // 2
num_devisible_three = (3 + 3 * (K // 3)) * (K // 3) // 2
num_devisible_five = (5 + 5 * (K // 5)) * (K // 5) // 2
num_devisible_fifteen = (15 + 15 * (K // 15)) * (K // 15) // 2
print((x - num_devisible_three - num_devisible_five + num_devisible_fifteen))
| false | 33.333333 | [
"-N = int(eval(input()))",
"-none_num = [i for i in range(1, N + 1) if i % 3 != 0 and i % 5 != 0]",
"-none = sum(none_num)",
"-print(none)",
"+K = int(eval(input()))",
"+x = (K + 1) * K // 2",
"+num_devisible_three = (3 + 3 * (K // 3)) * (K // 3) // 2",
"+num_devisible_five = (5 + 5 * (K // 5)) * (K /... | false | 0.239678 | 0.059728 | 4.012798 | [
"s938210618",
"s757018648"
] |
u863397945 | p02987 | python | s510043025 | s610482076 | 29 | 26 | 9,064 | 8,944 | Accepted | Accepted | 10.34 | x,y,z,w = eval(input())
l = []
l.append(x)
l.append(y)
l.append(z)
l.append(w)
new_l = sorted(l)
if new_l[0] == new_l[1] and new_l[1] != new_l[2] and new_l[2] == new_l[3]:
print("Yes")
else:
print("No") | S = eval(input())
S = sorted(S)
if S[0] == S[1] and S[2] == S[3] and S[1]!= S[2]:
print("Yes")
else:
print("No") | 13 | 8 | 218 | 123 | x, y, z, w = eval(input())
l = []
l.append(x)
l.append(y)
l.append(z)
l.append(w)
new_l = sorted(l)
if new_l[0] == new_l[1] and new_l[1] != new_l[2] and new_l[2] == new_l[3]:
print("Yes")
else:
print("No")
| S = eval(input())
S = sorted(S)
if S[0] == S[1] and S[2] == S[3] and S[1] != S[2]:
print("Yes")
else:
print("No")
| false | 38.461538 | [
"-x, y, z, w = eval(input())",
"-l = []",
"-l.append(x)",
"-l.append(y)",
"-l.append(z)",
"-l.append(w)",
"-new_l = sorted(l)",
"-if new_l[0] == new_l[1] and new_l[1] != new_l[2] and new_l[2] == new_l[3]:",
"+S = eval(input())",
"+S = sorted(S)",
"+if S[0] == S[1] and S[2] == S[3] and S[1] != S[... | false | 0.202573 | 0.123192 | 1.64437 | [
"s510043025",
"s610482076"
] |
u924691798 | p02707 | python | s665180974 | s693631409 | 235 | 209 | 48,644 | 34,744 | Accepted | Accepted | 11.06 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
dic = {}
for i in range(N):
dic[i] = 0
for a in list([int(x)-1 for x in input().split()]):
dic[a] += 1
for i in range(N):
if dic.get(i):
print((dic.get(i)))
else:
print((0))
| import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
A = list([int(x)-1 for x in input().split()])
dic = {}
for a in A:
dic[a] = dic.get(a, 0)+1
for i in range(N):
print((dic.get(i, 0))) | 15 | 11 | 306 | 239 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
dic = {}
for i in range(N):
dic[i] = 0
for a in list([int(x) - 1 for x in input().split()]):
dic[a] += 1
for i in range(N):
if dic.get(i):
print((dic.get(i)))
else:
print((0))
| import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
A = list([int(x) - 1 for x in input().split()])
dic = {}
for a in A:
dic[a] = dic.get(a, 0) + 1
for i in range(N):
print((dic.get(i, 0)))
| false | 26.666667 | [
"+A = list([int(x) - 1 for x in input().split()])",
"+for a in A:",
"+ dic[a] = dic.get(a, 0) + 1",
"- dic[i] = 0",
"-for a in list([int(x) - 1 for x in input().split()]):",
"- dic[a] += 1",
"-for i in range(N):",
"- if dic.get(i):",
"- print((dic.get(i)))",
"- else:",
"- ... | false | 0.032946 | 0.035901 | 0.91768 | [
"s665180974",
"s693631409"
] |
u143441425 | p02609 | python | s083939961 | s504332682 | 1,899 | 586 | 109,376 | 9,484 | Accepted | Accepted | 69.14 | from numba import njit
@njit('i8(i8)', cache=True)
def popcount(n):
a = 0
while n != 0:
a += n & 1
n >>= 1
return a
@njit('i8(i8)', cache=True)
def fun(n):
ops = 0
while n:
pc = popcount(n)
n %= pc
ops += 1
return ops
n = int(eval(inp... | def fun(n):
ops = 0
while n:
pc = format(n, 'b').count('1')
n %= pc
ops += 1
return ops
n = int(eval(input()))
xs = eval(input())
sm = int(xs, 2)
pc = xs.count('1')
mp = sm % (pc + 1)
mm = sm % (pc - 1) if pc > 1 else 0
for i, x in enumerate(xs, 1):
df = 1 i... | 46 | 32 | 876 | 588 | from numba import njit
@njit("i8(i8)", cache=True)
def popcount(n):
a = 0
while n != 0:
a += n & 1
n >>= 1
return a
@njit("i8(i8)", cache=True)
def fun(n):
ops = 0
while n:
pc = popcount(n)
n %= pc
ops += 1
return ops
n = int(eval(input()))
xs = list... | def fun(n):
ops = 0
while n:
pc = format(n, "b").count("1")
n %= pc
ops += 1
return ops
n = int(eval(input()))
xs = eval(input())
sm = int(xs, 2)
pc = xs.count("1")
mp = sm % (pc + 1)
mm = sm % (pc - 1) if pc > 1 else 0
for i, x in enumerate(xs, 1):
df = 1 if x == "0" else -1
... | false | 30.434783 | [
"-from numba import njit",
"-",
"-",
"-@njit(\"i8(i8)\", cache=True)",
"-def popcount(n):",
"- a = 0",
"- while n != 0:",
"- a += n & 1",
"- n >>= 1",
"- return a",
"-",
"-",
"-@njit(\"i8(i8)\", cache=True)",
"- pc = popcount(n)",
"+ pc = format(n, \"... | false | 0.045572 | 0.037935 | 1.201321 | [
"s083939961",
"s504332682"
] |
u753803401 | p03331 | python | s267644876 | s017858153 | 704 | 408 | 3,060 | 3,060 | Accepted | Accepted | 42.05 | n = int(eval(input()))
mt = 10 ** 9
for i in range(1, n):
t = 0
for j in range(len(str(i))):
t += int(str(i)[j])
for j in range(len(str(n - i))):
t += int(str(n - i)[j])
mt = min(mt, t)
print(mt)
| def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip('\n'))
m_t = 10 ** 10
for i in range(1, n):
a = list(map(int, list(str(i))))
b = list(map(int, list(str(n-i))))
m_t = min(m_t, sum(a) + sum(b))
print(m_t)
if __name__ == '__main__':
... | 10 | 14 | 231 | 331 | n = int(eval(input()))
mt = 10**9
for i in range(1, n):
t = 0
for j in range(len(str(i))):
t += int(str(i)[j])
for j in range(len(str(n - i))):
t += int(str(n - i)[j])
mt = min(mt, t)
print(mt)
| def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip("\n"))
m_t = 10**10
for i in range(1, n):
a = list(map(int, list(str(i))))
b = list(map(int, list(str(n - i))))
m_t = min(m_t, sum(a) + sum(b))
print(m_t)
if __name__ == "__main__":
slove()
| false | 28.571429 | [
"-n = int(eval(input()))",
"-mt = 10**9",
"-for i in range(1, n):",
"- t = 0",
"- for j in range(len(str(i))):",
"- t += int(str(i)[j])",
"- for j in range(len(str(n - i))):",
"- t += int(str(n - i)[j])",
"- mt = min(mt, t)",
"-print(mt)",
"+def slove():",
"+ impor... | false | 0.267845 | 0.131227 | 2.041074 | [
"s267644876",
"s017858153"
] |
u191874006 | p03037 | python | s121366990 | s354705069 | 319 | 276 | 3,060 | 41,196 | Accepted | Accepted | 13.48 | #!/usr/bin/env python3
import math
n,m = list(map(int,input().split(" ")))
s = 0
t = 10**5+1
for i in range(m):
a,b = list(map(int,input().split(" ")))
if s < a:
s = a
if b < t:
t = b
if t < s:
print((0))
else:
print((t-s+1)) | #!/usr/bin/env python3
#ABC127 C
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import ite... | 18 | 31 | 277 | 681 | #!/usr/bin/env python3
import math
n, m = list(map(int, input().split(" ")))
s = 0
t = 10**5 + 1
for i in range(m):
a, b = list(map(int, input().split(" ")))
if s < a:
s = a
if b < t:
t = b
if t < s:
print((0))
else:
print((t - s + 1))
| #!/usr/bin/env python3
# ABC127 C
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
fr... | false | 41.935484 | [
"+# ABC127 C",
"+import sys",
"+import bisect",
"-n, m = list(map(int, input().split(\" \")))",
"-s = 0",
"-t = 10**5 + 1",
"-for i in range(m):",
"- a, b = list(map(int, input().split(\" \")))",
"- if s < a:",
"- s = a",
"- if b < t:",
"- t = b",
"-if t < s:",
"+sys... | false | 0.043452 | 0.096587 | 0.449871 | [
"s121366990",
"s354705069"
] |
u656330453 | p02613 | python | s012879622 | s497325055 | 151 | 137 | 16,184 | 16,176 | Accepted | Accepted | 9.27 | n = int(eval(input()))
a = [eval(input()) for i in range(n)]
ac = 0
wa = 0
tle = 0
re = 0
for s in a:
if s=='AC':
ac+=1
if s=='WA':
wa+=1
if s=='TLE':
tle+=1
if s=='RE':
re+=1
print(f'AC x {ac}')
print(f'WA x {wa}')
print(f'TLE x {tle}')
print(f'RE x {re}')
| n = int(eval(input()))
a = [eval(input()) for i in range(n)]
for v in ['AC', 'WA', 'TLE', 'RE']:
print(f'{v} x {a.count(v)}')
| 20 | 6 | 294 | 127 | n = int(eval(input()))
a = [eval(input()) for i in range(n)]
ac = 0
wa = 0
tle = 0
re = 0
for s in a:
if s == "AC":
ac += 1
if s == "WA":
wa += 1
if s == "TLE":
tle += 1
if s == "RE":
re += 1
print(f"AC x {ac}")
print(f"WA x {wa}")
print(f"TLE x {tle}")
print(f"RE x {re}"... | n = int(eval(input()))
a = [eval(input()) for i in range(n)]
for v in ["AC", "WA", "TLE", "RE"]:
print(f"{v} x {a.count(v)}")
| false | 70 | [
"-ac = 0",
"-wa = 0",
"-tle = 0",
"-re = 0",
"-for s in a:",
"- if s == \"AC\":",
"- ac += 1",
"- if s == \"WA\":",
"- wa += 1",
"- if s == \"TLE\":",
"- tle += 1",
"- if s == \"RE\":",
"- re += 1",
"-print(f\"AC x {ac}\")",
"-print(f\"WA x {wa}\")... | false | 0.043713 | 0.040996 | 1.066265 | [
"s012879622",
"s497325055"
] |
u912237403 | p00156 | python | s401970575 | s338778003 | 930 | 650 | 12,484 | 12,416 | Accepted | Accepted | 30.11 | def ReadMap(n, m):
Map = [0] * m
for i in range(m):
a = input()
b = list(a)
if a.count('&')>0:
j = a.index('&')
PosCas = [j, i]
b[j] = '.'
Map[i] = b
return Map, PosCas
def fill(SP, c1, c2):
for x, y in SP:
if not (0 <= x < n and 0 <= y < m):
continue
... | def ReadMap(n, m):
Map = [0] * m
for i in range(m):
a = input()
b = list(a)
if a.count('&')>0:
j = a.index('&')
PosCas = [j, i]
b[j] = '.'
Map[i] = b
return Map, PosCas
def fill(SP, c1, c2):
for x, y in SP:
try:
if Map[y][x]!=c1:continue
except: c... | 44 | 44 | 869 | 844 | def ReadMap(n, m):
Map = [0] * m
for i in range(m):
a = input()
b = list(a)
if a.count("&") > 0:
j = a.index("&")
PosCas = [j, i]
b[j] = "."
Map[i] = b
return Map, PosCas
def fill(SP, c1, c2):
for x, y in SP:
if not (0 <= x < ... | def ReadMap(n, m):
Map = [0] * m
for i in range(m):
a = input()
b = list(a)
if a.count("&") > 0:
j = a.index("&")
PosCas = [j, i]
b[j] = "."
Map[i] = b
return Map, PosCas
def fill(SP, c1, c2):
for x, y in SP:
try:
... | false | 0 | [
"- if not (0 <= x < n and 0 <= y < m):",
"- continue",
"- if Map[y][x] != c1:",
"+ try:",
"+ if Map[y][x] != c1:",
"+ continue",
"+ except:"
] | false | 0.183448 | 0.111772 | 1.641265 | [
"s401970575",
"s338778003"
] |
u803848678 | p03600 | python | s216965046 | s176847925 | 926 | 759 | 44,892 | 44,764 | Accepted | Accepted | 18.03 | n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
b = [[1]*n for i in range(n)]
for i in range(n):
for j in range(n):
for k in range(n):
if a[i][k] + a[k][j] < a[i][j]:
print((-1))
exit()
elif a[i][k] + a[k][j] =... | n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
b = [[1]*n for i in range(n)]
for k in range(n):
for i in range(n):
for j in range(n):
if a[i][k] + a[k][j] < a[i][j]:
print((-1))
exit()
elif a[i][k] + a[k][j] =... | 19 | 19 | 482 | 482 | n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
b = [[1] * n for i in range(n)]
for i in range(n):
for j in range(n):
for k in range(n):
if a[i][k] + a[k][j] < a[i][j]:
print((-1))
exit()
elif a[i][k] + a[k][j] == a[i][j]... | n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
b = [[1] * n for i in range(n)]
for k in range(n):
for i in range(n):
for j in range(n):
if a[i][k] + a[k][j] < a[i][j]:
print((-1))
exit()
elif a[i][k] + a[k][j] == a[i][j]... | false | 0 | [
"-for i in range(n):",
"- for j in range(n):",
"- for k in range(n):",
"+for k in range(n):",
"+ for i in range(n):",
"+ for j in range(n):"
] | false | 0.065226 | 0.041458 | 1.573299 | [
"s216965046",
"s176847925"
] |
u173148629 | p02623 | python | s272171630 | s259190439 | 407 | 325 | 47,368 | 47,360 | Accepted | Accepted | 20.15 | N,M,K=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
A_sum=[0,A[0]]
B_sum=[0,B[0]]
for i in range(1,N):
A_sum.append(A_sum[i]+A[i])
for i in range(1,M):
B_sum.append(B_sum[i]+B[i])
b_read=0
ans=0
for i in range(N,-1,-1):
for j in range(b_read... | N,M,K=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
import bisect
A_sum=[0]
B_sum=[0]
for i in range(N):
A_sum.append(A_sum[i]+A[i])
for i in range(M):
B_sum.append(B_sum[i]+B[i])
ans=0
for i in range(N+1):
if A_sum[i]>K:
continue
... | 21 | 18 | 453 | 402 | N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_sum = [0, A[0]]
B_sum = [0, B[0]]
for i in range(1, N):
A_sum.append(A_sum[i] + A[i])
for i in range(1, M):
B_sum.append(B_sum[i] + B[i])
b_read = 0
ans = 0
for i in range(N, -1, -1):
for j in... | N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
import bisect
A_sum = [0]
B_sum = [0]
for i in range(N):
A_sum.append(A_sum[i] + A[i])
for i in range(M):
B_sum.append(B_sum[i] + B[i])
ans = 0
for i in range(N + 1):
if A_sum[i] > K:
c... | false | 14.285714 | [
"-A_sum = [0, A[0]]",
"-B_sum = [0, B[0]]",
"-for i in range(1, N):",
"+import bisect",
"+",
"+A_sum = [0]",
"+B_sum = [0]",
"+for i in range(N):",
"-for i in range(1, M):",
"+for i in range(M):",
"-b_read = 0",
"-for i in range(N, -1, -1):",
"- for j in range(b_read, M + 1):",
"- ... | false | 0.040967 | 0.043136 | 0.949733 | [
"s272171630",
"s259190439"
] |
u721425712 | p03478 | python | s162086136 | s334307369 | 31 | 25 | 3,060 | 3,060 | Accepted | Accepted | 19.35 | def degitsum(n):
ans = 0
while n/10 != 0:
ans += n%10
n = int(n/10)
return ans
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
if a <= degitsum(i) <= b:
ans += i
else:
continue
print(ans) | # B
# 2020/03/06 14:34-
n, a, b = list(map(int, input().split()))
def SumDegit(x):
ans = 0
while x > 0:
ans += x%10
x = x//10
return ans
ans = 0
for i in range(1, n+1):
if a <= SumDegit(i) <= b:
ans += i
print(ans) | 17 | 17 | 286 | 275 | def degitsum(n):
ans = 0
while n / 10 != 0:
ans += n % 10
n = int(n / 10)
return ans
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
if a <= degitsum(i) <= b:
ans += i
else:
continue
print(ans)
| # B
# 2020/03/06 14:34-
n, a, b = list(map(int, input().split()))
def SumDegit(x):
ans = 0
while x > 0:
ans += x % 10
x = x // 10
return ans
ans = 0
for i in range(1, n + 1):
if a <= SumDegit(i) <= b:
ans += i
print(ans)
| false | 0 | [
"-def degitsum(n):",
"+# B",
"+# 2020/03/06 14:34-",
"+n, a, b = list(map(int, input().split()))",
"+",
"+",
"+def SumDegit(x):",
"- while n / 10 != 0:",
"- ans += n % 10",
"- n = int(n / 10)",
"+ while x > 0:",
"+ ans += x % 10",
"+ x = x // 10",
"-n, a, ... | false | 0.046324 | 0.042989 | 1.077583 | [
"s162086136",
"s334307369"
] |
u316386814 | p03033 | python | s579522478 | s325522840 | 1,336 | 1,230 | 58,548 | 65,564 | Accepted | Accepted | 7.93 | import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().spl... | import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LLI(): return [int(x) for x in sys.stdin.readlines()]
def LF(): return [float(x) for x in sys.stdin.rea... | 39 | 38 | 1,015 | 1,029 | import sys
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.... | import sys
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LLI():
return [int(x) for x in sys.stdin.readlines()]
def LF():
return [float(x) for x in... | false | 2.564103 | [
"+",
"+",
"+def LLI():",
"+ return [int(x) for x in sys.stdin.readlines()]",
"- D = []",
"- for _ in range(Q):",
"- D.append(II())",
"+ XST.sort()",
"+ D = LLI()",
"- XST.sort()"
] | false | 0.042638 | 0.041788 | 1.020348 | [
"s579522478",
"s325522840"
] |
u075303794 | p03834 | python | s035017968 | s676304593 | 26 | 24 | 8,988 | 9,028 | Accepted | Accepted | 7.69 | S=list(input().split(','))
print((S[0],S[1],S[2])) | S=list(input().split(','))
print((*S)) | 2 | 2 | 49 | 37 | S = list(input().split(","))
print((S[0], S[1], S[2]))
| S = list(input().split(","))
print((*S))
| false | 0 | [
"-print((S[0], S[1], S[2]))",
"+print((*S))"
] | false | 0.043694 | 0.040339 | 1.083173 | [
"s035017968",
"s676304593"
] |
u982591663 | p03565 | python | s875084529 | s235575123 | 21 | 17 | 3,188 | 3,064 | Accepted | Accepted | 19.05 | import re
S = str(eval(input()))
T = str(eval(input()))
S = S.replace("?",".")
for i in range(len(S)-len(T),-1,-1):
if re.match(S[i:i+len(T)],T):
S = S.replace('.','a')
print((S[:i]+T+S[i+len(T):]))
exit()
print('UNRESTORABLE')
| S = list(eval(input()))
N = len(S)
T = eval(input())
M = len(T)
ans = []
for i in range(N-M+1):
tmp_S = S[:]
if S[i] == "?" or S[i] == T[0]:
tmp_S[i] = T[0]
tmp = 1
for j in range(i+1, i+M):
if S[j] == "?" or S[j] == T[tmp]:
tmp_S[i+tmp] = T[tm... | 12 | 28 | 241 | 591 | import re
S = str(eval(input()))
T = str(eval(input()))
S = S.replace("?", ".")
for i in range(len(S) - len(T), -1, -1):
if re.match(S[i : i + len(T)], T):
S = S.replace(".", "a")
print((S[:i] + T + S[i + len(T) :]))
exit()
print("UNRESTORABLE")
| S = list(eval(input()))
N = len(S)
T = eval(input())
M = len(T)
ans = []
for i in range(N - M + 1):
tmp_S = S[:]
if S[i] == "?" or S[i] == T[0]:
tmp_S[i] = T[0]
tmp = 1
for j in range(i + 1, i + M):
if S[j] == "?" or S[j] == T[tmp]:
tmp_S[i + tmp] = T[tmp]
... | false | 57.142857 | [
"-import re",
"-",
"-S = str(eval(input()))",
"-T = str(eval(input()))",
"-S = S.replace(\"?\", \".\")",
"-for i in range(len(S) - len(T), -1, -1):",
"- if re.match(S[i : i + len(T)], T):",
"- S = S.replace(\".\", \"a\")",
"- print((S[:i] + T + S[i + len(T) :]))",
"- exit()... | false | 0.079221 | 0.036767 | 2.154707 | [
"s875084529",
"s235575123"
] |
u860002137 | p02726 | python | s191094008 | s932617596 | 1,598 | 1,073 | 3,956 | 9,456 | Accepted | Accepted | 32.85 | from collections import defaultdict
n, x, y = list(map(int, input().split()))
d = defaultdict(int)
for i in range(1, n):
for j in range(i + 1, n + 1):
a = j - i
b = abs(x - i) + 1 + abs(y - j)
d[min(a, b)] += 1
for i in range(1, n):
print((d[i])) | from collections import defaultdict
n, x, y = list(map(int, input().split()))
d = defaultdict(int)
for i in range(1, n):
for j in range(i + 1, n + 1):
d[min(j - i, abs(x - i) + abs(y - j) + 1)] += 1
for i in range(1, n):
print((d[i])) | 14 | 12 | 287 | 257 | from collections import defaultdict
n, x, y = list(map(int, input().split()))
d = defaultdict(int)
for i in range(1, n):
for j in range(i + 1, n + 1):
a = j - i
b = abs(x - i) + 1 + abs(y - j)
d[min(a, b)] += 1
for i in range(1, n):
print((d[i]))
| from collections import defaultdict
n, x, y = list(map(int, input().split()))
d = defaultdict(int)
for i in range(1, n):
for j in range(i + 1, n + 1):
d[min(j - i, abs(x - i) + abs(y - j) + 1)] += 1
for i in range(1, n):
print((d[i]))
| false | 14.285714 | [
"- a = j - i",
"- b = abs(x - i) + 1 + abs(y - j)",
"- d[min(a, b)] += 1",
"+ d[min(j - i, abs(x - i) + abs(y - j) + 1)] += 1"
] | false | 0.098231 | 0.036302 | 2.705946 | [
"s191094008",
"s932617596"
] |
u427690532 | p02766 | python | s509996192 | s237011080 | 26 | 23 | 9,188 | 9,120 | Accepted | Accepted | 11.54 | #https://atcoder.jp/contests/abc156/tasks/abc156_b
N,K = list(map(int,input().split()))
q, mod = divmod(N,K)
mod_list = [mod]
while True:
q , mod =divmod(q,K)
mod_list.append(mod)
#print(q)
#print(mod)
if q <=0 :
break
if mod_list[-1] == 0:
result = len(mod_list) - 1
else:
... | #https://atcoder.jp/contests/abc156/tasks/abc156_b
N,K = list(map(int,input().split()))
q, mod = divmod(N,K)
mod_list = [mod]
while True:
q , mod =divmod(q,K)
mod_list.append(mod)
if q <=0 :
break
n_ary = int("".join(map(str,mod_list[::-1])))
print((len(str(n_ary)))) | 16 | 12 | 354 | 291 | # https://atcoder.jp/contests/abc156/tasks/abc156_b
N, K = list(map(int, input().split()))
q, mod = divmod(N, K)
mod_list = [mod]
while True:
q, mod = divmod(q, K)
mod_list.append(mod)
# print(q)
# print(mod)
if q <= 0:
break
if mod_list[-1] == 0:
result = len(mod_list) - 1
else:
res... | # https://atcoder.jp/contests/abc156/tasks/abc156_b
N, K = list(map(int, input().split()))
q, mod = divmod(N, K)
mod_list = [mod]
while True:
q, mod = divmod(q, K)
mod_list.append(mod)
if q <= 0:
break
n_ary = int("".join(map(str, mod_list[::-1])))
print((len(str(n_ary))))
| false | 25 | [
"- # print(q)",
"- # print(mod)",
"-if mod_list[-1] == 0:",
"- result = len(mod_list) - 1",
"-else:",
"- result = len(mod_list)",
"-print(result)",
"+n_ary = int(\"\".join(map(str, mod_list[::-1])))",
"+print((len(str(n_ary))))"
] | false | 0.03785 | 0.040345 | 0.93816 | [
"s509996192",
"s237011080"
] |
u263830634 | p03475 | python | s849272119 | s773030894 | 114 | 101 | 3,188 | 3,188 | Accepted | Accepted | 11.4 | N = int(eval(input()))
lst = []
for i in range(N-1):
lst += [list(map(int, input().split()))]
# print (lst)
for i in range(N):
t = 0
for j in range(i, N-1):
# print ('j', j)
t = (max(lst[j][1], t)+lst[j][2] -1)//lst[j][2]*lst[j][2] + lst[j][0]
# print ('t', t)
print ... | import sys
input = sys.stdin.readline
N = int(eval(input()))
CSF = [tuple(map(int, input().split())) for _ in range(N - 1)]
def calc(x): #xからの客がNに到達するのにかかる時間
tmp = 0
for i in range(x, N - 1):
tmp = max((tmp + CSF[i][2] - 1) // CSF[i][2] * CSF[i][2], CSF[i][1]) + CSF[i][0]
return tmp
... | 13 | 15 | 317 | 355 | N = int(eval(input()))
lst = []
for i in range(N - 1):
lst += [list(map(int, input().split()))]
# print (lst)
for i in range(N):
t = 0
for j in range(i, N - 1):
# print ('j', j)
t = (max(lst[j][1], t) + lst[j][2] - 1) // lst[j][2] * lst[j][2] + lst[j][0]
# print ('t', t)
print(t)... | import sys
input = sys.stdin.readline
N = int(eval(input()))
CSF = [tuple(map(int, input().split())) for _ in range(N - 1)]
def calc(x): # xからの客がNに到達するのにかかる時間
tmp = 0
for i in range(x, N - 1):
tmp = max((tmp + CSF[i][2] - 1) // CSF[i][2] * CSF[i][2], CSF[i][1]) + CSF[i][0]
return tmp
for i in ... | false | 13.333333 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-lst = []",
"-for i in range(N - 1):",
"- lst += [list(map(int, input().split()))]",
"-# print (lst)",
"+CSF = [tuple(map(int, input().split())) for _ in range(N - 1)]",
"+",
"+",
"+def calc(x): # xからの客がNに到達するのにかかる時間",
"+ tmp = 0",
"... | false | 0.03536 | 0.036434 | 0.970543 | [
"s849272119",
"s773030894"
] |
u620480037 | p02600 | python | s240019470 | s604162482 | 70 | 29 | 61,860 | 9,012 | Accepted | Accepted | 58.57 | X=int(eval(input()))
A=X//200
print((10-A)) | X=int(eval(input()))
print((10-X//200)) | 3 | 3 | 37 | 34 | X = int(eval(input()))
A = X // 200
print((10 - A))
| X = int(eval(input()))
print((10 - X // 200))
| false | 0 | [
"-A = X // 200",
"-print((10 - A))",
"+print((10 - X // 200))"
] | false | 0.10753 | 0.045898 | 2.342793 | [
"s240019470",
"s604162482"
] |
u437215432 | p02572 | python | s916503744 | s954227810 | 175 | 155 | 31,556 | 31,660 | Accepted | Accepted | 11.43 | n = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * n
b[-1]= a[-1]
total = 0
mod = 10**9 + 7
for i in range(n-2, 0, -1):
b[i] = a[i] + b[i + 1]
for i in range(n-1):
total = (total + (a[i] * b[i + 1]) % mod) % mod
print(total)
| n = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * n
b[-1]= a[-1]
total = 0
mod = 10**9 + 7
cumsum = sum(a)
for i in range(n-1):
cumsum -= a[i]
total = (total + (a[i] * cumsum) % mod) % mod
print(total) | 11 | 11 | 255 | 232 | n = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * n
b[-1] = a[-1]
total = 0
mod = 10**9 + 7
for i in range(n - 2, 0, -1):
b[i] = a[i] + b[i + 1]
for i in range(n - 1):
total = (total + (a[i] * b[i + 1]) % mod) % mod
print(total)
| n = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * n
b[-1] = a[-1]
total = 0
mod = 10**9 + 7
cumsum = sum(a)
for i in range(n - 1):
cumsum -= a[i]
total = (total + (a[i] * cumsum) % mod) % mod
print(total)
| false | 0 | [
"-for i in range(n - 2, 0, -1):",
"- b[i] = a[i] + b[i + 1]",
"+cumsum = sum(a)",
"- total = (total + (a[i] * b[i + 1]) % mod) % mod",
"+ cumsum -= a[i]",
"+ total = (total + (a[i] * cumsum) % mod) % mod"
] | false | 0.075954 | 0.077425 | 0.981002 | [
"s916503744",
"s954227810"
] |
u022407960 | p02237 | python | s183013244 | s603209686 | 50 | 30 | 8,520 | 8,344 | Accepted | Accepted | 40 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def generate_graph(v_info):
for info in v_info:
adj_info = info[2:]
for each in adj_info:
adj_matrix[int(info[0]) - 1][int(each) - 1] = 1
return adj_matrix
if __name__ == '__main__':
_input = sys.stdin... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def generate_graph(v_info):
for info in v_info:
adj_info = info[2:]
assert len(adj_info) == int(info[1])
for each in adj_info:
adj_matrix[int(info[0]) - 1][int(each) - 1] = 1
return adj_matrix
if _... | 25 | 26 | 629 | 675 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def generate_graph(v_info):
for info in v_info:
adj_info = info[2:]
for each in adj_info:
adj_matrix[int(info[0]) - 1][int(each) - 1] = 1
return adj_matrix
if __name__ == "__main__":
_input = sys.stdin.readlines()
v... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def generate_graph(v_info):
for info in v_info:
adj_info = info[2:]
assert len(adj_info) == int(info[1])
for each in adj_info:
adj_matrix[int(info[0]) - 1][int(each) - 1] = 1
return adj_matrix
if __name__ == "__main... | false | 3.846154 | [
"+ assert len(adj_info) == int(info[1])"
] | false | 0.083852 | 0.077074 | 1.087945 | [
"s183013244",
"s603209686"
] |
u863370423 | p03264 | python | s761674175 | s962355886 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | s= int(eval(input()))
if s%2==0:
print((int((s//2)**2)))
else:
print((int((s//2)*(s//2+1))))
| K = int(eval(input()))
x = 0
for i in range (0,K,1):
if i % 2 == 0:
x +=1
sum = x * (K-x)
print(sum) | 6 | 7 | 97 | 112 | s = int(eval(input()))
if s % 2 == 0:
print((int((s // 2) ** 2)))
else:
print((int((s // 2) * (s // 2 + 1))))
| K = int(eval(input()))
x = 0
for i in range(0, K, 1):
if i % 2 == 0:
x += 1
sum = x * (K - x)
print(sum)
| false | 14.285714 | [
"-s = int(eval(input()))",
"-if s % 2 == 0:",
"- print((int((s // 2) ** 2)))",
"-else:",
"- print((int((s // 2) * (s // 2 + 1))))",
"+K = int(eval(input()))",
"+x = 0",
"+for i in range(0, K, 1):",
"+ if i % 2 == 0:",
"+ x += 1",
"+sum = x * (K - x)",
"+print(sum)"
] | false | 0.046185 | 0.0357 | 1.293714 | [
"s761674175",
"s962355886"
] |
u852690916 | p03361 | python | s451331120 | s994204907 | 177 | 20 | 39,152 | 3,064 | Accepted | Accepted | 88.7 | H,W=list(map(int, input().split()))
S=[list(eval(input())) for _ in range(H)]
for i in range(H):
for j in range(W):
if S[i][j]=='.': continue
if 0<i and S[i-1][j]=='#': continue
if i<H-1 and S[i+1][j]=='#': continue
if 0<j and S[i][j-1]=='#': continue
if j<W-1 and S[i... | H,W=list(map(int, input().split()))
S=[eval(input()) for _ in range(H)]
for i in range(H):
for j in range(W):
if S[i][j]=='#':
for ni,nj in ((i+1,j),(i-1,j),(i,j+1),(i,j-1)):
if 0<=ni<H and 0<=nj<W and S[ni][nj]=='#':
break
else:
... | 12 | 13 | 380 | 366 | H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
for i in range(H):
for j in range(W):
if S[i][j] == ".":
continue
if 0 < i and S[i - 1][j] == "#":
continue
if i < H - 1 and S[i + 1][j] == "#":
continue
if 0 < j an... | H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
for i in range(H):
for j in range(W):
if S[i][j] == "#":
for ni, nj in ((i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)):
if 0 <= ni < H and 0 <= nj < W and S[ni][nj] == "#":
break
... | false | 7.692308 | [
"-S = [list(eval(input())) for _ in range(H)]",
"+S = [eval(input()) for _ in range(H)]",
"- if S[i][j] == \".\":",
"- continue",
"- if 0 < i and S[i - 1][j] == \"#\":",
"- continue",
"- if i < H - 1 and S[i + 1][j] == \"#\":",
"- continue",
"- ... | false | 0.16062 | 0.037305 | 4.305545 | [
"s451331120",
"s994204907"
] |
u019685451 | p02625 | python | s248603324 | s349720220 | 1,724 | 1,180 | 48,172 | 48,232 | Accepted | Accepted | 31.55 | '''
Let g(x) = 序列內數字唯一,且最多 x 個位置不同。
Let f(x) = 序列內數字唯一,且給定 x 個位置時,使這些位置不同的方法數。
題目所求是 C(N, N) f(N)。
其中 g(x) 代表有至少 N - x 個位置是相同。可以分三個部份填數字,注意順序會影響,所以要乘上全排序:
(1) N - x 個位置(數字必需相同):C(M, N - x) * (N - x)! = P(M, N - x)
(2) 序列 A 其餘位置(可以隨便填,但不能用到 (1) 的數字):C(M - (N - x), x) * x! = P(M - (N - x), x)
(3) 序列 B 其餘位置(可以隨... | '''
Let g(x) = 序列內數字唯一,且最多 x 個位置不同。
Let f(x) = 序列內數字唯一,且給定 x 個位置時,使這些位置不同的方法數。
題目所求是 C(N, N) f(N)。
其中 g(x) 代表有至少 N - x 個位置是相同。可以分三個部份填數字,注意順序會影響,所以要乘上全排序:
(1) N - x 個位置(數字必需相同):C(M, N - x) * (N - x)! = P(M, N - x)
(2) 序列 A 其餘位置(可以隨便填,但不能用到 (1) 的數字):C(M - (N - x), x) * x! = P(M - (N - x), x)
(3) 序列 B 其餘位置(可以隨... | 59 | 60 | 1,776 | 1,811 | """
Let g(x) = 序列內數字唯一,且最多 x 個位置不同。
Let f(x) = 序列內數字唯一,且給定 x 個位置時,使這些位置不同的方法數。
題目所求是 C(N, N) f(N)。
其中 g(x) 代表有至少 N - x 個位置是相同。可以分三個部份填數字,注意順序會影響,所以要乘上全排序:
(1) N - x 個位置(數字必需相同):C(M, N - x) * (N - x)! = P(M, N - x)
(2) 序列 A 其餘位置(可以隨便填,但不能用到 (1) 的數字):C(M - (N - x), x) * x! = P(M - (N - x), x)
(3) 序列 B 其餘位置(可以隨便填,但不能用到 (1... | """
Let g(x) = 序列內數字唯一,且最多 x 個位置不同。
Let f(x) = 序列內數字唯一,且給定 x 個位置時,使這些位置不同的方法數。
題目所求是 C(N, N) f(N)。
其中 g(x) 代表有至少 N - x 個位置是相同。可以分三個部份填數字,注意順序會影響,所以要乘上全排序:
(1) N - x 個位置(數字必需相同):C(M, N - x) * (N - x)! = P(M, N - x)
(2) 序列 A 其餘位置(可以隨便填,但不能用到 (1) 的數字):C(M - (N - x), x) * x! = P(M - (N - x), x)
(3) 序列 B 其餘位置(可以隨便填,但不能用到 (1... | false | 1.666667 | [
"-ans = 0",
"+f_N = 0",
"- val = pow(-1, N - i, mod) * tool.comb(N, i) % mod * g_i % mod",
"- ans = (ans + val) % mod",
"+ val = (-1) ** ((N - i) % 2) * tool.comb(N, i) % mod * g_i % mod",
"+ f_N = (f_N + val) % mod",
"+ans = tool.comb(N, N) * f_N % mod"
] | false | 0.248946 | 0.189809 | 1.311557 | [
"s248603324",
"s349720220"
] |
u794544096 | p02988 | python | s261445529 | s173115853 | 87 | 70 | 61,752 | 61,976 | Accepted | Accepted | 19.54 | n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(n - 2):
l = p[i:i+3]
L = sorted(l)
if l[1] == L[1]:
cnt += 1
print(cnt) | n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(n-2):
P = p[i:i+3]
if P[0] < P[1] < P[2]:
cnt += 1
elif P[2] < P[1] < P[0]:
cnt += 1
print(cnt) | 10 | 12 | 185 | 221 | n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(n - 2):
l = p[i : i + 3]
L = sorted(l)
if l[1] == L[1]:
cnt += 1
print(cnt)
| n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(n - 2):
P = p[i : i + 3]
if P[0] < P[1] < P[2]:
cnt += 1
elif P[2] < P[1] < P[0]:
cnt += 1
print(cnt)
| false | 16.666667 | [
"- l = p[i : i + 3]",
"- L = sorted(l)",
"- if l[1] == L[1]:",
"+ P = p[i : i + 3]",
"+ if P[0] < P[1] < P[2]:",
"+ cnt += 1",
"+ elif P[2] < P[1] < P[0]:"
] | false | 0.04748 | 0.116514 | 0.407501 | [
"s261445529",
"s173115853"
] |
u621935300 | p03660 | python | s786538595 | s816865759 | 588 | 334 | 30,324 | 48,540 | Accepted | Accepted | 43.2 | # -*- coding: utf-8 -*-
#Python
import sys
N=eval(input())
adj=[[] for i in range(N+1)]
#隣接リスト
for i in range(N-1):
x,y=list(map(int,input().split()))
adj[x].append(y)
adj[y].append(x)
#print adj
#訪問判別フラグ
F=(N+1)*[0]
#Stack
S=[]
#距離
dist=(N+1)*[0]
#先頭から深さ優先探索
S.append(1)
w... | # -*- coding: utf-8 -*-
import sys
from collections import deque
N=eval(input())
nl=[ [] for i in range(N+1)]
D=[ 0 for i in range(N+1)] # No.1からの距離
V=[ 0 for i in range(N+1)] # 訪問済みフラグ
for i in range(N-1):
a,b=list(map(int, sys.stdin.readline().split()))
nl[a].append(b)
nl[b].append(a)
def bfs(... | 89 | 90 | 1,013 | 1,325 | # -*- coding: utf-8 -*-
# Python
import sys
N = eval(input())
adj = [[] for i in range(N + 1)]
# 隣接リスト
for i in range(N - 1):
x, y = list(map(int, input().split()))
adj[x].append(y)
adj[y].append(x)
# print adj
# 訪問判別フラグ
F = (N + 1) * [0]
# Stack
S = []
# 距離
dist = (N + 1) * [0]
# 先頭から深さ優先探索
S.append(1)
wh... | # -*- coding: utf-8 -*-
import sys
from collections import deque
N = eval(input())
nl = [[] for i in range(N + 1)]
D = [0 for i in range(N + 1)] # No.1からの距離
V = [0 for i in range(N + 1)] # 訪問済みフラグ
for i in range(N - 1):
a, b = list(map(int, sys.stdin.readline().split()))
nl[a].append(b)
nl[b].append(a)
... | false | 1.111111 | [
"-# Python",
"+from collections import deque",
"-adj = [[] for i in range(N + 1)]",
"-# 隣接リスト",
"+nl = [[] for i in range(N + 1)]",
"+D = [0 for i in range(N + 1)] # No.1からの距離",
"+V = [0 for i in range(N + 1)] # 訪問済みフラグ",
"- x, y = list(map(int, input().split()))",
"- adj[x].append(y)",
"-... | false | 0.041265 | 0.042108 | 0.979991 | [
"s786538595",
"s816865759"
] |
u254871849 | p03625 | python | s756939847 | s750193310 | 248 | 219 | 20,956 | 20,956 | Accepted | Accepted | 11.69 | from sys import stdin
n, *a = list(map(int, stdin.read().split()))
a.sort(reverse=1)
l_count = {}
for l in a:
l_count.update({l: l_count.get(l, 0) + 1})
long_side, short_side = 0, 0
for l, c in sorted(list(l_count.items()), reverse=1):
if c != 1:
if not long_side:
if c ... | from sys import stdin
n, *a = list(map(int, stdin.read().split()))
l_count = {}
for l in a:
l_count.update({l: l_count.get(l, 0) + 1})
long_side, short_side = 0, 0
for l, c in sorted(list(l_count.items()), reverse=1):
if c != 1:
if not long_side:
if c >= 4:
... | 23 | 22 | 513 | 491 | from sys import stdin
n, *a = list(map(int, stdin.read().split()))
a.sort(reverse=1)
l_count = {}
for l in a:
l_count.update({l: l_count.get(l, 0) + 1})
long_side, short_side = 0, 0
for l, c in sorted(list(l_count.items()), reverse=1):
if c != 1:
if not long_side:
if c >= 4:
... | from sys import stdin
n, *a = list(map(int, stdin.read().split()))
l_count = {}
for l in a:
l_count.update({l: l_count.get(l, 0) + 1})
long_side, short_side = 0, 0
for l, c in sorted(list(l_count.items()), reverse=1):
if c != 1:
if not long_side:
if c >= 4:
print((l**2))
... | false | 4.347826 | [
"-a.sort(reverse=1)"
] | false | 0.09048 | 0.043528 | 2.078669 | [
"s756939847",
"s750193310"
] |
u547167033 | p02803 | python | s143699178 | s547940894 | 547 | 328 | 3,316 | 46,428 | Accepted | Accepted | 40.04 | from collections import deque
def bfs(loc):
global ans
d=[[float('inf')]*w for i in range(h)]
dx=[1,0,-1,0]
dy=[0,1,0,-1]
que=deque([])
que.append(loc)
d[loc[0]][loc[1]]=0
while que:
p=que.popleft()
for i in range(4):
nx=p[0]+dx[i]
ny=p[1]+dy[i]
if 0<=nx<h and 0<=... | from collections import deque
def bfs(yy,xx):
global ans
d=[[float('inf')]*w for i in range(h)]
dx=[1,0,-1,0]
dy=[0,1,0,-1]
q=deque([])
q.append((yy,xx))
d[yy][xx]=0
while q:
y,x=q.popleft()
for i in range(4):
ny,nx=y+dy[i],x+dx[i]
if 0<=ny<h and 0<=nx<w and s[ny][nx]=='... | 32 | 28 | 721 | 651 | from collections import deque
def bfs(loc):
global ans
d = [[float("inf")] * w for i in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
que = deque([])
que.append(loc)
d[loc[0]][loc[1]] = 0
while que:
p = que.popleft()
for i in range(4):
nx = p[0] + dx[i]
... | from collections import deque
def bfs(yy, xx):
global ans
d = [[float("inf")] * w for i in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
q = deque([])
q.append((yy, xx))
d[yy][xx] = 0
while q:
y, x = q.popleft()
for i in range(4):
ny, nx = y + dy[i], x + d... | false | 12.5 | [
"-def bfs(loc):",
"+def bfs(yy, xx):",
"- que = deque([])",
"- que.append(loc)",
"- d[loc[0]][loc[1]] = 0",
"- while que:",
"- p = que.popleft()",
"+ q = deque([])",
"+ q.append((yy, xx))",
"+ d[yy][xx] = 0",
"+ while q:",
"+ y, x = q.popleft()",
"- ... | false | 0.100304 | 0.0404 | 2.482779 | [
"s143699178",
"s547940894"
] |
u172147273 | p03238 | python | s447877035 | s410566637 | 168 | 29 | 38,256 | 9,088 | Accepted | Accepted | 82.74 | import math
def ip():return int(eval(input()))
def imp():return list(map(int,input().split()))
n=ip()
if n==1:print("Hello World")
else:
a=ip()
b=ip()
print((a+b)) | n=int(eval(input()))
if n==1:print("Hello World")
else:print((int(eval(input()))+int(eval(input())))) | 10 | 3 | 171 | 83 | import math
def ip():
return int(eval(input()))
def imp():
return list(map(int, input().split()))
n = ip()
if n == 1:
print("Hello World")
else:
a = ip()
b = ip()
print((a + b))
| n = int(eval(input()))
if n == 1:
print("Hello World")
else:
print((int(eval(input())) + int(eval(input()))))
| false | 70 | [
"-import math",
"-",
"-",
"-def ip():",
"- return int(eval(input()))",
"-",
"-",
"-def imp():",
"- return list(map(int, input().split()))",
"-",
"-",
"-n = ip()",
"+n = int(eval(input()))",
"- a = ip()",
"- b = ip()",
"- print((a + b))",
"+ print((int(eval(input()))... | false | 0.037475 | 0.0929 | 0.403394 | [
"s447877035",
"s410566637"
] |
u057964173 | p03403 | python | s361345060 | s545594216 | 416 | 369 | 66,848 | 65,004 | Accepted | Accepted | 11.3 | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n=int(eval(input()))
l=[0]+list(map(int,input().split()))+[0]
max=0
for i in range(n+1):
max+=abs(l[i+1]-l[i])
for j in range(1,n+1):
if l[j-1]<l[j]<l[j+1] or l[j-1]>l[j]>l[j+1]:
print(... | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n=int(eval(input()))
l=[0]+list(map(int,input().split()))+[0]
max=0
for i in range(n+1):
max+=abs(l[i+1]-l[i])
for j in range(1,n+1):
x=abs(l[j+1]-l[j])
y=abs(l[j]-l[j-1])
z=abs(l[... | 18 | 15 | 472 | 363 | import sys
def input():
return sys.stdin.readline().strip()
def resolve():
n = int(eval(input()))
l = [0] + list(map(int, input().split())) + [0]
max = 0
for i in range(n + 1):
max += abs(l[i + 1] - l[i])
for j in range(1, n + 1):
if l[j - 1] < l[j] < l[j + 1] or l[j - 1] > l... | import sys
def input():
return sys.stdin.readline().strip()
def resolve():
n = int(eval(input()))
l = [0] + list(map(int, input().split())) + [0]
max = 0
for i in range(n + 1):
max += abs(l[i + 1] - l[i])
for j in range(1, n + 1):
x = abs(l[j + 1] - l[j])
y = abs(l[j]... | false | 16.666667 | [
"- if l[j - 1] < l[j] < l[j + 1] or l[j - 1] > l[j] > l[j + 1]:",
"- print(max)",
"- else:",
"- x = abs(l[j + 1] - l[j])",
"- y = abs(l[j] - l[j - 1])",
"- z = abs(l[j + 1] - l[j - 1])",
"- print((max - x - y + z))",
"+ x = ab... | false | 0.045659 | 0.044922 | 1.016403 | [
"s361345060",
"s545594216"
] |
u548545174 | p03352 | python | s882682590 | s186619300 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | X = int(eval(input()))
b = 1
p = 2
ans = 0
for b in range(1, X + 1):
for p in range(2, 10):
if b ** p <= X:
ans = max(ans, b ** p)
print(ans)
| X = int(eval(input()))
ans = 1
for b in range(1, X + 1):
for p in range(2, X + 1):
if b ** p <= X:
ans = max(ans, b ** p)
else:
break
print(ans)
| 10 | 11 | 170 | 195 | X = int(eval(input()))
b = 1
p = 2
ans = 0
for b in range(1, X + 1):
for p in range(2, 10):
if b**p <= X:
ans = max(ans, b**p)
print(ans)
| X = int(eval(input()))
ans = 1
for b in range(1, X + 1):
for p in range(2, X + 1):
if b**p <= X:
ans = max(ans, b**p)
else:
break
print(ans)
| false | 9.090909 | [
"-b = 1",
"-p = 2",
"-ans = 0",
"+ans = 1",
"- for p in range(2, 10):",
"+ for p in range(2, X + 1):",
"+ else:",
"+ break"
] | false | 0.041488 | 0.045199 | 0.917889 | [
"s882682590",
"s186619300"
] |
u454524105 | p03262 | python | s684143015 | s062468343 | 91 | 64 | 16,252 | 20,304 | Accepted | Accepted | 29.67 | import fractions
from functools import reduce
gcd = lambda l: reduce(fractions.gcd, l)
n, x = list(map(int, input().split()))
c = [abs(x-int(i)) for i in input().split()]
print((gcd(c))) | import math
from functools import reduce
N, X = list(map(int, input().split()))
x = [abs(X-i) for i in map(int, input().split())]
print((reduce(math.gcd, x))) | 6 | 5 | 183 | 154 | import fractions
from functools import reduce
gcd = lambda l: reduce(fractions.gcd, l)
n, x = list(map(int, input().split()))
c = [abs(x - int(i)) for i in input().split()]
print((gcd(c)))
| import math
from functools import reduce
N, X = list(map(int, input().split()))
x = [abs(X - i) for i in map(int, input().split())]
print((reduce(math.gcd, x)))
| false | 16.666667 | [
"-import fractions",
"+import math",
"-gcd = lambda l: reduce(fractions.gcd, l)",
"-n, x = list(map(int, input().split()))",
"-c = [abs(x - int(i)) for i in input().split()]",
"-print((gcd(c)))",
"+N, X = list(map(int, input().split()))",
"+x = [abs(X - i) for i in map(int, input().split())]",
"+pri... | false | 0.055514 | 0.037327 | 1.48723 | [
"s684143015",
"s062468343"
] |
u460386402 | p02779 | python | s922579775 | s259261252 | 185 | 138 | 25,172 | 31,100 | Accepted | Accepted | 25.41 | n=int(eval(input()))
a=list(map(int,input().split()))
a=sorted(a)
for i in range(n-1):
if a[i]==a[i+1]:
print('NO')
exit()
print('YES') | n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
for i in range(n-1):
if a[i]==a[i+1]:
print("NO")
exit()
print("YES") | 9 | 9 | 152 | 145 | n = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a)
for i in range(n - 1):
if a[i] == a[i + 1]:
print("NO")
exit()
print("YES")
| n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
for i in range(n - 1):
if a[i] == a[i + 1]:
print("NO")
exit()
print("YES")
| false | 0 | [
"-a = sorted(a)",
"+a.sort()"
] | false | 0.05241 | 0.037088 | 1.413152 | [
"s922579775",
"s259261252"
] |
u945181840 | p02900 | python | s057267480 | s292669312 | 176 | 93 | 3,064 | 3,064 | Accepted | Accepted | 47.16 | A, B = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n /= i
table.append(i)
i += 1
if n > 1:
table.app... | A, B = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
... | 23 | 27 | 395 | 450 | A, B = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n /= i
table.append(i)
i += 1
if n > 1:
table.append(n)
return ... | A, B = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
... | false | 14.814815 | [
"-def prime_decomposition(n):",
"- i = 2",
"- table = []",
"- while i * i <= n:",
"- while n % i == 0:",
"- n /= i",
"- table.append(i)",
"- i += 1",
"- if n > 1:",
"- table.append(n)",
"- return table",
"+def prime_factorize(n):",
"+... | false | 0.038614 | 0.039112 | 0.987264 | [
"s057267480",
"s292669312"
] |
u608088992 | p03724 | python | s255902963 | s163729337 | 400 | 206 | 3,888 | 3,828 | Accepted | Accepted | 48.5 | N, M = list(map(int, input().split()))
Path = [0 for i in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = min(a, b), max(a, b)
Path[b-1] += 1
if a > 1:
Path[a-1] += 1
for p in Path:
if p % 2 != 0:
print("NO")
break
else: print("YES") | import sys
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
count = [0] * N
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = min(a, b), max(a, b)
if a > 1: count[a-1] += 1
count[b-1] += 1
for i, a in enumer... | 14 | 21 | 306 | 470 | N, M = list(map(int, input().split()))
Path = [0 for i in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = min(a, b), max(a, b)
Path[b - 1] += 1
if a > 1:
Path[a - 1] += 1
for p in Path:
if p % 2 != 0:
print("NO")
break
else:
print("YES")
| import sys
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
count = [0] * N
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = min(a, b), max(a, b)
if a > 1:
count[a - 1] += 1
count[b - 1] += 1
for i, a in enum... | false | 33.333333 | [
"-N, M = list(map(int, input().split()))",
"-Path = [0 for i in range(N)]",
"-for _ in range(M):",
"- a, b = list(map(int, input().split()))",
"- a, b = min(a, b), max(a, b)",
"- Path[b - 1] += 1",
"- if a > 1:",
"- Path[a - 1] += 1",
"-for p in Path:",
"- if p % 2 != 0:",
... | false | 0.047271 | 0.037251 | 1.268976 | [
"s255902963",
"s163729337"
] |
u533883485 | p02264 | python | s028050606 | s407906170 | 810 | 320 | 15,784 | 16,052 | Accepted | Accepted | 60.49 | # coding=utf-8
n, q = list(map(int, input().split()))
queue = []
total_time = 0
finished_loop = 0
for i in range(n):
name, time = input().split()
queue.append([name, int(time)])
while queue:
n -= finished_loop
finished_loop = 0
for i in range(n):
poped = queue.pop(0)
... | # coding=utf-8
from collections import deque
n, q = list(map(int, input().split()))
queue = deque()
total_time = 0
for i in range(n):
name, time = input().split()
queue.append([name, int(time)])
while queue:
poped = queue.popleft()
if poped[1] > q:
queue.append([poped[0], poped[... | 25 | 19 | 568 | 427 | # coding=utf-8
n, q = list(map(int, input().split()))
queue = []
total_time = 0
finished_loop = 0
for i in range(n):
name, time = input().split()
queue.append([name, int(time)])
while queue:
n -= finished_loop
finished_loop = 0
for i in range(n):
poped = queue.pop(0)
name = poped[0]
... | # coding=utf-8
from collections import deque
n, q = list(map(int, input().split()))
queue = deque()
total_time = 0
for i in range(n):
name, time = input().split()
queue.append([name, int(time)])
while queue:
poped = queue.popleft()
if poped[1] > q:
queue.append([poped[0], poped[1] - q])
... | false | 24 | [
"+from collections import deque",
"+",
"-queue = []",
"+queue = deque()",
"-finished_loop = 0",
"- n -= finished_loop",
"- finished_loop = 0",
"- for i in range(n):",
"- poped = queue.pop(0)",
"- name = poped[0]",
"- time = poped[1]",
"- if time > q:",
"-... | false | 0.037891 | 0.038593 | 0.981808 | [
"s028050606",
"s407906170"
] |
u375616706 | p03013 | python | s341396282 | s652788600 | 150 | 130 | 11,884 | 11,884 | Accepted | Accepted | 13.33 | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
MOD = 10**9+7
N, M = list(map(int, input().split()))
broken = {int(eval(input())) for _ in range(M)}
dp = [0]*(N+1)
dp[0] = 1
for i in range(N+1):
for j in [1, 2]:
if i+j <= N and not i+j in broken... | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
mod = 10**9+7
n, m = list(map(int, input().split()))
broken = {int(eval(input())) for _ in range(m)}
dp = [0]*(n+1)
dp[0] = 1
for i in range(n+1):
for j in (1, 2):
nex = i+j
if nex <= n an... | 16 | 17 | 383 | 402 | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
broken = {int(eval(input())) for _ in range(M)}
dp = [0] * (N + 1)
dp[0] = 1
for i in range(N + 1):
for j in [1, 2]:
if i + j <= N and not i + j in broken... | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
mod = 10**9 + 7
n, m = list(map(int, input().split()))
broken = {int(eval(input())) for _ in range(m)}
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n + 1):
for j in (1, 2):
nex = i + j
if nex <= n and n... | false | 5.882353 | [
"-MOD = 10**9 + 7",
"-N, M = list(map(int, input().split()))",
"-broken = {int(eval(input())) for _ in range(M)}",
"-dp = [0] * (N + 1)",
"+mod = 10**9 + 7",
"+n, m = list(map(int, input().split()))",
"+broken = {int(eval(input())) for _ in range(m)}",
"+dp = [0] * (n + 1)",
"-for i in range(N + 1):... | false | 0.038177 | 0.034618 | 1.102811 | [
"s341396282",
"s652788600"
] |
u133864042 | p03575 | python | s654731159 | s062077213 | 38 | 27 | 9,236 | 9,092 | Accepted | Accepted | 28.95 | class UnionFind():
def __init__(self, n):
self.n = n
self.parent = [i for i in range(self.n)]
self.rank = [0] * self.n
def find_root(self, x):
if self.parent[x] == x:
return x
else:
self.parent[x] = self.find_root(self.parent[x])
return self.parent[x]
def u... | class UnionFind():
def __init__(self, n):
self.n = n
self.parent = [i for i in range(self.n)]
self.rank = [0] * self.n
def find_root(self, x):
if self.parent[x] == x:
return x
else:
self.parent[x] = self.find_root(self.parent[x])
return self.parent[x]
def u... | 49 | 45 | 1,107 | 1,064 | class UnionFind:
def __init__(self, n):
self.n = n
self.parent = [i for i in range(self.n)]
self.rank = [0] * self.n
def find_root(self, x):
if self.parent[x] == x:
return x
else:
self.parent[x] = self.find_root(self.parent[x])
return ... | class UnionFind:
def __init__(self, n):
self.n = n
self.parent = [i for i in range(self.n)]
self.rank = [0] * self.n
def find_root(self, x):
if self.parent[x] == x:
return x
else:
self.parent[x] = self.find_root(self.parent[x])
return ... | false | 8.163265 | [
"- root = uf.find_root(0)",
"- for i in range(1, N):",
"- if root != uf.find_root(i):",
"- bridge += 1",
"- break",
"+ if uf.find_root(edge[i][0]) != uf.find_root(edge[i][1]):",
"+ bridge += 1"
] | false | 0.037379 | 0.043294 | 0.863375 | [
"s654731159",
"s062077213"
] |
u821624310 | p02414 | python | s930584486 | s871087077 | 570 | 480 | 9,116 | 9,048 | Accepted | Accepted | 15.79 | n, m, l = map(int, input().split())
A = [[int(n) for n in input().split()] for i in range(n)]
B = [[int(n) for n in input().split()] for i in range(m)]
C = [[0 for i in range(l)] for i in range(n)]
for i in range(n):
for j in range(l):
for k in range(m):
C[i][j] += A[i][k] * B[k][j]
for ... | n, m, l = map(int, input().split())
a = [[int(num) for num in input().split()] for i in range(n)]
b = [[int(num) for num in input().split()] for i in range(m)]
c = [[0 for i in range(l)] for j in range(n)]
for i in range(n):
for j in range(l):
for k in range(m):
c[i][j] += a[i][k] * b[k][... | 14 | 15 | 464 | 484 | n, m, l = map(int, input().split())
A = [[int(n) for n in input().split()] for i in range(n)]
B = [[int(n) for n in input().split()] for i in range(m)]
C = [[0 for i in range(l)] for i in range(n)]
for i in range(n):
for j in range(l):
for k in range(m):
C[i][j] += A[i][k] * B[k][j]
for i in ran... | n, m, l = map(int, input().split())
a = [[int(num) for num in input().split()] for i in range(n)]
b = [[int(num) for num in input().split()] for i in range(m)]
c = [[0 for i in range(l)] for j in range(n)]
for i in range(n):
for j in range(l):
for k in range(m):
c[i][j] += a[i][k] * b[k][j]
for ... | false | 6.666667 | [
"-A = [[int(n) for n in input().split()] for i in range(n)]",
"-B = [[int(n) for n in input().split()] for i in range(m)]",
"-C = [[0 for i in range(l)] for i in range(n)]",
"+a = [[int(num) for num in input().split()] for i in range(n)]",
"+b = [[int(num) for num in input().split()] for i in range(m)]",
... | false | 0.075116 | 0.038842 | 1.93387 | [
"s930584486",
"s871087077"
] |
u014333473 | p03633 | python | s109001912 | s550916414 | 30 | 26 | 9,032 | 9,088 | Accepted | Accepted | 13.33 | import math
a=[int(eval(input())) for _ in range(int(eval(input())))]
r=a[0]
for i in range(len(a)):
r=r*a[i]//math.gcd(r,a[i])
print(r) | import math
n=int(eval(input()));a=[int(eval(input())) for _ in range(n)];r=a[0]
for i in a: r=r*i//math.gcd(r,i)
print(r) | 7 | 4 | 133 | 113 | import math
a = [int(eval(input())) for _ in range(int(eval(input())))]
r = a[0]
for i in range(len(a)):
r = r * a[i] // math.gcd(r, a[i])
print(r)
| import math
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
r = a[0]
for i in a:
r = r * i // math.gcd(r, i)
print(r)
| false | 42.857143 | [
"-a = [int(eval(input())) for _ in range(int(eval(input())))]",
"+n = int(eval(input()))",
"+a = [int(eval(input())) for _ in range(n)]",
"-for i in range(len(a)):",
"- r = r * a[i] // math.gcd(r, a[i])",
"+for i in a:",
"+ r = r * i // math.gcd(r, i)"
] | false | 0.036476 | 0.035768 | 1.019801 | [
"s109001912",
"s550916414"
] |
u330799501 | p02595 | python | s492064541 | s649049841 | 433 | 389 | 9,204 | 9,112 | Accepted | Accepted | 10.16 | #k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
import math
n,d = list(map(int, input().split()))
ans = 0
for i in range(n):
x, y = list(map(int, input().spli... | #k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
n, d = list(map(int, input().split()))
ans = 0
for i in range(n):
x, y = list(map(int, input().split()))
i... | 18 | 17 | 396 | 360 | # k = int(input())
# s = input()
# a, b = map(int, input().split())
# s, t = map(str, input().split())
# l = list(map(int, input().split()))
# l = [list(map(int,input().split())) for i in range(n)]
import math
n, d = list(map(int, input().split()))
ans = 0
for i in range(n):
x, y = list(map(int, input().split()))
... | # k = int(input())
# s = input()
# a, b = map(int, input().split())
# s, t = map(str, input().split())
# l = list(map(int, input().split()))
# l = [list(map(int,input().split())) for i in range(n)]
n, d = list(map(int, input().split()))
ans = 0
for i in range(n):
x, y = list(map(int, input().split()))
if x * x ... | false | 5.555556 | [
"-import math",
"-",
"- kyori = math.sqrt(x * x + y * y)",
"- if kyori <= d:",
"+ if x * x + y * y <= d * d:"
] | false | 0.187027 | 0.163723 | 1.142341 | [
"s492064541",
"s649049841"
] |
u270681687 | p03240 | python | s027953093 | s669869244 | 1,164 | 741 | 3,064 | 3,064 | Accepted | Accepted | 36.34 | n = int(eval(input()))
data = [list(map(int, input().split())) for i in range(n)]
flag = 0
for i in range(n):
if data[i][2] > 0:
flag = 1
break
if flag == 0:
print((data[0][0], data[0][1], 0))
else:
for cx in range(0, 101):
for cy in range(0, 101):
for i i... | n = int(eval(input()))
x = []
y = []
h = []
for i in range(n):
X, Y, H = list(map(int, input().split()))
x.append(X)
y.append(Y)
h.append(H)
INF = float('inf')
for cx in range(101):
for cy in range(101):
H = INF
Hmax = INF
for i in range(n):
if h[... | 24 | 29 | 696 | 783 | n = int(eval(input()))
data = [list(map(int, input().split())) for i in range(n)]
flag = 0
for i in range(n):
if data[i][2] > 0:
flag = 1
break
if flag == 0:
print((data[0][0], data[0][1], 0))
else:
for cx in range(0, 101):
for cy in range(0, 101):
for i in range(n):
... | n = int(eval(input()))
x = []
y = []
h = []
for i in range(n):
X, Y, H = list(map(int, input().split()))
x.append(X)
y.append(Y)
h.append(H)
INF = float("inf")
for cx in range(101):
for cy in range(101):
H = INF
Hmax = INF
for i in range(n):
if h[i] > 0 and H == I... | false | 17.241379 | [
"-data = [list(map(int, input().split())) for i in range(n)]",
"-flag = 0",
"+x = []",
"+y = []",
"+h = []",
"- if data[i][2] > 0:",
"- flag = 1",
"- break",
"-if flag == 0:",
"- print((data[0][0], data[0][1], 0))",
"-else:",
"- for cx in range(0, 101):",
"- for... | false | 0.050081 | 0.079814 | 0.627473 | [
"s027953093",
"s669869244"
] |
u562016607 | p02995 | python | s355518120 | s243612630 | 53 | 36 | 5,688 | 5,048 | Accepted | Accepted | 32.08 | from fractions import gcd
A,B,C,D=list(map(int,input().split()))
#CとDのどちらかで割り切れる
#=(Cで割り切れる)+(Dで割り切れる)-(lcm(C,D)で割り切れる)
L=(C*D)//gcd(C,D)
#(i-1)<A/C<=i
#i*C<=B<(i+1)C
i=(B//C)-(-((-A)//C))+1
j=(B//D)-(-((-A)//D))+1
k=(B//L)-(-((-A)//L))+1
print((B-A+1-(i+j-k)))
| from fractions import gcd
A,B,C,D=list(map(int,input().split()))
#CとDのどちらかで割り切れる
#=(Cで割り切れる)+(Dで割り切れる)-(lcm(C,D)で割り切れる)
L=(C*D)//gcd(C,D)
#(i-1)<A/C<=i
#i*C<=B<(i+1)C
i=(B//C)-((A+C-1)//C)+1
j=(B//D)-((A+D-1)//D)+1
k=(B//L)-((A+L-1)//L)+1
print((B-A+1-(i+j-k)))
| 11 | 11 | 264 | 264 | from fractions import gcd
A, B, C, D = list(map(int, input().split()))
# CとDのどちらかで割り切れる
# =(Cで割り切れる)+(Dで割り切れる)-(lcm(C,D)で割り切れる)
L = (C * D) // gcd(C, D)
# (i-1)<A/C<=i
# i*C<=B<(i+1)C
i = (B // C) - (-((-A) // C)) + 1
j = (B // D) - (-((-A) // D)) + 1
k = (B // L) - (-((-A) // L)) + 1
print((B - A + 1 - (i + j - k)))
| from fractions import gcd
A, B, C, D = list(map(int, input().split()))
# CとDのどちらかで割り切れる
# =(Cで割り切れる)+(Dで割り切れる)-(lcm(C,D)で割り切れる)
L = (C * D) // gcd(C, D)
# (i-1)<A/C<=i
# i*C<=B<(i+1)C
i = (B // C) - ((A + C - 1) // C) + 1
j = (B // D) - ((A + D - 1) // D) + 1
k = (B // L) - ((A + L - 1) // L) + 1
print((B - A + 1 - (i... | false | 0 | [
"-i = (B // C) - (-((-A) // C)) + 1",
"-j = (B // D) - (-((-A) // D)) + 1",
"-k = (B // L) - (-((-A) // L)) + 1",
"+i = (B // C) - ((A + C - 1) // C) + 1",
"+j = (B // D) - ((A + D - 1) // D) + 1",
"+k = (B // L) - ((A + L - 1) // L) + 1"
] | false | 0.056092 | 0.168475 | 0.332939 | [
"s355518120",
"s243612630"
] |
u968166680 | p03165 | python | s953536070 | s382759157 | 953 | 409 | 405,896 | 111,580 | Accepted | Accepted | 57.08 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
S = readline().strip()
T = readline().strip()
N, M = len(S), len(T)
dp = [[0] * (M + 1) for _ in range(N + 1)]
prev = [[0] * (M +... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
S = readline().strip()
T = readline().strip()
N, M = len(S), len(T)
dp = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(N):... | 42 | 42 | 1,038 | 941 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
S = readline().strip()
T = readline().strip()
N, M = len(S), len(T)
dp = [[0] * (M + 1) for _ in range(N + 1)]
prev = [[0] * (M + 1) for _ in range... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
S = readline().strip()
T = readline().strip()
N, M = len(S), len(T)
dp = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(N):
for j in ... | false | 0 | [
"- prev = [[0] * (M + 1) for _ in range(N + 1)]",
"- prev[i + 1][j + 1] = (i, j)",
"- prev[i + 1][j + 1] = (i + 1, j)",
"- prev[i + 1][j + 1] = (i, j + 1)",
"- p, q = prev[i][j]",
"- if i > p and j > q:",
"- ans.append(S[p])",
"-... | false | 0.03895 | 0.040753 | 0.955753 | [
"s953536070",
"s382759157"
] |
u637170240 | p02762 | python | s473508705 | s068529007 | 1,483 | 1,099 | 55,688 | 19,604 | Accepted | Accepted | 25.89 | from collections import defaultdict
class UnionFind:
def __init__(self, n):
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def un... | class UnionFind:
def __init__(self, n):
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.find... | 50 | 51 | 1,247 | 1,268 | from collections import defaultdict
class UnionFind:
def __init__(self, n):
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x,... | class UnionFind:
def __init__(self, n):
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.find(x)
... | false | 1.960784 | [
"-from collections import defaultdict",
"-",
"-",
"-friends = defaultdict(set)",
"+# friends = defaultdict(set)",
"+friends = [0] * N",
"- friends[u].add(v)",
"- friends[v].add(u)",
"+ # friends[u].add(v)",
"+ # friends[v].add(u)",
"+ friends[u] += 1",
"+ friends[v] += 1",
... | false | 0.046293 | 0.042137 | 1.098615 | [
"s473508705",
"s068529007"
] |
u078042885 | p00687 | python | s102902966 | s608838603 | 2,530 | 1,620 | 30,956 | 54,344 | Accepted | Accepted | 35.97 | while 1:
n,a,b=list(map(int,input().split()))
if n==a==b==0:break
c=0;d=[1]+[0]*1000000
for i in range(0,n+1):
if d[i]:
if i+a<=n:d[i+a]=1
if i+b<=n:d[i+b]=1
else:c+=1
print(c) | while 1:
n,a,b=list(map(int,input().split()))
if n==a==b==0:break
c=0;d=[1]+[0]*2000000
for i in range(0,n+1):
if d[i]:d[i+a]=d[i+b]=1
else:c+=1
print(c) | 10 | 8 | 239 | 190 | while 1:
n, a, b = list(map(int, input().split()))
if n == a == b == 0:
break
c = 0
d = [1] + [0] * 1000000
for i in range(0, n + 1):
if d[i]:
if i + a <= n:
d[i + a] = 1
if i + b <= n:
d[i + b] = 1
else:
c +... | while 1:
n, a, b = list(map(int, input().split()))
if n == a == b == 0:
break
c = 0
d = [1] + [0] * 2000000
for i in range(0, n + 1):
if d[i]:
d[i + a] = d[i + b] = 1
else:
c += 1
print(c)
| false | 20 | [
"- d = [1] + [0] * 1000000",
"+ d = [1] + [0] * 2000000",
"- if i + a <= n:",
"- d[i + a] = 1",
"- if i + b <= n:",
"- d[i + b] = 1",
"+ d[i + a] = d[i + b] = 1"
] | false | 0.102741 | 0.173348 | 0.592686 | [
"s102902966",
"s608838603"
] |
u912237403 | p00001 | python | s103959701 | s267334785 | 20 | 10 | 4,184 | 4,184 | Accepted | Accepted | 50 | import sys
for i in sorted(map(int,sys.stdin))[:-4:-1]:print(i) | import sys
x=sorted(map(int,sys.stdin))[:-4:-1]
for i in x:print(i) | 2 | 3 | 63 | 68 | import sys
for i in sorted(map(int, sys.stdin))[:-4:-1]:
print(i)
| import sys
x = sorted(map(int, sys.stdin))[:-4:-1]
for i in x:
print(i)
| false | 33.333333 | [
"-for i in sorted(map(int, sys.stdin))[:-4:-1]:",
"+x = sorted(map(int, sys.stdin))[:-4:-1]",
"+for i in x:"
] | false | 0.065701 | 0.046769 | 1.404783 | [
"s103959701",
"s267334785"
] |
u102126195 | p02720 | python | s534903224 | s736757766 | 452 | 371 | 59,996 | 49,000 | Accepted | Accepted | 17.92 | def make(n, now):
global cnt, k
# print(n, now, cnt)
if n == 0:
cnt += 1
if cnt == k:
return now
return
# print(n, now, cnt)
for i in range(max(0, now[-1] - 1), min(10, now[-1] + 2)):
ans = make(n - 1, now + [i])
if ans:
ret... | import queue
def solved(n):
if n <= 9:
return n
nums = queue.Queue()
for i in range(1, 10):
nums.put(i)
cnt = 9
for i in range(cnt, n):
i_num = nums.get()
ini_num = i_num % 10
for j in range(max(0, ini_num - 1), min(10, ini_num + 2)):
n... | 28 | 19 | 549 | 487 | def make(n, now):
global cnt, k
# print(n, now, cnt)
if n == 0:
cnt += 1
if cnt == k:
return now
return
# print(n, now, cnt)
for i in range(max(0, now[-1] - 1), min(10, now[-1] + 2)):
ans = make(n - 1, now + [i])
if ans:
return ans
k ... | import queue
def solved(n):
if n <= 9:
return n
nums = queue.Queue()
for i in range(1, 10):
nums.put(i)
cnt = 9
for i in range(cnt, n):
i_num = nums.get()
ini_num = i_num % 10
for j in range(max(0, ini_num - 1), min(10, ini_num + 2)):
nums.put(i_... | false | 32.142857 | [
"-def make(n, now):",
"- global cnt, k",
"- # print(n, now, cnt)",
"- if n == 0:",
"- cnt += 1",
"- if cnt == k:",
"- return now",
"- return",
"- # print(n, now, cnt)",
"- for i in range(max(0, now[-1] - 1), min(10, now[-1] + 2)):",
"- ans = ... | false | 0.161509 | 0.099845 | 1.617604 | [
"s534903224",
"s736757766"
] |
u564412408 | p03645 | python | s201892303 | s424212522 | 692 | 360 | 21,856 | 21,832 | Accepted | Accepted | 47.98 | # coding: utf-8
# Here your code !
a = list(map((int), input().split(' ')))
N, M = a[0], a[1]
first = []
second = []
for i in range(M):
b = list(map((int),input().split(' ')))
start, end = b[0], b[1]
if start == 1:
first.append(end)
if end == N:
second.appen... | import sys
input = sys.stdin.readline
a = list(map((int), input().split(' ')))
N, M = a[0], a[1]
first = []
second = []
for i in range(M):
b = list(map((int),input().split(' ')))
start, end = b[0], b[1]
if start == 1:
first.append(end)
if end == N:
secon... | 28 | 29 | 536 | 544 | # coding: utf-8
# Here your code !
a = list(map((int), input().split(" ")))
N, M = a[0], a[1]
first = []
second = []
for i in range(M):
b = list(map((int), input().split(" ")))
start, end = b[0], b[1]
if start == 1:
first.append(end)
if end == N:
second.append(start)
first_set = set(firs... | import sys
input = sys.stdin.readline
a = list(map((int), input().split(" ")))
N, M = a[0], a[1]
first = []
second = []
for i in range(M):
b = list(map((int), input().split(" ")))
start, end = b[0], b[1]
if start == 1:
first.append(end)
if end == N:
second.append(start)
first_set = set(... | false | 3.448276 | [
"-# coding: utf-8",
"-# Here your code !",
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.090764 | 0.048233 | 1.881799 | [
"s201892303",
"s424212522"
] |
u777283665 | p04030 | python | s383922215 | s325341827 | 29 | 17 | 3,060 | 2,940 | Accepted | Accepted | 41.38 | s = list(eval(input()))
ans = ""
for i in s:
if i == "0":
ans += "0"
elif i == "1":
ans += "1"
else:
try:
ans = ans[:-1]
except:
continue
print(ans) | s = eval(input())
ans = ""
for i in s:
if i == "0":
ans += i
elif i == "1":
ans += i
else:
ans = ans[:-1]
print(ans) | 16 | 13 | 194 | 169 | s = list(eval(input()))
ans = ""
for i in s:
if i == "0":
ans += "0"
elif i == "1":
ans += "1"
else:
try:
ans = ans[:-1]
except:
continue
print(ans)
| s = eval(input())
ans = ""
for i in s:
if i == "0":
ans += i
elif i == "1":
ans += i
else:
ans = ans[:-1]
print(ans)
| false | 18.75 | [
"-s = list(eval(input()))",
"+s = eval(input())",
"- ans += \"0\"",
"+ ans += i",
"- ans += \"1\"",
"+ ans += i",
"- try:",
"- ans = ans[:-1]",
"- except:",
"- continue",
"+ ans = ans[:-1]"
] | false | 0.037832 | 0.065047 | 0.581601 | [
"s383922215",
"s325341827"
] |
u141610915 | p04019 | python | s836915713 | s607541576 | 175 | 40 | 38,384 | 28,396 | Accepted | Accepted | 77.14 | import sys
input = sys.stdin.readline
S = list(eval(input()))[: -1]
if (S.count("N") > 0 and (S.count("S") > 0)) or (S.count("N") == 0 and (S.count("S") == 0)):
if (S.count("E") > 0 and (S.count("W") > 0)) or (S.count("E") == 0 and (S.count("W") == 0)):
print("Yes")
exit(0)
print("No") | import sys
input = sys.stdin.readline
S = list(eval(input()))[: -1]
n = S.count("N") > 0
e = S.count("E") > 0
s = S.count("S") > 0
w = S.count("W") > 0
if n and s or (n == 0 and (s == 0)):
if e and w or (e == 0 and (w == 0)):
print("Yes")
exit(0)
print("No") | 8 | 12 | 297 | 273 | import sys
input = sys.stdin.readline
S = list(eval(input()))[:-1]
if (S.count("N") > 0 and (S.count("S") > 0)) or (
S.count("N") == 0 and (S.count("S") == 0)
):
if (S.count("E") > 0 and (S.count("W") > 0)) or (
S.count("E") == 0 and (S.count("W") == 0)
):
print("Yes")
exit(0)
print... | import sys
input = sys.stdin.readline
S = list(eval(input()))[:-1]
n = S.count("N") > 0
e = S.count("E") > 0
s = S.count("S") > 0
w = S.count("W") > 0
if n and s or (n == 0 and (s == 0)):
if e and w or (e == 0 and (w == 0)):
print("Yes")
exit(0)
print("No")
| false | 33.333333 | [
"-if (S.count(\"N\") > 0 and (S.count(\"S\") > 0)) or (",
"- S.count(\"N\") == 0 and (S.count(\"S\") == 0)",
"-):",
"- if (S.count(\"E\") > 0 and (S.count(\"W\") > 0)) or (",
"- S.count(\"E\") == 0 and (S.count(\"W\") == 0)",
"- ):",
"+n = S.count(\"N\") > 0",
"+e = S.count(\"E\") > 0"... | false | 0.083826 | 0.038486 | 2.178098 | [
"s836915713",
"s607541576"
] |
u353919145 | p02712 | python | s059195724 | s904697756 | 193 | 69 | 8,852 | 64,532 | Accepted | Accepted | 64.25 | n=int(eval(input()))
sum=0
for i in range(1,n+1):
if(i%15!=0 and i%3!=0 and i%5!=0 ):
sum=sum+i
print(sum) | n = int(eval(input()))
ans = 0
for i in range(1, n+1):
if i%3 == 0 or i%5==0:
pass
else:
ans += i
print(ans) | 6 | 8 | 117 | 133 | n = int(eval(input()))
sum = 0
for i in range(1, n + 1):
if i % 15 != 0 and i % 3 != 0 and i % 5 != 0:
sum = sum + i
print(sum)
| n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
if i % 3 == 0 or i % 5 == 0:
pass
else:
ans += i
print(ans)
| false | 25 | [
"-sum = 0",
"+ans = 0",
"- if i % 15 != 0 and i % 3 != 0 and i % 5 != 0:",
"- sum = sum + i",
"-print(sum)",
"+ if i % 3 == 0 or i % 5 == 0:",
"+ pass",
"+ else:",
"+ ans += i",
"+print(ans)"
] | false | 0.155508 | 0.212089 | 0.733219 | [
"s059195724",
"s904697756"
] |
u961674365 | p02954 | python | s320165671 | s380519165 | 192 | 133 | 8,804 | 8,804 | Accepted | Accepted | 30.73 | s=eval(input())
n=len(s)
ans=[0 for _ in range(n)]
r=ans[:]
p=''
c=0
for i in range(n):
x=s[i]
if x=='R':
if p=='R':
c+=1
else:
c=1
else:
if p=='R':
r[i-1]=c
c=0
p=x
r=r[::-1]
s=s[::-1]
for i in range(n):
x=s[i]
if x=='L':
if p=='L':
c+=1... | # -*- coding: utf-8 -*-
def solve():
s=eval(input())
n=len(s)
ans=[0 for _ in range(n)]
r=ans[:]
p=''
c=0
for i in range(n):
x=s[i]
if x=='R':
if p=='R':
c+=1
else:
c=1
else:
if p=='R':
r[i-1]=c
c=0
p=x
r=r[::-1]
... | 47 | 53 | 623 | 807 | s = eval(input())
n = len(s)
ans = [0 for _ in range(n)]
r = ans[:]
p = ""
c = 0
for i in range(n):
x = s[i]
if x == "R":
if p == "R":
c += 1
else:
c = 1
else:
if p == "R":
r[i - 1] = c
c = 0
p = x
r = r[::-1]
s = s[::-1]
for i in r... | # -*- coding: utf-8 -*-
def solve():
s = eval(input())
n = len(s)
ans = [0 for _ in range(n)]
r = ans[:]
p = ""
c = 0
for i in range(n):
x = s[i]
if x == "R":
if p == "R":
c += 1
else:
c = 1
else:
if ... | false | 11.320755 | [
"-s = eval(input())",
"-n = len(s)",
"-ans = [0 for _ in range(n)]",
"-r = ans[:]",
"-p = \"\"",
"-c = 0",
"-for i in range(n):",
"- x = s[i]",
"- if x == \"R\":",
"- if p == \"R\":",
"- c += 1",
"- else:",
"- c = 1",
"- else:",
"- if p... | false | 0.038697 | 0.037907 | 1.020833 | [
"s320165671",
"s380519165"
] |
u546285759 | p00424 | python | s710339071 | s515264843 | 270 | 230 | 7,940 | 8,512 | Accepted | Accepted | 14.81 | while True:
n = int(eval(input()))
if n == 0:
break
d = {}
for _ in range(n):
a, b = input().split()
d[a] = b
m = int(eval(input()))
ans = ""
for _ in range(m):
a = input().strip()
if a in d:
ans += d[a]
else:
... | while True:
n = int(eval(input()))
if n == 0:
break
d = {}
for _ in range(n):
a, b = input().split()
d[a] = b
m = int(eval(input()))
ans = []
for _ in range(m):
a = input().strip()
if a in d:
ans.append(d[a])
else:
... | 17 | 17 | 337 | 356 | while True:
n = int(eval(input()))
if n == 0:
break
d = {}
for _ in range(n):
a, b = input().split()
d[a] = b
m = int(eval(input()))
ans = ""
for _ in range(m):
a = input().strip()
if a in d:
ans += d[a]
else:
ans += a
... | while True:
n = int(eval(input()))
if n == 0:
break
d = {}
for _ in range(n):
a, b = input().split()
d[a] = b
m = int(eval(input()))
ans = []
for _ in range(m):
a = input().strip()
if a in d:
ans.append(d[a])
else:
ans.a... | false | 0 | [
"- ans = \"\"",
"+ ans = []",
"- ans += d[a]",
"+ ans.append(d[a])",
"- ans += a",
"- print(ans)",
"+ ans.append(a)",
"+ print((\"\".join(ans)))"
] | false | 0.040187 | 0.039974 | 1.005323 | [
"s710339071",
"s515264843"
] |
u330039499 | p03088 | python | s233124192 | s387141777 | 101 | 32 | 3,332 | 3,332 | Accepted | Accepted | 68.32 | MAX_NUM = 10 ** 9 + 7
N = eval(input())
memo = [{} for _ in range(N + 1)]
# def ok(last4):
# if 'AGC' in last4 or \
# 'GAC' in last4 or \
# 'ACG' in last4 or \
# last4[0] == 'A' and last4[2:] == 'GC' or \
# last4[:2] == 'AG' and last4[-1] == 'C':
# return False
# return True
def ok(last... | MAX_NUM = 10 ** 9 + 7
N = input()
memo = [{} for _ in range(N + 1)]
def ok(last4):
if 'AGC' in last4 or \
'GAC' in last4 or \
'ACG' in last4 or \
last4[0] == 'A' and last4[2:] == 'GC' or \
last4[:2] == 'AG' and last4[-1] == 'C':
return False
return True
def dfs(cur, last3):
if cur ==... | 40 | 31 | 787 | 591 | MAX_NUM = 10**9 + 7
N = eval(input())
memo = [{} for _ in range(N + 1)]
# def ok(last4):
# if 'AGC' in last4 or \
# 'GAC' in last4 or \
# 'ACG' in last4 or \
# last4[0] == 'A' and last4[2:] == 'GC' or \
# last4[:2] == 'AG' and last4[-1] == 'C':
# return False
# return True
def ok(last4):
for i in ra... | MAX_NUM = 10 ** 9 + 7
N = input()
memo = [{} for _ in range(N + 1)]
def ok(last4):
if 'AGC' in last4 or \
'GAC' in last4 or \
'ACG' in last4 or \
last4[0] == 'A' and last4[2:] == 'GC' or \
last4[:2] == 'AG' and last4[-1] == 'C':
return False
return True
def dfs(cur, last3):
if cur == N:
return 1
... | false | 22.5 | [
"-MAX_NUM = 10**9 + 7",
"-N = eval(input())",
"+MAX_NUM = 10 ** 9 + 7",
"+N = input()",
"-# def ok(last4):",
"-# if 'AGC' in last4 or \\",
"-# 'GAC' in last4 or \\",
"-# 'ACG' in last4 or \\",
"-# last4[0] == 'A' and last4[2:] == 'GC' or \\",
"-# last4[:2] == 'AG' and last4[-1] == 'C':",... | false | 0.105815 | 0.107601 | 0.9834 | [
"s233124192",
"s387141777"
] |
u572144347 | p03291 | python | s630429482 | s038857103 | 506 | 244 | 54,232 | 54,764 | Accepted | Accepted | 51.78 | #!/mnt/c/Users/moiki/bash/env/bin/python
# N,M = map(int, input().split())
S = eval(input())
from collections import defaultdict
from bisect import bisect_left, bisect_right
a = []
b = []
c = []
# a = defaultdict(list)
# b = defaultdict(list)
# c = defaultdict(list)
q = []
for e,s in enumerate(S):
if... | #!/mnt/c/Users/moiki/bash/env/bin/python
# N,M = map(int, input().split())
MOD = int(1e9+7)
S = eval(input())
dp = [ [0] * 4 for _ in range(len(S)+1)]
dp[0][0] = 1
for e,s in enumerate(S,1):
dp[e][0] = dp[e-1][0] * (3 if s == "?" else 1)
if s == "A" or s == "?":
dp[e][1] += dp[e-1][... | 65 | 38 | 1,805 | 769 | #!/mnt/c/Users/moiki/bash/env/bin/python
# N,M = map(int, input().split())
S = eval(input())
from collections import defaultdict
from bisect import bisect_left, bisect_right
a = []
b = []
c = []
# a = defaultdict(list)
# b = defaultdict(list)
# c = defaultdict(list)
q = []
for e, s in enumerate(S):
if s == "A":
... | #!/mnt/c/Users/moiki/bash/env/bin/python
# N,M = map(int, input().split())
MOD = int(1e9 + 7)
S = eval(input())
dp = [[0] * 4 for _ in range(len(S) + 1)]
dp[0][0] = 1
for e, s in enumerate(S, 1):
dp[e][0] = dp[e - 1][0] * (3 if s == "?" else 1)
if s == "A" or s == "?":
dp[e][1] += dp[e - 1][0]
dp[e]... | false | 41.538462 | [
"+MOD = int(1e9 + 7)",
"-from collections import defaultdict",
"-from bisect import bisect_left, bisect_right",
"-",
"-a = []",
"-b = []",
"-c = []",
"-# a = defaultdict(list)",
"-# b = defaultdict(list)",
"-# c = defaultdict(list)",
"-q = []",
"-for e, s in enumerate(S):",
"- if s == \"A... | false | 0.054598 | 0.055635 | 0.981353 | [
"s630429482",
"s038857103"
] |
u326609687 | p02574 | python | s537643697 | s725560660 | 498 | 260 | 145,332 | 58,156 | Accepted | Accepted | 47.79 | import numpy as np
import sys
i4 = np.int32
i8 = np.int64
if sys.argv[-1] == 'ONLINE_JUDGE':
from numba.pycc import CC
from numba import njit
from numba.types import int64, Array
cc = CC('my_module')
@njit
def factorization(N):
p = np.zeros(N + 1, i8)
n_max = int(... | import numpy as np
import sys
i4 = np.int32
i8 = np.int64
if sys.argv[-1] == 'ONLINE_JUDGE':
from numba.pycc import CC
from numba import njit
from numba.types import int64, Array
cc = CC('my_module')
@njit
def factorization(N):
p = np.zeros(N + 1, i8)
n_max = int(... | 89 | 89 | 2,230 | 2,221 | import numpy as np
import sys
i4 = np.int32
i8 = np.int64
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
from numba import njit
from numba.types import int64, Array
cc = CC("my_module")
@njit
def factorization(N):
p = np.zeros(N + 1, i8)
n_max = int(np.sqrt(N)) +... | import numpy as np
import sys
i4 = np.int32
i8 = np.int64
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
from numba import njit
from numba.types import int64, Array
cc = CC("my_module")
@njit
def factorization(N):
p = np.zeros(N + 1, i8)
n_max = int(np.sqrt(N)) +... | false | 0 | [
"- A = np.array([int(x) for x in stdin.readline().split()])",
"+ A = np.fromstring(stdin.readline(), i8, sep=\" \")"
] | false | 0.313162 | 0.238227 | 1.314551 | [
"s537643697",
"s725560660"
] |
u925782032 | p03163 | python | s233012779 | s660005479 | 1,456 | 1,059 | 7,668 | 5,764 | Accepted | Accepted | 27.27 | #!/usr/bin/env python3
import sys, os
def main():
inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
n, m = inp[0],inp[1]
wi, vi = inp[2], inp[3]
dp = [0] * (m + 1)
for j in range(wi, m + 1):
dp[j] = vi
for i in range(n - 1):
wi = inp[2*i + 4... | #!/usr/bin/env python3
import sys, os
range = xrange
def main():
inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
n, m = inp[0],inp[1]
wi, vi = inp[2], inp[3]
dp = [0] * (m + 1)
for j in range(wi, m + 1):
dp[j] = vi
for i in range(n - 1):
w... | 24 | 25 | 504 | 519 | #!/usr/bin/env python3
import sys, os
def main():
inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
n, m = inp[0], inp[1]
wi, vi = inp[2], inp[3]
dp = [0] * (m + 1)
for j in range(wi, m + 1):
dp[j] = vi
for i in range(n - 1):
wi = inp[2 * i + 4]
vi = inp[2... | #!/usr/bin/env python3
import sys, os
range = xrange
def main():
inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
n, m = inp[0], inp[1]
wi, vi = inp[2], inp[3]
dp = [0] * (m + 1)
for j in range(wi, m + 1):
dp[j] = vi
for i in range(n - 1):
wi = inp[2 * i + 4]
... | false | 4 | [
"+",
"+range = xrange"
] | false | 0.036571 | 0.038059 | 0.960904 | [
"s233012779",
"s660005479"
] |
u795245552 | p02954 | python | s958098186 | s799184927 | 244 | 166 | 4,864 | 6,408 | Accepted | Accepted | 31.97 | S = str(input())
n = len(S)
ans = [0 for x in range(n)]
i = 0
ToRight = True
while i < n - 1:
start = i
while i < n - 1 and S[i + 1] == S[i]:
i += 1
if ToRight:
ans[i] += (i + 1 - start) // 2 + (i + 1 - start) % 2
ans[i + 1] += (i + 1 - start) // 2
else:
an... | S = str(eval(input()))
n = len(S)
ans = [0 for x in range(n)]
i = 0
ToRight = True
while i < n - 1:
start = i
while i < n - 1 and S[i + 1] == S[i]:
i += 1
if ToRight:
ans[i] += (i + 1 - start) // 2 + (i + 1 - start) % 2
ans[i + 1] += (i + 1 - start) // 2
else:
... | 25 | 22 | 594 | 518 | S = str(input())
n = len(S)
ans = [0 for x in range(n)]
i = 0
ToRight = True
while i < n - 1:
start = i
while i < n - 1 and S[i + 1] == S[i]:
i += 1
if ToRight:
ans[i] += (i + 1 - start) // 2 + (i + 1 - start) % 2
ans[i + 1] += (i + 1 - start) // 2
else:
ans[start] += (i ... | S = str(eval(input()))
n = len(S)
ans = [0 for x in range(n)]
i = 0
ToRight = True
while i < n - 1:
start = i
while i < n - 1 and S[i + 1] == S[i]:
i += 1
if ToRight:
ans[i] += (i + 1 - start) // 2 + (i + 1 - start) % 2
ans[i + 1] += (i + 1 - start) // 2
else:
ans[start] ... | false | 12 | [
"-S = str(input())",
"+S = str(eval(input()))",
"-for i in range(n):",
"- print(ans[i], end=\" \")",
"- if i == n - 1:",
"- print(\"\\n\")",
"+print((*ans))"
] | false | 0.046051 | 0.043601 | 1.056187 | [
"s958098186",
"s799184927"
] |
u677121387 | p03837 | python | s648190485 | s375745077 | 494 | 455 | 9,220 | 9,308 | Accepted | Accepted | 7.89 | n,m = list(map(int,input().split()))
INF = 10**18
d = [[INF]*n for _ in range(n)]
nd = [[INF]*n for _ in range(n)]
for i in range(n):
d[i][i] = 0
nd[i][i] = 0
for _ in range(m):
a,b,c = list(map(int,input().split()))
a -= 1
b -= 1
d[a][b] = c
d[b][a] = c
nd[a][b] = c
nd... | n,m = list(map(int,input().split()))
INF = 10**18
d = [[INF]*n for _ in range(n)]
for i in range(n): d[i][i] = 0
A = [0]*m
B = [0]*m
C = [0]*m
for i in range(m):
a,b,c = list(map(int,input().split()))
a -= 1
b -= 1
A[i] = a
B[i] = b
C[i] = c
d[a][b] = c
d[b][a] = c
for ... | 27 | 26 | 597 | 509 | n, m = list(map(int, input().split()))
INF = 10**18
d = [[INF] * n for _ in range(n)]
nd = [[INF] * n for _ in range(n)]
for i in range(n):
d[i][i] = 0
nd[i][i] = 0
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
d[a][b] = c
d[b][a] = c
nd[a][b] = c
nd[b][a... | n, m = list(map(int, input().split()))
INF = 10**18
d = [[INF] * n for _ in range(n)]
for i in range(n):
d[i][i] = 0
A = [0] * m
B = [0] * m
C = [0] * m
for i in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
A[i] = a
B[i] = b
C[i] = c
d[a][b] = c
d[b][a] = c
for k... | false | 3.703704 | [
"-nd = [[INF] * n for _ in range(n)]",
"- nd[i][i] = 0",
"-for _ in range(m):",
"+A = [0] * m",
"+B = [0] * m",
"+C = [0] * m",
"+for i in range(m):",
"+ A[i] = a",
"+ B[i] = b",
"+ C[i] = c",
"- nd[a][b] = c",
"- nd[b][a] = c",
"- nd[i][j] = min(nd[i][j], nd[i][... | false | 0.04373 | 0.048154 | 0.908141 | [
"s648190485",
"s375745077"
] |
u773981351 | p03401 | python | s930422475 | s339070199 | 224 | 189 | 14,172 | 14,172 | Accepted | Accepted | 15.62 | def cost(a):
prev = 0
total = 0
for ai in a:
total += abs(ai - prev)
prev = ai
total += abs(0 - prev)
return total
def cancel(a, i, total_cost):
prev_spot = a[i-1]
spot = a[i]
next_spot = a[i+1]
if spot >= min(prev_spot, next_spot) and spot <= max(prev_s... | def cost(a):
total = 0
for i in range(1, len(a)):
total += abs(a[i] - a[i-1])
return total
def cancel(a, i, total):
prev = a[i-1]
spot = a[i]
nxt = a[i+1]
if (nxt >= prev and spot < prev) or (nxt <= prev and spot > prev):
return total - 2 * abs(prev - spot)
i... | 29 | 24 | 951 | 666 | def cost(a):
prev = 0
total = 0
for ai in a:
total += abs(ai - prev)
prev = ai
total += abs(0 - prev)
return total
def cancel(a, i, total_cost):
prev_spot = a[i - 1]
spot = a[i]
next_spot = a[i + 1]
if spot >= min(prev_spot, next_spot) and spot <= max(prev_spot, nex... | def cost(a):
total = 0
for i in range(1, len(a)):
total += abs(a[i] - a[i - 1])
return total
def cancel(a, i, total):
prev = a[i - 1]
spot = a[i]
nxt = a[i + 1]
if (nxt >= prev and spot < prev) or (nxt <= prev and spot > prev):
return total - 2 * abs(prev - spot)
if (nx... | false | 17.241379 | [
"- prev = 0",
"- for ai in a:",
"- total += abs(ai - prev)",
"- prev = ai",
"- total += abs(0 - prev)",
"+ for i in range(1, len(a)):",
"+ total += abs(a[i] - a[i - 1])",
"-def cancel(a, i, total_cost):",
"- prev_spot = a[i - 1]",
"+def cancel(a, i, total):",
... | false | 0.058093 | 0.038808 | 1.496935 | [
"s930422475",
"s339070199"
] |
u408071652 | p02726 | python | s567653378 | s068166865 | 108 | 93 | 74,124 | 73,756 | Accepted | Accepted | 13.89 | N,X,Y =list(map(int,input().split()))
count = [0] * (N-1)
for i in range(1,N):
for j in range(i+1,N+1):
dist = min(j-i, abs(X-i)+1+abs(Y-j))
count[dist-1] +=1
for i in range(N-1):
print((count[i])) | N,X,Y =list(map(int,input().split()))
count = [0] * (N-1)
for i in range(1,N):
for j in range(i+1,N+1):
dist = min(j-i, abs(X-i)+1+abs(Y-j))
count[dist-1] +=1
print(("\n".join(map(str,count)))) | 13 | 12 | 230 | 221 | N, X, Y = list(map(int, input().split()))
count = [0] * (N - 1)
for i in range(1, N):
for j in range(i + 1, N + 1):
dist = min(j - i, abs(X - i) + 1 + abs(Y - j))
count[dist - 1] += 1
for i in range(N - 1):
print((count[i]))
| N, X, Y = list(map(int, input().split()))
count = [0] * (N - 1)
for i in range(1, N):
for j in range(i + 1, N + 1):
dist = min(j - i, abs(X - i) + 1 + abs(Y - j))
count[dist - 1] += 1
print(("\n".join(map(str, count))))
| false | 7.692308 | [
"-for i in range(N - 1):",
"- print((count[i]))",
"+print((\"\\n\".join(map(str, count))))"
] | false | 0.061527 | 0.049821 | 1.23496 | [
"s567653378",
"s068166865"
] |
u545368057 | p02572 | python | s522587158 | s380283647 | 246 | 113 | 31,560 | 105,236 | Accepted | Accepted | 54.07 | n = int(eval(input()))
As = list(map(int, input().split()))
MOD = 10**9 + 7
S = sum(As)
b = 0
for a in As:
b += pow(a,2,MOD)
b %= MOD
ans = (pow(S,2,MOD)-b)*pow(2,MOD-2,MOD)
print((ans%MOD)) | n = int(eval(input()))
As = list(map(int, input().split()))
MOD = 10**9 + 7
S = sum(As)%MOD
ans = 0
for a in As:
ans += (a * (S-a))%MOD
ans %= MOD
ans *= pow(2,MOD-2,MOD)
print((ans%MOD))
| 10 | 10 | 199 | 197 | n = int(eval(input()))
As = list(map(int, input().split()))
MOD = 10**9 + 7
S = sum(As)
b = 0
for a in As:
b += pow(a, 2, MOD)
b %= MOD
ans = (pow(S, 2, MOD) - b) * pow(2, MOD - 2, MOD)
print((ans % MOD))
| n = int(eval(input()))
As = list(map(int, input().split()))
MOD = 10**9 + 7
S = sum(As) % MOD
ans = 0
for a in As:
ans += (a * (S - a)) % MOD
ans %= MOD
ans *= pow(2, MOD - 2, MOD)
print((ans % MOD))
| false | 0 | [
"-S = sum(As)",
"-b = 0",
"+S = sum(As) % MOD",
"+ans = 0",
"- b += pow(a, 2, MOD)",
"- b %= MOD",
"-ans = (pow(S, 2, MOD) - b) * pow(2, MOD - 2, MOD)",
"+ ans += (a * (S - a)) % MOD",
"+ ans %= MOD",
"+ans *= pow(2, MOD - 2, MOD)"
] | false | 0.089499 | 0.070565 | 1.268327 | [
"s522587158",
"s380283647"
] |
u974918235 | p02760 | python | s572735295 | s150880209 | 30 | 27 | 9,176 | 9,228 | Accepted | Accepted | 10 | bin = []
for i in range(3):
bin.append(list(map(int, input().split())))
bin = sum(bin, [])
N = int(input())
bingo = [False for _ in range(9)]
for _ in range(N):
b = int(input())
if b in bin:
bingo[bin.index(b)] = True
if (bingo[0] and bingo[1] and bingo[2]) or (bingo[3] and bingo[4] and bingo[5]) or... | bingo = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
for _ in range(N):
b = int(input())
for i in range(3):
for j in range(3):
if bingo[i][j] == b:
bingo[i][j] = 0
ans = "No"
for k in range(3):
if bingo[k][0] == bingo[k][1] == bingo[k][2] or \
bingo[0][k... | 17 | 19 | 614 | 505 | bin = []
for i in range(3):
bin.append(list(map(int, input().split())))
bin = sum(bin, [])
N = int(input())
bingo = [False for _ in range(9)]
for _ in range(N):
b = int(input())
if b in bin:
bingo[bin.index(b)] = True
if (
(bingo[0] and bingo[1] and bingo[2])
or (bingo[3] and bingo[4] and bi... | bingo = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
for _ in range(N):
b = int(input())
for i in range(3):
for j in range(3):
if bingo[i][j] == b:
bingo[i][j] = 0
ans = "No"
for k in range(3):
if (
bingo[k][0] == bingo[k][1] == bingo[k][2]... | false | 10.526316 | [
"-bin = []",
"-for i in range(3):",
"- bin.append(list(map(int, input().split())))",
"-bin = sum(bin, [])",
"+bingo = [list(map(int, input().split())) for _ in range(3)]",
"-bingo = [False for _ in range(9)]",
"- if b in bin:",
"- bingo[bin.index(b)] = True",
"+ for i in range(3):",
... | false | 0.040181 | 0.037911 | 1.05986 | [
"s572735295",
"s150880209"
] |
u350064373 | p02408 | python | s901120807 | s890490126 | 30 | 20 | 7,764 | 7,752 | Accepted | Accepted | 33.33 | r=range
v=input
l=[i+" "+str(j)for i in["S","H","C","D"]for j in r(1,14)]
for i in r(int(v())):l.remove(v())
for i in l:print(i) | r=range
v=input
l=[i+" "+str(j)for i in"SHCD" for j in r(1,14)]
for i in r(int(v())):l.remove(v())
for i in l:print(i) | 5 | 5 | 132 | 122 | r = range
v = input
l = [i + " " + str(j) for i in ["S", "H", "C", "D"] for j in r(1, 14)]
for i in r(int(v())):
l.remove(v())
for i in l:
print(i)
| r = range
v = input
l = [i + " " + str(j) for i in "SHCD" for j in r(1, 14)]
for i in r(int(v())):
l.remove(v())
for i in l:
print(i)
| false | 0 | [
"-l = [i + \" \" + str(j) for i in [\"S\", \"H\", \"C\", \"D\"] for j in r(1, 14)]",
"+l = [i + \" \" + str(j) for i in \"SHCD\" for j in r(1, 14)]"
] | false | 0.045613 | 0.041626 | 1.095786 | [
"s901120807",
"s890490126"
] |
u835924161 | p03548 | python | s345422497 | s597678458 | 29 | 17 | 2,940 | 2,940 | Accepted | Accepted | 41.38 | x,y,z=list(map(int,input().split()))
ans=int(0)
x-=z
while x>=y+z:
ans+=1
x-=(y+z)
print(ans) | x,y,z=list(map(int,input().split()))
x-=z
print((int(x/(y+z)))) | 8 | 3 | 103 | 57 | x, y, z = list(map(int, input().split()))
ans = int(0)
x -= z
while x >= y + z:
ans += 1
x -= y + z
print(ans)
| x, y, z = list(map(int, input().split()))
x -= z
print((int(x / (y + z))))
| false | 62.5 | [
"-ans = int(0)",
"-while x >= y + z:",
"- ans += 1",
"- x -= y + z",
"-print(ans)",
"+print((int(x / (y + z))))"
] | false | 0.048017 | 0.040874 | 1.174746 | [
"s345422497",
"s597678458"
] |
u614314290 | p03208 | python | s157831463 | s484728569 | 247 | 176 | 12,056 | 25,064 | Accepted | Accepted | 28.74 | N, K = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
h = sorted(H)
#print(h)
d = []
for i in range(K - 1, N):
d += [h[i] - h[i - K + 1]]
#print(d)
print((min(d)))
| import sys
from operator import itemgetter as ig
from collections import defaultdict as dd
# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
return int(n) - 1
def input():
return next(args)
def parse(*params):
if len(params) == 1:
return params[0](next(args))
r... | 12 | 40 | 193 | 910 | N, K = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
h = sorted(H)
# print(h)
d = []
for i in range(K - 1, N):
d += [h[i] - h[i - K + 1]]
# print(d)
print((min(d)))
| import sys
from operator import itemgetter as ig
from collections import defaultdict as dd
# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
return int(n) - 1
def input():
return next(args)
def parse(*params):
if len(params) == 1:
return params[0](next(args))
return tup... | false | 70 | [
"-N, K = list(map(int, input().split()))",
"-H = [int(eval(input())) for _ in range(N)]",
"-h = sorted(H)",
"-# print(h)",
"-d = []",
"-for i in range(K - 1, N):",
"- d += [h[i] - h[i - K + 1]]",
"-# print(d)",
"-print((min(d)))",
"+import sys",
"+from operator import itemgetter as ig",
"+f... | false | 0.035816 | 0.037801 | 0.94748 | [
"s157831463",
"s484728569"
] |
u133936772 | p03378 | python | s897619849 | s754354675 | 26 | 24 | 9,128 | 9,096 | Accepted | Accepted | 7.69 | f=lambda:[*list(map(int,input().split()))]
n,m,x=f()
a=f()
l=r=0
for i in a:
if i<x: l+=1
elif i<n: r+=1
print((min(l,r))) | n,m,x,*a=list(map(int,open(0).read().split()))
print((min(l:=sum(i<x for i in a),m-l))) | 8 | 2 | 125 | 80 | f = lambda: [*list(map(int, input().split()))]
n, m, x = f()
a = f()
l = r = 0
for i in a:
if i < x:
l += 1
elif i < n:
r += 1
print((min(l, r)))
| n, m, x, *a = list(map(int, open(0).read().split()))
print((min(l := sum(i < x for i in a), m - l)))
| false | 75 | [
"-f = lambda: [*list(map(int, input().split()))]",
"-n, m, x = f()",
"-a = f()",
"-l = r = 0",
"-for i in a:",
"- if i < x:",
"- l += 1",
"- elif i < n:",
"- r += 1",
"-print((min(l, r)))",
"+n, m, x, *a = list(map(int, open(0).read().split()))",
"+print((min(l := sum(i < x... | false | 0.042124 | 0.042021 | 1.002442 | [
"s897619849",
"s754354675"
] |
u687044304 | p03032 | python | s063376039 | s617068103 | 34 | 31 | 3,444 | 3,064 | Accepted | Accepted | 8.82 | # -*- coding:utf-8 -*-
import copy
def solve():
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
M = min(N,K)
for l in range(M+1):
having = []
for r in range(M+1):
if l+r > M: break
if l+r == 0: continue
... | # -*- coding:utf-8 -*-
def solve():
N, K = list(map(int, input().split()))
Vs = list(map(int, input().split()))
"""方針
Dequeueから宝石をとる。最後に好きなだけ宝石を戻す。
dp[i][j] := 左からi個、右からj個取ったときの最大値
"""
dp = [[0 for _ in range(K+1)] for __ in range(K+1)]
dp[0][0] = 0 # dpを使ってなくて草
ans ... | 32 | 43 | 754 | 1,004 | # -*- coding:utf-8 -*-
import copy
def solve():
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
M = min(N, K)
for l in range(M + 1):
having = []
for r in range(M + 1):
if l + r > M:
break
if l + r == 0:
... | # -*- coding:utf-8 -*-
def solve():
N, K = list(map(int, input().split()))
Vs = list(map(int, input().split()))
"""方針
Dequeueから宝石をとる。最後に好きなだけ宝石を戻す。
dp[i][j] := 左からi個、右からj個取ったときの最大値
"""
dp = [[0 for _ in range(K + 1)] for __ in range(K + 1)]
dp[0][0] = 0 # dpを使ってなくて草
ans = -float("in... | false | 25.581395 | [
"-import copy",
"-",
"-",
"- V = list(map(int, input().split()))",
"- ans = 0",
"- M = min(N, K)",
"- for l in range(M + 1):",
"- having = []",
"- for r in range(M + 1):",
"- if l + r > M:",
"+ Vs = list(map(int, input().split()))",
"+ \"\"\"方針",
"+... | false | 0.043023 | 0.088158 | 0.488027 | [
"s063376039",
"s617068103"
] |
u472065247 | p03634 | python | s354468653 | s483195276 | 1,446 | 1,182 | 43,664 | 175,772 | Accepted | Accepted | 18.26 | from collections import deque
N = int(eval(input()))
G = [[] * N for _ in range(N)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
G[a - 1].append((b - 1, c))
G[b - 1].append((a - 1, c))
Q, K = list(map(int, input().split()))
D = [-1] * N
D[K - 1] = 0
q = deque([K - 1])
while ... | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
ABC = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(Q)]
G = [[] * N for _ in range(N)]
for a, b, c in ABC:
G[a - 1].append((b - 1, c))
G[b... | 25 | 25 | 492 | 504 | from collections import deque
N = int(eval(input()))
G = [[] * N for _ in range(N)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
G[a - 1].append((b - 1, c))
G[b - 1].append((a - 1, c))
Q, K = list(map(int, input().split()))
D = [-1] * N
D[K - 1] = 0
q = deque([K - 1])
while q:
n = q... | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
ABC = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(Q)]
G = [[] * N for _ in range(N)]
for a, b, c in ABC:
G[a - 1].append((b - 1, c))
G[b - 1].ap... | false | 0 | [
"-from collections import deque",
"+import sys",
"+sys.setrecursionlimit(10**6)",
"+ABC = [list(map(int, input().split())) for _ in range(N - 1)]",
"+Q, K = list(map(int, input().split()))",
"+XY = [list(map(int, input().split())) for _ in range(Q)]",
"-for _ in range(N - 1):",
"- a, b, c = list(ma... | false | 0.039016 | 0.047428 | 0.822646 | [
"s354468653",
"s483195276"
] |
u699296734 | p03777 | python | s390447994 | s627600664 | 26 | 24 | 8,984 | 9,024 | Accepted | Accepted | 7.69 | a, b = input().split()
if a == "H":
print(b)
else:
if b == "H":
print("D")
else:
print("H")
| a, b = input().split()
hd = "HD"
if a == "H":
print(b)
else:
print((hd[hd.index(b) - 1]))
| 8 | 6 | 127 | 101 | a, b = input().split()
if a == "H":
print(b)
else:
if b == "H":
print("D")
else:
print("H")
| a, b = input().split()
hd = "HD"
if a == "H":
print(b)
else:
print((hd[hd.index(b) - 1]))
| false | 25 | [
"+hd = \"HD\"",
"- if b == \"H\":",
"- print(\"D\")",
"- else:",
"- print(\"H\")",
"+ print((hd[hd.index(b) - 1]))"
] | false | 0.039309 | 0.039812 | 0.987374 | [
"s390447994",
"s627600664"
] |
u474423089 | p03095 | python | s173489107 | s604864096 | 1,091 | 33 | 3,572 | 3,828 | Accepted | Accepted | 96.98 | from collections import Counter
N=int(eval(input()))
S=eval(input())
mod = 10**9+7
d = Counter(S)
ans = 0
for i in S:
tmp = 1
d[i] -=1
for k,v in list(d.items()):
if i!=k and v:
tmp *=(v+1)
tmp%=mod
ans += tmp
ans %=mod
print(ans) | from collections import Counter
N=int(eval(input()))
S=eval(input())
mod = 10**9+7
d = Counter(S)
ans = 1
for v in list(d.values()):
ans *= v+1
ans %=mod
print((ans-1)) | 16 | 10 | 279 | 165 | from collections import Counter
N = int(eval(input()))
S = eval(input())
mod = 10**9 + 7
d = Counter(S)
ans = 0
for i in S:
tmp = 1
d[i] -= 1
for k, v in list(d.items()):
if i != k and v:
tmp *= v + 1
tmp %= mod
ans += tmp
ans %= mod
print(ans)
| from collections import Counter
N = int(eval(input()))
S = eval(input())
mod = 10**9 + 7
d = Counter(S)
ans = 1
for v in list(d.values()):
ans *= v + 1
ans %= mod
print((ans - 1))
| false | 37.5 | [
"-ans = 0",
"-for i in S:",
"- tmp = 1",
"- d[i] -= 1",
"- for k, v in list(d.items()):",
"- if i != k and v:",
"- tmp *= v + 1",
"- tmp %= mod",
"- ans += tmp",
"+ans = 1",
"+for v in list(d.values()):",
"+ ans *= v + 1",
"-print(ans)",
"+print(... | false | 0.112526 | 0.035505 | 3.169274 | [
"s173489107",
"s604864096"
] |
u506858457 | p02959 | python | s025858713 | s109577208 | 218 | 176 | 18,624 | 18,476 | Accepted | Accepted | 19.27 | N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for i in range(N):
left=min(A[i],B[i])
ans+=left
A[i]-=left
B[i]-=left
right=min(A[i+1],B[i])
ans+=right
A[i+1]-=right
B[i]-=right
print(ans) | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
killed = 0
for i in range(n):
now_kill = min(a[i], b[i])
killed += now_kill
#a[i] -= now_kill
b[i] -= now_kill
if b[i] == 0:continue
now_kill = min(a[i+1], b[i])
killed += now_kill
... | 14 | 18 | 257 | 376 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(N):
left = min(A[i], B[i])
ans += left
A[i] -= left
B[i] -= left
right = min(A[i + 1], B[i])
ans += right
A[i + 1] -= right
B[i] -= right
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
killed = 0
for i in range(n):
now_kill = min(a[i], b[i])
killed += now_kill
# a[i] -= now_kill
b[i] -= now_kill
if b[i] == 0:
continue
now_kill = min(a[i + 1], b[i])
killed += now_kill
... | false | 22.222222 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-ans = 0",
"-for i in range(N):",
"- left = min(A[i], B[i])",
"- ans += left",
"- A[i] -= left",
"- B[i] -= left",
"- right = min(A[i + 1], B[i])",
"- ans += right",
"-... | false | 0.035314 | 0.038142 | 0.925854 | [
"s025858713",
"s109577208"
] |
u562935282 | p02856 | python | s923569508 | s982371363 | 881 | 255 | 44,248 | 3,064 | Accepted | Accepted | 71.06 | def solve() -> '操作回数':
m = int(eval(input()))
digits = 0
sum_ = 0
for _ in range(m):
d, c = list(map(int, input().split()))
digits += c
sum_ += d * c
return (digits - 1) + (sum_ - 1) // 9
# 一回の操作で、
# 繰り上がりが起こらないとき一桁減る
# 繰り上がりが起こるとき合計値が9減る
# 最終的... | def main():
import sys
input = sys.stdin.readline
M = int(eval(input())) # M[1,2*10**5]
d_sum, c_sum = 0, 0
for _ in range(M):
d_, c_ = list(map(int, input().split()))
d_sum += d_ * c_
c_sum += c_
ret = ((d_sum - 9 + 8) // 9) + (c_sum - 1)
print(ret)
... | 19 | 21 | 401 | 400 | def solve() -> "操作回数":
m = int(eval(input()))
digits = 0
sum_ = 0
for _ in range(m):
d, c = list(map(int, input().split()))
digits += c
sum_ += d * c
return (digits - 1) + (sum_ - 1) // 9
# 一回の操作で、
# 繰り上がりが起こらないとき一桁減る
# 繰り上がりが起こるとき合計値が9減る
# 最終的に一桁の数値1~9が残るので、
... | def main():
import sys
input = sys.stdin.readline
M = int(eval(input())) # M[1,2*10**5]
d_sum, c_sum = 0, 0
for _ in range(M):
d_, c_ = list(map(int, input().split()))
d_sum += d_ * c_
c_sum += c_
ret = ((d_sum - 9 + 8) // 9) + (c_sum - 1)
print(ret)
if __name__ =... | false | 9.52381 | [
"-def solve() -> \"操作回数\":",
"- m = int(eval(input()))",
"- digits = 0",
"- sum_ = 0",
"- for _ in range(m):",
"- d, c = list(map(int, input().split()))",
"- digits += c",
"- sum_ += d * c",
"- return (digits - 1) + (sum_ - 1) // 9",
"- # 一回の操作で、",
"- # ... | false | 0.041361 | 0.156405 | 0.26445 | [
"s923569508",
"s982371363"
] |
u998733244 | p03146 | python | s367791259 | s023504624 | 177 | 162 | 38,256 | 38,384 | Accepted | Accepted | 8.47 | #!/usr/bin/env python3
S = int(eval(input()))
if S == 1 or S == 2 or S == 4:
print((4))
exit()
A = [S]
e = S
cnt = 0
while True:
if e % 2 == 0:
v = e//2
else:
v = 3*e+1
A.append(v)
e = v
cnt += 1
if v == 4:
print((cnt+4))
exit()
| #!/usr/bin/env python3
S = int(eval(input()))
if S == 1 or S == 2 or S == 4:
print((4))
exit()
e = S
cnt = 0
while True:
if e % 2 == 0:
v = e//2
else:
v = 3*e+1
e = v
cnt += 1
if v == 4:
print((cnt+4))
exit()
| 23 | 21 | 309 | 283 | #!/usr/bin/env python3
S = int(eval(input()))
if S == 1 or S == 2 or S == 4:
print((4))
exit()
A = [S]
e = S
cnt = 0
while True:
if e % 2 == 0:
v = e // 2
else:
v = 3 * e + 1
A.append(v)
e = v
cnt += 1
if v == 4:
print((cnt + 4))
exit()
| #!/usr/bin/env python3
S = int(eval(input()))
if S == 1 or S == 2 or S == 4:
print((4))
exit()
e = S
cnt = 0
while True:
if e % 2 == 0:
v = e // 2
else:
v = 3 * e + 1
e = v
cnt += 1
if v == 4:
print((cnt + 4))
exit()
| false | 8.695652 | [
"-A = [S]",
"- A.append(v)"
] | false | 0.039567 | 0.040846 | 0.968695 | [
"s367791259",
"s023504624"
] |
u227020436 | p03241 | python | s457911159 | s353538700 | 1,417 | 1,298 | 38,512 | 38,896 | Accepted | Accepted | 8.4 | import math
N, M = list(map(int, input().split()))
if N == 1:
print(M)
else:
d = max(d for d in range(1, math.ceil(M / (N - 1))) if M % d == 0)
print(d)
| N, M = list(map(int, input().split()))
if N == 1:
print(M)
else:
d = max(d for d in range(1, M // N + 1) if M % d == 0)
print(d)
| 9 | 7 | 169 | 142 | import math
N, M = list(map(int, input().split()))
if N == 1:
print(M)
else:
d = max(d for d in range(1, math.ceil(M / (N - 1))) if M % d == 0)
print(d)
| N, M = list(map(int, input().split()))
if N == 1:
print(M)
else:
d = max(d for d in range(1, M // N + 1) if M % d == 0)
print(d)
| false | 22.222222 | [
"-import math",
"-",
"- d = max(d for d in range(1, math.ceil(M / (N - 1))) if M % d == 0)",
"+ d = max(d for d in range(1, M // N + 1) if M % d == 0)"
] | false | 0.120763 | 0.060836 | 1.985046 | [
"s457911159",
"s353538700"
] |
u006883624 | p02773 | python | s703162769 | s472362263 | 747 | 629 | 47,660 | 20,680 | Accepted | Accepted | 15.8 | #from math import sqrt
#from heapq import heappush, heappop
#from collections import deque
n = int(eval(input()))
max_v = 0
s = {}
list = [[] for _ in range(n+1)]
for _ in range(n):
str = eval(input())
if str in s:
v = s[str] + 1
else:
v = 1
s[str] = v
max_v = max... | #from math import sqrt
#from heapq import heappush, heappop
#from collections import deque
n = int(eval(input()))
l = []
for _ in range(n):
s = eval(input())
l.append(s)
l.sort()
max_count = 0
count = 0
results = []
ps = None
for s in l:
if s == ps or ps is None:
count += 1
... | 24 | 38 | 409 | 677 | # from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
n = int(eval(input()))
max_v = 0
s = {}
list = [[] for _ in range(n + 1)]
for _ in range(n):
str = eval(input())
if str in s:
v = s[str] + 1
else:
v = 1
s[str] = v
max_v = max(max_v, v)
... | # from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
n = int(eval(input()))
l = []
for _ in range(n):
s = eval(input())
l.append(s)
l.sort()
max_count = 0
count = 0
results = []
ps = None
for s in l:
if s == ps or ps is None:
count += 1
else:
if m... | false | 36.842105 | [
"-max_v = 0",
"-s = {}",
"-list = [[] for _ in range(n + 1)]",
"+l = []",
"- str = eval(input())",
"- if str in s:",
"- v = s[str] + 1",
"+ s = eval(input())",
"+ l.append(s)",
"+l.sort()",
"+max_count = 0",
"+count = 0",
"+results = []",
"+ps = None",
"+for s in l:",
... | false | 0.036129 | 0.036503 | 0.989764 | [
"s703162769",
"s472362263"
] |
u739360929 | p03457 | python | s109162787 | s424581285 | 397 | 343 | 11,636 | 3,064 | Accepted | Accepted | 13.6 | def solve():
N = int(eval(input()))
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
t[0] = 0
x[0] = 0
y[0] = 0
for i in range(1, N+1):
t[i], x[i], y[i] = list(map(int, input().split()))
# 空間的に可能かどうか。奇数秒後はx+yが奇数に、偶数秒後はx+yが偶数にならないといけない。
if (t[i]%2==0 and ... | def solve():
N = int(eval(input()))
t_p = 0
x_p = 0
y_p = 0
for i in range(1, N+1):
t, x, y = list(map(int, input().split()))
# 空間的に可能かどうか。奇数秒後はx+yが奇数に、偶数秒後はx+yが偶数にならないといけない。
if (t%2==0 and (x+y)%2==1) or (t%2==1 and (x+y)%2==0):
print('No')
... | 23 | 21 | 610 | 531 | def solve():
N = int(eval(input()))
t = [0] * (N + 1)
x = [0] * (N + 1)
y = [0] * (N + 1)
t[0] = 0
x[0] = 0
y[0] = 0
for i in range(1, N + 1):
t[i], x[i], y[i] = list(map(int, input().split()))
# 空間的に可能かどうか。奇数秒後はx+yが奇数に、偶数秒後はx+yが偶数にならないといけない。
if (t[i] % 2 == 0 and... | def solve():
N = int(eval(input()))
t_p = 0
x_p = 0
y_p = 0
for i in range(1, N + 1):
t, x, y = list(map(int, input().split()))
# 空間的に可能かどうか。奇数秒後はx+yが奇数に、偶数秒後はx+yが偶数にならないといけない。
if (t % 2 == 0 and (x + y) % 2 == 1) or (t % 2 == 1 and (x + y) % 2 == 0):
print("No")
... | false | 8.695652 | [
"- t = [0] * (N + 1)",
"- x = [0] * (N + 1)",
"- y = [0] * (N + 1)",
"- t[0] = 0",
"- x[0] = 0",
"- y[0] = 0",
"+ t_p = 0",
"+ x_p = 0",
"+ y_p = 0",
"- t[i], x[i], y[i] = list(map(int, input().split()))",
"+ t, x, y = list(map(int, input().split()))",
... | false | 0.034588 | 0.043197 | 0.800705 | [
"s109162787",
"s424581285"
] |
u235376569 | p03796 | python | s164195452 | s340674042 | 84 | 67 | 62,784 | 62,536 | Accepted | Accepted | 20.24 | n=int(eval(input()))
ans=1
mod=10**9+7
for i in range(1,n+1):
ans=(ans*i)%mod
print(ans) | n=int(eval(input()))
ans=1
mod=10**9+7
for i in range(1,n+1):
ans=((ans%mod)*i)
print((ans%mod)) | 6 | 6 | 89 | 95 | n = int(eval(input()))
ans = 1
mod = 10**9 + 7
for i in range(1, n + 1):
ans = (ans * i) % mod
print(ans)
| n = int(eval(input()))
ans = 1
mod = 10**9 + 7
for i in range(1, n + 1):
ans = (ans % mod) * i
print((ans % mod))
| false | 0 | [
"- ans = (ans * i) % mod",
"-print(ans)",
"+ ans = (ans % mod) * i",
"+print((ans % mod))"
] | false | 0.111918 | 0.05003 | 2.237026 | [
"s164195452",
"s340674042"
] |
u397496203 | p02925 | python | s303437749 | s260582668 | 356 | 296 | 90,928 | 86,196 | Accepted | Accepted | 16.85 | import sys
# sys.setrecursionlimit(100000)
def input():
return sys.stdin.readline().strip()
def input_int():
return int(eval(input()))
def input_int_list():
return [int(i) for i in input().split()]
def main():
n = input_int()
d = dict()
for i in range(1, n + 1):
... | import sys
# sys.setrecursionlimit(100000)
def input():
return sys.stdin.readline().strip()
def input_int():
return int(eval(input()))
def input_int_list():
return [int(i) for i in input().split()]
def main():
n = input_int()
d = dict()
for i in range(1, n + 1):
... | 52 | 52 | 1,001 | 1,005 | import sys
# sys.setrecursionlimit(100000)
def input():
return sys.stdin.readline().strip()
def input_int():
return int(eval(input()))
def input_int_list():
return [int(i) for i in input().split()]
def main():
n = input_int()
d = dict()
for i in range(1, n + 1):
d[i] = input_int_l... | import sys
# sys.setrecursionlimit(100000)
def input():
return sys.stdin.readline().strip()
def input_int():
return int(eval(input()))
def input_int_list():
return [int(i) for i in input().split()]
def main():
n = input_int()
d = dict()
for i in range(1, n + 1):
d[i] = input_int_l... | false | 0 | [
"- if d[a]:",
"- candi.add(d[a][-1])",
"+ # if d[a]:",
"+ # candi.add(d[a][-1])"
] | false | 0.036995 | 0.036999 | 0.999878 | [
"s303437749",
"s260582668"
] |
u690536347 | p02579 | python | s725295570 | s296718503 | 1,556 | 954 | 126,384 | 122,512 | Accepted | Accepted | 38.69 | from collections import deque
from itertools import product
import sys
input=sys.stdin.readline
def solve():
H, W = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
l = [[1 if i=="#" else 0 for i in eval(input())] for _ in ra... | from collections import deque
import sys
input=sys.stdin.readline
def solve():
H, W = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
l = [[1 if i=="#" else 0 for i in eval(input())] for _ in range(H)]
q = deque([(0, (Ch... | 42 | 41 | 1,195 | 1,233 | from collections import deque
from itertools import product
import sys
input = sys.stdin.readline
def solve():
H, W = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
l = [[1 if i == "#" else 0 for i in eval(input())] for _ in range(H)]... | from collections import deque
import sys
input = sys.stdin.readline
def solve():
H, W = list(map(int, input().split()))
Ch, Cw = list(map(int, input().split()))
Dh, Dw = list(map(int, input().split()))
l = [[1 if i == "#" else 0 for i in eval(input())] for _ in range(H)]
q = deque([(0, (Ch - 1, C... | false | 2.380952 | [
"-from itertools import product",
"- for dh, dw in product(list(range(-2, 3)), repeat=2):",
"- if dh == 0 and dw == 0:",
"- continue",
"- hh, ww = h + dh, w + dw",
"- if not (0 <= hh < H and 0 <= ww < W):",
"- continue",
"- ... | false | 0.039108 | 0.117642 | 0.332432 | [
"s725295570",
"s296718503"
] |
u879309973 | p02820 | python | s026009905 | s416704946 | 1,946 | 40 | 15,800 | 4,084 | Accepted | Accepted | 97.94 | import numpy as np
def solve(n, k, r, s, p, t):
dp = np.zeros((n, 3), dtype=int)
win_hand_mapping = {
"r": "p",
"s": "r",
"p": "s"
}
score_mapping = {
"r": r,
"s": s,
"p": p
}
hand_index_mapping = {
"r": 0,
"s": 1,
... | """
References
----------
https://atcoder.jp/contests/abc149/submissions/9219652
"""
def solve(n, k, r, s, p, t):
score = 0
mapping = {"r": p, "s": r, "p": s}
t = list(t)
for i in range(k):
score += mapping[t[i]]
for i in range(k, n):
if t[i] == t[i-k]:
t[i] ... | 39 | 22 | 1,191 | 512 | import numpy as np
def solve(n, k, r, s, p, t):
dp = np.zeros((n, 3), dtype=int)
win_hand_mapping = {"r": "p", "s": "r", "p": "s"}
score_mapping = {"r": r, "s": s, "p": p}
hand_index_mapping = {"r": 0, "s": 1, "p": 2}
legal_hands_mapping = {i: [j for j in range(3) if i != j] for i in range(3)}
... | """
References
----------
https://atcoder.jp/contests/abc149/submissions/9219652
"""
def solve(n, k, r, s, p, t):
score = 0
mapping = {"r": p, "s": r, "p": s}
t = list(t)
for i in range(k):
score += mapping[t[i]]
for i in range(k, n):
if t[i] == t[i - k]:
t[i] = "x"
... | false | 43.589744 | [
"-import numpy as np",
"+\"\"\"",
"+References",
"+https://atcoder.jp/contests/abc149/submissions/9219652",
"+\"\"\"",
"- dp = np.zeros((n, 3), dtype=int)",
"- win_hand_mapping = {\"r\": \"p\", \"s\": \"r\", \"p\": \"s\"}",
"- score_mapping = {\"r\": r, \"s\": s, \"p\": p}",
"- hand_inde... | false | 0.288097 | 0.037812 | 7.619241 | [
"s026009905",
"s416704946"
] |
u191829404 | p03986 | python | s791050112 | s031088456 | 209 | 59 | 41,564 | 4,264 | Accepted | Accepted | 71.77 | import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき,A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutat... | import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき,A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutat... | 46 | 51 | 1,119 | 1,232 | import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき,A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(se... | import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき,A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(se... | false | 9.803922 | [
"+import re",
"-# from scipy.special import perm",
"-# from scipy.special import comb",
"+# from scipy.misc import perm",
"+# from scipy.misc import comb",
"-INF = float(\"inf\")",
"+def line_inpl(x):",
"+ return [i_inpl() for _ in range(x)]",
"+",
"+",
"+INF = int(1e18)",
"+MOD = int(1e9) ... | false | 0.109217 | 0.044867 | 2.434209 | [
"s791050112",
"s031088456"
] |
u297109012 | p03127 | python | s070807635 | s999326864 | 660 | 80 | 14,636 | 14,224 | Accepted | Accepted | 87.88 | from collections import Counter
def factor(N):
ret = []
i = 2
while N > 1:
if N % i == 0:
ret.append(i)
N //= i
else:
i += 1
return ret
def solve(N, As):
iter = Counter(factor(min(As)))
for a in As:
for k, v in l... |
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
assert (gcd(10, 3) == 1)
def solve(N, As):
k = min(As)
for a in As:
k = gcd(k, a)
return k
if __name__ == "__main__":
N = int(eval(input()))
As = list(map(int, input().split(" ")))
print((solve(N... | 39 | 18 | 821 | 320 | from collections import Counter
def factor(N):
ret = []
i = 2
while N > 1:
if N % i == 0:
ret.append(i)
N //= i
else:
i += 1
return ret
def solve(N, As):
iter = Counter(factor(min(As)))
for a in As:
for k, v in list(iter.items()):
... | def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
assert gcd(10, 3) == 1
def solve(N, As):
k = min(As)
for a in As:
k = gcd(k, a)
return k
if __name__ == "__main__":
N = int(eval(input()))
As = list(map(int, input().split(" ")))
print((solve(N, As)))
| false | 53.846154 | [
"-from collections import Counter",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"+ return gcd(b, a % b)",
"-def factor(N):",
"- ret = []",
"- i = 2",
"- while N > 1:",
"- if N % i == 0:",
"- ret.append(i)",
"- N //= i",
"- else:"... | false | 0.13062 | 0.037605 | 3.473504 | [
"s070807635",
"s999326864"
] |
u780465569 | p02775 | python | s873265189 | s383425146 | 423 | 326 | 123,176 | 115,496 | Accepted | Accepted | 22.93 | import sys
readline = sys.stdin.readline
N = readline().rstrip()
N = list(map(int, N))
L = len(N)
total = 0
a = [0] * L
for i in range(L - 1, -1, -1):
k = N[i]
if k <= 4:
a[i] = 0 # none
total += k
elif k >= 6:
a[i] = 1 # age
total += 10 - k
if ... | import sys
readline = sys.stdin.readline
N = readline().rstrip()
N = list(map(int, N))
L = len(N)
total = 0
for i in range(L - 1, -1, -1):
k = N[i]
if k <= 4:
total += k
elif k >= 6:
total += 10 - k
if i == 0:
total += 1
else:
N[i ... | 39 | 30 | 700 | 557 | import sys
readline = sys.stdin.readline
N = readline().rstrip()
N = list(map(int, N))
L = len(N)
total = 0
a = [0] * L
for i in range(L - 1, -1, -1):
k = N[i]
if k <= 4:
a[i] = 0 # none
total += k
elif k >= 6:
a[i] = 1 # age
total += 10 - k
if i == 0:
... | import sys
readline = sys.stdin.readline
N = readline().rstrip()
N = list(map(int, N))
L = len(N)
total = 0
for i in range(L - 1, -1, -1):
k = N[i]
if k <= 4:
total += k
elif k >= 6:
total += 10 - k
if i == 0:
total += 1
else:
N[i - 1] += 1
else:
... | false | 23.076923 | [
"-a = [0] * L",
"- a[i] = 0 # none",
"- a[i] = 1 # age",
"- a[i] = 0",
"- a[i] = 0",
"- a[i] = 1"
] | false | 0.034191 | 0.041877 | 0.816462 | [
"s873265189",
"s383425146"
] |
u411302151 | p02712 | python | s531356007 | s879799138 | 25 | 22 | 9,172 | 9,092 | Accepted | Accepted | 12 | from math import floor
N = int(eval(input()))
S = int((N * (N+1)) / 2)
fizz = floor(N/3)
buzz = floor(N/5)
fizzbuzz = floor(N/15)
print((S - int(3 * fizz * (fizz+1)/2) -
int(5*buzz*(buzz+1) /2) +
int(15 * fizzbuzz * (fizzbuzz+1)/2))) | from math import floor
def sum(x):
return int(x *(x+1)/2)
N = int(eval(input()))
S = sum(N)
fizz = floor(N/3)
buzz = floor(N/5)
fizzbuzz = floor(N/15)
print((S - 3 * sum(fizz) - 5*sum(buzz) + 15 * sum(fizzbuzz))) | 11 | 11 | 257 | 220 | from math import floor
N = int(eval(input()))
S = int((N * (N + 1)) / 2)
fizz = floor(N / 3)
buzz = floor(N / 5)
fizzbuzz = floor(N / 15)
print(
(
S
- int(3 * fizz * (fizz + 1) / 2)
- int(5 * buzz * (buzz + 1) / 2)
+ int(15 * fizzbuzz * (fizzbuzz + 1) / 2)
)
)
| from math import floor
def sum(x):
return int(x * (x + 1) / 2)
N = int(eval(input()))
S = sum(N)
fizz = floor(N / 3)
buzz = floor(N / 5)
fizzbuzz = floor(N / 15)
print((S - 3 * sum(fizz) - 5 * sum(buzz) + 15 * sum(fizzbuzz)))
| false | 0 | [
"+",
"+def sum(x):",
"+ return int(x * (x + 1) / 2)",
"+",
"+",
"-S = int((N * (N + 1)) / 2)",
"+S = sum(N)",
"-print(",
"- (",
"- S",
"- - int(3 * fizz * (fizz + 1) / 2)",
"- - int(5 * buzz * (buzz + 1) / 2)",
"- + int(15 * fizzbuzz * (fizzbuzz + 1) / 2)",
... | false | 0.038438 | 0.049264 | 0.780247 | [
"s531356007",
"s879799138"
] |
u867848444 | p03448 | python | s553248450 | s902909611 | 53 | 18 | 3,060 | 3,060 | Accepted | Accepted | 66.04 | l=[int(eval(input())) for i in range(3)]
x=int(eval(input()))
ans=0
count=0
for i in range(1+l[0]):
for j in range(1+l[1]):
for k in range(1+l[2]):
ans=500*i+100*j+50*k
if ans==x:
count+=1
print(count) | l=[int(eval(input())) for i in range(3)]
x=int(eval(input()))
ans=0
count=0
for i in range(1+l[0]):
for j in range(1+l[1]):
ans=x-500*i-100*j
if ans>=0 and ans<=50*l[2]:
count+=1
print(count) | 11 | 12 | 251 | 240 | l = [int(eval(input())) for i in range(3)]
x = int(eval(input()))
ans = 0
count = 0
for i in range(1 + l[0]):
for j in range(1 + l[1]):
for k in range(1 + l[2]):
ans = 500 * i + 100 * j + 50 * k
if ans == x:
count += 1
print(count)
| l = [int(eval(input())) for i in range(3)]
x = int(eval(input()))
ans = 0
count = 0
for i in range(1 + l[0]):
for j in range(1 + l[1]):
ans = x - 500 * i - 100 * j
if ans >= 0 and ans <= 50 * l[2]:
count += 1
print(count)
| false | 8.333333 | [
"- for k in range(1 + l[2]):",
"- ans = 500 * i + 100 * j + 50 * k",
"- if ans == x:",
"- count += 1",
"+ ans = x - 500 * i - 100 * j",
"+ if ans >= 0 and ans <= 50 * l[2]:",
"+ count += 1"
] | false | 0.069278 | 0.035107 | 1.973303 | [
"s553248450",
"s902909611"
] |
u462831976 | p00023 | python | s221486697 | s011355574 | 30 | 20 | 7,720 | 7,596 | Accepted | Accepted | 33.33 | # -*- coding: utf-8 -*-
import sys
import os
import math
N = int(eval(input()))
for i in range(N):
ax, ay, ar, bx, by, br = list(map(float, input().split()))
between_center = math.sqrt( (ax-bx)**2 + (ay-by)**2 )
# ????????£????????????
if between_center > ar + br:
print((0)... | # -*- coding: utf-8 -*-
import sys
import os
import math
N = int(eval(input()))
for i in range(N):
ax, ay, ar, bx, by, br = list(map(float, input().split()))
between_center = math.hypot(ax - bx, ay - by)
# ????????£????????????
if between_center > ar + br:
print((0))
... | 30 | 30 | 549 | 541 | # -*- coding: utf-8 -*-
import sys
import os
import math
N = int(eval(input()))
for i in range(N):
ax, ay, ar, bx, by, br = list(map(float, input().split()))
between_center = math.sqrt((ax - bx) ** 2 + (ay - by) ** 2)
# ????????£????????????
if between_center > ar + br:
print((0))
# ???????... | # -*- coding: utf-8 -*-
import sys
import os
import math
N = int(eval(input()))
for i in range(N):
ax, ay, ar, bx, by, br = list(map(float, input().split()))
between_center = math.hypot(ax - bx, ay - by)
# ????????£????????????
if between_center > ar + br:
print((0))
# ????????????????????¨... | false | 0 | [
"- between_center = math.sqrt((ax - bx) ** 2 + (ay - by) ** 2)",
"+ between_center = math.hypot(ax - bx, ay - by)"
] | false | 0.047509 | 0.122029 | 0.389326 | [
"s221486697",
"s011355574"
] |
u707498674 | p02692 | python | s663919344 | s272378333 | 187 | 131 | 18,644 | 18,676 | Accepted | Accepted | 29.95 | import sys
def input() : return sys.stdin.readline().strip()
def main():
N, A, B, C = map(int, input().split())
s = tuple(input() for _ in range(N))
d = {}
d["A"] = A
d["B"] = B
d["C"] = C
ans = []
for i in range(N-1):
l1, r1 = s[i]
l2, r2 = s[i+1]
... | import sys
def input() : return sys.stdin.readline().strip()
def main():
N, A, B, C = map(int, input().split())
s = list(input() for _ in range(N))
d = {}
d["A"] = A
d["B"] = B
d["C"] = C
ans = []
s.append("XX")
for i in range(N):
l1, r1 = s[i]
l2... | 80 | 41 | 2,132 | 846 | import sys
def input():
return sys.stdin.readline().strip()
def main():
N, A, B, C = map(int, input().split())
s = tuple(input() for _ in range(N))
d = {}
d["A"] = A
d["B"] = B
d["C"] = C
ans = []
for i in range(N - 1):
l1, r1 = s[i]
l2, r2 = s[i + 1]
if d... | import sys
def input():
return sys.stdin.readline().strip()
def main():
N, A, B, C = map(int, input().split())
s = list(input() for _ in range(N))
d = {}
d["A"] = A
d["B"] = B
d["C"] = C
ans = []
s.append("XX")
for i in range(N):
l1, r1 = s[i]
l2, r2 = s[i + 1... | false | 48.75 | [
"- s = tuple(input() for _ in range(N))",
"+ s = list(input() for _ in range(N))",
"- for i in range(N - 1):",
"+ s.append(\"XX\")",
"+ for i in range(N):",
"- if d[\"A\"] * d[\"B\"] * d[\"C\"]:",
"- temp = [d[l1], d[r1]]",
"- max_val = max(temp)",
"- ... | false | 0.039506 | 0.040556 | 0.974105 | [
"s663919344",
"s272378333"
] |
u310233294 | p03087 | python | s226588316 | s944974860 | 879 | 481 | 24,840 | 30,664 | Accepted | Accepted | 45.28 | n, q = list(map(int, input().split()))
s = eval(input())
t = [0] * (n + 1)
nl = set(range(n))
for i in nl:
t[i + 1] = t[i] + (1 if s[i:i + 2] == 'AC' else 0)
ql = set(range(q))
for i in ql:
l1, l2 = list(map(int, input().split()))
ans = t[l2-1] - t[l1-1]
print(ans) | N, Q = list(map(int, input().split()))
S = eval(input())
lr = [list(map(int, input().split())) for _ in range(Q)]
s = [0] * N
for i in range(N-1):
if S[i:i + 2] == 'AC':
s[i+1] = s[i] + 1
else:
s[i+1] = s[i]
for l, r in lr:
print((s[r-1] - s[l-1])) | 11 | 11 | 273 | 272 | n, q = list(map(int, input().split()))
s = eval(input())
t = [0] * (n + 1)
nl = set(range(n))
for i in nl:
t[i + 1] = t[i] + (1 if s[i : i + 2] == "AC" else 0)
ql = set(range(q))
for i in ql:
l1, l2 = list(map(int, input().split()))
ans = t[l2 - 1] - t[l1 - 1]
print(ans)
| N, Q = list(map(int, input().split()))
S = eval(input())
lr = [list(map(int, input().split())) for _ in range(Q)]
s = [0] * N
for i in range(N - 1):
if S[i : i + 2] == "AC":
s[i + 1] = s[i] + 1
else:
s[i + 1] = s[i]
for l, r in lr:
print((s[r - 1] - s[l - 1]))
| false | 0 | [
"-n, q = list(map(int, input().split()))",
"-s = eval(input())",
"-t = [0] * (n + 1)",
"-nl = set(range(n))",
"-for i in nl:",
"- t[i + 1] = t[i] + (1 if s[i : i + 2] == \"AC\" else 0)",
"-ql = set(range(q))",
"-for i in ql:",
"- l1, l2 = list(map(int, input().split()))",
"- ans = t[l2 - ... | false | 0.039568 | 0.055301 | 0.715505 | [
"s226588316",
"s944974860"
] |
u268793453 | p04006 | python | s195025889 | s305254777 | 1,653 | 1,046 | 3,188 | 3,188 | Accepted | Accepted | 36.72 | n, x = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = A[:]
ans = sum(A)
for i in range(1, n):
for j in range(n):
B[j] = min(B[j], A[j-i])
ans = min(ans, sum(B) + i * x)
print(ans) | n, x = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = A[:]
ans = sum(A)
for i in range(1, n):
B = [min(B[j], A[j-i]) for j in range(n)]
ans = min(ans, sum(B) + i * x)
print(ans) | 12 | 11 | 238 | 227 | n, x = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = A[:]
ans = sum(A)
for i in range(1, n):
for j in range(n):
B[j] = min(B[j], A[j - i])
ans = min(ans, sum(B) + i * x)
print(ans)
| n, x = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = A[:]
ans = sum(A)
for i in range(1, n):
B = [min(B[j], A[j - i]) for j in range(n)]
ans = min(ans, sum(B) + i * x)
print(ans)
| false | 8.333333 | [
"- for j in range(n):",
"- B[j] = min(B[j], A[j - i])",
"+ B = [min(B[j], A[j - i]) for j in range(n)]"
] | false | 0.03581 | 0.035761 | 1.001377 | [
"s195025889",
"s305254777"
] |
u580697892 | p03262 | python | s885639574 | s049058484 | 181 | 98 | 16,244 | 16,240 | Accepted | Accepted | 45.86 | # coding: utf-8
try:
from math import gcd
except:
from fractions import gcd
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(X)
x.sort()
l = []
for i in range(N):
tmp = (x[i+1] - x[i])
if tmp != 0:
l.append(tmp)
l.sort()
ans = l[0]
for i in rang... | # coding: utf-8
from fractions import gcd
N, X = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = abs(A[0] - X)
for i in range(1, N):
ans = gcd(ans, abs(A[i] - X))
print(ans) | 19 | 8 | 365 | 204 | # coding: utf-8
try:
from math import gcd
except:
from fractions import gcd
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(X)
x.sort()
l = []
for i in range(N):
tmp = x[i + 1] - x[i]
if tmp != 0:
l.append(tmp)
l.sort()
ans = l[0]
for i in range(1, len(l)):
... | # coding: utf-8
from fractions import gcd
N, X = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = abs(A[0] - X)
for i in range(1, N):
ans = gcd(ans, abs(A[i] - X))
print(ans)
| false | 57.894737 | [
"-try:",
"- from math import gcd",
"-except:",
"- from fractions import gcd",
"+from fractions import gcd",
"+",
"-x = list(map(int, input().split()))",
"-x.append(X)",
"-x.sort()",
"-l = []",
"-for i in range(N):",
"- tmp = x[i + 1] - x[i]",
"- if tmp != 0:",
"- l.appen... | false | 0.035597 | 0.041385 | 0.860142 | [
"s885639574",
"s049058484"
] |
u867848444 | p03274 | python | s691823866 | s260417517 | 96 | 81 | 14,380 | 14,388 | Accepted | Accepted | 15.62 | n,k=list(map(int,input().split()))
x=list(map(int,input().split()))
ans=float('inf')
for i in range(n-k+1):
ans=min(ans,abs(x[i])+abs(x[i]-x[i+k-1]),abs(x[i+k-1])+abs(x[i]-x[i+k-1]))
print(ans) | n,k=list(map(int,input().split()))
x=list(map(int,input().split()))
ans=float('inf')
for i in range(n-k+1):
temp=x[i+k-1]-x[i]+min(abs(x[i]),abs(x[i+k-1]))
if ans>temp:ans=temp
print(ans) | 8 | 8 | 204 | 197 | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = float("inf")
for i in range(n - k + 1):
ans = min(
ans,
abs(x[i]) + abs(x[i] - x[i + k - 1]),
abs(x[i + k - 1]) + abs(x[i] - x[i + k - 1]),
)
print(ans)
| n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = float("inf")
for i in range(n - k + 1):
temp = x[i + k - 1] - x[i] + min(abs(x[i]), abs(x[i + k - 1]))
if ans > temp:
ans = temp
print(ans)
| false | 0 | [
"- ans = min(",
"- ans,",
"- abs(x[i]) + abs(x[i] - x[i + k - 1]),",
"- abs(x[i + k - 1]) + abs(x[i] - x[i + k - 1]),",
"- )",
"+ temp = x[i + k - 1] - x[i] + min(abs(x[i]), abs(x[i + k - 1]))",
"+ if ans > temp:",
"+ ans = temp"
] | false | 0.14829 | 0.113221 | 1.309741 | [
"s691823866",
"s260417517"
] |
u093607836 | p00002 | python | s791788929 | s336325397 | 20 | 10 | 4,200 | 4,180 | Accepted | Accepted | 50 | import sys
for line in sys.stdin:
l = [int(i) for i in line.split(' ')]
print(len(str(l[0] + l[1]))) | import sys
for s in sys.stdin:
a,b = list(map(int,s.split()))
print(len(str(a+b))) | 4 | 5 | 108 | 82 | import sys
for line in sys.stdin:
l = [int(i) for i in line.split(" ")]
print(len(str(l[0] + l[1])))
| import sys
for s in sys.stdin:
a, b = list(map(int, s.split()))
print(len(str(a + b)))
| false | 20 | [
"-for line in sys.stdin:",
"- l = [int(i) for i in line.split(\" \")]",
"- print(len(str(l[0] + l[1])))",
"+for s in sys.stdin:",
"+ a, b = list(map(int, s.split()))",
"+ print(len(str(a + b)))"
] | false | 0.04873 | 0.048199 | 1.011024 | [
"s791788929",
"s336325397"
] |
u764215612 | p02691 | python | s341828335 | s560506063 | 162 | 127 | 32,376 | 32,248 | Accepted | Accepted | 21.6 | n = int(eval(input()))
a = list(map(int, input().split()))
d = [0]*n
for i in range(n):
if i+a[i] < n: d[i+a[i]] += 1
ans = 0
for i in range(n):
if i-a[i] >= 0: ans += d[i-a[i]]
print(ans) | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
d = [0]*n
for i in range(n):
if i+a[i] < n: d[i+a[i]] += 1
ans = 0
for i in range(n):
if i-a[i] >= 0: ans += d[i-a[i]]
print(ans)
main() | 9 | 11 | 194 | 233 | n = int(eval(input()))
a = list(map(int, input().split()))
d = [0] * n
for i in range(n):
if i + a[i] < n:
d[i + a[i]] += 1
ans = 0
for i in range(n):
if i - a[i] >= 0:
ans += d[i - a[i]]
print(ans)
| def main():
n = int(eval(input()))
a = list(map(int, input().split()))
d = [0] * n
for i in range(n):
if i + a[i] < n:
d[i + a[i]] += 1
ans = 0
for i in range(n):
if i - a[i] >= 0:
ans += d[i - a[i]]
print(ans)
main()
| false | 18.181818 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-d = [0] * n",
"-for i in range(n):",
"- if i + a[i] < n:",
"- d[i + a[i]] += 1",
"-ans = 0",
"-for i in range(n):",
"- if i - a[i] >= 0:",
"- ans += d[i - a[i]]",
"-print(ans)",
"+def main():",
"+ n =... | false | 0.038191 | 0.097186 | 0.392969 | [
"s341828335",
"s560506063"
] |
u476604182 | p02839 | python | s819229349 | s131478246 | 445 | 91 | 173,700 | 20,596 | Accepted | Accepted | 79.55 | import numpy as np
H,W = list(map(int,input().split()))
A = [[0]*W for i in range(H)]
B = [[0]*W for i in range(H)]
for i in range(H):
inf = [int(c) for c in input().split()]
for j in range(W):
A[i][j] = inf[j]
for i in range(H):
inf = [int(c) for c in input().split()]
for j in range(W):
... | H, W = list(map(int, input().split()))
A = [[0]*W for i in range(H)]
B = [[0]*W for i in range(H)]
for i in range(H):
inf = [int(c) for c in input().split()]
for j in range(W):
A[i][j] = inf[j]
for i in range(H):
inf = [int(c) for c in input().split()]
for j in range(W):
B[i][j] = inf[j]
... | 40 | 39 | 989 | 844 | import numpy as np
H, W = list(map(int, input().split()))
A = [[0] * W for i in range(H)]
B = [[0] * W for i in range(H)]
for i in range(H):
inf = [int(c) for c in input().split()]
for j in range(W):
A[i][j] = inf[j]
for i in range(H):
inf = [int(c) for c in input().split()]
for j in range(W):
... | H, W = list(map(int, input().split()))
A = [[0] * W for i in range(H)]
B = [[0] * W for i in range(H)]
for i in range(H):
inf = [int(c) for c in input().split()]
for j in range(W):
A[i][j] = inf[j]
for i in range(H):
inf = [int(c) for c in input().split()]
for j in range(W):
B[i][j] = in... | false | 2.5 | [
"-import numpy as np",
"-",
"-L = X + X + 1",
"-# X点持った状態から始める",
"-dp = [[0] * W for _ in range(H)]",
"+dp = [[0] * W for i in range(H)]",
"-dp[0][0] = np.zeros(L, np.bool)",
"-dp[0][0][X + d] = 1",
"-for h in range(H):",
"- for w, (a, b) in enumerate(zip(A[h], B[h])):",
"- if h == w =... | false | 0.190622 | 0.065384 | 2.915411 | [
"s819229349",
"s131478246"
] |
u170350182 | p02835 | python | s610109563 | s429223866 | 204 | 173 | 38,384 | 38,384 | Accepted | Accepted | 15.2 |
a,b,c = list(map(int,input().split()))
if(a+b+c>=22):
print("bust")
else:
print("win") | a,b,c = list(map(int,input().split()))
a = a+b+c
if(a>=22):
print("bust")
else:
print("win") | 6 | 7 | 90 | 101 | a, b, c = list(map(int, input().split()))
if a + b + c >= 22:
print("bust")
else:
print("win")
| a, b, c = list(map(int, input().split()))
a = a + b + c
if a >= 22:
print("bust")
else:
print("win")
| false | 14.285714 | [
"-if a + b + c >= 22:",
"+a = a + b + c",
"+if a >= 22:"
] | false | 0.105949 | 0.044021 | 2.406771 | [
"s610109563",
"s429223866"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.