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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u057109575 | p03487 | python | s152078724 | s475888904 | 101 | 92 | 18,728 | 18,728 | Accepted | Accepted | 8.91 | from collections import Counter
N, *a = list(map(int, open(0).read().split()))
c = Counter(a)
ans = 0
for v in c:
if v > c[v]:
ans += c[v]
else:
ans += c[v] - v
print(ans)
| from collections import Counter
N, *a = list(map(int, open(0).read().split()))
c = Counter(a)
print((sum(c[v] if v > c[v] else c[v] - v for v in c)))
| 10 | 4 | 187 | 145 | from collections import Counter
N, *a = list(map(int, open(0).read().split()))
c = Counter(a)
ans = 0
for v in c:
if v > c[v]:
ans += c[v]
else:
ans += c[v] - v
print(ans)
| from collections import Counter
N, *a = list(map(int, open(0).read().split()))
c = Counter(a)
print((sum(c[v] if v > c[v] else c[v] - v for v in c)))
| false | 60 | [
"-ans = 0",
"-for v in c:",
"- if v > c[v]:",
"- ans += c[v]",
"- else:",
"- ans += c[v] - v",
"-print(ans)",
"+print((sum(c[v] if v > c[v] else c[v] - v for v in c)))"
] | false | 0.047611 | 0.046554 | 1.022708 | [
"s152078724",
"s475888904"
] |
u285891772 | p03107 | python | s654304092 | s682376713 | 310 | 35 | 22,800 | 3,956 | Accepted | Accepted | 88.71 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lower... | S = list(eval(input()))
count_0 = 0
count_1 = 0
for i in S:
if i == "0":
count_0 += 1
if i == "1":
count_1 += 1
print((min(count_0, count_1)*2)) | 33 | 12 | 965 | 156 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | S = list(eval(input()))
count_0 = 0
count_1 = 0
for i in S:
if i == "0":
count_0 += 1
if i == "1":
count_1 += 1
print((min(count_0, count_1) * 2))
| false | 63.636364 | [
"-import sys, re",
"-from collections import deque, defaultdict, Counter",
"-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2",
"-from itertools import accumulate, permutations, combinations, product, groupby",
"-from operator import itemgetter, mul",
"-from copy import deepcopy"... | false | 0.054816 | 0.034377 | 1.594537 | [
"s654304092",
"s682376713"
] |
u606045429 | p03343 | python | s839822357 | s567501964 | 1,861 | 1,538 | 3,444 | 115,164 | Accepted | Accepted | 17.36 | from itertools import*
N,K,Q,*A=list(map(int,open(0).read().split()))
l=len
s=sorted
a=1e9
for Y in set(A):
C=s(sum((v[:l(v)-K+1]for v in(s(v)for k,v in groupby(A,lambda a:a>=Y)if k)if l(v)>=K),[]))
if l(C)>=Q:a=min(a,C[Q-1]-Y)
print(a) | n,k,q,*a=list(map(int,open(0).read().split()))
s=sorted
m=1e9
for b in a:
i=[i for i,t in enumerate(a)if t<b]
l=s(sum([s(a[i+1:j])[::-1][k-1:]for i,j in zip([-1]+i,i+[n])],[]))
if len(l)>=q:m=min(m,l[q-1]-b)
print(m) | 9 | 8 | 240 | 229 | from itertools import *
N, K, Q, *A = list(map(int, open(0).read().split()))
l = len
s = sorted
a = 1e9
for Y in set(A):
C = s(
sum(
(
v[: l(v) - K + 1]
for v in (s(v) for k, v in groupby(A, lambda a: a >= Y) if k)
if l(v) >= K
),
... | n, k, q, *a = list(map(int, open(0).read().split()))
s = sorted
m = 1e9
for b in a:
i = [i for i, t in enumerate(a) if t < b]
l = s(sum([s(a[i + 1 : j])[::-1][k - 1 :] for i, j in zip([-1] + i, i + [n])], []))
if len(l) >= q:
m = min(m, l[q - 1] - b)
print(m)
| false | 11.111111 | [
"-from itertools import *",
"-",
"-N, K, Q, *A = list(map(int, open(0).read().split()))",
"-l = len",
"+n, k, q, *a = list(map(int, open(0).read().split()))",
"-a = 1e9",
"-for Y in set(A):",
"- C = s(",
"- sum(",
"- (",
"- v[: l(v) - K + 1]",
"- ... | false | 0.039134 | 0.036876 | 1.061247 | [
"s839822357",
"s567501964"
] |
u472065247 | p03575 | python | s113925111 | s923538566 | 281 | 248 | 18,216 | 17,612 | Accepted | Accepted | 11.74 | from scipy.sparse import lil_matrix
from scipy.sparse.csgraph import connected_components
N, M = list(map(int, input().split()))
g = lil_matrix((N, N))
for _ in range(M):
a, b = list(map(int, input().split()))
g[a - 1, b - 1] = 1
c = 0
for a, b in zip(*g.nonzero()):
g[a, b] = 0
c += connected_co... | from scipy.sparse import *;from scipy.sparse.csgraph import connected_components;N,M=list(map(int,input().split()));g=lil_matrix((N,N))
for _ in [0]*M:
a,b=list(map(int,input().split()));g[a-1,b-1]=1
c=0
for a,b in zip(*g.nonzero()):
g[a,b]=0;c+=connected_components(g,return_labels=False)!=1;g[a,b]=1
print(c) | 17 | 7 | 382 | 314 | from scipy.sparse import lil_matrix
from scipy.sparse.csgraph import connected_components
N, M = list(map(int, input().split()))
g = lil_matrix((N, N))
for _ in range(M):
a, b = list(map(int, input().split()))
g[a - 1, b - 1] = 1
c = 0
for a, b in zip(*g.nonzero()):
g[a, b] = 0
c += connected_component... | from scipy.sparse import *
from scipy.sparse.csgraph import connected_components
N, M = list(map(int, input().split()))
g = lil_matrix((N, N))
for _ in [0] * M:
a, b = list(map(int, input().split()))
g[a - 1, b - 1] = 1
c = 0
for a, b in zip(*g.nonzero()):
g[a, b] = 0
c += connected_components(g, retur... | false | 58.823529 | [
"-from scipy.sparse import lil_matrix",
"+from scipy.sparse import *",
"-for _ in range(M):",
"+for _ in [0] * M:"
] | false | 0.291455 | 0.351161 | 0.829975 | [
"s113925111",
"s923538566"
] |
u298297089 | p02999 | python | s336315910 | s992007900 | 177 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.4 |
X,A = list(map(int, input().split()))
print((0 if X < A else 10)) | x,a = list(map(int, input().split()))
print((0 if x < a else 10)) | 3 | 2 | 60 | 58 | X, A = list(map(int, input().split()))
print((0 if X < A else 10))
| x, a = list(map(int, input().split()))
print((0 if x < a else 10))
| false | 33.333333 | [
"-X, A = list(map(int, input().split()))",
"-print((0 if X < A else 10))",
"+x, a = list(map(int, input().split()))",
"+print((0 if x < a else 10))"
] | false | 0.036548 | 0.035212 | 1.037939 | [
"s336315910",
"s992007900"
] |
u330314953 | p03861 | python | s593202489 | s101882084 | 21 | 17 | 2,940 | 2,940 | Accepted | Accepted | 19.05 | a,b,x = list(map(int,input().split()))
print((b//x-(-((-1)*a//x))+1))
| a,b,x = list(map(int,input().split()))
c = -((-1 * a)//x)
d = b // x
print((d - c + 1)) | 2 | 4 | 63 | 82 | a, b, x = list(map(int, input().split()))
print((b // x - (-((-1) * a // x)) + 1))
| a, b, x = list(map(int, input().split()))
c = -((-1 * a) // x)
d = b // x
print((d - c + 1))
| false | 50 | [
"-print((b // x - (-((-1) * a // x)) + 1))",
"+c = -((-1 * a) // x)",
"+d = b // x",
"+print((d - c + 1))"
] | false | 0.05547 | 0.152074 | 0.364757 | [
"s593202489",
"s101882084"
] |
u606033239 | p03370 | python | s506508698 | s292172641 | 194 | 17 | 2,940 | 2,940 | Accepted | Accepted | 91.24 | n,x = list(map(int,input().split()))
m = [int(eval(input())) for i in range(n)]
a = n
s = sum(m)
while s < x:
s+=min(m)
a += 1
print(([a,a-1][s>x]))
| n,x = list(map(int,input().split()))
m = list(int(eval(input())) for i in range(n))
x -= sum(m)
print((x//min(m)+n))
| 8 | 4 | 151 | 106 | n, x = list(map(int, input().split()))
m = [int(eval(input())) for i in range(n)]
a = n
s = sum(m)
while s < x:
s += min(m)
a += 1
print(([a, a - 1][s > x]))
| n, x = list(map(int, input().split()))
m = list(int(eval(input())) for i in range(n))
x -= sum(m)
print((x // min(m) + n))
| false | 50 | [
"-m = [int(eval(input())) for i in range(n)]",
"-a = n",
"-s = sum(m)",
"-while s < x:",
"- s += min(m)",
"- a += 1",
"-print(([a, a - 1][s > x]))",
"+m = list(int(eval(input())) for i in range(n))",
"+x -= sum(m)",
"+print((x // min(m) + n))"
] | false | 0.072469 | 0.006998 | 10.356206 | [
"s506508698",
"s292172641"
] |
u970197315 | p03061 | python | s510270052 | s035795610 | 202 | 122 | 16,140 | 20,668 | Accepted | Accepted | 39.6 | # ABC125 C - GCD on Blackboard
from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
l = n*[0]
r = n*[0]
ans = 0
for i in range(n-1):
l[i+1] = gcd(l[i],a[i])
for i in range(n-1,0,-1):
r[i-1] = gcd(r[i],a[i])
for i in range(n):
ans = max(ans,gcd(l[i],r[i]))
... | from math import gcd
n=int(eval(input()))
a=list(map(int,input().split()))
l=[0]*n
r=[0]*n
for i in range(n-1):
l[i+1]=gcd(l[i],a[i])
for i in range(n-1,0,-1):
r[i-1]=gcd(r[i],a[i])
ans=0
for i in range(n):
ans=max(ans,gcd(l[i],r[i]))
print(ans) | 19 | 15 | 328 | 261 | # ABC125 C - GCD on Blackboard
from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
l = n * [0]
r = n * [0]
ans = 0
for i in range(n - 1):
l[i + 1] = gcd(l[i], a[i])
for i in range(n - 1, 0, -1):
r[i - 1] = gcd(r[i], a[i])
for i in range(n):
ans = max(ans, gcd(l[i], r[i]))
p... | from math import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
l = [0] * n
r = [0] * n
for i in range(n - 1):
l[i + 1] = gcd(l[i], a[i])
for i in range(n - 1, 0, -1):
r[i - 1] = gcd(r[i], a[i])
ans = 0
for i in range(n):
ans = max(ans, gcd(l[i], r[i]))
print(ans)
| false | 21.052632 | [
"-# ABC125 C - GCD on Blackboard",
"-from fractions import gcd",
"+from math import gcd",
"-l = n * [0]",
"-r = n * [0]",
"-ans = 0",
"+l = [0] * n",
"+r = [0] * n",
"+ans = 0"
] | false | 0.090479 | 0.047781 | 1.893605 | [
"s510270052",
"s035795610"
] |
u227082700 | p02714 | python | s480625060 | s151702624 | 1,839 | 1,453 | 9,216 | 9,156 | Accepted | Accepted | 20.99 | n=int(eval(input()))
s=eval(input())
r=g=b=0
for i in s:
if i=="R":r+=1
elif i=="G":g+=1
else:b+=1
ans=r*g*b
for i in range(1,n//2+2):
for j in range(n):
if j+i+i>=n:break
if not(s[j]==s[j+i] or s[j+i]==s[j+i+i] or s[j]==s[j+i+i]):ans-=1
print(ans) | n=int(eval(input()))
s=eval(input())
r=g=b=0
for i in s:
if i=="R":r+=1
elif i=="G":g+=1
else:b+=1
ans=r*g*b
for i in range(n-2):
for j in range(i+1,n-1):
k=j+(j-i)
if k>=n:break
if not(s[i]==s[j] or s[j]==s[k] or s[i]==s[k]):ans-=1
print(ans) | 13 | 14 | 264 | 264 | n = int(eval(input()))
s = eval(input())
r = g = b = 0
for i in s:
if i == "R":
r += 1
elif i == "G":
g += 1
else:
b += 1
ans = r * g * b
for i in range(1, n // 2 + 2):
for j in range(n):
if j + i + i >= n:
break
if not (s[j] == s[j + i] or s[j + i] ==... | n = int(eval(input()))
s = eval(input())
r = g = b = 0
for i in s:
if i == "R":
r += 1
elif i == "G":
g += 1
else:
b += 1
ans = r * g * b
for i in range(n - 2):
for j in range(i + 1, n - 1):
k = j + (j - i)
if k >= n:
break
if not (s[i] == s[j]... | false | 7.142857 | [
"-for i in range(1, n // 2 + 2):",
"- for j in range(n):",
"- if j + i + i >= n:",
"+for i in range(n - 2):",
"+ for j in range(i + 1, n - 1):",
"+ k = j + (j - i)",
"+ if k >= n:",
"- if not (s[j] == s[j + i] or s[j + i] == s[j + i + i] or s[j] == s[j + i + i]):",
... | false | 0.069023 | 0.088163 | 0.782908 | [
"s480625060",
"s151702624"
] |
u546285759 | p00049 | python | s586545215 | s891041950 | 30 | 20 | 7,348 | 7,328 | Accepted | Accepted | 33.33 | d = {"A": 0, "AB": 0, "B": 0, "O": 0}
flag = 1
while flag:
try:
_, blood_type = input().split(',')
d[blood_type] += 1
except:
for blood_type in ["A", "B", "AB", "O"]:
print((d[blood_type]))
flag = 0 | d = []
flag = 1
while flag:
try:
_, blood_type = input().split(',')
d.append(blood_type)
except:
for blood_type in ["A", "B", "AB", "O"]:
print((d.count(blood_type)))
flag = 0 | 10 | 10 | 257 | 234 | d = {"A": 0, "AB": 0, "B": 0, "O": 0}
flag = 1
while flag:
try:
_, blood_type = input().split(",")
d[blood_type] += 1
except:
for blood_type in ["A", "B", "AB", "O"]:
print((d[blood_type]))
flag = 0
| d = []
flag = 1
while flag:
try:
_, blood_type = input().split(",")
d.append(blood_type)
except:
for blood_type in ["A", "B", "AB", "O"]:
print((d.count(blood_type)))
flag = 0
| false | 0 | [
"-d = {\"A\": 0, \"AB\": 0, \"B\": 0, \"O\": 0}",
"+d = []",
"- d[blood_type] += 1",
"+ d.append(blood_type)",
"- print((d[blood_type]))",
"+ print((d.count(blood_type)))"
] | false | 0.09547 | 0.091164 | 1.047236 | [
"s586545215",
"s891041950"
] |
u307516601 | p03074 | python | s968039833 | s376018744 | 128 | 115 | 9,932 | 13,748 | Accepted | Accepted | 10.16 | """
keyword: 尺取法
"""
import sys
sys.setrecursionlimit(10**6)
n, k = list(map(int, input().split()))
s = eval(input())
nums = []
now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか
for i in range(n):
if s[i] == str(now):
cnt += 1
else:
nums.append(cnt)
now ^= 1 # 0と1を切り替える
... | """
keyword: 累積和
"""
import sys
sys.setrecursionlimit(10**6)
n, k = list(map(int, input().split()))
s = eval(input())
nums = []
now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか
for i in range(n):
if s[i] == str(now):
cnt += 1
else:
nums.append(cnt)
now ^= 1 # 0と1を切り替える
... | 55 | 50 | 1,050 | 956 | """
keyword: 尺取法
"""
import sys
sys.setrecursionlimit(10**6)
n, k = list(map(int, input().split()))
s = eval(input())
nums = []
now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか
for i in range(n):
if s[i] == str(now):
cnt += 1
else:
nums.append(cnt)
now ^= 1 # 0と1を切り替える
cnt = 1 # 新しい... | """
keyword: 累積和
"""
import sys
sys.setrecursionlimit(10**6)
n, k = list(map(int, input().split()))
s = eval(input())
nums = []
now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか
for i in range(n):
if s[i] == str(now):
cnt += 1
else:
nums.append(cnt)
now ^= 1 # 0と1を切り替える
cnt = 1 # 新しい... | false | 9.090909 | [
"-keyword: 尺取法",
"+keyword: 累積和",
"+# 累積和を作る",
"+tot = [0] * (len(nums) + 1)",
"+for i in range(len(nums)):",
"+ tot[i + 1] = tot[i] + nums[i]",
"-left = 0",
"-right = 0",
"-tmp = 0 # [left, right)のsum",
"- nextleft = i",
"- nextright = min(i + add, len(nums))",
"- # 左端を移動",
"- ... | false | 0.086399 | 0.082052 | 1.052981 | [
"s968039833",
"s376018744"
] |
u698919163 | p02888 | python | s182162398 | s335833419 | 1,654 | 1,139 | 3,188 | 9,220 | Accepted | Accepted | 31.14 | N = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
import bisect
ans = 0
for i in range(N-2):
for j in range(i+1,N-1):
a = L[i]
b = L[j]
insert_index = bisect.bisect_left(L,a+b)
#print(insert_index,a,b,a+b)
if i < insert_... | N = int(eval(input()))
L = list(map(int,input().split()))
import bisect
ans = 0
L.sort()
for i in range(0,N-2):
for j in range(i+1,N-1):
a = L[i]
b = L[j]
index = bisect.bisect_left(L,a+b)
if index > j:
ans += index-j-1
print(ans) | 21 | 16 | 421 | 302 | N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
import bisect
ans = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
a = L[i]
b = L[j]
insert_index = bisect.bisect_left(L, a + b)
# print(insert_index,a,b,a+b)
if i < insert_index:
ans += ... | N = int(eval(input()))
L = list(map(int, input().split()))
import bisect
ans = 0
L.sort()
for i in range(0, N - 2):
for j in range(i + 1, N - 1):
a = L[i]
b = L[j]
index = bisect.bisect_left(L, a + b)
if index > j:
ans += index - j - 1
print(ans)
| false | 23.809524 | [
"-L.sort()",
"-for i in range(N - 2):",
"+L.sort()",
"+for i in range(0, N - 2):",
"- insert_index = bisect.bisect_left(L, a + b)",
"- # print(insert_index,a,b,a+b)",
"- if i < insert_index:",
"- ans += insert_index - j - 1",
"- # print(i,j,insert_index)",
... | false | 0.071106 | 0.105529 | 0.67381 | [
"s182162398",
"s335833419"
] |
u905203728 | p03157 | python | s139616659 | s891779373 | 1,297 | 153 | 360,708 | 78,068 | Accepted | Accepted | 88.2 | import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
def DFS(add,next,cnt):
x,y=add
for i,j in [[1,0],[-1,0],[0,1],[0,-1]]:
X,Y=x+i,y+j
if 0<=X<h and 0<=Y<w:
if S[X][Y]==next and color[X][Y]=="white":
color[X][Y]=str(cnt)
DFS(... | from collections import deque
def BFS():
color=[["white" for _ in range(w)] for _ in range(h)]
queue=deque([])
ans=0
for i in range(h):
for j in range(w):
if color[i][j]=="white" and S[i][j]=="#":
queue.append([i,j])
color[i][j]="gray"
... | 37 | 36 | 946 | 1,072 | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
def DFS(add, next, cnt):
x, y = add
for i, j in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
X, Y = x + i, y + j
if 0 <= X < h and 0 <= Y < w:
if S[X][Y] == next and color[X][Y] == "white":
color[X][Y] = str... | from collections import deque
def BFS():
color = [["white" for _ in range(w)] for _ in range(h)]
queue = deque([])
ans = 0
for i in range(h):
for j in range(w):
if color[i][j] == "white" and S[i][j] == "#":
queue.append([i, j])
color[i][j] = "gray"
... | false | 2.702703 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"-input = sys.stdin.readline",
"+from collections import deque",
"-def DFS(add, next, cnt):",
"- x, y = add",
"- for i, j in [[1, 0], [-1, 0], [0, 1], [0, -1]]:",
"- X, Y = x + i, y + j",
"- if 0 <= X < h and 0 <= Y < w:",
... | false | 0.037662 | 0.036034 | 1.045172 | [
"s139616659",
"s891779373"
] |
u280552586 | p03292 | python | s522727027 | s913717544 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | a, b, c =sorted(map(int, input().split()), reverse=True)
print(((a-b)+(b-c))) | a = list(map(int, input().split()))
a.sort()
print((abs(a[2]-a[1])+abs(a[1]-a[0])))
| 2 | 3 | 76 | 84 | a, b, c = sorted(map(int, input().split()), reverse=True)
print(((a - b) + (b - c)))
| a = list(map(int, input().split()))
a.sort()
print((abs(a[2] - a[1]) + abs(a[1] - a[0])))
| false | 33.333333 | [
"-a, b, c = sorted(map(int, input().split()), reverse=True)",
"-print(((a - b) + (b - c)))",
"+a = list(map(int, input().split()))",
"+a.sort()",
"+print((abs(a[2] - a[1]) + abs(a[1] - a[0])))"
] | false | 0.037317 | 0.036392 | 1.025423 | [
"s522727027",
"s913717544"
] |
u608088992 | p02792 | python | s874976479 | s299327971 | 297 | 156 | 3,064 | 9,184 | Accepted | Accepted | 47.47 | import sys
def solve():
N = int(eval(input()))
D = dict()
for i in range(1, N + 1):
front = i % 10
back = i
while back >= 10: back //= 10
if front > 0:
if (front, back) in D: D[(front, back)] += 1
else: D[(front, back)] = 1
Ans = 0
... | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
dictType = dict()
for i in range(1, 10):
for j in range(1, 10): dictType[(i, j)] = 0
for i in range(1, N + 1):
bottom = i % 10
if bottom == 0: continue
top = i
while top >= ... | 25 | 28 | 589 | 640 | import sys
def solve():
N = int(eval(input()))
D = dict()
for i in range(1, N + 1):
front = i % 10
back = i
while back >= 10:
back //= 10
if front > 0:
if (front, back) in D:
D[(front, back)] += 1
else:
D[(... | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
dictType = dict()
for i in range(1, 10):
for j in range(1, 10):
dictType[(i, j)] = 0
for i in range(1, N + 1):
bottom = i % 10
if bottom == 0:
continue
top = i
... | false | 10.714286 | [
"+ input = sys.stdin.readline",
"- D = dict()",
"+ dictType = dict()",
"+ for i in range(1, 10):",
"+ for j in range(1, 10):",
"+ dictType[(i, j)] = 0",
"- front = i % 10",
"- back = i",
"- while back >= 10:",
"- back //= 10",
"- ... | false | 0.053438 | 0.092987 | 0.574684 | [
"s874976479",
"s299327971"
] |
u827885761 | p03045 | python | s413450164 | s936311268 | 713 | 524 | 110,204 | 110,212 | Accepted | Accepted | 26.51 | import sys
sys.setrecursionlimit(10**6)
n, m = list(map(int, input().split()))
t = [[] for i in range(n)]
c = [-1 for i in range(n)]
for i in range(m):
x, y ,z = list(map(int, input().split()))
x -= 1
y -= 1
t[x].append(y)
t[y].append(x)
def dfs(num, depth):
if c[num] != -1:
... | import sys
sys.setrecursionlimit(10**6)
n, m = list(map(int, input().split()))
t = [[] for i in range(n)]
c = [-1 for i in range(n)]
for line in sys.stdin:
x, y ,z = list(map(int, line.split()))
x -= 1
y -= 1
t[x].append(y)
t[y].append(x)
def dfs(num, depth):
if c[num] != -1:
... | 30 | 30 | 511 | 509 | import sys
sys.setrecursionlimit(10**6)
n, m = list(map(int, input().split()))
t = [[] for i in range(n)]
c = [-1 for i in range(n)]
for i in range(m):
x, y, z = list(map(int, input().split()))
x -= 1
y -= 1
t[x].append(y)
t[y].append(x)
def dfs(num, depth):
if c[num] != -1:
return
... | import sys
sys.setrecursionlimit(10**6)
n, m = list(map(int, input().split()))
t = [[] for i in range(n)]
c = [-1 for i in range(n)]
for line in sys.stdin:
x, y, z = list(map(int, line.split()))
x -= 1
y -= 1
t[x].append(y)
t[y].append(x)
def dfs(num, depth):
if c[num] != -1:
return
... | false | 0 | [
"-for i in range(m):",
"- x, y, z = list(map(int, input().split()))",
"+for line in sys.stdin:",
"+ x, y, z = list(map(int, line.split()))",
"-print((max(c)))",
"+print(cnt)"
] | false | 0.04814 | 0.080909 | 0.59499 | [
"s413450164",
"s936311268"
] |
u352394527 | p00099 | python | s404759173 | s928585670 | 2,660 | 2,270 | 158,060 | 158,064 | Accepted | Accepted | 14.66 | """
セグメント木
"""
INF = 10 ** 20
n, q = list(map(int, input().split()))
size = 1
while size < n:
size *= 2
size = size * 2 - 1
seg_tree = [(INF, 0) for _ in range(size)]
def update(a, v):
ind = (size - 1) // 2 + a
prea, prev = seg_tree[ind]
seg_tree[ind] = (a + 1, prev + v)
while ind > 0:
... | """
セグメント木
"""
INF = 10 ** 20
def main():
n, q = list(map(int, input().split()))
size = 1
while size < n:
size *= 2
size = size * 2 - 1
seg_tree = [(INF, 0) for _ in range(size)]
def update(a, v):
ind = (size - 1) // 2 + a
prea, prev = seg_tree[ind]
seg_tree[ind... | 33 | 37 | 647 | 722 | """
セグメント木
"""
INF = 10**20
n, q = list(map(int, input().split()))
size = 1
while size < n:
size *= 2
size = size * 2 - 1
seg_tree = [(INF, 0) for _ in range(size)]
def update(a, v):
ind = (size - 1) // 2 + a
prea, prev = seg_tree[ind]
seg_tree[ind] = (a + 1, prev + v)
while ind > 0:
ind =... | """
セグメント木
"""
INF = 10**20
def main():
n, q = list(map(int, input().split()))
size = 1
while size < n:
size *= 2
size = size * 2 - 1
seg_tree = [(INF, 0) for _ in range(size)]
def update(a, v):
ind = (size - 1) // 2 + a
prea, prev = seg_tree[ind]
seg_tree[ind]... | false | 10.810811 | [
"-n, q = list(map(int, input().split()))",
"-size = 1",
"-while size < n:",
"- size *= 2",
"-size = size * 2 - 1",
"-seg_tree = [(INF, 0) for _ in range(size)]",
"-def update(a, v):",
"- ind = (size - 1) // 2 + a",
"- prea, prev = seg_tree[ind]",
"- seg_tree[ind] = (a + 1, prev + v)",
... | false | 0.037433 | 0.050457 | 0.741888 | [
"s404759173",
"s928585670"
] |
u047931063 | p02612 | python | s244798040 | s552809792 | 73 | 65 | 61,736 | 61,788 | Accepted | Accepted | 10.96 | N = int(eval(input()))
if N%1000 != 0:
print((1000 - N%1000))
else:
print((0))
| # n, m, l = map(int, input().split())
# list_n = list(map(int, input().split()))
# n = input()
# list = [input() for i in range(N)
# list = [[i for i in range(N)] for _ in range(M)]
import sys
input = sys.stdin.readline
N = int(eval(input()))
if N % 1000 != 0:
print((1000 - N % 1000))
else:
... | 5 | 17 | 77 | 322 | N = int(eval(input()))
if N % 1000 != 0:
print((1000 - N % 1000))
else:
print((0))
| # n, m, l = map(int, input().split())
# list_n = list(map(int, input().split()))
# n = input()
# list = [input() for i in range(N)
# list = [[i for i in range(N)] for _ in range(M)]
import sys
input = sys.stdin.readline
N = int(eval(input()))
if N % 1000 != 0:
print((1000 - N % 1000))
else:
print((0))
| false | 70.588235 | [
"+# n, m, l = map(int, input().split())",
"+# list_n = list(map(int, input().split()))",
"+# n = input()",
"+# list = [input() for i in range(N)",
"+# list = [[i for i in range(N)] for _ in range(M)]",
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.039013 | 0.087812 | 0.444275 | [
"s244798040",
"s552809792"
] |
u316268279 | p00440 | python | s550660131 | s849906721 | 420 | 190 | 11,200 | 9,528 | Accepted | Accepted | 54.76 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
N,K = list(map(int,input().split()))
A = sorted([int(eval(input())) for i in range(0,K)])
if (N,K) == (0,0):
break
if A[0] == 0:
flag = True
A = A[1:]
K -= 1
else:
flag = False
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
N,K = list(map(int,input().split()))
A = sorted([int(input()) for i in range(0,K)])
if (N,K) == (0,0):
break
if A[0] == 0:
flag = True
A = A[1:]
K -= 1
else:
flag = False
ans = ... | 43 | 43 | 950 | 958 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
N, K = list(map(int, input().split()))
A = sorted([int(eval(input())) for i in range(0, K)])
if (N, K) == (0, 0):
break
if A[0] == 0:
flag = True
A = A[1:]
K -= 1
else:
flag = False
ans = 0
coun... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
N, K = list(map(int, input().split()))
A = sorted([int(input()) for i in range(0, K)])
if (N, K) == (0, 0):
break
if A[0] == 0:
flag = True
A = A[1:]
K -= 1
else:
flag = False
ans = 0
count = 0
... | false | 0 | [
"- A = sorted([int(eval(input())) for i in range(0, K)])",
"+ A = sorted([int(input()) for i in range(0, K)])"
] | false | 0.06685 | 0.040936 | 1.633028 | [
"s550660131",
"s849906721"
] |
u021019433 | p02642 | python | s478775263 | s015209655 | 1,387 | 151 | 32,224 | 99,908 | Accepted | Accepted | 89.11 | N = 1000001
a = [0]* N
eval(input())
for x in input().split():
a[int(x)] += 1
for i in range(1, N):
for j in range(i + i, N, i):
if a[i]:
a[j] = 0
print((a.count(1)))
| N = 1000001
a = [0]* N
eval(input())
for x in input().split():
a[int(x)] += 1
for i in range(1, N):
if a[i]:
for j in range(i + i, N, i):
a[j] = 0
print((a.count(1)))
| 10 | 10 | 182 | 182 | N = 1000001
a = [0] * N
eval(input())
for x in input().split():
a[int(x)] += 1
for i in range(1, N):
for j in range(i + i, N, i):
if a[i]:
a[j] = 0
print((a.count(1)))
| N = 1000001
a = [0] * N
eval(input())
for x in input().split():
a[int(x)] += 1
for i in range(1, N):
if a[i]:
for j in range(i + i, N, i):
a[j] = 0
print((a.count(1)))
| false | 0 | [
"- for j in range(i + i, N, i):",
"- if a[i]:",
"+ if a[i]:",
"+ for j in range(i + i, N, i):"
] | false | 2.682715 | 0.247684 | 10.831207 | [
"s478775263",
"s015209655"
] |
u077291787 | p02614 | python | s791949146 | s962186037 | 67 | 57 | 9,124 | 9,196 | Accepted | Accepted | 14.93 | # C - H and V
def main():
H, W, K, *C = open(0).read().split()
H, W, K, C = int(H), int(W), int(K), "".join(C)
res = 0
for bit in range(1 << (H + W)):
cnt_black = sum(
C[i * W + j] == "#" and not (bit >> i) & 1 and not (bit >> (j + H)) & 1
for i in range(H)
... | # C - H and V
def main():
H, W, K = list(map(int, input().split()))
C = [input().rstrip() for _ in range(H)]
res = 0
for bit in range(1 << (H + W)):
cnt_black = sum(
C[i][j] == "#" and not (bit >> i) & 1 and not (bit >> (j + H)) & 1
for i in range(H)
... | 18 | 18 | 466 | 453 | # C - H and V
def main():
H, W, K, *C = open(0).read().split()
H, W, K, C = int(H), int(W), int(K), "".join(C)
res = 0
for bit in range(1 << (H + W)):
cnt_black = sum(
C[i * W + j] == "#" and not (bit >> i) & 1 and not (bit >> (j + H)) & 1
for i in range(H)
fo... | # C - H and V
def main():
H, W, K = list(map(int, input().split()))
C = [input().rstrip() for _ in range(H)]
res = 0
for bit in range(1 << (H + W)):
cnt_black = sum(
C[i][j] == "#" and not (bit >> i) & 1 and not (bit >> (j + H)) & 1
for i in range(H)
for j in ... | false | 0 | [
"- H, W, K, *C = open(0).read().split()",
"- H, W, K, C = int(H), int(W), int(K), \"\".join(C)",
"+ H, W, K = list(map(int, input().split()))",
"+ C = [input().rstrip() for _ in range(H)]",
"- C[i * W + j] == \"#\" and not (bit >> i) & 1 and not (bit >> (j + H)) & 1",
"+ ... | false | 0.08276 | 0.049762 | 1.663126 | [
"s791949146",
"s962186037"
] |
u327179339 | p02839 | python | s691021811 | s175526696 | 1,659 | 261 | 250,248 | 57,052 | Accepted | Accepted | 84.27 | h, w = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(h)]
B = [list(map(int, input().split())) for _ in range(h)]
grid = [[0] * w for _ in range(h)]
for i in range(h):
for j in range(w):
m = abs(A[i][j] - B[i][j])
grid[i][j] = m
bias_inf = 2000
dp = [[... | def solve(h, w, A, B):
center = 80 * (h + w - 1)
C = [[abs(A[r][c] - B[r][c]) for c in range(w)] for r in range(h)]
dp = [[0] * w for r in range(h)]
dp[0][0] = (1 << (center + C[0][0])) | (1 << (center - C[0][0]))
for r in range(h):
for c in range(w):
if r > 0:
... | 35 | 17 | 1,280 | 735 | h, w = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(h)]
B = [list(map(int, input().split())) for _ in range(h)]
grid = [[0] * w for _ in range(h)]
for i in range(h):
for j in range(w):
m = abs(A[i][j] - B[i][j])
grid[i][j] = m
bias_inf = 2000
dp = [[[0 for i in... | def solve(h, w, A, B):
center = 80 * (h + w - 1)
C = [[abs(A[r][c] - B[r][c]) for c in range(w)] for r in range(h)]
dp = [[0] * w for r in range(h)]
dp[0][0] = (1 << (center + C[0][0])) | (1 << (center - C[0][0]))
for r in range(h):
for c in range(w):
if r > 0:
dp... | false | 51.428571 | [
"+def solve(h, w, A, B):",
"+ center = 80 * (h + w - 1)",
"+ C = [[abs(A[r][c] - B[r][c]) for c in range(w)] for r in range(h)]",
"+ dp = [[0] * w for r in range(h)]",
"+ dp[0][0] = (1 << (center + C[0][0])) | (1 << (center - C[0][0]))",
"+ for r in range(h):",
"+ for c in range(w)... | false | 0.041626 | 0.035768 | 1.163776 | [
"s691021811",
"s175526696"
] |
u662430503 | p04045 | python | s690771995 | s836020738 | 108 | 92 | 3,060 | 2,940 | Accepted | Accepted | 14.81 | def main():
num = list(map(int,input().split()))
bad = list(map(int,input().split()))
while True :
flg=0
for i in range(0,len(str(num[0]))):
stnum=str(num[0])
if int(stnum[i]) in bad:
flg=1
break
if flg==1:
num[0]+=1
continue
else:
break
print((num[0]))
... | def main():
num = list(map(int,input().split()))
bad = list(map(str,input().split()))
while True :
flg=0
for i in range(0,len(str(num[0]))):
stnum=str(num[0])
if stnum[i] in bad:
flg=1
break
if flg==1:
num[0]+=1
continue
else:
break
print((num[0]))
mai... | 22 | 22 | 326 | 321 | def main():
num = list(map(int, input().split()))
bad = list(map(int, input().split()))
while True:
flg = 0
for i in range(0, len(str(num[0]))):
stnum = str(num[0])
if int(stnum[i]) in bad:
flg = 1
break
if flg == 1:
... | def main():
num = list(map(int, input().split()))
bad = list(map(str, input().split()))
while True:
flg = 0
for i in range(0, len(str(num[0]))):
stnum = str(num[0])
if stnum[i] in bad:
flg = 1
break
if flg == 1:
num[... | false | 0 | [
"- bad = list(map(int, input().split()))",
"+ bad = list(map(str, input().split()))",
"- if int(stnum[i]) in bad:",
"+ if stnum[i] in bad:"
] | false | 0.082568 | 0.042697 | 1.933794 | [
"s690771995",
"s836020738"
] |
u072053884 | p02262 | python | s216076936 | s809324864 | 24,460 | 12,740 | 128,612 | 127,944 | Accepted | Accepted | 47.91 | import sys
A = list(map(int, sys.stdin.read().rstrip().split("\n")))
n = A[0]
del A[0]
#shellSort
cnt = 0
G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
m = len(G)
for i in range(m):
g = G[i]
# insertionSort
for j in range(g, n):
v = A[j]
... | import sys
def insertionSort(A, n, g):
global cnt
for i in range(g, n):
v = A[i]
j = i - g
while (j >= 0) and (A[j] > v):
A[j + g] = A[j]
j = j - g
cnt += 1
A[j + g] = v
def shellSort(A, n):
G = [i for i in [262913, 65921, 1... | 29 | 32 | 532 | 615 | import sys
A = list(map(int, sys.stdin.read().rstrip().split("\n")))
n = A[0]
del A[0]
# shellSort
cnt = 0
G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
m = len(G)
for i in range(m):
g = G[i]
# insertionSort
for j in range(g, n):
v = A[j]
k = j - g
... | import sys
def insertionSort(A, n, g):
global cnt
for i in range(g, n):
v = A[i]
j = i - g
while (j >= 0) and (A[j] > v):
A[j + g] = A[j]
j = j - g
cnt += 1
A[j + g] = v
def shellSort(A, n):
G = [i for i in [262913, 65921, 16577, 4193, ... | false | 9.375 | [
"-A = list(map(int, sys.stdin.read().rstrip().split(\"\\n\")))",
"+",
"+def insertionSort(A, n, g):",
"+ global cnt",
"+ for i in range(g, n):",
"+ v = A[i]",
"+ j = i - g",
"+ while (j >= 0) and (A[j] > v):",
"+ A[j + g] = A[j]",
"+ j = j - g",
"... | false | 0.159901 | 0.082361 | 1.941453 | [
"s216076936",
"s809324864"
] |
u401487574 | p03078 | python | s885187816 | s640364378 | 635 | 480 | 220,284 | 90,276 | Accepted | Accepted | 24.41 | ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
x,y,z,k = ma()
A = l... | ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
x,y,z,k = ma()
A = l... | 26 | 34 | 601 | 909 | ma = lambda: map(int, input().split())
lma = lambda: list(map(int, input().split()))
tma = lambda: tuple(map(int, input().split()))
ni = lambda: int(input())
yn = lambda fl: print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
x, y, z, k = ma()
A = lma... | ma = lambda: map(int, input().split())
lma = lambda: list(map(int, input().split()))
tma = lambda: tuple(map(int, input().split()))
ni = lambda: int(input())
yn = lambda fl: print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
x, y, z, k = ma()
A = lma... | false | 23.529412 | [
"-AB = [a + b for a in A for b in B]",
"-AB.sort(reverse=True)",
"+A.sort(reverse=True)",
"+B.sort(reverse=True)",
"-ans = []",
"-iab = min(k, x * y)",
"-ic = min(k, z)",
"-for i in range(ic):",
"- for j in range(iab):",
"- ans.append(AB[j] + C[i])",
"-ans.sort(reverse=True)",
"-for ... | false | 0.075379 | 0.050508 | 1.492408 | [
"s885187816",
"s640364378"
] |
u912237403 | p00140 | python | s043884131 | s123759119 | 20 | 10 | 4,220 | 4,224 | Accepted | Accepted | 50 | for _ in [0]*eval(input()):
A = '012345678954321'
a, b = input().split()
n = 15
for _ in [0]*A.count(a):
I = A.index(a)
A = A[I:]+A[:I]
I = A.index(b)
if n>I:
n = I
x = A[:I+1]
A = A[1:]+A[0]
for e in x:
print(e, end=' ')
print() | for _ in [0]*eval(input()):
A = "012345678954321"
a, b = input().split()
n = 15
for _ in [0]*A.count(a):
I = A.index(a)
A = A[I:]+A[:I]
I = A.index(b)
if n>I:
n = I
x = A[:I+1]
A = A[1:]+A[0]
print(" ".join(x)) | 15 | 13 | 278 | 261 | for _ in [0] * eval(input()):
A = "012345678954321"
a, b = input().split()
n = 15
for _ in [0] * A.count(a):
I = A.index(a)
A = A[I:] + A[:I]
I = A.index(b)
if n > I:
n = I
x = A[: I + 1]
A = A[1:] + A[0]
for e in x:
print(e, en... | for _ in [0] * eval(input()):
A = "012345678954321"
a, b = input().split()
n = 15
for _ in [0] * A.count(a):
I = A.index(a)
A = A[I:] + A[:I]
I = A.index(b)
if n > I:
n = I
x = A[: I + 1]
A = A[1:] + A[0]
print(" ".join(x))
| false | 13.333333 | [
"- for e in x:",
"- print(e, end=\" \")",
"- print()",
"+ print(\" \".join(x))"
] | false | 0.008741 | 0.035326 | 0.247442 | [
"s043884131",
"s123759119"
] |
u078042885 | p02417 | python | s230579929 | s147959632 | 30 | 20 | 7,492 | 7,424 | Accepted | Accepted | 33.33 | import sys
s=s = sys.stdin.read().lower()
for i in range(97,123):print((chr(i),':',s.count(chr(i)))) | import sys
s=sys.stdin.read().lower()
for i in range(97,123):print((chr(i),':',s.count(chr(i)))) | 3 | 3 | 100 | 96 | import sys
s = s = sys.stdin.read().lower()
for i in range(97, 123):
print((chr(i), ":", s.count(chr(i))))
| import sys
s = sys.stdin.read().lower()
for i in range(97, 123):
print((chr(i), ":", s.count(chr(i))))
| false | 0 | [
"-s = s = sys.stdin.read().lower()",
"+s = sys.stdin.read().lower()"
] | false | 0.060798 | 0.066466 | 0.914722 | [
"s230579929",
"s147959632"
] |
u535803878 | p02710 | python | s987568608 | s089007621 | 1,872 | 1,676 | 427,260 | 427,736 | Accepted | Accepted | 10.47 |
import sys
# 小さすぎても怒られるので
from collections import defaultdict
n = int(eval(input()))
sys.setrecursionlimit(max(1000, 2*n))
cs = [0] + [int(c) for c in input().split()]
ns = defaultdict(set)
for _ in range(n-1):
a,b = [int(c) for c in input().split()]
ns[a].add(b)
ns[b].add(a)
ans = [0] * (n... |
import sys
input = lambda : sys.stdin.readline().rstrip()
# 小さすぎても怒られるので
from collections import defaultdict
n = int(eval(input()))
sys.setrecursionlimit(max(1000, 2*n))
cs = [0] + [int(c) for c in input().split()]
ns = defaultdict(set)
for _ in range(n-1):
a,b = [int(c) for c in input().split()]
... | 48 | 50 | 1,094 | 1,144 | import sys
# 小さすぎても怒られるので
from collections import defaultdict
n = int(eval(input()))
sys.setrecursionlimit(max(1000, 2 * n))
cs = [0] + [int(c) for c in input().split()]
ns = defaultdict(set)
for _ in range(n - 1):
a, b = [int(c) for c in input().split()]
ns[a].add(b)
ns[b].add(a)
ans = [0] * (n + 1) # k... | import sys
input = lambda: sys.stdin.readline().rstrip()
# 小さすぎても怒られるので
from collections import defaultdict
n = int(eval(input()))
sys.setrecursionlimit(max(1000, 2 * n))
cs = [0] + [int(c) for c in input().split()]
ns = defaultdict(set)
for _ in range(n - 1):
a, b = [int(c) for c in input().split()]
ns[a].ad... | false | 4 | [
"+input = lambda: sys.stdin.readline().rstrip()"
] | false | 0.048484 | 0.093076 | 0.520911 | [
"s987568608",
"s089007621"
] |
u120691615 | p03078 | python | s690926896 | s431845116 | 982 | 119 | 147,776 | 8,708 | Accepted | Accepted | 87.88 | 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()))
ab = []
for i in range(x):
for j in range(y):
ab.append(a[i] + b[j])
ab.sort(reverse = True)
abc = []
for i in range(min(k,len(ab))):
for j in ... | 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)
c.sort(reverse = True)
abc = []
for i in range(x):
for j in range(y):
if (i + 1) * (j + 1) > k:
... | 20 | 23 | 426 | 541 | 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()))
ab = []
for i in range(x):
for j in range(y):
ab.append(a[i] + b[j])
ab.sort(reverse=True)
abc = []
for i in range(min(k, len(ab))):
for j in range(z):... | 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)
c.sort(reverse=True)
abc = []
for i in range(x):
for j in range(y):
if (i + 1) * (j + 1) > k:
break
... | false | 13.043478 | [
"-ab = []",
"+a.sort(reverse=True)",
"+b.sort(reverse=True)",
"+c.sort(reverse=True)",
"+abc = []",
"- ab.append(a[i] + b[j])",
"-ab.sort(reverse=True)",
"-abc = []",
"-for i in range(min(k, len(ab))):",
"- for j in range(z):",
"- abc.append(ab[i] + c[j])",
"+ if (i + 1... | false | 0.038001 | 0.040568 | 0.936732 | [
"s690926896",
"s431845116"
] |
u945335181 | p03160 | python | s128765610 | s073409232 | 240 | 121 | 52,208 | 20,444 | Accepted | Accepted | 49.58 | n = int(eval(input()))
h = list(map(int,input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2,n):
dp[i] = min(dp[i-2] + abs(h[i-2] - h[i]), dp[i-1] + abs(h[i-1] - h[i]))
print((dp[n-1]))
| n = int(eval(input()))
pedras = list(map(int,input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(pedras[0] - pedras[1])
for i in range(2,n):
custo1 = dp[i-1] + abs(pedras[i-1] - pedras[i])
custo2 = dp[i-2] + abs(pedras[i-2] - pedras[i])
dp[i] = min(custo1,custo2)
print((dp[n-1]))
| 13 | 16 | 229 | 307 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]))
print((dp[n - 1]))
| n = int(eval(input()))
pedras = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(pedras[0] - pedras[1])
for i in range(2, n):
custo1 = dp[i - 1] + abs(pedras[i - 1] - pedras[i])
custo2 = dp[i - 2] + abs(pedras[i - 2] - pedras[i])
dp[i] = min(custo1, custo2)
print((dp[n - 1]))
| false | 18.75 | [
"-h = list(map(int, input().split()))",
"+pedras = list(map(int, input().split()))",
"-dp[1] = abs(h[1] - h[0])",
"+dp[1] = abs(pedras[0] - pedras[1])",
"- dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]))",
"+ custo1 = dp[i - 1] + abs(pedras[i - 1] - pedras[i])",
"+ ... | false | 0.090537 | 0.048306 | 1.874241 | [
"s128765610",
"s073409232"
] |
u463775490 | p03262 | python | s200575034 | s608139533 | 148 | 135 | 16,304 | 14,600 | Accepted | Accepted | 8.78 | #import math
import fractions
from functools import reduce
def gcdList(ls):
# return reduce(math.gcd, ls)
return reduce(fractions.gcd, ls)
n,y = list(map(int,input().split()))
x = sorted([int(i) for i in input().split()])
x_ = [0 for _ in range(n)]
for i in range(n):
x_[i] = abs(y-x[i])
print(... | #import math
#import fractions
from functools import reduce
'''
def gcdList(ls):
return reduce(math.gcd, ls)
# return reduce(fractions.gcd, ls)
'''
def gcd(a,b):
while b:
a, b = b, a % b
return a
def gcdList(ls):
return reduce(gcd,ls)
n,y = list(map(int,input().split()))
... | 14 | 23 | 326 | 452 | # import math
import fractions
from functools import reduce
def gcdList(ls):
# return reduce(math.gcd, ls)
return reduce(fractions.gcd, ls)
n, y = list(map(int, input().split()))
x = sorted([int(i) for i in input().split()])
x_ = [0 for _ in range(n)]
for i in range(n):
x_[i] = abs(y - x[i])
print((g... | # import math
# import fractions
from functools import reduce
"""
def gcdList(ls):
return reduce(math.gcd, ls)
# return reduce(fractions.gcd, ls)
"""
def gcd(a, b):
while b:
a, b = b, a % b
return a
def gcdList(ls):
return reduce(gcd, ls)
n, y = list(map(int, input().split()))
x = sort... | false | 39.130435 | [
"-import fractions",
"+# import fractions",
"+",
"+\"\"\"",
"+def gcdList(ls):",
"+ return reduce(math.gcd, ls)",
"+# return reduce(fractions.gcd, ls)",
"+\"\"\"",
"+",
"+",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"- # return reduce(ma... | false | 0.151064 | 0.03534 | 4.274557 | [
"s200575034",
"s608139533"
] |
u077291787 | p02957 | python | s052235959 | s633965108 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | # ABC135
def main():
a, b = tuple(map(int, input().rstrip().split()))
print(((a + b) // 2 if (a + b) % 2 == 0 else "IMPOSSIBLE"))
if __name__ == "__main__":
main() | # ABC135A - Harmony
def main():
A, B = list(map(int, input().split()))
flg = (A + B) % 2 == 0
print(((A + B) // 2 if flg else "IMPOSSIBLE"))
if __name__ == "__main__":
main() | 8 | 9 | 182 | 192 | # ABC135
def main():
a, b = tuple(map(int, input().rstrip().split()))
print(((a + b) // 2 if (a + b) % 2 == 0 else "IMPOSSIBLE"))
if __name__ == "__main__":
main()
| # ABC135A - Harmony
def main():
A, B = list(map(int, input().split()))
flg = (A + B) % 2 == 0
print(((A + B) // 2 if flg else "IMPOSSIBLE"))
if __name__ == "__main__":
main()
| false | 11.111111 | [
"-# ABC135",
"+# ABC135A - Harmony",
"- a, b = tuple(map(int, input().rstrip().split()))",
"- print(((a + b) // 2 if (a + b) % 2 == 0 else \"IMPOSSIBLE\"))",
"+ A, B = list(map(int, input().split()))",
"+ flg = (A + B) % 2 == 0",
"+ print(((A + B) // 2 if flg else \"IMPOSSIBLE\"))"
] | false | 0.042428 | 0.007629 | 5.561233 | [
"s052235959",
"s633965108"
] |
u645250356 | p02833 | python | s957331025 | s807670684 | 272 | 52 | 63,980 | 5,500 | Accepted | Accepted | 80.88 | 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
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.rea... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,copy
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()))
... | 19 | 19 | 528 | 446 | 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
mod2 = 998244353
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(in... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, copy
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.readli... | false | 0 | [
"-import sys, bisect, math, itertools, fractions, pprint",
"+import sys, bisect, math, itertools, fractions, copy",
"-mod2 = 998244353",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) for i in range(n))",
"-",
"-",
"-for i in range(1, 100):",
"- res += n // ((5**i) * 2)",
"+now =... | false | 0.08904 | 0.048388 | 1.84011 | [
"s957331025",
"s807670684"
] |
u845643816 | p00028 | python | s123370825 | s008857795 | 30 | 20 | 7,540 | 7,620 | Accepted | Accepted | 33.33 | # 0028
array = []
while True:
try:
a = eval(input())
array.append(int(a))
except EOFError:
break
s = set(array)
mx = array.count(max(s, key = array.count))
for a in sorted(s):
if array.count(a) == mx:
print(a) | # 0028
array = []
while True:
try:
a = eval(input())
array.append(int(a))
except EOFError: break
s = set(array)
mx = max(sorted(s, reverse=True), key = array.count)
for a in sorted(s, key = array.count, reverse=True):
print(a)
if a == mx: break | 13 | 12 | 259 | 281 | # 0028
array = []
while True:
try:
a = eval(input())
array.append(int(a))
except EOFError:
break
s = set(array)
mx = array.count(max(s, key=array.count))
for a in sorted(s):
if array.count(a) == mx:
print(a)
| # 0028
array = []
while True:
try:
a = eval(input())
array.append(int(a))
except EOFError:
break
s = set(array)
mx = max(sorted(s, reverse=True), key=array.count)
for a in sorted(s, key=array.count, reverse=True):
print(a)
if a == mx:
break
| false | 7.692308 | [
"-mx = array.count(max(s, key=array.count))",
"-for a in sorted(s):",
"- if array.count(a) == mx:",
"- print(a)",
"+mx = max(sorted(s, reverse=True), key=array.count)",
"+for a in sorted(s, key=array.count, reverse=True):",
"+ print(a)",
"+ if a == mx:",
"+ break"
] | false | 0.043912 | 0.047195 | 0.930449 | [
"s123370825",
"s008857795"
] |
u824793212 | p02861 | python | s675227945 | s780008725 | 200 | 172 | 38,384 | 38,256 | Accepted | Accepted | 14 | def main():
global visited, adj, sets
print = out.append
''' Cook your dish here! '''
q = get_int()
points = []
res = 0
for _ in range(q):
pt = get_list()
for i in points:
res += ((pt[0]-i[0])**2+(pt[1]-i[1])**2)**(1/2)
points.append(pt)
pr... | def main():
global visited, adj, sets
print = out.append
''' Cook your dish here! '''
q = get_int()
points = []
res = 0
for _ in range(q):
pt = get_list()
for i in points:
res += ((pt[0]-i[0])**2+(pt[1]-i[1])**2)**(1/2)
points.append(pt)
pr... | 25 | 25 | 688 | 672 | def main():
global visited, adj, sets
print = out.append
""" Cook your dish here! """
q = get_int()
points = []
res = 0
for _ in range(q):
pt = get_list()
for i in points:
res += ((pt[0] - i[0]) ** 2 + (pt[1] - i[1]) ** 2) ** (1 / 2)
points.append(pt)
... | def main():
global visited, adj, sets
print = out.append
""" Cook your dish here! """
q = get_int()
points = []
res = 0
for _ in range(q):
pt = get_list()
for i in points:
res += ((pt[0] - i[0]) ** 2 + (pt[1] - i[1]) ** 2) ** (1 / 2)
points.append(pt)
... | false | 0 | [
"-import sys, threading, math",
"-from collections import defaultdict",
"+import sys",
"+# from collections import defaultdict"
] | false | 0.064078 | 0.040649 | 1.576372 | [
"s675227945",
"s780008725"
] |
u893063840 | p03545 | python | s316224937 | s504336965 | 20 | 17 | 3,188 | 3,060 | Accepted | Accepted | 15 | abcd = eval(input())
import itertools
for op in itertools.product(["+", "-"], repeat=3):
sm = int(abcd[0])
for i in range(3):
if op[i] == "+":
sm += int(abcd[i+1])
else:
sm -= int(abcd[i+1])
if sm == 7:
break
ans = str(abcd[0])
for i in range... | a, b, c, d = list(eval(input()))
import itertools
for ops in itertools.product(["+", "-"], repeat=3):
eq = a + ops[0] + b + ops[1] + c + ops[2] + d
sol = eval(eq)
if sol == 7:
break
ans = eq + "=7"
print(ans)
| 19 | 12 | 374 | 237 | abcd = eval(input())
import itertools
for op in itertools.product(["+", "-"], repeat=3):
sm = int(abcd[0])
for i in range(3):
if op[i] == "+":
sm += int(abcd[i + 1])
else:
sm -= int(abcd[i + 1])
if sm == 7:
break
ans = str(abcd[0])
for i in range(3):
ans ... | a, b, c, d = list(eval(input()))
import itertools
for ops in itertools.product(["+", "-"], repeat=3):
eq = a + ops[0] + b + ops[1] + c + ops[2] + d
sol = eval(eq)
if sol == 7:
break
ans = eq + "=7"
print(ans)
| false | 36.842105 | [
"-abcd = eval(input())",
"+a, b, c, d = list(eval(input()))",
"-for op in itertools.product([\"+\", \"-\"], repeat=3):",
"- sm = int(abcd[0])",
"- for i in range(3):",
"- if op[i] == \"+\":",
"- sm += int(abcd[i + 1])",
"- else:",
"- sm -= int(abcd[i + 1])",... | false | 0.038521 | 0.068339 | 0.563666 | [
"s316224937",
"s504336965"
] |
u903005414 | p03845 | python | s062447910 | s437578395 | 21 | 17 | 3,060 | 3,060 | Accepted | Accepted | 19.05 | N = int(eval(input()))
T = list(map(int, input().split()))
sum_T = sum(T)
M = int(eval(input()))
for _ in range(M):
p, x = list(map(int, input().split()))
v = sum_T - T[p - 1] + x
print(v)
| import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
T = [0] + list(map(int, input().split()))
sum_T = sum(T)
M = int(eval(input()))
# print('sum_T', sum_T)
for _ in range(M):
p, x = list(map(int, input().split()))
# print('p, x', p, x)
t = sum_T - T[p] + x
print(t)
| 8 | 12 | 190 | 291 | N = int(eval(input()))
T = list(map(int, input().split()))
sum_T = sum(T)
M = int(eval(input()))
for _ in range(M):
p, x = list(map(int, input().split()))
v = sum_T - T[p - 1] + x
print(v)
| import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
T = [0] + list(map(int, input().split()))
sum_T = sum(T)
M = int(eval(input()))
# print('sum_T', sum_T)
for _ in range(M):
p, x = list(map(int, input().split()))
# print('p, x', p, x)
t = sum_T - T[p] + x
print(t)
| false | 33.333333 | [
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"-T = list(map(int, input().split()))",
"+T = [0] + list(map(int, input().split()))",
"+# print('sum_T', sum_T)",
"- v = sum_T - T[p - 1] + x",
"- print(v)",
"+ # print('p, x', p, x)",
"+ t = sum_T - T[p] + x",
"+ print(t)"... | false | 0.13265 | 0.158234 | 0.838317 | [
"s062447910",
"s437578395"
] |
u816872429 | p03032 | python | s185361344 | s869035457 | 205 | 32 | 41,456 | 3,064 | Accepted | Accepted | 84.39 | n, k = list(map(int, input().split()))
v = list(map(int, input().split()))
ret = 0
for l in range(min(n, k) + 1):
for r in range(min(n, k) - l + 1):
d = k - l - r
g = sorted(v[:l] + v[n - r:])
for i in range(min(d, len(g))):
g[i] = max(0, g[i])
ret = max(ret, sum... | n, k = list(map(int, input().split()))
v = list(map(int, input().split()))
ret = 0
for s in range(n):
for e in range(s, n + 1):
t = k - (s + n - e)
if t < 0:
continue
l = sorted(v[:s] + v[e:])
u = 0
while u < len(l) and u < t and l[u] < 0:
u... | 11 | 14 | 331 | 367 | n, k = list(map(int, input().split()))
v = list(map(int, input().split()))
ret = 0
for l in range(min(n, k) + 1):
for r in range(min(n, k) - l + 1):
d = k - l - r
g = sorted(v[:l] + v[n - r :])
for i in range(min(d, len(g))):
g[i] = max(0, g[i])
ret = max(ret, sum(g))
pri... | n, k = list(map(int, input().split()))
v = list(map(int, input().split()))
ret = 0
for s in range(n):
for e in range(s, n + 1):
t = k - (s + n - e)
if t < 0:
continue
l = sorted(v[:s] + v[e:])
u = 0
while u < len(l) and u < t and l[u] < 0:
u += 1
... | false | 21.428571 | [
"-for l in range(min(n, k) + 1):",
"- for r in range(min(n, k) - l + 1):",
"- d = k - l - r",
"- g = sorted(v[:l] + v[n - r :])",
"- for i in range(min(d, len(g))):",
"- g[i] = max(0, g[i])",
"- ret = max(ret, sum(g))",
"+for s in range(n):",
"+ for e in ... | false | 0.037676 | 0.042048 | 0.896029 | [
"s185361344",
"s869035457"
] |
u672475305 | p03163 | python | s633524191 | s636724587 | 607 | 459 | 171,656 | 119,916 | Accepted | Accepted | 24.38 | def knapsack_1(N, W, lst):
#N : 品物数
#W : 重みの総和
#lst (wi,vi) : 商品iの重みwi、価値vi
#dp[i][j] : i番目の品物から重さの総和がj以下になるように選んだ場合の価値の総和の最大値
dp = [[0 for i in range(W+1)] for _ in range(N+1)]
for i in range(N):
for j in range(W+1):
if j < lst[i][0]:
dp[... | n,w = list(map(int,input().split()))
wv = [list(map(int,input().split())) for _ in range(n)]
dp = [[0]*(w+1) for _ in range(n+1)]
for i in range(n):
wi, vi = wv[i]
for j in range(w+1):
if j<wi:
dp[i+1][j] = dp[i][j]
else:
dp[i+1][j] = max(dp[i][j], dp[i][j-wi]+vi... | 23 | 12 | 615 | 346 | def knapsack_1(N, W, lst):
# N : 品物数
# W : 重みの総和
# lst (wi,vi) : 商品iの重みwi、価値vi
# dp[i][j] : i番目の品物から重さの総和がj以下になるように選んだ場合の価値の総和の最大値
dp = [[0 for i in range(W + 1)] for _ in range(N + 1)]
for i in range(N):
for j in range(W + 1):
if j < lst[i][0]:
dp[i + 1][j] =... | n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] * (w + 1) for _ in range(n + 1)]
for i in range(n):
wi, vi = wv[i]
for j in range(w + 1):
if j < wi:
dp[i + 1][j] = dp[i][j]
else:
dp[i + 1][j] = max(dp[i][j], dp[i][... | false | 47.826087 | [
"-def knapsack_1(N, W, lst):",
"- # N : 品物数",
"- # W : 重みの総和",
"- # lst (wi,vi) : 商品iの重みwi、価値vi",
"- # dp[i][j] : i番目の品物から重さの総和がj以下になるように選んだ場合の価値の総和の最大値",
"- dp = [[0 for i in range(W + 1)] for _ in range(N + 1)]",
"- for i in range(N):",
"- for j in range(W + 1):",
"- ... | false | 0.039657 | 0.038112 | 1.040558 | [
"s633524191",
"s636724587"
] |
u652583512 | p02726 | python | s227214145 | s536755696 | 1,948 | 1,430 | 3,444 | 3,444 | Accepted | Accepted | 26.59 | N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
D = [0] * N
for i in range(N):
for j in range(i, N):
m = min(abs(j - i), abs(i - X) + 1 + abs(j - Y), abs(i - Y) + 1 + abs(j - X))
D[m] += 1
for v in D[1:N]:
print(v) | N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
D = [0] * N
for i in range(N):
for j in range(i + 1, N):
m = min(abs(j - i), abs(i - X) + 1 + abs(j - Y))
D[m] += 1
for v in D[1:N]:
print(v) | 12 | 12 | 253 | 228 | N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
D = [0] * N
for i in range(N):
for j in range(i, N):
m = min(abs(j - i), abs(i - X) + 1 + abs(j - Y), abs(i - Y) + 1 + abs(j - X))
D[m] += 1
for v in D[1:N]:
print(v)
| N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
D = [0] * N
for i in range(N):
for j in range(i + 1, N):
m = min(abs(j - i), abs(i - X) + 1 + abs(j - Y))
D[m] += 1
for v in D[1:N]:
print(v)
| false | 0 | [
"- for j in range(i, N):",
"- m = min(abs(j - i), abs(i - X) + 1 + abs(j - Y), abs(i - Y) + 1 + abs(j - X))",
"+ for j in range(i + 1, N):",
"+ m = min(abs(j - i), abs(i - X) + 1 + abs(j - Y))"
] | false | 0.037819 | 0.038265 | 0.988324 | [
"s227214145",
"s536755696"
] |
u777923818 | p03436 | python | s698744660 | s127179163 | 26 | 24 | 3,316 | 3,316 | Accepted | Accepted | 7.69 | # -*- coding: utf-8 -*-
from collections import deque
def inpl(): return tuple(map(int, input().split()))
H, W = inpl()
S = []
for _ in range(H):
S.append(eval(input()))
M = [[50*50*10 if S[h][w]=="." else -1 for w in range(W)] for h in range(H)]
Q = deque() #step, H, W
Q.append([1, 0, 0])
ok = ... | # -*- coding: utf-8 -*-
from collections import deque
def inpl(): return tuple(map(int, input().split()))
H, W = inpl()
S = [eval(input()) for _ in range(H)]
V = [[True if S[h][w]=="." else False for w in range(W)] for h in range(H)]
V[0][0] = True
Q = deque() #step, H, W
Q.append([1, 0, 0])
ok = False... | 47 | 45 | 981 | 960 | # -*- coding: utf-8 -*-
from collections import deque
def inpl():
return tuple(map(int, input().split()))
H, W = inpl()
S = []
for _ in range(H):
S.append(eval(input()))
M = [[50 * 50 * 10 if S[h][w] == "." else -1 for w in range(W)] for h in range(H)]
Q = deque() # step, H, W
Q.append([1, 0, 0])
ok = Fals... | # -*- coding: utf-8 -*-
from collections import deque
def inpl():
return tuple(map(int, input().split()))
H, W = inpl()
S = [eval(input()) for _ in range(H)]
V = [[True if S[h][w] == "." else False for w in range(W)] for h in range(H)]
V[0][0] = True
Q = deque() # step, H, W
Q.append([1, 0, 0])
ok = False
whil... | false | 4.255319 | [
"-S = []",
"-for _ in range(H):",
"- S.append(eval(input()))",
"-M = [[50 * 50 * 10 if S[h][w] == \".\" else -1 for w in range(W)] for h in range(H)]",
"+S = [eval(input()) for _ in range(H)]",
"+V = [[True if S[h][w] == \".\" else False for w in range(W)] for h in range(H)]",
"+V[0][0] = True",
"-... | false | 0.08447 | 0.098654 | 0.856221 | [
"s698744660",
"s127179163"
] |
u254871849 | p03339 | python | s812659703 | s153404674 | 138 | 79 | 3,700 | 15,524 | Accepted | Accepted | 42.75 | import sys
n = int(sys.stdin.readline().rstrip())
s = sys.stdin.readline().rstrip()
def main():
l = 0
r = s.count('E')
res = r
for i in range(n):
cur = s[i]
if cur == 'E':
r -= 1
res = min(res, l + r)
if cur == 'W':
l += 1
ret... | import sys
n, s = sys.stdin.read().split()
def main():
cnt = s.count('E')
cur = 'E'
res = [cnt]
for c in s:
if cur == 'W': cnt += 1
if c == 'E': cnt -= 1
res.append(cnt)
cur = c
print((min(res)))
if __name__ == '__main__':
main() | 21 | 17 | 391 | 307 | import sys
n = int(sys.stdin.readline().rstrip())
s = sys.stdin.readline().rstrip()
def main():
l = 0
r = s.count("E")
res = r
for i in range(n):
cur = s[i]
if cur == "E":
r -= 1
res = min(res, l + r)
if cur == "W":
l += 1
return res
if __... | import sys
n, s = sys.stdin.read().split()
def main():
cnt = s.count("E")
cur = "E"
res = [cnt]
for c in s:
if cur == "W":
cnt += 1
if c == "E":
cnt -= 1
res.append(cnt)
cur = c
print((min(res)))
if __name__ == "__main__":
main()
| false | 19.047619 | [
"-n = int(sys.stdin.readline().rstrip())",
"-s = sys.stdin.readline().rstrip()",
"+n, s = sys.stdin.read().split()",
"- l = 0",
"- r = s.count(\"E\")",
"- res = r",
"- for i in range(n):",
"- cur = s[i]",
"- if cur == \"E\":",
"- r -= 1",
"- res = min(... | false | 0.104719 | 0.042929 | 2.439368 | [
"s812659703",
"s153404674"
] |
u141610915 | p03634 | python | s249650500 | s716013504 | 1,662 | 813 | 90,840 | 102,488 | Accepted | Accepted | 51.08 | from collections import defaultdict as dd
from collections import deque as dq
N = int(eval(input()))
e = dd(list)
inf = 10 ** 15
for _ in range(N - 1):
u, v, d = list(map(int, input().split()))
e[u].append((v, d))
e[v].append((u, d))
Q, K = list(map(int, input().split()))
d = [inf] * (N + 1)
d[K] = 0
... | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N = int(eval(input()))
e = dd(list)
for _ in range(N - 1):
u, v, c = list(map(int, input().split()))
e[u].append((v, c))
e[v].append((u, c))
Q, K = list(map(int, input().split()))
import heapq
class dijkstra:
def __init_... | 24 | 37 | 547 | 921 | from collections import defaultdict as dd
from collections import deque as dq
N = int(eval(input()))
e = dd(list)
inf = 10**15
for _ in range(N - 1):
u, v, d = list(map(int, input().split()))
e[u].append((v, d))
e[v].append((u, d))
Q, K = list(map(int, input().split()))
d = [inf] * (N + 1)
d[K] = 0
q = dq(... | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N = int(eval(input()))
e = dd(list)
for _ in range(N - 1):
u, v, c = list(map(int, input().split()))
e[u].append((v, c))
e[v].append((u, c))
Q, K = list(map(int, input().split()))
import heapq
class dijkstra:
def __init__... | false | 35.135135 | [
"+import sys",
"-from collections import deque as dq",
"+input = sys.stdin.readline",
"-inf = 10**15",
"- u, v, d = list(map(int, input().split()))",
"- e[u].append((v, d))",
"- e[v].append((u, d))",
"+ u, v, c = list(map(int, input().split()))",
"+ e[u].append((v, c))",
"+ e[v].... | false | 0.103539 | 0.047226 | 2.192415 | [
"s249650500",
"s716013504"
] |
u305366205 | p02777 | python | s591512787 | s260271598 | 173 | 20 | 38,256 | 3,060 | Accepted | Accepted | 88.44 | s, t = input().split()
a, b = list(map(int, input().split()))
u = eval(input())
if s == u:
a -= 1
if t == u:
b -= 1
print((a, b))
| s, t = input().split()
a, b = list(map(int, input().split()))
u = eval(input())
if s == u:
a -= 1
else:
b -= 1
print((a, b)) | 9 | 9 | 133 | 127 | s, t = input().split()
a, b = list(map(int, input().split()))
u = eval(input())
if s == u:
a -= 1
if t == u:
b -= 1
print((a, b))
| s, t = input().split()
a, b = list(map(int, input().split()))
u = eval(input())
if s == u:
a -= 1
else:
b -= 1
print((a, b))
| false | 0 | [
"-if t == u:",
"+else:"
] | false | 0.036632 | 0.037046 | 0.988837 | [
"s591512787",
"s260271598"
] |
u983918956 | p03575 | python | s767523613 | s918825634 | 28 | 23 | 3,064 | 3,064 | Accepted | Accepted | 17.86 | def multival(): return list(map(int,input().split()))
def data(N=1): return [list(map(int,input().split())) for _ in range(N)]
mod = 10**9 + 7
inf = float("inf")
N,M = multival()
nemat = [[0]*N for _ in range(N)]
ans = M
info = []
for _ in range(M):
a,b = multival()
a -= 1; b-= 1
nemat[a][b] ... | class Unionfind:
__slots__ = ['nodes']
def __init__(self, n):
self.nodes = [-1]*n
def root(self, x):
if self.nodes[x] < 0:
return x
else:
root_x = self.root(self.nodes[x])
self.nodes[x] = root_x
return root_x
def ... | 35 | 52 | 744 | 1,211 | def multival():
return list(map(int, input().split()))
def data(N=1):
return [list(map(int, input().split())) for _ in range(N)]
mod = 10**9 + 7
inf = float("inf")
N, M = multival()
nemat = [[0] * N for _ in range(N)]
ans = M
info = []
for _ in range(M):
a, b = multival()
a -= 1
b -= 1
nemat... | class Unionfind:
__slots__ = ["nodes"]
def __init__(self, n):
self.nodes = [-1] * n
def root(self, x):
if self.nodes[x] < 0:
return x
else:
root_x = self.root(self.nodes[x])
self.nodes[x] = root_x
return root_x
def unite(self, x,... | false | 32.692308 | [
"-def multival():",
"- return list(map(int, input().split()))",
"+class Unionfind:",
"+ __slots__ = [\"nodes\"]",
"+",
"+ def __init__(self, n):",
"+ self.nodes = [-1] * n",
"+",
"+ def root(self, x):",
"+ if self.nodes[x] < 0:",
"+ return x",
"+ els... | false | 0.038639 | 0.040104 | 0.963485 | [
"s767523613",
"s918825634"
] |
u760569096 | p02726 | python | s816722844 | s309085636 | 1,985 | 1,106 | 3,444 | 9,304 | Accepted | Accepted | 44.28 | n,x,y=list(map(int,input().split()))
ans=[0]*n
list =[]
for i in range(n):
for j in range(i):
b = i+1
a = j+1
if a<=x and b>=y:
k =b-y+x-a+1
elif a>x and b>=y:
d =min(a-x+1,y-a)
k =d+b-y
elif a<=x and b<y:
d =min(b-x,y-b+1)
k =x-a+d
elif a>x a... | n,x,y = list(map(int, input().split()))
g = [0]*(n)
for i in range(1,n+1):
for j in range(1,i):
e = abs(y-i)+1+abs(x-j)
f = i-j
g[min(e,f)]+=1
for i in g[1:]:
print(i) | 23 | 9 | 411 | 185 | n, x, y = list(map(int, input().split()))
ans = [0] * n
list = []
for i in range(n):
for j in range(i):
b = i + 1
a = j + 1
if a <= x and b >= y:
k = b - y + x - a + 1
elif a > x and b >= y:
d = min(a - x + 1, y - a)
k = d + b - y
elif a <=... | n, x, y = list(map(int, input().split()))
g = [0] * (n)
for i in range(1, n + 1):
for j in range(1, i):
e = abs(y - i) + 1 + abs(x - j)
f = i - j
g[min(e, f)] += 1
for i in g[1:]:
print(i)
| false | 60.869565 | [
"-ans = [0] * n",
"-list = []",
"-for i in range(n):",
"- for j in range(i):",
"- b = i + 1",
"- a = j + 1",
"- if a <= x and b >= y:",
"- k = b - y + x - a + 1",
"- elif a > x and b >= y:",
"- d = min(a - x + 1, y - a)",
"- k = d +... | false | 0.036632 | 0.0351 | 1.043625 | [
"s816722844",
"s309085636"
] |
u766684188 | p02720 | python | s104942532 | s316386028 | 345 | 192 | 78,044 | 46,576 | Accepted | Accepted | 44.35 | from collections import deque
def main():
q=deque()
for i in range(1,10):
q.append((str(i)))
Ans=[]
while q:
s=q.popleft()
if int(s)>3234566667:
continue
Ans.append(int(s))
d=int(s[-1])
if d==0:
q.append(s+'0')
... | from collections import deque
def main():
k=int(eval(input()))
if k<=9:
return k
q=deque()
for i in range(1,10):
q.append(i)
Ans=list(range(1,10))
cnt=9
while cnt<k:
s=q.popleft()
d=s%10
s*=10
if d==0:
q.append(s)
... | 29 | 36 | 644 | 788 | from collections import deque
def main():
q = deque()
for i in range(1, 10):
q.append((str(i)))
Ans = []
while q:
s = q.popleft()
if int(s) > 3234566667:
continue
Ans.append(int(s))
d = int(s[-1])
if d == 0:
q.append(s + "0")
... | from collections import deque
def main():
k = int(eval(input()))
if k <= 9:
return k
q = deque()
for i in range(1, 10):
q.append(i)
Ans = list(range(1, 10))
cnt = 9
while cnt < k:
s = q.popleft()
d = s % 10
s *= 10
if d == 0:
q.ap... | false | 19.444444 | [
"+ k = int(eval(input()))",
"+ if k <= 9:",
"+ return k",
"- q.append((str(i)))",
"- Ans = []",
"- while q:",
"+ q.append(i)",
"+ Ans = list(range(1, 10))",
"+ cnt = 9",
"+ while cnt < k:",
"- if int(s) > 3234566667:",
"- continue",
... | false | 0.547751 | 0.13566 | 4.03766 | [
"s104942532",
"s316386028"
] |
u241159583 | p03029 | python | s185511595 | s955614954 | 21 | 17 | 2,940 | 2,940 | Accepted | Accepted | 19.05 | A, P = list(map(int, input().split()))
print(((3*A + P) // 2)) | a,p = list(map(int, input().split()))
print(((a*3+p)//2)) | 3 | 2 | 57 | 50 | A, P = list(map(int, input().split()))
print(((3 * A + P) // 2))
| a, p = list(map(int, input().split()))
print(((a * 3 + p) // 2))
| false | 33.333333 | [
"-A, P = list(map(int, input().split()))",
"-print(((3 * A + P) // 2))",
"+a, p = list(map(int, input().split()))",
"+print(((a * 3 + p) // 2))"
] | false | 0.045435 | 0.047314 | 0.960285 | [
"s185511595",
"s955614954"
] |
u323680411 | p03944 | python | s879840900 | s851257096 | 166 | 17 | 3,064 | 3,064 | Accepted | Accepted | 89.76 | from sys import stdin
def main():
w = next_int()
h = next_int()
n = next_int()
arr = [[1] * w for _ in range(h)]
for i in range(n):
xi, yi, a = list(map(int, input().split()))
for y in range(h):
for x in range(w):
if a == 1:
... | from sys import stdin
def main():
w = next_int()
h = next_int()
n = next_int()
x = 0
y = 0
for i in range(n):
xi, yi, a = list(map(int, input().split()))
if a == 1:
x = max(x, xi)
if a == 2:
w = min(w, xi)
if a == 3:
... | 50 | 42 | 1,053 | 749 | from sys import stdin
def main():
w = next_int()
h = next_int()
n = next_int()
arr = [[1] * w for _ in range(h)]
for i in range(n):
xi, yi, a = list(map(int, input().split()))
for y in range(h):
for x in range(w):
if a == 1:
if x < xi... | from sys import stdin
def main():
w = next_int()
h = next_int()
n = next_int()
x = 0
y = 0
for i in range(n):
xi, yi, a = list(map(int, input().split()))
if a == 1:
x = max(x, xi)
if a == 2:
w = min(w, xi)
if a == 3:
y = max(y... | false | 16 | [
"- arr = [[1] * w for _ in range(h)]",
"+ x = 0",
"+ y = 0",
"- for y in range(h):",
"- for x in range(w):",
"- if a == 1:",
"- if x < xi:",
"- arr[y][x] = 0",
"- if a == 2:",
"- i... | false | 0.121 | 0.035659 | 3.393275 | [
"s879840900",
"s851257096"
] |
u507330326 | p04001 | python | s748033746 | s088779128 | 217 | 179 | 41,564 | 39,664 | Accepted | Accepted | 17.51 | s = eval(input())
nbits = 2**(len(s)-1)
ans = 0
for bit in range(nbits):
tmp = []
for i in range(nbits):
if bit & (1 << i):
tmp.append(i)
curr = 0
for x in tmp:
ans += int(s[curr:x+1])
curr = x + 1
ans += int(s[curr:])
print(ans) | s = eval(input())
nbits = 2**(len(s)-1)
ans = 0
for bit in range(nbits):
tmp = []
for i in range(len(s)-1):
if bit & (1 << i):
tmp.append(i)
curr = 0
for x in tmp:
ans += int(s[curr:x+1])
curr = x + 1
ans += int(s[curr:])
print(ans) | 15 | 15 | 266 | 269 | s = eval(input())
nbits = 2 ** (len(s) - 1)
ans = 0
for bit in range(nbits):
tmp = []
for i in range(nbits):
if bit & (1 << i):
tmp.append(i)
curr = 0
for x in tmp:
ans += int(s[curr : x + 1])
curr = x + 1
ans += int(s[curr:])
print(ans)
| s = eval(input())
nbits = 2 ** (len(s) - 1)
ans = 0
for bit in range(nbits):
tmp = []
for i in range(len(s) - 1):
if bit & (1 << i):
tmp.append(i)
curr = 0
for x in tmp:
ans += int(s[curr : x + 1])
curr = x + 1
ans += int(s[curr:])
print(ans)
| false | 0 | [
"- for i in range(nbits):",
"+ for i in range(len(s) - 1):"
] | false | 0.047089 | 0.045077 | 1.04464 | [
"s748033746",
"s088779128"
] |
u821432765 | p03775 | python | s850283767 | s422392701 | 38 | 32 | 3,188 | 3,188 | Accepted | Accepted | 15.79 | N = int(eval(input()))
def is_square(n):
m = int(n**.5)
return True if abs(m*m - n) < 1e-6 else False
divs = []
f = False
if is_square(N):
divs = [int(N**.5)]*2
f = True
for i in range(int(N**.5),0,-1):
if f: break
if N % i == 0: divs += [i, N//i]
if len(divs) >= 2: break
print(... | n = int(eval(input()))
sn = int(n**.5)
if (sn)*(sn)==n:
print((len(str(sn))))
quit()
divisors = []
c = 0
for i in range(int(n**.5)+1, 0, -1):
if n % i == 0:
divisors.append(i)
c += 1
if i != n // i:
divisors.append(n//i)
c += 1
if c >= 2:
... | 14 | 19 | 347 | 359 | N = int(eval(input()))
def is_square(n):
m = int(n**0.5)
return True if abs(m * m - n) < 1e-6 else False
divs = []
f = False
if is_square(N):
divs = [int(N**0.5)] * 2
f = True
for i in range(int(N**0.5), 0, -1):
if f:
break
if N % i == 0:
divs += [i, N // i]
if len(divs) ... | n = int(eval(input()))
sn = int(n**0.5)
if (sn) * (sn) == n:
print((len(str(sn))))
quit()
divisors = []
c = 0
for i in range(int(n**0.5) + 1, 0, -1):
if n % i == 0:
divisors.append(i)
c += 1
if i != n // i:
divisors.append(n // i)
c += 1
if c >= 2:
... | false | 26.315789 | [
"-N = int(eval(input()))",
"-",
"-",
"-def is_square(n):",
"- m = int(n**0.5)",
"- return True if abs(m * m - n) < 1e-6 else False",
"-",
"-",
"-divs = []",
"-f = False",
"-if is_square(N):",
"- divs = [int(N**0.5)] * 2",
"- f = True",
"-for i in range(int(N**0.5), 0, -1):",
... | false | 0.041913 | 0.087818 | 0.477267 | [
"s850283767",
"s422392701"
] |
u912237403 | p00007 | python | s880347543 | s659798523 | 20 | 10 | 4,372 | 4,356 | Accepted | Accepted | 50 | import math
n=eval(input())
money = 100000
for i in range(n):
money = math.ceil(money * 1.05/1000)*1000
print("%d" %(money)) | import math
m=100
for i in range(eval(input())):m=math.ceil(m*1.05)
print("%d" %(m*1000)) | 7 | 4 | 128 | 85 | import math
n = eval(input())
money = 100000
for i in range(n):
money = math.ceil(money * 1.05 / 1000) * 1000
print("%d" % (money))
| import math
m = 100
for i in range(eval(input())):
m = math.ceil(m * 1.05)
print("%d" % (m * 1000))
| false | 42.857143 | [
"-n = eval(input())",
"-money = 100000",
"-for i in range(n):",
"- money = math.ceil(money * 1.05 / 1000) * 1000",
"-print(\"%d\" % (money))",
"+m = 100",
"+for i in range(eval(input())):",
"+ m = math.ceil(m * 1.05)",
"+print(\"%d\" % (m * 1000))"
] | false | 0.073317 | 0.068214 | 1.074807 | [
"s880347543",
"s659798523"
] |
u319245933 | p03720 | python | s864909288 | s761721597 | 66 | 61 | 62,004 | 61,976 | Accepted | Accepted | 7.58 | N,_,*L=map(int,open(0).read().split())
A=[0]*N
for l in L: A[l-1]+=1
print(*A,sep='\n')
| N,_,*L=list(map(int,open(0).read().split()))
for n in range(N):print((L.count(n+1))) | 4 | 2 | 90 | 77 | N, _, *L = map(int, open(0).read().split())
A = [0] * N
for l in L:
A[l - 1] += 1
print(*A, sep="\n")
| N, _, *L = list(map(int, open(0).read().split()))
for n in range(N):
print((L.count(n + 1)))
| false | 50 | [
"-N, _, *L = map(int, open(0).read().split())",
"-A = [0] * N",
"-for l in L:",
"- A[l - 1] += 1",
"-print(*A, sep=\"\\n\")",
"+N, _, *L = list(map(int, open(0).read().split()))",
"+for n in range(N):",
"+ print((L.count(n + 1)))"
] | false | 0.042528 | 0.089056 | 0.477543 | [
"s864909288",
"s761721597"
] |
u072053884 | p02381 | python | s351025545 | s085008851 | 70 | 30 | 10,292 | 7,700 | Accepted | Accepted | 57.14 | import statistics
import sys
data_sets = sys.stdin.read().split("\n")
for i in data_sets[1:-1:2]:
data_set = [int(j) for j in i.split()]
print((statistics.pstdev(data_set))) | while True:
n = int(eval(input()))
if n == 0:
break
else:
data_set = [int(i) for i in input().split()]
m = sum(data_set) / n
v = 0
for i in data_set:
diff = i - m
v += diff ** 2
v /= n
print((v ** 0.5)) | 8 | 13 | 188 | 298 | import statistics
import sys
data_sets = sys.stdin.read().split("\n")
for i in data_sets[1:-1:2]:
data_set = [int(j) for j in i.split()]
print((statistics.pstdev(data_set)))
| while True:
n = int(eval(input()))
if n == 0:
break
else:
data_set = [int(i) for i in input().split()]
m = sum(data_set) / n
v = 0
for i in data_set:
diff = i - m
v += diff**2
v /= n
print((v**0.5))
| false | 38.461538 | [
"-import statistics",
"-import sys",
"-",
"-data_sets = sys.stdin.read().split(\"\\n\")",
"-for i in data_sets[1:-1:2]:",
"- data_set = [int(j) for j in i.split()]",
"- print((statistics.pstdev(data_set)))",
"+while True:",
"+ n = int(eval(input()))",
"+ if n == 0:",
"+ break"... | false | 0.048428 | 0.040573 | 1.193623 | [
"s351025545",
"s085008851"
] |
u790710233 | p03164 | python | s516392436 | s749630531 | 1,373 | 417 | 385,176 | 120,044 | Accepted | Accepted | 69.63 | n, w = list(map(int, input().split()))
weights, values = list(zip(*[tuple(map(int, input().split())) for _ in range(n)]))
UV = 10**5
INF = float('inf')
dp = [[0]+[INF]*UV for _ in range(n+1)]
for i in range(1, n+1):
for j in range(1, UV+1):
dp[i][j] = dp[i-1][j]
if 0 <= j-values[i-1]:
... | n, w = list(map(int, input().split()))
weights, values = list(zip(*[tuple(map(int, input().split())) for _ in range(n)]))
UV = 10**5
INF = 10**10
dp = [[INF]*(UV+1) for _ in range(n+1)]
for i in range(n+1):
dp[i][0] = 0
for i in range(1, n+1):
for j in range(1, UV+1):
dp[i][j] = dp[i-1][j... | 17 | 20 | 476 | 528 | n, w = list(map(int, input().split()))
weights, values = list(zip(*[tuple(map(int, input().split())) for _ in range(n)]))
UV = 10**5
INF = float("inf")
dp = [[0] + [INF] * UV for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, UV + 1):
dp[i][j] = dp[i - 1][j]
if 0 <= j - values[i - 1]... | n, w = list(map(int, input().split()))
weights, values = list(zip(*[tuple(map(int, input().split())) for _ in range(n)]))
UV = 10**5
INF = 10**10
dp = [[INF] * (UV + 1) for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 0
for i in range(1, n + 1):
for j in range(1, UV + 1):
dp[i][j] = dp[i - 1][j]... | false | 15 | [
"-INF = float(\"inf\")",
"-dp = [[0] + [INF] * UV for _ in range(n + 1)]",
"+INF = 10**10",
"+dp = [[INF] * (UV + 1) for _ in range(n + 1)]",
"+for i in range(n + 1):",
"+ dp[i][0] = 0",
"-for i in range(UV + 1):",
"+for i in reversed(list(range(UV + 1))):",
"- ans = max(ans, i)",
"+ ... | false | 0.791764 | 0.738183 | 1.072584 | [
"s516392436",
"s749630531"
] |
u017810624 | p02868 | python | s782502236 | s441986893 | 1,732 | 1,253 | 105,120 | 100,704 | Accepted | Accepted | 27.66 | import heapq
def dijkstra_heap(s):
d = [float("inf")] * n
used = [True] * n
d[s] = 0
used[s] = False
edgelist = []
for e in edge[s]:
heapq.heappush(edgelist,e)
while len(edgelist):
minedge = heapq.heappop(edgelist)
if not used[minedge[1]]:
con... | import sys
input=sys.stdin.readline
n,m=list(map(int,input().split()))
edge=[[] for i in range(n)]
for i in range(m):
x,y,z=list(map(int,input().split()))
edge[x-1].append([z,y-1])
edge[y-1].append([z,x-1])
for i in range(1,n):
edge[i].append([0,i-1])
import heapq
def dijkstra_heap(s):
d=[float(... | 36 | 37 | 846 | 783 | import heapq
def dijkstra_heap(s):
d = [float("inf")] * n
used = [True] * n
d[s] = 0
used[s] = False
edgelist = []
for e in edge[s]:
heapq.heappush(edgelist, e)
while len(edgelist):
minedge = heapq.heappop(edgelist)
if not used[minedge[1]]:
continue
... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
edge = [[] for i in range(n)]
for i in range(m):
x, y, z = list(map(int, input().split()))
edge[x - 1].append([z, y - 1])
edge[y - 1].append([z, x - 1])
for i in range(1, n):
edge[i].append([0, i - 1])
import heapq
def dijks... | false | 2.702703 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+n, m = list(map(int, input().split()))",
"+edge = [[] for i in range(n)]",
"+for i in range(m):",
"+ x, y, z = list(map(int, input().split()))",
"+ edge[x - 1].append([z, y - 1])",
"+ edge[y - 1].append([z, x - 1])",
"+for i in range(1,... | false | 0.035692 | 0.038442 | 0.928471 | [
"s782502236",
"s441986893"
] |
u301624971 | p02748 | python | s140401455 | s462172156 | 488 | 448 | 38,560 | 38,444 | Accepted | Accepted | 8.2 | A,B,M=list(map(int,input().split()))
a= list(map(int,input().split()))
b= list(map(int,input().split()))
waribiki=[]
for _ in range(M):
waribiki.append(list(map(int,input().split())))
MIN=min(a)+min(b)
for wari in waribiki:
x=wari[0]-1
y=wari[1]-1
value=wari[2]
total=a[x]+b[y]-val... | def myAnswer(a:list,b:list,XYC:list) -> int:
ans = min(a) + min(b)
for x,y,c in XYC:
total = a[x-1] + b[y-1] - c
ans = min(total,ans)
return ans
def modelAnswer():
tmp=1
def main():
A, B, M = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map... | 22 | 22 | 376 | 492 | A, B, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
waribiki = []
for _ in range(M):
waribiki.append(list(map(int, input().split())))
MIN = min(a) + min(b)
for wari in waribiki:
x = wari[0] - 1
y = wari[1] - 1
value = wari[2]
total = a[x]... | def myAnswer(a: list, b: list, XYC: list) -> int:
ans = min(a) + min(b)
for x, y, c in XYC:
total = a[x - 1] + b[y - 1] - c
ans = min(total, ans)
return ans
def modelAnswer():
tmp = 1
def main():
A, B, M = list(map(int, input().split()))
a = list(map(int, input().split()))
... | false | 0 | [
"-A, B, M = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-waribiki = []",
"-for _ in range(M):",
"- waribiki.append(list(map(int, input().split())))",
"-MIN = min(a) + min(b)",
"-for wari in waribiki:",
"- x = wari[0] - 1",
... | false | 0.063873 | 0.038177 | 1.673046 | [
"s140401455",
"s462172156"
] |
u046187684 | p03475 | python | s195705078 | s843354254 | 75 | 67 | 3,188 | 3,188 | Accepted | Accepted | 10.67 | #!/usr/bin/env python3
import math
import sys
n = int(sys.stdin.readline().strip())
f_list = []
for _ in range(n - 1):
c, s, f = sys.stdin.readline().strip().split(" ")
c = int(c)
s = int(s)
f = int(f)
f_list = [c + math.ceil((max(_f, s)) / f) * f for _f in f_list]
f_list.append(c... | from math import ceil
def solve(string):
n, *csf = list(map(int, string.split()))
f_list = []
for c, s, f in zip(csf[::3], csf[1::3], csf[2::3]):
f_list = [c + ceil((max(_f, s)) / f) * f for _f in f_list]
f_list.append(c + s)
f_list.append(0)
return "\n".join([str(_f) for... | 17 | 16 | 377 | 465 | #!/usr/bin/env python3
import math
import sys
n = int(sys.stdin.readline().strip())
f_list = []
for _ in range(n - 1):
c, s, f = sys.stdin.readline().strip().split(" ")
c = int(c)
s = int(s)
f = int(f)
f_list = [c + math.ceil((max(_f, s)) / f) * f for _f in f_list]
f_list.append(c + s)
f_list.a... | from math import ceil
def solve(string):
n, *csf = list(map(int, string.split()))
f_list = []
for c, s, f in zip(csf[::3], csf[1::3], csf[2::3]):
f_list = [c + ceil((max(_f, s)) / f) * f for _f in f_list]
f_list.append(c + s)
f_list.append(0)
return "\n".join([str(_f) for _f in f_l... | false | 5.882353 | [
"-#!/usr/bin/env python3",
"-import math",
"-import sys",
"+from math import ceil",
"-n = int(sys.stdin.readline().strip())",
"-f_list = []",
"-for _ in range(n - 1):",
"- c, s, f = sys.stdin.readline().strip().split(\" \")",
"- c = int(c)",
"- s = int(s)",
"- f = int(f)",
"- f_... | false | 0.038394 | 0.078442 | 0.489457 | [
"s195705078",
"s843354254"
] |
u241159583 | p02959 | python | s069624857 | s408915782 | 158 | 130 | 18,476 | 24,168 | Accepted | Accepted | 17.72 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
if a[i] <= b[i]:
ans += a[i]
b[i] -= a[i]
else:
ans += b[i]
b[i] = 0
if b[i] > 0:
if a[i+1] > b[i]:
ans += b[i]
... | n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
for i in range(n):
if A[i] <= B[i]:
cnt += A[i]
B[i] -= A[i]
else:
cnt += B[i]
B[i] = 0
if A[i+1] <= B[i]:
cnt += A[i+1]
A[i+1] = 0
else:
... | 20 | 18 | 413 | 369 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
if a[i] <= b[i]:
ans += a[i]
b[i] -= a[i]
else:
ans += b[i]
b[i] = 0
if b[i] > 0:
if a[i + 1] > b[i]:
ans += b[i]
a[i + 1]... | n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
for i in range(n):
if A[i] <= B[i]:
cnt += A[i]
B[i] -= A[i]
else:
cnt += B[i]
B[i] = 0
if A[i + 1] <= B[i]:
cnt += A[i + 1]
A[i + 1] = 0
else:
c... | false | 10 | [
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-ans = 0",
"+A = list(map(int, input().split()))",
"+B = list(map(int, input().split()))",
"+cnt = 0",
"- if a[i] <= b[i]:",
"- ans += a[i]",
"- b[i] -= a[i]",
"+ if A[i] <= B[i]:",
"+ cnt... | false | 0.0377 | 0.038375 | 0.982415 | [
"s069624857",
"s408915782"
] |
u102461423 | p04017 | python | s935481233 | s288686023 | 2,471 | 1,074 | 30,084 | 31,900 | Accepted | Accepted | 56.54 | import sys
input = sys.stdin.readline
import numpy as np
N = int(eval(input()))
X = np.array(input().split(), dtype = np.int64)
L = int(eval(input()))
U = N.bit_length()
# 各ホテルから、2^n回でどこまで行けるか
next_x = []
next_x.append(np.searchsorted(X, X+L, side = 'right') - 1)
for i in range(U):
next_x.append(next... | import sys
input = sys.stdin.readline
import numpy as np
N = int(eval(input()))
X = np.array(input().split(), dtype = np.int64)
L = int(eval(input()))
U = N.bit_length()
# 各ホテルから、2^n回でどこまで行けるか
next_x = []
next_x.append((np.searchsorted(X, X+L, side = 'right') - 1).tolist())
for i in range(U):
next_x.... | 33 | 33 | 684 | 719 | import sys
input = sys.stdin.readline
import numpy as np
N = int(eval(input()))
X = np.array(input().split(), dtype=np.int64)
L = int(eval(input()))
U = N.bit_length()
# 各ホテルから、2^n回でどこまで行けるか
next_x = []
next_x.append(np.searchsorted(X, X + L, side="right") - 1)
for i in range(U):
next_x.append(next_x[i][next_x[i]... | import sys
input = sys.stdin.readline
import numpy as np
N = int(eval(input()))
X = np.array(input().split(), dtype=np.int64)
L = int(eval(input()))
U = N.bit_length()
# 各ホテルから、2^n回でどこまで行けるか
next_x = []
next_x.append((np.searchsorted(X, X + L, side="right") - 1).tolist())
for i in range(U):
next_x.append([next_x[... | false | 0 | [
"-next_x.append(np.searchsorted(X, X + L, side=\"right\") - 1)",
"+next_x.append((np.searchsorted(X, X + L, side=\"right\") - 1).tolist())",
"- next_x.append(next_x[i][next_x[i]])",
"+ next_x.append([next_x[i][next_x[i][n]] for n in range(N)])"
] | false | 0.368051 | 0.206074 | 1.78601 | [
"s935481233",
"s288686023"
] |
u369752439 | p03211 | python | s124791963 | s987257723 | 150 | 18 | 12,424 | 2,940 | Accepted | Accepted | 88 | import numpy as np
S = input().strip()
print((min([np.abs(753 - int(S[i:i+3])) for i in range(len(S) - 2)]))) | S = input().strip()
print((min([abs(753 - int(S[i:i+3])) for i in range(len(S) - 2)]))) | 3 | 2 | 110 | 87 | import numpy as np
S = input().strip()
print((min([np.abs(753 - int(S[i : i + 3])) for i in range(len(S) - 2)])))
| S = input().strip()
print((min([abs(753 - int(S[i : i + 3])) for i in range(len(S) - 2)])))
| false | 33.333333 | [
"-import numpy as np",
"-",
"-print((min([np.abs(753 - int(S[i : i + 3])) for i in range(len(S) - 2)])))",
"+print((min([abs(753 - int(S[i : i + 3])) for i in range(len(S) - 2)])))"
] | false | 0.21119 | 0.037342 | 5.655483 | [
"s124791963",
"s987257723"
] |
u029329478 | p03221 | python | s362295726 | s363773947 | 1,177 | 946 | 50,076 | 50,044 | Accepted | Accepted | 19.63 | from operator import attrgetter
class City:
def __init__(self, p, y):
self.p = p
self.y = y
def set_num(self, n):
p = str(self.p)
_p = list(p)
l_p = len(_p)
if l_p < 6:
num = 6 - l_p
for i in range(num):
p ... | from operator import attrgetter
class City:
def __init__(self, p, y):
self.p = p
self.y = y
def set_num(self, n):
self.n = '{0:06d}'.format(self.p) + '{0:06d}'.format(n)
N, M = list(map(int, input().split()))
cities = []
for _ in range(M):
p, y = list(map(int, inp... | 49 | 34 | 1,026 | 710 | from operator import attrgetter
class City:
def __init__(self, p, y):
self.p = p
self.y = y
def set_num(self, n):
p = str(self.p)
_p = list(p)
l_p = len(_p)
if l_p < 6:
num = 6 - l_p
for i in range(num):
p = "0" + p
... | from operator import attrgetter
class City:
def __init__(self, p, y):
self.p = p
self.y = y
def set_num(self, n):
self.n = "{0:06d}".format(self.p) + "{0:06d}".format(n)
N, M = list(map(int, input().split()))
cities = []
for _ in range(M):
p, y = list(map(int, input().split()))
... | false | 30.612245 | [
"- p = str(self.p)",
"- _p = list(p)",
"- l_p = len(_p)",
"- if l_p < 6:",
"- num = 6 - l_p",
"- for i in range(num):",
"- p = \"0\" + p",
"- n = str(n)",
"- _n = list(n)",
"- l_n = len(_n)",
"- if l_n <... | false | 0.039184 | 0.036565 | 1.071624 | [
"s362295726",
"s363773947"
] |
u759412327 | p02640 | python | s695387285 | s691469401 | 25 | 20 | 9,160 | 9,172 | Accepted | Accepted | 20 | X,Y = list(map(int,input().split()))
if 2*X<=Y<=4*X and Y%2==0:
print("Yes")
else:
print("No") | X,Y = list(map(int,input().split()))
f = False
for i in range(X+1):
for j in range(X+1):
if i+j==X and 2*i+4*j==Y:
f = True
if f:
print("Yes")
else:
print("No")
| 6 | 12 | 98 | 184 | X, Y = list(map(int, input().split()))
if 2 * X <= Y <= 4 * X and Y % 2 == 0:
print("Yes")
else:
print("No")
| X, Y = list(map(int, input().split()))
f = False
for i in range(X + 1):
for j in range(X + 1):
if i + j == X and 2 * i + 4 * j == Y:
f = True
if f:
print("Yes")
else:
print("No")
| false | 50 | [
"-if 2 * X <= Y <= 4 * X and Y % 2 == 0:",
"+f = False",
"+for i in range(X + 1):",
"+ for j in range(X + 1):",
"+ if i + j == X and 2 * i + 4 * j == Y:",
"+ f = True",
"+if f:"
] | false | 0.038677 | 0.035339 | 1.094468 | [
"s695387285",
"s691469401"
] |
u673361376 | p03557 | python | s032233921 | s503400815 | 520 | 327 | 105,444 | 23,156 | Accepted | Accepted | 37.12 | import bisect
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
C.sort()
ans = 0
mem_idx_a = {}
for idx_b in range(N):
idx_c = bisect.bisect_right(C,B[idx_b])
idx_a = bisect.bisect_left(A,B[idx_b])
ans += (N-i... | import bisect
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0
for b in B:
idx_a = bisect.bisect_left(A, b)
idx_c = bisect.bisect(C, b)
ans += idx_a * (N - idx_c)
print(ans)
| 17 | 13 | 337 | 308 | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
ans = 0
mem_idx_a = {}
for idx_b in range(N):
idx_c = bisect.bisect_right(C, B[idx_b])
idx_a = bisect.bisect_left(A, B[idx_b])
ans += (N - idx_c... | import bisect
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0
for b in B:
idx_a = bisect.bisect_left(A, b)
idx_c = bisect.bisect(C, b)
ans += idx_a * (N - idx_c)
print(ans)
| false | 23.529412 | [
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-C = list(map(int, input().split()))",
"-A.sort()",
"-C.sort()",
"+A = sorted(list(map(int, input().split())))",
"+B = sorted(list(map(int, input().split())))",
"+C = sorted(list(map(int, input().split())))",
"-mem_idx_... | false | 0.040499 | 0.045872 | 0.882871 | [
"s032233921",
"s503400815"
] |
u813098295 | p03262 | python | s910367708 | s226113779 | 146 | 81 | 12,368 | 19,992 | Accepted | Accepted | 44.52 | # coding: utf-8
def gcd(x, y):
if y == 0:
return x
else:
return gcd(y, x%y)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
A = [ abs(x[i+1] - x[i]) for i in range(N)]
for i in range(len(A)):
if i == 0:
a... | def gcd(x, y):
while y != 0:
x, y = y, x % y
return x
N, X = list(map(int, input().split()))
x = [int(a) for a in input().split()]
ans = 0
for xx in x:
ans = gcd(ans, abs(X - xx))
print(ans) | 25 | 14 | 379 | 221 | # coding: utf-8
def gcd(x, y):
if y == 0:
return x
else:
return gcd(y, x % y)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
A = [abs(x[i + 1] - x[i]) for i in range(N)]
for i in range(len(A)):
if i == 0:
ans = A[i]
else:
... | def gcd(x, y):
while y != 0:
x, y = y, x % y
return x
N, X = list(map(int, input().split()))
x = [int(a) for a in input().split()]
ans = 0
for xx in x:
ans = gcd(ans, abs(X - xx))
print(ans)
| false | 44 | [
"-# coding: utf-8",
"- if y == 0:",
"- return x",
"- else:",
"- return gcd(y, x % y)",
"+ while y != 0:",
"+ x, y = y, x % y",
"+ return x",
"-x = list(map(int, input().split()))",
"-x.append(X)",
"-x = sorted(x)",
"-A = [abs(x[i + 1] - x[i]) for i in range(N)]... | false | 0.086781 | 0.006797 | 12.768142 | [
"s910367708",
"s226113779"
] |
u450983668 | p03043 | python | s778599404 | s308026360 | 74 | 65 | 3,060 | 3,060 | Accepted | Accepted | 12.16 | import math
e=0
n, k = list(map(int, input().split()))
for i in range(1,n+1):
m = math.ceil(math.log2(k/i))
e += 1*(m<1) or 2**-m
print((e/n)) | from math import *
n,k=list(map(int,input().split()))
e=0
for i in range(1,n+1):
t=ceil(log2(k/i))
e+=1*(t<1)or 2**-t
print((e/n)) | 7 | 7 | 144 | 132 | import math
e = 0
n, k = list(map(int, input().split()))
for i in range(1, n + 1):
m = math.ceil(math.log2(k / i))
e += 1 * (m < 1) or 2**-m
print((e / n))
| from math import *
n, k = list(map(int, input().split()))
e = 0
for i in range(1, n + 1):
t = ceil(log2(k / i))
e += 1 * (t < 1) or 2**-t
print((e / n))
| false | 0 | [
"-import math",
"+from math import *",
"+n, k = list(map(int, input().split()))",
"-n, k = list(map(int, input().split()))",
"- m = math.ceil(math.log2(k / i))",
"- e += 1 * (m < 1) or 2**-m",
"+ t = ceil(log2(k / i))",
"+ e += 1 * (t < 1) or 2**-t"
] | false | 0.094875 | 0.057054 | 1.662906 | [
"s778599404",
"s308026360"
] |
u463775490 | p02820 | python | s180315376 | s384775264 | 93 | 80 | 4,212 | 4,212 | Accepted | Accepted | 13.98 | n, k = list(map(int,input().split()))
r, s, p = list(map(int,input().split()))
t = eval(input())
win = ['x' for i in range(n)]
ans = 0
if t[0] == 'r':
win[0] = 'p'
elif t[0] == 's':
win[0] = 'r'
else:
win[0] = 's'
for i in range(1,n):
if t[i] == 'r':
win[i] = 'p'
elif t[i] == '... | n, k = list(map(int,input().split()))
r, s, p = list(map(int,input().split()))
t = [i for i in eval(input())]
ans = 0
for i in range(n):
if t[i] == 'r':
tmp = p
ans += p
elif t[i] == 's':
tmp = r
ans += r
elif t[i] == 'p':
tmp = s
ans += s
if... | 29 | 18 | 611 | 381 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
win = ["x" for i in range(n)]
ans = 0
if t[0] == "r":
win[0] = "p"
elif t[0] == "s":
win[0] = "r"
else:
win[0] = "s"
for i in range(1, n):
if t[i] == "r":
win[i] = "p"
elif t[i] == "s":
... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = [i for i in eval(input())]
ans = 0
for i in range(n):
if t[i] == "r":
tmp = p
ans += p
elif t[i] == "s":
tmp = r
ans += r
elif t[i] == "p":
tmp = s
ans += s
if k <= i and ... | false | 37.931034 | [
"-t = eval(input())",
"-win = [\"x\" for i in range(n)]",
"+t = [i for i in eval(input())]",
"-if t[0] == \"r\":",
"- win[0] = \"p\"",
"-elif t[0] == \"s\":",
"- win[0] = \"r\"",
"-else:",
"- win[0] = \"s\"",
"-for i in range(1, n):",
"+for i in range(n):",
"- win[i] = \"p\"",
... | false | 0.083849 | 0.035118 | 2.387608 | [
"s180315376",
"s384775264"
] |
u014333473 | p03598 | python | s317263659 | s492652883 | 30 | 24 | 9,168 | 9,176 | Accepted | Accepted | 20 | n,k=int(eval(input())),int(eval(input()));print((sum([min(i*2,(k-i)*2) for i in list(map(int,input().split()))]))) | _,k=eval(input()),int(eval(input()));print((sum([min(i*2,(k-i)*2) for i in list(map(int,input().split()))]))) | 1 | 1 | 100 | 95 | n, k = int(eval(input())), int(eval(input()))
print((sum([min(i * 2, (k - i) * 2) for i in list(map(int, input().split()))])))
| _, k = eval(input()), int(eval(input()))
print((sum([min(i * 2, (k - i) * 2) for i in list(map(int, input().split()))])))
| false | 0 | [
"-n, k = int(eval(input())), int(eval(input()))",
"+_, k = eval(input()), int(eval(input()))"
] | false | 0.038614 | 0.042842 | 0.901319 | [
"s317263659",
"s492652883"
] |
u531603069 | p02732 | python | s011527947 | s149352249 | 357 | 314 | 24,748 | 26,908 | Accepted | Accepted | 12.04 | n = int(eval(input()))
a = list(map(int, input().split()))
c = [0]*n
for i in range(n):
c[a[i]-1] = c[a[i]-1] + 1
total = 0
for x in c:
total = total + x*(x-1)//2
for i in range(n):
print((total - c[a[i]-1] + 1))
| import copy
N = int(eval(input()))
A = list(map(int, input().split()))
count_dict = [0] * N
for each in A:
count_dict[each - 1] += 1
all_types = 0
for value in count_dict:
all_types += value * (value - 1) // 2
# result_dict = {}
# for each in a_types:
# result_dict[each] = all_types - count... | 14 | 18 | 238 | 390 | n = int(eval(input()))
a = list(map(int, input().split()))
c = [0] * n
for i in range(n):
c[a[i] - 1] = c[a[i] - 1] + 1
total = 0
for x in c:
total = total + x * (x - 1) // 2
for i in range(n):
print((total - c[a[i] - 1] + 1))
| import copy
N = int(eval(input()))
A = list(map(int, input().split()))
count_dict = [0] * N
for each in A:
count_dict[each - 1] += 1
all_types = 0
for value in count_dict:
all_types += value * (value - 1) // 2
# result_dict = {}
# for each in a_types:
# result_dict[each] = all_types - count_dict[each] + 1
... | false | 22.222222 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-c = [0] * n",
"-for i in range(n):",
"- c[a[i] - 1] = c[a[i] - 1] + 1",
"-total = 0",
"-for x in c:",
"- total = total + x * (x - 1) // 2",
"-for i in range(n):",
"- print((total - c[a[i] - 1] + 1))",
"+import copy",
... | false | 0.035071 | 0.035826 | 0.978918 | [
"s011527947",
"s149352249"
] |
u649558044 | p03240 | python | s044684559 | s917240020 | 912 | 489 | 84,792 | 3,700 | Accepted | Accepted | 46.38 | import itertools
n = int(input())
x, y, h = [], [], []
for _ in range(n):
xi, yi, hi = map(int, input().split())
if hi != 0:
x.append(xi)
y.append(yi)
h.append(hi)
candidate_cx = list(range(min(x), max(x) + 1))
candidate_cy = list(range(min(y), max(y) + 1))
candidate_ch = li... | import itertools
n = int(input())
x, y, h = [], [], []
for _ in range(n):
xi, yi, hi = map(int, input().split())
if hi != 0:
x.append(xi)
y.append(yi)
h.append(hi)
candidate_cx = list(range(min(x), max(x) + 1))
candidate_cy = list(range(min(y), max(y) + 1))
for cx, cy in l... | 24 | 26 | 725 | 724 | import itertools
n = int(input())
x, y, h = [], [], []
for _ in range(n):
xi, yi, hi = map(int, input().split())
if hi != 0:
x.append(xi)
y.append(yi)
h.append(hi)
candidate_cx = list(range(min(x), max(x) + 1))
candidate_cy = list(range(min(y), max(y) + 1))
candidate_ch = list(range(max... | import itertools
n = int(input())
x, y, h = [], [], []
for _ in range(n):
xi, yi, hi = map(int, input().split())
if hi != 0:
x.append(xi)
y.append(yi)
h.append(hi)
candidate_cx = list(range(min(x), max(x) + 1))
candidate_cy = list(range(min(y), max(y) + 1))
for cx, cy in list(itertools.... | false | 7.692308 | [
"-candidate_ch = list(range(max(h), max(max(x) - min(x), max(y) - min(y)) + max(h) + 1))",
"-for cx, cy, ch in list(itertools.product(candidate_cx, candidate_cy, candidate_ch)):",
"+for cx, cy in list(itertools.product(candidate_cx, candidate_cy)):",
"+ ch = 0",
"+ for xi, yi, hi in zip(x, y, h):",
... | false | 0.034383 | 0.036401 | 0.944572 | [
"s044684559",
"s917240020"
] |
u172773620 | p03495 | python | s308287897 | s508680084 | 233 | 192 | 48,992 | 37,720 | Accepted | Accepted | 17.6 | from collections import Counter
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
set_a = set(a)
count_list = []
if len(set_a) <= k:
print((0))
else:
a = Counter(a)
cost = 0
for (v, c) in a.most_common()[k:]:
cost += c
print(cost) | from collections import Counter
n, k = [int(i) for i in input().split()]
a = Counter([int(i) for i in input().split()])
cost = 0
print((sum(c for (v, c) in a.most_common()[k:])))
| 15 | 7 | 301 | 185 | from collections import Counter
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
set_a = set(a)
count_list = []
if len(set_a) <= k:
print((0))
else:
a = Counter(a)
cost = 0
for (v, c) in a.most_common()[k:]:
cost += c
print(cost)
| from collections import Counter
n, k = [int(i) for i in input().split()]
a = Counter([int(i) for i in input().split()])
cost = 0
print((sum(c for (v, c) in a.most_common()[k:])))
| false | 53.333333 | [
"-a = [int(i) for i in input().split()]",
"-set_a = set(a)",
"-count_list = []",
"-if len(set_a) <= k:",
"- print((0))",
"-else:",
"- a = Counter(a)",
"- cost = 0",
"- for (v, c) in a.most_common()[k:]:",
"- cost += c",
"- print(cost)",
"+a = Counter([int(i) for i in inpu... | false | 0.123817 | 0.17273 | 0.71682 | [
"s308287897",
"s508680084"
] |
u392319141 | p02616 | python | s619141571 | s527660378 | 237 | 216 | 33,544 | 32,268 | Accepted | Accepted | 8.86 | from collections import deque
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
P = [a for a in A if a >= 0]
N = [a for a in A if a < 0]
def canPositive():
for i in range(0, len(N) + 1, 2):
p = K - i
if p < 0:
break
if len... | from collections import deque
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
A.sort(reverse=True)
ans = 1
B = deque(A)
if K % 2 == 1:
ans *= B.popleft()
for _ in range(K // 2):
l = B[0] * B[1]
r = B[-1] * B[-2]
if l >= r:
ans *= B.... | 92 | 30 | 1,902 | 553 | from collections import deque
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
P = [a for a in A if a >= 0]
N = [a for a in A if a < 0]
def canPositive():
for i in range(0, len(N) + 1, 2):
p = K - i
if p < 0:
break
if len(P) >= p:
... | from collections import deque
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
A.sort(reverse=True)
ans = 1
B = deque(A)
if K % 2 == 1:
ans *= B.popleft()
for _ in range(K // 2):
l = B[0] * B[1]
r = B[-1] * B[-2]
if l >= r:
ans *= B.popleft() * B.poplef... | false | 67.391304 | [
"-P = [a for a in A if a >= 0]",
"-N = [a for a in A if a < 0]",
"-",
"-",
"-def canPositive():",
"- for i in range(0, len(N) + 1, 2):",
"- p = K - i",
"- if p < 0:",
"- break",
"- if len(P) >= p:",
"- return True",
"- return False",
"-",
"-... | false | 0.049384 | 0.043648 | 1.131425 | [
"s619141571",
"s527660378"
] |
u553987207 | p02989 | python | s064288344 | s736844173 | 76 | 66 | 14,428 | 20,640 | Accepted | Accepted | 13.16 | N = int(eval(input()))
d = sorted(map(int, input().split()))
abcmax = d[N//2-1]
arcmin = d[N//2]
print((arcmin - abcmax)) | N = int(eval(input()))
D = sorted(map(int, input().split()))
ans = D[N//2] - D[N//2-1]
print(ans) | 5 | 4 | 117 | 94 | N = int(eval(input()))
d = sorted(map(int, input().split()))
abcmax = d[N // 2 - 1]
arcmin = d[N // 2]
print((arcmin - abcmax))
| N = int(eval(input()))
D = sorted(map(int, input().split()))
ans = D[N // 2] - D[N // 2 - 1]
print(ans)
| false | 20 | [
"-d = sorted(map(int, input().split()))",
"-abcmax = d[N // 2 - 1]",
"-arcmin = d[N // 2]",
"-print((arcmin - abcmax))",
"+D = sorted(map(int, input().split()))",
"+ans = D[N // 2] - D[N // 2 - 1]",
"+print(ans)"
] | false | 0.110331 | 0.145217 | 0.759767 | [
"s064288344",
"s736844173"
] |
u627600101 | p02609 | python | s568149228 | s276178984 | 356 | 220 | 106,304 | 112,188 | Accepted | Accepted | 38.2 | N = int(eval(input()))
X = eval(input())
ans = [1 for _ in range(N)]
#original 1 count
l = 0
for k in range(N):
if X[k] == '1':
l+=1
if l == 0:
for _ in range(N):
print((1))
exit()
if l == 1:
if X[-1] == '1':
for _ in range(N-1):
ans[_] = 2
else:
ans[-1] = 2
for k in... | N = int(eval(input()))
X = eval(input())
ans = [1 for _ in range(N)]
#original 1 count
l = 0
for k in range(N):
if X[k] == '1':
l+=1
if l == 0:
for _ in range(N):
print((1))
exit()
if l == 1:
if X[-1] == '1':
for _ in range(N-1):
ans[_] = 2
else:
ans[-1] = 2
for k in... | 82 | 82 | 1,364 | 1,363 | N = int(eval(input()))
X = eval(input())
ans = [1 for _ in range(N)]
# original 1 count
l = 0
for k in range(N):
if X[k] == "1":
l += 1
if l == 0:
for _ in range(N):
print((1))
exit()
if l == 1:
if X[-1] == "1":
for _ in range(N - 1):
ans[_] = 2
else:
ans[... | N = int(eval(input()))
X = eval(input())
ans = [1 for _ in range(N)]
# original 1 count
l = 0
for k in range(N):
if X[k] == "1":
l += 1
if l == 0:
for _ in range(N):
print((1))
exit()
if l == 1:
if X[-1] == "1":
for _ in range(N - 1):
ans[_] = 2
else:
ans[... | false | 0 | [
"-\"\"\"",
"-ml = len(bin(l+1))-2",
"+ml = len(bin(l + 1)) - 2",
"- t *= 2",
"- for k in range(t//2, N, t):",
"- for j in range(t//2):",
"- if k+j>N-1:",
"- break",
"- poplist[k+j] += 1",
"+ t *= 2",
"+ for k in range(t // 2, N, t):",
"+ for j in range(t // 2... | false | 0.042355 | 0.03898 | 1.086581 | [
"s568149228",
"s276178984"
] |
u270681687 | p03253 | python | s254774774 | s087894009 | 167 | 141 | 15,296 | 15,040 | Accepted | Accepted | 15.57 | import math
n, m = list(map(int, input().split()))
mod = 10**9 + 7
b = []
c = int(math.sqrt(m))
for i in range(2, c+2):
count = 0
while m % i == 0:
count += 1
m = m // i
b.append(count)
if m > 1:
b.append(1)
fac = [1, 1]
inv = [1, 1]
finv = [1, 1]
for i in range(2... | import math
n, m = list(map(int, input().split()))
sqrt_m = math.sqrt(m)
sqrt_m = int(sqrt_m) + 1
mod = 10**9 + 7
fac = [1, 1]
inv = [1, 1]
finv = [1, 1]
for i in range(2, n + 31):
fac.append(fac[i-1] * i % mod)
inv.append(mod - inv[mod%i] * (mod//i) % mod)
finv.append(finv[i-1] * inv[i] % ... | 38 | 41 | 688 | 757 | import math
n, m = list(map(int, input().split()))
mod = 10**9 + 7
b = []
c = int(math.sqrt(m))
for i in range(2, c + 2):
count = 0
while m % i == 0:
count += 1
m = m // i
b.append(count)
if m > 1:
b.append(1)
fac = [1, 1]
inv = [1, 1]
finv = [1, 1]
for i in range(2, n + max(b) + 3):
... | import math
n, m = list(map(int, input().split()))
sqrt_m = math.sqrt(m)
sqrt_m = int(sqrt_m) + 1
mod = 10**9 + 7
fac = [1, 1]
inv = [1, 1]
finv = [1, 1]
for i in range(2, n + 31):
fac.append(fac[i - 1] * i % mod)
inv.append(mod - inv[mod % i] * (mod // i) % mod)
finv.append(finv[i - 1] * inv[i] % mod)
d... | false | 7.317073 | [
"+sqrt_m = math.sqrt(m)",
"+sqrt_m = int(sqrt_m) + 1",
"-b = []",
"-c = int(math.sqrt(m))",
"-for i in range(2, c + 2):",
"- count = 0",
"- while m % i == 0:",
"- count += 1",
"- m = m // i",
"- b.append(count)",
"-if m > 1:",
"- b.append(1)",
"-for i in range(2, n ... | false | 0.096388 | 0.066522 | 1.448959 | [
"s254774774",
"s087894009"
] |
u844646164 | p03476 | python | s788654526 | s054255706 | 747 | 207 | 70,744 | 77,820 | Accepted | Accepted | 72.29 |
q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(q)]
#nの素数判定
def is_prime(n):
if n == 1:
return 0
for i in range(2,int(n**0.5)+1):
if n % i == 0:
return 0
return 1
m = 0
for l, r in lr:
m = max(l, r, m)
prime_count = [0, 0]
for i i... | import sys
input = sys.stdin.readline
Q = int(eval(input()))
#nの素数判定
def is_prime(n):
if n == 1:
return False
for i in range(2,int(n**0.5)+1):
if n % i == 0:
return False
return True
l = [0]*(10**5+1)
for i in range(1, 10**5+1):
if i%2 and is_prime(i) and is_... | 27 | 24 | 615 | 485 | q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(q)]
# nの素数判定
def is_prime(n):
if n == 1:
return 0
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return 0
return 1
m = 0
for l, r in lr:
m = max(l, r, m)
prime_count = [0, 0]
for i in range(2, m... | import sys
input = sys.stdin.readline
Q = int(eval(input()))
# nの素数判定
def is_prime(n):
if n == 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
l = [0] * (10**5 + 1)
for i in range(1, 10**5 + 1):
if i % 2 and is_prime(i) and is_pr... | false | 11.111111 | [
"-q = int(eval(input()))",
"-lr = [list(map(int, input().split())) for _ in range(q)]",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+Q = int(eval(input()))",
"- return 0",
"+ return False",
"- return 0",
"- return 1",
"+ return False",
"+ retur... | false | 0.048102 | 0.760661 | 0.063237 | [
"s788654526",
"s054255706"
] |
u608088992 | p03148 | python | s803226838 | s822446484 | 865 | 305 | 44,564 | 28,604 | Accepted | Accepted | 64.74 | import heapq as hq
from collections import deque
from copy import deepcopy
N, K = list(map(int, input().split()))
Sushi = [None for _ in range(N)]
TotalType = set()
for _ in range(N):
t, d = list(map(int, input().split()))
Sushi[_] = [d, t]
Sushi.sort(reverse = True)
ChosenType = set()
Double = []
... | import sys
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
S = []
for _ in range(N):
t, d = list(map(int, input().split()))
S.append((d, t))
S.sort(reverse = True)
upperKCount = 0
appeared = set()
maxPoint = 0
for i in rang... | 34 | 44 | 1,005 | 1,229 | import heapq as hq
from collections import deque
from copy import deepcopy
N, K = list(map(int, input().split()))
Sushi = [None for _ in range(N)]
TotalType = set()
for _ in range(N):
t, d = list(map(int, input().split()))
Sushi[_] = [d, t]
Sushi.sort(reverse=True)
ChosenType = set()
Double = []
hq.heapify(Dou... | import sys
def solve():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
S = []
for _ in range(N):
t, d = list(map(int, input().split()))
S.append((d, t))
S.sort(reverse=True)
upperKCount = 0
appeared = set()
maxPoint = 0
for i in range(K):
... | false | 22.727273 | [
"-import heapq as hq",
"-from collections import deque",
"-from copy import deepcopy",
"+import sys",
"-N, K = list(map(int, input().split()))",
"-Sushi = [None for _ in range(N)]",
"-TotalType = set()",
"-for _ in range(N):",
"- t, d = list(map(int, input().split()))",
"- Sushi[_] = [d, t]"... | false | 0.096778 | 0.106033 | 0.912714 | [
"s803226838",
"s822446484"
] |
u120360464 | p00728 | python | s804119363 | s326440861 | 20 | 10 | 4,192 | 6,388 | Accepted | Accepted | 50 | # -*- coding: utf-8 -*-
n = int(input())
while n != 0:
list = []
for i in range(n):
list.append(int(input()))
print((sum(list)-max(list)-min(list))/(n-2))
n = int(input()) | #!usr/bin/env python
# -*- coding: utf-8 -*-
while True:
n = int(input())
if n == 0:
break
list = []
for i in range(n):
list.append(int(input()))
print((sum(list) - max(list) - min(list))/(n-2)) | 10 | 11 | 217 | 284 | # -*- coding: utf-8 -*-
n = int(input())
while n != 0:
list = []
for i in range(n):
list.append(int(input()))
print((sum(list) - max(list) - min(list)) / (n - 2))
n = int(input())
| #!usr/bin/env python
# -*- coding: utf-8 -*-
while True:
n = int(input())
if n == 0:
break
list = []
for i in range(n):
list.append(int(input()))
print((sum(list) - max(list) - min(list)) / (n - 2))
| false | 9.090909 | [
"+#!usr/bin/env python",
"-n = int(input())",
"-while n != 0:",
"+while True:",
"+ n = int(input())",
"+ if n == 0:",
"+ break",
"- n = int(input())"
] | false | 0.037247 | 0.04296 | 0.867019 | [
"s804119363",
"s326440861"
] |
u670180528 | p03142 | python | s555258548 | s323459396 | 1,849 | 1,652 | 57,288 | 37,488 | Accepted | Accepted | 10.65 | def topologicalSort(g: list, deg: list):
ret = []
q = []
for i, d in enumerate(deg):
if not d:
ret.append(i)
q.append(i)
while q:
cur = q.pop(0)
for nxt in g[cur]:
deg[nxt] -= 1
if not deg[nxt]:
ret.append(nxt)
q.append(nxt)
return ret
def main():
v, e, *L = list(map(in... | def main():
v, e, *L = list(map(int, open(0).read().split()))
g = [[] for _ in range(v)]
deg = [0] * v
for s, t in zip(*[iter(L)] * 2):
g[s - 1].append(t - 1)
deg[t - 1] += 1
q = []
for i, d in enumerate(deg):
if not d:
q.append(i)
ans = [0] * v
while q:
c = q.pop(0)
for n in g[c]:
... | 37 | 23 | 800 | 456 | def topologicalSort(g: list, deg: list):
ret = []
q = []
for i, d in enumerate(deg):
if not d:
ret.append(i)
q.append(i)
while q:
cur = q.pop(0)
for nxt in g[cur]:
deg[nxt] -= 1
if not deg[nxt]:
ret.append(nxt)
... | def main():
v, e, *L = list(map(int, open(0).read().split()))
g = [[] for _ in range(v)]
deg = [0] * v
for s, t in zip(*[iter(L)] * 2):
g[s - 1].append(t - 1)
deg[t - 1] += 1
q = []
for i, d in enumerate(deg):
if not d:
q.append(i)
ans = [0] * v
while ... | false | 37.837838 | [
"-def topologicalSort(g: list, deg: list):",
"- ret = []",
"+def main():",
"+ v, e, *L = list(map(int, open(0).read().split()))",
"+ g = [[] for _ in range(v)]",
"+ deg = [0] * v",
"+ for s, t in zip(*[iter(L)] * 2):",
"+ g[s - 1].append(t - 1)",
"+ deg[t - 1] += 1",
"... | false | 0.108739 | 0.036834 | 2.952117 | [
"s555258548",
"s323459396"
] |
u941438707 | p03986 | python | s393721453 | s075839533 | 75 | 49 | 10,520 | 9,084 | Accepted | Accepted | 34.67 | a=[]
for i in eval(input()):
if i=="S":
a+=i
if a:
if i=="T" and a[-1]=="T":
a+=i
if i=="T" and a[-1]=="S":
a.pop(-1)
elif i=="T" and len(a)==0:
a+=i
print((len(a))) | s=t=0
for i in eval(input()):
if i=="S":s+=1
else:
if s:s-=1
else:t+=1
print((s+t)) | 13 | 7 | 246 | 93 | a = []
for i in eval(input()):
if i == "S":
a += i
if a:
if i == "T" and a[-1] == "T":
a += i
if i == "T" and a[-1] == "S":
a.pop(-1)
elif i == "T" and len(a) == 0:
a += i
print((len(a)))
| s = t = 0
for i in eval(input()):
if i == "S":
s += 1
else:
if s:
s -= 1
else:
t += 1
print((s + t))
| false | 46.153846 | [
"-a = []",
"+s = t = 0",
"- a += i",
"- if a:",
"- if i == \"T\" and a[-1] == \"T\":",
"- a += i",
"- if i == \"T\" and a[-1] == \"S\":",
"- a.pop(-1)",
"- elif i == \"T\" and len(a) == 0:",
"- a += i",
"-print((len(a)))",
"+ s += ... | false | 0.08058 | 0.083668 | 0.963088 | [
"s393721453",
"s075839533"
] |
u562935282 | p03165 | python | s185017837 | s518861631 | 609 | 413 | 121,308 | 112,988 | Accepted | Accepted | 32.18 | s = eval(input())
t = eval(input())
ls = len(s)
lt = len(t)
dp = [[0 for _ in range(lt + 1)] for _ in range(ls + 1)]
# dp[si][ti] = si文字目までとti文字目までのLCS長
for si in range(ls):
for ti in range(lt):
if s[si] == t[ti]:
dp[si + 1][ti + 1] = max(dp[si + 1][ti + 1], dp[si][ti] + 1)
... | s = eval(input())
n = len(s)
t = eval(input())
m = len(t)
dp = tuple([0] * (m + 1) for _ in range(n + 1))
for i in range(n):
for j in range(m):
if s[i] == t[j]:
dp[i + 1][j + 1] = dp[i][j] + 1
else:
dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1])
rest = ... | 30 | 31 | 700 | 562 | s = eval(input())
t = eval(input())
ls = len(s)
lt = len(t)
dp = [[0 for _ in range(lt + 1)] for _ in range(ls + 1)]
# dp[si][ti] = si文字目までとti文字目までのLCS長
for si in range(ls):
for ti in range(lt):
if s[si] == t[ti]:
dp[si + 1][ti + 1] = max(dp[si + 1][ti + 1], dp[si][ti] + 1)
dp[si + 1][ti... | s = eval(input())
n = len(s)
t = eval(input())
m = len(t)
dp = tuple([0] * (m + 1) for _ in range(n + 1))
for i in range(n):
for j in range(m):
if s[i] == t[j]:
dp[i + 1][j + 1] = dp[i][j] + 1
else:
dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1])
rest = dp[n][m]
ans = ""
i... | false | 3.225806 | [
"+n = len(s)",
"-ls = len(s)",
"-lt = len(t)",
"-dp = [[0 for _ in range(lt + 1)] for _ in range(ls + 1)]",
"-# dp[si][ti] = si文字目までとti文字目までのLCS長",
"-for si in range(ls):",
"- for ti in range(lt):",
"- if s[si] == t[ti]:",
"- dp[si + 1][ti + 1] = max(dp[si + 1][ti + 1], dp[si][t... | false | 0.034219 | 0.03675 | 0.931138 | [
"s185017837",
"s518861631"
] |
u163320134 | p03163 | python | s785652314 | s977547069 | 1,860 | 274 | 9,716 | 39,792 | Accepted | Accepted | 85.27 | import sys
input=sys.stdin.readline
n,w=list(map(int,input().split()))
dp=[0]*(w+1)
def ans(n,w):
for _ in range(n):
c,p=list(map(int,input().split()))
for j in range(w,c-1,-1):
tmp=dp[j-c]+p
if dp[j]<tmp:
dp[j]=tmp
return max(dp)
print((ans(n,w))) | import sys
input=sys.stdin.readline
n,w=list(map(int,input().split()))
dp=[0]*(w+1)
c,p=list(map(int,input().split()))
dp[c]=p
def ans(n,w):
for _ in range(1,n):
c,p=list(map(int,input().split()))
for j in range(w,c,-1):
if dp[j-c] != 0 and dp[j]<dp[j-c]+p:
dp[j]=dp[j-c]+p
if... | 15 | 18 | 284 | 364 | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
dp = [0] * (w + 1)
def ans(n, w):
for _ in range(n):
c, p = list(map(int, input().split()))
for j in range(w, c - 1, -1):
tmp = dp[j - c] + p
if dp[j] < tmp:
dp[j] = tmp
return... | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
dp = [0] * (w + 1)
c, p = list(map(int, input().split()))
dp[c] = p
def ans(n, w):
for _ in range(1, n):
c, p = list(map(int, input().split()))
for j in range(w, c, -1):
if dp[j - c] != 0 and dp[j] < dp[j - c... | false | 16.666667 | [
"+c, p = list(map(int, input().split()))",
"+dp[c] = p",
"- for _ in range(n):",
"+ for _ in range(1, n):",
"- for j in range(w, c - 1, -1):",
"- tmp = dp[j - c] + p",
"- if dp[j] < tmp:",
"- dp[j] = tmp",
"+ for j in range(w, c, -1):",
"+ ... | false | 0.03716 | 0.042292 | 0.878651 | [
"s785652314",
"s977547069"
] |
u572532976 | p03291 | python | s053817997 | s039128826 | 1,653 | 1,389 | 14,316 | 14,676 | Accepted | Accepted | 15.97 | import numpy as np
dp = np.zeros((2, 4), dtype=np.int64)
mod = 1e9+7
dp[0][0] = 1
for s in eval(input()):
if s == '?':
dp[1] = dp[0]*3
dp[1][1:] += dp[0][:3]
dp[1] = np.remainder(dp[1], mod)
else:
dp[1] = dp[0]
if s == 'A':
dp[1][1] += dp[0][0]... | import numpy as np
dp = np.zeros((2, 4), dtype=np.int64)
mod = int(1e9+7)
dp[0][0] = 1
for s in eval(input()):
if s == '?':
dp[1] = dp[0]*3
dp[1][1:] += dp[0][:3]
else:
dp[1] = dp[0]
if s == 'A':
dp[1][1] += dp[0][0]
elif s == 'B':
... | 24 | 20 | 623 | 448 | import numpy as np
dp = np.zeros((2, 4), dtype=np.int64)
mod = 1e9 + 7
dp[0][0] = 1
for s in eval(input()):
if s == "?":
dp[1] = dp[0] * 3
dp[1][1:] += dp[0][:3]
dp[1] = np.remainder(dp[1], mod)
else:
dp[1] = dp[0]
if s == "A":
dp[1][1] += dp[0][0]
... | import numpy as np
dp = np.zeros((2, 4), dtype=np.int64)
mod = int(1e9 + 7)
dp[0][0] = 1
for s in eval(input()):
if s == "?":
dp[1] = dp[0] * 3
dp[1][1:] += dp[0][:3]
else:
dp[1] = dp[0]
if s == "A":
dp[1][1] += dp[0][0]
elif s == "B":
dp[1][2] +=... | false | 16.666667 | [
"-mod = 1e9 + 7",
"+mod = int(1e9 + 7)",
"- dp[1] = np.remainder(dp[1], mod)",
"- dp[1][1] = np.remainder(dp[1][1], mod)",
"- dp[1][2] = np.remainder(dp[1][2], mod)",
"- dp[1][3] = np.remainder(dp[1][3], mod)",
"- dp[0] = dp[1]",
"+ dp[0] = np.remainder(dp... | false | 0.237631 | 0.223397 | 1.063716 | [
"s053817997",
"s039128826"
] |
u918009437 | p03611 | python | s807333042 | s258813425 | 189 | 142 | 30,940 | 21,088 | Accepted | Accepted | 24.87 | import collections
if __name__ == '__main__':
n = int(eval(input()))
A = list(map(int,input().split()))
tmp_A = []
for a in A:
tmp_A.append(a-1)
tmp_A.append(a)
tmp_A.append(a+1)
c = collections.Counter(tmp_A)
most_common_element = c.most_common()[0][0]
... | import collections
if __name__ == '__main__':
n = int(eval(input()))
a_list = list(map(int,input().split()))
c = collections.Counter(a_list)
dic_cnt = dict(c.most_common())
answer = -1
for k in list(dic_cnt.keys()):
cnt = dic_cnt[k]
if k-1 in list(dic_cnt.keys(... | 22 | 21 | 493 | 462 | import collections
if __name__ == "__main__":
n = int(eval(input()))
A = list(map(int, input().split()))
tmp_A = []
for a in A:
tmp_A.append(a - 1)
tmp_A.append(a)
tmp_A.append(a + 1)
c = collections.Counter(tmp_A)
most_common_element = c.most_common()[0][0]
answer =... | import collections
if __name__ == "__main__":
n = int(eval(input()))
a_list = list(map(int, input().split()))
c = collections.Counter(a_list)
dic_cnt = dict(c.most_common())
answer = -1
for k in list(dic_cnt.keys()):
cnt = dic_cnt[k]
if k - 1 in list(dic_cnt.keys()):
... | false | 4.545455 | [
"- A = list(map(int, input().split()))",
"- tmp_A = []",
"- for a in A:",
"- tmp_A.append(a - 1)",
"- tmp_A.append(a)",
"- tmp_A.append(a + 1)",
"- c = collections.Counter(tmp_A)",
"- most_common_element = c.most_common()[0][0]",
"- answer = 0",
"- for a i... | false | 0.043439 | 0.046429 | 0.935603 | [
"s807333042",
"s258813425"
] |
u493520238 | p02900 | python | s155877456 | s055873605 | 201 | 73 | 3,188 | 63,320 | Accepted | Accepted | 63.68 | def factorization(n):
arr = {}
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr[i] = cnt
if temp!=1:
arr[temp] = 1
if arr=={}:
arr[... | from math import gcd
def factorization(n):
pf_cnt = {}
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i == 0:
cnt = 0
while temp%i == 0:
cnt += 1
temp //= i
if i != 1: pf_cnt[i] = cnt
if temp != 1: pf_c... | 29 | 22 | 583 | 500 | def factorization(n):
arr = {}
temp = n
for i in range(2, int(-(-(n**0.5) // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
arr[i] = cnt
if temp != 1:
arr[temp] = 1
if arr == {}:
... | from math import gcd
def factorization(n):
pf_cnt = {}
temp = n
for i in range(2, int(-(-(n**0.5) // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
if i != 1:
pf_cnt[i] = cnt
if te... | false | 24.137931 | [
"+from math import gcd",
"+",
"+",
"- arr = {}",
"+ pf_cnt = {}",
"- arr[i] = cnt",
"+ if i != 1:",
"+ pf_cnt[i] = cnt",
"- arr[temp] = 1",
"- if arr == {}:",
"- arr[n] = 1",
"- return arr",
"+ pf_cnt[temp] = 1",
"+ i... | false | 0.046447 | 0.046024 | 1.009196 | [
"s155877456",
"s055873605"
] |
u150984829 | p00008 | python | s503849232 | s715905073 | 110 | 20 | 5,600 | 5,604 | Accepted | Accepted | 81.82 | import sys
a=[0]*51;x=list(range(10))
for i in range(51):
a[i]=sum([1 for p in x for q in x for r in x for s in x if p+q+r+s==i])
for e in sys.stdin:
print((a[int(e)]))
| import sys
a=[0]*51
for i in range(10):a[i]=a[36-i]=(i+3)*(i+2)*(i+1)//6
for i in range(10,19):a[i]=a[36-i]=(i+3)*(i+2)*(i+1)//6-a[i-10]*4
for e in map(int,sys.stdin):print((a[e]))
| 6 | 5 | 168 | 183 | import sys
a = [0] * 51
x = list(range(10))
for i in range(51):
a[i] = sum([1 for p in x for q in x for r in x for s in x if p + q + r + s == i])
for e in sys.stdin:
print((a[int(e)]))
| import sys
a = [0] * 51
for i in range(10):
a[i] = a[36 - i] = (i + 3) * (i + 2) * (i + 1) // 6
for i in range(10, 19):
a[i] = a[36 - i] = (i + 3) * (i + 2) * (i + 1) // 6 - a[i - 10] * 4
for e in map(int, sys.stdin):
print((a[e]))
| false | 16.666667 | [
"-x = list(range(10))",
"-for i in range(51):",
"- a[i] = sum([1 for p in x for q in x for r in x for s in x if p + q + r + s == i])",
"-for e in sys.stdin:",
"- print((a[int(e)]))",
"+for i in range(10):",
"+ a[i] = a[36 - i] = (i + 3) * (i + 2) * (i + 1) // 6",
"+for i in range(10, 19):",
... | false | 0.107368 | 0.04471 | 2.401418 | [
"s503849232",
"s715905073"
] |
u608088992 | p03215 | python | s873194584 | s213285480 | 2,501 | 346 | 35,948 | 29,340 | Accepted | Accepted | 86.17 | from copy import deepcopy
from collections import deque
N, K = list(map(int, input().split()))
A = [int(a) for a in input().split()]
Sum = deque([0])
for i in range(N):
Sum.append(Sum[-1] + A[i])
Asum = deque([])
for i in range(N):
for j in range(i+1, N+1):
Asum.append(Sum[j] - Sum[i])
Sear... | import sys
sys.setrecursionlimit(1000000)
def search(i, L, Lnum, K):
if i > 40: return 0
add = pow(2, 40 - i)
nextK = []
count = 0
for l in L:
if l & add == add:
nextK.append(l)
count += 1
#print(i, L)
if count >= K: return add + search(i+1, next... | 23 | 34 | 576 | 804 | from copy import deepcopy
from collections import deque
N, K = list(map(int, input().split()))
A = [int(a) for a in input().split()]
Sum = deque([0])
for i in range(N):
Sum.append(Sum[-1] + A[i])
Asum = deque([])
for i in range(N):
for j in range(i + 1, N + 1):
Asum.append(Sum[j] - Sum[i])
Search = dee... | import sys
sys.setrecursionlimit(1000000)
def search(i, L, Lnum, K):
if i > 40:
return 0
add = pow(2, 40 - i)
nextK = []
count = 0
for l in L:
if l & add == add:
nextK.append(l)
count += 1
# print(i, L)
if count >= K:
return add + search(i +... | false | 32.352941 | [
"-from copy import deepcopy",
"-from collections import deque",
"+import sys",
"-N, K = list(map(int, input().split()))",
"-A = [int(a) for a in input().split()]",
"-Sum = deque([0])",
"-for i in range(N):",
"- Sum.append(Sum[-1] + A[i])",
"-Asum = deque([])",
"-for i in range(N):",
"- for... | false | 0.039545 | 0.037349 | 1.058798 | [
"s873194584",
"s213285480"
] |
u970449052 | p02983 | python | s780469780 | s195986138 | 1,718 | 773 | 3,064 | 3,060 | Accepted | Accepted | 55.01 | l,r=list(map(int,input().split()))
a=[]
for i in range(l,min(r+1,l+2020)):
a.append(i%2019)
a=sorted(a)
ans=2020
for i in range(len(a)-1):
for j in range(1,len(a)):
ans=min(ans,a[i]*a[j]%2019)
print(ans) | l,r=list(map(int,input().split()))
ans=10**10
for i in range(l,min(r,l+2019)):
for j in range(i+1,min(r,l+2019)+1):
ans=min(ans,i*j%2019)
print(ans) | 10 | 6 | 222 | 159 | l, r = list(map(int, input().split()))
a = []
for i in range(l, min(r + 1, l + 2020)):
a.append(i % 2019)
a = sorted(a)
ans = 2020
for i in range(len(a) - 1):
for j in range(1, len(a)):
ans = min(ans, a[i] * a[j] % 2019)
print(ans)
| l, r = list(map(int, input().split()))
ans = 10**10
for i in range(l, min(r, l + 2019)):
for j in range(i + 1, min(r, l + 2019) + 1):
ans = min(ans, i * j % 2019)
print(ans)
| false | 40 | [
"-a = []",
"-for i in range(l, min(r + 1, l + 2020)):",
"- a.append(i % 2019)",
"-a = sorted(a)",
"-ans = 2020",
"-for i in range(len(a) - 1):",
"- for j in range(1, len(a)):",
"- ans = min(ans, a[i] * a[j] % 2019)",
"+ans = 10**10",
"+for i in range(l, min(r, l + 2019)):",
"+ fo... | false | 0.119945 | 0.100412 | 1.194532 | [
"s780469780",
"s195986138"
] |
u242031676 | p03329 | python | s125336858 | s186358012 | 390 | 326 | 3,064 | 3,060 | Accepted | Accepted | 16.41 | n = int(eval(input()))
mn = 1e10
for i in range(n+1):
ans = 0
a, b = i, n-i
while a>=6:
a, mo = divmod(a, 6)
ans += mo
ans += a
while b>=9:
b, mo = divmod(b, 9)
ans += mo
ans += b
mn = min(mn, ans)
print(mn) | def rec(n, x):
d, m = divmod(n, x)
if d: return m + rec(d, x)
else: return m
ans = n = int(eval(input()))
for i in range(n+1):
ans = min(ans, rec(i, 6)+rec(n-i, 9))
print(ans) | 19 | 9 | 283 | 210 | n = int(eval(input()))
mn = 1e10
for i in range(n + 1):
ans = 0
a, b = i, n - i
while a >= 6:
a, mo = divmod(a, 6)
ans += mo
ans += a
while b >= 9:
b, mo = divmod(b, 9)
ans += mo
ans += b
mn = min(mn, ans)
print(mn)
| def rec(n, x):
d, m = divmod(n, x)
if d:
return m + rec(d, x)
else:
return m
ans = n = int(eval(input()))
for i in range(n + 1):
ans = min(ans, rec(i, 6) + rec(n - i, 9))
print(ans)
| false | 52.631579 | [
"-n = int(eval(input()))",
"-mn = 1e10",
"+def rec(n, x):",
"+ d, m = divmod(n, x)",
"+ if d:",
"+ return m + rec(d, x)",
"+ else:",
"+ return m",
"+",
"+",
"+ans = n = int(eval(input()))",
"- ans = 0",
"- a, b = i, n - i",
"- while a >= 6:",
"- a, ... | false | 0.280343 | 0.0768 | 3.650307 | [
"s125336858",
"s186358012"
] |
u691501673 | p02837 | python | s534355267 | s945029893 | 1,639 | 492 | 3,064 | 3,064 | Accepted | Accepted | 69.98 | N = int(eval(input()))
# print("")
# 証言者ごとに整理する
testimony_list = []
for i in range(N):
array = [-1] * N
testimony_list.append(array)
for i in range(N):
A = int(eval(input()))
for j in range(A):
# iさんの、xさんへの証言
x, y = list(map(int, input().split()))
# print("test:{} {... | N = int(eval(input()))
# 証言者ごとに整理する
testimony_list = []
for i in range(N):
array = [-1] * N
testimony_list.append(array)
for i in range(N):
A = int(eval(input()))
for j in range(A):
x, y = list(map(int, input().split()))
# iさんの、xさんへの証言
testimony_list[i][x - 1] = y
... | 71 | 28 | 2,128 | 718 | N = int(eval(input()))
# print("")
# 証言者ごとに整理する
testimony_list = []
for i in range(N):
array = [-1] * N
testimony_list.append(array)
for i in range(N):
A = int(eval(input()))
for j in range(A):
# iさんの、xさんへの証言
x, y = list(map(int, input().split()))
# print("test:{} {}".format(x, y... | N = int(eval(input()))
# 証言者ごとに整理する
testimony_list = []
for i in range(N):
array = [-1] * N
testimony_list.append(array)
for i in range(N):
A = int(eval(input()))
for j in range(A):
x, y = list(map(int, input().split()))
# iさんの、xさんへの証言
testimony_list[i][x - 1] = y
max_count = 0
f... | false | 60.56338 | [
"-# print(\"\")",
"+ x, y = list(map(int, input().split()))",
"- x, y = list(map(int, input().split()))",
"- # print(\"test:{} {}\".format(x, y))",
"- # iさんの、xさんへの証言",
"- # print(\"test:{} {} {}\".format(x - 1, i, y))",
"- # print(testimony_list)",
"-# print(t... | false | 0.039436 | 0.078857 | 0.500095 | [
"s534355267",
"s945029893"
] |
u165436807 | p02711 | python | s231637406 | s483099697 | 22 | 20 | 9,052 | 8,936 | Accepted | Accepted | 9.09 | import math
N = int(eval(input()))
if N%10 == 7:
print("Yes")
elif (N-N%10)%100 == 70:
print("Yes")
elif N-N%100 == 700:
print("Yes")
else:
print("No")
| S = eval(input())
X = 0
for i in range(3):
if int(S[i]) == 7:
X += 1
if X == 0:
print('No')
else:
print('Yes')
| 10 | 10 | 163 | 135 | import math
N = int(eval(input()))
if N % 10 == 7:
print("Yes")
elif (N - N % 10) % 100 == 70:
print("Yes")
elif N - N % 100 == 700:
print("Yes")
else:
print("No")
| S = eval(input())
X = 0
for i in range(3):
if int(S[i]) == 7:
X += 1
if X == 0:
print("No")
else:
print("Yes")
| false | 0 | [
"-import math",
"-",
"-N = int(eval(input()))",
"-if N % 10 == 7:",
"+S = eval(input())",
"+X = 0",
"+for i in range(3):",
"+ if int(S[i]) == 7:",
"+ X += 1",
"+if X == 0:",
"+ print(\"No\")",
"+else:",
"-elif (N - N % 10) % 100 == 70:",
"- print(\"Yes\")",
"-elif N - N %... | false | 0.077011 | 0.043952 | 1.752162 | [
"s231637406",
"s483099697"
] |
u130900604 | p02574 | python | s770759840 | s799878979 | 1,908 | 430 | 184,680 | 186,860 | Accepted | Accepted | 77.46 | from math import gcd
from functools import reduce
from collections import defaultdict
n=int(eval(input()))
a=list(map(int,input().split()))
g=reduce(gcd,a)
if g!=1:
print("not coprime")
exit()
def isPrimeMR(n):
d = n - 1
d = d // (d & -d)
L = [2]
for a in L:
t = d
... | from math import gcd
from functools import reduce
from collections import defaultdict
n=int(eval(input()))
a=list(map(int,input().split()))
g=reduce(gcd,a)
if g!=1:
print("not coprime")
exit()
def isPrimeMR(n):
d = n - 1
d = d // (d & -d)
L = [2]
for a in L:
t = d
... | 89 | 88 | 2,215 | 2,205 | from math import gcd
from functools import reduce
from collections import defaultdict
n = int(eval(input()))
a = list(map(int, input().split()))
g = reduce(gcd, a)
if g != 1:
print("not coprime")
exit()
def isPrimeMR(n):
d = n - 1
d = d // (d & -d)
L = [2]
for a in L:
t = d
y ... | from math import gcd
from functools import reduce
from collections import defaultdict
n = int(eval(input()))
a = list(map(int, input().split()))
g = reduce(gcd, a)
if g != 1:
print("not coprime")
exit()
def isPrimeMR(n):
d = n - 1
d = d // (d & -d)
L = [2]
for a in L:
t = d
y ... | false | 1.123596 | [
"+s = set()",
"+ if d[j] == 1:",
"+ print(\"setwise coprime\")",
"+ exit()",
"-for _, di in list(d.items()):",
"- if di >= 2:",
"- print(\"setwise coprime\")",
"- exit()"
] | false | 0.047537 | 0.048047 | 0.989371 | [
"s770759840",
"s799878979"
] |
u561231954 | p02845 | python | s569924434 | s174350472 | 192 | 65 | 104,364 | 14,056 | Accepted | Accepted | 66.15 | MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
ans = 1
def dfs(i,x,y,z,a,n):
global ans
if i == n:
return
if x == y == z == a[i]:
ans *= 3
ans %= MOD
dfs(i + 1,x + 1,y,z,a,n)
elif x == y == a[i... | MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
def main():
n = int(eval(input()))
a = list(map(int,input().split()))
cnt = [0] * (n + 1)
cnt[0] = 3
ans = 1
for num in a:
ans *= cnt[num]
ans %=... | 43 | 26 | 863 | 435 | MOD = 10**9 + 7
INF = 10**10
import sys
sys.setrecursionlimit(100000000)
dy = (-1, 0, 1, 0)
dx = (0, 1, 0, -1)
ans = 1
def dfs(i, x, y, z, a, n):
global ans
if i == n:
return
if x == y == z == a[i]:
ans *= 3
ans %= MOD
dfs(i + 1, x + 1, y, z, a, n)
elif x == y == a[i]:... | MOD = 10**9 + 7
INF = 10**10
import sys
sys.setrecursionlimit(100000000)
dy = (-1, 0, 1, 0)
dx = (0, 1, 0, -1)
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = [0] * (n + 1)
cnt[0] = 3
ans = 1
for num in a:
ans *= cnt[num]
ans %= MOD
cnt[num... | false | 39.534884 | [
"-ans = 1",
"-",
"-",
"-def dfs(i, x, y, z, a, n):",
"- global ans",
"- if i == n:",
"- return",
"- if x == y == z == a[i]:",
"- ans *= 3",
"- ans %= MOD",
"- dfs(i + 1, x + 1, y, z, a, n)",
"- elif x == y == a[i]:",
"- ans *= 2",
"- an... | false | 0.062061 | 0.137246 | 0.452186 | [
"s569924434",
"s174350472"
] |
u365156087 | p03495 | python | s692593222 | s155344084 | 201 | 113 | 49,116 | 32,284 | Accepted | Accepted | 43.78 | n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
D = dict.fromkeys(list(range(1,n+1)),0)
ans = 0
for a in A:
D[a] += 1
D = sorted(list(D.items()), key=lambda x:x[1])
for i in range(n-k):
ans += D[i][1]
print(ans) | n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
L = [0] * n
ans = 0
for a in A:
L[a-1] += 1
L = sorted(L)
for i in range(n-k):
ans += L[i]
print(ans) | 10 | 12 | 230 | 184 | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
D = dict.fromkeys(list(range(1, n + 1)), 0)
ans = 0
for a in A:
D[a] += 1
D = sorted(list(D.items()), key=lambda x: x[1])
for i in range(n - k):
ans += D[i][1]
print(ans)
| n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
L = [0] * n
ans = 0
for a in A:
L[a - 1] += 1
L = sorted(L)
for i in range(n - k):
ans += L[i]
print(ans)
| false | 16.666667 | [
"-D = dict.fromkeys(list(range(1, n + 1)), 0)",
"+L = [0] * n",
"- D[a] += 1",
"-D = sorted(list(D.items()), key=lambda x: x[1])",
"+ L[a - 1] += 1",
"+L = sorted(L)",
"- ans += D[i][1]",
"+ ans += L[i]"
] | false | 0.041454 | 0.041343 | 1.002668 | [
"s692593222",
"s155344084"
] |
u367130284 | p03325 | python | s664933377 | s407435860 | 87 | 59 | 4,468 | 4,084 | Accepted | Accepted | 32.18 | n,*a=list(map(int,open(0).read().split()))
#print(f.reduce(o.mul,a))
a=[s for s in a if s%2==0]
if len(a)==0:
print((0))
exit()
count=0
for x in a:
while True:
if x%2==0:
x=x//2
count+=1
else:
break
print(count) | n,*a=list(map(int,open(0).read().split()))
def f(x):
ans=0
while x%2==0 :
ans+=1
x//=2
return ans
print((sum(map(f,a)))) | 16 | 8 | 283 | 147 | n, *a = list(map(int, open(0).read().split()))
# print(f.reduce(o.mul,a))
a = [s for s in a if s % 2 == 0]
if len(a) == 0:
print((0))
exit()
count = 0
for x in a:
while True:
if x % 2 == 0:
x = x // 2
count += 1
else:
break
print(count)
| n, *a = list(map(int, open(0).read().split()))
def f(x):
ans = 0
while x % 2 == 0:
ans += 1
x //= 2
return ans
print((sum(map(f, a))))
| false | 50 | [
"-# print(f.reduce(o.mul,a))",
"-a = [s for s in a if s % 2 == 0]",
"-if len(a) == 0:",
"- print((0))",
"- exit()",
"-count = 0",
"-for x in a:",
"- while True:",
"- if x % 2 == 0:",
"- x = x // 2",
"- count += 1",
"- else:",
"- break",... | false | 0.035262 | 0.054586 | 0.64599 | [
"s664933377",
"s407435860"
] |
u951145045 | p03805 | python | s919509023 | s345946836 | 46 | 40 | 9,052 | 9,236 | Accepted | Accepted | 13.04 |
N,M=list(map(int,input().split()))
path_matrix=[]
for i in range(N):
path_matrix.append([False]*N)
for i in range(M):
a,b=list(map(int,input().split()))
path_matrix[a-1][b-1]=True
path_matrix[b-1][a-1]=True
view=[False]*N
def path(x,depth):
if view[x-1]:
return False
... | N,M=list(map(int,input().split()))
A=[[] for i in range(N)]
for i in range(M):
x,y=list(map(int,input().split()))
A[x-1].append(y)
A[y-1].append(x)
color=["W" for i in range(N)]
clear=["B" for i in range(N)]
def path(x,d):
if color[x-1]=="B":
return False
color[x... | 30 | 30 | 561 | 533 | N, M = list(map(int, input().split()))
path_matrix = []
for i in range(N):
path_matrix.append([False] * N)
for i in range(M):
a, b = list(map(int, input().split()))
path_matrix[a - 1][b - 1] = True
path_matrix[b - 1][a - 1] = True
view = [False] * N
def path(x, depth):
if view[x - 1]:
retu... | N, M = list(map(int, input().split()))
A = [[] for i in range(N)]
for i in range(M):
x, y = list(map(int, input().split()))
A[x - 1].append(y)
A[y - 1].append(x)
color = ["W" for i in range(N)]
clear = ["B" for i in range(N)]
def path(x, d):
if color[x - 1] == "B":
return False
color[x - 1... | false | 0 | [
"-path_matrix = []",
"-for i in range(N):",
"- path_matrix.append([False] * N)",
"+A = [[] for i in range(N)]",
"- a, b = list(map(int, input().split()))",
"- path_matrix[a - 1][b - 1] = True",
"- path_matrix[b - 1][a - 1] = True",
"-view = [False] * N",
"+ x, y = list(map(int, input(... | false | 0.039267 | 0.039021 | 1.006324 | [
"s919509023",
"s345946836"
] |
u475065881 | p03283 | python | s739981919 | s196525382 | 615 | 546 | 8,728 | 8,668 | Accepted | Accepted | 11.22 | import sys
N, M, Q = list(map(int, sys.stdin.readline().split()))
LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
L, R = list(map(int, sys.stdin.readline().split()))
LR[L][R-L+1] += 1
for i in range(2,N+2):
for j in range(1,N-i+2):
LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - ... | import sys
from itertools import accumulate
N, M, Q = list(map(int, sys.stdin.readline().split()))
LR = [[0 for _ in range(N-i)] for i in range(N)]
for i in range(M):
L, R = list(map(int, sys.stdin.readline().split()))
LR[L-1][R-L] += 1
for i in range(N-2,-1,-1):
for j, acc in enumerate(accumulate(L... | 16 | 16 | 457 | 483 | import sys
N, M, Q = list(map(int, sys.stdin.readline().split()))
LR = [[0 for _ in range(N + 2 - i)] for i in range(N + 2)]
for i in range(M):
L, R = list(map(int, sys.stdin.readline().split()))
LR[L][R - L + 1] += 1
for i in range(2, N + 2):
for j in range(1, N - i + 2):
LR[j][i] += LR[j][i - 1] ... | import sys
from itertools import accumulate
N, M, Q = list(map(int, sys.stdin.readline().split()))
LR = [[0 for _ in range(N - i)] for i in range(N)]
for i in range(M):
L, R = list(map(int, sys.stdin.readline().split()))
LR[L - 1][R - L] += 1
for i in range(N - 2, -1, -1):
for j, acc in enumerate(accumulat... | false | 0 | [
"+from itertools import accumulate",
"-LR = [[0 for _ in range(N + 2 - i)] for i in range(N + 2)]",
"+LR = [[0 for _ in range(N - i)] for i in range(N)]",
"- LR[L][R - L + 1] += 1",
"-for i in range(2, N + 2):",
"- for j in range(1, N - i + 2):",
"- LR[j][i] += LR[j][i - 1] + LR[j + 1][i - ... | false | 0.038527 | 0.038379 | 1.003865 | [
"s739981919",
"s196525382"
] |
u241190159 | p03229 | python | s886575948 | s022403733 | 111 | 97 | 14,452 | 14,452 | Accepted | Accepted | 12.61 | def main():
N, *A = list(map(int, open(0).read().split()))
A.sort()
if N % 2:
array1 = [-2] * (N // 2) + [1] * 2 + [2] * (N // 2 - 1)
array2 = [-2] * (N // 2 - 1) + [-1] * 2 + [2] * (N // 2)
ret1 = 0
ret2 = 0
for i in range(N):
ret1 += A[i]*array1[i]
ret2 += A[i]*a... | def main():
N, *A = list(map(int, open(0).read().split()))
A.sort()
if N % 2:
array1 = [-2] * (N // 2) + [1] * 2 + [2] * (N // 2 - 1)
array2 = [-2] * (N // 2 - 1) + [-1] * 2 + [2] * (N // 2)
ret1 = 0
ret2 = 0
for i, j, k in zip(A, array1, array2):
ret1 += i * j
ret2... | 27 | 27 | 559 | 560 | def main():
N, *A = list(map(int, open(0).read().split()))
A.sort()
if N % 2:
array1 = [-2] * (N // 2) + [1] * 2 + [2] * (N // 2 - 1)
array2 = [-2] * (N // 2 - 1) + [-1] * 2 + [2] * (N // 2)
ret1 = 0
ret2 = 0
for i in range(N):
ret1 += A[i] * array1[i]
... | def main():
N, *A = list(map(int, open(0).read().split()))
A.sort()
if N % 2:
array1 = [-2] * (N // 2) + [1] * 2 + [2] * (N // 2 - 1)
array2 = [-2] * (N // 2 - 1) + [-1] * 2 + [2] * (N // 2)
ret1 = 0
ret2 = 0
for i, j, k in zip(A, array1, array2):
ret1 += ... | false | 0 | [
"- for i in range(N):",
"- ret1 += A[i] * array1[i]",
"- ret2 += A[i] * array2[i]",
"+ for i, j, k in zip(A, array1, array2):",
"+ ret1 += i * j",
"+ ret2 += i * k",
"- for i in range(N):",
"- ret += A[i] * array1[i]",
"+ ... | false | 0.072734 | 0.038467 | 1.890791 | [
"s886575948",
"s022403733"
] |
u150984829 | p00513 | python | s193467990 | s032095950 | 7,380 | 5,520 | 8,000 | 5,992 | Accepted | Accepted | 25.2 | a=[int(eval(input()))for _ in[0]*int(eval(input()))]
m=a[-1]+1
def f(S):
x=1
while 2*x*-~x<m:
if(S-x)%(2*x+1)==0:return 0
x+=1
return 1
print((sum(f(S)for S in a)))
| a=0
for _ in[0]*int(eval(input())):
n=int(eval(input()))
for i in range(1,int(n**.5)+1):
if(n-i)%(2*i+1)==0:break
else:a+=1
print(a)
| 9 | 7 | 166 | 132 | a = [int(eval(input())) for _ in [0] * int(eval(input()))]
m = a[-1] + 1
def f(S):
x = 1
while 2 * x * -~x < m:
if (S - x) % (2 * x + 1) == 0:
return 0
x += 1
return 1
print((sum(f(S) for S in a)))
| a = 0
for _ in [0] * int(eval(input())):
n = int(eval(input()))
for i in range(1, int(n**0.5) + 1):
if (n - i) % (2 * i + 1) == 0:
break
else:
a += 1
print(a)
| false | 22.222222 | [
"-a = [int(eval(input())) for _ in [0] * int(eval(input()))]",
"-m = a[-1] + 1",
"-",
"-",
"-def f(S):",
"- x = 1",
"- while 2 * x * -~x < m:",
"- if (S - x) % (2 * x + 1) == 0:",
"- return 0",
"- x += 1",
"- return 1",
"-",
"-",
"-print((sum(f(S) for S in... | false | 0.066187 | 0.037023 | 1.787741 | [
"s193467990",
"s032095950"
] |
u037430802 | p03575 | python | s374276050 | s638051423 | 24 | 22 | 3,064 | 3,064 | Accepted | Accepted | 8.33 | n,m = list(map(int, input().split()))
es = [tuple([int(x)-1 for x in input().split()]) for _ in range(m)]
class UnionFind:
def __init__(self, n):
self.parent = [i for i in range(n)]
self.rank = [0] * n
self.count = 0
def root(self, x):
if self.parent[x] == x:
... | class UnionFind:
def __init__(self,N):
self.parent = [i for i in range(N)]
self.rank = [0] * N
self.count = 0
def root(self,a):
if self.parent[a] == a:
return a
else:
self.parent[a] = self.root(self.parent[a])
return self.pare... | 48 | 46 | 1,238 | 1,143 | n, m = list(map(int, input().split()))
es = [tuple([int(x) - 1 for x in input().split()]) for _ in range(m)]
class UnionFind:
def __init__(self, n):
self.parent = [i for i in range(n)]
self.rank = [0] * n
self.count = 0
def root(self, x):
if self.parent[x] == x:
re... | class UnionFind:
def __init__(self, N):
self.parent = [i for i in range(N)]
self.rank = [0] * N
self.count = 0
def root(self, a):
if self.parent[a] == a:
return a
else:
self.parent[a] = self.root(self.parent[a])
return self.parent[a]
... | false | 4.166667 | [
"-n, m = list(map(int, input().split()))",
"-es = [tuple([int(x) - 1 for x in input().split()]) for _ in range(m)]",
"-",
"-",
"- def __init__(self, n):",
"- self.parent = [i for i in range(n)]",
"- self.rank = [0] * n",
"+ def __init__(self, N):",
"+ self.parent = [i for ... | false | 0.035326 | 0.035367 | 0.998845 | [
"s374276050",
"s638051423"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.