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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u363610900 | p03610 | python | s674771984 | s418936264 | 29 | 21 | 4,268 | 4,268 | Accepted | Accepted | 27.59 | s = list(eval(input()))
ans = ''
for j in s[0:len(s):2]:
ans += j
print(ans) | s = list(eval(input()))
print((''.join(s[::2]))) | 5 | 2 | 78 | 41 | s = list(eval(input()))
ans = ""
for j in s[0 : len(s) : 2]:
ans += j
print(ans)
| s = list(eval(input()))
print(("".join(s[::2])))
| false | 60 | [
"-ans = \"\"",
"-for j in s[0 : len(s) : 2]:",
"- ans += j",
"-print(ans)",
"+print((\"\".join(s[::2])))"
] | false | 0.039113 | 0.039199 | 0.997818 | [
"s674771984",
"s418936264"
] |
u608088992 | p03213 | python | s800907596 | s272203257 | 29 | 21 | 3,188 | 3,316 | Accepted | Accepted | 27.59 | N = int(eval(input()))
lim = 1
for i in range(N): lim *= (i+1)
Prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47,\
53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
Ans = 0
for i in range(23):
for j in range(i+1, 24):
for k in range(j+1, 25):
a, b, c = Prime[i], Prime[j], Prim... | import sys
from collections import defaultdict
def solve():
input = sys.stdin.readline
N = int(eval(input()))
primes = defaultdict(int)
ans = 0
for i in range(1, N + 1):
k = i
for j in range(2, i+1):
if j ** 2 > i: break
if k % j == 0:
... | 26 | 42 | 1,013 | 1,100 | N = int(eval(input()))
lim = 1
for i in range(N):
lim *= i + 1
Prime = [
2,
3,
5,
7,
11,
13,
17,
19,
23,
29,
31,
37,
41,
43,
47,
53,
59,
61,
67,
71,
73,
79,
83,
89,
97,
]
Ans = 0
for i in range(23):
for j in rang... | import sys
from collections import defaultdict
def solve():
input = sys.stdin.readline
N = int(eval(input()))
primes = defaultdict(int)
ans = 0
for i in range(1, N + 1):
k = i
for j in range(2, i + 1):
if j**2 > i:
break
if k % j == 0:
... | false | 38.095238 | [
"-N = int(eval(input()))",
"-lim = 1",
"-for i in range(N):",
"- lim *= i + 1",
"-Prime = [",
"- 2,",
"- 3,",
"- 5,",
"- 7,",
"- 11,",
"- 13,",
"- 17,",
"- 19,",
"- 23,",
"- 29,",
"- 31,",
"- 37,",
"- 41,",
"- 43,",
"- 47,",
"- ... | false | 0.047695 | 0.040138 | 1.18827 | [
"s800907596",
"s272203257"
] |
u437351386 | p03044 | python | s925544461 | s699928289 | 708 | 564 | 84,432 | 181,980 | Accepted | Accepted | 20.34 | # 再帰の深さが1000を超えそうなときはこれをやっておく
import sys
sys.setrecursionlimit(10**7)
#二部グラフになっている時の色の塗り分けを聞いている
n=int(eval(input()))
es=[[] for i in range(n)]
for i in range(n-1):
u,v,w=list(map(int,input().split()))
es[u-1].append([v,w])
es[v-1].append([u,w])
colors=[0 for i in range(n)]
#深さ優先探索 頂点vをcolorで塗ることを考える... | n=int(eval(input()))
#隣接リスト表現
es=[[] for i in range(n)]
for i in range(n-1):
u,v,w=list(map(int,input().split()))
es[u-1].append([v-1,w])
es[v-1].append([u-1,w])
# 再帰の深さが1000を超えそうなときはこれをやっておく
import sys
sys.setrecursionlimit(10**7)
#頂点vから初めて白なら1、黒なら−1、未探索なら0
colors=[0 for i in range(n)]
def se... | 30 | 36 | 616 | 642 | # 再帰の深さが1000を超えそうなときはこれをやっておく
import sys
sys.setrecursionlimit(10**7)
# 二部グラフになっている時の色の塗り分けを聞いている
n = int(eval(input()))
es = [[] for i in range(n)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
es[u - 1].append([v, w])
es[v - 1].append([u, w])
colors = [0 for i in range(n)]
# 深さ優先探索 頂点v... | n = int(eval(input()))
# 隣接リスト表現
es = [[] for i in range(n)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
es[u - 1].append([v - 1, w])
es[v - 1].append([u - 1, w])
# 再帰の深さが1000を超えそうなときはこれをやっておく
import sys
sys.setrecursionlimit(10**7)
# 頂点vから初めて白なら1、黒なら−1、未探索なら0
colors = [0 for i in rang... | false | 16.666667 | [
"+n = int(eval(input()))",
"+# 隣接リスト表現",
"+es = [[] for i in range(n)]",
"+for i in range(n - 1):",
"+ u, v, w = list(map(int, input().split()))",
"+ es[u - 1].append([v - 1, w])",
"+ es[v - 1].append([u - 1, w])",
"-# 二部グラフになっている時の色の塗り分けを聞いている",
"-n = int(eval(input()))",
"-es = [[] for ... | false | 0.087655 | 0.046687 | 1.877514 | [
"s925544461",
"s699928289"
] |
u854294899 | p02594 | python | s409363457 | s802421591 | 28 | 25 | 9,144 | 9,092 | Accepted | Accepted | 10.71 | n = int(eval(input()))
if n >= 30:
print('Yes')
else:
print('No') | n = int(eval(input()))
s = ''
if n >= 30:
s = 'Yes'
else:
s = 'No'
print(s) | 5 | 7 | 67 | 79 | n = int(eval(input()))
if n >= 30:
print("Yes")
else:
print("No")
| n = int(eval(input()))
s = ""
if n >= 30:
s = "Yes"
else:
s = "No"
print(s)
| false | 28.571429 | [
"+s = \"\"",
"- print(\"Yes\")",
"+ s = \"Yes\"",
"- print(\"No\")",
"+ s = \"No\"",
"+print(s)"
] | false | 0.112134 | 0.085532 | 1.311012 | [
"s409363457",
"s802421591"
] |
u498531348 | p02772 | python | s401498611 | s827111329 | 71 | 62 | 62,008 | 62,016 | Accepted | Accepted | 12.68 | N = int(eval(input()))
A = list(map(int, input().split()))
i = 0
for i in range(len(A)):
if (A[i] % 2 == 0):
if A[i] % 3 != 0 and A[i] % 5 != 0:
print('DENIED')
exit()
else:
continue
else:
continue
print('APPROVED') | N = int(eval(input()))
A = list(map(int, input().split()))
i = 0
for i in range(len(A)):
if (A[i] % 2 != 0 or (A[i] % 3 == 0 or A[i] % 5 == 0)):
continue
else:
print('DENIED')
exit()
print('APPROVED')
| 17 | 15 | 297 | 246 | N = int(eval(input()))
A = list(map(int, input().split()))
i = 0
for i in range(len(A)):
if A[i] % 2 == 0:
if A[i] % 3 != 0 and A[i] % 5 != 0:
print("DENIED")
exit()
else:
continue
else:
continue
print("APPROVED")
| N = int(eval(input()))
A = list(map(int, input().split()))
i = 0
for i in range(len(A)):
if A[i] % 2 != 0 or (A[i] % 3 == 0 or A[i] % 5 == 0):
continue
else:
print("DENIED")
exit()
print("APPROVED")
| false | 11.764706 | [
"- if A[i] % 2 == 0:",
"- if A[i] % 3 != 0 and A[i] % 5 != 0:",
"- print(\"DENIED\")",
"- exit()",
"- else:",
"- continue",
"+ if A[i] % 2 != 0 or (A[i] % 3 == 0 or A[i] % 5 == 0):",
"+ continue",
"- continue",
"+ print(\"DE... | false | 0.045471 | 0.045289 | 1.004036 | [
"s401498611",
"s827111329"
] |
u896741788 | p03634 | python | s994744232 | s019648985 | 1,464 | 623 | 47,184 | 47,156 | Accepted | Accepted | 57.45 | n=int(eval(input()))
edges=[[] for i in range(n)]
for i in range(n-1):
a,s,d=list(map(int,input().split()))
edges[a-1].append((s-1,d));edges[s-1].append((a-1,d))
q,k=list(map(int,input().split()))
cost=[0]*n
from collections import deque
dq=deque([])
#pop/append/(append,pop)_left/in/len/count/[]/index/... | import sys
input=sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)
n=int(eval(input()))
edges=[[] for i in range(n)]
for i in range(n-1):
a,s,d=list(map(int,input().split()))
edges[a-1].append((s-1,d));edges[s-1].append((a-1,d))
q,k=list(map(int,input().split()))
cost=[0]*n
from collections impor... | 24 | 27 | 636 | 711 | n = int(eval(input()))
edges = [[] for i in range(n)]
for i in range(n - 1):
a, s, d = list(map(int, input().split()))
edges[a - 1].append((s - 1, d))
edges[s - 1].append((a - 1, d))
q, k = list(map(int, input().split()))
cost = [0] * n
from collections import deque
dq = deque([])
# pop/append/(append,pop)... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)
n = int(eval(input()))
edges = [[] for i in range(n)]
for i in range(n - 1):
a, s, d = list(map(int, input().split()))
edges[a - 1].append((s - 1, d))
edges[s - 1].append((a - 1, d))
q, k = list(map(int, input().split()))
cost = [0] ... | false | 11.111111 | [
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"+sys.setrecursionlimit(10**9)"
] | false | 0.040778 | 0.069983 | 0.582682 | [
"s994744232",
"s019648985"
] |
u203843959 | p02990 | python | s840959648 | s521013909 | 1,219 | 89 | 3,316 | 3,316 | Accepted | Accepted | 92.7 | MOD=10**9+7
def powmod(a,p):
if p==0:
return 1
elif p==1:
return a
else:
pow2=powmod(a,p//2)
if p%2==0:
return (pow2**2)%MOD
else:
return (a*pow2**2)%MOD
def invmod(a):
return powmod(a,MOD-2)
def comb_mod(n,r):
nPr=1
fact_r=1
for i in range(r):
nPr*=n-... | MOD=10**9+7
N,K=list(map(int,input().split()))
def powmod(a,p):
if p==0:
return 1
elif p==1:
return a
else:
pow2=powmod(a,p//2)
if p%2==0:
return (pow2**2)%MOD
else:
return (a*pow2**2)%MOD
def invmod(a):
return powmod(a,MOD-2)
term1=N-K+1
term2=1
for i in ran... | 30 | 25 | 544 | 457 | MOD = 10**9 + 7
def powmod(a, p):
if p == 0:
return 1
elif p == 1:
return a
else:
pow2 = powmod(a, p // 2)
if p % 2 == 0:
return (pow2**2) % MOD
else:
return (a * pow2**2) % MOD
def invmod(a):
return powmod(a, MOD - 2)
def comb_mod(n,... | MOD = 10**9 + 7
N, K = list(map(int, input().split()))
def powmod(a, p):
if p == 0:
return 1
elif p == 1:
return a
else:
pow2 = powmod(a, p // 2)
if p % 2 == 0:
return (pow2**2) % MOD
else:
return (a * pow2**2) % MOD
def invmod(a):
retu... | false | 16.666667 | [
"+N, K = list(map(int, input().split()))",
"-def comb_mod(n, r):",
"- nPr = 1",
"- fact_r = 1",
"- for i in range(r):",
"- nPr *= n - i",
"- nPr %= MOD",
"- fact_r *= r - i",
"- fact_r %= MOD",
"- return (nPr * invmod(fact_r)) % MOD",
"-",
"-",
"-N, K ... | false | 0.035771 | 0.04097 | 0.873107 | [
"s840959648",
"s521013909"
] |
u426649993 | p03575 | python | s731773042 | s975628005 | 29 | 25 | 3,064 | 3,316 | Accepted | Accepted | 13.79 | if __name__ == "__main__":
n, m = list(map(int, input().split()))
edge = list()
for i in range(m):
edge.append(list(map(int, input().split())))
ans = 0
def dfs(v):
visted[v] = True
for i in range(n):
if graph[v][i] is False:
continue
... | from collections import deque
if __name__ == "__main__":
n, m = list(map(int, input().split()))
edge = list()
for i in range(m):
edge.append(list(map(int, input().split())))
ans = 0
for i in range(m):
distance = [-1] * n
que = deque([0])
graph = dict()... | 30 | 39 | 765 | 969 | if __name__ == "__main__":
n, m = list(map(int, input().split()))
edge = list()
for i in range(m):
edge.append(list(map(int, input().split())))
ans = 0
def dfs(v):
visted[v] = True
for i in range(n):
if graph[v][i] is False:
continue
i... | from collections import deque
if __name__ == "__main__":
n, m = list(map(int, input().split()))
edge = list()
for i in range(m):
edge.append(list(map(int, input().split())))
ans = 0
for i in range(m):
distance = [-1] * n
que = deque([0])
graph = dict()
for j ... | false | 23.076923 | [
"+from collections import deque",
"+",
"-",
"- def dfs(v):",
"- visted[v] = True",
"- for i in range(n):",
"- if graph[v][i] is False:",
"- continue",
"- if visted[i] is True:",
"- continue",
"- dfs(i)",
"-",
"- ... | false | 0.046003 | 0.064909 | 0.708726 | [
"s731773042",
"s975628005"
] |
u353919145 | p03712 | python | s641645488 | s810684737 | 32 | 19 | 4,468 | 3,064 | Accepted | Accepted | 40.62 | arr=list(map(int,input().rstrip().split()))
r=arr[0]
c=arr[1]
line=[]
for i in range(0,r):
line.append(input())
s=[[0 for x in range(r)]for y in range(c)]
for i in range(0,r+2):
for j in range(0,c+2):
if i == 0 or i == r + 1 or j == 0 or j == c + 1:
print("#",end="")
else:... | h,w = [int(i) for i in input().split()]
pic = []
for i in range(h):
pic.append(input())
for i in range(w+2):
print('#', sep='',end='')
print()
for i in range(h):
print('#', sep='',end='')
print(pic[i],end='')
print('#')
for i in range(w+2):
print('#', sep='',end='')
print()
| 16 | 21 | 395 | 308 | arr = list(map(int, input().rstrip().split()))
r = arr[0]
c = arr[1]
line = []
for i in range(0, r):
line.append(input())
s = [[0 for x in range(r)] for y in range(c)]
for i in range(0, r + 2):
for j in range(0, c + 2):
if i == 0 or i == r + 1 or j == 0 or j == c + 1:
print("#", end="")
... | h, w = [int(i) for i in input().split()]
pic = []
for i in range(h):
pic.append(input())
for i in range(w + 2):
print("#", sep="", end="")
print()
for i in range(h):
print("#", sep="", end="")
print(pic[i], end="")
print("#")
for i in range(w + 2):
print("#", sep="", end="")
print()
| false | 23.809524 | [
"-arr = list(map(int, input().rstrip().split()))",
"-r = arr[0]",
"-c = arr[1]",
"-line = []",
"-for i in range(0, r):",
"- line.append(input())",
"-s = [[0 for x in range(r)] for y in range(c)]",
"-for i in range(0, r + 2):",
"- for j in range(0, c + 2):",
"- if i == 0 or i == r + 1 ... | false | 0.058519 | 0.079206 | 0.738826 | [
"s641645488",
"s810684737"
] |
u347640436 | p02873 | python | s197619008 | s008457451 | 427 | 341 | 23,336 | 24,752 | Accepted | Accepted | 20.14 | S = eval(input())
N = len(S) + 1
t = [0] * N
p = ''
for i in range(N - 2, -2, -1):
if p == '>':
t[i + 1] = t[i + 2] + 1
p = S[i]
for i in range(N - 1):
if S[i] == '<':
t[i + 1] = max(t[i + 1], t[i] + 1)
print((sum(t)))
| S = eval(input())
N = len(S) + 1
t = [0] * N
for i in range(N - 1):
if S[i] == '<':
t[i + 1] = t[i] + 1
for i in range(N - 2, -1, -1):
if S[i] == '>':
t[i] = max(t[i], t[i + 1] + 1)
print((sum(t)))
| 13 | 11 | 238 | 225 | S = eval(input())
N = len(S) + 1
t = [0] * N
p = ""
for i in range(N - 2, -2, -1):
if p == ">":
t[i + 1] = t[i + 2] + 1
p = S[i]
for i in range(N - 1):
if S[i] == "<":
t[i + 1] = max(t[i + 1], t[i] + 1)
print((sum(t)))
| S = eval(input())
N = len(S) + 1
t = [0] * N
for i in range(N - 1):
if S[i] == "<":
t[i + 1] = t[i] + 1
for i in range(N - 2, -1, -1):
if S[i] == ">":
t[i] = max(t[i], t[i + 1] + 1)
print((sum(t)))
| false | 15.384615 | [
"-p = \"\"",
"-for i in range(N - 2, -2, -1):",
"- if p == \">\":",
"- t[i + 1] = t[i + 2] + 1",
"- p = S[i]",
"- t[i + 1] = max(t[i + 1], t[i] + 1)",
"+ t[i + 1] = t[i] + 1",
"+for i in range(N - 2, -1, -1):",
"+ if S[i] == \">\":",
"+ t[i] = max(t[i], t[i + 1... | false | 0.04268 | 0.075816 | 0.562944 | [
"s197619008",
"s008457451"
] |
u923668099 | p02397 | python | s205934351 | s965357992 | 50 | 30 | 7,560 | 7,816 | Accepted | Accepted | 40 | # coding: utf-8
# Here your code !
while True:
x,y = list(map(int, input().split()))
if x == 0 and y == 0:
break
if x < y:
print((str(x) + " " + str(y)))
else:
print((str(y) + " " + str(x))) | from sys import stdin
for test_case in range(3000 + 2):
x, y = list(map(int, stdin.readline().split()))
if not(x + y):
break
if x > y:
x, y = y, x
print((x, y)) | 13 | 12 | 249 | 199 | # coding: utf-8
# Here your code !
while True:
x, y = list(map(int, input().split()))
if x == 0 and y == 0:
break
if x < y:
print((str(x) + " " + str(y)))
else:
print((str(y) + " " + str(x)))
| from sys import stdin
for test_case in range(3000 + 2):
x, y = list(map(int, stdin.readline().split()))
if not (x + y):
break
if x > y:
x, y = y, x
print((x, y))
| false | 7.692308 | [
"-# coding: utf-8",
"-# Here your code !",
"-while True:",
"- x, y = list(map(int, input().split()))",
"- if x == 0 and y == 0:",
"+from sys import stdin",
"+",
"+for test_case in range(3000 + 2):",
"+ x, y = list(map(int, stdin.readline().split()))",
"+ if not (x + y):",
"- if x ... | false | 0.037143 | 0.07864 | 0.472317 | [
"s205934351",
"s965357992"
] |
u667024514 | p03818 | python | s316554474 | s303488340 | 93 | 53 | 14,396 | 14,564 | Accepted | Accepted | 43.01 | n = int(eval(input()))
lis = list(map(int,input().split()))
s = set()
for i in range(n):s.add(lis[i])
lis.sort()
if (len(lis)-len(s)) % 2 == 1:
print((len(s)-1))
else:
print((len(s))) | n = int(eval(input()))
lis = list(map(int,input().split()))
ans = set()
for num in lis:ans.add(num)
print((len(ans)-((len(ans) % 2)+1)%2)) | 9 | 5 | 183 | 134 | n = int(eval(input()))
lis = list(map(int, input().split()))
s = set()
for i in range(n):
s.add(lis[i])
lis.sort()
if (len(lis) - len(s)) % 2 == 1:
print((len(s) - 1))
else:
print((len(s)))
| n = int(eval(input()))
lis = list(map(int, input().split()))
ans = set()
for num in lis:
ans.add(num)
print((len(ans) - ((len(ans) % 2) + 1) % 2))
| false | 44.444444 | [
"-s = set()",
"-for i in range(n):",
"- s.add(lis[i])",
"-lis.sort()",
"-if (len(lis) - len(s)) % 2 == 1:",
"- print((len(s) - 1))",
"-else:",
"- print((len(s)))",
"+ans = set()",
"+for num in lis:",
"+ ans.add(num)",
"+print((len(ans) - ((len(ans) % 2) + 1) % 2))"
] | false | 0.088086 | 0.045172 | 1.950008 | [
"s316554474",
"s303488340"
] |
u630511239 | p03380 | python | s527014957 | s244930206 | 95 | 79 | 14,052 | 20,068 | Accepted | Accepted | 16.84 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
M = A[-1]
a = M // 2
for i in range(N-1):
if A[i] <= a and A[i+1] >= a:
if (M-A[i])*A[i] >= (M-A[i+1])*A[i+1]:
ans = [M, A[i]]
else:
ans = [M, A[i+1]]
ans = [str(b) for b in ans]
ans = ' '.join(ans)
print(ans)
| n = int(input())
a = list(map(int, input().split()))
a.sort()
M = a[-1]
m = a[0]
C = -1
for i in range(n):
c = a[i]*(M-a[i])
if C < c:
C = c
m = a[i]
else:
break
print(M, m, sep=' ')
| 15 | 14 | 314 | 213 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
M = A[-1]
a = M // 2
for i in range(N - 1):
if A[i] <= a and A[i + 1] >= a:
if (M - A[i]) * A[i] >= (M - A[i + 1]) * A[i + 1]:
ans = [M, A[i]]
else:
ans = [M, A[i + 1]]
ans = [str(b) for b in ans]
ans = " ".j... | n = int(input())
a = list(map(int, input().split()))
a.sort()
M = a[-1]
m = a[0]
C = -1
for i in range(n):
c = a[i] * (M - a[i])
if C < c:
C = c
m = a[i]
else:
break
print(M, m, sep=" ")
| false | 6.666667 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-A.sort()",
"-M = A[-1]",
"-a = M // 2",
"-for i in range(N - 1):",
"- if A[i] <= a and A[i + 1] >= a:",
"- if (M - A[i]) * A[i] >= (M - A[i + 1]) * A[i + 1]:",
"- ans = [M, A[i]]",
"- else:",
"- ... | false | 0.180158 | 0.075836 | 2.375624 | [
"s527014957",
"s244930206"
] |
u102461423 | p03682 | python | s059605954 | s304108636 | 1,405 | 1,103 | 74,612 | 81,240 | Accepted | Accepted | 21.49 | import sys
input = sys.stdin.readline
from operator import itemgetter
from scipy.sparse import csr_matrix
import numpy as np
N = int(eval(input()))
XY = [[i] + [int(x) for x in input().split()] for i in range(N)]
edge = set()
for key in [itemgetter(1),itemgetter(2)]:
XY.sort(key = key)
for i in rang... | import sys
input = sys.stdin.readline
from operator import itemgetter
from scipy.sparse import csr_matrix
import numpy as np
N = int(eval(input()))
XY = [[i] + [int(x) for x in input().split()] for i in range(N)]
edge = set()
for key in [itemgetter(1),itemgetter(2)]:
XY.sort(key = key)
for i in rang... | 30 | 29 | 758 | 731 | import sys
input = sys.stdin.readline
from operator import itemgetter
from scipy.sparse import csr_matrix
import numpy as np
N = int(eval(input()))
XY = [[i] + [int(x) for x in input().split()] for i in range(N)]
edge = set()
for key in [itemgetter(1), itemgetter(2)]:
XY.sort(key=key)
for i in range(N - 1):
... | import sys
input = sys.stdin.readline
from operator import itemgetter
from scipy.sparse import csr_matrix
import numpy as np
N = int(eval(input()))
XY = [[i] + [int(x) for x in input().split()] for i in range(N)]
edge = set()
for key in [itemgetter(1), itemgetter(2)]:
XY.sort(key=key)
for i in range(N - 1):
... | false | 3.333333 | [
"-edge = sorted(list(edge))"
] | false | 0.341326 | 0.341457 | 0.999616 | [
"s059605954",
"s304108636"
] |
u849324100 | p03012 | python | s133943399 | s780003061 | 151 | 18 | 12,436 | 3,060 | Accepted | Accepted | 88.08 | #import sys
#import math
import numpy as np
'''a,b= map(int,input().split())'''
#a, b, c = [list(map(int, input().split())) for _ in range(3)]
#li0= [int(x) for x in input().split()]
#n,l= map(int, input().split())
#x = [list(map(int, input().split())) for _ in range(n)]
a=int(eval(input()))
li0=[int(x) for x... | #import sys
#import math
#import numpy as np
'''a,b= map(int,input().split())'''
#a, b, c = [list(map(int, input().split())) for _ in range(3)]
#li0= [int(x) for x in input().split()]
#n,l= map(int, input().split())
#x = [list(map(int, input().split())) for _ in range(n)]
a=int(eval(input()))
li=[int(x) for x... | 24 | 15 | 632 | 438 | # import sys
# import math
import numpy as np
"""a,b= map(int,input().split())"""
# a, b, c = [list(map(int, input().split())) for _ in range(3)]
# li0= [int(x) for x in input().split()]
# n,l= map(int, input().split())
# x = [list(map(int, input().split())) for _ in range(n)]
a = int(eval(input()))
li0 = [int(x) for ... | # import sys
# import math
# import numpy as np
"""a,b= map(int,input().split())"""
# a, b, c = [list(map(int, input().split())) for _ in range(3)]
# li0= [int(x) for x in input().split()]
# n,l= map(int, input().split())
# x = [list(map(int, input().split())) for _ in range(n)]
a = int(eval(input()))
li = [int(x) for ... | false | 37.5 | [
"-import numpy as np",
"-",
"+# import numpy as np",
"-li0 = [int(x) for x in input().split()]",
"-count = 0",
"-ju = ans = mis = 0",
"-half = 0",
"-count = sum(li0) // 2",
"-for i in range(len(li0)):",
"- ju += li0[i]",
"- if ju >= count:",
"- half = i",
"- break",
"-i... | false | 0.41604 | 0.036616 | 11.362387 | [
"s133943399",
"s780003061"
] |
u486448566 | p03162 | python | s422032471 | s110621538 | 696 | 361 | 74,200 | 70,236 | Accepted | Accepted | 48.13 | n = int(eval(input()))
abc = []
for _ in range(n):
abc.append(list(map(int, input().split())))
dp = [[0]*3 for _ in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for i in range(1,n):
for j in range(3):
if j == 0:
dp[i][j] = max(dp[i-1][1], dp[i-1][2... | INF = float("inf")
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
input_int = lambda:int(eval(input()))
input_ints = lambda:list(map(int,input().split()))
input_ints_list = lambda:list(input_ints())
input_str = lambda:eval(input())
input_strs = lambda:input().split()
input_lines = lambda ... | 19 | 63 | 517 | 2,443 | n = int(eval(input()))
abc = []
for _ in range(n):
abc.append(list(map(int, input().split())))
dp = [[0] * 3 for _ in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for i in range(1, n):
for j in range(3):
if j == 0:
dp[i][j] = max(dp[i - 1][1], dp[i - 1][2]) + abc[... | INF = float("inf")
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
input_int = lambda: int(eval(input()))
input_ints = lambda: list(map(int, input().split()))
input_ints_list = lambda: list(input_ints())
input_str = lambda: eval(input())
input_strs = lambda: input().split()
input_lines = lambda n, i... | false | 69.84127 | [
"-n = int(eval(input()))",
"-abc = []",
"-for _ in range(n):",
"- abc.append(list(map(int, input().split())))",
"-dp = [[0] * 3 for _ in range(n)]",
"-dp[0][0] = abc[0][0]",
"-dp[0][1] = abc[0][1]",
"-dp[0][2] = abc[0][2]",
"-for i in range(1, n):",
"- for j in range(3):",
"- if j =... | false | 0.087076 | 0.048644 | 1.790082 | [
"s422032471",
"s110621538"
] |
u935558307 | p03546 | python | s455565594 | s520667565 | 206 | 90 | 41,564 | 74,016 | Accepted | Accepted | 56.31 | H,W = list(map(int,input().split()))
dp = [list(map(int,input().split())) for _ in range(10)]
A = [list(map(int,input().split())) for _ in range(H)]
"""
各数字から各数字への変更コストの最小値をわーシャルフロイドで計算する
"""
for i in range(10):
for j in range(10):
for k in range(9,-1,-1):
dp[j][k] = min(dp[j][k],... | H,W = list(map(int,input().split()))
C = [list(map(int,input().split())) for _ in range(10)]
A = [list(map(int,input().split())) for _ in range(H)]
dp = [float("INF")]*(10)
dp[1] = 0
cnt = 0
while cnt <= 10:
cnt += 1
for i in range(10):
for j in range(10):
dp[j] = min(dp[j],dp[i]... | 22 | 19 | 494 | 452 | H, W = list(map(int, input().split()))
dp = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
"""
各数字から各数字への変更コストの最小値をわーシャルフロイドで計算する
"""
for i in range(10):
for j in range(10):
for k in range(9, -1, -1):
dp[j][k] = min(dp[j][k], dp[j][i]... | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
dp = [float("INF")] * (10)
dp[1] = 0
cnt = 0
while cnt <= 10:
cnt += 1
for i in range(10):
for j in range(10):
dp[j] = min(dp[j], dp[i] + C[... | false | 13.636364 | [
"-dp = [list(map(int, input().split())) for _ in range(10)]",
"+C = [list(map(int, input().split())) for _ in range(10)]",
"-\"\"\"",
"-各数字から各数字への変更コストの最小値をわーシャルフロイドで計算する",
"-\"\"\"",
"-for i in range(10):",
"- for j in range(10):",
"- for k in range(9, -1, -1):",
"- dp[j][k] = ... | false | 0.061588 | 0.089049 | 0.691622 | [
"s455565594",
"s520667565"
] |
u638078488 | p03478 | python | s314472782 | s286759658 | 46 | 26 | 3,060 | 3,060 | Accepted | Accepted | 43.48 | N, A, B = list(map(int, input().split()))
total = 0
for i in range(1, N + 1, 1):
i_sum = 0
for j in range(len(str(i))):
i_sum += int(str(i)[j])
# print("i_sum", i_sum)
if A <= i_sum and i_sum <= B:
total += i
print(total) | N, A, B = list(map(int, input().split()))
total = 0
# 各桁の和を計算する関数
def sumOfDigits(n):
sum = 0
while n > 0:
sum += n % 10
n = n // 10
return sum
for i in range(1, N + 1, 1):
j = sumOfDigits(i)
if A <= j and j <= B:
total += i
print(total) | 11 | 17 | 258 | 294 | N, A, B = list(map(int, input().split()))
total = 0
for i in range(1, N + 1, 1):
i_sum = 0
for j in range(len(str(i))):
i_sum += int(str(i)[j])
# print("i_sum", i_sum)
if A <= i_sum and i_sum <= B:
total += i
print(total)
| N, A, B = list(map(int, input().split()))
total = 0
# 各桁の和を計算する関数
def sumOfDigits(n):
sum = 0
while n > 0:
sum += n % 10
n = n // 10
return sum
for i in range(1, N + 1, 1):
j = sumOfDigits(i)
if A <= j and j <= B:
total += i
print(total)
| false | 35.294118 | [
"+# 各桁の和を計算する関数",
"+def sumOfDigits(n):",
"+ sum = 0",
"+ while n > 0:",
"+ sum += n % 10",
"+ n = n // 10",
"+ return sum",
"+",
"+",
"- i_sum = 0",
"- for j in range(len(str(i))):",
"- i_sum += int(str(i)[j])",
"- # print(\"i_sum\", i_sum)",
"- i... | false | 0.046583 | 0.045907 | 1.014717 | [
"s314472782",
"s286759658"
] |
u879870653 | p03356 | python | s716004793 | s731668414 | 694 | 467 | 66,164 | 14,388 | Accepted | Accepted | 32.71 | from collections import deque
N,M = list(map(int,input().split()))
P = list(map(int,input().split()))
L = [list(map(int,input().split())) for i in range(M)]
G = [[] for i in range(N)]
for i in range(len(L)) :
u,v = L[i]
u -= 1
v -= 1
G[u].append(v)
G[v].append(u)
explored = ... | class UnionFind:
def __init__(self, num):
self.rank = [0] * num
self.par = [i for i in range(num)]
self.n = num
def find_root(self, node):
if self.par[node] == node:
return node
else:
self.par[node] = self.find_root(self.par[node])
... | 49 | 54 | 834 | 1,229 | from collections import deque
N, M = list(map(int, input().split()))
P = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(M)]
G = [[] for i in range(N)]
for i in range(len(L)):
u, v = L[i]
u -= 1
v -= 1
G[u].append(v)
G[v].append(u)
explored = [0 for i in range(N)... | class UnionFind:
def __init__(self, num):
self.rank = [0] * num
self.par = [i for i in range(num)]
self.n = num
def find_root(self, node):
if self.par[node] == node:
return node
else:
self.par[node] = self.find_root(self.par[node])
ret... | false | 9.259259 | [
"-from collections import deque",
"+class UnionFind:",
"+ def __init__(self, num):",
"+ self.rank = [0] * num",
"+ self.par = [i for i in range(num)]",
"+ self.n = num",
"-N, M = list(map(int, input().split()))",
"-P = list(map(int, input().split()))",
"-L = [list(map(int, in... | false | 0.040337 | 0.046772 | 0.862408 | [
"s716004793",
"s731668414"
] |
u169350228 | p02693 | python | s294527859 | s570784258 | 103 | 23 | 27,112 | 9,000 | Accepted | Accepted | 77.67 | import numpy as np
import math
k = int(eval(input()))
a, b = list(map(int,input().split()))
ans = False
for i in range(a,b+1):
if i%k == 0:
ans = True
break
if ans:
print("OK")
else:
print("NG") | k = int(eval(input()))
a, b = list(map(int,input().split()))
for i in range(a,b+1):
if i%k == 0:
print("OK")
exit()
print("NG")
| 14 | 9 | 224 | 146 | import numpy as np
import math
k = int(eval(input()))
a, b = list(map(int, input().split()))
ans = False
for i in range(a, b + 1):
if i % k == 0:
ans = True
break
if ans:
print("OK")
else:
print("NG")
| k = int(eval(input()))
a, b = list(map(int, input().split()))
for i in range(a, b + 1):
if i % k == 0:
print("OK")
exit()
print("NG")
| false | 35.714286 | [
"-import numpy as np",
"-import math",
"-",
"-ans = False",
"- ans = True",
"- break",
"-if ans:",
"- print(\"OK\")",
"-else:",
"- print(\"NG\")",
"+ print(\"OK\")",
"+ exit()",
"+print(\"NG\")"
] | false | 0.159821 | 0.068397 | 2.336658 | [
"s294527859",
"s570784258"
] |
u332906195 | p03502 | python | s870332651 | s734160415 | 175 | 21 | 38,256 | 3,316 | Accepted | Accepted | 88 | N = eval(input())
sumN = sum([int(n) for n in N])
print(("Yes" if int(N) % sumN == 0 else "No"))
| N = eval(input())
print(("Yes" if int(N) % sum([int(n) for n in N]) == 0 else "No"))
| 4 | 2 | 93 | 78 | N = eval(input())
sumN = sum([int(n) for n in N])
print(("Yes" if int(N) % sumN == 0 else "No"))
| N = eval(input())
print(("Yes" if int(N) % sum([int(n) for n in N]) == 0 else "No"))
| false | 50 | [
"-sumN = sum([int(n) for n in N])",
"-print((\"Yes\" if int(N) % sumN == 0 else \"No\"))",
"+print((\"Yes\" if int(N) % sum([int(n) for n in N]) == 0 else \"No\"))"
] | false | 0.007516 | 0.035336 | 0.212713 | [
"s870332651",
"s734160415"
] |
u888092736 | p02678 | python | s477089329 | s305333199 | 739 | 678 | 72,768 | 74,908 | Accepted | Accepted | 8.25 | from collections import deque, defaultdict
import sys
def input():
return sys.stdin.readline().strip()
N, M = map(int, input().split())
graph = defaultdict(set)
for _ in range(M):
A, B = map(lambda x: int(x) - 1, input().split())
graph[A].add(B)
graph[B].add(A)
if len(set(graph.keys())... | from collections import deque, defaultdict
import sys
def input():
return sys.stdin.readline().strip()
N, M = list(map(int, input().split()))
graph = defaultdict(set)
for _ in range(M):
A, B = [int(x) - 1 for x in input().split()]
graph[A].add(B)
graph[B].add(A)
tokens = [-1] * N
to... | 30 | 30 | 599 | 612 | from collections import deque, defaultdict
import sys
def input():
return sys.stdin.readline().strip()
N, M = map(int, input().split())
graph = defaultdict(set)
for _ in range(M):
A, B = map(lambda x: int(x) - 1, input().split())
graph[A].add(B)
graph[B].add(A)
if len(set(graph.keys())) != N:
pr... | from collections import deque, defaultdict
import sys
def input():
return sys.stdin.readline().strip()
N, M = list(map(int, input().split()))
graph = defaultdict(set)
for _ in range(M):
A, B = [int(x) - 1 for x in input().split()]
graph[A].add(B)
graph[B].add(A)
tokens = [-1] * N
tokens[0] = N
q = d... | false | 0 | [
"-N, M = map(int, input().split())",
"+N, M = list(map(int, input().split()))",
"- A, B = map(lambda x: int(x) - 1, input().split())",
"+ A, B = [int(x) - 1 for x in input().split()]",
"-if len(set(graph.keys())) != N:",
"- print(\"No\")",
"- exit()",
"-print(\"Yes\")",
"-[print(t + 1) f... | false | 0.047162 | 0.049836 | 0.946335 | [
"s477089329",
"s305333199"
] |
u984276646 | p02600 | python | s815765028 | s816210332 | 34 | 30 | 9,148 | 9,124 | Accepted | Accepted | 11.76 | X = int(eval(input()))
print((8-(X-400)//200)) | print((8-(int(eval(input()))-400)//200)) | 2 | 1 | 39 | 32 | X = int(eval(input()))
print((8 - (X - 400) // 200))
| print((8 - (int(eval(input())) - 400) // 200))
| false | 50 | [
"-X = int(eval(input()))",
"-print((8 - (X - 400) // 200))",
"+print((8 - (int(eval(input())) - 400) // 200))"
] | false | 0.042985 | 0.071517 | 0.601041 | [
"s815765028",
"s816210332"
] |
u309120194 | p03059 | python | s052988646 | s496380430 | 36 | 26 | 9,080 | 8,752 | Accepted | Accepted | 27.78 | A, B, T = list(map(int, input().split()))
print((int((T+0.5)//A) * B)) | A, B, T = list(map(int, input().split()))
print((T // A * B)) | 3 | 3 | 66 | 57 | A, B, T = list(map(int, input().split()))
print((int((T + 0.5) // A) * B))
| A, B, T = list(map(int, input().split()))
print((T // A * B))
| false | 0 | [
"-print((int((T + 0.5) // A) * B))",
"+print((T // A * B))"
] | false | 0.034965 | 0.034433 | 1.015442 | [
"s052988646",
"s496380430"
] |
u730769327 | p03112 | python | s600842907 | s606427553 | 972 | 894 | 100,476 | 97,488 | Accepted | Accepted | 8.02 | import bisect
INF=10**11
A,B,q=list(map(int,input().split()))
a=[-INF]+[int(eval(input())) for _ in range(A)]+[INF]
b=[-INF]+[int(eval(input())) for _ in range(B)]+[INF]
for _ in range(q):
x=int(eval(input()))
i=bisect.bisect_left(a,x)
j=bisect.bisect_left(b,x)
ans=min(max(a[i],b[j])-x,x-min(a[i-1],b[j... | from bisect import*
a,b,q=list(map(int,input().split()))
s=[-10**18]+[int(eval(input())) for _ in range(a)]+[10**18]
t=[-10**18]+[int(eval(input())) for _ in range(b)]+[10**18]
for _ in range(q):
i=int(eval(input()))
si=bisect_left(s,i)
ti=bisect_left(t,i)
print((min(max(s[si],t[ti])-i,i-min(t[ti-1],s[s... | 11 | 11 | 381 | 402 | import bisect
INF = 10**11
A, B, q = list(map(int, input().split()))
a = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
b = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
for _ in range(q):
x = int(eval(input()))
i = bisect.bisect_left(a, x)
j = bisect.bisect_left(b, x)
ans = min(
... | from bisect import *
a, b, q = list(map(int, input().split()))
s = [-(10**18)] + [int(eval(input())) for _ in range(a)] + [10**18]
t = [-(10**18)] + [int(eval(input())) for _ in range(b)] + [10**18]
for _ in range(q):
i = int(eval(input()))
si = bisect_left(s, i)
ti = bisect_left(t, i)
print(
(... | false | 0 | [
"-import bisect",
"+from bisect import *",
"-INF = 10**11",
"-A, B, q = list(map(int, input().split()))",
"-a = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]",
"-b = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]",
"+a, b, q = list(map(int, input().split()))",
"+s = [-(10**18)] + [i... | false | 0.053531 | 0.144281 | 0.371018 | [
"s600842907",
"s606427553"
] |
u734519000 | p03112 | python | s916165488 | s352135029 | 1,821 | 1,216 | 12,080 | 16,244 | Accepted | Accepted | 33.22 | import bisect as bi
a, b, q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(a)]
t = [int(eval(input())) for i in range(b)]
for i in range(q):
c = []
d = []
x = int(eval(input()))
tmp = bi.bisect_left(s, x)
if tmp != a : c.append(s[tmp])
if tmp != 0 : c.append(s... | import bisect as bi
a, b, q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(a)]
t = [int(eval(input())) for i in range(b)]
u = [int(eval(input())) for i in range(q)]
for x in u:
c = []
d = []
tmp = bi.bisect_left(s, x)
if tmp != a : c.append(s[tmp])
if tmp != 0 :... | 25 | 26 | 705 | 717 | import bisect as bi
a, b, q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(a)]
t = [int(eval(input())) for i in range(b)]
for i in range(q):
c = []
d = []
x = int(eval(input()))
tmp = bi.bisect_left(s, x)
if tmp != a:
c.append(s[tmp])
if tmp != 0:
c.app... | import bisect as bi
a, b, q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(a)]
t = [int(eval(input())) for i in range(b)]
u = [int(eval(input())) for i in range(q)]
for x in u:
c = []
d = []
tmp = bi.bisect_left(s, x)
if tmp != a:
c.append(s[tmp])
if tmp != 0:
... | false | 3.846154 | [
"-for i in range(q):",
"+u = [int(eval(input())) for i in range(q)]",
"+for x in u:",
"- x = int(eval(input()))"
] | false | 0.122453 | 0.104731 | 1.169208 | [
"s916165488",
"s352135029"
] |
u024890678 | p02712 | python | s771500594 | s499978573 | 205 | 159 | 9,036 | 9,164 | Accepted | Accepted | 22.44 | n = int(eval(input()))
ans = 0
for i in range(1, n+1):
if i%15 == 0 or i%5 == 0 or i%3 ==0:
continue
else:
ans += i
print(ans) | n = int(eval(input()))
ans = 0
for i in range(1, n+1):
if i%5 == 0 or i%3 ==0:
continue
else:
ans += i
print(ans) | 10 | 10 | 143 | 130 | n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
if i % 15 == 0 or i % 5 == 0 or i % 3 == 0:
continue
else:
ans += i
print(ans)
| n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
if i % 5 == 0 or i % 3 == 0:
continue
else:
ans += i
print(ans)
| false | 0 | [
"- if i % 15 == 0 or i % 5 == 0 or i % 3 == 0:",
"+ if i % 5 == 0 or i % 3 == 0:"
] | false | 0.255278 | 0.384629 | 0.663699 | [
"s771500594",
"s499978573"
] |
u968166680 | p03003 | python | s241258778 | s532047704 | 179 | 119 | 134,172 | 74,160 | Accepted | Accepted | 33.52 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, M = list(map(int, readline().split()))
S = list(map(int, readline().split()))
T = list(map(int, readline().split()))
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, M = list(map(int, readline().split()))
S = list(map(int, readline().split()))
T = list(map(int, readline().split()))
... | 36 | 31 | 844 | 674 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, M = list(map(int, readline().split()))
S = list(map(int, readline().split()))
T = list(map(int, readline().split()))
dp = [[0] * (M... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, M = list(map(int, readline().split()))
S = list(map(int, readline().split()))
T = list(map(int, readline().split()))
dp = [1] * (M ... | false | 13.888889 | [
"- dp = [[0] * (M + 1) for _ in range(N + 1)]",
"- sdp = [[0] * (M + 2) for _ in range(N + 2)]",
"- dp[0][0] = 1",
"- for i in range(N + 1):",
"- sdp[i][0] = 1",
"- for j in range(M + 1):",
"- sdp[0][j] = 1",
"+ dp = [1] * (M + 1)",
"+ dp_prev = dp[:]",
"- ... | false | 0.046869 | 0.042029 | 1.115135 | [
"s241258778",
"s532047704"
] |
u103902792 | p02813 | python | s466698892 | s803943093 | 190 | 142 | 44,912 | 13,884 | Accepted | Accepted | 25.26 | n = int(eval(input()))
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
from itertools import permutations
lst = list(permutations(list(range(1,n+1))))
lst.sort()
print((abs(lst.index(P) - lst.index(Q))))
| n = int(eval(input()))
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
queue = [[]]
lst = []
while queue:
e = queue.pop(-1)
if len(e) == n:
lst.append(tuple(e))
continue
for i in range(1,n+1):
if i not in e:
queue.append(e+[i])
lst.sort()
print((abs(ls... | 10 | 20 | 226 | 345 | n = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
from itertools import permutations
lst = list(permutations(list(range(1, n + 1))))
lst.sort()
print((abs(lst.index(P) - lst.index(Q))))
| n = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
queue = [[]]
lst = []
while queue:
e = queue.pop(-1)
if len(e) == n:
lst.append(tuple(e))
continue
for i in range(1, n + 1):
if i not in e:
queue.append(e + [i])
lst.sort()
pr... | false | 50 | [
"-from itertools import permutations",
"-",
"-lst = list(permutations(list(range(1, n + 1))))",
"+queue = [[]]",
"+lst = []",
"+while queue:",
"+ e = queue.pop(-1)",
"+ if len(e) == n:",
"+ lst.append(tuple(e))",
"+ continue",
"+ for i in range(1, n + 1):",
"+ if ... | false | 0.039319 | 0.039832 | 0.987119 | [
"s466698892",
"s803943093"
] |
u707124227 | p02995 | python | s444384655 | s881723263 | 39 | 35 | 5,048 | 5,048 | Accepted | Accepted | 10.26 | import fractions
a,b,c,d=list(map(int,input().split()))
base=b-a+1
n_c=b//c-(a+c-1)//c+1
n_d=b//d-(a+d-1)//d+1
cd=c*d // fractions.gcd(c,d)
n_cd=b//cd-(a+cd-1)//cd+1
print((base-n_c-n_d+n_cd))
| import fractions
a,b,c,d=list(map(int,input().split()))
nc=b//c-(a+c-1)//c+1
nd=b//d-(a+d-1)//d+1
cd=c*d//fractions.gcd(c,d)
ncd=b//cd-(a+cd-1)//cd+1
print((b-a+1-(nc+nd-ncd)))
# math.ceil(a/b)->(a+b-1)//b | 8 | 9 | 192 | 206 | import fractions
a, b, c, d = list(map(int, input().split()))
base = b - a + 1
n_c = b // c - (a + c - 1) // c + 1
n_d = b // d - (a + d - 1) // d + 1
cd = c * d // fractions.gcd(c, d)
n_cd = b // cd - (a + cd - 1) // cd + 1
print((base - n_c - n_d + n_cd))
| import fractions
a, b, c, d = list(map(int, input().split()))
nc = b // c - (a + c - 1) // c + 1
nd = b // d - (a + d - 1) // d + 1
cd = c * d // fractions.gcd(c, d)
ncd = b // cd - (a + cd - 1) // cd + 1
print((b - a + 1 - (nc + nd - ncd)))
# math.ceil(a/b)->(a+b-1)//b
| false | 11.111111 | [
"-base = b - a + 1",
"-n_c = b // c - (a + c - 1) // c + 1",
"-n_d = b // d - (a + d - 1) // d + 1",
"+nc = b // c - (a + c - 1) // c + 1",
"+nd = b // d - (a + d - 1) // d + 1",
"-n_cd = b // cd - (a + cd - 1) // cd + 1",
"-print((base - n_c - n_d + n_cd))",
"+ncd = b // cd - (a + cd - 1) // cd + 1",... | false | 0.054931 | 0.053775 | 1.021495 | [
"s444384655",
"s881723263"
] |
u227020436 | p02696 | python | s792406869 | s173520193 | 24 | 21 | 9,156 | 9,152 | Accepted | Accepted | 12.5 | # D - Floor Function
a, b, n = list(map(int, input().split()))
# max(floor(a * x / b) - a * floor(x / b) for 0 <= x <= n)
# x = k * b のとき, 第1項 == 第2項
# k * b <= x < (k+1) * b のとき, 第1項は単調増加, 第2項は一定
x = min(n, b - 1)
print((a * x // b - a * (x // b)))
| # D - Floor Function
a, b, n = list(map(int, input().split()))
# max(floor(a * x / b) - a * floor(x / b) for 0 <= x <= n)
# x = k * b のとき, 第1項 == 第2項
# k * b <= x < (k+1) * b のとき, 第1項は単調増加, 第2項は一定
x = min(n, b - 1)
print((a * x // b))
| 10 | 10 | 254 | 239 | # D - Floor Function
a, b, n = list(map(int, input().split()))
# max(floor(a * x / b) - a * floor(x / b) for 0 <= x <= n)
# x = k * b のとき, 第1項 == 第2項
# k * b <= x < (k+1) * b のとき, 第1項は単調増加, 第2項は一定
x = min(n, b - 1)
print((a * x // b - a * (x // b)))
| # D - Floor Function
a, b, n = list(map(int, input().split()))
# max(floor(a * x / b) - a * floor(x / b) for 0 <= x <= n)
# x = k * b のとき, 第1項 == 第2項
# k * b <= x < (k+1) * b のとき, 第1項は単調増加, 第2項は一定
x = min(n, b - 1)
print((a * x // b))
| false | 0 | [
"-print((a * x // b - a * (x // b)))",
"+print((a * x // b))"
] | false | 0.038982 | 0.037833 | 1.030377 | [
"s792406869",
"s173520193"
] |
u312025627 | p02971 | python | s263718149 | s799083154 | 483 | 311 | 14,076 | 92,872 | Accepted | Accepted | 35.61 |
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a_max = max(a)
b = a.copy()
b.remove(a_max)
a_max_second = max(b)
for a_i in a:
if a_i != a_max:
print(a_max)
else:
print(a_max_second) | def main():
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
L = [0]*(N+1)
for i, a in enumerate(A, start=1):
L[i] = max(L[i-1], a)
R = [0]*(N+2)
for i in range(N)[::-1]:
R[i] = max(R[i+1], A[i])
for i in range(N):
print((max(L[i], R[i+1... | 14 | 17 | 229 | 355 | n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a_max = max(a)
b = a.copy()
b.remove(a_max)
a_max_second = max(b)
for a_i in a:
if a_i != a_max:
print(a_max)
else:
print(a_max_second)
| def main():
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
L = [0] * (N + 1)
for i, a in enumerate(A, start=1):
L[i] = max(L[i - 1], a)
R = [0] * (N + 2)
for i in range(N)[::-1]:
R[i] = max(R[i + 1], A[i])
for i in range(N):
print((max(L[i], R[i + 1... | false | 17.647059 | [
"-n = int(eval(input()))",
"-a = [int(eval(input())) for i in range(n)]",
"-a_max = max(a)",
"-b = a.copy()",
"-b.remove(a_max)",
"-a_max_second = max(b)",
"-for a_i in a:",
"- if a_i != a_max:",
"- print(a_max)",
"- else:",
"- print(a_max_second)",
"+def main():",
"+ ... | false | 0.040505 | 0.092844 | 0.436266 | [
"s263718149",
"s799083154"
] |
u278955646 | p02881 | python | s309089849 | s787929248 | 153 | 128 | 3,060 | 3,060 | Accepted | Accepted | 16.34 | import math
N = int(eval(input()))
answer = N + 1
for a in range(1, math.floor(math.sqrt(N)) + 1):
if N % a == 0:
answer = min(answer, int(a + N / a) - 2)
print(answer) | import math
N = int(eval(input()))
print((min([a + N // a - 2 for a in range(math.floor(math.sqrt(N)) + 1, 0, -1) if N % a == 0])))
| 9 | 3 | 185 | 126 | import math
N = int(eval(input()))
answer = N + 1
for a in range(1, math.floor(math.sqrt(N)) + 1):
if N % a == 0:
answer = min(answer, int(a + N / a) - 2)
print(answer)
| import math
N = int(eval(input()))
print(
(
min(
[
a + N // a - 2
for a in range(math.floor(math.sqrt(N)) + 1, 0, -1)
if N % a == 0
]
)
)
)
| false | 66.666667 | [
"-answer = N + 1",
"-for a in range(1, math.floor(math.sqrt(N)) + 1):",
"- if N % a == 0:",
"- answer = min(answer, int(a + N / a) - 2)",
"-print(answer)",
"+print(",
"+ (",
"+ min(",
"+ [",
"+ a + N // a - 2",
"+ for a in range(math.f... | false | 0.03876 | 0.037083 | 1.045216 | [
"s309089849",
"s787929248"
] |
u025501820 | p02660 | python | s889477124 | s128580961 | 251 | 178 | 9,500 | 9,496 | Accepted | Accepted | 29.08 | import sys
N = int(sys.stdin.readline().rstrip())
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
def prime_jud... | import sys
N = int(sys.stdin.readline().rstrip())
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
def prime_fac... | 60 | 40 | 1,235 | 820 | import sys
N = int(sys.stdin.readline().rstrip())
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
def prime_judge(n):
... | import sys
N = int(sys.stdin.readline().rstrip())
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
def prime_factorize(n):... | false | 33.333333 | [
"-def prime_judge(n):",
"+def prime_factorize(n):",
"-def prime_factorize(n):",
"- a = []",
"- while n % 2 == 0:",
"- a.append(2)",
"- n //= 2",
"- f = 3",
"- while f * f <= n:",
"- if n % f == 0:",
"- a.append(f)",
"- n //= f",
"- ... | false | 0.0745 | 0.063597 | 1.171431 | [
"s889477124",
"s128580961"
] |
u241159583 | p03696 | python | s226475887 | s452965270 | 30 | 25 | 9,040 | 9,080 | Accepted | Accepted | 16.67 | n = int(eval(input()))
s = eval(input())
ans = s
while s.count("()")>0:
s = s.replace("()", "")
cnt_l = s.count(")")
cnt_r = s.count("(")
ans = cnt_l * "(" + ans
ans += cnt_r * ")"
print(ans) | n = int(eval(input()))
s = eval(input())
ans = s
while s.count("()")>0:
s = s.replace("()", "")
cnt_l = s.count(")")
cnt_r = s.count("(")
print((cnt_l * "(" + ans + cnt_r * ")")) | 10 | 8 | 192 | 175 | n = int(eval(input()))
s = eval(input())
ans = s
while s.count("()") > 0:
s = s.replace("()", "")
cnt_l = s.count(")")
cnt_r = s.count("(")
ans = cnt_l * "(" + ans
ans += cnt_r * ")"
print(ans)
| n = int(eval(input()))
s = eval(input())
ans = s
while s.count("()") > 0:
s = s.replace("()", "")
cnt_l = s.count(")")
cnt_r = s.count("(")
print((cnt_l * "(" + ans + cnt_r * ")"))
| false | 20 | [
"-ans = cnt_l * \"(\" + ans",
"-ans += cnt_r * \")\"",
"-print(ans)",
"+print((cnt_l * \"(\" + ans + cnt_r * \")\"))"
] | false | 0.049548 | 0.126871 | 0.390536 | [
"s226475887",
"s452965270"
] |
u703528810 | p02732 | python | s804677194 | s139760845 | 473 | 418 | 24,748 | 26,268 | Accepted | Accepted | 11.63 | N=int(eval(input()))
A=list(map(int,input().split()))
A1=sorted(A)
cnt=[0 for _ in range(N+1)] #cnt_table[i]: 数字iの要素の個数
for i in range(N):
cnt[A[i]]+=1
cmb=[cnt[k]*(cnt[k]-1)//2 for k in range(N+1)]
SUM=sum(cmb)
for j in range(N):
n=A[j]
v=cnt[A[j]]
print((SUM-cmb[n]+(v-1)*(v-2)//2))
| N=int(eval(input()))
A=list(map(int,input().split()))
cnt=[0 for _ in range(N+1)]
for i in range(N):
cnt[A[i]]+=1
cmb=[cnt[k]*(cnt[k]-1)//2 for k in range(N+1)]
SUM=sum(cmb)
for j in range(N):
n=A[j]
v=cnt[A[j]]
print((SUM-cmb[n]+(v-1)*(v-2)//2)) | 15 | 11 | 310 | 264 | N = int(eval(input()))
A = list(map(int, input().split()))
A1 = sorted(A)
cnt = [0 for _ in range(N + 1)] # cnt_table[i]: 数字iの要素の個数
for i in range(N):
cnt[A[i]] += 1
cmb = [cnt[k] * (cnt[k] - 1) // 2 for k in range(N + 1)]
SUM = sum(cmb)
for j in range(N):
n = A[j]
v = cnt[A[j]]
print((SUM - cmb[n] + (... | N = int(eval(input()))
A = list(map(int, input().split()))
cnt = [0 for _ in range(N + 1)]
for i in range(N):
cnt[A[i]] += 1
cmb = [cnt[k] * (cnt[k] - 1) // 2 for k in range(N + 1)]
SUM = sum(cmb)
for j in range(N):
n = A[j]
v = cnt[A[j]]
print((SUM - cmb[n] + (v - 1) * (v - 2) // 2))
| false | 26.666667 | [
"-A1 = sorted(A)",
"-cnt = [0 for _ in range(N + 1)] # cnt_table[i]: 数字iの要素の個数",
"+cnt = [0 for _ in range(N + 1)]"
] | false | 0.03452 | 0.036343 | 0.949823 | [
"s804677194",
"s139760845"
] |
u979444096 | p02773 | python | s610831481 | s244766788 | 717 | 662 | 49,204 | 45,076 | Accepted | Accepted | 7.67 | from collections import Counter
def main():
N = int(eval(input()))
A = [eval(input()) for _ in range(N)]
C = Counter(A)
most_c = C.most_common()
max_num = most_c[0][1]
ANS = []
for c in most_c:
if c[1] < max_num:
break
ANS.append(c[0])
for an... | from collections import Counter
def main():
N = int(eval(input()))
A = [eval(input()) for _ in range(N)]
c = Counter(A)
max_num = c.most_common()[0][1]
ANS = [i[0] for i in list(c.items()) if i[1] == max_num]
ANS.sort()
for ans in ANS:
print(ans)
if __name__ == '_... | 21 | 17 | 390 | 324 | from collections import Counter
def main():
N = int(eval(input()))
A = [eval(input()) for _ in range(N)]
C = Counter(A)
most_c = C.most_common()
max_num = most_c[0][1]
ANS = []
for c in most_c:
if c[1] < max_num:
break
ANS.append(c[0])
for ans in sorted(ANS)... | from collections import Counter
def main():
N = int(eval(input()))
A = [eval(input()) for _ in range(N)]
c = Counter(A)
max_num = c.most_common()[0][1]
ANS = [i[0] for i in list(c.items()) if i[1] == max_num]
ANS.sort()
for ans in ANS:
print(ans)
if __name__ == "__main__":
ma... | false | 19.047619 | [
"- C = Counter(A)",
"- most_c = C.most_common()",
"- max_num = most_c[0][1]",
"- ANS = []",
"- for c in most_c:",
"- if c[1] < max_num:",
"- break",
"- ANS.append(c[0])",
"- for ans in sorted(ANS):",
"+ c = Counter(A)",
"+ max_num = c.most_common(... | false | 0.075411 | 0.047092 | 1.601361 | [
"s610831481",
"s244766788"
] |
u476124554 | p03160 | python | s533375060 | s396739799 | 166 | 132 | 13,928 | 14,036 | Accepted | Accepted | 20.48 | n = int(eval(input()))
h = list(map(int,input().split()))
dp = [float("inf")]*n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(1,n):
dp[i] = min(dp[i],dp[i-1] + abs(h[i] - h[i-1]))
if i >= 2:
dp[i] = min(dp[i],dp[i-2] + abs(h[i] - h[i-2]))
print((dp[-1])) | n = int(eval(input()))
h = list(map(int,input().split()))
dp = [10 ** 5 for i in range(n)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(n-2):
dp[i+2] = min(dp[i] + abs(h[i+2] - h[i]), dp[i+1] + abs(h[i+2] - h[i+1]))
print((dp[-1])) | 13 | 9 | 284 | 241 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(1, n):
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
if i >= 2:
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [10**5 for i in range(n)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(n - 2):
dp[i + 2] = min(dp[i] + abs(h[i + 2] - h[i]), dp[i + 1] + abs(h[i + 2] - h[i + 1]))
print((dp[-1]))
| false | 30.769231 | [
"-dp = [float(\"inf\")] * n",
"+dp = [10**5 for i in range(n)]",
"-for i in range(1, n):",
"- dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))",
"- if i >= 2:",
"- dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))",
"+for i in range(n - 2):",
"+ dp[i + 2] = min(dp[i] + abs(h[i +... | false | 0.042317 | 0.099941 | 0.423419 | [
"s533375060",
"s396739799"
] |
u278886389 | p03608 | python | s544418243 | s720372785 | 448 | 409 | 8,304 | 8,336 | Accepted | Accepted | 8.71 | INF = float('inf')
N,M,RR = list(map(int,input().split(" ")))
R = list([int(x)-1 for x in input().split(" ")])
G = [[] for i in range(N)]
sq = [[(x==y)-1 for x in range(RR)] for y in range(RR)]
for i in range(M):
a,b,c = list(map(int,input().split(" ")))
a -= 1
b -= 1
G[a].append((b,c))
... | INF = float('inf')
N,M,RR = list(map(int,input().split(" ")))
R = list([int(x)-1 for x in input().split(" ")])
G = [[] for i in range(N)]
sq = [[(x==y)-1 for x in range(RR)] for y in range(RR)]
for i in range(M):
a,b,c = list(map(int,input().split(" ")))
a -= 1
b -= 1
G[a].append((b,c))
... | 51 | 46 | 1,204 | 1,005 | INF = float("inf")
N, M, RR = list(map(int, input().split(" ")))
R = list([int(x) - 1 for x in input().split(" ")])
G = [[] for i in range(N)]
sq = [[(x == y) - 1 for x in range(RR)] for y in range(RR)]
for i in range(M):
a, b, c = list(map(int, input().split(" ")))
a -= 1
b -= 1
G[a].append((b, c))
... | INF = float("inf")
N, M, RR = list(map(int, input().split(" ")))
R = list([int(x) - 1 for x in input().split(" ")])
G = [[] for i in range(N)]
sq = [[(x == y) - 1 for x in range(RR)] for y in range(RR)]
for i in range(M):
a, b, c = list(map(int, input().split(" ")))
a -= 1
b -= 1
G[a].append((b, c))
... | false | 9.803922 | [
"- E = [INF for x in range(N)]",
"- F = [0 for x in range(N)]",
"+ E = [INF] * N",
"+ F = [1] * N",
"- F[R[i]] = 1",
"+ F[R[i]] = 0",
"- continue",
"- if E[a] == -1:",
"- E[a] = E[q] + b",
"- else:",
"- a = [x for x in ... | false | 0.07032 | 0.057933 | 1.213803 | [
"s544418243",
"s720372785"
] |
u155757809 | p03633 | python | s277469141 | s573514758 | 33 | 25 | 9,508 | 9,152 | Accepted | Accepted | 24.24 | import math
from functools import reduce
def lcm_base(x, y):
return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
n = int(eval(input()))
l = []
for i in range(n):
t = int(eval(input()))
l.append(t)
print((lcm_list(l)))
| def gcd(m, n):
if m < n:
m, n = n, m
while True:
r = m % n
if r == 0:
return n
else:
m, n = n, r
def lcm(m, n):
return m*n // gcd(m, n)
n = int(eval(input()))
l = []
ans = 1
for i in range(n):
t = int(eval(input()))
an... | 18 | 24 | 283 | 338 | import math
from functools import reduce
def lcm_base(x, y):
return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
n = int(eval(input()))
l = []
for i in range(n):
t = int(eval(input()))
l.append(t)
print((lcm_list(l)))
| def gcd(m, n):
if m < n:
m, n = n, m
while True:
r = m % n
if r == 0:
return n
else:
m, n = n, r
def lcm(m, n):
return m * n // gcd(m, n)
n = int(eval(input()))
l = []
ans = 1
for i in range(n):
t = int(eval(input()))
ans = lcm(ans, t)
prin... | false | 25 | [
"-import math",
"-from functools import reduce",
"+def gcd(m, n):",
"+ if m < n:",
"+ m, n = n, m",
"+ while True:",
"+ r = m % n",
"+ if r == 0:",
"+ return n",
"+ else:",
"+ m, n = n, r",
"-def lcm_base(x, y):",
"- return (x * y) /... | false | 0.036515 | 0.038538 | 0.947526 | [
"s277469141",
"s573514758"
] |
u347600233 | p02765 | python | s473960042 | s759790233 | 29 | 26 | 9,096 | 9,156 | Accepted | Accepted | 10.34 | n, r = list(map(int, input().split()))
print((r + max(0, 100*(10 - n)))) | n, r = list(map(int, input().split()))
print((r + 100*(10 - min(10, n)))) | 2 | 2 | 65 | 66 | n, r = list(map(int, input().split()))
print((r + max(0, 100 * (10 - n))))
| n, r = list(map(int, input().split()))
print((r + 100 * (10 - min(10, n))))
| false | 0 | [
"-print((r + max(0, 100 * (10 - n))))",
"+print((r + 100 * (10 - min(10, n))))"
] | false | 0.046844 | 0.047705 | 0.981954 | [
"s473960042",
"s759790233"
] |
u761320129 | p03761 | python | s876531107 | s749399735 | 25 | 22 | 3,316 | 3,316 | Accepted | Accepted | 12 | from collections import Counter
N = int(eval(input()))
src = [eval(input()) for i in range(N)]
ctr = Counter(src[0])
for s in src[1:]:
ctr &= Counter(s)
ans = ''
for k,v in sorted(ctr.items()):
ans += k*v
print(ans) | N = int(eval(input()))
S = [eval(input()) for i in range(N)]
from collections import Counter
ctr = Counter(S[0])
for s in S[1:]:
ctr &= Counter(s)
ans = ''
for k,v in sorted(ctr.items()):
ans += k * v
print(ans) | 12 | 10 | 224 | 216 | from collections import Counter
N = int(eval(input()))
src = [eval(input()) for i in range(N)]
ctr = Counter(src[0])
for s in src[1:]:
ctr &= Counter(s)
ans = ""
for k, v in sorted(ctr.items()):
ans += k * v
print(ans)
| N = int(eval(input()))
S = [eval(input()) for i in range(N)]
from collections import Counter
ctr = Counter(S[0])
for s in S[1:]:
ctr &= Counter(s)
ans = ""
for k, v in sorted(ctr.items()):
ans += k * v
print(ans)
| false | 16.666667 | [
"+N = int(eval(input()))",
"+S = [eval(input()) for i in range(N)]",
"-N = int(eval(input()))",
"-src = [eval(input()) for i in range(N)]",
"-ctr = Counter(src[0])",
"-for s in src[1:]:",
"+ctr = Counter(S[0])",
"+for s in S[1:]:"
] | false | 0.112239 | 0.050685 | 2.214439 | [
"s876531107",
"s749399735"
] |
u633068244 | p00915 | python | s554092459 | s736260773 | 170 | 90 | 4,276 | 4,252 | Accepted | Accepted | 47.06 | while 1:
n,l = list(map(int,input().split()))
if n == 0: break
tube = [[] for i in range(l-1)]
for i in range(1,n+1):
d,p = input().split()
tube[int(p)-1].append(i if d == "R" else -i)
t = num = 0
while sum(len(ele) for ele in tube) != 0:
for s in [-1,1]:
... | while 1:
n,l = list(map(int,input().split()))
if n == 0: break
R = [0]*(l-1)
L = [0]*(l-1)
for i in range(1,n+1):
d,p = input().split()
p = int(p)-1
if d == "R": R[p] = i
else: L[p] = i
t = num = 0
while sum(R)+sum(L) != 0:
if R[-1] > 0: nu... | 24 | 20 | 800 | 535 | while 1:
n, l = list(map(int, input().split()))
if n == 0:
break
tube = [[] for i in range(l - 1)]
for i in range(1, n + 1):
d, p = input().split()
tube[int(p) - 1].append(i if d == "R" else -i)
t = num = 0
while sum(len(ele) for ele in tube) != 0:
for s in [-1, 1... | while 1:
n, l = list(map(int, input().split()))
if n == 0:
break
R = [0] * (l - 1)
L = [0] * (l - 1)
for i in range(1, n + 1):
d, p = input().split()
p = int(p) - 1
if d == "R":
R[p] = i
else:
L[p] = i
t = num = 0
while sum(R) +... | false | 16.666667 | [
"- tube = [[] for i in range(l - 1)]",
"+ R = [0] * (l - 1)",
"+ L = [0] * (l - 1)",
"- tube[int(p) - 1].append(i if d == \"R\" else -i)",
"+ p = int(p) - 1",
"+ if d == \"R\":",
"+ R[p] = i",
"+ else:",
"+ L[p] = i",
"- while sum(len(e... | false | 0.077438 | 0.042587 | 1.818368 | [
"s554092459",
"s736260773"
] |
u762420987 | p03986 | python | s386821239 | s248987707 | 207 | 187 | 48,864 | 48,352 | Accepted | Accepted | 9.66 | from collections import deque
d = deque()
X = eval(input())
for c in X:
d.append(c)
while len(d) >= 2:
new = d.pop()
last = d.pop()
if last == "S" and new == "T":
continue
else:
d.append(last)
d.append(new)
break
print... | from collections import deque
d = deque()
X = eval(input())
for c in X:
if d:
last = d.pop()
if last == "S" and c == "T":
pass
else:
d.append(last)
d.append(c)
else:
d.append(c)
print((len(d)))
| 15 | 14 | 322 | 275 | from collections import deque
d = deque()
X = eval(input())
for c in X:
d.append(c)
while len(d) >= 2:
new = d.pop()
last = d.pop()
if last == "S" and new == "T":
continue
else:
d.append(last)
d.append(new)
break
print((len(d)))
| from collections import deque
d = deque()
X = eval(input())
for c in X:
if d:
last = d.pop()
if last == "S" and c == "T":
pass
else:
d.append(last)
d.append(c)
else:
d.append(c)
print((len(d)))
| false | 6.666667 | [
"- d.append(c)",
"- while len(d) >= 2:",
"- new = d.pop()",
"+ if d:",
"- if last == \"S\" and new == \"T\":",
"- continue",
"+ if last == \"S\" and c == \"T\":",
"+ pass",
"- d.append(new)",
"- break",
"+ d.app... | false | 0.049388 | 0.049476 | 0.998219 | [
"s386821239",
"s248987707"
] |
u725107050 | p03161 | python | s549525192 | s421338066 | 487 | 409 | 57,312 | 57,184 | Accepted | Accepted | 16.02 | N, K = list(map(int, input().split()))
h_list = list(map(int, input().split()))
dp = [float('INF') for i in range(N)]
dp[0] = 0
def change_min(a, b):
if a > b: return b
else: return a
for i in range(N):
for j in range(1, K + 1):
if i + j > N - 1: continue
dp[i + j] = change_min(dp[i] + abs(h... | N, K = list(map(int, input().split()))
h_list = list(map(int, input().split()))
dp = [float('INF') for i in range(N)]
dp[0] = 0
def update_dp(now, next):
global h_list
global dp
global N
if next > N - 1: return
if dp[next] > dp[now] + abs(h_list[next] - h_list[now]):
dp[next] = dp[now] + abs(... | 15 | 19 | 371 | 449 | N, K = list(map(int, input().split()))
h_list = list(map(int, input().split()))
dp = [float("INF") for i in range(N)]
dp[0] = 0
def change_min(a, b):
if a > b:
return b
else:
return a
for i in range(N):
for j in range(1, K + 1):
if i + j > N - 1:
continue
dp[i... | N, K = list(map(int, input().split()))
h_list = list(map(int, input().split()))
dp = [float("INF") for i in range(N)]
dp[0] = 0
def update_dp(now, next):
global h_list
global dp
global N
if next > N - 1:
return
if dp[next] > dp[now] + abs(h_list[next] - h_list[now]):
dp[next] = dp[... | false | 21.052632 | [
"-def change_min(a, b):",
"- if a > b:",
"- return b",
"- else:",
"- return a",
"+def update_dp(now, next):",
"+ global h_list",
"+ global dp",
"+ global N",
"+ if next > N - 1:",
"+ return",
"+ if dp[next] > dp[now] + abs(h_list[next] - h_list[now]):"... | false | 0.043877 | 0.095685 | 0.458563 | [
"s549525192",
"s421338066"
] |
u989306199 | p03610 | python | s195725170 | s878826505 | 79 | 17 | 4,596 | 3,188 | Accepted | Accepted | 78.48 | s = input()
for i,c in enumerate(s):
if i % 2==0:
print(c, end='')
| s = eval(input())
print((s[::2])) | 4 | 2 | 82 | 26 | s = input()
for i, c in enumerate(s):
if i % 2 == 0:
print(c, end="")
| s = eval(input())
print((s[::2]))
| false | 50 | [
"-s = input()",
"-for i, c in enumerate(s):",
"- if i % 2 == 0:",
"- print(c, end=\"\")",
"+s = eval(input())",
"+print((s[::2]))"
] | false | 0.044362 | 0.038595 | 1.14941 | [
"s195725170",
"s878826505"
] |
u225388820 | p02695 | python | s714409367 | s122427378 | 1,456 | 1,003 | 22,960 | 9,120 | Accepted | Accepted | 31.11 | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n,m,q=list(map(int,input().split()))
x=[list(map(int,input().split())) for i in range(q)]
for i in range(q):
for j in range(2):
x[i][j]-=1
a=[]
def dfs(v):
if len(v)>n:
return
if len(v)==n:
a.append(... | from itertools import combinations_with_replacement
n,m,q=list(map(int,input().split()))
a,b,c,d=[0]*q,[0]*q,[0]*q,[0]*q
for i in range(q):
x,y,z,w=list(map(int,input().split()))
x-=1
y-=1
a[i],b[i],c[i],d[i]=x,y,z,w
ans=0
for v in combinations_with_replacement(list(range(1,m+1)),n):
res=0... | 26 | 16 | 570 | 418 | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n, m, q = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(q)]
for i in range(q):
for j in range(2):
x[i][j] -= 1
a = []
def dfs(v):
if len(v) > n:
return
if len(v) == n:
a.a... | from itertools import combinations_with_replacement
n, m, q = list(map(int, input().split()))
a, b, c, d = [0] * q, [0] * q, [0] * q, [0] * q
for i in range(q):
x, y, z, w = list(map(int, input().split()))
x -= 1
y -= 1
a[i], b[i], c[i], d[i] = x, y, z, w
ans = 0
for v in combinations_with_replacement(... | false | 38.461538 | [
"-import sys",
"+from itertools import combinations_with_replacement",
"-sys.setrecursionlimit(1000000000)",
"-input = sys.stdin.readline",
"-x = [list(map(int, input().split())) for i in range(q)]",
"+a, b, c, d = [0] * q, [0] * q, [0] * q, [0] * q",
"- for j in range(2):",
"- x[i][j] -= 1"... | false | 0.07455 | 0.047322 | 1.575368 | [
"s714409367",
"s122427378"
] |
u537782349 | p03848 | python | s035970140 | s224509029 | 118 | 99 | 14,008 | 14,008 | Accepted | Accepted | 16.1 | a = int(eval(input()))
b = list(map(int, input().split()))
b.sort()
c = 1 if a % 2 == 0 else 0
for i in range(a):
if (a % 2) ^ (i % 2) == 0 and i != 0:
c += 2
if b[i] != c:
print((0))
exit()
print(((2 ** (a // 2)) % (10 ** 9 + 7)))
| a = int(eval(input()))
b = list(map(int, input().split()))
b.sort()
if a % 2 == 0:
c = 1
for i in range(len(b)):
if i > 0 and i % 2 == 0:
c += 2
if b[i] != c:
print((0))
exit()
print(((2 ** (a // 2)) % (10 ** 9 + 7)))
else:
c = 0
for ... | 11 | 21 | 264 | 497 | a = int(eval(input()))
b = list(map(int, input().split()))
b.sort()
c = 1 if a % 2 == 0 else 0
for i in range(a):
if (a % 2) ^ (i % 2) == 0 and i != 0:
c += 2
if b[i] != c:
print((0))
exit()
print(((2 ** (a // 2)) % (10**9 + 7)))
| a = int(eval(input()))
b = list(map(int, input().split()))
b.sort()
if a % 2 == 0:
c = 1
for i in range(len(b)):
if i > 0 and i % 2 == 0:
c += 2
if b[i] != c:
print((0))
exit()
print(((2 ** (a // 2)) % (10**9 + 7)))
else:
c = 0
for i in range(len(b... | false | 47.619048 | [
"-c = 1 if a % 2 == 0 else 0",
"-for i in range(a):",
"- if (a % 2) ^ (i % 2) == 0 and i != 0:",
"- c += 2",
"- if b[i] != c:",
"- print((0))",
"- exit()",
"-print(((2 ** (a // 2)) % (10**9 + 7)))",
"+if a % 2 == 0:",
"+ c = 1",
"+ for i in range(len(b)):",
"+ ... | false | 0.046125 | 0.048154 | 0.957872 | [
"s035970140",
"s224509029"
] |
u729133443 | p03852 | python | s171184603 | s320580212 | 182 | 28 | 38,256 | 9,036 | Accepted | Accepted | 84.62 | print(('vowel'*(eval(input())in'aiueo')or'consonant')) | print((('consonant','vowel')[eval(input())in'aiueo'])) | 1 | 1 | 46 | 46 | print(("vowel" * (eval(input()) in "aiueo") or "consonant"))
| print((("consonant", "vowel")[eval(input()) in "aiueo"]))
| false | 0 | [
"-print((\"vowel\" * (eval(input()) in \"aiueo\") or \"consonant\"))",
"+print(((\"consonant\", \"vowel\")[eval(input()) in \"aiueo\"]))"
] | false | 0.035931 | 0.081116 | 0.442957 | [
"s171184603",
"s320580212"
] |
u858748695 | p02755 | python | s846333250 | s201091207 | 33 | 17 | 2,940 | 2,940 | Accepted | Accepted | 48.48 | #!/usr/bin/env python3
a, b = list(map(int, input().split()))
for i in range(10 ** 5):
if i * 8 // 100 == a and i // 10 == b:
print(i)
exit()
print((-1))
| #!/usr/bin/env python3
a, b = list(map(int, input().split()))
mn = max(100 * a, 80 * b)
mx = min(100 * a + 99, 80 * b + 72)
print(((mn + 7) // 8 if mn <= mx else -1))
| 7 | 5 | 172 | 163 | #!/usr/bin/env python3
a, b = list(map(int, input().split()))
for i in range(10**5):
if i * 8 // 100 == a and i // 10 == b:
print(i)
exit()
print((-1))
| #!/usr/bin/env python3
a, b = list(map(int, input().split()))
mn = max(100 * a, 80 * b)
mx = min(100 * a + 99, 80 * b + 72)
print(((mn + 7) // 8 if mn <= mx else -1))
| false | 28.571429 | [
"-for i in range(10**5):",
"- if i * 8 // 100 == a and i // 10 == b:",
"- print(i)",
"- exit()",
"-print((-1))",
"+mn = max(100 * a, 80 * b)",
"+mx = min(100 * a + 99, 80 * b + 72)",
"+print(((mn + 7) // 8 if mn <= mx else -1))"
] | false | 0.06361 | 0.085264 | 0.746036 | [
"s846333250",
"s201091207"
] |
u624689667 | p03266 | python | s802379965 | s201617002 | 194 | 171 | 50,800 | 38,384 | Accepted | Accepted | 11.86 | import collections
N, K = [int(i) for i in input().split()]
# Kで割ってvalue余る数が1以上key以下にいくつあるか
d = collections.defaultdict(int)
for i in range(1, N + 1):
d[i % K] += 1
ans = 0
for a in range(K):
b = (K - a) % K
c = (K - a) % K
if (b + c) % K:
continue
ans += d[a] * d[b] * d[c]
... | import collections
N, K = [int(i) for i in input().split()]
ans = (N // K) ** 3
if K % 2 == 0:
ans += ((N + K//2) // K) ** 3
print(ans)
| 16 | 7 | 330 | 147 | import collections
N, K = [int(i) for i in input().split()]
# Kで割ってvalue余る数が1以上key以下にいくつあるか
d = collections.defaultdict(int)
for i in range(1, N + 1):
d[i % K] += 1
ans = 0
for a in range(K):
b = (K - a) % K
c = (K - a) % K
if (b + c) % K:
continue
ans += d[a] * d[b] * d[c]
print(ans)
| import collections
N, K = [int(i) for i in input().split()]
ans = (N // K) ** 3
if K % 2 == 0:
ans += ((N + K // 2) // K) ** 3
print(ans)
| false | 56.25 | [
"-# Kで割ってvalue余る数が1以上key以下にいくつあるか",
"-d = collections.defaultdict(int)",
"-for i in range(1, N + 1):",
"- d[i % K] += 1",
"-ans = 0",
"-for a in range(K):",
"- b = (K - a) % K",
"- c = (K - a) % K",
"- if (b + c) % K:",
"- continue",
"- ans += d[a] * d[b] * d[c]",
"+ans =... | false | 0.038897 | 0.040295 | 0.965299 | [
"s802379965",
"s201617002"
] |
u775421443 | p03160 | python | s575134084 | s117111802 | 86 | 76 | 14,184 | 14,184 | Accepted | Accepted | 11.63 | def main():
n = int(eval(input()))
hs = tuple(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
d1 = a + abs(hs[i] - hs[i-2])
d2 = b + abs(hs[i] - hs[i-1])
a, b = b, min(d1, d2)
print(b)
if __name__ == "__main__":
main()
| def main():
n = int(eval(input()))
hs = tuple(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
d1 = a + abs(hs[i] - hs[i-2])
d2 = b + abs(hs[i] - hs[i-1])
a, b = b, d1 if d1 <= d2 else d2
print(b)
if __name__ == "__main__":
main()
| 15 | 15 | 285 | 296 | def main():
n = int(eval(input()))
hs = tuple(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
d1 = a + abs(hs[i] - hs[i - 2])
d2 = b + abs(hs[i] - hs[i - 1])
a, b = b, min(d1, d2)
print(b)
if __name__ == "__main__":
main()
| def main():
n = int(eval(input()))
hs = tuple(map(int, input().split()))
a, b = 0, abs(hs[1] - hs[0])
for i in range(2, n):
d1 = a + abs(hs[i] - hs[i - 2])
d2 = b + abs(hs[i] - hs[i - 1])
a, b = b, d1 if d1 <= d2 else d2
print(b)
if __name__ == "__main__":
main()
| false | 0 | [
"- a, b = b, min(d1, d2)",
"+ a, b = b, d1 if d1 <= d2 else d2"
] | false | 0.045783 | 0.044921 | 1.01918 | [
"s575134084",
"s117111802"
] |
u053749071 | p02899 | python | s920349721 | s031482930 | 270 | 203 | 52,164 | 105,408 | Accepted | Accepted | 24.81 | import math
import numpy as np
n = int(eval(input()))
a = list(map(int, input().split()))
# a = np.array(a)
# ans = []
# while a.min() != 9999999:
# min_index = a.argmin()
# ans.append(min_index+1)
# a[min_index] = 9999999
# print(' '.join([str(_) for _ in ans]))
l = []
for i in range(n)... | n = int(eval(input()))
a = list(map(int, input().split()))
# a = np.array(a)
# ans = []
# while a.min() != 9999999:
# min_index = a.argmin()
# ans.append(min_index+1)
# a[min_index] = 9999999
# print(' '.join([str(_) for _ in ans]))
l = []
for i in range(n):
l.append([i+1, a[i]])
sl ... | 22 | 19 | 447 | 412 | import math
import numpy as np
n = int(eval(input()))
a = list(map(int, input().split()))
# a = np.array(a)
# ans = []
# while a.min() != 9999999:
# min_index = a.argmin()
# ans.append(min_index+1)
# a[min_index] = 9999999
# print(' '.join([str(_) for _ in ans]))
l = []
for i in range(n):
l.append([i +... | n = int(eval(input()))
a = list(map(int, input().split()))
# a = np.array(a)
# ans = []
# while a.min() != 9999999:
# min_index = a.argmin()
# ans.append(min_index+1)
# a[min_index] = 9999999
# print(' '.join([str(_) for _ in ans]))
l = []
for i in range(n):
l.append([i + 1, a[i]])
sl = sorted(l, key=la... | false | 13.636364 | [
"-import math",
"-import numpy as np",
"-"
] | false | 0.128412 | 0.038386 | 3.345254 | [
"s920349721",
"s031482930"
] |
u416011173 | p02601 | python | s333239923 | s869696617 | 31 | 28 | 9,080 | 9,216 | Accepted | Accepted | 9.68 | # -*- coding: utf-8 -*-
# モジュールのインポート
import math
# 標準入力を取得
A, B, C = list(map(int, input().split()))
K = int(eval(input()))
# 求解処理
ans = str()
k_b = 0
if A >= B:
k_b = int(math.log(A / B) / math.log(2)) + 1
if k_b > K:
ans = "No"
else:
if 2**(K - k_b) * C > 2**k_b * B:
ans = "Yes... | # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
A, B, C = list(map(int, input().split()))
K = int(eval(input()))
return A, B, C, K
def main(A: int, B: int, C: int, K: int) -> None:
"""
メイン処理.
Args:\n
... | 23 | 45 | 369 | 785 | # -*- coding: utf-8 -*-
# モジュールのインポート
import math
# 標準入力を取得
A, B, C = list(map(int, input().split()))
K = int(eval(input()))
# 求解処理
ans = str()
k_b = 0
if A >= B:
k_b = int(math.log(A / B) / math.log(2)) + 1
if k_b > K:
ans = "No"
else:
if 2 ** (K - k_b) * C > 2**k_b * B:
ans = "Yes"
else:
... | # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
A, B, C = list(map(int, input().split()))
K = int(eval(input()))
return A, B, C, K
def main(A: int, B: int, C: int, K: int) -> None:
"""
メイン処理.
Args:\n
A (int): 整数(1 <= A... | false | 48.888889 | [
"-# モジュールのインポート",
"-import math",
"+def get_input() -> tuple:",
"+ \"\"\"",
"+ 標準入力を取得する.",
"+ Returns:\\n",
"+ tuple: 標準入力",
"+ \"\"\"",
"+ A, B, C = list(map(int, input().split()))",
"+ K = int(eval(input()))",
"+ return A, B, C, K",
"-# 標準入力を取得",
"-A, B, C = li... | false | 0.036551 | 0.036438 | 1.003102 | [
"s333239923",
"s869696617"
] |
u562935282 | p02990 | python | s016439668 | s481052884 | 224 | 33 | 43,376 | 3,984 | Accepted | Accepted | 85.27 | def cmb(n, r):
if n < r:
return 0 # <-直した
if r > n - r:
return cmb(n, n - r)
if r == 0:
return 1
if r == 1:
return n
res = f[n]
res *= invs[r]
res %= MOD
res *= invs[n - r]
res %= MOD
return res
MOD = 10 ** 9 + 7
N, K = list(m... | from collections import defaultdict
mod = 10 ** 9 + 7
memo = defaultdict(int)
def cmb(n, r):
if (n, r) in memo:
return memo[(n, r)]
if n < r or r < 0:
return 0
if r > n - r:
return cmb(n, n - r)
res = f[n] * pow(f[n - r], mod - 2, mod) * pow(f[r], mod - 2,... | 40 | 30 | 731 | 568 | def cmb(n, r):
if n < r:
return 0 # <-直した
if r > n - r:
return cmb(n, n - r)
if r == 0:
return 1
if r == 1:
return n
res = f[n]
res *= invs[r]
res %= MOD
res *= invs[n - r]
res %= MOD
return res
MOD = 10**9 + 7
N, K = list(map(int, input().split... | from collections import defaultdict
mod = 10**9 + 7
memo = defaultdict(int)
def cmb(n, r):
if (n, r) in memo:
return memo[(n, r)]
if n < r or r < 0:
return 0
if r > n - r:
return cmb(n, n - r)
res = f[n] * pow(f[n - r], mod - 2, mod) * pow(f[r], mod - 2, mod) % mod
memo[(n... | false | 25 | [
"+from collections import defaultdict",
"+",
"+mod = 10**9 + 7",
"+memo = defaultdict(int)",
"+",
"+",
"- if n < r:",
"- return 0 # <-直した",
"+ if (n, r) in memo:",
"+ return memo[(n, r)]",
"+ if n < r or r < 0:",
"+ return 0",
"- if r == 0:",
"- ret... | false | 0.036025 | 0.037822 | 0.952484 | [
"s016439668",
"s481052884"
] |
u691018832 | p03578 | python | s310048277 | s087052595 | 901 | 264 | 71,252 | 56,952 | Accepted | Accepted | 70.7 | import sys
from collections import Counter
input = sys.stdin.readline
n = int(eval(input()))
d = list(map(int, input().split()))
m = int(eval(input()))
t = list(map(int, input().split()))
dif = sorted(list(Counter(d).items()))
check = sorted(list(Counter(t).items()))
cnt = 0
len_check = len(check)
for i, j... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from collections import Counter
n = int(readline())
d = list(map(int, readline().split()))
m, *t = list(map(int, read().split()))
d = Counter(d)
for k, v in li... | 23 | 18 | 536 | 411 | import sys
from collections import Counter
input = sys.stdin.readline
n = int(eval(input()))
d = list(map(int, input().split()))
m = int(eval(input()))
t = list(map(int, input().split()))
dif = sorted(list(Counter(d).items()))
check = sorted(list(Counter(t).items()))
cnt = 0
len_check = len(check)
for i, j in dif:
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from collections import Counter
n = int(readline())
d = list(map(int, readline().split()))
m, *t = list(map(int, read().split()))
d = Counter(d)
for k, v in list(Counter(t).... | false | 21.73913 | [
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+sys.setrecursionlimit(10**7)",
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"-d = list(map(int, input().split()))",
"-m = int(eval(input()))",
"-t = list(map(int... | false | 0.046558 | 0.150282 | 0.309805 | [
"s310048277",
"s087052595"
] |
u427344224 | p02984 | python | s948415607 | s443653097 | 224 | 186 | 16,944 | 14,028 | Accepted | Accepted | 16.96 | N = int(eval(input()))
a_list = list(map(int, input().split()))
odd_sum = [0]
even_sum = [0]
for i in range(N):
if i % 2 == 0:
odd_sum.append(odd_sum[-1] + a_list[i])
even_sum.append(even_sum[-1] - a_list[i])
else:
odd_sum.append(odd_sum[-1] - a_list[i])
even_sum.ap... | N = int(eval(input()))
a_list = list(map(int, input().split()))
ans = []
for i in range(N):
a = a_list[i]
if i == 0:
for j in range(1, N):
if j % 2 == 0:
a += a_list[j]
else:
a -= a_list[j]
ans.append(a)
else:
a =... | 25 | 19 | 586 | 404 | N = int(eval(input()))
a_list = list(map(int, input().split()))
odd_sum = [0]
even_sum = [0]
for i in range(N):
if i % 2 == 0:
odd_sum.append(odd_sum[-1] + a_list[i])
even_sum.append(even_sum[-1] - a_list[i])
else:
odd_sum.append(odd_sum[-1] - a_list[i])
even_sum.append(even_sum[... | N = int(eval(input()))
a_list = list(map(int, input().split()))
ans = []
for i in range(N):
a = a_list[i]
if i == 0:
for j in range(1, N):
if j % 2 == 0:
a += a_list[j]
else:
a -= a_list[j]
ans.append(a)
else:
a = a_list[i - 1]
... | false | 24 | [
"-odd_sum = [0]",
"-even_sum = [0]",
"-for i in range(N):",
"- if i % 2 == 0:",
"- odd_sum.append(odd_sum[-1] + a_list[i])",
"- even_sum.append(even_sum[-1] - a_list[i])",
"- else:",
"- odd_sum.append(odd_sum[-1] - a_list[i])",
"- even_sum.append(even_sum[-1] + a_li... | false | 0.043761 | 0.034734 | 1.259898 | [
"s948415607",
"s443653097"
] |
u089376182 | p03160 | python | s316553341 | s065592668 | 134 | 122 | 13,928 | 20,704 | Accepted | Accepted | 8.96 | n = int(eval(input()))
H = list(map(int, input().split()))
C = [0]*(n)
for i in range(1, n):
if i == 1:
C[i] = abs(H[i]-H[i-1])
else:
C[i] = min(C[i-1]+abs(H[i]-H[i-1]), C[i-2]+abs(H[i]-H[i-2]))
print((C.pop())) | n = int(eval(input()))
H = [0]+list(map(int, input().split()))
dp = [0]*(n+1)
dp[2] = abs(H[2]-H[1])
for i in range(3, n+1):
dp[i] = min(dp[i-1]+abs(H[i]-H[i-1]), dp[i-2]+abs(H[i]-H[i-2]))
print((dp[-1])) | 12 | 9 | 231 | 208 | n = int(eval(input()))
H = list(map(int, input().split()))
C = [0] * (n)
for i in range(1, n):
if i == 1:
C[i] = abs(H[i] - H[i - 1])
else:
C[i] = min(C[i - 1] + abs(H[i] - H[i - 1]), C[i - 2] + abs(H[i] - H[i - 2]))
print((C.pop()))
| n = int(eval(input()))
H = [0] + list(map(int, input().split()))
dp = [0] * (n + 1)
dp[2] = abs(H[2] - H[1])
for i in range(3, n + 1):
dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))
print((dp[-1]))
| false | 25 | [
"-H = list(map(int, input().split()))",
"-C = [0] * (n)",
"-for i in range(1, n):",
"- if i == 1:",
"- C[i] = abs(H[i] - H[i - 1])",
"- else:",
"- C[i] = min(C[i - 1] + abs(H[i] - H[i - 1]), C[i - 2] + abs(H[i] - H[i - 2]))",
"-print((C.pop()))",
"+H = [0] + list(map(int, input()... | false | 0.042322 | 0.046511 | 0.90993 | [
"s316553341",
"s065592668"
] |
u871201743 | p03176 | python | s638431194 | s964829700 | 832 | 746 | 121,936 | 121,852 | Accepted | Accepted | 10.34 | import operator
class SegmentTree:
def __init__(self, seq, op=operator.add):
self.n = len(seq)
self.op = op
self.tree = [-1] * self.n + seq
for i in reversed(list(range(1, self.n))):
self.tree[i] = op(self.tree[2*i], self.tree[2*i+1])
def modify(self, po... | import operator
class SegmentTree:
def __init__(self, seq, op=operator.add):
self.n = len(seq)
self.op = op
self.tree = [-1] * self.n + seq
for i in reversed(list(range(1, self.n))):
self.tree[i] = op(self.tree[2*i], self.tree[2*i+1])
def modify(self, po... | 57 | 60 | 1,436 | 1,462 | import operator
class SegmentTree:
def __init__(self, seq, op=operator.add):
self.n = len(seq)
self.op = op
self.tree = [-1] * self.n + seq
for i in reversed(list(range(1, self.n))):
self.tree[i] = op(self.tree[2 * i], self.tree[2 * i + 1])
def modify(self, pos, va... | import operator
class SegmentTree:
def __init__(self, seq, op=operator.add):
self.n = len(seq)
self.op = op
self.tree = [-1] * self.n + seq
for i in reversed(list(range(1, self.n))):
self.tree[i] = op(self.tree[2 * i], self.tree[2 * i + 1])
def modify(self, pos, va... | false | 5 | [
"- st = SegmentTree([0] * (n + 1), op=lambda x, y: max(x, y))",
"+ dp = [0] * (n + 1)",
"+ st = SegmentTree(dp, op=max)",
"- st.modify(heights[flower], st.query(0, heights[flower] + 1) + beauty[flower])",
"+ pos = heights[flower]",
"+ val = st.query(0, heights[flower]) + beau... | false | 0.03816 | 0.038169 | 0.999767 | [
"s638431194",
"s964829700"
] |
u562935282 | p03503 | python | s155379856 | s508543781 | 167 | 63 | 3,064 | 3,064 | Accepted | Accepted | 62.28 | n = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(n)]#F[i]は(i+1)番目の店の営業の有無のリスト
P = [list(map(int, input().split())) for _ in range(n)]#P[i]は(i+1)番目の店との同時開店数に応じた利益のリスト
ans = (-1) * 10 ** 9
for i in range(2 ** 10):
if sum(map(int, list(str(i)))) == 0:
continue
cnt_lst = [... | def main():
from itertools import combinations
N = int(eval(input()))
F = []
for _ in range(N):
t = 0
for j, b in enumerate(map(int, input().split())):
if b:
t |= (1 << j)
F.append(t)
# F[i]:=店舗iの営業時間情報
P = [list(map(int, input().s... | 20 | 34 | 637 | 799 | n = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(n)] # F[i]は(i+1)番目の店の営業の有無のリスト
P = [
list(map(int, input().split())) for _ in range(n)
] # P[i]は(i+1)番目の店との同時開店数に応じた利益のリスト
ans = (-1) * 10**9
for i in range(2**10):
if sum(map(int, list(str(i)))) == 0:
continue
cnt_lst = [0... | def main():
from itertools import combinations
N = int(eval(input()))
F = []
for _ in range(N):
t = 0
for j, b in enumerate(map(int, input().split())):
if b:
t |= 1 << j
F.append(t)
# F[i]:=店舗iの営業時間情報
P = [list(map(int, input().split())) for _... | false | 41.176471 | [
"-n = int(eval(input()))",
"-F = [list(map(int, input().split())) for _ in range(n)] # F[i]は(i+1)番目の店の営業の有無のリスト",
"-P = [",
"- list(map(int, input().split())) for _ in range(n)",
"-] # P[i]は(i+1)番目の店との同時開店数に応じた利益のリスト",
"-ans = (-1) * 10**9",
"-for i in range(2**10):",
"- if sum(map(int, list(s... | false | 0.045979 | 0.045243 | 1.016253 | [
"s155379856",
"s508543781"
] |
u761320129 | p02813 | python | s666519659 | s268176522 | 45 | 28 | 3,064 | 8,052 | Accepted | Accepted | 37.78 | n = int(eval(input()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
import itertools
i = 1
for ptn in itertools.permutations(list(range(1,n+1))):
if list(ptn)==p:
a = i
if list(ptn)==q:
b = i
i += 1
print((abs(a-b))) | N = int(eval(input()))
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
from itertools import permutations
l = list(permutations(list(range(1,N+1))))
print((abs(l.index(P) - l.index(Q)))) | 12 | 6 | 262 | 201 | n = int(eval(input()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
import itertools
i = 1
for ptn in itertools.permutations(list(range(1, n + 1))):
if list(ptn) == p:
a = i
if list(ptn) == q:
b = i
i += 1
print((abs(a - b)))
| N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
from itertools import permutations
l = list(permutations(list(range(1, N + 1))))
print((abs(l.index(P) - l.index(Q))))
| false | 50 | [
"-n = int(eval(input()))",
"-p = list(map(int, input().split()))",
"-q = list(map(int, input().split()))",
"-import itertools",
"+N = int(eval(input()))",
"+P = tuple(map(int, input().split()))",
"+Q = tuple(map(int, input().split()))",
"+from itertools import permutations",
"-i = 1",
"-for ptn in... | false | 0.11435 | 0.109576 | 1.043566 | [
"s666519659",
"s268176522"
] |
u093861603 | p03557 | python | s545914681 | s663475265 | 450 | 344 | 107,108 | 22,720 | Accepted | Accepted | 23.56 | N = int(eval(input()))
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))
"""
minnum以上で最小の数のindexを返す。無いときはlen(List)を返す
計算量log(len(List))
def bts(List,minnum,under=0):
if List[0]>=minnum:
return under
if List[... | import bisect
n=int(eval(input()))
al=list(map(int,input().split()))
bl=list(map(int,input().split()))
cl=list(map(int,input().split()))
al.sort()
bl.sort()
cl.sort()
ans=0
for b in bl:
ac=bisect.bisect_right(al,b-1)
cc=n-bisect.bisect_left(cl,b+1)
ans+=ac*cc
print(ans)
| 54 | 17 | 1,151 | 296 | N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
"""
minnum以上で最小の数のindexを返す。無いときはlen(List)を返す
計算量log(len(List))
def bts(List,minnum,under=0):
if List[0]>=minnum:
return under
if List[-1]<minnum:
... | import bisect
n = int(eval(input()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al.sort()
bl.sort()
cl.sort()
ans = 0
for b in bl:
ac = bisect.bisect_right(al, b - 1)
cc = n - bisect.bisect_left(cl, b + 1)
ans += ac * cc
print(ans)
| false | 68.518519 | [
"-N = int(eval(input()))",
"-A = sorted(list(map(int, input().split())))",
"-B = sorted(list(map(int, input().split())))",
"-C = sorted(list(map(int, input().split())))",
"-\"\"\"",
"-minnum以上で最小の数のindexを返す。無いときはlen(List)を返す",
"-計算量log(len(List))",
"-def bts(List,minnum,under=0):",
"- if List[0]>... | false | 0.043528 | 0.084563 | 0.51474 | [
"s545914681",
"s663475265"
] |
u426534722 | p02237 | python | s358295286 | s880570537 | 30 | 20 | 8,448 | 6,380 | Accepted | Accepted | 33.33 | from sys import stdin
n = int(stdin.readline())
v = [[0] * n for _ in range(n)]
for u in range(n):
l = [int(j) for j in stdin.readline().split()]
for k in l[2:]:
v[u][k - 1] = 1
print((*v[u])) | n = int(eval(input()))
MAP = [[0] * n for _ in range(n)]
for i in range(n):
u, k, *v = list(map(int, input().split()))
for j in v:
MAP[u - 1][j - 1] = 1
for m in MAP:
print((*m))
| 8 | 9 | 217 | 194 | from sys import stdin
n = int(stdin.readline())
v = [[0] * n for _ in range(n)]
for u in range(n):
l = [int(j) for j in stdin.readline().split()]
for k in l[2:]:
v[u][k - 1] = 1
print((*v[u]))
| n = int(eval(input()))
MAP = [[0] * n for _ in range(n)]
for i in range(n):
u, k, *v = list(map(int, input().split()))
for j in v:
MAP[u - 1][j - 1] = 1
for m in MAP:
print((*m))
| false | 11.111111 | [
"-from sys import stdin",
"-",
"-n = int(stdin.readline())",
"-v = [[0] * n for _ in range(n)]",
"-for u in range(n):",
"- l = [int(j) for j in stdin.readline().split()]",
"- for k in l[2:]:",
"- v[u][k - 1] = 1",
"- print((*v[u]))",
"+n = int(eval(input()))",
"+MAP = [[0] * n fo... | false | 0.041284 | 0.089622 | 0.460651 | [
"s358295286",
"s880570537"
] |
u345621867 | p03031 | python | s324909985 | s779877529 | 45 | 39 | 9,200 | 9,144 | Accepted | Accepted | 13.33 | N, M = list(map(int,input().split()))
K = []
S = []
for i in range(M):
k = 0
s = []
k, *s = list(map(int,input().split()))
K.append(k)
S.append(s)
P = list(map(int,input().split()))
res = 0
for bit in range(1 << N):
judge = True
for i in range(M):
cnt = 0
for s... | N, M = list(map(int,input().split()))
K = []
S = []
for i in range(M):
k = 0
s = []
k, *s = list(map(int,input().split()))
K.append(k)
S.append(s)
P = list(map(int,input().split()))
res = 0
for bit in range(1 << N):
judge = True
for i in range(M):
cnt = 0
for s... | 22 | 23 | 455 | 474 | N, M = list(map(int, input().split()))
K = []
S = []
for i in range(M):
k = 0
s = []
k, *s = list(map(int, input().split()))
K.append(k)
S.append(s)
P = list(map(int, input().split()))
res = 0
for bit in range(1 << N):
judge = True
for i in range(M):
cnt = 0
for s in S[i]:
... | N, M = list(map(int, input().split()))
K = []
S = []
for i in range(M):
k = 0
s = []
k, *s = list(map(int, input().split()))
K.append(k)
S.append(s)
P = list(map(int, input().split()))
res = 0
for bit in range(1 << N):
judge = True
for i in range(M):
cnt = 0
for s in S[i]:
... | false | 4.347826 | [
"+ break"
] | false | 0.103908 | 0.067362 | 1.542526 | [
"s324909985",
"s779877529"
] |
u358254559 | p04000 | python | s526296343 | s468061454 | 1,633 | 1,336 | 230,392 | 228,860 | Accepted | Accepted | 18.19 | h,w,n = list(map(int, input().split()))
l=[list(map(int,input().split())) for i in range(n)]
from collections import defaultdict
d = defaultdict(int)
for tmp in l:
y=tmp[0]-1
x=tmp[1]-1
for i in [-1,0,1]:
for j in [-1,0,1]:
if 1<=x+i<w-1 and 1<=y+j <h-1:
s = s... | import sys
input=sys.stdin.readline
h,w,n = list(map(int, input().split()))
l=[list(map(int,input().split())) for i in range(n)]
from collections import defaultdict
d = defaultdict(int)
for tmp in l:
y=tmp[0]-1
x=tmp[1]-1
for i in [-1,0,1]:
for j in [-1,0,1]:
if 1<=x+i<w-1 a... | 26 | 28 | 562 | 600 | h, w, n = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
from collections import defaultdict
d = defaultdict(int)
for tmp in l:
y = tmp[0] - 1
x = tmp[1] - 1
for i in [-1, 0, 1]:
for j in [-1, 0, 1]:
if 1 <= x + i < w - 1 and 1 <= y + j < h - 1:
... | import sys
input = sys.stdin.readline
h, w, n = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
from collections import defaultdict
d = defaultdict(int)
for tmp in l:
y = tmp[0] - 1
x = tmp[1] - 1
for i in [-1, 0, 1]:
for j in [-1, 0, 1]:
if 1 <=... | false | 7.142857 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.044294 | 0.044316 | 0.999512 | [
"s526296343",
"s468061454"
] |
u588341295 | p04048 | python | s506231618 | s311931212 | 52 | 18 | 5,556 | 3,064 | Accepted | Accepted | 65.38 | # -*- coding: utf-8 -*-
import sys
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def l... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 25 | 32 | 827 | 947 | # -*- coding: utf-8 -*-
import sys
if sys.version_info.minor >= 5:
from math import gcd
else:
from fractions import gcd
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 21.875 | [
"-",
"-if sys.version_info.minor >= 5:",
"- from math import gcd",
"-else:",
"- from fractions import gcd",
"-print(((N - gcd(N, X)) * 3))",
"+# 最初のN以外は、平行四辺形を小さくしていくと考える",
"+def rec(a, b):",
"+ a, b = min(a, b), max(a, b)",
"+ if a == 0:",
"+ # 最後に割り切れた時は半分でいいので減らす",
"+ ... | false | 0.039715 | 0.043188 | 0.91958 | [
"s506231618",
"s311931212"
] |
u094191970 | p03295 | python | s258156343 | s951964795 | 526 | 457 | 28,764 | 29,920 | Accepted | Accepted | 13.12 | n,m=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(m)]
for i in l:
i[0],i[1]=i[1],i[0]
ll=sorted(l)
x,cnt=ll[0][0],1
for i in ll:
a=i[1]
b=i[0]
if a>=x:
cnt+=1
x=b
print(cnt) | from operator import itemgetter
n,m=list(map(int,input().split()))
l=sorted([list(map(int,input().split())) for i in range(m)],key=itemgetter(1))
x,cnt=l[0][1],1
for i in l:
a=i[0]
b=i[1]
if a>=x:
cnt+=1
x=b
print(cnt) | 13 | 12 | 245 | 252 | n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
for i in l:
i[0], i[1] = i[1], i[0]
ll = sorted(l)
x, cnt = ll[0][0], 1
for i in ll:
a = i[1]
b = i[0]
if a >= x:
cnt += 1
x = b
print(cnt)
| from operator import itemgetter
n, m = list(map(int, input().split()))
l = sorted([list(map(int, input().split())) for i in range(m)], key=itemgetter(1))
x, cnt = l[0][1], 1
for i in l:
a = i[0]
b = i[1]
if a >= x:
cnt += 1
x = b
print(cnt)
| false | 7.692308 | [
"+from operator import itemgetter",
"+",
"-l = [list(map(int, input().split())) for i in range(m)]",
"+l = sorted([list(map(int, input().split())) for i in range(m)], key=itemgetter(1))",
"+x, cnt = l[0][1], 1",
"- i[0], i[1] = i[1], i[0]",
"-ll = sorted(l)",
"-x, cnt = ll[0][0], 1",
"-for i in l... | false | 0.099116 | 0.158611 | 0.624897 | [
"s258156343",
"s951964795"
] |
u222668979 | p02616 | python | s188013663 | s662309398 | 266 | 238 | 33,304 | 31,684 | Accepted | Accepted | 10.53 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
cnt = 1
if len(pla) == 0 and k % 2 == 1:
for i in mia[:k]:
cnt = cnt * i % mod
else:
while k > 0:
... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
cnt = 1
if len(pla) == 0 and k % 2 == 1:
for i in mia[:k]:
cnt = cnt * i % mod
else:
while k > 0:
... | 31 | 30 | 905 | 836 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
cnt = 1
if len(pla) == 0 and k % 2 == 1:
for i in mia[:k]:
cnt = cnt * i % mod
else:
while k > 0:
if k == 1 or len... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
cnt = 1
if len(pla) == 0 and k % 2 == 1:
for i in mia[:k]:
cnt = cnt * i % mod
else:
while k > 0:
if k == 1 or len... | false | 3.225806 | [
"- elif len(pla) >= 2 and len(mia) >= 2:",
"- if pla[-1] * pla[-2] > mia[-1] * mia[-2]:",
"- cnt *= pla.pop()",
"- k -= 1",
"- elif pla[-1] * pla[-2] <= mia[-1] * mia[-2]:",
"- cnt *= mia.pop() * mia.pop()",
"- k -=... | false | 0.039387 | 0.044694 | 0.881252 | [
"s188013663",
"s662309398"
] |
u260036763 | p03478 | python | s041839430 | s240940551 | 33 | 28 | 2,940 | 2,940 | Accepted | Accepted | 15.15 | n, a, b = list(map(int, input().split()))
sum = 0
for i in range(1, n+1):
isum = 0
m = i
for j in range(5):
isum += m%10
m //= 10
if a <= isum <= b:
sum += i
print(sum)
| n, a, b = list(map(int, input().split()))
sum = 0
for i in range(1, n+1):
isum = 0
m = i
while m != 0:
isum += m%10
m //= 10
if a <= isum <= b:
sum += i
print(sum)
| 11 | 11 | 193 | 188 | n, a, b = list(map(int, input().split()))
sum = 0
for i in range(1, n + 1):
isum = 0
m = i
for j in range(5):
isum += m % 10
m //= 10
if a <= isum <= b:
sum += i
print(sum)
| n, a, b = list(map(int, input().split()))
sum = 0
for i in range(1, n + 1):
isum = 0
m = i
while m != 0:
isum += m % 10
m //= 10
if a <= isum <= b:
sum += i
print(sum)
| false | 0 | [
"- for j in range(5):",
"+ while m != 0:"
] | false | 0.091988 | 0.007588 | 12.123128 | [
"s041839430",
"s240940551"
] |
u977193988 | p03018 | python | s082024532 | s554513828 | 62 | 46 | 5,864 | 3,500 | Accepted | Accepted | 25.81 | import re
s=eval(input())
ss=s.replace('BC','D')
sss=re.split('[BC]',ss)
ans=0
for i in sss:
acnt=0
for g in i:
if g=='A':
acnt+=1
else:
ans+=acnt
print(ans)
| s=eval(input())
s=s.replace('BC','D')
ans=0
cnt=0
for i in s:
if i=='A':
cnt+=1
elif i=='D':
ans+=cnt
else:
cnt=0
print(ans)
| 13 | 13 | 212 | 168 | import re
s = eval(input())
ss = s.replace("BC", "D")
sss = re.split("[BC]", ss)
ans = 0
for i in sss:
acnt = 0
for g in i:
if g == "A":
acnt += 1
else:
ans += acnt
print(ans)
| s = eval(input())
s = s.replace("BC", "D")
ans = 0
cnt = 0
for i in s:
if i == "A":
cnt += 1
elif i == "D":
ans += cnt
else:
cnt = 0
print(ans)
| false | 0 | [
"-import re",
"-",
"-ss = s.replace(\"BC\", \"D\")",
"-sss = re.split(\"[BC]\", ss)",
"+s = s.replace(\"BC\", \"D\")",
"-for i in sss:",
"- acnt = 0",
"- for g in i:",
"- if g == \"A\":",
"- acnt += 1",
"- else:",
"- ans += acnt",
"+cnt = 0",
"+for... | false | 0.039181 | 0.033017 | 1.186697 | [
"s082024532",
"s554513828"
] |
u894114233 | p00146 | python | s126234342 | s143080918 | 4,450 | 3,540 | 27,408 | 27,320 | Accepted | Accepted | 20.45 | def calctime(w,dist):
time=dist/(2000/(70.0+w))
return time
n=int(input())
s={}
d={}
v={}
for i in range(n):
S,D,V=list(map(int,input().split()))
s[i]=S
d[i]=D
v[i]=V
dist=[[None]*n for _ in range(n)]
for i in range(n):
for j in range(n):
if i==j:
dist... | def calctime(w,dist):
time=dist/(2000/(70.0+w))
return time
def solve():
dist=[[None]*n for _ in range(n)]
for i in range(n):
for j in range(n):
if i==j:
dist[i][j]=float('inf')
else:
dist[i][j]=abs(d[i]-d[j])
w=[float('i... | 50 | 54 | 1,215 | 1,388 | def calctime(w, dist):
time = dist / (2000 / (70.0 + w))
return time
n = int(input())
s = {}
d = {}
v = {}
for i in range(n):
S, D, V = list(map(int, input().split()))
s[i] = S
d[i] = D
v[i] = V
dist = [[None] * n for _ in range(n)]
for i in range(n):
for j in range(n):
if i == j:
... | def calctime(w, dist):
time = dist / (2000 / (70.0 + w))
return time
def solve():
dist = [[None] * n for _ in range(n)]
for i in range(n):
for j in range(n):
if i == j:
dist[i][j] = float("inf")
else:
dist[i][j] = abs(d[i] - d[j])
w =... | false | 7.407407 | [
"+",
"+",
"+def solve():",
"+ dist = [[None] * n for _ in range(n)]",
"+ for i in range(n):",
"+ for j in range(n):",
"+ if i == j:",
"+ dist[i][j] = float(\"inf\")",
"+ else:",
"+ dist[i][j] = abs(d[i] - d[j])",
"+ w = [float(\... | false | 0.03777 | 0.037259 | 1.01373 | [
"s126234342",
"s143080918"
] |
u042105122 | p03078 | python | s240281412 | s865253006 | 508 | 40 | 5,648 | 5,448 | Accepted | Accepted | 92.13 |
def main():
buf = eval(input())
buflist = buf.split()
X = int(buflist[0])
Y = int(buflist[1])
Z = int(buflist[2])
K = int(buflist[3])
buf = eval(input())
buflist = buf.split()
A = list(map(int, buflist))
buf = eval(input())
buflist = buf.split()
B = list(map... | import heapq
def main():
buf = eval(input())
buflist = buf.split()
X = int(buflist[0])
Y = int(buflist[1])
Z = int(buflist[2])
K = int(buflist[3])
buf = eval(input())
buflist = buf.split()
A = list(map(int, buflist))
buf = eval(input())
buflist = buf.split()
... | 45 | 45 | 2,017 | 2,058 | def main():
buf = eval(input())
buflist = buf.split()
X = int(buflist[0])
Y = int(buflist[1])
Z = int(buflist[2])
K = int(buflist[3])
buf = eval(input())
buflist = buf.split()
A = list(map(int, buflist))
buf = eval(input())
buflist = buf.split()
B = list(map(int, buflist)... | import heapq
def main():
buf = eval(input())
buflist = buf.split()
X = int(buflist[0])
Y = int(buflist[1])
Z = int(buflist[2])
K = int(buflist[3])
buf = eval(input())
buflist = buf.split()
A = list(map(int, buflist))
buf = eval(input())
buflist = buf.split()
B = list(ma... | false | 0 | [
"+import heapq",
"+",
"+",
"- cakelist = [(A[0] + B[0] + C[0], 0, 0, 0)]",
"- hashtable = {(A[0] + B[0] + C[0], 0, 0, 0)}",
"+ cakeheap = [(-(A[0] + B[0] + C[0]), 0, 0, 0)]",
"+ hashtable = {(-(A[0] + B[0] + C[0]), 0, 0, 0)}",
"- current = cakelist.pop()",
"- tastiness.appe... | false | 0.045441 | 0.038739 | 1.17301 | [
"s240281412",
"s865253006"
] |
u279460955 | p03372 | python | s817729920 | s899998678 | 285 | 252 | 109,080 | 118,996 | Accepted | Accepted | 11.58 | from itertools import accumulate
class SegTree: # 0-index !!!
"""
fx: モノイドXでの二項演算
ex: モノイドXでの単位元
init(seq, fx, ex): 配列seqで初期化 O(N)
update(i, x): i番目の値をxに更新 O(logN)
query(l, r): 区間[l,r)をfxしたものを返す O(logN)
get(i): i番目の値を返す
show(): 配列を返す
"""
def __init__(self, seq, fx... | from itertools import accumulate
n, c = (int(x) for x in input().split())
X = []
V = []
D = []
prev_x = 0
for _ in range(n):
x, v = (int(x) for x in input().split())
X.append(x)
D.append(x - prev_x)
V.append(v)
prev_x = x
D.append(c - X[-1])
rev_D = list(reversed(D))
rev_V = list(rev... | 109 | 53 | 2,801 | 1,164 | from itertools import accumulate
class SegTree: # 0-index !!!
"""
fx: モノイドXでの二項演算
ex: モノイドXでの単位元
init(seq, fx, ex): 配列seqで初期化 O(N)
update(i, x): i番目の値をxに更新 O(logN)
query(l, r): 区間[l,r)をfxしたものを返す O(logN)
get(i): i番目の値を返す
show(): 配列を返す
"""
def __init__(self, seq, fx, ex):
... | from itertools import accumulate
n, c = (int(x) for x in input().split())
X = []
V = []
D = []
prev_x = 0
for _ in range(n):
x, v = (int(x) for x in input().split())
X.append(x)
D.append(x - prev_x)
V.append(v)
prev_x = x
D.append(c - X[-1])
rev_D = list(reversed(D))
rev_V = list(reversed(V))
ans =... | false | 51.376147 | [
"-",
"-class SegTree: # 0-index !!!",
"- \"\"\"",
"- fx: モノイドXでの二項演算",
"- ex: モノイドXでの単位元",
"- init(seq, fx, ex): 配列seqで初期化 O(N)",
"- update(i, x): i番目の値をxに更新 O(logN)",
"- query(l, r): 区間[l,r)をfxしたものを返す O(logN)",
"- get(i): i番目の値を返す",
"- show(): 配列を返す",
"- \"\"\"",
"... | false | 0.04614 | 0.044056 | 1.047307 | [
"s817729920",
"s899998678"
] |
u561231954 | p03987 | python | s236313411 | s227061891 | 850 | 371 | 104,572 | 48,596 | Accepted | Accepted | 56.35 | import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
class SegmentTree():
def __init__(self,N,f,unit):
self.f = f
self.unit = unit
self.N = N
self.tree = [self.unit] * (2*self.N)
#self._build(array)
def _build(self,array):
... | import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
def main():
N = int(eval(input()))
A = list(enumerate(map(int,input().split())))
A.sort(key = lambda x:-x[1])
left = list(range(-1,N + 2))
right = list(range(1,N + 4))
ans = 0
for i,a in A:
L ... | 66 | 22 | 1,659 | 478 | import sys
sys.setrecursionlimit(10000000)
MOD = 10**9 + 7
INF = 10**15
class SegmentTree:
def __init__(self, N, f, unit):
self.f = f
self.unit = unit
self.N = N
self.tree = [self.unit] * (2 * self.N)
# self._build(array)
def _build(self, array):
for i, x in e... | import sys
sys.setrecursionlimit(10000000)
MOD = 10**9 + 7
INF = 10**15
def main():
N = int(eval(input()))
A = list(enumerate(map(int, input().split())))
A.sort(key=lambda x: -x[1])
left = list(range(-1, N + 2))
right = list(range(1, N + 4))
ans = 0
for i, a in A:
L = left[i]
... | false | 66.666667 | [
"-class SegmentTree:",
"- def __init__(self, N, f, unit):",
"- self.f = f",
"- self.unit = unit",
"- self.N = N",
"- self.tree = [self.unit] * (2 * self.N)",
"- # self._build(array)",
"-",
"- def _build(self, array):",
"- for i, x in enumerate(array,... | false | 0.109798 | 0.035326 | 3.108114 | [
"s236313411",
"s227061891"
] |
u508732591 | p00009 | python | s918546600 | s978480803 | 270 | 170 | 26,348 | 16,888 | Accepted | Accepted | 37.04 | import sys
import math
N = 1000000
primes = [1] * N
primes[0] = 0
primes[1] = 0
primes[4::2] = [0] * len(primes[4::2])
for i in range(3,int(math.sqrt(N)),2):
if primes[i]:
primes[i*i::i*2] = [0] * len(primes[i*i::i*2])
for i in sys.stdin:
n = int(i)
print((sum(primes[0:n+1]... | import sys
import math
N = 1000000
primes = [1] * (N//2)
primes[0] = 0
for i in range(3,int(math.sqrt(N)),2):
if primes[i//2]:
primes[(i*i)//2::i] = [0] * len(primes[(i*i)//2::i])
for i in sys.stdin:
n = int(i)
if n == 1:
print((0))
elif n == 2:
print((1))
... | 16 | 19 | 321 | 364 | import sys
import math
N = 1000000
primes = [1] * N
primes[0] = 0
primes[1] = 0
primes[4::2] = [0] * len(primes[4::2])
for i in range(3, int(math.sqrt(N)), 2):
if primes[i]:
primes[i * i :: i * 2] = [0] * len(primes[i * i :: i * 2])
for i in sys.stdin:
n = int(i)
print((sum(primes[0 : n + 1])))
| import sys
import math
N = 1000000
primes = [1] * (N // 2)
primes[0] = 0
for i in range(3, int(math.sqrt(N)), 2):
if primes[i // 2]:
primes[(i * i) // 2 :: i] = [0] * len(primes[(i * i) // 2 :: i])
for i in sys.stdin:
n = int(i)
if n == 1:
print((0))
elif n == 2:
print((1))
... | false | 15.789474 | [
"-primes = [1] * N",
"+primes = [1] * (N // 2)",
"-primes[1] = 0",
"-primes[4::2] = [0] * len(primes[4::2])",
"- if primes[i]:",
"- primes[i * i :: i * 2] = [0] * len(primes[i * i :: i * 2])",
"+ if primes[i // 2]:",
"+ primes[(i * i) // 2 :: i] = [0] * len(primes[(i * i) // 2 :: i... | false | 0.245928 | 0.157458 | 1.561863 | [
"s918546600",
"s978480803"
] |
u886747123 | p02883 | python | s087369415 | s163073557 | 509 | 423 | 38,748 | 38,840 | Accepted | Accepted | 16.9 | # E - Gluttony
import numpy as np
# np.arrayに変換する場合はsortedを使うよりnp.sortを使う方が少し速い
N, K = list(map(int, input().split()))
A = np.sort(np.array((list(map(int, input().split())))))
F = np.sort(np.array(sorted((list(map(int, input().split()))))))[::-1]
lower = 0
upper = A[-1] * F[0]
# 達成可能な最高成績を二分探索する
while ... | # E - Gluttony
import numpy as np
# np.arrayに変換する場合はsortedを使うよりnp.sortを使う方が少し速い
N, K = list(map(int, input().split()))
A = np.sort(np.array((list(map(int, input().split())))))
F = np.sort(np.array(((list(map(int, input().split()))))))[::-1]
lower = 0
upper = A[-1] * F[0]
# 達成可能な最高成績を二分探索する
while lower ... | 24 | 24 | 623 | 617 | # E - Gluttony
import numpy as np
# np.arrayに変換する場合はsortedを使うよりnp.sortを使う方が少し速い
N, K = list(map(int, input().split()))
A = np.sort(np.array((list(map(int, input().split())))))
F = np.sort(np.array(sorted((list(map(int, input().split()))))))[::-1]
lower = 0
upper = A[-1] * F[0]
# 達成可能な最高成績を二分探索する
while lower <= upper:
... | # E - Gluttony
import numpy as np
# np.arrayに変換する場合はsortedを使うよりnp.sortを使う方が少し速い
N, K = list(map(int, input().split()))
A = np.sort(np.array((list(map(int, input().split())))))
F = np.sort(np.array(((list(map(int, input().split()))))))[::-1]
lower = 0
upper = A[-1] * F[0]
# 達成可能な最高成績を二分探索する
while lower <= upper:
re... | false | 0 | [
"-F = np.sort(np.array(sorted((list(map(int, input().split()))))))[::-1]",
"+F = np.sort(np.array(((list(map(int, input().split()))))))[::-1]"
] | false | 1.010155 | 0.479854 | 2.10513 | [
"s087369415",
"s163073557"
] |
u802537549 | p00009 | python | s552730007 | s992921675 | 720 | 540 | 21,236 | 21,248 | Accepted | Accepted | 25 | # coding: utf-8
LIMIT = 999999
prime = [0, 1] + [0 if i % 2 == 0 else 1 for i in range(3, LIMIT + 1)]
for i in range(3, LIMIT + 1):
if prime[i - 1]:
for j in range(i ** 2, LIMIT + 1, i):
prime[j - 1] = 0
while True:
try:
n = int(eval(input()))
except EOFError:
... | # coding: utf-8
LIMIT = 999999
prime = [0, 1] + [0 if i % 2 == 0 else 1 for i in range(3, LIMIT + 1)]
for i in range(3, int(LIMIT ** 0.5) + 1):
if prime[i - 1]:
for j in range(i ** 2, LIMIT + 1, i):
prime[j - 1] = 0
while True:
try:
n = int(eval(input()))
except... | 19 | 18 | 359 | 369 | # coding: utf-8
LIMIT = 999999
prime = [0, 1] + [0 if i % 2 == 0 else 1 for i in range(3, LIMIT + 1)]
for i in range(3, LIMIT + 1):
if prime[i - 1]:
for j in range(i**2, LIMIT + 1, i):
prime[j - 1] = 0
while True:
try:
n = int(eval(input()))
except EOFError:
break
pri... | # coding: utf-8
LIMIT = 999999
prime = [0, 1] + [0 if i % 2 == 0 else 1 for i in range(3, LIMIT + 1)]
for i in range(3, int(LIMIT**0.5) + 1):
if prime[i - 1]:
for j in range(i**2, LIMIT + 1, i):
prime[j - 1] = 0
while True:
try:
n = int(eval(input()))
except EOFError:
bre... | false | 5.263158 | [
"-for i in range(3, LIMIT + 1):",
"+for i in range(3, int(LIMIT**0.5) + 1):"
] | false | 1.318732 | 0.600931 | 2.19448 | [
"s552730007",
"s992921675"
] |
u426534722 | p02366 | python | s828112177 | s770285887 | 300 | 210 | 20,304 | 20,492 | Accepted | Accepted | 30 | import sys
sys.setrecursionlimit(100000)
def dfs(v, tm):
dts[v] = est[v] = tm + 1
child = 0
for i in adj[v]:
if est[i] == float('inf'):
child += 1
parents[i] = v
dfs(i, tm + 1)
est[v] = min(est[v], est[i])
if parents[v] i... | from sys import stdin
import sys
from math import isinf
INF = float("inf")
sys.setrecursionlimit(100000)
def dfs(v, tm):
dts[v] = est[v] = tm + 1
child = 0
for i in adj[v]:
if isinf(est[i]):
child += 1
parents[i] = v
dfs(i, tm + 1)
est[v] ... | 39 | 32 | 843 | 884 | import sys
sys.setrecursionlimit(100000)
def dfs(v, tm):
dts[v] = est[v] = tm + 1
child = 0
for i in adj[v]:
if est[i] == float("inf"):
child += 1
parents[i] = v
dfs(i, tm + 1)
est[v] = min(est[v], est[i])
if parents[v] is None and child... | from sys import stdin
import sys
from math import isinf
INF = float("inf")
sys.setrecursionlimit(100000)
def dfs(v, tm):
dts[v] = est[v] = tm + 1
child = 0
for i in adj[v]:
if isinf(est[i]):
child += 1
parents[i] = v
dfs(i, tm + 1)
est[v] = min(est[... | false | 17.948718 | [
"+from sys import stdin",
"+from math import isinf",
"+INF = float(\"inf\")",
"- if est[i] == float(\"inf\"):",
"+ if isinf(est[i]):",
"-nv, ne = list(map(int, input().split(\" \")))",
"-adj = [[] for _ in range(nv)]",
"-est = [float(\"inf\")] * nv",
"-parents = [None] * nv",
"-aps =... | false | 0.088989 | 0.036107 | 2.464631 | [
"s828112177",
"s770285887"
] |
u442030035 | p02990 | python | s567925274 | s462570680 | 1,281 | 831 | 3,316 | 3,316 | Accepted | Accepted | 35.13 | N, K = list(map(int, input().split()))
mod = 1000000007
def factorial_2(N: int, M: int) -> int:
res = 1
for i in range(2, N+1):
res *= i
res %= M
return res
def nCr(n: int, r: int, mod: int):
if n == r:
return 1
if r > n:
return 0
return (fact... | import math
N, K = list(map(int, input().split()))
mod = 1000000007
def nCr(n: int, r: int):
if n == r:
return 1
if r > n:
return 0
return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
for i in range(1, K+1):
print((nCr(N-K+1, i) * nCr(K-1, i-1) % mod... | 22 | 16 | 489 | 315 | N, K = list(map(int, input().split()))
mod = 1000000007
def factorial_2(N: int, M: int) -> int:
res = 1
for i in range(2, N + 1):
res *= i
res %= M
return res
def nCr(n: int, r: int, mod: int):
if n == r:
return 1
if r > n:
return 0
return (
factorial_... | import math
N, K = list(map(int, input().split()))
mod = 1000000007
def nCr(n: int, r: int):
if n == r:
return 1
if r > n:
return 0
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(1, K + 1):
print((nCr(N - K + 1, i) * nCr(K - 1, i - 1) % mod))
| false | 27.272727 | [
"+import math",
"+",
"-def factorial_2(N: int, M: int) -> int:",
"- res = 1",
"- for i in range(2, N + 1):",
"- res *= i",
"- res %= M",
"- return res",
"-",
"-",
"-def nCr(n: int, r: int, mod: int):",
"+def nCr(n: int, r: int):",
"- return (",
"- factorial... | false | 0.038245 | 0.040867 | 0.935856 | [
"s567925274",
"s462570680"
] |
u280552586 | p03556 | python | s802070271 | s703101826 | 44 | 17 | 2,940 | 3,060 | Accepted | Accepted | 61.36 | n = int(eval(input()))
for i in range(1, n+1):
if i**2 <= n:
ans = min(n, i**2)
else:
break
print(ans)
| n = int(eval(input()))
print((int(n**.5)**2))
| 9 | 2 | 131 | 39 | n = int(eval(input()))
for i in range(1, n + 1):
if i**2 <= n:
ans = min(n, i**2)
else:
break
print(ans)
| n = int(eval(input()))
print((int(n**0.5) ** 2))
| false | 77.777778 | [
"-for i in range(1, n + 1):",
"- if i**2 <= n:",
"- ans = min(n, i**2)",
"- else:",
"- break",
"-print(ans)",
"+print((int(n**0.5) ** 2))"
] | false | 0.048656 | 0.039445 | 1.233517 | [
"s802070271",
"s703101826"
] |
u285443936 | p03425 | python | s993673911 | s414951487 | 261 | 179 | 9,772 | 3,064 | Accepted | Accepted | 31.42 | N = int(eval(input()))
S = [eval(input()) for i in range(N)]
S_march = []
MARCH = ["M", "A", "R", "C", "H"]
cmb = []
ans = 0
N_march = [0]*5
for Si in S:
for j in range(5):
if Si[:1] == MARCH[j]:
N_march[j] += 1
for i in range(2**5):
check = [False]*5
for j in range(5):
if (i>>... | N = int(eval(input()))
m,a,r,c,h = 0,0,0,0,0
for i in range(N):
s = eval(input())
if s[0] == "M":
m += 1
if s[0] == "A":
a += 1
if s[0] == "R":
r += 1
if s[0] == "C":
c += 1
if s[0] == "H":
h += 1
A = [m,a,r,c,h]
ans = 0
for i in range(5):
for j in range(min(i+1,5),5):... | 42 | 21 | 786 | 384 | N = int(eval(input()))
S = [eval(input()) for i in range(N)]
S_march = []
MARCH = ["M", "A", "R", "C", "H"]
cmb = []
ans = 0
N_march = [0] * 5
for Si in S:
for j in range(5):
if Si[:1] == MARCH[j]:
N_march[j] += 1
for i in range(2**5):
check = [False] * 5
for j in range(5):
if (i... | N = int(eval(input()))
m, a, r, c, h = 0, 0, 0, 0, 0
for i in range(N):
s = eval(input())
if s[0] == "M":
m += 1
if s[0] == "A":
a += 1
if s[0] == "R":
r += 1
if s[0] == "C":
c += 1
if s[0] == "H":
h += 1
A = [m, a, r, c, h]
ans = 0
for i in range(5):
... | false | 50 | [
"-S = [eval(input()) for i in range(N)]",
"-S_march = []",
"-MARCH = [\"M\", \"A\", \"R\", \"C\", \"H\"]",
"-cmb = []",
"+m, a, r, c, h = 0, 0, 0, 0, 0",
"+for i in range(N):",
"+ s = eval(input())",
"+ if s[0] == \"M\":",
"+ m += 1",
"+ if s[0] == \"A\":",
"+ a += 1",
"... | false | 0.037547 | 0.036636 | 1.024873 | [
"s993673911",
"s414951487"
] |
u131984977 | p02412 | python | s210774544 | s229334190 | 2,060 | 1,150 | 25,476 | 6,724 | Accepted | Accepted | 44.17 | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
dataset = []
for a in range(1, n + 1):
for b in range(a + 1, n + 1):
for c in range(b + 1, n + 1):
dataset.append([a,b,c])
count = 0
for data in dataset:
... | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for a in range(1, n + 1):
for b in range(a + 1, n + 1):
for c in range(b + 1, n + 1):
if sum([a,b,c]) == x:
count += 1
print(count) | 17 | 13 | 384 | 316 | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
dataset = []
for a in range(1, n + 1):
for b in range(a + 1, n + 1):
for c in range(b + 1, n + 1):
dataset.append([a, b, c])
count = 0
for data in dataset:
if sum(data... | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for a in range(1, n + 1):
for b in range(a + 1, n + 1):
for c in range(b + 1, n + 1):
if sum([a, b, c]) == x:
count += 1
print(count)
| false | 23.529412 | [
"- dataset = []",
"+ count = 0",
"- dataset.append([a, b, c])",
"- count = 0",
"- for data in dataset:",
"- if sum(data) == x:",
"- count += 1",
"+ if sum([a, b, c]) == x:",
"+ count += 1"
] | false | 0.047809 | 0.174898 | 0.273356 | [
"s210774544",
"s229334190"
] |
u102461423 | p02998 | python | s119611354 | s898996081 | 590 | 422 | 25,060 | 48,424 | Accepted | Accepted | 28.47 | from collections import defaultdict
U = 10 ** 5
root = [None] * (2*U+1)
N = int(eval(input()))
XY = [[int(x) for x in input().split()] for _ in range(N)]
def find_root(x):
y = root[x]
if y is None:
root[x] = x
return x
if x == y:
return y
z = find_root(y)
root[x] = z
return z
... | import numpy as np
from scipy.sparse import *
U = 10**5
N = int(eval(input()))
XY = np.array([input().split() for _ in range(N)], dtype=np.int32)
graph = csr_matrix((np.ones(N,dtype=np.bool), (XY[:,0], U + XY[:,1])), (2*U+1, 2*U+1))
_, component = csgraph.connected_components(graph)
X_cnt = np.bincount(com... | 50 | 15 | 871 | 523 | from collections import defaultdict
U = 10**5
root = [None] * (2 * U + 1)
N = int(eval(input()))
XY = [[int(x) for x in input().split()] for _ in range(N)]
def find_root(x):
y = root[x]
if y is None:
root[x] = x
return x
if x == y:
return y
z = find_root(y)
root[x] = z
... | import numpy as np
from scipy.sparse import *
U = 10**5
N = int(eval(input()))
XY = np.array([input().split() for _ in range(N)], dtype=np.int32)
graph = csr_matrix(
(np.ones(N, dtype=np.bool), (XY[:, 0], U + XY[:, 1])), (2 * U + 1, 2 * U + 1)
)
_, component = csgraph.connected_components(graph)
X_cnt = np.bincoun... | false | 70 | [
"-from collections import defaultdict",
"+import numpy as np",
"+from scipy.sparse import *",
"-root = [None] * (2 * U + 1)",
"-XY = [[int(x) for x in input().split()] for _ in range(N)]",
"-",
"-",
"-def find_root(x):",
"- y = root[x]",
"- if y is None:",
"- root[x] = x",
"- ... | false | 0.08093 | 0.444861 | 0.181922 | [
"s119611354",
"s898996081"
] |
u193264896 | p03029 | python | s586124496 | s147018652 | 36 | 17 | 5,076 | 3,060 | Accepted | Accepted | 52.78 | from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path,... | import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
A, P = list(map(int, readline().split()))
print(((3*A+P)//2))
if __name__ == '__main__':
main() | 28 | 12 | 860 | 240 | from collections import deque
from collections import Counter
from itertools import product, permutations, combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
# pypyではscipy, numpyは使えない
# from scipy.sparse.csgraph import shortest_path, fl... | import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7
def main():
A, P = list(map(int, readline().split()))
print(((3 * A + P) // 2))
if __name__ == "__main__":
main()
| false | 57.142857 | [
"-from collections import deque",
"-from collections import Counter",
"-from itertools import product, permutations, combinations",
"-from operator import itemgetter",
"-from heapq import heappop, heappush",
"-from bisect import bisect_left, bisect_right, bisect",
"-",
"-# pypyではscipy, numpyは使えない",
... | false | 0.046612 | 0.067957 | 0.685906 | [
"s586124496",
"s147018652"
] |
u047102107 | p03588 | python | s825356576 | s317307140 | 872 | 307 | 67,800 | 83,620 | Accepted | Accepted | 64.79 | N = int(eval(input()))
A, B = [], []
for _ in range(N):
ai, bi = list(map(int, input().split()))
A.append(ai)
B.append(bi)
AB = sorted(list(zip(A, B)))
count = len(AB)
# 先頭
count += AB[0][0] - 1
for i in range(N - 1):
# i と j の間に何人入れられるか
if AB[i + 1][0] > AB[i][0] + 1:
cou... | from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)
INF = int(1e10)
MOD = int(1e9 + 7)
def main():
from builtins import int, map
N = int... | 22 | 27 | 399 | 682 | N = int(eval(input()))
A, B = [], []
for _ in range(N):
ai, bi = list(map(int, input().split()))
A.append(ai)
B.append(bi)
AB = sorted(list(zip(A, B)))
count = len(AB)
# 先頭
count += AB[0][0] - 1
for i in range(N - 1):
# i と j の間に何人入れられるか
if AB[i + 1][0] > AB[i][0] + 1:
count += AB[i + 1][0] ... | from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)
INF = int(1e10)
MOD = int(1e9 + 7)
def main():
from builtins import int, map
N = int(eval(inpu... | false | 18.518519 | [
"-N = int(eval(input()))",
"-A, B = [], []",
"-for _ in range(N):",
"- ai, bi = list(map(int, input().split()))",
"- A.append(ai)",
"- B.append(bi)",
"-AB = sorted(list(zip(A, B)))",
"-count = len(AB)",
"-# 先頭",
"-count += AB[0][0] - 1",
"-for i in range(N - 1):",
"- # i と j の間に何人入... | false | 0.03773 | 0.044208 | 0.853478 | [
"s825356576",
"s317307140"
] |
u380524497 | p02662 | python | s859916378 | s452709947 | 238 | 210 | 27,760 | 27,168 | Accepted | Accepted | 11.76 | import numpy as np
mod = 998244353
n, s = list(map(int, input().split()))
A = list(map(int, input().split()))
DP = np.zeros(3005, dtype=np.int64)
DP[0] = 1
for a in A:
double = DP * 2
shift = np.hstack([np.zeros(a), DP[:-a]]).astype(np.int64)
DP = double + shift
DP %= mod
print((DP[s]... | import numpy as np
mod = 998244353
n, s = list(map(int, input().split()))
A = list(map(int, input().split()))
DP = np.zeros(3005, dtype=np.int64)
DP[0] = 1
for a in A:
double = DP * 2
double[a:] += DP[:-a] # shift
DP = double % mod
print((DP[s]))
| 16 | 15 | 315 | 270 | import numpy as np
mod = 998244353
n, s = list(map(int, input().split()))
A = list(map(int, input().split()))
DP = np.zeros(3005, dtype=np.int64)
DP[0] = 1
for a in A:
double = DP * 2
shift = np.hstack([np.zeros(a), DP[:-a]]).astype(np.int64)
DP = double + shift
DP %= mod
print((DP[s]))
| import numpy as np
mod = 998244353
n, s = list(map(int, input().split()))
A = list(map(int, input().split()))
DP = np.zeros(3005, dtype=np.int64)
DP[0] = 1
for a in A:
double = DP * 2
double[a:] += DP[:-a] # shift
DP = double % mod
print((DP[s]))
| false | 6.25 | [
"- shift = np.hstack([np.zeros(a), DP[:-a]]).astype(np.int64)",
"- DP = double + shift",
"- DP %= mod",
"+ double[a:] += DP[:-a] # shift",
"+ DP = double % mod"
] | false | 0.262788 | 0.23846 | 1.102022 | [
"s859916378",
"s452709947"
] |
u923279197 | p03108 | python | s104706491 | s013897532 | 1,291 | 979 | 120,920 | 93,016 | Accepted | Accepted | 24.17 | n,m = list(map(int,input().split()))
AB = [list(map(int,input().split())) for i in range(m)]
#入力
AB.reverse()
ans = [0]*(m+1)
ans[m] = n*(n-1)//2
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1)
self.count = [1]* (n+1)
# 検索
... | class UnionFind:
def __init__(self, n):
# 親要素のノード番号を格納 par[x] == x の時そのノードは根
self.par = [i for i in range(n+1)]
# 木の高さを格納する(初期状態では0)
self.rank = [0] * (n+1)
# 各々の集合の要素数(根が代表して値を持っておく)
self.count = [1] * (n+1)
# 検索
def find(self, x):
# 根ならその... | 62 | 69 | 1,534 | 1,869 | n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(m)]
# 入力
AB.reverse()
ans = [0] * (m + 1)
ans[m] = n * (n - 1) // 2
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1)
self.count = [1] * (n + 1)
... | class UnionFind:
def __init__(self, n):
# 親要素のノード番号を格納 par[x] == x の時そのノードは根
self.par = [i for i in range(n + 1)]
# 木の高さを格納する(初期状態では0)
self.rank = [0] * (n + 1)
# 各々の集合の要素数(根が代表して値を持っておく)
self.count = [1] * (n + 1)
# 検索
def find(self, x):
# 根ならその番号を返す... | false | 10.144928 | [
"-n, m = list(map(int, input().split()))",
"-AB = [list(map(int, input().split())) for i in range(m)]",
"-# 入力",
"-AB.reverse()",
"-ans = [0] * (m + 1)",
"-ans[m] = n * (n - 1) // 2",
"-",
"-",
"+ # 親要素のノード番号を格納 par[x] == x の時そのノードは根",
"+ # 木の高さを格納する(初期状態では0)",
"+ # 各々の集合の要素... | false | 0.087428 | 0.073635 | 1.187316 | [
"s104706491",
"s013897532"
] |
u489762173 | p03103 | python | s943900369 | s124696218 | 290 | 168 | 28,972 | 27,496 | Accepted | Accepted | 42.07 | import sys
input = sys.stdin.buffer.readline
from collections import deque
def main():
N, M = list(map(int, input().split()))
AB = [0] * N
for i in range(N):
AB[i] = list(map(int, input().split()))
AB = sorted(AB)
have = 0
price = 0
for x, y in AB:
if M - ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, M = list(map(int, readline().split()))
d = list(map(int, read().split()))
AB = list(zip(d, d))
AB = sorted(AB)
have = 0
price = 0
for x, y in ... | 28 | 28 | 479 | 493 | import sys
input = sys.stdin.buffer.readline
from collections import deque
def main():
N, M = list(map(int, input().split()))
AB = [0] * N
for i in range(N):
AB[i] = list(map(int, input().split()))
AB = sorted(AB)
have = 0
price = 0
for x, y in AB:
if M - have < y:
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N, M = list(map(int, readline().split()))
d = list(map(int, read().split()))
AB = list(zip(d, d))
AB = sorted(AB)
have = 0
price = 0
for x, y in AB:
if M... | false | 0 | [
"-input = sys.stdin.buffer.readline",
"-from collections import deque",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"- N, M = list(map(int, input().split()))",
"- AB = [0] * N",
"- for i in range(N):",
"- AB[i] ... | false | 0.060239 | 0.037766 | 1.595075 | [
"s943900369",
"s124696218"
] |
u701318346 | p02923 | python | s074159329 | s128017490 | 108 | 88 | 14,224 | 15,020 | Accepted | Accepted | 18.52 | N = int(eval(input()))
H = list(map(int, input().split()))
if N == 1:
print((0))
else:
ans = 0
H1 = H[0]
H2 = H[1]
count = 1
move = 0
while count != N:
count += 1
if H2 <= H1:
move += 1
ans = max(ans, move)
else:
m... | N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
count = 0
for i in range(N - 1):
if H[i] >= H[i + 1]:
count += 1
ans = max(ans, count)
else:
count = 0
print(ans)
| 23 | 13 | 410 | 221 | N = int(eval(input()))
H = list(map(int, input().split()))
if N == 1:
print((0))
else:
ans = 0
H1 = H[0]
H2 = H[1]
count = 1
move = 0
while count != N:
count += 1
if H2 <= H1:
move += 1
ans = max(ans, move)
else:
move = 0
if... | N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
count = 0
for i in range(N - 1):
if H[i] >= H[i + 1]:
count += 1
ans = max(ans, count)
else:
count = 0
print(ans)
| false | 43.478261 | [
"-if N == 1:",
"- print((0))",
"-else:",
"- ans = 0",
"- H1 = H[0]",
"- H2 = H[1]",
"- count = 1",
"- move = 0",
"- while count != N:",
"+ans = 0",
"+count = 0",
"+for i in range(N - 1):",
"+ if H[i] >= H[i + 1]:",
"- if H2 <= H1:",
"- move += 1"... | false | 0.104967 | 0.078434 | 1.338282 | [
"s074159329",
"s128017490"
] |
u258492760 | p03075 | python | s972197078 | s048739221 | 38 | 18 | 3,064 | 2,940 | Accepted | Accepted | 52.63 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))
k = int(eval(input()))
ab = b - a
ac = c - a
ad = d - a
ae = e - a
bc = c - b
bd = d - b
be = e - b
cd = d - c
ce = e - c
de = e - d
if ab <= k and ac <= k and ad <= k and ae <= k and b... | N = 5
a2e = [int(eval(input())) for _ in range(N)]
k = int(eval(input()))
for i in range(N):
for j in range(N):
if k < abs(a2e[i] - a2e[j]):
print(':(')
exit()
print('Yay!')
| 22 | 11 | 394 | 210 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))
k = int(eval(input()))
ab = b - a
ac = c - a
ad = d - a
ae = e - a
bc = c - b
bd = d - b
be = e - b
cd = d - c
ce = e - c
de = e - d
if (
ab <= k
and ac <= k
and ad <= k
and ae <= k
and... | N = 5
a2e = [int(eval(input())) for _ in range(N)]
k = int(eval(input()))
for i in range(N):
for j in range(N):
if k < abs(a2e[i] - a2e[j]):
print(":(")
exit()
print("Yay!")
| false | 50 | [
"-a = int(eval(input()))",
"-b = int(eval(input()))",
"-c = int(eval(input()))",
"-d = int(eval(input()))",
"-e = int(eval(input()))",
"+N = 5",
"+a2e = [int(eval(input())) for _ in range(N)]",
"-ab = b - a",
"-ac = c - a",
"-ad = d - a",
"-ae = e - a",
"-bc = c - b",
"-bd = d - b",
"-be =... | false | 0.077589 | 0.096044 | 0.807848 | [
"s972197078",
"s048739221"
] |
u389910364 | p03286 | python | s833224366 | s889920962 | 288 | 160 | 21,196 | 13,360 | Accepted | Accepted | 44.44 | import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator imp... | import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
fro... | 43 | 43 | 789 | 778 | import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter... | import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator impo... | false | 0 | [
"+import cmath",
"-sys.setrecursionlimit(2147483647)",
"+sys.setrecursionlimit(10**9)",
"-N = int(sys.stdin.readline())",
"+# MOD = 998244353",
"+N = int(sys.stdin.buffer.readline())",
"+N = -N",
"-odd = False",
"-while abs(N) > 0:",
"- if N & 1:",
"+while N != 0:",
"+ if N % -2 == 0:",
... | false | 0.040892 | 0.042653 | 0.958724 | [
"s833224366",
"s889920962"
] |
u729133443 | p03379 | python | s102414903 | s675012580 | 313 | 283 | 25,052 | 25,052 | Accepted | Accepted | 9.58 | n,*x=list(map(int,open(0).read().split()))
y=sorted(x)
a,b=y[n//2],y[n//2-1]
for i in x:print((a*(i<=b)or b)) | n,*x=list(map(int,open(0).read().split()))
y=sorted(x)[n//2-1:n//2+1]
for i in x:print((y[i<=y[0]])) | 4 | 3 | 104 | 94 | n, *x = list(map(int, open(0).read().split()))
y = sorted(x)
a, b = y[n // 2], y[n // 2 - 1]
for i in x:
print((a * (i <= b) or b))
| n, *x = list(map(int, open(0).read().split()))
y = sorted(x)[n // 2 - 1 : n // 2 + 1]
for i in x:
print((y[i <= y[0]]))
| false | 25 | [
"-y = sorted(x)",
"-a, b = y[n // 2], y[n // 2 - 1]",
"+y = sorted(x)[n // 2 - 1 : n // 2 + 1]",
"- print((a * (i <= b) or b))",
"+ print((y[i <= y[0]]))"
] | false | 0.074605 | 0.109039 | 0.684209 | [
"s102414903",
"s675012580"
] |
u832871520 | p03478 | python | s918203784 | s119943505 | 38 | 25 | 3,060 | 2,940 | Accepted | Accepted | 34.21 | N, A, B = list(map(int, input().split()))
sum = 0
for n in range(N + 1):
wa = 0
sn = str(n)
size = len(sn)
for s in range(size):
wa += int(sn[s])
if A <= wa and B >= wa:
sum += n
print(sum) | def sumOfDigits(n):
sum = 0
while(n > 0):
sum += n % 10
n //= 10
return sum
N, A, B = list(map(int, input().split()))
sum = 0
for n in range(N + 1):
wa = sumOfDigits(n)
if A <= wa and B >= wa:
sum += n
print(sum) | 12 | 15 | 231 | 266 | N, A, B = list(map(int, input().split()))
sum = 0
for n in range(N + 1):
wa = 0
sn = str(n)
size = len(sn)
for s in range(size):
wa += int(sn[s])
if A <= wa and B >= wa:
sum += n
print(sum)
| def sumOfDigits(n):
sum = 0
while n > 0:
sum += n % 10
n //= 10
return sum
N, A, B = list(map(int, input().split()))
sum = 0
for n in range(N + 1):
wa = sumOfDigits(n)
if A <= wa and B >= wa:
sum += n
print(sum)
| false | 20 | [
"+def sumOfDigits(n):",
"+ sum = 0",
"+ while n > 0:",
"+ sum += n % 10",
"+ n //= 10",
"+ return sum",
"+",
"+",
"- wa = 0",
"- sn = str(n)",
"- size = len(sn)",
"- for s in range(size):",
"- wa += int(sn[s])",
"+ wa = sumOfDigits(n)"
] | false | 0.042885 | 0.083438 | 0.513975 | [
"s918203784",
"s119943505"
] |
u021019433 | p02803 | python | s720634259 | s634438226 | 625 | 560 | 3,316 | 3,316 | Accepted | Accepted | 10.4 | from collections import deque
h, w = list(map(int, input().split()))
a = [eval(input()) for _ in range(h)]
r = 0
for i in range(h):
for j in range(w):
if a[i][j] == '.':
b = list(map(list, a))
q = deque()
b[i][j] = 0
q.append((i, j))
while(q):
i, j = q.popleft()... | from collections import deque
h, w = list(map(int, input().split()))
a = ['#' * (w + 2)] * 2
a[1: 1] = ['#' + eval(input()) + '#' for _ in range(h)]
r = 0
for i in range(1, h + 1):
for j in range(1, w + 1):
if a[i][j] == '.':
b = list(map(list, a))
q = deque()
b[i][j] = 0
q.a... | 24 | 24 | 640 | 647 | from collections import deque
h, w = list(map(int, input().split()))
a = [eval(input()) for _ in range(h)]
r = 0
for i in range(h):
for j in range(w):
if a[i][j] == ".":
b = list(map(list, a))
q = deque()
b[i][j] = 0
q.append((i, j))
while q:
... | from collections import deque
h, w = list(map(int, input().split()))
a = ["#" * (w + 2)] * 2
a[1:1] = ["#" + eval(input()) + "#" for _ in range(h)]
r = 0
for i in range(1, h + 1):
for j in range(1, w + 1):
if a[i][j] == ".":
b = list(map(list, a))
q = deque()
b[i][j] = 0... | false | 0 | [
"-a = [eval(input()) for _ in range(h)]",
"+a = [\"#\" * (w + 2)] * 2",
"+a[1:1] = [\"#\" + eval(input()) + \"#\" for _ in range(h)]",
"-for i in range(h):",
"- for j in range(w):",
"+for i in range(1, h + 1):",
"+ for j in range(1, w + 1):",
"- if 0 <= i1 < h:",
"- ... | false | 0.043507 | 0.080813 | 0.538363 | [
"s720634259",
"s634438226"
] |
u794173881 | p03464 | python | s106404435 | s755277582 | 252 | 230 | 63,856 | 63,856 | Accepted | Accepted | 8.73 | n = int(eval(input()))
a = list(map(int, input().split()))[::-1]
min_ans = 2
max_ans = 2
for i in range(n):
min_ans = -((-min_ans) // a[i]) * a[i]
for i in range(n):
max_ans = (max_ans// a[i]) * a[i] +a[i] - 1
a = a[::-1]
tmp_ans = min_ans
tmp_ans2 = max_ans
for i in range(n):
tmp_an... | k = int(eval(input()))
a = list(map(int, input().split()))
max_ans = 2
for i in range(k)[::-1]:
max_ans = (max_ans // a[i]) * a[i] + (a[i] - 1)
min_ans = 2
for i in range(k)[::-1]:
min_ans = -((-min_ans) // a[i]) * a[i]
tmp = max_ans
for i in range(k):
tmp = (tmp // a[i]) * a[i]
if tmp ... | 23 | 26 | 476 | 487 | n = int(eval(input()))
a = list(map(int, input().split()))[::-1]
min_ans = 2
max_ans = 2
for i in range(n):
min_ans = -((-min_ans) // a[i]) * a[i]
for i in range(n):
max_ans = (max_ans // a[i]) * a[i] + a[i] - 1
a = a[::-1]
tmp_ans = min_ans
tmp_ans2 = max_ans
for i in range(n):
tmp_ans = (tmp_ans // a[i]) ... | k = int(eval(input()))
a = list(map(int, input().split()))
max_ans = 2
for i in range(k)[::-1]:
max_ans = (max_ans // a[i]) * a[i] + (a[i] - 1)
min_ans = 2
for i in range(k)[::-1]:
min_ans = -((-min_ans) // a[i]) * a[i]
tmp = max_ans
for i in range(k):
tmp = (tmp // a[i]) * a[i]
if tmp != 2:
print((-1))... | false | 11.538462 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))[::-1]",
"+k = int(eval(input()))",
"+a = list(map(int, input().split()))",
"+max_ans = 2",
"+for i in range(k)[::-1]:",
"+ max_ans = (max_ans // a[i]) * a[i] + (a[i] - 1)",
"-max_ans = 2",
"-for i in range(n):",
"+for i in range(k... | false | 0.082206 | 0.101193 | 0.812373 | [
"s106404435",
"s755277582"
] |
u219197917 | p03031 | python | s374175491 | s966649446 | 42 | 37 | 9,200 | 8,988 | Accepted | Accepted | 11.9 | n, m = [int(i) for i in input().split()]
ks = [[int(i) for i in input().split()] for _ in range(m)]
p = [int(i) for i in input().split()]
cnt = 0
for i in range(2**n):
on = set(j + 1 for j in range(n) if i >> j & 1 == 1)
flag = True
for j in range(m):
_, *s = ks[j]
flag &= len(on & set(s)) % 2 ==... | from itertools import product
n, m = list(map(int, input().split()))
l = [[int(i) for i in input().split()] for _ in range(m)]
p = [int(i) for i in input().split()]
c = 0
for sw in product((0, 1), repeat=n):
for i in range(m):
if sum(sw[si - 1] for si in l[i][1:]) % 2 != p[i]:
break
... | 12 | 13 | 353 | 349 | n, m = [int(i) for i in input().split()]
ks = [[int(i) for i in input().split()] for _ in range(m)]
p = [int(i) for i in input().split()]
cnt = 0
for i in range(2**n):
on = set(j + 1 for j in range(n) if i >> j & 1 == 1)
flag = True
for j in range(m):
_, *s = ks[j]
flag &= len(on & set(s)) %... | from itertools import product
n, m = list(map(int, input().split()))
l = [[int(i) for i in input().split()] for _ in range(m)]
p = [int(i) for i in input().split()]
c = 0
for sw in product((0, 1), repeat=n):
for i in range(m):
if sum(sw[si - 1] for si in l[i][1:]) % 2 != p[i]:
break
else:
... | false | 7.692308 | [
"-n, m = [int(i) for i in input().split()]",
"-ks = [[int(i) for i in input().split()] for _ in range(m)]",
"+from itertools import product",
"+",
"+n, m = list(map(int, input().split()))",
"+l = [[int(i) for i in input().split()] for _ in range(m)]",
"-cnt = 0",
"-for i in range(2**n):",
"- on =... | false | 0.039036 | 0.045069 | 0.866147 | [
"s374175491",
"s966649446"
] |
u497596438 | p03699 | python | s501977345 | s587917783 | 187 | 137 | 48,876 | 4,628 | Accepted | Accepted | 26.74 | N=int(eval(input()))
S=set([0])
for i in range(N):
T=set(S)
s=int(eval(input()))
for t in T:
S.add(t+s)
S=list(S)
S.sort()
for i in S[::-1]:
if i%10!=0:
print(i)
quit()
print((0))
| N=int(eval(input()))
S=[]
for i in range(N):
s=int(eval(input()))
S.append(s)
t=set([0])
for i in range(N):
t_=set()
for s in t:
t_.add(s)
t_.add(s+S[i])
t=t_
ans=0
for s in t:
if s%10==0:
continue
ans=max(s,ans)
print(ans)
| 14 | 18 | 219 | 281 | N = int(eval(input()))
S = set([0])
for i in range(N):
T = set(S)
s = int(eval(input()))
for t in T:
S.add(t + s)
S = list(S)
S.sort()
for i in S[::-1]:
if i % 10 != 0:
print(i)
quit()
print((0))
| N = int(eval(input()))
S = []
for i in range(N):
s = int(eval(input()))
S.append(s)
t = set([0])
for i in range(N):
t_ = set()
for s in t:
t_.add(s)
t_.add(s + S[i])
t = t_
ans = 0
for s in t:
if s % 10 == 0:
continue
ans = max(s, ans)
print(ans)
| false | 22.222222 | [
"-S = set([0])",
"+S = []",
"- T = set(S)",
"- for t in T:",
"- S.add(t + s)",
"-S = list(S)",
"-S.sort()",
"-for i in S[::-1]:",
"- if i % 10 != 0:",
"- print(i)",
"- quit()",
"-print((0))",
"+ S.append(s)",
"+t = set([0])",
"+for i in range(N):",
"+ ... | false | 0.034135 | 0.052494 | 0.650261 | [
"s501977345",
"s587917783"
] |
u173230196 | p03045 | python | s024403489 | s482210683 | 1,735 | 1,370 | 7,088 | 7,088 | Accepted | Accepted | 21.04 | n, m = list(map(int, input().split()))
xy = [i for i in range(n + 1)]
def root(x):
i = x
while i != xy[i]:
i = xy[i]
xy[x] = i
return i
for _ in range(m):
x, y = list(map(int, input().split()[:2]))
rx = root(x)
ry = root(y)
if rx < ry:
xy[rx] = ry
... | n, m = list(map(int, input().split()))
xy = [i for i in range(n + 1)]
def root(x):
i = x
a = []
while i != xy[i]:
i = xy[i]
a += [i]
for b in a:
xy[b] = i
return i
for _ in range(m):
x, y = list(map(int, input().split()[:2]))
xy[root(x)] = root(... | 25 | 23 | 404 | 376 | n, m = list(map(int, input().split()))
xy = [i for i in range(n + 1)]
def root(x):
i = x
while i != xy[i]:
i = xy[i]
xy[x] = i
return i
for _ in range(m):
x, y = list(map(int, input().split()[:2]))
rx = root(x)
ry = root(y)
if rx < ry:
xy[rx] = ry
else:
xy... | n, m = list(map(int, input().split()))
xy = [i for i in range(n + 1)]
def root(x):
i = x
a = []
while i != xy[i]:
i = xy[i]
a += [i]
for b in a:
xy[b] = i
return i
for _ in range(m):
x, y = list(map(int, input().split()[:2]))
xy[root(x)] = root(y)
ans = sum(i == v... | false | 8 | [
"+ a = []",
"- xy[x] = i",
"+ a += [i]",
"+ for b in a:",
"+ xy[b] = i",
"- rx = root(x)",
"- ry = root(y)",
"- if rx < ry:",
"- xy[rx] = ry",
"- else:",
"- xy[ry] = rx",
"+ xy[root(x)] = root(y)"
] | false | 0.08868 | 0.046901 | 1.890786 | [
"s024403489",
"s482210683"
] |
u729133443 | p03503 | python | s814114215 | s238181883 | 252 | 78 | 41,308 | 3,444 | Accepted | Accepted | 69.05 | I=input;n=int(I());f=[int(I()[::2],2)for _ in[0]*n];p=[I().split()for _ in[0]*n];print((max(sum(int(q[bin(i&g).count('1')])for g,q in zip(f,p))for i in range(1,1024)))) | I=input;n=int(I());f=eval('int(I()[::2],2),'*n);p=eval('I().split(),'*n);print((max(sum(int(q[bin(i&g).count('1')])for g,q in zip(f,p))for i in range(1,1024)))) | 1 | 1 | 166 | 158 | I = input
n = int(I())
f = [int(I()[::2], 2) for _ in [0] * n]
p = [I().split() for _ in [0] * n]
print(
(
max(
sum(int(q[bin(i & g).count("1")]) for g, q in zip(f, p))
for i in range(1, 1024)
)
)
)
| I = input
n = int(I())
f = eval("int(I()[::2],2)," * n)
p = eval("I().split()," * n)
print(
(
max(
sum(int(q[bin(i & g).count("1")]) for g, q in zip(f, p))
for i in range(1, 1024)
)
)
)
| false | 0 | [
"-f = [int(I()[::2], 2) for _ in [0] * n]",
"-p = [I().split() for _ in [0] * n]",
"+f = eval(\"int(I()[::2],2),\" * n)",
"+p = eval(\"I().split(),\" * n)"
] | false | 0.048556 | 0.064003 | 0.758649 | [
"s814114215",
"s238181883"
] |
u094191970 | p02923 | python | s396600914 | s164563133 | 82 | 70 | 15,020 | 15,020 | Accepted | Accepted | 14.63 | n=int(eval(input()))
h=list(map(int,input().split()))+[10**9+1]
ans=0
cnt=0
for i in range(1,n+1):
if h[i-1]>=h[i]:
cnt+=1
else:
ans=max(ans,cnt)
cnt=0
print(ans) | n=int(eval(input()))
h=list(map(int,input().split()))
ans=0
t_ans=0
b_h=h[0]
for i in h[1:]:
if b_h>=i:
t_ans+=1
else:
ans=max(ans,t_ans)
t_ans=0
b_h=i
ans=max(ans,t_ans)
print(ans) | 11 | 14 | 198 | 206 | n = int(eval(input()))
h = list(map(int, input().split())) + [10**9 + 1]
ans = 0
cnt = 0
for i in range(1, n + 1):
if h[i - 1] >= h[i]:
cnt += 1
else:
ans = max(ans, cnt)
cnt = 0
print(ans)
| n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
t_ans = 0
b_h = h[0]
for i in h[1:]:
if b_h >= i:
t_ans += 1
else:
ans = max(ans, t_ans)
t_ans = 0
b_h = i
ans = max(ans, t_ans)
print(ans)
| false | 21.428571 | [
"-h = list(map(int, input().split())) + [10**9 + 1]",
"+h = list(map(int, input().split()))",
"-cnt = 0",
"-for i in range(1, n + 1):",
"- if h[i - 1] >= h[i]:",
"- cnt += 1",
"+t_ans = 0",
"+b_h = h[0]",
"+for i in h[1:]:",
"+ if b_h >= i:",
"+ t_ans += 1",
"- ans =... | false | 0.039995 | 0.038961 | 1.026535 | [
"s396600914",
"s164563133"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.