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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u020604402 | p03574 | python | s601747035 | s012054488 | 32 | 29 | 3,444 | 3,444 | Accepted | Accepted | 9.38 | H,W = map(int,input().split())
L = []
blank = ['.' for _ in range(W+2)]
L.append(blank)
def cnt(x):
if x == '#':
return 1
else:
return 0
for _ in range(H):
L.append(['.']+list(input())+['.'])
L.append(blank)
for i in range(1,H+1):
for j in range(1,W+1):
if L[i... | H, W = map(int,input().split())
L = []
def cange(x):
if x == '.':
return 0
else:
return 1
zerofill = [ '.' for _ in range(W+2)]
L.append(zerofill)
for _ in range(H):
L.append(['.']+list(input())+['.'])
L.append(zerofill)
for i in range(1,H+1):
for j in range(1,1+W):
if L[i][j]... | 27 | 28 | 594 | 547 | H, W = map(int, input().split())
L = []
blank = ["." for _ in range(W + 2)]
L.append(blank)
def cnt(x):
if x == "#":
return 1
else:
return 0
for _ in range(H):
L.append(["."] + list(input()) + ["."])
L.append(blank)
for i in range(1, H + 1):
for j in range(1, W + 1):
if L[i][... | H, W = map(int, input().split())
L = []
def cange(x):
if x == ".":
return 0
else:
return 1
zerofill = ["." for _ in range(W + 2)]
L.append(zerofill)
for _ in range(H):
L.append(["."] + list(input()) + ["."])
L.append(zerofill)
for i in range(1, H + 1):
for j in range(1, 1 + W):
... | false | 3.571429 | [
"-blank = [\".\" for _ in range(W + 2)]",
"-L.append(blank)",
"-def cnt(x):",
"- if x == \"#\":",
"+def cange(x):",
"+ if x == \".\":",
"+ return 0",
"+ else:",
"- else:",
"- return 0",
"+zerofill = [\".\" for _ in range(W + 2)]",
"+L.append(zerofill)",
"-L.append(b... | false | 0.039735 | 0.089591 | 0.443517 | [
"s601747035",
"s012054488"
] |
u463775490 | p03030 | python | s534744491 | s407856694 | 21 | 17 | 3,064 | 3,064 | Accepted | Accepted | 19.05 | n = int(eval(input()))
s = []
p = []
ans = [0]*n
for i in range(n):
s1,p1 = [str(i) for i in input().split()]
s.append(s1)
p.append(p1)
ans[i] = i + 1
for i in range(n):
p[i] = int(p[i])
flag = 1
while flag:
flag = 0
for i in range(n-1,0,-1):
if s[i] < s[i-1]:
... | n = int(eval(input()))
ans = [[] for i in range(n)]
for i in range(n):
ss,pp = list(map(str,input().split()))
ans[i].append(ss)
ans[i].append(int(pp))
ans[i].append(i+1)
ans.sort(key=lambda x: (x[0],-x[1]))
for i in range(n):
print((ans[i][2])) | 30 | 10 | 708 | 259 | n = int(eval(input()))
s = []
p = []
ans = [0] * n
for i in range(n):
s1, p1 = [str(i) for i in input().split()]
s.append(s1)
p.append(p1)
ans[i] = i + 1
for i in range(n):
p[i] = int(p[i])
flag = 1
while flag:
flag = 0
for i in range(n - 1, 0, -1):
if s[i] < s[i - 1]:
s[... | n = int(eval(input()))
ans = [[] for i in range(n)]
for i in range(n):
ss, pp = list(map(str, input().split()))
ans[i].append(ss)
ans[i].append(int(pp))
ans[i].append(i + 1)
ans.sort(key=lambda x: (x[0], -x[1]))
for i in range(n):
print((ans[i][2]))
| false | 66.666667 | [
"-s = []",
"-p = []",
"-ans = [0] * n",
"+ans = [[] for i in range(n)]",
"- s1, p1 = [str(i) for i in input().split()]",
"- s.append(s1)",
"- p.append(p1)",
"- ans[i] = i + 1",
"+ ss, pp = list(map(str, input().split()))",
"+ ans[i].append(ss)",
"+ ans[i].append(int(pp))",
... | false | 0.042172 | 0.043146 | 0.977431 | [
"s534744491",
"s407856694"
] |
u546285759 | p00148 | python | s440390408 | s597026022 | 30 | 20 | 7,536 | 7,688 | Accepted | Accepted | 33.33 | while True:
try:
c= int(eval(input()))
except:
break
c%= 39
print(("3C0"+str(c) if len(str(c))==1 and c> 0 else ("3C39" if not c else "3C"+str(c)))) | while True:
try:
a = int(eval(input()))
except:
break
tmp = a - (a // 39) * 39
print(("3C{:02d}".format(tmp if tmp % 39 else 39))) | 7 | 7 | 178 | 160 | while True:
try:
c = int(eval(input()))
except:
break
c %= 39
print(
(
"3C0" + str(c)
if len(str(c)) == 1 and c > 0
else ("3C39" if not c else "3C" + str(c))
)
)
| while True:
try:
a = int(eval(input()))
except:
break
tmp = a - (a // 39) * 39
print(("3C{:02d}".format(tmp if tmp % 39 else 39)))
| false | 0 | [
"- c = int(eval(input()))",
"+ a = int(eval(input()))",
"- c %= 39",
"- print(",
"- (",
"- \"3C0\" + str(c)",
"- if len(str(c)) == 1 and c > 0",
"- else (\"3C39\" if not c else \"3C\" + str(c))",
"- )",
"- )",
"+ tmp = a - ... | false | 0.041012 | 0.035373 | 1.159422 | [
"s440390408",
"s597026022"
] |
u789132058 | p02900 | python | s781721664 | s651060248 | 634 | 326 | 3,064 | 3,064 | Accepted | Accepted | 48.58 | import sys
import itertools
input = sys.stdin.readline
#複数入力
a,b=(int(x) for x in input().split())
def factorize(n):
b = 2
#本当は[]
fct = [1]
while b * b <= n:
while n % b == 0:
n //= b
fct.append(b)
b = b + 1
if n > 1:
fct.append(n)
... | import sys
import itertools
input = sys.stdin.readline
#複数入力
a,b=(int(x) for x in input().split())
def factorize(n):
b = 2
#本当は[]
fct = [1]
while b * b <= n:
while n % b == 0:
n //= b
fct.append(b)
b = b + 1
if n > 1:
fct.append(n)
... | 25 | 21 | 536 | 387 | import sys
import itertools
input = sys.stdin.readline
# 複数入力
a, b = (int(x) for x in input().split())
def factorize(n):
b = 2
# 本当は[]
fct = [1]
while b * b <= n:
while n % b == 0:
n //= b
fct.append(b)
b = b + 1
if n > 1:
fct.append(n)
return f... | import sys
import itertools
input = sys.stdin.readline
# 複数入力
a, b = (int(x) for x in input().split())
def factorize(n):
b = 2
# 本当は[]
fct = [1]
while b * b <= n:
while n % b == 0:
n //= b
fct.append(b)
b = b + 1
if n > 1:
fct.append(n)
return f... | false | 16 | [
"-# len(list(itertools.combinations(set(factorize(a))&set(factorize(b)),2)))",
"-if len(set(factorize(a)) & set(factorize(b))) == 1:",
"- print((1))",
"-else:",
"- print((len((set(factorize(a)) & set(factorize(b))))))",
"+print((len((set(factorize(a)) & set(factorize(b))))))"
] | false | 0.075094 | 0.035105 | 2.139152 | [
"s781721664",
"s651060248"
] |
u695811449 | p03287 | python | s054774481 | s924293235 | 125 | 113 | 16,956 | 14,696 | Accepted | Accepted | 9.6 | N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
S=[0]*(N+1)
for i in range(N):
S[i+1]=(A[i]+S[i])%M
def tr(k):
return k*(k-1)//2
countlist=dict()
check=set()
for i in range(1,N+1):
countlist[S[i]]=countlist.get(S[i],0)+1
ANS=countlist.get(0,0)
... |
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
S=[0]*(N+1)
for i in range(N):
S[i+1]=(A[i]+S[i])%M
def tr(k):
return k*(k-1)//2
S.sort()
S=[-1]+S+[-1]
count=0
ANS=0
for i in range(1,N+3):
if S[i]==S[i-1]:
count+=1
else:
ANS+=tr(count)... | 35 | 28 | 396 | 346 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
S = [0] * (N + 1)
for i in range(N):
S[i + 1] = (A[i] + S[i]) % M
def tr(k):
return k * (k - 1) // 2
countlist = dict()
check = set()
for i in range(1, N + 1):
countlist[S[i]] = countlist.get(S[i], 0) + 1
ANS = countlist.get(0, 0... | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
S = [0] * (N + 1)
for i in range(N):
S[i + 1] = (A[i] + S[i]) % M
def tr(k):
return k * (k - 1) // 2
S.sort()
S = [-1] + S + [-1]
count = 0
ANS = 0
for i in range(1, N + 3):
if S[i] == S[i - 1]:
count += 1
else:
... | false | 20 | [
"-countlist = dict()",
"-check = set()",
"-for i in range(1, N + 1):",
"- countlist[S[i]] = countlist.get(S[i], 0) + 1",
"-ANS = countlist.get(0, 0)",
"-for i in list(countlist.keys()):",
"- ANS += tr(countlist[i])",
"+S.sort()",
"+S = [-1] + S + [-1]",
"+count = 0",
"+ANS = 0",
"+for i ... | false | 0.032733 | 0.09292 | 0.352274 | [
"s054774481",
"s924293235"
] |
u941022948 | p03315 | python | s878756836 | s271700349 | 18 | 16 | 2,940 | 2,940 | Accepted | Accepted | 11.11 | a=eval(input())
ans=0
for i in a:
if i=='+':
ans+=1
else:
ans=ans-1
print(ans)
| a=(eval(input()))
print((a.count('+')-a.count('-'))) | 8 | 2 | 104 | 45 | a = eval(input())
ans = 0
for i in a:
if i == "+":
ans += 1
else:
ans = ans - 1
print(ans)
| a = eval(input())
print((a.count("+") - a.count("-")))
| false | 75 | [
"-ans = 0",
"-for i in a:",
"- if i == \"+\":",
"- ans += 1",
"- else:",
"- ans = ans - 1",
"-print(ans)",
"+print((a.count(\"+\") - a.count(\"-\")))"
] | false | 0.064793 | 0.109996 | 0.589053 | [
"s878756836",
"s271700349"
] |
u074220993 | p03945 | python | s807974236 | s882352234 | 211 | 36 | 9,144 | 9,116 | Accepted | Accepted | 82.94 | S = eval(input())
X = S[0]
ans = 0
while 1:
for i in range(len(S)):
if S[i] != X:
ans += 1
X =S[i]
S = S[i:]
break
else:
break
print(ans)
| S = eval(input())
l = len(S)
ans = sum(a != b for a,b in zip(S[:l-1],S[1:]))
print(ans) | 14 | 4 | 226 | 84 | S = eval(input())
X = S[0]
ans = 0
while 1:
for i in range(len(S)):
if S[i] != X:
ans += 1
X = S[i]
S = S[i:]
break
else:
break
print(ans)
| S = eval(input())
l = len(S)
ans = sum(a != b for a, b in zip(S[: l - 1], S[1:]))
print(ans)
| false | 71.428571 | [
"-X = S[0]",
"-ans = 0",
"-while 1:",
"- for i in range(len(S)):",
"- if S[i] != X:",
"- ans += 1",
"- X = S[i]",
"- S = S[i:]",
"- break",
"- else:",
"- break",
"+l = len(S)",
"+ans = sum(a != b for a, b in zip(S[: l - 1], S[1:... | false | 0.037496 | 0.036187 | 1.036152 | [
"s807974236",
"s882352234"
] |
u657361950 | p02271 | python | s682320952 | s519358532 | 1,520 | 1,230 | 6,412 | 5,948 | Accepted | Accepted | 19.08 | def subset_sum(s, a):
dict = {}
return subset_rec(0, s, a, dict)
def subset_rec(i, s, a, dict):
key = str(i) + '-' + str(s)
if key in dict:
ret = dict[key]
elif s == 0:
ret = True
elif i >= len(a):
ret = False
else:
ret = subset_rec(i+1, s-a[i], a, dict) or subset_rec(i+1, s, a, dict)
d... | def subset_sum(s, a):
n = len(a)
dp = [[False for x in range(s+1)] for x in range(n+1)]
for i in range(n):
v = a[i]
for j in range(s+1):
if v == j:
dp[i+1][j] = True
elif v > j:
dp[i+1][j] = dp[i][j]
else:
dp[i+1][j] = dp[i][j] or dp[i][j-v]
return dp[n][s]
n = int(eval(input... | 27 | 23 | 547 | 504 | def subset_sum(s, a):
dict = {}
return subset_rec(0, s, a, dict)
def subset_rec(i, s, a, dict):
key = str(i) + "-" + str(s)
if key in dict:
ret = dict[key]
elif s == 0:
ret = True
elif i >= len(a):
ret = False
else:
ret = subset_rec(i + 1, s - a[i], a, dict)... | def subset_sum(s, a):
n = len(a)
dp = [[False for x in range(s + 1)] for x in range(n + 1)]
for i in range(n):
v = a[i]
for j in range(s + 1):
if v == j:
dp[i + 1][j] = True
elif v > j:
dp[i + 1][j] = dp[i][j]
else:
... | false | 14.814815 | [
"- dict = {}",
"- return subset_rec(0, s, a, dict)",
"-",
"-",
"-def subset_rec(i, s, a, dict):",
"- key = str(i) + \"-\" + str(s)",
"- if key in dict:",
"- ret = dict[key]",
"- elif s == 0:",
"- ret = True",
"- elif i >= len(a):",
"- ret = False",
"- ... | false | 0.037458 | 0.036035 | 1.039493 | [
"s682320952",
"s519358532"
] |
u285891772 | p03053 | python | s202123457 | s774130440 | 339 | 274 | 120,432 | 114,676 | Accepted | Accepted | 19.17 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 47 | 48 | 1,474 | 1,481 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 2.083333 | [
"-cnt = [[0] * W for _ in range(H)]",
"+cnt = [[-1] * W for _ in range(H)]",
"+ cnt[y][x] = 0",
"- for Dy, Dx in zip(dy, dx):",
"- ny = y + Dy",
"- nx = x + Dx",
"- if 0 <= ny < H and 0 <= nx < W and cnt[ny][nx] == 0 and A[ny][nx] == \".\":",
"+ for i in range(4):... | false | 0.047908 | 0.048064 | 0.996754 | [
"s202123457",
"s774130440"
] |
u562935282 | p02850 | python | s832513981 | s791740501 | 516 | 469 | 86,304 | 54,180 | Accepted | Accepted | 9.11 | def solve():
from collections import deque
import sys
input = sys.stdin.readline
n = int(input())
g = tuple(set() for _ in range(n))
for idx in range(n - 1):
a, b = (int(x) - 1 for x in input().split())
g[a].add((b, idx))
g[b].add((a, idx))
q = deque... | def main():
from collections import deque
import sys
input = sys.stdin.readline
N = int(input())
g = tuple(set() for _ in range(N))
for i in range(N - 1):
a, b = (int(x) - 1 for x in input().split())
g[a].add((b, i))
g[b].add((a, i))
dq = deque()
... | 40 | 33 | 901 | 784 | def solve():
from collections import deque
import sys
input = sys.stdin.readline
n = int(input())
g = tuple(set() for _ in range(n))
for idx in range(n - 1):
a, b = (int(x) - 1 for x in input().split())
g[a].add((b, idx))
g[b].add((a, idx))
q = deque()
q.append((... | def main():
from collections import deque
import sys
input = sys.stdin.readline
N = int(input())
g = tuple(set() for _ in range(N))
for i in range(N - 1):
a, b = (int(x) - 1 for x in input().split())
g[a].add((b, i))
g[b].add((a, i))
dq = deque()
dq.append([0, -1... | false | 17.5 | [
"-def solve():",
"+def main():",
"- n = int(input())",
"- g = tuple(set() for _ in range(n))",
"- for idx in range(n - 1):",
"+ N = int(input())",
"+ g = tuple(set() for _ in range(N))",
"+ for i in range(N - 1):",
"- g[a].add((b, idx))",
"- g[b].add((a, idx))",
"... | false | 0.040232 | 0.112212 | 0.35854 | [
"s832513981",
"s791740501"
] |
u361826811 | p02911 | python | s868757376 | s396001059 | 401 | 92 | 21,464 | 12,392 | Accepted | Accepted | 77.06 | """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K, Q, *A = map(int, read().split())
point = np.zeros(N+1)
for i in A:
point[i] += 1
point += K - Q
print(*['Y... | """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K, Q, *A = map(int, read().split())
point =[K-Q]*(N+1)
for i in A:
point[i] += 1
print(*['Yes' if i > 0 else... | 19 | 18 | 374 | 357 | """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K, Q, *A = map(int, read().split())
point = np.zeros(N + 1)
for i in A:
point[i] += 1
point += K - Q
print(*["Yes" if i > 0 else "... | """
author : halo2halo
date : 4, Feb, 2020
"""
import sys
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K, Q, *A = map(int, read().split())
point = [K - Q] * (N + 1)
for i in A:
point[i] += 1
print(*["Yes" if i > 0 else "No" for i i... | false | 5.263158 | [
"-import numpy as np",
"+# import numpy as np",
"-point = np.zeros(N + 1)",
"+point = [K - Q] * (N + 1)",
"-point += K - Q"
] | false | 0.449894 | 0.038786 | 11.599466 | [
"s868757376",
"s396001059"
] |
u130900604 | p02720 | python | s140749731 | s124797873 | 321 | 140 | 29,176 | 16,120 | Accepted | Accepted | 56.39 | # coding: utf-8
# Your code here!
from collections import deque
k=int(eval(input()))
ans=[]
d=deque([1,2,3,4,5,6,7,8,9])
c=0
while c<11:
q=d.popleft()
ans.append(q)
c=len(str(q))
b=q%10
if b!=0:
d.append(q*10+b-1)
d.append(q*10+b)
if b!=9:
d.append(q*10+b+1)
... | # coding: utf-8
# Your code here!
from collections import deque
k=int(eval(input()))
ans=[]
d=deque([1,2,3,4,5,6,7,8,9])
c=0
while c<100100:
q=d.popleft()
ans.append(q)
c+=1
b=q%10
if b!=0:
d.append(q*10+b-1)
d.append(q*10+b)
if b!=9:
d.append(q*10+b+1)
... | 19 | 19 | 335 | 330 | # coding: utf-8
# Your code here!
from collections import deque
k = int(eval(input()))
ans = []
d = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
c = 0
while c < 11:
q = d.popleft()
ans.append(q)
c = len(str(q))
b = q % 10
if b != 0:
d.append(q * 10 + b - 1)
d.append(q * 10 + b)
if b != 9:
... | # coding: utf-8
# Your code here!
from collections import deque
k = int(eval(input()))
ans = []
d = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
c = 0
while c < 100100:
q = d.popleft()
ans.append(q)
c += 1
b = q % 10
if b != 0:
d.append(q * 10 + b - 1)
d.append(q * 10 + b)
if b != 9:
... | false | 0 | [
"-while c < 11:",
"+while c < 100100:",
"- c = len(str(q))",
"+ c += 1"
] | false | 1.330709 | 0.283419 | 4.6952 | [
"s140749731",
"s124797873"
] |
u094191970 | p02661 | python | s758988058 | s462792744 | 467 | 278 | 26,976 | 25,364 | Accepted | Accepted | 40.47 | n=int(eval(input()))
s=[]
e=[]
for i in range(n):
a,b=list(map(int,input().split()))
s.append(a)
e.append(b)
s=sorted(s)
e=sorted(e,reverse=True)
x=n//2
if n%2==1:
ans=(e[x]-s[x]+1)
else:
ts=(s[x]+s[x-1])/2
te=(e[x]+e[x-1])/2
ans=(te-ts)//0.5+1
print((int(ans))) | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
n=int(eval(input()))
l1=[]
l2=[]
for i in range(n):
a,b=nii()
l1.append(a)
l2.append(b)
l1.sort()
l2.sort()
if n%2==1:
ans=l2[n//2]-l1[n//2]
else:
m1=(l2[n//2]+l2[n... | 22 | 23 | 288 | 372 | n = int(eval(input()))
s = []
e = []
for i in range(n):
a, b = list(map(int, input().split()))
s.append(a)
e.append(b)
s = sorted(s)
e = sorted(e, reverse=True)
x = n // 2
if n % 2 == 1:
ans = e[x] - s[x] + 1
else:
ts = (s[x] + s[x - 1]) / 2
te = (e[x] + e[x - 1]) / 2
ans = (te - ts) // 0.5 ... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
n = int(eval(input()))
l1 = []
l2 = []
for i in range(n):
a, b = nii()
l1.append(a)
l2.append(b)
l1.sort()
l2.sort()
if n % 2 == 1:
ans = l2[n // 2] - l1[n // 2]
else:
... | false | 4.347826 | [
"+from sys import stdin",
"+",
"+nii = lambda: list(map(int, stdin.readline().split()))",
"+lnii = lambda: list(map(int, stdin.readline().split()))",
"-s = []",
"-e = []",
"+l1 = []",
"+l2 = []",
"- a, b = list(map(int, input().split()))",
"- s.append(a)",
"- e.append(b)",
"-s = sorte... | false | 0.038307 | 0.035606 | 1.075869 | [
"s758988058",
"s462792744"
] |
u452269253 | p02802 | python | s718222743 | s729644548 | 581 | 281 | 51,288 | 5,528 | Accepted | Accepted | 51.64 | n, m = [int(i) for i in input().split()]
wa = [0]*n
ac = [0]*n
for _ in range(m):
p, s = input().split()
if s == "WA":
if ac[int(p)-1] == 0:
wa[int(p)-1] += 1
else:
ac[int(p)-1] += 1
print((n-ac.count(0), sum([wa[i] for i in range(n) if ac[i] >= 1])))
| def main():
n, m = [int(i) for i in input().split()]
wa = [0]*n
ac = [0]*n
for _ in range(m):
p, s = input().split()
if s == "WA":
if ac[int(p)-1] == 0:
wa[int(p)-1] += 1
else:
ac[int(p)-1] += 1
print((n-ac.count(... | 13 | 18 | 304 | 412 | n, m = [int(i) for i in input().split()]
wa = [0] * n
ac = [0] * n
for _ in range(m):
p, s = input().split()
if s == "WA":
if ac[int(p) - 1] == 0:
wa[int(p) - 1] += 1
else:
ac[int(p) - 1] += 1
print((n - ac.count(0), sum([wa[i] for i in range(n) if ac[i] >= 1])))
| def main():
n, m = [int(i) for i in input().split()]
wa = [0] * n
ac = [0] * n
for _ in range(m):
p, s = input().split()
if s == "WA":
if ac[int(p) - 1] == 0:
wa[int(p) - 1] += 1
else:
ac[int(p) - 1] += 1
print((n - ac.count(0), sum([wa... | false | 27.777778 | [
"-n, m = [int(i) for i in input().split()]",
"-wa = [0] * n",
"-ac = [0] * n",
"-for _ in range(m):",
"- p, s = input().split()",
"- if s == \"WA\":",
"- if ac[int(p) - 1] == 0:",
"- wa[int(p) - 1] += 1",
"- else:",
"- ac[int(p) - 1] += 1",
"-print((n - ac.count... | false | 0.037795 | 0.078062 | 0.484174 | [
"s718222743",
"s729644548"
] |
u891635666 | p03475 | python | s128591433 | s140962599 | 133 | 103 | 3,188 | 3,188 | Accepted | Accepted | 22.56 | n = int(eval(input()))
cs, ss, fs = [], [], []
for _ in range(n - 1):
c, s, f = list(map(int, input().split()))
cs.append(c)
ss.append(s)
fs.append(f)
cs.append(0)
ss.append(0)
fs.append(1)
res = []
for i in range(n - 1):
arrives = [0]
lefts = [ss[i]]
for j in range(i, n - 1)... | n = int(eval(input()))
cs, ss, fs = [], [], []
for _ in range(n - 1):
c, s, f = list(map(int, input().split()))
cs.append(c)
ss.append(s)
fs.append(f)
cs.append(0)
ss.append(0)
fs.append(1)
res = []
for i in range(n - 1):
t = 0
for j in range(i, n - 1):
s = ss[j]
... | 29 | 26 | 640 | 492 | n = int(eval(input()))
cs, ss, fs = [], [], []
for _ in range(n - 1):
c, s, f = list(map(int, input().split()))
cs.append(c)
ss.append(s)
fs.append(f)
cs.append(0)
ss.append(0)
fs.append(1)
res = []
for i in range(n - 1):
arrives = [0]
lefts = [ss[i]]
for j in range(i, n - 1):
a = le... | n = int(eval(input()))
cs, ss, fs = [], [], []
for _ in range(n - 1):
c, s, f = list(map(int, input().split()))
cs.append(c)
ss.append(s)
fs.append(f)
cs.append(0)
ss.append(0)
fs.append(1)
res = []
for i in range(n - 1):
t = 0
for j in range(i, n - 1):
s = ss[j]
f = fs[j]
... | false | 10.344828 | [
"- arrives = [0]",
"- lefts = [ss[i]]",
"+ t = 0",
"- a = lefts[-1] + cs[j]",
"- arrives.append(a)",
"- ns = ss[j + 1]",
"- if a > ss[j + 1]:",
"- nf = fs[j + 1]",
"- w = (nf - (a - ns) % nf) % nf",
"- lefts.append(a + w)",
"-... | false | 0.050052 | 0.048991 | 1.021655 | [
"s128591433",
"s140962599"
] |
u707808519 | p02842 | python | s776834050 | s381487011 | 32 | 17 | 2,940 | 2,940 | Accepted | Accepted | 46.88 | import sys
N = int(eval(input()))
for i in range(N+1):
a = int(i * 1.08)
if N == a:
print(i)
sys.exit()
print(':(') | import math
n = int(eval(input()))
a = math.ceil(n/1.08)
if int(a*1.08) == n:
print(a)
else:
print(':(') | 8 | 7 | 140 | 112 | import sys
N = int(eval(input()))
for i in range(N + 1):
a = int(i * 1.08)
if N == a:
print(i)
sys.exit()
print(":(")
| import math
n = int(eval(input()))
a = math.ceil(n / 1.08)
if int(a * 1.08) == n:
print(a)
else:
print(":(")
| false | 12.5 | [
"-import sys",
"+import math",
"-N = int(eval(input()))",
"-for i in range(N + 1):",
"- a = int(i * 1.08)",
"- if N == a:",
"- print(i)",
"- sys.exit()",
"-print(\":(\")",
"+n = int(eval(input()))",
"+a = math.ceil(n / 1.08)",
"+if int(a * 1.08) == n:",
"+ print(a)",
... | false | 0.061422 | 0.042397 | 1.448735 | [
"s776834050",
"s381487011"
] |
u770018088 | p02547 | python | s883195576 | s635481518 | 30 | 27 | 9,188 | 9,192 | Accepted | Accepted | 10 | it = lambda: list(map(int, input().strip().split()))
def solve():
n = int(eval(input()))
ok = False
cnt = 0
for _ in range(n):
a, b = it()
if a == b:
cnt += 1
if cnt == 3:
ok = True
else:
cnt = 0
return 'Yes... | it = lambda: list(map(int, input().strip().split()))
def solve():
n = int(eval(input()))
F = [0] * n
S = [0] * n
for i in range(n):
a, b = it()
F[i] = a
S[i] = b
cnt = 0
for i in range(n):
if F[i] == S[i]:
cnt += 1
if... | 19 | 25 | 381 | 459 | it = lambda: list(map(int, input().strip().split()))
def solve():
n = int(eval(input()))
ok = False
cnt = 0
for _ in range(n):
a, b = it()
if a == b:
cnt += 1
if cnt == 3:
ok = True
else:
cnt = 0
return "Yes" if ok else "N... | it = lambda: list(map(int, input().strip().split()))
def solve():
n = int(eval(input()))
F = [0] * n
S = [0] * n
for i in range(n):
a, b = it()
F[i] = a
S[i] = b
cnt = 0
for i in range(n):
if F[i] == S[i]:
cnt += 1
if cnt == 3:
... | false | 24 | [
"- ok = False",
"+ F = [0] * n",
"+ S = [0] * n",
"+ for i in range(n):",
"+ a, b = it()",
"+ F[i] = a",
"+ S[i] = b",
"- for _ in range(n):",
"- a, b = it()",
"- if a == b:",
"+ for i in range(n):",
"+ if F[i] == S[i]:",
"- ... | false | 0.048824 | 0.045413 | 1.075114 | [
"s883195576",
"s635481518"
] |
u729133443 | p03075 | python | s734370034 | s025626296 | 168 | 17 | 38,560 | 3,060 | Accepted | Accepted | 89.88 | a,*_,e,k=eval('int(input()),'*6);print((':('*(e-a>k)or'Yay!')) | a,*_,e,k=eval('int(input()),'*6);print(('Y:a(y !'[e-a>k::2])) | 1 | 1 | 60 | 59 | a, *_, e, k = eval("int(input())," * 6)
print((":(" * (e - a > k) or "Yay!"))
| a, *_, e, k = eval("int(input())," * 6)
print(("Y:a(y !"[e - a > k :: 2]))
| false | 0 | [
"-print((\":(\" * (e - a > k) or \"Yay!\"))",
"+print((\"Y:a(y !\"[e - a > k :: 2]))"
] | false | 0.07796 | 0.03963 | 1.967183 | [
"s734370034",
"s025626296"
] |
u843175622 | p03291 | python | s825743811 | s366549637 | 416 | 244 | 27,596 | 9,280 | Accepted | Accepted | 41.35 | MOD = pow(10, 9) + 7
s = eval(input())
n = len(s)
dp = [[0 for _ in range(4)] for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
dp[i+1][0] = dp[i][0]
dp[i+1][1] = dp[i][1]
dp[i+1][2] = dp[i][2]
dp[i+1][3] = dp[i][3]
if s[i] == 'A':
dp[i+1][1] += dp[i][0]
elif s[i] == '... | s = input().rstrip()
n = len(s)
mod = 10**9 + 7
dp = [0] * 4
dp[0] = 1
for i in range(n):
next = [0] * 4
if s[i] == 'A':
next[1] += dp[0]
elif s[i] == 'B':
next[2] += dp[1]
elif s[i] == 'C':
next[3] += dp[2]
else:
next[1] += dp[0]
next[2] += d... | 31 | 31 | 763 | 638 | MOD = pow(10, 9) + 7
s = eval(input())
n = len(s)
dp = [[0 for _ in range(4)] for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
dp[i + 1][0] = dp[i][0]
dp[i + 1][1] = dp[i][1]
dp[i + 1][2] = dp[i][2]
dp[i + 1][3] = dp[i][3]
if s[i] == "A":
dp[i + 1][1] += dp[i][0]
elif s[i] == "B":
... | s = input().rstrip()
n = len(s)
mod = 10**9 + 7
dp = [0] * 4
dp[0] = 1
for i in range(n):
next = [0] * 4
if s[i] == "A":
next[1] += dp[0]
elif s[i] == "B":
next[2] += dp[1]
elif s[i] == "C":
next[3] += dp[2]
else:
next[1] += dp[0]
next[2] += dp[1]
next... | false | 0 | [
"-MOD = pow(10, 9) + 7",
"-s = eval(input())",
"+s = input().rstrip()",
"-dp = [[0 for _ in range(4)] for _ in range(n + 1)]",
"-dp[0][0] = 1",
"+mod = 10**9 + 7",
"+dp = [0] * 4",
"+dp[0] = 1",
"- dp[i + 1][0] = dp[i][0]",
"- dp[i + 1][1] = dp[i][1]",
"- dp[i + 1][2] = dp[i][2]",
"- ... | false | 0.073282 | 0.037269 | 1.966302 | [
"s825743811",
"s366549637"
] |
u334712262 | p02669 | python | s426408549 | s465108028 | 941 | 798 | 116,556 | 111,148 | Accepted | Accepted | 15.2 | # -*- coding: utf-8 -*-
from functools import lru_cache
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return... | # -*- coding: utf-8 -*-
from functools import lru_cache
import sys
# sys.setrecursionlimit(10)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return li... | 84 | 91 | 1,602 | 1,767 | # -*- coding: utf-8 -*-
from functools import lru_cache
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, b... | # -*- coding: utf-8 -*-
from functools import lru_cache
import sys
# sys.setrecursionlimit(10)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff... | false | 7.692308 | [
"-# sys.setrecursionlimit(10**6)",
"+# sys.setrecursionlimit(10)",
"+ if n == 1:",
"+ return D",
"+ if n == 0:",
"+ return 0",
"- for i in range(-min(2, n), min(3, n)):",
"- m = n + i",
"- i = abs(i)",
"- if m == 0:",
"-... | false | 0.600875 | 0.259313 | 2.317176 | [
"s426408549",
"s465108028"
] |
u832039789 | p03325 | python | s473899075 | s686498919 | 142 | 83 | 4,148 | 4,152 | Accepted | Accepted | 41.55 | N = int(eval(input()))
a = list(map(int,input().split()))
result = 0
for i in a:
while True:
if i%2!=0:
break
else:
i/=2
result += 1
print(result) | n = int(eval(input()))
a = list(map(int,input().split()))
p = 0
for i in a:
cnt = 0
while i % 2 == 0:
cnt += 1
i //= 2
p += cnt
print(p)
| 11 | 10 | 164 | 168 | N = int(eval(input()))
a = list(map(int, input().split()))
result = 0
for i in a:
while True:
if i % 2 != 0:
break
else:
i /= 2
result += 1
print(result)
| n = int(eval(input()))
a = list(map(int, input().split()))
p = 0
for i in a:
cnt = 0
while i % 2 == 0:
cnt += 1
i //= 2
p += cnt
print(p)
| false | 9.090909 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-result = 0",
"+p = 0",
"- while True:",
"- if i % 2 != 0:",
"- break",
"- else:",
"- i /= 2",
"- result += 1",
"-print(result)",
"+ cnt = 0",
"+ while i % 2 == 0:",
"+ cnt... | false | 0.069624 | 0.038486 | 1.809094 | [
"s473899075",
"s686498919"
] |
u855710796 | p02629 | python | s673218686 | s704794213 | 36 | 29 | 9,216 | 9,220 | Accepted | Accepted | 19.44 | N = int(input())
s = []
a = 26
tmp = 1
for i in range(20):
s.append(tmp)
tmp += a
a *= 26
if tmp > 100000000000000000:
break
for i in range(len(s)):
if N >= s[i]:
continue
else:
size = i
break
b = N - s[size-1]
n2a = lambda c: chr(c+64)
... | N = int(eval(input()))
N -= 1
d = 26
for i in range(1,15):
if N >= d:
N -= d
d *= 26
else:
d //= 26
ans = ""
for j in range(i):
ans += chr(N // d + ord("a"))
N %= d
d //= 26
break
print(ans) | 31 | 18 | 456 | 295 | N = int(input())
s = []
a = 26
tmp = 1
for i in range(20):
s.append(tmp)
tmp += a
a *= 26
if tmp > 100000000000000000:
break
for i in range(len(s)):
if N >= s[i]:
continue
else:
size = i
break
b = N - s[size - 1]
n2a = lambda c: chr(c + 64)
a = 26 ** (size - 1)
an... | N = int(eval(input()))
N -= 1
d = 26
for i in range(1, 15):
if N >= d:
N -= d
d *= 26
else:
d //= 26
ans = ""
for j in range(i):
ans += chr(N // d + ord("a"))
N %= d
d //= 26
break
print(ans)
| false | 41.935484 | [
"-N = int(input())",
"-s = []",
"-a = 26",
"-tmp = 1",
"-for i in range(20):",
"- s.append(tmp)",
"- tmp += a",
"- a *= 26",
"- if tmp > 100000000000000000:",
"+N = int(eval(input()))",
"+N -= 1",
"+d = 26",
"+for i in range(1, 15):",
"+ if N >= d:",
"+ N -= d",
"... | false | 0.036705 | 0.03693 | 0.993902 | [
"s673218686",
"s704794213"
] |
u392319141 | p03018 | python | s249570422 | s924689977 | 103 | 56 | 5,224 | 3,500 | Accepted | Accepted | 45.63 | S = eval(input())
S = S.replace('BC', 'D').replace('B', ' ').replace('C', ' ').split()
ans = 0
for s in S:
leftA = 0
for i, t in enumerate(s[:: -1]):
if t == 'A':
ans += max(0, i - leftA)
leftA += 1
print(ans) | S = eval(input())
S = S.replace('BC', 'D')
cnt = 0
ans = 0
for i, s in enumerate(S):
if s == 'D':
ans += cnt
elif s == 'A':
cnt += 1
else:
cnt = 0
print(ans)
| 12 | 13 | 256 | 201 | S = eval(input())
S = S.replace("BC", "D").replace("B", " ").replace("C", " ").split()
ans = 0
for s in S:
leftA = 0
for i, t in enumerate(s[::-1]):
if t == "A":
ans += max(0, i - leftA)
leftA += 1
print(ans)
| S = eval(input())
S = S.replace("BC", "D")
cnt = 0
ans = 0
for i, s in enumerate(S):
if s == "D":
ans += cnt
elif s == "A":
cnt += 1
else:
cnt = 0
print(ans)
| false | 7.692308 | [
"-S = S.replace(\"BC\", \"D\").replace(\"B\", \" \").replace(\"C\", \" \").split()",
"+S = S.replace(\"BC\", \"D\")",
"+cnt = 0",
"-for s in S:",
"- leftA = 0",
"- for i, t in enumerate(s[::-1]):",
"- if t == \"A\":",
"- ans += max(0, i - leftA)",
"- leftA += 1",
... | false | 0.046113 | 0.037747 | 1.221628 | [
"s249570422",
"s924689977"
] |
u982594421 | p02780 | python | s816440206 | s719592638 | 542 | 205 | 73,992 | 25,060 | Accepted | Accepted | 62.18 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
ans = 0
e = [sum(range(1, pi + 1)) / pi for pi in p]
tmp = 0
for i in range(n):
tmp += e[i]
if i >= k:
tmp -= e[i - k]
ans = max(ans, tmp)
print(ans) | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
ans = 0
e = [(pi + 1) / 2 for pi in p]
tmp = 0
for i in range(n):
tmp += e[i]
if i >= k:
tmp -= e[i - k]
ans = max(ans, tmp)
print(ans) | 13 | 13 | 252 | 238 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
ans = 0
e = [sum(range(1, pi + 1)) / pi for pi in p]
tmp = 0
for i in range(n):
tmp += e[i]
if i >= k:
tmp -= e[i - k]
ans = max(ans, tmp)
print(ans)
| n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
ans = 0
e = [(pi + 1) / 2 for pi in p]
tmp = 0
for i in range(n):
tmp += e[i]
if i >= k:
tmp -= e[i - k]
ans = max(ans, tmp)
print(ans)
| false | 0 | [
"-e = [sum(range(1, pi + 1)) / pi for pi in p]",
"+e = [(pi + 1) / 2 for pi in p]"
] | false | 0.036611 | 0.036592 | 1.000519 | [
"s816440206",
"s719592638"
] |
u281610856 | p03244 | python | s377489657 | s306482695 | 93 | 86 | 21,952 | 20,572 | Accepted | Accepted | 7.53 | import collections
n = int(eval(input())) # even
v = list(map(int, input().split()))
e = v[0::2]
o = v[1::2]
e_cnt = collections.Counter(e)
o_cnt = collections.Counter(o)
e_most = e_cnt.most_common() + ([(0, 0)])
e_most1 = e_most[0][1]
e_most2 = e_most[1][1]
o_most = o_cnt.most_common() + ([(0, 0)])
o_mos... | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
odd_cnt = Counter(v[0::2]).most_common() + ([(0, 0)])
even_cnt = Counter(v[1::2]).most_common() + ([(0, 0)])
if odd_cnt[0][0] != even_cnt[0][0]:
ans = n - odd_cnt[0][1] - even_cnt[0][1]
else:
ans = min(n - odd... | 18 | 12 | 492 | 391 | import collections
n = int(eval(input())) # even
v = list(map(int, input().split()))
e = v[0::2]
o = v[1::2]
e_cnt = collections.Counter(e)
o_cnt = collections.Counter(o)
e_most = e_cnt.most_common() + ([(0, 0)])
e_most1 = e_most[0][1]
e_most2 = e_most[1][1]
o_most = o_cnt.most_common() + ([(0, 0)])
o_most1 = o_most[... | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
odd_cnt = Counter(v[0::2]).most_common() + ([(0, 0)])
even_cnt = Counter(v[1::2]).most_common() + ([(0, 0)])
if odd_cnt[0][0] != even_cnt[0][0]:
ans = n - odd_cnt[0][1] - even_cnt[0][1]
else:
ans = min(n - odd_cnt[1][1] ... | false | 33.333333 | [
"-import collections",
"+from collections import Counter",
"-n = int(eval(input())) # even",
"+n = int(eval(input()))",
"-e = v[0::2]",
"-o = v[1::2]",
"-e_cnt = collections.Counter(e)",
"-o_cnt = collections.Counter(o)",
"-e_most = e_cnt.most_common() + ([(0, 0)])",
"-e_most1 = e_most[0][1]",
... | false | 0.070691 | 0.070991 | 0.995771 | [
"s377489657",
"s306482695"
] |
u729133443 | p04035 | python | s079744716 | s162109713 | 270 | 84 | 71,228 | 19,864 | Accepted | Accepted | 68.89 | n,l,*a=list(map(int,open(0).read().split()))
i=m=0
for j,(x,y)in enumerate(zip(a,a[1:]),1):
if x+y>m:
m=x+y
i=j
if m<l:
print('Impossible')
else:
print('Possible')
print((*list(range(1,i))))
print((*list(range(n-1,i,-1))))
print(i) | n,l,*a=map(int,open(i:=0).read().split())
for a,b in zip(a,a[1:]):i+=1;a+b>=l>exit(print('Possible',*range(1,i),*range(n-1,i-1,-1)))
print('Impossible')
| 13 | 3 | 241 | 154 | n, l, *a = list(map(int, open(0).read().split()))
i = m = 0
for j, (x, y) in enumerate(zip(a, a[1:]), 1):
if x + y > m:
m = x + y
i = j
if m < l:
print("Impossible")
else:
print("Possible")
print((*list(range(1, i))))
print((*list(range(n - 1, i, -1))))
print(i)
| n, l, *a = map(int, open(i := 0).read().split())
for a, b in zip(a, a[1:]):
i += 1
a + b >= l > exit(print("Possible", *range(1, i), *range(n - 1, i - 1, -1)))
print("Impossible")
| false | 76.923077 | [
"-n, l, *a = list(map(int, open(0).read().split()))",
"-i = m = 0",
"-for j, (x, y) in enumerate(zip(a, a[1:]), 1):",
"- if x + y > m:",
"- m = x + y",
"- i = j",
"-if m < l:",
"- print(\"Impossible\")",
"-else:",
"- print(\"Possible\")",
"- print((*list(range(1, i))))"... | false | 0.042992 | 0.03489 | 1.232231 | [
"s079744716",
"s162109713"
] |
u863442865 | p03487 | python | s456054288 | s650349880 | 115 | 77 | 21,228 | 18,676 | Accepted | Accepted | 33.04 | from collections import Counter
from collections import deque
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
c = c.most_common()
ans = 0
for num, cnt in c:
if cnt>=num:
ans += cnt - num
else:
ans += cnt
print(ans) | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
for num, cnt in list(c.items()):
if cnt>=num:
ans += cnt - num
else:
ans += cnt
print(ans)
| 14 | 11 | 272 | 227 | from collections import Counter
from collections import deque
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
c = c.most_common()
ans = 0
for num, cnt in c:
if cnt >= num:
ans += cnt - num
else:
ans += cnt
print(ans)
| from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
for num, cnt in list(c.items()):
if cnt >= num:
ans += cnt - num
else:
ans += cnt
print(ans)
| false | 21.428571 | [
"-from collections import deque",
"-c = c.most_common()",
"-for num, cnt in c:",
"+for num, cnt in list(c.items()):"
] | false | 0.046788 | 0.04443 | 1.053083 | [
"s456054288",
"s650349880"
] |
u687041133 | p02837 | python | s220192907 | s046920555 | 1,295 | 110 | 8,820 | 8,820 | Accepted | Accepted | 91.51 | import itertools
N = int(eval(input()))
all_list = list(itertools.product([0,1], repeat=N))
xy_list =[]
for i in range(N):
for j in range(int(eval(input()))):
x, y = list(map(int, input().split()))
xy_list.append((i+1,x,y))
#print(xy_list)
num_ok = 0
for i in all_list:
#どの... |
import itertools
N = int(eval(input()))
all_list = list(itertools.product([0,1], repeat=N))
xy_list =[]
for i in range(N):
for j in range(int(eval(input()))):
x, y = list(map(int, input().split()))
xy_list.append((i+1,x,y))
#print(xy_list)
num_ok = 0
for i in all_list:
#... | 30 | 36 | 560 | 605 | import itertools
N = int(eval(input()))
all_list = list(itertools.product([0, 1], repeat=N))
xy_list = []
for i in range(N):
for j in range(int(eval(input()))):
x, y = list(map(int, input().split()))
xy_list.append((i + 1, x, y))
# print(xy_list)
num_ok = 0
for i in all_list:
# どの人の証言なのか
fl... | import itertools
N = int(eval(input()))
all_list = list(itertools.product([0, 1], repeat=N))
xy_list = []
for i in range(N):
for j in range(int(eval(input()))):
x, y = list(map(int, input().split()))
xy_list.append((i + 1, x, y))
# print(xy_list)
num_ok = 0
for i in all_list:
# どの人の証言なのか
fl... | false | 16.666667 | [
"+ break"
] | false | 0.111464 | 0.032459 | 3.43398 | [
"s220192907",
"s046920555"
] |
u463655976 | p03061 | python | s996891262 | s014625315 | 428 | 271 | 20,840 | 14,076 | Accepted | Accepted | 36.68 | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(x, y):
if x == 0 or y == 0:
return max(x, y)
if y == 0:
return x
return gcd(y, x % y)
param = [[0, 0, 0]]
addr = 0
while True:
if len(param) <= 0:
break
addr, Li, Lv = param.pop()
if addr... | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(x, y):
if x == 0 or y == 0:
return max(x, y)
return gcd(y, x % y) if y!=0 else x
def F(init, add):
w = [0]
for i in range(init, init + add * N, add):
w += [gcd(w[-1], A[i])]
return w[:-1]
print((max(l... | 30 | 15 | 664 | 366 | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(x, y):
if x == 0 or y == 0:
return max(x, y)
if y == 0:
return x
return gcd(y, x % y)
param = [[0, 0, 0]]
addr = 0
while True:
if len(param) <= 0:
break
addr, Li, Lv = param.pop()
if addr == 0:
... | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(x, y):
if x == 0 or y == 0:
return max(x, y)
return gcd(y, x % y) if y != 0 else x
def F(init, add):
w = [0]
for i in range(init, init + add * N, add):
w += [gcd(w[-1], A[i])]
return w[:-1]
print((max(list(map(l... | false | 50 | [
"- if y == 0:",
"- return x",
"- return gcd(y, x % y)",
"+ return gcd(y, x % y) if y != 0 else x",
"-param = [[0, 0, 0]]",
"-addr = 0",
"-while True:",
"- if len(param) <= 0:",
"- break",
"- addr, Li, Lv = param.pop()",
"- if addr == 0:",
"- if Li == N - ... | false | 0.037148 | 0.046792 | 0.7939 | [
"s996891262",
"s014625315"
] |
u729133443 | p03060 | python | s075147711 | s695097572 | 172 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.12 | n,*t=list(map(int,open(0).read().split()));print((sum((x-y)*(x>y)for x,y in zip(t[:n],t[n:])))) | _,v,c=[list(map(int,t.split()))for t in open(0)];print((sum((x-y)*(x>y)for x,y in zip(v,c)))) | 1 | 1 | 87 | 85 | n, *t = list(map(int, open(0).read().split()))
print((sum((x - y) * (x > y) for x, y in zip(t[:n], t[n:]))))
| _, v, c = [list(map(int, t.split())) for t in open(0)]
print((sum((x - y) * (x > y) for x, y in zip(v, c))))
| false | 0 | [
"-n, *t = list(map(int, open(0).read().split()))",
"-print((sum((x - y) * (x > y) for x, y in zip(t[:n], t[n:]))))",
"+_, v, c = [list(map(int, t.split())) for t in open(0)]",
"+print((sum((x - y) * (x > y) for x, y in zip(v, c))))"
] | false | 0.047375 | 0.040469 | 1.170653 | [
"s075147711",
"s695097572"
] |
u119655368 | p03805 | python | s491740038 | s609909644 | 132 | 46 | 8,052 | 3,572 | Accepted | Accepted | 65.15 | import itertools
n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
r = [[] for i in range(n + 1)]
ans = 0
for i in range(m):
r[l[i][0]].append(l[i][1])
r[l[i][1]].append(l[i][0])
p = []
for i in range(n):
p.append(i + 1)
p = list(itertools.permutations... | import itertools
n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
r = [[] for i in range(n + 1)]
ans = 0
for i in range(m):
r[l[i][0]].append(l[i][1])
r[l[i][1]].append(l[i][0])
p = "2345678"[:n-1]
p = list(itertools.permutations(p))
for i in range(len(p... | 23 | 20 | 563 | 514 | import itertools
n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
r = [[] for i in range(n + 1)]
ans = 0
for i in range(m):
r[l[i][0]].append(l[i][1])
r[l[i][1]].append(l[i][0])
p = []
for i in range(n):
p.append(i + 1)
p = list(itertools.permutations(p))
for i... | import itertools
n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
r = [[] for i in range(n + 1)]
ans = 0
for i in range(m):
r[l[i][0]].append(l[i][1])
r[l[i][1]].append(l[i][0])
p = "2345678"[: n - 1]
p = list(itertools.permutations(p))
for i in range(len(p)):
... | false | 13.043478 | [
"-p = []",
"-for i in range(n):",
"- p.append(i + 1)",
"+p = \"2345678\"[: n - 1]",
"- t = list(p[i])",
"- if t[0] != 1:",
"- check = False",
"+ t = \"1\" + \"\".join(p[i])",
"- if not t[j + 1] in r[t[j]]:",
"+ if not int(t[j + 1]) in r[int(t[j])]:"
] | false | 0.180909 | 0.07228 | 2.502892 | [
"s491740038",
"s609909644"
] |
u086566114 | p02411 | python | s607256576 | s192836039 | 20 | 10 | 6,332 | 6,364 | Accepted | Accepted | 50 | def get_score(medium, final, retry):
medium_final = medium + final
if medium == -1 or final == -1:
return 'F'
elif 80 <= medium_final:
return 'A'
elif 65 <= medium_final:
return 'B'
elif 50 <= medium_final:
return 'C'
elif 30 <= medium_final:
if... | def get_score(medium, final, retry):
medium_final = medium + final
if medium == -1 or final == -1:
return 'F'
elif 80 <= medium_final:
return 'A'
elif 65 <= medium_final:
return 'B'
elif 50 <= medium_final:
return 'C'
elif 30 <= medium_final:
if... | 25 | 28 | 621 | 668 | def get_score(medium, final, retry):
medium_final = medium + final
if medium == -1 or final == -1:
return "F"
elif 80 <= medium_final:
return "A"
elif 65 <= medium_final:
return "B"
elif 50 <= medium_final:
return "C"
elif 30 <= medium_final:
if 50 <= retr... | def get_score(medium, final, retry):
medium_final = medium + final
if medium == -1 or final == -1:
return "F"
elif 80 <= medium_final:
return "A"
elif 65 <= medium_final:
return "B"
elif 50 <= medium_final:
return "C"
elif 30 <= medium_final:
if 50 <= retr... | false | 10.714286 | [
"+data = []",
"- print((get_score(medium, final, retry)))",
"+ data.append(get_score(medium, final, retry))",
"+for n in data:",
"+ print(n)"
] | false | 0.048855 | 0.192903 | 0.25326 | [
"s607256576",
"s192836039"
] |
u326609687 | p02551 | python | s655802641 | s045276700 | 534 | 399 | 114,096 | 33,432 | Accepted | Accepted | 25.28 | import numpy as np
from numba import njit
from numba.types import int64
i8 = np.int64
@njit((int64, int64[:,::-1]), cache=True)
def solve(n, qr):
col = np.zeros(n - 1, i8)
col[0] = 0
col_min = n - 1
row = np.zeros(n - 1, i8)
row[0] = 0
row_min = n - 1
white = 0
for i in ... | import numpy as np
# from numba import njit
# from numba.types import int64
i8 = np.int64
# @njit((int64, int64[:,::-1]), cache=True)
def solve(n, qr):
col = np.zeros(n - 1, i8)
col[0] = 0
col_min = n - 1
row = np.zeros(n - 1, i8)
row[0] = 0
row_min = n - 1
white = 0
for... | 44 | 44 | 1,121 | 1,127 | import numpy as np
from numba import njit
from numba.types import int64
i8 = np.int64
@njit((int64, int64[:, ::-1]), cache=True)
def solve(n, qr):
col = np.zeros(n - 1, i8)
col[0] = 0
col_min = n - 1
row = np.zeros(n - 1, i8)
row[0] = 0
row_min = n - 1
white = 0
for i in range(qr.shap... | import numpy as np
# from numba import njit
# from numba.types import int64
i8 = np.int64
# @njit((int64, int64[:,::-1]), cache=True)
def solve(n, qr):
col = np.zeros(n - 1, i8)
col[0] = 0
col_min = n - 1
row = np.zeros(n - 1, i8)
row[0] = 0
row_min = n - 1
white = 0
for i in range(qr.s... | false | 0 | [
"-from numba import njit",
"-from numba.types import int64",
"+# from numba import njit",
"+# from numba.types import int64",
"-",
"-",
"-@njit((int64, int64[:, ::-1]), cache=True)",
"+# @njit((int64, int64[:,::-1]), cache=True)"
] | false | 0.264269 | 0.312647 | 0.845264 | [
"s655802641",
"s045276700"
] |
u562935282 | p02983 | python | s515537840 | s704207658 | 173 | 64 | 39,024 | 3,316 | Accepted | Accepted | 63.01 | inf = float('inf')
L, R = list(map(int, input().split()))
if R > L + 3000:
R = L + 3000
t = [i % 2019 for i in range(L, R + 1)]
t.sort()
if (3 in t and 673 in t) or (0 in t):
print((0))
else:
n = len(t)
ans = inf
for i in range(n - 1):
for j in range(i + 1, n):
a... | mod = 2019
l, r = list(map(int, input().split()))
e = []
for i in range(l, min(r, l + mod * 2) + 1):
e.append(i % mod)
e.sort()
ans = mod
for i in range(len(e)):
for j in range(i + 1, len(e)):
ans = min(ans, e[i] * e[j] % mod)
if ans == 0:
break
else:
conti... | 18 | 17 | 378 | 341 | inf = float("inf")
L, R = list(map(int, input().split()))
if R > L + 3000:
R = L + 3000
t = [i % 2019 for i in range(L, R + 1)]
t.sort()
if (3 in t and 673 in t) or (0 in t):
print((0))
else:
n = len(t)
ans = inf
for i in range(n - 1):
for j in range(i + 1, n):
ans = min(ans, t[i... | mod = 2019
l, r = list(map(int, input().split()))
e = []
for i in range(l, min(r, l + mod * 2) + 1):
e.append(i % mod)
e.sort()
ans = mod
for i in range(len(e)):
for j in range(i + 1, len(e)):
ans = min(ans, e[i] * e[j] % mod)
if ans == 0:
break
else:
continue
break
p... | false | 5.555556 | [
"-inf = float(\"inf\")",
"-L, R = list(map(int, input().split()))",
"-if R > L + 3000:",
"- R = L + 3000",
"-t = [i % 2019 for i in range(L, R + 1)]",
"-t.sort()",
"-if (3 in t and 673 in t) or (0 in t):",
"- print((0))",
"-else:",
"- n = len(t)",
"- ans = inf",
"- for i in rang... | false | 0.043716 | 0.044301 | 0.98679 | [
"s515537840",
"s704207658"
] |
u963468276 | p03834 | python | s681331791 | s575489856 | 180 | 164 | 38,256 | 38,256 | Accepted | Accepted | 8.89 | s1, s2, s3 = input().split(',')
print((s1 + ' ' + s2 + ' ' + s3)) | s = list(input().split(','))
print((' '.join(s))) | 2 | 2 | 64 | 48 | s1, s2, s3 = input().split(",")
print((s1 + " " + s2 + " " + s3))
| s = list(input().split(","))
print((" ".join(s)))
| false | 0 | [
"-s1, s2, s3 = input().split(\",\")",
"-print((s1 + \" \" + s2 + \" \" + s3))",
"+s = list(input().split(\",\"))",
"+print((\" \".join(s)))"
] | false | 0.044259 | 0.04504 | 0.982663 | [
"s681331791",
"s575489856"
] |
u678167152 | p02586 | python | s441806634 | s414768523 | 1,970 | 1,222 | 215,568 | 207,492 | Accepted | Accepted | 37.97 | def solve():
R, C, K = list(map(int, input().split()))
item = [[0]*C for _ in range(R)]
for i in range(K):
r,c,v = list(map(int, input().split()))
item[r-1][c-1] = v
last_dp = [[0]*5 for _ in range(C+1)]
for i in range(1,R+1):
dp = [[0]*5 for _ in range(C+1)]
for j in range(1,C+1):
... | def solve():
R, C, K = list(map(int, input().split()))
item = [[0]*C for _ in range(R)]
for i in range(K):
r,c,v = list(map(int, input().split()))
item[r-1][c-1] = v
last_dp = [[0]*(C+1) for _ in range(5)]
for i in range(1,R+1):
dp = [[0]*(C+1) for _ in range(5)]
for j in range(1,C+1)... | 24 | 25 | 750 | 791 | def solve():
R, C, K = list(map(int, input().split()))
item = [[0] * C for _ in range(R)]
for i in range(K):
r, c, v = list(map(int, input().split()))
item[r - 1][c - 1] = v
last_dp = [[0] * 5 for _ in range(C + 1)]
for i in range(1, R + 1):
dp = [[0] * 5 for _ in range(C + 1... | def solve():
R, C, K = list(map(int, input().split()))
item = [[0] * C for _ in range(R)]
for i in range(K):
r, c, v = list(map(int, input().split()))
item[r - 1][c - 1] = v
last_dp = [[0] * (C + 1) for _ in range(5)]
for i in range(1, R + 1):
dp = [[0] * (C + 1) for _ in ran... | false | 4 | [
"- last_dp = [[0] * 5 for _ in range(C + 1)]",
"+ last_dp = [[0] * (C + 1) for _ in range(5)]",
"- dp = [[0] * 5 for _ in range(C + 1)]",
"+ dp = [[0] * (C + 1) for _ in range(5)]",
"- dp[j][k] = dp[j - 1][k]",
"+ dp[k][j] = dp[k][j - 1]",
"- ... | false | 0.044577 | 0.042345 | 1.052725 | [
"s441806634",
"s414768523"
] |
u252828980 | p03617 | python | s805224668 | s945804193 | 20 | 17 | 3,064 | 3,064 | Accepted | Accepted | 15 | q,h,s,d = list(map(int,input().split()))
n = int(eval(input()))
L2 = [8*q,4*h,2*s,d]
L2.sort()
L1 = [4*q,2*h,s]
L1.sort()
L5 = [2*q,h]
L5.sort()
L25 = [q]
ans = 0
if n >= 2:
ans += n//2*L2[0]
n = n%2
if n == 1:
ans += L1[0]
elif n == 1:
ans = L1[0]
elif n == 0:
ans = 0
... | q,h,s,d = list(map(int,input().split()))
n = int(eval(input()))
d1 = min([8*q,4*h,2*s,d])
s1 = min([4*q,2*h,s])
ans = 0
if n >= 2:
ans += n//2*d1
n = n%2
if n == 1:
ans += s1
elif n == 1:
ans = s1
print(ans) | 23 | 16 | 325 | 241 | q, h, s, d = list(map(int, input().split()))
n = int(eval(input()))
L2 = [8 * q, 4 * h, 2 * s, d]
L2.sort()
L1 = [4 * q, 2 * h, s]
L1.sort()
L5 = [2 * q, h]
L5.sort()
L25 = [q]
ans = 0
if n >= 2:
ans += n // 2 * L2[0]
n = n % 2
if n == 1:
ans += L1[0]
elif n == 1:
ans = L1[0]
elif n == 0:
an... | q, h, s, d = list(map(int, input().split()))
n = int(eval(input()))
d1 = min([8 * q, 4 * h, 2 * s, d])
s1 = min([4 * q, 2 * h, s])
ans = 0
if n >= 2:
ans += n // 2 * d1
n = n % 2
if n == 1:
ans += s1
elif n == 1:
ans = s1
print(ans)
| false | 30.434783 | [
"-L2 = [8 * q, 4 * h, 2 * s, d]",
"-L2.sort()",
"-L1 = [4 * q, 2 * h, s]",
"-L1.sort()",
"-L5 = [2 * q, h]",
"-L5.sort()",
"-L25 = [q]",
"+d1 = min([8 * q, 4 * h, 2 * s, d])",
"+s1 = min([4 * q, 2 * h, s])",
"- ans += n // 2 * L2[0]",
"+ ans += n // 2 * d1",
"- ans += L1[0]",
"+... | false | 0.051085 | 0.050701 | 1.007585 | [
"s805224668",
"s945804193"
] |
u843175622 | p03032 | python | s304874632 | s856343863 | 53 | 34 | 9,212 | 9,220 | Accepted | Accepted | 35.85 | n, k = list(map(int, input().split()))
v = list(map(int, input().split()))
# 左から何個、右から何個を全探索
ans = 0
for l in range(0, k + 1):
for r in range(0, k + 1 - l):
if l + r > n:
continue
suteru = k - l - r
get = []
for i in range(l):
get.append(v[i])
... | n, k = list(map(int, input().split()))
v = list(map(int, input().split()))
ans = 0
for l in range(0, k + 1):
for r in range(0, k + 1 - l):
if l == r == 0 or l + r > n:
continue
a = sorted(v[:l] + v[n - r:])
m = min(k - l - r, len(a) - 1)
ans = max(ans, sum(a[m:... | 21 | 13 | 570 | 401 | n, k = list(map(int, input().split()))
v = list(map(int, input().split()))
# 左から何個、右から何個を全探索
ans = 0
for l in range(0, k + 1):
for r in range(0, k + 1 - l):
if l + r > n:
continue
suteru = k - l - r
get = []
for i in range(l):
get.append(v[i])
for i in... | n, k = list(map(int, input().split()))
v = list(map(int, input().split()))
ans = 0
for l in range(0, k + 1):
for r in range(0, k + 1 - l):
if l == r == 0 or l + r > n:
continue
a = sorted(v[:l] + v[n - r :])
m = min(k - l - r, len(a) - 1)
ans = max(ans, sum(a[m:] if a[m] ... | false | 38.095238 | [
"-# 左から何個、右から何個を全探索",
"- if l + r > n:",
"+ if l == r == 0 or l + r > n:",
"- suteru = k - l - r",
"- get = []",
"- for i in range(l):",
"- get.append(v[i])",
"- for i in range(n - 1, n - 1 - r, -1):",
"- get.append(v[i])",
"- ... | false | 0.037313 | 0.074004 | 0.504196 | [
"s304874632",
"s856343863"
] |
u161712560 | p02720 | python | s364294593 | s302309862 | 297 | 125 | 3,064 | 8,568 | Accepted | Accepted | 57.91 | def dfs(inParam, digits, lunlunCount, lunlun):
if len(inParam) != digits:
if int(inParam[len(inParam)-1]) == 0:
nextNumList = [0, 1]
elif int(inParam[len(inParam)-1]) == 9:
nextNumList = [8, 9]
else:
nextNum = int(inParam[len(inParam)-1])
... | K = int(eval(input()))
if K <= 9:
print(K)
else:
mylun = 9
lunList = []
for indx in range(1, 10):
lunList.append(str(indx))
while mylun < K:
newLunList = []
for lunItem in lunList:
if lunItem[len(lunItem)-1] != "0":
mylun += 1
... | 42 | 35 | 1,117 | 1,104 | def dfs(inParam, digits, lunlunCount, lunlun):
if len(inParam) != digits:
if int(inParam[len(inParam) - 1]) == 0:
nextNumList = [0, 1]
elif int(inParam[len(inParam) - 1]) == 9:
nextNumList = [8, 9]
else:
nextNum = int(inParam[len(inParam) - 1])
... | K = int(eval(input()))
if K <= 9:
print(K)
else:
mylun = 9
lunList = []
for indx in range(1, 10):
lunList.append(str(indx))
while mylun < K:
newLunList = []
for lunItem in lunList:
if lunItem[len(lunItem) - 1] != "0":
mylun += 1
new... | false | 16.666667 | [
"-def dfs(inParam, digits, lunlunCount, lunlun):",
"- if len(inParam) != digits:",
"- if int(inParam[len(inParam) - 1]) == 0:",
"- nextNumList = [0, 1]",
"- elif int(inParam[len(inParam) - 1]) == 9:",
"- nextNumList = [8, 9]",
"- else:",
"- next... | false | 0.092524 | 0.065846 | 1.405156 | [
"s364294593",
"s302309862"
] |
u588341295 | p03634 | python | s271088916 | s118623871 | 692 | 623 | 53,700 | 80,084 | Accepted | Accepted | 9.97 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 50 | 49 | 1,342 | 1,314 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 2 | [
"-ans = []",
"- ans.append(str(res[x] + res[y]))",
"-print((\"\\n\".join(ans)))",
"+ ans = res[x] + res[y]",
"+ print(ans)"
] | false | 0.049605 | 0.047775 | 1.0383 | [
"s271088916",
"s118623871"
] |
u083960235 | p03062 | python | s149076554 | s730330280 | 111 | 92 | 14,224 | 15,092 | Accepted | Accepted | 17.12 | N=int(eval(input()))
A=list(map(int,input().split()))
l=[]
cnt=0
for i in range(N):
if A[i]<0:
cnt+=1
l.append(A[i])
wa=0
l_ab=[]
for i in range(N):
wa+=abs(A[i])
l_ab.append(abs(A[i]))
if cnt%2!=0:
wa-=2*min(l_ab)
print(wa)
| import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 20 | 48 | 286 | 1,147 | N = int(eval(input()))
A = list(map(int, input().split()))
l = []
cnt = 0
for i in range(N):
if A[i] < 0:
cnt += 1
l.append(A[i])
wa = 0
l_ab = []
for i in range(N):
wa += abs(A[i])
l_ab.append(abs(A[i]))
if cnt % 2 != 0:
wa -= 2 * min(l_ab)
print(wa)
| import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 58.333333 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-l = []",
"-cnt = 0",
"-for i in range(N):",
"- if A[i] < 0:",
"- cnt += 1",
"- l.append(A[i])",
"-wa = 0",
"-l_ab = []",
"-for i in range(N):",
"- wa += abs(A[i])",
"- l_ab.append(abs(A[i]))",
"-if ... | false | 0.082708 | 0.041134 | 2.01067 | [
"s149076554",
"s730330280"
] |
u631277801 | p03295 | python | s282664712 | s183060474 | 451 | 311 | 29,076 | 18,200 | Accepted | Accepted | 31.04 | N,M = list(map(int, input().split()))
AB = []
for _ in range(M):
AB.append(list(map(int,input().split())))
AB.sort(key=lambda x:x[1])
cur = 0
ans = 0
for a,b in AB:
if cur > a:
continue
ans += 1
cur = b
print(ans) | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readl... | 17 | 30 | 255 | 673 | N, M = list(map(int, input().split()))
AB = []
for _ in range(M):
AB.append(list(map(int, input().split())))
AB.sort(key=lambda x: x[1])
cur = 0
ans = 0
for a, b in AB:
if cur > a:
continue
ans += 1
cur = b
print(ans)
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 43.333333 | [
"-N, M = list(map(int, input().split()))",
"-AB = []",
"-for _ in range(M):",
"- AB.append(list(map(int, input().split())))",
"-AB.sort(key=lambda x: x[1])",
"-cur = 0",
"+import sys",
"+",
"+stdin = sys.stdin",
"+sys.setrecursionlimit(10**5)",
"+",
"+",
"+def li():",
"+ return list(... | false | 0.037818 | 0.038277 | 0.988014 | [
"s282664712",
"s183060474"
] |
u193264896 | p03014 | python | s040066609 | s762716011 | 1,777 | 1,588 | 309,888 | 310,664 | Accepted | Accepted | 10.64 | def main():
H, W = list(map(int, input().split()))
S = []
for _ in range(H):
s = list(eval(input()))
S.append(s)
R = [[0]*W for _ in range(H)]
L = [[0]*W for _ in range(H)]
U = [[0]*W for _ in range(H)]
D = [[0]*W for _ in range(H)]
for i in range(H):
c... | def main():
H, W = list(map(int, input().split()))
S = []
for _ in range(H):
s = list(eval(input()))
S.append(s)
R = [[0]*W for _ in range(H)]
L = [[0]*W for _ in range(H)]
U = [[0]*W for _ in range(H)]
D = [[0]*W for _ in range(H)]
for i in range(H):
c... | 51 | 51 | 1,279 | 1,251 | def main():
H, W = list(map(int, input().split()))
S = []
for _ in range(H):
s = list(eval(input()))
S.append(s)
R = [[0] * W for _ in range(H)]
L = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]
for i in range(H):
cnt ... | def main():
H, W = list(map(int, input().split()))
S = []
for _ in range(H):
s = list(eval(input()))
S.append(s)
R = [[0] * W for _ in range(H)]
L = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]
for i in range(H):
cnt1... | false | 0 | [
"- cnt = 0",
"+ cnt1 = 0",
"+ cnt2 = 0",
"- cnt = 0",
"+ cnt1 = 0",
"- cnt += 1",
"- L[i][j] = cnt",
"- for i in range(H):",
"- cnt = 0",
"+ cnt1 += 1",
"+ L[i][j] = cnt1",
... | false | 0.046802 | 0.041687 | 1.122698 | [
"s040066609",
"s762716011"
] |
u564589929 | p02819 | python | s561779235 | s825798556 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): re... | # import sys
# sys.setrecursionlimit(10 ** 6)
# # input = sys.stdin.readline ####
# def int1(x): return int(x) - 1
def II(): return int(eval(input()))
# def MI(): return map(int, input().split())
# def MI1(): return map(int1, input().split())
#
# def LI(): return list(map(int, input().split()))
# def LI1(... | 45 | 45 | 1,063 | 1,103 | import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline ####
def int1(x):
return int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split())... | # import sys
# sys.setrecursionlimit(10 ** 6)
# # input = sys.stdin.readline ####
# def int1(x): return int(x) - 1
def II():
return int(eval(input()))
# def MI(): return map(int, input().split())
# def MI1(): return map(int1, input().split())
#
# def LI(): return list(map(int, input().split()))
# def LI1(): re... | false | 0 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"-# input = sys.stdin.readline ####",
"-def int1(x):",
"- return int(x) - 1",
"-",
"-",
"+# import sys",
"+# sys.setrecursionlimit(10 ** 6)",
"+# # input = sys.stdin.readline ####",
"+# def int1(x): return int(x) - 1",
"-def MI():... | false | 0.038698 | 0.044294 | 0.873659 | [
"s561779235",
"s825798556"
] |
u849029577 | p02844 | python | s680167537 | s823683816 | 876 | 513 | 43,100 | 40,940 | Accepted | Accepted | 41.44 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
count = 0
index = 0
i = str(i)
if len(i) < 2:
i = "00"+i
elif len(i) < 3:
i = "0"+i
for j in i:
for k in range(index, n):
if j == s[k]:
index = k+1
... | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
index = 0
i = str(i)
if len(i) < 2:
i = "00"+i
elif len(i) < 3:
i = "0"+i
for j in s:
if i[index] == j:
index += 1
if index == 3:
ans += 1
break
... | 20 | 17 | 397 | 318 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
count = 0
index = 0
i = str(i)
if len(i) < 2:
i = "00" + i
elif len(i) < 3:
i = "0" + i
for j in i:
for k in range(index, n):
if j == s[k]:
index = k + 1
cou... | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
index = 0
i = str(i)
if len(i) < 2:
i = "00" + i
elif len(i) < 3:
i = "0" + i
for j in s:
if i[index] == j:
index += 1
if index == 3:
ans += 1
break
print(ans)
| false | 15 | [
"- count = 0",
"- for j in i:",
"- for k in range(index, n):",
"- if j == s[k]:",
"- index = k + 1",
"- count += 1",
"- break",
"- if count == 3:",
"- ans += 1",
"+ for j in s:",
"+ if i[index] == j:",
"+ ... | false | 0.053481 | 0.0795 | 0.672714 | [
"s680167537",
"s823683816"
] |
u600402037 | p03644 | python | s163401738 | s713246924 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | print((2**(len(bin(int(eval(input()))))-3)))
| N = int(eval(input()))
print((2 ** (len(bin(N)[2:]) - 1))) | 1 | 2 | 37 | 51 | print((2 ** (len(bin(int(eval(input())))) - 3)))
| N = int(eval(input()))
print((2 ** (len(bin(N)[2:]) - 1)))
| false | 50 | [
"-print((2 ** (len(bin(int(eval(input())))) - 3)))",
"+N = int(eval(input()))",
"+print((2 ** (len(bin(N)[2:]) - 1)))"
] | false | 0.044523 | 0.146114 | 0.304715 | [
"s163401738",
"s713246924"
] |
u163320134 | p02679 | python | s397598484 | s084966338 | 841 | 759 | 150,788 | 141,724 | Accepted | Accepted | 9.75 | def gcd(a,b):
if b==0:
return a
else:
return gcd(b,a%b)
mod=10**9+7
n=int(eval(input()))
dic={}
cnt=0
for _ in range(n):
a,b=list(map(int,input().split()))
if a!=0 and b!=0:
g=gcd(abs(a),abs(b))
if (a>0 and b>0) or (a<0 and b<0):
if (abs(a)//g,abs(b)//g) not in dic:
... | def gcd(a,b):
if b==0:
return a
else:
return gcd(b,a%b)
mod=10**9+7
n=int(eval(input()))
dic={}
cnt=0
for _ in range(n):
a,b=list(map(int,input().split()))
if a!=0 and b!=0:
g=gcd(abs(a),abs(b))
if a*b>0:
if (abs(a)//g,abs(b)//g) not in dic:
dic[(abs(a)//g,abs(b)//... | 75 | 75 | 1,678 | 1,607 | def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
mod = 10**9 + 7
n = int(eval(input()))
dic = {}
cnt = 0
for _ in range(n):
a, b = list(map(int, input().split()))
if a != 0 and b != 0:
g = gcd(abs(a), abs(b))
if (a > 0 and b > 0) or (a < 0 and b < 0):
... | def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
mod = 10**9 + 7
n = int(eval(input()))
dic = {}
cnt = 0
for _ in range(n):
a, b = list(map(int, input().split()))
if a != 0 and b != 0:
g = gcd(abs(a), abs(b))
if a * b > 0:
if (abs(a) // g, abs(b... | false | 0 | [
"- if (a > 0 and b > 0) or (a < 0 and b < 0):",
"+ if a * b > 0:",
"- elif (a < 0 and b > 0) or (a > 0 and b < 0):",
"+ else:",
"- if a != 0 and b != 0:",
"+ if a * b != 0:",
"- ans *= pow(2, dic[(a, b)], mod)",
"+ ans *= pow(2, dic[(a, b... | false | 0.043991 | 0.04042 | 1.088331 | [
"s397598484",
"s084966338"
] |
u385574568 | p02953 | python | s797863887 | s835165289 | 75 | 64 | 15,340 | 15,344 | Accepted | Accepted | 14.67 | import math
import os
import random
import re
import sys
def check_non_decreasing_squares(n: int, a: list):
for i in range(1, n):
if a[i] != a[i - 1]:
if a[i] - 1 < a[i - 1]:
print("No")
sys.exit(0)
a[i] -= 1
print("Yes")
if __name... | import math
import os
import random
import re
import sys
def check_non_decreasing_squares(n: int, a: list):
p = a[0]
for i in range(1, n):
if a[i] > p:
p = a[i]
if p - a[i] == 1 or p - a[i] == 0:
continue
print("No")
exit(0)
print("Yes"... | 19 | 21 | 449 | 463 | import math
import os
import random
import re
import sys
def check_non_decreasing_squares(n: int, a: list):
for i in range(1, n):
if a[i] != a[i - 1]:
if a[i] - 1 < a[i - 1]:
print("No")
sys.exit(0)
a[i] -= 1
print("Yes")
if __name__ == "__main... | import math
import os
import random
import re
import sys
def check_non_decreasing_squares(n: int, a: list):
p = a[0]
for i in range(1, n):
if a[i] > p:
p = a[i]
if p - a[i] == 1 or p - a[i] == 0:
continue
print("No")
exit(0)
print("Yes")
if __name_... | false | 9.52381 | [
"+ p = a[0]",
"- if a[i] != a[i - 1]:",
"- if a[i] - 1 < a[i - 1]:",
"- print(\"No\")",
"- sys.exit(0)",
"- a[i] -= 1",
"+ if a[i] > p:",
"+ p = a[i]",
"+ if p - a[i] == 1 or p - a[i] == 0:",
"+ conti... | false | 0.048964 | 0.112108 | 0.436754 | [
"s797863887",
"s835165289"
] |
u366482170 | p03043 | python | s795361350 | s796415264 | 81 | 44 | 2,940 | 3,316 | Accepted | Accepted | 45.68 | import math
def main():
pos=0
n,k=list(map(int,input().split()))
nmen=1/n
for i in range(1,n+1):
ajs=(-(-math.log2(k/i)//1))
if ajs<=0: ajs=0
pos+=nmen*0.5**ajs
# print(ajs)
print(pos)
if __name__ == "__main__":
main()
| import math
n,k=list(map(int,input().split()))
p=0
for i in range(n):
g=k/(i+1)
if i>=k:
p+=1/n
continue
x=-(-math.log2(g)//1)
p+=1/n*((0.5)**x)
print(p) | 17 | 11 | 266 | 189 | import math
def main():
pos = 0
n, k = list(map(int, input().split()))
nmen = 1 / n
for i in range(1, n + 1):
ajs = -(-math.log2(k / i) // 1)
if ajs <= 0:
ajs = 0
pos += nmen * 0.5**ajs
# print(ajs)
print(pos)
if __name__ == "__main__":
main()
| import math
n, k = list(map(int, input().split()))
p = 0
for i in range(n):
g = k / (i + 1)
if i >= k:
p += 1 / n
continue
x = -(-math.log2(g) // 1)
p += 1 / n * ((0.5) ** x)
print(p)
| false | 35.294118 | [
"-",
"-def main():",
"- pos = 0",
"- n, k = list(map(int, input().split()))",
"- nmen = 1 / n",
"- for i in range(1, n + 1):",
"- ajs = -(-math.log2(k / i) // 1)",
"- if ajs <= 0:",
"- ajs = 0",
"- pos += nmen * 0.5**ajs",
"- # print(ajs)",
"- ... | false | 0.088487 | 0.055067 | 1.60689 | [
"s795361350",
"s796415264"
] |
u814781830 | p02612 | python | s078177342 | s977809834 | 76 | 64 | 61,528 | 61,776 | Accepted | Accepted | 15.79 | n = int(eval(input()))
print((1000-n%1000 if n%1000 > 0 else 0)) | print(((1000-int(eval(input()))%1000)%1000)) | 2 | 1 | 57 | 36 | n = int(eval(input()))
print((1000 - n % 1000 if n % 1000 > 0 else 0))
| print(((1000 - int(eval(input())) % 1000) % 1000))
| false | 50 | [
"-n = int(eval(input()))",
"-print((1000 - n % 1000 if n % 1000 > 0 else 0))",
"+print(((1000 - int(eval(input())) % 1000) % 1000))"
] | false | 0.086225 | 0.063382 | 1.360412 | [
"s078177342",
"s977809834"
] |
u223646582 | p03504 | python | s402028584 | s816595497 | 942 | 311 | 68,672 | 88,464 | Accepted | Accepted | 66.99 | N, C = list(map(int, input().split()))
imos = [0]*(10**5+1)
pgs = []
for _ in range(N):
s, t, c = list(map(int, input().split()))
pgs.append((s, t, c))
pgs = sorted(pgs, key=lambda x: (x[2], x[0]))
for i in range(N):
s, t, c = pgs[i]
if i >= 1 and pgs[i-1][2] == pgs[i][2] and pgs[i-1][1... | from collections import defaultdict
N, C = list(map(int, input().split()))
D = defaultdict(list)
for _ in range(N):
s, t, c = list(map(int, input().split()))
D[c-1].append((s, t))
IMOS = [0]*(10**5+2)
for c in range(C):
D[c].sort(key=lambda x: x[0])
pt = -1
for i, (s, t) in enumera... | 27 | 30 | 508 | 561 | N, C = list(map(int, input().split()))
imos = [0] * (10**5 + 1)
pgs = []
for _ in range(N):
s, t, c = list(map(int, input().split()))
pgs.append((s, t, c))
pgs = sorted(pgs, key=lambda x: (x[2], x[0]))
for i in range(N):
s, t, c = pgs[i]
if i >= 1 and pgs[i - 1][2] == pgs[i][2] and pgs[i - 1][1] == pgs[... | from collections import defaultdict
N, C = list(map(int, input().split()))
D = defaultdict(list)
for _ in range(N):
s, t, c = list(map(int, input().split()))
D[c - 1].append((s, t))
IMOS = [0] * (10**5 + 2)
for c in range(C):
D[c].sort(key=lambda x: x[0])
pt = -1
for i, (s, t) in enumerate(D[c]):
... | false | 10 | [
"+from collections import defaultdict",
"+",
"-imos = [0] * (10**5 + 1)",
"-pgs = []",
"+D = defaultdict(list)",
"- pgs.append((s, t, c))",
"-pgs = sorted(pgs, key=lambda x: (x[2], x[0]))",
"-for i in range(N):",
"- s, t, c = pgs[i]",
"- if i >= 1 and pgs[i - 1][2] == pgs[i][2] and pgs[i ... | false | 0.117402 | 0.11372 | 1.032378 | [
"s402028584",
"s816595497"
] |
u631277801 | p03370 | python | s903715945 | s276623028 | 56 | 17 | 3,064 | 3,064 | Accepted | Accepted | 69.64 | N,X = list(map(int, input().split()))
M = []
for i in range(N):
M.append(int(eval(input())))
ichi = sum(M)
ans = N
X -= ichi
M.sort()
i = 0
while X-M[i]>=0:
if X - M[i] >= 0:
X -= M[i]
ans += 1
continue
i += 1
print(ans) | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readl... | 21 | 23 | 281 | 565 | N, X = list(map(int, input().split()))
M = []
for i in range(N):
M.append(int(eval(input())))
ichi = sum(M)
ans = N
X -= ichi
M.sort()
i = 0
while X - M[i] >= 0:
if X - M[i] >= 0:
X -= M[i]
ans += 1
continue
i += 1
print(ans)
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 8.695652 | [
"-N, X = list(map(int, input().split()))",
"-M = []",
"-for i in range(N):",
"- M.append(int(eval(input())))",
"-ichi = sum(M)",
"-ans = N",
"-X -= ichi",
"-M.sort()",
"-i = 0",
"-while X - M[i] >= 0:",
"- if X - M[i] >= 0:",
"- X -= M[i]",
"- ans += 1",
"- conti... | false | 0.037646 | 0.037546 | 1.002656 | [
"s903715945",
"s276623028"
] |
u073852194 | p03031 | python | s124829397 | s919516447 | 66 | 52 | 3,064 | 3,064 | Accepted | Accepted | 21.21 | n,m = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(m)]
P = list(map(int, input().split()))
c = 0
a = 0
for a in range(2**n):
a2 = format(a, 'b').zfill(n)
d = 0
for i in range(m):
o = 0
for j in range(S[i][0]):
o += int(a2[S[i][j+1]-1])
if o % 2 ... | N,M = list(map(int,input().split()))
B = [tuple(map(int,input().split())) for _ in range(M)]
P = tuple(map(int,input().split()))
ans = 0
for i in range(2**N):
flag = True
for k in range(M):
on = 0
for j in range(B[k][0]):
if i>>(B[k][j+1]-1) & 1:
... | 17 | 22 | 372 | 454 | n, m = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(m)]
P = list(map(int, input().split()))
c = 0
a = 0
for a in range(2**n):
a2 = format(a, "b").zfill(n)
d = 0
for i in range(m):
o = 0
for j in range(S[i][0]):
o += int(a2[S[i][j + 1] - 1])
... | N, M = list(map(int, input().split()))
B = [tuple(map(int, input().split())) for _ in range(M)]
P = tuple(map(int, input().split()))
ans = 0
for i in range(2**N):
flag = True
for k in range(M):
on = 0
for j in range(B[k][0]):
if i >> (B[k][j + 1] - 1) & 1:
on += 1
... | false | 22.727273 | [
"-n, m = list(map(int, input().split()))",
"-S = [list(map(int, input().split())) for i in range(m)]",
"-P = list(map(int, input().split()))",
"-c = 0",
"-a = 0",
"-for a in range(2**n):",
"- a2 = format(a, \"b\").zfill(n)",
"- d = 0",
"- for i in range(m):",
"- o = 0",
"- ... | false | 0.040921 | 0.088512 | 0.462327 | [
"s124829397",
"s919516447"
] |
u843175622 | p03222 | python | s693143762 | s632795002 | 58 | 40 | 9,128 | 9,136 | Accepted | Accepted | 31.03 | h, w, k = list(map(int, input().split()))
dp = [0] * w
mod = 10 ** 9 + 7
dp[0] = 1
for i in range(h):
next = [0] * w
for bit in range(1 << w - 1):
ok = True
for j in range(w - 2):
if bit >> j & 1 and bit >> j + 1 & 1:
ok = False
if ok:
... | h, w, k = list(map(int, input().split()))
dp = [0] * w
mod = 10 ** 9 + 7
comb = []
for bit in range(1 << w - 1):
ok = True
for j in range(w - 2):
if bit >> j & 1 and bit >> j + 1 & 1:
ok = False
if ok:
comb.append(bit)
dp[0] = 1
for i in range(h):
next = [0] ... | 23 | 27 | 651 | 656 | h, w, k = list(map(int, input().split()))
dp = [0] * w
mod = 10**9 + 7
dp[0] = 1
for i in range(h):
next = [0] * w
for bit in range(1 << w - 1):
ok = True
for j in range(w - 2):
if bit >> j & 1 and bit >> j + 1 & 1:
ok = False
if ok:
moved = [False... | h, w, k = list(map(int, input().split()))
dp = [0] * w
mod = 10**9 + 7
comb = []
for bit in range(1 << w - 1):
ok = True
for j in range(w - 2):
if bit >> j & 1 and bit >> j + 1 & 1:
ok = False
if ok:
comb.append(bit)
dp[0] = 1
for i in range(h):
next = [0] * w
for bit in ... | false | 14.814815 | [
"+comb = []",
"+for bit in range(1 << w - 1):",
"+ ok = True",
"+ for j in range(w - 2):",
"+ if bit >> j & 1 and bit >> j + 1 & 1:",
"+ ok = False",
"+ if ok:",
"+ comb.append(bit)",
"- for bit in range(1 << w - 1):",
"- ok = True",
"- for j in... | false | 0.049544 | 0.046758 | 1.059582 | [
"s693143762",
"s632795002"
] |
u294385082 | p02714 | python | s155978423 | s266268223 | 1,154 | 1,064 | 9,200 | 9,208 | Accepted | Accepted | 7.8 | n = int(eval(input()))
s = list(eval(input()))
r = s.count('R')
g = s.count('G')
b = len(s) - r - g
ans = r*g*b
for i in range(n-2):
for j in range(i+1,i+((n-i-1)//2)+1):
if s[i] != s[j] and s[i] != s[2*j - i] and s[j] != s[2*j - i]:
ans -= 1
print(ans) | n = int(eval(input()))
s = list(eval(input()))
r = s.count('R')
g = s.count('G')
b = n - r - g
ans = r*g*b
for i in range(n-2):
for j in range(i+1,i+((n-i-1)//2)+1):
if s[i] != s[j] and s[i] != s[2*j - i] and s[j] != s[2*j - i]:
ans -= 1
print(ans) | 14 | 14 | 275 | 270 | n = int(eval(input()))
s = list(eval(input()))
r = s.count("R")
g = s.count("G")
b = len(s) - r - g
ans = r * g * b
for i in range(n - 2):
for j in range(i + 1, i + ((n - i - 1) // 2) + 1):
if s[i] != s[j] and s[i] != s[2 * j - i] and s[j] != s[2 * j - i]:
ans -= 1
print(ans)
| n = int(eval(input()))
s = list(eval(input()))
r = s.count("R")
g = s.count("G")
b = n - r - g
ans = r * g * b
for i in range(n - 2):
for j in range(i + 1, i + ((n - i - 1) // 2) + 1):
if s[i] != s[j] and s[i] != s[2 * j - i] and s[j] != s[2 * j - i]:
ans -= 1
print(ans)
| false | 0 | [
"-b = len(s) - r - g",
"+b = n - r - g"
] | false | 0.09121 | 0.089573 | 1.018277 | [
"s155978423",
"s266268223"
] |
u780962115 | p03032 | python | s290440295 | s639991955 | 54 | 48 | 3,064 | 9,468 | Accepted | Accepted | 11.11 | n,k=list(map(int,input().split()))
lists=list(map(int,input().split()))
ans=0
nums=min(n,k)
for j in range(1,nums+1):
#スライドするときの数 j=0,1,2,3,4......numsまでとることができる
#n<kの時max n かつかくjに対して取り除けるのはk-j回めまでである
#n>=kの時max k かつ かくjに対して取り除けるのはk-j回までである
for m in range(j+1):
sublist=lists[:m]+lists[n... | # equeue
from collections import deque
import heapq
def main():
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
res = 0
for pull in range(K+1):
push = K - pull
if push < 0 or push > N:
continue
for left_push in range(push+1)... | 19 | 39 | 561 | 1,004 | n, k = list(map(int, input().split()))
lists = list(map(int, input().split()))
ans = 0
nums = min(n, k)
for j in range(1, nums + 1):
# スライドするときの数 j=0,1,2,3,4......numsまでとることができる
# n<kの時max n かつかくjに対して取り除けるのはk-j回めまでである
# n>=kの時max k かつ かくjに対して取り除けるのはk-j回までである
for m in range(j + 1):
sublist = list... | # equeue
from collections import deque
import heapq
def main():
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
res = 0
for pull in range(K + 1):
push = K - pull
if push < 0 or push > N:
continue
for left_push in range(push + 1):
... | false | 51.282051 | [
"-n, k = list(map(int, input().split()))",
"-lists = list(map(int, input().split()))",
"-ans = 0",
"-nums = min(n, k)",
"-for j in range(1, nums + 1):",
"- # スライドするときの数 j=0,1,2,3,4......numsまでとることができる",
"- # n<kの時max n かつかくjに対して取り除けるのはk-j回めまでである",
"- # n>=kの時max k かつ かくjに対して取り除けるのはk-j回までである",... | false | 0.048699 | 0.142637 | 0.341421 | [
"s290440295",
"s639991955"
] |
u046187684 | p03088 | python | s709396416 | s830984479 | 263 | 18 | 6,288 | 3,064 | Accepted | Accepted | 93.16 | from functools import lru_cache
def check(s):
bads = ["AGC", "ACG", "GAC"] + [b.format(_s) for b in ["AG{}C", "A{}GC"] for _s in "ACGT"]
return not any([x in s for x in bads])
def solve(string):
n = int(string)
@lru_cache(n * 4**3)
def dfs(pos, last3):
if pos == n:
... | def solve(string):
n = int(string)
dp = [[0] * 4 for _ in range(n)]
dp[0] = [1] * 4
for i in range(1, n):
base = sum(dp[i - 1])
for j in range(4):
dp[i][j] = base
# "AGC", "ACG", "GAC"
if i >= 2:
dp[i][1] -= dp[i - 2][0] + dp[i - 2][2]
... | 25 | 22 | 586 | 591 | from functools import lru_cache
def check(s):
bads = ["AGC", "ACG", "GAC"] + [
b.format(_s) for b in ["AG{}C", "A{}GC"] for _s in "ACGT"
]
return not any([x in s for x in bads])
def solve(string):
n = int(string)
@lru_cache(n * 4**3)
def dfs(pos, last3):
if pos == n:
... | def solve(string):
n = int(string)
dp = [[0] * 4 for _ in range(n)]
dp[0] = [1] * 4
for i in range(1, n):
base = sum(dp[i - 1])
for j in range(4):
dp[i][j] = base
# "AGC", "ACG", "GAC"
if i >= 2:
dp[i][1] -= dp[i - 2][0] + dp[i - 2][2]
... | false | 12 | [
"-from functools import lru_cache",
"-",
"-",
"-def check(s):",
"- bads = [\"AGC\", \"ACG\", \"GAC\"] + [",
"- b.format(_s) for b in [\"AG{}C\", \"A{}GC\"] for _s in \"ACGT\"",
"- ]",
"- return not any([x in s for x in bads])",
"-",
"-",
"-",
"- @lru_cache(n * 4**3)",
"- ... | false | 0.125088 | 0.036671 | 3.411042 | [
"s709396416",
"s830984479"
] |
u046187684 | p03282 | python | s234529297 | s981443181 | 179 | 163 | 38,256 | 38,256 | Accepted | Accepted | 8.94 | def solve(string):
s, k = string.split()
if len(s) == 1:
return s
k = int(k)
for _s in s[:k]:
if _s != "1":
return _s
else:
return "1"
if __name__ == '__main__':
print((solve('\n'.join([eval(input()), eval(input())]))))
| def solve(string):
s, k = string.split()
for _s in s[:int(k)]:
if _s != "1":
return _s
else:
return "1"
if __name__ == '__main__':
print((solve('\n'.join([eval(input()), eval(input())]))))
| 14 | 11 | 281 | 231 | def solve(string):
s, k = string.split()
if len(s) == 1:
return s
k = int(k)
for _s in s[:k]:
if _s != "1":
return _s
else:
return "1"
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval(input())]))))
| def solve(string):
s, k = string.split()
for _s in s[: int(k)]:
if _s != "1":
return _s
else:
return "1"
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval(input())]))))
| false | 21.428571 | [
"- if len(s) == 1:",
"- return s",
"- k = int(k)",
"- for _s in s[:k]:",
"+ for _s in s[: int(k)]:"
] | false | 0.044425 | 0.060884 | 0.729673 | [
"s234529297",
"s981443181"
] |
u970308980 | p02793 | python | s052271581 | s425056508 | 1,959 | 968 | 6,136 | 6,136 | Accepted | Accepted | 50.59 | import sys
input = sys.stdin.readline
from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def mod_inv(a, m):
return pow(a, m-2, m)
MOD = 10 ** 9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
LCM = 1
for a in A:
LCM = lcm(LCM, a)
# ans = LCM * su... | from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def mod_inv(a, m):
return pow(a, m-2, m)
MOD = 10 ** 9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
LCM = 1
for a in A:
LCM = lcm(LCM, a)
LCM %= MOD
# ans = LCM * sum([mod_inv(a, MOD) for a in A]... | 29 | 28 | 444 | 416 | import sys
input = sys.stdin.readline
from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def mod_inv(a, m):
return pow(a, m - 2, m)
MOD = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
LCM = 1
for a in A:
LCM = lcm(LCM, a)
# ans = LCM * sum([mod_inv(a, MOD) for a... | from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def mod_inv(a, m):
return pow(a, m - 2, m)
MOD = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
LCM = 1
for a in A:
LCM = lcm(LCM, a)
LCM %= MOD
# ans = LCM * sum([mod_inv(a, MOD) for a in A]) % MOD
ans = 0
for a ... | false | 3.448276 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"+LCM %= MOD"
] | false | 0.045291 | 0.065627 | 0.69012 | [
"s052271581",
"s425056508"
] |
u508732591 | p02315 | python | s559384301 | s646592951 | 760 | 440 | 26,900 | 6,664 | Accepted | Accepted | 42.11 | from fractions import gcd
from functools import reduce
N,W = list(map(int, input().split()))
v = [0]*(N+1)
wtemp = [0]*(N+1)
for i in range(1,N+1):
v[i],wtemp[i] = list(map(int, input().split()))
gcdw = reduce(gcd,wtemp+[W])
w = list([x//gcdw for x in wtemp])
W2 = W//gcdw
dp = [[0]*(W2+1) for y in r... | N,W = list(map(int, input().split()))
dp = [0]*(W+1)
temp = [0]*(W+1)
for i in range(1,N+1):
v,w = list(map(int,input().split()))
for j in range(1, W+1):
if w <= j and v + temp[j-w] > temp[j]:
dp[j] = temp[j-w]+v
temp[0:W+1] = dp[0:W+1]
print((dp[W])) | 22 | 12 | 496 | 282 | from fractions import gcd
from functools import reduce
N, W = list(map(int, input().split()))
v = [0] * (N + 1)
wtemp = [0] * (N + 1)
for i in range(1, N + 1):
v[i], wtemp[i] = list(map(int, input().split()))
gcdw = reduce(gcd, wtemp + [W])
w = list([x // gcdw for x in wtemp])
W2 = W // gcdw
dp = [[0] * (W2 + 1) f... | N, W = list(map(int, input().split()))
dp = [0] * (W + 1)
temp = [0] * (W + 1)
for i in range(1, N + 1):
v, w = list(map(int, input().split()))
for j in range(1, W + 1):
if w <= j and v + temp[j - w] > temp[j]:
dp[j] = temp[j - w] + v
temp[0 : W + 1] = dp[0 : W + 1]
print((dp[W]))
| false | 45.454545 | [
"-from fractions import gcd",
"-from functools import reduce",
"-",
"-v = [0] * (N + 1)",
"-wtemp = [0] * (N + 1)",
"+dp = [0] * (W + 1)",
"+temp = [0] * (W + 1)",
"- v[i], wtemp[i] = list(map(int, input().split()))",
"-gcdw = reduce(gcd, wtemp + [W])",
"-w = list([x // gcdw for x in wtemp])",
... | false | 0.109992 | 0.03845 | 2.860618 | [
"s559384301",
"s646592951"
] |
u086566114 | p02412 | python | s130967232 | s902365252 | 450 | 190 | 6,324 | 6,412 | Accepted | Accepted | 57.78 | while True:
[n, m] = [int(x) for x in input().split()]
if [n, m] == [0, 0]:
break
data = []
for x in range(n, 2, -1):
if 3 * x - 2 < m:
break
for y in range(x - 1, 1, -1):
for z in range(y - 1, 0, -1):
s = x + y + z
... | def get_num(n, m):
ans = 0
for x in range(n, 2, -1):
if 3 * x - 2 < m:
return ans
for y in range(x - 1, 1, -1):
if x + 2 * y - 1 < m:
break
for z in range(y - 1, 0, -1):
s = x + y + z
if s == m:
... | 18 | 20 | 453 | 494 | while True:
[n, m] = [int(x) for x in input().split()]
if [n, m] == [0, 0]:
break
data = []
for x in range(n, 2, -1):
if 3 * x - 2 < m:
break
for y in range(x - 1, 1, -1):
for z in range(y - 1, 0, -1):
s = x + y + z
if s < m... | def get_num(n, m):
ans = 0
for x in range(n, 2, -1):
if 3 * x - 2 < m:
return ans
for y in range(x - 1, 1, -1):
if x + 2 * y - 1 < m:
break
for z in range(y - 1, 0, -1):
s = x + y + z
if s == m:
... | false | 10 | [
"+def get_num(n, m):",
"+ ans = 0",
"+ for x in range(n, 2, -1):",
"+ if 3 * x - 2 < m:",
"+ return ans",
"+ for y in range(x - 1, 1, -1):",
"+ if x + 2 * y - 1 < m:",
"+ break",
"+ for z in range(y - 1, 0, -1):",
"+ ... | false | 0.047894 | 0.048277 | 0.992071 | [
"s130967232",
"s902365252"
] |
u254871849 | p03645 | python | s955108084 | s532033683 | 485 | 188 | 76,048 | 46,660 | Accepted | Accepted | 61.24 | import sys
n, m, *ab = list(map(int, sys.stdin.read().split()))
g = [set() for _ in range(n+1)]
for a, b in zip(*[iter(ab)] * 2):
g[a].add(b)
g[b].add(a)
def main():
return 'POSSIBLE' if g[1] & g[n] else 'IMPOSSIBLE'
if __name__ == '__main__':
ans = main()
print(ans) | import sys
n, m, *ab = list(map(int, sys.stdin.read().split()))
g_1 = set()
g_n = set()
for a, b in zip(*[iter(ab)] * 2):
if a == 1 or b == 1:
g_1.add(b)
elif a == n or b == n:
g_n.add(a)
def main():
return 'POSSIBLE' if g_1 & g_n else 'IMPOSSIBLE'
if __name__ == '__main__':... | 14 | 17 | 297 | 348 | import sys
n, m, *ab = list(map(int, sys.stdin.read().split()))
g = [set() for _ in range(n + 1)]
for a, b in zip(*[iter(ab)] * 2):
g[a].add(b)
g[b].add(a)
def main():
return "POSSIBLE" if g[1] & g[n] else "IMPOSSIBLE"
if __name__ == "__main__":
ans = main()
print(ans)
| import sys
n, m, *ab = list(map(int, sys.stdin.read().split()))
g_1 = set()
g_n = set()
for a, b in zip(*[iter(ab)] * 2):
if a == 1 or b == 1:
g_1.add(b)
elif a == n or b == n:
g_n.add(a)
def main():
return "POSSIBLE" if g_1 & g_n else "IMPOSSIBLE"
if __name__ == "__main__":
ans = m... | false | 17.647059 | [
"-g = [set() for _ in range(n + 1)]",
"+g_1 = set()",
"+g_n = set()",
"- g[a].add(b)",
"- g[b].add(a)",
"+ if a == 1 or b == 1:",
"+ g_1.add(b)",
"+ elif a == n or b == n:",
"+ g_n.add(a)",
"- return \"POSSIBLE\" if g[1] & g[n] else \"IMPOSSIBLE\"",
"+ return \"PO... | false | 0.106029 | 0.044048 | 2.407132 | [
"s955108084",
"s532033683"
] |
u463068683 | p02572 | python | s776759005 | s498994665 | 215 | 126 | 31,384 | 31,440 | Accepted | Accepted | 41.4 | n = int(eval(input()))
la = list(map(int, input().split()))
MOD = (10**9+7)
ans = 0
nn = 0
for i in range(n):
ans %= MOD
ans += la[i]%MOD
nn %= MOD
nn += (la[i]**2)%MOD
ans = (ans**2-nn+10**9+7)*pow(2, -1, MOD)%MOD
print(ans) | n = int(eval(input()))
la = list(map(int, input().split()))
MOD = 10**9+7
s1 = sum(la)
s2 = sum([x**2 for x in la])
ans = (s1*s1-s2)//2%MOD
print(ans) | 12 | 7 | 238 | 150 | n = int(eval(input()))
la = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
nn = 0
for i in range(n):
ans %= MOD
ans += la[i] % MOD
nn %= MOD
nn += (la[i] ** 2) % MOD
ans = (ans**2 - nn + 10**9 + 7) * pow(2, -1, MOD) % MOD
print(ans)
| n = int(eval(input()))
la = list(map(int, input().split()))
MOD = 10**9 + 7
s1 = sum(la)
s2 = sum([x**2 for x in la])
ans = (s1 * s1 - s2) // 2 % MOD
print(ans)
| false | 41.666667 | [
"-ans = 0",
"-nn = 0",
"-for i in range(n):",
"- ans %= MOD",
"- ans += la[i] % MOD",
"- nn %= MOD",
"- nn += (la[i] ** 2) % MOD",
"-ans = (ans**2 - nn + 10**9 + 7) * pow(2, -1, MOD) % MOD",
"+s1 = sum(la)",
"+s2 = sum([x**2 for x in la])",
"+ans = (s1 * s1 - s2) // 2 % MOD"
] | false | 0.008287 | 0.069241 | 0.119679 | [
"s776759005",
"s498994665"
] |
u608088992 | p03937 | python | s980675235 | s544480994 | 24 | 19 | 3,316 | 3,064 | Accepted | Accepted | 20.83 | import sys
from collections import deque
def solve():
input = sys.stdin.readline
H, W = list(map(int, input().split()))
A = [input().strip("\n") for _ in range(H)]
q = deque()
q.append((0, 0))
visited = [[False] * W for _ in range(H)]
possible = True
while q:
nh, nw ... | import sys
def solve():
input = sys.stdin.readline
H, W = list(map(int, input().split()))
A = [input().strip("\n") for _ in range(H)]
count = 0
for h in range(H):
for w in range(W):
if A[h][w] == "#": count += 1
if count + 1 == H + W: print("Possible")
else: p... | 39 | 18 | 1,170 | 393 | import sys
from collections import deque
def solve():
input = sys.stdin.readline
H, W = list(map(int, input().split()))
A = [input().strip("\n") for _ in range(H)]
q = deque()
q.append((0, 0))
visited = [[False] * W for _ in range(H)]
possible = True
while q:
nh, nw = q.popleft... | import sys
def solve():
input = sys.stdin.readline
H, W = list(map(int, input().split()))
A = [input().strip("\n") for _ in range(H)]
count = 0
for h in range(H):
for w in range(W):
if A[h][w] == "#":
count += 1
if count + 1 == H + W:
print("Possible... | false | 53.846154 | [
"-from collections import deque",
"- q = deque()",
"- q.append((0, 0))",
"- visited = [[False] * W for _ in range(H)]",
"- possible = True",
"- while q:",
"- nh, nw = q.popleft()",
"- if not visited[nh][nw]:",
"- visited[nh][nw] = True",
"- count ... | false | 0.037547 | 0.036101 | 1.04004 | [
"s980675235",
"s544480994"
] |
u787562674 | p03363 | python | s241017574 | s462195054 | 224 | 156 | 41,472 | 41,472 | Accepted | Accepted | 30.36 | from collections import Counter
from itertools import accumulate
N = int(eval(input()))
inputs = [int(i) for i in input().split()]
ans = 0
ruisekiwa = list(accumulate(inputs))
ruisekiwa.sort()
counter_ruiseki = Counter(ruisekiwa)
for key, value in list(counter_ruiseki.items()):
if key == 0 and valu... | from collections import Counter
from itertools import accumulate
N = int(eval(input()))
inputs = [int(i) for i in input().split()]
ans = 0
ruisekiwa = list(accumulate(inputs))
for key, value in list(Counter(ruisekiwa).items()):
if key == 0 and value == 1:
ans += value
continue
... | 22 | 20 | 485 | 433 | from collections import Counter
from itertools import accumulate
N = int(eval(input()))
inputs = [int(i) for i in input().split()]
ans = 0
ruisekiwa = list(accumulate(inputs))
ruisekiwa.sort()
counter_ruiseki = Counter(ruisekiwa)
for key, value in list(counter_ruiseki.items()):
if key == 0 and value == 1:
... | from collections import Counter
from itertools import accumulate
N = int(eval(input()))
inputs = [int(i) for i in input().split()]
ans = 0
ruisekiwa = list(accumulate(inputs))
for key, value in list(Counter(ruisekiwa).items()):
if key == 0 and value == 1:
ans += value
continue
elif key == 0 and... | false | 9.090909 | [
"-ruisekiwa.sort()",
"-counter_ruiseki = Counter(ruisekiwa)",
"-for key, value in list(counter_ruiseki.items()):",
"+for key, value in list(Counter(ruisekiwa).items()):",
"- ans += sum(list(range(value)))",
"+ ans += value * (value - 1) // 2"
] | false | 0.035179 | 0.042243 | 0.832768 | [
"s241017574",
"s462195054"
] |
u951601135 | p03835 | python | s768057919 | s349018509 | 1,460 | 484 | 2,940 | 2,940 | Accepted | Accepted | 66.85 | K , S = list(map(int,input().split()))
count = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if(0 <= z <= K):
count += 1
print(count) | K , S = list(map(int,input().split()))
count = 0
for x in range(K+1):
for y in range(max(0,S-K-x), min(K+1,S-x+1)):
count += 1
print(count) | 8 | 6 | 166 | 144 | K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if 0 <= z <= K:
count += 1
print(count)
| K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
for y in range(max(0, S - K - x), min(K + 1, S - x + 1)):
count += 1
print(count)
| false | 25 | [
"- for y in range(K + 1):",
"- z = S - x - y",
"- if 0 <= z <= K:",
"- count += 1",
"+ for y in range(max(0, S - K - x), min(K + 1, S - x + 1)):",
"+ count += 1"
] | false | 0.038085 | 0.075086 | 0.507211 | [
"s768057919",
"s349018509"
] |
u934246119 | p03361 | python | s785492140 | s525149975 | 21 | 19 | 3,064 | 3,064 | Accepted | Accepted | 9.52 | h, w = list(map(int, input().split()))
s = [[] for i in range(h)]
for i in range(h):
s[i] = eval(input())
s2 = [[False for j in range(w)] for i in range(h)]
ssum = 0
ssum2 = 0
for i in range(h):
for j in range(w):
if s[i][j] == "#":
# print(i, j, s[i][j])
if 0 < i:
... | h, w = map(int, input().split())
s = [[] for i in range(h+2)]
s[0] = '.'*(w+2)
for i in range(1, h+1):
s[i] = '.' + input() + '.'
s[h+1] = '.'*(w+2)
s2 = [[False for j in range(w)] for i in range(h)]
judge = True
for i in range(1, h+1):
for j in range(1, w+1):
if s[i][j] == "#":
i... | 35 | 25 | 962 | 605 | h, w = list(map(int, input().split()))
s = [[] for i in range(h)]
for i in range(h):
s[i] = eval(input())
s2 = [[False for j in range(w)] for i in range(h)]
ssum = 0
ssum2 = 0
for i in range(h):
for j in range(w):
if s[i][j] == "#":
# print(i, j, s[i][j])
if 0 < i:
... | h, w = map(int, input().split())
s = [[] for i in range(h + 2)]
s[0] = "." * (w + 2)
for i in range(1, h + 1):
s[i] = "." + input() + "."
s[h + 1] = "." * (w + 2)
s2 = [[False for j in range(w)] for i in range(h)]
judge = True
for i in range(1, h + 1):
for j in range(1, w + 1):
if s[i][j] == "#":
... | false | 28.571429 | [
"-h, w = list(map(int, input().split()))",
"-s = [[] for i in range(h)]",
"-for i in range(h):",
"- s[i] = eval(input())",
"+h, w = map(int, input().split())",
"+s = [[] for i in range(h + 2)]",
"+s[0] = \".\" * (w + 2)",
"+for i in range(1, h + 1):",
"+ s[i] = \".\" + input() + \".\"",
"+s[... | false | 0.044751 | 0.046713 | 0.957989 | [
"s785492140",
"s525149975"
] |
u729133443 | p03987 | python | s903771347 | s847636225 | 1,212 | 1,100 | 25,884 | 25,884 | Accepted | Accepted | 9.24 | from bisect import*
class BTreeNode:
def __init__(self):self.key,self.child=[],[]
class BTree:
def __init__(self):self.root=BTreeNode()
def search_higher(self,key):
ptr=self.root
ret=None
while ptr.child:
i=bisect(ptr.key,key)
if i!=len(ptr.key):ret=... | from bisect import*
class BTreeNode:
def __init__(self):self.key,self.child=[],[]
root=BTreeNode()
def main():
def search_higher(key):
ptr=root
ret=None
while ptr.child:
i=bisect(ptr.key,key)
if i!=len(ptr.key):ret=ptr.key[i]
ptr=ptr.child[i... | 67 | 66 | 2,154 | 1,980 | from bisect import *
class BTreeNode:
def __init__(self):
self.key, self.child = [], []
class BTree:
def __init__(self):
self.root = BTreeNode()
def search_higher(self, key):
ptr = self.root
ret = None
while ptr.child:
i = bisect(ptr.key, key)
... | from bisect import *
class BTreeNode:
def __init__(self):
self.key, self.child = [], []
root = BTreeNode()
def main():
def search_higher(key):
ptr = root
ret = None
while ptr.child:
i = bisect(ptr.key, key)
if i != len(ptr.key):
ret =... | false | 1.492537 | [
"-class BTree:",
"- def __init__(self):",
"- self.root = BTreeNode()",
"+root = BTreeNode()",
"- def search_higher(self, key):",
"- ptr = self.root",
"+",
"+def main():",
"+ def search_higher(key):",
"+ ptr = root",
"- def search_lower(self, key):",
"- p... | false | 0.044687 | 0.037146 | 1.203011 | [
"s903771347",
"s847636225"
] |
u634046173 | p04012 | python | s337354923 | s319259836 | 32 | 26 | 9,028 | 8,928 | Accepted | Accepted | 18.75 | s = eval(input())
ss = set(s)
r = 'Yes'
for w in ss:
if s.count(w) % 2 == 1:
r = 'No'
break
print(r) | s = eval(input())
r = 'Yes'
for w in s:
if s.count(w) % 2 == 1:
r = 'No'
break
print(r) | 9 | 8 | 113 | 100 | s = eval(input())
ss = set(s)
r = "Yes"
for w in ss:
if s.count(w) % 2 == 1:
r = "No"
break
print(r)
| s = eval(input())
r = "Yes"
for w in s:
if s.count(w) % 2 == 1:
r = "No"
break
print(r)
| false | 11.111111 | [
"-ss = set(s)",
"-for w in ss:",
"+for w in s:"
] | false | 0.045494 | 0.077438 | 0.587489 | [
"s337354923",
"s319259836"
] |
u191874006 | p02937 | python | s058545325 | s662281583 | 1,520 | 496 | 3,980 | 133,472 | Accepted | Accepted | 67.37 | #!/usr/bin/env python3
#ABC138 E
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import ite... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 42 | 49 | 978 | 1,201 | #!/usr/bin/env python3
# ABC138 E
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
fr... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 14.285714 | [
"-# ABC138 E",
"-import bisect",
"+from bisect import bisect_right as br",
"+from bisect import bisect_left as bl",
"-sys.setrecursionlimit(1000000000)",
"+sys.setrecursionlimit(2147483647)",
"-n = len(s)",
"-m = len(t)",
"-f = [False] * 26",
"-f2 = [False] * 26",
"-alpha = \"abcdefghijklmnopqrs... | false | 0.080843 | 0.060047 | 1.346326 | [
"s058545325",
"s662281583"
] |
u389910364 | p03148 | python | s764920430 | s919084918 | 823 | 399 | 43,652 | 33,088 | Accepted | Accepted | 51.52 | import heapq
INF = float('inf')
n, k = list(map(int, input().split()))
sushi = {}
for _ in range(n):
t, d = list(map(int, input().split()))
if t not in sushi:
sushi[t] = []
sushi[t].append(d)
for s in list(sushi.values()):
s.sort(reverse=True)
eat_counts = {s: 0 for s in list(... | import os
import sys
from collections import deque
from operator import itemgetter
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
N, K = list(map(int, sys.stdin.buffer.readline().split()))... | 70 | 55 | 1,505 | 1,300 | import heapq
INF = float("inf")
n, k = list(map(int, input().split()))
sushi = {}
for _ in range(n):
t, d = list(map(int, input().split()))
if t not in sushi:
sushi[t] = []
sushi[t].append(d)
for s in list(sushi.values()):
s.sort(reverse=True)
eat_counts = {s: 0 for s in list(sushi.keys())}
# ま... | import os
import sys
from collections import deque
from operator import itemgetter
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
N, K = list(map(int, sys.stdin.buffer.readline().split()))
TD = [list(map(int, s... | false | 21.428571 | [
"-import heapq",
"+import os",
"+import sys",
"+from collections import deque",
"+from operator import itemgetter",
"+if os.getenv(\"LOCAL\"):",
"+ sys.stdin = open(\"_in.txt\", \"r\")",
"+sys.setrecursionlimit(10**9)",
"-n, k = list(map(int, input().split()))",
"-sushi = {}",
"-for _ in rang... | false | 0.062367 | 0.099695 | 0.625579 | [
"s764920430",
"s919084918"
] |
u826188728 | p02888 | python | s108332163 | s183667956 | 1,937 | 1,625 | 3,188 | 3,188 | Accepted | Accepted | 16.11 | import bisect
n = int(eval(input()))
l = list(map(int, input().split()))
count = 0
l.sort(reverse = False)
for i in range(len(l)-1, 1, -1):
for j in range(i-1, 0, -1):
pt = bisect.bisect_right(l, l[i] - l[j])
count += max(j - pt, 0)
print(count)
| import bisect
n = int(eval(input()))
l = list(map(int, input().split()))
count = 0
l.sort()
for i in range(len(l)-1, 1, -1):
for j in range(i-1, 0, -1):
count += max(j - (bisect.bisect_right(l, l[i] - l[j])), 0)
print(count)
| 11 | 10 | 261 | 235 | import bisect
n = int(eval(input()))
l = list(map(int, input().split()))
count = 0
l.sort(reverse=False)
for i in range(len(l) - 1, 1, -1):
for j in range(i - 1, 0, -1):
pt = bisect.bisect_right(l, l[i] - l[j])
count += max(j - pt, 0)
print(count)
| import bisect
n = int(eval(input()))
l = list(map(int, input().split()))
count = 0
l.sort()
for i in range(len(l) - 1, 1, -1):
for j in range(i - 1, 0, -1):
count += max(j - (bisect.bisect_right(l, l[i] - l[j])), 0)
print(count)
| false | 9.090909 | [
"-l.sort(reverse=False)",
"+l.sort()",
"- pt = bisect.bisect_right(l, l[i] - l[j])",
"- count += max(j - pt, 0)",
"+ count += max(j - (bisect.bisect_right(l, l[i] - l[j])), 0)"
] | false | 0.046576 | 0.047186 | 0.987072 | [
"s108332163",
"s183667956"
] |
u368796742 | p02564 | python | s563281199 | s957239289 | 3,477 | 2,936 | 200,044 | 200,156 | Accepted | Accepted | 15.56 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
class SCC:
def __init__(self, n):
self.n = n
self.graph = [[] for i in range(n)]
self.graph_rev = [[] for i in range(n)]
self.used = [False]*n
def add_edge(self, fr, to):
if fr == to:
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
class SCC:
def __init__(self, n):
self.n = n
self.graph = [[] for i in range(n)]
self.graph_rev = [[] for i in range(n)]
self.used = [False]*n
def add_edge(self, fr, to):
if fr == to:
... | 63 | 66 | 1,538 | 1,627 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
class SCC:
def __init__(self, n):
self.n = n
self.graph = [[] for i in range(n)]
self.graph_rev = [[] for i in range(n)]
self.used = [False] * n
def add_edge(self, fr, to):
if fr == to:
r... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
class SCC:
def __init__(self, n):
self.n = n
self.graph = [[] for i in range(n)]
self.graph_rev = [[] for i in range(n)]
self.used = [False] * n
def add_edge(self, fr, to):
if fr == to:
r... | false | 4.545455 | [
"-n, m = list(map(int, input().split()))",
"-scc = SCC(n)",
"-for _ in range(m):",
"- a, b = list(map(int, input().split()))",
"- scc.add_edge(a, b)",
"-ans = scc.scc()",
"-print((len(ans)))",
"-for i in ans:",
"- print((len(i), *i))",
"+def main():",
"+ n, m = list(map(int, input().... | false | 0.048021 | 0.039627 | 1.211835 | [
"s563281199",
"s957239289"
] |
u123756661 | p02837 | python | s352523035 | s980527690 | 322 | 140 | 43,500 | 73,872 | Accepted | Accepted | 56.52 | n=int(eval(input()))
w=[[] for i in range(n)]
for i in range(n):
a=int(eval(input()))
for j in range(a):
x,y=list(map(int,input().split()))
w[i].append((x,y))
ans=0
for i in range(1<<n):
x="0"*15+bin(i)[2:]
z=[int(i) for i in x[-n:]]
f=1
for p,q in enumerate(w):
... | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
n=int(eval(input()))
w=[]
ans=chk=0
for i in range(n):
a=int(eval(input()))
t=[]
for j in range(a):
x,y=list(map(int,input().split()))
t.append((x,y))
w.append(t)
for i in range(1,2**n):
l=[0]*n
for j in range(n):
... | 20 | 27 | 462 | 556 | n = int(eval(input()))
w = [[] for i in range(n)]
for i in range(n):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
w[i].append((x, y))
ans = 0
for i in range(1 << n):
x = "0" * 15 + bin(i)[2:]
z = [int(i) for i in x[-n:]]
f = 1
for p, q in enume... | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
n = int(eval(input()))
w = []
ans = chk = 0
for i in range(n):
a = int(eval(input()))
t = []
for j in range(a):
x, y = list(map(int, input().split()))
t.append((x, y))
w.append(t)
for i in range(1, 2**n):
l = [0] * n
for j in range(n... | false | 25.925926 | [
"+#!/usr/bin/env python3",
"+# -*- coding: UTF-8 -*-",
"-w = [[] for i in range(n)]",
"+w = []",
"+ans = chk = 0",
"+ t = []",
"- w[i].append((x, y))",
"-ans = 0",
"-for i in range(1 << n):",
"- x = \"0\" * 15 + bin(i)[2:]",
"- z = [int(i) for i in x[-n:]]",
"- f = 1",
"- ... | false | 0.03803 | 0.037612 | 1.011133 | [
"s352523035",
"s980527690"
] |
u581603131 | p02712 | python | s379861250 | s857984363 | 199 | 154 | 48,544 | 9,164 | Accepted | Accepted | 22.61 | N = int(eval(input()))
list = []
for i in range(1,N+1):
list.append(i)
for i in range(1,(N+3)//3):
list[3*i-1] = 0
for i in range(1,(N+5)//5):
list[5*i-1] = 0
print((sum(list))) | n = int(eval(input()))
ans = 0
for i in range(n+1):
if i % 3 != 0 and i % 5 != 0:
ans += i
print(ans) | 9 | 7 | 189 | 114 | N = int(eval(input()))
list = []
for i in range(1, N + 1):
list.append(i)
for i in range(1, (N + 3) // 3):
list[3 * i - 1] = 0
for i in range(1, (N + 5) // 5):
list[5 * i - 1] = 0
print((sum(list)))
| n = int(eval(input()))
ans = 0
for i in range(n + 1):
if i % 3 != 0 and i % 5 != 0:
ans += i
print(ans)
| false | 22.222222 | [
"-N = int(eval(input()))",
"-list = []",
"-for i in range(1, N + 1):",
"- list.append(i)",
"-for i in range(1, (N + 3) // 3):",
"- list[3 * i - 1] = 0",
"-for i in range(1, (N + 5) // 5):",
"- list[5 * i - 1] = 0",
"-print((sum(list)))",
"+n = int(eval(input()))",
"+ans = 0",
"+for i ... | false | 0.343468 | 0.176888 | 1.941723 | [
"s379861250",
"s857984363"
] |
u200887663 | p02791 | python | s058211917 | s933572632 | 176 | 145 | 26,012 | 32,384 | Accepted | Accepted | 17.61 | n=int(eval(input()))
#n,p=map(int,input().split())
pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
mn=pl[0]
mnl=[]
count=1
for i in range(n):
mn=min(mn,pl[i])
mnl.append(mn)
for i in range(1,n):
if pl[i]<=mnl[i-1]:
count+=1
print(count) | n=int(eval(input()))
#n,m=map(int,input().split())
#t=int(input())
pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
mn=pl[0]
mnl=[]
for i in range(n):
mn=min(mn,pl[i])
mnl.append(mn)
res=0
for i in range(n):
if pl[i]<=mnl[i]: res+=1
print(res)
| 17 | 15 | 309 | 304 | n = int(eval(input()))
# n,p=map(int,input().split())
pl = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
mn = pl[0]
mnl = []
count = 1
for i in range(n):
mn = min(mn, pl[i])
mnl.append(mn)
for i in range(1, n):
if pl[i] <= mnl[i - 1]:
count += 1
print(count)
| n = int(eval(input()))
# n,m=map(int,input().split())
# t=int(input())
pl = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
mn = pl[0]
mnl = []
for i in range(n):
mn = min(mn, pl[i])
mnl.append(mn)
res = 0
for i in range(n):
if pl[i] <= mnl[i]:
res += 1
print(r... | false | 11.764706 | [
"-# n,p=map(int,input().split())",
"+# n,m=map(int,input().split())",
"+# t=int(input())",
"-count = 1",
"-for i in range(1, n):",
"- if pl[i] <= mnl[i - 1]:",
"- count += 1",
"-print(count)",
"+res = 0",
"+for i in range(n):",
"+ if pl[i] <= mnl[i]:",
"+ res += 1",
"+pri... | false | 0.120101 | 0.046713 | 2.571018 | [
"s058211917",
"s933572632"
] |
u539692012 | p02601 | python | s653874747 | s122174080 | 93 | 29 | 61,604 | 9,024 | Accepted | Accepted | 68.82 | a, b, c = list(map(int, input().split()))
k = int(eval(input()))
t = 0
# c > b > a
while not b > a:
b *= 2
t += 1
while not c > b:
c *= 2
t += 1
print(('Yes' if t <= k else 'No')) | a,b,c,k=list(map(int,open(0).read().split()))
while k:k-=1;t=a<b;b*=2-t;c*=1+t
print(('NYoe s'[a<b<c::2])) | 11 | 3 | 191 | 100 | a, b, c = list(map(int, input().split()))
k = int(eval(input()))
t = 0
# c > b > a
while not b > a:
b *= 2
t += 1
while not c > b:
c *= 2
t += 1
print(("Yes" if t <= k else "No"))
| a, b, c, k = list(map(int, open(0).read().split()))
while k:
k -= 1
t = a < b
b *= 2 - t
c *= 1 + t
print(("NYoe s"[a < b < c :: 2]))
| false | 72.727273 | [
"-a, b, c = list(map(int, input().split()))",
"-k = int(eval(input()))",
"-t = 0",
"-# c > b > a",
"-while not b > a:",
"- b *= 2",
"- t += 1",
"-while not c > b:",
"- c *= 2",
"- t += 1",
"-print((\"Yes\" if t <= k else \"No\"))",
"+a, b, c, k = list(map(int, open(0).read().split(... | false | 0.085866 | 0.039491 | 2.174354 | [
"s653874747",
"s122174080"
] |
u677991935 | p03031 | python | s519163367 | s890675536 | 52 | 46 | 3,064 | 3,064 | Accepted | Accepted | 11.54 | N,M = list(map(int,input().split()))
#ks[i][0]がk_i
ks = [[int(i) for i in input().split()]for i in range(M)]
p=list(map(int,input().split()))
ans=0
for i in range(2**N):
flag=0
#Onoff[i]=0はスイッチiのOFFを、=1はONを表す
OnOff = [0]*N
for j in range(N):
if (i>>j) & 1:
OnOff[j]=1
... | N,M = list(map(int,input().split()))
#ks[i][0]がk_i
ks = [[int(i) for i in input().split()]for i in range(M)]
p=list(map(int,input().split()))
ans=0
for i in range(2**N):
flag=0
#Onoff[i]=0はスイッチiのOFFを、=1はONを表す
OnOff = [0]*N
for j in range(N):
if (i>>j) & 1:
OnOff[j]=1
... | 28 | 28 | 667 | 712 | N, M = list(map(int, input().split()))
# ks[i][0]がk_i
ks = [[int(i) for i in input().split()] for i in range(M)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**N):
flag = 0
# Onoff[i]=0はスイッチiのOFFを、=1はONを表す
OnOff = [0] * N
for j in range(N):
if (i >> j) & 1:
OnOff[j] = ... | N, M = list(map(int, input().split()))
# ks[i][0]がk_i
ks = [[int(i) for i in input().split()] for i in range(M)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**N):
flag = 0
# Onoff[i]=0はスイッチiのOFFを、=1はONを表す
OnOff = [0] * N
for j in range(N):
if (i >> j) & 1:
OnOff[j] = ... | false | 0 | [
"- if OnOff[ks[j][l] - 1] == 1:",
"+ if OnOff[ks[j][l] - 1] == 1: # -1に注意(スイッチxはOnOff[x-1]に対応)",
"+ # 全ての電球が点くならばansに+1"
] | false | 0.007179 | 0.03982 | 0.180294 | [
"s519163367",
"s890675536"
] |
u533039576 | p02678 | python | s567065130 | s653635461 | 1,018 | 691 | 64,140 | 34,992 | Accepted | Accepted | 32.12 | from heapq import heappush, heappop
def dijkstra(graph: list, n: int, v_s: int, INF: int = float('inf')) -> list:
# graph[v_from] = [(cost, v_to), ...]
dist = [INF] * n
prev_node = [-1] * n
dist[v_s] = 0
heap = [(0, v_s)] # heap = [(dist[v], v), ...]
while heap:
dist2v, v_... | from collections import deque
n, m = list(map(int, input().split()))
graph = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
dist = [-1] * n
prev_node = [-1] * n
dist[0] = 0
q = deque([0])
while q:
... | 40 | 29 | 1,039 | 600 | from heapq import heappush, heappop
def dijkstra(graph: list, n: int, v_s: int, INF: int = float("inf")) -> list:
# graph[v_from] = [(cost, v_to), ...]
dist = [INF] * n
prev_node = [-1] * n
dist[v_s] = 0
heap = [(0, v_s)] # heap = [(dist[v], v), ...]
while heap:
dist2v, v_from = heapp... | from collections import deque
n, m = list(map(int, input().split()))
graph = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
dist = [-1] * n
prev_node = [-1] * n
dist[0] = 0
q = deque([0])
while q:
v = q.poplef... | false | 27.5 | [
"-from heapq import heappush, heappop",
"-",
"-",
"-def dijkstra(graph: list, n: int, v_s: int, INF: int = float(\"inf\")) -> list:",
"- # graph[v_from] = [(cost, v_to), ...]",
"- dist = [INF] * n",
"- prev_node = [-1] * n",
"- dist[v_s] = 0",
"- heap = [(0, v_s)] # heap = [(dist[v],... | false | 0.038829 | 0.039183 | 0.990973 | [
"s567065130",
"s653635461"
] |
u671252250 | p03672 | python | s984895171 | s313275037 | 21 | 17 | 3,316 | 3,060 | Accepted | Accepted | 19.05 | # coding: utf-8
# Your code here!
from collections import Counter
S = list(eval(input()))
A_li = []
B_li = []
for i in range(1, len(S) + 1):
S_del = S[:-i]
A_li = S_del[0:len(S_del) // 2]
B_li = S_del[len(S_del) // 2::]
if A_li == B_li:
print((len(A_li) * 2))
exit() | # coding: utf-8
# Your code here!
S = list(eval(input()))
A_li = []
B_li = []
for i in range(1, len(S) + 1):
S_del = S[:-i]
A_li = S_del[0:len(S_del) // 2]
B_li = S_del[len(S_del) // 2::]
if A_li == B_li:
print((len(A_li) * 2))
exit() | 15 | 14 | 306 | 273 | # coding: utf-8
# Your code here!
from collections import Counter
S = list(eval(input()))
A_li = []
B_li = []
for i in range(1, len(S) + 1):
S_del = S[:-i]
A_li = S_del[0 : len(S_del) // 2]
B_li = S_del[len(S_del) // 2 : :]
if A_li == B_li:
print((len(A_li) * 2))
exit()
| # coding: utf-8
# Your code here!
S = list(eval(input()))
A_li = []
B_li = []
for i in range(1, len(S) + 1):
S_del = S[:-i]
A_li = S_del[0 : len(S_del) // 2]
B_li = S_del[len(S_del) // 2 : :]
if A_li == B_li:
print((len(A_li) * 2))
exit()
| false | 6.666667 | [
"-from collections import Counter",
"-"
] | false | 0.036772 | 0.076213 | 0.482482 | [
"s984895171",
"s313275037"
] |
u407160848 | p02745 | python | s415742872 | s291712992 | 1,954 | 1,779 | 52,788 | 53,192 | Accepted | Accepted | 8.96 | a = eval(input())
b = eval(input())
c = eval(input())
# 文字のマッチング(?はワイルドカード)
def match(a, b):
return a=="?" or b=="?" or a==b
ab = [True] * 100000 # Aに対して(i-50000)個左にスライドした位置にBを置けるか?
ac = [True] * 100000 # Aに対して(i-50000)個左にスライドした位置にCを置けるか?
bc = [True] * 100000 # Bに対して(i-50000)個左にスライドした位置にCを置けるか?
def c... | a = eval(input())
b = eval(input())
c = eval(input())
# 文字のマッチング(?はワイルドカード)
def match(a, b):
return a=="?" or b=="?" or a==b
ab = [True] * 100000 # Aに対して(i-50000)個左にスライドした位置にBを置けるか?
ac = [True] * 100000 # Aに対して(i-50000)個左にスライドした位置にCを置けるか?
bc = [True] * 100000 # Bに対して(i-50000)個左にスライドした位置にCを置けるか?
def c... | 39 | 37 | 966 | 914 | a = eval(input())
b = eval(input())
c = eval(input())
# 文字のマッチング(?はワイルドカード)
def match(a, b):
return a == "?" or b == "?" or a == b
ab = [True] * 100000 # Aに対して(i-50000)個左にスライドした位置にBを置けるか?
ac = [True] * 100000 # Aに対して(i-50000)個左にスライドした位置にCを置けるか?
bc = [True] * 100000 # Bに対して(i-50000)個左にスライドした位置にCを置けるか?
def che... | a = eval(input())
b = eval(input())
c = eval(input())
# 文字のマッチング(?はワイルドカード)
def match(a, b):
return a == "?" or b == "?" or a == b
ab = [True] * 100000 # Aに対して(i-50000)個左にスライドした位置にBを置けるか?
ac = [True] * 100000 # Aに対して(i-50000)個左にスライドした位置にCを置けるか?
bc = [True] * 100000 # Bに対して(i-50000)個左にスライドした位置にCを置けるか?
def che... | false | 5.128205 | [
"- left = min(0, i, j)",
"- right = max(len_a, len_b + i, len_c + j)",
"- ans = min(ans, right - left)",
"+ ans = min(ans, max(len_a, len_b + i, len_c + j) - min(0, i, j))"
] | false | 0.042213 | 0.045521 | 0.92734 | [
"s415742872",
"s291712992"
] |
u246253778 | p02622 | python | s095178291 | s065843951 | 81 | 62 | 73,224 | 9,328 | Accepted | Accepted | 23.46 | S = eval(input())
T = eval(input())
cnt = 0
for i, s in enumerate(S):
if s != T[i]:
cnt += 1
print(cnt) | S = eval(input())
T = eval(input())
cnt = 0
for i in range(len(S)):
if S[i] != T[i]:
cnt += 1
print(cnt) | 9 | 9 | 113 | 114 | S = eval(input())
T = eval(input())
cnt = 0
for i, s in enumerate(S):
if s != T[i]:
cnt += 1
print(cnt)
| S = eval(input())
T = eval(input())
cnt = 0
for i in range(len(S)):
if S[i] != T[i]:
cnt += 1
print(cnt)
| false | 0 | [
"-for i, s in enumerate(S):",
"- if s != T[i]:",
"+for i in range(len(S)):",
"+ if S[i] != T[i]:"
] | false | 0.10258 | 0.043962 | 2.333405 | [
"s095178291",
"s065843951"
] |
u852690916 | p03371 | python | s155831675 | s239568696 | 182 | 126 | 39,408 | 3,064 | Accepted | Accepted | 30.77 | A,B,C,X,Y = list(map(int, input().split()))
ans = 5000 * 10**5 * 4 + 1
for c in range(0,max(X,Y)*2+1,2):
a = c * C
x,y = max(0,X-c//2), max(0,Y-c//2)
a += A*x + B*y
ans = min(ans, a)
print(ans) | a,b,c,x,y=list(map(int, input().split()))
c*=2
ans=10**9
for cc in range(max(x,y)+1):
tmp = cc * c
tmp += max(0, x-cc)*a
tmp += max(0, y-cc)*b
ans = min(ans, tmp)
print(ans) | 9 | 9 | 212 | 191 | A, B, C, X, Y = list(map(int, input().split()))
ans = 5000 * 10**5 * 4 + 1
for c in range(0, max(X, Y) * 2 + 1, 2):
a = c * C
x, y = max(0, X - c // 2), max(0, Y - c // 2)
a += A * x + B * y
ans = min(ans, a)
print(ans)
| a, b, c, x, y = list(map(int, input().split()))
c *= 2
ans = 10**9
for cc in range(max(x, y) + 1):
tmp = cc * c
tmp += max(0, x - cc) * a
tmp += max(0, y - cc) * b
ans = min(ans, tmp)
print(ans)
| false | 0 | [
"-A, B, C, X, Y = list(map(int, input().split()))",
"-ans = 5000 * 10**5 * 4 + 1",
"-for c in range(0, max(X, Y) * 2 + 1, 2):",
"- a = c * C",
"- x, y = max(0, X - c // 2), max(0, Y - c // 2)",
"- a += A * x + B * y",
"- ans = min(ans, a)",
"+a, b, c, x, y = list(map(int, input().split()))... | false | 0.054441 | 0.07096 | 0.767212 | [
"s155831675",
"s239568696"
] |
u977389981 | p03700 | python | s149011394 | s563260925 | 1,444 | 1,180 | 11,032 | 11,060 | Accepted | Accepted | 18.28 | import math
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for i in range(N)]
def f(x):
s = sum([math.ceil(max(0, h - x * B) / (A - B)) for h in H])
if s <= x:
return True
else:
return False
l = 0
r = 10 ** 9 + 7
while r - l > 1:
m = (l + r) // ... | N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for i in range(N)]
def f(x):
s = sum([- (- max(0, h - x * B) // (A - B)) for h in H])
if s <= x:
return True
else:
return False
l = 0
r = 10 ** 9 + 7
while r - l > 1:
m = (l + r) // 2
if f(m):
... | 22 | 21 | 406 | 389 | import math
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for i in range(N)]
def f(x):
s = sum([math.ceil(max(0, h - x * B) / (A - B)) for h in H])
if s <= x:
return True
else:
return False
l = 0
r = 10**9 + 7
while r - l > 1:
m = (l + r) // 2
if f(m):
... | N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for i in range(N)]
def f(x):
s = sum([-(-max(0, h - x * B) // (A - B)) for h in H])
if s <= x:
return True
else:
return False
l = 0
r = 10**9 + 7
while r - l > 1:
m = (l + r) // 2
if f(m):
r = m
else:
... | false | 4.545455 | [
"-import math",
"-",
"- s = sum([math.ceil(max(0, h - x * B) / (A - B)) for h in H])",
"+ s = sum([-(-max(0, h - x * B) // (A - B)) for h in H])"
] | false | 0.068145 | 0.05522 | 1.23407 | [
"s149011394",
"s563260925"
] |
u216015528 | p03329 | python | s663833255 | s854252042 | 229 | 104 | 9,160 | 73,456 | Accepted | Accepted | 54.59 | import sys
def resolve():
readline = sys.stdin.readline
def func(n: int, a: int):
res = 0
while n > 0:
res += n % a
n = int(n / a)
return res
N = int(readline())
res = N
for i in range(N + 1):
tmp = func(i, 6) + func(N - i... | #!/usr/bin/env python3
def main():
N = int(eval(input()))
can_six = []
can_nine = []
limit = 100
for i in range(1, limit):
six = 6 ** i
if six <= N:
can_six.append(six)
nine = 9 ** i
if nine <= N:
can_nine.append(nine)
... | 22 | 31 | 383 | 686 | import sys
def resolve():
readline = sys.stdin.readline
def func(n: int, a: int):
res = 0
while n > 0:
res += n % a
n = int(n / a)
return res
N = int(readline())
res = N
for i in range(N + 1):
tmp = func(i, 6) + func(N - i, 9)
res =... | #!/usr/bin/env python3
def main():
N = int(eval(input()))
can_six = []
can_nine = []
limit = 100
for i in range(1, limit):
six = 6**i
if six <= N:
can_six.append(six)
nine = 9**i
if nine <= N:
can_nine.append(nine)
if six > N and nine >... | false | 29.032258 | [
"-import sys",
"+#!/usr/bin/env python3",
"+def main():",
"+ N = int(eval(input()))",
"+ can_six = []",
"+ can_nine = []",
"+ limit = 100",
"+ for i in range(1, limit):",
"+ six = 6**i",
"+ if six <= N:",
"+ can_six.append(six)",
"+ nine = 9**i",
... | false | 0.066733 | 0.21767 | 0.30658 | [
"s663833255",
"s854252042"
] |
u391731808 | p03569 | python | s461183493 | s580494672 | 76 | 66 | 3,956 | 5,236 | Accepted | Accepted | 13.16 | s = eval(input())
t= "".join(c for c in s if c!="x")
if t!=t[::-1]:
print((-1))
else:
ans=0
i=0
j=0
l=len(s)
while i+j<l-1:
if s[i] != s[l-1-j]:
ans+=1
if s[i] == "x" : i+=1
else : j+=1
else:
i+=1
j+=1
... | s = eval(input())
t = "".join(s.split("x"))
if t!=t[::-1]:print((-1));exit()
ans = 0
i,j=0,len(s)-1
while i<j:
if s[i]==s[j]:i+=1;j-=1
elif s[i]=="x":ans+=1;i+=1
elif s[j]=="x":ans+=1;j-=1
print(ans) | 18 | 10 | 325 | 212 | s = eval(input())
t = "".join(c for c in s if c != "x")
if t != t[::-1]:
print((-1))
else:
ans = 0
i = 0
j = 0
l = len(s)
while i + j < l - 1:
if s[i] != s[l - 1 - j]:
ans += 1
if s[i] == "x":
i += 1
else:
j += 1
... | s = eval(input())
t = "".join(s.split("x"))
if t != t[::-1]:
print((-1))
exit()
ans = 0
i, j = 0, len(s) - 1
while i < j:
if s[i] == s[j]:
i += 1
j -= 1
elif s[i] == "x":
ans += 1
i += 1
elif s[j] == "x":
ans += 1
j -= 1
print(ans)
| false | 44.444444 | [
"-t = \"\".join(c for c in s if c != \"x\")",
"+t = \"\".join(s.split(\"x\"))",
"-else:",
"- ans = 0",
"- i = 0",
"- j = 0",
"- l = len(s)",
"- while i + j < l - 1:",
"- if s[i] != s[l - 1 - j]:",
"- ans += 1",
"- if s[i] == \"x\":",
"- ... | false | 0.0861 | 0.153837 | 0.559688 | [
"s461183493",
"s580494672"
] |
u527993431 | p02847 | python | s254210618 | s282800484 | 19 | 17 | 2,940 | 3,060 | Accepted | Accepted | 10.53 | S = eval(input())
youbi = {
'SUN':7,
'MON':6,
'TUE':5,
'WED':4,
'THU':3,
'FRI':2,
'SAT':1
}
print((youbi[S])) | S=["SUN","MON","TUE","WED","THU","FRI","SAT"]
T=eval(input())
if T=="SUN":
print((7))
if T=="MON":
print((6))
if T=="TUE":
print((5))
if T=="WED":
print((4))
if T=="THU":
print((3))
if T=="FRI":
print((2))
if T=="SAT":
print((1))
| 13 | 16 | 143 | 232 | S = eval(input())
youbi = {"SUN": 7, "MON": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SAT": 1}
print((youbi[S]))
| S = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
T = eval(input())
if T == "SUN":
print((7))
if T == "MON":
print((6))
if T == "TUE":
print((5))
if T == "WED":
print((4))
if T == "THU":
print((3))
if T == "FRI":
print((2))
if T == "SAT":
print((1))
| false | 18.75 | [
"-S = eval(input())",
"-youbi = {\"SUN\": 7, \"MON\": 6, \"TUE\": 5, \"WED\": 4, \"THU\": 3, \"FRI\": 2, \"SAT\": 1}",
"-print((youbi[S]))",
"+S = [\"SUN\", \"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\"]",
"+T = eval(input())",
"+if T == \"SUN\":",
"+ print((7))",
"+if T == \"MON\":",
"+ ... | false | 0.046422 | 0.049621 | 0.935535 | [
"s254210618",
"s282800484"
] |
u069533671 | p03073 | python | s696353254 | s890653704 | 51 | 37 | 4,652 | 4,252 | Accepted | Accepted | 27.45 | l = [int(i) for i in list(eval(input()))]
even = l[0::2]
odd = l[1::2]
l = sum([abs(1-x) for x in even]) + sum(odd)
r = sum([abs(1-x) for x in odd]) + sum(even)
print((min(l, r))) | s = [int(i) for i in eval(input())]
n = len(s)
l = sum(s[0::2])
r = sum(s[1::2])
print((min(abs(l-r+len(s[1::2])), abs(r-l+len(s[0::2]))))) | 9 | 7 | 190 | 139 | l = [int(i) for i in list(eval(input()))]
even = l[0::2]
odd = l[1::2]
l = sum([abs(1 - x) for x in even]) + sum(odd)
r = sum([abs(1 - x) for x in odd]) + sum(even)
print((min(l, r)))
| s = [int(i) for i in eval(input())]
n = len(s)
l = sum(s[0::2])
r = sum(s[1::2])
print((min(abs(l - r + len(s[1::2])), abs(r - l + len(s[0::2])))))
| false | 22.222222 | [
"-l = [int(i) for i in list(eval(input()))]",
"-even = l[0::2]",
"-odd = l[1::2]",
"-l = sum([abs(1 - x) for x in even]) + sum(odd)",
"-r = sum([abs(1 - x) for x in odd]) + sum(even)",
"-print((min(l, r)))",
"+s = [int(i) for i in eval(input())]",
"+n = len(s)",
"+l = sum(s[0::2])",
"+r = sum(s[1:... | false | 0.037007 | 0.066409 | 0.557257 | [
"s696353254",
"s890653704"
] |
u367701763 | p02793 | python | s929382006 | s063973797 | 335 | 140 | 33,656 | 90,212 | Accepted | Accepted | 58.21 | import sys
input = sys.stdin.readline
from collections import defaultdict
class PrimeFactor():
def __init__(self, n): # エラトステネス O(N loglog N)
self.n = n
self.table = [i if i % 2 else 2 for i in range(n + 1)]
self.table[0] = 0
for p in range(3, n + 1):
... | import sys
input = sys.stdin.readline
from collections import defaultdict
class PrimeFactor():
def __init__(self, n): # エラトステネス O(N loglog N)
self.n = n
self.table = list(range(n+1))
self.table[2::2] = [2]*(n//2)
for p in range(3, int(n**0.5) + 2, 2):
... | 77 | 76 | 2,208 | 2,198 | import sys
input = sys.stdin.readline
from collections import defaultdict
class PrimeFactor:
def __init__(self, n): # エラトステネス O(N loglog N)
self.n = n
self.table = [i if i % 2 else 2 for i in range(n + 1)]
self.table[0] = 0
for p in range(3, n + 1):
if self.table[p] =... | import sys
input = sys.stdin.readline
from collections import defaultdict
class PrimeFactor:
def __init__(self, n): # エラトステネス O(N loglog N)
self.n = n
self.table = list(range(n + 1))
self.table[2::2] = [2] * (n // 2)
for p in range(3, int(n**0.5) + 2, 2):
if self.tabl... | false | 1.298701 | [
"- self.table = [i if i % 2 else 2 for i in range(n + 1)]",
"- self.table[0] = 0",
"- for p in range(3, n + 1):",
"+ self.table = list(range(n + 1))",
"+ self.table[2::2] = [2] * (n // 2)",
"+ for p in range(3, int(n**0.5) + 2, 2):",
"- for q in r... | false | 0.481566 | 0.145493 | 3.309895 | [
"s929382006",
"s063973797"
] |
u368249389 | p02684 | python | s207117355 | s652477107 | 170 | 157 | 32,380 | 32,376 | Accepted | Accepted | 7.65 | # Problem D - Teleporter
# input
N, K = list(map(int, input().split()))
a_list = list(map(int, input().split()))
# initialization
visit_list = [0] * N
pos = a_list[0]
visit_list[pos-1] = 1
visit_count = 1
remain = K - 1
is_ok = True
ans = 0
# count
while remain>0 and is_ok:
pos = a_list[pos-1]
... | # Problem D - Teleporter
# input
N, K = list(map(int, input().split()))
a_list = list(map(int, input().split()))
# initialization
visit_list = [0] * N
pos = a_list[0]
visit_list[pos-1] = 1
visit_count = 1
remain = K - 1
is_ok = True
ans = 0
# count
while remain>0 and is_ok:
pos = a_list[pos-1]
... | 33 | 32 | 709 | 656 | # Problem D - Teleporter
# input
N, K = list(map(int, input().split()))
a_list = list(map(int, input().split()))
# initialization
visit_list = [0] * N
pos = a_list[0]
visit_list[pos - 1] = 1
visit_count = 1
remain = K - 1
is_ok = True
ans = 0
# count
while remain > 0 and is_ok:
pos = a_list[pos - 1]
remain -= 1... | # Problem D - Teleporter
# input
N, K = list(map(int, input().split()))
a_list = list(map(int, input().split()))
# initialization
visit_list = [0] * N
pos = a_list[0]
visit_list[pos - 1] = 1
visit_count = 1
remain = K - 1
is_ok = True
ans = 0
# count
while remain > 0 and is_ok:
pos = a_list[pos - 1]
remain -= 1... | false | 3.030303 | [
"- if not pos == 1 and visit_list[pos - 1] == 0:",
"- visit_list[pos - 1] = visit_count",
"+ visit_list[pos - 1] = visit_count"
] | false | 0.048222 | 0.046248 | 1.042667 | [
"s207117355",
"s652477107"
] |
u171366497 | p03684 | python | s623965322 | s013608730 | 1,045 | 831 | 47,596 | 63,736 | Accepted | Accepted | 20.48 | N=int(eval(input()))
city=[0]*N
for i in range(N):
x,y=list(map(int,input().split()))
city[i]=(i,x,y)
city.sort(key=lambda x:x[1])
data=[(city[i][0],city[i+1][0],city[i+1][1]-city[i][1]) for i in range(N-1)]
city.sort(key=lambda x:x[2])
data+=[(city[i][0],city[i+1][0],city[i+1][2]-city[i][2]) for i in r... | import sys
input=sys.stdin.readline
N=int(eval(input()))
P=[tuple(map(int,input().split())) for i in range(N)]
X=[(i,P[i][0]) for i in range(N)]
Y=[(i,P[i][1]) for i in range(N)]
X.sort(key=lambda x:x[1])
Y.sort(key=lambda x:x[1])
Z=[(X[i][0],X[i+1][0],X[i+1][1]-X[i][1]) for i in range(N-1)]+[(Y[i][0],Y[i+1][0]... | 32 | 32 | 787 | 795 | N = int(eval(input()))
city = [0] * N
for i in range(N):
x, y = list(map(int, input().split()))
city[i] = (i, x, y)
city.sort(key=lambda x: x[1])
data = [(city[i][0], city[i + 1][0], city[i + 1][1] - city[i][1]) for i in range(N - 1)]
city.sort(key=lambda x: x[2])
data += [
(city[i][0], city[i + 1][0], city... | import sys
input = sys.stdin.readline
N = int(eval(input()))
P = [tuple(map(int, input().split())) for i in range(N)]
X = [(i, P[i][0]) for i in range(N)]
Y = [(i, P[i][1]) for i in range(N)]
X.sort(key=lambda x: x[1])
Y.sort(key=lambda x: x[1])
Z = [(X[i][0], X[i + 1][0], X[i + 1][1] - X[i][1]) for i in range(N - 1)]... | false | 0 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-city = [0] * N",
"-for i in range(N):",
"- x, y = list(map(int, input().split()))",
"- city[i] = (i, x, y)",
"-city.sort(key=lambda x: x[1])",
"-data = [(city[i][0], city[i + 1][0], city[i + 1][1] - city[i][1]) for i in range(N - 1)]",
"-c... | false | 0.032871 | 0.077577 | 0.423719 | [
"s623965322",
"s013608730"
] |
u271934630 | p03999 | python | s391650251 | s366101494 | 191 | 26 | 39,536 | 3,188 | Accepted | Accepted | 86.39 | S = eval(input())
ans = 0
for i in range(2**(len(S)-1)):
tmp = S[0]
for j in range(len(S)-1):
if i & (1 << j):
tmp += "+"
tmp += S[j+1]
ans += eval(tmp)
print(ans)
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
s = i_s()
ans = 0
for i in range(2**(len(s)-1)):
tmp = s[0]
for j in range(len(s)-1):
if i & (1<<j):
... | 10 | 20 | 207 | 396 | S = eval(input())
ans = 0
for i in range(2 ** (len(S) - 1)):
tmp = S[0]
for j in range(len(S) - 1):
if i & (1 << j):
tmp += "+"
tmp += S[j + 1]
ans += eval(tmp)
print(ans)
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
s = i_s()
ans = 0
for i in range(2 ** (len(s) - 1)):
tmp = s[0]
for j in range(len(s) - 1):
if i & (1 << j):
tmp ... | false | 50 | [
"-S = eval(input())",
"+import sys",
"+",
"+stdin = sys.stdin",
"+sys.setrecursionlimit(10**7)",
"+i_i = lambda: int(i_s())",
"+i_l = lambda: list(map(int, stdin.readline().split()))",
"+i_s = lambda: stdin.readline().rstrip()",
"+s = i_s()",
"-for i in range(2 ** (len(S) - 1)):",
"- tmp = S[... | false | 0.040596 | 0.036634 | 1.108155 | [
"s391650251",
"s366101494"
] |
u994988729 | p02973 | python | s334795759 | s984278317 | 529 | 160 | 8,060 | 8,196 | Accepted | Accepted | 69.75 | import bisect
from collections import deque
N=int(eval(input()))
a=[int(eval(input())) for _ in range(N)]
d=deque()
for i in range(N):
p=bisect.bisect_left(d, a[i])
#print(a[i], p, d)
if p==0:
d.appendleft(a[i])
else:
d[p-1]=a[i]
print((len(d))) | from collections import deque
import bisect
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A = A[::-1]
col = [A.pop()]
col = deque(col)
while A:
a = A.pop()
if a <= col[0]:
col.appendleft(a)
else:
x = bisect.bisect_... | 14 | 22 | 277 | 375 | import bisect
from collections import deque
N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
d = deque()
for i in range(N):
p = bisect.bisect_left(d, a[i])
# print(a[i], p, d)
if p == 0:
d.appendleft(a[i])
else:
d[p - 1] = a[i]
print((len(d)))
| from collections import deque
import bisect
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A = A[::-1]
col = [A.pop()]
col = deque(col)
while A:
a = A.pop()
if a <= col[0]:
col.appendleft(a)
else:
x = bisect.bisect_left(col, a)
... | false | 36.363636 | [
"+from collections import deque",
"-from collections import deque",
"+import sys",
"+input = sys.stdin.readline",
"-a = [int(eval(input())) for _ in range(N)]",
"-d = deque()",
"-for i in range(N):",
"- p = bisect.bisect_left(d, a[i])",
"- # print(a[i], p, d)",
"- if p == 0:",
"- ... | false | 0.047247 | 0.067275 | 0.7023 | [
"s334795759",
"s984278317"
] |
u798803522 | p02363 | python | s012718547 | s869056090 | 3,820 | 1,380 | 9,968 | 10,880 | Accepted | Accepted | 63.87 | from collections import defaultdict
vertice,edge = list(map(int,input().split(" ")))
cost = [[0 if m == n else float("inf") for n in range(vertice)] for m in range(vertice)]
link = defaultdict(dict)
weight = defaultdict(dict)
for e in range(edge):
i,j,w = list(map(int,input().split(" ")))
link[i] = l... | from collections import defaultdict
vertices, edges = (int(n) for n in input().split(" "))
connect = defaultdict(list)
cost_dp = [[float("inf") if n != m else 0 for n in range(vertices)] for m in range(vertices)]
for e in range(edges):
v1, v2, weight = (int(n) for n in input().split(" "))
connect[v1].appe... | 30 | 23 | 934 | 900 | from collections import defaultdict
vertice, edge = list(map(int, input().split(" ")))
cost = [[0 if m == n else float("inf") for n in range(vertice)] for m in range(vertice)]
link = defaultdict(dict)
weight = defaultdict(dict)
for e in range(edge):
i, j, w = list(map(int, input().split(" ")))
link[i] = link.g... | from collections import defaultdict
vertices, edges = (int(n) for n in input().split(" "))
connect = defaultdict(list)
cost_dp = [
[float("inf") if n != m else 0 for n in range(vertices)] for m in range(vertices)
]
for e in range(edges):
v1, v2, weight = (int(n) for n in input().split(" "))
connect[v1].app... | false | 23.333333 | [
"-vertice, edge = list(map(int, input().split(\" \")))",
"-cost = [[0 if m == n else float(\"inf\") for n in range(vertice)] for m in range(vertice)]",
"-link = defaultdict(dict)",
"-weight = defaultdict(dict)",
"-for e in range(edge):",
"- i, j, w = list(map(int, input().split(\" \")))",
"- link[... | false | 0.095057 | 0.037579 | 2.52954 | [
"s012718547",
"s869056090"
] |
u562016607 | p03157 | python | s212503879 | s447609520 | 1,258 | 393 | 35,756 | 73,352 | Accepted | Accepted | 68.76 | H,W=list(map(int,input().split()))
S=[list(eval(input())) for i in range(H)]
N=H*W
par=[0 for i in range(N)]
rnk=[0 for i in range(N)]
def init(n):
for i in range(N):
par[i]=i
rnk[i]=0
def find(x):
if par[x]==x:
return x
else:
par[x]=find(par[x])
return ... | class UnionFind():
n=1
par=[0]
rnk=[0]
def __init__(self,size):
self.n=size
self.par=[i for i in range(self.n)]
self.rnk=[0 for i in range(self.n)]
def find(self,vertex1):
if self.par[vertex1]==vertex1:
return vertex1
else:
... | 56 | 55 | 1,151 | 1,511 | H, W = list(map(int, input().split()))
S = [list(eval(input())) for i in range(H)]
N = H * W
par = [0 for i in range(N)]
rnk = [0 for i in range(N)]
def init(n):
for i in range(N):
par[i] = i
rnk[i] = 0
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
... | class UnionFind:
n = 1
par = [0]
rnk = [0]
def __init__(self, size):
self.n = size
self.par = [i for i in range(self.n)]
self.rnk = [0 for i in range(self.n)]
def find(self, vertex1):
if self.par[vertex1] == vertex1:
return vertex1
else:
... | false | 1.785714 | [
"+class UnionFind:",
"+ n = 1",
"+ par = [0]",
"+ rnk = [0]",
"+",
"+ def __init__(self, size):",
"+ self.n = size",
"+ self.par = [i for i in range(self.n)]",
"+ self.rnk = [0 for i in range(self.n)]",
"+",
"+ def find(self, vertex1):",
"+ if self.pa... | false | 0.074978 | 0.040018 | 1.873622 | [
"s212503879",
"s447609520"
] |
u606045429 | p03946 | python | s434793330 | s896897484 | 177 | 141 | 21,600 | 20,448 | Accepted | Accepted | 20.34 | from collections import Counter
N, T, *A = list(map(int, open(0).read().split()))
mi = A[0]
ma = 0
B = Counter()
for a in A[1:]:
b = a - mi
B[b] += 1
ma = max(ma, b)
mi = min(mi, a)
print((B[ma]))
| N, T, A0, *A = list(map(int, open(0).read().split()))
ma, mi = 0, A0
B = {}
for a in A:
b = a - mi
B[b] = B.get(b, 0) + 1
ma, mi = max(ma, b), min(mi, a)
print((B[ma])) | 15 | 10 | 223 | 183 | from collections import Counter
N, T, *A = list(map(int, open(0).read().split()))
mi = A[0]
ma = 0
B = Counter()
for a in A[1:]:
b = a - mi
B[b] += 1
ma = max(ma, b)
mi = min(mi, a)
print((B[ma]))
| N, T, A0, *A = list(map(int, open(0).read().split()))
ma, mi = 0, A0
B = {}
for a in A:
b = a - mi
B[b] = B.get(b, 0) + 1
ma, mi = max(ma, b), min(mi, a)
print((B[ma]))
| false | 33.333333 | [
"-from collections import Counter",
"-",
"-N, T, *A = list(map(int, open(0).read().split()))",
"-mi = A[0]",
"-ma = 0",
"-B = Counter()",
"-for a in A[1:]:",
"+N, T, A0, *A = list(map(int, open(0).read().split()))",
"+ma, mi = 0, A0",
"+B = {}",
"+for a in A:",
"- B[b] += 1",
"- ma = m... | false | 0.040098 | 0.031191 | 1.285574 | [
"s434793330",
"s896897484"
] |
u798803522 | p02316 | python | s219369597 | s810570771 | 1,600 | 880 | 44,520 | 6,956 | Accepted | Accepted | 45 | num,weight = (int(n) for n in input().split(" "))
query = []
for n in range(num):
query.append([int(n) for n in input().split(" ")])
nap = [[0 for n in range(weight + 1)] for m in range(num + 1)]
query = sorted(query,key = lambda x:x[1],reverse = True)
for n in range(num):
for w in range(weight + 1):
... | import copy
length, cap = list(map(int, input().split(" ")))
dp = [0] * (cap + 1)
items = []
for _ in range(length):
a, b = list(map(int, input().split(" ")))
items.append([a, b])
for item in items:
v, w = item
temp_dp = copy.copy(dp)
temp_dp[w] = max(temp_dp[w], v)
for j in range(c... | 14 | 18 | 537 | 471 | num, weight = (int(n) for n in input().split(" "))
query = []
for n in range(num):
query.append([int(n) for n in input().split(" ")])
nap = [[0 for n in range(weight + 1)] for m in range(num + 1)]
query = sorted(query, key=lambda x: x[1], reverse=True)
for n in range(num):
for w in range(weight + 1):
if... | import copy
length, cap = list(map(int, input().split(" ")))
dp = [0] * (cap + 1)
items = []
for _ in range(length):
a, b = list(map(int, input().split(" ")))
items.append([a, b])
for item in items:
v, w = item
temp_dp = copy.copy(dp)
temp_dp[w] = max(temp_dp[w], v)
for j in range(cap):
... | false | 22.222222 | [
"-num, weight = (int(n) for n in input().split(\" \"))",
"-query = []",
"-for n in range(num):",
"- query.append([int(n) for n in input().split(\" \")])",
"-nap = [[0 for n in range(weight + 1)] for m in range(num + 1)]",
"-query = sorted(query, key=lambda x: x[1], reverse=True)",
"-for n in range(nu... | false | 0.040554 | 0.053395 | 0.759512 | [
"s219369597",
"s810570771"
] |
u077291787 | p03160 | python | s360786692 | s311286117 | 224 | 204 | 53,752 | 24,264 | Accepted | Accepted | 8.93 | # dpA
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
dp = [0] + [float("inf")] * (n - 1)
for i in range(1, n):
for j in range(1, 3):
if i - j >= 0:
dp[i] = min(dp[i], dp[i - j] + abs(A[i] - A[i - j]))
print((dp[-1]))
... | # A - Frog 1
from collections import defaultdict
def main():
N, *H = list(map(int, open(0).read().split()))
H = [0] + H + [0, 0]
dp = defaultdict(lambda: 1 << 30)
dp[1] = 0
for i, a in enumerate(H[1:N + 1], 1):
for j, b in enumerate(H[i + 1:i + 3], i + 1):
dp[j] = mi... | 14 | 17 | 351 | 405 | # dpA
def main():
n = int(eval(input()))
A = tuple(map(int, input().rstrip().split()))
dp = [0] + [float("inf")] * (n - 1)
for i in range(1, n):
for j in range(1, 3):
if i - j >= 0:
dp[i] = min(dp[i], dp[i - j] + abs(A[i] - A[i - j]))
print((dp[-1]))
if __name__... | # A - Frog 1
from collections import defaultdict
def main():
N, *H = list(map(int, open(0).read().split()))
H = [0] + H + [0, 0]
dp = defaultdict(lambda: 1 << 30)
dp[1] = 0
for i, a in enumerate(H[1 : N + 1], 1):
for j, b in enumerate(H[i + 1 : i + 3], i + 1):
dp[j] = min(dp[j]... | false | 17.647059 | [
"-# dpA",
"+# A - Frog 1",
"+from collections import defaultdict",
"+",
"+",
"- n = int(eval(input()))",
"- A = tuple(map(int, input().rstrip().split()))",
"- dp = [0] + [float(\"inf\")] * (n - 1)",
"- for i in range(1, n):",
"- for j in range(1, 3):",
"- if i - j >... | false | 0.041809 | 0.04638 | 0.901445 | [
"s360786692",
"s311286117"
] |
u227082700 | p02807 | python | s676627135 | s169072488 | 480 | 180 | 14,252 | 14,052 | Accepted | Accepted | 62.5 | n=int(eval(input()));a=list(map(int,input().split()));mod=10**9+7;x=m=1;z=0
for i in range(2,n):x=m=m*i%mod
for i in range(n):z=z+x*(a[i]-a[i-1])%mod;x=x+m*pow(i+1,mod-2,mod)%mod
print((z%mod)) | N,*X=list(map(int,open(0).read().split()));M,g,q,r=10**9+7,1,[1,1],0
for i in range(1,N):r,g=(r+q[-1]*(X[-1]-X[i-1]))%M,g*i%M;q+=[M//(-~i)*-q[M%(-~i)]%M]
print((r*g%M)) | 4 | 3 | 188 | 162 | n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
x = m = 1
z = 0
for i in range(2, n):
x = m = m * i % mod
for i in range(n):
z = z + x * (a[i] - a[i - 1]) % mod
x = x + m * pow(i + 1, mod - 2, mod) % mod
print((z % mod))
| N, *X = list(map(int, open(0).read().split()))
M, g, q, r = 10**9 + 7, 1, [1, 1], 0
for i in range(1, N):
r, g = (r + q[-1] * (X[-1] - X[i - 1])) % M, g * i % M
q += [M // (-~i) * -q[M % (-~i)] % M]
print((r * g % M))
| false | 25 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-mod = 10**9 + 7",
"-x = m = 1",
"-z = 0",
"-for i in range(2, n):",
"- x = m = m * i % mod",
"-for i in range(n):",
"- z = z + x * (a[i] - a[i - 1]) % mod",
"- x = x + m * pow(i + 1, mod - 2, mod) % mod",
"-print((z % ... | false | 0.039345 | 0.036204 | 1.086756 | [
"s676627135",
"s169072488"
] |
u391819434 | p03331 | python | s150563295 | s816413723 | 36 | 26 | 9,864 | 9,088 | Accepted | Accepted | 27.78 | N=eval(input())
import re
if re.match('10+',N):
print((10))
else:
ans=0
for n in N:
ans+=int(n)
print(ans) | N=eval(input())
ans=0
for n in N:
ans+=int(n)
if ans==1:
ans=10
print(ans) | 9 | 7 | 130 | 82 | N = eval(input())
import re
if re.match("10+", N):
print((10))
else:
ans = 0
for n in N:
ans += int(n)
print(ans)
| N = eval(input())
ans = 0
for n in N:
ans += int(n)
if ans == 1:
ans = 10
print(ans)
| false | 22.222222 | [
"-import re",
"-",
"-if re.match(\"10+\", N):",
"- print((10))",
"-else:",
"- ans = 0",
"- for n in N:",
"- ans += int(n)",
"- print(ans)",
"+ans = 0",
"+for n in N:",
"+ ans += int(n)",
"+if ans == 1:",
"+ ans = 10",
"+print(ans)"
] | false | 0.044071 | 0.039223 | 1.123607 | [
"s150563295",
"s816413723"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.