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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u440566786 | p02913 | python | s091573115 | s831144073 | 1,204 | 200 | 68,700 | 42,864 | Accepted | Accepted | 83.39 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
class RollingHash(object):
__base1=1007; __mod1=10**9+9
__base2=1009; __mod2=10**9+7
def __init__(self,s):
self.__s=s; self.__n=len(s)
b1=self.__base1; m1=self.... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
class RollingHash(object):
__base1=1007; __mod1=10**9+9
__base2=1009; __mod2=10**9+7
def __init__(self,s):
self.__s=s; self.__n=len(s)
b1=self.__base1; m1=self._... | 63 | 60 | 1,959 | 1,872 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
class RollingHash(object):
__base1 = 1007
__mod1 = 10**9 + 9
__base2 = 1009
__mod2 = 10**9 + 7
def __init__(self, s):
self.__s = s
self.__n = len(s)
... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
class RollingHash(object):
__base1 = 1007
__mod1 = 10**9 + 9
__base2 = 1009
__mod2 = 10**9 + 7
def __init__(self, s):
self.__s = s
self.__n = len(s)
... | false | 4.761905 | [
"+from collections import defaultdict",
"+",
"+",
"- from collections import defaultdict",
"- hash = rh[i : i + k]",
"- if D[hash] != -1:",
"- if i - D[hash] >= k:",
"+ h = rh[i : i + k]",
"+ if D[h] != -1:",
"+ if i - D[... | false | 0.043034 | 0.036883 | 1.166769 | [
"s091573115",
"s831144073"
] |
u439333767 | p03911 | python | s673376167 | s473058129 | 544 | 365 | 66,908 | 69,836 | Accepted | Accepted | 32.9 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
class UnionFind(object):
def __init__(self,n):
self.__par=list(range(n))
self.__rank=[0]*n
self.__size=[1]*n
def root(self,k):
if(self.__par[k]==k):... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n,m=list(map(int,input().split()))
# n,m ใฎ bipartite graph
E=[[] for _ in range(n+m)]
for i in range(n):
L=list([int(x)-1 for x in input().split()])[::-1]... | 50 | 29 | 1,309 | 698 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
class UnionFind(object):
def __init__(self, n):
self.__par = list(range(n))
self.__rank = [0] * n
self.__size = [1] * n
def root(self, k):
if self.__p... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, m = list(map(int, input().split()))
# n,m ใฎ bipartite graph
E = [[] for _ in range(n + m)]
for i in range(n):
L = list([int(x) - 1 for x in input().s... | false | 42 | [
"-class UnionFind(object):",
"- def __init__(self, n):",
"- self.__par = list(range(n))",
"- self.__rank = [0] * n",
"- self.__size = [1] * n",
"-",
"- def root(self, k):",
"- if self.__par[k] == k:",
"- return k",
"- self.__par[k] = self.root(se... | false | 0.041548 | 0.043998 | 0.944303 | [
"s673376167",
"s473058129"
] |
u296150111 | p03078 | python | s738927562 | s229906084 | 477 | 231 | 142,868 | 46,064 | Accepted | Accepted | 51.57 | def main():
X,Y,Z,k=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ab=[]
for x in a:
for y in b:
ab.append(x+y)
ab.sort(reverse=True)
if len(ab)>k:
ab=ab[:k+1]
c.sort()
l=0
r=max(ab)+max(c)+1
import bise... | x,y,z,k=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans=[]
for i in range(min(x,k+1)):
for j in range(y):
if (i+1)*(j+1)>k:
break
for l in range(z):
... | 34 | 20 | 681 | 444 | def main():
X, Y, Z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ab = []
for x in a:
for y in b:
ab.append(x + y)
ab.sort(reverse=True)
if len(ab) > k:
ab = 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()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans = []
for i in range(min(x, k + 1)):
for j in range(y):
if (i + 1) * (j + 1) > k:
... | false | 41.176471 | [
"-def main():",
"- X, Y, Z, k = list(map(int, input().split()))",
"- a = list(map(int, input().split()))",
"- b = list(map(int, input().split()))",
"- c = list(map(int, input().split()))",
"- ab = []",
"- for x in a:",
"- for y in b:",
"- ab.append(x + y)",
"- ... | false | 0.082768 | 0.106931 | 0.77403 | [
"s738927562",
"s229906084"
] |
u390727364 | p02780 | python | s579594235 | s874423771 | 265 | 234 | 67,824 | 66,800 | Accepted | Accepted | 11.7 | from sys import stdin, setrecursionlimit
def main():
n, k = list(map(int, stdin.readline().split()))
p = list(map(int, stdin.readline().split()))
sp = [0] * 1001
for i in range(1, 1001):
sp[i] = sum(range(i + 1)) / i
summary = [0] * n
summary[0] = sp[p[0]]
for i in... | from sys import stdin, setrecursionlimit
def main():
input = stdin.buffer.readline
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
e = [i * (i + 1) / (2 * i) for i in range(1, 1001)]
sum = [0] * n
sum[0] = e[p[0] - 1]
for i in range(1, n):
... | 28 | 26 | 609 | 569 | from sys import stdin, setrecursionlimit
def main():
n, k = list(map(int, stdin.readline().split()))
p = list(map(int, stdin.readline().split()))
sp = [0] * 1001
for i in range(1, 1001):
sp[i] = sum(range(i + 1)) / i
summary = [0] * n
summary[0] = sp[p[0]]
for i in range(1, n):
... | from sys import stdin, setrecursionlimit
def main():
input = stdin.buffer.readline
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
e = [i * (i + 1) / (2 * i) for i in range(1, 1001)]
sum = [0] * n
sum[0] = e[p[0] - 1]
for i in range(1, n):
sum[i] = sum[i ... | false | 7.142857 | [
"- n, k = list(map(int, stdin.readline().split()))",
"- p = list(map(int, stdin.readline().split()))",
"- sp = [0] * 1001",
"- for i in range(1, 1001):",
"- sp[i] = sum(range(i + 1)) / i",
"- summary = [0] * n",
"- summary[0] = sp[p[0]]",
"+ input = stdin.buffer.readline",
... | false | 0.054073 | 0.034289 | 1.576994 | [
"s579594235",
"s874423771"
] |
u903005414 | p02548 | python | s161809782 | s307763217 | 212 | 150 | 9,152 | 9,116 | Accepted | Accepted | 29.25 | N = int(eval(input()))
cnt = 0
for a in range(1, N):
# print(f'{a=}, {N // a}')
if N % a == 0:
cnt += N // a - 1
else:
cnt += N // a
print(cnt)
| N = int(eval(input()))
cnt = 0
for a in range(1, N):
# print(f'{a=}, {N // a}')
cnt += (N - 1) // a
print(cnt)
| 11 | 8 | 178 | 122 | N = int(eval(input()))
cnt = 0
for a in range(1, N):
# print(f'{a=}, {N // a}')
if N % a == 0:
cnt += N // a - 1
else:
cnt += N // a
print(cnt)
| N = int(eval(input()))
cnt = 0
for a in range(1, N):
# print(f'{a=}, {N // a}')
cnt += (N - 1) // a
print(cnt)
| false | 27.272727 | [
"- if N % a == 0:",
"- cnt += N // a - 1",
"- else:",
"- cnt += N // a",
"+ cnt += (N - 1) // a"
] | false | 0.062433 | 0.054897 | 1.137277 | [
"s161809782",
"s307763217"
] |
u077291787 | p03966 | python | s074991619 | s353698626 | 20 | 18 | 3,064 | 3,188 | Accepted | Accepted | 10 | # ARC062C - AtCoDeerใใใจ้ธๆ้ๅ ฑ / AtCoDeer and Election Report (ABC046C)
def main():
n = int(eval(input()))
arr = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
t, a = 1, 1
for i, j in arr:
r = max((t - 1) // i + 1, (a - 1) // j + 1)
t, a = i * r, j * r
print(... | # ARC062C - AtCoDeerใใใจ้ธๆ้ๅ ฑ / AtCoDeer and Election Report
def main():
N, *TA = list(map(int, open(0).read().split()))
t, a = TA[:2]
for i, j in zip(*[iter(TA[2:])] * 2):
x = max((t + i - 1) // i, (a + j - 1) // j)
t, a = i * x, j * x
print((t + a))
if __name__ == "__main__":... | 13 | 12 | 364 | 324 | # ARC062C - AtCoDeerใใใจ้ธๆ้ๅ ฑ / AtCoDeer and Election Report (ABC046C)
def main():
n = int(eval(input()))
arr = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
t, a = 1, 1
for i, j in arr:
r = max((t - 1) // i + 1, (a - 1) // j + 1)
t, a = i * r, j * r
print((t + a))... | # ARC062C - AtCoDeerใใใจ้ธๆ้ๅ ฑ / AtCoDeer and Election Report
def main():
N, *TA = list(map(int, open(0).read().split()))
t, a = TA[:2]
for i, j in zip(*[iter(TA[2:])] * 2):
x = max((t + i - 1) // i, (a + j - 1) // j)
t, a = i * x, j * x
print((t + a))
if __name__ == "__main__":
main(... | false | 7.692308 | [
"-# ARC062C - AtCoDeerใใใจ้ธๆ้ๅ ฑ / AtCoDeer and Election Report (ABC046C)",
"+# ARC062C - AtCoDeerใใใจ้ธๆ้ๅ ฑ / AtCoDeer and Election Report",
"- n = int(eval(input()))",
"- arr = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))",
"- t, a = 1, 1",
"- for i, j in arr:",
"- r... | false | 0.038806 | 0.040072 | 0.968421 | [
"s074991619",
"s353698626"
] |
u296518383 | p02838 | python | s094301106 | s713506468 | 674 | 612 | 122,936 | 122,936 | Accepted | Accepted | 9.2 | N=int(eval(input()))
A=list(map(int,input().split()))
T=[0]*61
mod=10**9+7
for i in range(N):
for j in range(61):
if ((A[i]>>j) & 1):
#print(i,j)
T[j]+=1
#print(T)
ans=0
for i in range(61):
ans+=2**i*(N-T[i])*T[i]
ans%=mod
print(ans) | N = int(eval(input()))
A = tuple(map(int, input().split()))
MOD = 10 ** 9 + 7
cnt = [0] * 61
for a in A:
for i in range(61):
cnt[i] += 1 if (a >> i) & 1 else 0
answer = 0
for i in range(61):
answer = (answer + (2 ** i * cnt[i] * (N - cnt[i]))) % MOD
print(answer) | 17 | 14 | 267 | 281 | N = int(eval(input()))
A = list(map(int, input().split()))
T = [0] * 61
mod = 10**9 + 7
for i in range(N):
for j in range(61):
if (A[i] >> j) & 1:
# print(i,j)
T[j] += 1
# print(T)
ans = 0
for i in range(61):
ans += 2**i * (N - T[i]) * T[i]
ans %= mod
print(ans)
| N = int(eval(input()))
A = tuple(map(int, input().split()))
MOD = 10**9 + 7
cnt = [0] * 61
for a in A:
for i in range(61):
cnt[i] += 1 if (a >> i) & 1 else 0
answer = 0
for i in range(61):
answer = (answer + (2**i * cnt[i] * (N - cnt[i]))) % MOD
print(answer)
| false | 17.647059 | [
"-A = list(map(int, input().split()))",
"-T = [0] * 61",
"-mod = 10**9 + 7",
"-for i in range(N):",
"- for j in range(61):",
"- if (A[i] >> j) & 1:",
"- # print(i,j)",
"- T[j] += 1",
"-# print(T)",
"-ans = 0",
"+A = tuple(map(int, input().split()))",
"+MOD = 10*... | false | 0.035413 | 0.032991 | 1.073429 | [
"s094301106",
"s713506468"
] |
u796942881 | p03805 | python | s022670387 | s005185818 | 30 | 19 | 3,064 | 3,064 | Accepted | Accepted | 36.67 | from sys import stdin
def dfs(e, ans, done, N, graph):
if (1 << N) - 1 == done:
ans += 1
return ans
for s in graph[e]:
if done >> s & 1:
continue
done ^= 1 << s
ans = dfs(s, ans, done, N, graph)
done ^= 1 << s
return ans
def mai... | from sys import stdin
N = int()
memo = {}
graph = []
def dfs(e, done):
if (1 << N) - 1 == done:
return 1
key = (e, done)
if key in memo:
return memo[key]
ret = 0
for s in graph[e]:
if done >> s & 1:
continue
done ^= 1 << s
ret +=... | 31 | 39 | 680 | 771 | from sys import stdin
def dfs(e, ans, done, N, graph):
if (1 << N) - 1 == done:
ans += 1
return ans
for s in graph[e]:
if done >> s & 1:
continue
done ^= 1 << s
ans = dfs(s, ans, done, N, graph)
done ^= 1 << s
return ans
def main():
lines =... | from sys import stdin
N = int()
memo = {}
graph = []
def dfs(e, done):
if (1 << N) - 1 == done:
return 1
key = (e, done)
if key in memo:
return memo[key]
ret = 0
for s in graph[e]:
if done >> s & 1:
continue
done ^= 1 << s
ret += dfs(s, done)
... | false | 20.512821 | [
"+N = int()",
"+memo = {}",
"+graph = []",
"-def dfs(e, ans, done, N, graph):",
"+",
"+def dfs(e, done):",
"- ans += 1",
"- return ans",
"+ return 1",
"+ key = (e, done)",
"+ if key in memo:",
"+ return memo[key]",
"+ ret = 0",
"- ans = dfs(s, an... | false | 0.03527 | 0.036718 | 0.960551 | [
"s022670387",
"s005185818"
] |
u905203728 | p03061 | python | s060745602 | s017571548 | 359 | 102 | 89,580 | 86,484 | Accepted | Accepted | 71.59 | from fractions import gcd
n=int(eval(input()))
A=list(map(int,input().split()))
left=[0]*n
right=[0]*n
left[0]=A[0]
for i in range(1,n-1):
left[i]=gcd(left[i-1],A[i])
right[-1]=A[-1]
for i in range(1,n-1)[::-1]:
right[i]=gcd(right[i+1],A[i])
ans=max(left[-2],right[1])
for i in range(1,n-1):
... | from math import gcd
n=int(eval(input()))
A=list(map(int,input().split()))
left,right=[0]*n,[0]*n
left[0]=A[0]
for i in range(1,n-1):
left[i]=gcd(left[i-1],A[i])
right[-1]=A[-1]
for i in range(1,n-1)[::-1]:
right[i]=gcd(right[i+1],A[i])
ans=max(left[-2],right[1])
for i in range(1,n-1):
ans... | 19 | 18 | 369 | 363 | from fractions import gcd
n = int(eval(input()))
A = list(map(int, input().split()))
left = [0] * n
right = [0] * n
left[0] = A[0]
for i in range(1, n - 1):
left[i] = gcd(left[i - 1], A[i])
right[-1] = A[-1]
for i in range(1, n - 1)[::-1]:
right[i] = gcd(right[i + 1], A[i])
ans = max(left[-2], right[1])
for i ... | from math import gcd
n = int(eval(input()))
A = list(map(int, input().split()))
left, right = [0] * n, [0] * n
left[0] = A[0]
for i in range(1, n - 1):
left[i] = gcd(left[i - 1], A[i])
right[-1] = A[-1]
for i in range(1, n - 1)[::-1]:
right[i] = gcd(right[i + 1], A[i])
ans = max(left[-2], right[1])
for i in ra... | false | 5.263158 | [
"-from fractions import gcd",
"+from math import gcd",
"-left = [0] * n",
"-right = [0] * n",
"+left, right = [0] * n, [0] * n"
] | false | 0.057179 | 0.038966 | 1.467414 | [
"s060745602",
"s017571548"
] |
u744920373 | p03074 | python | s897363758 | s976144289 | 186 | 81 | 42,480 | 8,828 | Accepted | Accepted | 56.45 | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | 49 | 48 | 1,231 | 1,262 | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | false | 2.040816 | [
"-# from itertools import accumulate #list(accumulate(A))",
"+from itertools import accumulate # list(accumulate(A))",
"+",
"-len_list = [0] * (2 * (10**5) + 100)",
"+len_list = []",
"- len_list[0] = 0",
"- ind += 1",
"+ # len_list[0] = 0",
"+ len_list.append(0)",
"+ # ind += 1",
... | false | 0.047362 | 0.039257 | 1.206465 | [
"s897363758",
"s976144289"
] |
u869790980 | p03266 | python | s404271411 | s352324840 | 387 | 185 | 90,296 | 85,132 | Accepted | Accepted | 52.2 |
import collections
n,k = list(map(int, input().split(' ')))
cc= collections.Counter()
for ii in range(1, n+1):
cc[ii % k] +=1
r = 0
for ii in cc:
if 2*(k - ii) % k == 0:
r += cc[ii] * ((cc[(k - ii) % k ]) ** 2)
#* cc[(k - ii) % k]
print(r) | import collections
n,k = list(map(int, input().split(' ')))
cc= collections.Counter()
for ii in range(1, n+1):
cc[ii % k] +=1
r = 0
for ii in cc:
if (- 2*ii) % k == 0:
r += cc[ii] * ((cc[(k - ii) % k ]) ** 2)
#* cc[(k - ii) % k]
print(r) | 14 | 13 | 262 | 258 | import collections
n, k = list(map(int, input().split(" ")))
cc = collections.Counter()
for ii in range(1, n + 1):
cc[ii % k] += 1
r = 0
for ii in cc:
if 2 * (k - ii) % k == 0:
r += cc[ii] * ((cc[(k - ii) % k]) ** 2)
# * cc[(k - ii) % k]
print(r)
| import collections
n, k = list(map(int, input().split(" ")))
cc = collections.Counter()
for ii in range(1, n + 1):
cc[ii % k] += 1
r = 0
for ii in cc:
if (-2 * ii) % k == 0:
r += cc[ii] * ((cc[(k - ii) % k]) ** 2)
# * cc[(k - ii) % k]
print(r)
| false | 7.142857 | [
"- if 2 * (k - ii) % k == 0:",
"+ if (-2 * ii) % k == 0:"
] | false | 0.042192 | 0.038581 | 1.093583 | [
"s404271411",
"s352324840"
] |
u588341295 | p04020 | python | s447202171 | s841986285 | 146 | 121 | 7,072 | 7,152 | Accepted | Accepted | 17.12 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 36 | 33 | 980 | 885 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 8.333333 | [
"-ans = A[0] // 2",
"-mod = A[0] % 2",
"-for i in range(1, N):",
"- ans += A[i] // 2",
"- tmpmod = A[i] % 2",
"- if mod == tmpmod == 1:",
"- ans += 1",
"- mod = 0",
"- elif tmpmod == 1:",
"- mod = 1",
"- elif A[i] == 0:",
"- mod = 0",
"+ans = cnt = ... | false | 0.036584 | 0.04238 | 0.86323 | [
"s447202171",
"s841986285"
] |
u644907318 | p03103 | python | s011641989 | s693117881 | 689 | 310 | 65,496 | 94,124 | Accepted | Accepted | 55.01 | N,M = list(map(int,input().split()))
A = sorted([list(map(int,input().split())) for _ in range(N)],key=lambda x:x[0])
cnt = 0
pay = 0
for i in range(N):
if cnt+A[i][1]<=M:
pay += A[i][0]*A[i][1]
cnt += A[i][1]
else:
m = M-cnt
pay += A[i][0]*m
break
print(pay) ... | N,M = list(map(int,input().split()))
A = sorted([list(map(int,input().split())) for _ in range(N)],key=lambda x:x[0])
cnt = 0
cost = 0
for i in range(N):
a,b = A[i]
if cnt+b<=M:
cnt += b
cost += a*b
else:
d = M-cnt
cost += a*d
break
print(cost) | 13 | 14 | 321 | 303 | N, M = list(map(int, input().split()))
A = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
cnt = 0
pay = 0
for i in range(N):
if cnt + A[i][1] <= M:
pay += A[i][0] * A[i][1]
cnt += A[i][1]
else:
m = M - cnt
pay += A[i][0] * m
break
print(pa... | N, M = list(map(int, input().split()))
A = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
cnt = 0
cost = 0
for i in range(N):
a, b = A[i]
if cnt + b <= M:
cnt += b
cost += a * b
else:
d = M - cnt
cost += a * d
break
print(cost)
| false | 7.142857 | [
"-pay = 0",
"+cost = 0",
"- if cnt + A[i][1] <= M:",
"- pay += A[i][0] * A[i][1]",
"- cnt += A[i][1]",
"+ a, b = A[i]",
"+ if cnt + b <= M:",
"+ cnt += b",
"+ cost += a * b",
"- m = M - cnt",
"- pay += A[i][0] * m",
"+ d = M - cnt",
"... | false | 0.046653 | 0.042647 | 1.093924 | [
"s011641989",
"s693117881"
] |
u131625544 | p02913 | python | s177574297 | s313362871 | 988 | 724 | 247,560 | 48,988 | Accepted | Accepted | 26.72 | import sys
input = sys.stdin.readline
class AtCoder:
def main(self):
N = int(eval(input()))
S = input().rstrip()
dp = [[0 for i in range(N + 1)] for j in range(N + 1)]
ans = 0
for i in range(N)[::-1]:
for j in range(N)[::-1]:
if S... | import sys
input = sys.stdin.readline
class AtCoder:
def main(self):
N = int(eval(input()))
S = input().rstrip()
ans = 0
for i in range(N - 1):
ans = max(self.longest_common_subsequence(S[i:]), ans)
print(ans)
# Z-Algorithm ใไฝฟใฃใ้ฃ็ถใใ้จๅๆๅญๅ้ท... | 23 | 64 | 529 | 1,806 | import sys
input = sys.stdin.readline
class AtCoder:
def main(self):
N = int(eval(input()))
S = input().rstrip()
dp = [[0 for i in range(N + 1)] for j in range(N + 1)]
ans = 0
for i in range(N)[::-1]:
for j in range(N)[::-1]:
if S[i] == S[j]:
... | import sys
input = sys.stdin.readline
class AtCoder:
def main(self):
N = int(eval(input()))
S = input().rstrip()
ans = 0
for i in range(N - 1):
ans = max(self.longest_common_subsequence(S[i:]), ans)
print(ans)
# Z-Algorithm ใไฝฟใฃใ้ฃ็ถใใ้จๅๆๅญๅ้ทใฎ่จ็ฎ
def longes... | false | 64.0625 | [
"- dp = [[0 for i in range(N + 1)] for j in range(N + 1)]",
"- for i in range(N)[::-1]:",
"- for j in range(N)[::-1]:",
"- if S[i] == S[j]:",
"- dp[i][j] = min(dp[i + 1][j + 1] + 1, abs(i - j))",
"- ans = max(ans, dp[i][j])",
... | false | 0.042773 | 0.042352 | 1.009928 | [
"s177574297",
"s313362871"
] |
u624475441 | p03457 | python | s312206223 | s302891502 | 405 | 228 | 28,168 | 28,148 | Accepted | Accepted | 43.7 | can = True
e = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(int(eval(input())))]
for a, b in zip(e[1:], e):
dt = a[0] - b[0]
dist = abs(a[1] - b[1]) + abs(a[2] - b[2])
if dt < dist: can = False; break
if dt % 2 != dist % 2: can = False; break
print((['No', 'Yes'][can])) | import sys
can = True; eval(input())
e = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]
for a, b in zip(e[1:], e):
t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])
if t < 0 or t % 2 == 1: can = False; break
print((['No', 'Yes'][can])) | 8 | 7 | 302 | 259 | can = True
e = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(int(eval(input())))]
for a, b in zip(e[1:], e):
dt = a[0] - b[0]
dist = abs(a[1] - b[1]) + abs(a[2] - b[2])
if dt < dist:
can = False
break
if dt % 2 != dist % 2:
can = False
break
print((["No", ... | import sys
can = True
eval(input())
e = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]
for a, b in zip(e[1:], e):
t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])
if t < 0 or t % 2 == 1:
can = False
break
print((["No", "Yes"][can]))
| false | 12.5 | [
"+import sys",
"+",
"-e = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(int(eval(input())))]",
"+eval(input())",
"+e = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]",
"- dt = a[0] - b[0]",
"- dist = abs(a[1] - b[1]) + abs(a[2] - b[2])",
"- if dt < dist:",
"- ... | false | 0.038229 | 0.057151 | 0.66892 | [
"s312206223",
"s302891502"
] |
u467175809 | p00829 | python | s575700198 | s024912618 | 13,690 | 10,640 | 27,004 | 22,500 | Accepted | Accepted | 22.28 | #!/usr/bin/env python
import sys
import math
import itertools as it
from collections import deque
sys.setrecursionlimit(10000000)
N = eval(input())
for i in range(N):
lst = []
while len(lst) < 9:
lst_ = input().split()
for S in lst_:
lst.append(int(S, 16))
re... | #!/usr/bin/env python
import sys
import math
import itertools as it
from collections import deque
sys.setrecursionlimit(10000000)
N = eval(input())
for i in range(N):
lst = []
while len(lst) < 9:
lst_ = input().split()
for S in lst_:
lst.append(int(S, 16))
re... | 60 | 60 | 1,456 | 1,456 | #!/usr/bin/env python
import sys
import math
import itertools as it
from collections import deque
sys.setrecursionlimit(10000000)
N = eval(input())
for i in range(N):
lst = []
while len(lst) < 9:
lst_ = input().split()
for S in lst_:
lst.append(int(S, 16))
res = lst[8]
lst =... | #!/usr/bin/env python
import sys
import math
import itertools as it
from collections import deque
sys.setrecursionlimit(10000000)
N = eval(input())
for i in range(N):
lst = []
while len(lst) < 9:
lst_ = input().split()
for S in lst_:
lst.append(int(S, 16))
res = lst[8]
lst =... | false | 0 | [
"- diff_lst.append([D, 1 << i])",
"- L1 = [[diff, 0]]",
"+ diff_lst.append((D, 1 << i))",
"+ L1 = [(diff, 0)]",
"- L.append([(p[0] + P[0]) % (1 << 32), p[1] + P[1]])",
"+ L.append(((p[0] + P[0]) % (1 << 32), p[1] + P[1]))",
"- L.append([(p[0] + P[0]) ... | false | 1.362534 | 0.197727 | 6.891001 | [
"s575700198",
"s024912618"
] |
u047102107 | p02882 | python | s177124060 | s585962070 | 181 | 79 | 38,896 | 66,640 | Accepted | Accepted | 56.35 | from math import tan, pi
a, b, x = list(map(float, input().split()))
eps = 1e-9
def f(a, b, theta):
if theta > pi / 2.0 - eps:
return 0.0
ret = 0.0
if a * tan(theta) <= b:
ret = a * a * b - a * a * a * tan(theta) / 2.0
else:
ret = b * b / tan(theta) * a / 2.0
... | # https://atcoder.jp/contests/abc144/tasks/abc144_d
from math import pi, tan
a, b, x = list(map(int, input().split()))
eps = 10e-8
def f(a, b, theta):
if theta > pi / 2.0 - eps:
return 0.0
ret = 0.0
if a * tan(theta) <= b:
ret = a * a * b - a * a * a * tan(theta) / 2.0
el... | 27 | 26 | 583 | 569 | from math import tan, pi
a, b, x = list(map(float, input().split()))
eps = 1e-9
def f(a, b, theta):
if theta > pi / 2.0 - eps:
return 0.0
ret = 0.0
if a * tan(theta) <= b:
ret = a * a * b - a * a * a * tan(theta) / 2.0
else:
ret = b * b / tan(theta) * a / 2.0
return ret
... | # https://atcoder.jp/contests/abc144/tasks/abc144_d
from math import pi, tan
a, b, x = list(map(int, input().split()))
eps = 10e-8
def f(a, b, theta):
if theta > pi / 2.0 - eps:
return 0.0
ret = 0.0
if a * tan(theta) <= b:
ret = a * a * b - a * a * a * tan(theta) / 2.0
else:
r... | false | 3.703704 | [
"-from math import tan, pi",
"+# https://atcoder.jp/contests/abc144/tasks/abc144_d",
"+from math import pi, tan",
"-a, b, x = list(map(float, input().split()))",
"-eps = 1e-9",
"+a, b, x = list(map(int, input().split()))",
"+eps = 10e-8",
"-def solve():",
"- ok = pi / 2.0",
"- ng = 0.0",
"... | false | 0.094477 | 0.12318 | 0.766983 | [
"s177124060",
"s585962070"
] |
u945181840 | p02862 | python | s883566040 | s659183585 | 480 | 150 | 3,064 | 3,064 | Accepted | Accepted | 68.75 | X, Y = list(map(int, input().split()))
mod = 10 ** 9 + 7
# modใใชใใใณใณใใใผใทใงใณใๆฑใใ
def mod_cmb(n, r, mod):
p, q = 1, 1
for i in range(r):
p = p * (n - i) % mod
q = q * (i + 1) % mod
return p * mod_inverse(q, mod) % mod
# modใใa^bใๆฑใใ
def mod_pow(a, p, mod):
if p == 0:
... | X, Y = list(map(int, input().split()))
mod = 10 ** 9 + 7
# modใใชใใใณใณใใใผใทใงใณใๆฑใใ
def mod_cmb(n, r, mod):
p, q = 1, 1
for i in range(r):
p = p * (n - i) % mod
q = q * (i + 1) % mod
return p * mod_inverse(q, mod) % mod
# modใใa^bใๆฑใใ
def mod_pow(a, p, mod):
if p == 0:
... | 41 | 41 | 825 | 768 | X, Y = list(map(int, input().split()))
mod = 10**9 + 7
# modใใชใใใณใณใใใผใทใงใณใๆฑใใ
def mod_cmb(n, r, mod):
p, q = 1, 1
for i in range(r):
p = p * (n - i) % mod
q = q * (i + 1) % mod
return p * mod_inverse(q, mod) % mod
# modใใa^bใๆฑใใ
def mod_pow(a, p, mod):
if p == 0:
return 1
el... | X, Y = list(map(int, input().split()))
mod = 10**9 + 7
# modใใชใใใณใณใใใผใทใงใณใๆฑใใ
def mod_cmb(n, r, mod):
p, q = 1, 1
for i in range(r):
p = p * (n - i) % mod
q = q * (i + 1) % mod
return p * mod_inverse(q, mod) % mod
# modใใa^bใๆฑใใ
def mod_pow(a, p, mod):
if p == 0:
return 1
el... | false | 0 | [
"+if (X + Y) % 3 != 0:",
"+ print((0))",
"+ exit()",
"-n, m = 0, 0",
"-for i in range(10**6):",
"- if X - i == (Y - 2 * i) * 2 == 0 or X - i == (Y - 2 * i) * 2 != 0:",
"- n = i",
"- m = Y - 2 * n",
"- break",
"-else:",
"+n = (2 * Y - X) // 3",
"+m = (2 * X - Y) //... | false | 0.794783 | 0.064152 | 12.389077 | [
"s883566040",
"s659183585"
] |
u411203878 | p03102 | python | s460506312 | s594760812 | 174 | 106 | 38,384 | 61,820 | Accepted | Accepted | 39.08 | n,m,c = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for _ in range(n):
a = list(map(int,input().split()))
res = c
for i in range(m):
res += b[i]*a[i]
if res > 0:
ans += 1
print(ans) | N,M,D = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for _ in range(N):
tmp_math = D
A = list(map(int,input().split()))
for i in range(M):
tmp_math += B[i]*A[i]
if tmp_math > 0:
ans += 1
print(ans) | 11 | 14 | 247 | 268 | n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for _ in range(n):
a = list(map(int, input().split()))
res = c
for i in range(m):
res += b[i] * a[i]
if res > 0:
ans += 1
print(ans)
| N, M, D = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for _ in range(N):
tmp_math = D
A = list(map(int, input().split()))
for i in range(M):
tmp_math += B[i] * A[i]
if tmp_math > 0:
ans += 1
print(ans)
| false | 21.428571 | [
"-n, m, c = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"+N, M, D = list(map(int, input().split()))",
"+B = list(map(int, input().split()))",
"-for _ in range(n):",
"- a = list(map(int, input().split()))",
"- res = c",
"- for i in range(m):",
"- res += b... | false | 0.077235 | 0.042338 | 1.824233 | [
"s460506312",
"s594760812"
] |
u667024514 | p03433 | python | s075263668 | s649118166 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | a = int(eval(input()))
b = int(eval(input()))
a = a % 500
if a > b:
print("No")
else:
print("Yes") | n = int(eval(input()))
a = int(eval(input()))
n %= 500
if n <= a:
print("Yes")
else:
print("No") | 7 | 7 | 94 | 94 | a = int(eval(input()))
b = int(eval(input()))
a = a % 500
if a > b:
print("No")
else:
print("Yes")
| n = int(eval(input()))
a = int(eval(input()))
n %= 500
if n <= a:
print("Yes")
else:
print("No")
| false | 0 | [
"+n = int(eval(input()))",
"-b = int(eval(input()))",
"-a = a % 500",
"-if a > b:",
"+n %= 500",
"+if n <= a:",
"+ print(\"Yes\")",
"+else:",
"-else:",
"- print(\"Yes\")"
] | false | 0.070991 | 0.067515 | 1.051482 | [
"s075263668",
"s649118166"
] |
u906428167 | p02713 | python | s158881613 | s611554158 | 863 | 180 | 80,500 | 71,532 | Accepted | Accepted | 79.14 | from fractions import gcd
k = int(eval(input()))
ans = 0
lst = [[0 for _ in range(1, k+1)] for __ in range(k+1)]
cnt = [0 for _ in range(1, k+1)]
for i in range(1, k+1):
for j in range(1, k+1):
lst[i-1][j-1] = [gcd(i, j)]
cnt[gcd(i, j)-1] += 1
ans = 0
for i in range(k):
fo... | from math import gcd
k = int(eval(input()))
ans = 0
lst = [[0 for _ in range(1, k+1)] for __ in range(k+1)]
cnt = [0 for _ in range(1, k+1)]
for i in range(1, k+1):
for j in range(1, k+1):
tmp = gcd(i,j)
for l in range(1,k+1):
ans += gcd(tmp,l)
print(ans)
| 21 | 16 | 386 | 314 | from fractions import gcd
k = int(eval(input()))
ans = 0
lst = [[0 for _ in range(1, k + 1)] for __ in range(k + 1)]
cnt = [0 for _ in range(1, k + 1)]
for i in range(1, k + 1):
for j in range(1, k + 1):
lst[i - 1][j - 1] = [gcd(i, j)]
cnt[gcd(i, j) - 1] += 1
ans = 0
for i in range(k):
for j in... | from math import gcd
k = int(eval(input()))
ans = 0
lst = [[0 for _ in range(1, k + 1)] for __ in range(k + 1)]
cnt = [0 for _ in range(1, k + 1)]
for i in range(1, k + 1):
for j in range(1, k + 1):
tmp = gcd(i, j)
for l in range(1, k + 1):
ans += gcd(tmp, l)
print(ans)
| false | 23.809524 | [
"-from fractions import gcd",
"+from math import gcd",
"- lst[i - 1][j - 1] = [gcd(i, j)]",
"- cnt[gcd(i, j) - 1] += 1",
"-ans = 0",
"-for i in range(k):",
"- for j in range(1, k + 1):",
"- ans += cnt[i] * gcd((i + 1), j)",
"+ tmp = gcd(i, j)",
"+ for l in ran... | false | 0.067268 | 0.153226 | 0.439011 | [
"s158881613",
"s611554158"
] |
u067983636 | p02769 | python | s039040713 | s646455867 | 1,841 | 1,227 | 24,820 | 52,452 | Accepted | Accepted | 33.35 | import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def read_values():
return list(map(int, input().split()))
def read_index():
return [x - 1 for x in list(map(int, input().split()))]
def read_list():
return list(read_values())
def read_lists(N):
... | import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def read_values():
return list(map(int, input().split()))
def read_index():
return [x - 1 for x in list(map(int, input().split()))]
def read_list():
return list(read_values())
def read_lists(N):
... | 55 | 60 | 1,091 | 1,174 | import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def read_values():
return list(map(int, input().split()))
def read_index():
return [x - 1 for x in list(map(int, input().split()))]
def read_list():
return list(read_values())
def read_lists(N):
return [read_li... | import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def read_values():
return list(map(int, input().split()))
def read_index():
return [x - 1 for x in list(map(int, input().split()))]
def read_list():
return list(read_values())
def read_lists(N):
return [read_li... | false | 8.333333 | [
"+INV = dict()",
"+",
"+",
"- return pow(a, mod - 2, mod)",
"+ if a in INV:",
"+ return INV[a]",
"+ i = pow(a, mod - 2, mod)",
"+ INV[a] = i",
"+ return i"
] | false | 0.585697 | 0.373959 | 1.566206 | [
"s039040713",
"s646455867"
] |
u368249389 | p02685 | python | s190293017 | s112253866 | 1,277 | 493 | 9,084 | 40,564 | Accepted | Accepted | 61.39 | N, M, K = list(map(int, input().split()))
out = 0
mod = 998244353
c = 1
for k in range(K+1):
out += M * pow(M-1, N-k-1, mod) * c
out %= mod
c *= (N-k-1) * pow(k+1, mod-2, mod)
c %= mod
print(out)
| # Problem E - Colorful Blocks
# input
N, M, K = list(map(int, input().split()))
# initialization
MOD = 998244353
fact = [1, 1]
fact_inv = [1, 1]
inv = [0, 1]
pow_list = [1, M-1]
for i in range(2, N+1):
fact.append((fact[-1] * i)%MOD)
inv.append((-inv[MOD%i] * (MOD//i))%MOD)
fact_inv.append((... | 12 | 32 | 211 | 689 | N, M, K = list(map(int, input().split()))
out = 0
mod = 998244353
c = 1
for k in range(K + 1):
out += M * pow(M - 1, N - k - 1, mod) * c
out %= mod
c *= (N - k - 1) * pow(k + 1, mod - 2, mod)
c %= mod
print(out)
| # Problem E - Colorful Blocks
# input
N, M, K = list(map(int, input().split()))
# initialization
MOD = 998244353
fact = [1, 1]
fact_inv = [1, 1]
inv = [0, 1]
pow_list = [1, M - 1]
for i in range(2, N + 1):
fact.append((fact[-1] * i) % MOD)
inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
fact_inv.append((fact... | false | 62.5 | [
"+# Problem E - Colorful Blocks",
"+# input",
"-out = 0",
"-mod = 998244353",
"-c = 1",
"-for k in range(K + 1):",
"- out += M * pow(M - 1, N - k - 1, mod) * c",
"- out %= mod",
"- c *= (N - k - 1) * pow(k + 1, mod - 2, mod)",
"- c %= mod",
"-print(out)",
"+# initialization",
"+M... | false | 0.095064 | 0.223307 | 0.425712 | [
"s190293017",
"s112253866"
] |
u025287757 | p02804 | python | s710046272 | s067856083 | 1,713 | 515 | 14,416 | 14,416 | Accepted | Accepted | 69.94 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
p = 1000000007
frac = [1]
for i in range(N):
frac.append(frac[i]*(i+1)%p)
def power(n, r, mod):
if r == 0: return 1
if r%2 == 0:
return power(n*n % mod, r//2, mod) % mod
if r%2 == 1:
retu... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
p = 1000000007
frac = [1]
for i in range(N):
frac.append(frac[i]*(i+1)%p)
def comb(n, k, mod):
a=frac[n]
b=frac[k]
c=frac[n-k]
return (a * pow(b, mod-2, mod) * pow(c, mod-2, mod)) % mod
ans = 0... | 27 | 20 | 606 | 421 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
p = 1000000007
frac = [1]
for i in range(N):
frac.append(frac[i] * (i + 1) % p)
def power(n, r, mod):
if r == 0:
return 1
if r % 2 == 0:
return power(n * n % mod, r // 2, mod) % mod
if r % 2 == 1:
... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
p = 1000000007
frac = [1]
for i in range(N):
frac.append(frac[i] * (i + 1) % p)
def comb(n, k, mod):
a = frac[n]
b = frac[k]
c = frac[n - k]
return (a * pow(b, mod - 2, mod) * pow(c, mod - 2, mod)) % mod
ans... | false | 25.925926 | [
"-def power(n, r, mod):",
"- if r == 0:",
"- return 1",
"- if r % 2 == 0:",
"- return power(n * n % mod, r // 2, mod) % mod",
"- if r % 2 == 1:",
"- return n * power(n, r - 1, mod) % mod",
"-",
"-",
"- return (a * power(b, mod - 2, mod) * power(c, mod - 2, mod)) % ... | false | 0.047534 | 0.007832 | 6.069171 | [
"s710046272",
"s067856083"
] |
u280552586 | p03627 | python | s980100760 | s013637840 | 145 | 132 | 25,920 | 28,188 | Accepted | Accepted | 8.97 | from collections import Counter
n = int(eval(input()))
A = Counter(list(map(int, input().split())))
A = sorted(A.most_common(), reverse=True)
rods = []
for a in A:
if a[1] >= 4:
rods.append(a[0])
rods.append(a[0])
break
if a[1] >= 2:
rods.append(a[0])
if len(rod... | from collections import defaultdict
n = int(eval(input()))
A = list(map(int, input().split()))
C = defaultdict(int)
for a in A:
C[a] += 1
C = sorted(list(C.items()), key=lambda x: x[0], reverse=True)
rods = []
for k, v in C:
if v >= 4:
rods.append(k)
rods.append(k)
break
... | 20 | 23 | 417 | 458 | from collections import Counter
n = int(eval(input()))
A = Counter(list(map(int, input().split())))
A = sorted(A.most_common(), reverse=True)
rods = []
for a in A:
if a[1] >= 4:
rods.append(a[0])
rods.append(a[0])
break
if a[1] >= 2:
rods.append(a[0])
if len(rods) == 2:
... | from collections import defaultdict
n = int(eval(input()))
A = list(map(int, input().split()))
C = defaultdict(int)
for a in A:
C[a] += 1
C = sorted(list(C.items()), key=lambda x: x[0], reverse=True)
rods = []
for k, v in C:
if v >= 4:
rods.append(k)
rods.append(k)
break
if v >= 2:
... | false | 13.043478 | [
"-from collections import Counter",
"+from collections import defaultdict",
"-A = Counter(list(map(int, input().split())))",
"-A = sorted(A.most_common(), reverse=True)",
"+A = list(map(int, input().split()))",
"+C = defaultdict(int)",
"+for a in A:",
"+ C[a] += 1",
"+C = sorted(list(C.items()), ... | false | 0.040621 | 0.041517 | 0.978419 | [
"s980100760",
"s013637840"
] |
u729133443 | p02756 | python | s080969928 | s033774596 | 1,951 | 1,715 | 18,288 | 18,132 | Accepted | Accepted | 12.1 | s,_,*q=open(0)
a=['',s[:-1]]
p=1
for q in q:
q,*f=q[::2]
if q>'1':
f,c=f
a[(1if f<'2'else 0)^p]+=c
else:p^=1
print((a[p^1][::-1]+a[p])) | s,_,*q=open(0)
a=['',s[:-1]]
p=1
for q in q:
if q>'2':a[(q<'2 2')^p]+=q[-2]
else:p^=1
print((a[p^1][::-1]+a[p])) | 10 | 7 | 156 | 120 | s, _, *q = open(0)
a = ["", s[:-1]]
p = 1
for q in q:
q, *f = q[::2]
if q > "1":
f, c = f
a[(1 if f < "2" else 0) ^ p] += c
else:
p ^= 1
print((a[p ^ 1][::-1] + a[p]))
| s, _, *q = open(0)
a = ["", s[:-1]]
p = 1
for q in q:
if q > "2":
a[(q < "2 2") ^ p] += q[-2]
else:
p ^= 1
print((a[p ^ 1][::-1] + a[p]))
| false | 30 | [
"- q, *f = q[::2]",
"- if q > \"1\":",
"- f, c = f",
"- a[(1 if f < \"2\" else 0) ^ p] += c",
"+ if q > \"2\":",
"+ a[(q < \"2 2\") ^ p] += q[-2]"
] | false | 0.075421 | 0.041143 | 1.833146 | [
"s080969928",
"s033774596"
] |
u863442865 | p03325 | python | s187601097 | s534232775 | 89 | 58 | 4,148 | 4,148 | Accepted | Accepted | 34.83 | n = int(eval(input()))
ni = list(map(int, input().split()))
cnt = 0
for i in ni:
while ( i % 2==0):
i //= 2
cnt += 1
print(cnt)
| n = int(eval(input()))
ni = list(map(int, input().split()))
def f(i):
cnt = 0
while not i%2:
i //= 2
cnt += 1
return cnt
total = 0
for i in ni:
total += f(i)
print(total)
| 8 | 13 | 139 | 194 | n = int(eval(input()))
ni = list(map(int, input().split()))
cnt = 0
for i in ni:
while i % 2 == 0:
i //= 2
cnt += 1
print(cnt)
| n = int(eval(input()))
ni = list(map(int, input().split()))
def f(i):
cnt = 0
while not i % 2:
i //= 2
cnt += 1
return cnt
total = 0
for i in ni:
total += f(i)
print(total)
| false | 38.461538 | [
"-cnt = 0",
"-for i in ni:",
"- while i % 2 == 0:",
"+",
"+",
"+def f(i):",
"+ cnt = 0",
"+ while not i % 2:",
"-print(cnt)",
"+ return cnt",
"+",
"+",
"+total = 0",
"+for i in ni:",
"+ total += f(i)",
"+print(total)"
] | false | 0.069275 | 0.036772 | 1.883888 | [
"s187601097",
"s534232775"
] |
u347600233 | p02583 | python | s138230823 | s591617131 | 147 | 128 | 9,180 | 9,184 | Accepted | Accepted | 12.93 | n = int(eval(input()))
l = list(map(int, input().split()))
cnt = 0
for i in range(n):
for j in range(i + 1, n):
for k in range(j + 1, n):
tri = [l[i], l[j], l[k]]
if len(set(tri)) != 3:
continue
if 2*max(tri) < sum(tri):
cnt += 1
... | n = int(eval(input()))
l = sorted(list(map(int, input().split())))
cnt = 0
for i in range(n):
for j in range(i + 1, n):
for k in range(j + 1, n):
if len(set([l[i], l[j], l[k]])) != 3:
continue
if l[k] < l[i] + l[j]:
cnt += 1
print(cnt) | 12 | 11 | 325 | 307 | n = int(eval(input()))
l = list(map(int, input().split()))
cnt = 0
for i in range(n):
for j in range(i + 1, n):
for k in range(j + 1, n):
tri = [l[i], l[j], l[k]]
if len(set(tri)) != 3:
continue
if 2 * max(tri) < sum(tri):
cnt += 1
print(cn... | n = int(eval(input()))
l = sorted(list(map(int, input().split())))
cnt = 0
for i in range(n):
for j in range(i + 1, n):
for k in range(j + 1, n):
if len(set([l[i], l[j], l[k]])) != 3:
continue
if l[k] < l[i] + l[j]:
cnt += 1
print(cnt)
| false | 8.333333 | [
"-l = list(map(int, input().split()))",
"+l = sorted(list(map(int, input().split())))",
"- tri = [l[i], l[j], l[k]]",
"- if len(set(tri)) != 3:",
"+ if len(set([l[i], l[j], l[k]])) != 3:",
"- if 2 * max(tri) < sum(tri):",
"+ if l[k] < l[i] + l[j]:"
... | false | 0.048067 | 0.101483 | 0.473646 | [
"s138230823",
"s591617131"
] |
u811733736 | p02409 | python | s032055476 | s876734910 | 50 | 20 | 7,808 | 5,632 | Accepted | Accepted | 60 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_C&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
residents = [[[0] * 10 for _ in range(3)] for _ in range(4)]
n = int(eval(input()))
for _ in range(n):
b,... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_C&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def solve(n):
# ใใซใใคใใ(ใฉใฎ้จๅฑใๅ
ฅๅฑ
่
ใฏ0)
buildings = []
for _ in range(4): # ใใซใฏ4ๆฃ
buildings.append([[0]*10 for _ in ... | 31 | 39 | 688 | 845 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_C&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
residents = [[[0] * 10 for _ in range(3)] for _ in range(4)]
n = int(eval(input()))
for _ in range(n):
b, f, r, v = lis... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_C&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def solve(n):
# ใใซใใคใใ(ใฉใฎ้จๅฑใๅ
ฅๅฑ
่
ใฏ0)
buildings = []
for _ in range(4): # ใใซใฏ4ๆฃ
buildings.append([[0] * 10 for _ in range(3)]) # 1ใใญใข1... | false | 20.512821 | [
"+def solve(n):",
"+ # ใใซใใคใใ(ใฉใฎ้จๅฑใๅ
ฅๅฑ
่
ใฏ0)",
"+ buildings = []",
"+ for _ in range(4): # ใใซใฏ4ๆฃ",
"+ buildings.append([[0] * 10 for _ in range(3)]) # 1ใใญใข10้จๅฑใง3้ๅปบ",
"+ # ๅ
ฅๅฑ
่
ใฎๅขๆธๅฆ็ (ใใซ็ชๅทใใใญใข็ชๅทใ้จๅฑ็ชๅทใ0่ตท็ฎใซใชใฃใฆใใใฎใงใ-1ใใ)",
"+ for _ in range(n):",
"+ b, f, r, v = map(int, input(... | false | 0.045985 | 0.038417 | 1.196975 | [
"s032055476",
"s876734910"
] |
u283869437 | p02948 | python | s808214996 | s471231429 | 249 | 228 | 24,932 | 24,932 | Accepted | Accepted | 8.43 | from heapq import*
N,M,*t=list(map(int,open(0).read().split()))
v=[[]for _ in'_'*M]
for i in range(N):M<t[2*i]or v[t[2*i]-1].append(t[2*i+1])
z=0
q=[]
for i in v:
for j in i:heappush(q,-j)
z-=len(q)and heappop(q)
print(z) | from heapq import*
N,M,*t=list(map(int,open(0).read().split()))
v=[[]for _ in'_'*M]
z=i=0
for _ in'_'*N:M<t[i]or v[t[i]-1].append(t[i+1]);i+=2
q=[]
for i in v:
for j in i:heappush(q,-j)
z-=len(q)and heappop(q)
print(z) | 10 | 10 | 226 | 223 | from heapq import *
N, M, *t = list(map(int, open(0).read().split()))
v = [[] for _ in "_" * M]
for i in range(N):
M < t[2 * i] or v[t[2 * i] - 1].append(t[2 * i + 1])
z = 0
q = []
for i in v:
for j in i:
heappush(q, -j)
z -= len(q) and heappop(q)
print(z)
| from heapq import *
N, M, *t = list(map(int, open(0).read().split()))
v = [[] for _ in "_" * M]
z = i = 0
for _ in "_" * N:
M < t[i] or v[t[i] - 1].append(t[i + 1])
i += 2
q = []
for i in v:
for j in i:
heappush(q, -j)
z -= len(q) and heappop(q)
print(z)
| false | 0 | [
"-for i in range(N):",
"- M < t[2 * i] or v[t[2 * i] - 1].append(t[2 * i + 1])",
"-z = 0",
"+z = i = 0",
"+for _ in \"_\" * N:",
"+ M < t[i] or v[t[i] - 1].append(t[i + 1])",
"+ i += 2"
] | false | 0.034387 | 0.034052 | 1.009828 | [
"s808214996",
"s471231429"
] |
u896741788 | p02726 | python | s284084732 | s147785756 | 1,968 | 1,490 | 37,492 | 9,272 | Accepted | Accepted | 24.29 | n,x,y=map(int,input().split())
x-=1;y-=1
l=[[10**4 for g in range(n)] for i in range(n)]
fl=[0 for i in range(n-1)]
for i in range(n):
for j in range(i+1,n):
fl[min(abs(j-i),abs(j-x)+1+abs(y-i),abs(i-x)+1+abs(y-j))]+=1
print(*fl[1:],sep="\n")
print(fl[0])
| n,x,y=map(int,input().split())
x-=1;y-=1
fl=[0 for i in range(n-1)]
for i in range(n):
for j in range(i+1,n):
fl[min(abs(j-i),abs(j-x)+1+abs(y-i),abs(i-x)+1+abs(y-j))]+=1
print(*fl[1:],sep="\n")
print(0)
| 9 | 8 | 275 | 223 | n, x, y = map(int, input().split())
x -= 1
y -= 1
l = [[10**4 for g in range(n)] for i in range(n)]
fl = [0 for i in range(n - 1)]
for i in range(n):
for j in range(i + 1, n):
fl[
min(abs(j - i), abs(j - x) + 1 + abs(y - i), abs(i - x) + 1 + abs(y - j))
] += 1
print(*fl[1:], sep="\n")
pr... | n, x, y = map(int, input().split())
x -= 1
y -= 1
fl = [0 for i in range(n - 1)]
for i in range(n):
for j in range(i + 1, n):
fl[
min(abs(j - i), abs(j - x) + 1 + abs(y - i), abs(i - x) + 1 + abs(y - j))
] += 1
print(*fl[1:], sep="\n")
print(0)
| false | 11.111111 | [
"-l = [[10**4 for g in range(n)] for i in range(n)]",
"-print(fl[0])",
"+print(0)"
] | false | 0.04214 | 0.038016 | 1.108474 | [
"s284084732",
"s147785756"
] |
u716530146 | p03987 | python | s974632699 | s868099973 | 920 | 375 | 132,944 | 35,776 | Accepted | Accepted | 59.24 | #!/usr/bin/env python3
class UnionFind:
__slots__ = ['id','sz']
def __init__(self, n):
self.id = [-1] * n
def root(self, x):
if self.id[x] < 0:
return x
else:
self.id[x] = self.root(self.id[x])
return self.id[x]
def find(self, ... | #!/usr/bin/env python3
ans=0
n=int(eval(input()))
A=list(map(int,input().split()))
B=[0]*(n+1)
for i in range(n):
B[A[i]]=i+1
LL=[int(i) for i in range(n+2)]
RR=[int(i) for i in range(n+2)]
for i in range(n,0,-1):
l=LL[B[i]]
r=RR[B[i]]
ans+=(B[i]-l+1)*(r-B[i]+1)*i
LL[r+1]=l
RR[l-1]... | 52 | 16 | 1,181 | 329 | #!/usr/bin/env python3
class UnionFind:
__slots__ = ["id", "sz"]
def __init__(self, n):
self.id = [-1] * n
def root(self, x):
if self.id[x] < 0:
return x
else:
self.id[x] = self.root(self.id[x])
return self.id[x]
def find(self, x, y):
... | #!/usr/bin/env python3
ans = 0
n = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * (n + 1)
for i in range(n):
B[A[i]] = i + 1
LL = [int(i) for i in range(n + 2)]
RR = [int(i) for i in range(n + 2)]
for i in range(n, 0, -1):
l = LL[B[i]]
r = RR[B[i]]
ans += (B[i] - l + 1) * (r - B[i] + 1... | false | 69.230769 | [
"-class UnionFind:",
"- __slots__ = [\"id\", \"sz\"]",
"-",
"- def __init__(self, n):",
"- self.id = [-1] * n",
"-",
"- def root(self, x):",
"- if self.id[x] < 0:",
"- return x",
"- else:",
"- self.id[x] = self.root(self.id[x])",
"- ... | false | 0.049218 | 0.109786 | 0.448307 | [
"s974632699",
"s868099973"
] |
u618002097 | p03371 | python | s332020309 | s693981055 | 183 | 62 | 38,256 | 61,716 | Accepted | Accepted | 66.12 | A, B, C, X, Y = list(map(int, input().split()))
print((min(A*X+B*Y, min(X, Y)*C*2 + (X-min(X, Y))*A+(Y-min(X, Y))*B, max(X, Y)*C*2))) | A, B, C, X, Y = list(map(int, input().split()))
cost_1 = A*X + B*Y
cost_2 = C * max(X, Y) * 2
cost_3 = C * min(X, Y) * 2 + (X - min(X, Y))*A + (Y - min(X, Y))*B
print((min(cost_1, cost_2, cost_3))) | 3 | 9 | 128 | 201 | A, B, C, X, Y = list(map(int, input().split()))
print(
(
min(
A * X + B * Y,
min(X, Y) * C * 2 + (X - min(X, Y)) * A + (Y - min(X, Y)) * B,
max(X, Y) * C * 2,
)
)
)
| A, B, C, X, Y = list(map(int, input().split()))
cost_1 = A * X + B * Y
cost_2 = C * max(X, Y) * 2
cost_3 = C * min(X, Y) * 2 + (X - min(X, Y)) * A + (Y - min(X, Y)) * B
print((min(cost_1, cost_2, cost_3)))
| false | 66.666667 | [
"-print(",
"- (",
"- min(",
"- A * X + B * Y,",
"- min(X, Y) * C * 2 + (X - min(X, Y)) * A + (Y - min(X, Y)) * B,",
"- max(X, Y) * C * 2,",
"- )",
"- )",
"-)",
"+cost_1 = A * X + B * Y",
"+cost_2 = C * max(X, Y) * 2",
"+cost_3 = C * min(X, Y... | false | 0.078787 | 0.077247 | 1.019936 | [
"s332020309",
"s693981055"
] |
u638795007 | p03546 | python | s158736854 | s569916421 | 190 | 35 | 40,284 | 3,952 | Accepted | Accepted | 81.58 | def warshall_floyd(n,d):
#d[i][j]: iใใjใธใฎๆ็ญ่ท้ข
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j] = min(d[i][j],d[i][k] + d[k][j])
return d
######################################################
import sys
def I(): return int(sys.stdin.readline())
d... | def dijkstra_heap(n,s,edge):
# ๅง็นsใใๅ้ ็นใธใฎๆ็ญ่ท้ข
d = [float("inf")] * n
used = [True] * n # True:ๆช็ขบๅฎ
d[s] = 0
used[s] = False
edgelist = []
for e in edge[s]:
heappush(edgelist, e)
while len(edgelist):
minedge = heappop(edgelist)
# ใพใ ไฝฟใใใฆใชใ้ ็นใฎไธญใใๆๅฐใฎ่ท้ขใฎใใฎใๆข... | 37 | 55 | 1,068 | 1,530 | def warshall_floyd(n, d):
# d[i][j]: iใใjใธใฎๆ็ญ่ท้ข
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
return d
######################################################
import sys
def I():
return int(sys.stdin.readline())
... | def dijkstra_heap(n, s, edge):
# ๅง็นsใใๅ้ ็นใธใฎๆ็ญ่ท้ข
d = [float("inf")] * n
used = [True] * n # True:ๆช็ขบๅฎ
d[s] = 0
used[s] = False
edgelist = []
for e in edge[s]:
heappush(edgelist, e)
while len(edgelist):
minedge = heappop(edgelist)
# ใพใ ไฝฟใใใฆใชใ้ ็นใฎไธญใใๆๅฐใฎ่ท้ขใฎใใฎใๆขใ
... | false | 32.727273 | [
"-def warshall_floyd(n, d):",
"- # d[i][j]: iใใjใธใฎๆ็ญ่ท้ข",
"- for k in range(n):",
"- for i in range(n):",
"- for j in range(n):",
"- d[i][j] = min(d[i][j], d[i][k] + d[k][j])",
"+def dijkstra_heap(n, s, edge):",
"+ # ๅง็นsใใๅ้ ็นใธใฎๆ็ญ่ท้ข",
"+ d = [float(\"inf\")... | false | 0.06647 | 0.031144 | 2.134281 | [
"s158736854",
"s569916421"
] |
u729133443 | p02768 | python | s074202531 | s475845189 | 174 | 154 | 38,512 | 3,060 | Accepted | Accepted | 11.49 | M=10**9+7
def comb(n,k):
a=b=1
for i in range(1,k+1):
a=a*n%M
b=b*i%M
n-=1
return a*pow(b,M-2,M)
n,a,b=list(map(int,input().split()))
print(((pow(2,n,M)-1-comb(n,a)-comb(n,b))%M)) | M=10**9+7
n,a,b=list(map(int,input().split()))
def f(k):
a=b=1;m=n
for i in range(k):a=a*m%M;b=b*-~i%M;m-=1
return a*pow(b,M-2,M)
print(((~f(a)-f(b)+pow(2,n,M))%M)) | 10 | 7 | 198 | 165 | M = 10**9 + 7
def comb(n, k):
a = b = 1
for i in range(1, k + 1):
a = a * n % M
b = b * i % M
n -= 1
return a * pow(b, M - 2, M)
n, a, b = list(map(int, input().split()))
print(((pow(2, n, M) - 1 - comb(n, a) - comb(n, b)) % M))
| M = 10**9 + 7
n, a, b = list(map(int, input().split()))
def f(k):
a = b = 1
m = n
for i in range(k):
a = a * m % M
b = b * -~i % M
m -= 1
return a * pow(b, M - 2, M)
print(((~f(a) - f(b) + pow(2, n, M)) % M))
| false | 30 | [
"+n, a, b = list(map(int, input().split()))",
"-def comb(n, k):",
"+def f(k):",
"- for i in range(1, k + 1):",
"- a = a * n % M",
"- b = b * i % M",
"- n -= 1",
"+ m = n",
"+ for i in range(k):",
"+ a = a * m % M",
"+ b = b * -~i % M",
"+ m -=... | false | 0.106824 | 0.13829 | 0.772466 | [
"s074202531",
"s475845189"
] |
u260980560 | p02361 | python | s878287200 | s032621206 | 1,980 | 1,770 | 87,908 | 90,460 | Accepted | Accepted | 10.61 | from heapq import heappush, heappop
V, E, r = list(map(int, input().split()))
g = [[] for i in range(V)]
for i in range(E):
s, t, d = list(map(int, input().split()))
g[s].append((t, d))
INF = 10**10
dist = [INF]*V
que = [(0,r)]
dist[r] = 0
while que:
c, v = heappop(que)
if dist[v] < c:
... | class RadixHeap:
__slots__ = ["data", "last", "siz", "used"]
# (max_key - min_key) <= C
def __init__(self, N, C):
self.data = [[] for i in range(C.bit_length() + 1)]
self.last = self.siz = 0
self.used = [0]*N
def push(self, x, key):
#assert self.last <= x
... | 21 | 72 | 541 | 1,889 | from heapq import heappush, heappop
V, E, r = list(map(int, input().split()))
g = [[] for i in range(V)]
for i in range(E):
s, t, d = list(map(int, input().split()))
g[s].append((t, d))
INF = 10**10
dist = [INF] * V
que = [(0, r)]
dist[r] = 0
while que:
c, v = heappop(que)
if dist[v] < c:
conti... | class RadixHeap:
__slots__ = ["data", "last", "siz", "used"]
# (max_key - min_key) <= C
def __init__(self, N, C):
self.data = [[] for i in range(C.bit_length() + 1)]
self.last = self.siz = 0
self.used = [0] * N
def push(self, x, key):
# assert self.last <= x
self... | false | 70.833333 | [
"-from heapq import heappush, heappop",
"+class RadixHeap:",
"+ __slots__ = [\"data\", \"last\", \"siz\", \"used\"]",
"+ # (max_key - min_key) <= C",
"+ def __init__(self, N, C):",
"+ self.data = [[] for i in range(C.bit_length() + 1)]",
"+ self.last = self.siz = 0",
"+ s... | false | 0.039292 | 0.04649 | 0.845181 | [
"s878287200",
"s032621206"
] |
u200887663 | p02911 | python | s095317852 | s974702578 | 284 | 211 | 7,844 | 19,456 | Accepted | Accepted | 25.7 | n,k,q=list(map(int,input().split()))
pointl=[k-q for i in range(n)]
for i in range(q):
a=int(eval(input()))
pointl[a-1]=pointl[a-1]+1
for i in range(n):
if pointl[i]<=0:
print("No")
else:
print("Yes")
| #n=int(input())
n,k,q=list(map(int,input().split()))
#t=int(input())
#al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
windic={i:0 for i in range(1,n+1)}
for i in range(q):
a=int(eval(input()))
windic[a]=windic[a]+1
for i in range(1,n+1):
if k-q+windic[i]>=... | 14 | 15 | 241 | 365 | n, k, q = list(map(int, input().split()))
pointl = [k - q for i in range(n)]
for i in range(q):
a = int(eval(input()))
pointl[a - 1] = pointl[a - 1] + 1
for i in range(n):
if pointl[i] <= 0:
print("No")
else:
print("Yes")
| # n=int(input())
n, k, q = list(map(int, input().split()))
# t=int(input())
# al=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
windic = {i: 0 for i in range(1, n + 1)}
for i in range(q):
a = int(eval(input()))
windic[a] = windic[a] + 1
for i in range(1, n + 1):
if k -... | false | 6.666667 | [
"+# n=int(input())",
"-pointl = [k - q for i in range(n)]",
"+# t=int(input())",
"+# al=list(map(int,input().split()))",
"+# l=[list(map(int,input().split())) for i in range(n)]",
"+windic = {i: 0 for i in range(1, n + 1)}",
"- pointl[a - 1] = pointl[a - 1] + 1",
"-for i in range(n):",
"- if p... | false | 0.084166 | 0.067022 | 1.255799 | [
"s095317852",
"s974702578"
] |
u533039576 | p02768 | python | s672936343 | s173579001 | 837 | 271 | 263,504 | 10,900 | Accepted | Accepted | 67.62 | n, a, b = list(map(int, input().split()))
MOD = 10**9 + 7
def comb(n: int, k: int, MOD: int) -> int:
if n < k or n < 0 or k < 0:
return 0
k = min(k, n - k)
if k == 0:
return 1
iinv = [1] * (k + 1)
ans = n
for i in range(2, k + 1):
iinv[i] = MOD - iinv[MOD %... | n, a, b = list(map(int, input().split()))
MOD = 10**9 + 7
def comb(n: int, k: int, MOD: int) -> int:
if n < k or n < 0 or k < 0:
return 0
k = min(k, n - k)
if k == 0:
return 1
iinv = [1] * (k + 1)
ans = n
for i in range(2, k + 1):
iinv[i] = MOD - iinv[MOD %... | 24 | 25 | 521 | 557 | n, a, b = list(map(int, input().split()))
MOD = 10**9 + 7
def comb(n: int, k: int, MOD: int) -> int:
if n < k or n < 0 or k < 0:
return 0
k = min(k, n - k)
if k == 0:
return 1
iinv = [1] * (k + 1)
ans = n
for i in range(2, k + 1):
iinv[i] = MOD - iinv[MOD % i] * (MOD //... | n, a, b = list(map(int, input().split()))
MOD = 10**9 + 7
def comb(n: int, k: int, MOD: int) -> int:
if n < k or n < 0 or k < 0:
return 0
k = min(k, n - k)
if k == 0:
return 1
iinv = [1] * (k + 1)
ans = n
for i in range(2, k + 1):
iinv[i] = MOD - iinv[MOD % i] * (MOD //... | false | 4 | [
"-ans = ((1 << n) - 1) % MOD",
"+# ans = ((1 << n) - 1) % MOD",
"+ans = (pow(2, n, MOD) - 1) % MOD"
] | false | 1.122786 | 0.16837 | 6.668545 | [
"s672936343",
"s173579001"
] |
u550061714 | p02772 | python | s264081832 | s811196666 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | from sys import exit
N = int(eval(input()))
A = tuple(map(int, input().split()))
for a in A:
if a % 2 == 0:
if not(a % 3 == 0 or a % 5 == 0):
print('DENIED')
exit()
print('APPROVED')
| from sys import exit
N = int(eval(input()))
A = tuple(map(int, input().split()))
for a in A:
if not a % 2 and a % 3 and a % 5:
print('DENIED')
exit()
print('APPROVED')
| 10 | 9 | 223 | 191 | from sys import exit
N = int(eval(input()))
A = tuple(map(int, input().split()))
for a in A:
if a % 2 == 0:
if not (a % 3 == 0 or a % 5 == 0):
print("DENIED")
exit()
print("APPROVED")
| from sys import exit
N = int(eval(input()))
A = tuple(map(int, input().split()))
for a in A:
if not a % 2 and a % 3 and a % 5:
print("DENIED")
exit()
print("APPROVED")
| false | 10 | [
"- if a % 2 == 0:",
"- if not (a % 3 == 0 or a % 5 == 0):",
"- print(\"DENIED\")",
"- exit()",
"+ if not a % 2 and a % 3 and a % 5:",
"+ print(\"DENIED\")",
"+ exit()"
] | false | 0.045517 | 0.04563 | 0.997521 | [
"s264081832",
"s811196666"
] |
u936985471 | p02887 | python | s804354922 | s392732218 | 53 | 42 | 15,988 | 9,284 | Accepted | Accepted | 20.75 | eval(input())
import itertools
print((len(list(itertools.groupby(eval(input())))))) | import sys
readline = sys.stdin.readline
N = int(readline())
S = readline().rstrip()
ans = 1
for i in range(1,len(S)):
if S[i] != S[i - 1]:
ans += 1
print(ans) | 3 | 11 | 71 | 177 | eval(input())
import itertools
print((len(list(itertools.groupby(eval(input()))))))
| import sys
readline = sys.stdin.readline
N = int(readline())
S = readline().rstrip()
ans = 1
for i in range(1, len(S)):
if S[i] != S[i - 1]:
ans += 1
print(ans)
| false | 72.727273 | [
"-eval(input())",
"-import itertools",
"+import sys",
"-print((len(list(itertools.groupby(eval(input()))))))",
"+readline = sys.stdin.readline",
"+N = int(readline())",
"+S = readline().rstrip()",
"+ans = 1",
"+for i in range(1, len(S)):",
"+ if S[i] != S[i - 1]:",
"+ ans += 1",
"+pr... | false | 0.034296 | 0.036044 | 0.951501 | [
"s804354922",
"s392732218"
] |
u358919705 | p02412 | python | s175338291 | s140153444 | 990 | 490 | 20,676 | 8,924 | Accepted | Accepted | 50.51 | import itertools
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
ans = 0
for t in list(itertools.combinations([i + 1 for i in range(n)], 3)):
if sum(t) == x:
ans += 1
print(ans) | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_B "How many ways?" ????ยงยฃ??????
#
import itertools
while True:
n, x = list(map(int, input().split()))
if not n:
break
print((list(map(sum, itertools.combinations(list(range(1, n + 1)), 3))).count(x))) | 10 | 8 | 253 | 280 | import itertools
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
ans = 0
for t in list(itertools.combinations([i + 1 for i in range(n)], 3)):
if sum(t) == x:
ans += 1
print(ans)
| # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_B "How many ways?" ????ยงยฃ??????
#
import itertools
while True:
n, x = list(map(int, input().split()))
if not n:
break
print((list(map(sum, itertools.combinations(list(range(1, n + 1)), 3))).count(x)))
| false | 20 | [
"+# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_B \"How many ways?\" ????ยงยฃ??????",
"+#",
"- if n == x == 0:",
"+ if not n:",
"- ans = 0",
"- for t in list(itertools.combinations([i + 1 for i in range(n)], 3)):",
"- if sum(t) == x:",
"- ans += 1",
"-... | false | 0.114504 | 0.0788 | 1.453097 | [
"s175338291",
"s140153444"
] |
u117348081 | p03207 | python | s140044253 | s036203751 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
print((int(max(a)*0.5+sum(a)-max(a))))
| n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a.sort()
print((sum(a) - int(a[-1]/2))) | 3 | 5 | 93 | 96 | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
print((int(max(a) * 0.5 + sum(a) - max(a))))
| n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a.sort()
print((sum(a) - int(a[-1] / 2)))
| false | 40 | [
"-print((int(max(a) * 0.5 + sum(a) - max(a))))",
"+a.sort()",
"+print((sum(a) - int(a[-1] / 2)))"
] | false | 0.038433 | 0.036659 | 1.048392 | [
"s140044253",
"s036203751"
] |
u102461423 | p02905 | python | s873761483 | s170376168 | 1,956 | 671 | 122,904 | 139,184 | Accepted | Accepted | 65.7 | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
import numpy as np
MOD = 998244353
N = int(readline())
A = np.array(readline().split(),np.int32)
U = 10**6+100
counter = np.bincount(A,minlength=U)
def cumprod(arr):
L = len(arr); Lsq = int(L... | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
import numpy as np
MOD = 998244353
N = int(readline())
A = np.array(readline().split(),np.int32)
U = 10**6+100
counter = np.bincount(A,minlength=U)
def cumprod(arr):
L = len(arr); Lsq = int(L... | 66 | 78 | 1,499 | 1,799 | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**7)
import numpy as np
MOD = 998244353
N = int(readline())
A = np.array(readline().split(), np.int32)
U = 10**6 + 100
counter = np.bincount(A, minlength=U)
def cumprod(arr):
L = len(arr)
Lsq = int(L**0.5 + 1)
... | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**7)
import numpy as np
MOD = 998244353
N = int(readline())
A = np.array(readline().split(), np.int32)
U = 10**6 + 100
counter = np.bincount(A, minlength=U)
def cumprod(arr):
L = len(arr)
Lsq = int(L**0.5 + 1)
... | false | 15.384615 | [
"+is_prime = np.zeros(U, dtype=np.int64)",
"+is_prime[2] = 1",
"+is_prime[3::2] = 1",
"+for p in range(3, M, 2):",
"+ if p * p > U:",
"+ break",
"+ if is_prime[p]:",
"+ is_prime[p * p :: p + p] = 0",
"+primes = np.where(is_prime)[0]",
"+pi = is_prime.cumsum()",
"-for p in ran... | false | 1.620573 | 1.686939 | 0.960659 | [
"s873761483",
"s170376168"
] |
u325227960 | p03722 | python | s928935984 | s309808777 | 549 | 439 | 51,672 | 49,368 | Accepted | Accepted | 20.04 | n, m = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(m)]
for i in range(m):
A[i][2] = -A[i][2]
P = [float("inf")] * (n+1)
P[1] = 0
F = [[0] * 2 for i in range(n+1)]
F[1][0] = 1
F[n][1] = 1
for i in range(n):
for j in range(m):
if F[A[j][0]][0] == 1 :
... | n, m = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(m)]
for i in range(m):
A[i][2] = -A[i][2]
P = [float("inf")] * (n+1)
P[1] = 0
F = [[0] * 2 for i in range(n+1)]
F[1][0] = 1
F[n][1] = 1
for i in range(n):
for j in range(m):
if F[A[j][0]][0] == 1 :
... | 41 | 41 | 894 | 894 | n, m = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(m)]
for i in range(m):
A[i][2] = -A[i][2]
P = [float("inf")] * (n + 1)
P[1] = 0
F = [[0] * 2 for i in range(n + 1)]
F[1][0] = 1
F[n][1] = 1
for i in range(n):
for j in range(m):
if F[A[j][0]][0] == 1:
... | n, m = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(m)]
for i in range(m):
A[i][2] = -A[i][2]
P = [float("inf")] * (n + 1)
P[1] = 0
F = [[0] * 2 for i in range(n + 1)]
F[1][0] = 1
F[n][1] = 1
for i in range(n):
for j in range(m):
if F[A[j][0]][0] == 1:
... | false | 0 | [
"-for i in range(n):",
"+for i in range(1):"
] | false | 0.041869 | 0.04774 | 0.877009 | [
"s928935984",
"s309808777"
] |
u472065247 | p03241 | python | s772148917 | s175542698 | 492 | 408 | 40,044 | 38,512 | Accepted | Accepted | 17.07 | N, M = list(map(int, input().split()))
for i in range(M // N, 0, -1):
if M % i == 0:
print(i)
exit() | def main():
N, M = list(map(int, input().split()))
for i in range(M // N, 0, -1):
if M % i == 0:
print(i)
break
if __name__ == '__main__':
main() | 6 | 10 | 110 | 178 | N, M = list(map(int, input().split()))
for i in range(M // N, 0, -1):
if M % i == 0:
print(i)
exit()
| def main():
N, M = list(map(int, input().split()))
for i in range(M // N, 0, -1):
if M % i == 0:
print(i)
break
if __name__ == "__main__":
main()
| false | 40 | [
"-N, M = list(map(int, input().split()))",
"-for i in range(M // N, 0, -1):",
"- if M % i == 0:",
"- print(i)",
"- exit()",
"+def main():",
"+ N, M = list(map(int, input().split()))",
"+ for i in range(M // N, 0, -1):",
"+ if M % i == 0:",
"+ print(i)",
"... | false | 0.079 | 0.057432 | 1.375558 | [
"s772148917",
"s175542698"
] |
u994521204 | p02559 | python | s973095227 | s768173086 | 1,682 | 703 | 136,940 | 134,880 | Accepted | Accepted | 58.2 | class SegmentTree:
ele = 0
def func(self, a, b):
return a + b
# SEGๆจใฏ1-index
# Aใซ้ขใใฆใฏ0-index
def __init__(self, n): # Aใฏ0-idx
self.n = n
self.num = 2 ** ((self.n - 1).bit_length())
self.SEG = [self.ele] * (2 * self.num)
def search(self, idx):
... | import sys
input = sys.stdin.buffer.readline
class SegmentTree:
ele = 0
def func(self, a, b):
return a + b
# SEGๆจใฏ1-index
# Aใซ้ขใใฆใฏ0-index
def __init__(self, n): # Aใฏ0-idx
self.n = n
self.num = 2 ** ((self.n - 1).bit_length())
self.SEG = [self.e... | 60 | 63 | 1,610 | 1,654 | class SegmentTree:
ele = 0
def func(self, a, b):
return a + b
# SEGๆจใฏ1-index
# Aใซ้ขใใฆใฏ0-index
def __init__(self, n): # Aใฏ0-idx
self.n = n
self.num = 2 ** ((self.n - 1).bit_length())
self.SEG = [self.ele] * (2 * self.num)
def search(self, idx):
return se... | import sys
input = sys.stdin.buffer.readline
class SegmentTree:
ele = 0
def func(self, a, b):
return a + b
# SEGๆจใฏ1-index
# Aใซ้ขใใฆใฏ0-index
def __init__(self, n): # Aใฏ0-idx
self.n = n
self.num = 2 ** ((self.n - 1).bit_length())
self.SEG = [self.ele] * (2 * self.nu... | false | 4.761905 | [
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"+",
"+",
"-A = list(map(int, input().split()))",
"-ST.initialize(A)",
"+ST.initialize(list(map(int, input().split())))"
] | false | 0.036377 | 0.036527 | 0.995892 | [
"s973095227",
"s768173086"
] |
u989345508 | p03612 | python | s888467920 | s293833007 | 158 | 73 | 14,324 | 14,008 | Accepted | Accepted | 53.8 | import copy
n=int(eval(input()))
f1=list(map(int,input().split()))
f2=copy.deepcopy(f1)
c=0
for i in range(n-1):
if f1[i]==i+1:
c+=1
f1[i],f1[i+1]=f1[i+1],f1[i]
for i in range(n-1,0,-1):
#print(d)
if f1[i]==i+1:
c+=1
f1[i],f1[i-1]=f1[i-1],f1[i]
print(c)
| n=int(eval(input()))
f=list(map(int,input().split()))
c=0
for i in range(n-1):
if f[i]==i+1:
c+=1
f[i],f[i+1]=f[i+1],f[i]
if f[n-1]==n:
f[n-2],f[n-1]=f[n-1],f[n-2]
c+=1
print(c) | 18 | 11 | 312 | 209 | import copy
n = int(eval(input()))
f1 = list(map(int, input().split()))
f2 = copy.deepcopy(f1)
c = 0
for i in range(n - 1):
if f1[i] == i + 1:
c += 1
f1[i], f1[i + 1] = f1[i + 1], f1[i]
for i in range(n - 1, 0, -1):
# print(d)
if f1[i] == i + 1:
c += 1
f1[i], f1[i - 1] = f1[... | n = int(eval(input()))
f = list(map(int, input().split()))
c = 0
for i in range(n - 1):
if f[i] == i + 1:
c += 1
f[i], f[i + 1] = f[i + 1], f[i]
if f[n - 1] == n:
f[n - 2], f[n - 1] = f[n - 1], f[n - 2]
c += 1
print(c)
| false | 38.888889 | [
"-import copy",
"-",
"-f1 = list(map(int, input().split()))",
"-f2 = copy.deepcopy(f1)",
"+f = list(map(int, input().split()))",
"- if f1[i] == i + 1:",
"+ if f[i] == i + 1:",
"- f1[i], f1[i + 1] = f1[i + 1], f1[i]",
"-for i in range(n - 1, 0, -1):",
"- # print(d)",
"- if f1[i... | false | 0.085443 | 0.043269 | 1.974693 | [
"s888467920",
"s293833007"
] |
u020604402 | p03700 | python | s290354311 | s365072826 | 1,982 | 1,437 | 8,284 | 8,284 | Accepted | Accepted | 27.5 | N,A,B = list(map(int,input().split()))
H = []
for _ in range(N):
H.append(int(eval(input())))
H = sorted(H)
def check(x):
cnt = 0
for h in H:
if h > x * B:
tmp = (h - x*B) // (A-B)
#ๅใไธใ
if tmp * (A-B) != h - x*B: tmp += 1
cnt += tmp
i... | N,A,B = list(map(int,input().split()))
H = []
for _ in range(N):
H.append(int(eval(input())))
H = sorted(H)
def check(x):
cnt = 0
for h in H:
if h > x * B:
tmp = (h - x*B) // (A-B)
#ๅใไธใ
if tmp * (A-B) != h - x*B: tmp += 1
cnt += tmp
i... | 27 | 27 | 574 | 574 | N, A, B = list(map(int, input().split()))
H = []
for _ in range(N):
H.append(int(eval(input())))
H = sorted(H)
def check(x):
cnt = 0
for h in H:
if h > x * B:
tmp = (h - x * B) // (A - B)
# ๅใไธใ
if tmp * (A - B) != h - x * B:
tmp += 1
... | N, A, B = list(map(int, input().split()))
H = []
for _ in range(N):
H.append(int(eval(input())))
H = sorted(H)
def check(x):
cnt = 0
for h in H:
if h > x * B:
tmp = (h - x * B) // (A - B)
# ๅใไธใ
if tmp * (A - B) != h - x * B:
tmp += 1
... | false | 0 | [
"-print((bisect(0, 10**31)))",
"+print((bisect(0, 10**12)))"
] | false | 0.043181 | 0.04313 | 1.001162 | [
"s290354311",
"s365072826"
] |
u155236040 | p03448 | python | s575049772 | s873361522 | 50 | 19 | 3,060 | 3,060 | Accepted | Accepted | 62 | a_500 = int(eval(input()))
b_100 = int(eval(input()))
c_50 = int(eval(input()))
x = int(eval(input()))
count = 0
for a in range(a_500+1):
for b in range(b_100+1):
for c in range(c_50+1):
if a*500+b*100+c*50 == x:
count += 1
print(count) | a_500 = int(eval(input()))
b_100 = int(eval(input()))
c_50 = int(eval(input()))
x = int(eval(input()))
count = 0
for a in range(a_500+1):
for b in range(b_100+1):
c_num = int((x-a*500-b*100)/50)
if c_num in range(c_50+1):
count += 1
print(count) | 11 | 11 | 262 | 263 | a_500 = int(eval(input()))
b_100 = int(eval(input()))
c_50 = int(eval(input()))
x = int(eval(input()))
count = 0
for a in range(a_500 + 1):
for b in range(b_100 + 1):
for c in range(c_50 + 1):
if a * 500 + b * 100 + c * 50 == x:
count += 1
print(count)
| a_500 = int(eval(input()))
b_100 = int(eval(input()))
c_50 = int(eval(input()))
x = int(eval(input()))
count = 0
for a in range(a_500 + 1):
for b in range(b_100 + 1):
c_num = int((x - a * 500 - b * 100) / 50)
if c_num in range(c_50 + 1):
count += 1
print(count)
| false | 0 | [
"- for c in range(c_50 + 1):",
"- if a * 500 + b * 100 + c * 50 == x:",
"- count += 1",
"+ c_num = int((x - a * 500 - b * 100) / 50)",
"+ if c_num in range(c_50 + 1):",
"+ count += 1"
] | false | 0.064718 | 0.031884 | 2.02979 | [
"s575049772",
"s873361522"
] |
u197300773 | p03458 | python | s426807824 | s282622839 | 778 | 702 | 56,664 | 56,664 | Accepted | Accepted | 9.77 | n,k=list(map(int,input().split()))
grid=[[0]*k for _ in range(k)]
for i in range(n):
x,y,c=[x for x in input().split()]
x,y=int(x),int(y)
p=(x//k+y//k)%2
if (p==0 and c=="B")|(p==1 and c=="W"): grid[x%k][y%k]+=1
else: grid[x%k][y%k]-=1
for i in range(k):
for j in range(1,k):
... | n,k=list(map(int,input().split()))
grid=[[0]*k for _ in range(k)]
for i in range(n):
x,y,c=[x for x in input().split()]
x,y=int(x),int(y)
p=(x//k+y//k)%2
if (p==0 and c=="B")|(p==1 and c=="W"): grid[x%k][y%k]+=1
else: grid[x%k][y%k]-=1
for i in range(k):
for j in range(1,k):
... | 24 | 24 | 599 | 592 | n, k = list(map(int, input().split()))
grid = [[0] * k for _ in range(k)]
for i in range(n):
x, y, c = [x for x in input().split()]
x, y = int(x), int(y)
p = (x // k + y // k) % 2
if (p == 0 and c == "B") | (p == 1 and c == "W"):
grid[x % k][y % k] += 1
else:
grid[x % k][y % k] -= 1
... | n, k = list(map(int, input().split()))
grid = [[0] * k for _ in range(k)]
for i in range(n):
x, y, c = [x for x in input().split()]
x, y = int(x), int(y)
p = (x // k + y // k) % 2
if (p == 0 and c == "B") | (p == 1 and c == "W"):
grid[x % k][y % k] += 1
else:
grid[x % k][y % k] -= 1
... | false | 0 | [
"- ans = max(ans, (n + b) // 2, (n - b) // 2)",
"-print(ans)",
"+ ans = max(ans, n + b, n - b)",
"+print((ans // 2))"
] | false | 0.468689 | 0.44984 | 1.0419 | [
"s426807824",
"s282622839"
] |
u744920373 | p03862 | python | s912966267 | s214495902 | 159 | 134 | 14,200 | 14,656 | Accepted | Accepted | 15.72 | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | 26 | 38 | 858 | 1,087 | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | false | 31.578947 | [
"-for i in range(N - 1):",
"- adj.append(A[i] + A[i + 1])",
"+\"\"\"",
"+for i in range(N-1):",
"+ adj.append(A[i]+A[i+1])",
"- if i < N - 2:",
"- adj[i + 1] = max(adj[i + 1] - (num - x), A[i + 2])",
"+ if i < N-2:",
"+ adj[i+1] = max(adj[i+1] - (num-x), A[i... | false | 0.038453 | 0.046764 | 0.822282 | [
"s912966267",
"s214495902"
] |
u608088992 | p02901 | python | s111497528 | s170059312 | 1,575 | 1,003 | 3,640 | 3,188 | Accepted | Accepted | 36.32 | import sys
import heapq
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
cost = dict()
for i in range(2 ** N): cost[i] = -1
cost[0] = 0
for i in range(M):
a, b = list(map(int, input().split()))
c = [int(c) for c in input().split()]
... | import sys
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
Dist = [10 ** 20] * pow(2, N)
Dist[0] = 0
for _ in range(M):
a, b = list(map(int, input().split()))
C = [int(c) for c in input().split()]
binaryC = 0
for c in C: bina... | 27 | 20 | 691 | 561 | import sys
import heapq
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
cost = dict()
for i in range(2**N):
cost[i] = -1
cost[0] = 0
for i in range(M):
a, b = list(map(int, input().split()))
c = [int(c) for c in input().split()]
bi... | import sys
def solve():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
Dist = [10**20] * pow(2, N)
Dist[0] = 0
for _ in range(M):
a, b = list(map(int, input().split()))
C = [int(c) for c in input().split()]
binaryC = 0
for c in C:
bina... | false | 25.925926 | [
"-import heapq",
"- cost = dict()",
"- for i in range(2**N):",
"- cost[i] = -1",
"- cost[0] = 0",
"- for i in range(M):",
"+ Dist = [10**20] * pow(2, N)",
"+ Dist[0] = 0",
"+ for _ in range(M):",
"- c = [int(c) for c in input().split()]",
"- bit = 0",
... | false | 0.008144 | 0.038849 | 0.209641 | [
"s111497528",
"s170059312"
] |
u597455618 | p02642 | python | s985226193 | s644091589 | 468 | 381 | 31,308 | 42,956 | Accepted | Accepted | 18.59 | from sys import stdin
n = int(eval(input()))
a = list(map(int, stdin.readline().split()))
a.sort()
amax = max(a)+1
e = [0]*amax
ans = 0
for i in range(n):
e[a[i]] += 1
if e[a[i]] == 1:
for j in range(2*a[i], amax, a[i]):
e[j] += 2
print((e.count(1))) | from sys import stdin
n = int(eval(input()))
a = list(map(int, stdin.readline().split()))
a.sort()
amax = max(a)+1
e = [True]*amax
Alice = set()
Bob = set()
ans = 0
for i in range(n):
if e[a[i]] == True:
Alice.add(a[i])
for j in range(a[i], amax, a[i]):
e[j] = False
e... | 15 | 20 | 286 | 399 | from sys import stdin
n = int(eval(input()))
a = list(map(int, stdin.readline().split()))
a.sort()
amax = max(a) + 1
e = [0] * amax
ans = 0
for i in range(n):
e[a[i]] += 1
if e[a[i]] == 1:
for j in range(2 * a[i], amax, a[i]):
e[j] += 2
print((e.count(1)))
| from sys import stdin
n = int(eval(input()))
a = list(map(int, stdin.readline().split()))
a.sort()
amax = max(a) + 1
e = [True] * amax
Alice = set()
Bob = set()
ans = 0
for i in range(n):
if e[a[i]] == True:
Alice.add(a[i])
for j in range(a[i], amax, a[i]):
e[j] = False
else:
... | false | 25 | [
"-e = [0] * amax",
"+e = [True] * amax",
"+Alice = set()",
"+Bob = set()",
"- e[a[i]] += 1",
"- if e[a[i]] == 1:",
"- for j in range(2 * a[i], amax, a[i]):",
"- e[j] += 2",
"-print((e.count(1)))",
"+ if e[a[i]] == True:",
"+ Alice.add(a[i])",
"+ for j i... | false | 0.049203 | 0.03879 | 1.268429 | [
"s985226193",
"s644091589"
] |
u163703551 | p02820 | python | s774843804 | s771085519 | 241 | 168 | 23,252 | 3,828 | Accepted | Accepted | 30.29 | import sys
import socket
hostname = socket.gethostname()
if hostname == 'F451C':
sys.stdin = open('d1.in')
def read_int_list():
return list(map(int, input().split()))
def read_str_list():
return input().split()
def read_int():
return int(eval(input()))
def read_str():
... | import sys
import socket
hostname = socket.gethostname()
if hostname == 'F451C':
sys.stdin = open('d1.in')
def read_int_list():
return list(map(int, input().split()))
def read_str_list():
return input().split()
def read_int():
return int(eval(input()))
def read_str():
... | 56 | 85 | 1,072 | 1,687 | import sys
import socket
hostname = socket.gethostname()
if hostname == "F451C":
sys.stdin = open("d1.in")
def read_int_list():
return list(map(int, input().split()))
def read_str_list():
return input().split()
def read_int():
return int(eval(input()))
def read_str():
return eval(input())
... | import sys
import socket
hostname = socket.gethostname()
if hostname == "F451C":
sys.stdin = open("d1.in")
def read_int_list():
return list(map(int, input().split()))
def read_str_list():
return input().split()
def read_int():
return int(eval(input()))
def read_str():
return eval(input())
... | false | 34.117647 | [
"+def bigger(l):",
"+ if l == \"r\":",
"+ return \"p\"",
"+ if l == \"p\":",
"+ return \"s\"",
"+ if l == \"s\":",
"+ return \"r\"",
"+",
"+",
"+def solve_greedy(t, R, S, P):",
"+ n = len(t)",
"+ res = 0",
"+ l = \"\"",
"+ score = {\"r\": R, \"s\":... | false | 0.101873 | 0.044238 | 2.302854 | [
"s774843804",
"s771085519"
] |
u764956288 | p02623 | python | s324909078 | s859036492 | 249 | 170 | 50,812 | 48,444 | Accepted | Accepted | 31.73 | from bisect import bisect_right
def solve():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum_as = [0] * (N+1)
sum_bs = [0] * (M+1)
for i, a in enumerate(A):
sum_as[i+1] = sum_as[i] + a
for i, b... | from itertools import chain
def solve():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
*B, = list(map(int, input().split()))
answer = 0
sum_b = sum(B)
idx_b = M
remain = K
for i, a in enumerate(chain([0], A)):
remain -= a
... | 37 | 38 | 703 | 643 | from bisect import bisect_right
def solve():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum_as = [0] * (N + 1)
sum_bs = [0] * (M + 1)
for i, a in enumerate(A):
sum_as[i + 1] = sum_as[i] + a
for i, b in enumerate... | from itertools import chain
def solve():
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
(*B,) = list(map(int, input().split()))
answer = 0
sum_b = sum(B)
idx_b = M
remain = K
for i, a in enumerate(chain([0], A)):
remain -= a
if remain < 0:... | false | 2.631579 | [
"-from bisect import bisect_right",
"+from itertools import chain",
"- B = list(map(int, input().split()))",
"- sum_as = [0] * (N + 1)",
"- sum_bs = [0] * (M + 1)",
"- for i, a in enumerate(A):",
"- sum_as[i + 1] = sum_as[i] + a",
"- for i, b in enumerate(B):",
"- sum_bs... | false | 0.05456 | 0.06919 | 0.788551 | [
"s324909078",
"s859036492"
] |
u852690916 | p02743 | python | s182942224 | s841523357 | 169 | 30 | 38,420 | 9,088 | Accepted | Accepted | 82.25 | a, b, c = list(map(int, input().split()))
if c<(a+b):
print('No')
else:
print(('Yes' if 4*a*b<(c-a-b)**2 else 'No'))
| a, b, c = list(map(int, input().split()))
if a + b > c:
print('No')
exit()
print(('Yes' if 4 * a * b < (c - a - b)**2 else 'No'))
| 5 | 5 | 121 | 134 | a, b, c = list(map(int, input().split()))
if c < (a + b):
print("No")
else:
print(("Yes" if 4 * a * b < (c - a - b) ** 2 else "No"))
| a, b, c = list(map(int, input().split()))
if a + b > c:
print("No")
exit()
print(("Yes" if 4 * a * b < (c - a - b) ** 2 else "No"))
| false | 0 | [
"-if c < (a + b):",
"+if a + b > c:",
"-else:",
"- print((\"Yes\" if 4 * a * b < (c - a - b) ** 2 else \"No\"))",
"+ exit()",
"+print((\"Yes\" if 4 * a * b < (c - a - b) ** 2 else \"No\"))"
] | false | 0.045011 | 0.038215 | 1.177855 | [
"s182942224",
"s841523357"
] |
u939814144 | p02261 | python | s734464350 | s859757220 | 450 | 20 | 7,816 | 7,736 | Accepted | Accepted | 95.56 | def bubble_sort(A, n):
flag = 1
i = 0
while flag:
flag = 0
for j in range(n-1, i, -1):
if int(A[j][1]) < int(A[j-1][1]):
A[j], A[j-1] = A[j-1], A[j]
flag = 1
i += 1
return A
def selection_sort(A, n):
for i in range(n-1):
minj = i
for j in range(i, n):
if int(A[j][1])... | def bubble_sort(A, n):
for i in range(n):
for j in range(n-1, i, -1):
if A[j][1] < A[j-1][1]:
A[j], A[j-1] = A[j-1], A[j]
print((' '.join(A)))
def selection_sort(A, n):
for i in range(n):
minj = i
for j in range(i, n):
if A[j][1] < A[minj][1]:
minj = j
if i != minj:
A[i], A[... | 55 | 29 | 1,006 | 561 | def bubble_sort(A, n):
flag = 1
i = 0
while flag:
flag = 0
for j in range(n - 1, i, -1):
if int(A[j][1]) < int(A[j - 1][1]):
A[j], A[j - 1] = A[j - 1], A[j]
flag = 1
i += 1
return A
def selection_sort(A, n):
for i in range(n - 1):... | def bubble_sort(A, n):
for i in range(n):
for j in range(n - 1, i, -1):
if A[j][1] < A[j - 1][1]:
A[j], A[j - 1] = A[j - 1], A[j]
print((" ".join(A)))
def selection_sort(A, n):
for i in range(n):
minj = i
for j in range(i, n):
if A[j][1] < A[... | false | 47.272727 | [
"- flag = 1",
"- i = 0",
"- while flag:",
"- flag = 0",
"+ for i in range(n):",
"- if int(A[j][1]) < int(A[j - 1][1]):",
"+ if A[j][1] < A[j - 1][1]:",
"- flag = 1",
"- i += 1",
"- return A",
"+ print((\" \".join(A)))",
"- ... | false | 0.135955 | 0.034876 | 3.898275 | [
"s734464350",
"s859757220"
] |
u553605501 | p02729 | python | s244073735 | s510200961 | 66 | 61 | 61,844 | 61,772 | Accepted | Accepted | 7.58 | n,m=list(map(int,input().split()))
if (n>0) and (m>0):
print((int(n*(n-1)/2+m*(m-1)/2)))
else:
print((int(max(n,m)*(max(n,m)-1)/2))) | n,m=list(map(int,input().split()))
print((int(n*(n-1)/2+m*(m-1)/2)))
| 5 | 2 | 130 | 62 | n, m = list(map(int, input().split()))
if (n > 0) and (m > 0):
print((int(n * (n - 1) / 2 + m * (m - 1) / 2)))
else:
print((int(max(n, m) * (max(n, m) - 1) / 2)))
| n, m = list(map(int, input().split()))
print((int(n * (n - 1) / 2 + m * (m - 1) / 2)))
| false | 60 | [
"-if (n > 0) and (m > 0):",
"- print((int(n * (n - 1) / 2 + m * (m - 1) / 2)))",
"-else:",
"- print((int(max(n, m) * (max(n, m) - 1) / 2)))",
"+print((int(n * (n - 1) / 2 + m * (m - 1) / 2)))"
] | false | 0.085208 | 0.102085 | 0.834672 | [
"s244073735",
"s510200961"
] |
u968166680 | p03212 | python | s279946736 | s889423977 | 84 | 50 | 9,132 | 9,120 | Accepted | Accepted | 40.48 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
def rec(vec):
if vec and int(''.join(vec)) > N:
return 0
ans = 0
i... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
def rec(n, used):
ans = 0
if all(used):
ans += 1
for i, d in enume... | 32 | 31 | 591 | 630 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
def rec(vec):
if vec and int("".join(vec)) > N:
return 0
ans = 0
if all(c in vec for ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N = int(readline())
def rec(n, used):
ans = 0
if all(used):
ans += 1
for i, d in enumerate((3, 7, 5)):
... | false | 3.125 | [
"- def rec(vec):",
"- if vec and int(\"\".join(vec)) > N:",
"- return 0",
"+ def rec(n, used):",
"- if all(c in vec for c in \"357\"):",
"+ if all(used):",
"- for c in \"357\":",
"- vec.append(c)",
"- ans += rec(vec)",
"- ... | false | 0.063923 | 0.039759 | 1.607783 | [
"s279946736",
"s889423977"
] |
u078042885 | p01447 | python | s100625528 | s718827599 | 30 | 20 | 7,736 | 7,744 | Accepted | Accepted | 33.33 | import math
print((math.ceil(math.log(int(eval(input())))/math.log(3)))) | import math
print((math.ceil(math.log(int(eval(input())),3)))) | 2 | 2 | 65 | 55 | import math
print((math.ceil(math.log(int(eval(input()))) / math.log(3))))
| import math
print((math.ceil(math.log(int(eval(input())), 3))))
| false | 0 | [
"-print((math.ceil(math.log(int(eval(input()))) / math.log(3))))",
"+print((math.ceil(math.log(int(eval(input())), 3))))"
] | false | 0.041141 | 0.046718 | 0.880618 | [
"s100625528",
"s718827599"
] |
u580273604 | p02548 | python | s523199384 | s618425435 | 222 | 151 | 9,148 | 9,152 | Accepted | Accepted | 31.98 | N=int(eval(input()))
s=0
for i in range(1,N):
s+=(N-0.1)//i
print((int(s))) | N=int(eval(input()))
s=0
for i in range(1,N):
s+=(N-1)//i
print(s) | 6 | 5 | 75 | 66 | N = int(eval(input()))
s = 0
for i in range(1, N):
s += (N - 0.1) // i
print((int(s)))
| N = int(eval(input()))
s = 0
for i in range(1, N):
s += (N - 1) // i
print(s)
| false | 16.666667 | [
"- s += (N - 0.1) // i",
"-print((int(s)))",
"+ s += (N - 1) // i",
"+print(s)"
] | false | 0.068871 | 0.056953 | 1.209252 | [
"s523199384",
"s618425435"
] |
u863370423 | p02694 | python | s753319799 | s584838470 | 49 | 26 | 64,380 | 8,852 | Accepted | Accepted | 46.94 | a = [100]
for i in range(4000):
a.append(a[-1] + a[-1] // 100)
x = int(eval(input()))
for i in range(4000):
if a[i] >= x:
print(i)
exit() | X = int(eval(input()))
x1 = 100
r = 0.01
t = 0
if 101 <= X <=10**18:
while x1 < X:
R = int(x1 * r)
x1 = R + x1
t = t + 1
print(t)
| 8 | 10 | 162 | 165 | a = [100]
for i in range(4000):
a.append(a[-1] + a[-1] // 100)
x = int(eval(input()))
for i in range(4000):
if a[i] >= x:
print(i)
exit()
| X = int(eval(input()))
x1 = 100
r = 0.01
t = 0
if 101 <= X <= 10**18:
while x1 < X:
R = int(x1 * r)
x1 = R + x1
t = t + 1
print(t)
| false | 20 | [
"-a = [100]",
"-for i in range(4000):",
"- a.append(a[-1] + a[-1] // 100)",
"-x = int(eval(input()))",
"-for i in range(4000):",
"- if a[i] >= x:",
"- print(i)",
"- exit()",
"+X = int(eval(input()))",
"+x1 = 100",
"+r = 0.01",
"+t = 0",
"+if 101 <= X <= 10**18:",
"+ ... | false | 0.038853 | 0.087329 | 0.444904 | [
"s753319799",
"s584838470"
] |
u116348130 | p03855 | python | s708073928 | s161519611 | 1,139 | 1,025 | 41,472 | 41,572 | Accepted | Accepted | 10.01 | from collections import*
import sys
input=sys.stdin.readline
class UNION_FIND(object):
def __init__(self,n):
#่ฆชใฎ็ชๅทใๆ ผ็ดใใใ่ฆชใ ใฃใๅ ดๅใฏ-(ใใฎ้ๅใฎใตใคใบ)
#ไฝใใจใใฏParentใฎๅคใๅ
จใฆ-1ใซใใ
#ใใใใใจๅ
จใฆใใฉใใฉใซใชใ
self.parent=[-1 for i in range(n)]
def root(self,x):
#Aใใฉใฎใฐใซใผใใซๅฑใใฆใใใ่ชฟ... | from collections import*
import sys
input = sys.stdin.readline
class UnionFind(object):
def __init__(self, n):
# ่ฆชใฎ็ชๅทใๆ ผ็ดใใใ่ฆชใ ใฃใๅ ดๅใฏ-(ใใฎ้ๅใฎใตใคใบ)
# ไฝใใจใใฏParentsใฎๅคใๅ
จใฆ-1ใซใใ
# ใใใใใจๅ
จใฆใใฉใใฉใซใชใ
self.parents = [-1 for i in range(n)]
def find(self, x):
if self.parents... | 55 | 50 | 1,493 | 1,221 | from collections import *
import sys
input = sys.stdin.readline
class UNION_FIND(object):
def __init__(self, n):
# ่ฆชใฎ็ชๅทใๆ ผ็ดใใใ่ฆชใ ใฃใๅ ดๅใฏ-(ใใฎ้ๅใฎใตใคใบ)
# ไฝใใจใใฏParentใฎๅคใๅ
จใฆ-1ใซใใ
# ใใใใใจๅ
จใฆใใฉใใฉใซใชใ
self.parent = [-1 for i in range(n)]
def root(self, x):
# Aใใฉใฎใฐใซใผใใซๅฑใใฆใใใ่ชฟในใ
... | from collections import *
import sys
input = sys.stdin.readline
class UnionFind(object):
def __init__(self, n):
# ่ฆชใฎ็ชๅทใๆ ผ็ดใใใ่ฆชใ ใฃใๅ ดๅใฏ-(ใใฎ้ๅใฎใตใคใบ)
# ไฝใใจใใฏParentsใฎๅคใๅ
จใฆ-1ใซใใ
# ใใใใใจๅ
จใฆใใฉใใฉใซใชใ
self.parents = [-1 for i in range(n)]
def find(self, x):
if self.parents[x] < 0:
... | false | 9.090909 | [
"-class UNION_FIND(object):",
"+class UnionFind(object):",
"- # ไฝใใจใใฏParentใฎๅคใๅ
จใฆ-1ใซใใ",
"+ # ไฝใใจใใฏParentsใฎๅคใๅ
จใฆ-1ใซใใ",
"- self.parent = [-1 for i in range(n)]",
"+ self.parents = [-1 for i in range(n)]",
"- def root(self, x):",
"- # Aใใฉใฎใฐใซใผใใซๅฑใใฆใใใ่ชฟในใ",
"- ... | false | 0.043885 | 0.041679 | 1.052925 | [
"s708073928",
"s161519611"
] |
u738898077 | p02954 | python | s297663969 | s450062872 | 129 | 102 | 12,412 | 10,824 | Accepted | Accepted | 20.93 | s = eval(input())
n = len(s)
r = [0]*n
l = [0]*n
for i in range(n-1):
if s[i] == "R":
r[i] += 1
if s[i+1] == "R":
r[i+2] += r[i]
r[i] = 0
if s[-i-1] == "L":
l[-i-1] += 1
if s[-i-2] == "L":
l[-i-3] += l[-i-1]
l[-i-1] = ... | s = eval(input())
n = len(s)
ans = [0]*n
rstrk = 0
lstrk = 0
for i in range(n):
rstrk += 1
if s[i] == "L":
ans[i-1] += rstrk//2
ans[i] += (rstrk+1)//2
rstrk = 0
for i in range(n-1,-1,-1):
lstrk += 1
if s[i] == "R":
ans[i+1] += lstrk//2
ans[i] += (l... | 21 | 19 | 409 | 371 | s = eval(input())
n = len(s)
r = [0] * n
l = [0] * n
for i in range(n - 1):
if s[i] == "R":
r[i] += 1
if s[i + 1] == "R":
r[i + 2] += r[i]
r[i] = 0
if s[-i - 1] == "L":
l[-i - 1] += 1
if s[-i - 2] == "L":
l[-i - 3] += l[-i - 1]
l[-i... | s = eval(input())
n = len(s)
ans = [0] * n
rstrk = 0
lstrk = 0
for i in range(n):
rstrk += 1
if s[i] == "L":
ans[i - 1] += rstrk // 2
ans[i] += (rstrk + 1) // 2
rstrk = 0
for i in range(n - 1, -1, -1):
lstrk += 1
if s[i] == "R":
ans[i + 1] += lstrk // 2
ans[i] += ... | false | 9.52381 | [
"-r = [0] * n",
"-l = [0] * n",
"-for i in range(n - 1):",
"+ans = [0] * n",
"+rstrk = 0",
"+lstrk = 0",
"+for i in range(n):",
"+ rstrk += 1",
"+ if s[i] == \"L\":",
"+ ans[i - 1] += rstrk // 2",
"+ ans[i] += (rstrk + 1) // 2",
"+ rstrk = 0",
"+for i in range(n - ... | false | 0.038318 | 0.037193 | 1.030244 | [
"s297663969",
"s450062872"
] |
u263830634 | p02863 | python | s187011417 | s356127904 | 522 | 333 | 117,080 | 83,276 | Accepted | Accepted | 36.21 | N, T = list(map(int, input().split()))
T -= 1
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[1])
AB.sort(key = lambda x: x[0], reverse = True)
dp = [[0] * (T + 1) for _ in range(N + 1)]
ans = AB[N - 1][1]
for i in range(N - 1, 0, -1):
for j in range(T + 1):
... | import numpy as np
N, T = list(map(int, input().split()))
T -= 1
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[1])
AB.sort(key = lambda x: x[0], reverse = True)
dp = [[0] * (T + 1) for _ in range(N + 1)]
dp = np.zeros(T + 1, dtype = np.int32)
ans = AB[N - 1][1]
fo... | 24 | 30 | 590 | 773 | N, T = list(map(int, input().split()))
T -= 1
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
AB.sort(key=lambda x: x[0], reverse=True)
dp = [[0] * (T + 1) for _ in range(N + 1)]
ans = AB[N - 1][1]
for i in range(N - 1, 0, -1):
for j in range(T + 1):
if j < AB[i][0]:
... | import numpy as np
N, T = list(map(int, input().split()))
T -= 1
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
AB.sort(key=lambda x: x[0], reverse=True)
dp = [[0] * (T + 1) for _ in range(N + 1)]
dp = np.zeros(T + 1, dtype=np.int32)
ans = AB[N - 1][1]
for i in range(N - 1, 0, -1)... | false | 20 | [
"+import numpy as np",
"+",
"+dp = np.zeros(T + 1, dtype=np.int32)",
"- for j in range(T + 1):",
"- if j < AB[i][0]:",
"- dp[i][j] = dp[i + 1][j]",
"- else:",
"- dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - AB[i][0]] + AB[i][1])",
"- tmp = dp[i][T] + AB[i - 1]... | false | 0.036719 | 0.248192 | 0.147946 | [
"s187011417",
"s356127904"
] |
u447528293 | p03796 | python | s111906714 | s914229641 | 230 | 34 | 4,024 | 2,940 | Accepted | Accepted | 85.22 | import math
N = int(input().rstrip())
power = math.factorial(N)
print((power % (pow(10, 9) + 7))) | N = int(input().rstrip())
DIV = 10**9 + 7
ans = 1
for n in range(1, N+1):
ans = (ans * n) % DIV
print(ans) | 4 | 6 | 98 | 115 | import math
N = int(input().rstrip())
power = math.factorial(N)
print((power % (pow(10, 9) + 7)))
| N = int(input().rstrip())
DIV = 10**9 + 7
ans = 1
for n in range(1, N + 1):
ans = (ans * n) % DIV
print(ans)
| false | 33.333333 | [
"-import math",
"-",
"-power = math.factorial(N)",
"-print((power % (pow(10, 9) + 7)))",
"+DIV = 10**9 + 7",
"+ans = 1",
"+for n in range(1, N + 1):",
"+ ans = (ans * n) % DIV",
"+print(ans)"
] | false | 0.160509 | 0.136073 | 1.179576 | [
"s111906714",
"s914229641"
] |
u150984829 | p00424 | python | s561758964 | s228303030 | 150 | 120 | 6,500 | 7,108 | Accepted | Accepted | 20 | import sys
s=sys.stdin.readline
while 1:
n=int(s())
if n==0:break
d={}
for _ in[0]*n:
k,v=s().strip().split()
d[k]=v
a=''
for _ in[0]*int(s()):
a+=d.get(*[s().strip()]*2)
print(a)
| import sys
s=sys.stdin.readline
while 1:
n=int(s())
if n==0:break
d={}
for _ in[0]*n:
k,v=s().strip().split()
d[k]=v
print((''.join(d.get(*[s().strip()]*2)for _ in[0]*int(s()))))
| 13 | 10 | 205 | 195 | import sys
s = sys.stdin.readline
while 1:
n = int(s())
if n == 0:
break
d = {}
for _ in [0] * n:
k, v = s().strip().split()
d[k] = v
a = ""
for _ in [0] * int(s()):
a += d.get(*[s().strip()] * 2)
print(a)
| import sys
s = sys.stdin.readline
while 1:
n = int(s())
if n == 0:
break
d = {}
for _ in [0] * n:
k, v = s().strip().split()
d[k] = v
print(("".join(d.get(*[s().strip()] * 2) for _ in [0] * int(s()))))
| false | 23.076923 | [
"- a = \"\"",
"- for _ in [0] * int(s()):",
"- a += d.get(*[s().strip()] * 2)",
"- print(a)",
"+ print((\"\".join(d.get(*[s().strip()] * 2) for _ in [0] * int(s()))))"
] | false | 0.043168 | 0.093375 | 0.462311 | [
"s561758964",
"s228303030"
] |
u335145501 | p02678 | python | s043382879 | s995072586 | 1,967 | 518 | 155,708 | 96,276 | Accepted | Accepted | 73.67 | from heapq import heappush, heappop
INT_MAX = 10 ** 9
def main():
n, m = list(map(int, input().split()))
ab = (list(map(int, input().split())) for i in range(m))
g = [[] for i in range(n+1)]
gp = [INT_MAX] * (n+1)
gf = [0] * (n+1)
for a, b in ab:
g[a].append(b)
g[b].append... |
def main():
n, m = list(map(int, input().split()))
ab = (list(map(int, input().split())) for _ in range(m))
# ๆญปๅ graph = [[0] * (n+1) for _ in range(n+1)]
graph = [[] for _ in range(n+1)]
for a, b in ab:
graph[a].append(b)
graph[b].append(a)
from collections impor... | 38 | 39 | 691 | 725 | from heapq import heappush, heappop
INT_MAX = 10**9
def main():
n, m = list(map(int, input().split()))
ab = (list(map(int, input().split())) for i in range(m))
g = [[] for i in range(n + 1)]
gp = [INT_MAX] * (n + 1)
gf = [0] * (n + 1)
for a, b in ab:
g[a].append(b)
g[b].append... | def main():
n, m = list(map(int, input().split()))
ab = (list(map(int, input().split())) for _ in range(m))
# ๆญปๅ graph = [[0] * (n+1) for _ in range(n+1)]
graph = [[] for _ in range(n + 1)]
for a, b in ab:
graph[a].append(b)
graph[b].append(a)
from collections import deque
q... | false | 2.564103 | [
"-from heapq import heappush, heappop",
"-",
"-INT_MAX = 10**9",
"-",
"-",
"- ab = (list(map(int, input().split())) for i in range(m))",
"- g = [[] for i in range(n + 1)]",
"- gp = [INT_MAX] * (n + 1)",
"- gf = [0] * (n + 1)",
"+ ab = (list(map(int, input().split())) for _ in range(... | false | 0.046758 | 0.082037 | 0.569965 | [
"s043382879",
"s995072586"
] |
u973840923 | p03126 | python | s909744112 | s986156342 | 28 | 19 | 3,064 | 2,940 | Accepted | Accepted | 32.14 | N,M = list(map(int,input().split()))
list = [list(map(int,input().split())) for x in range(N)]
#ไธๅ็ฎๅ้ค
for i in range(0,N):
list[i].pop(0)
stock = []
#่งฃ็ญใๅ
จใชในใใซใใใๆข็ดข
for i in range(0,N):
for j in range(0,len(list[i])):
cnt = 0
for k in range(0,N):
if list[i][j] in list... | N,M = list(map(int,input().split()))
M_kinds = set(range(1,M+1))
for i in range(N):
a,*b = list(map(int,input().split()))
M_kinds &= set(b)
print((len(M_kinds))) | 23 | 9 | 465 | 166 | N, M = list(map(int, input().split()))
list = [list(map(int, input().split())) for x in range(N)]
# ไธๅ็ฎๅ้ค
for i in range(0, N):
list[i].pop(0)
stock = []
# ่งฃ็ญใๅ
จใชในใใซใใใๆข็ดข
for i in range(0, N):
for j in range(0, len(list[i])):
cnt = 0
for k in range(0, N):
if list[i][j] in list[k]:
... | N, M = list(map(int, input().split()))
M_kinds = set(range(1, M + 1))
for i in range(N):
a, *b = list(map(int, input().split()))
M_kinds &= set(b)
print((len(M_kinds)))
| false | 60.869565 | [
"-list = [list(map(int, input().split())) for x in range(N)]",
"-# ไธๅ็ฎๅ้ค",
"-for i in range(0, N):",
"- list[i].pop(0)",
"-stock = []",
"-# ่งฃ็ญใๅ
จใชในใใซใใใๆข็ดข",
"-for i in range(0, N):",
"- for j in range(0, len(list[i])):",
"- cnt = 0",
"- for k in range(0, N):",
"- if... | false | 0.039418 | 0.074987 | 0.525662 | [
"s909744112",
"s986156342"
] |
u252828980 | p02832 | python | s571609205 | s862074333 | 139 | 128 | 26,268 | 24,744 | Accepted | Accepted | 7.91 | n = int(eval(input()))
#a,b = map(int,input().split())
L = list(map(int,input().split()))
#L.sort()
c = min(L)
flag = False
if c == 1:
flag = True
li = []
for i in range(n):
if L[i] == c and flag == True:
li.append(c)
c = L[i]+1
if flag:
print((len(L)-len(li)))
else:
... | n = int(eval(input()))
L = list(map(int,input().split()))
i = 0
num = 1
cnt = 0
while i <=n-1:
if L[i] == num:
num +=1
else:
cnt +=1
i+= 1
if num == 1:
print((-1))
else:
print(cnt) | 20 | 15 | 324 | 223 | n = int(eval(input()))
# a,b = map(int,input().split())
L = list(map(int, input().split()))
# L.sort()
c = min(L)
flag = False
if c == 1:
flag = True
li = []
for i in range(n):
if L[i] == c and flag == True:
li.append(c)
c = L[i] + 1
if flag:
print((len(L) - len(li)))
else:
print((-1))
| n = int(eval(input()))
L = list(map(int, input().split()))
i = 0
num = 1
cnt = 0
while i <= n - 1:
if L[i] == num:
num += 1
else:
cnt += 1
i += 1
if num == 1:
print((-1))
else:
print(cnt)
| false | 25 | [
"-# a,b = map(int,input().split())",
"-# L.sort()",
"-c = min(L)",
"-flag = False",
"-if c == 1:",
"- flag = True",
"-li = []",
"-for i in range(n):",
"- if L[i] == c and flag == True:",
"- li.append(c)",
"- c = L[i] + 1",
"-if flag:",
"- print((len(L) - len(li)))",
... | false | 0.081435 | 0.042253 | 1.927313 | [
"s571609205",
"s862074333"
] |
u132434645 | p03436 | python | s091889616 | s677010830 | 50 | 35 | 7,660 | 5,484 | Accepted | Accepted | 30 | import sys
import queue
sys.setrecursionlimit(1000000)
def s(m, h, w, d, q):
if q.empty(): return d[h - 1][w - 1]
k, i, j = q.get()
if i > 0 and m[i - 1][j] == '.' and k + 1 < d[i - 1][j]:
d[i - 1][j] = k + 1
q.put((k + 1, i - 1, j))
if i < h - 1 and m[i + 1][j] == '.' and k... | import sys
import queue
sys.setrecursionlimit(1000000)
def s(m, v, q):
if q.empty(): return -1
k, i, j = q.get()
if i == len(m) - 1 and j == len(m[i]) - 1: return k
if i > 0 and m[i - 1][j] == '.' and (i - 1, j) not in v:
q.put((k + 1, i - 1, j))
v.add((i - 1, j))
if i ... | 40 | 31 | 1,117 | 961 | import sys
import queue
sys.setrecursionlimit(1000000)
def s(m, h, w, d, q):
if q.empty():
return d[h - 1][w - 1]
k, i, j = q.get()
if i > 0 and m[i - 1][j] == "." and k + 1 < d[i - 1][j]:
d[i - 1][j] = k + 1
q.put((k + 1, i - 1, j))
if i < h - 1 and m[i + 1][j] == "." and k +... | import sys
import queue
sys.setrecursionlimit(1000000)
def s(m, v, q):
if q.empty():
return -1
k, i, j = q.get()
if i == len(m) - 1 and j == len(m[i]) - 1:
return k
if i > 0 and m[i - 1][j] == "." and (i - 1, j) not in v:
q.put((k + 1, i - 1, j))
v.add((i - 1, j))
... | false | 22.5 | [
"-def s(m, h, w, d, q):",
"+def s(m, v, q):",
"- return d[h - 1][w - 1]",
"+ return -1",
"- if i > 0 and m[i - 1][j] == \".\" and k + 1 < d[i - 1][j]:",
"- d[i - 1][j] = k + 1",
"+ if i == len(m) - 1 and j == len(m[i]) - 1:",
"+ return k",
"+ if i > 0 and m[i - 1... | false | 0.047921 | 0.040786 | 1.174948 | [
"s091889616",
"s677010830"
] |
u271934630 | p03636 | python | s916787570 | s671876239 | 164 | 18 | 38,384 | 3,060 | Accepted | Accepted | 89.02 | a, *b, c = eval(input())
print((a+str(len(b))+c))
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
s = i_s()
print((s[0] + str(len(s)-2) + s[-1])) | 3 | 10 | 45 | 236 | a, *b, c = eval(input())
print((a + str(len(b)) + c))
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
s = i_s()
print((s[0] + str(len(s) - 2) + s[-1]))
| false | 70 | [
"-a, *b, c = eval(input())",
"-print((a + str(len(b)) + c))",
"+import sys",
"+",
"+stdin = sys.stdin",
"+sys.setrecursionlimit(10**7)",
"+i_i = lambda: int(i_s())",
"+i_l = lambda: list(map(int, stdin.readline().split()))",
"+i_s = lambda: stdin.readline().rstrip()",
"+s = i_s()",
"+print((s[0]... | false | 0.03584 | 0.040814 | 0.878138 | [
"s916787570",
"s671876239"
] |
u150984829 | p02386 | python | s882303934 | s799834989 | 90 | 80 | 5,612 | 5,616 | Accepted | Accepted | 11.11 | import sys
n=int(eval(input()))
a=[list(map(int,input().split()))for _ in range(n)]
for k in range(n):
b=a[k];b[3],b[4]=b[4],b[3]
for i in range(n-1):
d=a[i]
for j in range(i+1,n):
e=a[j]
for p in('012345','152043','215304','302541','410352','514320'):
f=[d[int(k)]for k in p]
if f[0]==e[0]and f[... | import sys
n=int(eval(input()))
a=[list(map(int,input().split()))for _ in range(n)]
for i in range(n-1):
d=a[i][:];d[3],d[4]=d[4],d[3]
for j in range(i+1,n):
e=a[j][:];e[3],e[4]=e[4],e[3]
for p in('012345','152043','215304','302541','410352','514320'):
f=[d[int(k)]for k in p]
if f[0]==e[0]and f[5]=... | 16 | 14 | 427 | 424 | import sys
n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
for k in range(n):
b = a[k]
b[3], b[4] = b[4], b[3]
for i in range(n - 1):
d = a[i]
for j in range(i + 1, n):
e = a[j]
for p in ("012345", "152043", "215304", "302541", "410352", "514320"):
... | import sys
n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
for i in range(n - 1):
d = a[i][:]
d[3], d[4] = d[4], d[3]
for j in range(i + 1, n):
e = a[j][:]
e[3], e[4] = e[4], e[3]
for p in ("012345", "152043", "215304", "302541", "410352", "514320"):
... | false | 12.5 | [
"-for k in range(n):",
"- b = a[k]",
"- b[3], b[4] = b[4], b[3]",
"- d = a[i]",
"+ d = a[i][:]",
"+ d[3], d[4] = d[4], d[3]",
"- e = a[j]",
"+ e = a[j][:]",
"+ e[3], e[4] = e[4], e[3]"
] | false | 0.042187 | 0.049832 | 0.846593 | [
"s882303934",
"s799834989"
] |
u530383736 | p02596 | python | s892102432 | s990815973 | 413 | 152 | 77,872 | 9,108 | Accepted | Accepted | 63.2 | # -*- coding: utf-8 -*-
def main():
import sys
K = int( sys.stdin.readline() )
A = 7
add_digit = 7
i = 1
checked = set()
while True:
if A % K == 0:
print(i)
return
elif A in checked:
print("-1")
return
... | # -*- coding: utf-8 -*-
import sys
def main():
K = int( sys.stdin.readline() )
A = 7
for i in range(K):
if A % K == 0:
print((i+1))
return
A = (A * 10) + 7
A %= K
print((-1))
if __name__ == "__main__":
main()
| 34 | 22 | 541 | 307 | # -*- coding: utf-8 -*-
def main():
import sys
K = int(sys.stdin.readline())
A = 7
add_digit = 7
i = 1
checked = set()
while True:
if A % K == 0:
print(i)
return
elif A in checked:
print("-1")
return
checked.add(A)
... | # -*- coding: utf-8 -*-
import sys
def main():
K = int(sys.stdin.readline())
A = 7
for i in range(K):
if A % K == 0:
print((i + 1))
return
A = (A * 10) + 7
A %= K
print((-1))
if __name__ == "__main__":
main()
| false | 35.294118 | [
"+import sys",
"+",
"+",
"- import sys",
"-",
"- add_digit = 7",
"- i = 1",
"- checked = set()",
"- while True:",
"+ for i in range(K):",
"- print(i)",
"+ print((i + 1))",
"- elif A in checked:",
"- print(\"-1\")",
"- r... | false | 0.106311 | 0.060962 | 1.74389 | [
"s892102432",
"s990815973"
] |
u923279197 | p02845 | python | s231258083 | s683473686 | 228 | 150 | 52,908 | 14,020 | Accepted | Accepted | 34.21 | n = int(eval(input()))
a = list(map(int,input().split()))
mod = 10**9 + 7
ans = 1
rgb = [0,0,0]
for x in a:
ans *= rgb.count(x)
if rgb[0] == x: rgb[0] += 1
elif rgb[1] == x :rgb[1] += 1
elif rgb[2] == x :rgb[2] += 1
ans %= mod
print(ans) | n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
data = [0, 0, 0]
ans = 1
for x in a:
y = 0
t = True
for i in range(3):
if data[i] == x:
y += 1
if t:
t = False
data[i] += 1
ans *= y
ans %= mod
... | 13 | 18 | 264 | 328 | n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
ans = 1
rgb = [0, 0, 0]
for x in a:
ans *= rgb.count(x)
if rgb[0] == x:
rgb[0] += 1
elif rgb[1] == x:
rgb[1] += 1
elif rgb[2] == x:
rgb[2] += 1
ans %= mod
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
data = [0, 0, 0]
ans = 1
for x in a:
y = 0
t = True
for i in range(3):
if data[i] == x:
y += 1
if t:
t = False
data[i] += 1
ans *= y
ans %= mod
print(ans)
| false | 27.777778 | [
"+data = [0, 0, 0]",
"-rgb = [0, 0, 0]",
"- ans *= rgb.count(x)",
"- if rgb[0] == x:",
"- rgb[0] += 1",
"- elif rgb[1] == x:",
"- rgb[1] += 1",
"- elif rgb[2] == x:",
"- rgb[2] += 1",
"+ y = 0",
"+ t = True",
"+ for i in range(3):",
"+ if data... | false | 0.043215 | 0.042793 | 1.009861 | [
"s231258083",
"s683473686"
] |
u462192060 | p02657 | python | s527816957 | s130728728 | 23 | 19 | 9,092 | 9,164 | Accepted | Accepted | 17.39 | from sys import stdin
def main():
read = stdin.readline
A, B = list(map(int,read().split(" ")))
print((A*B))
if __name__ == "__main__":
main() | from sys import stdin
def main():
read = stdin.readline
A,B = list(read().split(" "))
B = int(B)*100
c = int(A) * B
print((c//100))
if __name__ == "__main__":
main()
| 10 | 13 | 164 | 198 | from sys import stdin
def main():
read = stdin.readline
A, B = list(map(int, read().split(" ")))
print((A * B))
if __name__ == "__main__":
main()
| from sys import stdin
def main():
read = stdin.readline
A, B = list(read().split(" "))
B = int(B) * 100
c = int(A) * B
print((c // 100))
if __name__ == "__main__":
main()
| false | 23.076923 | [
"- A, B = list(map(int, read().split(\" \")))",
"- print((A * B))",
"+ A, B = list(read().split(\" \"))",
"+ B = int(B) * 100",
"+ c = int(A) * B",
"+ print((c // 100))"
] | false | 0.042787 | 0.043804 | 0.97679 | [
"s527816957",
"s130728728"
] |
u075595666 | p02757 | python | s533259269 | s035236925 | 318 | 133 | 49,228 | 75,424 | Accepted | Accepted | 58.18 | n,p = [int(i) for i in input().split()]
s = eval(input())
ans = 0
import collections
if p == 2 or p == 5:
for i in range(n):
if int(s[i]) % p == 0:
ans += i + 1
print(ans)
exit()
else:
chk = []
m = 0
chk = collections.deque(chk)
for i in range(n)[::-1]:
m =... | import sys
input = sys.stdin.readline
n,p=list(map(int,input().split()))
s=eval(input())
ans=0
if p == 2 or p == 5:
for i in range(n):
if int(s[i]) % p == 0:
ans += i + 1
print(ans)
exit()
total=[0]*p#pใงๅฒใฃใไฝใใงๅ้ก
total[0]=1#t[0]=0ใฎๅใใใใใใใซใฆใณใ
t=[0]*(n+1)#s[i:n]ใๆ ผ็ดใใ็จใฎ้
ๅ
for i in r... | 25 | 23 | 502 | 481 | n, p = [int(i) for i in input().split()]
s = eval(input())
ans = 0
import collections
if p == 2 or p == 5:
for i in range(n):
if int(s[i]) % p == 0:
ans += i + 1
print(ans)
exit()
else:
chk = []
m = 0
chk = collections.deque(chk)
for i in range(n)[::-1]:
m = (int... | import sys
input = sys.stdin.readline
n, p = list(map(int, input().split()))
s = eval(input())
ans = 0
if p == 2 or p == 5:
for i in range(n):
if int(s[i]) % p == 0:
ans += i + 1
print(ans)
exit()
total = [0] * p # pใงๅฒใฃใไฝใใงๅ้ก
total[0] = 1 # t[0]=0ใฎๅใใใใใใใซใฆใณใ
t = [0] * (n + 1) # s[i:... | false | 8 | [
"-n, p = [int(i) for i in input().split()]",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+n, p = list(map(int, input().split()))",
"-import collections",
"-",
"-else:",
"- chk = []",
"- m = 0",
"- chk = collections.deque(chk)",
"- for i in range(n)[::-1]:",
"- m = ... | false | 0.041434 | 0.036315 | 1.140942 | [
"s533259269",
"s035236925"
] |
u327466606 | p03007 | python | s143936757 | s215014572 | 250 | 132 | 14,484 | 32,916 | Accepted | Accepted | 47.2 | import bisect
N = int(eval(input()))
A = sorted(map(int,input().split()))
i = bisect.bisect_left(A, 0)
j = bisect.bisect_right(A, 0)
if i == j:
if i == 0:
negatives = A[:1]
positives = A[1:]
elif i == N:
negatives = A[:-1]
positives = A[-1:]
else:
neg... | from bisect import bisect
def solve():
N = int(eval(input()))
A = sorted(map(int,input().split()))
if N == 2:
res = [(max(A),min(A))]
s = max(A)-min(A)
return s, res
if A[0] >= 0:
res = []
x = A[0]
for a in A[1:-1]:
res.append((... | 76 | 45 | 1,389 | 901 | import bisect
N = int(eval(input()))
A = sorted(map(int, input().split()))
i = bisect.bisect_left(A, 0)
j = bisect.bisect_right(A, 0)
if i == j:
if i == 0:
negatives = A[:1]
positives = A[1:]
elif i == N:
negatives = A[:-1]
positives = A[-1:]
else:
negatives = A[:i]
... | from bisect import bisect
def solve():
N = int(eval(input()))
A = sorted(map(int, input().split()))
if N == 2:
res = [(max(A), min(A))]
s = max(A) - min(A)
return s, res
if A[0] >= 0:
res = []
x = A[0]
for a in A[1:-1]:
res.append((x, a))
... | false | 40.789474 | [
"-import bisect",
"-",
"-N = int(eval(input()))",
"-A = sorted(map(int, input().split()))",
"-i = bisect.bisect_left(A, 0)",
"-j = bisect.bisect_right(A, 0)",
"-if i == j:",
"- if i == 0:",
"- negatives = A[:1]",
"- positives = A[1:]",
"- elif i == N:",
"- negatives ... | false | 0.042023 | 0.037059 | 1.133945 | [
"s143936757",
"s215014572"
] |
u184749404 | p02396 | python | s652363722 | s418700742 | 140 | 40 | 5,600 | 6,772 | Accepted | Accepted | 71.43 | counter = 1
while True:
x = int(eval(input()))
if x == 0 :
break
else :
print(("Case {}: {}".format(counter,x)))
counter = counter + 1
| ans = []
for i, x in enumerate(open(0).readlines()):
ans.append("Case %d: %s" % (i+1, x))
open(1,'w').writelines(ans[:-1])
| 9 | 4 | 180 | 130 | counter = 1
while True:
x = int(eval(input()))
if x == 0:
break
else:
print(("Case {}: {}".format(counter, x)))
counter = counter + 1
| ans = []
for i, x in enumerate(open(0).readlines()):
ans.append("Case %d: %s" % (i + 1, x))
open(1, "w").writelines(ans[:-1])
| false | 55.555556 | [
"-counter = 1",
"-while True:",
"- x = int(eval(input()))",
"- if x == 0:",
"- break",
"- else:",
"- print((\"Case {}: {}\".format(counter, x)))",
"- counter = counter + 1",
"+ans = []",
"+for i, x in enumerate(open(0).readlines()):",
"+ ans.append(\"Case %d: %s\... | false | 0.036456 | 0.052942 | 0.688601 | [
"s652363722",
"s418700742"
] |
u408071652 | p02608 | python | s105998313 | s927425068 | 51 | 35 | 9,304 | 9,468 | Accepted | Accepted | 31.37 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(input())
dp = [0] * (N + 1)
rt = int(N ** 0.5) + 1
for i in range(1, rt):
ii = i ** 2
for j in range(1, i + 1):
iji = ii + j ** 2 + i * j
if iji + 1 + i + j > N... | def main():
N = int(input())
dp = [0] * N
rt = int(pow(N, 0.5)) + 1
for i in range(1, rt):
ii = i * i
for j in range(1, i + 1):
iji = ii + j * j + i * j
if iji + 1 + i + j > N:
break
for k in range(1, j + 1):
... | 33 | 27 | 794 | 736 | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(input())
dp = [0] * (N + 1)
rt = int(N**0.5) + 1
for i in range(1, rt):
ii = i**2
for j in range(1, i + 1):
iji = ii + j**2 + i * j
if iji + 1 + i + j > N:
bre... | def main():
N = int(input())
dp = [0] * N
rt = int(pow(N, 0.5)) + 1
for i in range(1, rt):
ii = i * i
for j in range(1, i + 1):
iji = ii + j * j + i * j
if iji + 1 + i + j > N:
break
for k in range(1, j + 1):
c = iji + k... | false | 18.181818 | [
"-import sys",
"-",
"-",
"-def input():",
"- return sys.stdin.readline().rstrip()",
"-",
"-",
"- dp = [0] * (N + 1)",
"- rt = int(N**0.5) + 1",
"+ dp = [0] * N",
"+ rt = int(pow(N, 0.5)) + 1",
"- ii = i**2",
"+ ii = i * i",
"- iji = ii + j**2 + i * j... | false | 0.113894 | 0.035595 | 3.199704 | [
"s105998313",
"s927425068"
] |
u540762794 | p03329 | python | s528063518 | s143633684 | 438 | 221 | 9,280 | 24,972 | Accepted | Accepted | 49.54 | # -*- coding: utf-8 -*-
def count(val1, val2):
digit = 1
while digit*val2 <= val1:
digit *= val2
res = 0
while digit!=1:
cnt = int(val1 // digit)
val1 -= digit*cnt
res += cnt
digit /= val2
return res,val1
N = int(eval(input()))
ans = N
... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(100000) # RecursionErrorๅฏพ็ญ
def func(n):
if n==0:
return 0 # ็ต็ซฏๆกไปถ
if memo[n] != -1:
return memo[n] # ๆข็ดขๆธใฟ
res = n
for i in range(1,n+1):
pow6 = 6 ** i
if pow6 > n:
break
res = ... | 37 | 34 | 556 | 604 | # -*- coding: utf-8 -*-
def count(val1, val2):
digit = 1
while digit * val2 <= val1:
digit *= val2
res = 0
while digit != 1:
cnt = int(val1 // digit)
val1 -= digit * cnt
res += cnt
digit /= val2
return res, val1
N = int(eval(input()))
ans = N
for i in range(... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(100000) # RecursionErrorๅฏพ็ญ
def func(n):
if n == 0:
return 0 # ็ต็ซฏๆกไปถ
if memo[n] != -1:
return memo[n] # ๆข็ดขๆธใฟ
res = n
for i in range(1, n + 1):
pow6 = 6**i
if pow6 > n:
break
res = min(res, fu... | false | 8.108108 | [
"-def count(val1, val2):",
"- digit = 1",
"- while digit * val2 <= val1:",
"- digit *= val2",
"- res = 0",
"- while digit != 1:",
"- cnt = int(val1 // digit)",
"- val1 -= digit * cnt",
"- res += cnt",
"- digit /= val2",
"- return res, val1",
"+... | false | 0.243705 | 0.057787 | 4.217284 | [
"s528063518",
"s143633684"
] |
u888337853 | p03325 | python | s613890204 | s693048528 | 336 | 239 | 23,040 | 14,168 | Accepted | Accepted | 28.87 | import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
# ===FUNCTION===
def getInputInt():
inputNum = int(eval(input()))
return inputNum
def getInputListInt():
outputData = []
inputData = input().split()
outputDat... | import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
# ===FUNCTION===
def getInputInt():
inputNum = int(eval(input()))
return inputNum
def getInputListInt():
outputData = []
inputData = input().split()
outputDat... | 68 | 68 | 1,183 | 1,183 | import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
# ===FUNCTION===
def getInputInt():
inputNum = int(eval(input()))
return inputNum
def getInputListInt():
outputData = []
inputData = input().split()
outputData = [int(n) for n in ... | import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
# ===FUNCTION===
def getInputInt():
inputNum = int(eval(input()))
return inputNum
def getInputListInt():
outputData = []
inputData = input().split()
outputData = [int(n) for n in ... | false | 0 | [
"-k = getInputInt()",
"+n = getInputInt()"
] | false | 0.038158 | 0.03782 | 1.008921 | [
"s613890204",
"s693048528"
] |
u639343026 | p02995 | python | s139719331 | s245788270 | 165 | 17 | 38,384 | 3,064 | Accepted | Accepted | 89.7 | def gcd(a,b):
while b!=0:
a,b=b,a%b
return a
def lcm(a,b):
return a*b//gcd(a,b)
a,b,c,d=list(map(int,input().split()))
a-=1
b_1=b//c
b_1+=b//d
b_1-=b//lcm(c,d)
a_1=a//c
a_1+=a//d
a_1-=a//lcm(c,d)
print(((b-b_1)-(a-a_1))) | a,b,c,d=list(map(int,input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
#a,bใฎๆๅฐๅ
ฌๅๆฐ
def lcm(a, b):
return a * b // gcd (a, b)
a1=(a-1)//c
a2=b//c
b1=(a-1)//d
b2=b//d
new_lcm=lcm(c,d)
c1=(a-1)//new_lcm
c2=b//new_lcm
print(((b-a)+1-((a2-a1)+(b2-b1))+(c2-c1)))
#print(a1... | 17 | 18 | 250 | 329 | def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
a, b, c, d = list(map(int, input().split()))
a -= 1
b_1 = b // c
b_1 += b // d
b_1 -= b // lcm(c, d)
a_1 = a // c
a_1 += a // d
a_1 -= a // lcm(c, d)
print(((b - b_1) - (a - a_1)))
| a, b, c, d = list(map(int, input().split()))
def gcd(a, b):
while b:
a, b = b, a % b
return a
# a,bใฎๆๅฐๅ
ฌๅๆฐ
def lcm(a, b):
return a * b // gcd(a, b)
a1 = (a - 1) // c
a2 = b // c
b1 = (a - 1) // d
b2 = b // d
new_lcm = lcm(c, d)
c1 = (a - 1) // new_lcm
c2 = b // new_lcm
print(((b - a) + 1 - ((a2... | false | 5.555556 | [
"+a, b, c, d = list(map(int, input().split()))",
"+",
"+",
"- while b != 0:",
"+ while b:",
"+# a,bใฎๆๅฐๅ
ฌๅๆฐ",
"-a, b, c, d = list(map(int, input().split()))",
"-a -= 1",
"-b_1 = b // c",
"-b_1 += b // d",
"-b_1 -= b // lcm(c, d)",
"-a_1 = a // c",
"-a_1 += a // d",
"-a_1 -= a // lcm(c,... | false | 0.105421 | 0.035559 | 2.964683 | [
"s139719331",
"s245788270"
] |
u434967413 | p02819 | python | s705474043 | s695939918 | 145 | 19 | 4,632 | 2,940 | Accepted | Accepted | 86.9 | x = int(eval(input()))
y = x + 100
is_prime = [False] * 2 + [True for _ in range(2, y+1)]
prime = []
for i in range(2, y+1):
for j in range(i*2, y+1, i):
is_prime[j] = False
for i in range(y+1):
if is_prime[i]:
prime.append(i)
for i in range(len(prime)):
if prime[i] >= x:
print((prime[i]))
... | x = int(eval(input()))
while True:
x_sqrt = int(x ** 0.5)
for i in range(2, x_sqrt+1):
if x % i == 0:
break
else:
print(x)
break
x += 1 | 16 | 10 | 340 | 164 | x = int(eval(input()))
y = x + 100
is_prime = [False] * 2 + [True for _ in range(2, y + 1)]
prime = []
for i in range(2, y + 1):
for j in range(i * 2, y + 1, i):
is_prime[j] = False
for i in range(y + 1):
if is_prime[i]:
prime.append(i)
for i in range(len(prime)):
if prime[i] >= x:
p... | x = int(eval(input()))
while True:
x_sqrt = int(x**0.5)
for i in range(2, x_sqrt + 1):
if x % i == 0:
break
else:
print(x)
break
x += 1
| false | 37.5 | [
"-y = x + 100",
"-is_prime = [False] * 2 + [True for _ in range(2, y + 1)]",
"-prime = []",
"-for i in range(2, y + 1):",
"- for j in range(i * 2, y + 1, i):",
"- is_prime[j] = False",
"-for i in range(y + 1):",
"- if is_prime[i]:",
"- prime.append(i)",
"-for i in range(len(pri... | false | 0.07842 | 0.036829 | 2.129312 | [
"s705474043",
"s695939918"
] |
u869790980 | p02775 | python | s995652949 | s889054999 | 319 | 206 | 180,296 | 106,056 | Accepted | Accepted | 35.42 | s = list(map(int,list(input())))
dp = [[0,0] for _ in range(len(s))]
for i in range(len(dp)):
a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i]
b = (dp[i - 1][1] if i - 1 >= 0 else 1) + 10 - s[i]
dp[i][0] = min(a,b)
a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i] + 1
b = (dp[i - 1][1] if i - 1 >= 0 else 1) + ... | import collections
s = list(map(int,list(input())))
qa = collections.deque([0])
qb = collections.deque([1])
for i in range(len(s)):
qa.append(min(qa[0] + s[i], qb[0] + 10 - s[i]))
qb.append(min(qa[0] + s[i] + 1, qb[0] + 10 - s[i] - 1))
qa.popleft()
qb.popleft()
print(qa[-1])
| 14 | 14 | 377 | 294 | s = list(map(int, list(input())))
dp = [[0, 0] for _ in range(len(s))]
for i in range(len(dp)):
a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i]
b = (dp[i - 1][1] if i - 1 >= 0 else 1) + 10 - s[i]
dp[i][0] = min(a, b)
a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i] + 1
b = (dp[i - 1][1] if i - 1 >= 0 e... | import collections
s = list(map(int, list(input())))
qa = collections.deque([0])
qb = collections.deque([1])
for i in range(len(s)):
qa.append(min(qa[0] + s[i], qb[0] + 10 - s[i]))
qb.append(min(qa[0] + s[i] + 1, qb[0] + 10 - s[i] - 1))
qa.popleft()
qb.popleft()
print(qa[-1])
| false | 0 | [
"+import collections",
"+",
"-dp = [[0, 0] for _ in range(len(s))]",
"-for i in range(len(dp)):",
"- a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i]",
"- b = (dp[i - 1][1] if i - 1 >= 0 else 1) + 10 - s[i]",
"- dp[i][0] = min(a, b)",
"- a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i] + 1",
... | false | 0.099815 | 0.116102 | 0.859712 | [
"s995652949",
"s889054999"
] |
u013408661 | p03309 | python | s341179958 | s049756215 | 219 | 182 | 26,836 | 25,200 | Accepted | Accepted | 16.89 | n=int(eval(input()))
a=list(map(int,input().split()))
for i in range(n):
a[i]-=i
a.sort()
x=a[n//2]
ans=0
for i in range(n):
ans+=abs(a[i]-x)
print(ans) | n=int(eval(input()))
a=[int(i) for i in input().split()]
a=[a[i]-(i+1) for i in range(n)]
a.sort()
if n%2==0:
print((sum(a[n//2:])-sum(a[0:n//2])))
else:
print((sum(a[n//2+1:])-sum(a[0:n//2]))) | 10 | 8 | 159 | 198 | n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(n):
a[i] -= i
a.sort()
x = a[n // 2]
ans = 0
for i in range(n):
ans += abs(a[i] - x)
print(ans)
| n = int(eval(input()))
a = [int(i) for i in input().split()]
a = [a[i] - (i + 1) for i in range(n)]
a.sort()
if n % 2 == 0:
print((sum(a[n // 2 :]) - sum(a[0 : n // 2])))
else:
print((sum(a[n // 2 + 1 :]) - sum(a[0 : n // 2])))
| false | 20 | [
"-a = list(map(int, input().split()))",
"-for i in range(n):",
"- a[i] -= i",
"+a = [int(i) for i in input().split()]",
"+a = [a[i] - (i + 1) for i in range(n)]",
"-x = a[n // 2]",
"-ans = 0",
"-for i in range(n):",
"- ans += abs(a[i] - x)",
"-print(ans)",
"+if n % 2 == 0:",
"+ print(... | false | 0.035722 | 0.043219 | 0.82654 | [
"s341179958",
"s049756215"
] |
u107639613 | p04000 | python | s644818059 | s581504739 | 1,456 | 290 | 248,244 | 148,120 | Accepted | Accepted | 80.08 | import sys
from bisect import bisect_left
from collections import defaultdict
def input(): return sys.stdin.readline().strip()
def main():
H, W, N = list(map(int, input().split()))
black = []
d = defaultdict(list)
for _ in range(N):
a, b = list(map(int, input().split()))
blac... | import sys
def input(): return sys.stdin.readline().strip()
def main():
"""
https://atcoder.jp/contests/abc045/submissions/14945636
ใ้ซ้ใซๅไฝใใฆใใใฎใงๅ่ใซๅ็ตใใใ
ๅ้ปใในใซๅฏพใใฆใใใใๅซใใใณใใฌใผใใๅทฆไธใฎๅบงๆจๅคใง็ฎก็ใใใ
๏ผๅ็ตๅ
ใฏๅณไธๅบงๆจใง็ฎก็ใใฆใ๏ผ
ใใฎใใณใใฌใผใๅใณใใใซ้ปใในใไฝๅๅ
ฅใฃใฆใใใใ็ฎก็ใใฆใใใฐ
้ปใในไฝ็ฝฎใใฝใผใใใฆๅ
จไฝไฝ็ฝฎใๆๆกใใฆใใชใใฆใใชใณใฉใคใณใงๆดๆฐใๅฏ่ฝใ
... | 45 | 37 | 1,331 | 1,066 | import sys
from bisect import bisect_left
from collections import defaultdict
def input():
return sys.stdin.readline().strip()
def main():
H, W, N = list(map(int, input().split()))
black = []
d = defaultdict(list)
for _ in range(N):
a, b = list(map(int, input().split()))
black.ap... | import sys
def input():
return sys.stdin.readline().strip()
def main():
"""
https://atcoder.jp/contests/abc045/submissions/14945636
ใ้ซ้ใซๅไฝใใฆใใใฎใงๅ่ใซๅ็ตใใใ
ๅ้ปใในใซๅฏพใใฆใใใใๅซใใใณใใฌใผใใๅทฆไธใฎๅบงๆจๅคใง็ฎก็ใใใ
๏ผๅ็ตๅ
ใฏๅณไธๅบงๆจใง็ฎก็ใใฆใ๏ผ
ใใฎใใณใใฌใผใๅใณใใใซ้ปใในใไฝๅๅ
ฅใฃใฆใใใใ็ฎก็ใใฆใใใฐ
้ปใในไฝ็ฝฎใใฝใผใใใฆๅ
จไฝไฝ็ฝฎใๆๆกใใฆใใชใใฆใใชใณใฉใคใณใงๆดๆฐใๅฏ่ฝใ
"""
... | false | 17.777778 | [
"-from bisect import bisect_left",
"-from collections import defaultdict",
"+ \"\"\"",
"+ https://atcoder.jp/contests/abc045/submissions/14945636",
"+ ใ้ซ้ใซๅไฝใใฆใใใฎใงๅ่ใซๅ็ตใใใ",
"+ ๅ้ปใในใซๅฏพใใฆใใใใๅซใใใณใใฌใผใใๅทฆไธใฎๅบงๆจๅคใง็ฎก็ใใใ",
"+ ๏ผๅ็ตๅ
ใฏๅณไธๅบงๆจใง็ฎก็ใใฆใ๏ผ",
"+ ใใฎใใณใใฌใผใๅใณใใใซ้ปใในใไฝๅๅ
ฅใฃใฆใใใใ็ฎก็ใใฆใใใฐ",
"+ ้ปใ... | false | 0.043754 | 0.080863 | 0.541082 | [
"s644818059",
"s581504739"
] |
u598229387 | p03835 | python | s768499849 | s801629471 | 1,354 | 1,222 | 2,940 | 2,940 | Accepted | Accepted | 9.75 | k,s=list(map(int,input().split()))
ans=0
for i in range(k+1):
for j in range(k+1):
if 0<=s-(i+j)<=k:
ans+=1
print(ans) | k,s=list(map(int,input().split()))
ans=0
for i in range(k+1):
for j in range(k+1):
if 0<=s-i-j<=k:
ans+=1
print(ans) | 8 | 7 | 144 | 140 | k, s = list(map(int, input().split()))
ans = 0
for i in range(k + 1):
for j in range(k + 1):
if 0 <= s - (i + j) <= k:
ans += 1
print(ans)
| k, s = list(map(int, input().split()))
ans = 0
for i in range(k + 1):
for j in range(k + 1):
if 0 <= s - i - j <= k:
ans += 1
print(ans)
| false | 12.5 | [
"- if 0 <= s - (i + j) <= k:",
"+ if 0 <= s - i - j <= k:"
] | false | 0.050331 | 0.048069 | 1.047069 | [
"s768499849",
"s801629471"
] |
u241159583 | p03137 | python | s052852893 | s278094924 | 227 | 102 | 37,912 | 20,416 | Accepted | Accepted | 55.07 | import numpy as np
n,m = list(map(int, input().split()))
X = sorted(np.array(input().split(), dtype = np.int64))
X = sorted(np.diff(X))
if m-n >= 0:
ans = sum(X[:m-n])
else:
ans = 0
print(ans) | n,m = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
ans = []
for i in range(m-1):
ans.append(abs(x[i]-x[i+1]))
ans.sort(reverse=True)
print((sum(ans[n-1:]))) | 9 | 8 | 202 | 191 | import numpy as np
n, m = list(map(int, input().split()))
X = sorted(np.array(input().split(), dtype=np.int64))
X = sorted(np.diff(X))
if m - n >= 0:
ans = sum(X[: m - n])
else:
ans = 0
print(ans)
| n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
ans = []
for i in range(m - 1):
ans.append(abs(x[i] - x[i + 1]))
ans.sort(reverse=True)
print((sum(ans[n - 1 :])))
| false | 11.111111 | [
"-import numpy as np",
"-",
"-X = sorted(np.array(input().split(), dtype=np.int64))",
"-X = sorted(np.diff(X))",
"-if m - n >= 0:",
"- ans = sum(X[: m - n])",
"-else:",
"- ans = 0",
"-print(ans)",
"+x = list(map(int, input().split()))",
"+x.sort()",
"+ans = []",
"+for i in range(m - 1)... | false | 0.32795 | 0.087083 | 3.76596 | [
"s052852893",
"s278094924"
] |
u716530146 | p02802 | python | s152952050 | s478253447 | 259 | 107 | 45,932 | 76,000 | Accepted | Accepted | 58.69 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,m=list(map(int,input().split()))
wa=0
data=[0]*(n+1)
AC=[0]*(n+1)
for i in range(m):
p,... | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
wa = 0
n,m = list(map(int,input().split()))
data = [0]*(n+1)
ans = [0]*(n+1)
for i in range(m):
p,s = input().split()... | 24 | 20 | 512 | 462 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, m = list(map(int, input().split()))
wa = 0
data = [0] * (n + 1)
AC = [0] * (n + 1)
for i in range(m):
... | import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
wa = 0
n, m = list(map(int, input().split()))
data = [0] * (n + 1)
ans = [0] * (n + 1)
for i in range(m):
p, s = input().spli... | false | 16.666667 | [
"-#!/usr/bin/env python3",
"+wa = 0",
"-wa = 0",
"-AC = [0] * (n + 1)",
"+ans = [0] * (n + 1)",
"- AC[p] = 1",
"- wa += max(0, data[p])",
"- data[p] = -inf",
"-# print(data)",
"-print((sum(AC), wa))",
"+ if ans[p] == 0:",
"+ wa += data[p]",
"+ ... | false | 0.047182 | 0.038831 | 1.215049 | [
"s152952050",
"s478253447"
] |
u531599639 | p02947 | python | s085064280 | s810676335 | 500 | 236 | 20,756 | 20,272 | Accepted | Accepted | 52.8 | from collections import defaultdict
import math
prm = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101]
alp = {chr(i):p for i,p in zip(list(range(97, 97+26)),prm)}
n = int(eval(input()))
d = defaultdict(int)
nums = set([])
for _ in range(n):
s = eval(input())
m = 1
for l in s:... | from collections import defaultdict
n = int(eval(input()))
d = defaultdict(int)
sens = set()
ans = 0
for _ in range(n):
s = sorted(eval(input()))
s = ''.join(s)
if s in sens:
d[s] += 1
ans += d[s]
else:
sens.add(s)
print(ans) | 24 | 14 | 527 | 246 | from collections import defaultdict
import math
prm = [
2,
3,
5,
7,
11,
13,
17,
19,
23,
29,
31,
37,
41,
43,
47,
53,
59,
61,
67,
71,
73,
79,
83,
89,
97,
101,
]
alp = {chr(i): p for i, p in zip(list(range(97, 97 + 26)... | from collections import defaultdict
n = int(eval(input()))
d = defaultdict(int)
sens = set()
ans = 0
for _ in range(n):
s = sorted(eval(input()))
s = "".join(s)
if s in sens:
d[s] += 1
ans += d[s]
else:
sens.add(s)
print(ans)
| false | 41.666667 | [
"-import math",
"-prm = [",
"- 2,",
"- 3,",
"- 5,",
"- 7,",
"- 11,",
"- 13,",
"- 17,",
"- 19,",
"- 23,",
"- 29,",
"- 31,",
"- 37,",
"- 41,",
"- 43,",
"- 47,",
"- 53,",
"- 59,",
"- 61,",
"- 67,",
"- 71,",
"- 73... | false | 0.06374 | 0.159057 | 0.400739 | [
"s085064280",
"s810676335"
] |
u581187895 | p02862 | python | s941752776 | s524342770 | 278 | 112 | 29,300 | 3,064 | Accepted | Accepted | 59.71 | # nCrใฎๅทฆ้
ใซใฏย nnย ใใๆฅใชใๅ ดๅใ1!๏ฝ(n-1)!ใฏไฟๆใใชใใฆใใใใผใธใงใณ
def prepare(n, MOD):
# n! ใฎ่จ็ฎ
f = 1
for m in range(1, n+1):
f *= m
f %= MOD
fn = f
# n!^-1 ใฎ่จ็ฎ
inv = pow(f, MOD-2, MOD)
# n!^-1 - 1!^-1 ใฎ่จ็ฎ
invs = [1]*(n+1)
invs[n] = inv
for m in range(n, 1, -1):
inv *= m
inv %= MOD
... | # nCr mod m
# rใn/2ใซ่ฟใใจ้ๅธธใซ้ใใชใ
def combination(n, r, mod=10**9+7):
n1, r = n+1, min(r, n-r)
numer = denom = 1
for i in range(1, r+1):
numer = numer * (n1-i) % mod
denom = denom * i % mod
return numer * pow(denom, mod-2, mod) % mod
X, Y = list(map(int, input().split()))
if (... | 31 | 19 | 582 | 454 | # nCrใฎๅทฆ้
ใซใฏย nnย ใใๆฅใชใๅ ดๅใ1!๏ฝ(n-1)!ใฏไฟๆใใชใใฆใใใใผใธใงใณ
def prepare(n, MOD):
# n! ใฎ่จ็ฎ
f = 1
for m in range(1, n + 1):
f *= m
f %= MOD
fn = f
# n!^-1 ใฎ่จ็ฎ
inv = pow(f, MOD - 2, MOD)
# n!^-1 - 1!^-1 ใฎ่จ็ฎ
invs = [1] * (n + 1)
invs[n] = inv
for m in range(n, 1, -1):
inv *... | # nCr mod m
# rใn/2ใซ่ฟใใจ้ๅธธใซ้ใใชใ
def combination(n, r, mod=10**9 + 7):
n1, r = n + 1, min(r, n - r)
numer = denom = 1
for i in range(1, r + 1):
numer = numer * (n1 - i) % mod
denom = denom * i % mod
return numer * pow(denom, mod - 2, mod) % mod
X, Y = list(map(int, input().split()))
if (... | false | 38.709677 | [
"-# nCrใฎๅทฆ้
ใซใฏย nnย ใใๆฅใชใๅ ดๅใ1!๏ฝ(n-1)!ใฏไฟๆใใชใใฆใใใใผใธใงใณ",
"-def prepare(n, MOD):",
"- # n! ใฎ่จ็ฎ",
"- f = 1",
"- for m in range(1, n + 1):",
"- f *= m",
"- f %= MOD",
"- fn = f",
"- # n!^-1 ใฎ่จ็ฎ",
"- inv = pow(f, MOD - 2, MOD)",
"- # n!^-1 - 1!^-1 ใฎ่จ็ฎ",
"- invs = [1]... | false | 0.098114 | 0.123944 | 0.791598 | [
"s941752776",
"s524342770"
] |
u810356688 | p03169 | python | s665811729 | s980809502 | 994 | 912 | 255,240 | 256,008 | Accepted | Accepted | 8.25 | import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
n=int(eval(input()))
A=list(map(int,input().split()))
ac=Counter(A)
#1ๅใiๅ๏ผ2ๅใjๅ๏ผ3ๅใkๅ
dp=[[[0.0]*(n+1) for j in range(n+1)]for i in range(n+1)]
max_i,max_j,max_k=ac[1],ac[2],ac[3]
... | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n=int(eval(input()))
A=list(map(int,input().split()))
#1ๅใiๅ๏ผ2ๅใjๅ๏ผ3ๅใkๅ
dp=[[[0.0]*(n+1) for j in range(n+1)]for i in range(n+1)]
max_i,max_j=A.count(1),A.count(2)
max_k=n-max_i-max_j
for k in range(max_k+1):
... | 24 | 23 | 784 | 755 | import sys
def input():
return sys.stdin.readline().rstrip()
from collections import Counter
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
ac = Counter(A)
# 1ๅใiๅ๏ผ2ๅใjๅ๏ผ3ๅใkๅ
dp = [[[0.0] * (n + 1) for j in range(n + 1)] for i in range(n + 1)]
max_i, max_j, max... | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
n = int(eval(input()))
A = list(map(int, input().split()))
# 1ๅใiๅ๏ผ2ๅใjๅ๏ผ3ๅใkๅ
dp = [[[0.0] * (n + 1) for j in range(n + 1)] for i in range(n + 1)]
max_i, max_j = A.count(1), A.count(2)
max_k = n - max_i - max_j
... | false | 4.166667 | [
"-from collections import Counter",
"-",
"-",
"- ac = Counter(A)",
"- max_i, max_j, max_k = ac[1], ac[2], ac[3]",
"+ max_i, max_j = A.count(1), A.count(2)",
"+ max_k = n - max_i - max_j"
] | false | 0.144206 | 0.09 | 1.602294 | [
"s665811729",
"s980809502"
] |
u671060652 | p02678 | python | s733750274 | s397960027 | 572 | 509 | 98,404 | 98,220 | Accepted | Accepted | 11.01 | import itertools
import math
import fractions
import functools
import copy
from collections import deque
n, m = list(map(int, input().split()))
g = [[] for i in range(n)]
for i in range(m):
a,b = list(map(int, input().split()))
a -= 1
b -= 1
g[a].append(b)
g[b].append(a)
a = [-1]... | import itertools
import math
import fractions
import functools
import copy
from collections import deque
n, m = list(map(int, input().split()))
ab = [[] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
ab[a-1].append(b-1)
ab[b-1].append(a-1)
ans = [-1] * n
d = de... | 29 | 27 | 506 | 505 | import itertools
import math
import fractions
import functools
import copy
from collections import deque
n, m = list(map(int, input().split()))
g = [[] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
g[a].append(b)
g[b].append(a)
a = [-1] * n
d = deque([0]... | import itertools
import math
import fractions
import functools
import copy
from collections import deque
n, m = list(map(int, input().split()))
ab = [[] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
ab[a - 1].append(b - 1)
ab[b - 1].append(a - 1)
ans = [-1] * n
d = deque([0])... | false | 6.896552 | [
"-g = [[] for i in range(n)]",
"+ab = [[] for _ in range(n)]",
"- a -= 1",
"- b -= 1",
"- g[a].append(b)",
"- g[b].append(a)",
"-a = [-1] * n",
"+ ab[a - 1].append(b - 1)",
"+ ab[b - 1].append(a - 1)",
"+ans = [-1] * n",
"- for i in g[f]:",
"- if a[i] == -1:",
"- ... | false | 0.072948 | 0.074276 | 0.982121 | [
"s733750274",
"s397960027"
] |
u970197315 | p02773 | python | s406648351 | s153191646 | 815 | 663 | 42,716 | 45,040 | Accepted | Accepted | 18.65 | # ABC155 C
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(str, input().split()))
nl = lambda: list(map(int, input().split()))
from collections import defaultdict as dd
from operator import itemgetter
n=ni()
d=dd(int)
# s=[si() for i in range(n)]
for i in range(n):
s=eval... | from collections import Counter
n=int(eval(input()))
s=[eval(input()) for i in range(n)]
sc=Counter(s).most_common()
max_idx=sc[0][1]
ans=[]
for i, j in sc:
if j==max_idx:
ans.append(i)
ans=sorted(ans)
print((*ans)) | 26 | 12 | 499 | 225 | # ABC155 C
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(str, input().split()))
nl = lambda: list(map(int, input().split()))
from collections import defaultdict as dd
from operator import itemgetter
n = ni()
d = dd(int)
# s=[si() for i in range(n)]
for i in range(n):
s = eval(inp... | from collections import Counter
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
sc = Counter(s).most_common()
max_idx = sc[0][1]
ans = []
for i, j in sc:
if j == max_idx:
ans.append(i)
ans = sorted(ans)
print((*ans))
| false | 53.846154 | [
"-# ABC155 C",
"-si = lambda: eval(input())",
"-ni = lambda: int(eval(input()))",
"-nm = lambda: list(map(str, input().split()))",
"-nl = lambda: list(map(int, input().split()))",
"-from collections import defaultdict as dd",
"-from operator import itemgetter",
"+from collections import Counter",
"-... | false | 0.037204 | 0.083595 | 0.445051 | [
"s406648351",
"s153191646"
] |
u028973125 | p03799 | python | s055766388 | s997839785 | 182 | 30 | 38,256 | 9,148 | Accepted | Accepted | 83.52 | import sys
N, M = list(map(int, sys.stdin.readline().strip().split()))
if N >= M // 2:
print((M // 2))
else:
ans = N
r = M - N*2
ans += r // 4
print(ans) | import sys
N, M = list(map(int, sys.stdin.readline().split()))
ans = 0
first = min(2 * N, M - M % 2)
M -= first
ans += first // 2
ans += M // 4
print(ans) | 11 | 10 | 177 | 159 | import sys
N, M = list(map(int, sys.stdin.readline().strip().split()))
if N >= M // 2:
print((M // 2))
else:
ans = N
r = M - N * 2
ans += r // 4
print(ans)
| import sys
N, M = list(map(int, sys.stdin.readline().split()))
ans = 0
first = min(2 * N, M - M % 2)
M -= first
ans += first // 2
ans += M // 4
print(ans)
| false | 9.090909 | [
"-N, M = list(map(int, sys.stdin.readline().strip().split()))",
"-if N >= M // 2:",
"- print((M // 2))",
"-else:",
"- ans = N",
"- r = M - N * 2",
"- ans += r // 4",
"- print(ans)",
"+N, M = list(map(int, sys.stdin.readline().split()))",
"+ans = 0",
"+first = min(2 * N, M - M % 2)... | false | 0.108982 | 0.088507 | 1.231344 | [
"s055766388",
"s997839785"
] |
u151005508 | p02726 | python | s393121906 | s213723826 | 1,160 | 274 | 152,276 | 46,044 | Accepted | Accepted | 76.38 | import copy
N, X, Y = list(map(int, input().split()))
def check(num, distance):
if num!=0:
distance[num-1]=min(distance[num]+1, distance[num-1])
if num!=N-1:
distance[num+1]=min(distance[num+1], distance[num]+1)
if num==X-1:
distance[Y-1]=min(distance[Y-1], distance[X-1]+1)... | N, X, Y=list(map(int, input().split()))
answer=[0]*(N-1)
#i, j from 1 to N
for i in range(1, N):
for j in range(i+1, N+1):
temp=min(abs(j-i), abs(j-Y)+1+abs(X-i)) #, abs(j-X)+1+abs(Y-i)
#print(i, j, temp)
answer[temp-1]+=1
for val in answer:
print(val) | 47 | 11 | 1,126 | 289 | import copy
N, X, Y = list(map(int, input().split()))
def check(num, distance):
if num != 0:
distance[num - 1] = min(distance[num] + 1, distance[num - 1])
if num != N - 1:
distance[num + 1] = min(distance[num + 1], distance[num] + 1)
if num == X - 1:
distance[Y - 1] = min(distance... | N, X, Y = list(map(int, input().split()))
answer = [0] * (N - 1)
# i, j from 1 to N
for i in range(1, N):
for j in range(i + 1, N + 1):
temp = min(abs(j - i), abs(j - Y) + 1 + abs(X - i)) # , abs(j-X)+1+abs(Y-i)
# print(i, j, temp)
answer[temp - 1] += 1
for val in answer:
print(val)
| false | 76.595745 | [
"-import copy",
"-",
"-",
"-",
"-def check(num, distance):",
"- if num != 0:",
"- distance[num - 1] = min(distance[num] + 1, distance[num - 1])",
"- if num != N - 1:",
"- distance[num + 1] = min(distance[num + 1], distance[num] + 1)",
"- if num == X - 1:",
"- distan... | false | 0.070464 | 0.065827 | 1.070442 | [
"s393121906",
"s213723826"
] |
u489959379 | p03379 | python | s174476838 | s140077038 | 580 | 504 | 95,828 | 44,672 | Accepted | Accepted | 13.1 | import sys
import bisect
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
X = list(map(int, input().split()))
X_s = sorted(X)
for i in range(n):
idx = bisect.bisect_left(X_s, X[i])
if idx <= n // 2 - 1:
... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(input())
X = list(map(int, input().split()))
for i in range(n):
x = X[i]
X[i] = [i, x]
X_s = sorted(X, key=lambda x: x[1])
res = [0] ... | 22 | 29 | 435 | 570 | import sys
import bisect
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
X = list(map(int, input().split()))
X_s = sorted(X)
for i in range(n):
idx = bisect.bisect_left(X_s, X[i])
if idx <= n // 2 - 1:
print((X_s[n //... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(input())
X = list(map(int, input().split()))
for i in range(n):
x = X[i]
X[i] = [i, x]
X_s = sorted(X, key=lambda x: x[1])
res = [0] * n
for i in rang... | false | 24.137931 | [
"-import bisect",
"+input = sys.stdin.readline",
"- n = int(eval(input()))",
"+ n = int(input())",
"- X_s = sorted(X)",
"- idx = bisect.bisect_left(X_s, X[i])",
"- if idx <= n // 2 - 1:",
"- print((X_s[n // 2]))",
"+ x = X[i]",
"+ X[i] = [i, x]",
"... | false | 0.049857 | 0.008206 | 6.075792 | [
"s174476838",
"s140077038"
] |
u887207211 | p03360 | python | s943529073 | s893928779 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | A, B, C = sorted(map(int,input().split()))
K = int(eval(input()))
for i in range(K):
C *= 2
print((A + B + C)) | A, B, C = sorted(map(int,input().split()))
K = int(eval(input()))
for _ in range(K):
C *= 2
print((A+B+C)) | 6 | 5 | 110 | 104 | A, B, C = sorted(map(int, input().split()))
K = int(eval(input()))
for i in range(K):
C *= 2
print((A + B + C))
| A, B, C = sorted(map(int, input().split()))
K = int(eval(input()))
for _ in range(K):
C *= 2
print((A + B + C))
| false | 16.666667 | [
"-for i in range(K):",
"+for _ in range(K):"
] | false | 0.048239 | 0.048576 | 0.993049 | [
"s943529073",
"s893928779"
] |
u729133443 | p02904 | python | s566858367 | s182875845 | 1,621 | 649 | 25,884 | 120,892 | Accepted | Accepted | 59.96 | class SWAG():
def __init__(self,unit,f,data):
self.unit=unit
self.f=f
self.fold_r=[unit]
self.fold_l=[unit]
self.data_r=[]
self.data_l=[]
sep=len(data)//2
list(map(self.append,data[sep:]))
list(map(self.appendleft,data[sep-1::-1]))
... | class SWAG():
__slots__=('unit','f','fold_r','fold_l','data_r','data_l')
def __init__(self,unit,f,data):
self.unit=unit
self.f=f
self.fold_r=[unit]
self.fold_l=[unit]
self.data_r=[]
self.data_l=[]
sep=len(data)//2
for t in data[sep:]:
... | 44 | 47 | 1,388 | 1,482 | class SWAG:
def __init__(self, unit, f, data):
self.unit = unit
self.f = f
self.fold_r = [unit]
self.fold_l = [unit]
self.data_r = []
self.data_l = []
sep = len(data) // 2
list(map(self.append, data[sep:]))
list(map(self.appendleft, data[sep - ... | class SWAG:
__slots__ = ("unit", "f", "fold_r", "fold_l", "data_r", "data_l")
def __init__(self, unit, f, data):
self.unit = unit
self.f = f
self.fold_r = [unit]
self.fold_l = [unit]
self.data_r = []
self.data_l = []
sep = len(data) // 2
for t in ... | false | 6.382979 | [
"+ __slots__ = (\"unit\", \"f\", \"fold_r\", \"fold_l\", \"data_r\", \"data_l\")",
"+",
"- list(map(self.append, data[sep:]))",
"- list(map(self.appendleft, data[sep - 1 :: -1]))",
"+ for t in data[sep:]:",
"+ self.append(t)",
"+ for t in data[sep - 1 :: -1]:",
... | false | 0.106451 | 0.045853 | 2.321573 | [
"s566858367",
"s182875845"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.