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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u562016607 | p03026 | python | s158822981 | s995689950 | 366 | 312 | 50,264 | 50,520 | Accepted | Accepted | 14.75 | from collections import deque
N=int(eval(input()))
A=[0 for i in range(N-1)]
B=[0 for i in range(N-1)]
G=[[] for i in range(N)]
for i in range(N-1):
a,b=list(map(int,input().split()))
a-=1;b-=1
A[i],B[i]=a,b
G[a].append(b)
G[b].append(a)
j=0
for i in range(N):
if len(G[i])>len(G[j])... | from collections import deque
N=int(eval(input()))
A=[0 for i in range(N-1)]
B=[0 for i in range(N-1)]
G=[[] for i in range(N)]
for i in range(N-1):
a,b=list(map(int,input().split()))
a-=1;b-=1
A[i],B[i]=a,b
G[a].append(b)
G[b].append(a)
j=0
for i in range(N):
if len(G[i])>len(G[j])... | 29 | 29 | 634 | 638 | from collections import deque
N = int(eval(input()))
A = [0 for i in range(N - 1)]
B = [0 for i in range(N - 1)]
G = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
A[i], B[i] = a, b
G[a].append(b)
G[b].append(a)
j = 0
for i in range(N):
if... | from collections import deque
N = int(eval(input()))
A = [0 for i in range(N - 1)]
B = [0 for i in range(N - 1)]
G = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
A[i], B[i] = a, b
G[a].append(b)
G[b].append(a)
j = 0
for i in range(N):
if... | false | 0 | [
"- q.append(p)",
"+ q.appendleft(p)"
] | false | 0.047276 | 0.04831 | 0.978592 | [
"s158822981",
"s995689950"
] |
u188827677 | p02947 | python | s338368048 | s252096938 | 373 | 234 | 19,528 | 24,216 | Accepted | Accepted | 37.27 | N = int(eval(input()))
s = [''.join(sorted(eval(input()))) for _ in range(N)]
d = {}
for i in s:
if i not in d:
d[i] = 1
else:
d[i] += 1
ans = 0
for i in list(d.values()):
ans += i*(i-1)//2
print(ans) | from collections import Counter
n = int(eval(input()))
s = ["".join(sorted(list(eval(input())))) for _ in range(n)]
count = Counter(s)
ans = 0
for i in list(count.values()):
ans += i*(i-1)//2
print(ans) | 14 | 9 | 211 | 195 | N = int(eval(input()))
s = ["".join(sorted(eval(input()))) for _ in range(N)]
d = {}
for i in s:
if i not in d:
d[i] = 1
else:
d[i] += 1
ans = 0
for i in list(d.values()):
ans += i * (i - 1) // 2
print(ans)
| from collections import Counter
n = int(eval(input()))
s = ["".join(sorted(list(eval(input())))) for _ in range(n)]
count = Counter(s)
ans = 0
for i in list(count.values()):
ans += i * (i - 1) // 2
print(ans)
| false | 35.714286 | [
"-N = int(eval(input()))",
"-s = [\"\".join(sorted(eval(input()))) for _ in range(N)]",
"-d = {}",
"-for i in s:",
"- if i not in d:",
"- d[i] = 1",
"- else:",
"- d[i] += 1",
"+from collections import Counter",
"+",
"+n = int(eval(input()))",
"+s = [\"\".join(sorted(list(ev... | false | 0.042203 | 0.038917 | 1.084433 | [
"s338368048",
"s252096938"
] |
u242031676 | p02861 | python | s056356622 | s969989037 | 430 | 18 | 3,188 | 3,060 | Accepted | Accepted | 95.81 | from itertools import permutations
n = int(eval(input()))
x, y = list(zip(*[list(map(int, input().split()))for i in range(n)]))
ans = cnt = 0
for i in permutations(list(range(n))):
cnt += 1
for j in range(n-1):
f, t = i[j], i[j+1]
ans += ((x[f]-x[t])**2 + (y[f]-... | n = int(eval(input()))
a = [list(map(int,input().split()))for i in range(n)]
ans = 0
for i in range(n):
for j in range(n):
ans += ((a[i][0]-a[j][0])**2 + (a[i][1]-a[j][1])**2)**0.5
print((ans/n)) | 11 | 7 | 332 | 205 | from itertools import permutations
n = int(eval(input()))
x, y = list(zip(*[list(map(int, input().split())) for i in range(n)]))
ans = cnt = 0
for i in permutations(list(range(n))):
cnt += 1
for j in range(n - 1):
f, t = i[j], i[j + 1]
ans += ((x[f] - x[t]) ** 2 + (y[f] - y[t]) ** 2) ** 0.5
pri... | n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(n):
for j in range(n):
ans += ((a[i][0] - a[j][0]) ** 2 + (a[i][1] - a[j][1]) ** 2) ** 0.5
print((ans / n))
| false | 36.363636 | [
"-from itertools import permutations",
"-",
"-x, y = list(zip(*[list(map(int, input().split())) for i in range(n)]))",
"-ans = cnt = 0",
"-for i in permutations(list(range(n))):",
"- cnt += 1",
"- for j in range(n - 1):",
"- f, t = i[j], i[j + 1]",
"- ans += ((x[f] - x[t]) ** 2 +... | false | 0.040871 | 0.040763 | 1.002662 | [
"s056356622",
"s969989037"
] |
u895445743 | p03545 | python | s556962703 | s262437060 | 169 | 64 | 38,384 | 62,204 | Accepted | Accepted | 62.13 | from itertools import product
a=list(eval(input()))
for b in product(["+","-"],repeat=3):
if(eval(a[0]+b[0]+a[1]+b[1]+a[2]+b[2]+a[3])==7):
print((str(a[0]+b[0]+a[1]+b[1]+a[2]+b[2]+a[3]+"=7")))
break | from itertools import product
import sys
S = str(eval(input()))
A = list(product(['+', '-'], repeat=3))
for a in A:
ans = 0
tmp = ""
for i in range(len(S)-1):
tmp += S[i]+a[i]
tmp += S[len(S)-1]
ans += eval(tmp)
if ans == 7:
print((tmp+"=7"))
sys.exit()
| 7 | 16 | 207 | 311 | from itertools import product
a = list(eval(input()))
for b in product(["+", "-"], repeat=3):
if eval(a[0] + b[0] + a[1] + b[1] + a[2] + b[2] + a[3]) == 7:
print((str(a[0] + b[0] + a[1] + b[1] + a[2] + b[2] + a[3] + "=7")))
break
| from itertools import product
import sys
S = str(eval(input()))
A = list(product(["+", "-"], repeat=3))
for a in A:
ans = 0
tmp = ""
for i in range(len(S) - 1):
tmp += S[i] + a[i]
tmp += S[len(S) - 1]
ans += eval(tmp)
if ans == 7:
print((tmp + "=7"))
sys.exit()
| false | 56.25 | [
"+import sys",
"-a = list(eval(input()))",
"-for b in product([\"+\", \"-\"], repeat=3):",
"- if eval(a[0] + b[0] + a[1] + b[1] + a[2] + b[2] + a[3]) == 7:",
"- print((str(a[0] + b[0] + a[1] + b[1] + a[2] + b[2] + a[3] + \"=7\")))",
"- break",
"+S = str(eval(input()))",
"+A = list(pro... | false | 0.053842 | 0.088123 | 0.610987 | [
"s556962703",
"s262437060"
] |
u353797797 | p02624 | python | s763362091 | s433263344 | 1,213 | 32 | 9,160 | 9,080 | Accepted | Accepted | 97.36 | def solve(n):
ans=0
for d in range(1,n+1):
c=n//d
ans+=(c+1)*c//2*d
return ans
n=int(eval(input()))
print((solve(n)))
| # O(sqrt(N))solution
def solve(n):
ans = 0
r = n
for c in range(1, n + 1):
l = n // (c + 1)
if r - l == 1: break
ans += (l + 1 + r) * (r - l) // 2 * c * (c + 1) // 2
r = l
for d in range(1, r + 1):
c = n // d
ans += (c + 1) * c // 2 * d
r... | 9 | 17 | 147 | 365 | def solve(n):
ans = 0
for d in range(1, n + 1):
c = n // d
ans += (c + 1) * c // 2 * d
return ans
n = int(eval(input()))
print((solve(n)))
| # O(sqrt(N))solution
def solve(n):
ans = 0
r = n
for c in range(1, n + 1):
l = n // (c + 1)
if r - l == 1:
break
ans += (l + 1 + r) * (r - l) // 2 * c * (c + 1) // 2
r = l
for d in range(1, r + 1):
c = n // d
ans += (c + 1) * c // 2 * d
ret... | false | 47.058824 | [
"+# O(sqrt(N))solution",
"- for d in range(1, n + 1):",
"+ r = n",
"+ for c in range(1, n + 1):",
"+ l = n // (c + 1)",
"+ if r - l == 1:",
"+ break",
"+ ans += (l + 1 + r) * (r - l) // 2 * c * (c + 1) // 2",
"+ r = l",
"+ for d in range(1, r + 1)... | false | 0.826914 | 0.036897 | 22.411273 | [
"s763362091",
"s433263344"
] |
u186838327 | p03716 | python | s171206060 | s512201590 | 783 | 654 | 121,488 | 120,208 | Accepted | Accepted | 16.48 | n = int(eval(input()))
as_ = list(map(int, input().split()))
l = [0]*n
m = [0]*n
r = [0]*n
for i in range(n):
l[i] = as_[i]
m[i] = as_[n+i]
r[i] = (-1)*as_[2*n+i]
import heapq
heapq.heapify(l)
heapq.heapify(r)
l_maxs = [0]*(n+1)
r_mins = [0]*(n+1)
sl = sum(l)
sr = sum(r)
for i in range(... | n = int(eval(input()))
A = list(map(int, input().split()))
L = A[0:n]
R = A[2*n:3*n]
import heapq
sl = sum(L)
heapq.heapify(L)
sls = [0]*(n+1)
sls[0] = sl
for i in range(n, 2*n):
heapq.heappush(L, A[i])
x = heapq.heappop(L)
sl += A[i]-x
sls[i-n+1] = sl
#print(sls)
sr = sum(R)
R = [-c... | 40 | 32 | 660 | 602 | n = int(eval(input()))
as_ = list(map(int, input().split()))
l = [0] * n
m = [0] * n
r = [0] * n
for i in range(n):
l[i] = as_[i]
m[i] = as_[n + i]
r[i] = (-1) * as_[2 * n + i]
import heapq
heapq.heapify(l)
heapq.heapify(r)
l_maxs = [0] * (n + 1)
r_mins = [0] * (n + 1)
sl = sum(l)
sr = sum(r)
for i in rang... | n = int(eval(input()))
A = list(map(int, input().split()))
L = A[0:n]
R = A[2 * n : 3 * n]
import heapq
sl = sum(L)
heapq.heapify(L)
sls = [0] * (n + 1)
sls[0] = sl
for i in range(n, 2 * n):
heapq.heappush(L, A[i])
x = heapq.heappop(L)
sl += A[i] - x
sls[i - n + 1] = sl
# print(sls)
sr = sum(R)
R = [-c... | false | 20 | [
"-as_ = list(map(int, input().split()))",
"-l = [0] * n",
"-m = [0] * n",
"-r = [0] * n",
"-for i in range(n):",
"- l[i] = as_[i]",
"- m[i] = as_[n + i]",
"- r[i] = (-1) * as_[2 * n + i]",
"+A = list(map(int, input().split()))",
"+L = A[0:n]",
"+R = A[2 * n : 3 * n]",
"-heapq.heapify(... | false | 0.047938 | 0.044679 | 1.072926 | [
"s171206060",
"s512201590"
] |
u661534240 | p02911 | python | s850925892 | s912365801 | 241 | 198 | 10,528 | 10,924 | Accepted | Accepted | 17.84 | def t(n, k, q, a):
p = [-q + k] * n
for i in range(q):
p[a[i-1]-1] += 1
return ["Yes" if i > 0 else "No" for i in p]
if __name__ == "__main__":
n, k, q = list(map(int, input().split()))
a = [int(eval(input())) for i in range(q)]
r = t(n, k, q, a)
for i in r:
... | n, k, q = list(map(int, input().split()))
a = [int(eval(input())) for i in range(q)]
p = [-q + k] * n
for i in range(q):
p[a[i-1]-1] += 1
print(('\n'.join(["Yes" if i > 0 else "No" for i in p])))
| 13 | 6 | 317 | 191 | def t(n, k, q, a):
p = [-q + k] * n
for i in range(q):
p[a[i - 1] - 1] += 1
return ["Yes" if i > 0 else "No" for i in p]
if __name__ == "__main__":
n, k, q = list(map(int, input().split()))
a = [int(eval(input())) for i in range(q)]
r = t(n, k, q, a)
for i in r:
print(i)
| n, k, q = list(map(int, input().split()))
a = [int(eval(input())) for i in range(q)]
p = [-q + k] * n
for i in range(q):
p[a[i - 1] - 1] += 1
print(("\n".join(["Yes" if i > 0 else "No" for i in p])))
| false | 53.846154 | [
"-def t(n, k, q, a):",
"- p = [-q + k] * n",
"- for i in range(q):",
"- p[a[i - 1] - 1] += 1",
"- return [\"Yes\" if i > 0 else \"No\" for i in p]",
"-",
"-",
"-if __name__ == \"__main__\":",
"- n, k, q = list(map(int, input().split()))",
"- a = [int(eval(input())) for i in r... | false | 0.049349 | 0.11476 | 0.430022 | [
"s850925892",
"s912365801"
] |
u312025627 | p02954 | python | s941038613 | s498408475 | 1,317 | 248 | 23,344 | 48,060 | Accepted | Accepted | 81.17 | import numpy as np
from scipy.sparse import csr_matrix
s = np.array(list(eval(input())), dtype='U1')
n = len(s)
child = np.ones(n, dtype=np.int32)
rows = np.arange(n)
cols = np.where(s == 'R', rows+1, rows-1)
x = csr_matrix((np.ones(n, dtype=np.int32), (rows, cols)), (n, n))
def power(x, n):
if n == 1:... | def main():
S = eval(input())
N = len(S)
now = 0
ans = [0]*N
for i in range(N):
if S[i] == "R":
now += 1
else:
ans[i] += now//2
if i != 0:
ans[i-1] += int(0--now//2)
now = 0
now = 0
for i in range... | 20 | 28 | 447 | 573 | import numpy as np
from scipy.sparse import csr_matrix
s = np.array(list(eval(input())), dtype="U1")
n = len(s)
child = np.ones(n, dtype=np.int32)
rows = np.arange(n)
cols = np.where(s == "R", rows + 1, rows - 1)
x = csr_matrix((np.ones(n, dtype=np.int32), (rows, cols)), (n, n))
def power(x, n):
if n == 1:
... | def main():
S = eval(input())
N = len(S)
now = 0
ans = [0] * N
for i in range(N):
if S[i] == "R":
now += 1
else:
ans[i] += now // 2
if i != 0:
ans[i - 1] += int(0 - -now // 2)
now = 0
now = 0
for i in range(N - 1... | false | 28.571429 | [
"-import numpy as np",
"-from scipy.sparse import csr_matrix",
"-",
"-s = np.array(list(eval(input())), dtype=\"U1\")",
"-n = len(s)",
"-child = np.ones(n, dtype=np.int32)",
"-rows = np.arange(n)",
"-cols = np.where(s == \"R\", rows + 1, rows - 1)",
"-x = csr_matrix((np.ones(n, dtype=np.int32), (row... | false | 0.258604 | 0.036457 | 7.093432 | [
"s941038613",
"s498408475"
] |
u352394527 | p00430 | python | s506493922 | s096903138 | 110 | 100 | 9,776 | 9,776 | Accepted | Accepted | 9.09 | def main():
dic = [[] for i in range(31)]
dic[1].append([1])
def func(n):
if dic[n]:
return dic[n]
else:
dic[n].append([n])
for i in range(n - 1, 0, -1):
for l in func(n - i):
if i >= l[0]:
dic[n].append([i] + l)
return dic[n]
func(3... | dic = [[] for i in range(31)]
dic[1].append([1])
def func(n):
if dic[n]:
return dic[n]
else:
dic[n].append([n])
for i in range(n - 1, 0, -1):
for l in func(n - i):
if i >= l[0]:
dic[n].append([i] + l)
return dic[n]
func(30)
def main():
while True:
n =... | 23 | 23 | 458 | 428 | def main():
dic = [[] for i in range(31)]
dic[1].append([1])
def func(n):
if dic[n]:
return dic[n]
else:
dic[n].append([n])
for i in range(n - 1, 0, -1):
for l in func(n - i):
if i >= l[0]:
dic[n... | dic = [[] for i in range(31)]
dic[1].append([1])
def func(n):
if dic[n]:
return dic[n]
else:
dic[n].append([n])
for i in range(n - 1, 0, -1):
for l in func(n - i):
if i >= l[0]:
dic[n].append([i] + l)
return dic[n]
func(30)
de... | false | 0 | [
"+dic = [[] for i in range(31)]",
"+dic[1].append([1])",
"+",
"+",
"+def func(n):",
"+ if dic[n]:",
"+ return dic[n]",
"+ else:",
"+ dic[n].append([n])",
"+ for i in range(n - 1, 0, -1):",
"+ for l in func(n - i):",
"+ if i >= l[0]:",
"+ ... | false | 0.109502 | 0.094539 | 1.158277 | [
"s506493922",
"s096903138"
] |
u531599639 | p02659 | python | s931637418 | s323590203 | 27 | 22 | 10,096 | 9,160 | Accepted | Accepted | 18.52 | from decimal import Decimal
A, B = input().split()
A = Decimal(A)
B = Decimal(B)
print((int(A*B))) | A, B = input().split()
C = B.replace('.', '')
print((int(A)*int(C)//100))
| 6 | 3 | 102 | 74 | from decimal import Decimal
A, B = input().split()
A = Decimal(A)
B = Decimal(B)
print((int(A * B)))
| A, B = input().split()
C = B.replace(".", "")
print((int(A) * int(C) // 100))
| false | 50 | [
"-from decimal import Decimal",
"-",
"-A = Decimal(A)",
"-B = Decimal(B)",
"-print((int(A * B)))",
"+C = B.replace(\".\", \"\")",
"+print((int(A) * int(C) // 100))"
] | false | 0.038057 | 0.036313 | 1.048034 | [
"s931637418",
"s323590203"
] |
u560988566 | p02996 | python | s616957253 | s038421344 | 1,191 | 1,083 | 42,960 | 43,100 | Accepted | Accepted | 9.07 | import heapq
n = int(eval(input()))
abs = [tuple(map(int, input().split())) for _ in range(n)]
pq = []
for ab in abs:
a,b = ab[0],ab[1]
heapq.heappush(pq, tuple([b,a]))
dl = 0
tc = 0
ans = "Yes"
for i in range(n):
ba = heapq.heappop(pq)
dl = ba[0]
tc += ba[1]
if dl < tc:
ans... | import heapq
def main():
n = int(eval(input()))
abs = [tuple(map(int, input().split())) for _ in range(n)]
pq = []
for ab in abs:
a,b = ab[0],ab[1]
heapq.heappush(pq, tuple([b,a]))
dl = 0
tc = 0
ans = "Yes"
for i in range(n):
ba = heapq.heappop(pq)
dl = ba[0]
... | 24 | 28 | 344 | 431 | import heapq
n = int(eval(input()))
abs = [tuple(map(int, input().split())) for _ in range(n)]
pq = []
for ab in abs:
a, b = ab[0], ab[1]
heapq.heappush(pq, tuple([b, a]))
dl = 0
tc = 0
ans = "Yes"
for i in range(n):
ba = heapq.heappop(pq)
dl = ba[0]
tc += ba[1]
if dl < tc:
ans = "No"
... | import heapq
def main():
n = int(eval(input()))
abs = [tuple(map(int, input().split())) for _ in range(n)]
pq = []
for ab in abs:
a, b = ab[0], ab[1]
heapq.heappush(pq, tuple([b, a]))
dl = 0
tc = 0
ans = "Yes"
for i in range(n):
ba = heapq.heappop(pq)
dl... | false | 14.285714 | [
"-n = int(eval(input()))",
"-abs = [tuple(map(int, input().split())) for _ in range(n)]",
"-pq = []",
"-for ab in abs:",
"- a, b = ab[0], ab[1]",
"- heapq.heappush(pq, tuple([b, a]))",
"-dl = 0",
"-tc = 0",
"-ans = \"Yes\"",
"-for i in range(n):",
"- ba = heapq.heappop(pq)",
"- dl ... | false | 0.045845 | 0.045121 | 1.016045 | [
"s616957253",
"s038421344"
] |
u607865971 | p02995 | python | s656207203 | s695484691 | 38 | 25 | 4,020 | 3,684 | Accepted | Accepted | 34.21 | import sys
from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
from functools import reduce
from math import ceil, floor, log10, log2, factorial
from pprint import pprint
sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
... | import sys
from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
from functools import reduce
from math import ceil, floor, log10, log2, factorial
from pprint import pprint
sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
... | 47 | 32 | 970 | 797 | import sys
from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
from functools import reduce
from math import ceil, floor, log10, log2, factorial
from pprint import pprint
sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
# N = in... | import sys
from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
from functools import reduce
from math import ceil, floor, log10, log2, factorial
from pprint import pprint
sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
# N = in... | false | 31.914894 | [
"-def gcd(x, y):",
"- while y:",
"- x, y = y, x % y",
"- return x",
"+def gcb(a, b):",
"+ # a, b = max([a, b]), min([a, b])",
"+ return a if b == 0 else gcb(b, a % b)",
"-def lcm(x, y):",
"- return (x * y) // gcd(x, y)",
"+def lcm(a, b):",
"+ return a * b // gcb(a, b)",
... | false | 0.042594 | 0.072575 | 0.586896 | [
"s656207203",
"s695484691"
] |
u562016607 | p03363 | python | s546952888 | s942787581 | 324 | 252 | 41,152 | 41,152 | Accepted | Accepted | 22.22 | N=int(eval(input()))
A=[int(i) for i in input().split()]
S=[0 for i in range(N+1)]
for i in range(N):
S[i+1]=A[i]+S[i]
D=dict()
for i in range(N+1):
x=D.get(S[i],0)
x+=1
D[S[i]]=x
ans=0
for k in D:
ans+=(D[k]*(D[k]-1))//2
print(ans)
| #平成の次の元号は
#令和です!!
#令和→零和→Zero-Sum
#この問題はZero-Sum-Ranges...
N=int(eval(input()))
A=[int(i) for i in input().split()]
S=[0 for i in range(N+1)]
for i in range(N):
S[i+1]=A[i]+S[i]
D=dict()
for i in range(N+1):
if S[i] in D:
D[S[i]]+=1
else:
D[S[i]]=1
ans=0
for k in D:
t=D[... | 14 | 20 | 260 | 352 | N = int(eval(input()))
A = [int(i) for i in input().split()]
S = [0 for i in range(N + 1)]
for i in range(N):
S[i + 1] = A[i] + S[i]
D = dict()
for i in range(N + 1):
x = D.get(S[i], 0)
x += 1
D[S[i]] = x
ans = 0
for k in D:
ans += (D[k] * (D[k] - 1)) // 2
print(ans)
| # 平成の次の元号は
# 令和です!!
# 令和→零和→Zero-Sum
# この問題はZero-Sum-Ranges...
N = int(eval(input()))
A = [int(i) for i in input().split()]
S = [0 for i in range(N + 1)]
for i in range(N):
S[i + 1] = A[i] + S[i]
D = dict()
for i in range(N + 1):
if S[i] in D:
D[S[i]] += 1
else:
D[S[i]] = 1
ans = 0
for k in ... | false | 30 | [
"+# 平成の次の元号は",
"+# 令和です!!",
"+# 令和→零和→Zero-Sum",
"+# この問題はZero-Sum-Ranges...",
"- x = D.get(S[i], 0)",
"- x += 1",
"- D[S[i]] = x",
"+ if S[i] in D:",
"+ D[S[i]] += 1",
"+ else:",
"+ D[S[i]] = 1",
"- ans += (D[k] * (D[k] - 1)) // 2",
"+ t = D[k]",
"+ a... | false | 0.036576 | 0.035022 | 1.044371 | [
"s546952888",
"s942787581"
] |
u203843959 | p02892 | python | s875079872 | s723993477 | 712 | 650 | 3,444 | 3,444 | Accepted | Accepted | 8.71 | N=int(eval(input()))
graph=[]
for i in range(N):
graph.append([])
for i in range(N):
S=list(map(int,eval(input())))
for j in range(N):
if S[j]==1:
graph[i].append(j)
#print(graph)
max_set=-1
for i in range(N):
node_list=[-1]*N
#bfs
d=1
queue={i}
illegal=False
whi... | N=int(eval(input()))
graph=[]
for i in range(N):
graph.append([])
for i in range(N):
S=list(map(int,eval(input())))
for j in range(N):
if S[j]==1:
graph[i].append(j)
#print(graph)
max_set=-1
illegal=False
for i in range(N):
if illegal:
break
node_list=[-1]*N
#bf... | 43 | 46 | 786 | 814 | N = int(eval(input()))
graph = []
for i in range(N):
graph.append([])
for i in range(N):
S = list(map(int, eval(input())))
for j in range(N):
if S[j] == 1:
graph[i].append(j)
# print(graph)
max_set = -1
for i in range(N):
node_list = [-1] * N
# bfs
d = 1
queue = {i}
i... | N = int(eval(input()))
graph = []
for i in range(N):
graph.append([])
for i in range(N):
S = list(map(int, eval(input())))
for j in range(N):
if S[j] == 1:
graph[i].append(j)
# print(graph)
max_set = -1
illegal = False
for i in range(N):
if illegal:
break
node_list = [-1]... | false | 6.521739 | [
"+illegal = False",
"+ if illegal:",
"+ break",
"- illegal = False"
] | false | 0.035651 | 0.03481 | 1.02414 | [
"s875079872",
"s723993477"
] |
u584850530 | p02657 | python | s447357266 | s679122580 | 21 | 18 | 9,112 | 9,152 | Accepted | Accepted | 14.29 | a, b = list(map(int, input().split()))
print((a * b)) | a, b = list(map(str, input().split()))
A = int(a)
B = round(float(b) * 100)
print((A * B // 100))
| 2 | 4 | 46 | 93 | a, b = list(map(int, input().split()))
print((a * b))
| a, b = list(map(str, input().split()))
A = int(a)
B = round(float(b) * 100)
print((A * B // 100))
| false | 50 | [
"-a, b = list(map(int, input().split()))",
"-print((a * b))",
"+a, b = list(map(str, input().split()))",
"+A = int(a)",
"+B = round(float(b) * 100)",
"+print((A * B // 100))"
] | false | 0.039593 | 0.04356 | 0.908911 | [
"s447357266",
"s679122580"
] |
u926046014 | p02659 | python | s644585570 | s216217729 | 27 | 24 | 10,072 | 9,168 | Accepted | Accepted | 11.11 | from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((int(a*b))) | a, b = input().split()
a = int(a)
b = int(b.replace(".",""))
print(((a*b)//100)) | 5 | 6 | 86 | 85 | from decimal import Decimal
a, b = list(map(Decimal, input().split()))
print((int(a * b)))
| a, b = input().split()
a = int(a)
b = int(b.replace(".", ""))
print(((a * b) // 100))
| false | 16.666667 | [
"-from decimal import Decimal",
"-",
"-a, b = list(map(Decimal, input().split()))",
"-print((int(a * b)))",
"+a, b = input().split()",
"+a = int(a)",
"+b = int(b.replace(\".\", \"\"))",
"+print(((a * b) // 100))"
] | false | 0.052277 | 0.070947 | 0.736848 | [
"s644585570",
"s216217729"
] |
u884087839 | p02726 | python | s515634765 | s920334813 | 1,305 | 1,164 | 3,444 | 3,444 | Accepted | Accepted | 10.8 | #!/usr/bin/env python3
import sys
def solve(N: int, X: int, Y: int):
distances = [0] * (N - 1)
for i in range(0, N - 1):
for j in range(i + 1, N):
if j < X - 1 or Y - 1 < i:
distance = j - i
else:
distance = min(j - i, abs(X - 1 - i) +... | #!/usr/bin/env python3
import sys
def solve(N: int, X: int, Y: int):
distances = [0] * (N - 1)
for i in range(0, N - 1):
for j in range(i + 1, N):
distance = min(j - i, abs(X - 1 - i) + abs(Y - 1 - j) + 1)
distances[distance - 1] += 1
for k in distances:
... | 35 | 30 | 979 | 866 | #!/usr/bin/env python3
import sys
def solve(N: int, X: int, Y: int):
distances = [0] * (N - 1)
for i in range(0, N - 1):
for j in range(i + 1, N):
if j < X - 1 or Y - 1 < i:
distance = j - i
else:
distance = min(j - i, abs(X - 1 - i) + abs(Y - 1 ... | #!/usr/bin/env python3
import sys
def solve(N: int, X: int, Y: int):
distances = [0] * (N - 1)
for i in range(0, N - 1):
for j in range(i + 1, N):
distance = min(j - i, abs(X - 1 - i) + abs(Y - 1 - j) + 1)
distances[distance - 1] += 1
for k in distances:
print(k)
... | false | 14.285714 | [
"- if j < X - 1 or Y - 1 < i:",
"- distance = j - i",
"- else:",
"- distance = min(j - i, abs(X - 1 - i) + abs(Y - 1 - j) + 1)",
"+ distance = min(j - i, abs(X - 1 - i) + abs(Y - 1 - j) + 1)"
] | false | 0.034733 | 0.036179 | 0.960037 | [
"s515634765",
"s920334813"
] |
u325956328 | p02595 | python | s088017115 | s128145217 | 443 | 396 | 9,628 | 9,184 | Accepted | Accepted | 10.61 | N, D = list(map(int, input().split()))
ans = 0
for i in range(N):
x, y = list(map(int, input().split()))
dist = pow((x * x + y * y), 0.5)
# print(dist)
if dist <= D:
ans += 1
print(ans)
| N, D = list(map(int, input().split()))
ans = 0
for i in range(N):
x, y = list(map(int, input().split()))
# dist = pow((x * x + y * y), 0.5)
dist = (x * x + y * y)
# print(dist)
if dist <= D*D:
ans += 1
print(ans)
| 11 | 13 | 210 | 248 | N, D = list(map(int, input().split()))
ans = 0
for i in range(N):
x, y = list(map(int, input().split()))
dist = pow((x * x + y * y), 0.5)
# print(dist)
if dist <= D:
ans += 1
print(ans)
| N, D = list(map(int, input().split()))
ans = 0
for i in range(N):
x, y = list(map(int, input().split()))
# dist = pow((x * x + y * y), 0.5)
dist = x * x + y * y
# print(dist)
if dist <= D * D:
ans += 1
print(ans)
| false | 15.384615 | [
"- dist = pow((x * x + y * y), 0.5)",
"+ # dist = pow((x * x + y * y), 0.5)",
"+ dist = x * x + y * y",
"- if dist <= D:",
"+ if dist <= D * D:"
] | false | 0.100079 | 0.100765 | 0.993195 | [
"s088017115",
"s128145217"
] |
u332793228 | p03315 | python | s091761571 | s821550845 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | s=eval(input())
a=0
b=0
for i in s:
if i=="+":
a+=1
if i=="-":
b+=1
print((1*a-1*b)) | s=eval(input())
print((s.count("+")-s.count("-"))) | 9 | 2 | 108 | 43 | s = eval(input())
a = 0
b = 0
for i in s:
if i == "+":
a += 1
if i == "-":
b += 1
print((1 * a - 1 * b))
| s = eval(input())
print((s.count("+") - s.count("-")))
| false | 77.777778 | [
"-a = 0",
"-b = 0",
"-for i in s:",
"- if i == \"+\":",
"- a += 1",
"- if i == \"-\":",
"- b += 1",
"-print((1 * a - 1 * b))",
"+print((s.count(\"+\") - s.count(\"-\")))"
] | false | 0.037599 | 0.038895 | 0.96669 | [
"s091761571",
"s821550845"
] |
u594859393 | p03379 | python | s889391993 | s231375942 | 295 | 209 | 30,868 | 30,376 | Accepted | Accepted | 29.15 | from statistics import median_low, median_high
n = int(eval(input()))
xs = list(map(int, input().split()))
m1, m2 = median_low(xs), median_high(xs)
medians = [m2 if x < m2 else m1 for x in xs]
print(('\n'.join(map(str, medians)))) | n = int(eval(input()))
xs = list(map(int, input().split()))
ys = list(sorted(xs))
m1 = ys[n//2 - 1]
m2 = ys[n//2]
medians = [m2 if x < m2 else m1 for x in xs]
print(('\n'.join(map(str, medians)))) | 9 | 9 | 233 | 200 | from statistics import median_low, median_high
n = int(eval(input()))
xs = list(map(int, input().split()))
m1, m2 = median_low(xs), median_high(xs)
medians = [m2 if x < m2 else m1 for x in xs]
print(("\n".join(map(str, medians))))
| n = int(eval(input()))
xs = list(map(int, input().split()))
ys = list(sorted(xs))
m1 = ys[n // 2 - 1]
m2 = ys[n // 2]
medians = [m2 if x < m2 else m1 for x in xs]
print(("\n".join(map(str, medians))))
| false | 0 | [
"-from statistics import median_low, median_high",
"-",
"-m1, m2 = median_low(xs), median_high(xs)",
"+ys = list(sorted(xs))",
"+m1 = ys[n // 2 - 1]",
"+m2 = ys[n // 2]"
] | false | 0.098375 | 0.038289 | 2.569274 | [
"s889391993",
"s231375942"
] |
u571969099 | p02850 | python | s605670211 | s743556816 | 810 | 573 | 89,716 | 96,796 | Accepted | Accepted | 29.26 | import sys
sys.setrecursionlimit(1000000)
n = int(eval(input()))
ab = [[] for _ in range(n)]
for i in range(n - 1):
a, b = [int(i)-1 for i in input().split()]
ab[a].append([b, i])
ab[b].append([a, i])
re = [False] * n
ed = [0]*(n-1)
def c(i=0, used=-1):
global re, ed
if re[i]:
... | import sys
sys.setrecursionlimit(1000000)
def input():
return sys.stdin.readline()
n = int(eval(input()))
e = [[] for _ in range(n)]
for j in range(n - 1):
a, b = [int(i)-1 for i in input().split()]
e[a].append((b, j))
e[b].append((a, j))
co = [0]*(n-1)
def dfs(i=0, r=-1, dis=-1):
... | 32 | 32 | 586 | 562 | import sys
sys.setrecursionlimit(1000000)
n = int(eval(input()))
ab = [[] for _ in range(n)]
for i in range(n - 1):
a, b = [int(i) - 1 for i in input().split()]
ab[a].append([b, i])
ab[b].append([a, i])
re = [False] * n
ed = [0] * (n - 1)
def c(i=0, used=-1):
global re, ed
if re[i]:
retur... | import sys
sys.setrecursionlimit(1000000)
def input():
return sys.stdin.readline()
n = int(eval(input()))
e = [[] for _ in range(n)]
for j in range(n - 1):
a, b = [int(i) - 1 for i in input().split()]
e[a].append((b, j))
e[b].append((a, j))
co = [0] * (n - 1)
def dfs(i=0, r=-1, dis=-1):
globa... | false | 0 | [
"-n = int(eval(input()))",
"-ab = [[] for _ in range(n)]",
"-for i in range(n - 1):",
"- a, b = [int(i) - 1 for i in input().split()]",
"- ab[a].append([b, i])",
"- ab[b].append([a, i])",
"-re = [False] * n",
"-ed = [0] * (n - 1)",
"-def c(i=0, used=-1):",
"- global re, ed",
"- if... | false | 0.044122 | 0.043998 | 1.002799 | [
"s605670211",
"s743556816"
] |
u226108478 | p03448 | python | s903953085 | s227840122 | 62 | 43 | 3,060 | 3,188 | Accepted | Accepted | 30.65 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem B
if __name__ == '__main__':
five_hundred_yen_count = int(eval(input()))
one_hundred_yen_count = int(eval(input()))
fifty_yen_count = int(eval(input()))
total_yen = int(eval(input()))
pattern_count = 0
for i in range(f... | # -*- coding: utf-8 -*-
def main():
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
for a in range(a + 1):
for b in range(b + 1):
for c in range(c + 1):
if 500 * a + 100 * b + 50 * c == x:
... | 22 | 21 | 602 | 391 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem B
if __name__ == "__main__":
five_hundred_yen_count = int(eval(input()))
one_hundred_yen_count = int(eval(input()))
fifty_yen_count = int(eval(input()))
total_yen = int(eval(input()))
pattern_count = 0
for i in range(five_hundred_yen_c... | # -*- coding: utf-8 -*-
def main():
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
for a in range(a + 1):
for b in range(b + 1):
for c in range(c + 1):
if 500 * a + 100 * b + 50 * c == x:
... | false | 4.545455 | [
"-# AtCoder Beginner Contest",
"-# Problem B",
"+def main():",
"+ a = int(eval(input()))",
"+ b = int(eval(input()))",
"+ c = int(eval(input()))",
"+ x = int(eval(input()))",
"+ count = 0",
"+ for a in range(a + 1):",
"+ for b in range(b + 1):",
"+ for c in ra... | false | 0.113249 | 0.069976 | 1.618395 | [
"s903953085",
"s227840122"
] |
u312025627 | p02754 | python | s743558309 | s505977570 | 179 | 18 | 38,384 | 2,940 | Accepted | Accepted | 89.94 | def main():
N, A, B = (int(i) for i in input().split())
ans = (N//(A+B)) * A
less = N - (N//(A+B)) * (A+B)
print((ans + min(less, A)))
if __name__ == '__main__':
main()
| def main():
N, A, B = (int(i) for i in input().split())
ans = (N//(A+B)) * A
print((ans + min(N % (A+B), A)))
if __name__ == '__main__':
main()
| 9 | 8 | 197 | 167 | def main():
N, A, B = (int(i) for i in input().split())
ans = (N // (A + B)) * A
less = N - (N // (A + B)) * (A + B)
print((ans + min(less, A)))
if __name__ == "__main__":
main()
| def main():
N, A, B = (int(i) for i in input().split())
ans = (N // (A + B)) * A
print((ans + min(N % (A + B), A)))
if __name__ == "__main__":
main()
| false | 11.111111 | [
"- less = N - (N // (A + B)) * (A + B)",
"- print((ans + min(less, A)))",
"+ print((ans + min(N % (A + B), A)))"
] | false | 0.043435 | 0.036015 | 1.20603 | [
"s743558309",
"s505977570"
] |
u947883560 | p02774 | python | s936961592 | s798729145 | 498 | 454 | 95,188 | 95,188 | Accepted | Accepted | 8.84 | #!/usr/bin/env python3
import sys
INF = float("inf")
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
# 負数、 0数、 正数
neg, zero, pos = [], [], []
for a in A:
if a < 0:
neg.append(a)
elif a == 0:
... | import sys
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
# 負数、 0数、 正数
neg, zero, pos = [], [], []
for a in A:
if a < 0:
neg.append(a)
elif a == 0:
zero.append(a)
else:
... | 94 | 80 | 2,763 | 2,211 | #!/usr/bin/env python3
import sys
INF = float("inf")
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
# 負数、 0数、 正数
neg, zero, pos = [], [], []
for a in A:
if a < 0:
neg.append(a)
elif a == 0:
zero.append(a)... | import sys
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
# 負数、 0数、 正数
neg, zero, pos = [], [], []
for a in A:
if a < 0:
neg.append(a)
elif a == 0:
zero.append(a)
else:
pos.append(a)
... | false | 14.893617 | [
"-#!/usr/bin/env python3",
"-",
"-INF = float(\"inf\")",
"- neg.sort()",
"- pos.sort()",
"- # print(prod_neg, prod_zero, prod_pos)",
"- # print(prod_neg+prod_zero+prod_pos)",
"- # print(N*(N-1)//2)",
"- ns, ps = 0, 0",
"+ ps = 0",
"- # print(\"{} i... | false | 0.03678 | 0.037135 | 0.990434 | [
"s936961592",
"s798729145"
] |
u454022848 | p02402 | python | s186162673 | s889959069 | 40 | 10 | 8,028 | 7,156 | Accepted | Accepted | 75 | eval(input())
ia=[int(i) for i in input().split(" ")]
print((min(ia),max(ia),sum(ia))) | # encoding:utf-8
count = eval(input())
input = list(map(int, input().split()))
min = min(input)
max =max(input)
sum = sum(input)
print((min), end=' ')
print((max), end=' ')
print(sum) | 3 | 12 | 80 | 170 | eval(input())
ia = [int(i) for i in input().split(" ")]
print((min(ia), max(ia), sum(ia)))
| # encoding:utf-8
count = eval(input())
input = list(map(int, input().split()))
min = min(input)
max = max(input)
sum = sum(input)
print((min), end=" ")
print((max), end=" ")
print(sum)
| false | 75 | [
"-eval(input())",
"-ia = [int(i) for i in input().split(\" \")]",
"-print((min(ia), max(ia), sum(ia)))",
"+# encoding:utf-8",
"+count = eval(input())",
"+input = list(map(int, input().split()))",
"+min = min(input)",
"+max = max(input)",
"+sum = sum(input)",
"+print((min), end=\" \")",
"+print((... | false | 0.042073 | 0.068235 | 0.61659 | [
"s186162673",
"s889959069"
] |
u884323674 | p03478 | python | s672037599 | s093318128 | 37 | 27 | 3,060 | 2,940 | Accepted | Accepted | 27.03 | N, A, B = list(map(int, input().split()))
result = 0
for i in range(1, N+1):
num = list(str(i))
num_sum = 0
for j in num:
num_sum += int(j)
if A <= num_sum <= B:
result += i
print(result) | N, A, B = list(map(int, input().split()))
# 各桁を合計する関数
def sum_digits(num):
sum = 0
while num > 0:
sum += num % 10
num = num // 10
return sum
result = 0
for i in range(1, N+1):
if A <= sum_digits(i) <= B:
result += i
print(result) | 13 | 17 | 228 | 283 | N, A, B = list(map(int, input().split()))
result = 0
for i in range(1, N + 1):
num = list(str(i))
num_sum = 0
for j in num:
num_sum += int(j)
if A <= num_sum <= B:
result += i
print(result)
| N, A, B = list(map(int, input().split()))
# 各桁を合計する関数
def sum_digits(num):
sum = 0
while num > 0:
sum += num % 10
num = num // 10
return sum
result = 0
for i in range(1, N + 1):
if A <= sum_digits(i) <= B:
result += i
print(result)
| false | 23.529412 | [
"+# 各桁を合計する関数",
"+def sum_digits(num):",
"+ sum = 0",
"+ while num > 0:",
"+ sum += num % 10",
"+ num = num // 10",
"+ return sum",
"+",
"+",
"- num = list(str(i))",
"- num_sum = 0",
"- for j in num:",
"- num_sum += int(j)",
"- if A <= num_sum <= B... | false | 0.039736 | 0.040323 | 0.985432 | [
"s672037599",
"s093318128"
] |
u408071652 | p03078 | python | s394030431 | s462630934 | 542 | 123 | 221,252 | 77,548 | Accepted | Accepted | 77.31 | import sys
import heapq
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort... | import sys
import heapq
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort... | 47 | 38 | 805 | 712 | import sys
import heapq
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
... | import sys
import heapq
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
... | false | 19.148936 | [
"- a = 0",
"- b = 0",
"- c = 0",
"- k = 1",
"- L.append(A[i] + B[j])",
"+ for k in range(X):",
"+ if (i + 1) * (j + 1) * (k + 1) <= K:",
"+ L.append(A[i] + B[j] + C[k])",
"+ else:",
"+ break",
"... | false | 0.038673 | 0.062738 | 0.616417 | [
"s394030431",
"s462630934"
] |
u620084012 | p03127 | python | s860449207 | s044891876 | 76 | 62 | 14,480 | 20,284 | Accepted | Accepted | 18.42 | import sys
def input():
return sys.stdin.readline()[:-1]
def gcd(a,b):
if b == 0:
return a
return gcd(b,a%b)
def main():
N = int(eval(input()))
A = list(map(int,input().split()))
ans = A[0]
for e in A[1:]:
ans = gcd(ans,e)
print(ans)
if __name__ == '__main... | from math import gcd
N = int(eval(input()))
A = list(map(int,input().split()))
ans = A[0]
for e in A:
ans = gcd(e,ans)
print(ans)
| 17 | 7 | 331 | 134 | import sys
def input():
return sys.stdin.readline()[:-1]
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
ans = A[0]
for e in A[1:]:
ans = gcd(ans, e)
print(ans)
if __name__ == "__main__... | from math import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
ans = A[0]
for e in A:
ans = gcd(e, ans)
print(ans)
| false | 58.823529 | [
"-import sys",
"+from math import gcd",
"-",
"-def input():",
"- return sys.stdin.readline()[:-1]",
"-",
"-",
"-def gcd(a, b):",
"- if b == 0:",
"- return a",
"- return gcd(b, a % b)",
"-",
"-",
"-def main():",
"- N = int(eval(input()))",
"- A = list(map(int, inpu... | false | 0.042953 | 0.041488 | 1.035305 | [
"s860449207",
"s044891876"
] |
u086566114 | p02264 | python | s785916375 | s675014642 | 890 | 670 | 44,228 | 44,340 | Accepted | Accepted | 24.72 | class MyQueue(object):
"""
My Queue class
Attributes:
queue: queue
head
tail
"""
def __init__(self):
"""Constructor
"""
self.length = 100010
self.queue = []
counter = 0
while counter < self.length:
... | class MyQueue(object):
"""
My Queue class
Attributes:
queue: queue
head
tail
"""
def __init__(self):
"""Constructor
"""
self.length = 100010
self.queue = []
counter = 0
while counter < self.length:
... | 140 | 134 | 3,364 | 3,100 | class MyQueue(object):
"""
My Queue class
Attributes:
queue: queue
head
tail
"""
def __init__(self):
"""Constructor
"""
self.length = 100010
self.queue = []
counter = 0
while counter < self.length:
self.queue.append(... | class MyQueue(object):
"""
My Queue class
Attributes:
queue: queue
head
tail
"""
def __init__(self):
"""Constructor
"""
self.length = 100010
self.queue = []
counter = 0
while counter < self.length:
self.queue.append(... | false | 4.285714 | [
"- if self.is_full():",
"- print(\"[ERROR] Queue Overflow\")",
"- else:",
"- self.queue[self.tail % self.length].name = name",
"- self.queue[self.tail % self.length].time = time",
"- self.tail += 1",
"+ # if self.is_full():",
"+ #... | false | 0.036761 | 0.073272 | 0.501704 | [
"s785916375",
"s675014642"
] |
u562935282 | p03361 | python | s569211049 | s533533934 | 23 | 19 | 3,064 | 3,064 | Accepted | Accepted | 17.39 | h, w = list(map(int, input().split()))
s = []
for i in range(h):
s += [eval(input())]
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
ans = True
for i in range(h):
for j in range(w):
if (s[i][j] == '#'):
found = False
for k in range(4):
i2 = i + dx[k]
... | h, w = list(map(int, input().split()))
M = [eval(input()) for _ in range(h)]
bk = '#'
wt = '.'
for r in range(h):
for c in range(w):
if M[r][c] == bk:
flg = False
for dx, dy in [(-1, 0), (0, -1), (1, 0), (0, 1)]:
r2 = r + dy
c2 = c + dx
... | 25 | 21 | 553 | 559 | h, w = list(map(int, input().split()))
s = []
for i in range(h):
s += [eval(input())]
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
ans = True
for i in range(h):
for j in range(w):
if s[i][j] == "#":
found = False
for k in range(4):
i2 = i + dx[k]
j2 = j +... | h, w = list(map(int, input().split()))
M = [eval(input()) for _ in range(h)]
bk = "#"
wt = "."
for r in range(h):
for c in range(w):
if M[r][c] == bk:
flg = False
for dx, dy in [(-1, 0), (0, -1), (1, 0), (0, 1)]:
r2 = r + dy
c2 = c + dx
... | false | 16 | [
"-s = []",
"-for i in range(h):",
"- s += [eval(input())]",
"-dx = [1, -1, 0, 0]",
"-dy = [0, 0, 1, -1]",
"-ans = True",
"-for i in range(h):",
"- for j in range(w):",
"- if s[i][j] == \"#\":",
"- found = False",
"- for k in range(4):",
"- i2 =... | false | 0.042666 | 0.042458 | 1.00491 | [
"s569211049",
"s533533934"
] |
u466105944 | p03778 | python | s122059358 | s144483205 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | w,a,b = list(map(int,input().split()))
ans = max(a,b)-(min(a,b)+w)
if ans > 0:
print(ans)
else:
print((0))
| w,a,b = list(map(int,input().split()))
print((max(max(a,b)-(min(a,b)+w),0))) | 7 | 2 | 114 | 69 | w, a, b = list(map(int, input().split()))
ans = max(a, b) - (min(a, b) + w)
if ans > 0:
print(ans)
else:
print((0))
| w, a, b = list(map(int, input().split()))
print((max(max(a, b) - (min(a, b) + w), 0)))
| false | 71.428571 | [
"-ans = max(a, b) - (min(a, b) + w)",
"-if ans > 0:",
"- print(ans)",
"-else:",
"- print((0))",
"+print((max(max(a, b) - (min(a, b) + w), 0)))"
] | false | 0.038654 | 0.04481 | 0.862629 | [
"s122059358",
"s144483205"
] |
u346629192 | p03073 | python | s192914957 | s225733826 | 138 | 112 | 4,852 | 3,316 | Accepted | Accepted | 18.84 | s = eval(input())
N = len(s)
left_white=[]
for i in range(N):
if (i%2) == 0:
left_white.append(1)
else:
left_white.append(0)
left_black=[]
for i in range(N):
if (i%2) == 0:
left_black.append(0)
else:
left_black.append(1)
count_w = 0
for i in range(N):
... | s = eval(input())
N = len(s)
count_w = 0
for i in range(N):
if ((i%2) == 0 and int(s[i]) == 0) or ((i%2) == 1 and int(s[i]) == 1):
count_w += 1
count_b = 0
for i in range(N):
if ((i%2) == 0 and int(s[i]) == 1) or ((i%2) == 1 and int(s[i]) == 0):
count_b += 1
print((min(count_b,count_w)... | 23 | 11 | 493 | 314 | s = eval(input())
N = len(s)
left_white = []
for i in range(N):
if (i % 2) == 0:
left_white.append(1)
else:
left_white.append(0)
left_black = []
for i in range(N):
if (i % 2) == 0:
left_black.append(0)
else:
left_black.append(1)
count_w = 0
for i in range(N):
if int(s... | s = eval(input())
N = len(s)
count_w = 0
for i in range(N):
if ((i % 2) == 0 and int(s[i]) == 0) or ((i % 2) == 1 and int(s[i]) == 1):
count_w += 1
count_b = 0
for i in range(N):
if ((i % 2) == 0 and int(s[i]) == 1) or ((i % 2) == 1 and int(s[i]) == 0):
count_b += 1
print((min(count_b, count_w))... | false | 52.173913 | [
"-left_white = []",
"-for i in range(N):",
"- if (i % 2) == 0:",
"- left_white.append(1)",
"- else:",
"- left_white.append(0)",
"-left_black = []",
"-for i in range(N):",
"- if (i % 2) == 0:",
"- left_black.append(0)",
"- else:",
"- left_black.append(1)"... | false | 0.047489 | 0.044438 | 1.068673 | [
"s192914957",
"s225733826"
] |
u575431498 | p03329 | python | s283628852 | s046765888 | 917 | 377 | 4,308 | 3,828 | Accepted | Accepted | 58.89 | from math import log
N = int(eval(input()))
hiki9 = []
hiki6 = []
n = int(log(N) / log(9) + 1) # log9の計算に誤差があるので一つ多めに取っておく
for i in range(n+1):
hiki9.append(9**i)
n = int(log(N) / log(6) + 1)
for i in range(n+1):
hiki6.append(6**i)
hiki9.sort(reverse=True)
hiki6.sort(reverse=True)
x = []
for i i... | N = int(eval(input()))
koho = [1]
i=1
while True:
if i > 1e6:
break
i *= 6
koho.append(i)
i=1
while True:
if i > 1e6:
break
i *= 9
koho.append(i)
dp = [0] * (N+1)
for i in range(1, N+1):
tmp = []
for k in koho:
if k > i:
continue
... | 29 | 24 | 590 | 383 | from math import log
N = int(eval(input()))
hiki9 = []
hiki6 = []
n = int(log(N) / log(9) + 1) # log9の計算に誤差があるので一つ多めに取っておく
for i in range(n + 1):
hiki9.append(9**i)
n = int(log(N) / log(6) + 1)
for i in range(n + 1):
hiki6.append(6**i)
hiki9.sort(reverse=True)
hiki6.sort(reverse=True)
x = []
for i in range(N ... | N = int(eval(input()))
koho = [1]
i = 1
while True:
if i > 1e6:
break
i *= 6
koho.append(i)
i = 1
while True:
if i > 1e6:
break
i *= 9
koho.append(i)
dp = [0] * (N + 1)
for i in range(1, N + 1):
tmp = []
for k in koho:
if k > i:
continue
tmp.ap... | false | 17.241379 | [
"-from math import log",
"-",
"-hiki9 = []",
"-hiki6 = []",
"-n = int(log(N) / log(9) + 1) # log9の計算に誤差があるので一つ多めに取っておく",
"-for i in range(n + 1):",
"- hiki9.append(9**i)",
"-n = int(log(N) / log(6) + 1)",
"-for i in range(n + 1):",
"- hiki6.append(6**i)",
"-hiki9.sort(reverse=True)",
"-... | false | 0.135164 | 0.072244 | 1.870925 | [
"s283628852",
"s046765888"
] |
u170201762 | p03380 | python | s705249551 | s917885186 | 94 | 86 | 14,428 | 14,052 | Accepted | Accepted | 8.51 | n = int(eval(input()))
l = list(map(int,input().split()))
l.sort()
a = l[-1]
j = 0
while l[j] < int((a+1)/2):
j += 1
else:
if l[j] - int((a+1)/2) < int((a+1)/2) - l[j-1]:
b = l[j]
else:
b = l[j-1]
print(("{} {}".format(a,b))) | N = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
n = a[-1]
for i in range(N):
if a[i]>=n/2:
break
if n-a[i]>min(a[i-1],n-a[i-1]):
r = a[i]
else:
r = a[i-1]
print(('{} {}'.format(n,r))) | 13 | 13 | 257 | 227 | n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
a = l[-1]
j = 0
while l[j] < int((a + 1) / 2):
j += 1
else:
if l[j] - int((a + 1) / 2) < int((a + 1) / 2) - l[j - 1]:
b = l[j]
else:
b = l[j - 1]
print(("{} {}".format(a, b)))
| N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
n = a[-1]
for i in range(N):
if a[i] >= n / 2:
break
if n - a[i] > min(a[i - 1], n - a[i - 1]):
r = a[i]
else:
r = a[i - 1]
print(("{} {}".format(n, r)))
| false | 0 | [
"-n = int(eval(input()))",
"-l = list(map(int, input().split()))",
"-l.sort()",
"-a = l[-1]",
"-j = 0",
"-while l[j] < int((a + 1) / 2):",
"- j += 1",
"+N = int(eval(input()))",
"+a = list(map(int, input().split()))",
"+a.sort()",
"+n = a[-1]",
"+for i in range(N):",
"+ if a[i] >= n / ... | false | 0.202631 | 0.068454 | 2.960111 | [
"s705249551",
"s917885186"
] |
u186838327 | p03283 | python | s896474065 | s869763188 | 1,653 | 622 | 16,740 | 79,924 | Accepted | Accepted | 62.37 | n, m, q = list(map(int, input().split()))
x = [[0]*n for _ in range(n)]
for i in range(m):
l, r = list(map(int, input().split()))
l, r = l-1, r-1
x[l][r] += 1
s = [[0]*(n+1) for _ in range(n+1)]
for i in range(n):
for j in range(n):
s[i+1][j+1] = s[i+1][j] + s[i][j+1] - s[i][j] + x[i][j]
... | n, m, q = list(map(int, input().split()))
A = [[0]*n for i in range(n)]
for i in range(m):
l, r = list(map(int, input().split()))
l, r = l-1, r-1
A[l][r] += 1
#print(A)
s = [[0]*(n+1) for _ in range(n+1)]
for i in range(n):
for j in range(n):
s[i+1][j+1] = s[i+1][j] + s[i][j+1] - s[i... | 18 | 23 | 438 | 490 | n, m, q = list(map(int, input().split()))
x = [[0] * n for _ in range(n)]
for i in range(m):
l, r = list(map(int, input().split()))
l, r = l - 1, r - 1
x[l][r] += 1
s = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(n):
for j in range(n):
s[i + 1][j + 1] = s[i + 1][j] + s[i][j + 1] - s[i][... | n, m, q = list(map(int, input().split()))
A = [[0] * n for i in range(n)]
for i in range(m):
l, r = list(map(int, input().split()))
l, r = l - 1, r - 1
A[l][r] += 1
# print(A)
s = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(n):
for j in range(n):
s[i + 1][j + 1] = s[i + 1][j] + s[i][j +... | false | 21.73913 | [
"-x = [[0] * n for _ in range(n)]",
"+A = [[0] * n for i in range(n)]",
"- x[l][r] += 1",
"+ A[l][r] += 1",
"+# print(A)",
"- s[i + 1][j + 1] = s[i + 1][j] + s[i][j + 1] - s[i][j] + x[i][j]",
"-for _ in range(q):",
"- a, b = list(map(int, input().split()))",
"- a, b = a - 1, b - 1... | false | 0.047111 | 0.038225 | 1.232446 | [
"s896474065",
"s869763188"
] |
u010110540 | p03565 | python | s213560236 | s586056678 | 21 | 17 | 3,188 | 3,064 | Accepted | Accepted | 19.05 | import re
def solve(s, t):
s = s.replace('?', '.')
ls, lt = len(s), len(t)
if ls < lt:
return 'UNRESTORABLE'
ans = []
for i in range(ls - lt + 1):
m = re.match(s[i:i+lt], t)
if m is None:
continue
ans.append( (s[:i] + t + s[i+lt:]).repl... | Sd = eval(input())
T = eval(input())
def check(A, B):
for a, b in zip(A, B):
if a != '?' and a != b:
return False
return True
for i in range(len(Sd) - len(T) + 1)[::-1]:
if check(Sd[i:i + len(T)], T):
print(((Sd[:i] + T + Sd[i + len(T):]).replace('?', 'a')))
... | 24 | 15 | 472 | 346 | import re
def solve(s, t):
s = s.replace("?", ".")
ls, lt = len(s), len(t)
if ls < lt:
return "UNRESTORABLE"
ans = []
for i in range(ls - lt + 1):
m = re.match(s[i : i + lt], t)
if m is None:
continue
ans.append((s[:i] + t + s[i + lt :]).replace(".", "a"... | Sd = eval(input())
T = eval(input())
def check(A, B):
for a, b in zip(A, B):
if a != "?" and a != b:
return False
return True
for i in range(len(Sd) - len(T) + 1)[::-1]:
if check(Sd[i : i + len(T)], T):
print(((Sd[:i] + T + Sd[i + len(T) :]).replace("?", "a")))
break
... | false | 37.5 | [
"-import re",
"+Sd = eval(input())",
"+T = eval(input())",
"-def solve(s, t):",
"- s = s.replace(\"?\", \".\")",
"- ls, lt = len(s), len(t)",
"- if ls < lt:",
"- return \"UNRESTORABLE\"",
"- ans = []",
"- for i in range(ls - lt + 1):",
"- m = re.match(s[i : i + lt], ... | false | 0.036843 | 0.03788 | 0.972628 | [
"s213560236",
"s586056678"
] |
u017810624 | p02960 | python | s927749588 | s717162300 | 798 | 579 | 66,876 | 67,348 | Accepted | Accepted | 27.44 | s=list(eval(input()))
n=len(s)
s.reverse()
mod=10**9+7
dp=[[0]*13 for i in range(n+1)]
dp[0][0]=1
x=1
for i in range(n):
for j in range(13):
if s[i]=='?':
for k in range(10):
dp[i+1][j]+=dp[i][(j-(k*x)%13+13)%13]
else:
dp[i+1][j]+=dp[i][(j-(int(s[i])*x)%13+13)%13]
dp[i+1]... | s=list(eval(input()))
n=len(s)
s.reverse()
mod=10**9+7
dp=[[0]*13 for i in range(n+1)]
dp[0][0]=1
x=1
for i in range(n):
for j in range(13):
if s[i]=='?':
for k in range(10):
dp[i+1][j]+=dp[i][(j-k*x)%13]
else:
dp[i+1][j]+=dp[i][(j-int(s[i])*x)%13]
dp[i+1][j]%=mod
x*=1... | 18 | 18 | 357 | 341 | s = list(eval(input()))
n = len(s)
s.reverse()
mod = 10**9 + 7
dp = [[0] * 13 for i in range(n + 1)]
dp[0][0] = 1
x = 1
for i in range(n):
for j in range(13):
if s[i] == "?":
for k in range(10):
dp[i + 1][j] += dp[i][(j - (k * x) % 13 + 13) % 13]
else:
dp[i + ... | s = list(eval(input()))
n = len(s)
s.reverse()
mod = 10**9 + 7
dp = [[0] * 13 for i in range(n + 1)]
dp[0][0] = 1
x = 1
for i in range(n):
for j in range(13):
if s[i] == "?":
for k in range(10):
dp[i + 1][j] += dp[i][(j - k * x) % 13]
else:
dp[i + 1][j] += dp[... | false | 0 | [
"- dp[i + 1][j] += dp[i][(j - (k * x) % 13 + 13) % 13]",
"+ dp[i + 1][j] += dp[i][(j - k * x) % 13]",
"- dp[i + 1][j] += dp[i][(j - (int(s[i]) * x) % 13 + 13) % 13]",
"+ dp[i + 1][j] += dp[i][(j - int(s[i]) * x) % 13]"
] | false | 0.043685 | 0.037099 | 1.177529 | [
"s927749588",
"s717162300"
] |
u113971909 | p03160 | python | s888845858 | s296204588 | 152 | 138 | 13,980 | 14,012 | Accepted | Accepted | 9.21 | N = int(eval(input()))
H = list(map(int,input().split()))
DP = [0]*(N+1) #DP[i]に来るための最小コスト
def dH(i,j):
return abs(H[i-1] - H[j-1])
DP[2] = dH(1,2)
for i in range(3,N+1):
DP[i] = min( DP[i-2] + dH(i-2, i) , DP[i-1] + dH(i-1, i) )
print((DP[N])) | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
H = list(map(int, input().split()))
def cost(i, jp):
return abs(H[i-1] - H[i+jp-1])
dp = [0]*(N+1)
dp[2] = cost(1, 1)
for i in range(3,N+1):
... | 9 | 20 | 249 | 429 | N = int(eval(input()))
H = list(map(int, input().split()))
DP = [0] * (N + 1) # DP[i]に来るための最小コスト
def dH(i, j):
return abs(H[i - 1] - H[j - 1])
DP[2] = dH(1, 2)
for i in range(3, N + 1):
DP[i] = min(DP[i - 2] + dH(i - 2, i), DP[i - 1] + dH(i - 1, i))
print((DP[N]))
| #!/usr/bin/env python3
# -*- coding:utf-8 -*-
import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
H = list(map(int, input().split()))
def cost(i, jp):
return abs(H[i - 1] - H[i + jp - 1])
dp = [0] * (N + 1)
dp[2] = cost(1, 1)
for i in range(3, N + 1):
... | false | 55 | [
"-N = int(eval(input()))",
"-H = list(map(int, input().split()))",
"-DP = [0] * (N + 1) # DP[i]に来るための最小コスト",
"+#!/usr/bin/env python3",
"+# -*- coding:utf-8 -*-",
"+import sys",
"-def dH(i, j):",
"- return abs(H[i - 1] - H[j - 1])",
"+def main():",
"+ input = sys.stdin.readline",
"+ N ... | false | 0.036431 | 0.034907 | 1.043649 | [
"s888845858",
"s296204588"
] |
u489959379 | p03958 | python | s333924641 | s813519666 | 380 | 19 | 41,068 | 3,060 | Accepted | Accepted | 95 | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
k, t = list(map(int, input().split()))
A = list(map(int, input().split()))
B = []
for i in range(t):
B.append([i + 1, A[i]])
B = sorted(B, key=lambda x: x[1])
if t == 1:
... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
k, t = list(map(int, input().split()))
A = list(map(int, input().split()))
etc = sum(A) - max(A)
res = max(0, max(A) - 1 - etc)
print(res)
if __name__ == '_... | 40 | 18 | 833 | 339 | import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
k, t = list(map(int, input().split()))
A = list(map(int, input().split()))
B = []
for i in range(t):
B.append([i + 1, A[i]])
B = sorted(B, key=lambda x: x[1])
if t == 1:
print((k - 1))
... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
k, t = list(map(int, input().split()))
A = list(map(int, input().split()))
etc = sum(A) - max(A)
res = max(0, max(A) - 1 - etc)
print(res)
if __name__ == "__main__":
resolv... | false | 55 | [
"+input = sys.stdin.readline",
"- B = []",
"- for i in range(t):",
"- B.append([i + 1, A[i]])",
"- B = sorted(B, key=lambda x: x[1])",
"- if t == 1:",
"- print((k - 1))",
"- exit()",
"- res = 0",
"- pre = 0",
"- for i in range(k):",
"- if pre !=... | false | 0.130527 | 0.034238 | 3.812329 | [
"s333924641",
"s813519666"
] |
u606045429 | p03240 | python | s540932117 | s916133580 | 67 | 32 | 3,064 | 3,064 | Accepted | Accepted | 52.24 | N = int(eval(input()))
L = [tuple(map(int, input().split())) for _ in range(N)]
def get_H(Cx, Cy):
for x, y, h in L:
if h == 0:
continue
H = h + abs(x - Cx) + abs(y - Cy)
if H >= 1:
return H
def check(Cx, Cy, H):
for x, y, h in L:
if h != ma... | N = int(eval(input()))
L = [tuple(map(int, input().split())) for _ in range(N)]
xx, yy, hh = next(l for l in L if l[2] >= 1)
for Cx in range(101):
for Cy in range(101):
H = hh + abs(xx - Cx) + abs(yy - Cy)
for x, y, h in L:
if h != max(H - abs(x - Cx) - abs(y - Cy), 0):
... | 23 | 13 | 553 | 393 | N = int(eval(input()))
L = [tuple(map(int, input().split())) for _ in range(N)]
def get_H(Cx, Cy):
for x, y, h in L:
if h == 0:
continue
H = h + abs(x - Cx) + abs(y - Cy)
if H >= 1:
return H
def check(Cx, Cy, H):
for x, y, h in L:
if h != max(H - abs(x... | N = int(eval(input()))
L = [tuple(map(int, input().split())) for _ in range(N)]
xx, yy, hh = next(l for l in L if l[2] >= 1)
for Cx in range(101):
for Cy in range(101):
H = hh + abs(xx - Cx) + abs(yy - Cy)
for x, y, h in L:
if h != max(H - abs(x - Cx) - abs(y - Cy), 0):
b... | false | 43.478261 | [
"-",
"-",
"-def get_H(Cx, Cy):",
"- for x, y, h in L:",
"- if h == 0:",
"- continue",
"- H = h + abs(x - Cx) + abs(y - Cy)",
"- if H >= 1:",
"- return H",
"-",
"-",
"-def check(Cx, Cy, H):",
"- for x, y, h in L:",
"- if h != max(H - a... | false | 0.046633 | 0.049978 | 0.933059 | [
"s540932117",
"s916133580"
] |
u348805958 | p02774 | python | s342817194 | s939245676 | 785 | 722 | 97,236 | 97,364 | Accepted | Accepted | 8.03 | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
inf = 10**18 + 1
def cnt_val(a, b, x, cache):
ans = 0
la, lb = len(a), len(b)
J = (i for i in range(lb)) if a == b else (-1 for i in range(la))
if len(cache) == 0:
ca = [x, 0]
cb = [inf, lb-1]
cach... | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
inf = 10**18 + 1
def cnt_val(a, b, x):
ans = 0
la, lb = len(a), len(b)
J = (i for i in range(lb)) if a == b else (-1 for i in range(la))
j = lb - 1
for i, k in enumerate(J):
xa = a[i]
for j in range(... | 99 | 83 | 2,221 | 1,818 | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
inf = 10**18 + 1
def cnt_val(a, b, x, cache):
ans = 0
la, lb = len(a), len(b)
J = (i for i in range(lb)) if a == b else (-1 for i in range(la))
if len(cache) == 0:
ca = [x, 0]
cb = [inf, lb - 1]
cache.append(ca)
... | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
inf = 10**18 + 1
def cnt_val(a, b, x):
ans = 0
la, lb = len(a), len(b)
J = (i for i in range(lb)) if a == b else (-1 for i in range(la))
j = lb - 1
for i, k in enumerate(J):
xa = a[i]
for j in range(j, k, -1):
... | false | 16.161616 | [
"-def cnt_val(a, b, x, cache):",
"+def cnt_val(a, b, x):",
"- if len(cache) == 0:",
"- ca = [x, 0]",
"- cb = [inf, lb - 1]",
"- cache.append(ca)",
"- cache.append(cb)",
"- else:",
"- ca, cb = cache",
"- if x <= ca[0]:",
"- cache[0], cach... | false | 0.048118 | 0.048015 | 1.002136 | [
"s342817194",
"s939245676"
] |
u936985471 | p02973 | python | s460287721 | s835837902 | 910 | 103 | 7,092 | 12,724 | Accepted | Accepted | 88.68 | n=int(eval(input()))
# 降順のリストで二分探索
# 自分より小さい数字で最も大きいものを自分でアップデート
# 該当がなければ最後に追加
d=[]
d.append(int(eval(input())))
for i in range(n-1):
a=int(eval(input()))
ok=len(d)
ng=-1
while abs(ok-ng)>1:
mid=abs(ok+ng)//2
if d[mid]<a:
ok=mid
else:
ng=mid
if ok==len(d):
d.appen... | import sys
readline = sys.stdin.readline
N = int(readline())
ans = []
import bisect
for i in range(N):
a = -int(readline())
ind = bisect.bisect_right(ans, a)
if ind == len(ans):
ans.append(a)
else:
ans[ind] = a
print((len(ans)))
| 21 | 15 | 343 | 263 | n = int(eval(input()))
# 降順のリストで二分探索
# 自分より小さい数字で最も大きいものを自分でアップデート
# 該当がなければ最後に追加
d = []
d.append(int(eval(input())))
for i in range(n - 1):
a = int(eval(input()))
ok = len(d)
ng = -1
while abs(ok - ng) > 1:
mid = abs(ok + ng) // 2
if d[mid] < a:
ok = mid
else:
... | import sys
readline = sys.stdin.readline
N = int(readline())
ans = []
import bisect
for i in range(N):
a = -int(readline())
ind = bisect.bisect_right(ans, a)
if ind == len(ans):
ans.append(a)
else:
ans[ind] = a
print((len(ans)))
| false | 28.571429 | [
"-n = int(eval(input()))",
"-# 降順のリストで二分探索",
"-# 自分より小さい数字で最も大きいものを自分でアップデート",
"-# 該当がなければ最後に追加",
"-d = []",
"-d.append(int(eval(input())))",
"-for i in range(n - 1):",
"- a = int(eval(input()))",
"- ok = len(d)",
"- ng = -1",
"- while abs(ok - ng) > 1:",
"- mid = abs(ok + n... | false | 0.039641 | 0.035277 | 1.123711 | [
"s460287721",
"s835837902"
] |
u298520807 | p03495 | python | s746494188 | s187870777 | 179 | 122 | 36,000 | 35,868 | Accepted | Accepted | 31.84 | from collections import defaultdict
N, K = list(map(int, input().split()))
balls = defaultdict(int)
for b in input().split():
balls[b] += 1
types = len(list(balls.keys()))
balls = sorted(list(balls.values()), reverse=True)
ans = 0
while types > K:
ans += balls.pop()
types -= 1
print(ans)
| # 解説版
from collections import defaultdict
N, K = list(map(int, input().split()))
balls = defaultdict(int)
for b in input().split():
balls[b] += 1
balls = sorted(balls.values())
print((N - sum(balls[-K:])))
| 12 | 9 | 294 | 211 | from collections import defaultdict
N, K = list(map(int, input().split()))
balls = defaultdict(int)
for b in input().split():
balls[b] += 1
types = len(list(balls.keys()))
balls = sorted(list(balls.values()), reverse=True)
ans = 0
while types > K:
ans += balls.pop()
types -= 1
print(ans)
| # 解説版
from collections import defaultdict
N, K = list(map(int, input().split()))
balls = defaultdict(int)
for b in input().split():
balls[b] += 1
balls = sorted(balls.values())
print((N - sum(balls[-K:])))
| false | 25 | [
"+# 解説版",
"-types = len(list(balls.keys()))",
"-balls = sorted(list(balls.values()), reverse=True)",
"-ans = 0",
"-while types > K:",
"- ans += balls.pop()",
"- types -= 1",
"-print(ans)",
"+balls = sorted(balls.values())",
"+print((N - sum(balls[-K:])))"
] | false | 0.031715 | 0.037836 | 0.838241 | [
"s746494188",
"s187870777"
] |
u740284863 | p03161 | python | s790992521 | s001023314 | 394 | 216 | 52,448 | 83,368 | Accepted | Accepted | 45.18 | import sys
sys.setrecursionlimit(100000)
n,k = list(map(int,input().split()))
l = list(map(int,input().split()))
A = [0]*(n)
if k >= n:
k = n
for i in range(1,k):
A[i] = abs(l[i]-l[0])
for i in range(k,n):
tmp = float('Inf')
for j in range(1,k+1):
dis = A[i-j] + abs(l[i]-l[i-j])
... | n,k = list(map(int,input().split()))
if n <= k:
k = n
H = list(map(int,input().split()))
dp = [float('inf') for _ in range(n+1)]
for i in range(k):
dp[i] = abs(H[i] - H[0])
for i in range(k,n):
for j in range(k+1):
dp[i] = min(dp[i],dp[i-j] + abs(H[i] - H[i-j]))
print((dp[-2])) | 16 | 11 | 376 | 300 | import sys
sys.setrecursionlimit(100000)
n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
A = [0] * (n)
if k >= n:
k = n
for i in range(1, k):
A[i] = abs(l[i] - l[0])
for i in range(k, n):
tmp = float("Inf")
for j in range(1, k + 1):
dis = A[i - j] + abs(l[i] - l[i - j... | n, k = list(map(int, input().split()))
if n <= k:
k = n
H = list(map(int, input().split()))
dp = [float("inf") for _ in range(n + 1)]
for i in range(k):
dp[i] = abs(H[i] - H[0])
for i in range(k, n):
for j in range(k + 1):
dp[i] = min(dp[i], dp[i - j] + abs(H[i] - H[i - j]))
print((dp[-2]))
| false | 31.25 | [
"-import sys",
"-",
"-sys.setrecursionlimit(100000)",
"-l = list(map(int, input().split()))",
"-A = [0] * (n)",
"-if k >= n:",
"+if n <= k:",
"-for i in range(1, k):",
"- A[i] = abs(l[i] - l[0])",
"+H = list(map(int, input().split()))",
"+dp = [float(\"inf\") for _ in range(n + 1)]",
"+for ... | false | 0.038451 | 0.039449 | 0.974712 | [
"s790992521",
"s001023314"
] |
u753803401 | p04033 | python | s111603000 | s500526705 | 179 | 161 | 38,256 | 38,384 | Accepted | Accepted | 10.06 | def slove():
import sys
input = sys.stdin.readline
a, b = list(map(int, input().rstrip('\n').split()))
if a * b > 0 :
if a > 0 and b > 0:
print("Positive")
elif a < 0 and b < 0:
print(("Positive" if abs(a - b + 1) % 2 == 0 else "Negative"))
elif a... | def slove():
import sys
input = sys.stdin.readline
a, b = list(map(int, input().rstrip('\n').split()))
if a * b <= 0:
print("Zero")
elif a > 0 and b > 0:
print("Positive")
else:
if a * b >= 0:
if abs(a - b + 1) % 2 == 0:
print("Posit... | 17 | 23 | 479 | 562 | def slove():
import sys
input = sys.stdin.readline
a, b = list(map(int, input().rstrip("\n").split()))
if a * b > 0:
if a > 0 and b > 0:
print("Positive")
elif a < 0 and b < 0:
print(("Positive" if abs(a - b + 1) % 2 == 0 else "Negative"))
elif a < 0 and ... | def slove():
import sys
input = sys.stdin.readline
a, b = list(map(int, input().rstrip("\n").split()))
if a * b <= 0:
print("Zero")
elif a > 0 and b > 0:
print("Positive")
else:
if a * b >= 0:
if abs(a - b + 1) % 2 == 0:
print("Positive")
... | false | 26.086957 | [
"- if a * b > 0:",
"- if a > 0 and b > 0:",
"- print(\"Positive\")",
"- elif a < 0 and b < 0:",
"- print((\"Positive\" if abs(a - b + 1) % 2 == 0 else \"Negative\"))",
"- elif a < 0 and 0 < b:",
"- print((\"Positive\" if abs(a) % 2 == 0 else \"Neg... | false | 0.041258 | 0.039004 | 1.057785 | [
"s111603000",
"s500526705"
] |
u820180033 | p02631 | python | s511537822 | s160185959 | 175 | 149 | 31,336 | 31,680 | Accepted | Accepted | 14.86 | N = int(eval(input()))
A = [int(n) for n in input().split()]
X = 0
ans = []
for i in range(N):
X = X^A[i]
for i in range(N):
ans.append(X^A[i])
print((*ans)) | from functools import reduce
N = int(eval(input()))
A = [int(n) for n in input().split()]
X = reduce(int.__xor__, A)
ans = [X^a for a in A]
print((*ans)) | 9 | 6 | 161 | 150 | N = int(eval(input()))
A = [int(n) for n in input().split()]
X = 0
ans = []
for i in range(N):
X = X ^ A[i]
for i in range(N):
ans.append(X ^ A[i])
print((*ans))
| from functools import reduce
N = int(eval(input()))
A = [int(n) for n in input().split()]
X = reduce(int.__xor__, A)
ans = [X ^ a for a in A]
print((*ans))
| false | 33.333333 | [
"+from functools import reduce",
"+",
"-X = 0",
"-ans = []",
"-for i in range(N):",
"- X = X ^ A[i]",
"-for i in range(N):",
"- ans.append(X ^ A[i])",
"+X = reduce(int.__xor__, A)",
"+ans = [X ^ a for a in A]"
] | false | 0.050735 | 0.067018 | 0.757033 | [
"s511537822",
"s160185959"
] |
u297574184 | p02563 | python | s035990742 | s100564661 | 1,669 | 1,487 | 305,928 | 268,960 | Accepted | Accepted | 10.9 | import numpy as np
from scipy import signal
MOD = 998244353
N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
def divideArr3(As, numD):
arrA = np.array(As, dtype=np.int64)
mask = (1<<numD) - 1
arrA0 = arrA & mask
arrA1 = (arr... | import numpy as np
MOD = 998244353
N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
def divideArr3(As, numD):
arrA = np.array(As, dtype=np.int64)
mask = (1<<numD) - 1
arrA0 = arrA & mask
arrA1 = (arrA>>numD) & mask
arrA2... | 43 | 46 | 1,345 | 1,475 | import numpy as np
from scipy import signal
MOD = 998244353
N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
def divideArr3(As, numD):
arrA = np.array(As, dtype=np.int64)
mask = (1 << numD) - 1
arrA0 = arrA & mask
arrA1 = (arrA >> numD) ... | import numpy as np
MOD = 998244353
N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
def divideArr3(As, numD):
arrA = np.array(As, dtype=np.int64)
mask = (1 << numD) - 1
arrA0 = arrA & mask
arrA1 = (arrA >> numD) & mask
arrA2 = arrA >... | false | 6.521739 | [
"-from scipy import signal",
"- arrC = np.rint(signal.fftconvolve(arrA, arrB)).astype(np.int64)",
"- return arrC",
"+ L = len(arrA) + len(arrB) - 1",
"+ lenFFT = 1 << ((L - 1).bit_length())",
"+ fA = np.fft.rfft(arrA, n=lenFFT)",
"+ fB = np.fft.rfft(arrB, n=lenFFT)",
"+ arrC = np.... | false | 1.466463 | 0.644983 | 2.273648 | [
"s035990742",
"s100564661"
] |
u982591663 | p02683 | python | s479148582 | s329505029 | 202 | 88 | 27,224 | 9,124 | Accepted | Accepted | 56.44 | import numpy as np
N, M, X = list(map(int, input().split()))
CA = []
for _ in range(N):
Ci, *A = list(map(int, input().split()))
CA.append((Ci, A))
ans = 10**8
studied = np.array([0] * M)
for i in range(2**N):
flag = True
tmp_ans = 0
studied = np.array([0] * M)
for j in range(N... | N, M, X = list(map(int, input().split()))
CA = []
for _ in range(N):
C, *A = list(map(int, input().split()))
CA.append((C, A))
ans = 10**9
for i in range(2**N):
flag = True
tmp_C = 0
tmp_A = [0]*M
for j in range(N):
if i >> j & 1:
tmp_C += CA[j][0]
... | 30 | 28 | 601 | 573 | import numpy as np
N, M, X = list(map(int, input().split()))
CA = []
for _ in range(N):
Ci, *A = list(map(int, input().split()))
CA.append((Ci, A))
ans = 10**8
studied = np.array([0] * M)
for i in range(2**N):
flag = True
tmp_ans = 0
studied = np.array([0] * M)
for j in range(N):
if i >... | N, M, X = list(map(int, input().split()))
CA = []
for _ in range(N):
C, *A = list(map(int, input().split()))
CA.append((C, A))
ans = 10**9
for i in range(2**N):
flag = True
tmp_C = 0
tmp_A = [0] * M
for j in range(N):
if i >> j & 1:
tmp_C += CA[j][0]
for k in rang... | false | 6.666667 | [
"-import numpy as np",
"-",
"- Ci, *A = list(map(int, input().split()))",
"- CA.append((Ci, A))",
"-ans = 10**8",
"-studied = np.array([0] * M)",
"+ C, *A = list(map(int, input().split()))",
"+ CA.append((C, A))",
"+ans = 10**9",
"- tmp_ans = 0",
"- studied = np.array([0] * M)"... | false | 0.301864 | 0.091363 | 3.303995 | [
"s479148582",
"s329505029"
] |
u245870380 | p03457 | python | s636380941 | s688659594 | 405 | 370 | 27,300 | 3,060 | Accepted | Accepted | 8.64 | N = int(eval(input()))
t = [list(map(int, input().split())) for i in range(N)]
if N == 1:
if t[0][0] >= t[0][1] + t[0][2]:
print("Yes")
else:
print("No")
else:
for i in range(1,N):
a = t[i][0] - t[i-1][0]
b = abs(t[i][1] - t[i-1][1]) + abs(t[i][2] - t[i-1][2])
... | N = int(eval(input()))
pt, px, py = 0, 0, 0
for i in range(N):
t, x, y = list(map(int, input().split()))
a = abs(x - px) + abs(y - py)
b = t - pt
if b < a or (a - b) % 2 != 0:
print("No")
exit()
pt, px, py = t, x, y
print("Yes") | 19 | 11 | 451 | 262 | N = int(eval(input()))
t = [list(map(int, input().split())) for i in range(N)]
if N == 1:
if t[0][0] >= t[0][1] + t[0][2]:
print("Yes")
else:
print("No")
else:
for i in range(1, N):
a = t[i][0] - t[i - 1][0]
b = abs(t[i][1] - t[i - 1][1]) + abs(t[i][2] - t[i - 1][2])
... | N = int(eval(input()))
pt, px, py = 0, 0, 0
for i in range(N):
t, x, y = list(map(int, input().split()))
a = abs(x - px) + abs(y - py)
b = t - pt
if b < a or (a - b) % 2 != 0:
print("No")
exit()
pt, px, py = t, x, y
print("Yes")
| false | 42.105263 | [
"-t = [list(map(int, input().split())) for i in range(N)]",
"-if N == 1:",
"- if t[0][0] >= t[0][1] + t[0][2]:",
"- print(\"Yes\")",
"- else:",
"+pt, px, py = 0, 0, 0",
"+for i in range(N):",
"+ t, x, y = list(map(int, input().split()))",
"+ a = abs(x - px) + abs(y - py)",
"+ ... | false | 0.043031 | 0.07648 | 0.562645 | [
"s636380941",
"s688659594"
] |
u923279197 | p02787 | python | s421823674 | s527143373 | 854 | 382 | 122,588 | 41,580 | Accepted | Accepted | 55.27 | H,N = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(N)]
dp = [[10**18]*(N+1) for _ in range(H+1)]
dp[0][0] = 0
for h in range(H+1):
for i in range(N):
dp[h][i+1] = min(dp[h][i], dp[max(0,h-AB[i][0])][i+1] + AB[i][1])
print((dp[H][N])) | inf = 10**9
H, N = list(map(int, input().split()))
AB = []
for n in range(N):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB.sort(reverse=True, key=lambda x: x[0])
dp = [inf] * (H + 10 ** 4)
dp[0] = 0
for a, b in AB:
for h in range(H):
if dp[h] != inf:
tmp = dp[h... | 8 | 16 | 282 | 400 | H, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
dp = [[10**18] * (N + 1) for _ in range(H + 1)]
dp[0][0] = 0
for h in range(H + 1):
for i in range(N):
dp[h][i + 1] = min(dp[h][i], dp[max(0, h - AB[i][0])][i + 1] + AB[i][1])
print((dp[H][N]))
| inf = 10**9
H, N = list(map(int, input().split()))
AB = []
for n in range(N):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB.sort(reverse=True, key=lambda x: x[0])
dp = [inf] * (H + 10**4)
dp[0] = 0
for a, b in AB:
for h in range(H):
if dp[h] != inf:
tmp = dp[h] + b
... | false | 50 | [
"+inf = 10**9",
"-AB = [list(map(int, input().split())) for _ in range(N)]",
"-dp = [[10**18] * (N + 1) for _ in range(H + 1)]",
"-dp[0][0] = 0",
"-for h in range(H + 1):",
"- for i in range(N):",
"- dp[h][i + 1] = min(dp[h][i], dp[max(0, h - AB[i][0])][i + 1] + AB[i][1])",
"-print((dp[H][N]... | false | 0.154483 | 0.068664 | 2.249839 | [
"s421823674",
"s527143373"
] |
u112364985 | p03254 | python | s938758994 | s030602198 | 26 | 24 | 9,084 | 9,092 | Accepted | Accepted | 7.69 | n,x=list(map(int,input().split()))
List=list(map(int,input().split()))
List.sort()
ans=0
if sum(List)==x:
print(n)
exit()
else:
for i in range(len(List)-1):
if x>=List[i]:
ans+=1
x-=List[i]
else:
break
print(ans) | n,x=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
cnt=0
if sum(a)==x:
print(n)
exit()
else:
for i in range(n-1):
if a[i]<=x:
x-=a[i]
cnt+=1
print(cnt) | 15 | 13 | 284 | 227 | n, x = list(map(int, input().split()))
List = list(map(int, input().split()))
List.sort()
ans = 0
if sum(List) == x:
print(n)
exit()
else:
for i in range(len(List) - 1):
if x >= List[i]:
ans += 1
x -= List[i]
else:
break
print(ans)
| n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
cnt = 0
if sum(a) == x:
print(n)
exit()
else:
for i in range(n - 1):
if a[i] <= x:
x -= a[i]
cnt += 1
print(cnt)
| false | 13.333333 | [
"-List = list(map(int, input().split()))",
"-List.sort()",
"-ans = 0",
"-if sum(List) == x:",
"+a = list(map(int, input().split()))",
"+a.sort()",
"+cnt = 0",
"+if sum(a) == x:",
"- for i in range(len(List) - 1):",
"- if x >= List[i]:",
"- ans += 1",
"- x -= Lis... | false | 0.090916 | 0.039413 | 2.306713 | [
"s938758994",
"s030602198"
] |
u367130284 | p03919 | python | s029507524 | s901943958 | 21 | 17 | 3,060 | 3,060 | Accepted | Accepted | 19.05 | h,w,*a=open(0).read().split();b=a.index("snuke");print(([chr(i)for i in range(65,91)][b%int(w)]+str(b//int(w)+1))) | h,w,*a=open(0).read().split();b=a.index("snuke");print((chr(b%int(w)+65)+str(b//int(w)+1))) | 1 | 1 | 112 | 89 | h, w, *a = open(0).read().split()
b = a.index("snuke")
print(([chr(i) for i in range(65, 91)][b % int(w)] + str(b // int(w) + 1)))
| h, w, *a = open(0).read().split()
b = a.index("snuke")
print((chr(b % int(w) + 65) + str(b // int(w) + 1)))
| false | 0 | [
"-print(([chr(i) for i in range(65, 91)][b % int(w)] + str(b // int(w) + 1)))",
"+print((chr(b % int(w) + 65) + str(b // int(w) + 1)))"
] | false | 0.046841 | 0.041056 | 1.140907 | [
"s029507524",
"s901943958"
] |
u525065967 | p02678 | python | s842505803 | s034348645 | 963 | 688 | 35,108 | 34,112 | Accepted | Accepted | 28.56 | import queue
n,m = list(map(int, input().split()))
V = [[] for _ in range(n+1)]
for _ in range(m):
a,b = list(map(int, input().split()))
V[a].append(b)
V[b].append(a)
ans = [-1]*(n+1)
q = queue.Queue()
q.put(1)
while not q.empty():
p = q.get()
for c in V[p]:
if c > 1 and ans[c] ... | from collections import deque
n,m = list(map(int, input().split()))
V = [[] for _ in range(n+1)]
for _ in range(m):
a,b = list(map(int, input().split()))
V[a].append(b)
V[b].append(a)
ans = [-1]*(n+1)
q = deque()
q.append(1)
while len(q):
p = q.popleft()
for c in V[p]:
if c > 1 ... | 18 | 18 | 401 | 425 | import queue
n, m = list(map(int, input().split()))
V = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = list(map(int, input().split()))
V[a].append(b)
V[b].append(a)
ans = [-1] * (n + 1)
q = queue.Queue()
q.put(1)
while not q.empty():
p = q.get()
for c in V[p]:
if c > 1 and ans[c] < 0:... | from collections import deque
n, m = list(map(int, input().split()))
V = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = list(map(int, input().split()))
V[a].append(b)
V[b].append(a)
ans = [-1] * (n + 1)
q = deque()
q.append(1)
while len(q):
p = q.popleft()
for c in V[p]:
if c > 1 and ... | false | 0 | [
"-import queue",
"+from collections import deque",
"-q = queue.Queue()",
"-q.put(1)",
"-while not q.empty():",
"- p = q.get()",
"+q = deque()",
"+q.append(1)",
"+while len(q):",
"+ p = q.popleft()",
"- q.put(c)",
"+ q.append(c)",
"-for x in ans[2:]:",
"- prin... | false | 0.087663 | 0.066288 | 1.322458 | [
"s842505803",
"s034348645"
] |
u761529120 | p03326 | python | s225493065 | s354859982 | 226 | 202 | 39,920 | 39,152 | Accepted | Accepted | 10.62 | def main():
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in [-1,1]:
for j in [-1,1]:
for k in [-1,1]:
tmp = []
for x, y, z in X:
tmp.append(i*x + j*y + k*z)
... | def main():
N, M = list(map(int, input().split()))
x = [0] * N
y = [0] * N
z = [0] * N
for i in range(N):
x[i], y[i], z[i] = list(map(int, input().split()))
ans = 0
for i in [-1,1]:
for j in [-1,1]:
for k in [-1,1]:
cand_list = []
... | 17 | 30 | 431 | 691 | def main():
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in [-1, 1]:
for j in [-1, 1]:
for k in [-1, 1]:
tmp = []
for x, y, z in X:
tmp.append(i * x + j * y + k * z)
... | def main():
N, M = list(map(int, input().split()))
x = [0] * N
y = [0] * N
z = [0] * N
for i in range(N):
x[i], y[i], z[i] = list(map(int, input().split()))
ans = 0
for i in [-1, 1]:
for j in [-1, 1]:
for k in [-1, 1]:
cand_list = []
... | false | 43.333333 | [
"- X = [list(map(int, input().split())) for _ in range(N)]",
"+ x = [0] * N",
"+ y = [0] * N",
"+ z = [0] * N",
"+ for i in range(N):",
"+ x[i], y[i], z[i] = list(map(int, input().split()))",
"- tmp = []",
"- for x, y, z in X:",
"- ... | false | 0.044028 | 0.044542 | 0.988455 | [
"s225493065",
"s354859982"
] |
u505420467 | p03730 | python | s516028968 | s129340117 | 208 | 19 | 40,684 | 3,060 | Accepted | Accepted | 90.87 | a,b,c=list(map(int,input().split()))
for i in range(10**6):
if (i*b+c)%a==0:
print("YES")
exit()
print("NO")
| a, b, c = list(map(int, input().split()))
tmp = 0
for i in range(1, b + 1):
tmp = a * i
if tmp % b == c:
print("YES")
exit()
print("NO") | 6 | 8 | 128 | 161 | a, b, c = list(map(int, input().split()))
for i in range(10**6):
if (i * b + c) % a == 0:
print("YES")
exit()
print("NO")
| a, b, c = list(map(int, input().split()))
tmp = 0
for i in range(1, b + 1):
tmp = a * i
if tmp % b == c:
print("YES")
exit()
print("NO")
| false | 25 | [
"-for i in range(10**6):",
"- if (i * b + c) % a == 0:",
"+tmp = 0",
"+for i in range(1, b + 1):",
"+ tmp = a * i",
"+ if tmp % b == c:"
] | false | 0.081622 | 0.034178 | 2.388135 | [
"s516028968",
"s129340117"
] |
u282228874 | p03607 | python | s723119050 | s719917079 | 217 | 197 | 20,192 | 16,612 | Accepted | Accepted | 9.22 | from collections import Counter
n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
A = Counter(A)
num = []
for a in list(A.items()):
if a[1]%2 != 0:
num.append(a[0])
print((len(set(num)))) | from collections import Counter
n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
D = Counter(A)
res = 0
for v in list(D.values()):
if v%2 != 0:
res += 1
print(res) | 12 | 12 | 209 | 188 | from collections import Counter
n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
A = Counter(A)
num = []
for a in list(A.items()):
if a[1] % 2 != 0:
num.append(a[0])
print((len(set(num))))
| from collections import Counter
n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
D = Counter(A)
res = 0
for v in list(D.values()):
if v % 2 != 0:
res += 1
print(res)
| false | 0 | [
"-A = Counter(A)",
"-num = []",
"-for a in list(A.items()):",
"- if a[1] % 2 != 0:",
"- num.append(a[0])",
"-print((len(set(num))))",
"+D = Counter(A)",
"+res = 0",
"+for v in list(D.values()):",
"+ if v % 2 != 0:",
"+ res += 1",
"+print(res)"
] | false | 0.039473 | 0.048521 | 0.813536 | [
"s723119050",
"s719917079"
] |
u379692329 | p03476 | python | s861488404 | s997762035 | 564 | 437 | 23,148 | 23,572 | Accepted | Accepted | 22.52 | def prime(i):
if i == 2:
return True
else:
if i % 2 == 0:
return False
for j in range(3, int(i**0.5)+1, 2):
if i % j == 0:
return False
return True
Q = int(eval(input()))
l_r = [[int(_) for _ in input().split()] for _ in range(... | Q = int(eval(input()))
l_r = [[int(_) for _ in input().split()] for _ in range(Q)]
prime = [False]*(10**5+1)
Csum = [0]*(10**5+1)
for i in range(2, 10**5+1):
if not prime[i]:
for j in range(i*2, 10**5+1, i):
prime[j] = True
cnt = 0
for i in range(3, 10**5+1, 2):
if (not prime[i... | 23 | 18 | 508 | 433 | def prime(i):
if i == 2:
return True
else:
if i % 2 == 0:
return False
for j in range(3, int(i**0.5) + 1, 2):
if i % j == 0:
return False
return True
Q = int(eval(input()))
l_r = [[int(_) for _ in input().split()] for _ in range(Q)]
Csum ... | Q = int(eval(input()))
l_r = [[int(_) for _ in input().split()] for _ in range(Q)]
prime = [False] * (10**5 + 1)
Csum = [0] * (10**5 + 1)
for i in range(2, 10**5 + 1):
if not prime[i]:
for j in range(i * 2, 10**5 + 1, i):
prime[j] = True
cnt = 0
for i in range(3, 10**5 + 1, 2):
if (not prime... | false | 21.73913 | [
"-def prime(i):",
"- if i == 2:",
"- return True",
"- else:",
"- if i % 2 == 0:",
"- return False",
"- for j in range(3, int(i**0.5) + 1, 2):",
"- if i % j == 0:",
"- return False",
"- return True",
"-",
"-",
"+prime = [F... | false | 0.535026 | 0.154772 | 3.456872 | [
"s861488404",
"s997762035"
] |
u021019433 | p02768 | python | s885108687 | s727223260 | 1,496 | 113 | 5,468 | 3,060 | Accepted | Accepted | 92.45 | from math import factorial
M = 10**9 + 7
n, a, b = list(map(int, input().split()))
r = pow(2, n, M) - 1
c = 1
for i in range(b):
c = c * (n - i) % M
if i + 1 == a:
r -= c * pow(factorial(a) % M, M - 2, M)
a = b
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 i + 1 == a:
a = b
r -= c * pow(f, M - 2, M)
print((r % M))
| 12 | 11 | 243 | 224 | from math import factorial
M = 10**9 + 7
n, a, b = list(map(int, input().split()))
r = pow(2, n, M) - 1
c = 1
for i in range(b):
c = c * (n - i) % M
if i + 1 == a:
r -= c * pow(factorial(a) % M, M - 2, M)
a = b
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 i + 1 == a:
a = b
r -= c * pow(f, M - 2, M)
print((r % M))
| false | 8.333333 | [
"-from math import factorial",
"-",
"-c = 1",
"+f = c = 1",
"+ f = f * (i + 1) % M",
"- r -= c * pow(factorial(a) % M, M - 2, M)",
"+ r -= c * pow(f, M - 2, M)"
] | false | 0.473692 | 0.102499 | 4.621428 | [
"s885108687",
"s727223260"
] |
u792720861 | p03860 | python | s809844031 | s764797303 | 26 | 24 | 8,920 | 9,024 | Accepted | Accepted | 7.69 | print(('A' + input().split()[1][0] + 'C'))
| a = input().split()
print(*[h[0] for h in a], sep='')
| 1 | 2 | 41 | 55 | print(("A" + input().split()[1][0] + "C"))
| a = input().split()
print(*[h[0] for h in a], sep="")
| false | 50 | [
"-print((\"A\" + input().split()[1][0] + \"C\"))",
"+a = input().split()",
"+print(*[h[0] for h in a], sep=\"\")"
] | false | 0.03619 | 0.090983 | 0.39776 | [
"s809844031",
"s764797303"
] |
u561083515 | p03031 | python | s238698574 | s886838252 | 200 | 36 | 41,968 | 3,064 | Accepted | Accepted | 82 | N,M = list(map(int,input().split()))
k = [0] * M
s = [0] * M
for i in range(M):
ks = list(map(int,input().split()))
for j,x in enumerate(ks):
if j == 0:
k[i] = x
continue
s[i] += 1 << x-1
p = [int(i) for i in input().split()]
answer = 0
for i in range(2**N):... | N,M = list(map(int,input().split()))
S = []
for _ in range(M):
INPUT = tuple(map(int,input().split()))
S.append(INPUT[1:])
P = [int(i) for i in input().split()]
ans = 0
for i in range(2**N):
# state[i]: スイッチiがon
state = [False] * N
for j in range(N):
if 1 & (i >> j):
... | 33 | 29 | 705 | 601 | N, M = list(map(int, input().split()))
k = [0] * M
s = [0] * M
for i in range(M):
ks = list(map(int, input().split()))
for j, x in enumerate(ks):
if j == 0:
k[i] = x
continue
s[i] += 1 << x - 1
p = [int(i) for i in input().split()]
answer = 0
for i in range(2**N):
cou... | N, M = list(map(int, input().split()))
S = []
for _ in range(M):
INPUT = tuple(map(int, input().split()))
S.append(INPUT[1:])
P = [int(i) for i in input().split()]
ans = 0
for i in range(2**N):
# state[i]: スイッチiがon
state = [False] * N
for j in range(N):
if 1 & (i >> j):
state[j] ... | false | 12.121212 | [
"-k = [0] * M",
"-s = [0] * M",
"-for i in range(M):",
"- ks = list(map(int, input().split()))",
"- for j, x in enumerate(ks):",
"- if j == 0:",
"- k[i] = x",
"- continue",
"- s[i] += 1 << x - 1",
"-p = [int(i) for i in input().split()]",
"-answer = 0",
... | false | 0.045224 | 0.039397 | 1.147896 | [
"s238698574",
"s886838252"
] |
u843175622 | p03732 | python | s042599068 | s296671201 | 388 | 352 | 3,064 | 3,316 | Accepted | Accepted | 9.28 | 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()))
V=[[] for _ in [0]*4]
for i in range(N):V[w[i]-w[0]].append(v[i])
for i in range(4):
V[i].sort(reverse=True)
for j in range(len(V[i])-1):V[i][j+1]+=V[i][j]
V[i].insert(0,0)
a=0
for i in ... | from collections import defaultdict
from itertools import accumulate
N, W = list(map(int, input().split()))
w = [0] * N; v = [0] * N
d = defaultdict(list)
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
d[w[i]].append(v[i])
for i in range(4):
d[w[0]+i].sort(reverse=True)
d[w[... | 17 | 23 | 559 | 730 | 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()))
V = [[] for _ in [0] * 4]
for i in range(N):
V[w[i] - w[0]].append(v[i])
for i in range(4):
V[i].sort(reverse=True)
for j in range(len(V[i]) - 1):
V[i][j + 1] += V[i][j]... | from collections import defaultdict
from itertools import accumulate
N, W = list(map(int, input().split()))
w = [0] * N
v = [0] * N
d = defaultdict(list)
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
d[w[i]].append(v[i])
for i in range(4):
d[w[0] + i].sort(reverse=True)
d[w[0] + i].in... | false | 26.086957 | [
"+from collections import defaultdict",
"+from itertools import accumulate",
"+",
"+d = defaultdict(list)",
"-V = [[] for _ in [0] * 4]",
"-for i in range(N):",
"- V[w[i] - w[0]].append(v[i])",
"+ d[w[i]].append(v[i])",
"- V[i].sort(reverse=True)",
"- for j in range(len(V[i]) - 1):",
... | false | 0.050725 | 0.051113 | 0.992403 | [
"s042599068",
"s296671201"
] |
u827202523 | p03795 | python | s243385802 | s760126750 | 80 | 70 | 65,708 | 65,748 | Accepted | Accepted | 12.5 | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = ... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lam... | 56 | 55 | 1,207 | 1,045 | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(i... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int... | false | 1.785714 | [
"+import heapq",
"-# import heapq",
"-def search(pros, tgt, g, d):",
"- tmp = 0",
"- cnt = 0",
"- rest = []",
"- for i in range(d):",
"- if tgt % 2 == 1:",
"- tmp += 100 * (i + 1) * pros[i][0] + pros[i][1]",
"- cnt += pros[i][0]",
"- else:",
"- ... | false | 0.052198 | 0.047202 | 1.10584 | [
"s243385802",
"s760126750"
] |
u835907423 | p03493 | python | s938997632 | s239869462 | 23 | 17 | 3,188 | 2,940 | Accepted | Accepted | 26.09 | import re
a = eval(input())
regex = '^(\d)(\d)(\d)'
s1 = int(re.sub(regex, r'\1', a))
s2 = int(re.sub(regex, r'\2', a))
s3 = int(re.sub(regex, r'\3', a))
i = 0
if s1 == 1:
i += 1
if s2 == 1:
i += 1
if s3 == 1:
i += 1
print(i) | d = list(eval(input()))
i = 0
if d[0] == '1': i += 1
if d[1] == '1': i += 1
if d[2] == '1': i += 1
print(i) | 14 | 6 | 244 | 106 | import re
a = eval(input())
regex = "^(\d)(\d)(\d)"
s1 = int(re.sub(regex, r"\1", a))
s2 = int(re.sub(regex, r"\2", a))
s3 = int(re.sub(regex, r"\3", a))
i = 0
if s1 == 1:
i += 1
if s2 == 1:
i += 1
if s3 == 1:
i += 1
print(i)
| d = list(eval(input()))
i = 0
if d[0] == "1":
i += 1
if d[1] == "1":
i += 1
if d[2] == "1":
i += 1
print(i)
| false | 57.142857 | [
"-import re",
"-",
"-a = eval(input())",
"-regex = \"^(\\d)(\\d)(\\d)\"",
"-s1 = int(re.sub(regex, r\"\\1\", a))",
"-s2 = int(re.sub(regex, r\"\\2\", a))",
"-s3 = int(re.sub(regex, r\"\\3\", a))",
"+d = list(eval(input()))",
"-if s1 == 1:",
"+if d[0] == \"1\":",
"-if s2 == 1:",
"+if d[1] == \"... | false | 0.045709 | 0.081828 | 0.558594 | [
"s938997632",
"s239869462"
] |
u426534722 | p02241 | python | s658478414 | s197853134 | 30 | 20 | 7,872 | 7,860 | Accepted | Accepted | 33.33 | from sys import stdin
INF = float('inf')
WHITE, GRAY, BLACK = 0, 1, 2
n = int(stdin.readline())
M = [[INF] * n for _ in range(n)]
for i in range(0, n):
for j, e in enumerate(list(map(int, stdin.readline().split()))):
if e != -1: M[i][j] = e
d = [INF] * n
d[0] = 0
color = [0] * n
def prim():
... | from sys import stdin
INF = 1<<21
WHITE, GRAY, BLACK = 0, 1, 2
n = int(stdin.readline())
M = [[INF] * n for _ in range(n)]
for i in range(0, n):
for j, e in enumerate(list(map(int, stdin.readline().split()))):
if e != -1: M[i][j] = e
d = [INF] * n
d[0] = 0
color = [0] * n
def prim():
while T... | 26 | 26 | 705 | 698 | from sys import stdin
INF = float("inf")
WHITE, GRAY, BLACK = 0, 1, 2
n = int(stdin.readline())
M = [[INF] * n for _ in range(n)]
for i in range(0, n):
for j, e in enumerate(list(map(int, stdin.readline().split()))):
if e != -1:
M[i][j] = e
d = [INF] * n
d[0] = 0
color = [0] * n
def prim():
... | from sys import stdin
INF = 1 << 21
WHITE, GRAY, BLACK = 0, 1, 2
n = int(stdin.readline())
M = [[INF] * n for _ in range(n)]
for i in range(0, n):
for j, e in enumerate(list(map(int, stdin.readline().split()))):
if e != -1:
M[i][j] = e
d = [INF] * n
d[0] = 0
color = [0] * n
def prim():
wh... | false | 0 | [
"-INF = float(\"inf\")",
"+INF = 1 << 21"
] | false | 0.043188 | 0.045231 | 0.954832 | [
"s658478414",
"s197853134"
] |
u562935282 | p02873 | python | s561541089 | s987808858 | 235 | 195 | 49,224 | 46,448 | Accepted | Accepted | 17.02 | # import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())
def solve(s):
n = len(s)
t = [-1] * n
if s[0] == '<':
t[0] = 0
if s[-1] == '>':
t[-1] == 0
for ind, (prev, after) in enumerate(z... | s = eval(input())
n = len(s)
a = [0] * (n + 1)
for i in range(n):
if s[i] == '<':
a[i + 1] = max(a[i + 1], a[i] + 1)
for i in range(n - 1, -1, -1):
if s[i] == '>':
a[i] = max(a[i], a[i + 1] + 1)
print((sum(a)))
| 47 | 14 | 965 | 244 | # import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())
def solve(s):
n = len(s)
t = [-1] * n
if s[0] == "<":
t[0] = 0
if s[-1] == ">":
t[-1] == 0
for ind, (prev, after) in enumerate(zip(s, s[1:])):
... | s = eval(input())
n = len(s)
a = [0] * (n + 1)
for i in range(n):
if s[i] == "<":
a[i + 1] = max(a[i + 1], a[i] + 1)
for i in range(n - 1, -1, -1):
if s[i] == ">":
a[i] = max(a[i], a[i + 1] + 1)
print((sum(a)))
| false | 70.212766 | [
"-# import sys",
"-#",
"-# sys.setrecursionlimit(10 ** 7)",
"-#",
"-# input = sys.stdin.readline",
"-# rstrip()",
"-# int(input())",
"-# map(int, input().split())",
"-def solve(s):",
"- n = len(s)",
"- t = [-1] * n",
"- if s[0] == \"<\":",
"- t[0] = 0",
"- if s[-1] == \"... | false | 0.043414 | 0.039114 | 1.109941 | [
"s561541089",
"s987808858"
] |
u077291787 | p03588 | python | s963129639 | s554791678 | 256 | 181 | 16,992 | 25,940 | Accepted | Accepted | 29.3 | # tenka1-2017-beginnerB - Different Distribution
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = sorted(tuple(map(int, input().rstrip().split())) for _ in range(n))
print((A[-1][0] + A[-1][1]))
if __name__ == "__main__":
main() | # tenka1-2017-beginnerB - Different Distribution
def main():
N, *AB = list(map(int, open(0).read().split()))
A = [(i, j) for i, j in zip(*[iter(AB)] * 2)]
A.sort()
ans = sum(A[-1])
print(ans)
if __name__ == "__main__":
main() | 12 | 11 | 278 | 255 | # tenka1-2017-beginnerB - Different Distribution
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = sorted(tuple(map(int, input().rstrip().split())) for _ in range(n))
print((A[-1][0] + A[-1][1]))
if __name__ == "__main__":
main()
| # tenka1-2017-beginnerB - Different Distribution
def main():
N, *AB = list(map(int, open(0).read().split()))
A = [(i, j) for i, j in zip(*[iter(AB)] * 2)]
A.sort()
ans = sum(A[-1])
print(ans)
if __name__ == "__main__":
main()
| false | 8.333333 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"- n = int(eval(input()))",
"- A = sorted(tuple(map(int, input().rstrip().split())) for _ in range(n))",
"- print((A[-1][0] + A[-1][1]))",
"+ N, *AB = list(map(int, open(0).read().split()))",
"+ A = [(i, j) for i, j in zip... | false | 0.036315 | 0.036616 | 0.991792 | [
"s963129639",
"s554791678"
] |
u146803137 | p02547 | python | s877680088 | s471841851 | 33 | 29 | 9,348 | 9,204 | Accepted | Accepted | 12.12 | import math
ini = lambda : int(eval(input()))
inm = lambda : list(map(int,input().split()))
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
c... | import math
ini = lambda : int(eval(input()))
inm = lambda : list(map(int,input().split()))
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
c... | 92 | 92 | 2,233 | 2,330 | import math
ini = lambda: int(eval(input()))
inm = lambda: list(map(int, input().split()))
inl = lambda: list(map(int, input().split()))
gcd = lambda x, y: gcd(y, x % y) if x % y else y
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-(n**0.5) // 1)) + 1):
if temp % i == 0:
... | import math
ini = lambda: int(eval(input()))
inm = lambda: list(map(int, input().split()))
inl = lambda: list(map(int, input().split()))
gcd = lambda x, y: gcd(y, x % y) if x % y else y
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-(n**0.5) // 1)) + 1):
if temp % i == 0:
... | false | 0 | [
"-n = ini()",
"+n = int(eval(input()))",
"+x = [0 for i in range(n)]",
"+y = [0 for i in range(n)]",
"-c = 0",
"- a, b = inm()",
"- if a == b:",
"- c += 1",
"- else:",
"- c = 0",
"- if c >= 3:",
"+ x[i], y[i] = list(map(int, input().split()))",
"+for i in range(n... | false | 0.045324 | 0.048356 | 0.937298 | [
"s877680088",
"s471841851"
] |
u874644572 | p02599 | python | s321662766 | s862067546 | 1,708 | 1,562 | 248,716 | 248,656 | Accepted | Accepted | 8.55 | I=lambda:list(map(int,input().split()))
N=0xfffff
n,q=I()
c=list(I())
Q=[]
for i in range(q):l,r=I();Q.append(l<<40|r<<20|i)
Q.sort()
A=[[]for i in range(N)]
for i,x in enumerate(c):A[x].append(i)
B=[0]*N
def P(i,x):
i+=1
while i<=n:B[i]+=x;i+=i&-i
def G(i):
s=0
while i:s+=B[i];i-=i&-i
return s
fo... | I=lambda:list(map(int,input().split()))
N=0xfffff
n,q=I()
c=list(I())
Q=[]
for i in range(q):l,r=I();Q.append(l<<40|r<<20|i)
Q.sort()
A=[[]for i in range(N)]
for i in range(n):A[c[i]].append(i)
B=[0]*N
def P(i,x):
i+=1
while i<=n:B[i]+=x;i+=i&-i
def G(i):
s=0
while i:s+=B[i];i-=i&-i
return s
for i... | 33 | 33 | 530 | 527 | I = lambda: list(map(int, input().split()))
N = 0xFFFFF
n, q = I()
c = list(I())
Q = []
for i in range(q):
l, r = I()
Q.append(l << 40 | r << 20 | i)
Q.sort()
A = [[] for i in range(N)]
for i, x in enumerate(c):
A[x].append(i)
B = [0] * N
def P(i, x):
i += 1
while i <= n:
B[i] += x
... | I = lambda: list(map(int, input().split()))
N = 0xFFFFF
n, q = I()
c = list(I())
Q = []
for i in range(q):
l, r = I()
Q.append(l << 40 | r << 20 | i)
Q.sort()
A = [[] for i in range(N)]
for i in range(n):
A[c[i]].append(i)
B = [0] * N
def P(i, x):
i += 1
while i <= n:
B[i] += x
i +... | false | 0 | [
"-for i, x in enumerate(c):",
"- A[x].append(i)",
"+for i in range(n):",
"+ A[c[i]].append(i)"
] | false | 0.981075 | 1.148654 | 0.854109 | [
"s321662766",
"s862067546"
] |
u785578220 | p02594 | python | s180249583 | s177204404 | 29 | 26 | 9,156 | 9,056 | Accepted | Accepted | 10.34 | a = int(eval(input()))
if a >= 30 :
print("Yes")
else:print("No") | a = int(eval(input()))
ans = "Yes" if a>= 30 else "No"
print(ans) | 4 | 3 | 66 | 61 | a = int(eval(input()))
if a >= 30:
print("Yes")
else:
print("No")
| a = int(eval(input()))
ans = "Yes" if a >= 30 else "No"
print(ans)
| false | 25 | [
"-if a >= 30:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+ans = \"Yes\" if a >= 30 else \"No\"",
"+print(ans)"
] | false | 0.046663 | 0.110585 | 0.421967 | [
"s180249583",
"s177204404"
] |
u222668979 | p02691 | python | s160842136 | s079484100 | 233 | 211 | 62,856 | 61,328 | Accepted | Accepted | 9.44 | import sys
input = sys.stdin.readline
def RunLengthEncoding(list):
dict = {}
for i in list:
if i in list(dict.keys()):
dict[i] += 1
else:
dict[i] = 1
return dict
n = int(eval(input()))
a = list(map(int, input().split()))
minus = [i-a[i] for i in ra... | import sys
input = sys.stdin.readline
def rle(list):
dict = {}
for i in list:
if i in list(dict.keys()):
dict[i] += 1
else:
dict[i] = 1
return dict
n = int(eval(input()))
a = list(map(int, input().split()))
minus = rle([i-a[i] for i in range(n)])
... | 26 | 24 | 533 | 441 | import sys
input = sys.stdin.readline
def RunLengthEncoding(list):
dict = {}
for i in list:
if i in list(dict.keys()):
dict[i] += 1
else:
dict[i] = 1
return dict
n = int(eval(input()))
a = list(map(int, input().split()))
minus = [i - a[i] for i in range(n)]
plus ... | import sys
input = sys.stdin.readline
def rle(list):
dict = {}
for i in list:
if i in list(dict.keys()):
dict[i] += 1
else:
dict[i] = 1
return dict
n = int(eval(input()))
a = list(map(int, input().split()))
minus = rle([i - a[i] for i in range(n)])
plus = rle([i ... | false | 7.692308 | [
"-def RunLengthEncoding(list):",
"+def rle(list):",
"-minus = [i - a[i] for i in range(n)]",
"-plus = [i + a[i] for i in range(n)]",
"-minus_cnt = RunLengthEncoding(minus)",
"-plus_cnt = RunLengthEncoding(plus)",
"+minus = rle([i - a[i] for i in range(n)])",
"+plus = rle([i + a[i] for i in range(n)])"... | false | 0.046975 | 0.048173 | 0.975133 | [
"s160842136",
"s079484100"
] |
u272525952 | p02817 | python | s386426741 | s296399114 | 172 | 26 | 38,384 | 9,072 | Accepted | Accepted | 84.88 | s,t=list(map(str,input().split()))
print((t+s))
| s,t=input().split()
print((t+s)) | 2 | 2 | 41 | 31 | s, t = list(map(str, input().split()))
print((t + s))
| s, t = input().split()
print((t + s))
| false | 0 | [
"-s, t = list(map(str, input().split()))",
"+s, t = input().split()"
] | false | 0.076378 | 0.054353 | 1.405226 | [
"s386426741",
"s296399114"
] |
u054514819 | p02983 | python | s005807588 | s390245068 | 612 | 71 | 75,332 | 66,888 | Accepted | Accepted | 88.4 | L, R = list(map(int, input().split()))
if R-L>2019:
print((0))
else:
lis = []
for i in range(L, R):
for j in range(i+1, R+1):
lis.append((i*j)%2019)
print((min(lis))) | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
L, R = mapint()
lis = []
for i in range(L, min(R+1, L+2101)):
lis.append(i)
leng = len(lis)
ans = 10**18
for i in range(leng-1):
a = lis[i]
for j in... | 10 | 19 | 202 | 400 | L, R = list(map(int, input().split()))
if R - L > 2019:
print((0))
else:
lis = []
for i in range(L, R):
for j in range(i + 1, R + 1):
lis.append((i * j) % 2019)
print((min(lis)))
| import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
L, R = mapint()
lis = []
for i in range(L, min(R + 1, L + 2101)):
lis.append(i)
leng = len(lis)
ans = 10**18
for i in range(leng - 1):
a = lis[i]
for j ... | false | 47.368421 | [
"-L, R = list(map(int, input().split()))",
"-if R - L > 2019:",
"- print((0))",
"-else:",
"- lis = []",
"- for i in range(L, R):",
"- for j in range(i + 1, R + 1):",
"- lis.append((i * j) % 2019)",
"- print((min(lis)))",
"+import sys",
"+",
"+",
"+def input():",... | false | 0.126983 | 0.160095 | 0.793169 | [
"s005807588",
"s390245068"
] |
u678167152 | p03231 | python | s105633495 | s020568238 | 44 | 28 | 5,360 | 9,224 | Accepted | Accepted | 36.36 | N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
from fractions import gcd
def solve(N,M,S,T):
g = gcd(N,M)
for i in range(g):
if S[N//g*i]!=T[M//g*i]:
return -1
ans = N*M//g
return ans
print((solve(N,M,S,T))) | from math import gcd
def solve():
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
g = gcd(N,M)
ans = N*M//g
for i in range(g):
if S[N//g*i]!=T[M//g*i]:
return -1
return ans
print((solve())) | 14 | 12 | 266 | 231 | N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
from fractions import gcd
def solve(N, M, S, T):
g = gcd(N, M)
for i in range(g):
if S[N // g * i] != T[M // g * i]:
return -1
ans = N * M // g
return ans
print((solve(N, M, S, T)))
| from math import gcd
def solve():
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
g = gcd(N, M)
ans = N * M // g
for i in range(g):
if S[N // g * i] != T[M // g * i]:
return -1
return ans
print((solve()))
| false | 14.285714 | [
"-N, M = list(map(int, input().split()))",
"-S = eval(input())",
"-T = eval(input())",
"-from fractions import gcd",
"+from math import gcd",
"-def solve(N, M, S, T):",
"+def solve():",
"+ N, M = list(map(int, input().split()))",
"+ S = eval(input())",
"+ T = eval(input())",
"+ ans =... | false | 0.044189 | 0.103381 | 0.427442 | [
"s105633495",
"s020568238"
] |
u579699847 | p02732 | python | s629611349 | s344146835 | 1,672 | 337 | 121,264 | 26,780 | Accepted | Accepted | 79.84 | import bisect,collections,copy,itertools,math,string
def I(): return int(eval(input()))
def S(): return eval(input())
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
N = I()
A = LI()
_123 = [0]*N
_123count = [0]*N
for x ... | import collections
def I(): return int(eval(input()))
def LI(): return list(map(int,input().split()))
##################################################
N = I()
A = LI()
count = collections.Counter(A)
sum = 0
for x in list(count.values()):
sum += x*(x-1)//2
for x in A:
print((sum-(count[x]-1))) | 44 | 12 | 1,350 | 300 | import bisect, collections, copy, itertools, math, string
def I():
return int(eval(input()))
def S():
return eval(input())
def LI():
return list(map(int, input().split()))
def LS():
return list(input().split())
##################################################
N = I()
A = LI()
_123 = [0] * N
... | import collections
def I():
return int(eval(input()))
def LI():
return list(map(int, input().split()))
##################################################
N = I()
A = LI()
count = collections.Counter(A)
sum = 0
for x in list(count.values()):
sum += x * (x - 1) // 2
for x in A:
print((sum - (count[x... | false | 72.727273 | [
"-import bisect, collections, copy, itertools, math, string",
"+import collections",
"-def S():",
"- return eval(input())",
"-",
"-",
"-",
"-",
"-def LS():",
"- return list(input().split())",
"-_123 = [0] * N",
"-_123count = [0] * N",
"+count = collections.Counter(A)",
"+sum = 0",
... | false | 0.044968 | 0.045468 | 0.988997 | [
"s629611349",
"s344146835"
] |
u620945921 | p03243 | python | s799930756 | s046599466 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | n=int(eval(input()))
ans=999
for i in range(n,1000):
if i%111==0:
if i<=ans:
ans=i
print(ans)
| n=int(eval(input()))
if n%111==0:
ans=n
else:
while n%111>0:
n+=1
ans=n
print(ans)
| 9 | 11 | 116 | 106 | n = int(eval(input()))
ans = 999
for i in range(n, 1000):
if i % 111 == 0:
if i <= ans:
ans = i
print(ans)
| n = int(eval(input()))
if n % 111 == 0:
ans = n
else:
while n % 111 > 0:
n += 1
ans = n
print(ans)
| false | 18.181818 | [
"-ans = 999",
"-for i in range(n, 1000):",
"- if i % 111 == 0:",
"- if i <= ans:",
"- ans = i",
"+if n % 111 == 0:",
"+ ans = n",
"+else:",
"+ while n % 111 > 0:",
"+ n += 1",
"+ ans = n"
] | false | 0.039045 | 0.037192 | 1.049814 | [
"s799930756",
"s046599466"
] |
u219197917 | p03013 | python | s788243758 | s086267659 | 159 | 76 | 9,616 | 17,540 | Accepted | Accepted | 52.2 | import sys
def input():
return sys.stdin.readline().rstrip()
mod = 10**9 + 7
n, m = [int(i) for i in input().split()]
a = [int(eval(input())) for _ in range(m)]
notin = [1] * n
for i in a:
notin[i] = 0
dp = [0] * n
dp[n - 1] = 1
if n > 1:
dp[n - 2] = 1 + notin[n - 1]
for i in range(n - 3, -1, -1):
... | import sys
def read():
return sys.stdin.readline().rstrip()
def main():
n, m = list(map(int, read().split()))
a = {int(read()) - 1 for _ in range(m)}
if n == 1:
print((1))
return
mod = 10**9 + 7
dp = [0] * n
if 0 not in a:
dp[0] = 1
if 1 not i... | 18 | 28 | 426 | 523 | import sys
def input():
return sys.stdin.readline().rstrip()
mod = 10**9 + 7
n, m = [int(i) for i in input().split()]
a = [int(eval(input())) for _ in range(m)]
notin = [1] * n
for i in a:
notin[i] = 0
dp = [0] * n
dp[n - 1] = 1
if n > 1:
dp[n - 2] = 1 + notin[n - 1]
for i in range(n - 3, -1, -1):
d... | import sys
def read():
return sys.stdin.readline().rstrip()
def main():
n, m = list(map(int, read().split()))
a = {int(read()) - 1 for _ in range(m)}
if n == 1:
print((1))
return
mod = 10**9 + 7
dp = [0] * n
if 0 not in a:
dp[0] = 1
if 1 not in a:
dp[1... | false | 35.714286 | [
"-def input():",
"+def read():",
"-mod = 10**9 + 7",
"-n, m = [int(i) for i in input().split()]",
"-a = [int(eval(input())) for _ in range(m)]",
"-notin = [1] * n",
"-for i in a:",
"- notin[i] = 0",
"-dp = [0] * n",
"-dp[n - 1] = 1",
"-if n > 1:",
"- dp[n - 2] = 1 + notin[n - 1]",
"-fo... | false | 0.061559 | 0.037687 | 1.633446 | [
"s788243758",
"s086267659"
] |
u844945939 | p00881 | python | s570525710 | s183187505 | 4,250 | 3,630 | 72,584 | 15,080 | Accepted | Accepted | 14.59 | from collections import Counter
while True:
m, n = (int(s) for s in input().split())
if not m:
break
objs = [int(eval(input()), 2) for i in range(n)]
dp = [[0] * (1 << m) for i in range(1 << m)]
bits = [1 << i for i in range(m)]
for mask in reversed(list(range(1 << m))):
... | from collections import Counter
while True:
m, n = (int(s) for s in input().split())
if not m:
break
objs = [int(eval(input()), 2) for i in range(n)]
dp = [bytearray(1 << m) for i in range(1 << m)]
bits = [1 << i for i in range(m)]
for mask in reversed(list(range((1 << m)... | 20 | 20 | 656 | 665 | from collections import Counter
while True:
m, n = (int(s) for s in input().split())
if not m:
break
objs = [int(eval(input()), 2) for i in range(n)]
dp = [[0] * (1 << m) for i in range(1 << m)]
bits = [1 << i for i in range(m)]
for mask in reversed(list(range(1 << m))):
s = Cou... | from collections import Counter
while True:
m, n = (int(s) for s in input().split())
if not m:
break
objs = [int(eval(input()), 2) for i in range(n)]
dp = [bytearray(1 << m) for i in range(1 << m)]
bits = [1 << i for i in range(m)]
for mask in reversed(list(range((1 << m) - 1))):
... | false | 0 | [
"- dp = [[0] * (1 << m) for i in range(1 << m)]",
"+ dp = [bytearray(1 << m) for i in range(1 << m)]",
"- for mask in reversed(list(range(1 << m))):",
"+ for mask in reversed(list(range((1 << m) - 1))):",
"- for masked, value in list(s.items()):",
"- if value > 1:",
"+ ... | false | 0.036662 | 0.036564 | 1.002685 | [
"s570525710",
"s183187505"
] |
u645250356 | p02821 | python | s023816074 | s799414232 | 1,565 | 493 | 86,084 | 93,312 | Accepted | Accepted | 68.5 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 40 | 37 | 927 | 896 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 7.5 | [
"-from heapq import heappop, heappush, heapify",
"-import sys, bisect, math, itertools, fractions, pprint",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"-a = sorted(inpl())",
"-ng = 10**9 + 1",
"-ok = -1",
... | false | 0.045288 | 0.112015 | 0.404306 | [
"s023816074",
"s799414232"
] |
u111365362 | p02939 | python | s165887512 | s825854802 | 103 | 85 | 3,500 | 11,492 | Accepted | Accepted | 17.48 | s = eval(input())
n = len(s)
ans = 1
last = s[0]
i = 1
while i < n:
if len(last) == 2:
last = s[i]
i += 1
else:
if s[i] != last:
last = s[i]
i += 1
else:
if i != n-1:
last = s[i:i+2]
i += 2
else:
break
ans += 1
#print(last,ans)
... | #15:00(2)
s = eval(input())
n = len(s)
dp = [-1,0,1]
for i in range(1,n):
if s[i-1] != s[i]:
dp.append(dp[-1]+1)
else:
dp.append(dp[-3]+2)
print((dp[-1])) | 22 | 10 | 325 | 167 | s = eval(input())
n = len(s)
ans = 1
last = s[0]
i = 1
while i < n:
if len(last) == 2:
last = s[i]
i += 1
else:
if s[i] != last:
last = s[i]
i += 1
else:
if i != n - 1:
last = s[i : i + 2]
i += 2
else... | # 15:00(2)
s = eval(input())
n = len(s)
dp = [-1, 0, 1]
for i in range(1, n):
if s[i - 1] != s[i]:
dp.append(dp[-1] + 1)
else:
dp.append(dp[-3] + 2)
print((dp[-1]))
| false | 54.545455 | [
"+# 15:00(2)",
"-ans = 1",
"-last = s[0]",
"-i = 1",
"-while i < n:",
"- if len(last) == 2:",
"- last = s[i]",
"- i += 1",
"+dp = [-1, 0, 1]",
"+for i in range(1, n):",
"+ if s[i - 1] != s[i]:",
"+ dp.append(dp[-1] + 1)",
"- if s[i] != last:",
"- ... | false | 0.045935 | 0.046808 | 0.98135 | [
"s165887512",
"s825854802"
] |
u858748695 | p03017 | python | s305359016 | s239609478 | 111 | 36 | 4,984 | 3,572 | Accepted | Accepted | 67.57 | #!/usr/bin/env python3
n, a, b, c, d = [int(x) - 1 for x in input().split()]
s = list(eval(input()))
if d < c:
s[b] = 'b'
while a < b:
if a + 1 <= c and s[a + 1] == '.':
a += 1
elif a + 2 <= c and s[a + 2] == '.':
a += 2
elif b < d:
if b +... | #!/usr/bin/env python3
n, a, b, c, d = [int(x) - 1 for x in input().split()]
s = eval(input())
if d < c:
f = False
for i in range(n)[b:d + 1]:
if '...' in s[i - 1:i + 2]:
f = True
if not f:
print('No')
exit()
a, b = b, a
c, d = d, c
print((['Yes', '... | 45 | 15 | 1,098 | 344 | #!/usr/bin/env python3
n, a, b, c, d = [int(x) - 1 for x in input().split()]
s = list(eval(input()))
if d < c:
s[b] = "b"
while a < b:
if a + 1 <= c and s[a + 1] == ".":
a += 1
elif a + 2 <= c and s[a + 2] == ".":
a += 2
elif b < d:
if b + 1 <= d and s... | #!/usr/bin/env python3
n, a, b, c, d = [int(x) - 1 for x in input().split()]
s = eval(input())
if d < c:
f = False
for i in range(n)[b : d + 1]:
if "..." in s[i - 1 : i + 2]:
f = True
if not f:
print("No")
exit()
a, b = b, a
c, d = d, c
print((["Yes", "No"]["##" i... | false | 66.666667 | [
"-s = list(eval(input()))",
"+s = eval(input())",
"- s[b] = \"b\"",
"- while a < b:",
"- if a + 1 <= c and s[a + 1] == \".\":",
"- a += 1",
"- elif a + 2 <= c and s[a + 2] == \".\":",
"- a += 2",
"- elif b < d:",
"- if b + 1 <= d and s[b ... | false | 0.035218 | 0.037675 | 0.934768 | [
"s305359016",
"s239609478"
] |
u844646164 | p03659 | python | s143258639 | s758110570 | 208 | 159 | 24,832 | 30,544 | Accepted | Accepted | 23.56 | n = int(eval(input()))
a = list(map(int, input().split()))
cumsum = [a[0]]
for i in range(len(a)-1):
cumsum.append(cumsum[i] + a[i+1])
min = float('inf')
for i in range(len(cumsum)-1):
f1 = cumsum[i]
f2 = cumsum[-1] - cumsum[i]
d = abs(f1 - f2)
if min > d:
min = d
print(min) | N = int(eval(input()))
a = list(map(int, input().split()))
sa = a[:]
for i in range(N-1):
sa[i+1] += sa[i]
diff = float('inf')
for i in range(N-1):
if abs(sa[i] - (sa[-1] - sa[i])) < diff:
diff = abs(sa[i] - (sa[-1] - sa[i]))
print(diff) | 15 | 12 | 300 | 252 | n = int(eval(input()))
a = list(map(int, input().split()))
cumsum = [a[0]]
for i in range(len(a) - 1):
cumsum.append(cumsum[i] + a[i + 1])
min = float("inf")
for i in range(len(cumsum) - 1):
f1 = cumsum[i]
f2 = cumsum[-1] - cumsum[i]
d = abs(f1 - f2)
if min > d:
min = d
print(min)
| N = int(eval(input()))
a = list(map(int, input().split()))
sa = a[:]
for i in range(N - 1):
sa[i + 1] += sa[i]
diff = float("inf")
for i in range(N - 1):
if abs(sa[i] - (sa[-1] - sa[i])) < diff:
diff = abs(sa[i] - (sa[-1] - sa[i]))
print(diff)
| false | 20 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-cumsum = [a[0]]",
"-for i in range(len(a) - 1):",
"- cumsum.append(cumsum[i] + a[i + 1])",
"-min = float(\"inf\")",
"-for i in range(len(cumsum) - 1):",
"- f1 = cumsum[i]",
"- f2 = cumsum[-1] - cumsum[i]",
"- d = abs(f1 - f2)",
... | false | 0.038137 | 0.0411 | 0.927909 | [
"s143258639",
"s758110570"
] |
u013629972 | p03089 | python | s211963576 | s594009969 | 394 | 315 | 65,644 | 66,924 | Accepted | Accepted | 20.05 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
d... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
d... | 36 | 37 | 1,078 | 1,080 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI... | false | 2.702703 | [
"- del b[-i]",
"+ b.pop(-i)"
] | false | 0.041456 | 0.042315 | 0.97971 | [
"s211963576",
"s594009969"
] |
u583507988 | p03262 | python | s096406101 | s505256213 | 139 | 87 | 20,516 | 20,300 | Accepted | Accepted | 37.41 | from math import gcd
n, x = list(map(int, input().split()))
m = [x]+list(map(int, input().split()))
m.sort()
if n==1:
print((m[1]-m[0]))
else:
res = gcd(m[1]-m[0], m[2]-m[1])
for i in range(1, n-1):
a = m[i+1]-m[i]
b = m[i+2]-m[i+1]
if res >= gcd(a,b):
if res%gcd(a,b)==0:
... | import math
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))+[a]
x.sort()
if n==1:
print((abs(x[0]-x[1])))
exit()
res=x[1]-x[0]
for i in range(1,n):
res=math.gcd(res,x[i+1]-x[i])
print(res) | 23 | 11 | 465 | 216 | from math import gcd
n, x = list(map(int, input().split()))
m = [x] + list(map(int, input().split()))
m.sort()
if n == 1:
print((m[1] - m[0]))
else:
res = gcd(m[1] - m[0], m[2] - m[1])
for i in range(1, n - 1):
a = m[i + 1] - m[i]
b = m[i + 2] - m[i + 1]
if res >= gcd(a, b):
... | import math
n, a = list(map(int, input().split()))
x = list(map(int, input().split())) + [a]
x.sort()
if n == 1:
print((abs(x[0] - x[1])))
exit()
res = x[1] - x[0]
for i in range(1, n):
res = math.gcd(res, x[i + 1] - x[i])
print(res)
| false | 52.173913 | [
"-from math import gcd",
"+import math",
"-n, x = list(map(int, input().split()))",
"-m = [x] + list(map(int, input().split()))",
"-m.sort()",
"+n, a = list(map(int, input().split()))",
"+x = list(map(int, input().split())) + [a]",
"+x.sort()",
"- print((m[1] - m[0]))",
"-else:",
"- res = ... | false | 0.036247 | 0.082466 | 0.439541 | [
"s096406101",
"s505256213"
] |
u173178698 | p02583 | python | s079565582 | s063531615 | 196 | 139 | 20,596 | 20,524 | Accepted | Accepted | 29.08 | import itertools
n = int(eval(input()))
l = list(map(int, input().split()))
count = 0
ind_list = list(itertools.combinations(list(range(0,n)), 3))
for ind in ind_list:
if (l[ind[0]]+l[ind[1]])>l[ind[2]] and (l[ind[1]]+l[ind[2]])>l[ind[0]] and (l[ind[2]]+l[ind[0]])>l[ind[1]]:
if l[ind[0]]!=l[ind... | import itertools
n = int(eval(input()))
l = list(map(int, input().split()))
count = 0
c_list = list(itertools.combinations(l, 3))
for c in c_list:
if (c[0]+c[1])>c[2] and (c[1]+c[2])>c[0] and (c[2]+c[0])>c[1]:
if len(set(c)) == 3:
count += 1
print(count) | 12 | 12 | 403 | 285 | import itertools
n = int(eval(input()))
l = list(map(int, input().split()))
count = 0
ind_list = list(itertools.combinations(list(range(0, n)), 3))
for ind in ind_list:
if (
(l[ind[0]] + l[ind[1]]) > l[ind[2]]
and (l[ind[1]] + l[ind[2]]) > l[ind[0]]
and (l[ind[2]] + l[ind[0]]) > l[ind[1]]
... | import itertools
n = int(eval(input()))
l = list(map(int, input().split()))
count = 0
c_list = list(itertools.combinations(l, 3))
for c in c_list:
if (c[0] + c[1]) > c[2] and (c[1] + c[2]) > c[0] and (c[2] + c[0]) > c[1]:
if len(set(c)) == 3:
count += 1
print(count)
| false | 0 | [
"-ind_list = list(itertools.combinations(list(range(0, n)), 3))",
"-for ind in ind_list:",
"- if (",
"- (l[ind[0]] + l[ind[1]]) > l[ind[2]]",
"- and (l[ind[1]] + l[ind[2]]) > l[ind[0]]",
"- and (l[ind[2]] + l[ind[0]]) > l[ind[1]]",
"- ):",
"- if l[ind[0]] != l[ind[1]]... | false | 0.039379 | 0.036289 | 1.085165 | [
"s079565582",
"s063531615"
] |
u411203878 | p03524 | python | s515169925 | s126165147 | 193 | 81 | 49,392 | 77,824 | Accepted | Accepted | 58.03 | import collections
s=eval(input())
s=list(s)
c = collections.Counter(s)
score_sorted = sorted(list(c.items()), key=lambda x:-x[1])
val = []
for i, j in score_sorted:
val.append(j)
if len(val) == 2:
val.append(0)
elif len(val) == 1:
val.append(0)
val.append(0)
val.sort(... | import collections
s=list(eval(input()))
c = collections.Counter(s)
score_sorted = sorted(list(c.items()), key=lambda x:-x[1])
val = []
for i, j in score_sorted:
val.append(j)
if len(val) == 2:
val.append(0)
elif len(val) == 1:
val.append(0)
val.append(0)
val.sort()
if 0... | 28 | 25 | 380 | 372 | import collections
s = eval(input())
s = list(s)
c = collections.Counter(s)
score_sorted = sorted(list(c.items()), key=lambda x: -x[1])
val = []
for i, j in score_sorted:
val.append(j)
if len(val) == 2:
val.append(0)
elif len(val) == 1:
val.append(0)
val.append(0)
val.sort()
if 0 <= val[2] - val[0] <= ... | import collections
s = list(eval(input()))
c = collections.Counter(s)
score_sorted = sorted(list(c.items()), key=lambda x: -x[1])
val = []
for i, j in score_sorted:
val.append(j)
if len(val) == 2:
val.append(0)
elif len(val) == 1:
val.append(0)
val.append(0)
val.sort()
if 0 <= val[2] - val[0] <= 1:
... | false | 10.714286 | [
"-s = eval(input())",
"-s = list(s)",
"+s = list(eval(input()))"
] | false | 0.04923 | 0.047823 | 1.029416 | [
"s515169925",
"s126165147"
] |
u173148629 | p02669 | python | s518675663 | s048530087 | 264 | 225 | 11,020 | 11,524 | Accepted | Accepted | 14.77 | import sys
sys.setrecursionlimit(10**8)
T=int(eval(input()))
def solve(N):
if N==0:
return 0
if N==1:
return D
if N in dic:
return dic[N]
tmp=N*D
if N%2==0:
tmp=min(tmp,solve(N//2)+A)
else:
tmp=min(tmp,solve((N-1)//2)+A+D,solve((N+1)//2... | T=int(eval(input()))
from functools import lru_cache
for _ in range(T):
N,A,B,C,D=list(map(int,input().split()))
@lru_cache(maxsize=None)
def solve(N):
if N==0:
return 0
if N==1:
return D
tmp=N*D
if N%2==0:
tmp=min(tmp,s... | 33 | 29 | 753 | 791 | import sys
sys.setrecursionlimit(10**8)
T = int(eval(input()))
def solve(N):
if N == 0:
return 0
if N == 1:
return D
if N in dic:
return dic[N]
tmp = N * D
if N % 2 == 0:
tmp = min(tmp, solve(N // 2) + A)
else:
tmp = min(tmp, solve((N - 1) // 2) + A + D... | T = int(eval(input()))
from functools import lru_cache
for _ in range(T):
N, A, B, C, D = list(map(int, input().split()))
@lru_cache(maxsize=None)
def solve(N):
if N == 0:
return 0
if N == 1:
return D
tmp = N * D
if N % 2 == 0:
tmp = min(... | false | 12.121212 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**8)",
"-",
"-",
"-def solve(N):",
"- if N == 0:",
"- return 0",
"- if N == 1:",
"- return D",
"- if N in dic:",
"- return dic[N]",
"- tmp = N * D",
"- if N % 2 == 0:",
"- tmp = min(tmp, solve(N // 2... | false | 0.141136 | 0.154317 | 0.91458 | [
"s518675663",
"s048530087"
] |
u777283665 | p03031 | python | s818695101 | s865385934 | 198 | 27 | 40,944 | 3,064 | Accepted | Accepted | 86.36 | n, m = list(map(int, input().split()))
ks = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
light_on = 0
for j in range(m):
switch_on = 0
for k in ks[j][1:]:
if (i >> k-1) & 1:
switch_on += 1
if switch_on ... | from itertools import product
n, m = list(map(int, input().split()))
x = []
for i in range(m):
x.append(list(map(int, input().split()))[1:])
p = list(map(int, input().split()))
ans = 0
for j in product([1,0],repeat=n):
for i, s in enumerate(x):
if sum([j[k-1] == 1 for k in s]) % 2 != p[... | 19 | 20 | 396 | 393 | n, m = list(map(int, input().split()))
ks = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
light_on = 0
for j in range(m):
switch_on = 0
for k in ks[j][1:]:
if (i >> k - 1) & 1:
switch_on += 1
... | from itertools import product
n, m = list(map(int, input().split()))
x = []
for i in range(m):
x.append(list(map(int, input().split()))[1:])
p = list(map(int, input().split()))
ans = 0
for j in product([1, 0], repeat=n):
for i, s in enumerate(x):
if sum([j[k - 1] == 1 for k in s]) % 2 != p[i]:
... | false | 5 | [
"+from itertools import product",
"+",
"-ks = [list(map(int, input().split())) for i in range(m)]",
"+x = []",
"+for i in range(m):",
"+ x.append(list(map(int, input().split()))[1:])",
"-for i in range(2**n):",
"- light_on = 0",
"- for j in range(m):",
"- switch_on = 0",
"- ... | false | 0.125191 | 0.035074 | 3.569315 | [
"s818695101",
"s865385934"
] |
u764956288 | p02627 | python | s583496036 | s127482589 | 32 | 26 | 9,080 | 8,948 | Accepted | Accepted | 18.75 | # import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))
# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))
def solve():
alpha = eval(input())
if alpha.upper() == alpha:
return 'A'
... | def solve():
letter = eval(input())
answer = 'A' if letter.upper() == letter else 'a'
return answer
def main():
print((solve()))
if __name__ == "__main__":
main()
| 24 | 14 | 411 | 194 | # import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))
# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))
def solve():
alpha = eval(input())
if alpha.upper() == alpha:
return "A"
return "a"
de... | def solve():
letter = eval(input())
answer = "A" if letter.upper() == letter else "a"
return answer
def main():
print((solve()))
if __name__ == "__main__":
main()
| false | 41.666667 | [
"-# import sys",
"-# readline = sys.stdin.readline",
"-# generator = (readline().strip() for _ in range(N))",
"-# N, M = map(int, input().split())",
"-# As = list(map(int, input().split()))",
"-# queries = (input() for _ in range(N))",
"- alpha = eval(input())",
"- if alpha.upper() == alpha:",
... | false | 0.04604 | 0.046041 | 0.999977 | [
"s583496036",
"s127482589"
] |
u254871849 | p03325 | python | s696280742 | s868376229 | 65 | 58 | 4,212 | 4,084 | Accepted | Accepted | 10.77 | # author: kagemeka
# created: 2019-11-08 12:38:16(JST)
## internal modules
import sys
# import collections
import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## external module... | import sys
n, *a = list(map(int, sys.stdin.read().split()))
def main():
cnt = 0
for i in a:
while not i % 2:
i //= 2
cnt += 1
return cnt
if __name__ == '__main__':
ans = main()
print(ans) | 38 | 16 | 971 | 260 | # author: kagemeka
# created: 2019-11-08 12:38:16(JST)
## internal modules
import sys
# import collections
import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## external modules
# import s... | import sys
n, *a = list(map(int, sys.stdin.read().split()))
def main():
cnt = 0
for i in a:
while not i % 2:
i //= 2
cnt += 1
return cnt
if __name__ == "__main__":
ans = main()
print(ans)
| false | 57.894737 | [
"-# author: kagemeka",
"-# created: 2019-11-08 12:38:16(JST)",
"-## internal modules",
"-# import collections",
"-import math",
"+n, *a = list(map(int, sys.stdin.read().split()))",
"-# import string",
"-# import bisect",
"-# import re",
"-# import i... | false | 0.061872 | 0.037868 | 1.633904 | [
"s696280742",
"s868376229"
] |
u548545174 | p03126 | python | s402522094 | s050980045 | 23 | 18 | 3,316 | 2,940 | Accepted | Accepted | 21.74 | from collections import Counter
n, m = list(map(int, input().split()))
L = []
cnt = 0
for _ in range(n):
tmp = input().split()
a = tmp[1:]
L.extend(a)
c = Counter(L)
for k, v in list(c.items()):
if v==n:
cnt += 1
print(cnt) | n, m = list(map(int, input().split()))
foods = [0] * m
for _ in range(n):
k, *a = input().split()
for food in a:
foods[int(food)-1] += 1
print((foods.count(n)))
| 17 | 9 | 259 | 194 | from collections import Counter
n, m = list(map(int, input().split()))
L = []
cnt = 0
for _ in range(n):
tmp = input().split()
a = tmp[1:]
L.extend(a)
c = Counter(L)
for k, v in list(c.items()):
if v == n:
cnt += 1
print(cnt)
| n, m = list(map(int, input().split()))
foods = [0] * m
for _ in range(n):
k, *a = input().split()
for food in a:
foods[int(food) - 1] += 1
print((foods.count(n)))
| false | 47.058824 | [
"-from collections import Counter",
"-",
"-L = []",
"-cnt = 0",
"+foods = [0] * m",
"- tmp = input().split()",
"- a = tmp[1:]",
"- L.extend(a)",
"-c = Counter(L)",
"-for k, v in list(c.items()):",
"- if v == n:",
"- cnt += 1",
"-print(cnt)",
"+ k, *a = input().split()... | false | 0.041507 | 0.036718 | 1.130429 | [
"s402522094",
"s050980045"
] |
u923668099 | p02257 | python | s877663589 | s737820778 | 940 | 530 | 7,688 | 7,700 | Accepted | Accepted | 43.62 | import sys
def solve():
n = int(sys.stdin.readline())
ans = sum(is_prime(int(sys.stdin.readline())) for i in range(n))
print(ans)
def is_prime(n):
if n < 2:
return False
p = 2
while p*p <= n:
if n % p == 0:
return False
p += 1
... | import sys
def solve():
n = int(sys.stdin.readline())
ans = sum(is_prime(int(sys.stdin.readline())) for i in range(n))
print(ans)
def is_prime(n):
if n < 2 or (n > 2 and n & 1 == 0):
return False
p = 3
while p*p <= n:
if n % p == 0:
return False... | 25 | 25 | 374 | 400 | import sys
def solve():
n = int(sys.stdin.readline())
ans = sum(is_prime(int(sys.stdin.readline())) for i in range(n))
print(ans)
def is_prime(n):
if n < 2:
return False
p = 2
while p * p <= n:
if n % p == 0:
return False
p += 1
return True
if __name... | import sys
def solve():
n = int(sys.stdin.readline())
ans = sum(is_prime(int(sys.stdin.readline())) for i in range(n))
print(ans)
def is_prime(n):
if n < 2 or (n > 2 and n & 1 == 0):
return False
p = 3
while p * p <= n:
if n % p == 0:
return False
p += 2
... | false | 0 | [
"- if n < 2:",
"+ if n < 2 or (n > 2 and n & 1 == 0):",
"- p = 2",
"+ p = 3",
"- p += 1",
"+ p += 2"
] | false | 0.03812 | 0.046237 | 0.824459 | [
"s877663589",
"s737820778"
] |
u188827677 | p03816 | python | s464440129 | s487029676 | 63 | 57 | 21,920 | 20,756 | Accepted | Accepted | 9.52 | from collections import Counter
n = int(eval(input()))
a = list(map(int ,input().split()))
cnt = Counter(a) # カードの値をカウント
ans = len(cnt) # 存在する値の数をカウント
if ans%2 == 0: print((ans-1)) # 存在する値の数が偶数であれば1回取り除く必要があるため-1をする
else: print(ans) # 奇数の場合はそのまま | n = int(eval(input()))
a = list(map(int, input().split()))
n = len(set(a))
if n%2 == 0: print((n-1))
else: print(n) | 8 | 6 | 245 | 113 | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = Counter(a) # カードの値をカウント
ans = len(cnt) # 存在する値の数をカウント
if ans % 2 == 0:
print((ans - 1)) # 存在する値の数が偶数であれば1回取り除く必要があるため-1をする
else:
print(ans) # 奇数の場合はそのまま
| n = int(eval(input()))
a = list(map(int, input().split()))
n = len(set(a))
if n % 2 == 0:
print((n - 1))
else:
print(n)
| false | 25 | [
"-from collections import Counter",
"-",
"-cnt = Counter(a) # カードの値をカウント",
"-ans = len(cnt) # 存在する値の数をカウント",
"-if ans % 2 == 0:",
"- print((ans - 1)) # 存在する値の数が偶数であれば1回取り除く必要があるため-1をする",
"+n = len(set(a))",
"+if n % 2 == 0:",
"+ print((n - 1))",
"- print(ans) # 奇数の場合はそのまま",
"+ pr... | false | 0.097399 | 0.045814 | 2.12595 | [
"s464440129",
"s487029676"
] |
u272028993 | p03947 | python | s137460670 | s295548179 | 80 | 31 | 2,820 | 2,692 | Accepted | Accepted | 61.25 | s=input()
l=0
r=len(s)-1
news=""
i=0
while i<len(s):
if s[i]=="W":
while i<len(s) and s[i]=="W":
i+=1
news+=s[i-1]
else:
while i<len(s) and s[i]=="B":
i+=1
news+=s[i-1]
print((len(news)-1)) | s=input()
now=s[0]
ans=0
for i in range(1,len(s)):
if now!=s[i]:
ans+=1
now=s[i]
print(ans)
| 16 | 8 | 271 | 123 | s = input()
l = 0
r = len(s) - 1
news = ""
i = 0
while i < len(s):
if s[i] == "W":
while i < len(s) and s[i] == "W":
i += 1
news += s[i - 1]
else:
while i < len(s) and s[i] == "B":
i += 1
news += s[i - 1]
print((len(news) - 1))
| s = input()
now = s[0]
ans = 0
for i in range(1, len(s)):
if now != s[i]:
ans += 1
now = s[i]
print(ans)
| false | 50 | [
"-l = 0",
"-r = len(s) - 1",
"-news = \"\"",
"-i = 0",
"-while i < len(s):",
"- if s[i] == \"W\":",
"- while i < len(s) and s[i] == \"W\":",
"- i += 1",
"- news += s[i - 1]",
"- else:",
"- while i < len(s) and s[i] == \"B\":",
"- i += 1",
"- ... | false | 0.04217 | 0.038194 | 1.104105 | [
"s137460670",
"s295548179"
] |
u858464419 | p03478 | python | s412547663 | s919162333 | 42 | 36 | 3,316 | 3,060 | Accepted | Accepted | 14.29 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(n+1):
if a <= sum(list(map(int, list(str(i))))) <= b:
ans += i
print(ans)
| n,a,b = list(map(int, input().split()))
ans = 0
for i in range(1,n+1):
if a <= sum(list(map(int, list(str(i))))) <= b:
ans += i
print(ans)
| 6 | 6 | 144 | 144 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(n + 1):
if a <= sum(list(map(int, list(str(i))))) <= b:
ans += i
print(ans)
| n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
if a <= sum(list(map(int, list(str(i))))) <= b:
ans += i
print(ans)
| false | 0 | [
"-for i in range(n + 1):",
"+for i in range(1, n + 1):"
] | false | 0.045935 | 0.046259 | 0.992997 | [
"s412547663",
"s919162333"
] |
u509739538 | p02579 | python | s052380724 | s714096390 | 833 | 502 | 139,224 | 85,648 | Accepted | Accepted | 39.74 | from collections import defaultdict
from collections import deque
from collections import Counter
import math
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChar():
return input()
def readChars():
return input().split()
def p(arr):
print("________... | from collections import defaultdict
from collections import deque
from collections import Counter
import math
def readInt():
return int(eval(input()))
def readInts():
return list(map(int, input().split()))
def readChar():
return eval(input())
def readChars():
return input().split()
h,w = readInts()
... | 70 | 52 | 1,509 | 1,095 | from collections import defaultdict
from collections import deque
from collections import Counter
import math
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChar():
return input()
def readChars():
return input().split()
def p(arr):
print("... | from collections import defaultdict
from collections import deque
from collections import Counter
import math
def readInt():
return int(eval(input()))
def readInts():
return list(map(int, input().split()))
def readChar():
return eval(input())
def readChars():
return input().split()
h, w = read... | false | 25.714286 | [
"- return int(input())",
"+ return int(eval(input()))",
"- return input()",
"+ return eval(input())",
"-def p(arr):",
"- print(\"_______________________\")",
"- for i in arr:",
"- for j in i:",
"- print(j, end=\" \")",
"- print()",
"-",
"-",
"-s = (... | false | 0.033921 | 0.097538 | 0.347773 | [
"s052380724",
"s714096390"
] |
u241159583 | p03325 | python | s696050297 | s853112219 | 143 | 111 | 4,148 | 4,148 | Accepted | Accepted | 22.38 | N = int(eval(input()))
a =list(map(int, input().split()))
ans = 0
import math
for i in range(N):
if a[i] % 2 != 0:
continue
while a[i] % 2 == 0:
a[i] = a[i] /2
ans += 1
print(ans) | N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(N):
if a[i] % 2 == 0:
while a[i] % 2 == 0:
a[i] = a[i] // 2
ans += 1
print(ans) | 12 | 9 | 201 | 181 | N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
import math
for i in range(N):
if a[i] % 2 != 0:
continue
while a[i] % 2 == 0:
a[i] = a[i] / 2
ans += 1
print(ans)
| N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(N):
if a[i] % 2 == 0:
while a[i] % 2 == 0:
a[i] = a[i] // 2
ans += 1
print(ans)
| false | 25 | [
"-import math",
"-",
"- if a[i] % 2 != 0:",
"- continue",
"- while a[i] % 2 == 0:",
"- a[i] = a[i] / 2",
"- ans += 1",
"+ if a[i] % 2 == 0:",
"+ while a[i] % 2 == 0:",
"+ a[i] = a[i] // 2",
"+ ans += 1"
] | false | 0.037415 | 0.039276 | 0.9526 | [
"s696050297",
"s853112219"
] |
u075012704 | p03682 | python | s223398362 | s756260670 | 1,722 | 1,512 | 133,124 | 59,316 | Accepted | Accepted | 12.2 | N = int(eval(input()))
P = [[i, list(map(int, input().split()))] for i in range(N)]
X = sorted([[i, xy[0]] for i, xy in P], key=lambda x: x[1])
Y = sorted([[i, xy[1]] for i, xy in P], key=lambda y: y[1])
Xe = [[X[i][0], X[i+1][0], abs(X[i][1]-X[i+1][1])] for i in range(N-1)]
Ye = [[Y[i][0], Y[i+1][0], abs(Y[i]... | N = int(eval(input()))
Points = [[i] + list(map(int, input().split())) for i in range(N)]
# x, yそれぞれについてソートして、一番近いところを見れば十分
Edges = []
Points.sort(key=lambda p: p[1])
for i in range(N - 1):
n1, x1, y1 = Points[i]
n2, x2, y2 = Points[i + 1]
Edges.append([n1, n2, x2 - x1])
Points.sort(key=lambda ... | 59 | 68 | 1,409 | 1,571 | N = int(eval(input()))
P = [[i, list(map(int, input().split()))] for i in range(N)]
X = sorted([[i, xy[0]] for i, xy in P], key=lambda x: x[1])
Y = sorted([[i, xy[1]] for i, xy in P], key=lambda y: y[1])
Xe = [[X[i][0], X[i + 1][0], abs(X[i][1] - X[i + 1][1])] for i in range(N - 1)]
Ye = [[Y[i][0], Y[i + 1][0], abs(Y[i... | N = int(eval(input()))
Points = [[i] + list(map(int, input().split())) for i in range(N)]
# x, yそれぞれについてソートして、一番近いところを見れば十分
Edges = []
Points.sort(key=lambda p: p[1])
for i in range(N - 1):
n1, x1, y1 = Points[i]
n2, x2, y2 = Points[i + 1]
Edges.append([n1, n2, x2 - x1])
Points.sort(key=lambda p: p[2])
for ... | false | 13.235294 | [
"-P = [[i, list(map(int, input().split()))] for i in range(N)]",
"-X = sorted([[i, xy[0]] for i, xy in P], key=lambda x: x[1])",
"-Y = sorted([[i, xy[1]] for i, xy in P], key=lambda y: y[1])",
"-Xe = [[X[i][0], X[i + 1][0], abs(X[i][1] - X[i + 1][1])] for i in range(N - 1)]",
"-Ye = [[Y[i][0], Y[i + 1][0], ... | false | 0.117928 | 0.132958 | 0.886958 | [
"s223398362",
"s756260670"
] |
u017810624 | p03201 | python | s979195058 | s002274138 | 962 | 725 | 26,960 | 36,500 | Accepted | Accepted | 24.64 | import math
import bisect
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
b=[]
for i in range(1,50):
b.append(2**i)
ct=0
check=[1]*n
for i in range(n-1,-1,-1):
if a[i]==1:
break
if check[i]==1 and a[i] not in b:
check[i]=0
x=math.floor(math.log2(a[i]))
x=b[x]-a[i]
... | import math
import bisect
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
x=a[0]
ctn=1
l=[]
l2=[]
for i in range(1,n):
if x==a[i]:
ctn+=1
else:
l.append([x,ctn])
l2.append(x)
x=a[i]
ctn=1
l.append([x,ctn])
l2.append(x)
b=[]
for i in range(1,50):
b.append(2... | 44 | 38 | 749 | 615 | import math
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
b = []
for i in range(1, 50):
b.append(2**i)
ct = 0
check = [1] * n
for i in range(n - 1, -1, -1):
if a[i] == 1:
break
if check[i] == 1 and a[i] not in b:
check[i] = 0
x = math.floor(math.l... | import math
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
x = a[0]
ctn = 1
l = []
l2 = []
for i in range(1, n):
if x == a[i]:
ctn += 1
else:
l.append([x, ctn])
l2.append(x)
x = a[i]
ctn = 1
l.append([x, ctn])
l2.append(x)
b = []
for i ... | false | 13.636364 | [
"+x = a[0]",
"+ctn = 1",
"+l = []",
"+l2 = []",
"+for i in range(1, n):",
"+ if x == a[i]:",
"+ ctn += 1",
"+ else:",
"+ l.append([x, ctn])",
"+ l2.append(x)",
"+ x = a[i]",
"+ ctn = 1",
"+l.append([x, ctn])",
"+l2.append(x)",
"-check = [1] * n",
... | false | 0.043457 | 0.037679 | 1.153352 | [
"s979195058",
"s002274138"
] |
u633068244 | p00211 | python | s357305468 | s380004557 | 60 | 50 | 4,252 | 4,252 | Accepted | Accepted | 16.67 | def gcd(a,b):
return a if b==0 else gcd(b,a%b)
while 1:
n=eval(input())
if n==0:break
s=[list(map(int,input().split())) for i in range(n)]
t=c=1
for i in s:t=t*i[1]/gcd(t,i[1])
for i in range(n):
s[i]=t*s[i][0]/s[i][1]
c=c*s[i]/gcd(c,s[i])
for i in s:print(c/i) | def g(a,b):
return a if b==0 else g(b,a%b)
while 1:
n=eval(input())
if n==0:break
s=[list(map(int,input().split())) for i in [1]*n]
t=c=1
for i in s:t*=i[1]/g(t,i[1])
for i in range(n):
s[i]=t*s[i][0]/s[i][1]
c*=s[i]/g(c,s[i])
for i in s:print(c/i) | 13 | 13 | 277 | 264 | def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
while 1:
n = eval(input())
if n == 0:
break
s = [list(map(int, input().split())) for i in range(n)]
t = c = 1
for i in s:
t = t * i[1] / gcd(t, i[1])
for i in range(n):
s[i] = t * s[i][0] / s[i][1]
c = c *... | def g(a, b):
return a if b == 0 else g(b, a % b)
while 1:
n = eval(input())
if n == 0:
break
s = [list(map(int, input().split())) for i in [1] * n]
t = c = 1
for i in s:
t *= i[1] / g(t, i[1])
for i in range(n):
s[i] = t * s[i][0] / s[i][1]
c *= s[i] / g(c, ... | false | 0 | [
"-def gcd(a, b):",
"- return a if b == 0 else gcd(b, a % b)",
"+def g(a, b):",
"+ return a if b == 0 else g(b, a % b)",
"- s = [list(map(int, input().split())) for i in range(n)]",
"+ s = [list(map(int, input().split())) for i in [1] * n]",
"- t = t * i[1] / gcd(t, i[1])",
"+ ... | false | 0.038677 | 0.04151 | 0.931754 | [
"s357305468",
"s380004557"
] |
u017810624 | p02913 | python | s089113779 | s386394715 | 1,878 | 714 | 234,996 | 50,268 | Accepted | Accepted | 61.98 | n=int(eval(input()))
s=list(eval(input()))
def Z_algorithm(s):
N=len(s)
Z_alg=[0]*N
Z_alg[0]=N
i=1
j=0
while i<N:
while i+j<N and s[j]==s[i+j]:
j+=1
Z_alg[i]=j
if j==0:
i+=1
continue
k=1
while i+k<N and k+Z_alg[k]<j:
Z_alg[i+k]=Z_alg[k]
k... | n=int(eval(input()))
s=list(eval(input()))
def Z_algorithm(s):
N=len(s)
Z_alg=[0]*N
Z_alg[0]=N
i=1
j=0
while i<N:
while i+j<N and s[j]==s[i+j]:
j+=1
Z_alg[i]=j
if j==0:
i+=1
continue
k=1
while i+k<N and k+Z_alg[k]<j:
Z_alg[i+k]=Z_alg[k]
k... | 32 | 33 | 495 | 502 | n = int(eval(input()))
s = list(eval(input()))
def Z_algorithm(s):
N = len(s)
Z_alg = [0] * N
Z_alg[0] = N
i = 1
j = 0
while i < N:
while i + j < N and s[j] == s[i + j]:
j += 1
Z_alg[i] = j
if j == 0:
i += 1
continue
k = 1
... | n = int(eval(input()))
s = list(eval(input()))
def Z_algorithm(s):
N = len(s)
Z_alg = [0] * N
Z_alg[0] = N
i = 1
j = 0
while i < N:
while i + j < N and s[j] == s[i + j]:
j += 1
Z_alg[i] = j
if j == 0:
i += 1
continue
k = 1
... | false | 3.030303 | [
"-ans = [0]",
"+ans = 0",
"- ans.append(z[j])",
"-print((max(ans)))",
"+ if ans < z[j]:",
"+ ans = z[j]",
"+print(ans)"
] | false | 0.038467 | 0.067711 | 0.568111 | [
"s089113779",
"s386394715"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.