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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u013756322 | p02761 | python | s603541979 | s283705918 | 183 | 165 | 38,384 | 38,384 | Accepted | Accepted | 9.84 | n, m = list(map(int, input().split()))
if (n == 1 and m == 0):
print((0))
exit()
if (m == 0):
print(('1' + '0' * (n - 1)))
exit()
dic = {}
for i in range(m):
s, c = list(map(int, input().split()))
try:
_ = dic[s]
except KeyError:
if (s == 1 and c == 0 and n >= 2)... | n, m = list(map(int, input().split()))
if (n == 1 and m == 0):
print((0))
exit()
if (m == 0):
print(('1' + '0' * (n - 1)))
exit()
dic = {}
for i in range(m):
s, c = list(map(int, input().split()))
try:
_ = dic[s]
except KeyError:
if (s == 1 and c == 0 and n >= 2)... | 38 | 34 | 781 | 693 | n, m = list(map(int, input().split()))
if n == 1 and m == 0:
print((0))
exit()
if m == 0:
print(("1" + "0" * (n - 1)))
exit()
dic = {}
for i in range(m):
s, c = list(map(int, input().split()))
try:
_ = dic[s]
except KeyError:
if s == 1 and c == 0 and n >= 2:
print... | n, m = list(map(int, input().split()))
if n == 1 and m == 0:
print((0))
exit()
if m == 0:
print(("1" + "0" * (n - 1)))
exit()
dic = {}
for i in range(m):
s, c = list(map(int, input().split()))
try:
_ = dic[s]
except KeyError:
if s == 1 and c == 0 and n >= 2:
print... | false | 10.526316 | [
"- if str(i)[k - 1] == str(v):",
"- ok = True",
"- else:",
"- ok = False",
"+ if str(i)[k - 1] != str(v):",
"- if ok:",
"- print(i)",
"- exit()",
"+ print(i)",
"+ exit()"
] | false | 0.048994 | 0.043264 | 1.132441 | [
"s603541979",
"s283705918"
] |
u729133443 | p03425 | python | s112532154 | s778854694 | 54 | 49 | 10,864 | 10,864 | Accepted | Accepted | 9.26 | from itertools import*;d={};g=d.get
for t in open(0).read().split():d[t[0]]=g(t[0],0)+1
print((sum(g(p,0)*g(q,0)*g(r,0)for p,q,r in combinations('MARCH',3)))) | from itertools import*;d=[0]*128
for t in open(0).read().split():d[ord(t[0])]+=1
print((sum(p*q*r for p,q,r in combinations([d[ord(t)]for t in'MARCH'],3)))) | 3 | 3 | 158 | 156 | from itertools import *
d = {}
g = d.get
for t in open(0).read().split():
d[t[0]] = g(t[0], 0) + 1
print((sum(g(p, 0) * g(q, 0) * g(r, 0) for p, q, r in combinations("MARCH", 3))))
| from itertools import *
d = [0] * 128
for t in open(0).read().split():
d[ord(t[0])] += 1
print((sum(p * q * r for p, q, r in combinations([d[ord(t)] for t in "MARCH"], 3))))
| false | 0 | [
"-d = {}",
"-g = d.get",
"+d = [0] * 128",
"- d[t[0]] = g(t[0], 0) + 1",
"-print((sum(g(p, 0) * g(q, 0) * g(r, 0) for p, q, r in combinations(\"MARCH\", 3))))",
"+ d[ord(t[0])] += 1",
"+print((sum(p * q * r for p, q, r in combinations([d[ord(t)] for t in \"MARCH\"], 3))))"
] | false | 0.046967 | 0.04646 | 1.010906 | [
"s112532154",
"s778854694"
] |
u887207211 | p03598 | python | s615292569 | s996309585 | 20 | 18 | 3,060 | 2,940 | Accepted | Accepted | 10 | N = int(eval(input()))
K = int(eval(input()))
X = list(map(int,input().split()))
ans = 0
k = int(K/2)
for x in X:
if(x > k):
ans += (K-x) * 2
else:
ans += x * 2
print(ans) | N = int(eval(input()))
K = int(eval(input()))
X = list(map(int,input().split()))
cnt = 0
for x in X:
if(x > K//2):
cnt += (K-x)*2
else:
cnt += x*2
print(cnt) | 12 | 10 | 183 | 166 | N = int(eval(input()))
K = int(eval(input()))
X = list(map(int, input().split()))
ans = 0
k = int(K / 2)
for x in X:
if x > k:
ans += (K - x) * 2
else:
ans += x * 2
print(ans)
| N = int(eval(input()))
K = int(eval(input()))
X = list(map(int, input().split()))
cnt = 0
for x in X:
if x > K // 2:
cnt += (K - x) * 2
else:
cnt += x * 2
print(cnt)
| false | 16.666667 | [
"-ans = 0",
"-k = int(K / 2)",
"+cnt = 0",
"- if x > k:",
"- ans += (K - x) * 2",
"+ if x > K // 2:",
"+ cnt += (K - x) * 2",
"- ans += x * 2",
"-print(ans)",
"+ cnt += x * 2",
"+print(cnt)"
] | false | 0.037206 | 0.03817 | 0.974726 | [
"s615292569",
"s996309585"
] |
u060793972 | p03050 | python | s176413653 | s905850467 | 442 | 144 | 2,940 | 9,340 | Accepted | Accepted | 67.42 | n=int(eval(input()))
p=0
for i in range(1,int(n**0.5)+2):
j,k=divmod(n-i,i)
p+=0 if k or j<=i else j
print(p) | n=int(eval(input()))
p=0
for i in range(1,int(n**0.5)+10):
if n%i==0 and n//i-1>i:
p+=n//i-1
print(p) | 6 | 6 | 116 | 112 | n = int(eval(input()))
p = 0
for i in range(1, int(n**0.5) + 2):
j, k = divmod(n - i, i)
p += 0 if k or j <= i else j
print(p)
| n = int(eval(input()))
p = 0
for i in range(1, int(n**0.5) + 10):
if n % i == 0 and n // i - 1 > i:
p += n // i - 1
print(p)
| false | 0 | [
"-for i in range(1, int(n**0.5) + 2):",
"- j, k = divmod(n - i, i)",
"- p += 0 if k or j <= i else j",
"+for i in range(1, int(n**0.5) + 10):",
"+ if n % i == 0 and n // i - 1 > i:",
"+ p += n // i - 1"
] | false | 0.554219 | 0.20946 | 2.645936 | [
"s176413653",
"s905850467"
] |
u631277801 | p03503 | python | s658968331 | s392543257 | 224 | 80 | 3,064 | 3,064 | Accepted | Accepted | 64.29 | 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.rea... | 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.re... | 40 | 30 | 1,103 | 778 | 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():
... | 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 | 25 | [
"-def dfs(depth: int, inbis: str, f: list, p: list):",
"- if depth != 10:",
"- return max(dfs(depth + 1, inbis + \"1\", f, p), dfs(depth + 1, inbis + \"0\", f, p))",
"- else:",
"- if inbis.count(\"1\") == 0:",
"- return -(10**10)",
"- else:",
"- biz = [... | false | 0.041836 | 0.044593 | 0.938194 | [
"s658968331",
"s392543257"
] |
u644907318 | p02786 | python | s300237509 | s893277407 | 174 | 113 | 38,384 | 61,672 | Accepted | Accepted | 35.06 | def f(n):
if n==1:
return 1
return 1+2*f(n//2)
print((f(int(eval(input()))))) | memo = {}
def f(n):
if n==1:
return 1
if n in memo:
return memo[n]
memo[n] = 1+2*f(n//2)
return memo[n]
print((f(int(eval(input()))))) | 5 | 9 | 89 | 166 | def f(n):
if n == 1:
return 1
return 1 + 2 * f(n // 2)
print((f(int(eval(input())))))
| memo = {}
def f(n):
if n == 1:
return 1
if n in memo:
return memo[n]
memo[n] = 1 + 2 * f(n // 2)
return memo[n]
print((f(int(eval(input())))))
| false | 44.444444 | [
"+memo = {}",
"+",
"+",
"- return 1 + 2 * f(n // 2)",
"+ if n in memo:",
"+ return memo[n]",
"+ memo[n] = 1 + 2 * f(n // 2)",
"+ return memo[n]"
] | false | 0.04191 | 0.037298 | 1.123644 | [
"s300237509",
"s893277407"
] |
u645250356 | p04013 | python | s076723387 | s172464478 | 586 | 515 | 131,928 | 118,872 | Accepted | Accepted | 12.12 | from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
de... | from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
de... | 28 | 28 | 927 | 896 | from collections import Counter, defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpl_str():
return list(sys.stdin.... | from collections import Counter, defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpl_str():
return list(sys.stdin.... | false | 0 | [
"-dp = [[[0 for _ in range(n + 5)] for i in range(3005)] for j in range(n + 5)]",
"+nx = n * max(max(x), A)",
"+dp = [[[0 for _ in range(n + 5)] for i in range(nx + 1)] for j in range(n + 5)]",
"- for j in range(sum(x) + 1):",
"+ for j in range(nx + 1):",
"-# for i in range(n+1):",
"-# print(d... | false | 0.100758 | 0.048542 | 2.075693 | [
"s076723387",
"s172464478"
] |
u011062360 | p02773 | python | s838751094 | s739195751 | 704 | 536 | 35,572 | 46,336 | Accepted | Accepted | 23.86 | from collections import Counter
n = int(eval(input()))
list_S = [eval(input()) for _ in range(n)]
dic_S = Counter(list_S)
m = 0
for i in list(dic_S.values()):
m = max(m, i)
ans = []
for k, v in list(dic_S.items()):
if v == m:
ans.append(k)
ans.sort()
for s in ans:
print(s) | from collections import Counter
n = int(eval(input()))
list_S = []
ans = []
for _ in range(n):
list_S.append(str(eval(input())))
list_S = Counter(list_S)
list_S = list(list_S.items())
list_S.sort(key=lambda x:x[1], reverse=True)
for l in list_S:
if list_S[0][1] == l[1]:
ans.append(l[0])
... | 14 | 17 | 281 | 347 | from collections import Counter
n = int(eval(input()))
list_S = [eval(input()) for _ in range(n)]
dic_S = Counter(list_S)
m = 0
for i in list(dic_S.values()):
m = max(m, i)
ans = []
for k, v in list(dic_S.items()):
if v == m:
ans.append(k)
ans.sort()
for s in ans:
print(s)
| from collections import Counter
n = int(eval(input()))
list_S = []
ans = []
for _ in range(n):
list_S.append(str(eval(input())))
list_S = Counter(list_S)
list_S = list(list_S.items())
list_S.sort(key=lambda x: x[1], reverse=True)
for l in list_S:
if list_S[0][1] == l[1]:
ans.append(l[0])
ans.sort()
for... | false | 17.647059 | [
"-list_S = [eval(input()) for _ in range(n)]",
"-dic_S = Counter(list_S)",
"-m = 0",
"-for i in list(dic_S.values()):",
"- m = max(m, i)",
"+list_S = []",
"-for k, v in list(dic_S.items()):",
"- if v == m:",
"- ans.append(k)",
"+for _ in range(n):",
"+ list_S.append(str(eval(inpu... | false | 0.046027 | 0.038232 | 1.203884 | [
"s838751094",
"s739195751"
] |
u335278042 | p03262 | python | s816655007 | s660938013 | 92 | 69 | 14,252 | 14,252 | Accepted | Accepted | 25 | N,X = list(map(int, input().split()))
def myabs(i):
return abs(i-X)
xlis = list(map(myabs, list(map(int, input().split()))))
from fractions import gcd
res = xlis[0]
for i in xlis:
if i%res == 0:
continue
res = gcd(i,res)
print(res) | N,X = list(map(int, input().split()))
def myabs(i):
return abs(i-X)
xlis = list(map(myabs, list(map(int, input().split()))))
def gcd(a, b):
while b != 0:
a, b = b, a%b
return a
res = xlis[0]
for i in xlis:
if i%res == 0:
continue
res = gcd(i,res)
print(res) | 14 | 18 | 255 | 302 | N, X = list(map(int, input().split()))
def myabs(i):
return abs(i - X)
xlis = list(map(myabs, list(map(int, input().split()))))
from fractions import gcd
res = xlis[0]
for i in xlis:
if i % res == 0:
continue
res = gcd(i, res)
print(res)
| N, X = list(map(int, input().split()))
def myabs(i):
return abs(i - X)
xlis = list(map(myabs, list(map(int, input().split()))))
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
res = xlis[0]
for i in xlis:
if i % res == 0:
continue
res = gcd(i, res)
print(res)
| false | 22.222222 | [
"-from fractions import gcd",
"+",
"+",
"+def gcd(a, b):",
"+ while b != 0:",
"+ a, b = b, a % b",
"+ return a",
"+"
] | false | 0.049133 | 0.037926 | 1.295472 | [
"s816655007",
"s660938013"
] |
u638795007 | p03472 | python | s570729645 | s243710672 | 310 | 275 | 49,756 | 42,460 | Accepted | Accepted | 11.29 | import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
N, H = LI()
a = [0]*N; b = [0]*N
for i in range(N):
a[i], b[i] = LI()
maxa = max(a)
usefulb = []
for i in b:
if i>maxa:
usefulb.append(i)
#... | def examA():
C = [SI()for _ in range(3)]
ans = C[0][0]+C[1][1]+C[2][2]
print(ans)
return
def examB():
N, M = LI()
P = [0]*N
S = [LSI()for _ in range(M)]
pena = 0
ac = set()
for p,s in S:
p = int(p)-1
if s=="WA":
P[p] += 1
else:... | 30 | 104 | 564 | 2,147 | import sys
def I():
return int(sys.stdin.readline())
def LI():
return list(map(int, sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float("inf")
N, H = LI()
a = [0] * N
b = [0] * N
for i in range(N):
a[i], b[i] = LI()
maxa = max(a)
usefulb = []
for i in b:
if i > maxa:
usefulb.append(... | def examA():
C = [SI() for _ in range(3)]
ans = C[0][0] + C[1][1] + C[2][2]
print(ans)
return
def examB():
N, M = LI()
P = [0] * N
S = [LSI() for _ in range(M)]
pena = 0
ac = set()
for p, s in S:
p = int(p) - 1
if s == "WA":
P[p] += 1
else:
... | false | 71.153846 | [
"-import sys",
"+def examA():",
"+ C = [SI() for _ in range(3)]",
"+ ans = C[0][0] + C[1][1] + C[2][2]",
"+ print(ans)",
"+ return",
"+",
"+",
"+def examB():",
"+ N, M = LI()",
"+ P = [0] * N",
"+ S = [LSI() for _ in range(M)]",
"+ pena = 0",
"+ ac = set()",
"+... | false | 0.037075 | 0.040057 | 0.925539 | [
"s570729645",
"s243710672"
] |
u824237520 | p03078 | python | s288022043 | s709089536 | 834 | 275 | 151,768 | 48,540 | Accepted | Accepted | 67.03 | x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ab = []
for s in a:
for t in b:
ab.append(s + t)
ab.sort(reverse=True)
c.sort(reverse=True)
ans = []
for i in range(min(k, len(ab))):
... | x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = []
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
for s in range(x):
for t in range(y):
for u in range(z):
... | 24 | 22 | 428 | 480 | x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ab = []
for s in a:
for t in b:
ab.append(s + t)
ab.sort(reverse=True)
c.sort(reverse=True)
ans = []
for i in range(min(k, len(ab))):
for u in c:
... | x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = []
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
for s in range(x):
for t in range(y):
for u in range(z):
if (s + 1) * (... | false | 8.333333 | [
"-ab = []",
"-for s in a:",
"- for t in b:",
"- ab.append(s + t)",
"-ab.sort(reverse=True)",
"+ans = []",
"+a.sort(reverse=True)",
"+b.sort(reverse=True)",
"-ans = []",
"-for i in range(min(k, len(ab))):",
"- for u in c:",
"- ans.append(ab[i] + u)",
"+for s in range(x):",... | false | 0.037853 | 0.054521 | 0.694291 | [
"s288022043",
"s709089536"
] |
u157020659 | p02631 | python | s311211749 | s829110781 | 171 | 149 | 31,504 | 31,512 | Accepted | Accepted | 12.87 | n = int(input())
a = list(map(int, input().split()))
s = 0
for i in a:
s = s ^ i
ans = []
for i in a:
ans.append(s ^ i)
print(*ans, sep=' ')
| n = int(input())
a = list(map(int, input().split()))
s = 0
for i in a:
s = s ^ i
ans = [s ^ i for i in a]
print(*ans, sep=' ')
| 9 | 7 | 156 | 136 | n = int(input())
a = list(map(int, input().split()))
s = 0
for i in a:
s = s ^ i
ans = []
for i in a:
ans.append(s ^ i)
print(*ans, sep=" ")
| n = int(input())
a = list(map(int, input().split()))
s = 0
for i in a:
s = s ^ i
ans = [s ^ i for i in a]
print(*ans, sep=" ")
| false | 22.222222 | [
"-ans = []",
"-for i in a:",
"- ans.append(s ^ i)",
"+ans = [s ^ i for i in a]"
] | false | 0.04496 | 0.044872 | 1.001957 | [
"s311211749",
"s829110781"
] |
u498487134 | p02831 | python | s955053722 | s242422004 | 300 | 64 | 66,156 | 62,212 | Accepted | Accepted | 78.67 | import fractions
A, B = list(map(int, input().split()))
f=fractions.gcd(A,B)
print((int(A*B/f)))
| import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
from math import gcd
a,b=MI()
print(((a*b)//gcd(a,b)))
main()
| 6 | 15 | 96 | 281 | import fractions
A, B = list(map(int, input().split()))
f = fractions.gcd(A, B)
print((int(A * B / f)))
| import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
from math import gcd
a, b = MI()
print(((a * b) // gcd(a, b)))
main()
| false | 60 | [
"-import fractions",
"+import sys",
"-A, B = list(map(int, input().split()))",
"-f = fractions.gcd(A, B)",
"-print((int(A * B / f)))",
"+input = sys.stdin.readline",
"+",
"+",
"+def I():",
"+ return int(eval(input()))",
"+",
"+",
"+def MI():",
"+ return list(map(int, input().split())... | false | 0.043482 | 0.03604 | 1.206497 | [
"s955053722",
"s242422004"
] |
u001024152 | p02861 | python | s680455152 | s662067026 | 340 | 17 | 3,064 | 2,940 | Accepted | Accepted | 95 | from itertools import permutations
from math import sqrt
N = int(eval(input()))
xy = []
for _ in range(N):
x, y = list(map(int, input().split()))
xy.append((x, y))
_sum = 0
for p in permutations(list(range(N))):
s = p[0]
x, y = xy[s]
for i, pi in enumerate(p):
if i == 0:
... | from math import hypot
N = int(eval(input()))
XY = [tuple(map(int, input().split())) for _ in range(N)]
_sum = 0
for xi, yi in XY:
for xj, yj in XY:
_sum += hypot(xi-xj, yi-yj)
print((_sum/N))
| 25 | 11 | 468 | 210 | from itertools import permutations
from math import sqrt
N = int(eval(input()))
xy = []
for _ in range(N):
x, y = list(map(int, input().split()))
xy.append((x, y))
_sum = 0
for p in permutations(list(range(N))):
s = p[0]
x, y = xy[s]
for i, pi in enumerate(p):
if i == 0:
continu... | from math import hypot
N = int(eval(input()))
XY = [tuple(map(int, input().split())) for _ in range(N)]
_sum = 0
for xi, yi in XY:
for xj, yj in XY:
_sum += hypot(xi - xj, yi - yj)
print((_sum / N))
| false | 56 | [
"-from itertools import permutations",
"-from math import sqrt",
"+from math import hypot",
"-xy = []",
"-for _ in range(N):",
"- x, y = list(map(int, input().split()))",
"- xy.append((x, y))",
"+XY = [tuple(map(int, input().split())) for _ in range(N)]",
"-for p in permutations(list(range(N))... | false | 0.137664 | 0.038742 | 3.553353 | [
"s680455152",
"s662067026"
] |
u285891772 | p03013 | python | s663705601 | s014856646 | 481 | 122 | 496,200 | 9,860 | Accepted | Accepted | 74.64 | 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
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 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
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 54 | 42 | 1,329 | 1,169 | 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
from itertools import (
accumulate,
permutations,
combinations,
combi... | 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
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 22.222222 | [
"-a = [INT() for _ in range(M)]",
"-fib_list = [0] * (N + 1)",
"-fib_list[0] = 1",
"-fib_list[1] = 1",
"-",
"-",
"-def fib(n):",
"- if n < 2:",
"- return fib_list[n]",
"- elif fib_list[n] != 0:",
"- return fib_list[n]",
"+a = deque([INT() for _ in range(M)])",
"+a.append(... | false | 0.125093 | 0.092804 | 1.347931 | [
"s663705601",
"s014856646"
] |
u057109575 | p02912 | python | s953775511 | s660688966 | 333 | 155 | 71,228 | 95,396 | Accepted | Accepted | 53.45 | from heapq import heappush, heappop
N, M, *A = list(map(int, open(0).read().split()))
q = []
for v in A:
heappush(q, -v)
for _ in range(M):
v = heappop(q)
heappush(q, -(-v // 2))
print((-sum(q)))
| from heapq import heappush, heappop
N, M, *A = list(map(int, open(0).read().split()))
q = []
for v in A:
heappush(q, -v)
for _ in range(M):
v = heappop(q)
heappush(q, -((-v) // 2))
print((-sum(q)))
| 13 | 13 | 224 | 226 | from heapq import heappush, heappop
N, M, *A = list(map(int, open(0).read().split()))
q = []
for v in A:
heappush(q, -v)
for _ in range(M):
v = heappop(q)
heappush(q, -(-v // 2))
print((-sum(q)))
| from heapq import heappush, heappop
N, M, *A = list(map(int, open(0).read().split()))
q = []
for v in A:
heappush(q, -v)
for _ in range(M):
v = heappop(q)
heappush(q, -((-v) // 2))
print((-sum(q)))
| false | 0 | [
"- heappush(q, -(-v // 2))",
"+ heappush(q, -((-v) // 2))"
] | false | 0.043095 | 0.049445 | 0.871561 | [
"s953775511",
"s660688966"
] |
u847467233 | p00534 | python | s708041408 | s311494818 | 830 | 580 | 19,124 | 19,132 | Accepted | Accepted | 30.12 | # AOJ 0611: Silk Road
# Python3 2018.7.4 bal4u
import sys
from sys import stdin
input = stdin.readline
INF = 0x7fffffff
n, m = list(map(int, input().split()))
d = [int(eval(input())) for i in range(n)]
c = [int(eval(input())) for i in range(m)]
dp = [[INF for j in range(n+1)] for i in range(m+1)]
dp[0][0]... | # AOJ 0611: Silk Road
# Python3 2018.7.4 bal4u
import sys
from sys import stdin
input = stdin.readline
INF = 0x7fffffff
n, m = list(map(int, input().split()))
d = [int(eval(input())) for i in range(n)]
c = [int(eval(input())) for i in range(m)]
dp = [[INF for j in range(n+1)] for i in range(m+1)]
dp[0][0]... | 19 | 19 | 490 | 470 | # AOJ 0611: Silk Road
# Python3 2018.7.4 bal4u
import sys
from sys import stdin
input = stdin.readline
INF = 0x7FFFFFFF
n, m = list(map(int, input().split()))
d = [int(eval(input())) for i in range(n)]
c = [int(eval(input())) for i in range(m)]
dp = [[INF for j in range(n + 1)] for i in range(m + 1)]
dp[0][0] = 0
for ... | # AOJ 0611: Silk Road
# Python3 2018.7.4 bal4u
import sys
from sys import stdin
input = stdin.readline
INF = 0x7FFFFFFF
n, m = list(map(int, input().split()))
d = [int(eval(input())) for i in range(n)]
c = [int(eval(input())) for i in range(m)]
dp = [[INF for j in range(n + 1)] for i in range(m + 1)]
dp[0][0] = 0
for ... | false | 0 | [
"- for j in range(n + 1):",
"- dp[i + 1][j] = dp[i][j]",
"+ dp[i + 1] = dp[i][0 : n + 1]"
] | false | 0.038944 | 0.037507 | 1.038302 | [
"s708041408",
"s311494818"
] |
u729133443 | p03573 | python | s667143394 | s669617774 | 164 | 27 | 38,384 | 9,008 | Accepted | Accepted | 83.54 | print((eval(input().replace(' ','^')))) | print((eval(input().replace(*' ^')))) | 1 | 1 | 37 | 35 | print((eval(input().replace(" ", "^"))))
| print((eval(input().replace(*" ^"))))
| false | 0 | [
"-print((eval(input().replace(\" \", \"^\"))))",
"+print((eval(input().replace(*\" ^\"))))"
] | false | 0.073223 | 0.033601 | 2.179206 | [
"s667143394",
"s669617774"
] |
u940279019 | p03211 | python | s162010990 | s356123708 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | s = eval(input())
imin = 753
for i in range(len(s)-2):
if(abs(int(s[i] + s[i+1] + s[i+2]) - 753) )< imin:
imin = abs(int(s[i] + s[i+1] + s[i+2])-753)
print(imin) | s = eval(input())
imin = 753
for i in range(len(s) - 2):
c = abs(int(s[i]+s[i+1]+s[i+2]) - 753)
if c < imin:
imin = c
print(imin) | 6 | 7 | 167 | 137 | s = eval(input())
imin = 753
for i in range(len(s) - 2):
if (abs(int(s[i] + s[i + 1] + s[i + 2]) - 753)) < imin:
imin = abs(int(s[i] + s[i + 1] + s[i + 2]) - 753)
print(imin)
| s = eval(input())
imin = 753
for i in range(len(s) - 2):
c = abs(int(s[i] + s[i + 1] + s[i + 2]) - 753)
if c < imin:
imin = c
print(imin)
| false | 14.285714 | [
"- if (abs(int(s[i] + s[i + 1] + s[i + 2]) - 753)) < imin:",
"- imin = abs(int(s[i] + s[i + 1] + s[i + 2]) - 753)",
"+ c = abs(int(s[i] + s[i + 1] + s[i + 2]) - 753)",
"+ if c < imin:",
"+ imin = c"
] | false | 0.037935 | 0.039729 | 0.954845 | [
"s162010990",
"s356123708"
] |
u214617707 | p03371 | python | s916889222 | s218487725 | 138 | 123 | 3,060 | 3,060 | Accepted | Accepted | 10.87 | a, b, c, x, y = list(map(int, input().split()))
num = float("inf")
for i in range(max(x, y) + 1):
num = min(num, a * max(0, (x - i)) + b * max(0, (y - i)) + 2 * c * i)
print(num) | A, B, C, X, Y = list(map(int, input().split()))
num = float("inf")
for i in range(0, (10 ** 5) * 2 + 1, 2):
num = min(num, max(0, X - i // 2) * A + max(0, Y - i // 2) * B + C * i)
print(num) | 5 | 5 | 180 | 192 | a, b, c, x, y = list(map(int, input().split()))
num = float("inf")
for i in range(max(x, y) + 1):
num = min(num, a * max(0, (x - i)) + b * max(0, (y - i)) + 2 * c * i)
print(num)
| A, B, C, X, Y = list(map(int, input().split()))
num = float("inf")
for i in range(0, (10**5) * 2 + 1, 2):
num = min(num, max(0, X - i // 2) * A + max(0, Y - i // 2) * B + C * i)
print(num)
| false | 0 | [
"-a, b, c, x, y = list(map(int, input().split()))",
"+A, B, C, X, Y = list(map(int, input().split()))",
"-for i in range(max(x, y) + 1):",
"- num = min(num, a * max(0, (x - i)) + b * max(0, (y - i)) + 2 * c * i)",
"+for i in range(0, (10**5) * 2 + 1, 2):",
"+ num = min(num, max(0, X - i // 2) * A + ... | false | 0.070645 | 0.22873 | 0.308858 | [
"s916889222",
"s218487725"
] |
u489124637 | p02659 | python | s166075054 | s584671410 | 33 | 21 | 10,524 | 9,036 | Accepted | Accepted | 36.36 | #有理数演算
from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print((floor(a * b))) | #正しい丸め処理
a, b = input().split()
a = int(a)
b = round(float(b) * 100)
print((a * b // 100)) | 9 | 6 | 140 | 94 | # 有理数演算
from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print((floor(a * b)))
| # 正しい丸め処理
a, b = input().split()
a = int(a)
b = round(float(b) * 100)
print((a * b // 100))
| false | 33.333333 | [
"-# 有理数演算",
"-from math import floor",
"-from fractions import Fraction",
"-",
"+# 正しい丸め処理",
"-b = Fraction(b)",
"-print((floor(a * b)))",
"+b = round(float(b) * 100)",
"+print((a * b // 100))"
] | false | 0.044931 | 0.070413 | 0.638109 | [
"s166075054",
"s584671410"
] |
u926181697 | p03127 | python | s675110317 | s689231885 | 175 | 85 | 14,252 | 14,252 | Accepted | Accepted | 51.43 | N = int(eval(input()))
L = list(map(int,input().split()))
L = sorted(L)
while True:
for i in range(1,len(L)):
L[i] %= L[0]
L= [x for x in L if x!=0]
L= sorted(L)
if len(L) == 1:
break
print((L[0]))
| def gcd(x , y):
if x < y:
x , y = y , x
if y == 0:
return x
r = x % y
return gcd(y , r)
N = int(eval(input()))
L = list(map(int,input().split()))
ans = L[0]
for i in range(len(L)):
ans = gcd( ans ,L[i] )
print(ans)
| 11 | 14 | 233 | 259 | N = int(eval(input()))
L = list(map(int, input().split()))
L = sorted(L)
while True:
for i in range(1, len(L)):
L[i] %= L[0]
L = [x for x in L if x != 0]
L = sorted(L)
if len(L) == 1:
break
print((L[0]))
| def gcd(x, y):
if x < y:
x, y = y, x
if y == 0:
return x
r = x % y
return gcd(y, r)
N = int(eval(input()))
L = list(map(int, input().split()))
ans = L[0]
for i in range(len(L)):
ans = gcd(ans, L[i])
print(ans)
| false | 21.428571 | [
"+def gcd(x, y):",
"+ if x < y:",
"+ x, y = y, x",
"+ if y == 0:",
"+ return x",
"+ r = x % y",
"+ return gcd(y, r)",
"+",
"+",
"-L = sorted(L)",
"-while True:",
"- for i in range(1, len(L)):",
"- L[i] %= L[0]",
"- L = [x for x in L if x != 0]",
"- ... | false | 0.120332 | 0.038214 | 3.148848 | [
"s675110317",
"s689231885"
] |
u729133443 | p02560 | python | s671974280 | s175355467 | 120 | 104 | 9,052 | 8,988 | Accepted | Accepted | 13.33 | code = r"""
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
cdef extern from "/opt/atcoder-stl/atcoder/math.hpp" namespace "atcoder":
cdef long long floor_sum... | code = r"""
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
from libc.stdio cimport getchar, printf
cdef extern from "/opt/atcoder-stl/atcoder/math.hpp" namespace "... | 22 | 29 | 742 | 907 | code = r"""
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
cdef extern from "/opt/atcoder-stl/atcoder/math.hpp" namespace "atcoder":
cdef long long floor_sum(long lo... | code = r"""
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
from libc.stdio cimport getchar, printf
cdef extern from "/opt/atcoder-stl/atcoder/math.hpp" namespace "atcode... | false | 24.137931 | [
"+from libc.stdio cimport getchar, printf",
"-from libc.stdio cimport scanf, printf",
"-cdef int t, i",
"+cdef long long cin() nogil:",
"+ cdef long long b, c = 0",
"+ while 1:",
"+ b = getchar() - 48",
"+ if b < 0: break",
"+ c = c * 10 + b",
"+ return c",
"+cdef i... | false | 0.035176 | 0.036031 | 0.976257 | [
"s671974280",
"s175355467"
] |
u955248595 | p02552 | python | s470109807 | s218493931 | 28 | 22 | 9,016 | 9,092 | Accepted | Accepted | 21.43 | print(([1,0][eval(input())=='1'])) | print((1-int(eval(input())))) | 1 | 1 | 26 | 21 | print(([1, 0][eval(input()) == "1"]))
| print((1 - int(eval(input()))))
| false | 0 | [
"-print(([1, 0][eval(input()) == \"1\"]))",
"+print((1 - int(eval(input()))))"
] | false | 0.031607 | 0.139324 | 0.226863 | [
"s470109807",
"s218493931"
] |
u094191970 | p02755 | python | s136141386 | s959978327 | 465 | 26 | 3,060 | 2,940 | Accepted | Accepted | 94.41 | a,b=list(map(int,input().split()))
n=1
while n<=10**6:
if int(n*0.08)==a and int(n*0.1)==b:
print(n)
exit()
else:
n+=1
print((-1)) | a,b=list(map(int,input().split()))
n=1
while n<=2*10**4:
if int(n*0.08)==a and int(n*0.1)==b:
print(n)
exit()
else:
n+=1
print((-1)) | 10 | 10 | 148 | 150 | a, b = list(map(int, input().split()))
n = 1
while n <= 10**6:
if int(n * 0.08) == a and int(n * 0.1) == b:
print(n)
exit()
else:
n += 1
print((-1))
| a, b = list(map(int, input().split()))
n = 1
while n <= 2 * 10**4:
if int(n * 0.08) == a and int(n * 0.1) == b:
print(n)
exit()
else:
n += 1
print((-1))
| false | 0 | [
"-while n <= 10**6:",
"+while n <= 2 * 10**4:"
] | false | 0.64508 | 0.040021 | 16.118377 | [
"s136141386",
"s959978327"
] |
u780342333 | p02255 | python | s917748249 | s924744418 | 30 | 20 | 7,720 | 5,976 | Accepted | Accepted | 33.33 | N = int(eval(input()))
A = [int (x) for x in input().split(" ")]
for i in range(1, N):
print((" ".join([str(x) for x in A])))
v = A[i]
j = i -1
while j>=0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print((" ".join([str(x) for x in A]))) | #for i = 1 to A.length-1
# key = A[i]
# /* insert A[i] into the sorted sequence A[0,...,j-1] */
#j = i - 1
# while j >= 0 and A[j] > key
# A[j+1] = A[j]
# j--
# A[j+1] = key
n = int(eval(input()))
nums = list(map(int, input().split()))
for i in range(0, n):
key = nums[i]
j... | 13 | 19 | 279 | 446 | N = int(eval(input()))
A = [int(x) for x in input().split(" ")]
for i in range(1, N):
print((" ".join([str(x) for x in A])))
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print((" ".join([str(x) for x in A])))
| # for i = 1 to A.length-1
# key = A[i]
# /* insert A[i] into the sorted sequence A[0,...,j-1] */
# j = i - 1
# while j >= 0 and A[j] > key
# A[j+1] = A[j]
# j--
# A[j+1] = key
n = int(eval(input()))
nums = list(map(int, input().split()))
for i in range(0, n):
key = nums[i]
j = i - 1
... | false | 31.578947 | [
"-N = int(eval(input()))",
"-A = [int(x) for x in input().split(\" \")]",
"-for i in range(1, N):",
"- print((\" \".join([str(x) for x in A])))",
"- v = A[i]",
"+# for i = 1 to A.length-1",
"+# key = A[i]",
"+# /* insert A[i] into the sorted sequence A[0,...,j-1] */",
"+# j = i - 1",
"... | false | 0.123858 | 0.109358 | 1.132589 | [
"s917748249",
"s924744418"
] |
u451017206 | p03039 | python | s557316850 | s543593745 | 801 | 179 | 72,924 | 38,768 | Accepted | Accepted | 77.65 | from math import factorial
N, M, K = list(map(int, input().split()))
mod = 10 ** 9 + 7
def Comb(N, K):
a = factorial(N) % mod
b = factorial(K) % mod
c = factorial(N-K) % mod
return (a * pow(b, mod-2, mod) * pow(c, mod-2, mod)) % mod
c = Comb(N*M-2, K-2)
ans = 0
for d in range(M):
... | from math import factorial
N, M, K = list(map(int, input().split()))
mod = 10 ** 9 + 7
def f(N):
a = 1
for i in range(1, N+1):
a *= i
a %= mod
return a % mod
def Comb(N, K):
a = f(N)
b = f(K)
c = f(N-K)
return (a * pow(b, mod-2, mod) * pow(c, mod-2, mod)) %... | 28 | 35 | 474 | 539 | from math import factorial
N, M, K = list(map(int, input().split()))
mod = 10**9 + 7
def Comb(N, K):
a = factorial(N) % mod
b = factorial(K) % mod
c = factorial(N - K) % mod
return (a * pow(b, mod - 2, mod) * pow(c, mod - 2, mod)) % mod
c = Comb(N * M - 2, K - 2)
ans = 0
for d in range(M):
ans ... | from math import factorial
N, M, K = list(map(int, input().split()))
mod = 10**9 + 7
def f(N):
a = 1
for i in range(1, N + 1):
a *= i
a %= mod
return a % mod
def Comb(N, K):
a = f(N)
b = f(K)
c = f(N - K)
return (a * pow(b, mod - 2, mod) * pow(c, mod - 2, mod)) % mod
c... | false | 20 | [
"+def f(N):",
"+ a = 1",
"+ for i in range(1, N + 1):",
"+ a *= i",
"+ a %= mod",
"+ return a % mod",
"+",
"+",
"- a = factorial(N) % mod",
"- b = factorial(K) % mod",
"- c = factorial(N - K) % mod",
"+ a = f(N)",
"+ b = f(K)",
"+ c = f(N - K)"
] | false | 0.041063 | 0.038946 | 1.054358 | [
"s557316850",
"s543593745"
] |
u295178043 | p02713 | python | s838077335 | s179958930 | 638 | 149 | 9,388 | 68,520 | Accepted | Accepted | 76.65 | K = int(eval(input()))
g2 = [[0]*(K+1) for _ in range(K+1)]
def gcd(a, b):
if g2[a][b] > 0:
return g2[a][b]
tmpa = a
tmpb = b
while b > 0:
a,b = b, a%b
g2[tmpa][tmpb] = a
g2[tmpb][tmpa] = a
return a
def gcd_3(a,b,c):
g = gcd(a,b)
g = gcd(g,c)
re... | K = int(eval(input()))
g2 = [[0]*(K+1) for _ in range(K+1)]
def gcd(a, b):
if g2[a][b] > 0:
return g2[a][b]
tmpa = a
tmpb = b
while b > 0:
a,b = b, a%b
g2[tmpa][tmpb] = a
g2[tmpb][tmpa] = a
return a
def gcd_3(a,b,c):
g = gcd(a,b)
g = gcd(g,c)
re... | 30 | 26 | 565 | 463 | K = int(eval(input()))
g2 = [[0] * (K + 1) for _ in range(K + 1)]
def gcd(a, b):
if g2[a][b] > 0:
return g2[a][b]
tmpa = a
tmpb = b
while b > 0:
a, b = b, a % b
g2[tmpa][tmpb] = a
g2[tmpb][tmpa] = a
return a
def gcd_3(a, b, c):
g = gcd(a, b)
g = gcd(g, c)
retu... | K = int(eval(input()))
g2 = [[0] * (K + 1) for _ in range(K + 1)]
def gcd(a, b):
if g2[a][b] > 0:
return g2[a][b]
tmpa = a
tmpb = b
while b > 0:
a, b = b, a % b
g2[tmpa][tmpb] = a
g2[tmpb][tmpa] = a
return a
def gcd_3(a, b, c):
g = gcd(a, b)
g = gcd(g, c)
retu... | false | 13.333333 | [
"- sm += a",
"- for b in range(a + 1, K + 1):",
"- for c in range(b + 1, K + 1):",
"- sm += gcd_3(a, b, c) * 6",
"- if a != b:",
"- sm += gcd(a, b) * 3",
"+ for c in range(1, K + 1):",
"+ sm += gcd_3(a, b, c)"
] | false | 0.08804 | 0.046039 | 1.912301 | [
"s838077335",
"s179958930"
] |
u222668979 | p02615 | python | s266535844 | s455686855 | 161 | 138 | 32,312 | 123,960 | Accepted | Accepted | 14.29 | from collections import deque
n = int(eval(input()))
a = sorted(map(int, input().split()), reverse=True)
ans, cnt = 0, deque([a[0]])
for i in a[1:]:
ans += cnt.popleft()
cnt.extend([i,i])
print(ans)
| n = int(eval(input()))
a = sorted(map(int, input().split()), reverse=True)
ans, que, cnt = 0, [a[0]], 0
for i in a[1:]:
ans += que[cnt]
que += [i, i]
cnt += 1
print(ans)
| 10 | 9 | 212 | 185 | from collections import deque
n = int(eval(input()))
a = sorted(map(int, input().split()), reverse=True)
ans, cnt = 0, deque([a[0]])
for i in a[1:]:
ans += cnt.popleft()
cnt.extend([i, i])
print(ans)
| n = int(eval(input()))
a = sorted(map(int, input().split()), reverse=True)
ans, que, cnt = 0, [a[0]], 0
for i in a[1:]:
ans += que[cnt]
que += [i, i]
cnt += 1
print(ans)
| false | 10 | [
"-from collections import deque",
"-",
"-ans, cnt = 0, deque([a[0]])",
"+ans, que, cnt = 0, [a[0]], 0",
"- ans += cnt.popleft()",
"- cnt.extend([i, i])",
"+ ans += que[cnt]",
"+ que += [i, i]",
"+ cnt += 1"
] | false | 0.045967 | 0.046264 | 0.993586 | [
"s266535844",
"s455686855"
] |
u934442292 | p02773 | python | s854071612 | s992235807 | 435 | 328 | 35,928 | 35,932 | Accepted | Accepted | 24.6 | import sys
from collections import Counter
input = sys.stdin.readline
def main():
N = int(input())
S = [""] * N
for i in range(N):
S[i] = input().rstrip()
c = Counter(S)
max_v = max(c.values())
ans = [k for k, v in c.items() if v == max_v]
ans.sort()
print(*... | import sys
from collections import Counter
input = sys.stdin.readline
def main():
N = int(eval(input()))
S = [""] * N
for i in range(N):
S[i] = input().rstrip()
c = Counter(S)
max_v = max(c.values())
ans = [k for k, v in list(c.items()) if v == max_v]
ans.sort()
... | 22 | 22 | 379 | 379 | import sys
from collections import Counter
input = sys.stdin.readline
def main():
N = int(input())
S = [""] * N
for i in range(N):
S[i] = input().rstrip()
c = Counter(S)
max_v = max(c.values())
ans = [k for k, v in c.items() if v == max_v]
ans.sort()
print(*ans, sep="\n")
if... | import sys
from collections import Counter
input = sys.stdin.readline
def main():
N = int(eval(input()))
S = [""] * N
for i in range(N):
S[i] = input().rstrip()
c = Counter(S)
max_v = max(c.values())
ans = [k for k, v in list(c.items()) if v == max_v]
ans.sort()
print(("\n".jo... | false | 0 | [
"- N = int(input())",
"+ N = int(eval(input()))",
"- ans = [k for k, v in c.items() if v == max_v]",
"+ ans = [k for k, v in list(c.items()) if v == max_v]",
"- print(*ans, sep=\"\\n\")",
"+ print((\"\\n\".join(ans)))"
] | false | 0.034217 | 0.042025 | 0.814198 | [
"s854071612",
"s992235807"
] |
u345966487 | p03355 | python | s388303284 | s666225461 | 48 | 32 | 3,060 | 4,464 | Accepted | Accepted | 33.33 | s=eval(input());k=int(eval(input()));q=[]
for i in range(len(s)):
for j in range(k):x=s[i:i+j+1];q=q if x in q else sorted(q+[x])[:k]
print((q[-1])) | s=eval(input());k=int(eval(input()));print((sorted({s[i:i+j+1]for i in range(len(s))for j in range(k)})[k-1])) | 4 | 1 | 138 | 96 | s = eval(input())
k = int(eval(input()))
q = []
for i in range(len(s)):
for j in range(k):
x = s[i : i + j + 1]
q = q if x in q else sorted(q + [x])[:k]
print((q[-1]))
| s = eval(input())
k = int(eval(input()))
print((sorted({s[i : i + j + 1] for i in range(len(s)) for j in range(k)})[k - 1]))
| false | 75 | [
"-q = []",
"-for i in range(len(s)):",
"- for j in range(k):",
"- x = s[i : i + j + 1]",
"- q = q if x in q else sorted(q + [x])[:k]",
"-print((q[-1]))",
"+print((sorted({s[i : i + j + 1] for i in range(len(s)) for j in range(k)})[k - 1]))"
] | false | 0.047065 | 0.048651 | 0.967398 | [
"s388303284",
"s666225461"
] |
u832039789 | p03073 | python | s837619777 | s950570502 | 53 | 33 | 3,188 | 4,256 | Accepted | Accepted | 37.74 | s=eval(input())
n=len(s)
a=sum(i%2^int(s[i])for i in range(n))
print((min(a,n-a))) | *s,=list(map(int,eval(input())))
n=len(s)
a=sum(s[::2])+n//2-sum(s[1::2])
print((min(a,n-a))) | 4 | 4 | 77 | 82 | s = eval(input())
n = len(s)
a = sum(i % 2 ^ int(s[i]) for i in range(n))
print((min(a, n - a)))
| (*s,) = list(map(int, eval(input())))
n = len(s)
a = sum(s[::2]) + n // 2 - sum(s[1::2])
print((min(a, n - a)))
| false | 0 | [
"-s = eval(input())",
"+(*s,) = list(map(int, eval(input())))",
"-a = sum(i % 2 ^ int(s[i]) for i in range(n))",
"+a = sum(s[::2]) + n // 2 - sum(s[1::2])"
] | false | 0.106152 | 0.042854 | 2.477066 | [
"s837619777",
"s950570502"
] |
u086503932 | p03546 | python | s157296885 | s248493863 | 203 | 82 | 40,428 | 73,524 | Accepted | Accepted | 59.61 | #!/usr/bin/env python3
def main():
H, W = list(map(int, input().split()))
INF = 10**12
c = [None for _ in range(10)]
for i in range(10):
c[i] = list(map(int, input().split()))
for k in range(10):
for i in range(10):
for j in range(10):
c[i]... | from heapq import heappop, heappush
H, W = list(map(int, input().split()))
c = [list(map(int, input().split())) for _ in range(10)]
# Dijkstra法で1からの距離を求める
INF = 10**12
q = [(0,1)] # 始点のコストとindex
d = [INF] * 10
d[1] = 0
while len(q) > 0:
cost, u = heappop(q)
#print(u,c[u])
for v in range(10... | 25 | 35 | 587 | 739 | #!/usr/bin/env python3
def main():
H, W = list(map(int, input().split()))
INF = 10**12
c = [None for _ in range(10)]
for i in range(10):
c[i] = list(map(int, input().split()))
for k in range(10):
for i in range(10):
for j in range(10):
c[i][j] = min(c[i][j... | from heapq import heappop, heappush
H, W = list(map(int, input().split()))
c = [list(map(int, input().split())) for _ in range(10)]
# Dijkstra法で1からの距離を求める
INF = 10**12
q = [(0, 1)] # 始点のコストとindex
d = [INF] * 10
d[1] = 0
while len(q) > 0:
cost, u = heappop(q)
# print(u,c[u])
for v in range(10):
if ... | false | 28.571429 | [
"-#!/usr/bin/env python3",
"-def main():",
"- H, W = list(map(int, input().split()))",
"- INF = 10**12",
"- c = [None for _ in range(10)]",
"- for i in range(10):",
"- c[i] = list(map(int, input().split()))",
"- for k in range(10):",
"- for i in range(10):",
"- ... | false | 0.072523 | 0.073984 | 0.980245 | [
"s157296885",
"s248493863"
] |
u254871849 | p02954 | python | s075015721 | s694646389 | 155 | 102 | 6,896 | 9,084 | Accepted | Accepted | 34.19 | # 2019-11-16 10:55:08(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
... | import sys
s = sys.stdin.readline().rstrip()
n = len(s)
s += 'R'
def main():
l = []
for i in range(1, n):
if s[i] == 'L':
if s[i-1] == 'R':
ls = i
if s[i+1] == 'R':
lg = i
l.append((ls, lg))
res = [0] * n
... | 39 | 34 | 1,245 | 649 | # 2019-11-16 10:55:08(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import ... | import sys
s = sys.stdin.readline().rstrip()
n = len(s)
s += "R"
def main():
l = []
for i in range(1, n):
if s[i] == "L":
if s[i - 1] == "R":
ls = i
if s[i + 1] == "R":
lg = i
l.append((ls, lg))
res = [0] * n
j = 0
ls... | false | 12.820513 | [
"-# 2019-11-16 10:55:08(JST)",
"-# import collections",
"-# import math",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-# import itertools",
"-# from functools import reduce",
"-# import operator as op",
"-# fro... | false | 0.067806 | 0.03642 | 1.861759 | [
"s075015721",
"s694646389"
] |
u303039933 | p02720 | python | s380509689 | s591868348 | 279 | 94 | 62,572 | 14,860 | Accepted | Accepted | 66.31 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner():
... | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal
... | 132 | 146 | 2,741 | 3,176 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner:
@staticmethod
d... | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal
class Scanner:
... | false | 9.589041 | [
"+from collections import deque",
"-from decimal import *",
"+import decimal",
"- return [eval(input()) for i in range(n)]",
"+ return [Scanner.string() for i in range(n)]",
"- return [int(eval(input())) for i in range(n)]",
"+ return [Scanner.int() for i in range(n)]",
"+ ... | false | 0.047319 | 0.100681 | 0.469986 | [
"s380509689",
"s591868348"
] |
u874723578 | p03103 | python | s435868647 | s807643818 | 830 | 204 | 64,984 | 25,828 | Accepted | Accepted | 75.42 | n, m = list(map(int, input().split()))
A = []
B = []
for i in range(n):
x, y = list(map(int, input().split()))
A.append(x)
B.append(y)
ans = 0
for price, amount in sorted(zip(A, B)):
ans += price * min(m, amount)
m -= amount
if m <= 0:
break
print(ans) | n, m, *l= list(map(int, open(0).read().split()))
ans = 0
for price, amount in sorted(zip(l[::2], l[1::2])):
ans += price * min(m, amount)
m -= amount
if m <= 0:
break
print(ans) | 15 | 9 | 287 | 200 | n, m = list(map(int, input().split()))
A = []
B = []
for i in range(n):
x, y = list(map(int, input().split()))
A.append(x)
B.append(y)
ans = 0
for price, amount in sorted(zip(A, B)):
ans += price * min(m, amount)
m -= amount
if m <= 0:
break
print(ans)
| n, m, *l = list(map(int, open(0).read().split()))
ans = 0
for price, amount in sorted(zip(l[::2], l[1::2])):
ans += price * min(m, amount)
m -= amount
if m <= 0:
break
print(ans)
| false | 40 | [
"-n, m = list(map(int, input().split()))",
"-A = []",
"-B = []",
"-for i in range(n):",
"- x, y = list(map(int, input().split()))",
"- A.append(x)",
"- B.append(y)",
"+n, m, *l = list(map(int, open(0).read().split()))",
"-for price, amount in sorted(zip(A, B)):",
"+for price, amount in so... | false | 0.035173 | 0.042748 | 0.822801 | [
"s435868647",
"s807643818"
] |
u363610900 | p03577 | python | s974223048 | s977041372 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | s = eval(input())
print((s[0:len(s)-8])) | S = eval(input())
print((S[:-8])) | 2 | 2 | 33 | 26 | s = eval(input())
print((s[0 : len(s) - 8]))
| S = eval(input())
print((S[:-8]))
| false | 0 | [
"-s = eval(input())",
"-print((s[0 : len(s) - 8]))",
"+S = eval(input())",
"+print((S[:-8]))"
] | false | 0.046303 | 0.0447 | 1.035859 | [
"s974223048",
"s977041372"
] |
u795688372 | p02762 | python | s763137942 | s044106966 | 1,260 | 699 | 94,512 | 83,784 | Accepted | Accepted | 44.52 | N, M, K = map(int, input().split())
friend = [[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
friend[a - 1].append(b - 1)
friend[b - 1].append(a - 1)
for _ in range(K):
a, b = map(int, input().split())
block[a - 1].append(b - 1)
... | import sys
input = sys.stdin.readline
N, M, K = map(int, input().split())
friend = [[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
friend[a - 1].append(b - 1)
friend[b - 1].append(a - 1)
for _ in range(K):
a, b = map(int, input().sp... | 38 | 41 | 884 | 926 | N, M, K = map(int, input().split())
friend = [[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
friend[a - 1].append(b - 1)
friend[b - 1].append(a - 1)
for _ in range(K):
a, b = map(int, input().split())
block[a - 1].append(b - 1)
block[b - ... | import sys
input = sys.stdin.readline
N, M, K = map(int, input().split())
friend = [[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
friend[a - 1].append(b - 1)
friend[b - 1].append(a - 1)
for _ in range(K):
a, b = map(int, input().split())
bl... | false | 7.317073 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.040997 | 0.038612 | 1.061752 | [
"s763137942",
"s044106966"
] |
u225388820 | p02558 | python | s534122398 | s756621677 | 257 | 209 | 87,912 | 83,448 | Accepted | Accepted | 18.68 | import typing
class DSU:
'''
Implement (union by size) + (path compression)
Reference:
Zvi Galil and Giuseppe F. Italiano,
Data structures and algorithms for disjoint set union problems
'''
def __init__(self, n: int = 0):
self._n = n
self.parent_or_size = [-1]... | class UnionFind:
__slots__ = ["N", "root"]
def __init__(self, N):
"""
N:要素数
root:各要素の親要素の番号を格納するリスト.
ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
"""
self.N = N
self.root = [-1] * N
def __repr__(self):
return '\n'.join('{}: {}'... | 78 | 75 | 1,925 | 1,884 | import typing
class DSU:
"""
Implement (union by size) + (path compression)
Reference:
Zvi Galil and Giuseppe F. Italiano,
Data structures and algorithms for disjoint set union problems
"""
def __init__(self, n: int = 0):
self._n = n
self.parent_or_size = [-1] * n
def... | class UnionFind:
__slots__ = ["N", "root"]
def __init__(self, N):
"""
N:要素数
root:各要素の親要素の番号を格納するリスト.
ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
"""
self.N = N
self.root = [-1] * N
def __repr__(self):
return "\n".join("{}: {}".format(r, se... | false | 3.846154 | [
"-import typing",
"+class UnionFind:",
"+ __slots__ = [\"N\", \"root\"]",
"+ def __init__(self, N):",
"+ \"\"\"",
"+ N:要素数",
"+ root:各要素の親要素の番号を格納するリスト.",
"+ ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.",
"+ \"\"\"",
"+ self.N = N",
"+ sel... | false | 0.04262 | 0.03666 | 1.162601 | [
"s534122398",
"s756621677"
] |
u843318925 | p03448 | python | s567923415 | s970602169 | 51 | 38 | 3,060 | 3,064 | Accepted | Accepted | 25.49 | a, b, c, x = list(map(int, [eval(input()) for i in range(4)]))
count = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if 500 * i + 100 * j + 50 * k == x:
count += 1
print(count) | a, b, c, x = list(map(int, [eval(input()) for i in range(4)]))
count = 0
for i in range(a + 1):
if 500 * i == x:
count += 1
break
elif 500 * i > x:
break
else:
for j in range(b + 1):
if 500 * i + 100 * j == x:
count += 1
... | 8 | 21 | 236 | 575 | a, b, c, x = list(map(int, [eval(input()) for i in range(4)]))
count = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if 500 * i + 100 * j + 50 * k == x:
count += 1
print(count)
| a, b, c, x = list(map(int, [eval(input()) for i in range(4)]))
count = 0
for i in range(a + 1):
if 500 * i == x:
count += 1
break
elif 500 * i > x:
break
else:
for j in range(b + 1):
if 500 * i + 100 * j == x:
count += 1
break
... | false | 61.904762 | [
"- for j in range(b + 1):",
"- for k in range(c + 1):",
"- if 500 * i + 100 * j + 50 * k == x:",
"+ if 500 * i == x:",
"+ count += 1",
"+ break",
"+ elif 500 * i > x:",
"+ break",
"+ else:",
"+ for j in range(b + 1):",
"+ if 50... | false | 0.076661 | 0.050824 | 1.508375 | [
"s567923415",
"s970602169"
] |
u533039576 | p03355 | python | s255566188 | s708110851 | 36 | 33 | 3,064 | 5,084 | Accepted | Accepted | 8.33 | s = str(eval(input()))
n = int(eval(input()))
cand = [str(s[0])]
for i in range(len(s)):
if len(cand) == n and s[i] > cand[-1]:
continue
for j in range(i, len(s)):
tmp = s[i:j+1]
#print(i,j, tmp, cand)
if len(cand) == n and tmp > cand[-1]:
break
i... | s = eval(input())
k = int(eval(input()))
substr = []
for n in range(1, k+1):
for i in range(len(s)-n+1):
substr.append(s[i:i+n])
substr = list(set(substr))
substr.sort()
print((substr[k-1]))
| 22 | 11 | 493 | 201 | s = str(eval(input()))
n = int(eval(input()))
cand = [str(s[0])]
for i in range(len(s)):
if len(cand) == n and s[i] > cand[-1]:
continue
for j in range(i, len(s)):
tmp = s[i : j + 1]
# print(i,j, tmp, cand)
if len(cand) == n and tmp > cand[-1]:
break
if tmp in... | s = eval(input())
k = int(eval(input()))
substr = []
for n in range(1, k + 1):
for i in range(len(s) - n + 1):
substr.append(s[i : i + n])
substr = list(set(substr))
substr.sort()
print((substr[k - 1]))
| false | 50 | [
"-s = str(eval(input()))",
"-n = int(eval(input()))",
"-cand = [str(s[0])]",
"-for i in range(len(s)):",
"- if len(cand) == n and s[i] > cand[-1]:",
"- continue",
"- for j in range(i, len(s)):",
"- tmp = s[i : j + 1]",
"- # print(i,j, tmp, cand)",
"- if len(cand) ... | false | 0.080479 | 0.044713 | 1.799914 | [
"s255566188",
"s708110851"
] |
u401452016 | p02683 | python | s354836822 | s338884224 | 251 | 199 | 27,804 | 27,280 | Accepted | Accepted | 20.72 | #167C
def main():
import itertools as ite
import sys, numpy as np
N,M,X = list(map(int, sys.stdin.readline().split()))
CA = [np.array(list(map(int, sys.stdin.readline().split()))) for _ in range(N)]
bit = np.array(list(ite.product([0,1], repeat=N))) #式の展開
#print(CA)
#print(bit)
... | #167C bit探索
def main():
import sys, numpy as np
N,M,X =list(map(int, sys.stdin.readline().split()))
CAB = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]
#bit探索
ans = -1
for i in range(2**N):
result = np.array([0 for _ in range(M+1)])
for j ... | 27 | 22 | 750 | 589 | # 167C
def main():
import itertools as ite
import sys, numpy as np
N, M, X = list(map(int, sys.stdin.readline().split()))
CA = [np.array(list(map(int, sys.stdin.readline().split()))) for _ in range(N)]
bit = np.array(list(ite.product([0, 1], repeat=N))) # 式の展開
# print(CA)
# print(bit)
... | # 167C bit探索
def main():
import sys, numpy as np
N, M, X = list(map(int, sys.stdin.readline().split()))
CAB = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]
# bit探索
ans = -1
for i in range(2**N):
result = np.array([0 for _ in range(M + 1)])
for j in range(N): ... | false | 18.518519 | [
"-# 167C",
"+# 167C bit探索",
"- import itertools as ite",
"- CA = [np.array(list(map(int, sys.stdin.readline().split()))) for _ in range(N)]",
"- bit = np.array(list(ite.product([0, 1], repeat=N))) # 式の展開",
"- # print(CA)",
"- # print(bit)",
"+ CAB = [tuple(map(int, sys.stdin.readlin... | false | 0.303121 | 0.305185 | 0.993236 | [
"s354836822",
"s338884224"
] |
u543954314 | p02617 | python | s351172077 | s661127280 | 189 | 167 | 9,096 | 9,212 | Accepted | Accepted | 11.64 | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
def solve():
n = ni()
ans = 0
... | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
def solve():
n = ni()
ans = n * (n ... | 24 | 22 | 538 | 530 | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
def solve():
n = ni()
ans = 0
for i in ran... | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
def solve():
n = ni()
ans = n * (n + 1) ** 2 /... | false | 8.333333 | [
"- ans = 0",
"- for i in range(1, n + 1):",
"- ans += i * (n - i + 1)",
"+ ans = n * (n + 1) ** 2 // 2 - n * (n + 1) * (2 * n + 1) // 6"
] | false | 0.080363 | 0.043569 | 1.844512 | [
"s351172077",
"s661127280"
] |
u764600134 | p03645 | python | s357430812 | s447448178 | 595 | 281 | 18,936 | 18,936 | Accepted | Accepted | 52.77 | to_middle = set() # 島1から渡ることのできる島
from_middle = set() # 島Nへ渡ることのできる島
N, M = list(map(int, (input().split())))
for _ in range(M):
f, t = list(map(int, (input().split())))
if f == 1:
to_middle.add(t)
elif t == N:
from_middle.add(f)
if to_middle & from_middle:
... | from sys import stdin
input = stdin.readline
to_middle = set() # 島1から渡ることのできる島
from_middle = set() # 島Nへ渡ることのできる島
N, M = list(map(int, (input().split())))
for _ in range(M):
f, t = list(map(int, (input().split())))
if f == 1:
to_middle.add(t)
elif t == N:
from... | 14 | 17 | 360 | 409 | to_middle = set() # 島1から渡ることのできる島
from_middle = set() # 島Nへ渡ることのできる島
N, M = list(map(int, (input().split())))
for _ in range(M):
f, t = list(map(int, (input().split())))
if f == 1:
to_middle.add(t)
elif t == N:
from_middle.add(f)
if to_middle & from_middle:
print("POSSIBLE")
else:
... | from sys import stdin
input = stdin.readline
to_middle = set() # 島1から渡ることのできる島
from_middle = set() # 島Nへ渡ることのできる島
N, M = list(map(int, (input().split())))
for _ in range(M):
f, t = list(map(int, (input().split())))
if f == 1:
to_middle.add(t)
elif t == N:
from_middle.add(f)
if to_middle... | false | 17.647059 | [
"+from sys import stdin",
"+",
"+input = stdin.readline"
] | false | 0.087703 | 0.24097 | 0.363957 | [
"s357430812",
"s447448178"
] |
u248364740 | p03036 | python | s372668197 | s251090914 | 31 | 26 | 9,032 | 9,152 | Accepted | Accepted | 16.13 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
r, D, x = list(map(int, input().split()))
for _ in range(10):
x = r * x - D
print(x)
| r, d, x = list(map(int, input().strip().split()))
for i in range(10):
x = r * x - d
print(x)
| 8 | 6 | 143 | 102 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
r, D, x = list(map(int, input().split()))
for _ in range(10):
x = r * x - D
print(x)
| r, d, x = list(map(int, input().strip().split()))
for i in range(10):
x = r * x - d
print(x)
| false | 25 | [
"-#!/usr/bin/env python3",
"-# -*- coding: utf-8 -*-",
"-r, D, x = list(map(int, input().split()))",
"-for _ in range(10):",
"- x = r * x - D",
"+r, d, x = list(map(int, input().strip().split()))",
"+for i in range(10):",
"+ x = r * x - d"
] | false | 0.036565 | 0.147559 | 0.247802 | [
"s372668197",
"s251090914"
] |
u606045429 | p03252 | python | s571033158 | s640913693 | 129 | 119 | 3,632 | 3,632 | Accepted | Accepted | 7.75 | S = eval(input())
T = eval(input())
tdic = dict()
sdic = dict()
for i in range(len(S)):
if T[i] in tdic:
if tdic[T[i]] != S[i]:
print("No")
break
else:
tdic[T[i]] = S[i]
if S[i] in sdic:
if sdic[S[i]] != T[i]:
print("No")
... | S, T = [eval(input()) for _ in range(2)]
smemo, tmemo = {}, {}
for si, ti in zip(S, T):
if si in smemo and smemo[si] != ti or ti in tmemo and tmemo[ti] != si:
print("No")
quit()
smemo[si], tmemo[ti] = ti, si
print("Yes")
| 21 | 8 | 380 | 246 | S = eval(input())
T = eval(input())
tdic = dict()
sdic = dict()
for i in range(len(S)):
if T[i] in tdic:
if tdic[T[i]] != S[i]:
print("No")
break
else:
tdic[T[i]] = S[i]
if S[i] in sdic:
if sdic[S[i]] != T[i]:
print("No")
break
else... | S, T = [eval(input()) for _ in range(2)]
smemo, tmemo = {}, {}
for si, ti in zip(S, T):
if si in smemo and smemo[si] != ti or ti in tmemo and tmemo[ti] != si:
print("No")
quit()
smemo[si], tmemo[ti] = ti, si
print("Yes")
| false | 61.904762 | [
"-S = eval(input())",
"-T = eval(input())",
"-tdic = dict()",
"-sdic = dict()",
"-for i in range(len(S)):",
"- if T[i] in tdic:",
"- if tdic[T[i]] != S[i]:",
"- print(\"No\")",
"- break",
"- else:",
"- tdic[T[i]] = S[i]",
"- if S[i] in sdic:",
"- ... | false | 0.03461 | 0.03688 | 0.93843 | [
"s571033158",
"s640913693"
] |
u054412614 | p03241 | python | s534258930 | s088340648 | 566 | 36 | 9,256 | 9,120 | Accepted | Accepted | 93.64 | import copy
def cd_generator(num):
ans=[]
for i in range(1,10000000):
if num%i==0:
ans.append(i)
temp=copy.deepcopy(ans)
temp.reverse()
for ele in temp:
ans.append(num//ele)
return ans
def main():
n,m=list(map(int,input().split()))
array=cd_genera... | def make_divisors(n):
lower_divisors,upper_divisors=[],[]
i=1
while i*i<=n:
if n%i==0:
lower_divisors.append(i)
if i!=n//i:
upper_divisors.append(n//i)
i+=1
return lower_divisors+upper_divisors[::-1]
n,m=list(map(int,input().split()))
ar... | 20 | 17 | 431 | 426 | import copy
def cd_generator(num):
ans = []
for i in range(1, 10000000):
if num % i == 0:
ans.append(i)
temp = copy.deepcopy(ans)
temp.reverse()
for ele in temp:
ans.append(num // ele)
return ans
def main():
n, m = list(map(int, input().split()))
array = c... | def make_divisors(n):
lower_divisors, upper_divisors = [], []
i = 1
while i * i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n // i)
i += 1
return lower_divisors + upper_divisors[::-1]
n, m = list(map(int, i... | false | 15 | [
"-import copy",
"+def make_divisors(n):",
"+ lower_divisors, upper_divisors = [], []",
"+ i = 1",
"+ while i * i <= n:",
"+ if n % i == 0:",
"+ lower_divisors.append(i)",
"+ if i != n // i:",
"+ upper_divisors.append(n // i)",
"+ i += 1",... | false | 3.278351 | 0.03945 | 83.101414 | [
"s534258930",
"s088340648"
] |
u827885761 | p03209 | python | s243595239 | s356139077 | 20 | 17 | 3,064 | 3,064 | Accepted | Accepted | 15 | n, x = list(map(int, input().split()))
A = [1] * (n + 1)
P = [1] * (n + 1)
for i in range(1, n + 1):
A[i] = A[i - 1] * 2 + 3
P[i] = P[i - 1] * 2 + 1
def pate(m, y):
if m == 0:
return 1
else:
c = 0
if y >= 1:
y -= 1
if y >= 1:
... | n, x = list(map(int, input().split()))
A = [1] * (n + 1)
P = [1] * (n + 1)
for i in range(1, n + 1):
A[i] = A[i - 1] * 2 + 3
P[i] = P[i - 1] * 2 + 1
c = 0
for i in list(range(n+1))[::-1]:
if i == 0:
c += 1
elif x == 1:
break
elif x <= A[i - 1] + 1:
x -= 1... | 45 | 32 | 816 | 538 | n, x = list(map(int, input().split()))
A = [1] * (n + 1)
P = [1] * (n + 1)
for i in range(1, n + 1):
A[i] = A[i - 1] * 2 + 3
P[i] = P[i - 1] * 2 + 1
def pate(m, y):
if m == 0:
return 1
else:
c = 0
if y >= 1:
y -= 1
if y >= 1:
if y >= A[m - 1]:
... | n, x = list(map(int, input().split()))
A = [1] * (n + 1)
P = [1] * (n + 1)
for i in range(1, n + 1):
A[i] = A[i - 1] * 2 + 3
P[i] = P[i - 1] * 2 + 1
c = 0
for i in list(range(n + 1))[::-1]:
if i == 0:
c += 1
elif x == 1:
break
elif x <= A[i - 1] + 1:
x -= 1
elif x == A[i ... | false | 28.888889 | [
"-",
"-",
"-def pate(m, y):",
"- if m == 0:",
"- return 1",
"- else:",
"- c = 0",
"- if y >= 1:",
"- y -= 1",
"- if y >= 1:",
"- if y >= A[m - 1]:",
"- y -= A[m - 1]",
"- c += P[m - 1]",
"- els... | false | 0.06173 | 0.060877 | 1.014012 | [
"s243595239",
"s356139077"
] |
u191874006 | p02699 | python | s215093903 | s991069998 | 108 | 67 | 65,248 | 65,548 | Accepted | Accepted | 37.96 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
#A
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
... | 24 | 25 | 629 | 633 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
# A
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 colle... | false | 4 | [
"+# A",
"-if s <= w:",
"+if w >= s:"
] | false | 0.045871 | 0.046131 | 0.994371 | [
"s215093903",
"s991069998"
] |
u627600101 | p02616 | python | s016980815 | s749521679 | 257 | 236 | 31,868 | 31,744 | Accepted | Accepted | 8.17 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
plus = []
zero = []
minus = []
ans = 1
for k in range(N):
if A[k] > 0:
plus.append(A[k])
elif A[k] < 0:
minus.append(-1 * A[k])
else:
zero.append(A[k])
plus.sort(reverse = True)
minus.sort(r... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
plus = []
lz = 0
minus = []
ans = 1
for k in range(N):
if A[k] > 0:
plus.append(A[k])
elif A[k] < 0:
minus.append(A[k])
else:
lz += 1
plus.sort(reverse = True)
minus.sort()
lp = len(plus)
... | 91 | 84 | 1,703 | 1,528 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
plus = []
zero = []
minus = []
ans = 1
for k in range(N):
if A[k] > 0:
plus.append(A[k])
elif A[k] < 0:
minus.append(-1 * A[k])
else:
zero.append(A[k])
plus.sort(reverse=True)
minus.sort(revers... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
plus = []
lz = 0
minus = []
ans = 1
for k in range(N):
if A[k] > 0:
plus.append(A[k])
elif A[k] < 0:
minus.append(A[k])
else:
lz += 1
plus.sort(reverse=True)
minus.sort()
lp = len(plus)
lm = le... | false | 7.692308 | [
"-zero = []",
"+lz = 0",
"- minus.append(-1 * A[k])",
"+ minus.append(A[k])",
"- zero.append(A[k])",
"+ lz += 1",
"-minus.sort(reverse=True)",
"+minus.sort()",
"-lz = len(zero)",
"+",
"+",
"+def main(mp, mm, plus, minus):",
"+ mod = 10**9 + 7",
"+ ans = 1"... | false | 0.039647 | 0.037379 | 1.060683 | [
"s016980815",
"s749521679"
] |
u357335656 | p02658 | python | s265570900 | s666276544 | 81 | 48 | 21,420 | 21,624 | Accepted | Accepted | 40.74 | n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
if a[0] == 0:
print((0))
exit()
a.sort(reverse=True)
ans = 1
for i in range(n):
ans *= a[i]
if ans > 10 ** 18:
ans = -1
break
print(ans) | N = int(eval(input()))
A = list(map(int,input(). split ()))
if 0 in A:
print((0))
exit()
prod = 1
for a in A:
prod *= a
if prod > 1000000000000000000:
print((-1))
exit()
print(prod) | 18 | 12 | 232 | 190 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
if a[0] == 0:
print((0))
exit()
a.sort(reverse=True)
ans = 1
for i in range(n):
ans *= a[i]
if ans > 10**18:
ans = -1
break
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
if 0 in A:
print((0))
exit()
prod = 1
for a in A:
prod *= a
if prod > 1000000000000000000:
print((-1))
exit()
print(prod)
| false | 33.333333 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-a.sort()",
"-if a[0] == 0:",
"+N = int(eval(input()))",
"+A = list(map(int, input().split()))",
"+if 0 in A:",
"-a.sort(reverse=True)",
"-ans = 1",
"-for i in range(n):",
"- ans *= a[i]",
"- if ans > 10**18:",
"- ... | false | 0.047014 | 0.046685 | 1.007047 | [
"s265570900",
"s666276544"
] |
u156163787 | p03634 | python | s007224328 | s871474860 | 1,890 | 1,616 | 90,140 | 86,176 | Accepted | Accepted | 14.5 | from queue import Queue
INF=float('inf')
n=int(eval(input()))
g=[[] for _ in range(n)]
for _ in range(n-1):
u,v,w=list(map(int,input().split()))
g[u-1].append((v-1,w))
g[v-1].append((u-1,w))
q,k=list(map(int,input().split()))
ds=[INF]*n
ds[k-1]=0
que=Queue()
que.put((k-1,0))
while not que... | from collections import deque
INF=float('inf')
n=int(eval(input()))
g=[[] for _ in range(n)]
for _ in range(n-1):
u,v,w=list(map(int,input().split()))
g[u-1].append((v-1,w))
g[v-1].append((u-1,w))
q,k=list(map(int,input().split()))
ds=[INF]*n
ds[k-1]=0
que=deque()
que.append((k-1,0))
whil... | 26 | 26 | 514 | 523 | from queue import Queue
INF = float("inf")
n = int(eval(input()))
g = [[] for _ in range(n)]
for _ in range(n - 1):
u, v, w = list(map(int, input().split()))
g[u - 1].append((v - 1, w))
g[v - 1].append((u - 1, w))
q, k = list(map(int, input().split()))
ds = [INF] * n
ds[k - 1] = 0
que = Queue()
que.put((k ... | from collections import deque
INF = float("inf")
n = int(eval(input()))
g = [[] for _ in range(n)]
for _ in range(n - 1):
u, v, w = list(map(int, input().split()))
g[u - 1].append((v - 1, w))
g[v - 1].append((u - 1, w))
q, k = list(map(int, input().split()))
ds = [INF] * n
ds[k - 1] = 0
que = deque()
que.a... | false | 0 | [
"-from queue import Queue",
"+from collections import deque",
"-que = Queue()",
"-que.put((k - 1, 0))",
"-while not que.empty():",
"- u, d = que.get()",
"+que = deque()",
"+que.append((k - 1, 0))",
"+while len(que):",
"+ u, d = que.popleft()",
"- que.put((v, d + w))",
"+ ... | false | 0.105134 | 0.096212 | 1.092728 | [
"s007224328",
"s871474860"
] |
u638795007 | p04021 | python | s493848474 | s957523364 | 288 | 136 | 55,388 | 10,572 | Accepted | Accepted | 52.78 | def examC():
N = I(); A = [I() for _ in range(N)]
AS = sorted(A)
A0 = A[::2]
d = defaultdict(bool)
for i in AS[::2]:
d[i] = True
ans = 0
for i in A0:
if not d[i]:
ans +=1
print(ans)
import sys,copy,bisect,itertools,heapq,math
from heapq import h... | def examA():
S = SI()
if "W" in S and not "E" in S:
print("No")
elif "E" in S and not "W" in S:
print("No")
elif "N" in S and not "S" in S:
print("No")
elif "S" in S and not "N" in S:
print("No")
else:
print("Yes")
return
def examB():
... | 26 | 88 | 736 | 1,797 | def examC():
N = I()
A = [I() for _ in range(N)]
AS = sorted(A)
A0 = A[::2]
d = defaultdict(bool)
for i in AS[::2]:
d[i] = True
ans = 0
for i in A0:
if not d[i]:
ans += 1
print(ans)
import sys, copy, bisect, itertools, heapq, math
from heapq import heapp... | def examA():
S = SI()
if "W" in S and not "E" in S:
print("No")
elif "E" in S and not "W" in S:
print("No")
elif "N" in S and not "S" in S:
print("No")
elif "S" in S and not "N" in S:
print("No")
else:
print("Yes")
return
def examB():
N = I()
... | false | 70.454545 | [
"+def examA():",
"+ S = SI()",
"+ if \"W\" in S and not \"E\" in S:",
"+ print(\"No\")",
"+ elif \"E\" in S and not \"W\" in S:",
"+ print(\"No\")",
"+ elif \"N\" in S and not \"S\" in S:",
"+ print(\"No\")",
"+ elif \"S\" in S and not \"N\" in S:",
"+ pr... | false | 0.055645 | 0.036298 | 1.532996 | [
"s493848474",
"s957523364"
] |
u996749146 | p03252 | python | s478563714 | s367146675 | 90 | 41 | 3,632 | 4,144 | Accepted | Accepted | 54.44 | def main():
s = eval(input())
t = eval(input())
dt = dict()
ds = dict()
for i in range(len(s)):
if t[i] not in dt:
dt[t[i]] = s[i]
else:
if dt[t[i]] != s[i]:
print("No")
return
if s[i] not in ds:
... | #提出3250967より
from collections import Counter
S = eval(input())
T = eval(input())
s = Counter(S)
t = Counter(T)
if sorted(s.values()) == sorted(t.values()):
print("Yes")
else:
print("No") | 25 | 14 | 492 | 196 | def main():
s = eval(input())
t = eval(input())
dt = dict()
ds = dict()
for i in range(len(s)):
if t[i] not in dt:
dt[t[i]] = s[i]
else:
if dt[t[i]] != s[i]:
print("No")
return
if s[i] not in ds:
ds[s[i]] = t... | # 提出3250967より
from collections import Counter
S = eval(input())
T = eval(input())
s = Counter(S)
t = Counter(T)
if sorted(s.values()) == sorted(t.values()):
print("Yes")
else:
print("No")
| false | 44 | [
"-def main():",
"- s = eval(input())",
"- t = eval(input())",
"- dt = dict()",
"- ds = dict()",
"- for i in range(len(s)):",
"- if t[i] not in dt:",
"- dt[t[i]] = s[i]",
"- else:",
"- if dt[t[i]] != s[i]:",
"- print(\"No\")",
"-... | false | 0.048806 | 0.048406 | 1.008266 | [
"s478563714",
"s367146675"
] |
u073852194 | p03722 | python | s921016425 | s124948367 | 405 | 335 | 48,216 | 46,812 | Accepted | Accepted | 17.28 | INF = 10**18
N,M = list(map(int,input().split()))
edge = [list(map(int,input().split())) for i in range(M)]
graph = [[] for _ in range(N)]
for e in edge:
graph[e[0]-1].append([e[1]-1,-e[2]])
dist = [INF for _ in range(N)]
dist[0] = 0
for _ in range(N):
flag = False
for node,g in enum... | class Graph(): #directed
def __init__(self, n, edge, indexed=1):
self.n = n
self.graph = [[] for _ in range(n)]
self.deg = [0 for _ in range(n)]
for e in edge:
self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))
self.deg[e[1] - indexed] += 1
... | 40 | 72 | 985 | 2,436 | INF = 10**18
N, M = list(map(int, input().split()))
edge = [list(map(int, input().split())) for i in range(M)]
graph = [[] for _ in range(N)]
for e in edge:
graph[e[0] - 1].append([e[1] - 1, -e[2]])
dist = [INF for _ in range(N)]
dist[0] = 0
for _ in range(N):
flag = False
for node, g in enumerate(graph):
... | class Graph: # directed
def __init__(self, n, edge, indexed=1):
self.n = n
self.graph = [[] for _ in range(n)]
self.deg = [0 for _ in range(n)]
for e in edge:
self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))
self.deg[e[1] - indexed] += 1
def dij... | false | 44.444444 | [
"-INF = 10**18",
"+class Graph: # directed",
"+ def __init__(self, n, edge, indexed=1):",
"+ self.n = n",
"+ self.graph = [[] for _ in range(n)]",
"+ self.deg = [0 for _ in range(n)]",
"+ for e in edge:",
"+ self.graph[e[0] - indexed].append((e[1] - indexed, ... | false | 0.042112 | 0.040655 | 1.035833 | [
"s921016425",
"s124948367"
] |
u133936772 | p03087 | python | s658772582 | s954765542 | 876 | 286 | 6,164 | 6,332 | Accepted | Accepted | 67.35 | f = lambda : list(map(int,input().split()))
n, q = f()
s = eval(input())
cnt = 0
ln = [0]*n
for i in range(1,n):
if s[i-1:i+1] == 'AC':
cnt += 1
ln[i] = cnt
for _ in range(q):
l, r = f()
print((ln[r-1]-ln[l-1])) | import sys
input = sys.stdin.readline
f = lambda : list(map(int,input().split()))
n, q = f()
s = eval(input())
cnt = 0
ln = [0]*n
for i in range(1,n):
if s[i-1:i+1] == 'AC':
cnt += 1
ln[i] = cnt
for _ in range(q):
l, r = f()
print((ln[r-1]-ln[l-1])) | 13 | 16 | 222 | 264 | f = lambda: list(map(int, input().split()))
n, q = f()
s = eval(input())
cnt = 0
ln = [0] * n
for i in range(1, n):
if s[i - 1 : i + 1] == "AC":
cnt += 1
ln[i] = cnt
for _ in range(q):
l, r = f()
print((ln[r - 1] - ln[l - 1]))
| import sys
input = sys.stdin.readline
f = lambda: list(map(int, input().split()))
n, q = f()
s = eval(input())
cnt = 0
ln = [0] * n
for i in range(1, n):
if s[i - 1 : i + 1] == "AC":
cnt += 1
ln[i] = cnt
for _ in range(q):
l, r = f()
print((ln[r - 1] - ln[l - 1]))
| false | 18.75 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.042169 | 0.126701 | 0.332824 | [
"s658772582",
"s954765542"
] |
u753803401 | p02946 | python | s075454561 | s499249402 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | k, x = list(map(int, input().split()))
a = []
for i in range(x, x + k):
if i not in a:
a.append(i)
for i in range(x, x - k, -1):
if i not in a:
a.append(i)
a.sort()
print((*a))
| k, x = list(map(int, input().split()))
a = []
for i in range(x, x + k):
a.append(i)
for i in range(x - 1, x - k, -1):
a.append(i)
a.sort()
print((*a))
| 10 | 8 | 202 | 158 | k, x = list(map(int, input().split()))
a = []
for i in range(x, x + k):
if i not in a:
a.append(i)
for i in range(x, x - k, -1):
if i not in a:
a.append(i)
a.sort()
print((*a))
| k, x = list(map(int, input().split()))
a = []
for i in range(x, x + k):
a.append(i)
for i in range(x - 1, x - k, -1):
a.append(i)
a.sort()
print((*a))
| false | 20 | [
"- if i not in a:",
"- a.append(i)",
"-for i in range(x, x - k, -1):",
"- if i not in a:",
"- a.append(i)",
"+ a.append(i)",
"+for i in range(x - 1, x - k, -1):",
"+ a.append(i)"
] | false | 0.084216 | 0.037313 | 2.256998 | [
"s075454561",
"s499249402"
] |
u893063840 | p02683 | python | s554495385 | s678657349 | 107 | 77 | 28,224 | 9,208 | Accepted | Accepted | 28.04 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
import numpy as np
from itertools import product
n, m, x = list(map(int, readline().split()))
ca = np.array(read().split(), np.int64).reshape((n, m + 1))
INF = 10 ** 9
c = ca[:, 0]
a = ca[:, 1:]
p = np.array([e for e in produ... | n, m, x = list(map(int, input().split()))
ca = [list(map(int, input().split())) for _ in range(n)]
INF = 10 ** 9
ans = INF
for i in range(1 << n):
sm = [0] * m
cost = 0
for j in range(n):
if i >> j & 1:
cost += ca[j][0]
for k, e in enumerate(ca[j][1:]):
... | 24 | 21 | 497 | 432 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
import numpy as np
from itertools import product
n, m, x = list(map(int, readline().split()))
ca = np.array(read().split(), np.int64).reshape((n, m + 1))
INF = 10**9
c = ca[:, 0]
a = ca[:, 1:]
p = np.array([e for e in product([1, 0], repeat=... | n, m, x = list(map(int, input().split()))
ca = [list(map(int, input().split())) for _ in range(n)]
INF = 10**9
ans = INF
for i in range(1 << n):
sm = [0] * m
cost = 0
for j in range(n):
if i >> j & 1:
cost += ca[j][0]
for k, e in enumerate(ca[j][1:]):
sm[k] +=... | false | 12.5 | [
"-import sys",
"-",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-import numpy as np",
"-from itertools import product",
"-",
"-n, m, x = list(map(int, readline().split()))",
"-ca = np.array(read().split(), np.int64).reshape((n, m + 1))",
"+n, m, x = list(map(int, inp... | false | 0.256689 | 0.107224 | 2.393939 | [
"s554495385",
"s678657349"
] |
u063056051 | p01102 | python | s127406693 | s624732423 | 30 | 20 | 5,576 | 5,580 | Accepted | Accepted | 33.33 | while 1:
s1=input().split('"')
if s1[0]==".":
break
s2=input().split('"')
cnt1=0
cnt2=0
flag=0
if len(s1)!=len(s2):
print("DIFFERENT")
else:
i=0
while i<len(s1):
if s1[i]==s2[i]:
cnt1+=1
... | while 1:
list1=input().split('"')
if list1[0]==".":
break
list2=input().split('"')
cnt1=0
cnt2=0
flag=0
if len(list1)!=len(list2):
print("DIFFERENT")
else:
i=0
while i<len(list1):
if list1[i]==list2[i]:
... | 32 | 33 | 712 | 741 | while 1:
s1 = input().split('"')
if s1[0] == ".":
break
s2 = input().split('"')
cnt1 = 0
cnt2 = 0
flag = 0
if len(s1) != len(s2):
print("DIFFERENT")
else:
i = 0
while i < len(s1):
if s1[i] == s2[i]:
cnt1 += 1
elif i ... | while 1:
list1 = input().split('"')
if list1[0] == ".":
break
list2 = input().split('"')
cnt1 = 0
cnt2 = 0
flag = 0
if len(list1) != len(list2):
print("DIFFERENT")
else:
i = 0
while i < len(list1):
if list1[i] == list2[i]:
cnt1 ... | false | 3.030303 | [
"- s1 = input().split('\"')",
"- if s1[0] == \".\":",
"+ list1 = input().split('\"')",
"+ if list1[0] == \".\":",
"- s2 = input().split('\"')",
"+ list2 = input().split('\"')",
"- if len(s1) != len(s2):",
"+ if len(list1) != len(list2):",
"- while i < len(s1):",
"- ... | false | 0.040669 | 0.043307 | 0.939091 | [
"s127406693",
"s624732423"
] |
u189023301 | p02720 | python | s205142053 | s131341360 | 341 | 193 | 65,628 | 43,632 | Accepted | Accepted | 43.4 | import sys
input = sys.stdin.readline
import itertools
lunlun = [[] for i in range(11)]
def main():
n = int(eval(input()))
for i in range(100):
flag = True
l = len(str(i))
if l == 1:
lunlun[l - 1].append(i)
else:
for a in range(1, len(str(i... | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
lunlun = [[] for i in range(11)]
lunlun[0] = [1, 2, 3, 4, 5, 6, 7, 8, 9]
cnt = 9
if n < 10:
print(n)
exit()
for j in range(0, 10):
for a in lunlun[j]:
for b in range(10):
... | 32 | 24 | 878 | 592 | import sys
input = sys.stdin.readline
import itertools
lunlun = [[] for i in range(11)]
def main():
n = int(eval(input()))
for i in range(100):
flag = True
l = len(str(i))
if l == 1:
lunlun[l - 1].append(i)
else:
for a in range(1, len(str(i))):
... | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
lunlun = [[] for i in range(11)]
lunlun[0] = [1, 2, 3, 4, 5, 6, 7, 8, 9]
cnt = 9
if n < 10:
print(n)
exit()
for j in range(0, 10):
for a in lunlun[j]:
for b in range(10):
... | false | 25 | [
"-import itertools",
"-",
"-lunlun = [[] for i in range(11)]",
"- for i in range(100):",
"- flag = True",
"- l = len(str(i))",
"- if l == 1:",
"- lunlun[l - 1].append(i)",
"- else:",
"- for a in range(1, len(str(i))):",
"- if ab... | false | 0.932469 | 0.119145 | 7.826356 | [
"s205142053",
"s131341360"
] |
u844646164 | p02912 | python | s535439179 | s110941558 | 625 | 229 | 93,208 | 14,532 | Accepted | Accepted | 63.36 | import heapq
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
q = []
for a in A:
q += [-a]
heapq.heapify(q)
for _ in range(M):
a = heapq.heappop(q)
heapq.heappush(q, a/2)
ans = 0
for p in q:
ans += int(-p)
print(ans) | import heapq
import math
N, M = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapq.heapify(A)
while M > 0:
a = heapq.heappop(A)
heapq.heappush(A, a/2)
M -= 1
ans = 0
for a in range(N):
ans += math.floor(-A[a])
print(ans)
| 15 | 17 | 261 | 280 | import heapq
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
q = []
for a in A:
q += [-a]
heapq.heapify(q)
for _ in range(M):
a = heapq.heappop(q)
heapq.heappush(q, a / 2)
ans = 0
for p in q:
ans += int(-p)
print(ans)
| import heapq
import math
N, M = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapq.heapify(A)
while M > 0:
a = heapq.heappop(A)
heapq.heappush(A, a / 2)
M -= 1
ans = 0
for a in range(N):
ans += math.floor(-A[a])
print(ans)
| false | 11.764706 | [
"+import math",
"-A = list(map(int, input().split()))",
"-q = []",
"-for a in A:",
"- q += [-a]",
"-heapq.heapify(q)",
"-for _ in range(M):",
"- a = heapq.heappop(q)",
"- heapq.heappush(q, a / 2)",
"+A = list([-int(x) for x in input().split()])",
"+heapq.heapify(A)",
"+while M > 0:",
... | false | 0.094962 | 0.04768 | 1.991659 | [
"s535439179",
"s110941558"
] |
u844646164 | p02781 | python | s576670109 | s207566484 | 203 | 78 | 41,712 | 68,352 | Accepted | Accepted | 61.58 | N = int(eval(input()))
K = int(eval(input()))
l = len(str(N))
dp = [[[0]*(K+1) for _ in range(2)] for _ in range(l+1)]
# dp[i][smaller][j]
# i: 調べている桁
# smaller: 未満フラグ(未満のとき1)
# j: 0以外の数がj回出た
dp[0][0][0] = 1
for i in range(l):
n = int(str(N)[i])
for j in range(2):
for k in range(K+1):
for m... | N = str(eval(input()))
K = int(eval(input()))
dp = [[[0]*2 for _ in range(K+1)] for _ in range(len(N)+1)]
dp[0][0][0] = 1
for i in range(len(N)):
n = int(N[i])
for j in range(K+1):
for k in range(2): # smaller(未満なら1)
for l in range(10):
nj, nk = j, 0
if k == 0 and l == n:
... | 55 | 34 | 1,190 | 687 | N = int(eval(input()))
K = int(eval(input()))
l = len(str(N))
dp = [[[0] * (K + 1) for _ in range(2)] for _ in range(l + 1)]
# dp[i][smaller][j]
# i: 調べている桁
# smaller: 未満フラグ(未満のとき1)
# j: 0以外の数がj回出た
dp[0][0][0] = 1
for i in range(l):
n = int(str(N)[i])
for j in range(2):
for k in range(K + 1):
... | N = str(eval(input()))
K = int(eval(input()))
dp = [[[0] * 2 for _ in range(K + 1)] for _ in range(len(N) + 1)]
dp[0][0][0] = 1
for i in range(len(N)):
n = int(N[i])
for j in range(K + 1):
for k in range(2): # smaller(未満なら1)
for l in range(10):
nj, nk = j, 0
... | false | 38.181818 | [
"-N = int(eval(input()))",
"+N = str(eval(input()))",
"-l = len(str(N))",
"-dp = [[[0] * (K + 1) for _ in range(2)] for _ in range(l + 1)]",
"-# dp[i][smaller][j]",
"-# i: 調べている桁",
"-# smaller: 未満フラグ(未満のとき1)",
"-# j: 0以外の数がj回出た",
"+dp = [[[0] * 2 for _ in range(K + 1)] for _ in range(len(N) + 1)]",
... | false | 0.049214 | 0.07567 | 0.65037 | [
"s576670109",
"s207566484"
] |
u506858457 | p03014 | python | s081946431 | s777354060 | 1,902 | 1,120 | 306,952 | 211,204 | Accepted | Accepted | 41.11 | H,W=list(map(int,input().split()))
S = []
for _ in range(H):
S.append(list(eval(input())))
Left = [[0] * W for i in range(H)]
for i in range(H):
cur=0
for j in range(W):
#cur=0
if S[i][j]=='#':
cur=0
else:
cur=cur+1
Left[i][j]=cur
Right=[[0] * W for i in range(H... | #Satoooh
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
# そのマスを含めてLeft, Right, Up, Downにそれぞれ何マス分明かりを照らせるかを配列に記録
L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
for i in range(H):
for j in range(W... | 53 | 51 | 976 | 1,035 | H, W = list(map(int, input().split()))
S = []
for _ in range(H):
S.append(list(eval(input())))
Left = [[0] * W for i in range(H)]
for i in range(H):
cur = 0
for j in range(W):
# cur=0
if S[i][j] == "#":
cur = 0
else:
cur = cur + 1
Left[i][j] = cur
Righ... | # Satoooh
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
# そのマスを含めてLeft, Right, Up, Downにそれぞれ何マス分明かりを照らせるかを配列に記録
L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
for i in range(H):
for j in range(W):
... | false | 3.773585 | [
"+# Satoooh",
"-S = []",
"-for _ in range(H):",
"- S.append(list(eval(input())))",
"-Left = [[0] * W for i in range(H)]",
"-for i in range(H):",
"- cur = 0",
"- for j in range(W):",
"- # cur=0",
"- if S[i][j] == \"#\":",
"- cur = 0",
"- else:",
"- ... | false | 0.092994 | 0.069079 | 1.346194 | [
"s081946431",
"s777354060"
] |
u021019433 | p03032 | python | s511226498 | s937139481 | 53 | 44 | 3,064 | 3,316 | Accepted | Accepted | 16.98 | import heapq
from itertools import chain
R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
r = 0
for i in range(1, min(n, k) + 1):
for j in range(i):
s = 0
h = []
for m in chain(list(range(i - j)), list(range(n - j, n))):
x = v[m]
s +=... | from itertools import chain
R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
a = sorted((x, i) for i, x in enumerate(v) if x < 0)
r = 0
for i in range(1, min(n, k) + 1):
for j in range(i):
r1, r2 = list(range(i - j)), list(range(n - j, n))
s = sum(v[m] for m in chain(... | 22 | 20 | 497 | 514 | import heapq
from itertools import chain
R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
r = 0
for i in range(1, min(n, k) + 1):
for j in range(i):
s = 0
h = []
for m in chain(list(range(i - j)), list(range(n - j, n))):
x = v[m]
s += x
... | from itertools import chain
R = lambda: list(map(int, input().split()))
n, k = R()
v = list(R())
a = sorted((x, i) for i, x in enumerate(v) if x < 0)
r = 0
for i in range(1, min(n, k) + 1):
for j in range(i):
r1, r2 = list(range(i - j)), list(range(n - j, n))
s = sum(v[m] for m in chain(r1, r2))
... | false | 9.090909 | [
"-import heapq",
"+a = sorted((x, i) for i, x in enumerate(v) if x < 0)",
"- s = 0",
"- h = []",
"- for m in chain(list(range(i - j)), list(range(n - j, n))):",
"- x = v[m]",
"- s += x",
"- if x < 0:",
"- heapq.heappush(h, x)",
"... | false | 0.03656 | 0.038038 | 0.961155 | [
"s511226498",
"s937139481"
] |
u208713671 | p03565 | python | s813542888 | s784182064 | 77 | 64 | 62,996 | 62,672 | Accepted | Accepted | 16.88 | S = list(eval(input()))
T = list(eval(input()))
NS,NT = len(S),len(T)
outs = []
if NS>=NT:
for i in range(NS-NT+1):
flag = 0
for j in range(NT):
if S[i+j]==T[j] or S[i+j]=="?":
continue
else:
flag = 1
break
... | S = list(eval(input()))
T = list(eval(input()))
NS,NT = len(S),len(T)
outs = []
if NS>=NT:
for i in range(NS-NT+1):
flag = 0
for j in range(NT):
if S[i+j]==T[j] or S[i+j]=="?":
continue
else:
flag = 1
break
... | 27 | 26 | 640 | 624 | S = list(eval(input()))
T = list(eval(input()))
NS, NT = len(S), len(T)
outs = []
if NS >= NT:
for i in range(NS - NT + 1):
flag = 0
for j in range(NT):
if S[i + j] == T[j] or S[i + j] == "?":
continue
else:
flag = 1
break
... | S = list(eval(input()))
T = list(eval(input()))
NS, NT = len(S), len(T)
outs = []
if NS >= NT:
for i in range(NS - NT + 1):
flag = 0
for j in range(NT):
if S[i + j] == T[j] or S[i + j] == "?":
continue
else:
flag = 1
break
... | false | 3.703704 | [
"- outs.sort()",
"- print((outs[0]))",
"+ print((outs[-1]))"
] | false | 0.033407 | 0.044497 | 0.750779 | [
"s813542888",
"s784182064"
] |
u723711163 | p02708 | python | s743424263 | s758884920 | 170 | 62 | 9,204 | 64,792 | Accepted | Accepted | 63.53 | N, K = list(map(int, input().split()))
MAX = 10 ** 9 + 7
res = 0
def calc_sum(l, r):
return ((l+r) * (r-l+1)) // 2
for i in range(K, N+2):
low = calc_sum(0,i-1)
high = calc_sum(N-i+1,N)
res = (res + (high-low+1)) % MAX
print(res) | N,K = list(map(int,input().split()))
MOD = 10**9+7
res = 0
curmin,curmax = 0, N
mini,maxi = 1, N-1
for i in range(1,N+2):
if i == N+1:
# print(1)
res += 1
else:
if i >= K:
# print(curmin,curmax)
res = (res + curmax - curmin + 1) % MOD
curmin += mini
curmax += maxi
... | 14 | 19 | 252 | 359 | N, K = list(map(int, input().split()))
MAX = 10**9 + 7
res = 0
def calc_sum(l, r):
return ((l + r) * (r - l + 1)) // 2
for i in range(K, N + 2):
low = calc_sum(0, i - 1)
high = calc_sum(N - i + 1, N)
res = (res + (high - low + 1)) % MAX
print(res)
| N, K = list(map(int, input().split()))
MOD = 10**9 + 7
res = 0
curmin, curmax = 0, N
mini, maxi = 1, N - 1
for i in range(1, N + 2):
if i == N + 1:
# print(1)
res += 1
else:
if i >= K:
# print(curmin,curmax)
res = (res + curmax - curmin + 1) % MOD
curmin +... | false | 26.315789 | [
"-MAX = 10**9 + 7",
"+MOD = 10**9 + 7",
"-",
"-",
"-def calc_sum(l, r):",
"- return ((l + r) * (r - l + 1)) // 2",
"-",
"-",
"-for i in range(K, N + 2):",
"- low = calc_sum(0, i - 1)",
"- high = calc_sum(N - i + 1, N)",
"- res = (res + (high - low + 1)) % MAX",
"-print(res)",
"... | false | 0.08262 | 0.108847 | 0.759051 | [
"s743424263",
"s758884920"
] |
u709304134 | p02928 | python | s380413157 | s424766814 | 1,896 | 316 | 3,188 | 82,536 | Accepted | Accepted | 83.33 | MOD = 1000000007
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
def bubble_sort(A):
cnt = 0
for i in range(len(A)):
for j in range(len(A)-1, i, -1):
if A[j] < A[j-1]:
A[j], A[j-1] = A[j-1], A[j]
cnt += 1
return cnt
def s... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import numpy as np
MOD = 10**9 + 7
N,K = list(map(int,input().split()))
A = np.array(input().split(), dtype=np.int64)
# 同じグループ内
def type_1():
bl1 = A[:,None] > A[None,:]
bl2 = np.arange(N,dtype=np.int64)[:,None] < np.arange(N... | 21 | 29 | 506 | 668 | MOD = 1000000007
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
def bubble_sort(A):
cnt = 0
for i in range(len(A)):
for j in range(len(A) - 1, i, -1):
if A[j] < A[j - 1]:
A[j], A[j - 1] = A[j - 1], A[j]
cnt += 1
return cnt
d... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
import numpy as np
MOD = 10**9 + 7
N, K = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.int64)
# 同じグループ内
def type_1():
bl1 = A[:, None] > A[None, :]
bl2 = np.arange(N, dtype=np.int64)[:, None] < np.arange(N, dtype=np.i... | false | 27.586207 | [
"-MOD = 1000000007",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**7)",
"+import numpy as np",
"+",
"+MOD = 10**9 + 7",
"-A = list(map(int, input().split()))",
"+A = np.array(input().split(), dtype=np.int64)",
"+# 同じグループ内",
"+def type_1():",
"+ bl1 = A[:, ... | false | 0.107864 | 0.212525 | 0.507534 | [
"s380413157",
"s424766814"
] |
u243572357 | p03470 | python | s097589129 | s151457655 | 20 | 17 | 2,940 | 3,064 | Accepted | Accepted | 15 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
print((len(set(a)))) | n = int(eval(input()))
print((len(set([eval(input()) for i in range(n)])))) | 4 | 2 | 76 | 62 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
print((len(set(a))))
| n = int(eval(input()))
print((len(set([eval(input()) for i in range(n)]))))
| false | 50 | [
"-a = [int(eval(input())) for _ in range(n)]",
"-print((len(set(a))))",
"+print((len(set([eval(input()) for i in range(n)]))))"
] | false | 0.072268 | 0.060149 | 1.201487 | [
"s097589129",
"s151457655"
] |
u958693198 | p02850 | python | s676672278 | s153658511 | 412 | 371 | 28,200 | 21,784 | Accepted | Accepted | 9.95 | import sys
from collections import deque
input = sys.stdin.readline
N = int(eval(input()))
X = [[] for _ in range(N)]
for i in range(N-1):
a, b = list(map(int, input().split()))
X[a-1].append((i, b-1))
Q = deque([(0, -1)])
ANS = [-1] * (N-1)
cmax = 0
while Q:
x, c0 = Q.pop()
c = 1
fo... | import sys
from collections import deque
input = sys.stdin.readline
N = int(eval(input()))
bi=[0]* N
children = [[] for _ in range(N)]
for i in range(N-1):
a, b = list(map(int, input().split()))
bi[i]=b-1
children[a-1].append(b-1)
queue = deque([0])
colors = [0] * N
maxColor = 0
while queue:
... | 25 | 28 | 492 | 643 | import sys
from collections import deque
input = sys.stdin.readline
N = int(eval(input()))
X = [[] for _ in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
X[a - 1].append((i, b - 1))
Q = deque([(0, -1)])
ANS = [-1] * (N - 1)
cmax = 0
while Q:
x, c0 = Q.pop()
c = 1
for i, y ... | import sys
from collections import deque
input = sys.stdin.readline
N = int(eval(input()))
bi = [0] * N
children = [[] for _ in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
bi[i] = b - 1
children[a - 1].append(b - 1)
queue = deque([0])
colors = [0] * N
maxColor = 0
while queue:
... | false | 10.714286 | [
"-X = [[] for _ in range(N)]",
"+bi = [0] * N",
"+children = [[] for _ in range(N)]",
"- X[a - 1].append((i, b - 1))",
"-Q = deque([(0, -1)])",
"-ANS = [-1] * (N - 1)",
"-cmax = 0",
"-while Q:",
"- x, c0 = Q.pop()",
"- c = 1",
"- for i, y in X[x]:",
"- if c == c0:",
"- ... | false | 0.046739 | 0.047042 | 0.993561 | [
"s676672278",
"s153658511"
] |
u003475507 | p02781 | python | s139889129 | s245698873 | 23 | 18 | 3,064 | 3,064 | Accepted | Accepted | 21.74 | s = eval(input())
K = int(eval(input()))
n =len(s)
dp = [[[0] * 2 for _ in range(4)] for _ in range(101)]
dp[0][0][0]=1
for i in range(n):
for j in range(4):
for k in range(2):
nd = int(s[i])
for d in range(10):
ni = i+1; nj = j; nk = k
... | s=eval(input())
n=len(s)
K=int(eval(input()))
dp=[[[0] * 5 for _ in range(2)] for _ in range(n+1)]
dp[0][0][0]=1
for i in range(n):
ni= int(s[i])
for k in range(4):
# smaller 1 -> 全部OK
dp[i + 1][1][k + 1] += dp[i][1][k] * 9;
dp[i + 1][1][k] += dp[i][1][k];... | 29 | 31 | 751 | 858 | s = eval(input())
K = int(eval(input()))
n = len(s)
dp = [[[0] * 2 for _ in range(4)] for _ in range(101)]
dp[0][0][0] = 1
for i in range(n):
for j in range(4):
for k in range(2):
nd = int(s[i])
for d in range(10):
ni = i + 1
nj = j
nk ... | s = eval(input())
n = len(s)
K = int(eval(input()))
dp = [[[0] * 5 for _ in range(2)] for _ in range(n + 1)]
dp[0][0][0] = 1
for i in range(n):
ni = int(s[i])
for k in range(4):
# smaller 1 -> 全部OK
dp[i + 1][1][k + 1] += dp[i][1][k] * 9
dp[i + 1][1][k] += dp[i][1][k]
# smaller 0,... | false | 6.451613 | [
"+n = len(s)",
"-n = len(s)",
"-dp = [[[0] * 2 for _ in range(4)] for _ in range(101)]",
"+dp = [[[0] * 5 for _ in range(2)] for _ in range(n + 1)]",
"- for j in range(4):",
"- for k in range(2):",
"- nd = int(s[i])",
"- for d in range(10):",
"- ni = i ... | false | 0.118143 | 0.039159 | 3.016986 | [
"s139889129",
"s245698873"
] |
u350243405 | p02880 | python | s647945172 | s452613266 | 19 | 17 | 3,060 | 3,064 | Accepted | Accepted | 10.53 | n=int(eval(input()))
i=1
check=False
while i<int(n**.5+1):
if n/i<10 and n%i==0:
print("Yes")
check=True
break
i+=1
if not check:
print("No") | n=int(eval(input()))
check=False;
i=1
while i<10:
j=1
while j<10:
if (i*j==n):
print('Yes')
check=True
break;
j+=1;
if check:
break
i+=1
if not check:
print("No") | 12 | 18 | 183 | 257 | n = int(eval(input()))
i = 1
check = False
while i < int(n**0.5 + 1):
if n / i < 10 and n % i == 0:
print("Yes")
check = True
break
i += 1
if not check:
print("No")
| n = int(eval(input()))
check = False
i = 1
while i < 10:
j = 1
while j < 10:
if i * j == n:
print("Yes")
check = True
break
j += 1
if check:
break
i += 1
if not check:
print("No")
| false | 33.333333 | [
"+check = False",
"-check = False",
"-while i < int(n**0.5 + 1):",
"- if n / i < 10 and n % i == 0:",
"- print(\"Yes\")",
"- check = True",
"+while i < 10:",
"+ j = 1",
"+ while j < 10:",
"+ if i * j == n:",
"+ print(\"Yes\")",
"+ check = Tru... | false | 0.0429 | 0.041534 | 1.032888 | [
"s647945172",
"s452613266"
] |
u393253137 | p02744 | python | s071276548 | s561603629 | 93 | 52 | 14,788 | 15,368 | Accepted | Accepted | 44.09 | n = int(input())
A = 'a'
S ='abcdefghij'
for _ in range(n-1):
A = [a + s for a in A for s in S[:len(set(a))+1]]
print(*A, sep='\n')
| n = int(eval(input()))
A = 'a'
S = 'abcdefghij'
for _ in range(n-1):
A = [ a + s for a in A for s in S[:len(set(a)) + 1]]
print(('\n'.join(A))) | 6 | 6 | 140 | 144 | n = int(input())
A = "a"
S = "abcdefghij"
for _ in range(n - 1):
A = [a + s for a in A for s in S[: len(set(a)) + 1]]
print(*A, sep="\n")
| n = int(eval(input()))
A = "a"
S = "abcdefghij"
for _ in range(n - 1):
A = [a + s for a in A for s in S[: len(set(a)) + 1]]
print(("\n".join(A)))
| false | 0 | [
"-n = int(input())",
"+n = int(eval(input()))",
"-print(*A, sep=\"\\n\")",
"+print((\"\\n\".join(A)))"
] | false | 0.042452 | 0.036565 | 1.161011 | [
"s071276548",
"s561603629"
] |
u782930273 | p03137 | python | s314416050 | s200693707 | 133 | 109 | 18,388 | 13,840 | Accepted | Accepted | 18.05 | N, M = list(map(int, input().split()))
X = [int(x) for x in input().split()]
if N >= M:
print((0))
else:
X.sort()
dX = [(i, X[i + 1] - X[i]) for i in range(M - 1)]
dX.sort(key=lambda x: x[1], reverse=True)
print((sum(d[1] for d in dX[N - 1:]))) | N, M = list(map(int, input().split()))
X = [int(x) for x in input().split()]
if N >= M:
print((0))
else:
X.sort()
dX = [X[i + 1] - X[i] for i in range(M - 1)]
dX.sort(reverse=True)
print((sum(dX[N - 1:]))) | 10 | 10 | 264 | 225 | N, M = list(map(int, input().split()))
X = [int(x) for x in input().split()]
if N >= M:
print((0))
else:
X.sort()
dX = [(i, X[i + 1] - X[i]) for i in range(M - 1)]
dX.sort(key=lambda x: x[1], reverse=True)
print((sum(d[1] for d in dX[N - 1 :])))
| N, M = list(map(int, input().split()))
X = [int(x) for x in input().split()]
if N >= M:
print((0))
else:
X.sort()
dX = [X[i + 1] - X[i] for i in range(M - 1)]
dX.sort(reverse=True)
print((sum(dX[N - 1 :])))
| false | 0 | [
"- dX = [(i, X[i + 1] - X[i]) for i in range(M - 1)]",
"- dX.sort(key=lambda x: x[1], reverse=True)",
"- print((sum(d[1] for d in dX[N - 1 :])))",
"+ dX = [X[i + 1] - X[i] for i in range(M - 1)]",
"+ dX.sort(reverse=True)",
"+ print((sum(dX[N - 1 :])))"
] | false | 0.048593 | 0.04912 | 0.989264 | [
"s314416050",
"s200693707"
] |
u148981246 | p02614 | python | s085047860 | s647222946 | 83 | 64 | 9,144 | 9,032 | Accepted | Accepted | 22.89 | h, w, k = list(map(int, input().split(' ')))
c = [eval(input()) for x in range(h)]
cnt = 0
for m in range(2**(h+w)):
cc = c.copy()
for ij in range(h+w):
if ((m >> ij) & 1):
if ij in range(h):
cc[ij] = '.'*w
if ij in range(h,h+w):
for t in... | h, w, k = list(map(int, input().split(' ')))
c = [eval(input()) for x in range(h)]
cnt = 0
for maskR in range(2**h):
for maskC in range(2**w):
black = 0
for i in range(h):
for j in range(w):
if (((maskR >> i) &1) == 0
and ((maskC >> j) &1) =... | 16 | 15 | 478 | 422 | h, w, k = list(map(int, input().split(" ")))
c = [eval(input()) for x in range(h)]
cnt = 0
for m in range(2 ** (h + w)):
cc = c.copy()
for ij in range(h + w):
if (m >> ij) & 1:
if ij in range(h):
cc[ij] = "." * w
if ij in range(h, h + w):
for t in ... | h, w, k = list(map(int, input().split(" ")))
c = [eval(input()) for x in range(h)]
cnt = 0
for maskR in range(2**h):
for maskC in range(2**w):
black = 0
for i in range(h):
for j in range(w):
if (
((maskR >> i) & 1) == 0
and ((maskC ... | false | 6.25 | [
"-for m in range(2 ** (h + w)):",
"- cc = c.copy()",
"- for ij in range(h + w):",
"- if (m >> ij) & 1:",
"- if ij in range(h):",
"- cc[ij] = \".\" * w",
"- if ij in range(h, h + w):",
"- for t in range(h):",
"- cc[t]... | false | 0.040791 | 0.097828 | 0.416967 | [
"s085047860",
"s647222946"
] |
u462329577 | p02754 | python | s431048101 | s273735386 | 175 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.29 | #!/usr/bin/env python3
n,a,b = list(map(int,input().split()))
print(((n//(a+b))*a + min(a,n%(a+b)))) | n, a, b = list(map(int, input().split()))
print(((n // (a + b)) * a + min(n % (a + b), a)))
| 4 | 2 | 96 | 85 | #!/usr/bin/env python3
n, a, b = list(map(int, input().split()))
print(((n // (a + b)) * a + min(a, n % (a + b))))
| n, a, b = list(map(int, input().split()))
print(((n // (a + b)) * a + min(n % (a + b), a)))
| false | 50 | [
"-#!/usr/bin/env python3",
"-print(((n // (a + b)) * a + min(a, n % (a + b))))",
"+print(((n // (a + b)) * a + min(n % (a + b), a)))"
] | false | 0.042336 | 0.03544 | 1.194599 | [
"s431048101",
"s273735386"
] |
u347600233 | p02713 | python | s172778467 | s416037176 | 1,940 | 1,157 | 9,108 | 9,020 | Accepted | Accepted | 40.36 | def gcd(a, b):
if a < b:
a, b = b, a
while b:
a, b = b, a % b
return a
k = int(eval(input()))
sum = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
gcd_ij = gcd(i, j)
for k in range(1, k + 1):
sum += gcd(gcd_ij, k)
print(sum) | from math import gcd
k = int(eval(input()))
sum = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
gcd_ij = gcd(i, j)
for k in range(1, k + 1):
sum += gcd(gcd_ij, k)
print(sum) | 16 | 9 | 302 | 215 | def gcd(a, b):
if a < b:
a, b = b, a
while b:
a, b = b, a % b
return a
k = int(eval(input()))
sum = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
gcd_ij = gcd(i, j)
for k in range(1, k + 1):
sum += gcd(gcd_ij, k)
print(sum)
| from math import gcd
k = int(eval(input()))
sum = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
gcd_ij = gcd(i, j)
for k in range(1, k + 1):
sum += gcd(gcd_ij, k)
print(sum)
| false | 43.75 | [
"-def gcd(a, b):",
"- if a < b:",
"- a, b = b, a",
"- while b:",
"- a, b = b, a % b",
"- return a",
"-",
"+from math import gcd"
] | false | 0.177702 | 0.146084 | 1.216444 | [
"s172778467",
"s416037176"
] |
u922449550 | p02714 | python | s721511424 | s632947125 | 1,381 | 657 | 9,692 | 9,848 | Accepted | Accepted | 52.43 | import itertools
import bisect
N = int(eval(input()))
S = eval(input())
R_set = set()
G_set = set()
B_set = set()
R = []
G = []
B = []
R_ids = [0] * N
G_ids = [0] * N
B_ids = [0] * N
for i, s in enumerate(S):
if s == 'R':
R_set.add(i)
R.append(i)
R_ids[i] = 1
elif s... | import itertools
import bisect
N = int(eval(input()))
S = eval(input())
R_set = set()
G_set = set()
B_set = set()
R = []
G = []
B = []
R_ids = [0] * N
G_ids = [0] * N
B_ids = [0] * N
for i, s in enumerate(S):
if s == 'R':
R_set.add(i)
R.append(i)
R_ids[i] = 1
elif s... | 88 | 59 | 1,962 | 1,234 | import itertools
import bisect
N = int(eval(input()))
S = eval(input())
R_set = set()
G_set = set()
B_set = set()
R = []
G = []
B = []
R_ids = [0] * N
G_ids = [0] * N
B_ids = [0] * N
for i, s in enumerate(S):
if s == "R":
R_set.add(i)
R.append(i)
R_ids[i] = 1
elif s == "G":
G_se... | import itertools
import bisect
N = int(eval(input()))
S = eval(input())
R_set = set()
G_set = set()
B_set = set()
R = []
G = []
B = []
R_ids = [0] * N
G_ids = [0] * N
B_ids = [0] * N
for i, s in enumerate(S):
if s == "R":
R_set.add(i)
R.append(i)
R_ids[i] = 1
elif s == "G":
G_se... | false | 32.954545 | [
"+r = (R_set, R, R_ids)",
"+g = (G_set, G, G_ids)",
"+b = (B_set, B, B_ids)",
"+",
"+",
"+def count_rgb(r, g, b):",
"+ res = 0",
"+ r_set, _r, r_ids = r",
"+ g_set, _g, g_ids = g",
"+ b_set, _b, b_ids = b",
"+ for r_idx in _r:",
"+ start = bisect.bisect_left(_g, r_idx)",
... | false | 0.043765 | 0.043364 | 1.009259 | [
"s721511424",
"s632947125"
] |
u437215432 | p02713 | python | s331841393 | s422049532 | 1,982 | 1,207 | 10,380 | 9,084 | Accepted | Accepted | 39.1 | # ABC162C
from fractions import gcd
from math import gcd
k = int(eval(input()))
total = 0
for a in range(1, k+1):
for b in range(1, k+1):
for c in range(1, k+1):
# print(a, b, c, gcd(a, gcd(b, c)))
total += gcd(a, gcd(b, c))
print(total)
| from math import gcd
k = int(eval(input()))
total = 0
for a in range(1, k+1):
for b in range(1, k+1):
t = gcd(a, b)
for c in range(1, k+1):
# print(a, b, c, gcd(a, gcd(b, c)))
total += gcd(t, c)
print(total) # sample_02 1982 ms
| 13 | 11 | 282 | 277 | # ABC162C
from fractions import gcd
from math import gcd
k = int(eval(input()))
total = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
# print(a, b, c, gcd(a, gcd(b, c)))
total += gcd(a, gcd(b, c))
print(total)
| from math import gcd
k = int(eval(input()))
total = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
t = gcd(a, b)
for c in range(1, k + 1):
# print(a, b, c, gcd(a, gcd(b, c)))
total += gcd(t, c)
print(total) # sample_02 1982 ms
| false | 15.384615 | [
"-# ABC162C",
"-from fractions import gcd",
"+ t = gcd(a, b)",
"- total += gcd(a, gcd(b, c))",
"-print(total)",
"+ total += gcd(t, c)",
"+print(total) # sample_02 1982 ms"
] | false | 0.05725 | 0.332934 | 0.171956 | [
"s331841393",
"s422049532"
] |
u949876708 | p02923 | python | s317229269 | s365438704 | 89 | 66 | 14,252 | 14,252 | Accepted | Accepted | 25.84 | n=int(eval(input()))
h=[int(i) for i in input().split()]
c=0
d=c
for i in range(n-1):
if h[i]>=h[i+1]:
c+=1
else:
d=max([c,d])
c=0
print((max([c,d]))) | n = int(eval(input()))
L = list(map(int, input().split()))
tmp = 0
result = 0
for i in range(n-1):
if L[i] >= L[i+1]:
tmp += 1
else:
if tmp > result:
result = tmp
tmp = 0
if tmp > result:
result = tmp
print(result) | 12 | 15 | 186 | 271 | n = int(eval(input()))
h = [int(i) for i in input().split()]
c = 0
d = c
for i in range(n - 1):
if h[i] >= h[i + 1]:
c += 1
else:
d = max([c, d])
c = 0
print((max([c, d])))
| n = int(eval(input()))
L = list(map(int, input().split()))
tmp = 0
result = 0
for i in range(n - 1):
if L[i] >= L[i + 1]:
tmp += 1
else:
if tmp > result:
result = tmp
tmp = 0
if tmp > result:
result = tmp
print(result)
| false | 20 | [
"-h = [int(i) for i in input().split()]",
"-c = 0",
"-d = c",
"+L = list(map(int, input().split()))",
"+tmp = 0",
"+result = 0",
"- if h[i] >= h[i + 1]:",
"- c += 1",
"+ if L[i] >= L[i + 1]:",
"+ tmp += 1",
"- d = max([c, d])",
"- c = 0",
"-print((max([c, d]... | false | 0.07091 | 0.115715 | 0.612802 | [
"s317229269",
"s365438704"
] |
u095021077 | p02945 | python | s128251957 | s981643815 | 182 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.66 | temp=list(map(int, input().split()))
print((max([temp[0]+temp[1], temp[0]-temp[1], temp[0]*temp[1]]))) | A, B= list(map(int, input().split()))
c= A+B
d= A-B
e= A*B
f=max(c, d, e)
print(f) | 3 | 6 | 103 | 81 | temp = list(map(int, input().split()))
print((max([temp[0] + temp[1], temp[0] - temp[1], temp[0] * temp[1]])))
| A, B = list(map(int, input().split()))
c = A + B
d = A - B
e = A * B
f = max(c, d, e)
print(f)
| false | 50 | [
"-temp = list(map(int, input().split()))",
"-print((max([temp[0] + temp[1], temp[0] - temp[1], temp[0] * temp[1]])))",
"+A, B = list(map(int, input().split()))",
"+c = A + B",
"+d = A - B",
"+e = A * B",
"+f = max(c, d, e)",
"+print(f)"
] | false | 0.04802 | 0.084422 | 0.568812 | [
"s128251957",
"s981643815"
] |
u912115033 | p03575 | python | s662365611 | s488767549 | 347 | 32 | 3,572 | 3,572 | Accepted | Accepted | 90.78 | from copy import deepcopy
def dfs(v):
visited[v] = 1
ret = 1
for w in range(n):
if [v, w] not in r:
continue
elif visited[w] == 1:
continue
ret += dfs(w)
visited[w] = 1
return ret
n,m = list(map(int,input().split()))
x = []
cn... | from copy import deepcopy
def dfs(v):
visited[v] = 1
ret = 1
for w in r[v]:
if visited[w] == 1:
continue
ret += dfs(w)
visited[w] = 1
return ret
n,m = list(map(int,input().split()))
x = [[] for _ in range(n)]
x_list = []
cnt = 0
for _ in range(m)... | 31 | 31 | 573 | 628 | from copy import deepcopy
def dfs(v):
visited[v] = 1
ret = 1
for w in range(n):
if [v, w] not in r:
continue
elif visited[w] == 1:
continue
ret += dfs(w)
visited[w] = 1
return ret
n, m = list(map(int, input().split()))
x = []
cnt = 0
for _ in r... | from copy import deepcopy
def dfs(v):
visited[v] = 1
ret = 1
for w in r[v]:
if visited[w] == 1:
continue
ret += dfs(w)
visited[w] = 1
return ret
n, m = list(map(int, input().split()))
x = [[] for _ in range(n)]
x_list = []
cnt = 0
for _ in range(m):
a, b = lis... | false | 0 | [
"- for w in range(n):",
"- if [v, w] not in r:",
"- continue",
"- elif visited[w] == 1:",
"+ for w in r[v]:",
"+ if visited[w] == 1:",
"-x = []",
"+x = [[] for _ in range(n)]",
"+x_list = []",
"- x.append([a - 1, b - 1])",
"- x.append([b - 1, a - 1])",... | false | 0.059115 | 0.058574 | 1.009232 | [
"s662365611",
"s488767549"
] |
u076363290 | p02657 | python | s590766731 | s126355360 | 28 | 25 | 9,060 | 9,028 | Accepted | Accepted | 10.71 | a, b = list(map(int, input().split()))
answer = a * b
print(answer) | a, b = list(map(int, input().split()))
print((a*b)) | 3 | 2 | 63 | 44 | a, b = list(map(int, input().split()))
answer = a * b
print(answer)
| a, b = list(map(int, input().split()))
print((a * b))
| false | 33.333333 | [
"-answer = a * b",
"-print(answer)",
"+print((a * b))"
] | false | 0.081226 | 0.03645 | 2.22842 | [
"s590766731",
"s126355360"
] |
u392029857 | p03107 | python | s398495511 | s825625893 | 24 | 19 | 3,956 | 3,188 | Accepted | Accepted | 20.83 | s = list(eval(input()))
print((len(s) - (abs(s.count('0')-s.count('1'))))) | s = eval(input())
print((2*min(s.count('1'),s.count('0')))) | 2 | 2 | 67 | 52 | s = list(eval(input()))
print((len(s) - (abs(s.count("0") - s.count("1")))))
| s = eval(input())
print((2 * min(s.count("1"), s.count("0"))))
| false | 0 | [
"-s = list(eval(input()))",
"-print((len(s) - (abs(s.count(\"0\") - s.count(\"1\")))))",
"+s = eval(input())",
"+print((2 * min(s.count(\"1\"), s.count(\"0\"))))"
] | false | 0.101486 | 0.03821 | 2.655971 | [
"s398495511",
"s825625893"
] |
u025501820 | p02954 | python | s729029296 | s174925134 | 211 | 144 | 14,036 | 11,340 | Accepted | Accepted | 31.75 | import math
from collections import deque
S = eval(input())
L_kyoukai = []
R_kyoukai = [0]
flag = False
for i in range(1, len(S)):
if flag is False and S[i] == "L":
L_kyoukai.append(i)
R_kyoukai.append(i - 1)
flag = True
if flag is True and S[i] == "R":
L_kyoukai.appe... | import math
from collections import deque
S = eval(input())
ans = [0 for _ in range(len(S))]
cnt = 0
for i in range(len(S) - 1):
if S[i] == "R":
if S[i + 1] == "R":
cnt += 1
else:
cnt += 1
ans[i] += math.ceil(cnt / 2)
ans[i + 1] += cnt - ma... | 48 | 28 | 1,381 | 695 | import math
from collections import deque
S = eval(input())
L_kyoukai = []
R_kyoukai = [0]
flag = False
for i in range(1, len(S)):
if flag is False and S[i] == "L":
L_kyoukai.append(i)
R_kyoukai.append(i - 1)
flag = True
if flag is True and S[i] == "R":
L_kyoukai.append(i - 1)
... | import math
from collections import deque
S = eval(input())
ans = [0 for _ in range(len(S))]
cnt = 0
for i in range(len(S) - 1):
if S[i] == "R":
if S[i + 1] == "R":
cnt += 1
else:
cnt += 1
ans[i] += math.ceil(cnt / 2)
ans[i + 1] += cnt - math.ceil(cnt... | false | 41.666667 | [
"-L_kyoukai = []",
"-R_kyoukai = [0]",
"-flag = False",
"-for i in range(1, len(S)):",
"- if flag is False and S[i] == \"L\":",
"- L_kyoukai.append(i)",
"- R_kyoukai.append(i - 1)",
"- flag = True",
"- if flag is True and S[i] == \"R\":",
"- L_kyoukai.append(i - 1... | false | 0.047063 | 0.127937 | 0.367861 | [
"s729029296",
"s174925134"
] |
u401487574 | p02596 | python | s561519587 | s476987426 | 405 | 172 | 68,220 | 9,412 | Accepted | Accepted | 57.53 | ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
k = ni()
a = 0
for i in range(10**6):
a=(a+7*pow(10,i,k))%k
if a== 0:
print(i+1)
break
else:
pri... | ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
k = ni()
if k%2==0 or k%5==0:
print(-1)
exit()
if k%7==0:
L=9*k//7
else:
L=9*k
tmp=1
for i in range(1,10*... | 16 | 24 | 327 | 417 | ma = lambda: map(int, input().split())
ni = lambda: int(input())
yn = lambda fl: print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
k = ni()
a = 0
for i in range(10**6):
a = (a + 7 * pow(10, i, k)) % k
if a == 0:
print(i + 1)
break
else:
p... | ma = lambda: map(int, input().split())
ni = lambda: int(input())
yn = lambda fl: print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
k = ni()
if k % 2 == 0 or k % 5 == 0:
print(-1)
exit()
if k % 7 == 0:
L = 9 * k // 7
else:
L = 9 * k
tmp = 1
for i in r... | false | 33.333333 | [
"-a = 0",
"-for i in range(10**6):",
"- a = (a + 7 * pow(10, i, k)) % k",
"- if a == 0:",
"- print(i + 1)",
"+if k % 2 == 0 or k % 5 == 0:",
"+ print(-1)",
"+ exit()",
"+if k % 7 == 0:",
"+ L = 9 * k // 7",
"+else:",
"+ L = 9 * k",
"+tmp = 1",
"+for i in range(1, 1... | false | 0.560756 | 0.088152 | 6.361266 | [
"s561519587",
"s476987426"
] |
u390901183 | p02708 | python | s079487408 | s401745953 | 185 | 152 | 9,948 | 9,828 | Accepted | Accepted | 17.84 | from collections import deque
import sys
import bisect
import math
import itertools
from queue import deque
from math import gcd
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inp_list(): return list(map(int, sys.stdin.readline().split()))
def lcm(x, ... | from collections import deque
import sys
import bisect
import math
import itertools
from queue import deque
from math import gcd
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inp_list(): return list(map(int, sys.stdin.readline().split()))
def lcm(x, ... | 27 | 27 | 618 | 600 | from collections import deque
import sys
import bisect
import math
import itertools
from queue import deque
from math import gcd
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7
def inp():
return int(sys.stdin.readline())
def inp_list():
return list(map(int, sys.stdin.readline().split()))
def lcm(x, y):
... | from collections import deque
import sys
import bisect
import math
import itertools
from queue import deque
from math import gcd
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7
def inp():
return int(sys.stdin.readline())
def inp_list():
return list(map(int, sys.stdin.readline().split()))
def lcm(x, y):
... | false | 0 | [
"- M = (N * (N + 1) // 2 - (N - k) * (N + 1 - k) // 2) % mod",
"- m = k * (k - 1) // 2 % mod",
"- ans += (M - m + 1) % mod",
"+ M = N * (N + 1) // 2 - (N - k) * (N + 1 - k) // 2",
"+ m = k * (k - 1) // 2",
"+ ans += M - m + 1"
] | false | 0.08703 | 0.105148 | 0.827697 | [
"s079487408",
"s401745953"
] |
u227020436 | p02702 | python | s354040062 | s298997351 | 169 | 104 | 9,676 | 77,744 | Accepted | Accepted | 38.46 | # D - Multiple of 2019
from collections import Counter
s = eval(input())
count = 0
counter = Counter([0])
suffix = 0
pow = 1
for i in range(len(s) - 1, -1, -1):
suffix = (int(s[i]) * pow + suffix) % 2019
pow = pow * 10 % 2019
count += counter[suffix]
counter[suffix] += 1
print(coun... | # D - Multiple of 2019
from collections import Counter
s = eval(input())
r = [0]
for d in map(int, s):
r.append((r[-1] * 10 + d) % 2019)
e = 1
for i in range(len(r) - 1, -1, -1):
r[i] = r[i] * e % 2019
e = e * 10 % 2019
def choose2(x):
return x * (x - 1) // 2
counter = Counter(r)... | 18 | 20 | 317 | 364 | # D - Multiple of 2019
from collections import Counter
s = eval(input())
count = 0
counter = Counter([0])
suffix = 0
pow = 1
for i in range(len(s) - 1, -1, -1):
suffix = (int(s[i]) * pow + suffix) % 2019
pow = pow * 10 % 2019
count += counter[suffix]
counter[suffix] += 1
print(count)
| # D - Multiple of 2019
from collections import Counter
s = eval(input())
r = [0]
for d in map(int, s):
r.append((r[-1] * 10 + d) % 2019)
e = 1
for i in range(len(r) - 1, -1, -1):
r[i] = r[i] * e % 2019
e = e * 10 % 2019
def choose2(x):
return x * (x - 1) // 2
counter = Counter(r)
print((sum(choose2... | false | 10 | [
"-count = 0",
"-counter = Counter([0])",
"-suffix = 0",
"-pow = 1",
"-for i in range(len(s) - 1, -1, -1):",
"- suffix = (int(s[i]) * pow + suffix) % 2019",
"- pow = pow * 10 % 2019",
"- count += counter[suffix]",
"- counter[suffix] += 1",
"-print(count)",
"+r = [0]",
"+for d in map... | false | 0.054341 | 0.035768 | 1.519268 | [
"s354040062",
"s298997351"
] |
u644907318 | p03472 | python | s166133794 | s319480384 | 632 | 232 | 63,064 | 96,840 | Accepted | Accepted | 63.29 | from bisect import bisect_right
N,H = list(map(int,input().split()))
A = []
B = []
for _ in range(N):
a,b = list(map(int,input().split()))
A.append(a)
B.append(b)
A = sorted(A,reverse=True)
B = sorted(B)
a = A[0]
ind = bisect_right(B,a)
cnt = 0
flag = 0
for i in range(N-1,ind-1,-1):
H -= ... | import math
N,H = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]
a = 0
for i in range(N):
if A[i][0]>a:
a = A[i][0]
B = []
for i in range(N):
if A[i][1]>a:
B.append(A[i][1])
B = sorted(B,reverse=True)
totB = sum(B)
if totB>=H:
flag = 0
... | 26 | 26 | 457 | 521 | from bisect import bisect_right
N, H = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A = sorted(A, reverse=True)
B = sorted(B)
a = A[0]
ind = bisect_right(B, a)
cnt = 0
flag = 0
for i in range(N - 1, ind - 1, -1):
H -= B[... | import math
N, H = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
a = 0
for i in range(N):
if A[i][0] > a:
a = A[i][0]
B = []
for i in range(N):
if A[i][1] > a:
B.append(A[i][1])
B = sorted(B, reverse=True)
totB = sum(B)
if totB >= H:
flag = 0
to... | false | 0 | [
"-from bisect import bisect_right",
"+import math",
"-A = []",
"+A = [list(map(int, input().split())) for _ in range(N)]",
"+a = 0",
"+for i in range(N):",
"+ if A[i][0] > a:",
"+ a = A[i][0]",
"-for _ in range(N):",
"- a, b = list(map(int, input().split()))",
"- A.append(a)",
... | false | 0.079669 | 0.037316 | 2.135006 | [
"s166133794",
"s319480384"
] |
u564902833 | p02996 | python | s225406902 | s701700777 | 1,517 | 1,272 | 138,064 | 112,472 | Accepted | Accepted | 16.15 | N = int(eval(input()))
A, B = (
list(zip(*(list(map(int, input().split())) for _ in range(N)))) if N else
((), ())
)
a, b = list(zip(*sorted(zip(A, B), key=lambda t: t[1])))
t = 0
ans = 'Yes'
for x, y in zip(a, b):
t += x
if t > y:
ans = 'No'
print(ans)
| from functools import reduce
# 出力
N = int(eval(input()))
A, B = (
list(zip(*(list(map(int, input().split())) for _ in range(N)))) if N else
((), ())
)
# 〆切時刻が小さい順にgreedyに仕事を処理する
ans, _ = reduce(
lambda acc, t:
(
'Yes' if acc[0] == 'Yes' and acc[1] + t[0] <= t[1] else
... | 16 | 23 | 272 | 438 | N = int(eval(input()))
A, B = (
list(zip(*(list(map(int, input().split())) for _ in range(N)))) if N else ((), ())
)
a, b = list(zip(*sorted(zip(A, B), key=lambda t: t[1])))
t = 0
ans = "Yes"
for x, y in zip(a, b):
t += x
if t > y:
ans = "No"
print(ans)
| from functools import reduce
# 出力
N = int(eval(input()))
A, B = (
list(zip(*(list(map(int, input().split())) for _ in range(N)))) if N else ((), ())
)
# 〆切時刻が小さい順にgreedyに仕事を処理する
ans, _ = reduce(
lambda acc, t: (
"Yes" if acc[0] == "Yes" and acc[1] + t[0] <= t[1] else "No",
acc[1] + t[0],
),... | false | 30.434783 | [
"+from functools import reduce",
"+",
"+# 出力",
"-a, b = list(zip(*sorted(zip(A, B), key=lambda t: t[1])))",
"-t = 0",
"-ans = \"Yes\"",
"-for x, y in zip(a, b):",
"- t += x",
"- if t > y:",
"- ans = \"No\"",
"+# 〆切時刻が小さい順にgreedyに仕事を処理する",
"+ans, _ = reduce(",
"+ lambda acc, t... | false | 0.046274 | 0.049433 | 0.936081 | [
"s225406902",
"s701700777"
] |
u592547545 | p03013 | python | s979305746 | s665756013 | 197 | 146 | 30,272 | 14,380 | Accepted | Accepted | 25.89 | def readinput():
n,m=list(map(int,input().split()))
a=[]
for _ in range(m):
a.append(int(eval(input())))
return n,a
def main(n,a):
MOD=10**9+7
nroute=[0]*(n+2)
nroute[0]=0
nroute[1]=1
nroute[2]=1
for i in range(3,n+2):
nroute[i]=(nroute[i-1]+nrout... | import sys
INFTY=sys.maxsize
def readinput():
n,m=list(map(int,input().split()))
a=[]
for _ in range(m):
a.append(int(eval(input())))
return n,m,a
def main(n,m,a):
MOD=10**9+7
dp=[0]*(n+3)
dp[0]=1
ia=0
for i in range(n+1):
if ia<m and i==a[ia]:
... | 38 | 30 | 673 | 576 | def readinput():
n, m = list(map(int, input().split()))
a = []
for _ in range(m):
a.append(int(eval(input())))
return n, a
def main(n, a):
MOD = 10**9 + 7
nroute = [0] * (n + 2)
nroute[0] = 0
nroute[1] = 1
nroute[2] = 1
for i in range(3, n + 2):
nroute[i] = (nro... | import sys
INFTY = sys.maxsize
def readinput():
n, m = list(map(int, input().split()))
a = []
for _ in range(m):
a.append(int(eval(input())))
return n, m, a
def main(n, m, a):
MOD = 10**9 + 7
dp = [0] * (n + 3)
dp[0] = 1
ia = 0
for i in range(n + 1):
if ia < m an... | false | 21.052632 | [
"+import sys",
"+",
"+INFTY = sys.maxsize",
"+",
"+",
"- return n, a",
"+ return n, m, a",
"-def main(n, a):",
"+def main(n, m, a):",
"- nroute = [0] * (n + 2)",
"- nroute[0] = 0",
"- nroute[1] = 1",
"- nroute[2] = 1",
"- for i in range(3, n + 2):",
"- nroute[... | false | 0.045574 | 0.040802 | 1.116965 | [
"s979305746",
"s665756013"
] |
u036104576 | p02815 | python | s404626652 | s415153054 | 535 | 322 | 50,812 | 31,612 | Accepted | Accepted | 39.81 | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdi... | MOD = 10 ** 9 + 7
N = int(eval(input()))
C = list(sorted(map(int, input().split()), reverse=True))
ans = 0
pow_list = [1] * (N + 1)
for i in range(1, N + 1):
pow_list[i] = (2 * pow_list[i - 1]) % MOD
base = pow_list[N]
# 基本戦略:コストが一番高いものを一番最後に変更する
for i, c in enumerate(C):
now = pow_list[N - i - 1]... | 86 | 23 | 1,900 | 578 | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
#... | MOD = 10**9 + 7
N = int(eval(input()))
C = list(sorted(map(int, input().split()), reverse=True))
ans = 0
pow_list = [1] * (N + 1)
for i in range(1, N + 1):
pow_list[i] = (2 * pow_list[i - 1]) % MOD
base = pow_list[N]
# 基本戦略:コストが一番高いものを一番最後に変更する
for i, c in enumerate(C):
now = pow_list[N - i - 1]
tot = 0
... | false | 73.255814 | [
"-import sys",
"-import itertools",
"-",
"-# import numpy as np",
"-import time",
"-import math",
"-import heapq",
"-from collections import defaultdict",
"-from collections import Counter",
"-",
"-sys.setrecursionlimit(10**7)",
"-INF = 10**18",
"-read = sys.stdin.buffer.read",
"-readline ... | false | 0.510595 | 0.036761 | 13.889493 | [
"s404626652",
"s415153054"
] |
u626337957 | p03701 | python | s700433615 | s783669780 | 143 | 117 | 3,188 | 3,060 | Accepted | Accepted | 18.18 | N = int(eval(input()))
nums=[int(eval(input())) for _ in range(N)]
sum_num = sum(nums)
dp = [0] * (sum_num+1)
dp[0] = 1
for num in nums:
for i in range(sum_num+1)[::-1]:
if dp[i] == 1 and i + num <= sum_num:
dp[i+num] = 1
ans = 0
for i in range(sum_num+1):
if dp[i] == 1 and i%10 != 0:
ans ... | N = int(eval(input()))
nums=[int(eval(input())) for _ in range(N)]
sum_num = sum(nums)
dp = [0] * (sum_num+1)
dp[0] = 1
for num in nums:
for i in range(sum_num+1)[::-1]:
if dp[i] == 1:
dp[i+num] = 1
ans = 0
for i in range(sum_num+1):
if dp[i] == 1 and i%10 != 0:
ans = i
print(ans)
| 14 | 14 | 324 | 301 | N = int(eval(input()))
nums = [int(eval(input())) for _ in range(N)]
sum_num = sum(nums)
dp = [0] * (sum_num + 1)
dp[0] = 1
for num in nums:
for i in range(sum_num + 1)[::-1]:
if dp[i] == 1 and i + num <= sum_num:
dp[i + num] = 1
ans = 0
for i in range(sum_num + 1):
if dp[i] == 1 and i % 10 ... | N = int(eval(input()))
nums = [int(eval(input())) for _ in range(N)]
sum_num = sum(nums)
dp = [0] * (sum_num + 1)
dp[0] = 1
for num in nums:
for i in range(sum_num + 1)[::-1]:
if dp[i] == 1:
dp[i + num] = 1
ans = 0
for i in range(sum_num + 1):
if dp[i] == 1 and i % 10 != 0:
ans = i
p... | false | 0 | [
"- if dp[i] == 1 and i + num <= sum_num:",
"+ if dp[i] == 1:"
] | false | 0.038605 | 0.033114 | 1.165803 | [
"s700433615",
"s783669780"
] |
u895515293 | p02720 | python | s717987979 | s344037987 | 180 | 112 | 17,004 | 11,956 | Accepted | Accepted | 37.78 | import sys
from collections import deque
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x i... | import sys
from collections import deque
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x i... | 32 | 32 | 923 | 868 | import sys
from collections import deque
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y):
return pow(x, y, DVSR)
def INV(x, d=DVSR):
return pow(x, d - 2, d)
def DIV(x, y, d=DVSR):
return (x * INV(y, d)) % d
def LI():
return... | import sys
from collections import deque
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y):
return pow(x, y, DVSR)
def INV(x, d=DVSR):
return pow(x, d - 2, d)
def DIV(x, y, d=DVSR):
return (x * INV(y, d)) % d
def LI():
return... | false | 0 | [
"-deq = deque([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"])",
"+deq = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])",
"- last = int(v[-1])",
"+ last = v % 10",
"- deq.append(v + \"0\")",
"- deq.append(v + \"1\")",
"+ deq.append(10 * v)",
"+ deq.append(10 * v +... | false | 0.152333 | 0.286682 | 0.531364 | [
"s717987979",
"s344037987"
] |
u537782349 | p03212 | python | s649638294 | s618299935 | 55 | 48 | 3,064 | 3,060 | Accepted | Accepted | 12.73 | def ac(s, t, int3, int5, int7):
if s == "":
return ac(s + "3", t, int3 + 1, int5, int7) \
+ ac(s + "5", t, int3, int5+1, int7) \
+ ac(s + "7", t, int3, int5, int7+1)
elif int(s) <= t:
if int3 != 0 and int5 != 0 and int7 != 0:
return 1 \
... | import itertools
a = eval(input())
b = list("357")
c = 0
for j in range(3, len(a) + 1):
for i in itertools.product(b, repeat=j):
if int("".join(i)) <= int(a) and "3" in i and "5" in i and "7" in i:
c += 1
print(c)
| 22 | 9 | 785 | 240 | def ac(s, t, int3, int5, int7):
if s == "":
return (
ac(s + "3", t, int3 + 1, int5, int7)
+ ac(s + "5", t, int3, int5 + 1, int7)
+ ac(s + "7", t, int3, int5, int7 + 1)
)
elif int(s) <= t:
if int3 != 0 and int5 != 0 and int7 != 0:
return (
... | import itertools
a = eval(input())
b = list("357")
c = 0
for j in range(3, len(a) + 1):
for i in itertools.product(b, repeat=j):
if int("".join(i)) <= int(a) and "3" in i and "5" in i and "7" in i:
c += 1
print(c)
| false | 59.090909 | [
"-def ac(s, t, int3, int5, int7):",
"- if s == \"\":",
"- return (",
"- ac(s + \"3\", t, int3 + 1, int5, int7)",
"- + ac(s + \"5\", t, int3, int5 + 1, int7)",
"- + ac(s + \"7\", t, int3, int5, int7 + 1)",
"- )",
"- elif int(s) <= t:",
"- if... | false | 0.042755 | 0.158281 | 0.27012 | [
"s649638294",
"s618299935"
] |
u225388820 | p02558 | python | s975908780 | s995370225 | 314 | 270 | 76,352 | 75,140 | Accepted | Accepted | 14.01 | def main():
class UnionFind:
def __init__(self, N):
"""
N:要素数
root:各要素の親要素の番号を格納するリスト.
ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
rank:ランク
"""
self.N = N
self.root = [-1] * N
self.rank =... | class UnionFind:
def __init__(self, N: int):
"""
N:要素数
root:各要素の親要素の番号を格納するリスト.
ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
rank:ランク
"""
self.N = N
self.root = [-1] * N
self.rank = [0] * N
def __repr__(self):
return... | 57 | 79 | 1,621 | 2,151 | def main():
class UnionFind:
def __init__(self, N):
"""
N:要素数
root:各要素の親要素の番号を格納するリスト.
ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
rank:ランク
"""
self.N = N
self.root = [-1] * N
self.rank = [0] * N
... | class UnionFind:
def __init__(self, N: int):
"""
N:要素数
root:各要素の親要素の番号を格納するリスト.
ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
rank:ランク
"""
self.N = N
self.root = [-1] * N
self.rank = [0] * N
def __repr__(self):
return "\n".join("{... | false | 27.848101 | [
"-def main():",
"- class UnionFind:",
"- def __init__(self, N):",
"- \"\"\"",
"- N:要素数",
"- root:各要素の親要素の番号を格納するリスト.",
"- ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.",
"- rank:ランク",
"- \"\"\"",
"- self.N = N",... | false | 0.037288 | 0.083678 | 0.445614 | [
"s975908780",
"s995370225"
] |
u530383736 | p02813 | python | s925068036 | s617942257 | 80 | 29 | 6,040 | 7,924 | Accepted | Accepted | 63.75 | # -*- coding: utf-8 -*-
from itertools import permutations
N = int(input().strip())
pat_P = [ "".join( input().rstrip().split() )][0]
pat_Q = [ "".join( input().rstrip().split() )][0]
#-----
perm_list = [ "".join( map(str, pat) ) for pat in permutations(list(range(1,N+1)))]
perm_list.sort()
a = perm_list.... | # -*- coding: utf-8 -*-
from itertools import permutations
N = int(input().strip())
pat_P = tuple(map(int, input().rstrip().split()))
pat_Q = tuple(map(int, input().rstrip().split()))
#-----
perm_list = [ pat for pat in permutations(list(range(1,N+1)))]
a = perm_list.index(pat_P) + 1
b = perm_list.index(p... | 14 | 13 | 380 | 341 | # -*- coding: utf-8 -*-
from itertools import permutations
N = int(input().strip())
pat_P = ["".join(input().rstrip().split())][0]
pat_Q = ["".join(input().rstrip().split())][0]
# -----
perm_list = ["".join(map(str, pat)) for pat in permutations(list(range(1, N + 1)))]
perm_list.sort()
a = perm_list.index(pat_P) + 1
b... | # -*- coding: utf-8 -*-
from itertools import permutations
N = int(input().strip())
pat_P = tuple(map(int, input().rstrip().split()))
pat_Q = tuple(map(int, input().rstrip().split()))
# -----
perm_list = [pat for pat in permutations(list(range(1, N + 1)))]
a = perm_list.index(pat_P) + 1
b = perm_list.index(pat_Q) + 1
... | false | 7.142857 | [
"-pat_P = [\"\".join(input().rstrip().split())][0]",
"-pat_Q = [\"\".join(input().rstrip().split())][0]",
"+pat_P = tuple(map(int, input().rstrip().split()))",
"+pat_Q = tuple(map(int, input().rstrip().split()))",
"-perm_list = [\"\".join(map(str, pat)) for pat in permutations(list(range(1, N + 1)))]",
"-... | false | 0.042941 | 0.038234 | 1.123096 | [
"s925068036",
"s617942257"
] |
u923606520 | p03107 | python | s726419542 | s982131448 | 266 | 178 | 44,016 | 40,048 | Accepted | Accepted | 33.08 | from collections import deque
deq=deque()
s=eval(input())
n=len(s)
for i in s:
if len(deq)==0:
deq.append(i)
continue
x=deq.pop()
if x==i:
deq.append(x)
deq.append(i)
print((n-len(deq))) | from collections import Counter
s=eval(input())
c=Counter(s)
print((min(c["0"],c["1"])*2)) | 13 | 4 | 234 | 85 | from collections import deque
deq = deque()
s = eval(input())
n = len(s)
for i in s:
if len(deq) == 0:
deq.append(i)
continue
x = deq.pop()
if x == i:
deq.append(x)
deq.append(i)
print((n - len(deq)))
| from collections import Counter
s = eval(input())
c = Counter(s)
print((min(c["0"], c["1"]) * 2))
| false | 69.230769 | [
"-from collections import deque",
"+from collections import Counter",
"-deq = deque()",
"-n = len(s)",
"-for i in s:",
"- if len(deq) == 0:",
"- deq.append(i)",
"- continue",
"- x = deq.pop()",
"- if x == i:",
"- deq.append(x)",
"- deq.append(i)",
"-print... | false | 0.045642 | 0.046466 | 0.982276 | [
"s726419542",
"s982131448"
] |
u732870425 | p02678 | python | s438976801 | s605950991 | 1,683 | 514 | 105,680 | 101,732 | Accepted | Accepted | 69.46 | N, M = list(map(int, input().split()))
L = [[] for _ in range(N+1)]
for _ in range(M):
a, b = list(map(int, input().split()))
L[a].append(b)
L[b].append(a)
ans = [0 for _ in range(N+1)]
now = [1]
next = []
while len(now):
for x in now:
for y in L[x]:
if (ans[y] == 0) ... | N, M = list(map(int, input().split()))
L = [[] for _ in range(N+1)]
for _ in range(M):
a, b = list(map(int, input().split()))
L[a].append(b)
L[b].append(a)
ans = [0 for _ in range(N+1)]
now = [1]
next = []
while len(now):
for x in now:
for y in L[x]:
if (ans[y] == 0):... | 23 | 23 | 485 | 467 | N, M = list(map(int, input().split()))
L = [[] for _ in range(N + 1)]
for _ in range(M):
a, b = list(map(int, input().split()))
L[a].append(b)
L[b].append(a)
ans = [0 for _ in range(N + 1)]
now = [1]
next = []
while len(now):
for x in now:
for y in L[x]:
if (ans[y] == 0) and (y not i... | N, M = list(map(int, input().split()))
L = [[] for _ in range(N + 1)]
for _ in range(M):
a, b = list(map(int, input().split()))
L[a].append(b)
L[b].append(a)
ans = [0 for _ in range(N + 1)]
now = [1]
next = []
while len(now):
for x in now:
for y in L[x]:
if ans[y] == 0:
... | false | 0 | [
"- if (ans[y] == 0) and (y not in now):",
"+ if ans[y] == 0:"
] | false | 0.041253 | 0.041777 | 0.98745 | [
"s438976801",
"s605950991"
] |
u366886346 | p03304 | python | s545763766 | s782799610 | 33 | 27 | 9,944 | 8,984 | Accepted | Accepted | 18.18 | import decimal
n,m,d=list(map(int,input().split()))
print((decimal.Decimal(((2**min(1,d))*(n-d)*(m-1))/(n**2))))
| n,m,d=list(map(int,input().split()))
print((((2**min(1,d))*(n-d)*(m-1))/(n**2)))
| 3 | 2 | 107 | 74 | import decimal
n, m, d = list(map(int, input().split()))
print((decimal.Decimal(((2 ** min(1, d)) * (n - d) * (m - 1)) / (n**2))))
| n, m, d = list(map(int, input().split()))
print((((2 ** min(1, d)) * (n - d) * (m - 1)) / (n**2)))
| false | 33.333333 | [
"-import decimal",
"-",
"-print((decimal.Decimal(((2 ** min(1, d)) * (n - d) * (m - 1)) / (n**2))))",
"+print((((2 ** min(1, d)) * (n - d) * (m - 1)) / (n**2)))"
] | false | 0.04874 | 0.04659 | 1.046154 | [
"s545763766",
"s782799610"
] |
u923662841 | p03252 | python | s616003821 | s809638196 | 108 | 40 | 20,708 | 9,288 | Accepted | Accepted | 62.96 | S = eval(input())
T = eval(input())
s = {d:[] for d in set(S)}
t = {d:[] for d in set(T)}
for i, (j,k) in enumerate(zip(S,T)):
s[j] += [i]
t[k] += [i]
a = sorted(s.values())
b = sorted(t.values())
print(('Yes' if a==b else "No")) | s=eval(input())
t=eval(input())
S=sorted(map(s.count,set(s)))
T=sorted(map(t.count,set(t)))
print(("Yes" if S==T else "No")) | 12 | 5 | 236 | 114 | S = eval(input())
T = eval(input())
s = {d: [] for d in set(S)}
t = {d: [] for d in set(T)}
for i, (j, k) in enumerate(zip(S, T)):
s[j] += [i]
t[k] += [i]
a = sorted(s.values())
b = sorted(t.values())
print(("Yes" if a == b else "No"))
| s = eval(input())
t = eval(input())
S = sorted(map(s.count, set(s)))
T = sorted(map(t.count, set(t)))
print(("Yes" if S == T else "No"))
| false | 58.333333 | [
"-S = eval(input())",
"-T = eval(input())",
"-s = {d: [] for d in set(S)}",
"-t = {d: [] for d in set(T)}",
"-for i, (j, k) in enumerate(zip(S, T)):",
"- s[j] += [i]",
"- t[k] += [i]",
"-a = sorted(s.values())",
"-b = sorted(t.values())",
"-print((\"Yes\" if a == b else \"No\"))",
"+s = ev... | false | 0.047193 | 0.052451 | 0.899745 | [
"s616003821",
"s809638196"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.