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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u133936772 | p02837 | python | s058773035 | s862591719 | 1,281 | 85 | 12,792 | 3,064 | Accepted | Accepted | 93.36 | import sys
input = sys.stdin.readline
n = int(eval(input()))
la, lxy = [], []
for i in range(n):
a = int(eval(input()))
la.append(a)
xy = []
for j in range(a):
xy.append(list(map(int, input().split())))
lxy.append(xy)
from itertools import product
lb = [''.join(b) for b in product('01', ... | import sys, itertools
input = sys.stdin.readline
n = int(eval(input()))
ll = []
for i in range(n):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
ll.append([i, x-1, y])
ans = 0
for p in itertools.product([1,0], repeat=n):
ok = 1
for l in ll:
if p[... | 34 | 23 | 705 | 412 | import sys
input = sys.stdin.readline
n = int(eval(input()))
la, lxy = [], []
for i in range(n):
a = int(eval(input()))
la.append(a)
xy = []
for j in range(a):
xy.append(list(map(int, input().split())))
lxy.append(xy)
from itertools import product
lb = ["".join(b) for b in product("01", re... | import sys, itertools
input = sys.stdin.readline
n = int(eval(input()))
ll = []
for i in range(n):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
ll.append([i, x - 1, y])
ans = 0
for p in itertools.product([1, 0], repeat=n):
ok = 1
for l in ll:
... | false | 32.352941 | [
"-import sys",
"+import sys, itertools",
"-la, lxy = [], []",
"+ll = []",
"- la.append(a)",
"- xy = []",
"- xy.append(list(map(int, input().split())))",
"- lxy.append(xy)",
"-from itertools import product",
"-",
"-lb = [\"\".join(b) for b in product(\"01\", repeat=n)]",
"-lc = ... | false | 0.043442 | 0.035571 | 1.221264 | [
"s058773035",
"s862591719"
] |
u780342333 | p02268 | python | s406573756 | s444990259 | 510 | 50 | 18,992 | 16,600 | Accepted | Accepted | 90.2 | n = int(eval(input()))
S = [int(x) for x in input().split()]
q = int(eval(input()))
T = [int(x) for x in input().split()]
res = 0
for key in T:
left = 0
right = n
while left < right:
mid = (left + right) // 2
if S[mid] == key:
res += 1
right = -1
... | len_a = eval(input())
a = set(map(int, input().split()))
len_b = eval(input())
b = set(map(int, input().split()))
print((len(a & b)))
| 21 | 6 | 412 | 126 | n = int(eval(input()))
S = [int(x) for x in input().split()]
q = int(eval(input()))
T = [int(x) for x in input().split()]
res = 0
for key in T:
left = 0
right = n
while left < right:
mid = (left + right) // 2
if S[mid] == key:
res += 1
right = -1
elif key < S[... | len_a = eval(input())
a = set(map(int, input().split()))
len_b = eval(input())
b = set(map(int, input().split()))
print((len(a & b)))
| false | 71.428571 | [
"-n = int(eval(input()))",
"-S = [int(x) for x in input().split()]",
"-q = int(eval(input()))",
"-T = [int(x) for x in input().split()]",
"-res = 0",
"-for key in T:",
"- left = 0",
"- right = n",
"- while left < right:",
"- mid = (left + right) // 2",
"- if S[mid] == key:... | false | 0.088349 | 0.041192 | 2.14482 | [
"s406573756",
"s444990259"
] |
u644907318 | p02972 | python | s145378907 | s058554786 | 550 | 143 | 14,136 | 107,532 | Accepted | Accepted | 74 | N = int(eval(input()))
A = list(map(int,input().split()))
A.insert(0,0)
B = [0 for _ in range(N+1)]
B[N//2+1:] = A[N//2+1:]
for i in range(N//2,0,-1):
tot = 0
for j in range(2*i,N+1,i):
tot += B[j]
B[i] = (A[i]+tot)%2
C = []
M = 0
for i in range(1,N+1):
if B[i]==1:
M += 1
... | N = int(eval(input()))
A = list(map(int,input().split()))
A.insert(0,0)
B = [0 for _ in range(N+1)]
for i in range(N//2+1,N+1):
B[i] = A[i]
for i in range(N//2,0,-1):
cnt = A[i]
for j in range(2,N//i+1):
cnt = (cnt+B[i*j])%2
B[i] = cnt
C = []
for i in range(1,N+1):
if B[i]==1:
... | 19 | 17 | 368 | 359 | N = int(eval(input()))
A = list(map(int, input().split()))
A.insert(0, 0)
B = [0 for _ in range(N + 1)]
B[N // 2 + 1 :] = A[N // 2 + 1 :]
for i in range(N // 2, 0, -1):
tot = 0
for j in range(2 * i, N + 1, i):
tot += B[j]
B[i] = (A[i] + tot) % 2
C = []
M = 0
for i in range(1, N + 1):
if B[i] == ... | N = int(eval(input()))
A = list(map(int, input().split()))
A.insert(0, 0)
B = [0 for _ in range(N + 1)]
for i in range(N // 2 + 1, N + 1):
B[i] = A[i]
for i in range(N // 2, 0, -1):
cnt = A[i]
for j in range(2, N // i + 1):
cnt = (cnt + B[i * j]) % 2
B[i] = cnt
C = []
for i in range(1, N + 1):
... | false | 10.526316 | [
"-B[N // 2 + 1 :] = A[N // 2 + 1 :]",
"+for i in range(N // 2 + 1, N + 1):",
"+ B[i] = A[i]",
"- tot = 0",
"- for j in range(2 * i, N + 1, i):",
"- tot += B[j]",
"- B[i] = (A[i] + tot) % 2",
"+ cnt = A[i]",
"+ for j in range(2, N // i + 1):",
"+ cnt = (cnt + B[i * j... | false | 0.038227 | 0.038224 | 1.000077 | [
"s145378907",
"s058554786"
] |
u983918956 | p03147 | python | s931826446 | s084946727 | 63 | 45 | 3,064 | 3,060 | Accepted | Accepted | 28.57 | N = int(eval(input()))
h = list(map(int,input().split()))
if h == [0]*N:
print((0))
exit()
for i in range(1,10001):
f = False
for j in range(N):
if h[j] > 0:
h[j] -= 1
f = True
elif h[j] <= 0 and f:
break
if h == [0]*N:
ans = ... | N = int(eval(input()))
H = list(map(int,input().split()))
cnt = 0
for _ in range(10**4):
if any(H) is False:
break
cnt += 1
f = False
for i in range(len(H)):
if H[i] > 0:
H[i] -= 1
f = True
elif f and H[i] == 0:
break
print(cnt) | 17 | 15 | 340 | 312 | N = int(eval(input()))
h = list(map(int, input().split()))
if h == [0] * N:
print((0))
exit()
for i in range(1, 10001):
f = False
for j in range(N):
if h[j] > 0:
h[j] -= 1
f = True
elif h[j] <= 0 and f:
break
if h == [0] * N:
ans = i
... | N = int(eval(input()))
H = list(map(int, input().split()))
cnt = 0
for _ in range(10**4):
if any(H) is False:
break
cnt += 1
f = False
for i in range(len(H)):
if H[i] > 0:
H[i] -= 1
f = True
elif f and H[i] == 0:
break
print(cnt)
| false | 11.764706 | [
"-h = list(map(int, input().split()))",
"-if h == [0] * N:",
"- print((0))",
"- exit()",
"-for i in range(1, 10001):",
"+H = list(map(int, input().split()))",
"+cnt = 0",
"+for _ in range(10**4):",
"+ if any(H) is False:",
"+ break",
"+ cnt += 1",
"- for j in range(N):",
... | false | 0.04508 | 0.037616 | 1.19843 | [
"s931826446",
"s084946727"
] |
u825981710 | p03073 | python | s401026608 | s634841805 | 39 | 18 | 3,188 | 3,188 | Accepted | Accepted | 53.85 | s=eval(input())
N=len(s)
A=0
B=0
for i in range(0,N,2):
if s[i]=='0':
A+=1
if i+1==N:
break
if s[i+1]=='1':
B+=1
if A+B<=N/2:
print((A+B))
else:
print((N-(A+B)))
| s=eval(input())
ptn1=s[::2].count('0')+s[1::2].count('1')
ptn2=s[::2].count('1')+s[1::2].count('0')
print((min(ptn1,ptn2)))
| 15 | 4 | 210 | 119 | s = eval(input())
N = len(s)
A = 0
B = 0
for i in range(0, N, 2):
if s[i] == "0":
A += 1
if i + 1 == N:
break
if s[i + 1] == "1":
B += 1
if A + B <= N / 2:
print((A + B))
else:
print((N - (A + B)))
| s = eval(input())
ptn1 = s[::2].count("0") + s[1::2].count("1")
ptn2 = s[::2].count("1") + s[1::2].count("0")
print((min(ptn1, ptn2)))
| false | 73.333333 | [
"-N = len(s)",
"-A = 0",
"-B = 0",
"-for i in range(0, N, 2):",
"- if s[i] == \"0\":",
"- A += 1",
"- if i + 1 == N:",
"- break",
"- if s[i + 1] == \"1\":",
"- B += 1",
"-if A + B <= N / 2:",
"- print((A + B))",
"-else:",
"- print((N - (A + B)))",
"+pt... | false | 0.036546 | 0.035198 | 1.038289 | [
"s401026608",
"s634841805"
] |
u767664985 | p03730 | python | s498008790 | s189395484 | 38 | 18 | 5,176 | 2,940 | Accepted | Accepted | 52.63 | from fractions import gcd
A, B, C = list(map(int, input().split()))
if C % gcd(A, B) == 0:
print("YES")
else:
print("NO")
| A, B, C = list(map(int, input().split()))
for i in range(B):
if (A*i)%B == C:
print("YES")
exit()
print("NO")
| 6 | 6 | 123 | 129 | from fractions import gcd
A, B, C = list(map(int, input().split()))
if C % gcd(A, B) == 0:
print("YES")
else:
print("NO")
| A, B, C = list(map(int, input().split()))
for i in range(B):
if (A * i) % B == C:
print("YES")
exit()
print("NO")
| false | 0 | [
"-from fractions import gcd",
"-",
"-if C % gcd(A, B) == 0:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+for i in range(B):",
"+ if (A * i) % B == C:",
"+ print(\"YES\")",
"+ exit()",
"+print(\"NO\")"
] | false | 0.042688 | 0.035198 | 1.212783 | [
"s498008790",
"s189395484"
] |
u608088992 | p03674 | python | s792793855 | s632136337 | 406 | 326 | 20,472 | 34,844 | Accepted | Accepted | 19.7 | def Pow(i, n):
if n == 0:
return 1
else:
ans = Pow(i * i % mod, n//2)
if n % 2 == 1:
ans *= i
ans %= mod
return ans
N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 7 + 10 ** 9
num = [-1 for i in range(N)]
for i, a in enume... | import sys
mod = 7 + 10 ** 9
def comb(n, r, fact, revfact, mod):
return (fact[n] * revfact[n-r] * revfact[r]) % mod
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [int(a) for a in input().split()]
Ad = dict()
double = []
for i, a in enumerate(A):
if... | 37 | 36 | 964 | 1,013 | def Pow(i, n):
if n == 0:
return 1
else:
ans = Pow(i * i % mod, n // 2)
if n % 2 == 1:
ans *= i
ans %= mod
return ans
N = int(eval(input()))
A = [int(i) for i in input().split()]
mod = 7 + 10**9
num = [-1 for i in range(N)]
for i, a in enumerate(A):
... | import sys
mod = 7 + 10**9
def comb(n, r, fact, revfact, mod):
return (fact[n] * revfact[n - r] * revfact[r]) % mod
def solve():
input = sys.stdin.readline
N = int(eval(input()))
A = [int(a) for a in input().split()]
Ad = dict()
double = []
for i, a in enumerate(A):
if a in Ad:
... | false | 2.702703 | [
"-def Pow(i, n):",
"- if n == 0:",
"- return 1",
"- else:",
"- ans = Pow(i * i % mod, n // 2)",
"- if n % 2 == 1:",
"- ans *= i",
"- ans %= mod",
"- return ans",
"+import sys",
"+",
"+mod = 7 + 10**9",
"-N = int(eval(input()))",
"-A =... | false | 0.046365 | 0.081645 | 0.567883 | [
"s792793855",
"s632136337"
] |
u955125992 | p02631 | python | s484209265 | s405669048 | 1,035 | 176 | 53,344 | 31,700 | Accepted | Accepted | 83 | import numpy as np
n = int(eval(input()))
a = np.array(input().split(), np.int64)
S = a[0]
for i in range(1, n):
S = np.bitwise_xor(S, a[i]) #xor logic
#print(format(S, 'b')) decimal number→binary number
for i in range(n):
print((np.bitwise_xor(S, a[i]))) | n = int(eval(input()))
a = list(map(int, input().split()))
S = 0
for i in range(n):
S ^= a[i]
for i in range(n):
ans = S^a[i]
print(ans) | 13 | 11 | 275 | 155 | import numpy as np
n = int(eval(input()))
a = np.array(input().split(), np.int64)
S = a[0]
for i in range(1, n):
S = np.bitwise_xor(S, a[i]) # xor logic
# print(format(S, 'b')) decimal number→binary number
for i in range(n):
print((np.bitwise_xor(S, a[i])))
| n = int(eval(input()))
a = list(map(int, input().split()))
S = 0
for i in range(n):
S ^= a[i]
for i in range(n):
ans = S ^ a[i]
print(ans)
| false | 15.384615 | [
"-import numpy as np",
"-",
"-a = np.array(input().split(), np.int64)",
"-S = a[0]",
"-for i in range(1, n):",
"- S = np.bitwise_xor(S, a[i]) # xor logic",
"- # print(format(S, 'b')) decimal number→binary number",
"+a = list(map(int, input().split()))",
"+S = 0",
"- print((np.bitwise_xor... | false | 0.346785 | 0.037906 | 9.148644 | [
"s484209265",
"s405669048"
] |
u778814286 | p03126 | python | s176230951 | s873832408 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | N, M = list(map(int, input().split()))
K = [0] * N
A = [list(map(int, input().split())) for i in range(N)]
count = 0
for i in range(1, M+1, 1):
likecount = 0
for j in range(N):
for k in range(1, A[j][0]+1, 1):
if A[j][k] == i:
likecount += 1
if likecount == N... | N, M = list(map(int, input().split()))
likeset = set(range(1, M+1))
for _ in range(N):
a, *b = list(map(int, input().split()))
likeset &= set(b)
print((len(likeset)))
| 13 | 6 | 351 | 169 | N, M = list(map(int, input().split()))
K = [0] * N
A = [list(map(int, input().split())) for i in range(N)]
count = 0
for i in range(1, M + 1, 1):
likecount = 0
for j in range(N):
for k in range(1, A[j][0] + 1, 1):
if A[j][k] == i:
likecount += 1
if likecount == N:
... | N, M = list(map(int, input().split()))
likeset = set(range(1, M + 1))
for _ in range(N):
a, *b = list(map(int, input().split()))
likeset &= set(b)
print((len(likeset)))
| false | 53.846154 | [
"-K = [0] * N",
"-A = [list(map(int, input().split())) for i in range(N)]",
"-count = 0",
"-for i in range(1, M + 1, 1):",
"- likecount = 0",
"- for j in range(N):",
"- for k in range(1, A[j][0] + 1, 1):",
"- if A[j][k] == i:",
"- likecount += 1",
"- if li... | false | 0.045752 | 0.043364 | 1.05507 | [
"s176230951",
"s873832408"
] |
u241159583 | p03733 | python | s489150406 | s324071082 | 147 | 134 | 26,708 | 30,808 | Accepted | Accepted | 8.84 | N,T = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = 0
for i in range(N-1):
if t[i+1]-t[i] < T: ans += t[i+1]-t[i]
else: ans += T
ans += T
print(ans) | n,t = list(map(int, input().split()))
T = list(map(int, input().split()))
ans = 0
for i in range(n-1):
if T[i+1]-T[i]<t: ans += T[i+1]-T[i]
else: ans += t
print((ans+t)) | 9 | 8 | 183 | 177 | N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
if t[i + 1] - t[i] < T:
ans += t[i + 1] - t[i]
else:
ans += T
ans += T
print(ans)
| n, t = list(map(int, input().split()))
T = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
if T[i + 1] - T[i] < t:
ans += T[i + 1] - T[i]
else:
ans += t
print((ans + t))
| false | 11.111111 | [
"-N, T = list(map(int, input().split()))",
"-t = list(map(int, input().split()))",
"+n, t = list(map(int, input().split()))",
"+T = list(map(int, input().split()))",
"-for i in range(N - 1):",
"- if t[i + 1] - t[i] < T:",
"- ans += t[i + 1] - t[i]",
"+for i in range(n - 1):",
"+ if T[i ... | false | 0.084645 | 0.034931 | 2.423184 | [
"s489150406",
"s324071082"
] |
u141610915 | p02996 | python | s290721658 | s258189999 | 943 | 596 | 53,720 | 68,188 | Accepted | Accepted | 36.8 | N = int(eval(input()))
AB = []
for i in range(N):
AB.append(list(map(int, input().split())))
AB.sort(key = lambda x: x[1])
time = 0
possibility = 1
for l in AB:
if l[0] + time > l[1]:
possibility = 0
break
else:
time += l[0]
if possibility == 1:
print("Yes")
else:
pri... | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = []
for _ in range(N):
l, r = list(map(int, input().split()))
a.append((l, r))
a.sort(key = lambda x: x[1])
p = 0
for i in range(N):
if p <= a[i][1] - a[i][0]: p += a[i][0]
else:
print("No")
exit(0)
print("Yes") | 22 | 15 | 322 | 293 | N = int(eval(input()))
AB = []
for i in range(N):
AB.append(list(map(int, input().split())))
AB.sort(key=lambda x: x[1])
time = 0
possibility = 1
for l in AB:
if l[0] + time > l[1]:
possibility = 0
break
else:
time += l[0]
if possibility == 1:
print("Yes")
else:
print("No")
| import sys
input = sys.stdin.readline
N = int(eval(input()))
a = []
for _ in range(N):
l, r = list(map(int, input().split()))
a.append((l, r))
a.sort(key=lambda x: x[1])
p = 0
for i in range(N):
if p <= a[i][1] - a[i][0]:
p += a[i][0]
else:
print("No")
exit(0)
print("Yes")
| false | 31.818182 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-AB = []",
"+a = []",
"+for _ in range(N):",
"+ l, r = list(map(int, input().split()))",
"+ a.append((l, r))",
"+a.sort(key=lambda x: x[1])",
"+p = 0",
"- AB.append(list(map(int, input().split())))",
"-AB.sort(key=lambda x: x[1])",
... | false | 0.046361 | 0.045859 | 1.010961 | [
"s290721658",
"s258189999"
] |
u137912513 | p02720 | python | s105663376 | s102660050 | 207 | 105 | 41,584 | 78,052 | Accepted | Accepted | 49.28 | k = int(eval(input()))
count = 9
from collections import deque
que = deque([1,2,3,4,5,6,7,8,9])
if k<10:
print(k)
exit()
while que:
v = que.popleft()
matu = v%10
for i in range(10):
if abs(matu-i)<=1:
que.append(v*10+i)
count +=1
if count == ... | from collections import deque
k = int(eval(input()))
count = 0
que = deque([1,2,3,4,5,6,7,8,9])
while que:
q = que.popleft()
count +=1
if count == k:
print(q)
exit()
tmp = q%10
if tmp == 0:
for i in range(0,2):
nq = q*10+i
que.append(nq)
... | 17 | 23 | 375 | 524 | k = int(eval(input()))
count = 9
from collections import deque
que = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
if k < 10:
print(k)
exit()
while que:
v = que.popleft()
matu = v % 10
for i in range(10):
if abs(matu - i) <= 1:
que.append(v * 10 + i)
count += 1
if c... | from collections import deque
k = int(eval(input()))
count = 0
que = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
while que:
q = que.popleft()
count += 1
if count == k:
print(q)
exit()
tmp = q % 10
if tmp == 0:
for i in range(0, 2):
nq = q * 10 + i
que.append(n... | false | 26.086957 | [
"-k = int(eval(input()))",
"-count = 9",
"+k = int(eval(input()))",
"+count = 0",
"-if k < 10:",
"- print(k)",
"- exit()",
"- v = que.popleft()",
"- matu = v % 10",
"- for i in range(10):",
"- if abs(matu - i) <= 1:",
"- que.append(v * 10 + i)",
"- ... | false | 0.042982 | 0.064184 | 0.669665 | [
"s105663376",
"s102660050"
] |
u888337853 | p03031 | python | s358958390 | s104512611 | 282 | 40 | 20,112 | 5,152 | Accepted | Accepted | 85.82 | import math
import copy
import fractions
import numpy as np
# ===FUNCTION===
def getInputNum():
inputNum = int(eval(input()))
return inputNum
def getInputListInt():
outputoData = []
inputData = input().split()
outputData = [int(n) for n in inputData]
return outputData
def ... | import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul
sys.setrecursionlimit(100001)
# input = sys.stdin.readline
# s... | 69 | 83 | 1,355 | 1,585 | import math
import copy
import fractions
import numpy as np
# ===FUNCTION===
def getInputNum():
inputNum = int(eval(input()))
return inputNum
def getInputListInt():
outputoData = []
inputData = input().split()
outputData = [int(n) for n in inputData]
return outputData
def getSomeInputInt(n)... | import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul
sys.setrecursionlimit(100001)
# input = sys.stdin.readline
# sys.setrecursionlim... | false | 16.86747 | [
"+from copy import deepcopy",
"+import sys",
"-import numpy as np",
"+# import numpy as np",
"+from functools import reduce",
"+",
"+# import statistics",
"+import decimal",
"+import heapq",
"+import collections",
"+import itertools",
"+from operator import mul",
"+",
"+sys.setrecursionlim... | false | 0.041343 | 0.036921 | 1.119778 | [
"s358958390",
"s104512611"
] |
u606045429 | p03878 | python | s052620207 | s500468837 | 749 | 666 | 27,652 | 27,652 | Accepted | Accepted | 11.08 | mod = 10 ** 9 + 7
N = int(eval(input()))
A = [(int(eval(input())), -1) for _ in range(N)]
B = [(int(eval(input())), 1) for _ in range(N)]
C = sorted(A + B)
res = 1
cnt = 0
for _, delta in C:
if cnt != 0 and cnt * delta < 0:
res *= abs(cnt)
res %= mod
cnt += delta
print(res) | mod = 10 ** 9 + 7
N = int(eval(input()))
A = [(int(eval(input())), 1) for _ in range(N)]
B = [(int(eval(input())), -1) for _ in range(N)]
C = sorted(A + B)
res = 1
cnt = 0
for _, delta in C:
if cnt * delta < 0:
res *= abs(cnt)
res %= mod
cnt += delta
print(res) | 17 | 17 | 300 | 287 | mod = 10**9 + 7
N = int(eval(input()))
A = [(int(eval(input())), -1) for _ in range(N)]
B = [(int(eval(input())), 1) for _ in range(N)]
C = sorted(A + B)
res = 1
cnt = 0
for _, delta in C:
if cnt != 0 and cnt * delta < 0:
res *= abs(cnt)
res %= mod
cnt += delta
print(res)
| mod = 10**9 + 7
N = int(eval(input()))
A = [(int(eval(input())), 1) for _ in range(N)]
B = [(int(eval(input())), -1) for _ in range(N)]
C = sorted(A + B)
res = 1
cnt = 0
for _, delta in C:
if cnt * delta < 0:
res *= abs(cnt)
res %= mod
cnt += delta
print(res)
| false | 0 | [
"-A = [(int(eval(input())), -1) for _ in range(N)]",
"-B = [(int(eval(input())), 1) for _ in range(N)]",
"+A = [(int(eval(input())), 1) for _ in range(N)]",
"+B = [(int(eval(input())), -1) for _ in range(N)]",
"- if cnt != 0 and cnt * delta < 0:",
"+ if cnt * delta < 0:"
] | false | 0.049146 | 0.034738 | 1.414771 | [
"s052620207",
"s500468837"
] |
u136811344 | p03031 | python | s079842066 | s686959659 | 44 | 33 | 3,064 | 3,064 | Accepted | Accepted | 25 | N, M = list(map(int, input().split()))
int_switch_repr = 2**N
light_bulbs_switches = []
for i in range(M):
k_s = [int(x) for x in input().split()]
k_i = k_s[0]
light_bulbs_switches.append(k_s[1:]) # i-th light bulb
P = [int(x) for x in input().split()] # p_i
ans = 0
for itg in range(int_switch_repr):
... | N, M = list(map(int, input().split()))
int_switch_repr = 2**N
light_bulbs_switches = []
for i in range(M):
k_s = [int(x) for x in input().split()]
k_i = k_s[0]
light_bulbs_switches.append(k_s[1:]) # i-th light bulb
P = [int(x) for x in input().split()] # p_i
ans = 0
for itg in range(int_switch_repr):
... | 21 | 22 | 637 | 650 | N, M = list(map(int, input().split()))
int_switch_repr = 2**N
light_bulbs_switches = []
for i in range(M):
k_s = [int(x) for x in input().split()]
k_i = k_s[0]
light_bulbs_switches.append(k_s[1:]) # i-th light bulb
P = [int(x) for x in input().split()] # p_i
ans = 0
for itg in range(int_switch_repr):
... | N, M = list(map(int, input().split()))
int_switch_repr = 2**N
light_bulbs_switches = []
for i in range(M):
k_s = [int(x) for x in input().split()]
k_i = k_s[0]
light_bulbs_switches.append(k_s[1:]) # i-th light bulb
P = [int(x) for x in input().split()] # p_i
ans = 0
for itg in range(int_switch_repr):
... | false | 4.545455 | [
"+ break"
] | false | 0.038925 | 0.039783 | 0.978421 | [
"s079842066",
"s686959659"
] |
u191874006 | p02609 | python | s680567500 | s131975990 | 339 | 291 | 104,540 | 90,516 | Accepted | Accepted | 14.16 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
n = int(eval(input()))
x = eval(input())
b = [0] * (n+1)
for i in range(1, n+1):
bit_count = 0
for j in range(20):
if i >> j & 1:
bit_count += 1
b[i] = bit_count
popcount = [0] * (n+1)
cnt = x.count('1')
for i in range(1, n+1):
popcount[i] = po... | 62 | 44 | 1,538 | 1,067 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
n = int(eval(input()))
x = eval(input())
b = [0] * (n + 1)
for i in range(1, n + 1):
bit_count = 0
for j in range(20):
if i >> j & 1:
bit_count += 1
b[i] = bit_count
popcount = [0] * (n + 1)
cnt = x.count("1")
for i in range(1, n + 1):
popcount[i] = popcount[i ... | false | 29.032258 | [
"-import sys",
"-import math",
"-from bisect import bisect_right as br",
"-from bisect import bisect_left as bl",
"-",
"-sys.setrecursionlimit(2147483647)",
"-from heapq import heappush, heappop, heappushpop",
"-from collections import defaultdict",
"-from itertools import accumulate",
"-from coll... | false | 0.090363 | 0.122534 | 0.737448 | [
"s680567500",
"s131975990"
] |
u923279197 | p03105 | python | s274387122 | s131186696 | 169 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.94 | a,b,c = list(map(int,input().split()))
print((min(b//a,c))) | a,b,c = list(map(int,input().split()))
print((min(c,b//a))) | 2 | 2 | 52 | 52 | a, b, c = list(map(int, input().split()))
print((min(b // a, c)))
| a, b, c = list(map(int, input().split()))
print((min(c, b // a)))
| false | 0 | [
"-print((min(b // a, c)))",
"+print((min(c, b // a)))"
] | false | 0.118591 | 0.040347 | 2.939307 | [
"s274387122",
"s131186696"
] |
u844789719 | p04013 | python | s114306591 | s698138430 | 50 | 26 | 3,188 | 3,188 | Accepted | Accepted | 48 | N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
X_plus = [_ for _ in X if _ > 0]
X_minus = [-_ for _ in X if _ < 0]
l_plus = len(X_plus)
l_minus = len(X_minus)
l_zero = len(X) - l_plus - l_minus
s_plus = sum(X_plus)
s_minus = sum(X_minus)
dp_plus = [1] + [0] * s_plus
dp_minu... | N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
X_plus = [_ for _ in X if _ > 0]
X_minus = [-_ for _ in X if _ < 0]
l_zero = len(X) - len(X_plus) - len(X_minus)
s_plus = sum(X_plus)
s_minus = sum(X_minus)
dp_plus = {0: 1}
dp_minus = {0: 1}
for p in X_plus:
dp_plus_old = ... | 24 | 22 | 804 | 780 | N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
X_plus = [_ for _ in X if _ > 0]
X_minus = [-_ for _ in X if _ < 0]
l_plus = len(X_plus)
l_minus = len(X_minus)
l_zero = len(X) - l_plus - l_minus
s_plus = sum(X_plus)
s_minus = sum(X_minus)
dp_plus = [1] + [0] * s_plus
dp_minus = [1] + ... | N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
X_plus = [_ for _ in X if _ > 0]
X_minus = [-_ for _ in X if _ < 0]
l_zero = len(X) - len(X_plus) - len(X_minus)
s_plus = sum(X_plus)
s_minus = sum(X_minus)
dp_plus = {0: 1}
dp_minus = {0: 1}
for p in X_plus:
dp_plus_old = dp_plus.co... | false | 8.333333 | [
"-l_plus = len(X_plus)",
"-l_minus = len(X_minus)",
"-l_zero = len(X) - l_plus - l_minus",
"+l_zero = len(X) - len(X_plus) - len(X_minus)",
"-dp_plus = [1] + [0] * s_plus",
"-dp_minus = [1] + [0] * s_minus",
"-for i in range(l_plus):",
"+dp_plus = {0: 1}",
"+dp_minus = {0: 1}",
"+for p in X_plus:"... | false | 0.041155 | 0.056256 | 0.731564 | [
"s114306591",
"s698138430"
] |
u633068244 | p00095 | python | s054432345 | s792518765 | 20 | 10 | 4,204 | 4,204 | Accepted | Accepted | 50 | n = int(input())
mxs, minm = 0, 1000
for i in range(n):
m, s = list(map(int, input().split()))
if s > mxs:
mxs = s
minm = m
elif s == mxs:
if m < minm:
minm = m
print(minm, mxs) | n = int(input())
mxs, minm = 0, 21
for i in range(n):
m, s = list(map(int, input().split()))
if s > mxs:
mxs = s
minm = m
elif s == mxs:
if m < minm:
minm = m
print(minm, mxs) | 11 | 11 | 237 | 235 | n = int(input())
mxs, minm = 0, 1000
for i in range(n):
m, s = list(map(int, input().split()))
if s > mxs:
mxs = s
minm = m
elif s == mxs:
if m < minm:
minm = m
print(minm, mxs)
| n = int(input())
mxs, minm = 0, 21
for i in range(n):
m, s = list(map(int, input().split()))
if s > mxs:
mxs = s
minm = m
elif s == mxs:
if m < minm:
minm = m
print(minm, mxs)
| false | 0 | [
"-mxs, minm = 0, 1000",
"+mxs, minm = 0, 21"
] | false | 0.046728 | 0.046899 | 0.996343 | [
"s054432345",
"s792518765"
] |
u143322814 | p02714 | python | s723183023 | s802845596 | 1,913 | 1,034 | 9,196 | 9,216 | Accepted | Accepted | 45.95 | n = int(eval(input()))
s = eval(input())
ans = s.count('R') * s.count('G') * s.count('B')
for j in range(n):
for i in range(j):
k = j+(j-i)
if k < n:
if s[i] == s[j] or s[i] == s[k] or s[k] == s[j]:
continue
ans -= 1
print(ans) |
def main():
n = int(eval(input()))
s = eval(input())
r,g,b = 0,0,0
for i in s:
if i == 'R': r += 1
elif i == 'G': g += 1
elif i == 'B': b += 1
ans = r*g*b
for j in range(n):
for i in range(j):
k = j+(j-i)
if k < n:
... | 12 | 20 | 287 | 474 | n = int(eval(input()))
s = eval(input())
ans = s.count("R") * s.count("G") * s.count("B")
for j in range(n):
for i in range(j):
k = j + (j - i)
if k < n:
if s[i] == s[j] or s[i] == s[k] or s[k] == s[j]:
continue
ans -= 1
print(ans)
| def main():
n = int(eval(input()))
s = eval(input())
r, g, b = 0, 0, 0
for i in s:
if i == "R":
r += 1
elif i == "G":
g += 1
elif i == "B":
b += 1
ans = r * g * b
for j in range(n):
for i in range(j):
k = j + (j - i)... | false | 40 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-ans = s.count(\"R\") * s.count(\"G\") * s.count(\"B\")",
"-for j in range(n):",
"- for i in range(j):",
"- k = j + (j - i)",
"- if k < n:",
"- if s[i] == s[j] or s[i] == s[k] or s[k] == s[j]:",
"- continue"... | false | 0.036764 | 0.036355 | 1.01125 | [
"s723183023",
"s802845596"
] |
u806976856 | p03575 | python | s587556006 | s816850529 | 109 | 78 | 68,040 | 73,616 | Accepted | Accepted | 28.44 | import sys
sys.setrecursionlimit(10**9)
n,m=list(map(int,input().split()))
ab=[[0,0] for i in range(m)]
for i in range(m):
ab[i][0],ab[i][1]=list(map(int,input().split()))
ans=0
for i in range(m):
root=[j for j in range(n+1)]
root[0]=1
def r(x):
if root[x]==x:
return x
... | from _collections import deque
n,m=list(map(int,input().split()))
ab=[[0,0] for i in range(m)]
for i in range(m):
ab[i][0],ab[i][1]=list(map(int,input().split()))
ans=0
for i in range(m):
edg=[[] for j in range(n+1)]
dep=[-1]*(n+1)
dep[0]=1
dep[1]=1
for j in range(m):
if j!=i... | 34 | 25 | 729 | 654 | import sys
sys.setrecursionlimit(10**9)
n, m = list(map(int, input().split()))
ab = [[0, 0] for i in range(m)]
for i in range(m):
ab[i][0], ab[i][1] = list(map(int, input().split()))
ans = 0
for i in range(m):
root = [j for j in range(n + 1)]
root[0] = 1
def r(x):
if root[x] == x:
... | from _collections import deque
n, m = list(map(int, input().split()))
ab = [[0, 0] for i in range(m)]
for i in range(m):
ab[i][0], ab[i][1] = list(map(int, input().split()))
ans = 0
for i in range(m):
edg = [[] for j in range(n + 1)]
dep = [-1] * (n + 1)
dep[0] = 1
dep[1] = 1
for j in range(m):... | false | 26.470588 | [
"-import sys",
"+from _collections import deque",
"-sys.setrecursionlimit(10**9)",
"- root = [j for j in range(n + 1)]",
"- root[0] = 1",
"-",
"- def r(x):",
"- if root[x] == x:",
"- return x",
"- else:",
"- root[x] = r(root[x])",
"- retu... | false | 0.037625 | 0.037383 | 1.006463 | [
"s587556006",
"s816850529"
] |
u780475861 | p03848 | python | s834868565 | s233860319 | 101 | 79 | 13,940 | 15,840 | Accepted | Accepted | 21.78 | import sys
n, *lst = list(map(int, sys.stdin.read().split()))
lst.sort()
mod = 10 ** 9 + 7
if n % 2:
for i in range(1, n):
if lst[i] != (i + 1) // 2 * 2:
print((0))
quit()
else:
for i in range(n):
if lst[i] != i // 2 * 2 + 1:
print((0))
quit()
print(((1 << (n >> 1)) %... | import sys
from collections import Counter
def main():
n, *lst = list(map(int, sys.stdin.read().split()))
lst = sorted(Counter(lst).items())
l = len(lst)
mod = 10 ** 9 + 7
if n % 2:
for i in range(l):
if not i:
if lst[i][0] or lst[i][1] != 1:
print((0))
qu... | 16 | 28 | 314 | 593 | import sys
n, *lst = list(map(int, sys.stdin.read().split()))
lst.sort()
mod = 10**9 + 7
if n % 2:
for i in range(1, n):
if lst[i] != (i + 1) // 2 * 2:
print((0))
quit()
else:
for i in range(n):
if lst[i] != i // 2 * 2 + 1:
print((0))
quit()
print... | import sys
from collections import Counter
def main():
n, *lst = list(map(int, sys.stdin.read().split()))
lst = sorted(Counter(lst).items())
l = len(lst)
mod = 10**9 + 7
if n % 2:
for i in range(l):
if not i:
if lst[i][0] or lst[i][1] != 1:
p... | false | 42.857143 | [
"+from collections import Counter",
"-n, *lst = list(map(int, sys.stdin.read().split()))",
"-lst.sort()",
"-mod = 10**9 + 7",
"-if n % 2:",
"- for i in range(1, n):",
"- if lst[i] != (i + 1) // 2 * 2:",
"- print((0))",
"- quit()",
"-else:",
"- for i in range(n)... | false | 0.039009 | 0.039079 | 0.99822 | [
"s834868565",
"s233860319"
] |
u677121387 | p03732 | python | s096236950 | s883628592 | 319 | 256 | 75,740 | 42,604 | Accepted | Accepted | 19.75 | n,W = list(map(int,input().split()))
w = [0]*n
v = [0]*n
for i in range(n): w[i],v[i] = list(map(int,input().split()))
x = w[0]
for i in range(n): w[i] -= x
dp = [[[0]*(4*n+1) for _ in range(n+1)] for _ in range(n+1)]
for i in range(n):
for j in range(i+1):
for k in range(4*n+1):
if ... | n,W = list(map(int,input().split()))
lst = [[0]*(n+1) for _ in range(4)]
for i in range(n):
w,v = list(map(int,input().split()))
if i == 0: x = w
lst[w-x].append(v)
for i in range(4):
lst[i].sort(reverse=True)
for j in range(n): lst[i][j+1] += lst[i][j]
ans = 0
for a in range(n+1):
fo... | 22 | 21 | 673 | 654 | n, W = list(map(int, input().split()))
w = [0] * n
v = [0] * n
for i in range(n):
w[i], v[i] = list(map(int, input().split()))
x = w[0]
for i in range(n):
w[i] -= x
dp = [[[0] * (4 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n):
for j in range(i + 1):
for k in range(4 * n +... | n, W = list(map(int, input().split()))
lst = [[0] * (n + 1) for _ in range(4)]
for i in range(n):
w, v = list(map(int, input().split()))
if i == 0:
x = w
lst[w - x].append(v)
for i in range(4):
lst[i].sort(reverse=True)
for j in range(n):
lst[i][j + 1] += lst[i][j]
ans = 0
for a in r... | false | 4.545455 | [
"-w = [0] * n",
"-v = [0] * n",
"+lst = [[0] * (n + 1) for _ in range(4)]",
"- w[i], v[i] = list(map(int, input().split()))",
"-x = w[0]",
"-for i in range(n):",
"- w[i] -= x",
"-dp = [[[0] * (4 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]",
"-for i in range(n):",
"- for j in ra... | false | 0.047452 | 0.048548 | 0.977426 | [
"s096236950",
"s883628592"
] |
u780962115 | p03014 | python | s482470636 | s766251560 | 1,336 | 713 | 364,164 | 154,592 | Accepted | Accepted | 46.63 | #lamp
import sys
input=sys.stdin.readline
h,w=list(map(int,input().split()))
lists=[]
for i in range(h):
b=list(eval(input()))
lists.append(b)
right=[[0 for i in range(w)] for j in range(h)]
left=[[0 for i in range(w)] for j in range(h)]
up=[[0 for i in range(w)] for j in range(h)]
down=[[0 for... | h,w=list(map(int,input().split()))
lists=[]
for i in range(h):
s=eval(input())
lists.append(s)
ylists=[]
for some in lists:
some=some+"#"
cnt=0
add=[]
for i in range(w+1):
if some[i]=="#":
if cnt==0:
add.append(0)
cnt=0
... | 84 | 63 | 2,079 | 1,314 | # lamp
import sys
input = sys.stdin.readline
h, w = list(map(int, input().split()))
lists = []
for i in range(h):
b = list(eval(input()))
lists.append(b)
right = [[0 for i in range(w)] for j in range(h)]
left = [[0 for i in range(w)] for j in range(h)]
up = [[0 for i in range(w)] for j in range(h)]
down = [[0 ... | h, w = list(map(int, input().split()))
lists = []
for i in range(h):
s = eval(input())
lists.append(s)
ylists = []
for some in lists:
some = some + "#"
cnt = 0
add = []
for i in range(w + 1):
if some[i] == "#":
if cnt == 0:
add.append(0)
cnt = ... | false | 25 | [
"-# lamp",
"-import sys",
"-",
"-input = sys.stdin.readline",
"- b = list(eval(input()))",
"- lists.append(b)",
"-right = [[0 for i in range(w)] for j in range(h)]",
"-left = [[0 for i in range(w)] for j in range(h)]",
"-up = [[0 for i in range(w)] for j in range(h)]",
"-down = [[0 for i in ... | false | 0.081472 | 0.060959 | 1.336495 | [
"s482470636",
"s766251560"
] |
u787562674 | p04012 | python | s373427438 | s152820447 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | from collections import Counter
w = Counter(list(eval(input())))
for value in list(w.values()):
if value % 2 != 0:
print('No')
break
else:
print('Yes') | w = eval(input())
for s in set(w):
if w.count(s) % 2 != 0:
print('No')
break
else:
print('Yes') | 10 | 7 | 174 | 119 | from collections import Counter
w = Counter(list(eval(input())))
for value in list(w.values()):
if value % 2 != 0:
print("No")
break
else:
print("Yes")
| w = eval(input())
for s in set(w):
if w.count(s) % 2 != 0:
print("No")
break
else:
print("Yes")
| false | 30 | [
"-from collections import Counter",
"-",
"-w = Counter(list(eval(input())))",
"-for value in list(w.values()):",
"- if value % 2 != 0:",
"+w = eval(input())",
"+for s in set(w):",
"+ if w.count(s) % 2 != 0:"
] | false | 0.072336 | 0.008486 | 8.524283 | [
"s373427438",
"s152820447"
] |
u930705402 | p03703 | python | s472188725 | s173620385 | 1,026 | 447 | 125,976 | 120,080 | Accepted | Accepted | 56.43 | from bisect import bisect_left
class SEGTree:
def __init__(self,n):
self.Unit=0
i=1
while(i<n):
i*=2
self.SEG=[self.Unit]*(2*i-1)
self.d=i
def update(self,i,x):
i+=self.d-1
self.SEG[i]+=x
while i>0:
i=(i-1)//2
... | from bisect import bisect_left
class BIT:
def __init__(self,N):
self.N=N
self.bit=[0]*N
def add(self,a,w):
x=a
while(x<self.N):
self.bit[x]+=w
x|=x+1
def get(self,a):
ret,x=0,a-1
while(x>=0):
ret+=self.bit[x]
... | 43 | 36 | 1,091 | 788 | from bisect import bisect_left
class SEGTree:
def __init__(self, n):
self.Unit = 0
i = 1
while i < n:
i *= 2
self.SEG = [self.Unit] * (2 * i - 1)
self.d = i
def update(self, i, x):
i += self.d - 1
self.SEG[i] += x
while i > 0:
... | from bisect import bisect_left
class BIT:
def __init__(self, N):
self.N = N
self.bit = [0] * N
def add(self, a, w):
x = a
while x < self.N:
self.bit[x] += w
x |= x + 1
def get(self, a):
ret, x = 0, a - 1
while x >= 0:
re... | false | 16.27907 | [
"-class SEGTree:",
"- def __init__(self, n):",
"- self.Unit = 0",
"- i = 1",
"- while i < n:",
"- i *= 2",
"- self.SEG = [self.Unit] * (2 * i - 1)",
"- self.d = i",
"+class BIT:",
"+ def __init__(self, N):",
"+ self.N = N",
"+ s... | false | 0.09843 | 0.074652 | 1.318515 | [
"s472188725",
"s173620385"
] |
u014333473 | p03001 | python | s391556277 | s266779265 | 31 | 27 | 9,016 | 9,096 | Accepted | Accepted | 12.9 | w,h,x,y=list(map(int,input().split()));print(((w*h)/2,int(2*x==w and 2*y==h))) | w,h,x,y=list(map(int,input().split()));print((w*h/2,int(2*x==w and 2*y==h))) | 1 | 1 | 70 | 68 | w, h, x, y = list(map(int, input().split()))
print(((w * h) / 2, int(2 * x == w and 2 * y == h)))
| w, h, x, y = list(map(int, input().split()))
print((w * h / 2, int(2 * x == w and 2 * y == h)))
| false | 0 | [
"-print(((w * h) / 2, int(2 * x == w and 2 * y == h)))",
"+print((w * h / 2, int(2 * x == w and 2 * y == h)))"
] | false | 0.045717 | 0.045809 | 0.998001 | [
"s391556277",
"s266779265"
] |
u644516473 | p02640 | python | s165714855 | s185591187 | 25 | 21 | 9,164 | 9,092 | Accepted | Accepted | 16 | x, y = list(map(int, input().split()))
for i in range(0, 101):
for j in range(0, 101):
if i + j == x and i*2 + j * 4 == y:
print('Yes')
exit()
print('No')
# print('Yes' if y%2 == 0 and x >= y//2 and y // 4 - (y%4) //2 <= x else 'No')
| x, y = list(map(int, input().split()))
print(('Yes' if y%2 == 0 and x <= y/2 and y / 4 <= x else 'No'))
| 8 | 2 | 272 | 98 | x, y = list(map(int, input().split()))
for i in range(0, 101):
for j in range(0, 101):
if i + j == x and i * 2 + j * 4 == y:
print("Yes")
exit()
print("No")
# print('Yes' if y%2 == 0 and x >= y//2 and y // 4 - (y%4) //2 <= x else 'No')
| x, y = list(map(int, input().split()))
print(("Yes" if y % 2 == 0 and x <= y / 2 and y / 4 <= x else "No"))
| false | 75 | [
"-for i in range(0, 101):",
"- for j in range(0, 101):",
"- if i + j == x and i * 2 + j * 4 == y:",
"- print(\"Yes\")",
"- exit()",
"-print(\"No\")",
"-# print('Yes' if y%2 == 0 and x >= y//2 and y // 4 - (y%4) //2 <= x else 'No')",
"+print((\"Yes\" if y % 2 == 0 and x... | false | 0.033073 | 0.036302 | 0.911067 | [
"s165714855",
"s185591187"
] |
u989345508 | p03325 | python | s349362257 | s758652665 | 130 | 98 | 4,148 | 4,148 | Accepted | Accepted | 24.62 | #全ての要素を奇数にできれば良い
#2で何回割れるか
n=int(eval(input()))
a=[int(i) for i in input().split()]
k=0
while True:
f=0
for i in range(n):
if a[i]%2==0:
k+=1
f=1
a[i]=a[i]//2
if f==0:
break
print(k)
| n=int(eval(input()))
a=list(map(int,input().split()))
ans=0
for i in range(n):
while a[i]%2==0:
ans+=1
a[i]//=2
print(ans) | 18 | 8 | 261 | 143 | # 全ての要素を奇数にできれば良い
# 2で何回割れるか
n = int(eval(input()))
a = [int(i) for i in input().split()]
k = 0
while True:
f = 0
for i in range(n):
if a[i] % 2 == 0:
k += 1
f = 1
a[i] = a[i] // 2
if f == 0:
break
print(k)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(n):
while a[i] % 2 == 0:
ans += 1
a[i] //= 2
print(ans)
| false | 55.555556 | [
"-# 全ての要素を奇数にできれば良い",
"-# 2で何回割れるか",
"-a = [int(i) for i in input().split()]",
"-k = 0",
"-while True:",
"- f = 0",
"- for i in range(n):",
"- if a[i] % 2 == 0:",
"- k += 1",
"- f = 1",
"- a[i] = a[i] // 2",
"- if f == 0:",
"- break",
... | false | 0.10703 | 0.044001 | 2.432431 | [
"s349362257",
"s758652665"
] |
u330799501 | p03835 | python | s858946078 | s038763572 | 1,597 | 1,201 | 9,160 | 9,164 | Accepted | Accepted | 24.8 | #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)]
k, s = list(map(int, input().split()))
ans = 0
for x in range(k+1):
for y in range(k+1):
z = s - (x+y)... | #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)]
k, s = list(map(int, input().split()))
ans = 0
for x in range(k+1):
for y in range(k+1):
z = s - (x+y)... | 19 | 19 | 426 | 411 | # 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)]
k, s = list(map(int, input().split()))
ans = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - (x + y)
... | # 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)]
k, s = list(map(int, input().split()))
ans = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - (x + y)
... | false | 0 | [
"- if z >= 0 and z <= k and x + y + z == s:",
"+ if z >= 0 and z <= k:"
] | false | 0.03654 | 0.041985 | 0.870318 | [
"s858946078",
"s038763572"
] |
u439396449 | p03472 | python | s728005303 | s753470932 | 521 | 200 | 44,508 | 12,712 | Accepted | Accepted | 61.61 | import math
N, H = list(map(int, input().split()))
katana = {i: list(map(int, input().split())) for i in range(N)}
# 振り攻撃最大
max_i, (max_a, max_b) = max(list(katana.items()), key=lambda x: x[1][0])
ans = 0
for i, (_, b) in sorted(list(katana.items()), key=lambda x: x[1][1], reverse=True):
if i == max_i:... | import sys
input = sys.stdin.readline
N, H = list(map(int, input().split()))
a, b = [0] * N, [0] * N
for i in range(N):
a[i], b[i] = list(map(int, input().split()))
max_a = max(a)
b = [x for x in sorted(b, reverse=True) if x > max_a]
cnt = 0
for bi in b:
H -= bi
cnt += 1
if H <= 0:
... | 26 | 24 | 549 | 412 | import math
N, H = list(map(int, input().split()))
katana = {i: list(map(int, input().split())) for i in range(N)}
# 振り攻撃最大
max_i, (max_a, max_b) = max(list(katana.items()), key=lambda x: x[1][0])
ans = 0
for i, (_, b) in sorted(list(katana.items()), key=lambda x: x[1][1], reverse=True):
if i == max_i:
con... | import sys
input = sys.stdin.readline
N, H = list(map(int, input().split()))
a, b = [0] * N, [0] * N
for i in range(N):
a[i], b[i] = list(map(int, input().split()))
max_a = max(a)
b = [x for x in sorted(b, reverse=True) if x > max_a]
cnt = 0
for bi in b:
H -= bi
cnt += 1
if H <= 0:
break
if H >... | false | 7.692308 | [
"-import math",
"+import sys",
"+input = sys.stdin.readline",
"-katana = {i: list(map(int, input().split())) for i in range(N)}",
"-# 振り攻撃最大",
"-max_i, (max_a, max_b) = max(list(katana.items()), key=lambda x: x[1][0])",
"-ans = 0",
"-for i, (_, b) in sorted(list(katana.items()), key=lambda x: x[1][1],... | false | 0.036897 | 0.109621 | 0.336591 | [
"s728005303",
"s753470932"
] |
u670180528 | p03053 | python | s089787870 | s324065379 | 672 | 359 | 161,756 | 40,000 | Accepted | Accepted | 46.58 | from collections import deque
h,w = list(map(int,input().split()))
grid = [list(eval(input())) for _ in range(h)]
nxt = deque()
for i in range(h):
for j in range(w):
if grid[i][j] == "#":
nxt.append((i,j,0))
a=0
while nxt:
i,j,t = nxt.popleft()
if t > a:
a+=1
for i,j in ((i-1,j),(i+1,j),(i,j-... | from scipy.ndimage import distance_transform_cdt
h,w = list(map(int, input().split()))
grid = [[i=="." for i in eval(input())] for _ in range(h)]
print((distance_transform_cdt(grid, metric='taxicab').max()))
# reference : https://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.ndimage.morphology.distanc... | 18 | 6 | 426 | 325 | from collections import deque
h, w = list(map(int, input().split()))
grid = [list(eval(input())) for _ in range(h)]
nxt = deque()
for i in range(h):
for j in range(w):
if grid[i][j] == "#":
nxt.append((i, j, 0))
a = 0
while nxt:
i, j, t = nxt.popleft()
if t > a:
a += 1
for i... | from scipy.ndimage import distance_transform_cdt
h, w = list(map(int, input().split()))
grid = [[i == "." for i in eval(input())] for _ in range(h)]
print((distance_transform_cdt(grid, metric="taxicab").max()))
# reference : https://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.ndimage.morphology.distance_... | false | 66.666667 | [
"-from collections import deque",
"+from scipy.ndimage import distance_transform_cdt",
"-grid = [list(eval(input())) for _ in range(h)]",
"-nxt = deque()",
"-for i in range(h):",
"- for j in range(w):",
"- if grid[i][j] == \"#\":",
"- nxt.append((i, j, 0))",
"-a = 0",
"-while ... | false | 0.031126 | 0.367411 | 0.084718 | [
"s089787870",
"s324065379"
] |
u133936772 | p03240 | python | s482517875 | s613207426 | 38 | 31 | 3,064 | 3,064 | Accepted | Accepted | 18.42 | n = int(eval(input()))
ll = sorted([list(map(int,input().split())) for _ in range(n)],key=lambda k:k[2])[::-1]
for cx in range(101):
for cy in range(101):
ch = ll[0][2]+abs(ll[0][0]-cx)+abs(ll[0][1]-cy)
for x,y,h in ll:
if max(ch-abs(x-cx)-abs(y-cy),0) != h:
break
else:
print(... | ll = [list(map(int,input().split())) for _ in range(int(eval(input())))]
ll.sort(key=lambda k:k[2],reverse=1)
x,y,h = ll[0]
for cx in range(101):
for cy in range(101):
ch = h+abs(x-cx)+abs(y-cy)
for x,y,h in ll:
if max(ch-abs(x-cx)-abs(y-cy),0) != h:
break
else:
print((cx,cy,... | 14 | 15 | 368 | 361 | n = int(eval(input()))
ll = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda k: k[2])[
::-1
]
for cx in range(101):
for cy in range(101):
ch = ll[0][2] + abs(ll[0][0] - cx) + abs(ll[0][1] - cy)
for x, y, h in ll:
if max(ch - abs(x - cx) - abs(y - cy), 0) != h:
... | ll = [list(map(int, input().split())) for _ in range(int(eval(input())))]
ll.sort(key=lambda k: k[2], reverse=1)
x, y, h = ll[0]
for cx in range(101):
for cy in range(101):
ch = h + abs(x - cx) + abs(y - cy)
for x, y, h in ll:
if max(ch - abs(x - cx) - abs(y - cy), 0) != h:
... | false | 6.666667 | [
"-n = int(eval(input()))",
"-ll = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda k: k[2])[",
"- ::-1",
"-]",
"+ll = [list(map(int, input().split())) for _ in range(int(eval(input())))]",
"+ll.sort(key=lambda k: k[2], reverse=1)",
"+x, y, h = ll[0]",
"- ch = ll[0][2] +... | false | 0.047864 | 0.045207 | 1.058783 | [
"s482517875",
"s613207426"
] |
u869919400 | p02713 | python | s444232680 | s491183945 | 934 | 503 | 79,644 | 67,680 | Accepted | Accepted | 46.15 | K = int(eval(input()))
from itertools import product
kumi = product(list(range(1, K+1)), repeat=3)
from math import gcd
memo = [[None for i in range(K+1)] for i in range(K+1)]
# memo2 = {}
ans = 0
for a, b, c in kumi:
a, b, c = sorted([a, b, c])
if memo[a][b] is not None:
v = memo[... | K = int(eval(input()))
from math import gcd
ans = 0
for i in range(1, K+1):
for j in range(1, K+1):
for k in range(1, K+1):
ans += gcd(gcd(i, j), k)
print(ans) | 23 | 8 | 443 | 185 | K = int(eval(input()))
from itertools import product
kumi = product(list(range(1, K + 1)), repeat=3)
from math import gcd
memo = [[None for i in range(K + 1)] for i in range(K + 1)]
# memo2 = {}
ans = 0
for a, b, c in kumi:
a, b, c = sorted([a, b, c])
if memo[a][b] is not None:
v = memo[a][b]
else... | K = int(eval(input()))
from math import gcd
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
ans += gcd(gcd(i, j), k)
print(ans)
| false | 65.217391 | [
"-from itertools import product",
"-",
"-kumi = product(list(range(1, K + 1)), repeat=3)",
"-memo = [[None for i in range(K + 1)] for i in range(K + 1)]",
"-# memo2 = {}",
"-for a, b, c in kumi:",
"- a, b, c = sorted([a, b, c])",
"- if memo[a][b] is not None:",
"- v = memo[a][b]",
"- ... | false | 0.087164 | 0.181644 | 0.479863 | [
"s444232680",
"s491183945"
] |
u444732068 | p02786 | python | s798015471 | s729290222 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | H = int(eval(input()))
h = 0
while H != 1:
H = int(H/2)
h += 1
print((2**(h+1)-1)) | H = int(eval(input()))
def f(x):
if x == 1:
return 1
else:
return 2*f(int(x/2)) + 1
print((f(H)))
| 7 | 10 | 83 | 108 | H = int(eval(input()))
h = 0
while H != 1:
H = int(H / 2)
h += 1
print((2 ** (h + 1) - 1))
| H = int(eval(input()))
def f(x):
if x == 1:
return 1
else:
return 2 * f(int(x / 2)) + 1
print((f(H)))
| false | 30 | [
"-h = 0",
"-while H != 1:",
"- H = int(H / 2)",
"- h += 1",
"-print((2 ** (h + 1) - 1))",
"+",
"+",
"+def f(x):",
"+ if x == 1:",
"+ return 1",
"+ else:",
"+ return 2 * f(int(x / 2)) + 1",
"+",
"+",
"+print((f(H)))"
] | false | 0.04249 | 0.038253 | 1.110757 | [
"s798015471",
"s729290222"
] |
u905582793 | p04020 | python | s688089182 | s848957681 | 193 | 81 | 7,072 | 7,072 | Accepted | Accepted | 58.03 | n=int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a.append(0)
ans = 0
tmp = 0
for i in range(n+1):
if a[i]!=0:
tmp += a[i]
else:
ans += tmp//2
tmp = 0
print(ans) | import sys
input = sys.stdin.readline
n=int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a.append(0)
ans = 0
tmp = 0
for i in range(n+1):
if a[i]!=0:
tmp += a[i]
else:
ans += tmp//2
tmp = 0
print(ans) | 12 | 14 | 190 | 230 | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a.append(0)
ans = 0
tmp = 0
for i in range(n + 1):
if a[i] != 0:
tmp += a[i]
else:
ans += tmp // 2
tmp = 0
print(ans)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a.append(0)
ans = 0
tmp = 0
for i in range(n + 1):
if a[i] != 0:
tmp += a[i]
else:
ans += tmp // 2
tmp = 0
print(ans)
| false | 14.285714 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.048154 | 0.048062 | 1.001919 | [
"s688089182",
"s848957681"
] |
u718706790 | p02812 | python | s956827235 | s361654940 | 20 | 17 | 3,188 | 2,940 | Accepted | Accepted | 15 | import re
n = int(eval(input()))
s = eval(input())
x = re.sub(r'ABC', 'o', s)
print((x.count('o'))) | n = int(eval(input()))
s = eval(input())
print((s.count('ABC'))) | 8 | 4 | 95 | 54 | import re
n = int(eval(input()))
s = eval(input())
x = re.sub(r"ABC", "o", s)
print((x.count("o")))
| n = int(eval(input()))
s = eval(input())
print((s.count("ABC")))
| false | 50 | [
"-import re",
"-",
"-x = re.sub(r\"ABC\", \"o\", s)",
"-print((x.count(\"o\")))",
"+print((s.count(\"ABC\")))"
] | false | 0.04237 | 0.042121 | 1.005905 | [
"s956827235",
"s361654940"
] |
u562016607 | p03287 | python | s727885573 | s255992427 | 139 | 119 | 16,184 | 15,444 | Accepted | Accepted | 14.39 | N,M=list(map(int,input().split()))
A=[int(i) for i in input().split()]
S=[0 for i in range(N+1)]
for i in range(N):
S[i+1]=(S[i]+A[i])%M
D=dict()
ans=0
for i in range(N+1):
if S[i] in D:
D[S[i]]+=1
else:
D[S[i]]=1
ans+=D[S[i]]-1
print(ans)
| N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
D={0:1}
S=[0 for i in range(N)]
S[0]=A[0]%M
if S[0] in D:
D[S[0]]+=1
else:
D[S[0]]=1
for i in range(1,N):
S[i]=(S[i-1]+A[i])%M
if S[i] in D:
D[S[i]]+=1
else:
D[S[i]]=1
ans=0
for i in D:
ans+=(D[i... | 14 | 19 | 263 | 341 | N, M = list(map(int, input().split()))
A = [int(i) for i in input().split()]
S = [0 for i in range(N + 1)]
for i in range(N):
S[i + 1] = (S[i] + A[i]) % M
D = dict()
ans = 0
for i in range(N + 1):
if S[i] in D:
D[S[i]] += 1
else:
D[S[i]] = 1
ans += D[S[i]] - 1
print(ans)
| N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
D = {0: 1}
S = [0 for i in range(N)]
S[0] = A[0] % M
if S[0] in D:
D[S[0]] += 1
else:
D[S[0]] = 1
for i in range(1, N):
S[i] = (S[i - 1] + A[i]) % M
if S[i] in D:
D[S[i]] += 1
else:
D[S[i]] = 1
ans = 0
for i i... | false | 26.315789 | [
"-A = [int(i) for i in input().split()]",
"-S = [0 for i in range(N + 1)]",
"-for i in range(N):",
"- S[i + 1] = (S[i] + A[i]) % M",
"-D = dict()",
"-ans = 0",
"-for i in range(N + 1):",
"+A = list(map(int, input().split()))",
"+D = {0: 1}",
"+S = [0 for i in range(N)]",
"+S[0] = A[0] % M",
... | false | 0.040635 | 0.106943 | 0.379966 | [
"s727885573",
"s255992427"
] |
u506858457 | p02837 | python | s265478370 | s049083891 | 994 | 895 | 9,228 | 9,140 | Accepted | Accepted | 9.96 | g = [[-1 for _ in range(15)] for _ in range(15)]#証言格納用
n = int(eval(input()))#証言なし-1で初期化
ans=0
for i in range(n):#n人の人について、一人一人、入力
m = int(eval(input()))#証言の個数をもらう
for j in range(m):#m個の証言を入力
x,y = list(map(int, input().split()))
g[i][x-1] = y#i番目の人の証言を格納、人の番号xは0始まり
for i in range(1<<n):#Bit全探... | def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
N=II()
ans=0
List=[[-1 for _ in range(N)] for _ in range(N)]
for j in range(N):
A=II()
for i in range(A):
x,y=MI()
x-=1
List[j][x]=y
for i in range(1<<N):
... | 97 | 29 | 2,851 | 623 | g = [[-1 for _ in range(15)] for _ in range(15)] # 証言格納用
n = int(eval(input())) # 証言なし-1で初期化
ans = 0
for i in range(n): # n人の人について、一人一人、入力
m = int(eval(input())) # 証言の個数をもらう
for j in range(m): # m個の証言を入力
x, y = list(map(int, input().split()))
g[i][x - 1] = y # i番目の人の証言を格納、人の番号xは0始まり
for i ... | def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
N = II()
ans = 0
List = [[-1 for _ in range(N)] for _ in range(N)]
for j in range(N):
A = II()
for i in range(A):
x, y = MI()
x -= 1
Lis... | false | 70.103093 | [
"-g = [[-1 for _ in range(15)] for _ in range(15)] # 証言格納用",
"-n = int(eval(input())) # 証言なし-1で初期化",
"+def II():",
"+ return int(eval(input()))",
"+",
"+",
"+def MI():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def LI():",
"+ return list(map(int, input().split()))",
... | false | 0.039956 | 0.039591 | 1.009218 | [
"s265478370",
"s049083891"
] |
u241159583 | p02861 | python | s921556421 | s110277890 | 333 | 292 | 10,844 | 9,120 | Accepted | Accepted | 12.31 | import itertools
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
ans = []
for v in itertools.permutations(list(range(n)), n):
a = 0
for i in range(len(v)-1):
x1,y1 = xy[v[i]][0], xy[v[i]][1]
x2,y2 = xy[v[i+1]][0], xy[v[i+1]][1]
a += ((x1-x2)**2+... | import itertools
from math import sqrt
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
ans = 0
cnt = 0
for v in itertools.permutations(list(range(n))):
for i in range(n-1):
x = (xy[v[i]][0]-xy[v[i+1]][0]) ** 2
y = (xy[v[i]][1]-xy[v[i+1]][1]) ** 2
ans... | 13 | 13 | 375 | 357 | import itertools
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
ans = []
for v in itertools.permutations(list(range(n)), n):
a = 0
for i in range(len(v) - 1):
x1, y1 = xy[v[i]][0], xy[v[i]][1]
x2, y2 = xy[v[i + 1]][0], xy[v[i + 1]][1]
a += ((x1 - x2) ** ... | import itertools
from math import sqrt
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
ans = 0
cnt = 0
for v in itertools.permutations(list(range(n))):
for i in range(n - 1):
x = (xy[v[i]][0] - xy[v[i + 1]][0]) ** 2
y = (xy[v[i]][1] - xy[v[i + 1]][1]) ** 2
an... | false | 0 | [
"+from math import sqrt",
"-ans = []",
"-for v in itertools.permutations(list(range(n)), n):",
"- a = 0",
"- for i in range(len(v) - 1):",
"- x1, y1 = xy[v[i]][0], xy[v[i]][1]",
"- x2, y2 = xy[v[i + 1]][0], xy[v[i + 1]][1]",
"- a += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5",... | false | 0.038426 | 0.007531 | 5.1025 | [
"s921556421",
"s110277890"
] |
u803617136 | p03611 | python | s898393448 | s296781179 | 221 | 181 | 20,976 | 21,028 | Accepted | Accepted | 18.1 | from collections import defaultdict
n = int(eval(input()))
nums = list(map(int, input().split()))
frequency = defaultdict(int)
for n in nums:
for x in [-1, 0, 1]:
if 0 <= n + x and n + x <= 10 **5:
frequency[n + x] += 1
ans = 0
for k, v in list(frequency.items()):
ans = max(a... | from collections import defaultdict
n = int(eval(input()))
numbers = list(map(int, input().split()))
d = defaultdict(int)
for num in numbers:
for x in [-1, 0, 1]:
if num + x >= 0:
d[num + x] += 1
ans = 0
for k, v in list(d.items()):
ans = max(ans, v)
print(ans) | 16 | 16 | 329 | 296 | from collections import defaultdict
n = int(eval(input()))
nums = list(map(int, input().split()))
frequency = defaultdict(int)
for n in nums:
for x in [-1, 0, 1]:
if 0 <= n + x and n + x <= 10**5:
frequency[n + x] += 1
ans = 0
for k, v in list(frequency.items()):
ans = max(ans, v)
print(ans... | from collections import defaultdict
n = int(eval(input()))
numbers = list(map(int, input().split()))
d = defaultdict(int)
for num in numbers:
for x in [-1, 0, 1]:
if num + x >= 0:
d[num + x] += 1
ans = 0
for k, v in list(d.items()):
ans = max(ans, v)
print(ans)
| false | 0 | [
"-nums = list(map(int, input().split()))",
"-frequency = defaultdict(int)",
"-for n in nums:",
"+numbers = list(map(int, input().split()))",
"+d = defaultdict(int)",
"+for num in numbers:",
"- if 0 <= n + x and n + x <= 10**5:",
"- frequency[n + x] += 1",
"+ if num + x >= 0:... | false | 0.030707 | 0.105199 | 0.291895 | [
"s898393448",
"s296781179"
] |
u381518904 | p02971 | python | s898929918 | s575650452 | 933 | 252 | 70,104 | 14,076 | Accepted | Accepted | 72.99 | n = int(eval(input()))
numList = [int(eval(input())) for _ in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
if num != maxVal:
print(maxVal)
else:
print(secondVal) | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
max_val = max(A)
AA = A[:]
AA.remove(max_val)
second_max_val = max(AA)
for a in A:
if a != max_val:
print(max_val)
else:
... | 11 | 18 | 251 | 373 | n = int(eval(input()))
numList = [int(eval(input())) for _ in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
if num != maxVal:
print(maxVal)
else:
print(secondVal)
| import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
max_val = max(A)
AA = A[:]
AA.remove(max_val)
second_max_val = max(AA)
for a in A:
if a != max_val:
print(max_val)
else:
print(second... | false | 38.888889 | [
"-n = int(eval(input()))",
"-numList = [int(eval(input())) for _ in range(n)]",
"-maxVal = max(numList)",
"-workList = numList[:]",
"-workList.remove(maxVal)",
"-secondVal = max(workList)",
"-for num in numList:",
"- if num != maxVal:",
"- print(maxVal)",
"- else:",
"- print(... | false | 0.036355 | 0.036809 | 0.987679 | [
"s898929918",
"s575650452"
] |
u367701763 | p02719 | python | s961990859 | s836067914 | 297 | 63 | 80,144 | 61,900 | Accepted | Accepted | 78.79 | import sys
input = sys.stdin.readline
def binary_search_int(ok, ng, solve):
"""
:param ok: solve(x) = True を必ず満たす点
:param ng: solve(x) = False を必ず満たす点
"""
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if solve(mid):
ok = mid
else:
ng = mid... | import sys
input = sys.stdin.readline
def binary_search_int(ok, ng):
"""
:param ok: solve(x) = True を必ず満たす点
:param ng: solve(x) = False を必ず満たす点
"""
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if solve(mid):
ok = mid
else:
ng = mid
r... | 26 | 26 | 614 | 600 | import sys
input = sys.stdin.readline
def binary_search_int(ok, ng, solve):
"""
:param ok: solve(x) = True を必ず満たす点
:param ng: solve(x) = False を必ず満たす点
"""
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if solve(mid):
ok = mid
else:
ng = mid
return... | import sys
input = sys.stdin.readline
def binary_search_int(ok, ng):
"""
:param ok: solve(x) = True を必ず満たす点
:param ng: solve(x) = False を必ず満たす点
"""
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if solve(mid):
ok = mid
else:
ng = mid
return ok, ng... | false | 0 | [
"-def binary_search_int(ok, ng, solve):",
"+def binary_search_int(ok, ng):",
"-a, b = binary_search_int(0, 10**18, solve)",
"+a, b = binary_search_int(0, 10**18)"
] | false | 0.031879 | 0.039762 | 0.80176 | [
"s961990859",
"s836067914"
] |
u732061897 | p03221 | python | s759782439 | s044326532 | 935 | 572 | 101,340 | 38,216 | Accepted | Accepted | 38.82 | N, M = list(map(int, input().split()))
PY = [list(map(int, input().split())) for i in range(M)]
convertedPY = [
{'index': i,
'city': py[0],
'year': py[1]
} for i, py in enumerate(PY)
]
'''
3 4
1 32
3 64
3 63
1 33
'''
convertedPY = sorted(convertedPY, key=lambda a: (a['city'], a['ye... | N, M = list(map(int, input().split()))
PY = [list(map(int, input().split())) + [i] + [0] for i in range(M)]
PY_sorted = sorted(PY, key=lambda a: (a[0], a[1]))
PY_sorted[0][3] = str(PY_sorted[0][0]).zfill(6) + str(1).zfill(6)
#print(PY_sorted)
cnt = 1
for i in range(1, M):
cnt += 1
if PY_sorted[i][0] !... | 51 | 19 | 1,052 | 617 | N, M = list(map(int, input().split()))
PY = [list(map(int, input().split())) for i in range(M)]
convertedPY = [{"index": i, "city": py[0], "year": py[1]} for i, py in enumerate(PY)]
"""
3 4
1 32
3 64
3 63
1 33
"""
convertedPY = sorted(convertedPY, key=lambda a: (a["city"], a["year"]))
answer = []
cnt = 0
tmp = converte... | N, M = list(map(int, input().split()))
PY = [list(map(int, input().split())) + [i] + [0] for i in range(M)]
PY_sorted = sorted(PY, key=lambda a: (a[0], a[1]))
PY_sorted[0][3] = str(PY_sorted[0][0]).zfill(6) + str(1).zfill(6)
# print(PY_sorted)
cnt = 1
for i in range(1, M):
cnt += 1
if PY_sorted[i][0] != PY_sort... | false | 62.745098 | [
"-PY = [list(map(int, input().split())) for i in range(M)]",
"-convertedPY = [{\"index\": i, \"city\": py[0], \"year\": py[1]} for i, py in enumerate(PY)]",
"-\"\"\"",
"-3 4",
"-1 32",
"-3 64",
"-3 63",
"-1 33",
"-\"\"\"",
"-convertedPY = sorted(convertedPY, key=lambda a: (a[\"city\"], a[\"year\"]... | false | 0.040931 | 0.03719 | 1.100599 | [
"s759782439",
"s044326532"
] |
u780962115 | p03347 | python | s362112788 | s601489087 | 800 | 421 | 57,628 | 11,048 | Accepted | Accepted | 47.38 | n=int(eval(input()))
lists=[int(eval(input()))for i in range(n)]
lists.append(0)
ans=0
if lists[0]!=0:
print((-1))
else:
flag=True
for i in range(n-1):
if lists[i]+1<lists[i+1]:
flag=False
break
if not flag:
print((-1))
else:
for i in ra... | #sequence growing easy
N=int(eval(input()))
a=[int(eval(input())) for _ in range(N)]
answer=0
now_value=10**9
for i in range(N-1,-1,-1):
if a[i]>i:
answer=-1
break
if a[i]==now_value-1:
now_value-=1
else:
answer+=a[i]
now_value=a[i]
for i in range(N-1):... | 23 | 19 | 467 | 382 | n = int(eval(input()))
lists = [int(eval(input())) for i in range(n)]
lists.append(0)
ans = 0
if lists[0] != 0:
print((-1))
else:
flag = True
for i in range(n - 1):
if lists[i] + 1 < lists[i + 1]:
flag = False
break
if not flag:
print((-1))
else:
for i... | # sequence growing easy
N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
answer = 0
now_value = 10**9
for i in range(N - 1, -1, -1):
if a[i] > i:
answer = -1
break
if a[i] == now_value - 1:
now_value -= 1
else:
answer += a[i]
now_value = a[i]
for i in... | false | 17.391304 | [
"-n = int(eval(input()))",
"-lists = [int(eval(input())) for i in range(n)]",
"-lists.append(0)",
"-ans = 0",
"-if lists[0] != 0:",
"- print((-1))",
"-else:",
"- flag = True",
"- for i in range(n - 1):",
"- if lists[i] + 1 < lists[i + 1]:",
"- flag = False",
"- ... | false | 0.066976 | 0.037693 | 1.776864 | [
"s362112788",
"s601489087"
] |
u164727245 | p02598 | python | s806564489 | s157939991 | 686 | 240 | 33,528 | 50,932 | Accepted | Accepted | 65.01 | # coding: utf-8
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = tuple(map(int, args[1].split()))
l, r = 0, max(A)
while l+1 < r:
m = (l+r)//2
cnt = 0
for a in A:
cnt += -(-a//m)-1
if k < cnt:
l = m
... | # coding: utf-8
import numpy as np
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = np.array(tuple(map(int, args[1].split())))
l, r = 0, np.max(A)
while l+1 < r:
m = (l+r)//2
if k < np.sum(-(-A//m)-1):
l = m
else:
r... | 23 | 21 | 443 | 422 | # coding: utf-8
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = tuple(map(int, args[1].split()))
l, r = 0, max(A)
while l + 1 < r:
m = (l + r) // 2
cnt = 0
for a in A:
cnt += -(-a // m) - 1
if k < cnt:
l = m
else:
... | # coding: utf-8
import numpy as np
def solve(*args: str) -> str:
n, k = list(map(int, args[0].split()))
A = np.array(tuple(map(int, args[1].split())))
l, r = 0, np.max(A)
while l + 1 < r:
m = (l + r) // 2
if k < np.sum(-(-A // m) - 1):
l = m
else:
r = m
... | false | 8.695652 | [
"+import numpy as np",
"+",
"+",
"- A = tuple(map(int, args[1].split()))",
"- l, r = 0, max(A)",
"+ A = np.array(tuple(map(int, args[1].split())))",
"+ l, r = 0, np.max(A)",
"- cnt = 0",
"- for a in A:",
"- cnt += -(-a // m) - 1",
"- if k < cnt:",
"+... | false | 0.04088 | 0.191433 | 0.213546 | [
"s806564489",
"s157939991"
] |
u301624971 | p03073 | python | s987963425 | s719394625 | 37 | 29 | 3,956 | 3,956 | Accepted | Accepted | 21.62 | N=list(eval(input()))
counter=0
pre = N.pop(0)
for n in N:
if(pre == n):
counter+=1
if(pre == "0"):
pre="1"
else:
pre="0"
print(counter)
| def myAnswer(s:list) -> str:
ans = 0
pre =s.pop(0)
for i in s:
if(pre == i):
ans += 1
pre = "1" if(i == "0") else "0"
else:
pre = i
return ans
def modelAnswer():
tmp=1
def main():
s = list(eval(input()))
print((myAnswer(s)))
if __name__ == '... | 14 | 19 | 183 | 333 | N = list(eval(input()))
counter = 0
pre = N.pop(0)
for n in N:
if pre == n:
counter += 1
if pre == "0":
pre = "1"
else:
pre = "0"
print(counter)
| def myAnswer(s: list) -> str:
ans = 0
pre = s.pop(0)
for i in s:
if pre == i:
ans += 1
pre = "1" if (i == "0") else "0"
else:
pre = i
return ans
def modelAnswer():
tmp = 1
def main():
s = list(eval(input()))
print((myAnswer(s)))
if __... | false | 26.315789 | [
"-N = list(eval(input()))",
"-counter = 0",
"-pre = N.pop(0)",
"-for n in N:",
"- if pre == n:",
"- counter += 1",
"- if pre == \"0\":",
"- pre = \"1\"",
"- else:",
"- pre = \"0\"",
"-print(counter)",
"+def myAnswer(s: list) -> str:",
"+ ans = 0",
"+ pre... | false | 0.040428 | 0.04212 | 0.959822 | [
"s987963425",
"s719394625"
] |
u063052907 | p03633 | python | s763653601 | s196644793 | 38 | 17 | 5,384 | 3,064 | Accepted | Accepted | 55.26 | from functools import reduce
from fractions import gcd
def lcm(a, b):
return (a * b) // gcd(a, b)
N = int(eval(input()))
lst_T = [int(eval(input())) for _ in range(N)]
ans = reduce(lcm, lst_T)
print(ans) | def gcd(a, b):
if b == 0:
return a
return gcd(b, a%b)
def lcm(a, b):
return (a * b) // gcd(a, b)
N = int(eval(input()))
lst_T = [int(eval(input())) for _ in range(N)]
ans = 1
for t in lst_T:
ans = lcm(ans, t)
print(ans) | 16 | 20 | 218 | 258 | from functools import reduce
from fractions import gcd
def lcm(a, b):
return (a * b) // gcd(a, b)
N = int(eval(input()))
lst_T = [int(eval(input())) for _ in range(N)]
ans = reduce(lcm, lst_T)
print(ans)
| def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return (a * b) // gcd(a, b)
N = int(eval(input()))
lst_T = [int(eval(input())) for _ in range(N)]
ans = 1
for t in lst_T:
ans = lcm(ans, t)
print(ans)
| false | 20 | [
"-from functools import reduce",
"-from fractions import gcd",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"+ return gcd(b, a % b)",
"-ans = reduce(lcm, lst_T)",
"+ans = 1",
"+for t in lst_T:",
"+ ans = lcm(ans, t)"
] | false | 0.20704 | 0.069853 | 2.963928 | [
"s763653601",
"s196644793"
] |
u923668099 | p00740 | python | s482484997 | s266590643 | 4,940 | 4,100 | 7,508 | 7,672 | Accepted | Accepted | 17 | from sys import stdin, stdout, stderr
while 1:
n, p = list(map(int, stdin.readline().split()))
if n + p == 0:
break
a = [0] * n
wan = p
for i in range(10**6):
if wan > 0:
a[i % n] += 1
wan -= 1
else:
wan += a[i % n]
... | from sys import stdin, stdout, stderr
a = [0] * 50
while 1:
n, p = list(map(int, stdin.readline().split()))
if n + p == 0:
break
wan = p
i = 0
while a[i] < p:
if wan > 0:
a[i] += 1
wan -= 1
else:
wan += a[i]
... | 22 | 25 | 409 | 383 | from sys import stdin, stdout, stderr
while 1:
n, p = list(map(int, stdin.readline().split()))
if n + p == 0:
break
a = [0] * n
wan = p
for i in range(10**6):
if wan > 0:
a[i % n] += 1
wan -= 1
else:
wan += a[i % n]
a[i % n] = ... | from sys import stdin, stdout, stderr
a = [0] * 50
while 1:
n, p = list(map(int, stdin.readline().split()))
if n + p == 0:
break
wan = p
i = 0
while a[i] < p:
if wan > 0:
a[i] += 1
wan -= 1
else:
wan += a[i]
a[i] = 0
i ... | false | 12 | [
"+a = [0] * 50",
"- a = [0] * n",
"- for i in range(10**6):",
"+ i = 0",
"+ while a[i] < p:",
"- a[i % n] += 1",
"+ a[i] += 1",
"- wan += a[i % n]",
"- a[i % n] = 0",
"- if a[i % n] == p:",
"- print((i % n))",
"- ... | false | 0.539418 | 1.180632 | 0.456889 | [
"s482484997",
"s266590643"
] |
u393486651 | p03371 | python | s893782481 | s776248937 | 159 | 122 | 3,064 | 3,188 | Accepted | Accepted | 23.27 | def main():
A,B,C,X,Y = list(map(int, input().split()))
min_cost = 2 * (10 ** 5) * max(A, B, C)
for i in range(max(X, Y) + 1):
num_c = 2 * (max(X, Y) - i)
num_b = max(0, min(Y - num_c // 2, i))
num_a = max(0, min(X - num_c // 2, i))
total = A * num_a + B * num_b + C * num_c
min_cos... | def main():
A,B,C,X,Y = list(map(int, input().split()))
min_cost = 2 * (10 ** 5) * max(A, B, C)
for i in range(max(X, Y) + 1):
num_c = 2 * (max(X, Y) - i)
num_b = max(0, Y - num_c // 2)
num_a = max(0, X - num_c // 2)
total = A * num_a + B * num_b + C * num_c
min_cost = min(total, m... | 16 | 16 | 407 | 391 | def main():
A, B, C, X, Y = list(map(int, input().split()))
min_cost = 2 * (10**5) * max(A, B, C)
for i in range(max(X, Y) + 1):
num_c = 2 * (max(X, Y) - i)
num_b = max(0, min(Y - num_c // 2, i))
num_a = max(0, min(X - num_c // 2, i))
total = A * num_a + B * num_b + C * num_c... | def main():
A, B, C, X, Y = list(map(int, input().split()))
min_cost = 2 * (10**5) * max(A, B, C)
for i in range(max(X, Y) + 1):
num_c = 2 * (max(X, Y) - i)
num_b = max(0, Y - num_c // 2)
num_a = max(0, X - num_c // 2)
total = A * num_a + B * num_b + C * num_c
min_cos... | false | 0 | [
"- num_b = max(0, min(Y - num_c // 2, i))",
"- num_a = max(0, min(X - num_c // 2, i))",
"+ num_b = max(0, Y - num_c // 2)",
"+ num_a = max(0, X - num_c // 2)"
] | false | 0.120752 | 0.061794 | 1.954091 | [
"s893782481",
"s776248937"
] |
u606033239 | p03240 | python | s005334001 | s159227457 | 674 | 623 | 3,064 | 3,064 | Accepted | Accepted | 7.57 | n=int(eval(input()))
xyh=[]
x,y,h=-1,-1,-1
nonzero=-1
for i in range(n):
xyh.append(list(map(int,input().split())))
if xyh[i][2] != 0:
nonzero = i
for px in range(101):
for py in range(101):
nh = xyh[nonzero][2]+abs(xyh[nonzero][0]-px)+abs(xyh[nonzero][1]-py)
ok = Tr... | n=int(eval(input()))
a=[]
x,y,k=-1,-1,-1
t=-1
for o in range(n):
a.append(list(map(int,input().split())))
if a[o][2] != 0:
t=o
for i in range(101):
for j in range(101):
h=a[t][2]+abs(a[t][0]-i)+abs(a[t][1]-j)
d=True
for l in range(n):
if a[l][2] >... | 26 | 25 | 675 | 581 | n = int(eval(input()))
xyh = []
x, y, h = -1, -1, -1
nonzero = -1
for i in range(n):
xyh.append(list(map(int, input().split())))
if xyh[i][2] != 0:
nonzero = i
for px in range(101):
for py in range(101):
nh = xyh[nonzero][2] + abs(xyh[nonzero][0] - px) + abs(xyh[nonzero][1] - py)
ok ... | n = int(eval(input()))
a = []
x, y, k = -1, -1, -1
t = -1
for o in range(n):
a.append(list(map(int, input().split())))
if a[o][2] != 0:
t = o
for i in range(101):
for j in range(101):
h = a[t][2] + abs(a[t][0] - i) + abs(a[t][1] - j)
d = True
for l in range(n):
if... | false | 3.846154 | [
"-xyh = []",
"-x, y, h = -1, -1, -1",
"-nonzero = -1",
"-for i in range(n):",
"- xyh.append(list(map(int, input().split())))",
"- if xyh[i][2] != 0:",
"- nonzero = i",
"-for px in range(101):",
"- for py in range(101):",
"- nh = xyh[nonzero][2] + abs(xyh[nonzero][0] - px) + ... | false | 0.107993 | 0.050562 | 2.135842 | [
"s005334001",
"s159227457"
] |
u537905693 | p02614 | python | s930422418 | s922489897 | 77 | 59 | 9,268 | 9,144 | Accepted | Accepted | 23.38 | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def simulate(mh, mw, H, W, K, grid):
flags = [[1 for _ in range(W)] for _ in range(H)]
for h in range(H):
if n... | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def main():
H, W, K = rli()
grid = []
for i in range(H):
grid.append(eval(input()))
ans = 0
for... | 50 | 33 | 1,076 | 678 | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def simulate(mh, mw, H, W, K, grid):
flags = [[1 for _ in range(W)] for _ in range(H)]
for h in range(H):
if not (mh >> h) ... | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(eval(input()))
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def main():
H, W, K = rli()
grid = []
for i in range(H):
grid.append(eval(input()))
ans = 0
for mh in range(0, ... | false | 34 | [
"-def simulate(mh, mw, H, W, K, grid):",
"- flags = [[1 for _ in range(W)] for _ in range(H)]",
"- for h in range(H):",
"- if not (mh >> h) & 1:",
"- continue",
"- for w in range(W):",
"- flags[h][w] = 0",
"- for w in range(W):",
"- if not (mw >> w... | false | 0.040642 | 0.04029 | 1.008734 | [
"s930422418",
"s922489897"
] |
u968166680 | p02763 | python | s046004692 | s408891525 | 521 | 461 | 203,660 | 203,084 | Accepted | Accepted | 11.52 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
def add(self, i, x=1):
i += 1
w... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
def add(self, i, x=1):
i += 1
w... | 69 | 69 | 1,501 | 1,495 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
def add(self, i, x=1):
i += 1
while i <= self.n:
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
def add(self, i, x=1):
i += 1
while i <= self.n:
... | false | 0 | [
"- query = [readline().split() for _ in range(Q)]",
"- for q in query:",
"- if q[0] == \"1\":",
"- i = int(q[1]) - 1",
"- c = q[2]",
"- bit[ord(S[i]) - ord(\"a\")].add(i, -1)",
"- bit[ord(c) - ord(\"a\")].add(i, 1)",
"- S[i] = c",
"... | false | 0.044973 | 0.045113 | 0.996895 | [
"s046004692",
"s408891525"
] |
u608241985 | p02725 | python | s713735446 | s150232833 | 92 | 73 | 27,900 | 27,908 | Accepted | Accepted | 20.65 | import sys
read = sys.stdin.buffer.read
k, n, *A = list(map(int, read().split()))
far = k + A[0] - A[-1]
y = A[0]
for x in A[1:]:
dis = x - y
if far < dis:
far = dis
y = x
print((k - far)) | import sys
def main():
read = sys.stdin.buffer.read
k, n, *A = list(map(int, read().split()))
far = k + A[0] - A[-1]
y = A[0]
for x in A[1:]:
dis = x - y
if far < dis:
far = dis
y = x
print((k - far))
if __name__ == "__main__":
main() | 11 | 18 | 210 | 311 | import sys
read = sys.stdin.buffer.read
k, n, *A = list(map(int, read().split()))
far = k + A[0] - A[-1]
y = A[0]
for x in A[1:]:
dis = x - y
if far < dis:
far = dis
y = x
print((k - far))
| import sys
def main():
read = sys.stdin.buffer.read
k, n, *A = list(map(int, read().split()))
far = k + A[0] - A[-1]
y = A[0]
for x in A[1:]:
dis = x - y
if far < dis:
far = dis
y = x
print((k - far))
if __name__ == "__main__":
main()
| false | 38.888889 | [
"-read = sys.stdin.buffer.read",
"-k, n, *A = list(map(int, read().split()))",
"-far = k + A[0] - A[-1]",
"-y = A[0]",
"-for x in A[1:]:",
"- dis = x - y",
"- if far < dis:",
"- far = dis",
"- y = x",
"-print((k - far))",
"+",
"+def main():",
"+ read = sys.stdin.buffer.rea... | false | 0.093887 | 0.044556 | 2.107174 | [
"s713735446",
"s150232833"
] |
u266874640 | p03044 | python | s971070100 | s810853756 | 1,152 | 1,040 | 103,252 | 102,108 | Accepted | Accepted | 9.72 | import sys
sys.setrecursionlimit(500*500)
N = int(eval(input()))
edges = [list(map(int,input().split())) for _ in range(N-1)]
A = [[]for _ in range(N+1)]
ans = [-1]*(N+1)
for u,v,w in edges:
A[u].append([v,w%2])
A[v].append([u,w%2])
ans[1] = 0
def dfs(r):
for a in A[r].copy():
n = a[0]... | import sys
sys.setrecursionlimit(500*500)
N = int(eval(input()))
edges = [list(map(int,input().split())) for _ in range(N-1)]
A = [[] for _ in range(N+1)]
for edge in edges:
A[edge[0]].append([edge[1],edge[2]])
A[edge[1]].append([edge[0],edge[2]])
depth = [-1] * (N+1)
depth[1] = 0
def dfs(A,s):
... | 21 | 24 | 461 | 534 | import sys
sys.setrecursionlimit(500 * 500)
N = int(eval(input()))
edges = [list(map(int, input().split())) for _ in range(N - 1)]
A = [[] for _ in range(N + 1)]
ans = [-1] * (N + 1)
for u, v, w in edges:
A[u].append([v, w % 2])
A[v].append([u, w % 2])
ans[1] = 0
def dfs(r):
for a in A[r].copy():
... | import sys
sys.setrecursionlimit(500 * 500)
N = int(eval(input()))
edges = [list(map(int, input().split())) for _ in range(N - 1)]
A = [[] for _ in range(N + 1)]
for edge in edges:
A[edge[0]].append([edge[1], edge[2]])
A[edge[1]].append([edge[0], edge[2]])
depth = [-1] * (N + 1)
depth[1] = 0
def dfs(A, s):
... | false | 12.5 | [
"-ans = [-1] * (N + 1)",
"-for u, v, w in edges:",
"- A[u].append([v, w % 2])",
"- A[v].append([u, w % 2])",
"-ans[1] = 0",
"+for edge in edges:",
"+ A[edge[0]].append([edge[1], edge[2]])",
"+ A[edge[1]].append([edge[0], edge[2]])",
"+depth = [-1] * (N + 1)",
"+depth[1] = 0",
"-def d... | false | 0.037302 | 0.036678 | 1.017018 | [
"s971070100",
"s810853756"
] |
u477977638 | p02586 | python | s987624033 | s346682812 | 1,368 | 867 | 428,036 | 145,536 | Accepted | Accepted | 36.62 | import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return input().rstrip().decode()
def II(): return int(eval(input()))
def FI(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float,input... | import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return input().rstrip().decode()
def II(): return int(eval(input()))
def FI(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float,input... | 57 | 57 | 1,237 | 1,139 | import sys
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return input().rstrip().decode()
def II():
return int(eval(input()))
def FI():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
return ... | import sys
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return input().rstrip().decode()
def II():
return int(eval(input()))
def FI():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
return ... | false | 0 | [
"- dp = [[[0] * (c + 1) for i in range(r + 1)] for j in range(4)]",
"+ dp = [[0] * (c + 1) for j in range(4)]",
"- dp[i][rr][cc] = max(dp[i][rr][cc - 1], dp[3][rr - 1][cc])",
"+ dp[i][cc] = max(dp[i][cc - 1], dp[3][cc])",
"- dp[0][rr][cc] = max(dp[3... | false | 0.040605 | 0.042287 | 0.960232 | [
"s987624033",
"s346682812"
] |
u078042885 | p00510 | python | s224744505 | s356691793 | 60 | 50 | 7,708 | 7,664 | Accepted | Accepted | 16.67 | # -*- coding: utf-8 -*-
n=int(eval(input()))
m=int(eval(input()))
ans=c=m
for i in range(n):
a,b=[int(a) for a in input().split()]
if c<0:
continue
c+=a-b
if ans<c:
ans=c
if c<0:
ans=0
print(ans) | n=int(eval(input()))
ans=c=m=int(eval(input()))
for i in[0]*n:
a,b=list(map(int,input().split()))
if c<0:ans=0;break
c+=a-b
ans=max(ans,c)
print(ans) | 14 | 8 | 240 | 154 | # -*- coding: utf-8 -*-
n = int(eval(input()))
m = int(eval(input()))
ans = c = m
for i in range(n):
a, b = [int(a) for a in input().split()]
if c < 0:
continue
c += a - b
if ans < c:
ans = c
if c < 0:
ans = 0
print(ans)
| n = int(eval(input()))
ans = c = m = int(eval(input()))
for i in [0] * n:
a, b = list(map(int, input().split()))
if c < 0:
ans = 0
break
c += a - b
ans = max(ans, c)
print(ans)
| false | 42.857143 | [
"-# -*- coding: utf-8 -*-",
"-m = int(eval(input()))",
"-ans = c = m",
"-for i in range(n):",
"- a, b = [int(a) for a in input().split()]",
"- if c < 0:",
"- continue",
"- c += a - b",
"- if ans < c:",
"- ans = c",
"+ans = c = m = int(eval(input()))",
"+for i in [0] *... | false | 0.039346 | 0.038408 | 1.024413 | [
"s224744505",
"s356691793"
] |
u644907318 | p03001 | python | s367993695 | s738204584 | 163 | 75 | 38,256 | 61,700 | Accepted | Accepted | 53.99 | W,H,x,y = list(map(int,input().split()))
s = W*H/2
if W/2==x and H/2==y:
print((s,1))
else:
print((s,0)) | W,H,x,y = list(map(int,input().split()))
if x*2==W and y*2==H:
z = 1
else:
z = 0
print((W*H/2,z)) | 6 | 6 | 107 | 102 | W, H, x, y = list(map(int, input().split()))
s = W * H / 2
if W / 2 == x and H / 2 == y:
print((s, 1))
else:
print((s, 0))
| W, H, x, y = list(map(int, input().split()))
if x * 2 == W and y * 2 == H:
z = 1
else:
z = 0
print((W * H / 2, z))
| false | 0 | [
"-s = W * H / 2",
"-if W / 2 == x and H / 2 == y:",
"- print((s, 1))",
"+if x * 2 == W and y * 2 == H:",
"+ z = 1",
"- print((s, 0))",
"+ z = 0",
"+print((W * H / 2, z))"
] | false | 0.075237 | 0.035072 | 2.145193 | [
"s367993695",
"s738204584"
] |
u373047809 | p04045 | python | s618316776 | s936422904 | 99 | 82 | 2,940 | 2,940 | Accepted | Accepted | 17.17 | n,_,*d=open(0).read().split()
n=int(n)
while 1:
if all(d not in str(n)for d in d):exit(print(n))
n+=1
| n=int(input().split()[0])
a=set(eval(input()))
while a&set(str(n)):n+=1
print(n) | 5 | 4 | 107 | 77 | n, _, *d = open(0).read().split()
n = int(n)
while 1:
if all(d not in str(n) for d in d):
exit(print(n))
n += 1
| n = int(input().split()[0])
a = set(eval(input()))
while a & set(str(n)):
n += 1
print(n)
| false | 20 | [
"-n, _, *d = open(0).read().split()",
"-n = int(n)",
"-while 1:",
"- if all(d not in str(n) for d in d):",
"- exit(print(n))",
"+n = int(input().split()[0])",
"+a = set(eval(input()))",
"+while a & set(str(n)):",
"+print(n)"
] | false | 0.04962 | 0.048521 | 1.022642 | [
"s618316776",
"s936422904"
] |
u017810624 | p03846 | python | s144557236 | s074563927 | 173 | 122 | 14,008 | 14,004 | Accepted | Accepted | 29.48 | n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
f=1
if n%2==0:
for i in range(n):
if i%2==0 and i+1!=a[i] or i%2==1 and i!=a[i]:
f=0
break
else:
for i in range(n):
if i%2==1 and i+1!=a[i] or i%2==0 and i!=a[i]:
f=0
break
if f==0:print((0))
else:
ans=1... | n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
f=1
for i in range(n):
if i%2==n%2 and i+1!=a[i] or i%2==(n+1)%2 and i!=a[i]:
f=0
break
if f==0:print((0))
else:print(((2**(n//2))%(10**9+7))) | 20 | 10 | 373 | 214 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
f = 1
if n % 2 == 0:
for i in range(n):
if i % 2 == 0 and i + 1 != a[i] or i % 2 == 1 and i != a[i]:
f = 0
break
else:
for i in range(n):
if i % 2 == 1 and i + 1 != a[i] or i % 2 == 0 and i != a[i]:
... | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
f = 1
for i in range(n):
if i % 2 == n % 2 and i + 1 != a[i] or i % 2 == (n + 1) % 2 and i != a[i]:
f = 0
break
if f == 0:
print((0))
else:
print(((2 ** (n // 2)) % (10**9 + 7)))
| false | 50 | [
"-if n % 2 == 0:",
"- for i in range(n):",
"- if i % 2 == 0 and i + 1 != a[i] or i % 2 == 1 and i != a[i]:",
"- f = 0",
"- break",
"-else:",
"- for i in range(n):",
"- if i % 2 == 1 and i + 1 != a[i] or i % 2 == 0 and i != a[i]:",
"- f = 0",
"- ... | false | 0.035782 | 0.035566 | 1.006057 | [
"s144557236",
"s074563927"
] |
u133936772 | p03816 | python | s525034139 | s086198132 | 65 | 52 | 21,824 | 20,208 | Accepted | Accepted | 20 | n,*l=list(map(int,open(0).read().split()))
from collections import *
c=Counter(l)
print((len(c)-sum(1-v%2 for v in list(c.values()))%2)) | _,*l=list(map(int,open(0).read().split()))
c=len(set(l))
print((c-1+c%2)) | 4 | 3 | 125 | 67 | n, *l = list(map(int, open(0).read().split()))
from collections import *
c = Counter(l)
print((len(c) - sum(1 - v % 2 for v in list(c.values())) % 2))
| _, *l = list(map(int, open(0).read().split()))
c = len(set(l))
print((c - 1 + c % 2))
| false | 25 | [
"-n, *l = list(map(int, open(0).read().split()))",
"-from collections import *",
"-",
"-c = Counter(l)",
"-print((len(c) - sum(1 - v % 2 for v in list(c.values())) % 2))",
"+_, *l = list(map(int, open(0).read().split()))",
"+c = len(set(l))",
"+print((c - 1 + c % 2))"
] | false | 0.00783 | 0.038659 | 0.202553 | [
"s525034139",
"s086198132"
] |
u440566786 | p02862 | python | s755422926 | s669423205 | 251 | 200 | 49,136 | 49,008 | Accepted | Accepted | 20.32 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def modfact(n):
fact=[1]*(n+1)
invfact=[1]*(n+1)
for i in range(1,n+1):
fact[i]=i*fact[i-1]%MOD
invfact[n]=pow(fact[n],MOD-2,MOD)
for i in range(n-1,-1,-1):
... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
class modfact(object):
def __init__(self,n):
fact=[1]*(n+1)
invfact=[1]*(n+1)
for i in range(1,n+1):
fact[i]=i*fact[i-1]%MOD
invfact[n]=pow(f... | 30 | 37 | 664 | 905 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def modfact(n):
fact = [1] * (n + 1)
invfact = [1] * (n + 1)
for i in range(1, n + 1):
fact[i] = i * fact[i - 1] % MOD
invfact[n] = pow(fact[n], MOD - 2, MOD)
for ... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
class modfact(object):
def __init__(self, n):
fact = [1] * (n + 1)
invfact = [1] * (n + 1)
for i in range(1, n + 1):
fact[i] = i * fact[i - 1] % MOD
... | false | 18.918919 | [
"-def modfact(n):",
"- fact = [1] * (n + 1)",
"- invfact = [1] * (n + 1)",
"- for i in range(1, n + 1):",
"- fact[i] = i * fact[i - 1] % MOD",
"- invfact[n] = pow(fact[n], MOD - 2, MOD)",
"- for i in range(n - 1, -1, -1):",
"- invfact[i] = invfact[i + 1] * (i + 1) % MOD",
... | false | 0.165233 | 0.224656 | 0.735493 | [
"s755422926",
"s669423205"
] |
u562935282 | p03274 | python | s931165064 | s610108959 | 114 | 63 | 15,024 | 14,384 | Accepted | Accepted | 44.74 | inf = float('inf')
N, K = list(map(int, input().split()))
x = tuple(map(int, input().split()))
m, p = [], []
for xx in x:
if xx > 0:
p.append(xx)
elif xx < 0:
m.append(-xx)
else:
K -= 1
if K == 0:
print((0))
exit()
m.sort()
lp = len(... | def main():
N, K = list(map(int, input().split()))
*x, = list(map(int, input().split()))
ans = 3 * 10 ** 8
for left, right in zip(x, x[K - 1:]):
if left * right < 0:
ans = min(ans, right - left + min(-left, right))
else:
ans = min(ans, -left if left < 0 ... | 33 | 32 | 732 | 731 | inf = float("inf")
N, K = list(map(int, input().split()))
x = tuple(map(int, input().split()))
m, p = [], []
for xx in x:
if xx > 0:
p.append(xx)
elif xx < 0:
m.append(-xx)
else:
K -= 1
if K == 0:
print((0))
exit()
m.sort()
lp = len(p)
lm = len(m)
ans ... | def main():
N, K = list(map(int, input().split()))
(*x,) = list(map(int, input().split()))
ans = 3 * 10**8
for left, right in zip(x, x[K - 1 :]):
if left * right < 0:
ans = min(ans, right - left + min(-left, right))
else:
ans = min(ans, -left if left < 0 else righ... | false | 3.030303 | [
"-inf = float(\"inf\")",
"-N, K = list(map(int, input().split()))",
"-x = tuple(map(int, input().split()))",
"-m, p = [], []",
"-for xx in x:",
"- if xx > 0:",
"- p.append(xx)",
"- elif xx < 0:",
"- m.append(-xx)",
"- else:",
"- K -= 1",
"- if K == 0:",
"... | false | 0.0368 | 0.044288 | 0.830915 | [
"s931165064",
"s610108959"
] |
u690536347 | p03127 | python | s622648352 | s973891514 | 252 | 78 | 70,936 | 16,240 | Accepted | Accepted | 69.05 | n=int(eval(input()))
a=set(map(int,input().split()))
while len(a)!=1:
t=min(a)
a=set(i for i in [x%t if x!=t else t for x in a] if i)
print((a.pop())) | from fractions import gcd
from functools import reduce
_=eval(input())
*a,=list(map(int,input().split()))
print((reduce(gcd,a))) | 8 | 5 | 158 | 118 | n = int(eval(input()))
a = set(map(int, input().split()))
while len(a) != 1:
t = min(a)
a = set(i for i in [x % t if x != t else t for x in a] if i)
print((a.pop()))
| from fractions import gcd
from functools import reduce
_ = eval(input())
(*a,) = list(map(int, input().split()))
print((reduce(gcd, a)))
| false | 37.5 | [
"-n = int(eval(input()))",
"-a = set(map(int, input().split()))",
"-while len(a) != 1:",
"- t = min(a)",
"- a = set(i for i in [x % t if x != t else t for x in a] if i)",
"-print((a.pop()))",
"+from fractions import gcd",
"+from functools import reduce",
"+",
"+_ = eval(input())",
"+(*a,) ... | false | 0.046092 | 0.05863 | 0.786141 | [
"s622648352",
"s973891514"
] |
u310233294 | p03112 | python | s418788066 | s803000174 | 1,132 | 907 | 16,144 | 16,776 | Accepted | Accepted | 19.88 | import bisect
A, B, Q = list(map(int, input().split()))
s = [-10 ** 12] + [int(eval(input())) for _ in range(A)] + [10 ** 12]
t = [-10 ** 12] + [int(eval(input())) for _ in range(B)] + [10 ** 12]
x = [int(eval(input())) for _ in range(Q)]
for i in x:
si = bisect.bisect_left(s, i)
ti = bisect.bisect_l... | import bisect
A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
S = [-10 ** 12] + S + [10 ** 12]
T = [-10 ** 12] + T + [10 ** 12]
for x in X:
si = bisect.bisect_right(S, x)
ti = ... | 18 | 17 | 564 | 526 | import bisect
A, B, Q = list(map(int, input().split()))
s = [-(10**12)] + [int(eval(input())) for _ in range(A)] + [10**12]
t = [-(10**12)] + [int(eval(input())) for _ in range(B)] + [10**12]
x = [int(eval(input())) for _ in range(Q)]
for i in x:
si = bisect.bisect_left(s, i)
ti = bisect.bisect_left(t, i)
... | import bisect
A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
S = [-(10**12)] + S + [10**12]
T = [-(10**12)] + T + [10**12]
for x in X:
si = bisect.bisect_right(S, x)
ti = bisect.bisect_ri... | false | 5.555556 | [
"-s = [-(10**12)] + [int(eval(input())) for _ in range(A)] + [10**12]",
"-t = [-(10**12)] + [int(eval(input())) for _ in range(B)] + [10**12]",
"-x = [int(eval(input())) for _ in range(Q)]",
"-for i in x:",
"- si = bisect.bisect_left(s, i)",
"- ti = bisect.bisect_left(t, i)",
"- s1, s2 = s[si -... | false | 0.146636 | 0.107775 | 1.360582 | [
"s418788066",
"s803000174"
] |
u893063840 | p03649 | python | s232333716 | s026889140 | 484 | 199 | 3,060 | 12,504 | Accepted | Accepted | 58.88 | n = int(eval(input()))
a = list(map(int, input().split()))
i = 0
ans = 0
while max(a) >= n:
if a[i] >= n:
cnt = a[i] // n
ans += cnt
a[i] -= n * cnt
for j in range(n):
if j == i:
continue
a[j] += cnt
i = (i + 1) % n
prin... | import numpy as np
n = int(eval(input()))
a = np.array(input().split(), np.int64)
def check(x):
cnt = np.maximum((a + x + 1) // (n + 1), 0)
return cnt.sum() <= x
l = -1
r = 10 ** 18
while r - l > 1:
m = (l + r) // 2
if check(m):
r = m
else:
l = m
for i in ... | 18 | 25 | 321 | 399 | n = int(eval(input()))
a = list(map(int, input().split()))
i = 0
ans = 0
while max(a) >= n:
if a[i] >= n:
cnt = a[i] // n
ans += cnt
a[i] -= n * cnt
for j in range(n):
if j == i:
continue
a[j] += cnt
i = (i + 1) % n
print(ans)
| import numpy as np
n = int(eval(input()))
a = np.array(input().split(), np.int64)
def check(x):
cnt = np.maximum((a + x + 1) // (n + 1), 0)
return cnt.sum() <= x
l = -1
r = 10**18
while r - l > 1:
m = (l + r) // 2
if check(m):
r = m
else:
l = m
for i in range(max(r - n * n, 0), ... | false | 28 | [
"+import numpy as np",
"+",
"-a = list(map(int, input().split()))",
"-i = 0",
"-ans = 0",
"-while max(a) >= n:",
"- if a[i] >= n:",
"- cnt = a[i] // n",
"- ans += cnt",
"- a[i] -= n * cnt",
"- for j in range(n):",
"- if j == i:",
"- co... | false | 0.11994 | 0.466044 | 0.257359 | [
"s232333716",
"s026889140"
] |
u673361376 | p03379 | python | s859346018 | s256668642 | 1,701 | 335 | 128,084 | 26,016 | Accepted | Accepted | 80.31 | N = int(input())
X = sorted([[x,i] for i, x in enumerate(map(int,input().split()))])
med1,med2 = X[(N-1)//2][0], X[(N-1)//2+1][0]
ans = []
for idx1, x in enumerate(X):
if idx1 <= (N-1)//2: ans.append([x[1],med2])
else: ans.append([x[1],med1])
#print(i)
[print(med) for i, med in sorted(ans)]
| N = int(eval(input()))
X = list(map(int, input().split()))
sorted_X = sorted(X)
med_options = [sorted_X[N//2-1], sorted_X[N//2]]
for i in range(N):
if X[i] <= med_options[0]:
print((med_options[1]))
elif med_options[1] <= X[i]:
print((med_options[0]))
| 9 | 10 | 305 | 276 | N = int(input())
X = sorted([[x, i] for i, x in enumerate(map(int, input().split()))])
med1, med2 = X[(N - 1) // 2][0], X[(N - 1) // 2 + 1][0]
ans = []
for idx1, x in enumerate(X):
if idx1 <= (N - 1) // 2:
ans.append([x[1], med2])
else:
ans.append([x[1], med1])
# print(i)
[print(med) for i, ... | N = int(eval(input()))
X = list(map(int, input().split()))
sorted_X = sorted(X)
med_options = [sorted_X[N // 2 - 1], sorted_X[N // 2]]
for i in range(N):
if X[i] <= med_options[0]:
print((med_options[1]))
elif med_options[1] <= X[i]:
print((med_options[0]))
| false | 10 | [
"-N = int(input())",
"-X = sorted([[x, i] for i, x in enumerate(map(int, input().split()))])",
"-med1, med2 = X[(N - 1) // 2][0], X[(N - 1) // 2 + 1][0]",
"-ans = []",
"-for idx1, x in enumerate(X):",
"- if idx1 <= (N - 1) // 2:",
"- ans.append([x[1], med2])",
"- else:",
"- ans.a... | false | 0.078389 | 0.04064 | 1.928869 | [
"s859346018",
"s256668642"
] |
u413165887 | p03128 | python | s986073025 | s704529108 | 49 | 38 | 3,700 | 4,084 | Accepted | Accepted | 22.45 | n , m = list(map(int, input().split(' ')))
s = [0,2,5,5,4,5,6,3,7,6]
a = list(map(int, input().split(' ')))
r = []
for i in range(len(a)):
r.append([s[a[i]],a[i]])
r.sort()
d = [-1]*(n+1)
d[0] = 0
for i in range(1,n+1):
j = 0
while j < len(a):
if i-s[r[j][1]] < 0:
j += 1
... | def main():
n, m = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
b = [0,2,5,5,4,5,6,3,7,6]
c = [[b[i], -i] for i in a]
c.sort()
result = [[] for _ in range(n+1)]
dp = [-1]*(n+1)
dp[0] = 0
for i in range(1, n+1):
for j in c:
i... | 33 | 34 | 760 | 948 | n, m = list(map(int, input().split(" ")))
s = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
a = list(map(int, input().split(" ")))
r = []
for i in range(len(a)):
r.append([s[a[i]], a[i]])
r.sort()
d = [-1] * (n + 1)
d[0] = 0
for i in range(1, n + 1):
j = 0
while j < len(a):
if i - s[r[j][1]] < 0:
j += ... | def main():
n, m = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
b = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
c = [[b[i], -i] for i in a]
c.sort()
result = [[] for _ in range(n + 1)]
dp = [-1] * (n + 1)
dp[0] = 0
for i in range(1, n + 1):
for j in c:
... | false | 2.941176 | [
"-n, m = list(map(int, input().split(\" \")))",
"-s = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]",
"-a = list(map(int, input().split(\" \")))",
"-r = []",
"-for i in range(len(a)):",
"- r.append([s[a[i]], a[i]])",
"-r.sort()",
"-d = [-1] * (n + 1)",
"-d[0] = 0",
"-for i in range(1, n + 1):",
"- j = 0"... | false | 0.041721 | 0.039553 | 1.054804 | [
"s986073025",
"s704529108"
] |
u353797797 | p03167 | python | s925600636 | s822510829 | 710 | 565 | 43,708 | 43,616 | Accepted | Accepted | 20.42 | from itertools import *
import sys
md=10**9+7
mis=list(map(int,sys.stdin.readline().split()))
h,w=mis
t=[[0]*(w+1) for _ in range(h+1)]
s=[]
for _ in range(h):
s+=[eval(input())]
for i,j in product(list(range(h)),list(range(w))):
if i==0 and j==0:
t[i+1][j+1]=1
elif s[i][j]==".":
... | md = 10 ** 9 + 7
h, w = list(map(int, input().split()))
a = [eval(input()) for _ in range(h)]
t = [[1] * w for _ in range(h)]
for i, ai in enumerate(a):
ti = t[i]
for j, aij in enumerate(ai):
if aij == "#":
ti[j] = 0
else:
if j == 0:
if i > 0:
... | 19 | 19 | 391 | 533 | from itertools import *
import sys
md = 10**9 + 7
mis = list(map(int, sys.stdin.readline().split()))
h, w = mis
t = [[0] * (w + 1) for _ in range(h + 1)]
s = []
for _ in range(h):
s += [eval(input())]
for i, j in product(list(range(h)), list(range(w))):
if i == 0 and j == 0:
t[i + 1][j + 1] = 1
eli... | md = 10**9 + 7
h, w = list(map(int, input().split()))
a = [eval(input()) for _ in range(h)]
t = [[1] * w for _ in range(h)]
for i, ai in enumerate(a):
ti = t[i]
for j, aij in enumerate(ai):
if aij == "#":
ti[j] = 0
else:
if j == 0:
if i > 0:
... | false | 0 | [
"-from itertools import *",
"-import sys",
"-",
"-mis = list(map(int, sys.stdin.readline().split()))",
"-h, w = mis",
"-t = [[0] * (w + 1) for _ in range(h + 1)]",
"-s = []",
"-for _ in range(h):",
"- s += [eval(input())]",
"-for i, j in product(list(range(h)), list(range(w))):",
"- if i =... | false | 0.007051 | 0.073226 | 0.096296 | [
"s925600636",
"s822510829"
] |
u368780724 | p03452 | python | s111933679 | s535766825 | 1,305 | 489 | 10,024 | 49,624 | Accepted | Accepted | 62.53 | def inpl(): return [int(i) for i in input().split()]
def find(x):
if par[x] == x:
return x
else:
par[x],dist[x] = find(par[x]),dist[x]+dist[par[x]]
return par[x]
N, M = inpl()
par = list(range(N+1))
dist = [0 for _ in range(N+1)]
for _ in range(M):
l, r, d = inpl()
... | import sys
readline = sys.stdin.readline
class UFP():
def __init__(self, num):
self.par = [-1]*num
self.dist = [0]*num
def find(self, x):
if self.par[x] < 0:
return x
else:
res = 0
xo = x
while self.par[x] >= 0:
... | 23 | 48 | 532 | 1,221 | def inpl():
return [int(i) for i in input().split()]
def find(x):
if par[x] == x:
return x
else:
par[x], dist[x] = find(par[x]), dist[x] + dist[par[x]]
return par[x]
N, M = inpl()
par = list(range(N + 1))
dist = [0 for _ in range(N + 1)]
for _ in range(M):
l, r, d = inpl()
... | import sys
readline = sys.stdin.readline
class UFP:
def __init__(self, num):
self.par = [-1] * num
self.dist = [0] * num
def find(self, x):
if self.par[x] < 0:
return x
else:
res = 0
xo = x
while self.par[x] >= 0:
... | false | 52.083333 | [
"-def inpl():",
"- return [int(i) for i in input().split()]",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"-def find(x):",
"- if par[x] == x:",
"- return x",
"- else:",
"- par[x], dist[x] = find(par[x]), dist[x] + dist[par[x]]",
"- return par[x]",
"+clas... | false | 0.037852 | 0.041029 | 0.922562 | [
"s111933679",
"s535766825"
] |
u411203878 | p02873 | python | s571761938 | s965874665 | 280 | 109 | 113,140 | 100,808 | Accepted | Accepted | 61.07 | s=list(eval(input()))
right = [0]
left = [0]
count = 0
for i in range(len(s)):
if s[i] == '<':
count += 1
else:
count = 0
right.append(count)
count = 0
for i in range(len(s)-1,-1,-1):
if s[i] == '>':
count += 1
else:
count = 0
left.append(cou... | S = list(eval(input()))
left = [0]*(len(S)+1)
right = [0]*(len(S)+1)
for i in range(len(S)):
if S[i] == '<':
left[i+1] += 1+left[i]
for i in range(len(S)-1,-1,-1):
if S[i] == '>':
right[i] = right[i+1]+1
ans = [0]*(len(S)+1)
for i in range(len(S)+1):
ans[i] = max(left[i]... | 27 | 18 | 419 | 341 | s = list(eval(input()))
right = [0]
left = [0]
count = 0
for i in range(len(s)):
if s[i] == "<":
count += 1
else:
count = 0
right.append(count)
count = 0
for i in range(len(s) - 1, -1, -1):
if s[i] == ">":
count += 1
else:
count = 0
left.append(count)
left.reverse... | S = list(eval(input()))
left = [0] * (len(S) + 1)
right = [0] * (len(S) + 1)
for i in range(len(S)):
if S[i] == "<":
left[i + 1] += 1 + left[i]
for i in range(len(S) - 1, -1, -1):
if S[i] == ">":
right[i] = right[i + 1] + 1
ans = [0] * (len(S) + 1)
for i in range(len(S) + 1):
ans[i] = max(le... | false | 33.333333 | [
"-s = list(eval(input()))",
"-right = [0]",
"-left = [0]",
"-count = 0",
"-for i in range(len(s)):",
"- if s[i] == \"<\":",
"- count += 1",
"- else:",
"- count = 0",
"- right.append(count)",
"-count = 0",
"-for i in range(len(s) - 1, -1, -1):",
"- if s[i] == \">\":"... | false | 0.146478 | 0.044548 | 3.288111 | [
"s571761938",
"s965874665"
] |
u021019433 | p02768 | python | s189281759 | s531889638 | 128 | 118 | 3,060 | 3,060 | Accepted | Accepted | 7.81 | M = 10**9 + 7
n, a, b = list(map(int, input().split()))
r = pow(2, n, M) - 1
f = c = 1
for i in range(b):
f = f * (i + 1) % M
c = c * (n - i) % M
if i + 1 in (a, b):
r -= c * pow(f, M - 2, M)
print((r % M))
| M = 10**9 + 7
n, a, b = list(map(int, input().split()))
r = pow(2, n, M) - 1
f = c = 1
for i in range(b):
f = f * (i + 1) % M
c = c * (n - i) % M
if a != i + 1 != b:
continue
r -= c * pow(f, M - 2, M)
print((r % M))
| 10 | 11 | 218 | 230 | M = 10**9 + 7
n, a, b = list(map(int, input().split()))
r = pow(2, n, M) - 1
f = c = 1
for i in range(b):
f = f * (i + 1) % M
c = c * (n - i) % M
if i + 1 in (a, b):
r -= c * pow(f, M - 2, M)
print((r % M))
| M = 10**9 + 7
n, a, b = list(map(int, input().split()))
r = pow(2, n, M) - 1
f = c = 1
for i in range(b):
f = f * (i + 1) % M
c = c * (n - i) % M
if a != i + 1 != b:
continue
r -= c * pow(f, M - 2, M)
print((r % M))
| false | 9.090909 | [
"- if i + 1 in (a, b):",
"- r -= c * pow(f, M - 2, M)",
"+ if a != i + 1 != b:",
"+ continue",
"+ r -= c * pow(f, M - 2, M)"
] | false | 0.409588 | 0.155624 | 2.631899 | [
"s189281759",
"s531889638"
] |
u174273188 | p02899 | python | s798819935 | s342937854 | 205 | 153 | 27,616 | 24,764 | Accepted | Accepted | 25.37 | def resolve():
n = int(eval(input()))
a = list(map(int, input().split()))
h = []
for i, ai in enumerate(a):
h.append([i, ai])
h.sort(key=lambda x: x[1])
ans = " ".join([str(i + 1) for i, _ in h])
print(ans)
if __name__ == "__main__":
resolve()
| def resolve():
n = int(eval(input()))
a = list(map(int, input().split()))
b = sorted([(i, ai) for i, ai in enumerate(a)], key=lambda x: x[1])
print((" ".join([str(i + 1) for i, _ in b])))
if __name__ == "__main__":
resolve()
| 13 | 9 | 292 | 247 | def resolve():
n = int(eval(input()))
a = list(map(int, input().split()))
h = []
for i, ai in enumerate(a):
h.append([i, ai])
h.sort(key=lambda x: x[1])
ans = " ".join([str(i + 1) for i, _ in h])
print(ans)
if __name__ == "__main__":
resolve()
| def resolve():
n = int(eval(input()))
a = list(map(int, input().split()))
b = sorted([(i, ai) for i, ai in enumerate(a)], key=lambda x: x[1])
print((" ".join([str(i + 1) for i, _ in b])))
if __name__ == "__main__":
resolve()
| false | 30.769231 | [
"- h = []",
"- for i, ai in enumerate(a):",
"- h.append([i, ai])",
"- h.sort(key=lambda x: x[1])",
"- ans = \" \".join([str(i + 1) for i, _ in h])",
"- print(ans)",
"+ b = sorted([(i, ai) for i, ai in enumerate(a)], key=lambda x: x[1])",
"+ print((\" \".join([str(i + 1) for... | false | 0.04233 | 0.07005 | 0.604281 | [
"s798819935",
"s342937854"
] |
u909514237 | p02585 | python | s143407373 | s169494559 | 759 | 687 | 77,084 | 80,984 | Accepted | Accepted | 9.49 | N,K = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = -1*10**9
for si in range(N):
x = si
total = 0
l = 0
s = list()
while(1):
x = p[x]-1
s.append(c[x])
l += 1
total += c[x]
if x == si:
break
t = 0
f... | N,K = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = -1* 10**9
for si in range(N):
s = list()
total = 0
l = 0
x = si
while(1):
x = p[x] - 1
s.append(c[x])
total += c[x]
l += 1
if x == si:
break
t = 0
... | 29 | 29 | 511 | 495 | N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = -1 * 10**9
for si in range(N):
x = si
total = 0
l = 0
s = list()
while 1:
x = p[x] - 1
s.append(c[x])
l += 1
total += c[x]
if x == si:
... | N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = -1 * 10**9
for si in range(N):
s = list()
total = 0
l = 0
x = si
while 1:
x = p[x] - 1
s.append(c[x])
total += c[x]
l += 1
if x == si:
... | false | 0 | [
"- x = si",
"+ s = list()",
"- s = list()",
"+ x = si",
"+ total += c[x]",
"- total += c[x]",
"- for i in range(l):",
"- now = 0",
"- if (i + 1) > K:",
"+ for j in range(l):",
"+ t += s[j]",
"+ now = t",
"+ if j >= K:",
"- ... | false | 0.042828 | 0.044405 | 0.964482 | [
"s143407373",
"s169494559"
] |
u556589653 | p04012 | python | s467722344 | s775859724 | 20 | 17 | 3,316 | 3,064 | Accepted | Accepted | 15 | #解法3
import collections
w = eval(input())
s = list(w)
c = collections.Counter(s)
l = list(c.most_common())
#出現回数のリストがl
flag = 0
for i in range(len(l)):
if l[i][1]%2 == 0:
continue
else:
flag += 1
break
if flag == 0:
print("Yes")
else:
print("No") | #解法2
w = eval(input())
ls = [0]*26
#各文字の出現回数リスト
for i in range(len(w)):
ls[ord(w[i])-97] += 1
#ASCIIコードに対応した配列を+1する
flag = 0
for i in range(len(ls)):
if ls[i]%2 == 0:
continue
else:
flag += 1
break
if flag == 0:
print("Yes")
else:
print("No") | 18 | 18 | 277 | 277 | # 解法3
import collections
w = eval(input())
s = list(w)
c = collections.Counter(s)
l = list(c.most_common())
# 出現回数のリストがl
flag = 0
for i in range(len(l)):
if l[i][1] % 2 == 0:
continue
else:
flag += 1
break
if flag == 0:
print("Yes")
else:
print("No")
| # 解法2
w = eval(input())
ls = [0] * 26
# 各文字の出現回数リスト
for i in range(len(w)):
ls[ord(w[i]) - 97] += 1
# ASCIIコードに対応した配列を+1する
flag = 0
for i in range(len(ls)):
if ls[i] % 2 == 0:
continue
else:
flag += 1
break
if flag == 0:
print("Yes")
else:
print("No")
| false | 0 | [
"-# 解法3",
"-import collections",
"-",
"+# 解法2",
"-s = list(w)",
"-c = collections.Counter(s)",
"-l = list(c.most_common())",
"-# 出現回数のリストがl",
"+ls = [0] * 26",
"+# 各文字の出現回数リスト",
"+for i in range(len(w)):",
"+ ls[ord(w[i]) - 97] += 1",
"+ # ASCIIコードに対応した配列を+1する",
"-for i in range(len(... | false | 0.008949 | 0.047117 | 0.189924 | [
"s467722344",
"s775859724"
] |
u968166680 | p03944 | python | s468945832 | s994361458 | 34 | 28 | 9,256 | 9,112 | Accepted | Accepted | 17.65 | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
W, H, N, *XYA = list(map(int, read().split()))
vec_x = [0] * (W + 1)
vec_y = [0] * (H +... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
W, H, N, *XYA = list(map(int, read().split()))
x_left = 0
x_right = W
y_left = 0
... | 45 | 34 | 948 | 741 | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
W, H, N, *XYA = list(map(int, read().split()))
vec_x = [0] * (W + 1)
vec_y = [0] * (H + 1)
for x, y, ... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
W, H, N, *XYA = list(map(int, read().split()))
x_left = 0
x_right = W
y_left = 0
y_right = H
... | false | 24.444444 | [
"- vec_x = [0] * (W + 1)",
"- vec_y = [0] * (H + 1)",
"+ x_left = 0",
"+ x_right = W",
"+ y_left = 0",
"+ y_right = H",
"- if a == 1:",
"- vec_x[0] += 1",
"- vec_x[x] -= 1",
"- elif a == 2:",
"- vec_x[x] += 1",
"- vec_... | false | 0.037448 | 0.037253 | 1.00524 | [
"s468945832",
"s994361458"
] |
u340781749 | p02996 | python | s649816646 | s818590281 | 265 | 189 | 22,768 | 19,464 | Accepted | Accepted | 28.68 | import sys
import numpy as np
n = int(eval(input()))
tasks = np.fromstring(sys.stdin.read(), sep=' ').reshape((n, 2))
a = tasks[:, 0]
b = tasks[:, 1]
i = b.argsort()
print(('Yes' if (np.add.accumulate(a[i]) <= b[i]).all() else 'No'))
| import sys
import numpy as np
n = int(eval(input()))
a, b = np.fromstring(sys.stdin.read(), dtype=np.uint32, sep=' ').reshape((n, 2)).T
i = b.argsort()
print(('Yes' if (np.add.accumulate(a[i]) <= b[i]).all() else 'No'))
| 9 | 7 | 235 | 219 | import sys
import numpy as np
n = int(eval(input()))
tasks = np.fromstring(sys.stdin.read(), sep=" ").reshape((n, 2))
a = tasks[:, 0]
b = tasks[:, 1]
i = b.argsort()
print(("Yes" if (np.add.accumulate(a[i]) <= b[i]).all() else "No"))
| import sys
import numpy as np
n = int(eval(input()))
a, b = np.fromstring(sys.stdin.read(), dtype=np.uint32, sep=" ").reshape((n, 2)).T
i = b.argsort()
print(("Yes" if (np.add.accumulate(a[i]) <= b[i]).all() else "No"))
| false | 22.222222 | [
"-tasks = np.fromstring(sys.stdin.read(), sep=\" \").reshape((n, 2))",
"-a = tasks[:, 0]",
"-b = tasks[:, 1]",
"+a, b = np.fromstring(sys.stdin.read(), dtype=np.uint32, sep=\" \").reshape((n, 2)).T"
] | false | 0.27951 | 0.229924 | 1.215663 | [
"s649816646",
"s818590281"
] |
u603745966 | p03699 | python | s409501632 | s209637950 | 386 | 25 | 11,488 | 3,572 | Accepted | Accepted | 93.52 | from functools import reduce
import math
def main():
# 文字列の2進数を数値にする
# '101' → '5'
# 文字列の頭に'0b'をつけてint()にわたす
# binary = int('0b'+'101',0)
# 2進数で立っているbitを数える
# 101(0x5) → 2
# cnt_bit = bin(5).count('1')
# N! を求める
# f = math.factorial(N)
# 切り捨て
# 4 ... | from functools import reduce
import math
def main():
# 文字列の2進数を数値にする
# '101' → '5'
# 文字列の頭に'0b'をつけてint()にわたす
# binary = int('0b'+'101',0)
# 2進数で立っているbitを数える
# 101(0x5) → 2
# cnt_bit = bin(5).count('1')
# N! を求める
# f = math.factorial(N)
# 切り捨て
# 4 ... | 66 | 76 | 1,526 | 1,726 | from functools import reduce
import math
def main():
# 文字列の2進数を数値にする
# '101' → '5'
# 文字列の頭に'0b'をつけてint()にわたす
# binary = int('0b'+'101',0)
# 2進数で立っているbitを数える
# 101(0x5) → 2
# cnt_bit = bin(5).count('1')
# N! を求める
# f = math.factorial(N)
# 切り捨て
# 4 // 3
# 切り上げ
# -(-4 ... | from functools import reduce
import math
def main():
# 文字列の2進数を数値にする
# '101' → '5'
# 文字列の頭に'0b'をつけてint()にわたす
# binary = int('0b'+'101',0)
# 2進数で立っているbitを数える
# 101(0x5) → 2
# cnt_bit = bin(5).count('1')
# N! を求める
# f = math.factorial(N)
# 切り捨て
# 4 // 3
# 切り上げ
# -(-4 ... | false | 13.157895 | [
"- dp = []",
"+ s.sort()",
"+ ans = 0",
"+ if sum(s) % 10 != 0:",
"+ ans = sum(s)",
"+ print(ans)",
"+ exit()",
"- dp.append([-1] * (100 * 100))",
"- dp[0][s[0]] = 1",
"- for i in range(1, N):",
"- for j in range(100 * 100):",
"- ... | false | 0.176854 | 0.036871 | 4.796607 | [
"s409501632",
"s209637950"
] |
u971811058 | p03730 | python | s724568324 | s885919710 | 34 | 30 | 9,448 | 9,408 | Accepted | Accepted | 11.76 | # Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, ... | # Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, ... | 20 | 20 | 641 | 640 | # Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import (
accumulate,
product,
permu... | # Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import (
accumulate,
product,
permu... | false | 0 | [
"-while i < b + 1:",
"+while i <= b:"
] | false | 0.115056 | 0.035213 | 3.267394 | [
"s724568324",
"s885919710"
] |
u373047809 | p03476 | python | s414513087 | s831468484 | 912 | 480 | 8,724 | 14,604 | Accepted | Accepted | 47.37 | #!/usr/bin/env python3
from itertools import accumulate
def erat(m):
p = [1] * m
p[0] = p[1] = 0
for x in range(2, int((~-m)**.5) + 1):
if p[x]:
for y in range(x*x, m, x):
p[y] = 0
return p
INF = 10**5 + 1
p = erat(INF)
q = [0] * INF
for n in range(INF)... | def erat(M):
p = [1] * M
p[0] = p[1] = 0
for x in range(2, int((M - 1)**.5) + 1):
if p[x]:
for y in range(x*x, M, x):
p[y] = 0
return p
INF = 10**5 + 1
p = erat(INF)
q = [0] * INF
from itertools import*
for i in range(INF):
q[i] = i%2 * p[i] * p[-~i//... | 20 | 18 | 482 | 447 | #!/usr/bin/env python3
from itertools import accumulate
def erat(m):
p = [1] * m
p[0] = p[1] = 0
for x in range(2, int((~-m) ** 0.5) + 1):
if p[x]:
for y in range(x * x, m, x):
p[y] = 0
return p
INF = 10**5 + 1
p = erat(INF)
q = [0] * INF
for n in range(INF):
... | def erat(M):
p = [1] * M
p[0] = p[1] = 0
for x in range(2, int((M - 1) ** 0.5) + 1):
if p[x]:
for y in range(x * x, M, x):
p[y] = 0
return p
INF = 10**5 + 1
p = erat(INF)
q = [0] * INF
from itertools import *
for i in range(INF):
q[i] = i % 2 * p[i] * p[-~i // ... | false | 10 | [
"-#!/usr/bin/env python3",
"-from itertools import accumulate",
"-",
"-",
"-def erat(m):",
"- p = [1] * m",
"+def erat(M):",
"+ p = [1] * M",
"- for x in range(2, int((~-m) ** 0.5) + 1):",
"+ for x in range(2, int((M - 1) ** 0.5) + 1):",
"- for y in range(x * x, m, x):",
... | false | 0.116719 | 0.117907 | 0.989925 | [
"s414513087",
"s831468484"
] |
u723711163 | p02726 | python | s669337503 | s689643673 | 1,856 | 321 | 3,572 | 49,756 | Accepted | Accepted | 82.7 | N, X, Y = list(map(int, input().split()))
result = [0] * N
for i in range(1, N):
for j in range(i+1, N+1):
step = min( j-i, abs(i-X)+1+abs(j-Y), abs(i-Y)+1+abs(j-X))
result[step] += 1
for e in result[1:]: print(e) | from collections import defaultdict
N,X,Y = list(map(int,input().split()))
counter = defaultdict(int)
for i in range(1,N):
for j in range(i+1, N+1):
step = min(j-i, abs(X-i)+1+abs(Y-j))
counter[step] += 1
for i in range(1, N):
print((counter[i])) | 10 | 11 | 235 | 262 | N, X, Y = list(map(int, input().split()))
result = [0] * N
for i in range(1, N):
for j in range(i + 1, N + 1):
step = min(j - i, abs(i - X) + 1 + abs(j - Y), abs(i - Y) + 1 + abs(j - X))
result[step] += 1
for e in result[1:]:
print(e)
| from collections import defaultdict
N, X, Y = list(map(int, input().split()))
counter = defaultdict(int)
for i in range(1, N):
for j in range(i + 1, N + 1):
step = min(j - i, abs(X - i) + 1 + abs(Y - j))
counter[step] += 1
for i in range(1, N):
print((counter[i]))
| false | 9.090909 | [
"+from collections import defaultdict",
"+",
"-result = [0] * N",
"+counter = defaultdict(int)",
"- step = min(j - i, abs(i - X) + 1 + abs(j - Y), abs(i - Y) + 1 + abs(j - X))",
"- result[step] += 1",
"-for e in result[1:]:",
"- print(e)",
"+ step = min(j - i, abs(X - i) + 1 ... | false | 0.079728 | 0.109929 | 0.725269 | [
"s669337503",
"s689643673"
] |
u792720861 | p02993 | python | s447883164 | s212804528 | 30 | 25 | 9,008 | 8,956 | Accepted | Accepted | 16.67 | s = eval(input())
print(('Bad' if s[0]==s[1] or s[1]==s[2] or s[2]==s[3] else 'Good'))
| n = eval(input())
print(('Bad' if n[0]==n[1] or n[1]==n[2] or n[2]==n[3] else 'Good'))
| 2 | 2 | 80 | 80 | s = eval(input())
print(("Bad" if s[0] == s[1] or s[1] == s[2] or s[2] == s[3] else "Good"))
| n = eval(input())
print(("Bad" if n[0] == n[1] or n[1] == n[2] or n[2] == n[3] else "Good"))
| false | 0 | [
"-s = eval(input())",
"-print((\"Bad\" if s[0] == s[1] or s[1] == s[2] or s[2] == s[3] else \"Good\"))",
"+n = eval(input())",
"+print((\"Bad\" if n[0] == n[1] or n[1] == n[2] or n[2] == n[3] else \"Good\"))"
] | false | 0.043742 | 0.042261 | 1.035063 | [
"s447883164",
"s212804528"
] |
u241159583 | p04020 | python | s837012442 | s576041747 | 192 | 175 | 12,936 | 13,096 | Accepted | Accepted | 8.85 | n = int(eval(input()))
A = list(int(eval(input())) for _ in range(n))
ans = 0
for i in range(n):
tmp = A[i]
ans += (tmp//2)
if i < n-1 and tmp %2 and A[i+1] > 0:
ans += 1
A[i+1] -= 1
print(ans) | n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
ans = 0
for i in range(n-1):
x,y = A[i], A[i+1]
ans += x//2
if x%2!=0 and y > 0:
ans += 1
A[i+1] -= 1
ans += A[-1]//2
print(ans) | 10 | 12 | 218 | 222 | n = int(eval(input()))
A = list(int(eval(input())) for _ in range(n))
ans = 0
for i in range(n):
tmp = A[i]
ans += tmp // 2
if i < n - 1 and tmp % 2 and A[i + 1] > 0:
ans += 1
A[i + 1] -= 1
print(ans)
| n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
ans = 0
for i in range(n - 1):
x, y = A[i], A[i + 1]
ans += x // 2
if x % 2 != 0 and y > 0:
ans += 1
A[i + 1] -= 1
ans += A[-1] // 2
print(ans)
| false | 16.666667 | [
"-A = list(int(eval(input())) for _ in range(n))",
"+A = [int(eval(input())) for _ in range(n)]",
"-for i in range(n):",
"- tmp = A[i]",
"- ans += tmp // 2",
"- if i < n - 1 and tmp % 2 and A[i + 1] > 0:",
"+for i in range(n - 1):",
"+ x, y = A[i], A[i + 1]",
"+ ans += x // 2",
"+ ... | false | 0.036908 | 0.037373 | 0.987564 | [
"s837012442",
"s576041747"
] |
u519968172 | p03252 | python | s053432213 | s690339705 | 56 | 49 | 9,624 | 9,568 | Accepted | Accepted | 12.5 | from collections import Counter
s=eval(input())
t=eval(input())
sc=Counter(s)
tc=Counter(t)
if len(sc)!=len(tc):
print("No")
else:
for s1,t1 in zip(sorted(list(sc.items()),key=lambda i: i[1]),sorted(list(tc.items()),key=lambda i: i[1])):
if s1[1]!=t1[1]:
print("No")
break
else:
... | from collections import Counter
sc=Counter(eval(input()))
tc=Counter(eval(input()))
for s,t in zip(sorted(sc.values()),sorted(tc.values())):
if s!=t:
print("No")
break
else:
print("Yes") | 15 | 11 | 308 | 206 | from collections import Counter
s = eval(input())
t = eval(input())
sc = Counter(s)
tc = Counter(t)
if len(sc) != len(tc):
print("No")
else:
for s1, t1 in zip(
sorted(list(sc.items()), key=lambda i: i[1]),
sorted(list(tc.items()), key=lambda i: i[1]),
):
if s1[1] != t1[1]:
... | from collections import Counter
sc = Counter(eval(input()))
tc = Counter(eval(input()))
for s, t in zip(sorted(sc.values()), sorted(tc.values())):
if s != t:
print("No")
break
else:
print("Yes")
| false | 26.666667 | [
"-s = eval(input())",
"-t = eval(input())",
"-sc = Counter(s)",
"-tc = Counter(t)",
"-if len(sc) != len(tc):",
"- print(\"No\")",
"+sc = Counter(eval(input()))",
"+tc = Counter(eval(input()))",
"+for s, t in zip(sorted(sc.values()), sorted(tc.values())):",
"+ if s != t:",
"+ print(\... | false | 0.038521 | 0.037101 | 1.038267 | [
"s053432213",
"s690339705"
] |
u346395915 | p03160 | python | s492759374 | s186789969 | 144 | 123 | 13,976 | 20,524 | Accepted | Accepted | 14.58 | n = int(eval(input()))
li = list(map(int,input().split()))
dp = [10**8] * n
for i in range(n):
if i == 0:
dp[i] = 0
elif i == 1:
dp[i] = abs(li[i] - li[i-1])
else:
dp[i] = min(abs(li[i] - li[i-1]) + dp[i-1], abs(li[i] - li[i-2]) + dp[i-2])
print((dp[-1]))
| n = int(eval(input()))
h_li = list(map(int, input().split()))
dp = [10**18] * n
dp[0] = 0
for i in range(1,n):
if i == 1:
dp[i] = abs(h_li[i] - h_li[0])
else:
dp[i] = min(abs(h_li[i] - h_li[i-1]) + dp[i-1], abs(h_li[i] - h_li[i-2]) + dp[i-2])
print((dp[-1])) | 14 | 12 | 300 | 287 | n = int(eval(input()))
li = list(map(int, input().split()))
dp = [10**8] * n
for i in range(n):
if i == 0:
dp[i] = 0
elif i == 1:
dp[i] = abs(li[i] - li[i - 1])
else:
dp[i] = min(
abs(li[i] - li[i - 1]) + dp[i - 1], abs(li[i] - li[i - 2]) + dp[i - 2]
)
print((dp[-... | n = int(eval(input()))
h_li = list(map(int, input().split()))
dp = [10**18] * n
dp[0] = 0
for i in range(1, n):
if i == 1:
dp[i] = abs(h_li[i] - h_li[0])
else:
dp[i] = min(
abs(h_li[i] - h_li[i - 1]) + dp[i - 1],
abs(h_li[i] - h_li[i - 2]) + dp[i - 2],
)
print((dp... | false | 14.285714 | [
"-li = list(map(int, input().split()))",
"-dp = [10**8] * n",
"-for i in range(n):",
"- if i == 0:",
"- dp[i] = 0",
"- elif i == 1:",
"- dp[i] = abs(li[i] - li[i - 1])",
"+h_li = list(map(int, input().split()))",
"+dp = [10**18] * n",
"+dp[0] = 0",
"+for i in range(1, n):",
... | false | 0.037345 | 0.037432 | 0.997699 | [
"s492759374",
"s186789969"
] |
u200887663 | p02708 | python | s488307581 | s069834553 | 138 | 80 | 9,180 | 9,164 | Accepted | Accepted | 42.03 | #n=int(input())
n,k=list(map(int,input().split()))
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
mod=10**9+7
ans=0
for kval in range(k,n+2):
mx=kval*(2*n-kval+1)//2
mn=kval*(kval-1)//2
add=mx-mn+1
ans=(ans+add) % mod
print(ans)
| #l=int(input())
n,k=list(map(int,input().split()))
#pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
mod=10**9+7
total=0
for m in range(k,n+2):
add=m*(n-m+1)+1
total=(total+add)%mod
print(total)
| 15 | 15 | 297 | 255 | # n=int(input())
n, k = list(map(int, input().split()))
# l=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
mod = 10**9 + 7
ans = 0
for kval in range(k, n + 2):
mx = kval * (2 * n - kval + 1) // 2
mn = kval * (kval - 1) // 2
add = mx - mn + 1
ans = (ans + add) % mod... | # l=int(input())
n, k = list(map(int, input().split()))
# pl=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
mod = 10**9 + 7
total = 0
for m in range(k, n + 2):
add = m * (n - m + 1) + 1
total = (total + add) % mod
print(total)
| false | 0 | [
"-# n=int(input())",
"+# l=int(input())",
"-# l=list(map(int,input().split()))",
"+# pl=list(map(int,input().split()))",
"-ans = 0",
"-for kval in range(k, n + 2):",
"- mx = kval * (2 * n - kval + 1) // 2",
"- mn = kval * (kval - 1) // 2",
"- add = mx - mn + 1",
"- ans = (ans + add) % ... | false | 0.053509 | 0.115605 | 0.46286 | [
"s488307581",
"s069834553"
] |
u998741086 | p02802 | python | s348703535 | s319330650 | 338 | 309 | 14,924 | 15,320 | Accepted | Accepted | 8.58 | #!/usr/bin/env python3
n, m = list(map(int, input().split()))
p = []
s = []
for i in range(m):
t1, t2 = input().split()
p.append(int(t1)-1)
s.append(t2)
# 問題iがACしているかどうかを覚えておく配列
ac = [0 for _ in range(n)]
# 問題iがWAしている回数
pena = [0 for _ in range(n)]
# ac[], pena[]を作る。
for i in range(m):
... | #!/usr/bin/env python3
n, m = list(map(int, input().split()))
p = []
s = []
for i in range(m):
t1, t2 = input().split()
p.append(int(t1)-1)
s.append(t2)
# 問題iがACしているかどうかを覚えておく配列
ac = [0 for _ in range(n)]
# 問題iがWAしている回数
pena = [0 for _ in range(n)]
# ac[], pena[]を作る。
for i in range(m):
... | 32 | 31 | 568 | 560 | #!/usr/bin/env python3
n, m = list(map(int, input().split()))
p = []
s = []
for i in range(m):
t1, t2 = input().split()
p.append(int(t1) - 1)
s.append(t2)
# 問題iがACしているかどうかを覚えておく配列
ac = [0 for _ in range(n)]
# 問題iがWAしている回数
pena = [0 for _ in range(n)]
# ac[], pena[]を作る。
for i in range(m):
if ac[p[i]] == ... | #!/usr/bin/env python3
n, m = list(map(int, input().split()))
p = []
s = []
for i in range(m):
t1, t2 = input().split()
p.append(int(t1) - 1)
s.append(t2)
# 問題iがACしているかどうかを覚えておく配列
ac = [0 for _ in range(n)]
# 問題iがWAしている回数
pena = [0 for _ in range(n)]
# ac[], pena[]を作る。
for i in range(m):
if ac[p[i]] == ... | false | 3.125 | [
"- if ac[p[i]] == 1:",
"- continue # XXX",
"- if s[i] == \"AC\":",
"- ac[p[i]] = 1",
"- else:",
"- pena[p[i]] += 1",
"+ if ac[p[i]] == 0:",
"+ if s[i] == \"AC\":",
"+ ac[p[i]] = 1",
"+ else:",
"+ pena[p[i]] += 1"
] | false | 0.044334 | 0.056431 | 0.785627 | [
"s348703535",
"s319330650"
] |
u689322583 | p03730 | python | s649766629 | s347445024 | 23 | 18 | 3,828 | 2,940 | Accepted | Accepted | 21.74 | #coding: utf-8
A, B ,C = map(int, input().split())
count = 0
for i in range(A*B):
if(A*i % B == C):
count = 1
else:
print('',end='')
if(count == 1):
print('YES')
else:
print('NO')
| #coding: utf-8
A, B ,C = list(map(int, input().split()))
count = 0
for i in range(A*B):
if(A*i % B == C):
print('YES')
break
else:
print('NO') | 15 | 11 | 228 | 172 | # coding: utf-8
A, B, C = map(int, input().split())
count = 0
for i in range(A * B):
if A * i % B == C:
count = 1
else:
print("", end="")
if count == 1:
print("YES")
else:
print("NO")
| # coding: utf-8
A, B, C = list(map(int, input().split()))
count = 0
for i in range(A * B):
if A * i % B == C:
print("YES")
break
else:
print("NO")
| false | 26.666667 | [
"-A, B, C = map(int, input().split())",
"+A, B, C = list(map(int, input().split()))",
"- count = 1",
"- else:",
"- print(\"\", end=\"\")",
"-if count == 1:",
"- print(\"YES\")",
"+ print(\"YES\")",
"+ break"
] | false | 0.033392 | 0.04213 | 0.792589 | [
"s649766629",
"s347445024"
] |
u146816547 | p00001 | python | s857003841 | s732542541 | 20 | 10 | 4,196 | 6,344 | Accepted | Accepted | 50 | s = []
for i in range(10):
s.append(int(input()))
s.sort()
s.reverse()
for i in range(3):
print(s[i]) | s = []
for i in range(10):
s.append(int(input()))
s.sort()
for i in range(3):
print(s[9-i]) | 7 | 9 | 114 | 109 | s = []
for i in range(10):
s.append(int(input()))
s.sort()
s.reverse()
for i in range(3):
print(s[i])
| s = []
for i in range(10):
s.append(int(input()))
s.sort()
for i in range(3):
print(s[9 - i])
| false | 22.222222 | [
"-s.reverse()",
"- print(s[i])",
"+ print(s[9 - i])"
] | false | 0.084845 | 0.040279 | 2.10641 | [
"s857003841",
"s732542541"
] |
u296150111 | p03450 | python | s145825235 | s305988116 | 1,435 | 1,206 | 66,824 | 66,316 | Accepted | Accepted | 15.96 | inf=10**10
n,m=list(map(int,input().split()))
x=[inf]*n
con=[[] for _ in range(n)]
for i in range(m):
l,r,d=list(map(int,input().split()))
con[l-1].append((r-1,d))
con[r-1].append((l-1,-d))
from collections import deque
for i in range(n):
if x[i]==inf:
x[i]=0
q=deque([i])
while q:
e=q.pop()
... | inf=10**10
n,m=list(map(int,input().split()))
x=[inf]*n
con=[[] for _ in range(n)]
for i in range(m):
l,r,d=list(map(int,input().split()))
con[l-1].append((r-1,d))
con[r-1].append((l-1,-d))
from collections import deque
for i in range(n):
if x[i]==inf:
x[i]=0
q=deque([i])
while q:
e=q.pop()
... | 25 | 23 | 486 | 453 | inf = 10**10
n, m = list(map(int, input().split()))
x = [inf] * n
con = [[] for _ in range(n)]
for i in range(m):
l, r, d = list(map(int, input().split()))
con[l - 1].append((r - 1, d))
con[r - 1].append((l - 1, -d))
from collections import deque
for i in range(n):
if x[i] == inf:
x[i] = 0
... | inf = 10**10
n, m = list(map(int, input().split()))
x = [inf] * n
con = [[] for _ in range(n)]
for i in range(m):
l, r, d = list(map(int, input().split()))
con[l - 1].append((r - 1, d))
con[r - 1].append((l - 1, -d))
from collections import deque
for i in range(n):
if x[i] == inf:
x[i] = 0
... | false | 8 | [
"-for i in range(n):",
"- for j, k in con[i]:",
"- if x[i] + k != x[j]:",
"- print(\"No\")",
"- exit()",
"+ elif x[j] != x[e] + k:",
"+ print(\"No\")",
"+ exit()"
] | false | 0.039441 | 0.031485 | 1.252687 | [
"s145825235",
"s305988116"
] |
u829249049 | p03013 | python | s815196558 | s134474148 | 529 | 488 | 460,020 | 460,020 | Accepted | Accepted | 7.75 | import sys
N,M=list(map(int,input().split()))
dp=[1]*N
listA=[]
for i in range(M):
a=int(eval(input()))
listA+=[a]
dp[a-1]=0
for i in range(1,M):
if listA[i]==listA[i-1]:
print((0))
sys.exit()
setA=set(listA)
if (1 not in setA) and (2 not in setA) and N!=1:
dp[1]=2
for i in range(2,... | N,M=list(map(int,input().split()))
dp=[1]*N
listA=[]
for i in range(M):
a=int(eval(input()))
listA+=[a]
dp[a-1]=0
setA=set(listA)
if (1 not in setA) and (2 not in setA) and N!=1:
dp[1]=2
for i in range(2,N):
if i+1 not in setA:
dp[i]=dp[i-1]+dp[i-2]
ans=dp[-1]%(10**9+7)
print(ans) | 20 | 15 | 393 | 301 | import sys
N, M = list(map(int, input().split()))
dp = [1] * N
listA = []
for i in range(M):
a = int(eval(input()))
listA += [a]
dp[a - 1] = 0
for i in range(1, M):
if listA[i] == listA[i - 1]:
print((0))
sys.exit()
setA = set(listA)
if (1 not in setA) and (2 not in setA) and N != 1:
... | N, M = list(map(int, input().split()))
dp = [1] * N
listA = []
for i in range(M):
a = int(eval(input()))
listA += [a]
dp[a - 1] = 0
setA = set(listA)
if (1 not in setA) and (2 not in setA) and N != 1:
dp[1] = 2
for i in range(2, N):
if i + 1 not in setA:
dp[i] = dp[i - 1] + dp[i - 2]
ans = d... | false | 25 | [
"-import sys",
"-",
"-for i in range(1, M):",
"- if listA[i] == listA[i - 1]:",
"- print((0))",
"- sys.exit()"
] | false | 0.097788 | 0.04895 | 1.997721 | [
"s815196558",
"s134474148"
] |
u017415492 | p02947 | python | s464348692 | s844496955 | 509 | 391 | 11,372 | 17,932 | Accepted | Accepted | 23.18 | n=int(eval(input()))
s=[]
ans=0
count=1
def comb(n,k):
for i in range(k-1):
n*=n-i-1
k*=k-i-1
return n//k
for i in range(n):
a=list(eval(input()))
a.sort()
" ".join(a)
s.append(" ".join(a))
s.sort()
for i in range(n-1):
if s[i]==s[i+1]:
count+=1
else:
ans+=(comb(coun... | n=int(eval(input()))
ans=dict()
for i in range(n):
d=list(eval(input()))
d.sort()
s="".join(d)
if not(s in ans):
ans[s]=1
else:
ans[s]+=1
anss=0
for i in ans:
anss+=((ans[i]*(ans[i]-1))//2)
print(anss) | 25 | 14 | 375 | 222 | n = int(eval(input()))
s = []
ans = 0
count = 1
def comb(n, k):
for i in range(k - 1):
n *= n - i - 1
k *= k - i - 1
return n // k
for i in range(n):
a = list(eval(input()))
a.sort()
" ".join(a)
s.append(" ".join(a))
s.sort()
for i in range(n - 1):
if s[i] == s[i + 1]:
... | n = int(eval(input()))
ans = dict()
for i in range(n):
d = list(eval(input()))
d.sort()
s = "".join(d)
if not (s in ans):
ans[s] = 1
else:
ans[s] += 1
anss = 0
for i in ans:
anss += (ans[i] * (ans[i] - 1)) // 2
print(anss)
| false | 44 | [
"-s = []",
"-ans = 0",
"-count = 1",
"-",
"-",
"-def comb(n, k):",
"- for i in range(k - 1):",
"- n *= n - i - 1",
"- k *= k - i - 1",
"- return n // k",
"-",
"-",
"+ans = dict()",
"- a = list(eval(input()))",
"- a.sort()",
"- \" \".join(a)",
"- s.appe... | false | 0.070022 | 0.096715 | 0.724011 | [
"s464348692",
"s844496955"
] |
u057109575 | p02888 | python | s511592943 | s794131391 | 622 | 355 | 74,428 | 68,584 | Accepted | Accepted | 42.93 | from bisect import bisect_left, bisect_right
N, *X = list(map(int, open(0).read().split()))
X.sort()
ans = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
k1 = bisect_right(X, X[j] - X[i])
k2 = bisect_left(X, X[i] + X[j])
k1 = max(k1, j + 1)
ans += max(0, k2 - k1)... |
from bisect import bisect_left
N = int(eval(input()))
X = list(map(int, input().split()))
X.sort()
ans = 0
for i in range(N):
for j in range(i + 1, N):
k = bisect_left(X, X[i] + X[j])
ans += k - j - 1
print(ans)
| 14 | 14 | 329 | 243 | from bisect import bisect_left, bisect_right
N, *X = list(map(int, open(0).read().split()))
X.sort()
ans = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
k1 = bisect_right(X, X[j] - X[i])
k2 = bisect_left(X, X[i] + X[j])
k1 = max(k1, j + 1)
ans += max(0, k2 - k1)
print(ans)
| from bisect import bisect_left
N = int(eval(input()))
X = list(map(int, input().split()))
X.sort()
ans = 0
for i in range(N):
for j in range(i + 1, N):
k = bisect_left(X, X[i] + X[j])
ans += k - j - 1
print(ans)
| false | 0 | [
"-from bisect import bisect_left, bisect_right",
"+from bisect import bisect_left",
"-N, *X = list(map(int, open(0).read().split()))",
"+N = int(eval(input()))",
"+X = list(map(int, input().split()))",
"-for i in range(N - 2):",
"- for j in range(i + 1, N - 1):",
"- k1 = bisect_right(X, X[j]... | false | 0.074149 | 0.038383 | 1.931815 | [
"s511592943",
"s794131391"
] |
u211109468 | p03024 | python | s980585659 | s530580426 | 70 | 61 | 61,748 | 61,668 | Accepted | Accepted | 12.86 | S = eval(input())
print(('YES' if 7-len(S)>=-sum([c=='o' for c in S]) else 'NO')) | print(('YES' if sum([c=='x' for c in eval(input())])<8 else 'NO')) | 2 | 1 | 74 | 58 | S = eval(input())
print(("YES" if 7 - len(S) >= -sum([c == "o" for c in S]) else "NO"))
| print(("YES" if sum([c == "x" for c in eval(input())]) < 8 else "NO"))
| false | 50 | [
"-S = eval(input())",
"-print((\"YES\" if 7 - len(S) >= -sum([c == \"o\" for c in S]) else \"NO\"))",
"+print((\"YES\" if sum([c == \"x\" for c in eval(input())]) < 8 else \"NO\"))"
] | false | 0.045531 | 0.125769 | 0.362023 | [
"s980585659",
"s530580426"
] |
u133936772 | p03062 | python | s061491587 | s016823258 | 95 | 60 | 15,020 | 14,224 | Accepted | Accepted | 36.84 | n = int(eval(input()))
l = list(map(int,input().split()))
m = sorted(list(map(abs,l)))
print((sum(m) - sum(i<0 for i in l)%2*m[0]*2)) | n=int(eval(input()))
l=list(map(int,input().split()))
m=list(map(abs,l))
print((sum(m)-sum(i<0 for i in l)%2*min(m)*2)) | 4 | 4 | 128 | 114 | n = int(eval(input()))
l = list(map(int, input().split()))
m = sorted(list(map(abs, l)))
print((sum(m) - sum(i < 0 for i in l) % 2 * m[0] * 2))
| n = int(eval(input()))
l = list(map(int, input().split()))
m = list(map(abs, l))
print((sum(m) - sum(i < 0 for i in l) % 2 * min(m) * 2))
| false | 0 | [
"-m = sorted(list(map(abs, l)))",
"-print((sum(m) - sum(i < 0 for i in l) % 2 * m[0] * 2))",
"+m = list(map(abs, l))",
"+print((sum(m) - sum(i < 0 for i in l) % 2 * min(m) * 2))"
] | false | 0.036632 | 0.042733 | 0.857232 | [
"s061491587",
"s016823258"
] |
u728992264 | p00935 | python | s365872661 | s942407924 | 30 | 20 | 7,604 | 7,604 | Accepted | Accepted | 33.33 | n=int(eval(input()))
d=''.join([''.join(input().split())for i in range(n//19+(n%19!=0))])
i=0
while True:
if d.find(str(i))==-1:
print(i)
exit()
i+=1 | n=int(eval(input()))
d=''.join(''.join(input().split())for i in[0]*(n//19+(n%19!=0)))
i=0
while 1:
if d.find(str(i))==-1:
print(i)
exit()
i+=1 | 8 | 8 | 157 | 150 | n = int(eval(input()))
d = "".join(["".join(input().split()) for i in range(n // 19 + (n % 19 != 0))])
i = 0
while True:
if d.find(str(i)) == -1:
print(i)
exit()
i += 1
| n = int(eval(input()))
d = "".join("".join(input().split()) for i in [0] * (n // 19 + (n % 19 != 0)))
i = 0
while 1:
if d.find(str(i)) == -1:
print(i)
exit()
i += 1
| false | 0 | [
"-d = \"\".join([\"\".join(input().split()) for i in range(n // 19 + (n % 19 != 0))])",
"+d = \"\".join(\"\".join(input().split()) for i in [0] * (n // 19 + (n % 19 != 0)))",
"-while True:",
"+while 1:"
] | false | 0.03876 | 0.0374 | 1.036373 | [
"s365872661",
"s942407924"
] |
u561231954 | p02727 | python | s988671709 | s696822564 | 315 | 251 | 22,720 | 22,720 | Accepted | Accepted | 20.32 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
INF = 10 ** 10
MOD = 10 ** 9 + 7
from heapq import heapify,heappop,heappush
input = sys.stdin.readline
def main():
x,y,a,b,c = list(map(int,input().split()))
R = list(map(int,input().split()))
G = list(map(int,input().split()... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
INF = 10 ** 10
MOD = 10 ** 9 + 7
from heapq import heapify,heappop,heappush
input = sys.stdin.readline
def main():
x,y,a,b,c = list(map(int,input().split()))
R = list(map(int,input().split()))
G = list(map(int,input().split()... | 71 | 22 | 1,646 | 587 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
INF = 10**10
MOD = 10**9 + 7
from heapq import heapify, heappop, heappush
input = sys.stdin.readline
def main():
x, y, a, b, c = list(map(int, input().split()))
R = list(map(int, input().split()))
G = list(map(int, input().split()))
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
INF = 10**10
MOD = 10**9 + 7
from heapq import heapify, heappop, heappush
input = sys.stdin.readline
def main():
x, y, a, b, c = list(map(int, input().split()))
R = list(map(int, input().split()))
G = list(map(int, input().split()))
... | false | 69.014085 | [
"- i, j, k = 0, 0, 0",
"- ans = 0",
"- while i < x and j < y and k < c and k + i + j < x + y:",
"- tmp = max(R[i], G[j], M[k])",
"- ans += tmp",
"- if tmp == R[i]:",
"- i += 1",
"- elif tmp == G[j]:",
"- j += 1",
"- else:",
"- ... | false | 0.040741 | 0.110415 | 0.36898 | [
"s988671709",
"s696822564"
] |
u029000441 | p02850 | python | s584200081 | s037775300 | 904 | 655 | 74,912 | 74,684 | Accepted | Accepted | 27.54 | #キューとdictionaryを利用したBFS
from collections import deque
n = int(eval(input()))
ab = [list(map(int,input().split())) for i in range(n-1)]
ver = [[] for i in range(n)]
for i in range(n-1):
a,b = ab[i][0],ab[i][1]
ver[a-1].append(b-1)
ver[b-1].append(a-1)
#print(ver)
color = [dict() for i i... | #d3と同一解法
n=int(eval(input()))
import sys
#再帰関数の再帰回数を変更
sys.setrecursionlimit(10**6)
s=[[] for _ in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
s[a-1].append((b-1,i))
s[b-1].append((a-1,i))
l=[0]*(n-1)
def dfs(node,pre_col,par):
col=1
for nei,i in s[node]:
... | 49 | 28 | 884 | 512 | # キューとdictionaryを利用したBFS
from collections import deque
n = int(eval(input()))
ab = [list(map(int, input().split())) for i in range(n - 1)]
ver = [[] for i in range(n)]
for i in range(n - 1):
a, b = ab[i][0], ab[i][1]
ver[a - 1].append(b - 1)
ver[b - 1].append(a - 1)
# print(ver)
color = [dict() for i in ra... | # d3と同一解法
n = int(eval(input()))
import sys
# 再帰関数の再帰回数を変更
sys.setrecursionlimit(10**6)
s = [[] for _ in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
s[a - 1].append((b - 1, i))
s[b - 1].append((a - 1, i))
l = [0] * (n - 1)
def dfs(node, pre_col, par):
col = 1
for nei, ... | false | 42.857143 | [
"-# キューとdictionaryを利用したBFS",
"-from collections import deque",
"+# d3と同一解法",
"+n = int(eval(input()))",
"+import sys",
"-n = int(eval(input()))",
"-ab = [list(map(int, input().split())) for i in range(n - 1)]",
"-ver = [[] for i in range(n)]",
"+# 再帰関数の再帰回数を変更",
"+sys.setrecursionlimit(10**6)",
... | false | 0.103245 | 0.037946 | 2.720871 | [
"s584200081",
"s037775300"
] |
u638282348 | p03732 | python | s386006971 | s366654815 | 143 | 84 | 11,960 | 3,632 | Accepted | Accepted | 41.26 | N, W = list(map(int, input().split()))
data = tuple(tuple(map(int, input().split())) for _ in range(N))
table = [dict() for _ in range(N + 1)]
table[0][0] = 0
for n in range(N):
weight, value = data[n]
for w, now in list(table[n].items()):
table[n + 1][w] = max(table[n + 1].get(w, 0), now)
... | N, W = list(map(int, input().split()))
data = tuple(tuple(map(int, input().split())) for _ in range(N))
d = {0: 0}
for n in range(N):
weight, value = data[n]
for w, now in list(d.copy().items()):
if w + weight <= W:
d[w + weight] = max(d.get(w + weight, 0), now + value)
print((max(d.... | 11 | 9 | 451 | 317 | N, W = list(map(int, input().split()))
data = tuple(tuple(map(int, input().split())) for _ in range(N))
table = [dict() for _ in range(N + 1)]
table[0][0] = 0
for n in range(N):
weight, value = data[n]
for w, now in list(table[n].items()):
table[n + 1][w] = max(table[n + 1].get(w, 0), now)
if w ... | N, W = list(map(int, input().split()))
data = tuple(tuple(map(int, input().split())) for _ in range(N))
d = {0: 0}
for n in range(N):
weight, value = data[n]
for w, now in list(d.copy().items()):
if w + weight <= W:
d[w + weight] = max(d.get(w + weight, 0), now + value)
print((max(d.values()... | false | 18.181818 | [
"-table = [dict() for _ in range(N + 1)]",
"-table[0][0] = 0",
"+d = {0: 0}",
"- for w, now in list(table[n].items()):",
"- table[n + 1][w] = max(table[n + 1].get(w, 0), now)",
"+ for w, now in list(d.copy().items()):",
"- table[n + 1][w + weight] = max(table[n + 1].get(w + weigh... | false | 0.037809 | 0.042996 | 0.879376 | [
"s386006971",
"s366654815"
] |
u489959379 | p02720 | python | s276347961 | s084848238 | 265 | 238 | 19,996 | 12,348 | Accepted | Accepted | 10.19 | k = int(eval(input()))
a = []
def dfs(x):
a.append(x)
if x > 3234566667:
return
for i in range(10):
if abs(x % 10 - i) <= 1:
dfs(x * 10 + i)
for i in range(1, 10):
dfs(i)
a = sorted(a)
print((a[k - 1]))
| import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
k = int(eval(input()))
res = []
def dfs(x):
res.append(x)
if len(str(x)) == 10:
return
for i in range(10):
if abs(x % 10 - i) <= 1:
... | 17 | 30 | 259 | 487 | k = int(eval(input()))
a = []
def dfs(x):
a.append(x)
if x > 3234566667:
return
for i in range(10):
if abs(x % 10 - i) <= 1:
dfs(x * 10 + i)
for i in range(1, 10):
dfs(i)
a = sorted(a)
print((a[k - 1]))
| import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
k = int(eval(input()))
res = []
def dfs(x):
res.append(x)
if len(str(x)) == 10:
return
for i in range(10):
if abs(x % 10 - i) <= 1:
dfs(x * 10 + i)
... | false | 43.333333 | [
"-k = int(eval(input()))",
"-a = []",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+f_inf = float(\"inf\")",
"+mod = 10**9 + 7",
"-def dfs(x):",
"- a.append(x)",
"- if x > 3234566667:",
"+def resolve():",
"+ k = int(eval(input()))",
"+ res = []",
"+",
"+ def dfs(x... | false | 0.415483 | 0.294471 | 1.410946 | [
"s276347961",
"s084848238"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.