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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u699296734 | p03265 | python | s435400167 | s522582126 | 26 | 23 | 9,076 | 9,172 | Accepted | Accepted | 11.54 | x1, y1, x2, y2 = list(map(int, input().split()))
x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)
x4 = x3 - (x2 - x1)
y4 = y3 - (y2 - y1)
print((x3, y3, x4, y4)) | x1, y1, x2, y2 = list(map(int, input().split()))
ab = (x2 - x1, y2 - y1)
bc = (- ab[1], ab[0])
print((x2 + bc[0], y2 + bc[1], x1 + bc[0], y1 + bc[1])) | 8 | 5 | 153 | 147 | x1, y1, x2, y2 = list(map(int, input().split()))
x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)
x4 = x3 - (x2 - x1)
y4 = y3 - (y2 - y1)
print((x3, y3, x4, y4))
| x1, y1, x2, y2 = list(map(int, input().split()))
ab = (x2 - x1, y2 - y1)
bc = (-ab[1], ab[0])
print((x2 + bc[0], y2 + bc[1], x1 + bc[0], y1 + bc[1]))
| false | 37.5 | [
"-x3 = x2 - (y2 - y1)",
"-y3 = y2 + (x2 - x1)",
"-x4 = x3 - (x2 - x1)",
"-y4 = y3 - (y2 - y1)",
"-print((x3, y3, x4, y4))",
"+ab = (x2 - x1, y2 - y1)",
"+bc = (-ab[1], ab[0])",
"+print((x2 + bc[0], y2 + bc[1], x1 + bc[0], y1 + bc[1]))"
] | false | 0.037106 | 0.038315 | 0.968441 | [
"s435400167",
"s522582126"
] |
u219015402 | p02691 | python | s554782469 | s746302020 | 341 | 227 | 32,244 | 42,792 | Accepted | Accepted | 33.43 | import bisect
N = int(eval(input()))
alist = list(map(int, input().split()))
alist = [0] + alist
sumlist = []
# (j, wj)のリストを作る
for i in range(1,N+1):
sumlist.append(i+alist[i])
sumlist.sort()
ans = 0
# 差と一致するものを探す
for i in range(1, N+1):
diff = i - alist[i]
if diff <= 0:
continue
... | from collections import Counter
N = int(eval(input()))
alist = list(map(int, input().split()))
alist = [0] + alist
sumlist = []
# (j, wj)のリストを作る
for i in range(1,N+1):
sumlist.append(i+alist[i])
sumlist.sort()
sum_cnt = Counter(sumlist)
ans = 0
# 差と一致するものを探す
for i in range(1, N+1):
diff = i - ali... | 19 | 18 | 425 | 386 | import bisect
N = int(eval(input()))
alist = list(map(int, input().split()))
alist = [0] + alist
sumlist = []
# (j, wj)のリストを作る
for i in range(1, N + 1):
sumlist.append(i + alist[i])
sumlist.sort()
ans = 0
# 差と一致するものを探す
for i in range(1, N + 1):
diff = i - alist[i]
if diff <= 0:
continue
i = bis... | from collections import Counter
N = int(eval(input()))
alist = list(map(int, input().split()))
alist = [0] + alist
sumlist = []
# (j, wj)のリストを作る
for i in range(1, N + 1):
sumlist.append(i + alist[i])
sumlist.sort()
sum_cnt = Counter(sumlist)
ans = 0
# 差と一致するものを探す
for i in range(1, N + 1):
diff = i - alist[i]
... | false | 5.263158 | [
"-import bisect",
"+from collections import Counter",
"+sum_cnt = Counter(sumlist)",
"- if diff <= 0:",
"- continue",
"- i = bisect.bisect_left(sumlist, diff)",
"- j = bisect.bisect_right(sumlist, diff)",
"- ans += j - i",
"+ if diff in sum_cnt:",
"+ ans += sum_cnt[dif... | false | 0.089 | 0.046199 | 1.926457 | [
"s554782469",
"s746302020"
] |
u038815010 | p03283 | python | s128759348 | s374515798 | 1,894 | 1,676 | 58,776 | 58,224 | Accepted | Accepted | 11.51 | n,m,q=list(map(int,input().split()))
h=[[0]*(n) for _ in range(n)]
for i in range(m):
l,r=list(map(int,input().split()))
l-=1
r-=1
h[n-1-l][r]+=1
ans=0
for i in range(n):
for j in range(n-1):
h[i][j+1] += h[i][j]
for j in range(n):
for i in range(n-1):
h[i+1][j] +... | n,m,q=list(map(int,input().split()))
g=[[0]*n for _ in [0]*n]
for i in range(m):
l,r=list(map(int,input().split()))
l-=1
r-=1
g[n-l-1][r]+=1
for i in range(n):
for j in range(n-1):
g[i][j+1]+=g[i][j]
for i in range(n):
for j in range(n-1):
g[j+1][i]+=g[j][i]
for ... | 21 | 22 | 418 | 413 | n, m, q = list(map(int, input().split()))
h = [[0] * (n) for _ in range(n)]
for i in range(m):
l, r = list(map(int, input().split()))
l -= 1
r -= 1
h[n - 1 - l][r] += 1
ans = 0
for i in range(n):
for j in range(n - 1):
h[i][j + 1] += h[i][j]
for j in range(n):
for i in range(n - 1):
... | n, m, q = list(map(int, input().split()))
g = [[0] * n for _ in [0] * n]
for i in range(m):
l, r = list(map(int, input().split()))
l -= 1
r -= 1
g[n - l - 1][r] += 1
for i in range(n):
for j in range(n - 1):
g[i][j + 1] += g[i][j]
for i in range(n):
for j in range(n - 1):
g[j + 1... | false | 4.545455 | [
"-h = [[0] * (n) for _ in range(n)]",
"+g = [[0] * n for _ in [0] * n]",
"- h[n - 1 - l][r] += 1",
"-ans = 0",
"+ g[n - l - 1][r] += 1",
"- h[i][j + 1] += h[i][j]",
"-for j in range(n):",
"- for i in range(n - 1):",
"- h[i + 1][j] += h[i][j]",
"+ g[i][j + 1] += g[i][j... | false | 0.046679 | 0.048911 | 0.954358 | [
"s128759348",
"s374515798"
] |
u748241164 | p03031 | python | s918520888 | s660672877 | 205 | 47 | 42,352 | 9,244 | Accepted | Accepted | 77.07 | N, M = list(map(int, input().split()))
K = [0] * M
for i in range(M):
K[i] = list(map(int, input().split()))
K[i].pop(0)
#print(K)
p = list(map(int, input().split()))
ans = 0
for i in range(2 ** N):#最大1000
now = [0] * (N + 1)
x = 1
for j in range(N):#最大10
if ((i >> j) & 1):
now[j + ... | N, M = list(map(int, input().split()))
K = [0] * M
for i in range(M):
S = list(map(int, input().split()))
K[i] = S[1:]
P = list(map(int, input().split()))
#print(K)
count = 0
for i in range(2 ** N):#1024
on = [0] * N
ans = [0] * M
ans2 = [1] * M
for j in range(N):#10
if ((i >> j) & 1)... | 26 | 30 | 494 | 561 | N, M = list(map(int, input().split()))
K = [0] * M
for i in range(M):
K[i] = list(map(int, input().split()))
K[i].pop(0)
# print(K)
p = list(map(int, input().split()))
ans = 0
for i in range(2**N): # 最大1000
now = [0] * (N + 1)
x = 1
for j in range(N): # 最大10
if (i >> j) & 1:
no... | N, M = list(map(int, input().split()))
K = [0] * M
for i in range(M):
S = list(map(int, input().split()))
K[i] = S[1:]
P = list(map(int, input().split()))
# print(K)
count = 0
for i in range(2**N): # 1024
on = [0] * N
ans = [0] * M
ans2 = [1] * M
for j in range(N): # 10
if (i >> j) & 1... | false | 13.333333 | [
"- K[i] = list(map(int, input().split()))",
"- K[i].pop(0)",
"+ S = list(map(int, input().split()))",
"+ K[i] = S[1:]",
"+P = list(map(int, input().split()))",
"-p = list(map(int, input().split()))",
"-ans = 0",
"-for i in range(2**N): # 最大1000",
"- now = [0] * (N + 1)",
"- x = ... | false | 0.092026 | 0.082921 | 1.109803 | [
"s918520888",
"s660672877"
] |
u985177058 | p02383 | python | s643586559 | s168674179 | 30 | 20 | 6,312 | 5,576 | Accepted | Accepted | 33.33 | import copy
class Dice:
def __init__(self, eyes):
self._top = eyes[0]
self._front = eyes[1]
self._right = eyes[2]
self._left = eyes[3]
self._back = eyes[4]
self._bottom = eyes[5]
@property
def eye(self):
return self._top
def rol... | class Dice:
def __init__(self, eyes):
self._eyes = ['dummy'] + eyes
@property
def eye(self):
return self._eyes[1]
def roll(self, direction):
old = self._eyes
new = ['dummy'] * 7
if direction == 'N':
new[1] = old[2]
new[2] = o... | 51 | 53 | 1,285 | 1,282 | import copy
class Dice:
def __init__(self, eyes):
self._top = eyes[0]
self._front = eyes[1]
self._right = eyes[2]
self._left = eyes[3]
self._back = eyes[4]
self._bottom = eyes[5]
@property
def eye(self):
return self._top
def roll(self, directio... | class Dice:
def __init__(self, eyes):
self._eyes = ["dummy"] + eyes
@property
def eye(self):
return self._eyes[1]
def roll(self, direction):
old = self._eyes
new = ["dummy"] * 7
if direction == "N":
new[1] = old[2]
new[2] = old[6]
... | false | 3.773585 | [
"-import copy",
"-",
"-",
"- self._top = eyes[0]",
"- self._front = eyes[1]",
"- self._right = eyes[2]",
"- self._left = eyes[3]",
"- self._back = eyes[4]",
"- self._bottom = eyes[5]",
"+ self._eyes = [\"dummy\"] + eyes",
"- return self._to... | false | 0.046249 | 0.045079 | 1.025945 | [
"s643586559",
"s168674179"
] |
u177398299 | p03504 | python | s379870532 | s856791472 | 1,123 | 957 | 38,260 | 37,108 | Accepted | Accepted | 14.78 | n, c = list(map(int, input().split()))
r = [[0 for i in range(c)] for j in range(100000)] # テレビ局の番組表
for dummy in range(n): # 入力
s, t, c = list(map(int, input().split()))
for j in range(s - 1, t):
r[j][c - 1] = 1 # 放送中なら1
ans = 0
for i in range(100000):
if sum(r[i]) > ans:
an... | N, C = list(map(int, input().split()))
r = [[0] * C for _ in range(10 ** 5)]
for _ in range(N):
s, t, c = list(map(int, input().split()))
for i in range(s - 1, t):
r[i][c - 1] = 1
ans = 0
for t in r:
sum_t = sum(t)
if sum_t > ans:
ans = sum_t
print(ans) | 14 | 13 | 355 | 286 | n, c = list(map(int, input().split()))
r = [[0 for i in range(c)] for j in range(100000)] # テレビ局の番組表
for dummy in range(n): # 入力
s, t, c = list(map(int, input().split()))
for j in range(s - 1, t):
r[j][c - 1] = 1 # 放送中なら1
ans = 0
for i in range(100000):
if sum(r[i]) > ans:
ans = sum(r[i])... | N, C = list(map(int, input().split()))
r = [[0] * C for _ in range(10**5)]
for _ in range(N):
s, t, c = list(map(int, input().split()))
for i in range(s - 1, t):
r[i][c - 1] = 1
ans = 0
for t in r:
sum_t = sum(t)
if sum_t > ans:
ans = sum_t
print(ans)
| false | 7.142857 | [
"-n, c = list(map(int, input().split()))",
"-r = [[0 for i in range(c)] for j in range(100000)] # テレビ局の番組表",
"-for dummy in range(n): # 入力",
"+N, C = list(map(int, input().split()))",
"+r = [[0] * C for _ in range(10**5)]",
"+for _ in range(N):",
"- for j in range(s - 1, t):",
"- r[j][c - ... | false | 0.222874 | 0.170623 | 1.306238 | [
"s379870532",
"s856791472"
] |
u969190727 | p03575 | python | s155776411 | s926154819 | 33 | 21 | 3,064 | 3,064 | Accepted | Accepted | 36.36 | def Con(V,E):
C1,C2=set(),set()
C1.add(1)
while len(C1)>len(C2):
for v in V:
if v in C1 and v not in C2:
for e in E:
if e[0]==v:
C1.add(e[1])
elif e[1]==v:
C1.add(e[0])
C2.add(v)
if len(C1)==len(V):
return True
else:
... | import sys
input=lambda: sys.stdin.readline().rstrip()
n,m=list(map(int,input().split()))
def find(x):
if par[x]<0:
return x
else:
par[x]=find(par[x])
return par[x]
def unite(x,y):
x=find(x)
y=find(y)
if x==y:
return False
else:
if par[x]>par[y]:
x,y=y,x
par[... | 27 | 45 | 559 | 743 | def Con(V, E):
C1, C2 = set(), set()
C1.add(1)
while len(C1) > len(C2):
for v in V:
if v in C1 and v not in C2:
for e in E:
if e[0] == v:
C1.add(e[1])
elif e[1] == v:
C1.add(e[0])
... | import sys
input = lambda: sys.stdin.readline().rstrip()
n, m = list(map(int, input().split()))
def find(x):
if par[x] < 0:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x, y):
x = find(x)
y = find(y)
if x == y:
return False
else:
if pa... | false | 40 | [
"-def Con(V, E):",
"- C1, C2 = set(), set()",
"- C1.add(1)",
"- while len(C1) > len(C2):",
"- for v in V:",
"- if v in C1 and v not in C2:",
"- for e in E:",
"- if e[0] == v:",
"- C1.add(e[1])",
"- ... | false | 0.039138 | 0.09198 | 0.425509 | [
"s155776411",
"s926154819"
] |
u729133443 | p03803 | python | s049332291 | s748965486 | 163 | 18 | 38,256 | 2,940 | Accepted | Accepted | 88.96 | a,b=list(map(int,input().split()));print((['Draw',['Bob','Alice'][(a-2)%13>(b-2)%13]][a!=b])) | a,b=list(map(int,input().split()));print((['ADlriacwe'[a==b::2],'Bob'][(a-2)%13<(b-2)%13])) | 1 | 1 | 85 | 83 | a, b = list(map(int, input().split()))
print((["Draw", ["Bob", "Alice"][(a - 2) % 13 > (b - 2) % 13]][a != b]))
| a, b = list(map(int, input().split()))
print((["ADlriacwe"[a == b :: 2], "Bob"][(a - 2) % 13 < (b - 2) % 13]))
| false | 0 | [
"-print(([\"Draw\", [\"Bob\", \"Alice\"][(a - 2) % 13 > (b - 2) % 13]][a != b]))",
"+print(([\"ADlriacwe\"[a == b :: 2], \"Bob\"][(a - 2) % 13 < (b - 2) % 13]))"
] | false | 0.051705 | 0.035191 | 1.469274 | [
"s049332291",
"s748965486"
] |
u542932305 | p03495 | python | s408689740 | s797104578 | 153 | 128 | 32,184 | 33,312 | Accepted | Accepted | 16.34 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
buckets = {}
for i in A:
if i in buckets:
buckets[i] += 1
else:
buckets[i] = 1
kinds = sorted(buckets.values())
count = len(kinds)
if K < count:
mini = 0
for i in kinds:
mini += i
... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
buckets = {}
for i in A:
if i in buckets:
buckets[i] += 1
else:
buckets[i] = 1
kinds = sorted(list(buckets.values()), reverse=True)
if K < len(kinds):
mini = N-sum([kinds[i] for i in range(K)])
prin... | 22 | 16 | 406 | 336 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
buckets = {}
for i in A:
if i in buckets:
buckets[i] += 1
else:
buckets[i] = 1
kinds = sorted(buckets.values())
count = len(kinds)
if K < count:
mini = 0
for i in kinds:
mini += i
count -= 1
... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
buckets = {}
for i in A:
if i in buckets:
buckets[i] += 1
else:
buckets[i] = 1
kinds = sorted(list(buckets.values()), reverse=True)
if K < len(kinds):
mini = N - sum([kinds[i] for i in range(K)])
print(mini)
else:... | false | 27.272727 | [
"-kinds = sorted(buckets.values())",
"-count = len(kinds)",
"-if K < count:",
"- mini = 0",
"- for i in kinds:",
"- mini += i",
"- count -= 1",
"- if count <= K:",
"- break",
"+kinds = sorted(list(buckets.values()), reverse=True)",
"+if K < len(kinds):",
"... | false | 0.03698 | 0.039252 | 0.942124 | [
"s408689740",
"s797104578"
] |
u813102292 | p03228 | python | s735830740 | s836328005 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a,b,k = (int(i) for i in input().split())
for i in range(k):
if(i%2==0):
if(a%2==1):
a -=1
b += a/2
a /= 2
else:
if(b%2==1):
b -= 1
a += b/2
b /= 2
print((int(a),int(b))) | a,b,k = list(map(int, input().split()))
for i in range(k):
if i%2==0:
if a%2==1:
a -= 1
b += a//2
a = a//2
else:
if b%2 == 1:
b -= 1
a += b//2
b = b//2
print((a,b))
| 13 | 14 | 260 | 258 | a, b, k = (int(i) for i in input().split())
for i in range(k):
if i % 2 == 0:
if a % 2 == 1:
a -= 1
b += a / 2
a /= 2
else:
if b % 2 == 1:
b -= 1
a += b / 2
b /= 2
print((int(a), int(b)))
| a, b, k = list(map(int, input().split()))
for i in range(k):
if i % 2 == 0:
if a % 2 == 1:
a -= 1
b += a // 2
a = a // 2
else:
if b % 2 == 1:
b -= 1
a += b // 2
b = b // 2
print((a, b))
| false | 7.142857 | [
"-a, b, k = (int(i) for i in input().split())",
"+a, b, k = list(map(int, input().split()))",
"- b += a / 2",
"- a /= 2",
"+ b += a // 2",
"+ a = a // 2",
"- a += b / 2",
"- b /= 2",
"-print((int(a), int(b)))",
"+ a += b // 2",
"+ b = b // ... | false | 0.055298 | 0.055485 | 0.996618 | [
"s735830740",
"s836328005"
] |
u633068244 | p00092 | python | s980534423 | s932001504 | 3,530 | 3,160 | 32,984 | 32,980 | Accepted | Accepted | 10.48 | while True:
n = int(input())
if n == 0: break
field = [input() for i in range(n)]
large = [[0] * (n + 1) for i in range(n + 1)]
mx = 0
for i in range(n):
for j in range(n):
if field[i][j] == '.':
large[i][j] = min(large[i][j - 1], large[i - 1][j], lar... | while True:
n = int(input())
if n == 0: break
field = [input() for i in range(n)]
large = [[0]*(n + 1) for i in range(n + 1)]
mx = 0
for i in range(n):
for j in range(n):
if field[i][j] == '.':
large[i][j] = min(large[i][j - 1], large[i - 1][j], large... | 13 | 11 | 436 | 379 | while True:
n = int(input())
if n == 0:
break
field = [input() for i in range(n)]
large = [[0] * (n + 1) for i in range(n + 1)]
mx = 0
for i in range(n):
for j in range(n):
if field[i][j] == ".":
large[i][j] = (
min(large[i][j - 1],... | while True:
n = int(input())
if n == 0:
break
field = [input() for i in range(n)]
large = [[0] * (n + 1) for i in range(n + 1)]
mx = 0
for i in range(n):
for j in range(n):
if field[i][j] == ".":
large[i][j] = (
min(large[i][j - 1],... | false | 15.384615 | [
"- if large[i][j] > mx:",
"- mx = large[i][j]",
"- print(mx)",
"+ print(max(list(map(max, large))))"
] | false | 0.07268 | 0.057387 | 1.266494 | [
"s980534423",
"s932001504"
] |
u623814058 | p03557 | python | s876807278 | s724807020 | 246 | 224 | 29,300 | 29,436 | Accepted | Accepted | 8.94 | N=int(eval(input()))
*A,=sorted(map(int,input().split()))
*B,=sorted(map(int,input().split()))
*C,=sorted(map(int,input().split()))
lenc=len(C)
from bisect import *
cnt=0
for b in B:
in_a = bisect_left(A, b)
in_c = bisect_right(C, b)
cnt+= in_a*(lenc-in_c)
print(cnt) | N=int(eval(input()))
f=lambda:sorted(map(int,input().split()))
*A,=f()
*B,=f()
*C,=f()
from bisect import *
print((sum([bisect_left(A, b)*(N-bisect_right(C, b)) for b in B]))) | 16 | 7 | 292 | 173 | N = int(eval(input()))
(*A,) = sorted(map(int, input().split()))
(*B,) = sorted(map(int, input().split()))
(*C,) = sorted(map(int, input().split()))
lenc = len(C)
from bisect import *
cnt = 0
for b in B:
in_a = bisect_left(A, b)
in_c = bisect_right(C, b)
cnt += in_a * (lenc - in_c)
print(cnt)
| N = int(eval(input()))
f = lambda: sorted(map(int, input().split()))
(*A,) = f()
(*B,) = f()
(*C,) = f()
from bisect import *
print((sum([bisect_left(A, b) * (N - bisect_right(C, b)) for b in B])))
| false | 56.25 | [
"-(*A,) = sorted(map(int, input().split()))",
"-(*B,) = sorted(map(int, input().split()))",
"-(*C,) = sorted(map(int, input().split()))",
"-lenc = len(C)",
"+f = lambda: sorted(map(int, input().split()))",
"+(*A,) = f()",
"+(*B,) = f()",
"+(*C,) = f()",
"-cnt = 0",
"-for b in B:",
"- in_a = b... | false | 0.042555 | 0.123023 | 0.345906 | [
"s876807278",
"s724807020"
] |
u761320129 | p03681 | python | s806665488 | s831152273 | 55 | 44 | 7,060 | 7,060 | Accepted | Accepted | 20 | N,M = list(map(int,input().split()))
if N > M: N,M = M,N
if M-N > 1:
print((0))
exit()
MOD = 10**9+7
fac = [1]
for n in range (1,M+2):
f = (fac[n-1]*n) % MOD
fac.append(f)
if M-N == 1:
ans = (fac[M] * fac[N]) % MOD
else:
ans = (fac[M] * fac[N] * 2) % MOD
print(ans) | N,M = list(map(int,input().split()))
if N > M:
N,M = M,N
if M-N > 1:
print((0))
exit()
MOD = 10**9+7
fac = [1]
for n in range(1, M + 2):
fac.append((fac[-1] * n) % MOD)
if M == N:
print(((fac[M] * fac[N] * 2) % MOD))
else:
print(((fac[M] * fac[N]) % MOD)) | 18 | 17 | 301 | 286 | N, M = list(map(int, input().split()))
if N > M:
N, M = M, N
if M - N > 1:
print((0))
exit()
MOD = 10**9 + 7
fac = [1]
for n in range(1, M + 2):
f = (fac[n - 1] * n) % MOD
fac.append(f)
if M - N == 1:
ans = (fac[M] * fac[N]) % MOD
else:
ans = (fac[M] * fac[N] * 2) % MOD
print(ans)
| N, M = list(map(int, input().split()))
if N > M:
N, M = M, N
if M - N > 1:
print((0))
exit()
MOD = 10**9 + 7
fac = [1]
for n in range(1, M + 2):
fac.append((fac[-1] * n) % MOD)
if M == N:
print(((fac[M] * fac[N] * 2) % MOD))
else:
print(((fac[M] * fac[N]) % MOD))
| false | 5.555556 | [
"- f = (fac[n - 1] * n) % MOD",
"- fac.append(f)",
"-if M - N == 1:",
"- ans = (fac[M] * fac[N]) % MOD",
"+ fac.append((fac[-1] * n) % MOD)",
"+if M == N:",
"+ print(((fac[M] * fac[N] * 2) % MOD))",
"- ans = (fac[M] * fac[N] * 2) % MOD",
"-print(ans)",
"+ print(((fac[M] * fac[... | false | 0.047373 | 0.123719 | 0.382908 | [
"s806665488",
"s831152273"
] |
u885634168 | p02838 | python | s211931853 | s446074232 | 774 | 350 | 124,028 | 124,144 | Accepted | Accepted | 54.78 | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
INF = 10 ** 9 + 7
D = defaultdict(int)
for a in A:
for i in range(61):
# a の i ビット目がたっているか否か
D[1 << i] += bool(a & (1 << i))
ans = 0
for key, value in list(D.items()):
ans += key * value... | def cin():
in_ = list(map(int,input().split()))
if len(in_) == 1: return in_[0]
else: return in_
N = cin()
A = cin()
INF = 10 ** 9 + 7
res = [0 for _ in range(65)]
for i in range(65):
c0, c1 = 0, 0
for j in range(N):
if bool(A[j] & (1 << i)): c1 += 1
else: c0 += 1... | 17 | 19 | 358 | 423 | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
INF = 10**9 + 7
D = defaultdict(int)
for a in A:
for i in range(61):
# a の i ビット目がたっているか否か
D[1 << i] += bool(a & (1 << i))
ans = 0
for key, value in list(D.items()):
ans += key * value * (N - value)
... | def cin():
in_ = list(map(int, input().split()))
if len(in_) == 1:
return in_[0]
else:
return in_
N = cin()
A = cin()
INF = 10**9 + 7
res = [0 for _ in range(65)]
for i in range(65):
c0, c1 = 0, 0
for j in range(N):
if bool(A[j] & (1 << i)):
c1 += 1
else... | false | 10.526316 | [
"-from collections import defaultdict",
"+def cin():",
"+ in_ = list(map(int, input().split()))",
"+ if len(in_) == 1:",
"+ return in_[0]",
"+ else:",
"+ return in_",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"+",
"+N = cin()",
"+A = cin()",
"-... | false | 0.079722 | 0.138678 | 0.57487 | [
"s211931853",
"s446074232"
] |
u687416863 | p02536 | python | s478212438 | s379905121 | 1,210 | 368 | 13,620 | 14,432 | Accepted | Accepted | 69.59 | N,M=list(map(int,input().split()))
city=[0]*(N+10)
#都市情報を初期化
for i in range(1,N+1):
city[i]=i
#都市番号の小さい方を根としてUnionFind木を作成(大きい方を書き換える)
for i in range(M):
A,B=list(map(int,input().split()))
# print(A,B)
#ルートチェック
if city[A]!=A:
root=city[A]
while city[root]!=root:
root=city[root]... | class UnionFind():
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1)
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
def unite(self, x, y):
x = self.find(x)
... | 48 | 44 | 800 | 860 | N, M = list(map(int, input().split()))
city = [0] * (N + 10)
# 都市情報を初期化
for i in range(1, N + 1):
city[i] = i
# 都市番号の小さい方を根としてUnionFind木を作成(大きい方を書き換える)
for i in range(M):
A, B = list(map(int, input().split()))
# print(A,B)
# ルートチェック
if city[A] != A:
root = city[A]
while city[root] !... | class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1)
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
def unite(self, x, y):
... | false | 8.333333 | [
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.par = [i for i in range(n + 1)]",
"+ self.rank = [0] * (n + 1)",
"+",
"+ def find(self, x):",
"+ if self.par[x] == x:",
"+ return x",
"+ else:",
"+ self.par[x] = self.find(self.par[x])"... | false | 0.068995 | 0.067671 | 1.019556 | [
"s478212438",
"s379905121"
] |
u692054751 | p02971 | python | s902139467 | s925490728 | 1,607 | 550 | 24,192 | 14,140 | Accepted | Accepted | 65.77 | import numpy as np
N = int(eval(input()))
A_s = []
for i in range(N):
A_s.append(int(eval(input())))
A_s = np.array(A_s)
m_index = A_s.argmax()
sort_A_s = sorted(A_s)
m_value = A_s[m_index]
m_second = sort_A_s[N-2]
for i in range(N):
if i != m_index:
print(m_value)
else:
print(m_... | #include <bits/stdc++.h>
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
first, second = sorted(A)[::-1][:2]
for a in A:
print((first if a != first else second))
| 19 | 6 | 315 | 175 | import numpy as np
N = int(eval(input()))
A_s = []
for i in range(N):
A_s.append(int(eval(input())))
A_s = np.array(A_s)
m_index = A_s.argmax()
sort_A_s = sorted(A_s)
m_value = A_s[m_index]
m_second = sort_A_s[N - 2]
for i in range(N):
if i != m_index:
print(m_value)
else:
print(m_second)
| # include <bits/stdc++.h>
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
first, second = sorted(A)[::-1][:2]
for a in A:
print((first if a != first else second))
| false | 68.421053 | [
"-import numpy as np",
"-",
"+# include <bits/stdc++.h>",
"-A_s = []",
"-for i in range(N):",
"- A_s.append(int(eval(input())))",
"-A_s = np.array(A_s)",
"-m_index = A_s.argmax()",
"-sort_A_s = sorted(A_s)",
"-m_value = A_s[m_index]",
"-m_second = sort_A_s[N - 2]",
"-for i in range(N):",
... | false | 0.236928 | 0.074692 | 3.172064 | [
"s902139467",
"s925490728"
] |
u111473084 | p02733 | python | s998917569 | s665571824 | 1,985 | 421 | 3,188 | 3,064 | Accepted | Accepted | 78.79 | def main():
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
INF = 10**9
H, W, K = list(map(int, input().split()))
chocolate = [ eval(input()) for _ in range(H) ]
loop_H = list(range(H))
loop_W = list(range(W))
min_cut = INF-1
for div in range(... | def main():
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
INF = 10**9
H, W, K = list(map(int, input().split()))
chocolate = [ eval(input()) for _ in range(H) ]
loop_H = list(range(H))
min_cut = INF-1
for div in range(1 << (H-1)):
# 横割りでグ... | 47 | 47 | 1,280 | 1,290 | def main():
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
INF = 10**9
H, W, K = list(map(int, input().split()))
chocolate = [eval(input()) for _ in range(H)]
loop_H = list(range(H))
loop_W = list(range(W))
min_cut = INF - 1
for div in range(1 << (H - 1)):
... | def main():
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
INF = 10**9
H, W, K = list(map(int, input().split()))
chocolate = [eval(input()) for _ in range(H)]
loop_H = list(range(H))
min_cut = INF - 1
for div in range(1 << (H - 1)):
# 横割りでグループ分け
g... | false | 0 | [
"- loop_W = list(range(W))",
"- zeros = [0] * len(group)",
"- cnt = zeros.copy()",
"+ cnt = [0] * len(group)",
"- now = zeros.copy()",
"+ now = [0] * len(group)",
"- cnt = zeros.copy()",
"+ cnt = [0] * len(group)",
"... | false | 0.073062 | 0.066485 | 1.098932 | [
"s998917569",
"s665571824"
] |
u413165887 | p03634 | python | s122210854 | s714105466 | 1,489 | 1,346 | 51,536 | 51,928 | Accepted | Accepted | 9.6 | n = int(eval(input()))
tree = [[] for _ in range(n+1)]
for i in range(n-1):
a, b, c = list(map(int, input().split()))
tree[a].append([b, c])
tree[b].append([a, c])
q, k = list(map(int, input().split()))
from collections import deque
que = deque([k])
visit = [-1 for _ in range(n+1)]
visit[k] ... | def main():
n = int(eval(input()))
tree = [[] for _ in range(n+1)]
for i in range(n-1):
a, b, c = list(map(int, input().split()))
tree[a].append([b, c])
tree[b].append([a, c])
q, k = list(map(int, input().split()))
from collections import deque
que = deque(... | 23 | 27 | 548 | 681 | n = int(eval(input()))
tree = [[] for _ in range(n + 1)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
tree[a].append([b, c])
tree[b].append([a, c])
q, k = list(map(int, input().split()))
from collections import deque
que = deque([k])
visit = [-1 for _ in range(n + 1)]
visit[k] = 0
while... | def main():
n = int(eval(input()))
tree = [[] for _ in range(n + 1)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
tree[a].append([b, c])
tree[b].append([a, c])
q, k = list(map(int, input().split()))
from collections import deque
que = deque([k])
v... | false | 14.814815 | [
"-n = int(eval(input()))",
"-tree = [[] for _ in range(n + 1)]",
"-for i in range(n - 1):",
"- a, b, c = list(map(int, input().split()))",
"- tree[a].append([b, c])",
"- tree[b].append([a, c])",
"-q, k = list(map(int, input().split()))",
"-from collections import deque",
"+def main():",
"... | false | 0.035619 | 0.035487 | 1.003727 | [
"s122210854",
"s714105466"
] |
u747602774 | p02820 | python | s170721401 | s995984023 | 107 | 79 | 15,960 | 4,980 | Accepted | Accepted | 26.17 | N,K = list(map(int,input().split()))
R,S,P = list(map(int,input().split()))
T = list(eval(input()))
ans = 0
check = {i:0 for i in range(N)}
for i in range(N):
if i <= K-1:
if T[i] == 'r':
ans += P
elif T[i] == 's':
ans += R
else:
ans += S
... | n,k = list(map(int,input().split()))
r,s,p = list(map(int,input().split()))
t = eval(input())
ans = 0
wl = [1 for i in range(k)] + [0 for j in range(n-k)]
for i in range(n):
if i < k:
if t[i] == 'r':
ans += p
elif t[i] == 's':
ans += r
else:
an... | 35 | 34 | 764 | 782 | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = list(eval(input()))
ans = 0
check = {i: 0 for i in range(N)}
for i in range(N):
if i <= K - 1:
if T[i] == "r":
ans += P
elif T[i] == "s":
ans += R
else:
ans += S
else:... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
ans = 0
wl = [1 for i in range(k)] + [0 for j in range(n - k)]
for i in range(n):
if i < k:
if t[i] == "r":
ans += p
elif t[i] == "s":
ans += r
else:
ans += ... | false | 2.857143 | [
"-N, K = list(map(int, input().split()))",
"-R, S, P = list(map(int, input().split()))",
"-T = list(eval(input()))",
"+n, k = list(map(int, input().split()))",
"+r, s, p = list(map(int, input().split()))",
"+t = eval(input())",
"-check = {i: 0 for i in range(N)}",
"-for i in range(N):",
"- if i <... | false | 0.036977 | 0.043418 | 0.851661 | [
"s170721401",
"s995984023"
] |
u441175813 | p02886 | python | s998100446 | s619240078 | 72 | 63 | 63,828 | 63,252 | Accepted | Accepted | 12.5 | import itertools
n = int(eval(input()))
D = list(map(int, input().split()))
l1 = [x for x in range(n)]
l2 = [x for x in range(n)]
ans = 0
sub = 0
for v1, v2 in itertools.product(l1, l2):
ans += D[v1] * D[v2]
for i in range(n):
sub += D[i]*D[i]
print(((ans-sub)//2)) | n = int(eval(input()))
D = list(map(int, input().split()))
ans = 0
for i in range(n-1):
for j in range(i+1, n):
ans += D[i]*D[j]
print(ans) | 18 | 9 | 288 | 155 | import itertools
n = int(eval(input()))
D = list(map(int, input().split()))
l1 = [x for x in range(n)]
l2 = [x for x in range(n)]
ans = 0
sub = 0
for v1, v2 in itertools.product(l1, l2):
ans += D[v1] * D[v2]
for i in range(n):
sub += D[i] * D[i]
print(((ans - sub) // 2))
| n = int(eval(input()))
D = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
for j in range(i + 1, n):
ans += D[i] * D[j]
print(ans)
| false | 50 | [
"-import itertools",
"-",
"-l1 = [x for x in range(n)]",
"-l2 = [x for x in range(n)]",
"-sub = 0",
"-for v1, v2 in itertools.product(l1, l2):",
"- ans += D[v1] * D[v2]",
"-for i in range(n):",
"- sub += D[i] * D[i]",
"-print(((ans - sub) // 2))",
"+for i in range(n - 1):",
"+ for j i... | false | 0.150278 | 0.148937 | 1.009001 | [
"s998100446",
"s619240078"
] |
u263830634 | p03450 | python | s140414960 | s458826757 | 872 | 705 | 66,236 | 66,208 | Accepted | Accepted | 19.15 | from collections import deque
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(M):
l, r, d = list(map(int, input().split()))
G[l].append((r, -d))
G[r].append((l, d))
MIN = -10 ** 18
lst = [MIN] * (N + 1)
que =... | def main():
from collections import deque
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(M):
l, r, d = list(map(int, input().split()))
G[l].append((r, -d))
G[r].append((l, d))
... | 42 | 46 | 857 | 1,039 | from collections import deque
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(M):
l, r, d = list(map(int, input().split()))
G[l].append((r, -d))
G[r].append((l, d))
MIN = -(10**18)
lst = [MIN] * (N + 1)
que = deque()
que_append = qu... | def main():
from collections import deque
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(M):
l, r, d = list(map(int, input().split()))
G[l].append((r, -d))
G[r].append((l, d))
MIN = -(10**18)... | false | 8.695652 | [
"-from collections import deque",
"-import sys",
"+def main():",
"+ from collections import deque",
"+ import sys",
"-input = sys.stdin.readline",
"-N, M = list(map(int, input().split()))",
"-G = [[] for _ in range(N + 1)]",
"-for _ in range(M):",
"- l, r, d = list(map(int, input().split(... | false | 0.05798 | 0.039426 | 1.470617 | [
"s140414960",
"s458826757"
] |
u110943895 | p03448 | python | s987602626 | s424974472 | 60 | 47 | 8,368 | 8,276 | Accepted | Accepted | 21.67 | A,B,C,X = [int(eval(input())) for i in range(4)]
total = []
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
total.append(a*500+b*100+c*50)
print((total.count(X))) | A,B,C,X = [int(eval(input())) for i in range(4)]
print(([a*500+b*100+c*50 for a in range(A+1) for b in range(B+1) for c in range(C+1)].count(X))) | 8 | 2 | 213 | 138 | A, B, C, X = [int(eval(input())) for i in range(4)]
total = []
for a in range(A + 1):
for b in range(B + 1):
for c in range(C + 1):
total.append(a * 500 + b * 100 + c * 50)
print((total.count(X)))
| A, B, C, X = [int(eval(input())) for i in range(4)]
print(
(
[
a * 500 + b * 100 + c * 50
for a in range(A + 1)
for b in range(B + 1)
for c in range(C + 1)
].count(X)
)
)
| false | 75 | [
"-total = []",
"-for a in range(A + 1):",
"- for b in range(B + 1):",
"- for c in range(C + 1):",
"- total.append(a * 500 + b * 100 + c * 50)",
"-print((total.count(X)))",
"+print(",
"+ (",
"+ [",
"+ a * 500 + b * 100 + c * 50",
"+ for a in ra... | false | 0.161786 | 0.143563 | 1.126935 | [
"s987602626",
"s424974472"
] |
u186838327 | p03240 | python | s530058724 | s871433027 | 314 | 210 | 49,500 | 42,224 | Accepted | Accepted | 33.12 | n = int(eval(input()))
L = [[0, 0, 0] for _ in range(n)]
for i in range(n):
x, y, h = list(map(int, input().split()))
L[i][0] = x
L[i][1] = y
L[i][2] = h
L.sort(key=lambda x: x[2], reverse=True)
for i in range(0, 101):
for j in range(0, 101):
temp = []
border = float... | n = int(eval(input()))
HXY = []
for i in range(n):
x, y, h = list(map(int, input().split()))
HXY.append((h, x, y))
HXY.sort(reverse=True)
for i in range(101):
for j in range(101):
H = -1
for k in range(n):
h, x, y = HXY[k]
if h > 0:
tem... | 28 | 26 | 715 | 647 | n = int(eval(input()))
L = [[0, 0, 0] for _ in range(n)]
for i in range(n):
x, y, h = list(map(int, input().split()))
L[i][0] = x
L[i][1] = y
L[i][2] = h
L.sort(key=lambda x: x[2], reverse=True)
for i in range(0, 101):
for j in range(0, 101):
temp = []
border = float("inf")
f... | n = int(eval(input()))
HXY = []
for i in range(n):
x, y, h = list(map(int, input().split()))
HXY.append((h, x, y))
HXY.sort(reverse=True)
for i in range(101):
for j in range(101):
H = -1
for k in range(n):
h, x, y = HXY[k]
if h > 0:
temp = h + abs(x - ... | false | 7.142857 | [
"-L = [[0, 0, 0] for _ in range(n)]",
"+HXY = []",
"- L[i][0] = x",
"- L[i][1] = y",
"- L[i][2] = h",
"-L.sort(key=lambda x: x[2], reverse=True)",
"-for i in range(0, 101):",
"- for j in range(0, 101):",
"- temp = []",
"- border = float(\"inf\")",
"+ HXY.append((h, x... | false | 0.106927 | 0.058289 | 1.83443 | [
"s530058724",
"s871433027"
] |
u296518383 | p03273 | python | s956524958 | s962206471 | 24 | 21 | 3,188 | 3,064 | Accepted | Accepted | 12.5 | H,W=list(map(int,input().split()))
a=[]
for _ in range(H):
a.append(list([1 if x=="#" else 0 for x in list(eval(input()))]))
#print(a)
b=[]
for i in range(H):
if sum(a[i])!=0:
b.append(a[i])
#print(b)
c=[]
for j in range(W):
cnt=0
for i in range(len(b)):
cnt+=b[i][j]
c.append(cnt)
... | H, W = list(map(int, input().split()))
A = [eval(input()) for _ in range(H)]
h_check = [0] * H
w_check = [0] * W
for i in range(H):
flag = 0
for j in range(W):
if A[i][j] != ".":
flag = 1
break
h_check[i] = flag
for j in range(W):
flag = 0
for i in range(H):
if A[i][j] ... | 31 | 29 | 548 | 505 | H, W = list(map(int, input().split()))
a = []
for _ in range(H):
a.append(list([1 if x == "#" else 0 for x in list(eval(input()))]))
# print(a)
b = []
for i in range(H):
if sum(a[i]) != 0:
b.append(a[i])
# print(b)
c = []
for j in range(W):
cnt = 0
for i in range(len(b)):
cnt += b[i][j]
... | H, W = list(map(int, input().split()))
A = [eval(input()) for _ in range(H)]
h_check = [0] * H
w_check = [0] * W
for i in range(H):
flag = 0
for j in range(W):
if A[i][j] != ".":
flag = 1
break
h_check[i] = flag
for j in range(W):
flag = 0
for i in range(H):
i... | false | 6.451613 | [
"-a = []",
"-for _ in range(H):",
"- a.append(list([1 if x == \"#\" else 0 for x in list(eval(input()))]))",
"-# print(a)",
"-b = []",
"+A = [eval(input()) for _ in range(H)]",
"+h_check = [0] * H",
"+w_check = [0] * W",
"- if sum(a[i]) != 0:",
"- b.append(a[i])",
"-# print(b)",
"... | false | 0.096316 | 0.046077 | 2.090345 | [
"s956524958",
"s962206471"
] |
u150984829 | p02269 | python | s576162754 | s850853365 | 880 | 800 | 117,988 | 118,012 | Accepted | Accepted | 9.09 | import sys
d={}
for e in sys.stdin.readlines()[1:]:
if'f'==e[0]:print(('yes'if e[5:]in d else'no'))
else:d[e[7:]]=0
| import sys
def m():
d={}
for e in sys.stdin.readlines()[1:]:
if'f'==e[0]:print(('yes'if e[5:]in d else'no'))
else:d[e[7:]]=0
if'__main__'==__name__:m()
| 5 | 7 | 120 | 162 | import sys
d = {}
for e in sys.stdin.readlines()[1:]:
if "f" == e[0]:
print(("yes" if e[5:] in d else "no"))
else:
d[e[7:]] = 0
| import sys
def m():
d = {}
for e in sys.stdin.readlines()[1:]:
if "f" == e[0]:
print(("yes" if e[5:] in d else "no"))
else:
d[e[7:]] = 0
if "__main__" == __name__:
m()
| false | 28.571429 | [
"-d = {}",
"-for e in sys.stdin.readlines()[1:]:",
"- if \"f\" == e[0]:",
"- print((\"yes\" if e[5:] in d else \"no\"))",
"- else:",
"- d[e[7:]] = 0",
"+",
"+def m():",
"+ d = {}",
"+ for e in sys.stdin.readlines()[1:]:",
"+ if \"f\" == e[0]:",
"+ pr... | false | 0.044757 | 0.045641 | 0.980616 | [
"s576162754",
"s850853365"
] |
u905582793 | p02983 | python | s191785277 | s973090934 | 1,358 | 649 | 3,064 | 3,060 | Accepted | Accepted | 52.21 | l,r = list(map(int,input().split()))
if r-l>=2019:
print((0))
exit()
l = l%2019
r = r%2019
ans = 2018
for i in range(l,r):
for j in range(l+1,r+1):
ans = min(ans,i*j%2019)
print(ans) | l,r = list(map(int,input().split()))
if r-l>=2019:
print((0))
exit()
l = l%2019
r = r%2019
ans = 2018
for i in range(l,r):
for j in range(i+1,r+1):
ans = min(ans,i*j%2019)
print(ans) | 11 | 11 | 194 | 194 | l, r = list(map(int, input().split()))
if r - l >= 2019:
print((0))
exit()
l = l % 2019
r = r % 2019
ans = 2018
for i in range(l, r):
for j in range(l + 1, r + 1):
ans = min(ans, i * j % 2019)
print(ans)
| l, r = list(map(int, input().split()))
if r - l >= 2019:
print((0))
exit()
l = l % 2019
r = r % 2019
ans = 2018
for i in range(l, r):
for j in range(i + 1, r + 1):
ans = min(ans, i * j % 2019)
print(ans)
| false | 0 | [
"- for j in range(l + 1, r + 1):",
"+ for j in range(i + 1, r + 1):"
] | false | 0.039857 | 0.047895 | 0.832175 | [
"s191785277",
"s973090934"
] |
u462329577 | p03777 | python | s321076180 | s085111652 | 172 | 18 | 38,256 | 2,940 | Accepted | Accepted | 89.53 | a,b = list(map(str,input().split()))
print(("H" if a==b else "D"))
| a,b = list(map(str,input().split()))
if a == b:
print("H")
else:
print("D")
| 3 | 5 | 62 | 78 | a, b = list(map(str, input().split()))
print(("H" if a == b else "D"))
| a, b = list(map(str, input().split()))
if a == b:
print("H")
else:
print("D")
| false | 40 | [
"-print((\"H\" if a == b else \"D\"))",
"+if a == b:",
"+ print(\"H\")",
"+else:",
"+ print(\"D\")"
] | false | 0.045371 | 0.046463 | 0.97651 | [
"s321076180",
"s085111652"
] |
u778814286 | p03403 | python | s974321423 | s754248963 | 249 | 214 | 13,920 | 14,048 | Accepted | Accepted | 14.06 | n = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
#普通に総和を出す
sum = 0
for i, a in enumerate(A):
if i == n+1: break #n+1はゴールなので先に行かない
sum += abs(a - A[i+1]) #a:A[i]
#引いて足す
for i in range(1, n+1, 1): #1~Nを省いたとき
nowsum = sum
nowsum -= abs(A[i-1]-A[i])
nowsum -= abs(A[i]-A[i+1]... | n = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
diff = [abs(A[i]-A[i+1]) for i in range(n+1)]
#普通に総和を出す
sum = sum(diff)
#引いて足す
for i in range(1, n+1, 1): #1~Nを省いたとき
nowsum = sum
nowsum -= diff[i-1]
nowsum -= diff[i]
nowsum += abs(A[i-1]-A[i+1])
print(nowsum)
| 16 | 14 | 364 | 303 | n = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
# 普通に総和を出す
sum = 0
for i, a in enumerate(A):
if i == n + 1:
break # n+1はゴールなので先に行かない
sum += abs(a - A[i + 1]) # a:A[i]
# 引いて足す
for i in range(1, n + 1, 1): # 1~Nを省いたとき
nowsum = sum
nowsum -= abs(A[i - 1] - A[i])
nowsum... | n = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
diff = [abs(A[i] - A[i + 1]) for i in range(n + 1)]
# 普通に総和を出す
sum = sum(diff)
# 引いて足す
for i in range(1, n + 1, 1): # 1~Nを省いたとき
nowsum = sum
nowsum -= diff[i - 1]
nowsum -= diff[i]
nowsum += abs(A[i - 1] - A[i + 1])
print(nowsum... | false | 12.5 | [
"+diff = [abs(A[i] - A[i + 1]) for i in range(n + 1)]",
"-sum = 0",
"-for i, a in enumerate(A):",
"- if i == n + 1:",
"- break # n+1はゴールなので先に行かない",
"- sum += abs(a - A[i + 1]) # a:A[i]",
"+sum = sum(diff)",
"- nowsum -= abs(A[i - 1] - A[i])",
"- nowsum -= abs(A[i] - A[i + 1])",
... | false | 0.038409 | 0.042992 | 0.893396 | [
"s974321423",
"s754248963"
] |
u471684875 | p03545 | python | s243727748 | s155751650 | 21 | 17 | 3,188 | 3,064 | Accepted | Accepted | 19.05 | s=str(eval(input()))
ans=int(s[0])
a=ans
for i in range(2):
ans=a
if i==0:
ans+=int(s[1])
i='+'
else:
ans-=int(s[1])
i='-'
b=ans
for j in range(2):
ans=b
if j==0:
ans+=int(s[2])
j='+'
else:
... | s=str(eval(input()))
a=int(s[0])
b=int(s[1])
c=int(s[2])
d=int(s[3])
if a+b+c+d==7:print((str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7'))
elif a+b+c-d==7:print((str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7'))
elif a+b-c+d==7:print((str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7'))
elif a+b-c-d==7:print((str(a)+'+'... | 40 | 14 | 779 | 619 | s = str(eval(input()))
ans = int(s[0])
a = ans
for i in range(2):
ans = a
if i == 0:
ans += int(s[1])
i = "+"
else:
ans -= int(s[1])
i = "-"
b = ans
for j in range(2):
ans = b
if j == 0:
ans += int(s[2])
j = "+"
else:
... | s = str(eval(input()))
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
if a + b + c + d == 7:
print((str(a) + "+" + str(b) + "+" + str(c) + "+" + str(d) + "=7"))
elif a + b + c - d == 7:
print((str(a) + "+" + str(b) + "+" + str(c) + "-" + str(d) + "=7"))
elif a + b - c + d == 7:
print((str(a) + "+" ... | false | 65 | [
"-ans = int(s[0])",
"-a = ans",
"-for i in range(2):",
"- ans = a",
"- if i == 0:",
"- ans += int(s[1])",
"- i = \"+\"",
"- else:",
"- ans -= int(s[1])",
"- i = \"-\"",
"- b = ans",
"- for j in range(2):",
"- ans = b",
"- if j == 0:"... | false | 0.046861 | 0.043948 | 1.066288 | [
"s243727748",
"s155751650"
] |
u657361950 | p02385 | python | s358135209 | s295255228 | 30 | 20 | 5,628 | 5,612 | Accepted | Accepted | 33.33 | class Dice:
def __init__(self, faces):
self.faces = faces
self.t = faces[0]
self.s = faces[1]
self.e = faces[2]
self.w = faces[3]
self.n = faces[4]
self.b = faces[5]
def roll(self, drct):
t_ = self.t
s_ = self.s
e_ = self.e
w_ = self.w
n_ = self.n
b_ = self.b
if drct =... | class Dice:
def __init__(self, faces):
self.faces = faces
self.t = faces[0]
self.s = faces[1]
self.e = faces[2]
self.w = faces[3]
self.n = faces[4]
self.b = faces[5]
def roll(self, drct):
t_ = self.t
s_ = self.s
e_ = self.e
w_ = self.w
n_ = self.n
b_ = self.b
if drct =... | 128 | 79 | 2,557 | 1,524 | class Dice:
def __init__(self, faces):
self.faces = faces
self.t = faces[0]
self.s = faces[1]
self.e = faces[2]
self.w = faces[3]
self.n = faces[4]
self.b = faces[5]
def roll(self, drct):
t_ = self.t
s_ = self.s
e_ = self.e
... | class Dice:
def __init__(self, faces):
self.faces = faces
self.t = faces[0]
self.s = faces[1]
self.e = faces[2]
self.w = faces[3]
self.n = faces[4]
self.b = faces[5]
def roll(self, drct):
t_ = self.t
s_ = self.s
e_ = self.e
... | false | 38.28125 | [
"- def set_top(self, face):",
"- if self.t == face:",
"- return",
"- elif self.s == face:",
"- self.roll(\"N\")",
"- elif self.e == face:",
"- self.roll(\"W\")",
"- elif self.w == face:",
"- self.roll(\"E\")",
"- eli... | false | 0.036664 | 0.034454 | 1.06415 | [
"s358135209",
"s295255228"
] |
u260980560 | p00140 | python | s101323433 | s038861374 | 20 | 10 | 4,236 | 4,216 | Accepted | Accepted | 50 | bus = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(eval(input())):
s, t = list(map(int, input().split()))
if s>5:
print(" ".join(map(str, bus[s:bus.index(t, s)+1])))
else:
if s<t:
print(" ".join(map(str, range(s, t+1))))
... | bus = "0123456789543210123456789"
rbus = "543210"
for i in range(eval(input())):
s, t = input().split()
if t<s<'6':
left = rbus.find(s, 0)
right = rbus.find(t, left)
print(" ".join(rbus[left:right+1]))
else:
left = bus.find(s, 0)
right = bus.find(t, left)
... | 11 | 12 | 392 | 358 | bus = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(eval(input())):
s, t = list(map(int, input().split()))
if s > 5:
print(" ".join(map(str, bus[s : bus.index(t, s) + 1])))
else:
if s < t:
print(" ".join(map(str, range(s, t + 1))))
... | bus = "0123456789543210123456789"
rbus = "543210"
for i in range(eval(input())):
s, t = input().split()
if t < s < "6":
left = rbus.find(s, 0)
right = rbus.find(t, left)
print(" ".join(rbus[left : right + 1]))
else:
left = bus.find(s, 0)
right = bus.find(t, left)
... | false | 8.333333 | [
"-bus = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]",
"+bus = \"0123456789543210123456789\"",
"+rbus = \"543210\"",
"- s, t = list(map(int, input().split()))",
"- if s > 5:",
"- print(\" \".join(map(str, bus[s : bus.index(t, s) + 1])))",
"+ s, t = input().... | false | 0.036622 | 0.034864 | 1.050422 | [
"s101323433",
"s038861374"
] |
u934529721 | p03610 | python | s256934757 | s047785537 | 65 | 26 | 6,516 | 4,268 | Accepted | Accepted | 60 | a = input()
b = len(a)
num = []
for x in range(0,b,2):
num.append(x)
for i in num:
print(a[i], end='')
| S = list(eval(input()))
box = []
for x in range(0,len(S),2):
box.append(S[x])
print((''.join(box)))
| 12 | 8 | 138 | 111 | a = input()
b = len(a)
num = []
for x in range(0, b, 2):
num.append(x)
for i in num:
print(a[i], end="")
| S = list(eval(input()))
box = []
for x in range(0, len(S), 2):
box.append(S[x])
print(("".join(box)))
| false | 33.333333 | [
"-a = input()",
"-b = len(a)",
"-num = []",
"-for x in range(0, b, 2):",
"- num.append(x)",
"-for i in num:",
"- print(a[i], end=\"\")",
"+S = list(eval(input()))",
"+box = []",
"+for x in range(0, len(S), 2):",
"+ box.append(S[x])",
"+print((\"\".join(box)))"
] | false | 0.132421 | 0.047391 | 2.794202 | [
"s256934757",
"s047785537"
] |
u548545174 | p03086 | python | s134338708 | s409337054 | 21 | 17 | 3,188 | 2,940 | Accepted | Accepted | 19.05 | import re
S = eval(input())
L = len(S)
mlen = 0
match = re.findall('[ATGC]+', S)
#print(match.span())
for m in match:
if len(m) > mlen:
mlen = len(m)
print(mlen) | S = eval(input())
L = len(S)
ans = 0
for i in range(L):
for j in range(i, L):
if all(c in 'AGCT' for c in S[i:j+1]):
ans = max(ans, j + 1 - i)
print(ans)
| 11 | 8 | 178 | 179 | import re
S = eval(input())
L = len(S)
mlen = 0
match = re.findall("[ATGC]+", S)
# print(match.span())
for m in match:
if len(m) > mlen:
mlen = len(m)
print(mlen)
| S = eval(input())
L = len(S)
ans = 0
for i in range(L):
for j in range(i, L):
if all(c in "AGCT" for c in S[i : j + 1]):
ans = max(ans, j + 1 - i)
print(ans)
| false | 27.272727 | [
"-import re",
"-",
"-mlen = 0",
"-match = re.findall(\"[ATGC]+\", S)",
"-# print(match.span())",
"-for m in match:",
"- if len(m) > mlen:",
"- mlen = len(m)",
"-print(mlen)",
"+ans = 0",
"+for i in range(L):",
"+ for j in range(i, L):",
"+ if all(c in \"AGCT\" for c in S[... | false | 0.053181 | 0.047596 | 1.117344 | [
"s134338708",
"s409337054"
] |
u983918956 | p03425 | python | s910245114 | s114019159 | 267 | 163 | 3,064 | 9,856 | Accepted | Accepted | 38.95 | N = int(eval(input()))
count = [0]*5
march = list("MARCH")
for i in range(N):
s = eval(input())
for i in range(5):
if s[0] == march[i]:
count[i] += 1
ans = 0
for i in range(5):
for j in range(i+1,5):
for k in range(j+1,5):
ans += count[i] * count[j] * coun... | from itertools import combinations
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
chenge = list("MARCH")
d = dict()
for i, c in enumerate(chenge):
d[c] = i
cnt = [0] * 5
for s in S:
if s[0] in chenge:
cnt[d[s[0]]] += 1
ans = 0
for i, j, k in combinations(cnt, 3):
... | 14 | 22 | 324 | 341 | N = int(eval(input()))
count = [0] * 5
march = list("MARCH")
for i in range(N):
s = eval(input())
for i in range(5):
if s[0] == march[i]:
count[i] += 1
ans = 0
for i in range(5):
for j in range(i + 1, 5):
for k in range(j + 1, 5):
ans += count[i] * count[j] * count[k]... | from itertools import combinations
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
chenge = list("MARCH")
d = dict()
for i, c in enumerate(chenge):
d[c] = i
cnt = [0] * 5
for s in S:
if s[0] in chenge:
cnt[d[s[0]]] += 1
ans = 0
for i, j, k in combinations(cnt, 3):
ans += i * j * k
prin... | false | 36.363636 | [
"+from itertools import combinations",
"+",
"-count = [0] * 5",
"-march = list(\"MARCH\")",
"-for i in range(N):",
"- s = eval(input())",
"- for i in range(5):",
"- if s[0] == march[i]:",
"- count[i] += 1",
"+S = [eval(input()) for _ in range(N)]",
"+chenge = list(\"MARCH... | false | 0.076514 | 0.03735 | 2.048594 | [
"s910245114",
"s114019159"
] |
u327466606 | p03181 | python | s191957162 | s723031688 | 660 | 597 | 128,096 | 135,576 | Accepted | Accepted | 9.55 |
from functools import reduce
from itertools import accumulate,chain
def rerooting(N, adj, merge, identity, finalize):
"""
merge: (T,T) -> T, (T, merge)はモノイド
identity: 単位元
finalize: T -> T
以下の形で書けるdpは対応可能
dp[u,v] = finalize(merge(dp[v,k] for k in adj[v] if k != u))
ただし(u,v)は辺
... |
from functools import reduce
from itertools import accumulate,chain
def rerooting(N, adj, merge, identity, finalize):
"""
merge: (T,T) -> T, (T, merge)はモノイド
identity: 単位元
finalize: T -> T
以下の形で書けるdpは対応可能
dp[u,v] = finalize(merge(dp[v,k] for k in adj[v] if k != u))
ただし(u,v)は辺
... | 81 | 78 | 2,169 | 2,091 | from functools import reduce
from itertools import accumulate, chain
def rerooting(N, adj, merge, identity, finalize):
"""
merge: (T,T) -> T, (T, merge)はモノイド
identity: 単位元
finalize: T -> T
以下の形で書けるdpは対応可能
dp[u,v] = finalize(merge(dp[v,k] for k in adj[v] if k != u))
ただし(u,v)は辺
"""
o... | from functools import reduce
from itertools import accumulate, chain
def rerooting(N, adj, merge, identity, finalize):
"""
merge: (T,T) -> T, (T, merge)はモノイド
identity: 単位元
finalize: T -> T
以下の形で書けるdpは対応可能
dp[u,v] = finalize(merge(dp[v,k] for k in adj[v] if k != u))
ただし(u,v)は辺
"""
o... | false | 3.703704 | [
"- left = tuple(",
"- accumulate(",
"- chain((dp_up[v],), (dp_down[u] for u in adj[v] if u != p)), merge",
"- )",
"- )",
"- right = tuple(",
"- accumulate(",
"- chain((identity,), (dp_down[u] for u in reversed(adj[v]) ... | false | 0.045749 | 0.049238 | 0.929146 | [
"s191957162",
"s723031688"
] |
u426534722 | p02412 | python | s096945549 | s677487367 | 580 | 290 | 5,648 | 5,644 | Accepted | Accepted | 50 | from itertools import combinations
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
print((sum(1 for li in combinations(list(range(1, n + 1)), 3) if sum(li) == x)))
| from itertools import combinations
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
print((sum(1 for a, b, c in combinations(list(range(1, n + 1)), 3) if a + b + c == x)))
| 6 | 6 | 200 | 207 | from itertools import combinations
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
print((sum(1 for li in combinations(list(range(1, n + 1)), 3) if sum(li) == x)))
| from itertools import combinations
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
print(
(sum(1 for a, b, c in combinations(list(range(1, n + 1)), 3) if a + b + c == x))
)
| false | 0 | [
"- print((sum(1 for li in combinations(list(range(1, n + 1)), 3) if sum(li) == x)))",
"+ print(",
"+ (sum(1 for a, b, c in combinations(list(range(1, n + 1)), 3) if a + b + c == x))",
"+ )"
] | false | 0.041642 | 0.039703 | 1.048845 | [
"s096945549",
"s677487367"
] |
u827202523 | p02918 | python | s523681884 | s373198404 | 182 | 74 | 45,168 | 73,952 | Accepted | Accepted | 59.34 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
n, k = getList()
s = input().strip()
s = s
state = "X"
cur_seq = 0
seq_nums = []
n_separ... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList... | 35 | 41 | 589 | 806 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
n, k = getList()
s = input().strip()
s = s
state = "X"
cur_seq = 0
seq_nums = []
n_separate = 0
for c... | import sys
from collections import defaultdict, deque, Counter
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(i... | false | 14.634146 | [
"+from collections import defaultdict, deque, Counter",
"+import math",
"+# import copy",
"+from bisect import bisect_left, bisect_right",
"+",
"+# import heapq",
"+# sys.setrecursionlimit(1000000)",
"+# input aliases",
"-sys.setrecursionlimit(1000000)",
"-from collections import deque",
"+getS ... | false | 0.036892 | 0.037561 | 0.982196 | [
"s523681884",
"s373198404"
] |
u480200603 | p03323 | python | s333796905 | s270798368 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | input = input().split()
if int(input[0])<=8 and int(input[1])<=8:
print("Yay!")
else:
print(":(") | a, b = list(map(int, input().split()))
if a <= 8 and b <= 8:
print("Yay!")
else:
print(":(")
| 6 | 6 | 111 | 101 | input = input().split()
if int(input[0]) <= 8 and int(input[1]) <= 8:
print("Yay!")
else:
print(":(")
| a, b = list(map(int, input().split()))
if a <= 8 and b <= 8:
print("Yay!")
else:
print(":(")
| false | 0 | [
"-input = input().split()",
"-if int(input[0]) <= 8 and int(input[1]) <= 8:",
"+a, b = list(map(int, input().split()))",
"+if a <= 8 and b <= 8:"
] | false | 0.070593 | 0.069591 | 1.014388 | [
"s333796905",
"s270798368"
] |
u871596687 | p03962 | python | s297486226 | s318829791 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | import collections
pen = list(map(str,input().split()))
print((len(collections.Counter(pen))))
| a,b,c = list(map(int,input().split()))
if a == b == c:
print((1))
elif a == b or b == c or c ==a:
print((2))
else:
print((3)) | 8 | 8 | 105 | 133 | import collections
pen = list(map(str, input().split()))
print((len(collections.Counter(pen))))
| a, b, c = list(map(int, input().split()))
if a == b == c:
print((1))
elif a == b or b == c or c == a:
print((2))
else:
print((3))
| false | 0 | [
"-import collections",
"-",
"-pen = list(map(str, input().split()))",
"-print((len(collections.Counter(pen))))",
"+a, b, c = list(map(int, input().split()))",
"+if a == b == c:",
"+ print((1))",
"+elif a == b or b == c or c == a:",
"+ print((2))",
"+else:",
"+ print((3))"
] | false | 0.007996 | 0.040085 | 0.199479 | [
"s297486226",
"s318829791"
] |
u980205854 | p02658 | python | s909643417 | s569552643 | 89 | 56 | 21,544 | 21,696 | Accepted | Accepted | 37.08 | N = int(eval(input()))
A = list(map(int,input().split()))
A.sort()
ans = 1
for i in range(N):
ans *= A[i]
if ans>10**18:
ans = -1
break
print(ans) | # B - Multiplication 2
N = int(eval(input()))
A = list(map(int,input().split()))
def ans():
global N,A
for i in range(N):
if A[i]==0:
return 0
tmp = 1
for i in range(N):
tmp *= A[i]
if tmp>10**18:
return -1
return tmp
print((ans())) | 12 | 17 | 177 | 310 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = 1
for i in range(N):
ans *= A[i]
if ans > 10**18:
ans = -1
break
print(ans)
| # B - Multiplication 2
N = int(eval(input()))
A = list(map(int, input().split()))
def ans():
global N, A
for i in range(N):
if A[i] == 0:
return 0
tmp = 1
for i in range(N):
tmp *= A[i]
if tmp > 10**18:
return -1
return tmp
print((ans()))
| false | 29.411765 | [
"+# B - Multiplication 2",
"-A.sort()",
"-ans = 1",
"-for i in range(N):",
"- ans *= A[i]",
"- if ans > 10**18:",
"- ans = -1",
"- break",
"-print(ans)",
"+",
"+",
"+def ans():",
"+ global N, A",
"+ for i in range(N):",
"+ if A[i] == 0:",
"+ ... | false | 0.075001 | 0.103763 | 0.722815 | [
"s909643417",
"s569552643"
] |
u941438707 | p03013 | python | s463770316 | s171000119 | 629 | 469 | 462,708 | 460,020 | Accepted | Accepted | 25.44 | n,m,*a=list(map(int,open(0).read().split()))
dp=[-1]*(n+1)
for i in a:
dp[i]=0
dp[0]=1
for i in range(1,n+1):
if dp[i]!=0:
dp[i]=dp[i-1]+dp[i-2]*(i>1)
print((dp[-1]%(10**9+7))) | n,m,*a=list(map(int,open(0).read().split()))
d=[1]*(n+1)
for i in a:
d[i]=0
for i in range(2,n+1):
if d[i]!=0:
d[i]=d[i-1]+d[i-2]
print((d[-1]%(10**9+7))) | 9 | 8 | 193 | 169 | n, m, *a = list(map(int, open(0).read().split()))
dp = [-1] * (n + 1)
for i in a:
dp[i] = 0
dp[0] = 1
for i in range(1, n + 1):
if dp[i] != 0:
dp[i] = dp[i - 1] + dp[i - 2] * (i > 1)
print((dp[-1] % (10**9 + 7)))
| n, m, *a = list(map(int, open(0).read().split()))
d = [1] * (n + 1)
for i in a:
d[i] = 0
for i in range(2, n + 1):
if d[i] != 0:
d[i] = d[i - 1] + d[i - 2]
print((d[-1] % (10**9 + 7)))
| false | 11.111111 | [
"-dp = [-1] * (n + 1)",
"+d = [1] * (n + 1)",
"- dp[i] = 0",
"-dp[0] = 1",
"-for i in range(1, n + 1):",
"- if dp[i] != 0:",
"- dp[i] = dp[i - 1] + dp[i - 2] * (i > 1)",
"-print((dp[-1] % (10**9 + 7)))",
"+ d[i] = 0",
"+for i in range(2, n + 1):",
"+ if d[i] != 0:",
"+ ... | false | 0.036335 | 0.036221 | 1.003157 | [
"s463770316",
"s171000119"
] |
u644907318 | p02796 | python | s525959894 | s205471337 | 537 | 442 | 43,360 | 119,004 | Accepted | Accepted | 17.69 | N = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(N)]
B = sorted([(A[i][0]-A[i][1],A[i][0]+A[i][1]) for i in range(N)],key=lambda x:x[0],reverse=True)
B = sorted(B,key=lambda x:x[1])
cnt = 1
cur = B[0][1]
for i in range(1,N):
if B[i][0]>=cur:
cnt += 1
cur = B[i][1]
... | N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
A = []
for i in range(N):
x,l = X[i]
A.append((x-l,x+l))
B1 = sorted(A,key=lambda x:x[1])
B1 = [(B1[i][0],B1[i][1],i) for i in range(N)]
B2 = sorted(B1,key=lambda x:x[0])
hist = [0 for _ in range(N)]
cnt = 0
i = 0
for k in... | 11 | 28 | 324 | 668 | N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
B = sorted(
[(A[i][0] - A[i][1], A[i][0] + A[i][1]) for i in range(N)],
key=lambda x: x[0],
reverse=True,
)
B = sorted(B, key=lambda x: x[1])
cnt = 1
cur = B[0][1]
for i in range(1, N):
if B[i][0] >= cur:
cnt += 1
... | N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
A = []
for i in range(N):
x, l = X[i]
A.append((x - l, x + l))
B1 = sorted(A, key=lambda x: x[1])
B1 = [(B1[i][0], B1[i][1], i) for i in range(N)]
B2 = sorted(B1, key=lambda x: x[0])
hist = [0 for _ in range(N)]
cnt = 0
i = 0
for k i... | false | 60.714286 | [
"-A = [list(map(int, input().split())) for _ in range(N)]",
"-B = sorted(",
"- [(A[i][0] - A[i][1], A[i][0] + A[i][1]) for i in range(N)],",
"- key=lambda x: x[0],",
"- reverse=True,",
"-)",
"-B = sorted(B, key=lambda x: x[1])",
"-cnt = 1",
"-cur = B[0][1]",
"-for i in range(1, N):",
"-... | false | 0.044156 | 0.035299 | 1.250884 | [
"s525959894",
"s205471337"
] |
u528470578 | p03945 | python | s877851768 | s171410058 | 48 | 43 | 3,956 | 3,956 | Accepted | Accepted | 10.42 | import sys
S = list(eval(input()))
ls = len(S)
if ls == 1:
print((0))
sys.exit()
elif len(set(S)) == 1:
print((0))
sys.exit()
tg = S[0]
n = 0
for i in range(ls):
if i == 0:
continue
else:
if S[i] != tg:
n += 1
tg = S[i]
print(n) | S = list(eval(input()))
ls = len(S)
p = S[0]
ans = 0
for i in range(1, ls):
if S[i] != p:
ans += 1
p = S[i]
print(ans) | 22 | 9 | 306 | 140 | import sys
S = list(eval(input()))
ls = len(S)
if ls == 1:
print((0))
sys.exit()
elif len(set(S)) == 1:
print((0))
sys.exit()
tg = S[0]
n = 0
for i in range(ls):
if i == 0:
continue
else:
if S[i] != tg:
n += 1
tg = S[i]
print(n)
| S = list(eval(input()))
ls = len(S)
p = S[0]
ans = 0
for i in range(1, ls):
if S[i] != p:
ans += 1
p = S[i]
print(ans)
| false | 59.090909 | [
"-import sys",
"-",
"-if ls == 1:",
"- print((0))",
"- sys.exit()",
"-elif len(set(S)) == 1:",
"- print((0))",
"- sys.exit()",
"-tg = S[0]",
"-n = 0",
"-for i in range(ls):",
"- if i == 0:",
"- continue",
"- else:",
"- if S[i] != tg:",
"- n +=... | false | 0.0449 | 0.053404 | 0.840767 | [
"s877851768",
"s171410058"
] |
u561231954 | p02734 | python | s690121640 | s828065140 | 350 | 323 | 41,324 | 14,412 | Accepted | Accepted | 7.71 | import sys
sys.setrecursionlimit(10000000)
MOD = 998244353
INF = 10 ** 15
def main():
N,S = list(map(int,input().split()))
A = list(map(int,input().split()))
before = [0] * (1 + S)
before[0] = 1
ans = 0
for a in A:
now = [0] * (1 + S)
for i in range(S + 1):
... | import sys
sys.setrecursionlimit(10000000)
MOD = 998244353
INF = 10 ** 18
import numpy as np
def main():
N,S = list(map(int,input().split()))
A = list(map(int,input().split()))
before = np.zeros(S + 1,np.int64)
before[0] = 1
ans = 0
for a in A:
now = np.zeros(S + 1,np... | 26 | 26 | 586 | 552 | import sys
sys.setrecursionlimit(10000000)
MOD = 998244353
INF = 10**15
def main():
N, S = list(map(int, input().split()))
A = list(map(int, input().split()))
before = [0] * (1 + S)
before[0] = 1
ans = 0
for a in A:
now = [0] * (1 + S)
for i in range(S + 1):
now[i]... | import sys
sys.setrecursionlimit(10000000)
MOD = 998244353
INF = 10**18
import numpy as np
def main():
N, S = list(map(int, input().split()))
A = list(map(int, input().split()))
before = np.zeros(S + 1, np.int64)
before[0] = 1
ans = 0
for a in A:
now = np.zeros(S + 1, np.int64)
... | false | 0 | [
"-INF = 10**15",
"+INF = 10**18",
"+import numpy as np",
"- before = [0] * (1 + S)",
"+ before = np.zeros(S + 1, np.int64)",
"- now = [0] * (1 + S)",
"- for i in range(S + 1):",
"- now[i] += before[i]",
"- if i + a <= S:",
"- now[i + a] += b... | false | 0.038065 | 0.265046 | 0.143618 | [
"s690121640",
"s828065140"
] |
u597374218 | p03139 | python | s384310212 | s582145159 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | N,A,B=list(map(int,input().split()))
if A+B-N>0:
print((min(A,B),A+B-N))
else:
print((min(A,B),"0")) | N,A,B=list(map(int,input().split()))
print((min(A,B),max(0,A+B-N))) | 5 | 2 | 102 | 60 | N, A, B = list(map(int, input().split()))
if A + B - N > 0:
print((min(A, B), A + B - N))
else:
print((min(A, B), "0"))
| N, A, B = list(map(int, input().split()))
print((min(A, B), max(0, A + B - N)))
| false | 60 | [
"-if A + B - N > 0:",
"- print((min(A, B), A + B - N))",
"-else:",
"- print((min(A, B), \"0\"))",
"+print((min(A, B), max(0, A + B - N)))"
] | false | 0.047686 | 0.044899 | 1.062073 | [
"s384310212",
"s582145159"
] |
u173148629 | p02713 | python | s460904084 | s516331409 | 1,858 | 1,235 | 9,168 | 9,108 | Accepted | Accepted | 33.53 | from math import gcd
K=int(eval(input()))
s=0
for i in range(1,K+1):
for j in range(1,K+1):
for k in range(1,K+1):
s+=gcd(i,gcd(j,k))
print(s) | from math import gcd
K=int(eval(input()))
s=0
for i in range(1,K+1):
for j in range(1,K+1):
a=gcd(i,j)
for k in range(1,K+1):
s+=gcd(a,k)
print(s)
| 11 | 12 | 174 | 188 | from math import gcd
K = int(eval(input()))
s = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
s += gcd(i, gcd(j, k))
print(s)
| from math import gcd
K = int(eval(input()))
s = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
a = gcd(i, j)
for k in range(1, K + 1):
s += gcd(a, k)
print(s)
| false | 8.333333 | [
"+ a = gcd(i, j)",
"- s += gcd(i, gcd(j, k))",
"+ s += gcd(a, k)"
] | false | 0.210283 | 0.182169 | 1.154326 | [
"s460904084",
"s516331409"
] |
u756439833 | p03044 | python | s803528114 | s186132666 | 1,079 | 975 | 42,736 | 42,728 | Accepted | Accepted | 9.64 | N = int(eval(input()))
q = []
c = [0 for i in range(N)]
l = [0 for i in range(N)]
A = [[] for i in range(N)]
W = [[] for i in range(N)]
for i in range(N-1):
u, v, w = list(map(int,input().split()))
u = u - 1
v = v - 1
A[u].append(v)
A[v].append(u)
W[u].append(w)
W[v].append(w)
q.append(0)
w... | import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''
N = int(eval(input()))
q = []
c = [0] * N
l = [0] * N
A = [[] for i in range(N)]
W = [[] for i in range(N)]
for i in range(N-1):
u, v, w = list(map(int,input().split()))
u -= 1
v ... | 31 | 38 | 487 | 577 | N = int(eval(input()))
q = []
c = [0 for i in range(N)]
l = [0 for i in range(N)]
A = [[] for i in range(N)]
W = [[] for i in range(N)]
for i in range(N - 1):
u, v, w = list(map(int, input().split()))
u = u - 1
v = v - 1
A[u].append(v)
A[v].append(u)
W[u].append(w)
W[v].append(w)
q.append(0)... | import sys
input = sys.stdin.readline
"""
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#"""
N = int(eval(input()))
q = []
c = [0] * N
l = [0] * N
A = [[] for i in range(N)]
W = [[] for i in range(N)]
for i in range(N - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
... | false | 18.421053 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+\"\"\"",
"+allinputs = iter(input().splitlines())",
"+input = lambda : next(allinputs)",
"+#\"\"\"",
"-c = [0 for i in range(N)]",
"-l = [0 for i in range(N)]",
"+c = [0] * N",
"+l = [0] * N",
"- u = u - 1",
"- v = v - 1",
"+ u ... | false | 0.113663 | 0.106677 | 1.065493 | [
"s803528114",
"s186132666"
] |
u222668979 | p03419 | python | s613573582 | s251252337 | 176 | 160 | 38,324 | 38,256 | Accepted | Accepted | 9.09 | n, m = list(map(int, input().split()))
if n == 1 or m == 1:
print((max(n, m) - 2 if n * m > 1 else 1))
else:
print(((n - 2) * (m - 2)))
| n, m = list(map(int, input().split()))
if n == 1 or m == 1:
print((1 if n * m == 1 else max(n, m) - 2))
else:
print(((n - 2) * (m - 2)))
| 5 | 5 | 138 | 139 | n, m = list(map(int, input().split()))
if n == 1 or m == 1:
print((max(n, m) - 2 if n * m > 1 else 1))
else:
print(((n - 2) * (m - 2)))
| n, m = list(map(int, input().split()))
if n == 1 or m == 1:
print((1 if n * m == 1 else max(n, m) - 2))
else:
print(((n - 2) * (m - 2)))
| false | 0 | [
"- print((max(n, m) - 2 if n * m > 1 else 1))",
"+ print((1 if n * m == 1 else max(n, m) - 2))"
] | false | 0.03895 | 0.035467 | 1.098193 | [
"s613573582",
"s251252337"
] |
u971124021 | p03290 | python | s561701488 | s777504699 | 29 | 25 | 3,316 | 3,064 | Accepted | Accepted | 13.79 | from collections import deque
import itertools, math
d,g = list(map(int,input().split()))
pc = [list(map(int,input().split())) for _ in range(d)]
g /= 100
#ans = sum([pc[x][0] for x in range(d)])
ans = float('inf')
for bit in range(1<<d):
cnt = 0
point = 0
pat = set(range(1,d+1))
for i in range... | d,g = list(map(int,input().split()))
pc = [list(map(int,input().split())) for _ in range(d)]
ans = float('inf')
for bit in range(1<<d):
sum = 0
cnt = 0
rem = set(range(d))
for i in range(d):
if bit & 1<<i:
sum += pc[i][0]*(i+1)*100 + pc[i][1]
cnt += pc[i][0]
rem.discard(i)
... | 31 | 26 | 676 | 515 | from collections import deque
import itertools, math
d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
g /= 100
# ans = sum([pc[x][0] for x in range(d)])
ans = float("inf")
for bit in range(1 << d):
cnt = 0
point = 0
pat = set(range(1, d + 1))
for i in rang... | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
ans = float("inf")
for bit in range(1 << d):
sum = 0
cnt = 0
rem = set(range(d))
for i in range(d):
if bit & 1 << i:
sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
cnt += pc[i][0]
... | false | 16.129032 | [
"-from collections import deque",
"-import itertools, math",
"-",
"-g /= 100",
"-# ans = sum([pc[x][0] for x in range(d)])",
"+ sum = 0",
"- point = 0",
"- pat = set(range(1, d + 1))",
"+ rem = set(range(d))",
"- if bit & (1 << i):",
"- point += pc[i][0] * (i + 1) +... | false | 0.037823 | 0.091736 | 0.412306 | [
"s561701488",
"s777504699"
] |
u506858457 | p02792 | python | s849678814 | s839387025 | 223 | 183 | 9,164 | 9,144 | Accepted | Accepted | 17.94 | def II(): return int(eval(input()))
N=II()
tbl=[0]*101
for i in range(1,N+1):
i=str(i)
tbl[int(i[0]+i[-1])]+=1
ans=0
for i in range(1,N+1):
i=str(i)
ans+=tbl[int(i[-1]+i[0])]
print(ans)
| def II(): return int(eval(input()))
N=II()
def solve(n):
tbl=[0]*100
ans=0
for i in range(1,n+1):
i=str(i)
tbl[int(i[0]+i[-1])]+=1
for i in range(1,n+1):
i=str(i)
ans+=tbl[int(i[-1]+i[0])]
return ans
a=solve(N)
print(a) | 12 | 14 | 205 | 258 | def II():
return int(eval(input()))
N = II()
tbl = [0] * 101
for i in range(1, N + 1):
i = str(i)
tbl[int(i[0] + i[-1])] += 1
ans = 0
for i in range(1, N + 1):
i = str(i)
ans += tbl[int(i[-1] + i[0])]
print(ans)
| def II():
return int(eval(input()))
N = II()
def solve(n):
tbl = [0] * 100
ans = 0
for i in range(1, n + 1):
i = str(i)
tbl[int(i[0] + i[-1])] += 1
for i in range(1, n + 1):
i = str(i)
ans += tbl[int(i[-1] + i[0])]
return ans
a = solve(N)
print(a)
| false | 14.285714 | [
"-tbl = [0] * 101",
"-for i in range(1, N + 1):",
"- i = str(i)",
"- tbl[int(i[0] + i[-1])] += 1",
"-ans = 0",
"-for i in range(1, N + 1):",
"- i = str(i)",
"- ans += tbl[int(i[-1] + i[0])]",
"-print(ans)",
"+",
"+",
"+def solve(n):",
"+ tbl = [0] * 100",
"+ ans = 0",
"... | false | 0.054593 | 0.063376 | 0.861418 | [
"s849678814",
"s839387025"
] |
u309120194 | p03469 | python | s542964497 | s807522146 | 30 | 24 | 8,948 | 9,076 | Accepted | Accepted | 20 | S = eval(input())
# Pythonでは S[3]='8' のような操作は許されないので間接的な方法を用いる
print((S[:3] + '8' + S[-6:])) | S = eval(input())
# count=1 にする
print((S.replace('7', '8', 1)))
| 4 | 4 | 89 | 60 | S = eval(input())
# Pythonでは S[3]='8' のような操作は許されないので間接的な方法を用いる
print((S[:3] + "8" + S[-6:]))
| S = eval(input())
# count=1 にする
print((S.replace("7", "8", 1)))
| false | 0 | [
"-# Pythonでは S[3]='8' のような操作は許されないので間接的な方法を用いる",
"-print((S[:3] + \"8\" + S[-6:]))",
"+# count=1 にする",
"+print((S.replace(\"7\", \"8\", 1)))"
] | false | 0.040158 | 0.062934 | 0.638101 | [
"s542964497",
"s807522146"
] |
u984664611 | p03861 | python | s474056676 | s542507414 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | a, b, x = list(map(int, input().split()))
"""
a~b間のxで割り切れる数は何個?
1~b間のxで割り切れる数から1~a間のxで割り切れる数
"""
ans_b = b//x
ans_a = (a-1)//x
print((ans_b - ans_a))
| a, b, x = list(map(int, input().split()))
print((b//x - (a-1)//x))
| 8 | 2 | 157 | 60 | a, b, x = list(map(int, input().split()))
"""
a~b間のxで割り切れる数は何個?
1~b間のxで割り切れる数から1~a間のxで割り切れる数
"""
ans_b = b // x
ans_a = (a - 1) // x
print((ans_b - ans_a))
| a, b, x = list(map(int, input().split()))
print((b // x - (a - 1) // x))
| false | 75 | [
"-\"\"\"",
"- a~b間のxで割り切れる数は何個?",
"- 1~b間のxで割り切れる数から1~a間のxで割り切れる数",
"-\"\"\"",
"-ans_b = b // x",
"-ans_a = (a - 1) // x",
"-print((ans_b - ans_a))",
"+print((b // x - (a - 1) // x))"
] | false | 0.040878 | 0.041029 | 0.996338 | [
"s474056676",
"s542507414"
] |
u075012704 | p03480 | python | s642356464 | s868885535 | 70 | 64 | 3,188 | 3,188 | Accepted | Accepted | 8.57 | S = eval(input())
T = len(S)
for i in range(len(S)-1):
if S[i] != S[i+1]:
K = max(i+1, len(S)-i-1)
T = min(T, K)
print(T) | S = eval(input())
K = len(S)
for i in range(1, len(S)):
if S[i-1] != S[i]:
K = min(K, max(i, len(S)-i))
print(K)
| 8 | 7 | 143 | 126 | S = eval(input())
T = len(S)
for i in range(len(S) - 1):
if S[i] != S[i + 1]:
K = max(i + 1, len(S) - i - 1)
T = min(T, K)
print(T)
| S = eval(input())
K = len(S)
for i in range(1, len(S)):
if S[i - 1] != S[i]:
K = min(K, max(i, len(S) - i))
print(K)
| false | 12.5 | [
"-T = len(S)",
"-for i in range(len(S) - 1):",
"- if S[i] != S[i + 1]:",
"- K = max(i + 1, len(S) - i - 1)",
"- T = min(T, K)",
"-print(T)",
"+K = len(S)",
"+for i in range(1, len(S)):",
"+ if S[i - 1] != S[i]:",
"+ K = min(K, max(i, len(S) - i))",
"+print(K)"
] | false | 0.210866 | 0.209413 | 1.006942 | [
"s642356464",
"s868885535"
] |
u775681539 | p03244 | python | s731372389 | s914683212 | 94 | 76 | 15,972 | 16,216 | Accepted | Accepted | 19.15 | #python3
from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
odd = [a[i] for i in range(n) if i%2==0]
even = [a[i] for i in range(n) if i%2!=0]
cntOdd = Counter(odd).most_common(2)
cntEven = Counter(even).most_common(2)
if cntOdd[0][0] != cntEven[0][0]:
pri... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import Counter
from collections import defaultdict
def main():
n = int(readline())
a = [int(i) for i in readline().split()]
odd = Counter(a[::2]).most_common(2)
... | 27 | 20 | 585 | 605 | # python3
from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
odd = [a[i] for i in range(n) if i % 2 == 0]
even = [a[i] for i in range(n) if i % 2 != 0]
cntOdd = Counter(odd).most_common(2)
cntEven = Counter(even).most_common(2)
if cntOdd[0][0] != cntEven[0][0]:
print((n - cn... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import Counter
from collections import defaultdict
def main():
n = int(readline())
a = [int(i) for i in readline().split()]
odd = Counter(a[::2]).most_common(2)
even = ... | false | 25.925926 | [
"-# python3",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+from collections import defaultdict",
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-odd = [a[i] for i in range(n) if i % 2... | false | 0.035378 | 0.037339 | 0.947492 | [
"s731372389",
"s914683212"
] |
u039623862 | p03607 | python | s470596908 | s384645239 | 269 | 203 | 16,636 | 11,884 | Accepted | Accepted | 24.54 | import collections
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
cnt = collections.Counter(a)
total = 0
for c, v in list(cnt.items()):
if v%2 == 1:
total += 1
print(total) | n = int(eval(input()))
s = set()
for i in range(n):
a = int(eval(input()))
if a in s:
s.remove(a)
else:
s.add(a)
print((len(s)))
| 9 | 9 | 193 | 151 | import collections
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
cnt = collections.Counter(a)
total = 0
for c, v in list(cnt.items()):
if v % 2 == 1:
total += 1
print(total)
| n = int(eval(input()))
s = set()
for i in range(n):
a = int(eval(input()))
if a in s:
s.remove(a)
else:
s.add(a)
print((len(s)))
| false | 0 | [
"-import collections",
"-",
"-a = [int(eval(input())) for i in range(n)]",
"-cnt = collections.Counter(a)",
"-total = 0",
"-for c, v in list(cnt.items()):",
"- if v % 2 == 1:",
"- total += 1",
"-print(total)",
"+s = set()",
"+for i in range(n):",
"+ a = int(eval(input()))",
"+ ... | false | 0.140214 | 0.03681 | 3.809163 | [
"s470596908",
"s384645239"
] |
u968166680 | p03353 | python | s463213946 | s829294236 | 69 | 39 | 69,040 | 10,488 | Accepted | Accepted | 43.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():
S = readline().strip()
K = int(readline())
subs = set()
S_sorted = sorted(set(S))
for c_min in S_sorted:
... | 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():
S = readline().strip()
K = int(readline())
subs = set()
for i in range(len(S)):
for j in range(i + 1, min... | 34 | 28 | 661 | 485 | 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():
S = readline().strip()
K = int(readline())
subs = set()
S_sorted = sorted(set(S))
for c_min in S_sorted:
indices = [i 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():
S = readline().strip()
K = int(readline())
subs = set()
for i in range(len(S)):
for j in range(i + 1, min(len(S) + 1, i + K + ... | false | 17.647059 | [
"- S_sorted = sorted(set(S))",
"- for c_min in S_sorted:",
"- indices = [i for i, c in enumerate(S) if c == c_min]",
"- for i in indices:",
"- for j in range(i + 1, min(len(S) + 1, i + K + 1)):",
"- subs.add(S[i:j])",
"- if len(subs) >= K:",
"- ... | false | 0.07429 | 0.091459 | 0.812278 | [
"s463213946",
"s829294236"
] |
u589276934 | p00001 | python | s641079594 | s776468696 | 20 | 10 | 7,620 | 7,640 | Accepted | Accepted | 50 | ranking = []
while True:
try:
height = int(eval(input()))
ranking.append(height)
except:
break
sortedRanking = sorted(ranking, reverse=True)
print((sortedRanking[0]))
print((sortedRanking[1]))
print((sortedRanking[2])) | # coding: utf-8
mountains = []
for i in range(10):
mountains.append(int(eval(input())))
outputCount = 3
for height in list(reversed(sorted(mountains))):
print(height)
outputCount -= 1
if outputCount == 0:
break | 12 | 12 | 250 | 249 | ranking = []
while True:
try:
height = int(eval(input()))
ranking.append(height)
except:
break
sortedRanking = sorted(ranking, reverse=True)
print((sortedRanking[0]))
print((sortedRanking[1]))
print((sortedRanking[2]))
| # coding: utf-8
mountains = []
for i in range(10):
mountains.append(int(eval(input())))
outputCount = 3
for height in list(reversed(sorted(mountains))):
print(height)
outputCount -= 1
if outputCount == 0:
break
| false | 0 | [
"-ranking = []",
"-while True:",
"- try:",
"- height = int(eval(input()))",
"- ranking.append(height)",
"- except:",
"+# coding: utf-8",
"+mountains = []",
"+for i in range(10):",
"+ mountains.append(int(eval(input())))",
"+outputCount = 3",
"+for height in list(reversed... | false | 0.040389 | 0.041092 | 0.982894 | [
"s641079594",
"s776468696"
] |
u172035535 | p02948 | python | s537346673 | s297483247 | 1,871 | 356 | 17,140 | 17,208 | Accepted | Accepted | 80.97 | import sys
from heapq import heappush,heappop
n,m = list(map(int,input().split()))
ab = []
for line in sys.stdin:
a,b = list(map(int,line.split()))
if a <= m:
ab.append((a,b))
ab.sort()
stock = []
ans = 0
for i in range(1,m+1):
while ab and ab[0][0] <= i:
a,b = ab.pop(0)
... | import sys
from heapq import heappush,heappop
n,m = list(map(int,input().split()))
ab = []
for line in sys.stdin:
a,b = list(map(int,line.split()))
if a <= m:
ab.append((a,b))
ab.sort(reverse=1)
stock = []
ans = 0
for i in range(1,m+1):
while ab and ab[-1][0] <= i:
a,b = ab.... | 21 | 21 | 393 | 402 | import sys
from heapq import heappush, heappop
n, m = list(map(int, input().split()))
ab = []
for line in sys.stdin:
a, b = list(map(int, line.split()))
if a <= m:
ab.append((a, b))
ab.sort()
stock = []
ans = 0
for i in range(1, m + 1):
while ab and ab[0][0] <= i:
a, b = ab.pop(0)
h... | import sys
from heapq import heappush, heappop
n, m = list(map(int, input().split()))
ab = []
for line in sys.stdin:
a, b = list(map(int, line.split()))
if a <= m:
ab.append((a, b))
ab.sort(reverse=1)
stock = []
ans = 0
for i in range(1, m + 1):
while ab and ab[-1][0] <= i:
a, b = ab.pop()
... | false | 0 | [
"-ab.sort()",
"+ab.sort(reverse=1)",
"- while ab and ab[0][0] <= i:",
"- a, b = ab.pop(0)",
"+ while ab and ab[-1][0] <= i:",
"+ a, b = ab.pop()"
] | false | 0.034821 | 0.036554 | 0.952576 | [
"s537346673",
"s297483247"
] |
u670180528 | p03566 | python | s919143052 | s660730487 | 365 | 72 | 43,868 | 3,496 | Accepted | Accepted | 80.27 | def main():
n = int(eval(input()))
*t, = list(map(int, input().split()))
tot = sum(t)
*v, = list(map(int, input().split()))
lim1 = []
lim2 = [(1, 0, 0), (-1, tot, tot)]
til = 0
for t1, t2, v1 in zip([0] + t, t, v):
lim1.append((til, til + t2, v1))
lim2.append((-1, til, til + v1))
lim2.append((1... | n,*L=list(map(int,open(0).read().split()))
T,V=L[:n],L[n:]
s=sum(T)
a=[0]
for t,v1,v2 in zip(T,V,V[1:]+[0]):
a+=[v1]*(2*t-1)+[min(v1,v2)]
for i in range(2*s):
a[i+1]=min(a[i+1],a[i]+.5)
for i in range(2*s,0,-1):
a[i-1]=min(a[i-1],a[i]+.5)
print((sum(a)/2)) | 30 | 11 | 715 | 261 | def main():
n = int(eval(input()))
(*t,) = list(map(int, input().split()))
tot = sum(t)
(*v,) = list(map(int, input().split()))
lim1 = []
lim2 = [(1, 0, 0), (-1, tot, tot)]
til = 0
for t1, t2, v1 in zip([0] + t, t, v):
lim1.append((til, til + t2, v1))
lim2.append((-1, til... | n, *L = list(map(int, open(0).read().split()))
T, V = L[:n], L[n:]
s = sum(T)
a = [0]
for t, v1, v2 in zip(T, V, V[1:] + [0]):
a += [v1] * (2 * t - 1) + [min(v1, v2)]
for i in range(2 * s):
a[i + 1] = min(a[i + 1], a[i] + 0.5)
for i in range(2 * s, 0, -1):
a[i - 1] = min(a[i - 1], a[i] + 0.5)
print((sum(a) ... | false | 63.333333 | [
"-def main():",
"- n = int(eval(input()))",
"- (*t,) = list(map(int, input().split()))",
"- tot = sum(t)",
"- (*v,) = list(map(int, input().split()))",
"- lim1 = []",
"- lim2 = [(1, 0, 0), (-1, tot, tot)]",
"- til = 0",
"- for t1, t2, v1 in zip([0] + t, t, v):",
"- l... | false | 0.057213 | 0.043359 | 1.319524 | [
"s919143052",
"s660730487"
] |
u994521204 | p02720 | python | s062099817 | s760926622 | 155 | 69 | 12,396 | 74,772 | Accepted | Accepted | 55.48 | from collections import deque
k = int(eval(input()))
queue = [1, 2, 3, 4, 5, 6, 7, 8, 9]
queue = deque(queue)
cnt = 0
while cnt < k:
cnt += 1
a = queue.popleft()
hitoketa = a % 10
kouho = [hitoketa - 1, hitoketa, hitoketa + 1]
for b in kouho:
if b >= 0 and b <= 9:
q... | from collections import deque
k = int(eval(input()))
LL = [i for i in range(1, 10)]
LL = deque(LL)
for j in range(k):
num = LL.popleft()
amari = num % 10
kouho = [amari - 1, amari, amari + 1]
for nn in kouho:
if nn >= 0 and nn < 10:
LL.append(10 * num + nn)
print(num)
| 15 | 14 | 348 | 314 | from collections import deque
k = int(eval(input()))
queue = [1, 2, 3, 4, 5, 6, 7, 8, 9]
queue = deque(queue)
cnt = 0
while cnt < k:
cnt += 1
a = queue.popleft()
hitoketa = a % 10
kouho = [hitoketa - 1, hitoketa, hitoketa + 1]
for b in kouho:
if b >= 0 and b <= 9:
queue.append(1... | from collections import deque
k = int(eval(input()))
LL = [i for i in range(1, 10)]
LL = deque(LL)
for j in range(k):
num = LL.popleft()
amari = num % 10
kouho = [amari - 1, amari, amari + 1]
for nn in kouho:
if nn >= 0 and nn < 10:
LL.append(10 * num + nn)
print(num)
| false | 6.666667 | [
"-queue = [1, 2, 3, 4, 5, 6, 7, 8, 9]",
"-queue = deque(queue)",
"-cnt = 0",
"-while cnt < k:",
"- cnt += 1",
"- a = queue.popleft()",
"- hitoketa = a % 10",
"- kouho = [hitoketa - 1, hitoketa, hitoketa + 1]",
"- for b in kouho:",
"- if b >= 0 and b <= 9:",
"- qu... | false | 0.125859 | 0.122899 | 1.024087 | [
"s062099817",
"s760926622"
] |
u340393770 | p02873 | python | s022689225 | s300984226 | 772 | 409 | 24,004 | 26,028 | Accepted | Accepted | 47.02 | s=eval(input())
list=[0 for _ in range(len(s) + 1)]
def inc(n):
if n < 0 or len(s) < n + 1:
return
if '<' == s[n]:
if list[n] >= list[n + 1]:
list[n + 1] += list[n] - list[n + 1] + 1
elif '>' == s[n]:
if list[n] <= list[n + 1]:
list[n] += list[n ... | s=eval(input())
list=[0 for _ in range(len(s) + 1)]
for n in range(0, len(s), 1):
if '<' == s[n] and list[n] >= list[n + 1]:
list[n + 1] += list[n] - list[n + 1] + 1
for n in range(len(s) - 1, -1, -1):
if '>' == s[n] and list[n] <= list[n + 1]:
list[n] += list[n + 1] - list[n] + 1
... | 21 | 13 | 449 | 333 | s = eval(input())
list = [0 for _ in range(len(s) + 1)]
def inc(n):
if n < 0 or len(s) < n + 1:
return
if "<" == s[n]:
if list[n] >= list[n + 1]:
list[n + 1] += list[n] - list[n + 1] + 1
elif ">" == s[n]:
if list[n] <= list[n + 1]:
list[n] += list[n + 1] - l... | s = eval(input())
list = [0 for _ in range(len(s) + 1)]
for n in range(0, len(s), 1):
if "<" == s[n] and list[n] >= list[n + 1]:
list[n + 1] += list[n] - list[n + 1] + 1
for n in range(len(s) - 1, -1, -1):
if ">" == s[n] and list[n] <= list[n + 1]:
list[n] += list[n + 1] - list[n] + 1
print((sum... | false | 38.095238 | [
"-",
"-",
"-def inc(n):",
"- if n < 0 or len(s) < n + 1:",
"- return",
"- if \"<\" == s[n]:",
"- if list[n] >= list[n + 1]:",
"- list[n + 1] += list[n] - list[n + 1] + 1",
"- elif \">\" == s[n]:",
"- if list[n] <= list[n + 1]:",
"- list[n] += l... | false | 0.085297 | 0.044793 | 1.904244 | [
"s022689225",
"s300984226"
] |
u172035535 | p03103 | python | s187572598 | s601007952 | 1,986 | 471 | 27,760 | 27,756 | Accepted | Accepted | 76.28 | N,M = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort()
ans = 0
while M > 0:
ab = AB[0]
if ab[1] <= M:
M-= ab[1]
ans += ab[0] * ab[1]
AB.pop(0)
else:
ans += ab[0] * M
M -= M
print(ans) | N,M = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort()
i = 0
ans = 0
while M > 0:
if M >= AB[i][1]:
ans += AB[i][0]*AB[i][1]
M -= AB[i][1]
i += 1
else:
ans += AB[i][0]*M
break
print(ans) | 14 | 14 | 298 | 289 | N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort()
ans = 0
while M > 0:
ab = AB[0]
if ab[1] <= M:
M -= ab[1]
ans += ab[0] * ab[1]
AB.pop(0)
else:
ans += ab[0] * M
M -= M
print(ans)
| N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort()
i = 0
ans = 0
while M > 0:
if M >= AB[i][1]:
ans += AB[i][0] * AB[i][1]
M -= AB[i][1]
i += 1
else:
ans += AB[i][0] * M
break
print(ans)
| false | 0 | [
"+i = 0",
"- ab = AB[0]",
"- if ab[1] <= M:",
"- M -= ab[1]",
"- ans += ab[0] * ab[1]",
"- AB.pop(0)",
"+ if M >= AB[i][1]:",
"+ ans += AB[i][0] * AB[i][1]",
"+ M -= AB[i][1]",
"+ i += 1",
"- ans += ab[0] * M",
"- M -= M",
"+ ... | false | 0.038604 | 0.037909 | 1.018347 | [
"s187572598",
"s601007952"
] |
u254871849 | p03240 | python | s180764666 | s140773349 | 32 | 28 | 3,064 | 3,192 | Accepted | Accepted | 12.5 | import sys
n, *xyh = list(map(int, sys.stdin.read().split()))
xyh = list(zip(*[iter(xyh)] * 3))
def contradict(cx, cy, ch, x, y, h):
return max(ch - abs(x - cx) - abs(y - cy), 0) != h
def main():
for x, y, h in xyh:
if h: x0, y0, h0 = x, y, h; break
cand = []
for cx in range(101):... | import sys
n, *xyh = list(map(int, sys.stdin.read().split()))
xyh = list(zip(*[iter(xyh)] * 3))
def contradict(cx, cy, ch, x, y, h):
return max(ch - abs(x - cx) - abs(y - cy), 0) != h
def main():
for x, y, h in xyh:
if h: x0, y0, h0 = x, y, h; break
for cx in range(101):
for... | 25 | 23 | 676 | 596 | import sys
n, *xyh = list(map(int, sys.stdin.read().split()))
xyh = list(zip(*[iter(xyh)] * 3))
def contradict(cx, cy, ch, x, y, h):
return max(ch - abs(x - cx) - abs(y - cy), 0) != h
def main():
for x, y, h in xyh:
if h:
x0, y0, h0 = x, y, h
break
cand = []
for cx i... | import sys
n, *xyh = list(map(int, sys.stdin.read().split()))
xyh = list(zip(*[iter(xyh)] * 3))
def contradict(cx, cy, ch, x, y, h):
return max(ch - abs(x - cx) - abs(y - cy), 0) != h
def main():
for x, y, h in xyh:
if h:
x0, y0, h0 = x, y, h
break
for cx in range(101):
... | false | 8 | [
"- cand = []",
"- cand.append((ch, cx, cy))",
"- cand.sort(reverse=True)",
"- res = cand[0]",
"- print((res[1], res[2], res[0]))",
"+ print((cx, cy, ch))",
"+ return"
] | false | 0.058133 | 0.043438 | 1.338297 | [
"s180764666",
"s140773349"
] |
u746419473 | p03835 | python | s541025143 | s715996945 | 1,854 | 1,606 | 2,940 | 2,940 | Accepted | Accepted | 13.38 | k, s = list(map(int, input().split()))
ans = 0
for x in range(k+1):
for y in range(k+1):
if x+y > s:
continue
if 0 <= s-x-y <= 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 i+j <= s and s-i-j <= k:
ans += 1
print(ans)
| 11 | 9 | 200 | 165 | k, s = list(map(int, input().split()))
ans = 0
for x in range(k + 1):
for y in range(k + 1):
if x + y > s:
continue
if 0 <= s - x - y <= 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 i + j <= s and s - i - j <= k:
ans += 1
print(ans)
| false | 18.181818 | [
"-for x in range(k + 1):",
"- for y in range(k + 1):",
"- if x + y > s:",
"- continue",
"- if 0 <= s - x - y <= k:",
"+for i in range(k + 1):",
"+ for j in range(k + 1):",
"+ if i + j <= s and s - i - j <= k:"
] | false | 0.046078 | 0.162758 | 0.283108 | [
"s541025143",
"s715996945"
] |
u814986259 | p02863 | python | s704727394 | s516415510 | 442 | 337 | 44,656 | 42,096 | Accepted | Accepted | 23.76 | def main():
import sys
input = sys.stdin.readline
N, T = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(N)]
ab.sort(key=lambda x: (x[0], x[1]))
dp = [-1 for i in range(T*2 + 1)]
dp[0] = 0
for a, b in ab:
for i in range(T*2, 0, -1):
... | def main():
import sys
input = sys.stdin.readline
N, T = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(N)]
ab.sort(key=lambda x: x[0])
t = ab[-1][0]
dp = [-1 for i in range(T+t + 1)]
dp[0] = 0
for a, b in ab:
for i in range(T+t... | 37 | 24 | 948 | 584 | def main():
import sys
input = sys.stdin.readline
N, T = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(N)]
ab.sort(key=lambda x: (x[0], x[1]))
dp = [-1 for i in range(T * 2 + 1)]
dp[0] = 0
for a, b in ab:
for i in range(T * 2, 0, -1):
... | def main():
import sys
input = sys.stdin.readline
N, T = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(N)]
ab.sort(key=lambda x: x[0])
t = ab[-1][0]
dp = [-1 for i in range(T + t + 1)]
dp[0] = 0
for a, b in ab:
for i in range(T + t, 0, ... | false | 35.135135 | [
"- ab.sort(key=lambda x: (x[0], x[1]))",
"- dp = [-1 for i in range(T * 2 + 1)]",
"+ ab.sort(key=lambda x: x[0])",
"+ t = ab[-1][0]",
"+ dp = [-1 for i in range(T + t + 1)]",
"- for i in range(T * 2, 0, -1):",
"+ for i in range(T + t, 0, -1):",
"- for i in range(1, T * ... | false | 0.038177 | 0.042296 | 0.90263 | [
"s704727394",
"s516415510"
] |
u593019570 | p02696 | python | s020227429 | s556369065 | 22 | 20 | 9,152 | 9,164 | Accepted | Accepted | 9.09 | #copy
import math
a, b, n = list(map(int, input().split()))
x = min(b-1,n)
ans = math.floor(a*x/b)-a*math.floor(x/b)
print(ans)
| import math
a,b,n = list(map(int,input().split()))
c = min(n,b - 1)
ans = math.floor(a * c / b) - a * math.floor(c / b)
print(ans) | 6 | 6 | 133 | 131 | # copy
import math
a, b, n = list(map(int, input().split()))
x = min(b - 1, n)
ans = math.floor(a * x / b) - a * math.floor(x / b)
print(ans)
| import math
a, b, n = list(map(int, input().split()))
c = min(n, b - 1)
ans = math.floor(a * c / b) - a * math.floor(c / b)
print(ans)
| false | 0 | [
"-# copy",
"-x = min(b - 1, n)",
"-ans = math.floor(a * x / b) - a * math.floor(x / b)",
"+c = min(n, b - 1)",
"+ans = math.floor(a * c / b) - a * math.floor(c / b)"
] | false | 0.048594 | 0.11586 | 0.419419 | [
"s020227429",
"s556369065"
] |
u143492911 | p03611 | python | s723245801 | s720045379 | 174 | 135 | 31,580 | 29,512 | Accepted | Accepted | 22.41 | n=int(eval(input()))
a=list(map(int,input().split()))
count=0
a_plus=[]
a_minu=[]
for i in range(n):
a_plus.append(a[i]+1)
a_minu.append(a[i]-1)
import collections
a.extend(a_plus)
a.extend(a_minu)
data=collections.Counter(a)
data=sorted(list(data.items()),key=lambda x:x[1],reverse=True)
print((dat... | n=int(eval(input()))
a=list(map(int,input().split()))
from collections import Counter
plus=[0]*n
minus=[0]*n
for i in range(n):
plus[i]=a[i]+1
minus[i]=a[i]-1
plus=plus+minus+a
data=Counter(plus)
ans=[]
for i in list(data.values()):
ans.append(i)
print((max(ans)))
| 14 | 14 | 316 | 276 | n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
a_plus = []
a_minu = []
for i in range(n):
a_plus.append(a[i] + 1)
a_minu.append(a[i] - 1)
import collections
a.extend(a_plus)
a.extend(a_minu)
data = collections.Counter(a)
data = sorted(list(data.items()), key=lambda x: x[1], reverse=True)
... | n = int(eval(input()))
a = list(map(int, input().split()))
from collections import Counter
plus = [0] * n
minus = [0] * n
for i in range(n):
plus[i] = a[i] + 1
minus[i] = a[i] - 1
plus = plus + minus + a
data = Counter(plus)
ans = []
for i in list(data.values()):
ans.append(i)
print((max(ans)))
| false | 0 | [
"-count = 0",
"-a_plus = []",
"-a_minu = []",
"+from collections import Counter",
"+",
"+plus = [0] * n",
"+minus = [0] * n",
"- a_plus.append(a[i] + 1)",
"- a_minu.append(a[i] - 1)",
"-import collections",
"-",
"-a.extend(a_plus)",
"-a.extend(a_minu)",
"-data = collections.Counter(a... | false | 0.040552 | 0.03853 | 1.05248 | [
"s723245801",
"s720045379"
] |
u794173881 | p04017 | python | s173401358 | s622297629 | 2,199 | 985 | 107,544 | 100,888 | Accepted | Accepted | 55.21 | import bisect
n = int(eval(input()))
x = list(map(int, input().split()))
l = int(eval(input()))
q = int(eval(input()))
info = [list(map(int, input().split())) for i in range(q)]
#logテーブルを作成する
log_table = [[0]*n for i in range(17)]
for i in range(n):
log_table[0][i] = bisect.bisect_right(x, x[i] + l... | import bisect
n = int(eval(input()))
x = list(map(int, input().split()))
l = int(eval(input()))
q = int(eval(input()))
query = [list(map(int, input().split())) for i in range(q)]
log_size = n.bit_length() + 1
double = [[0] * n for i in range(log_size)]
for i in range(n):
double[0][i] = bisect.bisec... | 53 | 33 | 1,171 | 759 | import bisect
n = int(eval(input()))
x = list(map(int, input().split()))
l = int(eval(input()))
q = int(eval(input()))
info = [list(map(int, input().split())) for i in range(q)]
# logテーブルを作成する
log_table = [[0] * n for i in range(17)]
for i in range(n):
log_table[0][i] = bisect.bisect_right(x, x[i] + l) - 1
for j i... | import bisect
n = int(eval(input()))
x = list(map(int, input().split()))
l = int(eval(input()))
q = int(eval(input()))
query = [list(map(int, input().split())) for i in range(q)]
log_size = n.bit_length() + 1
double = [[0] * n for i in range(log_size)]
for i in range(n):
double[0][i] = bisect.bisect_right(x, x[i] ... | false | 37.735849 | [
"-info = [list(map(int, input().split())) for i in range(q)]",
"-# logテーブルを作成する",
"-log_table = [[0] * n for i in range(17)]",
"+query = [list(map(int, input().split())) for i in range(q)]",
"+log_size = n.bit_length() + 1",
"+double = [[0] * n for i in range(log_size)]",
"- log_table[0][i] = bisect.... | false | 0.062379 | 0.099386 | 0.627639 | [
"s173401358",
"s622297629"
] |
u724687935 | p02838 | python | s708292783 | s808749545 | 674 | 479 | 122,808 | 122,936 | Accepted | Accepted | 28.93 | N = int(eval(input()))
A = list(map(int, input().split()))
D = [[0, 0] for _ in range(60)]
for a in A:
for i in range(60):
if (a >> i) & 1:
D[i][1] += 1
else:
D[i][0] += 1
ans = 0
mod = 10 ** 9 + 7
for idx, d in enumerate(D):
ans = (ans + (d[0] * d[1] * ... | N = int(eval(input()))
A = list(map(int, input().split()))
ones = [0] * 60
for a in A:
i = 0
while (1 << i) <= a:
ones[i] += ((a >> i) & 1)
i += 1
ans = 0
mod = 10 ** 9 + 7
for idx, one in enumerate(ones):
ans = (ans + one * (N - one) * (1 << idx)) % mod
print(ans)
| 18 | 17 | 340 | 302 | N = int(eval(input()))
A = list(map(int, input().split()))
D = [[0, 0] for _ in range(60)]
for a in A:
for i in range(60):
if (a >> i) & 1:
D[i][1] += 1
else:
D[i][0] += 1
ans = 0
mod = 10**9 + 7
for idx, d in enumerate(D):
ans = (ans + (d[0] * d[1] * (1 << idx))) % mod
p... | N = int(eval(input()))
A = list(map(int, input().split()))
ones = [0] * 60
for a in A:
i = 0
while (1 << i) <= a:
ones[i] += (a >> i) & 1
i += 1
ans = 0
mod = 10**9 + 7
for idx, one in enumerate(ones):
ans = (ans + one * (N - one) * (1 << idx)) % mod
print(ans)
| false | 5.555556 | [
"-D = [[0, 0] for _ in range(60)]",
"+ones = [0] * 60",
"- for i in range(60):",
"- if (a >> i) & 1:",
"- D[i][1] += 1",
"- else:",
"- D[i][0] += 1",
"+ i = 0",
"+ while (1 << i) <= a:",
"+ ones[i] += (a >> i) & 1",
"+ i += 1",
"-for i... | false | 0.05794 | 0.123429 | 0.469418 | [
"s708292783",
"s808749545"
] |
u263830634 | p03103 | python | s665524570 | s526079569 | 594 | 253 | 27,760 | 18,052 | Accepted | Accepted | 57.41 | import sys
N, M = list(map(int, input().split()))
lst = []
for i in range(N):
lst += [list(map(int, input().split()))]
lst.sort()
#print (lst)
count = M
yen = 0
for i in range(N):
yen += lst[i][0] * min(count, lst[i][1])
count -= min(count, lst[i][1])
# print (count)
if count <... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[0])
ans = 0
for i in range(N):
if AB[i][1] >= M:
ans += AB[i][0] * M
print ... | 18 | 17 | 359 | 385 | import sys
N, M = list(map(int, input().split()))
lst = []
for i in range(N):
lst += [list(map(int, input().split()))]
lst.sort()
# print (lst)
count = M
yen = 0
for i in range(N):
yen += lst[i][0] * min(count, lst[i][1])
count -= min(count, lst[i][1])
# print (count)
if count <= 0:
prin... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[0])
ans = 0
for i in range(N):
if AB[i][1] >= M:
ans += AB[i][0] * M
print(ans)
break
... | false | 5.555556 | [
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**9)",
"+MOD = 10**9 + 7",
"-lst = []",
"+AB = [tuple(map(int, input().split())) for _ in range(N)]",
"+AB.sort(key=lambda x: x[0])",
"+ans = 0",
"- lst += [list(map(int, input().split()))]",
"-lst.sort()",
"-# print (lst)",
"-count = M... | false | 0.04183 | 0.11757 | 0.35579 | [
"s665524570",
"s526079569"
] |
u783586434 | p03163 | python | s922765149 | s107440797 | 461 | 176 | 120,300 | 14,600 | Accepted | Accepted | 61.82 | n,w=list(map(int,input().split()))
wv=[list(map(int,input().split())) for _ in range(n)]
wv.sort()
cost=[[0]*(w+1) for _ in range(n+1)]
for i in range(1,n+1):
for j in range(w+1):
if wv[i-1][0] <= j:
cost[i][j]=max(wv[i-1][1]+cost[i-1][j-wv[i-1][0]],cost[i-1][j])
else:
... | import numpy as np
n,w=list(map(int,input().split()))
dp=np.zeros(w+1,dtype=np.int64)
for _ in range(n):
we,v=list(map(int,input().split()))
if we > w:
continue
else:
np.maximum(dp[we:],dp[:-we]+v,out = dp[we:])
print((dp[w])) | 11 | 10 | 360 | 249 | n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
wv.sort()
cost = [[0] * (w + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(w + 1):
if wv[i - 1][0] <= j:
cost[i][j] = max(
wv[i - 1][1] + cost[i - 1][j - wv[i - 1]... | import numpy as np
n, w = list(map(int, input().split()))
dp = np.zeros(w + 1, dtype=np.int64)
for _ in range(n):
we, v = list(map(int, input().split()))
if we > w:
continue
else:
np.maximum(dp[we:], dp[:-we] + v, out=dp[we:])
print((dp[w]))
| false | 9.090909 | [
"+import numpy as np",
"+",
"-wv = [list(map(int, input().split())) for _ in range(n)]",
"-wv.sort()",
"-cost = [[0] * (w + 1) for _ in range(n + 1)]",
"-for i in range(1, n + 1):",
"- for j in range(w + 1):",
"- if wv[i - 1][0] <= j:",
"- cost[i][j] = max(",
"- ... | false | 0.034608 | 0.173731 | 0.199204 | [
"s922765149",
"s107440797"
] |
u627234757 | p03013 | python | s881863622 | s827155358 | 183 | 150 | 7,836 | 13,360 | Accepted | Accepted | 18.03 | MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
broken = [False for _ in range(N+1)]
for _ in range(M):
broken[int(eval(input()))] = True
dp = [0 for _ in range(N + 1)]
dp[0] = 1
if(broken[1] == False):
dp[1] = 1
for i in range(2, N+1):
if broken[i]:
continue
else:
dp[i] = dp[i-1]... | n, m = list(map(int, input().split()))
broken = [0]*(n+1)
#m個階段が壊れているからそれをbrokenに入れる
for i in range(m):
a = int(eval(input()))
broken[a] = 1
dp = [0]*(n+1)
dp[0] = 1
mod = 1000000007
for i in range(1, n+1):
if broken[i]:
continue
#dp[-1]は0だから上手く回る
dp[i] = (dp[i-1] + dp[i-2]) % m... | 20 | 15 | 348 | 325 | MOD = 10**9 + 7
N, M = list(map(int, input().split()))
broken = [False for _ in range(N + 1)]
for _ in range(M):
broken[int(eval(input()))] = True
dp = [0 for _ in range(N + 1)]
dp[0] = 1
if broken[1] == False:
dp[1] = 1
for i in range(2, N + 1):
if broken[i]:
continue
else:
dp[i] = dp[i... | n, m = list(map(int, input().split()))
broken = [0] * (n + 1)
# m個階段が壊れているからそれをbrokenに入れる
for i in range(m):
a = int(eval(input()))
broken[a] = 1
dp = [0] * (n + 1)
dp[0] = 1
mod = 1000000007
for i in range(1, n + 1):
if broken[i]:
continue
# dp[-1]は0だから上手く回る
dp[i] = (dp[i - 1] + dp[i - 2]) ... | false | 25 | [
"-MOD = 10**9 + 7",
"-N, M = list(map(int, input().split()))",
"-broken = [False for _ in range(N + 1)]",
"-for _ in range(M):",
"- broken[int(eval(input()))] = True",
"-dp = [0 for _ in range(N + 1)]",
"+n, m = list(map(int, input().split()))",
"+broken = [0] * (n + 1)",
"+# m個階段が壊れているからそれをbroke... | false | 0.007601 | 0.035722 | 0.212787 | [
"s881863622",
"s827155358"
] |
u525065967 | p03329 | python | s036283075 | s535538453 | 366 | 228 | 7,076 | 2,940 | Accepted | Accepted | 37.7 | n = int(eval(input()))
dp = list(i for i in range(n+1))
def f(yen, p):
c = p
while yen >= c:
dp[yen] = min(dp[yen], dp[yen-c] + 1)
c *= p
for yen in range(6, n+1):
f(yen, 6)
f(yen, 9)
print((dp[n]))
| def f(yen, coin, cnt=0):
while yen > 0: cnt += yen % coin; yen //= coin
return cnt
ans = n = int(eval(input()))
for yen6 in range(0, n+1):
ans = min(ans, f(n-yen6, 9, f(yen6, 6)))
print(ans)
| 13 | 8 | 237 | 205 | n = int(eval(input()))
dp = list(i for i in range(n + 1))
def f(yen, p):
c = p
while yen >= c:
dp[yen] = min(dp[yen], dp[yen - c] + 1)
c *= p
for yen in range(6, n + 1):
f(yen, 6)
f(yen, 9)
print((dp[n]))
| def f(yen, coin, cnt=0):
while yen > 0:
cnt += yen % coin
yen //= coin
return cnt
ans = n = int(eval(input()))
for yen6 in range(0, n + 1):
ans = min(ans, f(n - yen6, 9, f(yen6, 6)))
print(ans)
| false | 38.461538 | [
"-n = int(eval(input()))",
"-dp = list(i for i in range(n + 1))",
"+def f(yen, coin, cnt=0):",
"+ while yen > 0:",
"+ cnt += yen % coin",
"+ yen //= coin",
"+ return cnt",
"-def f(yen, p):",
"- c = p",
"- while yen >= c:",
"- dp[yen] = min(dp[yen], dp[yen - c] + ... | false | 0.12004 | 0.057202 | 2.098535 | [
"s036283075",
"s535538453"
] |
u989345508 | p02603 | python | s828291190 | s452257585 | 348 | 66 | 80,172 | 64,168 | Accepted | Accepted | 81.03 | #bottomかtopか
n=int(eval(input()))
a=list(map(int,input().split()))
an=[]
for i in range(1,n):
if a[i]>a[i-1]:
an.append(a[i-1])
if i==n-1:
an.append(a[i])
break
pm=0
for j in range(i+1,n):
#print(pm)
if pm==0:
if a[j]>=a[j-1]:
if j==n-1:... | n=int(eval(input()))
a=list(map(int,input().split()))
dp=[0]*n
dp[0]=1000
for i in range(1,n):
dp[i]=dp[i-1]
for j in range(i):
dp[i]=max(dp[i],(dp[j]//a[j])*a[i]+dp[j]%a[j])
print((dp[n-1])) | 40 | 9 | 784 | 207 | # bottomかtopか
n = int(eval(input()))
a = list(map(int, input().split()))
an = []
for i in range(1, n):
if a[i] > a[i - 1]:
an.append(a[i - 1])
if i == n - 1:
an.append(a[i])
break
pm = 0
for j in range(i + 1, n):
# print(pm)
if pm == 0:
if a[j] >= a[j - 1]:
... | n = int(eval(input()))
a = list(map(int, input().split()))
dp = [0] * n
dp[0] = 1000
for i in range(1, n):
dp[i] = dp[i - 1]
for j in range(i):
dp[i] = max(dp[i], (dp[j] // a[j]) * a[i] + dp[j] % a[j])
print((dp[n - 1]))
| false | 77.5 | [
"-# bottomかtopか",
"-an = []",
"+dp = [0] * n",
"+dp[0] = 1000",
"- if a[i] > a[i - 1]:",
"- an.append(a[i - 1])",
"- if i == n - 1:",
"- an.append(a[i])",
"- break",
"-pm = 0",
"-for j in range(i + 1, n):",
"- # print(pm)",
"- if pm == 0:",
"- ... | false | 0.041061 | 0.034478 | 1.190957 | [
"s828291190",
"s452257585"
] |
u633068244 | p00637 | python | s802954556 | s979893375 | 20 | 10 | 4,244 | 4,228 | Accepted | Accepted | 50 | while 1:
n=eval(input())
if n==0:break
p=list(map(int,input().split()))
sp=p[0]
ans=[]
for i in range(n-1):
if p[i]+1!=p[i+1]:
if sp!=p[i]:
ans.append(str(sp)+"-"+str(p[i]))
else:
ans.append(str(sp))
sp=p[i+1]
else:
if sp!=p[-1]:
ans.append(str(sp)+"-"+str(p[-1]))
else:
... | while 1:
n=eval(input())
if n==0:break
p=list(map(int,input().split()))+["end"]
sp=p[0]
ans=[]
for i in range(n):
if p[i]+1!=p[i+1]:
if sp!=p[i]:
ans.append(str(sp)+"-"+str(p[i]))
else:
ans.append(str(sp))
sp=p[i+1]
print(" ".join(ans)) | 19 | 14 | 357 | 266 | while 1:
n = eval(input())
if n == 0:
break
p = list(map(int, input().split()))
sp = p[0]
ans = []
for i in range(n - 1):
if p[i] + 1 != p[i + 1]:
if sp != p[i]:
ans.append(str(sp) + "-" + str(p[i]))
else:
ans.append(str(sp)... | while 1:
n = eval(input())
if n == 0:
break
p = list(map(int, input().split())) + ["end"]
sp = p[0]
ans = []
for i in range(n):
if p[i] + 1 != p[i + 1]:
if sp != p[i]:
ans.append(str(sp) + "-" + str(p[i]))
else:
ans.append(s... | false | 26.315789 | [
"- p = list(map(int, input().split()))",
"+ p = list(map(int, input().split())) + [\"end\"]",
"- for i in range(n - 1):",
"+ for i in range(n):",
"- else:",
"- if sp != p[-1]:",
"- ans.append(str(sp) + \"-\" + str(p[-1]))",
"- else:",
"- ans.append(... | false | 0.039112 | 0.038267 | 1.022079 | [
"s802954556",
"s979893375"
] |
u492605584 | p03363 | python | s755846340 | s849783087 | 897 | 354 | 111,440 | 111,440 | Accepted | Accepted | 60.54 | from math import factorial as f
L = [0]
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
dic = {}
dic[0] = 1
for i in range(N):
n = L[-1] + A[i]
L.append(n)
dic.setdefault(n, 0)
dic[n] += 1
for key in list(dic.keys()):
if dic[key] > 1:
cnt += f(dic[key]) // f(... | L = [0]
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
dic = {}
dic[0] = 1
for i in range(N):
n = L[-1] + A[i]
L.append(n)
dic.setdefault(n, 0)
dic[n] += 1
for key in list(dic.keys()):
n = dic[key]
if n > 1:
cnt += n * (n - 1) // 2
print((int(cnt))) | 16 | 16 | 346 | 302 | from math import factorial as f
L = [0]
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
dic = {}
dic[0] = 1
for i in range(N):
n = L[-1] + A[i]
L.append(n)
dic.setdefault(n, 0)
dic[n] += 1
for key in list(dic.keys()):
if dic[key] > 1:
cnt += f(dic[key]) // f(2) // f(dic[k... | L = [0]
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
dic = {}
dic[0] = 1
for i in range(N):
n = L[-1] + A[i]
L.append(n)
dic.setdefault(n, 0)
dic[n] += 1
for key in list(dic.keys()):
n = dic[key]
if n > 1:
cnt += n * (n - 1) // 2
print((int(cnt)))
| false | 0 | [
"-from math import factorial as f",
"-",
"- if dic[key] > 1:",
"- cnt += f(dic[key]) // f(2) // f(dic[key] - 2)",
"+ n = dic[key]",
"+ if n > 1:",
"+ cnt += n * (n - 1) // 2"
] | false | 0.055591 | 0.035298 | 1.574891 | [
"s755846340",
"s849783087"
] |
u474162944 | p02600 | python | s884222573 | s382824508 | 31 | 25 | 8,848 | 9,160 | Accepted | Accepted | 19.35 | x = int(eval(input()))
if 400 <= x <= 599:
print ("8")
if 600 <= x <= 799:
print ("7")
if 800 <= x <= 999:
print ("6")
if 1000 <= x <= 1199:
print ("5")
if 1200 <= x <= 1399:
print ("4")
if 1400 <= x <= 1599:
print ("3")
if 1600 <= x <= 1799:
print ("2")
if 1800 <= x <= 1999:
... | x = int(eval(input()))
for i in range(2,10):
if i <= x/200 < i+1:
print((10-i)) | 17 | 4 | 331 | 86 | x = int(eval(input()))
if 400 <= x <= 599:
print("8")
if 600 <= x <= 799:
print("7")
if 800 <= x <= 999:
print("6")
if 1000 <= x <= 1199:
print("5")
if 1200 <= x <= 1399:
print("4")
if 1400 <= x <= 1599:
print("3")
if 1600 <= x <= 1799:
print("2")
if 1800 <= x <= 1999:
print("1")
| x = int(eval(input()))
for i in range(2, 10):
if i <= x / 200 < i + 1:
print((10 - i))
| false | 76.470588 | [
"-if 400 <= x <= 599:",
"- print(\"8\")",
"-if 600 <= x <= 799:",
"- print(\"7\")",
"-if 800 <= x <= 999:",
"- print(\"6\")",
"-if 1000 <= x <= 1199:",
"- print(\"5\")",
"-if 1200 <= x <= 1399:",
"- print(\"4\")",
"-if 1400 <= x <= 1599:",
"- print(\"3\")",
"-if 1600 <= x <... | false | 0.091896 | 0.11207 | 0.819985 | [
"s884222573",
"s382824508"
] |
u297574184 | p03045 | python | s640067822 | s410937880 | 609 | 559 | 13,932 | 13,932 | Accepted | Accepted | 8.21 | # Union-Findデータ構造
class UnionFind:
def __init__(self, numV):
self.pars = list(range(numV))
self.ranks = [0] * numV
def find(self, x):
if self.pars[x] == x: return x
else:
self.pars[x] = self.find(self.pars[x])
return self.pars[x]
def union(se... | class UnionFind:
def __init__(self, numV):
self.pars = list(range(numV))
self.ranks = [0] * numV
def getRoot(self, x):
par = self.pars[x]
if par != x:
self.pars[x] = par = self.getRoot(par)
return par
def merge(self, x, y):
x, y = self.ge... | 35 | 36 | 904 | 969 | # Union-Findデータ構造
class UnionFind:
def __init__(self, numV):
self.pars = list(range(numV))
self.ranks = [0] * numV
def find(self, x):
if self.pars[x] == x:
return x
else:
self.pars[x] = self.find(self.pars[x])
return self.pars[x]
def unio... | class UnionFind:
def __init__(self, numV):
self.pars = list(range(numV))
self.ranks = [0] * numV
def getRoot(self, x):
par = self.pars[x]
if par != x:
self.pars[x] = par = self.getRoot(par)
return par
def merge(self, x, y):
x, y = self.getRoot(x)... | false | 2.777778 | [
"-# Union-Findデータ構造",
"- def find(self, x):",
"- if self.pars[x] == x:",
"- return x",
"- else:",
"- self.pars[x] = self.find(self.pars[x])",
"- return self.pars[x]",
"+ def getRoot(self, x):",
"+ par = self.pars[x]",
"+ if par != ... | false | 0.038284 | 0.038262 | 1.000559 | [
"s640067822",
"s410937880"
] |
u955125992 | p02768 | python | s342197199 | s148833171 | 179 | 101 | 3,064 | 3,064 | Accepted | Accepted | 43.58 | n, a, b = list(map(int, input().split()))
mod = 10 ** 9 + 7
if n == 2:
print((0))
exit()
S = pow(2, n, mod) -1
x1 = 1
y1 = 1
for i in range(a):
x1 = x1 * (n-i) % mod
y1 = y1 * (i+1) % mod
A = (x1 * pow(y1, mod - 2, mod)) % mod
x2 = 1
y2 = 1
for i in range(b):
x2 =... | n, a, b = list(map(int, input().split()))
mod = 10 ** 9 + 7
if n == 2:
print((0))
exit()
S = pow(2, n, mod) - 1
x1 = 1
y1 = 1
for i in range(a):
x1 = x1 * (n-i) % mod
y1 = y1 * (i+1) % mod
A = (x1 * pow(y1, mod - 2, mod)) % mod
for i in range(a, b):
x1 = x1 * (n-i) %... | 25 | 23 | 422 | 409 | n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
if n == 2:
print((0))
exit()
S = pow(2, n, mod) - 1
x1 = 1
y1 = 1
for i in range(a):
x1 = x1 * (n - i) % mod
y1 = y1 * (i + 1) % mod
A = (x1 * pow(y1, mod - 2, mod)) % mod
x2 = 1
y2 = 1
for i in range(b):
x2 = x2 * (n - i) % mod
y2 = y2 *... | n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
if n == 2:
print((0))
exit()
S = pow(2, n, mod) - 1
x1 = 1
y1 = 1
for i in range(a):
x1 = x1 * (n - i) % mod
y1 = y1 * (i + 1) % mod
A = (x1 * pow(y1, mod - 2, mod)) % mod
for i in range(a, b):
x1 = x1 * (n - i) % mod
y1 = y1 * (i + 1) % ... | false | 8 | [
"-x2 = 1",
"-y2 = 1",
"-for i in range(b):",
"- x2 = x2 * (n - i) % mod",
"- y2 = y2 * (i + 1) % mod",
"-B = (x2 * pow(y2, mod - 2, mod)) % mod",
"+for i in range(a, b):",
"+ x1 = x1 * (n - i) % mod",
"+ y1 = y1 * (i + 1) % mod",
"+B = (x1 * pow(y1, mod - 2, mod)) % mod"
] | false | 0.112787 | 0.122446 | 0.921112 | [
"s342197199",
"s148833171"
] |
u123745130 | p03624 | python | s506572339 | s459864532 | 22 | 18 | 3,188 | 3,188 | Accepted | Accepted | 18.18 | l=set(i for i in "abcdefghijklmnopqrstuvwxyz")
n=set(j for j in eval(input()))
b=sorted(l-n)
print(("None" if b==[] else b[0])) | s=eval(input())
t=list(chr(i) for i in range(97,97+26))
bools=True
for i in t:
if i not in s:
print(i)
bools=False
break
if bools:print("None") | 4 | 9 | 122 | 161 | l = set(i for i in "abcdefghijklmnopqrstuvwxyz")
n = set(j for j in eval(input()))
b = sorted(l - n)
print(("None" if b == [] else b[0]))
| s = eval(input())
t = list(chr(i) for i in range(97, 97 + 26))
bools = True
for i in t:
if i not in s:
print(i)
bools = False
break
if bools:
print("None")
| false | 55.555556 | [
"-l = set(i for i in \"abcdefghijklmnopqrstuvwxyz\")",
"-n = set(j for j in eval(input()))",
"-b = sorted(l - n)",
"-print((\"None\" if b == [] else b[0]))",
"+s = eval(input())",
"+t = list(chr(i) for i in range(97, 97 + 26))",
"+bools = True",
"+for i in t:",
"+ if i not in s:",
"+ pri... | false | 0.048467 | 0.120283 | 0.402944 | [
"s506572339",
"s459864532"
] |
u886545507 | p03665 | python | s769668504 | s472398651 | 11 | 10 | 2,568 | 2,568 | Accepted | Accepted | 9.09 | #AGC017A
def f():
res=1
for x in a:
if x%2==0:
res*=1
else:
res=0
return res
return res
n,p=list(map(int,input().split()))
a=list(map(int,input().split()))
if f()==1 and p==0:
print(2**n)
elif f()==1 and p==1:
print(0)
else:
print(2**(n-1))
| def f():
for x in a:
if x%2==0:
continue
else:
return False
return True
n,p=list(map(int,input().split()))
a=list(map(int,input().split()))
if f()==True and p==0:
print(2**n)
elif f()==True and p==1:
print(0)
else:
print(2**(n-1))
| 21 | 17 | 276 | 257 | # AGC017A
def f():
res = 1
for x in a:
if x % 2 == 0:
res *= 1
else:
res = 0
return res
return res
n, p = list(map(int, input().split()))
a = list(map(int, input().split()))
if f() == 1 and p == 0:
print(2**n)
elif f() == 1 and p == 1:
print(0)
e... | def f():
for x in a:
if x % 2 == 0:
continue
else:
return False
return True
n, p = list(map(int, input().split()))
a = list(map(int, input().split()))
if f() == True and p == 0:
print(2**n)
elif f() == True and p == 1:
print(0)
else:
print(2 ** (n - 1))
| false | 19.047619 | [
"-# AGC017A",
"- res = 1",
"- res *= 1",
"+ continue",
"- res = 0",
"- return res",
"- return res",
"+ return False",
"+ return True",
"-if f() == 1 and p == 0:",
"+if f() == True and p == 0:",
"-elif f() == 1 and p == 1:",
"+el... | false | 0.042488 | 0.035966 | 1.181353 | [
"s769668504",
"s472398651"
] |
u269171164 | p03075 | python | s336659835 | s287314717 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | N = 6 #the number of the input data
a = [[int(i) for i in input().split()] for j in range(N)]
if a[N-2][0] - a[0][0] <= a[N-1][0]:
print("Yay!")
else:
print(":(") | N = 6
a = [int(eval(input())) for i in range(N)]
if a[4] - a[0] <= a[5]:
print("Yay!")
else:
print(":(") | 7 | 7 | 177 | 113 | N = 6 # the number of the input data
a = [[int(i) for i in input().split()] for j in range(N)]
if a[N - 2][0] - a[0][0] <= a[N - 1][0]:
print("Yay!")
else:
print(":(")
| N = 6
a = [int(eval(input())) for i in range(N)]
if a[4] - a[0] <= a[5]:
print("Yay!")
else:
print(":(")
| false | 0 | [
"-N = 6 # the number of the input data",
"-a = [[int(i) for i in input().split()] for j in range(N)]",
"-if a[N - 2][0] - a[0][0] <= a[N - 1][0]:",
"+N = 6",
"+a = [int(eval(input())) for i in range(N)]",
"+if a[4] - a[0] <= a[5]:"
] | false | 0.047883 | 0.048737 | 0.982461 | [
"s336659835",
"s287314717"
] |
u875291233 | p03660 | python | s799807013 | s239256587 | 568 | 373 | 109,488 | 29,364 | Accepted | Accepted | 34.33 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意
n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n-1):
a,b = [int(i) for i in readline().split()]
g[a-1].append(b-1)
g[b-1].append(a-1)
def dfs(v,p,path):
... | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意
n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n-1):
a,b = [int(i) for i in readline().split()]
g[a-1].append(b-1)
g[b-1].append(a-1)
"""
def dfs(v,p,path)... | 70 | 72 | 1,278 | 1,298 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline # 文字列入力のときは注意
n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n - 1):
a, b = [int(i) for i in readline().split()]
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
def dfs(v, p, path):
... | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline # 文字列入力のときは注意
n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n - 1):
a, b = [int(i) for i in readline().split()]
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
"""
def dfs(v,p,path):
... | false | 2.777778 | [
"+\"\"\"",
"+def dfs(v,p,path):",
"+ for c in g[v]:",
"+ if c == p: continue",
"+ if c == n-1:",
"+ path.append(n-1)",
"+ path.append(v)",
"+ return True",
"+ if dfs(c,v,path):",
"+ path.append(v)",
"+ return True",
... | false | 0.041683 | 0.039103 | 1.065975 | [
"s799807013",
"s239256587"
] |
u847467233 | p00121 | python | s523197921 | s969986380 | 670 | 170 | 9,220 | 9,012 | Accepted | Accepted | 74.63 | # AOJ 0121 Seven Puzzle
# Python 2017.6.23 bal4u
def swap(state, x, y):
s = list(copy.deepcopy(state))
s[x], s[y] = s[y], s[x]
return tuple(s)
from collections import deque
import copy
MAGIC = 37
move = ((1,4), (0,2,5), (1,3,6), (2,7), (0,5), (1,4,6), (2,5,7), (3,6))
Q = deque()
Q.append(((0,1,2,3... | # AOJ 0121 Seven Puzzle
# Python 2017.6.23 bal4u
def swap(state, x, y):
s = list(state)
s[x], s[y] = s[y], s[x]
return tuple(s)
from collections import deque
MAGIC = 37
move = ((1,4), (0,2,5), (1,3,6), (2,7), (0,5), (1,4,6), (2,5,7), (3,6))
Q = deque()
Q.append(((0,1,2,3,4,5,6,7), 0))
hash = {}
h... | 33 | 32 | 746 | 718 | # AOJ 0121 Seven Puzzle
# Python 2017.6.23 bal4u
def swap(state, x, y):
s = list(copy.deepcopy(state))
s[x], s[y] = s[y], s[x]
return tuple(s)
from collections import deque
import copy
MAGIC = 37
move = ((1, 4), (0, 2, 5), (1, 3, 6), (2, 7), (0, 5), (1, 4, 6), (2, 5, 7), (3, 6))
Q = deque()
Q.append(((0,... | # AOJ 0121 Seven Puzzle
# Python 2017.6.23 bal4u
def swap(state, x, y):
s = list(state)
s[x], s[y] = s[y], s[x]
return tuple(s)
from collections import deque
MAGIC = 37
move = ((1, 4), (0, 2, 5), (1, 3, 6), (2, 7), (0, 5), (1, 4, 6), (2, 5, 7), (3, 6))
Q = deque()
Q.append(((0, 1, 2, 3, 4, 5, 6, 7), 0))
... | false | 3.030303 | [
"- s = list(copy.deepcopy(state))",
"+ s = list(state)",
"-import copy"
] | false | 1.352581 | 0.096107 | 14.073745 | [
"s523197921",
"s969986380"
] |
u201928947 | p02768 | python | s498215386 | s957307848 | 126 | 68 | 9,188 | 63,632 | Accepted | Accepted | 46.03 | def cmb(a,b,c):
b = min(b,a-b)
num = 1
for i in range(b):
num = num*(n-i) % c
den = 1
for i in range(b):
den = den*(i+1) % c
return num*pow(den,-1,c) % c
mod = 10**9+7
n,a,b = list(map(int,input().split()))
ans = (pow(2,n,mod)-cmb(n,a,mod)-cmb(n,b,mod)-1) % mod
if an... | def cmb(a,b,c):
b = min(b,a-b)
num = 1
for i in range(b):
num = num*(n-i) % c
den = 1
for i in range(b):
den = den*(i+1) % c
return num*pow(den,c-2,c) % c
mod = 10**9+7
n,a,b = list(map(int,input().split()))
ans = (pow(2,n,mod)-cmb(n,a,mod)-cmb(n,b,mod)-1) % mod
if a... | 15 | 15 | 353 | 354 | def cmb(a, b, c):
b = min(b, a - b)
num = 1
for i in range(b):
num = num * (n - i) % c
den = 1
for i in range(b):
den = den * (i + 1) % c
return num * pow(den, -1, c) % c
mod = 10**9 + 7
n, a, b = list(map(int, input().split()))
ans = (pow(2, n, mod) - cmb(n, a, mod) - cmb(n, b... | def cmb(a, b, c):
b = min(b, a - b)
num = 1
for i in range(b):
num = num * (n - i) % c
den = 1
for i in range(b):
den = den * (i + 1) % c
return num * pow(den, c - 2, c) % c
mod = 10**9 + 7
n, a, b = list(map(int, input().split()))
ans = (pow(2, n, mod) - cmb(n, a, mod) - cmb(n... | false | 0 | [
"- return num * pow(den, -1, c) % c",
"+ return num * pow(den, c - 2, c) % c"
] | false | 0.221708 | 0.089792 | 2.469141 | [
"s498215386",
"s957307848"
] |
u626684023 | p02831 | python | s923362605 | s400106616 | 35 | 28 | 5,048 | 9,072 | Accepted | Accepted | 20 | import fractions
A, B = list(map(int, input().split()))
def lcm(A, B):
return (A * B) // fractions.gcd(A, B)
print((lcm(A, B))) | A, B = list(map(int, input().split()))
from math import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
print((lcm(A, B)))
| 9 | 8 | 135 | 128 | import fractions
A, B = list(map(int, input().split()))
def lcm(A, B):
return (A * B) // fractions.gcd(A, B)
print((lcm(A, B)))
| A, B = list(map(int, input().split()))
from math import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
print((lcm(A, B)))
| false | 11.111111 | [
"-import fractions",
"-",
"+from math import gcd",
"-def lcm(A, B):",
"- return (A * B) // fractions.gcd(A, B)",
"+def lcm(x, y):",
"+ return (x * y) // gcd(x, y)"
] | false | 0.05386 | 0.04634 | 1.162276 | [
"s923362605",
"s400106616"
] |
u724687935 | p03329 | python | s619107903 | s633763972 | 332 | 240 | 2,940 | 41,708 | Accepted | Accepted | 27.71 | N = int(eval(input()))
ans = N + 1
for t in range(N + 1):
cnt = 0
v6 = t
while v6 > 0:
cnt += v6 % 6
v6 //= 6
v9 = N - t
while v9 > 0:
cnt += v9 % 9
v9 //= 9
ans = min(ans, cnt)
print(ans)
| N = int(eval(input()))
ans = N
for v9 in range(N + 1):
cnt = 0
t = v9
w = 9 ** 5
while t >= 9:
if t >= w:
cnt9, t = divmod(t, w)
cnt += cnt9
w //= 9
t = N - (v9 - t)
w = 6 ** 7
while t >= 6:
if t >= w:
cnt6, t = div... | 16 | 22 | 256 | 409 | N = int(eval(input()))
ans = N + 1
for t in range(N + 1):
cnt = 0
v6 = t
while v6 > 0:
cnt += v6 % 6
v6 //= 6
v9 = N - t
while v9 > 0:
cnt += v9 % 9
v9 //= 9
ans = min(ans, cnt)
print(ans)
| N = int(eval(input()))
ans = N
for v9 in range(N + 1):
cnt = 0
t = v9
w = 9**5
while t >= 9:
if t >= w:
cnt9, t = divmod(t, w)
cnt += cnt9
w //= 9
t = N - (v9 - t)
w = 6**7
while t >= 6:
if t >= w:
cnt6, t = divmod(t, w)
... | false | 27.272727 | [
"-ans = N + 1",
"-for t in range(N + 1):",
"+ans = N",
"+for v9 in range(N + 1):",
"- v6 = t",
"- while v6 > 0:",
"- cnt += v6 % 6",
"- v6 //= 6",
"- v9 = N - t",
"- while v9 > 0:",
"- cnt += v9 % 9",
"- v9 //= 9",
"- ans = min(ans, cnt)",
"+ t... | false | 0.069726 | 0.107972 | 0.645777 | [
"s619107903",
"s633763972"
] |
u268981216 | p02820 | python | s950881264 | s378899422 | 598 | 47 | 3,436 | 4,084 | Accepted | Accepted | 92.14 | n,k = list(map(int,input().split()))
r,s,p = list(map(int,input().split()))
st=eval(input())
for i in range(len(st)-1):
if i + k > len(st)-1:
break
elif st[i] == st[i+k]:
st = st[:i+k]+'n'+st[i+k+1:]
win = r*st.count('s')+s*st.count('p')+p*st.count('r')
print(win) | n,k = list(map(int, input().split()))
r,s,p = list(map(int, input().split()))
st=list(eval(input()))
for i in range(n-k):
if st[i] == st[i+k]:
st[i+k] = 'no'
win = r*st.count('s')+s*st.count('p')+p*st.count('r')
print(win) | 10 | 8 | 279 | 223 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
st = eval(input())
for i in range(len(st) - 1):
if i + k > len(st) - 1:
break
elif st[i] == st[i + k]:
st = st[: i + k] + "n" + st[i + k + 1 :]
win = r * st.count("s") + s * st.count("p") + p * st.count("r")
print(w... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
st = list(eval(input()))
for i in range(n - k):
if st[i] == st[i + k]:
st[i + k] = "no"
win = r * st.count("s") + s * st.count("p") + p * st.count("r")
print(win)
| false | 20 | [
"-st = eval(input())",
"-for i in range(len(st) - 1):",
"- if i + k > len(st) - 1:",
"- break",
"- elif st[i] == st[i + k]:",
"- st = st[: i + k] + \"n\" + st[i + k + 1 :]",
"+st = list(eval(input()))",
"+for i in range(n - k):",
"+ if st[i] == st[i + k]:",
"+ st[i + ... | false | 0.04551 | 0.042021 | 1.083049 | [
"s950881264",
"s378899422"
] |
u203843959 | p03722 | python | s336600294 | s212885999 | 649 | 397 | 4,340 | 4,212 | Accepted | Accepted | 38.83 | import sys
sys.setrecursionlimit(10**9)
N,M=list(map(int,input().split()))
def find_negative_loop(n,w,es):
dist=[float("inf")]*n
#この始点はどこでもよい
dist[1]=0
for i in range(n):
for j in range(w):
e=es[j]
if dist[e[1]]>dist[e[0]]+e[2]:
dist[e[1]]=dist[e[0]]+e[2]
if i==... | import sys
sys.setrecursionlimit(10**9)
N,M=list(map(int,input().split()))
def find_negative_loop(n,w,es):
dist=[float("inf")]*n
#この始点はどこでもよい
dist[1]=0
for i in range(n):
for j in range(w):
e=es[j]
if dist[e[1]]>dist[e[0]]+e[2]:
dist[e[1]]=dist[e[0]]+e[2]
if i==... | 87 | 88 | 1,710 | 1,734 | import sys
sys.setrecursionlimit(10**9)
N, M = list(map(int, input().split()))
def find_negative_loop(n, w, es):
dist = [float("inf")] * n
# この始点はどこでもよい
dist[1] = 0
for i in range(n):
for j in range(w):
e = es[j]
if dist[e[1]] > dist[e[0]] + e[2]:
dist[... | import sys
sys.setrecursionlimit(10**9)
N, M = list(map(int, input().split()))
def find_negative_loop(n, w, es):
dist = [float("inf")] * n
# この始点はどこでもよい
dist[1] = 0
for i in range(n):
for j in range(w):
e = es[j]
if dist[e[1]] > dist[e[0]] + e[2]:
dist[... | false | 1.136364 | [
"+ reachable[u] = False"
] | false | 0.048873 | 0.083407 | 0.58596 | [
"s336600294",
"s212885999"
] |
u855694108 | p00019 | python | s402924161 | s128594025 | 30 | 20 | 7,536 | 5,584 | Accepted | Accepted | 33.33 | def main():
n = int(eval(input()))
for x in range(1, n):
n *= x
print(n)
if __name__ == "__main__":
main() | n = int(eval(input()))
ans = 1
for i in range(1, n + 1):
ans *= i
print(ans)
| 9 | 5 | 134 | 79 | def main():
n = int(eval(input()))
for x in range(1, n):
n *= x
print(n)
if __name__ == "__main__":
main()
| n = int(eval(input()))
ans = 1
for i in range(1, n + 1):
ans *= i
print(ans)
| false | 44.444444 | [
"-def main():",
"- n = int(eval(input()))",
"- for x in range(1, n):",
"- n *= x",
"- print(n)",
"-",
"-",
"-if __name__ == \"__main__\":",
"- main()",
"+n = int(eval(input()))",
"+ans = 1",
"+for i in range(1, n + 1):",
"+ ans *= i",
"+print(ans)"
] | false | 0.040721 | 0.040372 | 1.00863 | [
"s402924161",
"s128594025"
] |
u296518383 | p02821 | python | s042346022 | s545600169 | 1,529 | 1,046 | 59,384 | 59,392 | Accepted | Accepted | 31.59 | from bisect import bisect_left
from itertools import accumulate
N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
Acum = [0] + list(accumulate(A))
left = 0
right = 10 ** 10 + 1
while left + 1 < right:
mid = (left + right) // 2
tmp = 0
for i in range(N):
bi =... | from bisect import bisect_left
from itertools import accumulate
N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
Acum = [0] + list(accumulate(A))
left = 0
right = max(A) * 2 + 1
while left + 1 < right:
mid = (left + right) // 2
tmp = 0
for i in range(N):
bi... | 30 | 30 | 601 | 603 | from bisect import bisect_left
from itertools import accumulate
N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
Acum = [0] + list(accumulate(A))
left = 0
right = 10**10 + 1
while left + 1 < right:
mid = (left + right) // 2
tmp = 0
for i in range(N):
bi = bisect_le... | from bisect import bisect_left
from itertools import accumulate
N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
Acum = [0] + list(accumulate(A))
left = 0
right = max(A) * 2 + 1
while left + 1 < right:
mid = (left + right) // 2
tmp = 0
for i in range(N):
bi = bisec... | false | 0 | [
"-right = 10**10 + 1",
"+right = max(A) * 2 + 1"
] | false | 0.18527 | 0.041236 | 4.492878 | [
"s042346022",
"s545600169"
] |
u887207211 | p02953 | python | s395909255 | s619205439 | 82 | 70 | 14,396 | 14,340 | Accepted | Accepted | 14.63 | N = int(eval(input()))
H = list(map(int,input().split()))
for i in range(N-1, 1, -1):
if H[i] >= H[i-1]:
continue
if H[i] < H[i-1]:
if H[i - 1] - 1 == H[i]:
H[i - 1] -= 1
else:
print("No")
exit()
print("Yes") | import sys
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
def main():
n = ni()
a = na()
for i in range(n - 1, 1, -1):
if a[i] > a[i - 1]:
continue
if a[i] < a[i - 1]:
if a[i] == a[i - ... | 13 | 25 | 249 | 463 | N = int(eval(input()))
H = list(map(int, input().split()))
for i in range(N - 1, 1, -1):
if H[i] >= H[i - 1]:
continue
if H[i] < H[i - 1]:
if H[i - 1] - 1 == H[i]:
H[i - 1] -= 1
else:
print("No")
exit()
print("Yes")
| import sys
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
def main():
n = ni()
a = na()
for i in range(n - 1, 1, -1):
if a[i] > a[i - 1]:
continue
if a[i] < a[i - 1]:
if a[i] == ... | false | 48 | [
"-N = int(eval(input()))",
"-H = list(map(int, input().split()))",
"-for i in range(N - 1, 1, -1):",
"- if H[i] >= H[i - 1]:",
"- continue",
"- if H[i] < H[i - 1]:",
"- if H[i - 1] - 1 == H[i]:",
"- H[i - 1] -= 1",
"- else:",
"- print(\"No\")",
"-... | false | 0.048349 | 0.04697 | 1.029358 | [
"s395909255",
"s619205439"
] |
u191874006 | p03409 | python | s225023954 | s761855170 | 197 | 178 | 39,280 | 39,148 | Accepted | Accepted | 9.64 | #!/usr/bin/env python3
#ABC91 C
from operator import itemgetter
n = int(eval(input()))
red = [list(map(int,input().split())) for _ in range(n)]
blue = [list(map(int,input().split())) for _ in range(n)]
red = sorted(red,key = itemgetter(1),reverse = True)
blue = sorted(blue,key = itemgetter(0))
checkr = [True]... | #!/usr/bin/env python3
import sys
import math
import bisect
import time
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import i... | 21 | 38 | 541 | 954 | #!/usr/bin/env python3
# ABC91 C
from operator import itemgetter
n = int(eval(input()))
red = [list(map(int, input().split())) for _ in range(n)]
blue = [list(map(int, input().split())) for _ in range(n)]
red = sorted(red, key=itemgetter(1), reverse=True)
blue = sorted(blue, key=itemgetter(0))
checkr = [True] * n
chec... | #!/usr/bin/env python3
import sys
import math
import bisect
import time
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
f... | false | 44.736842 | [
"-# ABC91 C",
"+import sys",
"+import math",
"+import bisect",
"+import time",
"+",
"+sys.setrecursionlimit(1000000000)",
"+from heapq import heappush, heappop, heappushpop",
"+from collections import defaultdict",
"+from itertools import accumulate",
"+from collections import Counter",
"+from... | false | 0.038047 | 0.037506 | 1.014427 | [
"s225023954",
"s761855170"
] |
u315078622 | p03428 | python | s267558358 | s040855127 | 266 | 183 | 20,136 | 16,940 | Accepted | Accepted | 31.2 | import numpy as np
from scipy.spatial import ConvexHull
from scipy.spatial.qhull import QhullError
from scipy.spatial.distance import cosine
def main(points):
ans = [0.0] * N
try:
hull = ConvexHull(np.asarray(points))
except QhullError:
ans[points.index(min(points))] = ans[point... | import numpy as np
from scipy.spatial import ConvexHull
from scipy.spatial.qhull import QhullError
from numpy.linalg import norm
def main():
N = int(input())
points = []
for _ in range(N):
x, y = map(int, input().split())
points.append([x, y])
ans = np.zeros(N)
try:
... | 31 | 33 | 902 | 935 | import numpy as np
from scipy.spatial import ConvexHull
from scipy.spatial.qhull import QhullError
from scipy.spatial.distance import cosine
def main(points):
ans = [0.0] * N
try:
hull = ConvexHull(np.asarray(points))
except QhullError:
ans[points.index(min(points))] = ans[points.index(max... | import numpy as np
from scipy.spatial import ConvexHull
from scipy.spatial.qhull import QhullError
from numpy.linalg import norm
def main():
N = int(input())
points = []
for _ in range(N):
x, y = map(int, input().split())
points.append([x, y])
ans = np.zeros(N)
try:
hull = ... | false | 6.060606 | [
"-from scipy.spatial.distance import cosine",
"+from numpy.linalg import norm",
"-def main(points):",
"- ans = [0.0] * N",
"- try:",
"- hull = ConvexHull(np.asarray(points))",
"- except QhullError:",
"- ans[points.index(min(points))] = ans[points.index(max(points))] = 0.5",
"-... | false | 1.196998 | 0.763049 | 1.568703 | [
"s267558358",
"s040855127"
] |
u413165887 | p02837 | python | s767652108 | s639610594 | 1,929 | 340 | 3,064 | 3,444 | Accepted | Accepted | 82.37 | import sys
n = int(eval(input()))
a = [[-1 for _ in range(n)] for _ in range(n)]
for i in range(n):
j = int(eval(input()))
for s in range(j):
x, y = list(map(int, input().split()))
a[i][x-1] = y
r = 0
for i in range(2**n):
s = bin(i)
t = s[2:]
t = t.rjust(n, '0')
c =... | n = int(eval(input()))
a = []
for i in range(n):
a_ = int(eval(input()))
a.append([list(map(int, input().split())) for _ in range(a_)])
result = [0]
for i in range(1, 2**n):
h = format(i, "0"+str(n)+"b")
c = [int(j) for j in list(h)]
checker = True
for j in range(n):
if c[j]... | 27 | 20 | 685 | 507 | import sys
n = int(eval(input()))
a = [[-1 for _ in range(n)] for _ in range(n)]
for i in range(n):
j = int(eval(input()))
for s in range(j):
x, y = list(map(int, input().split()))
a[i][x - 1] = y
r = 0
for i in range(2**n):
s = bin(i)
t = s[2:]
t = t.rjust(n, "0")
c = 1
for... | n = int(eval(input()))
a = []
for i in range(n):
a_ = int(eval(input()))
a.append([list(map(int, input().split())) for _ in range(a_)])
result = [0]
for i in range(1, 2**n):
h = format(i, "0" + str(n) + "b")
c = [int(j) for j in list(h)]
checker = True
for j in range(n):
if c[j]:
... | false | 25.925926 | [
"-import sys",
"-",
"-a = [[-1 for _ in range(n)] for _ in range(n)]",
"+a = []",
"- j = int(eval(input()))",
"- for s in range(j):",
"- x, y = list(map(int, input().split()))",
"- a[i][x - 1] = y",
"-r = 0",
"-for i in range(2**n):",
"- s = bin(i)",
"- t = s[2:]",
... | false | 0.037585 | 0.076996 | 0.488146 | [
"s767652108",
"s639610594"
] |
u430223993 | p03281 | python | s610657866 | s153477634 | 19 | 17 | 3,060 | 3,188 | Accepted | Accepted | 10.53 | n = int(eval(input()))
int_list = []
for i in range(1,n+1,2):
num = 0
for j in range(1, i + 1):
if i % j == 0:
num += 1
if num == 8:
int_list.append(i)
print((len(int_list))) | import sys
n = int(eval(input()))
if n <= 3:
print((3))
sys.exit()
def check(a):
sqrt = round(a ** 0.5 + 0.5)
factors = {1, a}
for i in range(2, sqrt + 1):
if not a % i:
if not i in factors:
factors.add(i)
j = a // i
if not j i... | 10 | 21 | 215 | 471 | n = int(eval(input()))
int_list = []
for i in range(1, n + 1, 2):
num = 0
for j in range(1, i + 1):
if i % j == 0:
num += 1
if num == 8:
int_list.append(i)
print((len(int_list)))
| import sys
n = int(eval(input()))
if n <= 3:
print((3))
sys.exit()
def check(a):
sqrt = round(a**0.5 + 0.5)
factors = {1, a}
for i in range(2, sqrt + 1):
if not a % i:
if not i in factors:
factors.add(i)
j = a // i
if not j in factors:
... | false | 52.380952 | [
"+import sys",
"+",
"-int_list = []",
"-for i in range(1, n + 1, 2):",
"- num = 0",
"- for j in range(1, i + 1):",
"- if i % j == 0:",
"- num += 1",
"- if num == 8:",
"- int_list.append(i)",
"-print((len(int_list)))",
"+if n <= 3:",
"+ print((3))",
"+ ... | false | 0.079925 | 0.072671 | 1.099822 | [
"s610657866",
"s153477634"
] |
u067677727 | p02239 | python | s250531564 | s475976624 | 2,780 | 20 | 8,136 | 7,772 | Accepted | Accepted | 99.28 | # -*- coding: utf-8 -*-
def BFS(adj, start):
n = len(adj)
d = [n] * n
flag = [0... | n = int(eval(input()))
adj = [None]
for i in range(n):
adj_i = list(map(int, input().split()[2:]))
adj.append(adj_i)
isSearched = [None] + [False] * n
distance = [None] + [-1] * n
def bfs(u):
d = 0
isSearched[u] = True
distance[u] = d
edge = [u]
while edge:
q... | 46 | 32 | 1,203 | 662 | # -*- coding: utf-8 -*-
def BFS(adj, start):
n = len(adj)
d = [n] * n
flag = [0] * n
Q = []
Q.append(start)
d[start] = 0
while len(Q) != 0:
u = Q.pop(0)
v = [
i for i, x in enumerate(adj[u]) if (x == 1) and (flag[i] == 0)
] # v <= ??£??\??????????????????... | n = int(eval(input()))
adj = [None]
for i in range(n):
adj_i = list(map(int, input().split()[2:]))
adj.append(adj_i)
isSearched = [None] + [False] * n
distance = [None] + [-1] * n
def bfs(u):
d = 0
isSearched[u] = True
distance[u] = d
edge = [u]
while edge:
q = list(edge)
e... | false | 30.434783 | [
"-# -*- coding: utf-8 -*-",
"-def BFS(adj, start):",
"- n = len(adj)",
"- d = [n] * n",
"- flag = [0] * n",
"- Q = []",
"- Q.append(start)",
"- d[start] = 0",
"- while len(Q) != 0:",
"- u = Q.pop(0)",
"- v = [",
"- i for i, x in enumerate(adj[u]) i... | false | 0.048556 | 0.041205 | 1.178405 | [
"s250531564",
"s475976624"
] |
u144913062 | p02804 | python | s226446621 | s631432278 | 550 | 280 | 15,000 | 59,248 | Accepted | Accepted | 49.09 | def mod_inverse(n, mod=10**9+7):
return pow(n, mod-2, mod)
mod = 10**9+7
N, K = list(map(int, input().split()))
A = [0] + sorted(list(map(int, input().split())))
factorial = [1] * (N+1)
factorial_inv = [1] * (N+1)
for i in range(1, N+1):
factorial[i] = factorial[i-1] * i % mod
factorial_inv... | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
fact = [1] * (N+1)
fact_inv = [1] * (N+1)
for i in range(1, N+1):
fact[i] = i * fact[i-1] % mod
fact_inv[N] = pow(fact[N], mod-2, mod)
for i in range(1, N+1)[::-1]:
fac... | 22 | 25 | 608 | 635 | def mod_inverse(n, mod=10**9 + 7):
return pow(n, mod - 2, mod)
mod = 10**9 + 7
N, K = list(map(int, input().split()))
A = [0] + sorted(list(map(int, input().split())))
factorial = [1] * (N + 1)
factorial_inv = [1] * (N + 1)
for i in range(1, N + 1):
factorial[i] = factorial[i - 1] * i % mod
factorial_inv[... | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
fact = [1] * (N + 1)
fact_inv = [1] * (N + 1)
for i in range(1, N + 1):
fact[i] = i * fact[i - 1] % mod
fact_inv[N] = pow(fact[N], mod - 2, mod)
for i in range(1, N + 1)[::-1]:
fact_... | false | 12 | [
"-def mod_inverse(n, mod=10**9 + 7):",
"- return pow(n, mod - 2, mod)",
"+import sys",
"-",
"+input = sys.stdin.readline",
"+N, K = list(map(int, input().split()))",
"+A = list(map(int, input().split()))",
"-N, K = list(map(int, input().split()))",
"-A = [0] + sorted(list(map(int, input().split()... | false | 0.047347 | 0.071182 | 0.665158 | [
"s226446621",
"s631432278"
] |
u970109776 | p03294 | python | s512647149 | s825357233 | 31 | 27 | 9,304 | 9,360 | Accepted | Accepted | 12.9 | #coding: utf-8
N = eval(input())
A = [int(x) for x in input().split()]
print((sum(x-1 for x in A)))
| N = eval(input())
print((sum(int(x)-1 for x in input().split())))
| 6 | 2 | 99 | 59 | # coding: utf-8
N = eval(input())
A = [int(x) for x in input().split()]
print((sum(x - 1 for x in A)))
| N = eval(input())
print((sum(int(x) - 1 for x in input().split())))
| false | 66.666667 | [
"-# coding: utf-8",
"-A = [int(x) for x in input().split()]",
"-print((sum(x - 1 for x in A)))",
"+print((sum(int(x) - 1 for x in input().split())))"
] | false | 0.036295 | 0.033521 | 1.082747 | [
"s512647149",
"s825357233"
] |
u790877102 | p03495 | python | s611231706 | s898884140 | 350 | 184 | 101,576 | 42,492 | Accepted | Accepted | 47.43 | import collections
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
a = collections.Counter(a)
a = a.most_common()
if k<len(a):
x = 0
for i in range(k,len(a)):
x += a[i][1]
print(x)
else:
print((0))
| import collections
n,k = list(map(int,input().split()))
a = list(input().split())
a = collections.Counter(a)
a = a.most_common()
if k<len(a):
x = 0
for i in range(k,len(a)):
x += a[i][1]
print(x)
else:
print((0))
| 17 | 17 | 241 | 232 | import collections
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = collections.Counter(a)
a = a.most_common()
if k < len(a):
x = 0
for i in range(k, len(a)):
x += a[i][1]
print(x)
else:
print((0))
| import collections
n, k = list(map(int, input().split()))
a = list(input().split())
a = collections.Counter(a)
a = a.most_common()
if k < len(a):
x = 0
for i in range(k, len(a)):
x += a[i][1]
print(x)
else:
print((0))
| false | 0 | [
"-a = list(map(int, input().split()))",
"+a = list(input().split())"
] | false | 0.045518 | 0.041469 | 1.097648 | [
"s611231706",
"s898884140"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.