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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u440180827 | p00007 | python | s822625372 | s489372348 | 30 | 20 | 7,628 | 7,568 | Accepted | Accepted | 33.33 | import math
loan = 100000
n = int(eval(input()))
for i in range(n):
loan += math.ceil(loan * 0.05 / 1000) * 1000
print(loan) | import math
loan = 100000
for i in range(int(eval(input()))):
loan += math.ceil(loan * 0.05 / 1000) * 1000
print(loan) | 6 | 5 | 127 | 120 | import math
loan = 100000
n = int(eval(input()))
for i in range(n):
loan += math.ceil(loan * 0.05 / 1000) * 1000
print(loan)
| import math
loan = 100000
for i in range(int(eval(input()))):
loan += math.ceil(loan * 0.05 / 1000) * 1000
print(loan)
| false | 16.666667 | [
"-n = int(eval(input()))",
"-for i in range(n):",
"+for i in range(int(eval(input()))):"
] | false | 0.044134 | 0.041038 | 1.075436 | [
"s822625372",
"s489372348"
] |
u131406102 | p03013 | python | s540535595 | s192021830 | 497 | 214 | 460,020 | 7,896 | Accepted | Accepted | 56.94 | n, m = list(map(int, input().split()))
k = []
count_sub = 0
steps = []
j = 0
for i in range(m):
k.append(int(eval(input())))
if len(k)>1 and k[i]-k[i-1]==1:
count_sub = 1
if count_sub ==1:
steps = [0 for i in range(n)]
else:
for i in range(n+1):
if k!=[] and k[j... | n, m = list(map(int, input().split()))
k = []
count_sub = 0
steps = []
j = 0
for i in range(m):
k.append(int(eval(input())))
if len(k)>1 and k[i]-k[i-1]==1:
count_sub = 1
if count_sub ==1:
steps = [0 for i in range(n)]
else:
for i in range(n+1):
if k!=[] and k[j... | 26 | 26 | 599 | 599 | n, m = list(map(int, input().split()))
k = []
count_sub = 0
steps = []
j = 0
for i in range(m):
k.append(int(eval(input())))
if len(k) > 1 and k[i] - k[i - 1] == 1:
count_sub = 1
if count_sub == 1:
steps = [0 for i in range(n)]
else:
for i in range(n + 1):
if k != [] and k[j] == i:
... | n, m = list(map(int, input().split()))
k = []
count_sub = 0
steps = []
j = 0
for i in range(m):
k.append(int(eval(input())))
if len(k) > 1 and k[i] - k[i - 1] == 1:
count_sub = 1
if count_sub == 1:
steps = [0 for i in range(n)]
else:
for i in range(n + 1):
if k != [] and k[j] == i:
... | false | 0 | [
"- steps.append(steps[i - 1] + steps[i - 2])",
"-print((steps[-1] % (1000000007)))",
"+ steps.append((steps[i - 1] + steps[i - 2]) % 1000000007)",
"+print((steps[-1]))"
] | false | 0.072065 | 0.040841 | 1.764536 | [
"s540535595",
"s192021830"
] |
u981931040 | p03103 | python | s096996854 | s914104129 | 1,930 | 527 | 20,064 | 27,752 | Accepted | Accepted | 72.69 | N , M = list(map(int,input().split()))
drink = []
for _ in range(N):
a , b = list(map(int,input().split()))
drink.append([a,b])
drink.sort()
value = 0
hold = 0
while hold != M:
if drink[0][1] == 0:
drink.pop(0)
value += drink[0][0]
hold += 1
drink[0][1] -= 1
print(value... | N, M = list(map(int, input().split()))
shops = list(list(map(int, input().split())) for _ in range(N))
shops.sort()
ans = 0
for value, count in shops:
tmp_M = max(M - count , 0)
ans += (M - tmp_M) * value
M = tmp_M
if M == 0:
break
print(ans)
| 17 | 11 | 309 | 271 | N, M = list(map(int, input().split()))
drink = []
for _ in range(N):
a, b = list(map(int, input().split()))
drink.append([a, b])
drink.sort()
value = 0
hold = 0
while hold != M:
if drink[0][1] == 0:
drink.pop(0)
value += drink[0][0]
hold += 1
drink[0][1] -= 1
print(value)
| N, M = list(map(int, input().split()))
shops = list(list(map(int, input().split())) for _ in range(N))
shops.sort()
ans = 0
for value, count in shops:
tmp_M = max(M - count, 0)
ans += (M - tmp_M) * value
M = tmp_M
if M == 0:
break
print(ans)
| false | 35.294118 | [
"-drink = []",
"-for _ in range(N):",
"- a, b = list(map(int, input().split()))",
"- drink.append([a, b])",
"-drink.sort()",
"-value = 0",
"-hold = 0",
"-while hold != M:",
"- if drink[0][1] == 0:",
"- drink.pop(0)",
"- value += drink[0][0]",
"- hold += 1",
"- drink[... | false | 0.044461 | 0.038063 | 1.168101 | [
"s096996854",
"s914104129"
] |
u969850098 | p02631 | python | s781018196 | s885351213 | 177 | 134 | 36,324 | 31,584 | Accepted | Accepted | 24.29 | import sys
readline = sys.stdin.readline
def main():
N = int(readline()) # 偶数
A = list(map(int, readline().rstrip().split())) # [自分以外の全ての整数のxor, ...]
if N == 2:
print((*A[::-1]))
return
xor = []
for i in range(N-1):
xor.append(A[i] ^ A[i+1]) # a x... | import sys
readline = sys.stdin.readline
def main():
N = int(readline()) # 偶数
A = list(map(int, readline().rstrip().split())) # [自分以外の全ての整数のxor, ...]
xor = 0
for a in A:
xor ^= a
res = [a ^ xor for a in A]
print((*res))
if __name__ == '__main__':
main... | 40 | 18 | 698 | 320 | import sys
readline = sys.stdin.readline
def main():
N = int(readline()) # 偶数
A = list(map(int, readline().rstrip().split())) # [自分以外の全ての整数のxor, ...]
if N == 2:
print((*A[::-1]))
return
xor = []
for i in range(N - 1):
xor.append(A[i] ^ A[i + 1]) # a xor b, b xor c, c xo... | import sys
readline = sys.stdin.readline
def main():
N = int(readline()) # 偶数
A = list(map(int, readline().rstrip().split())) # [自分以外の全ての整数のxor, ...]
xor = 0
for a in A:
xor ^= a
res = [a ^ xor for a in A]
print((*res))
if __name__ == "__main__":
main()
| false | 55 | [
"- if N == 2:",
"- print((*A[::-1]))",
"- return",
"- xor = []",
"- for i in range(N - 1):",
"- xor.append(A[i] ^ A[i + 1]) # a xor b, b xor c, c xor d ...",
"- # bを求める",
"- b = A[0]",
"- for i in range(2, N, 2):",
"- b ^= xor[i]",
"- # aを求める",
... | false | 0.068694 | 0.076217 | 0.901289 | [
"s781018196",
"s885351213"
] |
u606045429 | p02936 | python | s272286494 | s340086945 | 1,887 | 1,249 | 109,772 | 63,608 | Accepted | Accepted | 33.81 | N, Q = [int(i) for i in input().split()]
E = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b = [int(i) for i in input().split()]
E[a].append(b)
E[b].append(a)
M = [0] * (N + 1)
for _ in range(Q):
p, x = [int(i) for i in input().split()]
M[p] += x
from collections import dequ... | from collections import deque
import sys
input = sys.stdin.readline
N, Q = [int(i) for i in input().split()]
E = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b = [int(i) for i in input().split()]
E[a].append(b)
E[b].append(a)
M = [0] * (N + 1)
for _ in range(Q):
p, x = [int(i) f... | 30 | 31 | 589 | 628 | N, Q = [int(i) for i in input().split()]
E = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b = [int(i) for i in input().split()]
E[a].append(b)
E[b].append(a)
M = [0] * (N + 1)
for _ in range(Q):
p, x = [int(i) for i in input().split()]
M[p] += x
from collections import deque
ans = M[:]
visi... | from collections import deque
import sys
input = sys.stdin.readline
N, Q = [int(i) for i in input().split()]
E = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b = [int(i) for i in input().split()]
E[a].append(b)
E[b].append(a)
M = [0] * (N + 1)
for _ in range(Q):
p, x = [int(i) for i in input().... | false | 3.225806 | [
"+from collections import deque",
"+import sys",
"+",
"+input = sys.stdin.readline",
"-from collections import deque",
"-"
] | false | 0.038662 | 0.008341 | 4.635015 | [
"s272286494",
"s340086945"
] |
u179169725 | p03164 | python | s730976337 | s390806382 | 1,415 | 1,138 | 199,916 | 273,228 | Accepted | Accepted | 19.58 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def ints(): return list(map(... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def ints(): return list(map(... | 73 | 70 | 1,738 | 1,577 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1):
return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def ints():
return list(map(int, re... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1):
return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def ints():
return list(map(int, re... | false | 4.109589 | [
"- dp = np.full((N + 1, V_max), 10**12, dtype=np.int64)",
"+ dp = np.full((N + 1, 2 * V_max), 10**12, dtype=np.int64)",
"- dp[i + 1, :] = np.minimum(dp[i + 1, :], dp[i, :])",
"- dp[i + 1, V[i] :] = np.minimum(dp[i + 1, V[i] :], dp[i, : -V[i]] + W[i])",
"- # 以下のコードを高速化",
"- ... | false | 0.229811 | 0.214572 | 1.071021 | [
"s730976337",
"s390806382"
] |
u222668979 | p03634 | python | s305878320 | s751965206 | 608 | 529 | 178,000 | 165,128 | Accepted | Accepted | 12.99 | from collections import deque
def nearlist(N, LIST): # 隣接リスト
NEAR = [set() for _ in range(N)]
COST = {}
for a, b, c in LIST:
NEAR[a - 1].add(b - 1)
NEAR[b - 1].add(a - 1)
COST[(a - 1, b - 1)] = c
COST[(b - 1, a - 1)] = c
return NEAR, COST
def bfs(NEAR, ... | from collections import deque
def nearlist(N, LIST): # 隣接リスト
NEAR = [{} for _ in range(N)]
for a, b, c in LIST:
NEAR[a - 1][b - 1] = c
NEAR[b - 1][a - 1] = c
return NEAR
def bfs(NEAR, S, N): # 幅優先探索 # キュー
DIST = [-1 for _ in range(N)] # 前処理
DIST[S] = 0
que, ... | 38 | 35 | 991 | 893 | from collections import deque
def nearlist(N, LIST): # 隣接リスト
NEAR = [set() for _ in range(N)]
COST = {}
for a, b, c in LIST:
NEAR[a - 1].add(b - 1)
NEAR[b - 1].add(a - 1)
COST[(a - 1, b - 1)] = c
COST[(b - 1, a - 1)] = c
return NEAR, COST
def bfs(NEAR, S, N): # 幅優先探... | from collections import deque
def nearlist(N, LIST): # 隣接リスト
NEAR = [{} for _ in range(N)]
for a, b, c in LIST:
NEAR[a - 1][b - 1] = c
NEAR[b - 1][a - 1] = c
return NEAR
def bfs(NEAR, S, N): # 幅優先探索 # キュー
DIST = [-1 for _ in range(N)] # 前処理
DIST[S] = 0
que, frag = deque([... | false | 7.894737 | [
"- NEAR = [set() for _ in range(N)]",
"- COST = {}",
"+ NEAR = [{} for _ in range(N)]",
"- NEAR[a - 1].add(b - 1)",
"- NEAR[b - 1].add(a - 1)",
"- COST[(a - 1, b - 1)] = c",
"- COST[(b - 1, a - 1)] = c",
"- return NEAR, COST",
"+ NEAR[a - 1][b - 1] = c"... | false | 0.036708 | 0.042588 | 0.861928 | [
"s305878320",
"s751965206"
] |
u498487134 | p02983 | python | s742547908 | s781817485 | 227 | 81 | 40,684 | 64,376 | Accepted | Accepted | 64.32 | L,R =list(map(int,input().split()))
mod=2019
ans=mod
l=L%mod
r=R%mod
if r<=l:
ans=0
elif (R-L)>=2019:
ans=0
else:
for i in range(l,r+1):
for j in range(i+1,r+1):
ans=min(ans,i*j%mod)
print(ans) | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=2019
L,R=MI()
if R-L>=2019:
print((0))
exit()
a=L%mod
b=R%mod
if b<=a:... | 16 | 30 | 236 | 535 | L, R = list(map(int, input().split()))
mod = 2019
ans = mod
l = L % mod
r = R % mod
if r <= l:
ans = 0
elif (R - L) >= 2019:
ans = 0
else:
for i in range(l, r + 1):
for j in range(i + 1, r + 1):
ans = min(ans, i * j % mod)
print(ans)
| import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 2019
L, R = MI()
if R - L >= 2019:
print((0))
exit()
a = L % mod
b = R % m... | false | 46.666667 | [
"-L, R = list(map(int, input().split()))",
"-mod = 2019",
"-ans = mod",
"-l = L % mod",
"-r = R % mod",
"-if r <= l:",
"- ans = 0",
"-elif (R - L) >= 2019:",
"- ans = 0",
"-else:",
"- for i in range(l, r + 1):",
"- for j in range(i + 1, r + 1):",
"- ans = min(ans, ... | false | 0.042569 | 0.041837 | 1.017496 | [
"s742547908",
"s781817485"
] |
u353919145 | p03605 | python | s217612756 | s534765028 | 17 | 11 | 2,940 | 2,568 | Accepted | Accepted | 35.29 | n = eval(input())
if n[0] == '9' or n[1] == '9':
print("Yes")
else:
print("No")
| n = input()
if '9' in n:
print('Yes')
else:
print('No') | 7 | 5 | 98 | 63 | n = eval(input())
if n[0] == "9" or n[1] == "9":
print("Yes")
else:
print("No")
| n = input()
if "9" in n:
print("Yes")
else:
print("No")
| false | 28.571429 | [
"-n = eval(input())",
"-if n[0] == \"9\" or n[1] == \"9\":",
"+n = input()",
"+if \"9\" in n:"
] | false | 0.137247 | 0.13503 | 1.016421 | [
"s217612756",
"s534765028"
] |
u056801547 | p02898 | python | s195399742 | s926427955 | 212 | 195 | 51,440 | 51,440 | Accepted | Accepted | 8.02 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
h = sorted(h, reverse=True)
for i in range(n):
if h[i] < k:
break
else:
print((i+1))
exit()
print(i) | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
print((len([i for i in a if i >= k]))) | 10 | 3 | 196 | 107 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
h = sorted(h, reverse=True)
for i in range(n):
if h[i] < k:
break
else:
print((i + 1))
exit()
print(i)
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
print((len([i for i in a if i >= k])))
| false | 70 | [
"-h = list(map(int, input().split()))",
"-h = sorted(h, reverse=True)",
"-for i in range(n):",
"- if h[i] < k:",
"- break",
"-else:",
"- print((i + 1))",
"- exit()",
"-print(i)",
"+a = list(map(int, input().split()))",
"+print((len([i for i in a if i >= k])))"
] | false | 0.039162 | 0.039384 | 0.994373 | [
"s195399742",
"s926427955"
] |
u346395915 | p03607 | python | s902874436 | s213998373 | 318 | 198 | 16,460 | 14,696 | Accepted | Accepted | 37.74 | n = int(eval(input()))
ans = [eval(input()) for i in range(n)]
ans.sort()
s = sorted(set(ans))
t = 0
cnt = 0
result = 0
for i in range(n):
temp = s[t]
if ans[i] == temp:
cnt += 1
else:
if cnt % 2 == 1:
result += 1
cnt = 1
t += 1
else:
... | n = int(eval(input()))
ans = set()
for i in range(n):
ans ^= {eval(input())}
print((len(ans))) | 28 | 9 | 384 | 100 | n = int(eval(input()))
ans = [eval(input()) for i in range(n)]
ans.sort()
s = sorted(set(ans))
t = 0
cnt = 0
result = 0
for i in range(n):
temp = s[t]
if ans[i] == temp:
cnt += 1
else:
if cnt % 2 == 1:
result += 1
cnt = 1
t += 1
else:
if cnt % 2 == 1:
... | n = int(eval(input()))
ans = set()
for i in range(n):
ans ^= {eval(input())}
print((len(ans)))
| false | 67.857143 | [
"-ans = [eval(input()) for i in range(n)]",
"-ans.sort()",
"-s = sorted(set(ans))",
"-t = 0",
"-cnt = 0",
"-result = 0",
"+ans = set()",
"- temp = s[t]",
"- if ans[i] == temp:",
"- cnt += 1",
"- else:",
"- if cnt % 2 == 1:",
"- result += 1",
"- cnt ... | false | 0.047711 | 0.043282 | 1.10233 | [
"s902874436",
"s213998373"
] |
u037441960 | p01086 | python | s349723324 | s281421007 | 40 | 30 | 5,616 | 5,616 | Accepted | Accepted | 25 | while True :
n = int(eval(input()))
if(n == 0) :
break
else :
A = [5, 7, 5, 7, 7]
ans = 0
w = [len(eval(input())) for i in range(n)]
for i in range(n) :
k = 0
s = 0
for j in range(i, n) :
s += w[j]
if(s == A[k]) :
s = 0
k += ... | while True :
n = int(eval(input()))
if(n == 0) :
break
else :
S = [len(eval(input())) for i in range(n)]
T = [5, 7, 5, 7, 7]
ans = 0
for i in range(n) :
s = 0
w = 0
for j in range(i, n) :
... | 24 | 34 | 478 | 806 | while True:
n = int(eval(input()))
if n == 0:
break
else:
A = [5, 7, 5, 7, 7]
ans = 0
w = [len(eval(input())) for i in range(n)]
for i in range(n):
k = 0
s = 0
for j in range(i, n):
s += w[j]
if s == ... | while True:
n = int(eval(input()))
if n == 0:
break
else:
S = [len(eval(input())) for i in range(n)]
T = [5, 7, 5, 7, 7]
ans = 0
for i in range(n):
s = 0
w = 0
for j in range(i, n):
s += S[j]
if s == ... | false | 29.411765 | [
"- A = [5, 7, 5, 7, 7]",
"+ S = [len(eval(input())) for i in range(n)]",
"+ T = [5, 7, 5, 7, 7]",
"- w = [len(eval(input())) for i in range(n)]",
"- k = 0",
"+ w = 0",
"- s += w[j]",
"- if s == A[k]:",
"+ ... | false | 0.047279 | 0.047549 | 0.994312 | [
"s349723324",
"s281421007"
] |
u753803401 | p03821 | python | s902915894 | s732193894 | 386 | 338 | 56,540 | 56,028 | Accepted | Accepted | 12.44 | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip('\n'))
ab = [list(map(int, (str(i) + " " + input().rstrip('\n')).split())) for i in range(n)]
ab.sort(reverse=True)
cnt = 0
for i, a, b in ab:
if (a + cnt) % b != 0:
cnt += (b - (a + cnt) %... | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip('\n'))
ab = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
t = 0
for i in range(n-1, -1, -1):
while True:
if (ab[i][0] + t) % ab[i][1] == 0:
break
... | 15 | 17 | 385 | 447 | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip("\n"))
ab = [
list(map(int, (str(i) + " " + input().rstrip("\n")).split())) for i in range(n)
]
ab.sort(reverse=True)
cnt = 0
for i, a, b in ab:
if (a + cnt) % b != 0:
cnt += b - (a + c... | def slove():
import sys
input = sys.stdin.readline
n = int(input().rstrip("\n"))
ab = [list(map(int, input().rstrip("\n").split())) for _ in range(n)]
t = 0
for i in range(n - 1, -1, -1):
while True:
if (ab[i][0] + t) % ab[i][1] == 0:
break
else:
... | false | 11.764706 | [
"- ab = [",
"- list(map(int, (str(i) + \" \" + input().rstrip(\"\\n\")).split())) for i in range(n)",
"- ]",
"- ab.sort(reverse=True)",
"- cnt = 0",
"- for i, a, b in ab:",
"- if (a + cnt) % b != 0:",
"- cnt += b - (a + cnt) % b",
"- print(cnt)",
"+ ab... | false | 0.045552 | 0.046786 | 0.973626 | [
"s902915894",
"s732193894"
] |
u077291787 | p03478 | python | s232528772 | s937416029 | 31 | 27 | 3,064 | 2,940 | Accepted | Accepted | 12.9 | # ABC083B - Some Sums
def main():
n, a, b = list(map(int, input().rstrip().split()))
ans = 0
for i in range(1, n + 1):
if a <= sum(map(int, list(str(i)))) <= b:
ans += i
print(ans)
if __name__ == "__main__":
main() | # ABC083B - Some Sums
def main():
N, A, B = tuple(map(int, input().split()))
ans = sum(i for i in range(1, N + 1) if A <= sum(map(int, str(i))) <= B)
print(ans)
if __name__ == "__main__":
main() | 12 | 9 | 267 | 220 | # ABC083B - Some Sums
def main():
n, a, b = list(map(int, input().rstrip().split()))
ans = 0
for i in range(1, n + 1):
if a <= sum(map(int, list(str(i)))) <= b:
ans += i
print(ans)
if __name__ == "__main__":
main()
| # ABC083B - Some Sums
def main():
N, A, B = tuple(map(int, input().split()))
ans = sum(i for i in range(1, N + 1) if A <= sum(map(int, str(i))) <= B)
print(ans)
if __name__ == "__main__":
main()
| false | 25 | [
"- n, a, b = list(map(int, input().rstrip().split()))",
"- ans = 0",
"- for i in range(1, n + 1):",
"- if a <= sum(map(int, list(str(i)))) <= b:",
"- ans += i",
"+ N, A, B = tuple(map(int, input().split()))",
"+ ans = sum(i for i in range(1, N + 1) if A <= sum(map(int, s... | false | 0.047054 | 0.110099 | 0.427381 | [
"s232528772",
"s937416029"
] |
u896741788 | p03475 | python | s603941969 | s408915383 | 120 | 75 | 3,188 | 3,188 | Accepted | Accepted | 37.5 | n=int(input())
l=[list(map(int,input().split())) for i in range(n-1)]+[[0,0,1]]
al=[]
mati=0
for i in range(n):
now=l[i][1]+l[i][0]
for j in range(i+1,n):
now=l[j][0]+l[j][1]-(-max(0,now-l[j][1])//l[j][2])*l[j][2]
al.append(now)
print(*al,sep="\n")
| def f():
n=int(eval(input()))
l=[list(map(int,input().split())) for i in range(n-1)]+[[0,0,1]]
for i in range(n):
now=0
for a,s,d in l[i:]:
now=a+s-(-max(0,now-s)//d)*d
print(now)
if __name__=="__main__":
f() | 10 | 10 | 267 | 237 | n = int(input())
l = [list(map(int, input().split())) for i in range(n - 1)] + [[0, 0, 1]]
al = []
mati = 0
for i in range(n):
now = l[i][1] + l[i][0]
for j in range(i + 1, n):
now = l[j][0] + l[j][1] - (-max(0, now - l[j][1]) // l[j][2]) * l[j][2]
al.append(now)
print(*al, sep="\n")
| def f():
n = int(eval(input()))
l = [list(map(int, input().split())) for i in range(n - 1)] + [[0, 0, 1]]
for i in range(n):
now = 0
for a, s, d in l[i:]:
now = a + s - (-max(0, now - s) // d) * d
print(now)
if __name__ == "__main__":
f()
| false | 0 | [
"-n = int(input())",
"-l = [list(map(int, input().split())) for i in range(n - 1)] + [[0, 0, 1]]",
"-al = []",
"-mati = 0",
"-for i in range(n):",
"- now = l[i][1] + l[i][0]",
"- for j in range(i + 1, n):",
"- now = l[j][0] + l[j][1] - (-max(0, now - l[j][1]) // l[j][2]) * l[j][2]",
"- ... | false | 0.068725 | 0.063114 | 1.088907 | [
"s603941969",
"s408915383"
] |
u370429695 | p03127 | python | s084587678 | s547315262 | 96 | 81 | 16,240 | 16,300 | Accepted | Accepted | 15.62 | import fractions
N = int(eval(input()))
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
ans = fractions.gcd(ans, a[i])
print(ans) | import functools
from fractions import gcd
n = int(eval(input()))
li = list(map(int,input().split()))
print((functools.reduce(gcd,li))) | 7 | 5 | 154 | 132 | import fractions
N = int(eval(input()))
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
ans = fractions.gcd(ans, a[i])
print(ans)
| import functools
from fractions import gcd
n = int(eval(input()))
li = list(map(int, input().split()))
print((functools.reduce(gcd, li)))
| false | 28.571429 | [
"-import fractions",
"+import functools",
"+from fractions import gcd",
"-N = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-ans = a[0]",
"-for i in range(1, N):",
"- ans = fractions.gcd(ans, a[i])",
"-print(ans)",
"+n = int(eval(input()))",
"+li = list(map(int, input().split(... | false | 0.07525 | 0.13888 | 0.541832 | [
"s084587678",
"s547315262"
] |
u038027079 | p03264 | python | s110974523 | s921832020 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | k = int(eval(input()))
count = 0
for i in range(k):
for j in range(i+1, k):
if (i % 2 == 0 and j % 2 == 1) or (i % 2 == 1 and j % 2 == 0):
count +=1
print(count) | k = int(eval(input()))
print(((k // 2) * (k - k // 2)))
| 7 | 2 | 185 | 49 | k = int(eval(input()))
count = 0
for i in range(k):
for j in range(i + 1, k):
if (i % 2 == 0 and j % 2 == 1) or (i % 2 == 1 and j % 2 == 0):
count += 1
print(count)
| k = int(eval(input()))
print(((k // 2) * (k - k // 2)))
| false | 71.428571 | [
"-count = 0",
"-for i in range(k):",
"- for j in range(i + 1, k):",
"- if (i % 2 == 0 and j % 2 == 1) or (i % 2 == 1 and j % 2 == 0):",
"- count += 1",
"-print(count)",
"+print(((k // 2) * (k - k // 2)))"
] | false | 0.00815 | 0.042904 | 0.189963 | [
"s110974523",
"s921832020"
] |
u983918956 | p03050 | python | s788530303 | s245359678 | 143 | 116 | 3,188 | 3,296 | Accepted | Accepted | 18.88 | from math import floor
N = int(eval(input()))
ans = 0
sup = floor(pow(N,1/2))
for r in range(1,sup+1):
if N % r == 0:
m = N // r - 1
if 0 <= r <= m-1:
ans += m
print(ans) | from math import floor
def divisor(n):
left = [1]
right = [n]
sup = floor(pow(n,1/2))
for p in range(2,sup+1):
if n % p == 0:
left.append(p)
right.append(n//p)
res = left + right[::-1]
return res
N = int(eval(input()))
div = divisor(N)
a... | 11 | 23 | 207 | 417 | from math import floor
N = int(eval(input()))
ans = 0
sup = floor(pow(N, 1 / 2))
for r in range(1, sup + 1):
if N % r == 0:
m = N // r - 1
if 0 <= r <= m - 1:
ans += m
print(ans)
| from math import floor
def divisor(n):
left = [1]
right = [n]
sup = floor(pow(n, 1 / 2))
for p in range(2, sup + 1):
if n % p == 0:
left.append(p)
right.append(n // p)
res = left + right[::-1]
return res
N = int(eval(input()))
div = divisor(N)
ans = 0
for d in... | false | 52.173913 | [
"+",
"+def divisor(n):",
"+ left = [1]",
"+ right = [n]",
"+ sup = floor(pow(n, 1 / 2))",
"+ for p in range(2, sup + 1):",
"+ if n % p == 0:",
"+ left.append(p)",
"+ right.append(n // p)",
"+ res = left + right[::-1]",
"+ return res",
"+",
"+",
... | false | 0.29086 | 0.159013 | 1.829165 | [
"s788530303",
"s245359678"
] |
u555503067 | p02899 | python | s576226490 | s518876034 | 290 | 164 | 18,264 | 13,812 | Accepted | Accepted | 43.45 | N = int(input())
A_list = list(map(int, input().split()))
my_list = []
for i in range(len(A_list)):
my_list.append((A_list[i], i+1))
my_list.sort()
for val in my_list:
print(val[1], end=" ")
print()
| N = int(input())
A_list = list(map(int, input().split()))
# my_list = []
# for i in range(len(A_list)):
# my_list.append((A_list[i], i+1))
# my_list.sort()
# for val in my_list:
# print(val[1], end=" ")
# print()
my_list = [0] * N
for i in range(len(A_list)):
my_list[A_list[i] - 1] = i + 1
for... | 9 | 16 | 214 | 371 | N = int(input())
A_list = list(map(int, input().split()))
my_list = []
for i in range(len(A_list)):
my_list.append((A_list[i], i + 1))
my_list.sort()
for val in my_list:
print(val[1], end=" ")
print()
| N = int(input())
A_list = list(map(int, input().split()))
# my_list = []
# for i in range(len(A_list)):
# my_list.append((A_list[i], i+1))
# my_list.sort()
# for val in my_list:
# print(val[1], end=" ")
# print()
my_list = [0] * N
for i in range(len(A_list)):
my_list[A_list[i] - 1] = i + 1
for val in my_lis... | false | 43.75 | [
"-my_list = []",
"+# my_list = []",
"+# for i in range(len(A_list)):",
"+# my_list.append((A_list[i], i+1))",
"+# my_list.sort()",
"+# for val in my_list:",
"+# print(val[1], end=\" \")",
"+# print()",
"+my_list = [0] * N",
"- my_list.append((A_list[i], i + 1))",
"-my_list.sort()",
... | false | 0.078996 | 0.04189 | 1.885788 | [
"s576226490",
"s518876034"
] |
u678505520 | p02714 | python | s667516497 | s181607012 | 1,849 | 1,315 | 9,468 | 9,220 | Accepted | Accepted | 28.88 | from collections import Counter
N = int(eval(input()))
S = [i for i in eval(input())]
count = 0
s = Counter(S)
for i in range(N):
for j in range(i,N):
if (i+j)%2==0 and S[(i+j)//2]!=S[i] and S[i]!=S[j] and S[(i+j)//2]!=S[j]:
count += 1
print(((s['R'] * s['B'] * s['G'])-count)) | N = int(eval(input()))
S = [i for i in eval(input())]
r = 0
g = 0
b = 0
no = 0
for i in S:
if i == "R":
r += 1
elif i == "G":
g += 1
else:
b += 1
for i in range(N):
for j in range(i+1, N):
k = j*2 - i
if k >= N:
break
el... | 11 | 25 | 298 | 401 | from collections import Counter
N = int(eval(input()))
S = [i for i in eval(input())]
count = 0
s = Counter(S)
for i in range(N):
for j in range(i, N):
if (
(i + j) % 2 == 0
and S[(i + j) // 2] != S[i]
and S[i] != S[j]
and S[(i + j) // 2] != S[j]
):
... | N = int(eval(input()))
S = [i for i in eval(input())]
r = 0
g = 0
b = 0
no = 0
for i in S:
if i == "R":
r += 1
elif i == "G":
g += 1
else:
b += 1
for i in range(N):
for j in range(i + 1, N):
k = j * 2 - i
if k >= N:
break
elif S[i] != S[j] and ... | false | 56 | [
"-from collections import Counter",
"-",
"-count = 0",
"-s = Counter(S)",
"+r = 0",
"+g = 0",
"+b = 0",
"+no = 0",
"+for i in S:",
"+ if i == \"R\":",
"+ r += 1",
"+ elif i == \"G\":",
"+ g += 1",
"+ else:",
"+ b += 1",
"- for j in range(i, N):",
"- ... | false | 0.081364 | 0.096472 | 0.843394 | [
"s667516497",
"s181607012"
] |
u721316601 | p02947 | python | s732785494 | s774952249 | 776 | 481 | 17,848 | 18,236 | Accepted | Accepted | 38.02 | import math
N = int(eval(input()))
s = {}
ans = 0
for i in range(N):
tmp = ''.join(sorted(eval(input())))
if tmp in s:
s[tmp] += 1
else:
s[tmp] = 1
x = math.factorial(2)
for n in list(s.values()):
if n > 1:
ans += math.factorial(n) // (math.factorial(n-2) * x)
pri... | from collections import Counter
count = Counter()
for i in range(int(eval(input()))):
s = sorted(eval(input()))
count[''.join(s)] += 1
ans = 0
for n in list(count.values()):
if n >= 2:
ans += (n**2 - n) // 2
print(ans) | 18 | 14 | 310 | 226 | import math
N = int(eval(input()))
s = {}
ans = 0
for i in range(N):
tmp = "".join(sorted(eval(input())))
if tmp in s:
s[tmp] += 1
else:
s[tmp] = 1
x = math.factorial(2)
for n in list(s.values()):
if n > 1:
ans += math.factorial(n) // (math.factorial(n - 2) * x)
print(ans)
| from collections import Counter
count = Counter()
for i in range(int(eval(input()))):
s = sorted(eval(input()))
count["".join(s)] += 1
ans = 0
for n in list(count.values()):
if n >= 2:
ans += (n**2 - n) // 2
print(ans)
| false | 22.222222 | [
"-import math",
"+from collections import Counter",
"-N = int(eval(input()))",
"-s = {}",
"+count = Counter()",
"+for i in range(int(eval(input()))):",
"+ s = sorted(eval(input()))",
"+ count[\"\".join(s)] += 1",
"-for i in range(N):",
"- tmp = \"\".join(sorted(eval(input())))",
"- i... | false | 0.046605 | 0.11705 | 0.398165 | [
"s732785494",
"s774952249"
] |
u285891772 | p03576 | python | s642038813 | s124021292 | 1,145 | 51 | 79,688 | 10,056 | Accepted | Accepted | 95.55 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 42 | 36 | 1,333 | 1,343 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 14.285714 | [
"-from functools import reduce",
"+from functools import reduce, lru_cache",
"-from decimal import *",
"-",
"+# from decimal import *",
"-x, y = list(zip(*xy))",
"-x = sorted(x)",
"-y = sorted(y)",
"-for ax, bx in combinations(x, 2):",
"- for ay, by in combinations(y, 2):",
"- cnt = 0"... | false | 0.036148 | 0.035318 | 1.02352 | [
"s642038813",
"s124021292"
] |
u454557108 | p02696 | python | s065213970 | s287213924 | 138 | 60 | 64,064 | 62,180 | Accepted | Accepted | 56.52 | import math
a,b,n = list(map(int,input().split()))
c = 0
ans = 0
for i in range(1,10**7) :
x = b*i-1
if x > n :
x = n
c = 1
ans = max(ans,math.floor((a*x)/b)-a*math.floor(x/b))
if c == 1 :
break
print(ans)
| import math
a,b,n = list(map(int,input().split()))
c = 0
ans = -1
for i in range(1,n//b+2) :
x = b*i-1
if x > n :
x = n
c = 1
if ans >= math.floor((a*x)/b)-a*math.floor(x/b) :
break
ans = math.floor((a*x)/b)-a*math.floor(x/b)
if c == 1 :
break
prin... | 16 | 18 | 258 | 320 | import math
a, b, n = list(map(int, input().split()))
c = 0
ans = 0
for i in range(1, 10**7):
x = b * i - 1
if x > n:
x = n
c = 1
ans = max(ans, math.floor((a * x) / b) - a * math.floor(x / b))
if c == 1:
break
print(ans)
| import math
a, b, n = list(map(int, input().split()))
c = 0
ans = -1
for i in range(1, n // b + 2):
x = b * i - 1
if x > n:
x = n
c = 1
if ans >= math.floor((a * x) / b) - a * math.floor(x / b):
break
ans = math.floor((a * x) / b) - a * math.floor(x / b)
if c == 1:
b... | false | 11.111111 | [
"-ans = 0",
"-for i in range(1, 10**7):",
"+ans = -1",
"+for i in range(1, n // b + 2):",
"- ans = max(ans, math.floor((a * x) / b) - a * math.floor(x / b))",
"+ if ans >= math.floor((a * x) / b) - a * math.floor(x / b):",
"+ break",
"+ ans = math.floor((a * x) / b) - a * math.floor(x ... | false | 0.036453 | 0.035551 | 1.025379 | [
"s065213970",
"s287213924"
] |
u967136506 | p02821 | python | s840581384 | s313523317 | 1,031 | 838 | 14,620 | 14,268 | Accepted | Accepted | 18.72 | def ints():
return [int(x) for x in input().split()]
def ii():
return int(eval(input()))
N, M = ints()
A = ints()
A.sort()
def combinations(x):
s = 0
i = 0
j = N-1
while j>=0:
while i<N and A[i]+A[j]<x:
i += 1
s += N-i
j -= 1
return s
def koufukudo(x):
s... | def ints():
return [int(x) for x in input().split()]
def ii():
return int(eval(input()))
N, M = ints()
A = ints()
A.sort()
A.reverse()
def combinations(x):
s = 0
i = 0
for j in reversed(list(range(N))):
while i<N and A[i]+A[j]>=x:
i += 1
s += i
return s
def koufukud... | 52 | 45 | 754 | 709 | def ints():
return [int(x) for x in input().split()]
def ii():
return int(eval(input()))
N, M = ints()
A = ints()
A.sort()
def combinations(x):
s = 0
i = 0
j = N - 1
while j >= 0:
while i < N and A[i] + A[j] < x:
i += 1
s += N - i
j -= 1
return s
d... | def ints():
return [int(x) for x in input().split()]
def ii():
return int(eval(input()))
N, M = ints()
A = ints()
A.sort()
A.reverse()
def combinations(x):
s = 0
i = 0
for j in reversed(list(range(N))):
while i < N and A[i] + A[j] >= x:
i += 1
s += i
return s
... | false | 13.461538 | [
"+A.reverse()",
"- j = N - 1",
"- while j >= 0:",
"- while i < N and A[i] + A[j] < x:",
"+ for j in reversed(list(range(N))):",
"+ while i < N and A[i] + A[j] >= x:",
"- s += N - i",
"- j -= 1",
"+ s += i",
"- j = 0",
"- i = N - 1",
"- while... | false | 0.040434 | 0.038667 | 1.04571 | [
"s840581384",
"s313523317"
] |
u125807888 | p02615 | python | s372528441 | s646005116 | 451 | 132 | 128,720 | 105,132 | Accepted | Accepted | 70.73 | import heapq
FAST_IO = 1
if FAST_IO:
import io, sys, atexit
rr = iter(sys.stdin.read().splitlines()).__next__
sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
@atexit.register
def write():
sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
rr = raw_input
rri = lambda: int(rr())... | n = int(eval(input()))
arr = list(map(int , input().split()))
arr.sort(reverse = True)
ptr = 1
s = arr[0]
n-=2
while n:
s+=arr[ptr]
n-=1
if n == 0: break
s+=arr[ptr]
n-=1
ptr+=1
print(s) | 36 | 14 | 926 | 217 | import heapq
FAST_IO = 1
if FAST_IO:
import io, sys, atexit
rr = iter(sys.stdin.read().splitlines()).__next__
sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
@atexit.register
def write():
sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
rr = raw_input
rri = lambda: int(rr())
rrm = la... | n = int(eval(input()))
arr = list(map(int, input().split()))
arr.sort(reverse=True)
ptr = 1
s = arr[0]
n -= 2
while n:
s += arr[ptr]
n -= 1
if n == 0:
break
s += arr[ptr]
n -= 1
ptr += 1
print(s)
| false | 61.111111 | [
"-import heapq",
"-",
"-FAST_IO = 1",
"-if FAST_IO:",
"- import io, sys, atexit",
"-",
"- rr = iter(sys.stdin.read().splitlines()).__next__",
"- sys.stdout = _OUTPUT_BUFFER = io.BytesIO()",
"-",
"- @atexit.register",
"- def write():",
"- sys.__stdout__.write(_OUTPUT_BUFFE... | false | 0.038861 | 0.037252 | 1.043184 | [
"s372528441",
"s646005116"
] |
u402629484 | p03112 | python | s162995832 | s770971893 | 1,791 | 1,491 | 12,800 | 13,952 | Accepted | Accepted | 16.75 | A,B,Q = list(map(int, input().split()))
s = [-(10**11)]+[int(eval(input())) for _ in range(A)]+[10**11]
t = [-(10**11)]+[int(eval(input())) for _ in range(B)]+[10**11]
s.sort()
t.sort()
import bisect
import itertools
for _ in range(Q):
pos = int(eval(input()))
s_near_id = bisect.bisect_left(s, pos)-1... | A,B,Q = list(map(int, input().split()))
s = [-(10**11)]+[int(eval(input())) for _ in range(A)]+[10**11]
t = [-(10**11)]+[int(eval(input())) for _ in range(B)]+[10**11]
s.sort()
t.sort()
import bisect
import itertools
for _ in range(Q):
pos = int(eval(input()))
near_s = bisect.bisect_left(s, pos)-1
... | 13 | 22 | 521 | 621 | A, B, Q = list(map(int, input().split()))
s = [-(10**11)] + [int(eval(input())) for _ in range(A)] + [10**11]
t = [-(10**11)] + [int(eval(input())) for _ in range(B)] + [10**11]
s.sort()
t.sort()
import bisect
import itertools
for _ in range(Q):
pos = int(eval(input()))
s_near_id = bisect.bisect_left(s, pos) -... | A, B, Q = list(map(int, input().split()))
s = [-(10**11)] + [int(eval(input())) for _ in range(A)] + [10**11]
t = [-(10**11)] + [int(eval(input())) for _ in range(B)] + [10**11]
s.sort()
t.sort()
import bisect
import itertools
for _ in range(Q):
pos = int(eval(input()))
near_s = bisect.bisect_left(s, pos) - 1
... | false | 40.909091 | [
"- s_near_id = bisect.bisect_left(s, pos) - 1",
"- t_near_id = bisect.bisect_left(t, pos) - 1",
"+ near_s = bisect.bisect_left(s, pos) - 1",
"+ near_t = bisect.bisect_left(t, pos) - 1",
"+ s1, s2 = s[near_s], s[near_s + 1]",
"+ t1, t2 = t[near_t], t[near_t + 1]",
"- min(... | false | 0.007425 | 0.044747 | 0.165934 | [
"s162995832",
"s770971893"
] |
u923668099 | p02258 | python | s495207722 | s296857004 | 510 | 310 | 7,676 | 7,676 | Accepted | Accepted | 39.22 |
n = int(eval(input()))
dif_max = -float("inf")
min_v = float("inf")
for i in range(n):
r = int(eval(input()))
dif_max = max(dif_max, r - min_v)
min_v = min(min_v, r)
print(dif_max) | import sys
n = int(eval(input()))
dif_max = -float("inf")
min_v = float("inf")
for i in range(n):
r = int(sys.stdin.readline())
dif_max = max(dif_max, r - min_v)
min_v = min(min_v, r)
print(dif_max) | 12 | 13 | 195 | 220 | n = int(eval(input()))
dif_max = -float("inf")
min_v = float("inf")
for i in range(n):
r = int(eval(input()))
dif_max = max(dif_max, r - min_v)
min_v = min(min_v, r)
print(dif_max)
| import sys
n = int(eval(input()))
dif_max = -float("inf")
min_v = float("inf")
for i in range(n):
r = int(sys.stdin.readline())
dif_max = max(dif_max, r - min_v)
min_v = min(min_v, r)
print(dif_max)
| false | 7.692308 | [
"+import sys",
"+",
"- r = int(eval(input()))",
"+ r = int(sys.stdin.readline())"
] | false | 0.039313 | 0.036189 | 1.086314 | [
"s495207722",
"s296857004"
] |
u745360181 | p00423 | python | s904982754 | s085661507 | 110 | 100 | 5,608 | 5,620 | Accepted | Accepted | 9.09 | while True:
n = int(eval(input()))
if n == 0: break
sum_a = sum_b = 0
for i in range(n):
a, b = list(map(int, input().split()))
if a > b:sum_a = sum_a + a + b
elif a < b:sum_b = sum_b + a + b
else:
sum_a = sum_a + a
sum_b = sum_b + b
... | while 1:
n = int(eval(input()))
if n == 0:
break
sum_a = 0
sum_b = 0
for i in range(n):
a,b = list(map(int, input().split()))
if a > b:
sum_a = sum_a + a + b
elif a < b:
sum_b = sum_b + a + b
elif a == ... | 13 | 23 | 330 | 424 | while True:
n = int(eval(input()))
if n == 0:
break
sum_a = sum_b = 0
for i in range(n):
a, b = list(map(int, input().split()))
if a > b:
sum_a = sum_a + a + b
elif a < b:
sum_b = sum_b + a + b
else:
sum_a = sum_a + a
... | while 1:
n = int(eval(input()))
if n == 0:
break
sum_a = 0
sum_b = 0
for i in range(n):
a, b = list(map(int, input().split()))
if a > b:
sum_a = sum_a + a + b
elif a < b:
sum_b = sum_b + a + b
elif a == b:
sum_a = sum_a + a
... | false | 43.478261 | [
"-while True:",
"+while 1:",
"- sum_a = sum_b = 0",
"+ sum_a = 0",
"+ sum_b = 0",
"- else:",
"+ elif a == b:",
"- print((sum_a, sum_b))",
"+ print((\"%s %s\" % (sum_a, sum_b)))"
] | false | 0.038924 | 0.038689 | 1.006076 | [
"s904982754",
"s085661507"
] |
u790710233 | p02984 | python | s365269746 | s460167701 | 170 | 127 | 14,092 | 14,092 | Accepted | Accepted | 25.29 | n = int(eval(input()))
A = list(map(int, input().split()))
SUM = sum(A)
dp = [0]*n
dp[0] = cnt = 0
for i in range(1, n):
dp[i] = 2*A[i-1]-dp[i-1]
cnt += dp[i]
init = SUM-cnt
dp = [0]*n
dp[0] = cnt = init
for i in range(1, n):
dp[i] = 2*A[i-1]-dp[i-1]
cnt += dp[i]
print((*dp)) | n = int(eval(input()))
A = list(map(int, input().split()))
SUM = sum(A)
init = SUM - 2*sum(A[1::2])
dp = [0]*n
dp[0] = init
for i in range(1, n):
dp[i] = 2*A[i-1]-dp[i-1]
print((*dp))
| 18 | 9 | 304 | 188 | n = int(eval(input()))
A = list(map(int, input().split()))
SUM = sum(A)
dp = [0] * n
dp[0] = cnt = 0
for i in range(1, n):
dp[i] = 2 * A[i - 1] - dp[i - 1]
cnt += dp[i]
init = SUM - cnt
dp = [0] * n
dp[0] = cnt = init
for i in range(1, n):
dp[i] = 2 * A[i - 1] - dp[i - 1]
cnt += dp[i]
print((*dp))
| n = int(eval(input()))
A = list(map(int, input().split()))
SUM = sum(A)
init = SUM - 2 * sum(A[1::2])
dp = [0] * n
dp[0] = init
for i in range(1, n):
dp[i] = 2 * A[i - 1] - dp[i - 1]
print((*dp))
| false | 50 | [
"+init = SUM - 2 * sum(A[1::2])",
"-dp[0] = cnt = 0",
"+dp[0] = init",
"- cnt += dp[i]",
"-init = SUM - cnt",
"-dp = [0] * n",
"-dp[0] = cnt = init",
"-for i in range(1, n):",
"- dp[i] = 2 * A[i - 1] - dp[i - 1]",
"- cnt += dp[i]"
] | false | 0.047294 | 0.04754 | 0.994822 | [
"s365269746",
"s460167701"
] |
u729133443 | p02647 | python | s179116548 | s791694697 | 1,976 | 286 | 35,516 | 172,352 | Accepted | Accepted | 85.53 | import sys
from itertools import accumulate
input=sys.stdin.buffer.readline
def main():
n,k=list(map(int,input().split()))
a=[*list(map(int,input().split()))]
for _ in'_'*k:
b=[0]*n
for i,t in enumerate(a):
if i>t:b[i-t]+=1
else:b[0]+=1
j=i-~t
... | n,k,*a=list(map(int,open(0).read().split()))
r=list(range(n))
for _ in a[:k][:41]:
b=[0]*n*3
for i in r:b[max(0,i-a[i])]+=1;b[i-~a[i]]-=1
for i in r:b[i+1]+=b[i]
a=b
print((*a[:n])) | 17 | 8 | 431 | 178 | import sys
from itertools import accumulate
input = sys.stdin.buffer.readline
def main():
n, k = list(map(int, input().split()))
a = [*list(map(int, input().split()))]
for _ in "_" * k:
b = [0] * n
for i, t in enumerate(a):
if i > t:
b[i - t] += 1
e... | n, k, *a = list(map(int, open(0).read().split()))
r = list(range(n))
for _ in a[:k][:41]:
b = [0] * n * 3
for i in r:
b[max(0, i - a[i])] += 1
b[i - ~a[i]] -= 1
for i in r:
b[i + 1] += b[i]
a = b
print((*a[:n]))
| false | 52.941176 | [
"-import sys",
"-from itertools import accumulate",
"-",
"-input = sys.stdin.buffer.readline",
"-",
"-",
"-def main():",
"- n, k = list(map(int, input().split()))",
"- a = [*list(map(int, input().split()))]",
"- for _ in \"_\" * k:",
"- b = [0] * n",
"- for i, t in enume... | false | 0.134377 | 0.045379 | 2.961227 | [
"s179116548",
"s791694697"
] |
u745087332 | p03287 | python | s067374321 | s311146377 | 91 | 77 | 17,284 | 17,284 | Accepted | Accepted | 15.38 | # coding:utf-8
import sys
from collections import Counter
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))
# Counterを使ったD - Candy Distributionの解法
def solve(N, M, A):
# 累積和(mod M)を求める
S = [0]
for i in range(N):
S.append((S[-1] + A[i]) % M)
del... | # coding:utf-8
import sys
from collections import Counter
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))
# Counterを使ったD - Candy Distributionの解法
def solve(N, M, A):
# 累積和S (mod M)を求める
S = [0]
for i in range(N):
S.append((S[-1] + A[i]) % M)
... | 37 | 31 | 634 | 512 | # coding:utf-8
import sys
from collections import Counter
input = sys.stdin.readline
def inpl():
return list(map(int, input().split()))
# Counterを使ったD - Candy Distributionの解法
def solve(N, M, A):
# 累積和(mod M)を求める
S = [0]
for i in range(N):
S.append((S[-1] + A[i]) % M)
del S[0]
# 各要素の... | # coding:utf-8
import sys
from collections import Counter
input = sys.stdin.readline
def inpl():
return list(map(int, input().split()))
# Counterを使ったD - Candy Distributionの解法
def solve(N, M, A):
# 累積和S (mod M)を求める
S = [0]
for i in range(N):
S.append((S[-1] + A[i]) % M)
ans = 0
# 各要素... | false | 16.216216 | [
"- # 累積和(mod M)を求める",
"+ # 累積和S (mod M)を求める",
"- del S[0]",
"+ ans = 0",
"- C = Counter(S)",
"- ans = 0",
"- for num in C:",
"- if C[num] <= 1:",
"- continue",
"- # C[num]個から2つ選ぶ組み合わせ",
"- ans += C[num] * (C[num] - 1) // 2",
"- # 1箱で条件を満た... | false | 0.079439 | 0.03856 | 2.060156 | [
"s067374321",
"s311146377"
] |
u619819312 | p03624 | python | s845372120 | s997244128 | 45 | 37 | 3,188 | 3,188 | Accepted | Accepted | 17.78 | a=[True]*26
s=eval(input())
for i in range(len(s)):
a[ord(s[i])-ord("a")]=False
for i in range(26):
if a[i]:
print((chr(ord("a")+i)))
break
else:
print("None") | d=[0]*26
for i in eval(input()):
d[ord(i)-97]+=1
print((chr(97+d.index(0)) if 0 in d else"None")) | 10 | 4 | 188 | 96 | a = [True] * 26
s = eval(input())
for i in range(len(s)):
a[ord(s[i]) - ord("a")] = False
for i in range(26):
if a[i]:
print((chr(ord("a") + i)))
break
else:
print("None")
| d = [0] * 26
for i in eval(input()):
d[ord(i) - 97] += 1
print((chr(97 + d.index(0)) if 0 in d else "None"))
| false | 60 | [
"-a = [True] * 26",
"-s = eval(input())",
"-for i in range(len(s)):",
"- a[ord(s[i]) - ord(\"a\")] = False",
"-for i in range(26):",
"- if a[i]:",
"- print((chr(ord(\"a\") + i)))",
"- break",
"-else:",
"- print(\"None\")",
"+d = [0] * 26",
"+for i in eval(input()):",
"... | false | 0.116112 | 0.0455 | 2.551897 | [
"s845372120",
"s997244128"
] |
u863370423 | p03563 | python | s999717412 | s968447379 | 17 | 10 | 2,940 | 2,568 | Accepted | Accepted | 41.18 | r=int(eval(input()))
g=int(eval(input()))
print((2*g - r))
| r=float(input())
g=float(input())
if int(g*2-r)==float(g*2-r):
print(int(g*2-r))
else:
print(g*2-r) | 4 | 7 | 57 | 114 | r = int(eval(input()))
g = int(eval(input()))
print((2 * g - r))
| r = float(input())
g = float(input())
if int(g * 2 - r) == float(g * 2 - r):
print(int(g * 2 - r))
else:
print(g * 2 - r)
| false | 42.857143 | [
"-r = int(eval(input()))",
"-g = int(eval(input()))",
"-print((2 * g - r))",
"+r = float(input())",
"+g = float(input())",
"+if int(g * 2 - r) == float(g * 2 - r):",
"+ print(int(g * 2 - r))",
"+else:",
"+ print(g * 2 - r)"
] | false | 0.087884 | 0.057258 | 1.534874 | [
"s999717412",
"s968447379"
] |
u207241407 | p03142 | python | s141216648 | s560318544 | 413 | 329 | 35,440 | 21,564 | Accepted | Accepted | 20.34 | import sys
from collections import defaultdict, deque
def main():
n, m = list(map(int, sys.stdin.readline().split()))
out_list = defaultdict(list)
in_cnt = defaultdict(int)
for _ in range(n - 1 + m):
a, b = list(map(int, sys.stdin.readline().split()))
out_list[a].append(b)
... | import sys
from collections import deque
def main():
n, m = list(map(int, sys.stdin.readline().split()))
out_list = [[] for _ in range(n + 1)]
in_cnt = [0] * (n + 1)
in_cnt[0] = -1
for _ in range(n - 1 + m):
a, b = list(map(int, sys.stdin.readline().split()))
out_list[... | 30 | 32 | 718 | 726 | import sys
from collections import defaultdict, deque
def main():
n, m = list(map(int, sys.stdin.readline().split()))
out_list = defaultdict(list)
in_cnt = defaultdict(int)
for _ in range(n - 1 + m):
a, b = list(map(int, sys.stdin.readline().split()))
out_list[a].append(b)
in_c... | import sys
from collections import deque
def main():
n, m = list(map(int, sys.stdin.readline().split()))
out_list = [[] for _ in range(n + 1)]
in_cnt = [0] * (n + 1)
in_cnt[0] = -1
for _ in range(n - 1 + m):
a, b = list(map(int, sys.stdin.readline().split()))
out_list[a].append(b)
... | false | 6.25 | [
"-from collections import defaultdict, deque",
"+from collections import deque",
"- out_list = defaultdict(list)",
"- in_cnt = defaultdict(int)",
"+ out_list = [[] for _ in range(n + 1)]",
"+ in_cnt = [0] * (n + 1)",
"+ in_cnt[0] = -1",
"+ root = in_cnt.index(0)",
"- que = deque... | false | 0.045222 | 0.03641 | 1.242014 | [
"s141216648",
"s560318544"
] |
u335406314 | p02719 | python | s493725339 | s652442357 | 28 | 24 | 9,108 | 9,084 | Accepted | Accepted | 14.29 | N,K=list(map(int,input(' ').split(' ')))
print((min(N%K,(-N)%K))) | N,K=list(map(int,input().split()))
print((min(N%K,-N%K))) | 2 | 2 | 64 | 50 | N, K = list(map(int, input(" ").split(" ")))
print((min(N % K, (-N) % K)))
| N, K = list(map(int, input().split()))
print((min(N % K, -N % K)))
| false | 0 | [
"-N, K = list(map(int, input(\" \").split(\" \")))",
"-print((min(N % K, (-N) % K)))",
"+N, K = list(map(int, input().split()))",
"+print((min(N % K, -N % K)))"
] | false | 0.121426 | 0.007813 | 15.541297 | [
"s493725339",
"s652442357"
] |
u256678932 | p02418 | python | s102754077 | s156224570 | 30 | 20 | 7,432 | 5,556 | Accepted | Accepted | 33.33 | s = eval(input())
p = eval(input())
if p in s+s:
print('Yes')
else:
print('No') | def main():
s = eval(input())
p = eval(input())
if p in s*2:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
| 7 | 12 | 82 | 164 | s = eval(input())
p = eval(input())
if p in s + s:
print("Yes")
else:
print("No")
| def main():
s = eval(input())
p = eval(input())
if p in s * 2:
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| false | 41.666667 | [
"-s = eval(input())",
"-p = eval(input())",
"-if p in s + s:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+def main():",
"+ s = eval(input())",
"+ p = eval(input())",
"+ if p in s * 2:",
"+ print(\"Yes\")",
"+ else:",
"+ print(\"No\")",
"+",
"+",
... | false | 0.035146 | 0.037694 | 0.932406 | [
"s102754077",
"s156224570"
] |
u506858457 | p02630 | python | s985790780 | s404664754 | 559 | 300 | 23,852 | 97,932 | Accepted | Accepted | 46.33 | N=int(eval(input()))
A=list(map(int,input().split()))
TMP=sum(A)
Q=int(eval(input()))
import collections
List=collections.Counter(A)
for i in range(Q):
S,T=list(map(int,input().split()))
TMP=TMP+(T-S)*List[S]
print(TMP)
List[T]+=List[S]
List[S]=0 | def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
N=II()
A=LI()
Sum=sum(A)
Q=II()
cnt={}
queries=[]
for i in range(Q):
b,c=MI()
queries.append((b,c))
for a in A:
if a not in cnt:
cnt[a]=0
cnt[a]+=1
#print(cnt... | 12 | 27 | 253 | 478 | N = int(eval(input()))
A = list(map(int, input().split()))
TMP = sum(A)
Q = int(eval(input()))
import collections
List = collections.Counter(A)
for i in range(Q):
S, T = list(map(int, input().split()))
TMP = TMP + (T - S) * List[S]
print(TMP)
List[T] += List[S]
List[S] = 0
| def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
N = II()
A = LI()
Sum = sum(A)
Q = II()
cnt = {}
queries = []
for i in range(Q):
b, c = MI()
queries.append((b, c))
for a in A:
if a not in cnt:
cnt... | false | 55.555556 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-TMP = sum(A)",
"-Q = int(eval(input()))",
"-import collections",
"+def II():",
"+ return int(eval(input()))",
"-List = collections.Counter(A)",
"+",
"+def MI():",
"+ return list(map(int, input().split()))",
"+",
"+",
... | false | 0.035772 | 0.120976 | 0.295692 | [
"s985790780",
"s404664754"
] |
u729133443 | p02579 | python | s007695417 | s847412166 | 817 | 751 | 185,496 | 227,276 | Accepted | Accepted | 8.08 | from collections import*
I=9**9
(h,w),(s,t),(f,g)=eval('map(int,input().split()),'*3)
m,d=list(zip(*eval('(input(),[I]*w),'*h)))
q=deque([(s-1,t-1,1)])
while q:
y,x,c=q.popleft()
if d[y][x]>c:
d[y][x]=c
for i in range(y-2,y+3):
for j in range(x-2,x+3):h>i>-1<j<w<I==d[i][j]!=m[i][j]>'#'!=(abs(y-i)+abs... | from collections import*
I=9**9
(h,w),(s,t),(f,g)=eval('map(int,input().split()),'*3)
m,d=list(zip(*eval('(input(),[I]*w),'*h)))
q=deque([(s-1,t-1,1)])
while q:
y,x,c=q.popleft()
if d[y][x]>c:
d[y][x]=c
for i in range(y-2,y+3):
for j in range(x-2,x+3):h>i>-1<j<w<d[i][j]!=m[i][j]>'#'!=(abs(y-i)+abs(x-... | 12 | 12 | 391 | 388 | from collections import *
I = 9**9
(h, w), (s, t), (f, g) = eval("map(int,input().split())," * 3)
m, d = list(zip(*eval("(input(),[I]*w)," * h)))
q = deque([(s - 1, t - 1, 1)])
while q:
y, x, c = q.popleft()
if d[y][x] > c:
d[y][x] = c
for i in range(y - 2, y + 3):
for j in range(x ... | from collections import *
I = 9**9
(h, w), (s, t), (f, g) = eval("map(int,input().split())," * 3)
m, d = list(zip(*eval("(input(),[I]*w)," * h)))
q = deque([(s - 1, t - 1, 1)])
while q:
y, x, c = q.popleft()
if d[y][x] > c:
d[y][x] = c
for i in range(y - 2, y + 3):
for j in range(x ... | false | 0 | [
"- h > i > -1 < j < w < I == d[i][j] != m[i][j] > \"#\" != (",
"+ h > i > -1 < j < w < d[i][j] != m[i][j] > \"#\" != ("
] | false | 0.043601 | 0.007619 | 5.722448 | [
"s007695417",
"s847412166"
] |
u588341295 | p03944 | python | s959213139 | s094564173 | 82 | 18 | 3,188 | 3,064 | Accepted | Accepted | 78.05 | # -*- coding: utf-8 -*-
W, H, N = list(map(int, input().split()))
HW = [[0 for i in range(W)] for j in range(H)]
aN = [list(map(int, input().split())) for i in range (N)]
for i in range(N):
if aN[i][2] == 1:
for j in range(H):
for k in range(aN[i][0]):
HW[j][k] = ... | # -*- coding: utf-8 -*-
W, H, N = list(map(int, input().split()))
aN = [list(map(int, input().split())) for i in range (N)]
# 1マスずつ塗りつぶさないパターン(こっちのが速い)
minXY = [0, 0]
maxXY = [W, H]
for i in range(N):
if aN[i][2] == 1:
minXY[0] = max(minXY[0], aN[i][0])
elif aN[i][2] == 2:
... | 33 | 31 | 763 | 650 | # -*- coding: utf-8 -*-
W, H, N = list(map(int, input().split()))
HW = [[0 for i in range(W)] for j in range(H)]
aN = [list(map(int, input().split())) for i in range(N)]
for i in range(N):
if aN[i][2] == 1:
for j in range(H):
for k in range(aN[i][0]):
HW[j][k] = 1
elif aN[i][... | # -*- coding: utf-8 -*-
W, H, N = list(map(int, input().split()))
aN = [list(map(int, input().split())) for i in range(N)]
# 1マスずつ塗りつぶさないパターン(こっちのが速い)
minXY = [0, 0]
maxXY = [W, H]
for i in range(N):
if aN[i][2] == 1:
minXY[0] = max(minXY[0], aN[i][0])
elif aN[i][2] == 2:
maxXY[0] = min(maxXY[0]... | false | 6.060606 | [
"-HW = [[0 for i in range(W)] for j in range(H)]",
"+# 1マスずつ塗りつぶさないパターン(こっちのが速い)",
"+minXY = [0, 0]",
"+maxXY = [W, H]",
"- for j in range(H):",
"- for k in range(aN[i][0]):",
"- HW[j][k] = 1",
"+ minXY[0] = max(minXY[0], aN[i][0])",
"- for j in range(H... | false | 0.007162 | 0.061108 | 0.117199 | [
"s959213139",
"s094564173"
] |
u232852711 | p03946 | python | s454922642 | s621862686 | 207 | 135 | 17,244 | 14,224 | Accepted | Accepted | 34.78 | n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
remain_max = [a[-1]]*n
for i in range(1, n):
remain_max[-(i+1)] = max(a[-i], remain_max[-i])
diffs1 = [0]*n
for i in range(n):
diffs1[i] = remain_max[i] - a[i]
max_diff1 = 0
ans1 = 0
for i in range(n):
if diffs1[i] >... | n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
remain_max = [a[-1]]*n
for i in range(1, n):
remain_max[-(i+1)] = max(a[-i], remain_max[-i])
diffs = [0]*n
for i in range(n):
diffs[i] = remain_max[i] - a[i]
max_diff = 0
ans = 0
for i in range(n):
if diffs[i] > max_... | 41 | 21 | 870 | 435 | n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
remain_max = [a[-1]] * n
for i in range(1, n):
remain_max[-(i + 1)] = max(a[-i], remain_max[-i])
diffs1 = [0] * n
for i in range(n):
diffs1[i] = remain_max[i] - a[i]
max_diff1 = 0
ans1 = 0
for i in range(n):
if diffs1[i] > max_diff1:... | n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
remain_max = [a[-1]] * n
for i in range(1, n):
remain_max[-(i + 1)] = max(a[-i], remain_max[-i])
diffs = [0] * n
for i in range(n):
diffs[i] = remain_max[i] - a[i]
max_diff = 0
ans = 0
for i in range(n):
if diffs[i] > max_diff:
... | false | 48.780488 | [
"-diffs1 = [0] * n",
"+diffs = [0] * n",
"- diffs1[i] = remain_max[i] - a[i]",
"-max_diff1 = 0",
"-ans1 = 0",
"+ diffs[i] = remain_max[i] - a[i]",
"+max_diff = 0",
"+ans = 0",
"- if diffs1[i] > max_diff1:",
"- max_diff1 = diffs1[i]",
"- ans1 = 1",
"- elif diffs1[i] ==... | false | 0.040027 | 0.106031 | 0.377505 | [
"s454922642",
"s621862686"
] |
u232652798 | p02640 | python | s400989374 | s071821942 | 30 | 26 | 9,084 | 9,172 | Accepted | Accepted | 13.33 | x, y = [int(x) for x in input().split()]
for i in range(x+1):
ans = 'No'
b = x - i
if (i*2 + b*4) == y:
ans = 'Yes'
break
print(ans) | X, Y = [int(x) for x in input().split()]
check = True
if X*4 < Y:
check = False
elif Y < 2*X:
check = False
elif Y%2==1:
check = False
if check:
print('Yes')
else:
print('No') | 10 | 13 | 171 | 208 | x, y = [int(x) for x in input().split()]
for i in range(x + 1):
ans = "No"
b = x - i
if (i * 2 + b * 4) == y:
ans = "Yes"
break
print(ans)
| X, Y = [int(x) for x in input().split()]
check = True
if X * 4 < Y:
check = False
elif Y < 2 * X:
check = False
elif Y % 2 == 1:
check = False
if check:
print("Yes")
else:
print("No")
| false | 23.076923 | [
"-x, y = [int(x) for x in input().split()]",
"-for i in range(x + 1):",
"- ans = \"No\"",
"- b = x - i",
"- if (i * 2 + b * 4) == y:",
"- ans = \"Yes\"",
"- break",
"-print(ans)",
"+X, Y = [int(x) for x in input().split()]",
"+check = True",
"+if X * 4 < Y:",
"+ check... | false | 0.044764 | 0.035945 | 1.245352 | [
"s400989374",
"s071821942"
] |
u133347536 | p03107 | python | s356526786 | s472297180 | 59 | 47 | 4,652 | 4,652 | Accepted | Accepted | 20.34 | #python 3.7.1
s = list(eval(input()))
s = [int(i) for i in s]
n = 0
r = 0
b = 0
for i in s:
if s[n] == 0:
r += 1
elif s[n] == 1:
b += 1
n += 1
print((min(r,b) * 2)) | s = list(eval(input()))
s = [int(i) for i in s]
count_one = 0
count_zero = 0
for i in s:
if i == 0:
count_zero += 1
else:
count_one += 1
print((min(count_one, count_zero) * 2))
| 13 | 10 | 175 | 202 | # python 3.7.1
s = list(eval(input()))
s = [int(i) for i in s]
n = 0
r = 0
b = 0
for i in s:
if s[n] == 0:
r += 1
elif s[n] == 1:
b += 1
n += 1
print((min(r, b) * 2))
| s = list(eval(input()))
s = [int(i) for i in s]
count_one = 0
count_zero = 0
for i in s:
if i == 0:
count_zero += 1
else:
count_one += 1
print((min(count_one, count_zero) * 2))
| false | 23.076923 | [
"-# python 3.7.1",
"-n = 0",
"-r = 0",
"-b = 0",
"+count_one = 0",
"+count_zero = 0",
"- if s[n] == 0:",
"- r += 1",
"- elif s[n] == 1:",
"- b += 1",
"- n += 1",
"-print((min(r, b) * 2))",
"+ if i == 0:",
"+ count_zero += 1",
"+ else:",
"+ cou... | false | 0.046837 | 0.046094 | 1.01613 | [
"s356526786",
"s472297180"
] |
u141610915 | p03061 | python | s448647165 | s740213383 | 711 | 344 | 87,776 | 85,228 | Accepted | Accepted | 51.62 | import sys
from fractions import gcd
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
class SegTree:
def segfunc(self, x, y):
return gcd(x, y) #ここ判定関数(ただし結合則があるもの)
def __init__(self, n, ide_ele, init_val):
#####単位元######
self.ide_ele = ide_ele
#num:n以上... | import sys
from fractions import gcd
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
l = [0] * (N + 1)
r = [0] * (N + 1)
for i in range(N): l[i + 1] = gcd(l[i], a[i])
a.reverse()
for i in range(N): r[i + 1] = gcd(r[i], a[i])
res = 0
for i in range(N + 1): res = max(res, ... | 51 | 13 | 1,511 | 351 | import sys
from fractions import gcd
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
class SegTree:
def segfunc(self, x, y):
return gcd(x, y) # ここ判定関数(ただし結合則があるもの)
def __init__(self, n, ide_ele, init_val):
#####単位元######
self.ide_ele = ide_ele
... | import sys
from fractions import gcd
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
l = [0] * (N + 1)
r = [0] * (N + 1)
for i in range(N):
l[i + 1] = gcd(l[i], a[i])
a.reverse()
for i in range(N):
r[i + 1] = gcd(r[i], a[i])
res = 0
for i in range(N + 1):
res = max(res... | false | 74.509804 | [
"-",
"-",
"-class SegTree:",
"- def segfunc(self, x, y):",
"- return gcd(x, y) # ここ判定関数(ただし結合則があるもの)",
"-",
"- def __init__(self, n, ide_ele, init_val):",
"- #####単位元######",
"- self.ide_ele = ide_ele",
"- # num:n以上の最小の2のべき乗",
"- self.num = 2 ** (n - 1).... | false | 0.0595 | 0.04981 | 1.194537 | [
"s448647165",
"s740213383"
] |
u390901183 | p03160 | python | s235272182 | s087870987 | 143 | 129 | 13,780 | 13,980 | Accepted | Accepted | 9.79 | N = int(eval(input()))
h = [i for i in map(int, input().split())]
"""
dp値を書き込んでいく。
dp値はこの場合、その足場にたどり着くまでの最小コストのことである。
"""
dp = [0] * N
# 0番目でのコストは0なので dp[0] = 0
# 1番目でのコストは0番目から1つ飛ぶ場合の一通り。0と1番目の高さの差を代入
dp[1] = abs(h[0] - h[1])
# 2番目以降は、1つ前と2つ前から飛ぶ場合があるのでイテレーションする
for i in range(2, N):
dp[i] = ... | N = int(eval(input()))
h = list(map(int, input().split()))
"""
dp[i]: カエルが足場 i にたどり着くまでの最小コスト
i の一つ前は、 i-1 or i-2 にいる. dp[0] = 0.
"""
dp = [0] * N
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]))
print((dp[N - 1]))... | 18 | 14 | 434 | 313 | N = int(eval(input()))
h = [i for i in map(int, input().split())]
"""
dp値を書き込んでいく。
dp値はこの場合、その足場にたどり着くまでの最小コストのことである。
"""
dp = [0] * N
# 0番目でのコストは0なので dp[0] = 0
# 1番目でのコストは0番目から1つ飛ぶ場合の一通り。0と1番目の高さの差を代入
dp[1] = abs(h[0] - h[1])
# 2番目以降は、1つ前と2つ前から飛ぶ場合があるのでイテレーションする
for i in range(2, N):
dp[i] = min(
d... | N = int(eval(input()))
h = list(map(int, input().split()))
"""
dp[i]: カエルが足場 i にたどり着くまでの最小コスト
i の一つ前は、 i-1 or i-2 にいる. dp[0] = 0.
"""
dp = [0] * N
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]))
print((dp[N - 1]))
| false | 22.222222 | [
"-h = [i for i in map(int, input().split())]",
"+h = list(map(int, input().split()))",
"- dp値を書き込んでいく。",
"- dp値はこの場合、その足場にたどり着くまでの最小コストのことである。",
"+ dp[i]: カエルが足場 i にたどり着くまでの最小コスト",
"+ i の一つ前は、 i-1 or i-2 にいる. dp[0] = 0.",
"-# 0番目でのコストは0なので dp[0] = 0",
"-# 1番目でのコストは0番目から1つ飛ぶ場合の一通り。0と1番目の高さの... | false | 0.038531 | 0.03885 | 0.991801 | [
"s235272182",
"s087870987"
] |
u811169796 | p03295 | python | s518193810 | s953662396 | 457 | 404 | 16,976 | 18,964 | Accepted | Accepted | 11.6 | n,m = list(map(int,input().split()))
data = []
for i in range(m):
a,b = list(map(int,input().split()))
a -= 1
b -= 1
data.append((b,a))
data.sort()
cnt = 0
dis = -1
for i in range(m):
b,a = data[i]
if(dis < a):
cnt += 1
dis = b - 1
print(cnt) | n,m = list(map(int,input().split()))
data = []
for i in range(m):
a,b = list(map(int,input().split()))
a -= 1
b -= 1
data.append((a,b))
data = sorted(data,key=lambda x:x[1])
cnt = 0
dis = -1
for i in range(m):
a,b = data[i]
if(dis < a):
cnt += 1
dis = b - 1
print(c... | 16 | 16 | 285 | 311 | n, m = list(map(int, input().split()))
data = []
for i in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
data.append((b, a))
data.sort()
cnt = 0
dis = -1
for i in range(m):
b, a = data[i]
if dis < a:
cnt += 1
dis = b - 1
print(cnt)
| n, m = list(map(int, input().split()))
data = []
for i in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
data.append((a, b))
data = sorted(data, key=lambda x: x[1])
cnt = 0
dis = -1
for i in range(m):
a, b = data[i]
if dis < a:
cnt += 1
dis = b - 1
print(cnt)
| false | 0 | [
"- data.append((b, a))",
"-data.sort()",
"+ data.append((a, b))",
"+data = sorted(data, key=lambda x: x[1])",
"- b, a = data[i]",
"+ a, b = data[i]"
] | false | 0.041844 | 0.043568 | 0.960433 | [
"s518193810",
"s953662396"
] |
u007270338 | p02267 | python | s851469458 | s363355733 | 60 | 50 | 6,320 | 6,552 | Accepted | Accepted | 16.67 | #coding:utf-8
n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
cnt = 0
for t in T:
for s in S:
if t == s:
cnt += 1
break
print(cnt)
| #coding:utf-8
n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
def search_banpei(array, target, cnt):
tmp = array[len(array)-1]
array[len(array)-1] = target
n = 0
while array[n] != target:
n += 1
array[len(... | 15 | 37 | 242 | 736 | # coding:utf-8
n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
cnt = 0
for t in T:
for s in S:
if t == s:
cnt += 1
break
print(cnt)
| # coding:utf-8
n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
def search_banpei(array, target, cnt):
tmp = array[len(array) - 1]
array[len(array) - 1] = target
n = 0
while array[n] != target:
n += 1
array[len(array) - 1... | false | 59.459459 | [
"-cnt = 0",
"-for t in T:",
"- for s in S:",
"- if t == s:",
"- cnt += 1",
"- break",
"+",
"+",
"+def search_banpei(array, target, cnt):",
"+ tmp = array[len(array) - 1]",
"+ array[len(array) - 1] = target",
"+ n = 0",
"+ while array[n] != target:"... | false | 0.041664 | 0.044986 | 0.926146 | [
"s851469458",
"s363355733"
] |
u533039576 | p03108 | python | s873845826 | s440461680 | 1,038 | 847 | 46,344 | 33,424 | Accepted | Accepted | 18.4 | import sys
sys.setrecursionlimit(100000)
class UnionFind():
def __init__(self, n):
self.par = [i for i in range(n)]
self.size = [1 for _ in range(n)]
def find(self, x):
if self.par[x] != x:
self.par[x] = self.find(self.par[x]) # contraction
return self.... | class UnionFind():
def __init__(self, n):
self.par = [-1 for i in range(n)]
def root(self, x):
if self.par[x] < 0:
return x
else:
self.par[x] = self.root(self.par[x]) # contraction
return self.par[x]
def unite(self, x, y):
x =... | 44 | 48 | 1,089 | 1,181 | import sys
sys.setrecursionlimit(100000)
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n)]
self.size = [1 for _ in range(n)]
def find(self, x):
if self.par[x] != x:
self.par[x] = self.find(self.par[x]) # contraction
return self.par[x]
... | class UnionFind:
def __init__(self, n):
self.par = [-1 for i in range(n)]
def root(self, x):
if self.par[x] < 0:
return x
else:
self.par[x] = self.root(self.par[x]) # contraction
return self.par[x]
def unite(self, x, y):
x = self.root(x)... | false | 8.333333 | [
"-import sys",
"-",
"-sys.setrecursionlimit(100000)",
"-",
"-",
"- self.par = [i for i in range(n)]",
"- self.size = [1 for _ in range(n)]",
"+ self.par = [-1 for i in range(n)]",
"- def find(self, x):",
"- if self.par[x] != x:",
"- self.par[x] = self.fi... | false | 0.03976 | 0.045444 | 0.874915 | [
"s873845826",
"s440461680"
] |
u826263061 | p03160 | python | s206853975 | s933254252 | 138 | 124 | 13,928 | 14,696 | Accepted | Accepted | 10.14 | n = int(eval(input()))
a = list(map(int, input().split()))
dp = [10**9+1]*n
dp[0] = 0
dp[1] = dp[0] + abs(a[1]-a[0])
for i in range(2, n):
dp[i] = min([dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2])])
print((dp[n-1])) | n = int(eval(input()))
dp = [0]*(n+1)
a = list(map(int, input().split()))
dp[1] = abs(a[1]-a[0])
for i in range(2,n):
dp[i] = min(dp[i-2]+abs(a[i]-a[i-2]), dp[i-1]+abs(a[i]-a[i-1]))
print((dp[n-1])) | 11 | 8 | 230 | 203 | n = int(eval(input()))
a = list(map(int, input().split()))
dp = [10**9 + 1] * n
dp[0] = 0
dp[1] = dp[0] + abs(a[1] - a[0])
for i in range(2, n):
dp[i] = min([dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2])])
print((dp[n - 1]))
| n = int(eval(input()))
dp = [0] * (n + 1)
a = list(map(int, input().split()))
dp[1] = abs(a[1] - a[0])
for i in range(2, n):
dp[i] = min(dp[i - 2] + abs(a[i] - a[i - 2]), dp[i - 1] + abs(a[i] - a[i - 1]))
print((dp[n - 1]))
| false | 27.272727 | [
"+dp = [0] * (n + 1)",
"-dp = [10**9 + 1] * n",
"-dp[0] = 0",
"-dp[1] = dp[0] + abs(a[1] - a[0])",
"+dp[1] = abs(a[1] - a[0])",
"- dp[i] = min([dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2])])",
"+ dp[i] = min(dp[i - 2] + abs(a[i] - a[i - 2]), dp[i - 1] + abs(a[i] - a[i - 1]))"... | false | 0.094306 | 0.077664 | 1.214282 | [
"s206853975",
"s933254252"
] |
u982591663 | p02899 | python | s250030381 | s807878208 | 225 | 182 | 25,504 | 25,916 | Accepted | Accepted | 19.11 | #ABC-142-C
N = int(input())
A = list(map(int, input().split()))
ans_dict = {}
for idx, item in enumerate(A):
ans_dict[item] = idx+1
sorted_dict = sorted(ans_dict.items(), key = lambda x:x[0])
for i in sorted_dict:
print(i[1], end = " ")
| N = int(eval(input()))
A = list(map(int, input().split()))
memo = {}
for i in range(1, N+1):
memo[i] = A[i-1]
memo = sorted(list(memo.items()), key=lambda x:x[1])
# print(memo)
ans = []
for student, order in memo:
ans.append(str(student))
print((" ".join(ans)))
| 12 | 15 | 262 | 274 | # ABC-142-C
N = int(input())
A = list(map(int, input().split()))
ans_dict = {}
for idx, item in enumerate(A):
ans_dict[item] = idx + 1
sorted_dict = sorted(ans_dict.items(), key=lambda x: x[0])
for i in sorted_dict:
print(i[1], end=" ")
| N = int(eval(input()))
A = list(map(int, input().split()))
memo = {}
for i in range(1, N + 1):
memo[i] = A[i - 1]
memo = sorted(list(memo.items()), key=lambda x: x[1])
# print(memo)
ans = []
for student, order in memo:
ans.append(str(student))
print((" ".join(ans)))
| false | 20 | [
"-# ABC-142-C",
"-N = int(input())",
"+N = int(eval(input()))",
"-ans_dict = {}",
"-for idx, item in enumerate(A):",
"- ans_dict[item] = idx + 1",
"-sorted_dict = sorted(ans_dict.items(), key=lambda x: x[0])",
"-for i in sorted_dict:",
"- print(i[1], end=\" \")",
"+memo = {}",
"+for i in r... | false | 0.036943 | 0.068857 | 0.53651 | [
"s250030381",
"s807878208"
] |
u844646164 | p03457 | python | s610827441 | s751611496 | 370 | 242 | 27,300 | 85,404 | Accepted | Accepted | 34.59 | N = int(eval(input()))
L = [list(map(int, input().split())) for _ in range(N)]
switch = 0
for li in L:
t = li[0]
co = li[1]+li[2]
if t >= co:
if co % 2 == 0 and t % 2 == 0:
pass
elif co % 2 != 0 and t % 2 != 0:
pass
else:
switch += 1
... | N = int(eval(input()))
txy = [list(map(int, input().split())) for _ in range(N)]
now_x, now_y = 0, 0
pre_t = 0
for t, x, y in txy:
walk = abs(now_x - x) + abs(now_y - y)
if t - pre_t < walk:
print('No')
exit()
if (t-pre_t) % 2 != walk % 2:
print('No')
exit()
... | 21 | 19 | 437 | 372 | N = int(eval(input()))
L = [list(map(int, input().split())) for _ in range(N)]
switch = 0
for li in L:
t = li[0]
co = li[1] + li[2]
if t >= co:
if co % 2 == 0 and t % 2 == 0:
pass
elif co % 2 != 0 and t % 2 != 0:
pass
else:
switch += 1
... | N = int(eval(input()))
txy = [list(map(int, input().split())) for _ in range(N)]
now_x, now_y = 0, 0
pre_t = 0
for t, x, y in txy:
walk = abs(now_x - x) + abs(now_y - y)
if t - pre_t < walk:
print("No")
exit()
if (t - pre_t) % 2 != walk % 2:
print("No")
exit()
now_x = x
... | false | 9.52381 | [
"-L = [list(map(int, input().split())) for _ in range(N)]",
"-switch = 0",
"-for li in L:",
"- t = li[0]",
"- co = li[1] + li[2]",
"- if t >= co:",
"- if co % 2 == 0 and t % 2 == 0:",
"- pass",
"- elif co % 2 != 0 and t % 2 != 0:",
"- pass",
"- ... | false | 0.045529 | 0.036629 | 1.242954 | [
"s610827441",
"s751611496"
] |
u729133443 | p03998 | python | s530334593 | s068264626 | 183 | 18 | 38,256 | 2,940 | Accepted | Accepted | 90.16 | s=[list(eval(input()))for _ in[0]*3];i=0
while s[i]:i='abc'.index(s[i].pop(0))
print(('ABC'[i])) | d={i:list(eval(input()))for i in'abc'};i='a'
while d[i]:i=d[i].pop(0)
print((i.upper())) | 3 | 3 | 90 | 82 | s = [list(eval(input())) for _ in [0] * 3]
i = 0
while s[i]:
i = "abc".index(s[i].pop(0))
print(("ABC"[i]))
| d = {i: list(eval(input())) for i in "abc"}
i = "a"
while d[i]:
i = d[i].pop(0)
print((i.upper()))
| false | 0 | [
"-s = [list(eval(input())) for _ in [0] * 3]",
"-i = 0",
"-while s[i]:",
"- i = \"abc\".index(s[i].pop(0))",
"-print((\"ABC\"[i]))",
"+d = {i: list(eval(input())) for i in \"abc\"}",
"+i = \"a\"",
"+while d[i]:",
"+ i = d[i].pop(0)",
"+print((i.upper()))"
] | false | 0.03973 | 0.039409 | 1.00816 | [
"s530334593",
"s068264626"
] |
u906501980 | p02762 | python | s461553892 | s560356237 | 1,157 | 1,057 | 74,776 | 41,320 | Accepted | Accepted | 8.64 | import sys
input = sys.stdin.buffer.readline
class UnionFind:
__slots__ = ["data"]
def __init__(self, n=0):
self.data = [-1]*(n+1)
def root(self, x):
if self.data[x] < 0:
return x
self.data[x] = self.root(self.data[x])
return self.data[x]
... | import sys
input = sys.stdin.buffer.readline
class UnionFind:
__slots__ = ["data"]
def __init__(self, n=0):
self.data = [-1]*(n+1)
def root(self, x):
if self.data[x] < 0:
return x
self.data[x] = self.root(self.data[x])
return self.data[x]
... | 57 | 57 | 1,460 | 1,466 | import sys
input = sys.stdin.buffer.readline
class UnionFind:
__slots__ = ["data"]
def __init__(self, n=0):
self.data = [-1] * (n + 1)
def root(self, x):
if self.data[x] < 0:
return x
self.data[x] = self.root(self.data[x])
return self.data[x]
def unite(s... | import sys
input = sys.stdin.buffer.readline
class UnionFind:
__slots__ = ["data"]
def __init__(self, n=0):
self.data = [-1] * (n + 1)
def root(self, x):
if self.data[x] < 0:
return x
self.data[x] = self.root(self.data[x])
return self.data[x]
def unite(s... | false | 0 | [
"- friends = [set() for _ in range(n + 1)]",
"- blocks = [set() for _ in range(n + 1)]",
"+ friends = [[] for _ in range(n + 1)]",
"+ blocks = [[] for _ in range(n + 1)]",
"- friends[a] |= {b}",
"- friends[b] |= {a}",
"+ friends[a].append(b)",
"+ friends[b].appe... | false | 0.042236 | 0.042389 | 0.996386 | [
"s461553892",
"s560356237"
] |
u947883560 | p03061 | python | s972400923 | s284746193 | 923 | 178 | 16,432 | 17,968 | Accepted | Accepted | 80.72 | #!/usr/bin/env python3
import sys
import math
from collections import Counter
import collections
INF = float("inf")
def factorial(n):
# 試し割りによる素因数分解
prime_count = collections.Counter()
for i in range(2, int(math.sqrt(n)) + 2):
while n % i == 0:
n /= i
prime_... | #!/usr/bin/env python3
import sys
import math
from collections import Counter
import collections
INF = float("inf")
def factorial(n):
# 試し割りによる素因数分解
prime_count = collections.Counter()
for i in range(2, int(math.sqrt(n)) + 2):
while n % i == 0:
n /= i
prime_... | 136 | 86 | 2,962 | 1,660 | #!/usr/bin/env python3
import sys
import math
from collections import Counter
import collections
INF = float("inf")
def factorial(n):
# 試し割りによる素因数分解
prime_count = collections.Counter()
for i in range(2, int(math.sqrt(n)) + 2):
while n % i == 0:
n /= i
prime_count[i] += 1
... | #!/usr/bin/env python3
import sys
import math
from collections import Counter
import collections
INF = float("inf")
def factorial(n):
# 試し割りによる素因数分解
prime_count = collections.Counter()
for i in range(2, int(math.sqrt(n)) + 2):
while n % i == 0:
n /= i
prime_count[i] += 1
... | false | 36.764706 | [
"- c1 = make_divisors(A[0])",
"- c2 = make_divisors(A[1])",
"- c = sorted(list(set(c1 + c2)))",
"- OKs = []",
"- for cv in c:",
"- if sum([1 if a % cv == 0 else 0 for a in A]) >= N - 1:",
"- OKs.append(cv)",
"- print((max(OKs)))",
"- # b = A[0]",
"- # m = ... | false | 0.050664 | 0.039618 | 1.27882 | [
"s972400923",
"s284746193"
] |
u730769327 | p03325 | python | s041535106 | s334437012 | 196 | 72 | 41,708 | 70,816 | Accepted | Accepted | 63.27 | n=int(eval(input()))
x=list(map(int,input().split()))
cnt=0
for i in x:
j=1
while(1):
if i%2:
break
elif i:
cnt+=1
i//=2
else: break
j+=1
print(cnt)
| n=int(eval(input()))
a=list(map(int,input().split()))
ans=0
for i in a:
while i%2==0:
i//=2
ans+=1
print(ans) | 16 | 8 | 197 | 120 | n = int(eval(input()))
x = list(map(int, input().split()))
cnt = 0
for i in x:
j = 1
while 1:
if i % 2:
break
elif i:
cnt += 1
i //= 2
else:
break
j += 1
print(cnt)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while i % 2 == 0:
i //= 2
ans += 1
print(ans)
| false | 50 | [
"-x = list(map(int, input().split()))",
"-cnt = 0",
"-for i in x:",
"- j = 1",
"- while 1:",
"- if i % 2:",
"- break",
"- elif i:",
"- cnt += 1",
"- i //= 2",
"- else:",
"- break",
"- j += 1",
"-print(cnt)",
"+... | false | 0.04497 | 0.037164 | 1.210067 | [
"s041535106",
"s334437012"
] |
u228223940 | p02633 | python | s960270367 | s169537314 | 31 | 25 | 9,144 | 8,936 | Accepted | Accepted | 19.35 | import math
#print(math.cos(math.radians(90)))
#exit()
x = int(eval(input()))
print((360//math.gcd(360,x))) | x = int(eval(input()))
for i in range(1000):
if x * (i+1) % 360 == 0:
print((i+1))
exit()
| 5 | 5 | 103 | 106 | import math
# print(math.cos(math.radians(90)))
# exit()
x = int(eval(input()))
print((360 // math.gcd(360, x)))
| x = int(eval(input()))
for i in range(1000):
if x * (i + 1) % 360 == 0:
print((i + 1))
exit()
| false | 0 | [
"-import math",
"-",
"-# print(math.cos(math.radians(90)))",
"-# exit()",
"-print((360 // math.gcd(360, x)))",
"+for i in range(1000):",
"+ if x * (i + 1) % 360 == 0:",
"+ print((i + 1))",
"+ exit()"
] | false | 0.105618 | 0.083622 | 1.263033 | [
"s960270367",
"s169537314"
] |
u391819434 | p03862 | python | s103755298 | s541934371 | 254 | 123 | 63,856 | 14,060 | Accepted | Accepted | 51.57 | N,X=list(map(int,input().split()))
*A,=list(map(int,input().split()))
ans=0
if A[0]>X:
ans+=A[0]-X
A[0]=X
i=0
while i+1<=N-1:
if A[i]+A[i+1]>X:
ans+=A[i]+A[i+1]-X
A[i+1]=X-A[i]
i+=1
print(ans) | N,X=list(map(int,input().split()))
*A,=list(map(int,input().split()))
ans=0
if A[0]>X:
ans+=A[0]-X
A[0]=X
i=1
while i<N:
if A[i]+A[i-1]>X:
ans+=A[i]+A[i-1]-X
A[i]=X-A[i-1]
i+=1
print(ans) | 17 | 16 | 233 | 233 | N, X = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
ans = 0
if A[0] > X:
ans += A[0] - X
A[0] = X
i = 0
while i + 1 <= N - 1:
if A[i] + A[i + 1] > X:
ans += A[i] + A[i + 1] - X
A[i + 1] = X - A[i]
i += 1
print(ans)
| N, X = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
ans = 0
if A[0] > X:
ans += A[0] - X
A[0] = X
i = 1
while i < N:
if A[i] + A[i - 1] > X:
ans += A[i] + A[i - 1] - X
A[i] = X - A[i - 1]
i += 1
print(ans)
| false | 5.882353 | [
"-i = 0",
"-while i + 1 <= N - 1:",
"- if A[i] + A[i + 1] > X:",
"- ans += A[i] + A[i + 1] - X",
"- A[i + 1] = X - A[i]",
"+i = 1",
"+while i < N:",
"+ if A[i] + A[i - 1] > X:",
"+ ans += A[i] + A[i - 1] - X",
"+ A[i] = X - A[i - 1]"
] | false | 0.084866 | 0.042814 | 1.982197 | [
"s103755298",
"s541934371"
] |
u796942881 | p03846 | python | s751945501 | s633589085 | 103 | 90 | 14,436 | 13,940 | Accepted | Accepted | 12.62 | from functools import reduce
INF = int(1e9+7)
def main():
N, *An = list(map(int, open(0).read().split()))
An.sort()
if N % 2:
if [0] + [i for i in range(2, N, 2) for j in range(2)] == An:
print((reduce(lambda x, y: (x << 1) % INF, list(range(N // 2)), 1)))
return
... | INF = int(1e9+7)
def main():
N, *An = list(map(int, open(0).read().split()))
An.sort()
if N % 2:
if [0] + [i for i in range(2, N, 2) for j in range(2)] == An:
print((2 ** (N // 2) % INF))
return
else:
if [i for i in range(1, N, 2) for j in range(2)] =... | 20 | 19 | 514 | 416 | from functools import reduce
INF = int(1e9 + 7)
def main():
N, *An = list(map(int, open(0).read().split()))
An.sort()
if N % 2:
if [0] + [i for i in range(2, N, 2) for j in range(2)] == An:
print((reduce(lambda x, y: (x << 1) % INF, list(range(N // 2)), 1)))
return
els... | INF = int(1e9 + 7)
def main():
N, *An = list(map(int, open(0).read().split()))
An.sort()
if N % 2:
if [0] + [i for i in range(2, N, 2) for j in range(2)] == An:
print((2 ** (N // 2) % INF))
return
else:
if [i for i in range(1, N, 2) for j in range(2)] == An:
... | false | 5 | [
"-from functools import reduce",
"-",
"- print((reduce(lambda x, y: (x << 1) % INF, list(range(N // 2)), 1)))",
"+ print((2 ** (N // 2) % INF))",
"- print((reduce(lambda x, y: (x << 1) % INF, list(range(N // 2)), 1)))",
"+ print((2 ** (N // 2) % INF))"
] | false | 0.064682 | 0.037406 | 1.729215 | [
"s751945501",
"s633589085"
] |
u871980676 | p02954 | python | s162844017 | s958885274 | 205 | 124 | 17,724 | 17,476 | Accepted | Accepted | 39.51 | s = eval(input())
N = len(s)
ls = [0] + [i for i in range(1,N) if (s[i-1]=='L' and s[i] == 'R')]
ls.append(N)
#print(ls)
ls2 = [(ls[i],ls[i+1]) for i in range(len(ls)-1)]
#print(ls2)
ls3 = [i for i in range(1,N) if (s[i-1]=='R' and s[i] == 'L')]
#print(ls3)
res = ['0']*N
for i,tp in enumerate(ls2):
for j... | s = eval(input())
N = len(s)
ls = [0] + [i for i in range(1,N) if (s[i-1]=='L' and s[i] == 'R')]
ls.append(N)
ls2 = [(ls[i],ls[i+1]) for i in range(len(ls)-1)]
ls3 = [i for i in range(1,N) if (s[i-1]=='R' and s[i] == 'L')]
res = ['0']*N
for i,tp in enumerate(ls2):
res[ls3[i]] = str((tp[1]-ls3[i]-1)//2+(ls3[... | 15 | 11 | 498 | 418 | s = eval(input())
N = len(s)
ls = [0] + [i for i in range(1, N) if (s[i - 1] == "L" and s[i] == "R")]
ls.append(N)
# print(ls)
ls2 = [(ls[i], ls[i + 1]) for i in range(len(ls) - 1)]
# print(ls2)
ls3 = [i for i in range(1, N) if (s[i - 1] == "R" and s[i] == "L")]
# print(ls3)
res = ["0"] * N
for i, tp in enumerate(ls2):... | s = eval(input())
N = len(s)
ls = [0] + [i for i in range(1, N) if (s[i - 1] == "L" and s[i] == "R")]
ls.append(N)
ls2 = [(ls[i], ls[i + 1]) for i in range(len(ls) - 1)]
ls3 = [i for i in range(1, N) if (s[i - 1] == "R" and s[i] == "L")]
res = ["0"] * N
for i, tp in enumerate(ls2):
res[ls3[i]] = str((tp[1] - ls3[i]... | false | 26.666667 | [
"-# print(ls)",
"-# print(ls2)",
"-# print(ls3)",
"- for j in range(tp[0], tp[1]):",
"- res[ls3[i]] = str((tp[1] - ls3[i] - 1) // 2 + (ls3[i] - tp[0]) // 2 + 1)",
"- res[ls3[i] - 1] = str((tp[1] - ls3[i]) // 2 + (ls3[i] - tp[0] - 1) // 2 + 1)",
"+ res[ls3[i]] = str((tp[1] - ls3[i] - ... | false | 0.049987 | 0.042083 | 1.18782 | [
"s162844017",
"s958885274"
] |
u624475441 | p03164 | python | s332844038 | s181563074 | 348 | 182 | 21,740 | 14,904 | Accepted | Accepted | 47.7 | import sys
import numpy as np
N, W = list(map(int, input().split()))
it = iter(map(int, sys.stdin.read().split()))
dp = np.full(N * 1000 + 1, 10 ** 10, dtype=np.int64)
dp[0] = 0
for w, v in zip(it, it):
np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
print((((dp <= W) * np.arange(N * 1000 + 1)).max())) | import sys
import numpy as np
N, W = list(map(int, input().split()))
it = iter(map(int, sys.stdin.read().split()))
dp = np.full(N * 1000 + 1, W + 1, dtype=np.int64)
dp[0] = 0
for w, v in zip(it, it):
np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
print((((dp <= W) * np.arange(N * 1000 + 1)).max())) | 9 | 9 | 303 | 300 | import sys
import numpy as np
N, W = list(map(int, input().split()))
it = iter(map(int, sys.stdin.read().split()))
dp = np.full(N * 1000 + 1, 10**10, dtype=np.int64)
dp[0] = 0
for w, v in zip(it, it):
np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
print((((dp <= W) * np.arange(N * 1000 + 1)).max()))
| import sys
import numpy as np
N, W = list(map(int, input().split()))
it = iter(map(int, sys.stdin.read().split()))
dp = np.full(N * 1000 + 1, W + 1, dtype=np.int64)
dp[0] = 0
for w, v in zip(it, it):
np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
print((((dp <= W) * np.arange(N * 1000 + 1)).max()))
| false | 0 | [
"-dp = np.full(N * 1000 + 1, 10**10, dtype=np.int64)",
"+dp = np.full(N * 1000 + 1, W + 1, dtype=np.int64)"
] | false | 0.359033 | 0.4412 | 0.813765 | [
"s332844038",
"s181563074"
] |
u343675824 | p03847 | python | s026193837 | s507045288 | 168 | 20 | 38,512 | 3,316 | Accepted | Accepted | 88.1 | N = int(eval(input()))
dp = [[0] * 3 for i in range(100)]
MOD = int(1e9+7)
maxBit = 70
while not (N >> maxBit):
maxBit -= 1
dp[maxBit][0] = 1
dp[maxBit][1] = 1
for i in range(maxBit-1, -1, -1):
for j in range(3):
bit = (N >> i) & 1
for k in range(3):
nj = 2 * j + bit ... | N = int(eval(input()))
s = bin(N)[2:]
n = len(s)
dp = [[0] * 4 for i in range(len(s)+1)]
dp[0][0] = 1
MOD = int(1e9) + 7
for i in range(n):
b = 1 if s[i] == '1' else 0
for j in range(4):
for k in range(3):
nj = min(((j << 1) + b - k, 3))
if 0 <= nj:
dp... | 22 | 15 | 493 | 397 | N = int(eval(input()))
dp = [[0] * 3 for i in range(100)]
MOD = int(1e9 + 7)
maxBit = 70
while not (N >> maxBit):
maxBit -= 1
dp[maxBit][0] = 1
dp[maxBit][1] = 1
for i in range(maxBit - 1, -1, -1):
for j in range(3):
bit = (N >> i) & 1
for k in range(3):
nj = 2 * j + bit - k
... | N = int(eval(input()))
s = bin(N)[2:]
n = len(s)
dp = [[0] * 4 for i in range(len(s) + 1)]
dp[0][0] = 1
MOD = int(1e9) + 7
for i in range(n):
b = 1 if s[i] == "1" else 0
for j in range(4):
for k in range(3):
nj = min(((j << 1) + b - k, 3))
if 0 <= nj:
dp[i + 1][nj... | false | 31.818182 | [
"-dp = [[0] * 3 for i in range(100)]",
"-MOD = int(1e9 + 7)",
"-maxBit = 70",
"-while not (N >> maxBit):",
"- maxBit -= 1",
"-dp[maxBit][0] = 1",
"-dp[maxBit][1] = 1",
"-for i in range(maxBit - 1, -1, -1):",
"- for j in range(3):",
"- bit = (N >> i) & 1",
"+s = bin(N)[2:]",
"+n = ... | false | 0.061283 | 0.038143 | 1.60668 | [
"s026193837",
"s507045288"
] |
u254871849 | p03557 | python | s730023694 | s224743338 | 362 | 325 | 36,340 | 22,720 | Accepted | Accepted | 10.22 |
import sys
# import collections
# import math
# import string
import bisect
def main():
n, *parts = (int(x) for x in sys.stdin.read().split())
uppers, middles, lowers = (parts[n*i:n*(i+1)] for i in range(3))
uppers.sort()
lowers.sort()
count = 0
for j in middles:
i = bi... | import sys
from bisect import bisect_left as bi_l, bisect_right as bi_r
n = int(sys.stdin.readline().rstrip())
*a, = list(map(int, sys.stdin.readline().split()))
*b, = list(map(int, sys.stdin.readline().split()))
*c, = list(map(int, sys.stdin.readline().split()))
def main():
a.sort()
b.sort()
c... | 23 | 23 | 500 | 516 | import sys
# import collections
# import math
# import string
import bisect
def main():
n, *parts = (int(x) for x in sys.stdin.read().split())
uppers, middles, lowers = (parts[n * i : n * (i + 1)] for i in range(3))
uppers.sort()
lowers.sort()
count = 0
for j in middles:
i = bisect.bi... | import sys
from bisect import bisect_left as bi_l, bisect_right as bi_r
n = int(sys.stdin.readline().rstrip())
(*a,) = list(map(int, sys.stdin.readline().split()))
(*b,) = list(map(int, sys.stdin.readline().split()))
(*c,) = list(map(int, sys.stdin.readline().split()))
def main():
a.sort()
b.sort()
c.sor... | false | 0 | [
"+from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-# import collections",
"-# import math",
"-# import string",
"-import bisect",
"+n = int(sys.stdin.readline().rstrip())",
"+(*a,) = list(map(int, sys.stdin.readline().split()))",
"+(*b,) = list(map(int, sys.stdin.readline().split()))",... | false | 0.126904 | 0.049606 | 2.55822 | [
"s730023694",
"s224743338"
] |
u998741086 | p02659 | python | s640101772 | s587732972 | 22 | 20 | 9,168 | 9,032 | Accepted | Accepted | 9.09 | #!/usr/bin/env python3
import math
a, b = input().split()
a = int(a)
b = int(b.replace('.', ''))
print((a*b//100))
| #!/usr/bin/env python3
a, b = input().split()
a = int(a)
b = int(float(b)*100+0.5)
print((a*b//100))
| 7 | 6 | 120 | 105 | #!/usr/bin/env python3
import math
a, b = input().split()
a = int(a)
b = int(b.replace(".", ""))
print((a * b // 100))
| #!/usr/bin/env python3
a, b = input().split()
a = int(a)
b = int(float(b) * 100 + 0.5)
print((a * b // 100))
| false | 14.285714 | [
"-import math",
"-",
"-b = int(b.replace(\".\", \"\"))",
"+b = int(float(b) * 100 + 0.5)"
] | false | 0.042069 | 0.047323 | 0.888975 | [
"s640101772",
"s587732972"
] |
u644907318 | p02796 | python | s220437154 | s525959894 | 793 | 537 | 80,984 | 43,360 | Accepted | Accepted | 32.28 | N = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(N)]
B = sorted([[A[i][0]-A[i][1],A[i][0]+A[i][1]] for i in range(N)],key=lambda x:x[1])
cur = 1
C = [B[0]]
while cur<N:
if B[cur][0]>=C[-1][1]:
C.append(B[cur])
cur += 1
print((len(C))) | N = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(N)]
B = sorted([(A[i][0]-A[i][1],A[i][0]+A[i][1]) for i in range(N)],key=lambda x:x[0],reverse=True)
B = sorted(B,key=lambda x:x[1])
cnt = 1
cur = B[0][1]
for i in range(1,N):
if B[i][0]>=cur:
cnt += 1
cur = B[i][1]
... | 10 | 11 | 276 | 324 | N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
B = sorted(
[[A[i][0] - A[i][1], A[i][0] + A[i][1]] for i in range(N)], key=lambda x: x[1]
)
cur = 1
C = [B[0]]
while cur < N:
if B[cur][0] >= C[-1][1]:
C.append(B[cur])
cur += 1
print((len(C)))
| N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
B = sorted(
[(A[i][0] - A[i][1], A[i][0] + A[i][1]) for i in range(N)],
key=lambda x: x[0],
reverse=True,
)
B = sorted(B, key=lambda x: x[1])
cnt = 1
cur = B[0][1]
for i in range(1, N):
if B[i][0] >= cur:
cnt += 1
... | false | 9.090909 | [
"- [[A[i][0] - A[i][1], A[i][0] + A[i][1]] for i in range(N)], key=lambda x: x[1]",
"+ [(A[i][0] - A[i][1], A[i][0] + A[i][1]) for i in range(N)],",
"+ key=lambda x: x[0],",
"+ reverse=True,",
"-cur = 1",
"-C = [B[0]]",
"-while cur < N:",
"- if B[cur][0] >= C[-1][1]:",
"- C.app... | false | 0.111423 | 0.044156 | 2.523413 | [
"s220437154",
"s525959894"
] |
u896741788 | p03403 | python | s014475432 | s001604152 | 265 | 207 | 13,920 | 20,620 | Accepted | Accepted | 21.89 | n=int(eval(input()))
l=[0]+list(map(int,input().split()))+[0]
ans=0
for a,s in zip(l,l[1:]):
ans+=abs(a-s)
for i in range(n):
a,s=sorted([l[i],l[i+2]])
if a<=l[i+1]<=s:print(ans)
else:
print((ans-abs(a-l[i+1])-abs(l[i+1]-s)+s-a)) | n=eval(input())
l=[0]+list(map(int,input().split()))+[0]
ans=0
pre=0
for i in l:ans+=abs(pre-i);pre=i
for i in range(1,int(n)+1):
dif=-abs(l[i]-l[i-1])-abs(l[i]-l[i+1])+abs(l[i-1]-l[i+1])
if l[i]in(l[i-1],l[i+1]):print(ans)
elif l[i]<l[i-1]:
print((ans if l[i+1]<l[i] else ans+dif))
else:print((ans... | 10 | 11 | 254 | 340 | n = int(eval(input()))
l = [0] + list(map(int, input().split())) + [0]
ans = 0
for a, s in zip(l, l[1:]):
ans += abs(a - s)
for i in range(n):
a, s = sorted([l[i], l[i + 2]])
if a <= l[i + 1] <= s:
print(ans)
else:
print((ans - abs(a - l[i + 1]) - abs(l[i + 1] - s) + s - a))
| n = eval(input())
l = [0] + list(map(int, input().split())) + [0]
ans = 0
pre = 0
for i in l:
ans += abs(pre - i)
pre = i
for i in range(1, int(n) + 1):
dif = -abs(l[i] - l[i - 1]) - abs(l[i] - l[i + 1]) + abs(l[i - 1] - l[i + 1])
if l[i] in (l[i - 1], l[i + 1]):
print(ans)
elif l[i] < l[i -... | false | 9.090909 | [
"-n = int(eval(input()))",
"+n = eval(input())",
"-for a, s in zip(l, l[1:]):",
"- ans += abs(a - s)",
"-for i in range(n):",
"- a, s = sorted([l[i], l[i + 2]])",
"- if a <= l[i + 1] <= s:",
"+pre = 0",
"+for i in l:",
"+ ans += abs(pre - i)",
"+ pre = i",
"+for i in range(1, in... | false | 0.081374 | 0.037262 | 2.183824 | [
"s014475432",
"s001604152"
] |
u655110382 | p02773 | python | s954414993 | s927839196 | 712 | 618 | 34,052 | 35,568 | Accepted | Accepted | 13.2 | N = int(input())
d = {}
mv = 0
mfw = []
for _ in range(N):
w = input()
d[w] = d.get(w, 0) + 1
if d[w] > mv:
mv += 1
mfw.clear()
mfw.append(w)
elif d[w] == mv:
mfw.append(w)
[print(w) for w in sorted(mfw)]
| from collections import Counter
N = int(input())
c = Counter([input() for _ in range(N)])
mv = max(c.values())
[print(w) for w in sorted(c.keys()) if c[w] == mv]
| 14 | 6 | 266 | 168 | N = int(input())
d = {}
mv = 0
mfw = []
for _ in range(N):
w = input()
d[w] = d.get(w, 0) + 1
if d[w] > mv:
mv += 1
mfw.clear()
mfw.append(w)
elif d[w] == mv:
mfw.append(w)
[print(w) for w in sorted(mfw)]
| from collections import Counter
N = int(input())
c = Counter([input() for _ in range(N)])
mv = max(c.values())
[print(w) for w in sorted(c.keys()) if c[w] == mv]
| false | 57.142857 | [
"+from collections import Counter",
"+",
"-d = {}",
"-mv = 0",
"-mfw = []",
"-for _ in range(N):",
"- w = input()",
"- d[w] = d.get(w, 0) + 1",
"- if d[w] > mv:",
"- mv += 1",
"- mfw.clear()",
"- mfw.append(w)",
"- elif d[w] == mv:",
"- mfw.append(w)... | false | 0.039186 | 0.03915 | 1.000911 | [
"s954414993",
"s927839196"
] |
u600402037 | p03032 | python | s080913697 | s681113066 | 90 | 35 | 3,064 | 4,884 | Accepted | Accepted | 61.11 | # coding: utf-8
import sys
sys.setrecursionlimit(10 ** 7)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 持っている宝石をDに詰めるのは最後
N, K = lr()
V = lr()
answer = 0
V = V[::-1] + V[::-1]
for x in range(K+1):
# x回Dから取り出す、K-x回戻すことが可能
x = min(x,... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
V = lr()
scores = [0]
limit = min(N, K)
for i in range(limit+1): # iは左から取り出す個数
for j in range(limit-i+1): # jは右から取り出す個数
stone = V[:i] + V[N-j:]
... | 29 | 26 | 688 | 625 | # coding: utf-8
import sys
sys.setrecursionlimit(10**7)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 持っている宝石をDに詰めるのは最後
N, K = lr()
V = lr()
answer = 0
V = V[::-1] + V[::-1]
for x in range(K + 1):
# x回Dから取り出す、K-x回戻すことが可能
x = min(x, N)
for i in... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
V = lr()
scores = [0]
limit = min(N, K)
for i in range(limit + 1): # iは左から取り出す個数
for j in range(limit - i + 1): # jは右から取り出す個数
stone = V[:i] + V[N - j :]
... | false | 10.344828 | [
"-sys.setrecursionlimit(10**7)",
"-# 持っている宝石をDに詰めるのは最後",
"-answer = 0",
"-V = V[::-1] + V[::-1]",
"-for x in range(K + 1):",
"- # x回Dから取り出す、K-x回戻すことが可能",
"- x = min(x, N)",
"- for i in range(N - 1, N - 1 + x + 1):",
"- take = V[i - x + 1 : i + 1]",
"- take.sort(reverse=True)... | false | 0.03665 | 0.006908 | 5.305419 | [
"s080913697",
"s681113066"
] |
u945181840 | p03674 | python | s913642015 | s231131364 | 361 | 318 | 31,704 | 31,708 | Accepted | Accepted | 11.91 | from collections import Counter
n, *a = list(map(int, open(0).read().split()))
n += 1
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
mod = 10 ** 9 + 7
N = n
# 元テーブル
g1 = [0] * (N + 1)
g1[0] = 1
g1[1] = 1
# 逆元テーブル
g2... | from collections import Counter
n, *a = list(map(int, open(0).read().split()))
n += 1
def cmb(n, r, mod=10 ** 9 + 7):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
def make_table(n, mod=10 ** 9 + 7):
mod = mod
N = n
# 元テーブル
... | 41 | 47 | 823 | 1,010 | from collections import Counter
n, *a = list(map(int, open(0).read().split()))
n += 1
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
mod = 10**9 + 7
N = n
# 元テーブル
g1 = [0] * (N + 1)
g1[0] = 1
g1[1] = 1
# 逆元テーブル
g2 = [0] * (N + 1)
g2[0] =... | from collections import Counter
n, *a = list(map(int, open(0).read().split()))
n += 1
def cmb(n, r, mod=10**9 + 7):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
def make_table(n, mod=10**9 + 7):
mod = mod
N = n
# 元テーブル
g1 = [0] * (N + 1)
... | false | 12.765957 | [
"-def cmb(n, r, mod):",
"+def cmb(n, r, mod=10**9 + 7):",
"-mod = 10**9 + 7",
"-N = n",
"-# 元テーブル",
"-g1 = [0] * (N + 1)",
"-g1[0] = 1",
"-g1[1] = 1",
"-# 逆元テーブル",
"-g2 = [0] * (N + 1)",
"-g2[0] = 1",
"-g2[1] = 1",
"-# 逆元テーブル計算用テーブル",
"-inverse = [0] * (N + 1)",
"-inverse[0] = 0",
"-in... | false | 0.043953 | 0.048681 | 0.90287 | [
"s913642015",
"s231131364"
] |
u847467233 | p00042 | python | s526520967 | s023745497 | 1,070 | 880 | 5,728 | 5,728 | Accepted | Accepted | 17.76 | # AOJ 0042 A Thief
# Python3 2018.6.22 bal4u
MAX = 1003
for cno in range(1, 100):
lim = int(input())
if lim == 0: break
print("Case ", cno, ":", sep='')
N = int(input())
vw = [(0, 0)]
for i in range(N):
v, w = list(map(int, input().split(',')))
vw.append((v, w))
V = [[0 for j in range(MAX)]... | # AOJ 0042 A Thief
# Python3 2018.6.22 bal4u
MAX = 1003
for cno in range(1, 100):
lim = int(input())
if lim == 0: break
print("Case ", cno, ":", sep='')
N = int(input())
V = [[0 for j in range(MAX)] for i in range(2)]
W = [[0 for j in range(MAX)] for i in range(2)]
k1, k2 = 0, 1
for i in range(... | 34 | 28 | 787 | 696 | # AOJ 0042 A Thief
# Python3 2018.6.22 bal4u
MAX = 1003
for cno in range(1, 100):
lim = int(input())
if lim == 0:
break
print("Case ", cno, ":", sep="")
N = int(input())
vw = [(0, 0)]
for i in range(N):
v, w = list(map(int, input().split(",")))
vw.append((v, w))
V = [... | # AOJ 0042 A Thief
# Python3 2018.6.22 bal4u
MAX = 1003
for cno in range(1, 100):
lim = int(input())
if lim == 0:
break
print("Case ", cno, ":", sep="")
N = int(input())
V = [[0 for j in range(MAX)] for i in range(2)]
W = [[0 for j in range(MAX)] for i in range(2)]
k1, k2 = 0, 1
... | false | 17.647059 | [
"- vw = [(0, 0)]",
"- for i in range(N):",
"- v, w = list(map(int, input().split(\",\")))",
"- vw.append((v, w))",
"- for j in range(1, lim + 1):",
"- v, w = vw[i]",
"- if w > j:",
"+ v, w = map(int, input().split(\",\"))",
"+ for j in r... | false | 0.059058 | 0.038154 | 1.547914 | [
"s526520967",
"s023745497"
] |
u014268998 | p02887 | python | s147879902 | s411422788 | 55 | 32 | 3,316 | 3,316 | Accepted | Accepted | 41.82 | n = int(eval(input()))
s = eval(input())
out = s[0]
x = s[0]
for i in range(1,n):
if s[i] == x:
continue
else:
out += s[i]
x = s[i]
print(( len(out) )) | n = int(eval(input()))
s = eval(input())
ans = 0
current = ''
for i in s:
if i != current:
ans += 1
current = i
print(ans) | 12 | 11 | 165 | 132 | n = int(eval(input()))
s = eval(input())
out = s[0]
x = s[0]
for i in range(1, n):
if s[i] == x:
continue
else:
out += s[i]
x = s[i]
print((len(out)))
| n = int(eval(input()))
s = eval(input())
ans = 0
current = ""
for i in s:
if i != current:
ans += 1
current = i
print(ans)
| false | 8.333333 | [
"-out = s[0]",
"-x = s[0]",
"-for i in range(1, n):",
"- if s[i] == x:",
"- continue",
"- else:",
"- out += s[i]",
"- x = s[i]",
"-print((len(out)))",
"+ans = 0",
"+current = \"\"",
"+for i in s:",
"+ if i != current:",
"+ ans += 1",
"+ current... | false | 0.037906 | 0.036888 | 1.027602 | [
"s147879902",
"s411422788"
] |
u878654696 | p02882 | python | s064473021 | s161144410 | 30 | 27 | 9,464 | 9,364 | Accepted | Accepted | 10 | from math import *
a, b, x = list(map(int, input().split()))
areatotal = a*a*b
if areatotal / 2 == x: print((45.0))
elif x > areatotal/2:
left = 0.0
right = 90.0
while right-left > 0.00000001:
current = (right+left)/2
if a**2 * tan(radians(current)) / 2 * a < (areatotal - x):
... | from math import atan, degrees
def angle(a, b, x):
return degrees(atan(((a * b ** 2) / ( 2 * x)) if x <= 0.5 * b * a ** 2 else ((2 * (b - (x / (a ** 2)))) / a)))
print((angle(*list(map(int, input().split()))))) | 28 | 6 | 656 | 214 | from math import *
a, b, x = list(map(int, input().split()))
areatotal = a * a * b
if areatotal / 2 == x:
print((45.0))
elif x > areatotal / 2:
left = 0.0
right = 90.0
while right - left > 0.00000001:
current = (right + left) / 2
if a**2 * tan(radians(current)) / 2 * a < (areatotal - x)... | from math import atan, degrees
def angle(a, b, x):
return degrees(
atan(
((a * b**2) / (2 * x))
if x <= 0.5 * b * a**2
else ((2 * (b - (x / (a**2)))) / a)
)
)
print((angle(*list(map(int, input().split())))))
| false | 78.571429 | [
"-from math import *",
"+from math import atan, degrees",
"-a, b, x = list(map(int, input().split()))",
"-areatotal = a * a * b",
"-if areatotal / 2 == x:",
"- print((45.0))",
"-elif x > areatotal / 2:",
"- left = 0.0",
"- right = 90.0",
"- while right - left > 0.00000001:",
"- ... | false | 0.047545 | 0.055355 | 0.858907 | [
"s064473021",
"s161144410"
] |
u292735000 | p03416 | python | s447463940 | s955067319 | 73 | 45 | 2,940 | 2,940 | Accepted | Accepted | 38.36 | a, b = list(map(int, input().split()))
sum_n = 0
for i in range(a, b + 1):
if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:
sum_n += 1
print(sum_n) | a, b = list(map(int, input().split()))
sum_s = 0
for i in range(a, b + 1):
s = str(i)
if s[0] == s[-1] and s[1] == s[-2]:
sum_s += 1
print(sum_s) | 8 | 9 | 169 | 165 | a, b = list(map(int, input().split()))
sum_n = 0
for i in range(a, b + 1):
if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:
sum_n += 1
print(sum_n)
| a, b = list(map(int, input().split()))
sum_s = 0
for i in range(a, b + 1):
s = str(i)
if s[0] == s[-1] and s[1] == s[-2]:
sum_s += 1
print(sum_s)
| false | 11.111111 | [
"-sum_n = 0",
"+sum_s = 0",
"- if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:",
"- sum_n += 1",
"-print(sum_n)",
"+ s = str(i)",
"+ if s[0] == s[-1] and s[1] == s[-2]:",
"+ sum_s += 1",
"+print(sum_s)"
] | false | 0.049683 | 0.080094 | 0.620301 | [
"s447463940",
"s955067319"
] |
u488127128 | p03073 | python | s697083121 | s708531461 | 48 | 17 | 3,316 | 3,188 | Accepted | Accepted | 64.58 | S = eval(input())
d,m = len(S)//2,len(S)%2
A = '01'*d+'0'*m
B = '10'*d+'1'*m
count_a = 0
count_b = 0
for s,a,b in zip(S,A,B):
if s != a:
count_a += 1
if s != b:
count_b += 1
print((min(count_a, count_b))) | s = eval(input())
h = s[::2].count('1') + s[1::2].count('0')
print((min(h, len(s)-h))) | 12 | 3 | 231 | 80 | S = eval(input())
d, m = len(S) // 2, len(S) % 2
A = "01" * d + "0" * m
B = "10" * d + "1" * m
count_a = 0
count_b = 0
for s, a, b in zip(S, A, B):
if s != a:
count_a += 1
if s != b:
count_b += 1
print((min(count_a, count_b)))
| s = eval(input())
h = s[::2].count("1") + s[1::2].count("0")
print((min(h, len(s) - h)))
| false | 75 | [
"-S = eval(input())",
"-d, m = len(S) // 2, len(S) % 2",
"-A = \"01\" * d + \"0\" * m",
"-B = \"10\" * d + \"1\" * m",
"-count_a = 0",
"-count_b = 0",
"-for s, a, b in zip(S, A, B):",
"- if s != a:",
"- count_a += 1",
"- if s != b:",
"- count_b += 1",
"-print((min(count_a, ... | false | 0.03669 | 0.035369 | 1.03735 | [
"s697083121",
"s708531461"
] |
u150984829 | p02413 | python | s019050824 | s323111459 | 30 | 20 | 6,252 | 6,248 | Accepted | Accepted | 33.33 | r,c=list(map(int,input().split()))
m=[[int(_) for _ in input().split()] for i in range(r)]
for i in range(r):m[i].append(sum(m[i]))
m.append([sum([m[i][j] for i in range(r)]) for j in range(c+1)])
for i in range(r+1):print((*m[i])) | r,c=map(int,input().split())
m=[[int(_) for _ in input().split()] for i in range(r)]
for i in range(r):m[i].append(sum(m[i]))
m.append([sum([m[i][j] for i in range(r)]) for j in range(c+1)])
[print(*m[i]) for i in range(r+1)]
| 5 | 5 | 227 | 229 | r, c = list(map(int, input().split()))
m = [[int(_) for _ in input().split()] for i in range(r)]
for i in range(r):
m[i].append(sum(m[i]))
m.append([sum([m[i][j] for i in range(r)]) for j in range(c + 1)])
for i in range(r + 1):
print((*m[i]))
| r, c = map(int, input().split())
m = [[int(_) for _ in input().split()] for i in range(r)]
for i in range(r):
m[i].append(sum(m[i]))
m.append([sum([m[i][j] for i in range(r)]) for j in range(c + 1)])
[print(*m[i]) for i in range(r + 1)]
| false | 0 | [
"-r, c = list(map(int, input().split()))",
"+r, c = map(int, input().split())",
"-for i in range(r + 1):",
"- print((*m[i]))",
"+[print(*m[i]) for i in range(r + 1)]"
] | false | 0.064844 | 0.053356 | 1.215307 | [
"s019050824",
"s323111459"
] |
u197457087 | p03325 | python | s164830738 | s900847342 | 110 | 84 | 4,148 | 70,744 | Accepted | Accepted | 23.64 | N = int(eval(input()))
A = list(map(int,input().split()))
ans = 0
for i in range(N):
while A[i]%2 == 0:
ans += 1
A[i] = A[i]//2
print(ans)
| N = int(eval(input()))
A = list(map(int,input().split()))
Flag = True
for x in A:
if x%2 != 1:
Flag = False
break
if Flag:
print((0))
exit()
ans = 0
for x in A:
while x%2 == 0:
ans += 1
x = x//2
print(ans) | 10 | 16 | 154 | 236 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for i in range(N):
while A[i] % 2 == 0:
ans += 1
A[i] = A[i] // 2
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
Flag = True
for x in A:
if x % 2 != 1:
Flag = False
break
if Flag:
print((0))
exit()
ans = 0
for x in A:
while x % 2 == 0:
ans += 1
x = x // 2
print(ans)
| false | 37.5 | [
"+Flag = True",
"+for x in A:",
"+ if x % 2 != 1:",
"+ Flag = False",
"+ break",
"+if Flag:",
"+ print((0))",
"+ exit()",
"-for i in range(N):",
"- while A[i] % 2 == 0:",
"+for x in A:",
"+ while x % 2 == 0:",
"- A[i] = A[i] // 2",
"+ x = x // 2"
... | false | 0.095325 | 0.036876 | 2.585011 | [
"s164830738",
"s900847342"
] |
u893962649 | p02621 | python | s536350192 | s499303382 | 30 | 25 | 9,056 | 9,092 | Accepted | Accepted | 16.67 | a = int(eval(input()))
print((a + a**2 + a**3))
| A = int(eval(input()))
ans = A + A**2 + A**3
print(ans) | 3 | 5 | 43 | 55 | a = int(eval(input()))
print((a + a**2 + a**3))
| A = int(eval(input()))
ans = A + A**2 + A**3
print(ans)
| false | 40 | [
"-a = int(eval(input()))",
"-print((a + a**2 + a**3))",
"+A = int(eval(input()))",
"+ans = A + A**2 + A**3",
"+print(ans)"
] | false | 0.059614 | 0.037995 | 1.568998 | [
"s536350192",
"s499303382"
] |
u278356323 | p02951 | python | s295966258 | s285484064 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | # ABC136a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
a, b, c = list(map(int, input().split()))
print((max(0, c-(a-b)))) | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
a, b, c = list(map(int, input().split()))
print((c-min(a-b, c)))
if __name__ == '__main__':
main()
| 8 | 10 | 144 | 205 | # ABC136a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
a, b, c = list(map(int, input().split()))
print((max(0, c - (a - b))))
| def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
a, b, c = list(map(int, input().split()))
print((c - min(a - b, c)))
if __name__ == "__main__":
main()
| false | 20 | [
"-# ABC136a",
"-import sys",
"+def main():",
"+ import sys",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**6)",
"-a, b, c = list(map(int, input().split()))",
"-print((max(0, c - (a - b))))",
"+ input = sys.stdin.readline",
"+ sys.setrecursionlimit(10**6)",
"+ a, b, c = l... | false | 0.046336 | 0.049597 | 0.934241 | [
"s295966258",
"s285484064"
] |
u439396449 | p03212 | python | s306173836 | s541161064 | 56 | 19 | 3,060 | 3,064 | Accepted | Accepted | 66.07 | from itertools import product
N = int(eval(input()))
S = str(N)
n = len(S)
ans = 0
for i in range(3, n + 1):
for p in product(['3', '5', '7'], repeat=i):
x = int(''.join(p))
if x <= N and len(set(p) & {'3', '5', '7'}) == 3:
ans += 1
print(ans)
| from itertools import product
N = int(eval(input()))
S = [int(x) for x in str(N)]
n = len(S)
# dp[pos][smaller?][started?][3?][5?][7?]
dp = [[[[[[0] * 2 for _ in range(2)] for _ in range(2)]
for _ in range(2)] for _ in range(2)] for _ in range(n + 1)]
dp[0][0][0][0][0][0] = 1
for i, j, k, c3, c5... | 14 | 28 | 286 | 822 | from itertools import product
N = int(eval(input()))
S = str(N)
n = len(S)
ans = 0
for i in range(3, n + 1):
for p in product(["3", "5", "7"], repeat=i):
x = int("".join(p))
if x <= N and len(set(p) & {"3", "5", "7"}) == 3:
ans += 1
print(ans)
| from itertools import product
N = int(eval(input()))
S = [int(x) for x in str(N)]
n = len(S)
# dp[pos][smaller?][started?][3?][5?][7?]
dp = [
[
[[[[0] * 2 for _ in range(2)] for _ in range(2)] for _ in range(2)]
for _ in range(2)
]
for _ in range(n + 1)
]
dp[0][0][0][0][0][0] = 1
for i, j, ... | false | 50 | [
"-S = str(N)",
"+S = [int(x) for x in str(N)]",
"-ans = 0",
"-for i in range(3, n + 1):",
"- for p in product([\"3\", \"5\", \"7\"], repeat=i):",
"- x = int(\"\".join(p))",
"- if x <= N and len(set(p) & {\"3\", \"5\", \"7\"}) == 3:",
"- ans += 1",
"+# dp[pos][smaller?][st... | false | 0.058024 | 0.048058 | 1.207353 | [
"s306173836",
"s541161064"
] |
u279605379 | p02300 | python | s466141440 | s822589679 | 980 | 830 | 33,784 | 33,924 | Accepted | Accepted | 15.31 | def isCLKWISE(ph):
a = ph[-1][0]-ph[-3][0],ph[-1][1]-ph[-3][1]
b = ph[-2][0]-ph[-3][0],ph[-2][1]-ph[-3][1]
crs = b[1]*a[0] - a[1]*b[0]
if crs < 0 : return False
else : return True
def ConvexHullScan(P):
P = sorted(P)
phU = [P[0],P[1]]
for p in P[2:]:
phU.append(p... | def isCLKWISE(ph):
a = ph[-1][0] - ph[-3][0]
d = - ph[-3][1] + ph[-2][1]
c = ph[-2][0] - ph[-3][0]
b = - ph[-3][1] + ph[-1][1]
crs = a*d - b*c
if crs < 0 : return False
else : return True
def ConvexHullScan(P):
P = sorted(P)
phU = [P[0],P[1]]
for p in P[2:]:
... | 40 | 42 | 1,015 | 1,034 | def isCLKWISE(ph):
a = ph[-1][0] - ph[-3][0], ph[-1][1] - ph[-3][1]
b = ph[-2][0] - ph[-3][0], ph[-2][1] - ph[-3][1]
crs = b[1] * a[0] - a[1] * b[0]
if crs < 0:
return False
else:
return True
def ConvexHullScan(P):
P = sorted(P)
phU = [P[0], P[1]]
for p in P[2:]:
... | def isCLKWISE(ph):
a = ph[-1][0] - ph[-3][0]
d = -ph[-3][1] + ph[-2][1]
c = ph[-2][0] - ph[-3][0]
b = -ph[-3][1] + ph[-1][1]
crs = a * d - b * c
if crs < 0:
return False
else:
return True
def ConvexHullScan(P):
P = sorted(P)
phU = [P[0], P[1]]
for p in P[2:]:
... | false | 4.761905 | [
"- a = ph[-1][0] - ph[-3][0], ph[-1][1] - ph[-3][1]",
"- b = ph[-2][0] - ph[-3][0], ph[-2][1] - ph[-3][1]",
"- crs = b[1] * a[0] - a[1] * b[0]",
"+ a = ph[-1][0] - ph[-3][0]",
"+ d = -ph[-3][1] + ph[-2][1]",
"+ c = ph[-2][0] - ph[-3][0]",
"+ b = -ph[-3][1] + ph[-1][1]",
"+ crs ... | false | 0.036558 | 0.042069 | 0.869002 | [
"s466141440",
"s822589679"
] |
u440566786 | p02912 | python | s509269657 | s507568092 | 454 | 144 | 68,296 | 14,380 | Accepted | Accepted | 68.28 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
import heapq
input=sys.stdin.readline
def resolve():
n,m=list(map(int,input().split()))
A=list([-(int(x)) for x in input().split()])
heapq.heapify(A)
for _ in range(m):
a=heapq.heappop(A)
a=-a
... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
from heapq import heapify,heappop,heappush
n,m=list(map(int,input().split()))
A=[-a for a in map(int,input().split())]
heapify(A)
for _ in range(m):
... | 18 | 15 | 386 | 388 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
import heapq
input = sys.stdin.readline
def resolve():
n, m = list(map(int, input().split()))
A = list([-(int(x)) for x in input().split()])
heapq.heapify(A)
for _ in range(m):
a = heapq.heappop(A)
a = -a... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
from heapq import heapify, heappop, heappush
n, m = list(map(int, input().split()))
A = [-a for a in map(int, input().split())]
heapify(A)
for _ in range(m... | false | 16.666667 | [
"-import heapq",
"-",
"-input = sys.stdin.readline",
"+input = lambda: sys.stdin.readline().rstrip()",
"+ from heapq import heapify, heappop, heappush",
"+",
"- A = list([-(int(x)) for x in input().split()])",
"- heapq.heapify(A)",
"+ A = [-a for a in map(int, input().split())]",
"+ ... | false | 0.040241 | 0.065429 | 0.615031 | [
"s509269657",
"s507568092"
] |
u688281605 | p02803 | python | s265242318 | s457770223 | 262 | 217 | 19,388 | 16,656 | Accepted | Accepted | 17.18 | import numpy as np
from scipy.sparse import csgraph
H, W = list(map(int, input().split()))
maze = "".join(eval(input()) for _ in range(H))
array = np.zeros((H * W, H * W), dtype=np.bool)
for n in range(H * W):
if maze[n] == "#":
continue
r, c = divmod(n, W)
if c and maze[n - 1] == ".":
... | import numpy as np
from scipy.sparse import csgraph
H, W = list(map(int, input().split()))#縦と横の大きさを入力から得る
maze = "".join(eval(input()) for _ in range(H))#入力を全行数分取得
#配列を生成する。np.zeros()は全てを0に初期化する関数
#第1引数は H*W,H*Wの2次元配列、第2引数はbool型を意味する
array = np.zeros((H * W, H * W), dtype=np.bool)
for n in range(H * W):
i... | 17 | 22 | 527 | 664 | import numpy as np
from scipy.sparse import csgraph
H, W = list(map(int, input().split()))
maze = "".join(eval(input()) for _ in range(H))
array = np.zeros((H * W, H * W), dtype=np.bool)
for n in range(H * W):
if maze[n] == "#":
continue
r, c = divmod(n, W)
if c and maze[n - 1] == ".":
arra... | import numpy as np
from scipy.sparse import csgraph
H, W = list(map(int, input().split())) # 縦と横の大きさを入力から得る
maze = "".join(eval(input()) for _ in range(H)) # 入力を全行数分取得
# 配列を生成する。np.zeros()は全てを0に初期化する関数
# 第1引数は H*W,H*Wの2次元配列、第2引数はbool型を意味する
array = np.zeros((H * W, H * W), dtype=np.bool)
for n in range(H * W):
if... | false | 22.727273 | [
"-H, W = list(map(int, input().split()))",
"-maze = \"\".join(eval(input()) for _ in range(H))",
"+H, W = list(map(int, input().split())) # 縦と横の大きさを入力から得る",
"+maze = \"\".join(eval(input()) for _ in range(H)) # 入力を全行数分取得",
"+# 配列を生成する。np.zeros()は全てを0に初期化する関数",
"+# 第1引数は H*W,H*Wの2次元配列、第2引数はbool型を意味する",
... | false | 0.449332 | 0.643813 | 0.697923 | [
"s265242318",
"s457770223"
] |
u254871849 | p02850 | python | s449078889 | s609259844 | 344 | 252 | 38,204 | 37,820 | Accepted | Accepted | 26.74 | # 2019-11-24 20:59:47(JST)
import sys
def main():
n = int(sys.stdin.readline().rstrip())
m = list(map(int, sys.stdin.read().split()))
ab = list(zip(m, m)) # 2回以上使えるようにlist化
graph = [[] for _ in range(n + 1)]
for a, b in ab:
graph[a].append(b)
graph[b].append(a)
ro... | import sys
from collections import deque
def main():
n = int(sys.stdin.readline().rstrip())
ab = list(map(int, sys.stdin.read().split()))
ab = list(zip(ab, ab))
G = [[] for _ in range(n + 1)]
for a, b in ab:
G[a].append(b)
G[b].append(a)
root = 1
q = dequ... | 60 | 45 | 1,590 | 996 | # 2019-11-24 20:59:47(JST)
import sys
def main():
n = int(sys.stdin.readline().rstrip())
m = list(map(int, sys.stdin.read().split()))
ab = list(zip(m, m)) # 2回以上使えるようにlist化
graph = [[] for _ in range(n + 1)]
for a, b in ab:
graph[a].append(b)
graph[b].append(a)
root = 1
pa... | import sys
from collections import deque
def main():
n = int(sys.stdin.readline().rstrip())
ab = list(map(int, sys.stdin.read().split()))
ab = list(zip(ab, ab))
G = [[] for _ in range(n + 1)]
for a, b in ab:
G[a].append(b)
G[b].append(a)
root = 1
q = deque()
q.append(ro... | false | 25 | [
"-# 2019-11-24 20:59:47(JST)",
"+from collections import deque",
"- m = list(map(int, sys.stdin.read().split()))",
"- ab = list(zip(m, m)) # 2回以上使えるようにlist化",
"- graph = [[] for _ in range(n + 1)]",
"+ ab = list(map(int, sys.stdin.read().split()))",
"+ ab = list(zip(ab, ab))",
"+ G ... | false | 0.100436 | 0.104387 | 0.962143 | [
"s449078889",
"s609259844"
] |
u150984829 | p02268 | python | s906063514 | s778160211 | 100 | 40 | 16,740 | 18,460 | Accepted | Accepted | 60 | import bisect
n = int(eval(input()))
A = list(map(int, input().split()))
eval(input())
k = 0
for e in map(int, input().split()):
i = bisect.bisect_left(A, e)
if i < n and A[i] == e: k += 1
print(k)
| def m():
eval(input());s=set(input().split())
eval(input());print((len(s&set(input().split()))))
if'__main__'==__name__:m()
| 9 | 4 | 203 | 115 | import bisect
n = int(eval(input()))
A = list(map(int, input().split()))
eval(input())
k = 0
for e in map(int, input().split()):
i = bisect.bisect_left(A, e)
if i < n and A[i] == e:
k += 1
print(k)
| def m():
eval(input())
s = set(input().split())
eval(input())
print((len(s & set(input().split()))))
if "__main__" == __name__:
m()
| false | 55.555556 | [
"-import bisect",
"+def m():",
"+ eval(input())",
"+ s = set(input().split())",
"+ eval(input())",
"+ print((len(s & set(input().split()))))",
"-n = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-eval(input())",
"-k = 0",
"-for e in map(int, input().split()):",
"- ... | false | 0.039357 | 0.038562 | 1.02062 | [
"s906063514",
"s778160211"
] |
u899909022 | p03013 | python | s121442627 | s684233633 | 189 | 174 | 6,876 | 6,900 | Accepted | Accepted | 7.94 | n,m=list(map(int,input().split()))
MOD = 1000000007
D=[0] * (n + 1)
for _ in range(m):
D[int(eval(input()))] = -1
for i in range(n+1):
if D[i] == -1:
continue
if i in (0, 1):
D[i] = 1
continue
if D[i-1] != -1:
D[i] += D[i-1]
if D[i-2] != -1:
D[i... | n,m=list(map(int,input().split()))
D=[1] * (n + 1)
for _ in range(m):
D[int(eval(input()))] = 0
for i in range(n+1):
if D[i] == 0 or i < 2:
continue
D[i] = (D[i-1] + D[i-2]) % 1000000007
print((D[i])) | 17 | 9 | 353 | 215 | n, m = list(map(int, input().split()))
MOD = 1000000007
D = [0] * (n + 1)
for _ in range(m):
D[int(eval(input()))] = -1
for i in range(n + 1):
if D[i] == -1:
continue
if i in (0, 1):
D[i] = 1
continue
if D[i - 1] != -1:
D[i] += D[i - 1]
if D[i - 2] != -1:
D[i]... | n, m = list(map(int, input().split()))
D = [1] * (n + 1)
for _ in range(m):
D[int(eval(input()))] = 0
for i in range(n + 1):
if D[i] == 0 or i < 2:
continue
D[i] = (D[i - 1] + D[i - 2]) % 1000000007
print((D[i]))
| false | 47.058824 | [
"-MOD = 1000000007",
"-D = [0] * (n + 1)",
"+D = [1] * (n + 1)",
"- D[int(eval(input()))] = -1",
"+ D[int(eval(input()))] = 0",
"- if D[i] == -1:",
"+ if D[i] == 0 or i < 2:",
"- if i in (0, 1):",
"- D[i] = 1",
"- continue",
"- if D[i - 1] != -1:",
"- D[i... | false | 0.036791 | 0.093386 | 0.39397 | [
"s121442627",
"s684233633"
] |
u251899209 | p02722 | python | s411859064 | s525413152 | 719 | 344 | 3,064 | 3,064 | Accepted | Accepted | 52.16 | def check(i):
tot=k
while(tot%i==0):
tot//=i
if(tot%i==1):
setl.add(i)
import math
k=int(eval(input()))
if(k==2):
print((1))
exit()
setl = set()
setl.add(k); setl.add(k-1)
for x in range(2,int(math.sqrt(k))+1):
check(x)
check(k//x)
print((len(setl))) | def check(i):
tot=k
pw=0
while(tot%i==0):
tot//=i
pw+=1
if(tot%i==1):
other = tot//i
if(pw==0 and other>=2 and other<=k):
setl.add(other)
setl.add(i)
import math
k=int(eval(input()))
if(k==2):
print((1))
exit()
setl = set()
setl.add(k); setl.add(k-1)
for x in range(2,int(math.sqrt... | 17 | 23 | 267 | 365 | def check(i):
tot = k
while tot % i == 0:
tot //= i
if tot % i == 1:
setl.add(i)
import math
k = int(eval(input()))
if k == 2:
print((1))
exit()
setl = set()
setl.add(k)
setl.add(k - 1)
for x in range(2, int(math.sqrt(k)) + 1):
check(x)
check(k // x)
print((len(setl)))
| def check(i):
tot = k
pw = 0
while tot % i == 0:
tot //= i
pw += 1
if tot % i == 1:
other = tot // i
if pw == 0 and other >= 2 and other <= k:
setl.add(other)
setl.add(i)
import math
k = int(eval(input()))
if k == 2:
print((1))
exit()
setl =... | false | 26.086957 | [
"+ pw = 0",
"+ pw += 1",
"+ other = tot // i",
"+ if pw == 0 and other >= 2 and other <= k:",
"+ setl.add(other)",
"- check(k // x)",
"+ # check(k//x)"
] | false | 0.148667 | 0.254988 | 0.583035 | [
"s411859064",
"s525413152"
] |
u832039789 | p03863 | python | s147284817 | s423277930 | 58 | 50 | 3,444 | 5,492 | Accepted | Accepted | 13.79 | s = eval(input())
t = ''
for c in s:
if c in (s[0],s[-1]):
t += c
r = len(t)
for c,d in zip(t[:-1],t[1:]):
if c==d:
r += 1
if len(s)%2==r%2:
print('Second')
else:
print('First')
| s = eval(input())
t = [i for i in s if i in (s[0],s[-1])]
r = len(t)
for c,d in zip(t[:-1],t[1:]):
r += c==d
print(('Second' if len(s)%2==r%2 else 'First'))
| 13 | 6 | 216 | 158 | s = eval(input())
t = ""
for c in s:
if c in (s[0], s[-1]):
t += c
r = len(t)
for c, d in zip(t[:-1], t[1:]):
if c == d:
r += 1
if len(s) % 2 == r % 2:
print("Second")
else:
print("First")
| s = eval(input())
t = [i for i in s if i in (s[0], s[-1])]
r = len(t)
for c, d in zip(t[:-1], t[1:]):
r += c == d
print(("Second" if len(s) % 2 == r % 2 else "First"))
| false | 53.846154 | [
"-t = \"\"",
"-for c in s:",
"- if c in (s[0], s[-1]):",
"- t += c",
"+t = [i for i in s if i in (s[0], s[-1])]",
"- if c == d:",
"- r += 1",
"-if len(s) % 2 == r % 2:",
"- print(\"Second\")",
"-else:",
"- print(\"First\")",
"+ r += c == d",
"+print((\"Second\" i... | false | 0.044339 | 0.040593 | 1.092283 | [
"s147284817",
"s423277930"
] |
u912237403 | p00043 | python | s296595059 | s294805589 | 60 | 30 | 4,332 | 4,276 | Accepted | Accepted | 50 | NUM="0123456789"
def atama(x):
return [e for e in set(x) if x.count(e)>=2]
def koutu(x,i):
return x.count(i)>=3
def shuntu(x,i):
return i<8 and x.count(i)>0 and x.count(i+1)>0 and x.count(i+2)>0
def make(x):
return [int(c) for c in x]
def check(x):
for e in set(x):
if ko... | def check(x,j=1):
if sum(x)==0: return True
for i in range(j,10):
y = x[:]
if y[i]>=3:
y[i] -= 3
if check(y,i): return True
y = x[:]
if i<8 and y[i]>0 and y[i+1]>0 and y[i+2]>0:
y[i] -= 1
y[i+1] -= 1
y[i+2] -=... | 61 | 38 | 1,469 | 889 | NUM = "0123456789"
def atama(x):
return [e for e in set(x) if x.count(e) >= 2]
def koutu(x, i):
return x.count(i) >= 3
def shuntu(x, i):
return i < 8 and x.count(i) > 0 and x.count(i + 1) > 0 and x.count(i + 2) > 0
def make(x):
return [int(c) for c in x]
def check(x):
for e in set(x):
... | def check(x, j=1):
if sum(x) == 0:
return True
for i in range(j, 10):
y = x[:]
if y[i] >= 3:
y[i] -= 3
if check(y, i):
return True
y = x[:]
if i < 8 and y[i] > 0 and y[i + 1] > 0 and y[i + 2] > 0:
y[i] -= 1
y... | false | 37.704918 | [
"-NUM = \"0123456789\"",
"+def check(x, j=1):",
"+ if sum(x) == 0:",
"+ return True",
"+ for i in range(j, 10):",
"+ y = x[:]",
"+ if y[i] >= 3:",
"+ y[i] -= 3",
"+ if check(y, i):",
"+ return True",
"+ y = x[:]",
"+ ... | false | 0.072709 | 0.189396 | 0.3839 | [
"s296595059",
"s294805589"
] |
u312025627 | p03627 | python | s247128888 | s833512201 | 402 | 277 | 78,616 | 71,832 | Accepted | Accepted | 31.09 | def main():
N = int(input())
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
if (c.most_common()[0][1] < 2 or c.most_common()[1][1] < 2) \
and c.most_common()[0][1] < 4:
return print(0)
d = [i[0] for i in c.items() if i[1] >= 2]
... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
most = c.most_common()
if most[0][1] >= 4:
ans = []
for k, v in most:
if v >= 4:
ans.append(k)
ans.append... | 24 | 29 | 615 | 699 | def main():
N = int(input())
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
if (c.most_common()[0][1] < 2 or c.most_common()[1][1] < 2) and c.most_common()[0][
1
] < 4:
return print(0)
d = [i[0] for i in c.items() if i[1] >= 2]
if d:... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
most = c.most_common()
if most[0][1] >= 4:
ans = []
for k, v in most:
if v >= 4:
ans.append(k)
ans.append(k)
... | false | 17.241379 | [
"- N = int(input())",
"+ N = int(eval(input()))",
"- if (c.most_common()[0][1] < 2 or c.most_common()[1][1] < 2) and c.most_common()[0][",
"- 1",
"- ] < 4:",
"- return print(0)",
"- d = [i[0] for i in c.items() if i[1] >= 2]",
"- if d:",
"- d.sort()",
"- e... | false | 0.039034 | 0.041612 | 0.938046 | [
"s247128888",
"s833512201"
] |
u006880673 | p03665 | python | s881774794 | s613718020 | 180 | 74 | 42,136 | 67,500 | Accepted | Accepted | 58.89 | from scipy.special import comb
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
MAX_C = 100
# def comb_dp():
# """
# dpテーブルを作ってnCkを計算.
# modのpは素数でなくてよい.
# 1 <= k <= n <= 2000程度
# O(MAX_C ** 2).
# """
# Com = [[0]*MAX_C for _ in range(MAX_C)]
# for ... | N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
MAX_C = 100
def comb_dp():
"""
dpテーブルを作ってnCkを計算.
modのpは素数でなくてよい.
1 <= k <= n <= 2000程度
O(MAX_C ** 2).
"""
Com = [[0]*MAX_C for _ in range(MAX_C)]
Com[0][0] = 1
for i in range(1, MAX_C):
... | 46 | 44 | 1,243 | 1,106 | from scipy.special import comb
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
MAX_C = 100
# def comb_dp():
# """
# dpテーブルを作ってnCkを計算.
# modのpは素数でなくてよい.
# 1 <= k <= n <= 2000程度
# O(MAX_C ** 2).
# """
# Com = [[0]*MAX_C for _ in range(MAX_C)]
# for i in range(1,... | N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
MAX_C = 100
def comb_dp():
"""
dpテーブルを作ってnCkを計算.
modのpは素数でなくてよい.
1 <= k <= n <= 2000程度
O(MAX_C ** 2).
"""
Com = [[0] * MAX_C for _ in range(MAX_C)]
Com[0][0] = 1
for i in range(1, MAX_C):
# iC0 = 1
... | false | 4.347826 | [
"-from scipy.special import comb",
"-",
"-# def comb_dp():",
"-# \"\"\"",
"-# dpテーブルを作ってnCkを計算.",
"-# modのpは素数でなくてよい.",
"-# 1 <= k <= n <= 2000程度",
"-# O(MAX_C ** 2).",
"-# \"\"\"",
"-# Com = [[0]*MAX_C for _ in range(MAX_C)]",
"-# for i in range(1, MAX_C):",
"-... | false | 1.13483 | 0.042273 | 26.845087 | [
"s881774794",
"s613718020"
] |
u625963200 | p03599 | python | s480170470 | s592009178 | 119 | 101 | 3,188 | 3,188 | Accepted | Accepted | 15.13 | A,B,C,D,E,F=list(map(int,input().split()))
water=set()
for a in range(0,F+1,100*A):
for b in range(0,F+1,100*B):
if a+b<=F: water.add(a+b)
water=sorted(list(water))
suger=set()
for c in range(0,F+1,C):
for d in range(0,F+1,D):
if c+d<=F: suger.add(c+d)
suger=sorted(list(suger))
ans,answater... | A,B,C,D,E,F=list(map(int,input().split()))
water=set()
for a in range(0,F+1,100*A):
for b in range(0,F+1,100*B):
if a+b<=F: water.add(a+b)
water=sorted(list(water))
suger=set()
for c in range(0,F+1,C):
for d in range(0,F+1,D):
if c+d<=F: suger.add(c+d)
suger=sorted(list(suger))
kosa,ans1,ans2... | 23 | 21 | 534 | 504 | A, B, C, D, E, F = list(map(int, input().split()))
water = set()
for a in range(0, F + 1, 100 * A):
for b in range(0, F + 1, 100 * B):
if a + b <= F:
water.add(a + b)
water = sorted(list(water))
suger = set()
for c in range(0, F + 1, C):
for d in range(0, F + 1, D):
if c + d <= F:
... | A, B, C, D, E, F = list(map(int, input().split()))
water = set()
for a in range(0, F + 1, 100 * A):
for b in range(0, F + 1, 100 * B):
if a + b <= F:
water.add(a + b)
water = sorted(list(water))
suger = set()
for c in range(0, F + 1, C):
for d in range(0, F + 1, D):
if c + d <= F:
... | false | 8.695652 | [
"-ans, answater, anssuger = 0, 0, 0",
"+kosa, ans1, ans2 = 0, 0, 0",
"- if w + s != 0:",
"- if ans <= (100 * s) / (w + s):",
"- answater, anssuger = w + s, s",
"- ans = (100 * s) / (w + s)",
"-print((answater, anssuger))",
"+ if w + s != 0 and kos... | false | 0.063532 | 0.215762 | 0.294455 | [
"s480170470",
"s592009178"
] |
u588341295 | p03291 | python | s273371696 | s484050471 | 1,101 | 525 | 18,992 | 27,612 | Accepted | Accepted | 52.32 | # -*- coding: utf-8 -*-
"""
参考:http://tutuz.hateblo.jp/entry/2018/08/06/074104
https://www.hamayanhamayan.com/entry/2018/08/05/232127
・別解
・予め必要なA,C,?の個数は集めておく。
・Bの位置を決めて、4つの選び方パターンを全部数え上げる。
・3べきの計算はpowの第三引数modで高速化
"""
MOD = 10 ** 9 + 7
S = eval(input())
# あるBの位置よりも左にあるAと?の個数
A, LQ = [0] * len(S), [... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 50 | 47 | 1,316 | 1,429 | # -*- coding: utf-8 -*-
"""
参考:http://tutuz.hateblo.jp/entry/2018/08/06/074104
https://www.hamayanhamayan.com/entry/2018/08/05/232127
・別解
・予め必要なA,C,?の個数は集めておく。
・Bの位置を決めて、4つの選び方パターンを全部数え上げる。
・3べきの計算はpowの第三引数modで高速化
"""
MOD = 10**9 + 7
S = eval(input())
# あるBの位置よりも左にあるAと?の個数
A, LQ = [0] * len(S), [0] * len(S)
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 | 6 | [
"-\"\"\"",
"-参考:http://tutuz.hateblo.jp/entry/2018/08/06/074104",
"- https://www.hamayanhamayan.com/entry/2018/08/05/232127",
"-・別解",
"-・予め必要なA,C,?の個数は集めておく。",
"-・Bの位置を決めて、4つの選び方パターンを全部数え上げる。",
"-・3べきの計算はpowの第三引数modで高速化",
"-\"\"\"",
"+import sys",
"+",
"+",
"+def input():",
"+ return sy... | false | 0.047382 | 0.036408 | 1.301426 | [
"s273371696",
"s484050471"
] |
u978178314 | p03559 | python | s467916452 | s801880927 | 607 | 503 | 107,236 | 106,340 | Accepted | Accepted | 17.13 | from bisect import bisect
from collections import deque
N = int(eval(input()))
A = list(map(int, input().split()))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
BC_ruiseki = deque([0])
for i, b in enumerate(B):
BC_ruiseki.append(BC_ruiseki[i] + N - bisect(C, b))
... | import bisect
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = list(map(int, input().split()))
C = sorted(list(map(int, input().split())))
ans = 0
for b in B:
a = bisect.bisect_left(A, b)
c = N-bisect.bisect(C, b)
ans += a*c
print(ans) | 17 | 13 | 413 | 271 | from bisect import bisect
from collections import deque
N = int(eval(input()))
A = list(map(int, input().split()))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
BC_ruiseki = deque([0])
for i, b in enumerate(B):
BC_ruiseki.append(BC_ruiseki[i] + N - bisect(C, b))
ans = 0
fo... | import bisect
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = list(map(int, input().split()))
C = sorted(list(map(int, input().split())))
ans = 0
for b in B:
a = bisect.bisect_left(A, b)
c = N - bisect.bisect(C, b)
ans += a * c
print(ans)
| false | 23.529412 | [
"-from bisect import bisect",
"-from collections import deque",
"+import bisect",
"-A = list(map(int, input().split()))",
"-B = sorted(list(map(int, input().split())))",
"+A = sorted(list(map(int, input().split())))",
"+B = list(map(int, input().split()))",
"-BC_ruiseki = deque([0])",
"-for i, b in ... | false | 0.042478 | 0.067121 | 0.632862 | [
"s467916452",
"s801880927"
] |
u506689504 | p03494 | python | s832676936 | s880430230 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | import math
N = int(eval(input()))
a = list(map(int, input().split()))
A = list(a)
min = 10**10
for e in A:
m=0 #eが2で割り切れる回数
while e%2==0:
e = e/2
m+=1
if min>m:
min = m
print(min) | n = eval(input())
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
ans = min(ans, len(bin(i)) - bin(i).rfind("1")-1)
print(ans) | 14 | 6 | 218 | 148 | import math
N = int(eval(input()))
a = list(map(int, input().split()))
A = list(a)
min = 10**10
for e in A:
m = 0 # eが2で割り切れる回数
while e % 2 == 0:
e = e / 2
m += 1
if min > m:
min = m
print(min)
| n = eval(input())
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(ans)
| false | 57.142857 | [
"-import math",
"-",
"-N = int(eval(input()))",
"+n = eval(input())",
"-A = list(a)",
"-min = 10**10",
"-for e in A:",
"- m = 0 # eが2で割り切れる回数",
"- while e % 2 == 0:",
"- e = e / 2",
"- m += 1",
"- if min > m:",
"- min = m",
"-print(min)",
"+ans = float(\"in... | false | 0.039642 | 0.039071 | 1.0146 | [
"s832676936",
"s880430230"
] |
u201928947 | p02564 | python | s723344383 | s777757697 | 1,132 | 942 | 198,696 | 214,184 | Accepted | Accepted | 16.78 | from collections import deque
class csr:
def __init__(self,N,edges):
self.start = [0]*(N+1)
self.elist = [0]*len(edges)
for e in edges:
self.start[e[0]+1] += 1
for i in range(1,N+1):
self.start[i] += self.start[i-1]
counter = self.start[:]
... | from collections import deque
class csr:
def __init__(self,N,edges):
self.start = [0]*(N+1)
self.elist = [0]*len(edges)
for e in edges:
self.start[e[0]+1] += 1
for i in range(1,N+1):
self.start[i] += self.start[i-1]
counter = self.start[:]
... | 84 | 87 | 2,749 | 2,806 | from collections import deque
class csr:
def __init__(self, N, edges):
self.start = [0] * (N + 1)
self.elist = [0] * len(edges)
for e in edges:
self.start[e[0] + 1] += 1
for i in range(1, N + 1):
self.start[i] += self.start[i - 1]
counter = self.star... | from collections import deque
class csr:
def __init__(self, N, edges):
self.start = [0] * (N + 1)
self.elist = [0] * len(edges)
for e in edges:
self.start[e[0] + 1] += 1
for i in range(1, N + 1):
self.start[i] += self.start[i - 1]
counter = self.star... | false | 3.448276 | [
"-input = sys.stdin.buffer.readline",
"-N, M = list(map(int, input().split()))",
"+readline = sys.stdin.buffer.readline",
"+read = sys.stdin.buffer.read",
"+N, M = list(map(int, readline().split()))",
"+ab = list(map(int, read().split()))",
"-for i in range(M):",
"- a, b = list(map(int, input().spl... | false | 0.080295 | 0.03791 | 2.118057 | [
"s723344383",
"s777757697"
] |
u482019060 | p02911 | python | s302869668 | s531539432 | 304 | 241 | 7,884 | 11,788 | Accepted | Accepted | 20.72 | N,K,Q=list(map(int,input().split()))
ans=[K for i in range(N)]
ans=list([x-Q for x in ans])
for i in range(Q):
A=int(eval(input()))
ans[A-1]=ans[A-1]+1
for i in range(N):
if ans[i]>0:
print('Yes')
else:
print('No') | n, k, q = list(map(int, input().split()))
a_list = [int(eval(input()))-1 for _ in range(q)]
p_list = [k-q for _ in range(n)]
for a in a_list:
p_list[a] += 1
for p in p_list:
if p <= 0:
print("No")
else:
print("Yes")
| 11 | 12 | 231 | 245 | N, K, Q = list(map(int, input().split()))
ans = [K for i in range(N)]
ans = list([x - Q for x in ans])
for i in range(Q):
A = int(eval(input()))
ans[A - 1] = ans[A - 1] + 1
for i in range(N):
if ans[i] > 0:
print("Yes")
else:
print("No")
| n, k, q = list(map(int, input().split()))
a_list = [int(eval(input())) - 1 for _ in range(q)]
p_list = [k - q for _ in range(n)]
for a in a_list:
p_list[a] += 1
for p in p_list:
if p <= 0:
print("No")
else:
print("Yes")
| false | 8.333333 | [
"-N, K, Q = list(map(int, input().split()))",
"-ans = [K for i in range(N)]",
"-ans = list([x - Q for x in ans])",
"-for i in range(Q):",
"- A = int(eval(input()))",
"- ans[A - 1] = ans[A - 1] + 1",
"-for i in range(N):",
"- if ans[i] > 0:",
"+n, k, q = list(map(int, input().split()))",
"... | false | 0.04318 | 0.044507 | 0.970192 | [
"s302869668",
"s531539432"
] |
u628581330 | p02813 | python | s333342165 | s199709271 | 35 | 27 | 8,052 | 8,052 | Accepted | Accepted | 22.86 | n = int(eval(input()))
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
seq = [i+1 for i in range(n)]
a = 0
b = 0
from itertools import permutations
per = list(permutations(seq,n))
for i in range(len(per)):
if per[i] == p:
a = i
if per[i] == q:
b = i
print((ab... | n = int(eval(input()))
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
seq = [i+1 for i in range(n)]
# a = 0
# b = 0
from itertools import permutations
per = list(permutations(seq,n))
# for i in range(len(per)):
# if per[i] == p:
# a = i
# if per[i] == q:
# b ... | 14 | 14 | 320 | 356 | n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
seq = [i + 1 for i in range(n)]
a = 0
b = 0
from itertools import permutations
per = list(permutations(seq, n))
for i in range(len(per)):
if per[i] == p:
a = i
if per[i] == q:
b = i
print((abs(a - b... | n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
seq = [i + 1 for i in range(n)]
# a = 0
# b = 0
from itertools import permutations
per = list(permutations(seq, n))
# for i in range(len(per)):
# if per[i] == p:
# a = i
# if per[i] == q:
# b = i
pr... | false | 0 | [
"-a = 0",
"-b = 0",
"+# a = 0",
"+# b = 0",
"-for i in range(len(per)):",
"- if per[i] == p:",
"- a = i",
"- if per[i] == q:",
"- b = i",
"-print((abs(a - b)))",
"+# for i in range(len(per)):",
"+# if per[i] == p:",
"+# a = i",
"+# if per[i] == q:",
"+... | false | 0.047197 | 0.048799 | 0.967172 | [
"s333342165",
"s199709271"
] |
u858742833 | p03161 | python | s105517879 | s919369490 | 1,946 | 1,740 | 13,980 | 13,980 | Accepted | Accepted | 10.59 | def main():
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
a = [0] * n
a[0] = 0
for i in range(1, n):
hi = h[i]
a[i] = min(a[j] + abs(hi - h[j]) for j in range(max(0, i - k), i))
print((a[-1]))
if __name__ == '__main__':
main()
| def main():
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
a = [0] * n
a[0] = 0
for i in range(1, n):
hi = h[i]
s = max(0, i - k)
a[i] = min(aj + abs(hi - hj) for hj, aj in zip(h[s:i], a[s:i]))
print((a[-1]))
if __name__ == '__main_... | 12 | 13 | 304 | 328 | def main():
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
a = [0] * n
a[0] = 0
for i in range(1, n):
hi = h[i]
a[i] = min(a[j] + abs(hi - h[j]) for j in range(max(0, i - k), i))
print((a[-1]))
if __name__ == "__main__":
main()
| def main():
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
a = [0] * n
a[0] = 0
for i in range(1, n):
hi = h[i]
s = max(0, i - k)
a[i] = min(aj + abs(hi - hj) for hj, aj in zip(h[s:i], a[s:i]))
print((a[-1]))
if __name__ == "__main__":
ma... | false | 7.692308 | [
"- a[i] = min(a[j] + abs(hi - h[j]) for j in range(max(0, i - k), i))",
"+ s = max(0, i - k)",
"+ a[i] = min(aj + abs(hi - hj) for hj, aj in zip(h[s:i], a[s:i]))"
] | false | 0.043719 | 0.046472 | 0.940758 | [
"s105517879",
"s919369490"
] |
u672475305 | p03436 | python | s053691358 | s808901004 | 154 | 30 | 12,496 | 3,444 | Accepted | Accepted | 80.52 | R,C = list(map(int,input().split()))
sy,sx = 1,1
gy,gx = R,C
maze = [list(eval(input())) for _ in range(R)]
mx = 0
for m in maze:
mx += m.count('.')
sx,sy = sx-1, sy-1
gx,gy = gx-1, gy-1
def bfs(R,C,sy,sx,gy,gx,maze):
from collections import deque
import numpy as np
INF = np.inf
vis... | from collections import deque
h,w = list(map(int,input().split()))
maze = []
visited = [[0]*(w) for _ in range(h)]
mx = 0
for _ in range(h):
s = eval(input())
mx += s.count('.')
maze.append(list(s))
sy,sx = 0, 0
gy, gx = h-1, w-1
que = deque([(sy,sx,1)])
while que:
y,x,c = que.popleft()
... | 34 | 26 | 879 | 636 | R, C = list(map(int, input().split()))
sy, sx = 1, 1
gy, gx = R, C
maze = [list(eval(input())) for _ in range(R)]
mx = 0
for m in maze:
mx += m.count(".")
sx, sy = sx - 1, sy - 1
gx, gy = gx - 1, gy - 1
def bfs(R, C, sy, sx, gy, gx, maze):
from collections import deque
import numpy as np
INF = np.inf... | from collections import deque
h, w = list(map(int, input().split()))
maze = []
visited = [[0] * (w) for _ in range(h)]
mx = 0
for _ in range(h):
s = eval(input())
mx += s.count(".")
maze.append(list(s))
sy, sx = 0, 0
gy, gx = h - 1, w - 1
que = deque([(sy, sx, 1)])
while que:
y, x, c = que.popleft()
... | false | 23.529412 | [
"-R, C = list(map(int, input().split()))",
"-sy, sx = 1, 1",
"-gy, gx = R, C",
"-maze = [list(eval(input())) for _ in range(R)]",
"+from collections import deque",
"+",
"+h, w = list(map(int, input().split()))",
"+maze = []",
"+visited = [[0] * (w) for _ in range(h)]",
"-for m in maze:",
"- m... | false | 0.043223 | 0.036425 | 1.186646 | [
"s053691358",
"s808901004"
] |
u466331465 | p02953 | python | s463841801 | s909013497 | 129 | 97 | 14,704 | 14,252 | Accepted | Accepted | 24.81 | N = int(eval(input()))
H = list(map(int,input().split()))
a = []
cnt = 0
for i in range(N-1):
if cnt-H[i]>1:
print("No")
exit()
elif H[i]>H[i+1] and H[i]-H[i+1]==1:
a.append(H[i]-1)
cnt = max(cnt,H[i])
elif H[i]<=H[i+1]:
a.append(H[i])
cnt = max(cnt,H[i])
else:
print(... | N = int(eval(input()))
H = list(map(int,input().split()))
for i in range(N-2,-1,-1):
if H[i]>H[i+1] and H[i]-H[i+1]==1:
H[i] = H[i]-1
elif H[i]<=H[i+1]:
H[i] = H[i]
else:
print("No")
exit()
print("Yes")
| 21 | 11 | 389 | 229 | N = int(eval(input()))
H = list(map(int, input().split()))
a = []
cnt = 0
for i in range(N - 1):
if cnt - H[i] > 1:
print("No")
exit()
elif H[i] > H[i + 1] and H[i] - H[i + 1] == 1:
a.append(H[i] - 1)
cnt = max(cnt, H[i])
elif H[i] <= H[i + 1]:
a.append(H[i])
... | N = int(eval(input()))
H = list(map(int, input().split()))
for i in range(N - 2, -1, -1):
if H[i] > H[i + 1] and H[i] - H[i + 1] == 1:
H[i] = H[i] - 1
elif H[i] <= H[i + 1]:
H[i] = H[i]
else:
print("No")
exit()
print("Yes")
| false | 47.619048 | [
"-a = []",
"-cnt = 0",
"-for i in range(N - 1):",
"- if cnt - H[i] > 1:",
"- print(\"No\")",
"- exit()",
"- elif H[i] > H[i + 1] and H[i] - H[i + 1] == 1:",
"- a.append(H[i] - 1)",
"- cnt = max(cnt, H[i])",
"+for i in range(N - 2, -1, -1):",
"+ if H[i] > H[i ... | false | 0.046223 | 0.037231 | 1.241505 | [
"s463841801",
"s909013497"
] |
u191874006 | p02843 | python | s796075257 | s050654940 | 171 | 76 | 38,256 | 65,456 | Accepted | Accepted | 55.56 | #!/usr/bin/env python3
#三井住友信託銀行プログラミングコンテスト2019 C
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collec... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 26 | 26 | 663 | 649 | #!/usr/bin/env python3
# 三井住友信託銀行プログラミングコンテスト2019 C
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections imp... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 0 | [
"-# 三井住友信託銀行プログラミングコンテスト2019 C",
"-sys.setrecursionlimit(1000000)",
"+sys.setrecursionlimit(2147483647)",
"-y, z = divmod(x, 100)",
"-if y * 5 >= z:",
"+y = x // 100",
"+z = x % 100",
"+if 0 <= z <= 5 * y:"
] | false | 0.035966 | 0.03641 | 0.987801 | [
"s796075257",
"s050654940"
] |
u774845108 | p02902 | python | s948270192 | s881127718 | 259 | 157 | 45,292 | 13,280 | Accepted | Accepted | 39.38 | from sys import stdin
import sys
#import numpy as np
import collections
from functools import cmp_to_key
import heapq
## input functions for me
def rsa(sep = ''):
if sep == '' :
return input().split()
else: return input().split(sep)
def rip(sep = ''):
if sep == '' :
return l... | from sys import stdin
import sys
import numpy as np
import collections
from functools import cmp_to_key
import heapq
sys.setrecursionlimit(100000)
## input functions for me
def rsa(sep = ''):
if sep == '' :
return input().split()
else: return input().split(sep)
def rip(sep = ''):
if... | 112 | 113 | 2,525 | 2,555 | from sys import stdin
import sys
# import numpy as np
import collections
from functools import cmp_to_key
import heapq
## input functions for me
def rsa(sep=""):
if sep == "":
return input().split()
else:
return input().split(sep)
def rip(sep=""):
if sep == "":
return list(map(i... | from sys import stdin
import sys
import numpy as np
import collections
from functools import cmp_to_key
import heapq
sys.setrecursionlimit(100000)
## input functions for me
def rsa(sep=""):
if sep == "":
return input().split()
else:
return input().split(sep)
def rip(sep=""):
if sep == ""... | false | 0.884956 | [
"-",
"-# import numpy as np",
"+import numpy as np",
"+sys.setrecursionlimit(100000)"
] | false | 0.059282 | 0.038356 | 1.545568 | [
"s948270192",
"s881127718"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.