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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u764956288 | p02691 | python | s372862352 | s494148715 | 188 | 114 | 36,612 | 32,224 | Accepted | Accepted | 39.36 | from collections import defaultdict
def main():
N = int(eval(input()))
heights = list(map(int, input().split()))
"""
for j>i, j-i = Ai + Aj
i + Ai = j -Aj
"""
L = defaultdict(int)
R = defaultdict(int)
for i, height in enumerate(heights):
if i + height < N... | def main():
N = int(eval(input()))
heights = list(map(int, input().split()))
"""
for j>i, j-i = Ai + Aj
i + Ai = j -Aj
"""
L = [0] * N
R = [0] * N
count = 0
for i, height in enumerate(heights):
right = i + height
left = i - height
if r... | 33 | 29 | 639 | 495 | from collections import defaultdict
def main():
N = int(eval(input()))
heights = list(map(int, input().split()))
"""
for j>i, j-i = Ai + Aj
i + Ai = j -Aj
"""
L = defaultdict(int)
R = defaultdict(int)
for i, height in enumerate(heights):
if i + height < N:
L[i +... | def main():
N = int(eval(input()))
heights = list(map(int, input().split()))
"""
for j>i, j-i = Ai + Aj
i + Ai = j -Aj
"""
L = [0] * N
R = [0] * N
count = 0
for i, height in enumerate(heights):
right = i + height
left = i - height
if right < N:
... | false | 12.121212 | [
"-from collections import defaultdict",
"-",
"-",
"- L = defaultdict(int)",
"- R = defaultdict(int)",
"+ L = [0] * N",
"+ R = [0] * N",
"+ count = 0",
"- if i + height < N:",
"- L[i + height] += 1",
"- if i - height > 0:",
"- R[i - height] += ... | false | 0.044666 | 0.044356 | 1.006996 | [
"s372862352",
"s494148715"
] |
u057109575 | p02792 | python | s436195247 | s651163983 | 233 | 72 | 40,460 | 64,488 | Accepted | Accepted | 69.1 | N = int(eval(input()))
cnt = [[0] * 10 for _ in range(10)]
for i in range(1, N + 1):
cnt[int(str(i)[0])][int(str(i)[-1])] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += cnt[i][j] * cnt[j][i]
print(ans)
| N = int(eval(input()))
dp = [[0] * 10 for _ in range(10)]
for x in range(1, N + 1):
j = x % 10
while x >= 10:
x //= 10
i = x % 10
dp[i][j] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += dp[i][j] * dp[j][i]
print(ans)
| 11 | 16 | 245 | 296 | N = int(eval(input()))
cnt = [[0] * 10 for _ in range(10)]
for i in range(1, N + 1):
cnt[int(str(i)[0])][int(str(i)[-1])] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += cnt[i][j] * cnt[j][i]
print(ans)
| N = int(eval(input()))
dp = [[0] * 10 for _ in range(10)]
for x in range(1, N + 1):
j = x % 10
while x >= 10:
x //= 10
i = x % 10
dp[i][j] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += dp[i][j] * dp[j][i]
print(ans)
| false | 31.25 | [
"-cnt = [[0] * 10 for _ in range(10)]",
"-for i in range(1, N + 1):",
"- cnt[int(str(i)[0])][int(str(i)[-1])] += 1",
"+dp = [[0] * 10 for _ in range(10)]",
"+for x in range(1, N + 1):",
"+ j = x % 10",
"+ while x >= 10:",
"+ x //= 10",
"+ i = x % 10",
"+ dp[i][j] += 1",
"-f... | false | 0.134736 | 0.076284 | 1.766233 | [
"s436195247",
"s651163983"
] |
u312025627 | p03136 | python | s073029191 | s907714383 | 169 | 59 | 38,384 | 61,828 | Accepted | Accepted | 65.09 | def main():
N = int(eval(input()))
L = [int(i) for i in input().split()]
sumL = sum(L)
maxL = max(L)
print(("Yes" if maxL < sumL - maxL else "No"))
if __name__ == '__main__':
main()
| def main():
N = int(eval(input()))
L = [int(i) for i in input().split()]
maxL = max(L)
sumL = sum(L) - maxL
if maxL < sumL:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
| 10 | 13 | 209 | 241 | def main():
N = int(eval(input()))
L = [int(i) for i in input().split()]
sumL = sum(L)
maxL = max(L)
print(("Yes" if maxL < sumL - maxL else "No"))
if __name__ == "__main__":
main()
| def main():
N = int(eval(input()))
L = [int(i) for i in input().split()]
maxL = max(L)
sumL = sum(L) - maxL
if maxL < sumL:
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| false | 23.076923 | [
"- sumL = sum(L)",
"- print((\"Yes\" if maxL < sumL - maxL else \"No\"))",
"+ sumL = sum(L) - maxL",
"+ if maxL < sumL:",
"+ print(\"Yes\")",
"+ else:",
"+ print(\"No\")"
] | false | 0.047703 | 0.035964 | 1.326422 | [
"s073029191",
"s907714383"
] |
u972658925 | p02848 | python | s663990116 | s723335007 | 36 | 28 | 3,064 | 3,064 | Accepted | Accepted | 22.22 | N = int(eval(input()))
S = list(eval(input()))
lst = [chr(ord('a') + i) for i in range(26)]
lst_up = list(map(str.upper,lst))
for i in range(len(S)):
if int(lst_up.index(S[i])+N+1) <= len(lst_up):
S[i] = lst_up[lst_up.index(S[i])+N]
elif int(lst_up.index(S[i])+N+1) > len(lst_up):
S[... | n = int(eval(input()))
s = list(eval(input()))
lst_26 = [(chr(ord("a") + i)).upper() for i in range(26)]
for i in range(len(s)):
if lst_26.index(s[i])+n >= 26:
s[i] = lst_26[lst_26.index(s[i])+n-26]
else:
s[i] = lst_26[lst_26.index(s[i])+n]
print(("".join(s))) | 14 | 10 | 380 | 280 | N = int(eval(input()))
S = list(eval(input()))
lst = [chr(ord("a") + i) for i in range(26)]
lst_up = list(map(str.upper, lst))
for i in range(len(S)):
if int(lst_up.index(S[i]) + N + 1) <= len(lst_up):
S[i] = lst_up[lst_up.index(S[i]) + N]
elif int(lst_up.index(S[i]) + N + 1) > len(lst_up):
S[i]... | n = int(eval(input()))
s = list(eval(input()))
lst_26 = [(chr(ord("a") + i)).upper() for i in range(26)]
for i in range(len(s)):
if lst_26.index(s[i]) + n >= 26:
s[i] = lst_26[lst_26.index(s[i]) + n - 26]
else:
s[i] = lst_26[lst_26.index(s[i]) + n]
print(("".join(s)))
| false | 28.571429 | [
"-N = int(eval(input()))",
"-S = list(eval(input()))",
"-lst = [chr(ord(\"a\") + i) for i in range(26)]",
"-lst_up = list(map(str.upper, lst))",
"-for i in range(len(S)):",
"- if int(lst_up.index(S[i]) + N + 1) <= len(lst_up):",
"- S[i] = lst_up[lst_up.index(S[i]) + N]",
"- elif int(lst_u... | false | 0.127501 | 0.039423 | 3.234166 | [
"s663990116",
"s723335007"
] |
u350248178 | p03775 | python | s814785306 | s650628110 | 185 | 27 | 39,792 | 3,064 | Accepted | Accepted | 85.41 | n=int(eval(input()))
def f(a,b):
a=str(a)
b=str(b)
return(max(len(a),len(b)))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort(... | n=int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divisors
l=make_divisors(n)
m=len(l)
ans=10**100
for i ... | 23 | 19 | 429 | 422 | n = int(eval(input()))
def f(a, b):
a = str(a)
b = str(b)
return max(len(a), len(b))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort... | n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
l = make_divisors(n)
m = len(l)
ans = 10**100
for i... | false | 17.391304 | [
"-",
"-",
"-def f(a, b):",
"- a = str(a)",
"- b = str(b)",
"- return max(len(a), len(b))",
"-ans = 10**9 + 7",
"-for i in l:",
"- ans = min(ans, f(i, n // i))",
"+m = len(l)",
"+ans = 10**100",
"+for i in range(min(m // 2 + 1, m)):",
"+ a, b = len(str(l[i])), len(str(n // l[i]... | false | 0.041296 | 0.052303 | 0.789551 | [
"s814785306",
"s650628110"
] |
u721407235 | p02837 | python | s162228089 | s163142864 | 411 | 163 | 3,064 | 8,820 | Accepted | Accepted | 60.34 | N=int(eval(input()))
A=[]
arr=[]
ans=0
for n in range(N):
a=int(eval(input()))
A.append(a)
arr.append([ list(map(int,input().split())) for _ in range(a)])
for i in range(2**N):
ord =[0]*N
count=0
flg=0
for n in range(N):
if (i >>n)&1:
count +=1
ord[n]=1
fo... | import itertools
N=int(eval(input()))
A=[]
arr=[]
ans=0
li=list(itertools.product([0,1], repeat=N))
for n in range(N):
a=int(eval(input()))
A.append(a)
arr.append([ list(map(int,input().split())) for _ in range(a)])
for l in li:
flg=0
for n in range(N):
if l[n]==1:
for m in ... | 36 | 31 | 569 | 545 | N = int(eval(input()))
A = []
arr = []
ans = 0
for n in range(N):
a = int(eval(input()))
A.append(a)
arr.append([list(map(int, input().split())) for _ in range(a)])
for i in range(2**N):
ord = [0] * N
count = 0
flg = 0
for n in range(N):
if (i >> n) & 1:
count += 1
... | import itertools
N = int(eval(input()))
A = []
arr = []
ans = 0
li = list(itertools.product([0, 1], repeat=N))
for n in range(N):
a = int(eval(input()))
A.append(a)
arr.append([list(map(int, input().split())) for _ in range(a)])
for l in li:
flg = 0
for n in range(N):
if l[n] == 1:
... | false | 13.888889 | [
"+import itertools",
"+",
"+li = list(itertools.product([0, 1], repeat=N))",
"-for i in range(2**N):",
"- ord = [0] * N",
"- count = 0",
"+for l in li:",
"- if (i >> n) & 1:",
"- count += 1",
"- ord[n] = 1",
"- for n in range(N):",
"- if ord[n] == 1... | false | 0.056494 | 0.035755 | 1.580021 | [
"s162228089",
"s163142864"
] |
u606045429 | p02888 | python | s078280124 | s531159571 | 1,960 | 1,155 | 3,188 | 3,316 | Accepted | Accepted | 41.07 | from itertools import combinations
from bisect import bisect_right
def main():
N, *L = list(map(int, open(0).read().split()))
L.sort()
print((sum(bisect_right(L, L[i] + L[j] - 1, lo=j + 1) - (j + 1) for i, j in combinations(list(range(N)), 2))))
if __name__ == '__main__':
main()
| from itertools import combinations
from bisect import bisect_right
def main():
N, *L = list(map(int, open(0).read().split()))
L.sort()
print((sum(bisect_right(L, L[i] + L[j] - 1, j + 1) - (j + 1) for i, j in combinations(list(range(N)), 2))))
if __name__ == '__main__':
main() | 12 | 12 | 297 | 293 | from itertools import combinations
from bisect import bisect_right
def main():
N, *L = list(map(int, open(0).read().split()))
L.sort()
print(
(
sum(
bisect_right(L, L[i] + L[j] - 1, lo=j + 1) - (j + 1)
for i, j in combinations(list(range(N)), 2)
... | from itertools import combinations
from bisect import bisect_right
def main():
N, *L = list(map(int, open(0).read().split()))
L.sort()
print(
(
sum(
bisect_right(L, L[i] + L[j] - 1, j + 1) - (j + 1)
for i, j in combinations(list(range(N)), 2)
... | false | 0 | [
"- bisect_right(L, L[i] + L[j] - 1, lo=j + 1) - (j + 1)",
"+ bisect_right(L, L[i] + L[j] - 1, j + 1) - (j + 1)"
] | false | 0.047512 | 0.037528 | 1.266032 | [
"s078280124",
"s531159571"
] |
u392319141 | p03253 | python | s131781606 | s614844122 | 161 | 145 | 15,788 | 18,916 | Accepted | Accepted | 9.94 | class Combination:
def __init__(self, size, mod=10**9 + 7):
self.size = size + 2
self.mod = mod
self.fact = [1, 1] + [0] * size
self.factInv = [1, 1] + [0] * size
self.inv = [0, 1] + [0] * size
for i in range(2, self.size):
self.fact[i] = self.fa... | MOD = 10**9 + 7
class Combination:
def __init__(self, size):
self.size = size + 2
self.fact = [1, 1] + [0] * size
self.factInv = [1, 1] + [0] * size
self.inv = [0, 1] + [0] * size
for i in range(2, self.size):
self.fact[i] = self.fact[i - 1] * i % MOD
... | 53 | 48 | 1,518 | 1,387 | class Combination:
def __init__(self, size, mod=10**9 + 7):
self.size = size + 2
self.mod = mod
self.fact = [1, 1] + [0] * size
self.factInv = [1, 1] + [0] * size
self.inv = [0, 1] + [0] * size
for i in range(2, self.size):
self.fact[i] = self.fact[i - 1] ... | MOD = 10**9 + 7
class Combination:
def __init__(self, size):
self.size = size + 2
self.fact = [1, 1] + [0] * size
self.factInv = [1, 1] + [0] * size
self.inv = [0, 1] + [0] * size
for i in range(2, self.size):
self.fact[i] = self.fact[i - 1] * i % MOD
... | false | 9.433962 | [
"+MOD = 10**9 + 7",
"+",
"+",
"- def __init__(self, size, mod=10**9 + 7):",
"+ def __init__(self, size):",
"- self.mod = mod",
"- self.fact[i] = self.fact[i - 1] * i % self.mod",
"- self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod",
"- ... | false | 0.077094 | 0.091881 | 0.839062 | [
"s131781606",
"s614844122"
] |
u015593272 | p02727 | python | s903642381 | s061488966 | 447 | 236 | 23,616 | 22,720 | Accepted | Accepted | 47.2 | from collections import deque
N_red_toEat, N_green_toEat, N_red, N_green, N_white = list(map(int, input().split()))
delicious_red = list(map(int, input().split()))
delicious_green = list(map(int, input().split()))
delicious_white = list(map(int, input().split()))
delicious_red.sort(reverse=True)
delicious_g... | x, y, a, b, c = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a = sorted(a, reverse=True)[:x]
b = sorted(b, reverse=True)[:y]
al = a + b + c
al.sort(reverse=True)
ans = sum(al[: x + y])
print(ans) | 58 | 15 | 1,364 | 303 | from collections import deque
N_red_toEat, N_green_toEat, N_red, N_green, N_white = list(map(int, input().split()))
delicious_red = list(map(int, input().split()))
delicious_green = list(map(int, input().split()))
delicious_white = list(map(int, input().split()))
delicious_red.sort(reverse=True)
delicious_green.sort(r... | x, y, a, b, c = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a = sorted(a, reverse=True)[:x]
b = sorted(b, reverse=True)[:y]
al = a + b + c
al.sort(reverse=True)
ans = sum(al[: x + y])
print(ans)
| false | 74.137931 | [
"-from collections import deque",
"-",
"-N_red_toEat, N_green_toEat, N_red, N_green, N_white = list(map(int, input().split()))",
"-delicious_red = list(map(int, input().split()))",
"-delicious_green = list(map(int, input().split()))",
"-delicious_white = list(map(int, input().split()))",
"-delicious_red... | false | 0.103852 | 0.036123 | 2.874957 | [
"s903642381",
"s061488966"
] |
u334712262 | p02839 | python | s731495260 | s680864043 | 1,986 | 1,711 | 550,668 | 552,232 | Accepted | Accepted | 13.85 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutati... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutati... | 95 | 95 | 2,040 | 2,030 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from... | false | 0 | [
"+ s = memo[i][j]",
"- memo[i][j].add(abs(d + c))",
"- memo[i][j].add(abs(d - c))",
"+ s.add(abs(d + c))",
"+ s.add(abs(d - c))",
"- memo[i][j].add(abs(d + c))",
"- memo[i][j].add... | false | 0.046305 | 0.046195 | 1.002391 | [
"s731495260",
"s680864043"
] |
u288280761 | p03032 | python | s657137358 | s295757664 | 43 | 39 | 3,064 | 3,064 | Accepted | Accepted | 9.3 | from heapq import heappop, heappush
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
for left in range(min(N, K) + 1):
for right in range(min(N, K) - left + 1):
heap = []
for v in V[:left]:
heappush(heap, v)
for v in V[N - right:... | N, K = list(map(int, input().strip().split()))
V = list(map(int, input().strip().split()))
maxi = 0
for i in range(min(N, K)):
for o in range(i+2):
hand = []
for p in range(o):
hand.append(V[p])
for p in range(N-(i-o)-1, N):
hand.append(V[p])
hand.... | 29 | 24 | 623 | 619 | from heapq import heappop, heappush
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = 0
for left in range(min(N, K) + 1):
for right in range(min(N, K) - left + 1):
heap = []
for v in V[:left]:
heappush(heap, v)
for v in V[N - right :]:
... | N, K = list(map(int, input().strip().split()))
V = list(map(int, input().strip().split()))
maxi = 0
for i in range(min(N, K)):
for o in range(i + 2):
hand = []
for p in range(o):
hand.append(V[p])
for p in range(N - (i - o) - 1, N):
hand.append(V[p])
hand.sort... | false | 17.241379 | [
"-from heapq import heappop, heappush",
"-",
"-N, K = list(map(int, input().split()))",
"-V = list(map(int, input().split()))",
"-ans = 0",
"-for left in range(min(N, K) + 1):",
"- for right in range(min(N, K) - left + 1):",
"- heap = []",
"- for v in V[:left]:",
"- hea... | false | 0.038923 | 0.041618 | 0.935243 | [
"s657137358",
"s295757664"
] |
u759412327 | p03307 | python | s048682843 | s062711439 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
if N%2==0:
print(N)
else:
print((2*N)) | N = int(eval(input()))
print((N+N%2*N)) | 6 | 2 | 63 | 32 | N = int(eval(input()))
if N % 2 == 0:
print(N)
else:
print((2 * N))
| N = int(eval(input()))
print((N + N % 2 * N))
| false | 66.666667 | [
"-if N % 2 == 0:",
"- print(N)",
"-else:",
"- print((2 * N))",
"+print((N + N % 2 * N))"
] | false | 0.043051 | 0.044055 | 0.977216 | [
"s048682843",
"s062711439"
] |
u150984829 | p00008 | python | s141831825 | s422396125 | 110 | 20 | 5,608 | 5,596 | Accepted | Accepted | 81.82 | import sys
for e in sys.stdin:
e=int(e);x=list(range(10))
print((sum([1 for a in x for b in x for c in x for d in x if a+b+c+d==e])))
| import sys
a=[0]*51
for i in range(19):
a[i]=a[36-i]=(i+3)*(i+2)*(i+1)//6-max(2*(i-9)*(i-8)*(i-7)//3,0)
for e in sys.stdin:
print((a[int(e)]))
| 4 | 6 | 131 | 148 | import sys
for e in sys.stdin:
e = int(e)
x = list(range(10))
print((sum([1 for a in x for b in x for c in x for d in x if a + b + c + d == e])))
| import sys
a = [0] * 51
for i in range(19):
a[i] = a[36 - i] = (i + 3) * (i + 2) * (i + 1) // 6 - max(
2 * (i - 9) * (i - 8) * (i - 7) // 3, 0
)
for e in sys.stdin:
print((a[int(e)]))
| false | 33.333333 | [
"+a = [0] * 51",
"+for i in range(19):",
"+ a[i] = a[36 - i] = (i + 3) * (i + 2) * (i + 1) // 6 - max(",
"+ 2 * (i - 9) * (i - 8) * (i - 7) // 3, 0",
"+ )",
"- e = int(e)",
"- x = list(range(10))",
"- print((sum([1 for a in x for b in x for c in x for d in x if a + b + c + d == e... | false | 0.037864 | 0.058004 | 0.652786 | [
"s141831825",
"s422396125"
] |
u368796742 | p03700 | python | s538326641 | s833722867 | 1,114 | 545 | 7,384 | 50,392 | Accepted | Accepted | 51.08 | n,a,b = list(map(int,input().split()))
h = [int(eval(input())) for i in range(n)]
h.sort()
t = a-b
r = 10**9+5
l = 0
while r-l > 1:
m = (r+l)//2
mi = m*b
count = 0
for i in h:
if i > mi:
count += (i-mi+t-1)//t
if count <= m:
r = m
else:
l = m... | n,a,b = list(map(int,input().split()))
h = [int(eval(input())) for i in range(n)]
t = a-b
r = (max(h)+b-1)//b
l = 0
while r-l > 1:
m = (r+l)//2
mi = m*b
count = 0
for i in h:
if i > mi:
count += (i-mi+t-1)//t
if count <= m:
r = m
else:
l = m
pr... | 19 | 17 | 318 | 314 | n, a, b = list(map(int, input().split()))
h = [int(eval(input())) for i in range(n)]
h.sort()
t = a - b
r = 10**9 + 5
l = 0
while r - l > 1:
m = (r + l) // 2
mi = m * b
count = 0
for i in h:
if i > mi:
count += (i - mi + t - 1) // t
if count <= m:
r = m
else:
... | n, a, b = list(map(int, input().split()))
h = [int(eval(input())) for i in range(n)]
t = a - b
r = (max(h) + b - 1) // b
l = 0
while r - l > 1:
m = (r + l) // 2
mi = m * b
count = 0
for i in h:
if i > mi:
count += (i - mi + t - 1) // t
if count <= m:
r = m
else:
... | false | 10.526316 | [
"-h.sort()",
"-r = 10**9 + 5",
"+r = (max(h) + b - 1) // b"
] | false | 0.036398 | 0.122231 | 0.297778 | [
"s538326641",
"s833722867"
] |
u811733736 | p00203 | python | s865490913 | s303254178 | 50 | 40 | 8,056 | 8,080 | Accepted | Accepted | 20 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203
"""
import sys
from sys import stdin
from collections import deque, defaultdict
input = stdin.readline
def solve(field):
BLANK, OBSTACLE, JUMP = 0, 1, 2
ans = 0 # ??????????????°???????... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203
"""
import sys
from sys import stdin
from collections import deque, defaultdict
input = stdin.readline
def solve(field):
BLANK, OBSTACLE, JUMP = 0, 1, 2
ans = 0 # ??????????????°???????... | 87 | 87 | 2,811 | 2,792 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203
"""
import sys
from sys import stdin
from collections import deque, defaultdict
input = stdin.readline
def solve(field):
BLANK, OBSTACLE, JUMP = 0, 1, 2
ans = 0 # ??????????????°???????????°
dy = [1, 1, 1] # ????... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203
"""
import sys
from sys import stdin
from collections import deque, defaultdict
input = stdin.readline
def solve(field):
BLANK, OBSTACLE, JUMP = 0, 1, 2
ans = 0 # ??????????????°???????????°
dy = [1, 1, 1] # ????... | false | 0 | [
"- for i in range(len(dx)):",
"+ for i in range(3): # ?????????3???len(dy)?????????",
"- if (ny >= y_limit - 1) and field[ny][nx] == BLANK:",
"- ans += num",
"- else:",
"- if (",
"- field[ny][nx] =... | false | 0.038998 | 0.039811 | 0.979582 | [
"s865490913",
"s303254178"
] |
u620084012 | p04034 | python | s204863322 | s980395299 | 731 | 615 | 4,784 | 61,656 | Accepted | Accepted | 15.87 | N, M = list(map(int, input().split()))
A = [1 for k in range(N)]
B = [0 for k in range(N)]
ans = 0
B[0] = 1
for k in range(M):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
if B[x] == 1 and A[x] >= 2:
A[x] -= 1
A[y] += 1
B[y] = 1
elif B[x] == 1 and A[x] ... | N, M = list(map(int,input().split()))
B = [list(map(int,input().split())) for k in range(M)]
H = [1]*N
E = [0]*N
E[0] = 1
for e in B:
x, y = e[0]-1, e[1]-1
if E[x] == 1:
if H[x] == 1:
E[x] = 0
E[y] = 1
else:
E[y] = 1
H[x] -= 1
H[y] += 1
... | 24 | 16 | 457 | 332 | N, M = list(map(int, input().split()))
A = [1 for k in range(N)]
B = [0 for k in range(N)]
ans = 0
B[0] = 1
for k in range(M):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
if B[x] == 1 and A[x] >= 2:
A[x] -= 1
A[y] += 1
B[y] = 1
elif B[x] == 1 and A[x] == 1:
A... | N, M = list(map(int, input().split()))
B = [list(map(int, input().split())) for k in range(M)]
H = [1] * N
E = [0] * N
E[0] = 1
for e in B:
x, y = e[0] - 1, e[1] - 1
if E[x] == 1:
if H[x] == 1:
E[x] = 0
E[y] = 1
else:
E[y] = 1
H[x] -= 1
H[y] += 1
print... | false | 33.333333 | [
"-A = [1 for k in range(N)]",
"-B = [0 for k in range(N)]",
"-ans = 0",
"-B[0] = 1",
"-for k in range(M):",
"- x, y = list(map(int, input().split()))",
"- x -= 1",
"- y -= 1",
"- if B[x] == 1 and A[x] >= 2:",
"- A[x] -= 1",
"- A[y] += 1",
"- B[y] = 1",
"- ... | false | 0.03309 | 0.034916 | 0.947715 | [
"s204863322",
"s980395299"
] |
u414920281 | p02726 | python | s484918761 | s226726376 | 1,830 | 107 | 9,224 | 74,328 | Accepted | Accepted | 94.15 | n,x,y=list(map(int,input().split()))
num=[0]*(n-1)
for i in range(n-1):
for j in range(i+1,n):
d=int(min(j-i,abs(x-j-1)+1+abs(y-1-i),abs(y-1-j)+1+abs(x-1-i)))
num[d-1]+=1
for i in range(n-1):
print((num[i])) | n,x,y=list(map(int,input().split()))
ans=[0]*n
for i in range(1,n):
for j in range(i+1,n+1):
ans[int(min(j-i,abs(x-i)+abs(y-j)+1))]+=1
for i in range(1,n):
print((ans[i])) | 8 | 7 | 230 | 185 | n, x, y = list(map(int, input().split()))
num = [0] * (n - 1)
for i in range(n - 1):
for j in range(i + 1, n):
d = int(
min(
j - i,
abs(x - j - 1) + 1 + abs(y - 1 - i),
abs(y - 1 - j) + 1 + abs(x - 1 - i),
)
)
num[d - 1]... | n, x, y = list(map(int, input().split()))
ans = [0] * n
for i in range(1, n):
for j in range(i + 1, n + 1):
ans[int(min(j - i, abs(x - i) + abs(y - j) + 1))] += 1
for i in range(1, n):
print((ans[i]))
| false | 12.5 | [
"-num = [0] * (n - 1)",
"-for i in range(n - 1):",
"- for j in range(i + 1, n):",
"- d = int(",
"- min(",
"- j - i,",
"- abs(x - j - 1) + 1 + abs(y - 1 - i),",
"- abs(y - 1 - j) + 1 + abs(x - 1 - i),",
"- )",
"- )"... | false | 0.075716 | 0.036296 | 2.086069 | [
"s484918761",
"s226726376"
] |
u075012704 | p03222 | python | s052471599 | s380586686 | 46 | 34 | 3,064 | 3,064 | Accepted | Accepted | 26.09 | H, W, K = list(map(int, input().split()))
mod = 10 ** 9 + 7
# 高さiにおいて左からj番目の棒にいる通り数
dp = [[0] * W for i in range(H + 1)]
dp[0][0] = 1
def pattern(w):
""" 幅wのあみだにおいて、validなものの通り数を返す """
# 例外処理
if w < 0:
return 1
cnt = 0
for i in range(2 ** w):
b = bin(2 ** w + i)[3... | from itertools import product
H, W, K = list(map(int, input().split()))
mod = 10 ** 9 + 7
# dp[i][j]:= 上からi番目, 左からj番目にいる通り数
dp = [[0] * W for i in range(H + 1)]
dp[0][0] = 1
def calc(x):
if x < 0:
return 1
ret = 0
for p in product(['0', '1'], repeat=x):
p = ''.join(p)
... | 39 | 35 | 851 | 792 | H, W, K = list(map(int, input().split()))
mod = 10**9 + 7
# 高さiにおいて左からj番目の棒にいる通り数
dp = [[0] * W for i in range(H + 1)]
dp[0][0] = 1
def pattern(w):
"""幅wのあみだにおいて、validなものの通り数を返す"""
# 例外処理
if w < 0:
return 1
cnt = 0
for i in range(2**w):
b = bin(2**w + i)[3:]
if "11" not in ... | from itertools import product
H, W, K = list(map(int, input().split()))
mod = 10**9 + 7
# dp[i][j]:= 上からi番目, 左からj番目にいる通り数
dp = [[0] * W for i in range(H + 1)]
dp[0][0] = 1
def calc(x):
if x < 0:
return 1
ret = 0
for p in product(["0", "1"], repeat=x):
p = "".join(p)
if "11" not in... | false | 10.25641 | [
"+from itertools import product",
"+",
"-# 高さiにおいて左からj番目の棒にいる通り数",
"+# dp[i][j]:= 上からi番目, 左からj番目にいる通り数",
"-def pattern(w):",
"- \"\"\"幅wのあみだにおいて、validなものの通り数を返す\"\"\"",
"- # 例外処理",
"- if w < 0:",
"+def calc(x):",
"+ if x < 0:",
"- cnt = 0",
"- for i in range(2**w):",
"- ... | false | 0.039906 | 0.034121 | 1.169534 | [
"s052471599",
"s380586686"
] |
u058781705 | p02996 | python | s739990469 | s195797941 | 1,766 | 1,291 | 89,816 | 88,152 | Accepted | Accepted | 26.9 | n = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(n)]
AB.sort(key=lambda x: (x[1], -x[0]))
time = 0
for a, b in AB:
time += a
if time > b:
print('No')
break
else:
print('Yes')
| n = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(n)]
AB.sort(key=lambda x: (x[1]))
time = 0
for a, b in AB:
time += a
if time > b:
print('No')
break
else:
print('Yes')
| 11 | 11 | 234 | 227 | n = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(n)]
AB.sort(key=lambda x: (x[1], -x[0]))
time = 0
for a, b in AB:
time += a
if time > b:
print("No")
break
else:
print("Yes")
| n = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(n)]
AB.sort(key=lambda x: (x[1]))
time = 0
for a, b in AB:
time += a
if time > b:
print("No")
break
else:
print("Yes")
| false | 0 | [
"-AB.sort(key=lambda x: (x[1], -x[0]))",
"+AB.sort(key=lambda x: (x[1]))"
] | false | 0.042155 | 0.041423 | 1.01767 | [
"s739990469",
"s195797941"
] |
u013617325 | p03363 | python | s449944550 | s848417240 | 193 | 174 | 44,252 | 31,576 | Accepted | Accepted | 9.84 | import collections
def main(N,A):
B=[0]
count = 0
for i in range(N):
T = A[i] + B[i]
B.append(T)
c = collections.Counter(B)
for i in range(len(c)):
k, v = c.popitem()
for z in range(v):
count += z
return print(count)
if __name__ ... | def main(N,A):
B=[0]
count = 0
for i in range(N):
T = A[i] + B[i]
#print('count:',count)
#
# B = [A[i] +B[i] for i in range(N)]
#
# count = [ count + 1 for m in range(len(B)) if B[i] - B[i-m] == 0]
# for m in range(len(B)):
# if ... | 23 | 60 | 409 | 1,153 | import collections
def main(N, A):
B = [0]
count = 0
for i in range(N):
T = A[i] + B[i]
B.append(T)
c = collections.Counter(B)
for i in range(len(c)):
k, v = c.popitem()
for z in range(v):
count += z
return print(count)
if __name__ == "__main__":
... | def main(N, A):
B = [0]
count = 0
for i in range(N):
T = A[i] + B[i]
# print('count:',count)
#
# B = [A[i] +B[i] for i in range(N)]
#
# count = [ count + 1 for m in range(len(B)) if B[i] - B[i-m] == 0]
# for m in range(len(B)):
# if T - B[m... | false | 61.666667 | [
"-import collections",
"-",
"-",
"+ # print('count:',count)",
"+ #",
"+ # B = [A[i] +B[i] for i in range(N)]",
"+ #",
"+ # count = [ count + 1 for m in range(len(B)) if B[i] - B[i-m] == 0]",
"+ # for m in range(len(B)):",
"+ # if T - B[m] == 0:"... | false | 0.038814 | 0.007427 | 5.226145 | [
"s449944550",
"s848417240"
] |
u645250356 | p03659 | python | s121559365 | s578350198 | 202 | 151 | 25,384 | 30,404 | Accepted | Accepted | 25.25 | from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdi... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | 20 | 17 | 606 | 514 | from collections import Counter, defaultdict
import sys, heapq, bisect, math, itertools, string, queue
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpl_str():
return list(sys.stdin.readline().split())
def inpln(n):
... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | false | 15 | [
"-from collections import Counter, defaultdict",
"-import sys, heapq, bisect, math, itertools, string, queue",
"+from collections import Counter, defaultdict, deque",
"+from heapq import heappop, heappush, heapify",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions,... | false | 0.057817 | 0.042556 | 1.358608 | [
"s121559365",
"s578350198"
] |
u855775311 | p02362 | python | s636102279 | s911175958 | 620 | 350 | 8,164 | 8,208 | Accepted | Accepted | 43.55 | import math
def main():
nvertices, nedges, s = list(map(int, input().split()))
E = []
for i in range(nedges):
u, v, w = list(map(int, input().split()))
E.append((u, v, w))
INF = float('inf')
d = [INF] * nvertices
d[s] = 0
for i in range(nvertices - 1):
... | import math
def main():
nvertices, nedges, s = list(map(int, input().split()))
E = []
for i in range(nedges):
u, v, w = list(map(int, input().split()))
E.append((u, v, w))
INF = float('inf')
weights = [INF] * nvertices
weights[s] = 0
for i in range(nvertices - 1... | 32 | 29 | 683 | 675 | import math
def main():
nvertices, nedges, s = list(map(int, input().split()))
E = []
for i in range(nedges):
u, v, w = list(map(int, input().split()))
E.append((u, v, w))
INF = float("inf")
d = [INF] * nvertices
d[s] = 0
for i in range(nvertices - 1):
for u, v, w i... | import math
def main():
nvertices, nedges, s = list(map(int, input().split()))
E = []
for i in range(nedges):
u, v, w = list(map(int, input().split()))
E.append((u, v, w))
INF = float("inf")
weights = [INF] * nvertices
weights[s] = 0
for i in range(nvertices - 1):
f... | false | 9.375 | [
"- d = [INF] * nvertices",
"- d[s] = 0",
"+ weights = [INF] * nvertices",
"+ weights[s] = 0",
"- if d[u] + w < d[v]:",
"- d[v] = d[u] + w",
"- for i in range(nvertices - 1):",
"- for u, v, w in E:",
"- if d[v] > d[u] + w:",
"- ... | false | 0.043339 | 0.04329 | 1.00112 | [
"s636102279",
"s911175958"
] |
u057964173 | p02831 | python | s334849781 | s705938561 | 47 | 35 | 5,560 | 5,044 | Accepted | Accepted | 25.53 | import sys
def input(): return sys.stdin.readline().strip()
import fractions
def resolve():
a, b = list(map(int, input().split()))
print(((a * b) // fractions.gcd(a, b)))
resolve()
| import sys
def input(): return sys.stdin.readline().strip()
def resolve():
a,b=list(map(int, input().split()))
import fractions
print((a*b//fractions.gcd(a,b)))
resolve() | 13 | 10 | 199 | 186 | import sys
def input():
return sys.stdin.readline().strip()
import fractions
def resolve():
a, b = list(map(int, input().split()))
print(((a * b) // fractions.gcd(a, b)))
resolve()
| import sys
def input():
return sys.stdin.readline().strip()
def resolve():
a, b = list(map(int, input().split()))
import fractions
print((a * b // fractions.gcd(a, b)))
resolve()
| false | 23.076923 | [
"-import fractions",
"-",
"-",
"- print(((a * b) // fractions.gcd(a, b)))",
"+ import fractions",
"+",
"+ print((a * b // fractions.gcd(a, b)))"
] | false | 0.05861 | 0.060453 | 0.969509 | [
"s334849781",
"s705938561"
] |
u420332509 | p02553 | python | s493278459 | s523853778 | 32 | 29 | 9,264 | 9,216 | Accepted | Accepted | 9.38 | def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(eval(input()))
def m_in(type_): return list(map(type_, input().split()))
def r_in(n, type_): return [type_(eval(input())) for _ in range(n)]
ans = None
def absmax(a, b):
if abs(a) > abs(b): return a
return b
def absmin(... | def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(eval(input()))
def m_in(type_): return list(map(type_, input().split()))
def r_in(n, type_): return [type_(eval(input())) for _ in range(n)]
ans = None
a, b, c, d = m_in(int)
ans = max(a*c, a*d, b*c, b*d)
print(ans)
| 35 | 10 | 831 | 290 | def l_in(type_):
return list(map(type_, input().split()))
def i_in():
return int(eval(input()))
def m_in(type_):
return list(map(type_, input().split()))
def r_in(n, type_):
return [type_(eval(input())) for _ in range(n)]
ans = None
def absmax(a, b):
if abs(a) > abs(b):
return a
... | def l_in(type_):
return list(map(type_, input().split()))
def i_in():
return int(eval(input()))
def m_in(type_):
return list(map(type_, input().split()))
def r_in(n, type_):
return [type_(eval(input())) for _ in range(n)]
ans = None
a, b, c, d = m_in(int)
ans = max(a * c, a * d, b * c, b * d)
pr... | false | 71.428571 | [
"-",
"-",
"-def absmax(a, b):",
"- if abs(a) > abs(b):",
"- return a",
"- return b",
"-",
"-",
"-def absmin(a, b):",
"- if abs(a) < abs(b):",
"- return a",
"- return b",
"-",
"-",
"-aa, bb, cc, dd = abs(a), abs(b), abs(c), abs(d)",
"-x, y = 0, 0",
"-abm = ab... | false | 0.048453 | 0.048226 | 1.004711 | [
"s493278459",
"s523853778"
] |
u389910364 | p03242 | python | s950046071 | s276313270 | 158 | 17 | 13,556 | 2,940 | Accepted | Accepted | 89.24 | from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import sys
sys.setrecursionlimit(10000)
INF = float('inf')
S = eval(input())
print((S.replace('1', ... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
n = sys.stdin.buffer.readline().decode().rstrip()
for a in n:
if a == '9':
print(1, end='')
if a == ... | 16 | 20 | 355 | 360 | from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
S = eval(input())
print((S.replace("1", "a").replace("9"... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
n = sys.stdin.buffer.readline().decode().rstrip()
for a in n:
if a == "9":
print(1, end="")
if a == "1":
print(9, end=... | false | 20 | [
"-from collections import Counter, deque",
"-from fractions import gcd",
"-from functools import lru_cache",
"-from functools import reduce",
"-import functools",
"-import heapq",
"-import itertools",
"-import math",
"-import numpy as np",
"+import os",
"-sys.setrecursionlimit(10000)",
"+if os... | false | 0.047703 | 0.046662 | 1.022323 | [
"s950046071",
"s276313270"
] |
u695811449 | p03354 | python | s144893169 | s704977073 | 1,049 | 871 | 35,276 | 35,324 | Accepted | Accepted | 16.97 | N, M = list(map(int,input().split()))
P=list(map(int,input().split()))
Group=[i for i in range(N+1)]
Swap=[None]*M
for i in range(M):
Swap[i]=sorted(map(int,input().split()))
def find(x):
while Group[x] != x:
x=Group[x]
return x
for i in range(M):
if find(Swap[i][1]) != find... | N,M = list(map(int,input().split()))
P = list(map(int,input().split()))
S = [list(map(int,input().split())) for i in range(M)]
class Union_find():
def __init__(self, N):
self.Group = [i for i in range(N)]
def find(self,x):# find(a)=find(b)のとき同じグループ
while self.Group[x] != x:
... | 30 | 32 | 704 | 745 | N, M = list(map(int, input().split()))
P = list(map(int, input().split()))
Group = [i for i in range(N + 1)]
Swap = [None] * M
for i in range(M):
Swap[i] = sorted(map(int, input().split()))
def find(x):
while Group[x] != x:
x = Group[x]
return x
for i in range(M):
if find(Swap[i][1]) != find... | N, M = list(map(int, input().split()))
P = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(M)]
class Union_find:
def __init__(self, N):
self.Group = [i for i in range(N)]
def find(self, x): # find(a)=find(b)のとき同じグループ
while self.Group[x] != x:
x... | false | 6.25 | [
"-Group = [i for i in range(N + 1)]",
"-Swap = [None] * M",
"-for i in range(M):",
"- Swap[i] = sorted(map(int, input().split()))",
"+S = [list(map(int, input().split())) for i in range(M)]",
"-def find(x):",
"- while Group[x] != x:",
"- x = Group[x]",
"- return x",
"+class Union_f... | false | 0.037098 | 0.093419 | 0.397114 | [
"s144893169",
"s704977073"
] |
u638456847 | p03557 | python | s945394803 | s889878734 | 376 | 256 | 33,344 | 26,776 | Accepted | Accepted | 31.91 | import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N = int(readline())
A = [int(i) for i in readline().split()]
B = [int(i) for i in readline().split()]
C = [int(i) for i in readline().split()]
A = np.array(sort... | import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N = int(readline())
A = np.array(readline().split(), dtype=np.int64)
B = np.array(readline().split(), dtype=np.int64)
C = np.array(readline().split(), dtype=np.int64)
... | 25 | 25 | 643 | 574 | import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N = int(readline())
A = [int(i) for i in readline().split()]
B = [int(i) for i in readline().split()]
C = [int(i) for i in readline().split()]
A = np.array(sorted(A), dtyp... | import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N = int(readline())
A = np.array(readline().split(), dtype=np.int64)
B = np.array(readline().split(), dtype=np.int64)
C = np.array(readline().split(), dtype=np.int64)
A.so... | false | 0 | [
"- A = [int(i) for i in readline().split()]",
"- B = [int(i) for i in readline().split()]",
"- C = [int(i) for i in readline().split()]",
"- A = np.array(sorted(A), dtype=np.int64)",
"- B = np.array(sorted(B), dtype=np.int64)",
"- C = np.array(sorted(C), dtype=np.int64)",
"+ A = np.... | false | 0.23376 | 0.18994 | 1.230701 | [
"s945394803",
"s889878734"
] |
u333945892 | p03323 | python | s099526204 | s647892209 | 29 | 18 | 4,212 | 2,940 | Accepted | Accepted | 37.93 | from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(eval(input()))
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())
at... | A,B = list(map(int, input().split()))
if A<=8 and B<=8:
print('Yay!')
else:
print(':(') | 16 | 5 | 425 | 93 | from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, datetime
sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7
def inp():
return int(eval(input()))
def inpl():
return list(map(int, input().split()))
def inpl_s():
return list... | A, B = list(map(int, input().split()))
if A <= 8 and B <= 8:
print("Yay!")
else:
print(":(")
| false | 68.75 | [
"-from collections import defaultdict, deque",
"-import sys, heapq, bisect, math, itertools, string, queue, datetime",
"-",
"-sys.setrecursionlimit(10**8)",
"-INF = float(\"inf\")",
"-mod = 10**9 + 7",
"-eps = 10**-7",
"-",
"-",
"-def inp():",
"- return int(eval(input()))",
"-",
"-",
"-... | false | 0.037674 | 0.033704 | 1.11781 | [
"s099526204",
"s647892209"
] |
u186838327 | p02973 | python | s693253730 | s219448786 | 572 | 197 | 55,000 | 84,384 | Accepted | Accepted | 65.56 | n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
B = []
import bisect
for i, a in enumerate(A):
if len(B) == 0:
B.append(-a)
else:
j = bisect.bisect_right(B, -a)
#print(j)
if j == len(B):
B.append(-a)
elif j == 0:
B[... | n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
A.reverse()
import bisect
B = [10**18]
for a in A:
i = bisect.bisect_right(B, a)
if 0 <= i < len(B):
B[i] = a
else:
B.append(a)
print((len(B))) | 20 | 14 | 395 | 238 | n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
B = []
import bisect
for i, a in enumerate(A):
if len(B) == 0:
B.append(-a)
else:
j = bisect.bisect_right(B, -a)
# print(j)
if j == len(B):
B.append(-a)
elif j == 0:
B[0] = -a
... | n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
A.reverse()
import bisect
B = [10**18]
for a in A:
i = bisect.bisect_right(B, a)
if 0 <= i < len(B):
B[i] = a
else:
B.append(a)
print((len(B)))
| false | 30 | [
"-B = []",
"+A.reverse()",
"-for i, a in enumerate(A):",
"- if len(B) == 0:",
"- B.append(-a)",
"+B = [10**18]",
"+for a in A:",
"+ i = bisect.bisect_right(B, a)",
"+ if 0 <= i < len(B):",
"+ B[i] = a",
"- j = bisect.bisect_right(B, -a)",
"- # print(j)",
... | false | 0.036422 | 0.101548 | 0.358669 | [
"s693253730",
"s219448786"
] |
u685983477 | p02608 | python | s884440942 | s747951711 | 741 | 110 | 9,424 | 74,416 | Accepted | Accepted | 85.16 | def main():
n = int(eval(input()))
res = [0]*(n+1)
for i in range(1,100):
for j in range(1,100):
for k in range(1,100):
tmp = i**2 + j**2 + k**2 + i*j + j*k + k*i
if(tmp<=n):
res[tmp]+=1
for i in range(1,n+1):... | def main():
n = int(eval(input()))
res = [0]*(n+1)
for i in range(1,100):
for j in range(1,100):
for k in range(1,100):
if(i**2 + j**2 + k**2 +i*j+j*k + k*i<=n):
res[i**2 + j**2 + k**2 +i*j+j*k + k*i]+=1
for i in ran... | 18 | 14 | 378 | 388 | def main():
n = int(eval(input()))
res = [0] * (n + 1)
for i in range(1, 100):
for j in range(1, 100):
for k in range(1, 100):
tmp = i**2 + j**2 + k**2 + i * j + j * k + k * i
if tmp <= n:
res[tmp] += 1
for i in range(1, n + 1):
... | def main():
n = int(eval(input()))
res = [0] * (n + 1)
for i in range(1, 100):
for j in range(1, 100):
for k in range(1, 100):
if i**2 + j**2 + k**2 + i * j + j * k + k * i <= n:
res[i**2 + j**2 + k**2 + i * j + j * k + k * i] += 1
for i in range(1... | false | 22.222222 | [
"- tmp = i**2 + j**2 + k**2 + i * j + j * k + k * i",
"- if tmp <= n:",
"- res[tmp] += 1",
"+ if i**2 + j**2 + k**2 + i * j + j * k + k * i <= n:",
"+ res[i**2 + j**2 + k**2 + i * j + j * k + k * i] += 1"
] | false | 0.936467 | 0.92955 | 1.007442 | [
"s884440942",
"s747951711"
] |
u102461423 | p02679 | python | s194188381 | s525580091 | 1,582 | 1,162 | 231,760 | 174,560 | Accepted | Accepted | 26.55 | import sys
from collections import defaultdict
from functools import lru_cache
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
P = 2 ** 61 - 1
N = int(readline())
m = list(map(int, read().split()))
A, B = list(zip(*list(zip(m, m)))... | import sys
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
P = 2 ** 61 - 1
N = int(readline())
m = list(map(int, read().split()))
A, B = list(zip(*list(zip(m, m))))
pow2 = [1] * (N + 10)
for n... | 66 | 64 | 1,312 | 1,240 | import sys
from collections import defaultdict
from functools import lru_cache
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
P = 2**61 - 1
N = int(readline())
m = list(map(int, read().split()))
A, B = list(zip(*list(zip(m, m))))
pow2 = [1] * (N... | import sys
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
P = 2**61 - 1
N = int(readline())
m = list(map(int, read().split()))
A, B = list(zip(*list(zip(m, m))))
pow2 = [1] * (N + 10)
for n in range(1, N + 10)... | false | 3.030303 | [
"-from functools import lru_cache",
"-@lru_cache(None)",
"- k *= pow(2, cnt, MOD)",
"+ k *= pow2[cnt]",
"- k *= pow(2, x, MOD) + pow(2, y, MOD) - 1",
"+ k *= pow2[x] + pow2[y] - 1"
] | false | 0.08248 | 0.043734 | 1.885936 | [
"s194188381",
"s525580091"
] |
u760794812 | p02984 | python | s438166982 | s043230593 | 140 | 109 | 14,092 | 20,612 | Accepted | Accepted | 22.14 | N = int(eval(input()))
List = list(map(int,input().split()))
Ans = [0]*N
for i in range(N):
if i % 2 == 0:
Ans[0] += List[i]
else:
Ans[0] -= List[i]
for i in range(1,N):
Ans[i] = 2*List[i-1] - Ans[i-1]
print((*Ans)) | N = int(eval(input()))
A = list(map(int,input().split()))
ans = [0]
for i in range(N):
if i%2==0:
ans[0] += A[i]
else:
ans[0] -= A[i]
for i in range(N-1):
ans.append(2*(A[i] - ans[i]//2))
print((*ans)) | 11 | 11 | 231 | 217 | N = int(eval(input()))
List = list(map(int, input().split()))
Ans = [0] * N
for i in range(N):
if i % 2 == 0:
Ans[0] += List[i]
else:
Ans[0] -= List[i]
for i in range(1, N):
Ans[i] = 2 * List[i - 1] - Ans[i - 1]
print((*Ans))
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = [0]
for i in range(N):
if i % 2 == 0:
ans[0] += A[i]
else:
ans[0] -= A[i]
for i in range(N - 1):
ans.append(2 * (A[i] - ans[i] // 2))
print((*ans))
| false | 0 | [
"-List = list(map(int, input().split()))",
"-Ans = [0] * N",
"+A = list(map(int, input().split()))",
"+ans = [0]",
"- Ans[0] += List[i]",
"+ ans[0] += A[i]",
"- Ans[0] -= List[i]",
"-for i in range(1, N):",
"- Ans[i] = 2 * List[i - 1] - Ans[i - 1]",
"-print((*Ans))",
"+ ... | false | 0.108048 | 0.113108 | 0.955262 | [
"s438166982",
"s043230593"
] |
u644907318 | p03737 | python | s406875443 | s908927802 | 176 | 29 | 38,384 | 8,932 | Accepted | Accepted | 83.52 | s1,s2,s3 = input().strip().split()
print((s1[0].upper()+s2[0].upper()+s3[0].upper())) | s1,s2,s3 = input().split()
s1 = s1.upper()
s2 = s2.upper()
s3 = s3.upper()
print((s1[0]+s2[0]+s3[0])) | 2 | 5 | 84 | 103 | s1, s2, s3 = input().strip().split()
print((s1[0].upper() + s2[0].upper() + s3[0].upper()))
| s1, s2, s3 = input().split()
s1 = s1.upper()
s2 = s2.upper()
s3 = s3.upper()
print((s1[0] + s2[0] + s3[0]))
| false | 60 | [
"-s1, s2, s3 = input().strip().split()",
"-print((s1[0].upper() + s2[0].upper() + s3[0].upper()))",
"+s1, s2, s3 = input().split()",
"+s1 = s1.upper()",
"+s2 = s2.upper()",
"+s3 = s3.upper()",
"+print((s1[0] + s2[0] + s3[0]))"
] | false | 0.080662 | 0.043975 | 1.834294 | [
"s406875443",
"s908927802"
] |
u667084803 | p03132 | python | s989572717 | s583930588 | 1,355 | 1,097 | 74,104 | 11,040 | Accepted | Accepted | 19.04 | #https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_d
#2019-02-10
#DP
L = int(eval(input()))
A = [int(eval(input())) for i in range(L)]
DP = [[0 for i in range(5)] for j in range(L+1)]
def cost(s, a):
if s == 0 or s == 4:
return a
elif s == 1 or s == 3:
... | #https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_d
#2019-02-10
#DP
L = int(eval(input()))
A = [int(eval(input())) for i in range(L)]
DP = [0 for i in range(5)]
def cost(s, a):
if s == 0 or s == 4:
return a
elif s == 1 or s == 3:
if a > 0:
... | 32 | 33 | 707 | 650 | # https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_d
# 2019-02-10
# DP
L = int(eval(input()))
A = [int(eval(input())) for i in range(L)]
DP = [[0 for i in range(5)] for j in range(L + 1)]
def cost(s, a):
if s == 0 or s == 4:
return a
elif s == 1 or s == 3:
if a > 0... | # https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_d
# 2019-02-10
# DP
L = int(eval(input()))
A = [int(eval(input())) for i in range(L)]
DP = [0 for i in range(5)]
def cost(s, a):
if s == 0 or s == 4:
return a
elif s == 1 or s == 3:
if a > 0:
return a %... | false | 3.030303 | [
"-DP = [[0 for i in range(5)] for j in range(L + 1)]",
"+DP = [0 for i in range(5)]",
"+ n = [min(DP[: i + 1]) for i in range(5)]",
"- DP[i + 1][0] = min(DP[i][:1]) + cost(0, a)",
"- DP[i + 1][1] = min(DP[i][:2]) + cost(1, a)",
"- DP[i + 1][2] = min(DP[i][:3]) + cost(2, a)",
"- DP[i + 1][... | false | 0.042899 | 0.042652 | 1.005773 | [
"s989572717",
"s583930588"
] |
u952467214 | p03167 | python | s306890503 | s079873989 | 1,599 | 794 | 43,628 | 47,112 | Accepted | Accepted | 50.34 | import sys
input = sys.stdin.readline
H, W = list(map(int, input().split()))
MOD = 10 ** 9 + 7
A = [eval(input()) for _ in range(H)]
dp = [[0]*W for _ in range(H)]
dp[0][0] = 1
for y in range(H):
for x in range(W):
if y+1 < H and A[y+1][x] == '.':
dp[y+1][x] += dp[y][x]
dp[y+1][x] = ... | p = 10**9+7
h, w = list(map(int, input().split()))
maze = [[-1 for i in range(w)] for j in range(h)]
ans = 0
for i in range(h):
maze[i] = eval(input())
dp = [[0]*(w+1) for _ in range(h+1)]
dp[1][1] = 1
for i in range(1,h+1):
for j in range(1,w+1):
if maze[i-1][j-1] == '.':
d... | 21 | 20 | 454 | 382 | import sys
input = sys.stdin.readline
H, W = list(map(int, input().split()))
MOD = 10**9 + 7
A = [eval(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for y in range(H):
for x in range(W):
if y + 1 < H and A[y + 1][x] == ".":
dp[y + 1][x] += dp[y][x]
dp[y +... | p = 10**9 + 7
h, w = list(map(int, input().split()))
maze = [[-1 for i in range(w)] for j in range(h)]
ans = 0
for i in range(h):
maze[i] = eval(input())
dp = [[0] * (w + 1) for _ in range(h + 1)]
dp[1][1] = 1
for i in range(1, h + 1):
for j in range(1, w + 1):
if maze[i - 1][j - 1] == ".":
... | false | 4.761905 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-H, W = list(map(int, input().split()))",
"-MOD = 10**9 + 7",
"-A = [eval(input()) for _ in range(H)]",
"-dp = [[0] * W for _ in range(H)]",
"-dp[0][0] = 1",
"-for y in range(H):",
"- for x in range(W):",
"- if y + 1 < H and A[y + 1][... | false | 0.053376 | 0.037409 | 1.426821 | [
"s306890503",
"s079873989"
] |
u498575211 | p02910 | python | s983586804 | s028757551 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | S = eval(input())
k = 'Yes'
for i in range(len(S)):
if i % 2 == 0:
if S[i] == 'L':
k = 'No'
break
else:
if S[i] == 'R':
k = 'No'
break
print(k)
| S = eval(input())
result = 'Yes'
for i in range(1, len(S)+1):
#print(i)
if (i % 2 == 0 and S[i-1] == "R") or (i % 2 == 1 and S[i-1] == "L"):
result = 'No'
break
print(result)
| 14 | 10 | 173 | 208 | S = eval(input())
k = "Yes"
for i in range(len(S)):
if i % 2 == 0:
if S[i] == "L":
k = "No"
break
else:
if S[i] == "R":
k = "No"
break
print(k)
| S = eval(input())
result = "Yes"
for i in range(1, len(S) + 1):
# print(i)
if (i % 2 == 0 and S[i - 1] == "R") or (i % 2 == 1 and S[i - 1] == "L"):
result = "No"
break
print(result)
| false | 28.571429 | [
"-k = \"Yes\"",
"-for i in range(len(S)):",
"- if i % 2 == 0:",
"- if S[i] == \"L\":",
"- k = \"No\"",
"- break",
"- else:",
"- if S[i] == \"R\":",
"- k = \"No\"",
"- break",
"-print(k)",
"+result = \"Yes\"",
"+for i in range(1,... | false | 0.043744 | 0.04566 | 0.958034 | [
"s983586804",
"s028757551"
] |
u047796752 | p03148 | python | s244054152 | s345530570 | 617 | 520 | 84,700 | 72,028 | Accepted | Accepted | 15.72 | import sys
input = sys.stdin.readline
from collections import *
from heapq import *
N, K = list(map(int, input().split()))
td = [tuple(map(int, input().split())) for _ in range(N)]
td.sort(key=lambda t: t[1], reverse=True)
d = defaultdict(list)
now = 0
for ti, di in td[:K]:
d[ti].append(di)
now +... | import sys
input = sys.stdin.readline
from collections import *
N, K = list(map(int, input().split()))
td = [tuple(map(int, input().split())) for _ in range(N)]
td.sort(key=lambda t: t[1], reverse=True)
d = defaultdict(list)
now = 0
for ti, di in td[:K]:
d[ti].append(di)
now += di
rem = []
f... | 43 | 41 | 780 | 775 | import sys
input = sys.stdin.readline
from collections import *
from heapq import *
N, K = list(map(int, input().split()))
td = [tuple(map(int, input().split())) for _ in range(N)]
td.sort(key=lambda t: t[1], reverse=True)
d = defaultdict(list)
now = 0
for ti, di in td[:K]:
d[ti].append(di)
now += di
remove =... | import sys
input = sys.stdin.readline
from collections import *
N, K = list(map(int, input().split()))
td = [tuple(map(int, input().split())) for _ in range(N)]
td.sort(key=lambda t: t[1], reverse=True)
d = defaultdict(list)
now = 0
for ti, di in td[:K]:
d[ti].append(di)
now += di
rem = []
for k in list(d.key... | false | 4.651163 | [
"-from heapq import *",
"-remove = []",
"+rem = []",
"- heappush(remove, d[k][i])",
"-s = set(list(d.keys()))",
"+ rem.append(d[k][i])",
"-for ti, di in td:",
"- if ti in s:",
"- continue",
"- s.add(ti)",
"- heappush(add, -di)",
"-x = len(d)",
"-ans = now + x**2... | false | 0.038909 | 0.067765 | 0.574168 | [
"s244054152",
"s345530570"
] |
u029000441 | p02756 | python | s952802558 | s929224376 | 1,082 | 139 | 51,840 | 92,004 | Accepted | Accepted | 87.15 | import sys
S =eval(input())
Q=int(eval(input()))
orders=[]
for line in sys.stdin.readlines():
orders.append(line.rstrip().split(" "))
dire=1
right=""
left=""
center=""
for order in orders:
if order[0]=="1":
dire=dire*(-1)
center=right
right=left
left=center
el... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
fro... | 35 | 62 | 754 | 1,672 | import sys
S = eval(input())
Q = int(eval(input()))
orders = []
for line in sys.stdin.readlines():
orders.append(line.rstrip().split(" "))
dire = 1
right = ""
left = ""
center = ""
for order in orders:
if order[0] == "1":
dire = dire * (-1)
center = right
right = left
left = cen... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heap... | false | 43.548387 | [
"-import sys",
"+def main():",
"+ import sys",
"-S = eval(input())",
"-Q = int(eval(input()))",
"-orders = []",
"-for line in sys.stdin.readlines():",
"- orders.append(line.rstrip().split(\" \"))",
"-dire = 1",
"-right = \"\"",
"-left = \"\"",
"-center = \"\"",
"-for order in orders:",... | false | 0.058174 | 0.042959 | 1.354174 | [
"s952802558",
"s929224376"
] |
u476604182 | p03332 | python | s668071891 | s092715611 | 1,841 | 486 | 124,100 | 127,560 | Accepted | Accepted | 73.6 | 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 = 998244353 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.... | 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 = 998244353 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.... | 27 | 27 | 596 | 612 | 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 = 998244353 # 出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) % mod)
inverse.append((-... | 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 = 998244353 # 出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) % mod)
inverse.append((-... | false | 0 | [
"- m = K - A * i",
"- if m % B != 0:",
"+ if (K - A * i) % B != 0:",
"- ans += cmb(N, i, mod) * cmb(N, m // B, mod)",
"+ j = (K - A * i) // B",
"+ m = cmb(N, i, mod) * cmb(N, j, mod) % mod",
"+ ans += m"
] | false | 2.842523 | 1.495832 | 1.900296 | [
"s668071891",
"s092715611"
] |
u256678932 | p02416 | python | s144410896 | s630087057 | 30 | 20 | 7,628 | 5,608 | Accepted | Accepted | 33.33 | from sys import stdin
for l in stdin:
l = l.rstrip()
if 0 == int(l):
break
print((sum([int(ch) for ch in l]))) | def main():
while True:
num = eval(input())
if num == "0":
break
print((sum([int(x) for x in num])))
if __name__ == '__main__':
main()
| 8 | 11 | 137 | 184 | from sys import stdin
for l in stdin:
l = l.rstrip()
if 0 == int(l):
break
print((sum([int(ch) for ch in l])))
| def main():
while True:
num = eval(input())
if num == "0":
break
print((sum([int(x) for x in num])))
if __name__ == "__main__":
main()
| false | 27.272727 | [
"-from sys import stdin",
"+def main():",
"+ while True:",
"+ num = eval(input())",
"+ if num == \"0\":",
"+ break",
"+ print((sum([int(x) for x in num])))",
"-for l in stdin:",
"- l = l.rstrip()",
"- if 0 == int(l):",
"- break",
"- print((sum... | false | 0.04985 | 0.050199 | 0.99305 | [
"s144410896",
"s630087057"
] |
u401452016 | p03031 | python | s539471220 | s119649114 | 32 | 24 | 3,316 | 3,316 | Accepted | Accepted | 25 | #ABC 128C
def main():
import sys
import itertools as ite
N, M = list(map(int, sys.stdin.readline().split()))
Light = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]
P = list(map(int, sys.stdin.readline().split()))
S = list(ite.product([0,1], repeat=N)) #スイッチの状態
ans ... | #ABC128C
def main():
import sys, itertools as ite
N, M = list(map(int, sys.stdin.readline().split()))
KS = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]
P = tuple(map(int, sys.stdin.readline().split()))
#print(KS)
#bit全探索
SWS = tuple(ite.product([0,1], repea... | 21 | 32 | 656 | 704 | # ABC 128C
def main():
import sys
import itertools as ite
N, M = list(map(int, sys.stdin.readline().split()))
Light = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]
P = list(map(int, sys.stdin.readline().split()))
S = list(ite.product([0, 1], repeat=N)) # スイッチの状態
ans = 0... | # ABC128C
def main():
import sys, itertools as ite
N, M = list(map(int, sys.stdin.readline().split()))
KS = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]
P = tuple(map(int, sys.stdin.readline().split()))
# print(KS)
# bit全探索
SWS = tuple(ite.product([0, 1], repeat=N))
... | false | 34.375 | [
"-# ABC 128C",
"+# ABC128C",
"- import sys",
"- import itertools as ite",
"+ import sys, itertools as ite",
"- Light = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]",
"- P = list(map(int, sys.stdin.readline().split()))",
"- S = list(ite.product([0, 1], repeat=N)) ... | false | 0.043472 | 0.037514 | 1.158847 | [
"s539471220",
"s119649114"
] |
u156815136 | p02899 | python | s186714170 | s257935918 | 218 | 173 | 23,480 | 27,252 | Accepted | Accepted | 20.64 | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも!!
#
#
mod = 10**9 + 7
def readInts():
return list(map(int,input().split()))
def main():
n = int(eval(input()))
... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counte... | 20 | 39 | 440 | 910 | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list
# from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも!!
#
#
mod = 10**9 + 7
def readInts():
return list(map(int, input().split()))
def main():
n = int(eval(input()))
A = li... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict, Co... | false | 48.717949 | [
"-# aa = collections.Counter(a) # list to list",
"-# from itertools import combinations # (string,3) 3回",
"+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]",
"+from fractions import gcd",
"+from itertools import combinations, permutations, accumulate # (string,3) 3回",
... | false | 0.037392 | 0.04093 | 0.91356 | [
"s186714170",
"s257935918"
] |
u230621983 | p03821 | python | s205931236 | s008933550 | 384 | 256 | 11,048 | 28,168 | Accepted | Accepted | 33.33 | n = int(eval(input()))
a_li = []
b_li = []
for _ in range(n):
a,b = list(map(int, input().split()))
a_li.append(a)
b_li.append(b)
cnt = 0
for i in range(1,n+1):
if (a_li[-i]+cnt) % b_li[-i] != 0:
cnt += b_li[-i] - ((a_li[-i]+cnt) % b_li[-i])
print(cnt)
| n = int(eval(input()))
cnt = 0
ab_l = [list(map(int, input().split())) for _ in range(n)]
for ab in ab_l[::-1]:
a, b = ab[0], ab[1]
a += cnt
if a % b != 0:
cnt += b - a%b
print(cnt) | 13 | 9 | 278 | 203 | n = int(eval(input()))
a_li = []
b_li = []
for _ in range(n):
a, b = list(map(int, input().split()))
a_li.append(a)
b_li.append(b)
cnt = 0
for i in range(1, n + 1):
if (a_li[-i] + cnt) % b_li[-i] != 0:
cnt += b_li[-i] - ((a_li[-i] + cnt) % b_li[-i])
print(cnt)
| n = int(eval(input()))
cnt = 0
ab_l = [list(map(int, input().split())) for _ in range(n)]
for ab in ab_l[::-1]:
a, b = ab[0], ab[1]
a += cnt
if a % b != 0:
cnt += b - a % b
print(cnt)
| false | 30.769231 | [
"-a_li = []",
"-b_li = []",
"-for _ in range(n):",
"- a, b = list(map(int, input().split()))",
"- a_li.append(a)",
"- b_li.append(b)",
"-for i in range(1, n + 1):",
"- if (a_li[-i] + cnt) % b_li[-i] != 0:",
"- cnt += b_li[-i] - ((a_li[-i] + cnt) % b_li[-i])",
"+ab_l = [list(map(... | false | 0.0657 | 0.068422 | 0.960217 | [
"s205931236",
"s008933550"
] |
u856775981 | p02725 | python | s110878142 | s896897494 | 231 | 83 | 34,168 | 26,444 | Accepted | Accepted | 64.07 | import numpy as np
K, N = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
print((K - max(np.diff(np.append(a, a[0] + K)))))
| from operator import sub
K, N = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(a[0] + K)
print((K - max(list(map(sub, a[1:], a[:-1]))))) | 6 | 7 | 159 | 172 | import numpy as np
K, N = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
print((K - max(np.diff(np.append(a, a[0] + K)))))
| from operator import sub
K, N = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(a[0] + K)
print((K - max(list(map(sub, a[1:], a[:-1])))))
| false | 14.285714 | [
"-import numpy as np",
"+from operator import sub",
"-a = np.array(list(map(int, input().split())))",
"-print((K - max(np.diff(np.append(a, a[0] + K)))))",
"+a = list(map(int, input().split()))",
"+a.append(a[0] + K)",
"+print((K - max(list(map(sub, a[1:], a[:-1])))))"
] | false | 0.400917 | 0.076433 | 5.245319 | [
"s110878142",
"s896897494"
] |
u729133443 | p03666 | python | s002127861 | s731206844 | 259 | 205 | 3,060 | 3,060 | Accepted | Accepted | 20.85 | n,a,b,c,d=list(map(int,input().split()))
f=0
for i in range(n):f|=i*c-(~i+n)*d<=b-a<=i*d-(~i+n)*c
print(('NYOE S'[f::2])) | n,a,b,c,d=list(map(int,input().split()));print(('NYOE S'[any(c*i-d*(~i+n)<=b-a<=d*i-c*(~i+n)for i in range(n))::2])) | 4 | 1 | 116 | 108 | n, a, b, c, d = list(map(int, input().split()))
f = 0
for i in range(n):
f |= i * c - (~i + n) * d <= b - a <= i * d - (~i + n) * c
print(("NYOE S"[f::2]))
| n, a, b, c, d = list(map(int, input().split()))
print(
(
"NYOE S"[
any(
c * i - d * (~i + n) <= b - a <= d * i - c * (~i + n) for i in range(n)
) :: 2
]
)
)
| false | 75 | [
"-f = 0",
"-for i in range(n):",
"- f |= i * c - (~i + n) * d <= b - a <= i * d - (~i + n) * c",
"-print((\"NYOE S\"[f::2]))",
"+print(",
"+ (",
"+ \"NYOE S\"[",
"+ any(",
"+ c * i - d * (~i + n) <= b - a <= d * i - c * (~i + n) for i in range(n)",
"+ ... | false | 0.135296 | 0.096901 | 1.396224 | [
"s002127861",
"s731206844"
] |
u952708174 | p02680 | python | s901557374 | s607047763 | 2,751 | 2,447 | 713,648 | 713,580 | Accepted | Accepted | 11.05 | def f_single_dot():
# https://atcoder.jp/contests/abc168/submissions/13368489
import sys
from collections import deque
input = sys.stdin.readline
N, M = [int(i) for i in input().split()]
x_set, y_set = set([0]), set([0]) # 重複を除いた xy 座標の一覧 (座標圧縮に必要)
vertical_lines = []
for _ ... | def f_single_dot():
# https://atcoder.jp/contests/abc168/submissions/13368489
import sys
from collections import deque
input = sys.stdin.readline
N, M = [int(i) for i in input().split()]
x_set, y_set = set([0]), set([0]) # 重複を除いた xy 座標の一覧 (座標圧縮に必要)
vertical_lines = []
for _ ... | 73 | 73 | 2,551 | 2,551 | def f_single_dot():
# https://atcoder.jp/contests/abc168/submissions/13368489
import sys
from collections import deque
input = sys.stdin.readline
N, M = [int(i) for i in input().split()]
x_set, y_set = set([0]), set([0]) # 重複を除いた xy 座標の一覧 (座標圧縮に必要)
vertical_lines = []
for _ in range(N)... | def f_single_dot():
# https://atcoder.jp/contests/abc168/submissions/13368489
import sys
from collections import deque
input = sys.stdin.readline
N, M = [int(i) for i in input().split()]
x_set, y_set = set([0]), set([0]) # 重複を除いた xy 座標の一覧 (座標圧縮に必要)
vertical_lines = []
for _ in range(N)... | false | 0 | [
"- grid = [[0] * (len(x_set) * 2 - 1) for _ in range(len(y_set) * 2 - 1)]",
"+ grid = [[0] * (len(y_set) * 2 - 1) for _ in range(len(x_set) * 2 - 1)]",
"- grid[c][x] = 1",
"+ grid[x][c] = 1",
"- grid[y][d] = 1",
"+ grid[d][y] = 1",
"- used = [[0] * le... | false | 0.050362 | 0.049778 | 1.011732 | [
"s901557374",
"s607047763"
] |
u678167152 | p04020 | python | s392552538 | s594395967 | 202 | 162 | 7,072 | 13,044 | Accepted | Accepted | 19.8 | def solve():
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
ans = 0
for a in A:
ans += a//2
prev = 0
for a in A:
new = a%2
if prev == 1:
if new == 1:
ans += 1
elif a>0:
prev = 1
... | def solve():
ans = 0
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
rem = 0
for i in range(N):
ans += (A[i]+rem)//2
if A[i]>0:
rem = (A[i]+rem)%2
else:
rem = 0
return ans
print((solve())) | 19 | 13 | 403 | 240 | def solve():
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
ans = 0
for a in A:
ans += a // 2
prev = 0
for a in A:
new = a % 2
if prev == 1:
if new == 1:
ans += 1
elif a > 0:
prev = 1
e... | def solve():
ans = 0
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
rem = 0
for i in range(N):
ans += (A[i] + rem) // 2
if A[i] > 0:
rem = (A[i] + rem) % 2
else:
rem = 0
return ans
print((solve()))
| false | 31.578947 | [
"+ ans = 0",
"- ans = 0",
"- for a in A:",
"- ans += a // 2",
"- prev = 0",
"- for a in A:",
"- new = a % 2",
"- if prev == 1:",
"- if new == 1:",
"- ans += 1",
"- elif a > 0:",
"- prev = 1",
"- ... | false | 0.087878 | 0.043191 | 2.034652 | [
"s392552538",
"s594395967"
] |
u266874640 | p03043 | python | s372814907 | s600175286 | 47 | 34 | 5,348 | 3,060 | Accepted | Accepted | 27.66 | N, K = list(map(int,input().split()))
ans = 0
if K <= N:
ans += (1/N)*(N-K+1)
dp = [0] + [1/N] * K
else:
dp = [0] + [1/N] * N + [0] * (K-N)
for i in range(1,K):
if i % 2 == 0:
dp[i] += dp[i//2] * (1/2)
if K % 2 == 0:
ans += sum(dp[K//2:K])*(1/2)
else:
ans += sum(dp[K//2+1:K]... | import math
N,K = list(map(int,input().split()))
ans = 0
for i in range(1,N+1):
if i >= K:
ans += (1/N)
continue
X = int(math.log((K/i), 2))
if (K/i) % 2**X == 0:
pass
else:
X += 1
ans += (1/N) * (1/2) ** X
print(ans)
| 15 | 15 | 334 | 279 | N, K = list(map(int, input().split()))
ans = 0
if K <= N:
ans += (1 / N) * (N - K + 1)
dp = [0] + [1 / N] * K
else:
dp = [0] + [1 / N] * N + [0] * (K - N)
for i in range(1, K):
if i % 2 == 0:
dp[i] += dp[i // 2] * (1 / 2)
if K % 2 == 0:
ans += sum(dp[K // 2 : K]) * (1 / 2)
else:
ans += s... | import math
N, K = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
if i >= K:
ans += 1 / N
continue
X = int(math.log((K / i), 2))
if (K / i) % 2**X == 0:
pass
else:
X += 1
ans += (1 / N) * (1 / 2) ** X
print(ans)
| false | 0 | [
"+import math",
"+",
"-if K <= N:",
"- ans += (1 / N) * (N - K + 1)",
"- dp = [0] + [1 / N] * K",
"-else:",
"- dp = [0] + [1 / N] * N + [0] * (K - N)",
"-for i in range(1, K):",
"- if i % 2 == 0:",
"- dp[i] += dp[i // 2] * (1 / 2)",
"-if K % 2 == 0:",
"- ans += sum(dp[K /... | false | 0.039759 | 0.056072 | 0.709079 | [
"s372814907",
"s600175286"
] |
u454022848 | p02388 | python | s769698447 | s922047638 | 30 | 10 | 6,724 | 6,368 | Accepted | Accepted | 66.67 | print((int(eval(input()))**3)) | print((input()**3)) | 1 | 1 | 22 | 17 | print((int(eval(input())) ** 3))
| print((input() ** 3))
| false | 0 | [
"-print((int(eval(input())) ** 3))",
"+print((input() ** 3))"
] | false | 0.080245 | 0.042433 | 1.891106 | [
"s769698447",
"s922047638"
] |
u054825571 | p02923 | python | s334148281 | s551550491 | 227 | 72 | 63,984 | 20,328 | Accepted | Accepted | 68.28 | N=int(eval(input()))
H=list(map(int, input().split()))
s=0
t=0
pre=H[0]
for h in H[1:]:
if h <= pre:
t+=1
else:
s=max(s,t)
t=0
pre = h
print((max(s,t))) | N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
s = 0
for i in range(N-1):
if H[i] >= H[i+1]:
s+=1
else:
ans = max(ans, s)
s = 0
ans = max(ans, s)
print(ans) | 13 | 13 | 174 | 201 | N = int(eval(input()))
H = list(map(int, input().split()))
s = 0
t = 0
pre = H[0]
for h in H[1:]:
if h <= pre:
t += 1
else:
s = max(s, t)
t = 0
pre = h
print((max(s, t)))
| N = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
s = 0
for i in range(N - 1):
if H[i] >= H[i + 1]:
s += 1
else:
ans = max(ans, s)
s = 0
ans = max(ans, s)
print(ans)
| false | 0 | [
"+ans = 0",
"-t = 0",
"-pre = H[0]",
"-for h in H[1:]:",
"- if h <= pre:",
"- t += 1",
"+for i in range(N - 1):",
"+ if H[i] >= H[i + 1]:",
"+ s += 1",
"- s = max(s, t)",
"- t = 0",
"- pre = h",
"-print((max(s, t)))",
"+ ans = max(ans, s)",
"+ ... | false | 0.044378 | 0.044584 | 0.995373 | [
"s334148281",
"s551550491"
] |
u411203878 | p02861 | python | s140400106 | s122870372 | 170 | 114 | 38,384 | 75,128 | Accepted | Accepted | 32.94 | n=int(eval(input()))
l=[[int(i) for i in input().split()] for j in range(n)]
d=[]
for i in range(n):
for j in range(i):
d.append(((l[i][0]-l[j][0])**2+(l[i][1]-l[j][1])**2)**0.5)
print((sum(d)*(n-1)/len(d))) | import itertools
n=int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
narabi = [0+i for i in range(n)]
ans = 0
count = 0
for v in itertools.permutations(narabi, n):
count += 1
tmp_len = 0
for i in range(1,n):
x, y = abs... | 8 | 21 | 213 | 452 | n = int(eval(input()))
l = [[int(i) for i in input().split()] for j in range(n)]
d = []
for i in range(n):
for j in range(i):
d.append(((l[i][0] - l[j][0]) ** 2 + (l[i][1] - l[j][1]) ** 2) ** 0.5)
print((sum(d) * (n - 1) / len(d)))
| import itertools
n = int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
narabi = [0 + i for i in range(n)]
ans = 0
count = 0
for v in itertools.permutations(narabi, n):
count += 1
tmp_len = 0
for i in range(1, n):
x, y = (
ab... | false | 61.904762 | [
"+import itertools",
"+",
"-l = [[int(i) for i in input().split()] for j in range(n)]",
"-d = []",
"-for i in range(n):",
"- for j in range(i):",
"- d.append(((l[i][0] - l[j][0]) ** 2 + (l[i][1] - l[j][1]) ** 2) ** 0.5)",
"-print((sum(d) * (n - 1) / len(d)))",
"+ab = []",
"+for _ in rang... | false | 0.085289 | 0.037472 | 2.276076 | [
"s140400106",
"s122870372"
] |
u312025627 | p03351 | python | s164174761 | s550036047 | 177 | 69 | 38,256 | 61,960 | Accepted | Accepted | 61.02 | def main():
A = [int(i) for i in input().split()]
if abs(A[0] - A[2]) <= A[3] or (abs(A[0] - A[1]) <= A[3] and abs(A[1] - A[2]) <= A[3]):
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
| def main():
a, b, c, d = (int(i) for i in input().split())
if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
| 10 | 10 | 246 | 222 | def main():
A = [int(i) for i in input().split()]
if abs(A[0] - A[2]) <= A[3] or (
abs(A[0] - A[1]) <= A[3] and abs(A[1] - A[2]) <= A[3]
):
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| def main():
a, b, c, d = (int(i) for i in input().split())
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| false | 0 | [
"- A = [int(i) for i in input().split()]",
"- if abs(A[0] - A[2]) <= A[3] or (",
"- abs(A[0] - A[1]) <= A[3] and abs(A[1] - A[2]) <= A[3]",
"- ):",
"+ a, b, c, d = (int(i) for i in input().split())",
"+ if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):"
] | false | 0.061029 | 0.042928 | 1.421641 | [
"s164174761",
"s550036047"
] |
u600402037 | p03579 | python | s555965853 | s657541061 | 634 | 575 | 42,128 | 42,124 | Accepted | Accepted | 9.31 | import sys
sys.setrecursionlimit(10 ** 7)
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
graph = [[] for _ in range(N)]
for a, b in AB:
graph[a-1].append(b-1)
graph[b-1].append(a-1)
# 二部グラフかどうかの判定
color = [None] * N
color[0] = 0
q = [0]
while q:... | # C - 3 Steps
import sys
sys.setrecursionlimit(10 ** 7)
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
graph = [[] for _ in range(N)]
for a, b in AB:
graph[a-1].append(b-1)
graph[b-1].append(a-1)
# 二部グラフかどうかの判定
colors = [None] * N
colors[0] = 0
... | 35 | 36 | 706 | 729 | import sys
sys.setrecursionlimit(10**7)
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
graph = [[] for _ in range(N)]
for a, b in AB:
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
# 二部グラフかどうかの判定
color = [None] * N
color[0] = 0
q = [0]
while q:
x = q.... | # C - 3 Steps
import sys
sys.setrecursionlimit(10**7)
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
graph = [[] for _ in range(N)]
for a, b in AB:
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
# 二部グラフかどうかの判定
colors = [None] * N
colors[0] = 0
q = [0]
whi... | false | 2.777778 | [
"+# C - 3 Steps",
"-color = [None] * N",
"-color[0] = 0",
"+colors = [None] * N",
"+colors[0] = 0",
"- if color[y] is None:",
"- color[y] = 1 - color[x]",
"+ if colors[y] is None:",
"+ colors[y] = 1 - colors[x]",
"-is_bg = all(color[a - 1] != color[b - 1] for a,... | false | 0.049061 | 0.04799 | 1.0223 | [
"s555965853",
"s657541061"
] |
u698693989 | p02388 | python | s379607745 | s182929874 | 30 | 20 | 7,640 | 5,572 | Accepted | Accepted | 33.33 | x = int(eval(input()))
print((x**3)) | n=int(eval(input()));
print((n**3))
| 2 | 2 | 29 | 29 | x = int(eval(input()))
print((x**3))
| n = int(eval(input()))
print((n**3))
| false | 0 | [
"-x = int(eval(input()))",
"-print((x**3))",
"+n = int(eval(input()))",
"+print((n**3))"
] | false | 0.037164 | 0.032388 | 1.14745 | [
"s379607745",
"s182929874"
] |
u197968862 | p03163 | python | s962483579 | s061742261 | 688 | 577 | 171,784 | 217,964 | Accepted | Accepted | 16.13 | n, w = list(map(int,input().split()))
wv = [list(map(int,input().split())) for _ in range(n)]
dp = [[0 for _ in range(w+1)] for _ in range(n+1)]
for i in range(n):
for j in range(w+1):
if wv[i][0] <= j:
dp[i+1][j] = max(dp[i][j-wv[i][0]]+wv[i][1],dp[i][j])
else:
d... | n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp = [[0 for _ in range(w+1)] for _ in range(n+1)]
for i in range(n):
for j in range(w+1):
if j - wv[i][0] >= 0:
dp[i+1][j] = max(dp[i][j - wv[i][0]] + wv[i][1], dp[i][j])
else:
... | 13 | 13 | 356 | 384 | n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]
for i in range(n):
for j in range(w + 1):
if wv[i][0] <= j:
dp[i + 1][j] = max(dp[i][j - wv[i][0]] + wv[i][1], dp[i][j])
else:
... | n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]
for i in range(n):
for j in range(w + 1):
if j - wv[i][0] >= 0:
dp[i + 1][j] = max(dp[i][j - wv[i][0]] + wv[i][1], dp[i][j])
else:
... | false | 0 | [
"- if wv[i][0] <= j:",
"+ if j - wv[i][0] >= 0:",
"- dp[i + 1][j] = dp[i][j]",
"+ dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])"
] | false | 0.044283 | 0.039116 | 1.132092 | [
"s962483579",
"s061742261"
] |
u734548018 | p03033 | python | s487309676 | s017475107 | 1,832 | 1,219 | 73,108 | 75,764 | Accepted | Accepted | 33.46 | import sys
from bisect import bisect_left
N,Q = list(map(int, input().split()))
STX = [None] * N
for i in range(N):
s,t,x = list(map(int, input().split()))
STX[i] = [x,s,t]
STX.sort()
Dn = [None] * (Q+1)
for i in range(Q):
Dn[i] = int(eval(input()))
Dn[Q] = 10**10
ans = [-1] * Q
skip = [-1] *... | # -*- coding: utf-8 -*-
from bisect import bisect_left
from sys import stdin
readl = stdin.readline
## input
N,Q = list(map(int, readl().rstrip().split()))
STX = [list(map(int, readl().rstrip().split())) for _ in range(N)]
Dn = [None for _ in range(Q+1)]
for i in range(Q):
Dn[i] = int(readl().rstrip(... | 31 | 31 | 559 | 626 | import sys
from bisect import bisect_left
N, Q = list(map(int, input().split()))
STX = [None] * N
for i in range(N):
s, t, x = list(map(int, input().split()))
STX[i] = [x, s, t]
STX.sort()
Dn = [None] * (Q + 1)
for i in range(Q):
Dn[i] = int(eval(input()))
Dn[Q] = 10**10
ans = [-1] * Q
skip = [-1] * Q
for ... | # -*- coding: utf-8 -*-
from bisect import bisect_left
from sys import stdin
readl = stdin.readline
## input
N, Q = list(map(int, readl().rstrip().split()))
STX = [list(map(int, readl().rstrip().split())) for _ in range(N)]
Dn = [None for _ in range(Q + 1)]
for i in range(Q):
Dn[i] = int(readl().rstrip())
Dn[Q] = ... | false | 0 | [
"-import sys",
"+# -*- coding: utf-8 -*-",
"+from sys import stdin",
"-N, Q = list(map(int, input().split()))",
"-STX = [None] * N",
"-for i in range(N):",
"- s, t, x = list(map(int, input().split()))",
"- STX[i] = [x, s, t]",
"-STX.sort()",
"-Dn = [None] * (Q + 1)",
"+readl = stdin.readli... | false | 0.040862 | 0.007329 | 5.575439 | [
"s487309676",
"s017475107"
] |
u535171899 | p02756 | python | s919586502 | s036588919 | 620 | 305 | 6,900 | 93,124 | Accepted | Accepted | 50.81 | from collections import deque
s = eval(input())
q = int(eval(input()))
queue = deque([s])
tmp = 1
for i in range(q):
x = eval(input())
if x[0]==str(1):
tmp*=-1
else:
t,f,c = x.split()
t,f = int(t),int(f)
if tmp==-1:
if f==1:
queue.a... | from collections import deque
s = eval(input())
q = int(eval(input()))
deq = deque([s])
flag = 1
for i in range(q):
query = input().split()
if query[0]==str(1):
flag*=-1
if query[0]==str(2):
x = 1 if query[1]==str(1) else -1
if flag*x==1:
deq.appendleft(q... | 25 | 22 | 535 | 444 | from collections import deque
s = eval(input())
q = int(eval(input()))
queue = deque([s])
tmp = 1
for i in range(q):
x = eval(input())
if x[0] == str(1):
tmp *= -1
else:
t, f, c = x.split()
t, f = int(t), int(f)
if tmp == -1:
if f == 1:
queue.appe... | from collections import deque
s = eval(input())
q = int(eval(input()))
deq = deque([s])
flag = 1
for i in range(q):
query = input().split()
if query[0] == str(1):
flag *= -1
if query[0] == str(2):
x = 1 if query[1] == str(1) else -1
if flag * x == 1:
deq.appendleft(query... | false | 12 | [
"-queue = deque([s])",
"-tmp = 1",
"+deq = deque([s])",
"+flag = 1",
"- x = eval(input())",
"- if x[0] == str(1):",
"- tmp *= -1",
"- else:",
"- t, f, c = x.split()",
"- t, f = int(t), int(f)",
"- if tmp == -1:",
"- if f == 1:",
"- ... | false | 0.038522 | 0.037339 | 1.031681 | [
"s919586502",
"s036588919"
] |
u279493135 | p03331 | python | s202085668 | s021389522 | 205 | 41 | 5,400 | 5,384 | Accepted | Accepted | 80 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul, add
from copy import deepcopy
from string import ascii_lowercase, asci... | 31 | 26 | 942 | 870 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul, add
from copy import deepcopy
from string import ascii_lowercase, ascii_uppe... | false | 16.129032 | [
"-from operator import itemgetter, mul",
"+from operator import itemgetter, mul, add",
"-",
"-",
"-def ketawa(x):",
"- return sum(map(int, list(str(x))))",
"-",
"-",
"-ans = INF",
"-for a in range(1, N // 2 + 1):",
"- b = N - a",
"- ans = min(ans, ketawa(a) + ketawa(b))",
"-print(an... | false | 0.090405 | 0.08858 | 1.020599 | [
"s202085668",
"s021389522"
] |
u145231176 | p02960 | python | s641372213 | s061277656 | 995 | 351 | 75,988 | 99,976 | Accepted | Accepted | 64.72 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
from collections import d... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 66 | 77 | 1,490 | 1,890 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
from collections import def... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 14.285714 | [
"+def rand_N(ran1, ran2):",
"+ return random.randint(ran1, ran2)",
"+",
"+",
"+def rand_List(ran1, ran2, rantime):",
"+ return [random.randint(ran1, ran2) for i in range(rantime)]",
"+",
"+",
"+def rand_ints_nodup(ran1, ran2, rantime):",
"+ ns = []",
"+ while len(ns) < rantime:",
"... | false | 0.038725 | 0.039654 | 0.976589 | [
"s641372213",
"s061277656"
] |
u562935282 | p03166 | python | s791174375 | s603101654 | 1,111 | 708 | 177,084 | 71,044 | Accepted | Accepted | 36.27 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
inf = float('inf')
def rec(v):
if used[v]:
return dp[v]
used[v] = True
res = 0
for u in es[v]:
res = max(res, rec(u) + 1)
dp[v] = res
return res
n, m = list(map(int, input().split()))
... | import sys
sys.setrecursionlimit(10 ** 7)
def dfs(v):
if d[v] != -1:
return d[v]
res = -1
for u in e[v]:
res = max(res, dfs(u))
res += 1
d[v] = res
return res
n, m = list(map(int, input().split()))
e = tuple(set() for _ in range(n))
for _ in range(m):
... | 36 | 29 | 562 | 474 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
inf = float("inf")
def rec(v):
if used[v]:
return dp[v]
used[v] = True
res = 0
for u in es[v]:
res = max(res, rec(u) + 1)
dp[v] = res
return res
n, m = list(map(int, input().split()))
es = tuple(set() for _ i... | import sys
sys.setrecursionlimit(10**7)
def dfs(v):
if d[v] != -1:
return d[v]
res = -1
for u in e[v]:
res = max(res, dfs(u))
res += 1
d[v] = res
return res
n, m = list(map(int, input().split()))
e = tuple(set() for _ in range(n))
for _ in range(m):
x, y = list(map(int, ... | false | 19.444444 | [
"-input = sys.stdin.readline",
"-inf = float(\"inf\")",
"-def rec(v):",
"- if used[v]:",
"- return dp[v]",
"- used[v] = True",
"- res = 0",
"- for u in es[v]:",
"- res = max(res, rec(u) + 1)",
"- dp[v] = res",
"+def dfs(v):",
"+ if d[v] != -1:",
"+ retu... | false | 0.079794 | 0.048284 | 1.652582 | [
"s791174375",
"s603101654"
] |
u885634168 | p02732 | python | s495867298 | s296521936 | 282 | 247 | 124,920 | 111,800 | Accepted | Accepted | 12.41 | from operator import mul
from functools import reduce
N = int(eval(input()))
A = list(map(int,input().split()))
def cmb(n, r):
if n < r: return 0
r = min(n - r, r)
if r == 0: return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1, r + 1)))
return o... | from operator import mul
from functools import reduce
N = int(eval(input()))
A = list(map(int,input().split()))
def cmb(n, r):
if n < r: return 0
r = min(n - r, r)
if r == 0: return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1, r + 1)))
return... | 30 | 26 | 625 | 547 | from operator import mul
from functools import reduce
N = int(eval(input()))
A = list(map(int, input().split()))
def cmb(n, r):
if n < r:
return 0
r = min(n - r, r)
if r == 0:
return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1, r + 1)))
ret... | from operator import mul
from functools import reduce
N = int(eval(input()))
A = list(map(int, input().split()))
def cmb(n, r):
if n < r:
return 0
r = min(n - r, r)
if r == 0:
return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1, r + 1)))
ret... | false | 13.333333 | [
"-ma = max(A)",
"-c = [0 for _ in range(ma + 1)]",
"+sum_ = 0",
"- c[i] = cmb(dic[i], 2)",
"-sum_ = sum(c)",
"+ sum_ += cmb(dic[i], 2)",
"- ans = sum_ - c[A[i]] + cmb(dic[A[i]] - 1, 2)",
"+ ans = sum_ - (dic[A[i]] - 1)"
] | false | 0.157772 | 0.156349 | 1.009101 | [
"s495867298",
"s296521936"
] |
u338225045 | p03633 | python | s112369246 | s427663873 | 63 | 17 | 5,560 | 3,060 | Accepted | Accepted | 73.02 | import fractions
import functools
N = int( eval(input()) )
T = [ int(eval(input())) for _ in range(N) ]
def lcm( x, y ):
return x * y // fractions.gcd( x, y )
def lcm_list( numbers ):
return functools.reduce( lcm, numbers, 1 )
if N == 1: print(( T[0] ))
else : print(( lcm_list(T) )) | N = int( eval(input()) )
T = [ int( eval(input()) ) for _ in range(N) ]
# 最小公倍数を求めたい
# aとbの最小公倍数 = a*b / aとbの最大公約数
# 最大公約数 (Greatest Common Divisor)
def GCD( a, b ):
if b == 0: return a
return GCD(b, a%b)
# 最小公倍数 (Least Common Multiple)
def LCM( a, b ):
return a*b // GCD(a,b)
ans = 1
f... | 14 | 19 | 296 | 362 | import fractions
import functools
N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
def lcm(x, y):
return x * y // fractions.gcd(x, y)
def lcm_list(numbers):
return functools.reduce(lcm, numbers, 1)
if N == 1:
print((T[0]))
else:
print((lcm_list(T)))
| N = int(eval(input()))
T = [int(eval(input())) for _ in range(N)]
# 最小公倍数を求めたい
# aとbの最小公倍数 = a*b / aとbの最大公約数
# 最大公約数 (Greatest Common Divisor)
def GCD(a, b):
if b == 0:
return a
return GCD(b, a % b)
# 最小公倍数 (Least Common Multiple)
def LCM(a, b):
return a * b // GCD(a, b)
ans = 1
for i in range(N... | false | 26.315789 | [
"-import fractions",
"-import functools",
"-",
"+# 最小公倍数を求めたい",
"+# aとbの最小公倍数 = a*b / aとbの最大公約数",
"+# 最大公約数 (Greatest Common Divisor)",
"+def GCD(a, b):",
"+ if b == 0:",
"+ return a",
"+ return GCD(b, a % b)",
"-def lcm(x, y):",
"- return x * y // fractions.gcd(x, y)",
"+# 最... | false | 0.045854 | 0.055201 | 0.830672 | [
"s112369246",
"s427663873"
] |
u423585790 | p02983 | python | s765280260 | s317167399 | 610 | 212 | 3,700 | 39,408 | Accepted | Accepted | 65.25 | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
... | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
... | 90 | 100 | 1,936 | 2,211 | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI():... | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI():... | false | 10 | [
"+ a = a + [a[0]]",
"+ ans = [0] * n",
"+ x = 0",
"+ for i in range(1, n, 2):",
"+ x = x + a[i + 1] - a[i]",
"+ ans[1] = a[0] - x",
"+ ans[0] = ans[1] + 2 * x",
"+ for i in range(2, n):",
"+ ans[i] = (a[i - 1] - ans[i - 1] // 2) * 2",
"+ print((\" \".join(map(... | false | 0.038927 | 0.037956 | 1.02557 | [
"s765280260",
"s317167399"
] |
u249218227 | p03494 | python | s714350175 | s356918778 | 166 | 19 | 38,512 | 3,060 | Accepted | Accepted | 88.55 | length = int(eval(input()))
num_li = list(map(int, input().split()))
count = 0
loop = True
while True:
for i in range(length):
if num_li[i]%2 == 1:
loop = False
break
else:
num_li[i] /= 2
if loop == False:
break
else:
count +=... | length = int(eval(input()))
num_li = list(map(int, input().split()))
count = 0
loop = True
while loop == True:
for i in range(length):
if num_li[i]%2 == 1:
loop = False
break
else:
num_li[i] /= 2
if loop == True:
count += 1
print(count) | 16 | 14 | 330 | 311 | length = int(eval(input()))
num_li = list(map(int, input().split()))
count = 0
loop = True
while True:
for i in range(length):
if num_li[i] % 2 == 1:
loop = False
break
else:
num_li[i] /= 2
if loop == False:
break
else:
count += 1
print(cou... | length = int(eval(input()))
num_li = list(map(int, input().split()))
count = 0
loop = True
while loop == True:
for i in range(length):
if num_li[i] % 2 == 1:
loop = False
break
else:
num_li[i] /= 2
if loop == True:
count += 1
print(count)
| false | 12.5 | [
"-while True:",
"+while loop == True:",
"- if loop == False:",
"- break",
"- else:",
"+ if loop == True:"
] | false | 0.036926 | 0.035911 | 1.028275 | [
"s714350175",
"s356918778"
] |
u566428756 | p02780 | python | s475744637 | s530110505 | 239 | 214 | 25,700 | 25,700 | Accepted | Accepted | 10.46 | from collections import deque
N,K=list(map(int,input().split()))
P=list(map(int,input().split()))
cnt=0
ans=0
buf=0
buf_2=0
q=deque([])
cnt=0
for i in range(N):
cnt+=1
buf=P[i]*(P[i]+1)//2/P[i]
q.append(buf)
buf_2+=buf
if cnt>=K:
if ans<buf_2:
ans=buf_2
... | from collections import deque
N,K=list(map(int,input().split()))
P=list(map(int,input().split()))
Ary=deque([])
ans,res,cnt=0,0,0
k=0
for i in range(N):
cnt+=1
k=(P[i]+1)/2
Ary.append(k)
res+=k
if cnt<K:
continue
if ans<res:
ans=res
res-=Ary.popleft()
... | 24 | 21 | 442 | 324 | from collections import deque
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
cnt = 0
ans = 0
buf = 0
buf_2 = 0
q = deque([])
cnt = 0
for i in range(N):
cnt += 1
buf = P[i] * (P[i] + 1) // 2 / P[i]
q.append(buf)
buf_2 += buf
if cnt >= K:
if ans < buf_2:
... | from collections import deque
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
Ary = deque([])
ans, res, cnt = 0, 0, 0
k = 0
for i in range(N):
cnt += 1
k = (P[i] + 1) / 2
Ary.append(k)
res += k
if cnt < K:
continue
if ans < res:
ans = res
res -= Ar... | false | 12.5 | [
"-cnt = 0",
"-ans = 0",
"-buf = 0",
"-buf_2 = 0",
"-q = deque([])",
"-cnt = 0",
"+Ary = deque([])",
"+ans, res, cnt = 0, 0, 0",
"+k = 0",
"- buf = P[i] * (P[i] + 1) // 2 / P[i]",
"- q.append(buf)",
"- buf_2 += buf",
"- if cnt >= K:",
"- if ans < buf_2:",
"- ... | false | 0.063556 | 0.064241 | 0.989342 | [
"s475744637",
"s530110505"
] |
u445404615 | p03030 | python | s889117214 | s908017109 | 182 | 165 | 38,256 | 38,384 | Accepted | Accepted | 9.34 | n = int(eval(input()))
l = []
ans = []
for i in range(1, n+1):
s, p = input().split()
l.append([s, int(p), i])
ans = sorted(l, key=lambda x:(x[0],-x[1]))
for j in ans:
print((j[2])) | n = int(eval(input()))
l = []
for i in range(1, n+1):
s, p = input().split()
l.append([s, int(p), i])
l = sorted(l, key=lambda x: x[1],reverse=True)
l = sorted(l, key=lambda x: x[0])
for j in l:
print((j[2])) | 12 | 13 | 203 | 235 | n = int(eval(input()))
l = []
ans = []
for i in range(1, n + 1):
s, p = input().split()
l.append([s, int(p), i])
ans = sorted(l, key=lambda x: (x[0], -x[1]))
for j in ans:
print((j[2]))
| n = int(eval(input()))
l = []
for i in range(1, n + 1):
s, p = input().split()
l.append([s, int(p), i])
l = sorted(l, key=lambda x: x[1], reverse=True)
l = sorted(l, key=lambda x: x[0])
for j in l:
print((j[2]))
| false | 7.692308 | [
"-ans = []",
"-ans = sorted(l, key=lambda x: (x[0], -x[1]))",
"-for j in ans:",
"+l = sorted(l, key=lambda x: x[1], reverse=True)",
"+l = sorted(l, key=lambda x: x[0])",
"+for j in l:"
] | false | 0.049568 | 0.00845 | 5.865869 | [
"s889117214",
"s908017109"
] |
u692746605 | p02678 | python | s811141466 | s948787270 | 1,262 | 653 | 33,640 | 34,056 | Accepted | Accepted | 48.26 | def main():
N,M=list(map(int,input().split()))
r=[[]for i in range(N)]
for i in range(M):
a,b=list(map(int,input().split()))
r[a-1].append(b-1)
r[b-1].append(a-1)
p=[-1]*N
q=[0]
while q:
i=q.pop(0)
for j in r[i]:
if p[j]==-1:
p[j]=i
q.append(j)
... | from collections import deque
def main():
N,M=list(map(int,input().split()))
r=[[]for i in range(N)]
for i in range(M):
a,b=list(map(int,input().split()))
r[a-1].append(b-1)
r[b-1].append(a-1)
p=[-1]*N
q=deque([0])
while q:
i=q.popleft()
for j in r[i]:
if p[j]==-... | 23 | 25 | 376 | 419 | def main():
N, M = list(map(int, input().split()))
r = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
r[a - 1].append(b - 1)
r[b - 1].append(a - 1)
p = [-1] * N
q = [0]
while q:
i = q.pop(0)
for j in r[i]:
if p... | from collections import deque
def main():
N, M = list(map(int, input().split()))
r = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
r[a - 1].append(b - 1)
r[b - 1].append(a - 1)
p = [-1] * N
q = deque([0])
while q:
i = q.popleft... | false | 8 | [
"+from collections import deque",
"+",
"+",
"- q = [0]",
"+ q = deque([0])",
"- i = q.pop(0)",
"+ i = q.popleft()"
] | false | 0.038564 | 0.037022 | 1.041643 | [
"s811141466",
"s948787270"
] |
u936985471 | p02756 | python | s693593099 | s006499821 | 261 | 120 | 4,396 | 14,176 | Accepted | Accepted | 54.02 | import sys
readline=sys.stdin.readline
S=readline().rstrip()
Q=int(readline())
cur=True
front=""
back=""
for i in range(Q):
q=list(readline().rstrip().split())
if q[0]=="1":
cur^=True
elif q[0]=="2":
f,c=q[1],q[2]
if f=="1":
if cur:
front+=c
else:
back+... | import sys
readline = sys.stdin.readline
S = readline().rstrip()
from collections import deque
S = deque(S)
Q = int(readline())
turn = False
for i in range(Q):
query = readline().split()
if query[0] == "1":
turn ^= True
elif query[0] == "2":
if query[1] == "1":
if turn:
S... | 32 | 31 | 493 | 555 | import sys
readline = sys.stdin.readline
S = readline().rstrip()
Q = int(readline())
cur = True
front = ""
back = ""
for i in range(Q):
q = list(readline().rstrip().split())
if q[0] == "1":
cur ^= True
elif q[0] == "2":
f, c = q[1], q[2]
if f == "1":
if cur:
... | import sys
readline = sys.stdin.readline
S = readline().rstrip()
from collections import deque
S = deque(S)
Q = int(readline())
turn = False
for i in range(Q):
query = readline().split()
if query[0] == "1":
turn ^= True
elif query[0] == "2":
if query[1] == "1":
if turn:
... | false | 3.125 | [
"+from collections import deque",
"+",
"+S = deque(S)",
"-cur = True",
"-front = \"\"",
"-back = \"\"",
"+turn = False",
"- q = list(readline().rstrip().split())",
"- if q[0] == \"1\":",
"- cur ^= True",
"- elif q[0] == \"2\":",
"- f, c = q[1], q[2]",
"- if f ==... | false | 0.037972 | 0.045172 | 0.84061 | [
"s693593099",
"s006499821"
] |
u850491413 | p03835 | python | s573464276 | s261598208 | 270 | 166 | 40,796 | 38,768 | Accepted | Accepted | 38.52 | K, S = list(map(int, input().split()))
num = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if z <= K and 0 <= z:
num += 1
print(num) | K, S = list(map(int, input().split()))
num = 0
for x in range(K + 1):
rest = S - x
if 0 <= rest and rest <= K:
num += rest + 1
elif K < rest and rest <=2*K:
num += 2*K + 1 - rest
print(num) | 9 | 10 | 165 | 206 | K, S = list(map(int, input().split()))
num = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if z <= K and 0 <= z:
num += 1
print(num)
| K, S = list(map(int, input().split()))
num = 0
for x in range(K + 1):
rest = S - x
if 0 <= rest and rest <= K:
num += rest + 1
elif K < rest and rest <= 2 * K:
num += 2 * K + 1 - rest
print(num)
| false | 10 | [
"- for y in range(K + 1):",
"- z = S - x - y",
"- if z <= K and 0 <= z:",
"- num += 1",
"+ rest = S - x",
"+ if 0 <= rest and rest <= K:",
"+ num += rest + 1",
"+ elif K < rest and rest <= 2 * K:",
"+ num += 2 * K + 1 - rest"
] | false | 0.034661 | 0.04033 | 0.859425 | [
"s573464276",
"s261598208"
] |
u148981246 | p02732 | python | s450497050 | s748044527 | 1,939 | 258 | 33,920 | 33,912 | Accepted | Accepted | 86.69 | import collections
import math
def cmb_factorial(s):
return math.factorial(s) // (math.factorial(2) * math.factorial(s - 2))
n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
f = {}
cmb = 0
for x in list(c.values()):
f[1] = 0
f[2] = 1
if x >= 3:
... | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
cmb = 0
for x in list(c.values()):
cmb += x * (x - 1) // 2
for z in a:
y = c.get(z)
before = y * (y - 1) // 2
after = (y - 1) * (y - 2) //2
ans = cmb - before + after
pr... | 27 | 16 | 555 | 316 | import collections
import math
def cmb_factorial(s):
return math.factorial(s) // (math.factorial(2) * math.factorial(s - 2))
n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
f = {}
cmb = 0
for x in list(c.values()):
f[1] = 0
f[2] = 1
if x >= 3:
f[x] = cmb... | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
cmb = 0
for x in list(c.values()):
cmb += x * (x - 1) // 2
for z in a:
y = c.get(z)
before = y * (y - 1) // 2
after = (y - 1) * (y - 2) // 2
ans = cmb - before + after
print(ans)
| false | 40.740741 | [
"-import math",
"-",
"-",
"-def cmb_factorial(s):",
"- return math.factorial(s) // (math.factorial(2) * math.factorial(s - 2))",
"-",
"-f = {}",
"- f[1] = 0",
"- f[2] = 1",
"- if x >= 3:",
"- f[x] = cmb_factorial(x)",
"- if x - 1 not in f:",
"- f[x - 1] =... | false | 0.150325 | 0.036595 | 4.107825 | [
"s450497050",
"s748044527"
] |
u991567869 | p02598 | python | s685529261 | s929322825 | 1,145 | 987 | 31,036 | 31,228 | Accepted | Accepted | 13.8 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
l = 0
r = 10**9 + 1
ref = 0
ans = 10**9
while r - l > 1:
now = (l + r)//2
for i in a:
ref += 0 - -i//now - 1
if ref > k:
ref = 0
l = now
break
else:
ans =... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
l = 0
r = 10**9 + 1
ref = 0
ans = 10**9
while r - l > 1:
now = (l + r)//2
for i in a:
ref += 0 - -i//now - 1
if ref <= k:
ans = now
ref = 0
r = now
else:
ref = 0
... | 21 | 20 | 364 | 334 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
l = 0
r = 10**9 + 1
ref = 0
ans = 10**9
while r - l > 1:
now = (l + r) // 2
for i in a:
ref += 0 - -i // now - 1
if ref > k:
ref = 0
l = now
break
else:
ans = now
re... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
l = 0
r = 10**9 + 1
ref = 0
ans = 10**9
while r - l > 1:
now = (l + r) // 2
for i in a:
ref += 0 - -i // now - 1
if ref <= k:
ans = now
ref = 0
r = now
else:
ref = 0
l = now
print(a... | false | 4.761905 | [
"- if ref > k:",
"- ref = 0",
"- l = now",
"- break",
"- else:",
"+ if ref <= k:",
"+ else:",
"+ ref = 0",
"+ l = now"
] | false | 0.042107 | 0.03673 | 1.146392 | [
"s685529261",
"s929322825"
] |
u453055089 | p03165 | python | s684623967 | s485367577 | 490 | 350 | 112,988 | 138,976 | Accepted | Accepted | 28.57 | s = eval(input())
t = eval(input())
len_s = len(s)
len_t = len(t)
dp = [[0]*(len_t+1) for _ in range(len_s+1)]
# dp[i][j]はi、j文字目までのs[i],t[j]で、最長の部分列の長さ
for i in range(len_s):
for j in range(len_t):
if s[i] == t[j]:
dp[i+1][j+1] = max(dp[i][j]+1, dp[i+1][j], dp[i][j+1])
dp[i+1... | s = eval(input())
t = eval(input())
n_s = len(s)
n_t = len(t)
dp = [[0]*(n_t+1) for _ in range(n_s+1)]
#dp[i][j]はsのi文字目までとtのj文字目までのLCSの長さ
for i in range(n_s+1):
for j in range(n_t+1):
if i == 0 or j == 0:
continue
dp[i][j] = max(dp[i-1][j], dp[i][j-1])
if s[i-1] ==... | 24 | 30 | 646 | 674 | s = eval(input())
t = eval(input())
len_s = len(s)
len_t = len(t)
dp = [[0] * (len_t + 1) for _ in range(len_s + 1)]
# dp[i][j]はi、j文字目までのs[i],t[j]で、最長の部分列の長さ
for i in range(len_s):
for j in range(len_t):
if s[i] == t[j]:
dp[i + 1][j + 1] = max(dp[i][j] + 1, dp[i + 1][j], dp[i][j + 1])
dp... | s = eval(input())
t = eval(input())
n_s = len(s)
n_t = len(t)
dp = [[0] * (n_t + 1) for _ in range(n_s + 1)]
# dp[i][j]はsのi文字目までとtのj文字目までのLCSの長さ
for i in range(n_s + 1):
for j in range(n_t + 1):
if i == 0 or j == 0:
continue
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
if s[i - 1] ... | false | 20 | [
"-len_s = len(s)",
"-len_t = len(t)",
"-dp = [[0] * (len_t + 1) for _ in range(len_s + 1)]",
"-# dp[i][j]はi、j文字目までのs[i],t[j]で、最長の部分列の長さ",
"-for i in range(len_s):",
"- for j in range(len_t):",
"- if s[i] == t[j]:",
"- dp[i + 1][j + 1] = max(dp[i][j] + 1, dp[i + 1][j], dp[i][j + 1]... | false | 0.081859 | 0.084958 | 0.963522 | [
"s684623967",
"s485367577"
] |
u952708174 | p03964 | python | s765777806 | s825489002 | 101 | 21 | 5,588 | 3,188 | Accepted | Accepted | 79.21 | def c_AtCoDeer_and_ElectionReport(N, R):
from math import ceil
from decimal import Decimal
t = 1 # 高橋の票数
a = 1 # 青木の票数
for x, y in R:
n = Decimal(max(ceil(t / x), ceil(a / y)))
t = n * x
a = n * y
return t + a
N = int(eval(input()))
R = [[int(i) for i in in... | def c_atcodeer_and_election_report(N, R):
t, a = 1, 1 # 高橋, 青木の票数
for x, y in R:
# t<=nx ∧ a<=ny を満たす最小のnを求める
n = max(t // x, a // y)
if t > n * x or a > n * y:
n += 1
t = n * x
a = n * y
return t + a
N = int(eval(input()))
R = [[int(i) for i... | 14 | 14 | 391 | 398 | def c_AtCoDeer_and_ElectionReport(N, R):
from math import ceil
from decimal import Decimal
t = 1 # 高橋の票数
a = 1 # 青木の票数
for x, y in R:
n = Decimal(max(ceil(t / x), ceil(a / y)))
t = n * x
a = n * y
return t + a
N = int(eval(input()))
R = [[int(i) for i in input().spli... | def c_atcodeer_and_election_report(N, R):
t, a = 1, 1 # 高橋, 青木の票数
for x, y in R:
# t<=nx ∧ a<=ny を満たす最小のnを求める
n = max(t // x, a // y)
if t > n * x or a > n * y:
n += 1
t = n * x
a = n * y
return t + a
N = int(eval(input()))
R = [[int(i) for i in input()... | false | 0 | [
"-def c_AtCoDeer_and_ElectionReport(N, R):",
"- from math import ceil",
"- from decimal import Decimal",
"-",
"- t = 1 # 高橋の票数",
"- a = 1 # 青木の票数",
"+def c_atcodeer_and_election_report(N, R):",
"+ t, a = 1, 1 # 高橋, 青木の票数",
"- n = Decimal(max(ceil(t / x), ceil(a / y)))",
"+... | false | 0.039937 | 0.036783 | 1.085759 | [
"s765777806",
"s825489002"
] |
u762420987 | p02768 | python | s306649940 | s616372199 | 180 | 110 | 38,768 | 3,064 | Accepted | Accepted | 38.89 | def sq(a, b, mod): # aのb乗を剰余,kは初期値#20191116-D-Knight
if b == 0:
return 1
elif b % 2 == 0:
return sq(a, b // 2, mod)**2 % mod
else:
return sq(a, b - 1, mod) * a % mod
def nCk(n, k, mod=10 ** 9 + 7):
x = max(k, n - k)
y = min(k, n - k)
kkai = 1
for i in ... | def sq(a, b, mod): # aのb乗を剰余,kは初期値#20191116-D-Knight
if b == 0:
return 1
elif b % 2 == 0:
return sq(a, b // 2, mod)**2 % mod
else:
return sq(a, b - 1, mod) * a % mod
def nCk(n, k, mod=10 ** 9 + 7):
x = max(k, n - k)
y = min(k, n - k)
kkai = 1
for i in ... | 39 | 27 | 874 | 665 | def sq(a, b, mod): # aのb乗を剰余,kは初期値#20191116-D-Knight
if b == 0:
return 1
elif b % 2 == 0:
return sq(a, b // 2, mod) ** 2 % mod
else:
return sq(a, b - 1, mod) * a % mod
def nCk(n, k, mod=10**9 + 7):
x = max(k, n - k)
y = min(k, n - k)
kkai = 1
for i in range(2, y + ... | def sq(a, b, mod): # aのb乗を剰余,kは初期値#20191116-D-Knight
if b == 0:
return 1
elif b % 2 == 0:
return sq(a, b // 2, mod) ** 2 % mod
else:
return sq(a, b - 1, mod) * a % mod
def nCk(n, k, mod=10**9 + 7):
x = max(k, n - k)
y = min(k, n - k)
kkai = 1
for i in range(2, y + ... | false | 30.769231 | [
"+n, a, b = list(map(int, input().split()))",
"-n, a, b = list(map(int, input().split()))",
"-",
"-",
"-def modpow(x, y):",
"- res = 1",
"- while y > 0:",
"- if y & 1:",
"- res = res * x % (10**9 + 7)",
"- x = x * x % (10**9 + 7)",
"- y >>= 1",
"- y... | false | 0.201825 | 0.21477 | 0.939728 | [
"s306649940",
"s616372199"
] |
u119148115 | p03264 | python | s183136261 | s211093742 | 75 | 65 | 61,912 | 61,728 | Accepted | Accepted | 13.33 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | import sys
def I(): return int(sys.stdin.readline().rstrip())
K = I()
print(((K//2)*(K-K//2)))
| 16 | 6 | 531 | 100 | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | import sys
def I():
return int(sys.stdin.readline().rstrip())
K = I()
print(((K // 2) * (K - K // 2)))
| false | 62.5 | [
"-",
"-sys.setrecursionlimit(10**7)",
"-def MI():",
"- return list(map(int, sys.stdin.readline().rstrip().split()))",
"-",
"-",
"-def LI():",
"- return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり",
"-",
"-",
"-def LI2():",
"- return list(map(int, sys.stdin.readline()... | false | 0.036155 | 0.036452 | 0.991827 | [
"s183136261",
"s211093742"
] |
u607865971 | p03253 | python | s339716093 | s491605414 | 812 | 19 | 40,044 | 3,064 | Accepted | Accepted | 97.66 | import math
N, M = [int(x) for x in input().split()]
MOD = 10 ** 9 + 7
divisor = []
dict = {}
m = M
d = 2
while m != 1:
while m % d == 0:
# divisor.append(d)
m //= d
dict[d] = dict.get(d, 0) + 1
d += 1
C = list(dict.values())
ret = 1
# def combinations_count(n, r... | import math
N, M = [int(x) for x in input().split()]
MOD = 10 ** 9 + 7
divisor = []
dict = {}
m = M
d = 2
while d*d <= m:
while m % d == 0:
m //= d
dict[d] = dict.get(d, 0) + 1
d += 1
if m > 1:
dict[d] = dict.get(m, 0) + 1
C = list(dict.values())
ret = 1
# def com... | 37 | 39 | 656 | 676 | import math
N, M = [int(x) for x in input().split()]
MOD = 10**9 + 7
divisor = []
dict = {}
m = M
d = 2
while m != 1:
while m % d == 0:
# divisor.append(d)
m //= d
dict[d] = dict.get(d, 0) + 1
d += 1
C = list(dict.values())
ret = 1
# def combinations_count(n, r):
# return math.facto... | import math
N, M = [int(x) for x in input().split()]
MOD = 10**9 + 7
divisor = []
dict = {}
m = M
d = 2
while d * d <= m:
while m % d == 0:
m //= d
dict[d] = dict.get(d, 0) + 1
d += 1
if m > 1:
dict[d] = dict.get(m, 0) + 1
C = list(dict.values())
ret = 1
# def combinations_count(n, r):
# ... | false | 5.128205 | [
"-while m != 1:",
"+while d * d <= m:",
"- # divisor.append(d)",
"+if m > 1:",
"+ dict[d] = dict.get(m, 0) + 1"
] | false | 0.073894 | 0.043686 | 1.691476 | [
"s339716093",
"s491605414"
] |
u437351386 | p03087 | python | s832934031 | s759150098 | 500 | 312 | 17,508 | 23,116 | Accepted | Accepted | 37.6 | from itertools import accumulate
n,q=list(map(int,input().split()))
s=eval(input())
l=[0]*q
r=[0]*q
for i in range(q):
l[i],r[i]=list(map(int,input().split()))
L=min(l)
R=max(r)
#前処理
A=[]
for i in range(L,R):
if s[i-1]=="A"and s[i]=="C":
A.append(1)
else:
A.append(0)
A.append... | from itertools import accumulate
n,q=list(map(int,input().split()))
s=list(eval(input()))
l=[]
r=[]
for i in range(q):
o,p=list(map(int,input().split()))
l.append(o)
r.append(p)
ruiseki=[]
for i in range(n-1):
if s[i]=="A" and s[i+1]=="C":
ruiseki.append(1)
else:
ruiseki.append(0)
r... | 27 | 22 | 430 | 424 | from itertools import accumulate
n, q = list(map(int, input().split()))
s = eval(input())
l = [0] * q
r = [0] * q
for i in range(q):
l[i], r[i] = list(map(int, input().split()))
L = min(l)
R = max(r)
# 前処理
A = []
for i in range(L, R):
if s[i - 1] == "A" and s[i] == "C":
A.append(1)
else:
A.... | from itertools import accumulate
n, q = list(map(int, input().split()))
s = list(eval(input()))
l = []
r = []
for i in range(q):
o, p = list(map(int, input().split()))
l.append(o)
r.append(p)
ruiseki = []
for i in range(n - 1):
if s[i] == "A" and s[i + 1] == "C":
ruiseki.append(1)
else:
... | false | 18.518519 | [
"-s = eval(input())",
"-l = [0] * q",
"-r = [0] * q",
"+s = list(eval(input()))",
"+l = []",
"+r = []",
"- l[i], r[i] = list(map(int, input().split()))",
"-L = min(l)",
"-R = max(r)",
"-# 前処理",
"-A = []",
"-for i in range(L, R):",
"- if s[i - 1] == \"A\" and s[i] == \"C\":",
"- ... | false | 0.044656 | 0.039677 | 1.125486 | [
"s832934031",
"s759150098"
] |
u321035578 | p03160 | python | s069075348 | s648923478 | 243 | 100 | 52,208 | 13,980 | Accepted | Accepted | 58.85 |
def main():
n=int(eval(input()))
h=list(map(int,input().split()))
dp=[None]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
temp2=dp[i-2]+abs(h[i]-h[i-2])
temp1=dp[i-1]+abs(h[i]-h[i-1])
dp[i]=min(temp1,temp2)
print((dp[n-1]))
if __name__=='__main_... |
def main():
n = int(eval(input()))
h = list(map(int,input().split()))
dp = [0] * (n + 1)
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]))
if __name__=='__main__':
main()
| 16 | 12 | 328 | 295 | def main():
n = int(eval(input()))
h = list(map(int, input().split()))
dp = [None] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
temp2 = dp[i - 2] + abs(h[i] - h[i - 2])
temp1 = dp[i - 1] + abs(h[i] - h[i - 1])
dp[i] = min(temp1, temp2)
print((dp[n - 1]... | def main():
n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * (n + 1)
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]))
if __name__ == "__main__":
main()
| false | 25 | [
"- dp = [None] * n",
"- dp[0] = 0",
"+ dp = [0] * (n + 1)",
"- temp2 = dp[i - 2] + abs(h[i] - h[i - 2])",
"- temp1 = dp[i - 1] + abs(h[i] - h[i - 1])",
"- dp[i] = min(temp1, temp2)",
"+ dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]))"
... | false | 0.040841 | 0.036848 | 1.108354 | [
"s069075348",
"s648923478"
] |
u842747358 | p03378 | python | s140771837 | s798013576 | 19 | 17 | 3,188 | 2,940 | Accepted | Accepted | 10.53 | N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
to_0 = 0
if A[-1] < X:
to_0 = M
to_N = 0
elif A[0] < X < A[-1]:
for i in A:
if i < X:
to_0 += 1
to_N = M - to_0
elif X < A[0]:
to_0 = 0
to_N = M
print((min(to_0, to_N))) | n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
left = 0
right = 0
for ai in a:
if ai < x:
left += 1
else:
right += 1
print((min(left, right)))
| 16 | 12 | 299 | 203 | N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
to_0 = 0
if A[-1] < X:
to_0 = M
to_N = 0
elif A[0] < X < A[-1]:
for i in A:
if i < X:
to_0 += 1
to_N = M - to_0
elif X < A[0]:
to_0 = 0
to_N = M
print((min(to_0, to_N)))
| n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
left = 0
right = 0
for ai in a:
if ai < x:
left += 1
else:
right += 1
print((min(left, right)))
| false | 25 | [
"-N, M, X = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-to_0 = 0",
"-if A[-1] < X:",
"- to_0 = M",
"- to_N = 0",
"-elif A[0] < X < A[-1]:",
"- for i in A:",
"- if i < X:",
"- to_0 += 1",
"- to_N = M - to_0",
"-elif X < A[0]:",
"- ... | false | 0.079567 | 0.070248 | 1.132653 | [
"s140771837",
"s798013576"
] |
u860002137 | p03611 | python | s485443561 | s744691608 | 160 | 120 | 30,172 | 23,600 | Accepted | Accepted | 25 | from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
for i in range(N):
a.append(a[i]+1)
a.append(a[i]-1)
ans = Counter(a)
print((ans.most_common()[0][1])) | from collections import defaultdict
n = int(eval(input()))
arr = list(map(int, input().split()))
d = defaultdict(int)
for x in arr:
d[x] += 1
d[x - 1] += 1
d[x + 1] += 1
result = [y for x, y in list(d.items())]
print((max(result))) | 12 | 15 | 208 | 248 | from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
for i in range(N):
a.append(a[i] + 1)
a.append(a[i] - 1)
ans = Counter(a)
print((ans.most_common()[0][1]))
| from collections import defaultdict
n = int(eval(input()))
arr = list(map(int, input().split()))
d = defaultdict(int)
for x in arr:
d[x] += 1
d[x - 1] += 1
d[x + 1] += 1
result = [y for x, y in list(d.items())]
print((max(result)))
| false | 20 | [
"-from collections import Counter",
"+from collections import defaultdict",
"-N = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-for i in range(N):",
"- a.append(a[i] + 1)",
"- a.append(a[i] - 1)",
"-ans = Counter(a)",
"-print((ans.most_common()[0][1]))",
"+n = int(eval(input... | false | 0.045543 | 0.041525 | 1.096771 | [
"s485443561",
"s744691608"
] |
u312025627 | p03545 | python | s060178688 | s504159601 | 196 | 18 | 38,384 | 3,064 | Accepted | Accepted | 90.82 | def main():
S = input()
for bit in range(1 << 3):
calc_v = int(S[0])
ans = [S[0]]
for i in range(3):
if bit & (1 << i):
calc_v += int(S[i+1])
ans.append("+")
ans.append(S[i+1])
else:
calc_v... | def main():
S = input()
for bit in range(1 << 3):
ans = int(S[0])
T = S[0]
for i in range(3):
if bit & (1 << i):
ans += int(S[i+1])
T += "+"+S[i+1]
else:
ans -= int(S[i+1])
T += "-"+S[i+1]
... | 20 | 18 | 519 | 420 | def main():
S = input()
for bit in range(1 << 3):
calc_v = int(S[0])
ans = [S[0]]
for i in range(3):
if bit & (1 << i):
calc_v += int(S[i + 1])
ans.append("+")
ans.append(S[i + 1])
else:
calc_v -= int... | def main():
S = input()
for bit in range(1 << 3):
ans = int(S[0])
T = S[0]
for i in range(3):
if bit & (1 << i):
ans += int(S[i + 1])
T += "+" + S[i + 1]
else:
ans -= int(S[i + 1])
T += "-" + S[i + 1]... | false | 10 | [
"- calc_v = int(S[0])",
"- ans = [S[0]]",
"+ ans = int(S[0])",
"+ T = S[0]",
"- calc_v += int(S[i + 1])",
"- ans.append(\"+\")",
"- ans.append(S[i + 1])",
"+ ans += int(S[i + 1])",
"+ T += \"+\" + ... | false | 0.037227 | 0.053964 | 0.689861 | [
"s060178688",
"s504159601"
] |
u089376182 | p02946 | python | s526419928 | s912695727 | 149 | 17 | 12,396 | 3,060 | Accepted | Accepted | 88.59 | import numpy as np
k, x = map(int, input().split())
upper = x + k - 1
lower = x - k + 1
if lower == upper:
print(lower)
else:
for i in range(lower, upper + 1):
print(i, end = " ")
| k, x = map(int, input().split())
lower = x - k + 1
upper = x + k - 1
for i in range(lower, upper + 1):
print(i, end = " ")
| 12 | 6 | 202 | 130 | import numpy as np
k, x = map(int, input().split())
upper = x + k - 1
lower = x - k + 1
if lower == upper:
print(lower)
else:
for i in range(lower, upper + 1):
print(i, end=" ")
| k, x = map(int, input().split())
lower = x - k + 1
upper = x + k - 1
for i in range(lower, upper + 1):
print(i, end=" ")
| false | 50 | [
"-import numpy as np",
"-",
"+lower = x - k + 1",
"-lower = x - k + 1",
"-if lower == upper:",
"- print(lower)",
"-else:",
"- for i in range(lower, upper + 1):",
"- print(i, end=\" \")",
"+for i in range(lower, upper + 1):",
"+ print(i, end=\" \")"
] | false | 0.036124 | 0.081614 | 0.442615 | [
"s526419928",
"s912695727"
] |
u096616343 | p03241 | python | s699641740 | s892338207 | 489 | 171 | 40,044 | 38,640 | Accepted | Accepted | 65.03 | N, M = list(map(int,input().split()))
for i in range(M // N, 0, -1):
if M % i == 0:
print(i)
break | N, M = list(map(int,input().split()))
lim = M // N
ans = 0
for i in range(1, int(M ** (1/2)) + 1):
if M % i == 0:
if ans < i <= lim:
ans = i
if ans < M // i <= lim:
ans = M // i
print(ans) | 5 | 10 | 116 | 235 | N, M = list(map(int, input().split()))
for i in range(M // N, 0, -1):
if M % i == 0:
print(i)
break
| N, M = list(map(int, input().split()))
lim = M // N
ans = 0
for i in range(1, int(M ** (1 / 2)) + 1):
if M % i == 0:
if ans < i <= lim:
ans = i
if ans < M // i <= lim:
ans = M // i
print(ans)
| false | 50 | [
"-for i in range(M // N, 0, -1):",
"+lim = M // N",
"+ans = 0",
"+for i in range(1, int(M ** (1 / 2)) + 1):",
"- print(i)",
"- break",
"+ if ans < i <= lim:",
"+ ans = i",
"+ if ans < M // i <= lim:",
"+ ans = M // i",
"+print(ans)"
] | false | 0.110677 | 0.063603 | 1.740133 | [
"s699641740",
"s892338207"
] |
u469700628 | p03369 | python | s090159846 | s359979947 | 24 | 17 | 3,684 | 2,940 | Accepted | Accepted | 29.17 | from functools import reduce
order = eval(input())
res = 700 + reduce(lambda x, y: x + y,
[100 if x == "o" else 0 for x in list(order)])
print(res) | # from functools import reduce
order = eval(input())
res = 700
# res = 700 + reduce(lambda x, y: x + y,
# map(lambda x: 100 if x == "o" else 0, list(order)))
for i in order:
if i == "o":
res += 100
print(res) | 6 | 10 | 171 | 243 | from functools import reduce
order = eval(input())
res = 700 + reduce(lambda x, y: x + y, [100 if x == "o" else 0 for x in list(order)])
print(res)
| # from functools import reduce
order = eval(input())
res = 700
# res = 700 + reduce(lambda x, y: x + y,
# map(lambda x: 100 if x == "o" else 0, list(order)))
for i in order:
if i == "o":
res += 100
print(res)
| false | 40 | [
"-from functools import reduce",
"-",
"+# from functools import reduce",
"-res = 700 + reduce(lambda x, y: x + y, [100 if x == \"o\" else 0 for x in list(order)])",
"+res = 700",
"+# res = 700 + reduce(lambda x, y: x + y,",
"+# map(lambda x: 100 if x == \"o\" else 0, list(order)))",
... | false | 0.041759 | 0.041436 | 1.007788 | [
"s090159846",
"s359979947"
] |
u974620347 | p03163 | python | s267206809 | s137159318 | 633 | 567 | 119,148 | 120,684 | Accepted | Accepted | 10.43 | def main():
N, W = [int(n) for n in input().split()]
baggages = [[int(n) for n in input().split()] for i in range(N)]
VALUE, WEIGHT = 1, 0
dp = [[-1] * (W+1) for n in range(N)]
# dp[baggage][weight] := baggage番目までの荷物を使ってweight以下に抑える
dp[0] = [0 if weight < baggages[0][WEIGHT] else baggage... | N,W = [int(_n) for _n in input().split()]
A = []
for i in range(N):
w,v = [int(_n) for _n in input().split()]
A.append((w,v))
dp = [[0]*(W+1) for _ in range(N)]
for w in range(W+1):
dp[0][w] = 0 if w < A[0][0] else A[0][1]
for i in range(N):
for w in range(W+1):
dp[i][w] = dp[i-1][... | 25 | 16 | 866 | 437 | def main():
N, W = [int(n) for n in input().split()]
baggages = [[int(n) for n in input().split()] for i in range(N)]
VALUE, WEIGHT = 1, 0
dp = [[-1] * (W + 1) for n in range(N)]
# dp[baggage][weight] := baggage番目までの荷物を使ってweight以下に抑える
dp[0] = [
0 if weight < baggages[0][WEIGHT] else bagg... | N, W = [int(_n) for _n in input().split()]
A = []
for i in range(N):
w, v = [int(_n) for _n in input().split()]
A.append((w, v))
dp = [[0] * (W + 1) for _ in range(N)]
for w in range(W + 1):
dp[0][w] = 0 if w < A[0][0] else A[0][1]
for i in range(N):
for w in range(W + 1):
dp[i][w] = dp[i - 1][w... | false | 36 | [
"-def main():",
"- N, W = [int(n) for n in input().split()]",
"- baggages = [[int(n) for n in input().split()] for i in range(N)]",
"- VALUE, WEIGHT = 1, 0",
"- dp = [[-1] * (W + 1) for n in range(N)]",
"- # dp[baggage][weight] := baggage番目までの荷物を使ってweight以下に抑える",
"- dp[0] = [",
"- ... | false | 0.036825 | 0.036609 | 1.005925 | [
"s267206809",
"s137159318"
] |
u638456847 | p02972 | python | s224957352 | s379158085 | 635 | 232 | 14,088 | 14,088 | Accepted | Accepted | 63.46 | N = int(eval(input()))
a = [int(i) for i in input().split()]
b = [0]*N
ans = []
for i in range(N, 0, -1):
s = 0
for j in range(i, N+1, i):
s += b[j-1]
if s % 2 != a[i-1]:
b[i-1] += 1
ans.append(i)
print((sum(b)))
if len(ans) > 0:
print((*ans)) | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N = int(readline())
A = [int(i) for i in readline().split()]
ans = []
B = [0] * N
for i in reversed(list(range(N))):
s = sum(B[i::i+1])
if s % 2 == A[i]:
... | 16 | 27 | 290 | 505 | N = int(eval(input()))
a = [int(i) for i in input().split()]
b = [0] * N
ans = []
for i in range(N, 0, -1):
s = 0
for j in range(i, N + 1, i):
s += b[j - 1]
if s % 2 != a[i - 1]:
b[i - 1] += 1
ans.append(i)
print((sum(b)))
if len(ans) > 0:
print((*ans))
| import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N = int(readline())
A = [int(i) for i in readline().split()]
ans = []
B = [0] * N
for i in reversed(list(range(N))):
s = sum(B[i :: i + 1])
if s % 2 == A[i]:
cont... | false | 40.740741 | [
"-N = int(eval(input()))",
"-a = [int(i) for i in input().split()]",
"-b = [0] * N",
"-ans = []",
"-for i in range(N, 0, -1):",
"- s = 0",
"- for j in range(i, N + 1, i):",
"- s += b[j - 1]",
"- if s % 2 != a[i - 1]:",
"- b[i - 1] += 1",
"- ans.append(i)",
"-print... | false | 0.085125 | 0.038765 | 2.19591 | [
"s224957352",
"s379158085"
] |
u644907318 | p02990 | python | s214360638 | s055205250 | 212 | 85 | 42,352 | 74,244 | Accepted | Accepted | 59.91 | p = 10**9+7
def pow(x,m):
if m==0:
return 1
if m==1:
return x
if m%2==0:
return (pow(x,m//2)**2)%p
else:
return (x*pow(x,(m-1)//2)**2)%p
N,K = list(map(int,input().split()))
A = [1 for _ in range(N+1)]
for i in range(2,N+1):
A[i] = (i*A[i-1])%p
B = [1 fo... | p = 10**9+7
def pow(x,m):
if m==0:
return 1
if m==1:
return x
if m%2==0:
return (pow(x,m//2)**2)%p
else:
return (x*(pow(x,(m-1)//2)**2)%p)%p
N,K = list(map(int,input().split()))
A = [1 for _ in range(N+1)]
for i in range(2,N+1):
A[i] = (i*A[i-1])%p
B = [... | 28 | 30 | 633 | 670 | p = 10**9 + 7
def pow(x, m):
if m == 0:
return 1
if m == 1:
return x
if m % 2 == 0:
return (pow(x, m // 2) ** 2) % p
else:
return (x * pow(x, (m - 1) // 2) ** 2) % p
N, K = list(map(int, input().split()))
A = [1 for _ in range(N + 1)]
for i in range(2, N + 1):
A[i... | p = 10**9 + 7
def pow(x, m):
if m == 0:
return 1
if m == 1:
return x
if m % 2 == 0:
return (pow(x, m // 2) ** 2) % p
else:
return (x * (pow(x, (m - 1) // 2) ** 2) % p) % p
N, K = list(map(int, input().split()))
A = [1 for _ in range(N + 1)]
for i in range(2, N + 1):
... | false | 6.666667 | [
"- return (x * pow(x, (m - 1) // 2) ** 2) % p",
"+ return (x * (pow(x, (m - 1) // 2) ** 2) % p) % p",
"- if N - K - i + 1 >= 0:",
"- a = (A[K - 1] * B[i - 1]) % p",
"+ if N - K < i - 1:",
"+ ans = 0",
"+ else:",
"+ a = A[K - 1]",
"- a = (a * A[N - K... | false | 0.03906 | 0.038091 | 1.025427 | [
"s214360638",
"s055205250"
] |
u638456847 | p03027 | python | s850898730 | s361217471 | 1,297 | 602 | 77,000 | 76,252 | Accepted | Accepted | 53.59 | ####################
# AC: ms (PyPy)
####################
def main():
MOD = 10**6+3
# preprocess
fac = [None] * (MOD+1)
fac[0] = fac[1] = 1
for i in range(2, MOD+1):
fac[i] = (fac[i-1] * i) % MOD
Q = int(eval(input()))
for i in range(Q):
x, d, n = list(ma... | import sys
def main():
MOD = 10**6+3
# preprocess
fac = [None] * (MOD+1)
fac[0] = fac[1] = 1
for i in range(2, MOD+1):
fac[i] = (fac[i-1] * i) % MOD
Q = int(eval(input()))
for i in range(Q):
x, d, n = list(map(int, sys.stdin.readline().split()))
if ... | 34 | 29 | 735 | 641 | ####################
# AC: ms (PyPy)
####################
def main():
MOD = 10**6 + 3
# preprocess
fac = [None] * (MOD + 1)
fac[0] = fac[1] = 1
for i in range(2, MOD + 1):
fac[i] = (fac[i - 1] * i) % MOD
Q = int(eval(input()))
for i in range(Q):
x, d, n = list(map(int, i... | import sys
def main():
MOD = 10**6 + 3
# preprocess
fac = [None] * (MOD + 1)
fac[0] = fac[1] = 1
for i in range(2, MOD + 1):
fac[i] = (fac[i - 1] * i) % MOD
Q = int(eval(input()))
for i in range(Q):
x, d, n = list(map(int, sys.stdin.readline().split()))
if d == 0:
... | false | 14.705882 | [
"-####################",
"-# AC: ms (PyPy)",
"-####################",
"+import sys",
"+",
"+",
"- x, d, n = list(map(int, input().split()))",
"- if x == 0:",
"- print((0))",
"- continue",
"+ x, d, n = list(map(int, sys.stdin.readline().split()))",
... | false | 0.754022 | 0.358863 | 2.10114 | [
"s850898730",
"s361217471"
] |
u072053884 | p02315 | python | s132030714 | s474849596 | 380 | 350 | 8,480 | 8,356 | Accepted | Accepted | 7.89 | import sys
def solve():
file_input = sys.stdin
N, W = list(map(int, file_input.readline().split()))
C = [0] * (W + 1)
for line in file_input:
item_v, item_w = list(map(int, line.split()))
for i, vals in enumerate(zip(C[item_w:], C)):
C[i] = max(vals[0] + item_v, val... | import sys
def solve():
file_input = sys.stdin
N, W = list(map(int, file_input.readline().split()))
C = [0] * (W + 1)
for line in file_input:
item_v, item_w = list(map(int, line.split()))
for i, vals in enumerate(zip(C[item_w:], C)):
v1, v2 = vals
C[i] ... | 13 | 14 | 341 | 358 | import sys
def solve():
file_input = sys.stdin
N, W = list(map(int, file_input.readline().split()))
C = [0] * (W + 1)
for line in file_input:
item_v, item_w = list(map(int, line.split()))
for i, vals in enumerate(zip(C[item_w:], C)):
C[i] = max(vals[0] + item_v, vals[1])
... | import sys
def solve():
file_input = sys.stdin
N, W = list(map(int, file_input.readline().split()))
C = [0] * (W + 1)
for line in file_input:
item_v, item_w = list(map(int, line.split()))
for i, vals in enumerate(zip(C[item_w:], C)):
v1, v2 = vals
C[i] = max(v1 ... | false | 7.142857 | [
"- C[i] = max(vals[0] + item_v, vals[1])",
"+ v1, v2 = vals",
"+ C[i] = max(v1 + item_v, v2)"
] | false | 0.04828 | 0.040472 | 1.192922 | [
"s132030714",
"s474849596"
] |
u729133443 | p03623 | python | s344717753 | s041364774 | 169 | 23 | 38,428 | 9,132 | Accepted | Accepted | 86.39 | x,a,b=list(map(int,input().split()));print(('AB'[abs(a-x)>abs(b-x)])) | x,a,b=list(map(int,input().split()))
print(('AB'[(x+x>a+b)^(a>b)])) | 1 | 2 | 61 | 60 | x, a, b = list(map(int, input().split()))
print(("AB"[abs(a - x) > abs(b - x)]))
| x, a, b = list(map(int, input().split()))
print(("AB"[(x + x > a + b) ^ (a > b)]))
| false | 50 | [
"-print((\"AB\"[abs(a - x) > abs(b - x)]))",
"+print((\"AB\"[(x + x > a + b) ^ (a > b)]))"
] | false | 0.063613 | 0.036127 | 1.760811 | [
"s344717753",
"s041364774"
] |
u672898046 | p03723 | python | s892086997 | s479546950 | 29 | 24 | 9,096 | 9,044 | Accepted | Accepted | 17.24 | a, b, c = list(map(int, input().split()))
if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
print((0))
exit()
if a == b == c:
print((-1))
exit()
cnt = 0
while (a % 2 == 0 and b % 2 == 0 and c % 2 == 0):
a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
cnt += 1
print(cnt)
| def resolve():
a, b, c = list(map(int, input().split()))
if a%2 != 0 or b%2 != 0 or c%2 != 0:
print((0))
exit()
if a == b == c:
print((-1))
exit()
ans = 0
while (a % 2 == 0 and b % 2 == 0 and c % 2 == 0):
a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
... | 16 | 14 | 304 | 349 | a, b, c = list(map(int, input().split()))
if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
print((0))
exit()
if a == b == c:
print((-1))
exit()
cnt = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
cnt += 1
print(cnt)
| def resolve():
a, b, c = list(map(int, input().split()))
if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
print((0))
exit()
if a == b == c:
print((-1))
exit()
ans = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
... | false | 12.5 | [
"-a, b, c = list(map(int, input().split()))",
"-if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:",
"- print((0))",
"- exit()",
"-if a == b == c:",
"- print((-1))",
"- exit()",
"-cnt = 0",
"-while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:",
"- a, b, c = (b + c) // 2, (a + c) // 2, (a + b) ... | false | 0.059704 | 0.03545 | 1.684195 | [
"s892086997",
"s479546950"
] |
u780025254 | p02408 | python | s525642682 | s801968316 | 40 | 20 | 7,784 | 5,604 | Accepted | Accepted | 50 | num = int(eval(input()))
cards = [ (design, rank) for design in ['S','H','C','D'] for rank in range(1,14) ]
for i in range(num):
design, rank = input().split()
cards.remove((design, int(rank)))
for (design, rank) in cards:
print((design, rank))
| list = []
for x in ["S", "H", "C", "D"]:
for y in [str(i) for i in range(1, 14)]:
list.append(x+" "+y)
n = int(eval(input()))
while n > 0:
list.remove(eval(input()))
n -= 1
for i in list:
print(i)
| 8 | 10 | 260 | 218 | num = int(eval(input()))
cards = [(design, rank) for design in ["S", "H", "C", "D"] for rank in range(1, 14)]
for i in range(num):
design, rank = input().split()
cards.remove((design, int(rank)))
for (design, rank) in cards:
print((design, rank))
| list = []
for x in ["S", "H", "C", "D"]:
for y in [str(i) for i in range(1, 14)]:
list.append(x + " " + y)
n = int(eval(input()))
while n > 0:
list.remove(eval(input()))
n -= 1
for i in list:
print(i)
| false | 20 | [
"-num = int(eval(input()))",
"-cards = [(design, rank) for design in [\"S\", \"H\", \"C\", \"D\"] for rank in range(1, 14)]",
"-for i in range(num):",
"- design, rank = input().split()",
"- cards.remove((design, int(rank)))",
"-for (design, rank) in cards:",
"- print((design, rank))",
"+list ... | false | 0.047586 | 0.047469 | 1.002464 | [
"s525642682",
"s801968316"
] |
u279955105 | p02390 | python | s468354899 | s566806393 | 70 | 20 | 7,664 | 7,668 | Accepted | Accepted | 71.43 | t = int(eval(input()))
h = int(t/3600)
m = int(t%3600/60)
s = int(t%3600%60)
print((str(h) + ":" + str(m) + ":" + str(s))) | S = int(eval(input()))
h = int(S/3600)
m = int(S%3600/60)
s = int(S%3600%60)
print((str(h) + ":" + str(m) + ":" + str(s))) | 5 | 5 | 118 | 118 | t = int(eval(input()))
h = int(t / 3600)
m = int(t % 3600 / 60)
s = int(t % 3600 % 60)
print((str(h) + ":" + str(m) + ":" + str(s)))
| S = int(eval(input()))
h = int(S / 3600)
m = int(S % 3600 / 60)
s = int(S % 3600 % 60)
print((str(h) + ":" + str(m) + ":" + str(s)))
| false | 0 | [
"-t = int(eval(input()))",
"-h = int(t / 3600)",
"-m = int(t % 3600 / 60)",
"-s = int(t % 3600 % 60)",
"+S = int(eval(input()))",
"+h = int(S / 3600)",
"+m = int(S % 3600 / 60)",
"+s = int(S % 3600 % 60)"
] | false | 0.037416 | 0.085146 | 0.439431 | [
"s468354899",
"s566806393"
] |
u270144704 | p02683 | python | s334864683 | s347865097 | 98 | 86 | 69,300 | 69,288 | Accepted | Accepted | 12.24 | n, m, x = list(map(int, input().split()))
CA = [tuple(map(int, input().split())) for _ in range(n)]
minimum = float("inf")
for i in range(2**n):
select = [0] * n
a = [0] * m
money = 0
for j in range(n):
if (i>>j)&1:
select[n-1-j] = 1
for i, v in enumerate(select):
... | n, m, x = list(map(int, input().split()))
CA = [tuple(map(int, input().split())) for _ in range(n)]
minimum = float("inf")
for i in range(2**n):
select = [0] * n
a = [0] * m
money = 0
for j in range(n):
if (i>>j)&1:
select[n-1-j] = 1
for i, v in enumerate(select):
... | 19 | 19 | 557 | 567 | n, m, x = list(map(int, input().split()))
CA = [tuple(map(int, input().split())) for _ in range(n)]
minimum = float("inf")
for i in range(2**n):
select = [0] * n
a = [0] * m
money = 0
for j in range(n):
if (i >> j) & 1:
select[n - 1 - j] = 1
for i, v in enumerate(select):
... | n, m, x = list(map(int, input().split()))
CA = [tuple(map(int, input().split())) for _ in range(n)]
minimum = float("inf")
for i in range(2**n):
select = [0] * n
a = [0] * m
money = 0
for j in range(n):
if (i >> j) & 1:
select[n - 1 - j] = 1
for i, v in enumerate(select):
... | false | 0 | [
"- if all(l >= x for l in a):",
"+ if not len([l for l in a if l < x]):"
] | false | 0.038314 | 0.039831 | 0.96191 | [
"s334864683",
"s347865097"
] |
u044220565 | p02617 | python | s441860115 | s164522744 | 649 | 552 | 9,276 | 9,004 | Accepted | Accepted | 14.95 | # coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#i... | # coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#i... | 46 | 46 | 1,089 | 1,084 | # coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10**7)
from heapq import heappop, heappush
# from collections import OrderedDict, defaultdict
# import math
# from itertools import product, accumulate, combinations, product
# import ... | # coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10**7)
from heapq import heappop, heappush
# from collections import OrderedDict, defaultdict
# import math
# from itertools import product, accumulate, combinations, product
# import ... | false | 0 | [
"- l, r = min(a, b), max(a, b)",
"- return (r - l + 1) * (r + l) // 2",
"+ if a > b:",
"+ a, b = b, a",
"+ return (b - a + 1) * (b + a) // 2"
] | false | 0.073396 | 0.070569 | 1.040058 | [
"s441860115",
"s164522744"
] |
u002459665 | p03086 | python | s575815739 | s688899449 | 44 | 17 | 2,940 | 3,060 | Accepted | Accepted | 61.36 | s = eval(input())
c = 0
mx = 0
for si in s:
if si in ("A", "C", "G", "T"):
c += 1
if c > mx:
mx = c
else:
c = 0
print(mx)
| S = eval(input())
mx = 0
for i in range(len(S)):
for j in range(i, len(S) + 1):
s = S[i:j]
flag = True
for si in s:
if si not in ["A", "C", "G", "T"]:
flag = False
if flag:
mx = max(mx, len(s))
print(mx)
| 13 | 13 | 174 | 287 | s = eval(input())
c = 0
mx = 0
for si in s:
if si in ("A", "C", "G", "T"):
c += 1
if c > mx:
mx = c
else:
c = 0
print(mx)
| S = eval(input())
mx = 0
for i in range(len(S)):
for j in range(i, len(S) + 1):
s = S[i:j]
flag = True
for si in s:
if si not in ["A", "C", "G", "T"]:
flag = False
if flag:
mx = max(mx, len(s))
print(mx)
| false | 0 | [
"-s = eval(input())",
"-c = 0",
"+S = eval(input())",
"-for si in s:",
"- if si in (\"A\", \"C\", \"G\", \"T\"):",
"- c += 1",
"- if c > mx:",
"- mx = c",
"- else:",
"- c = 0",
"+for i in range(len(S)):",
"+ for j in range(i, len(S) + 1):",
"+ ... | false | 0.042845 | 0.077314 | 0.554165 | [
"s575815739",
"s688899449"
] |
u223646582 | p03426 | python | s972063139 | s751604345 | 951 | 730 | 19,544 | 114,908 | Accepted | Accepted | 23.24 | H, W, D = list(map(int, input().split()))
A = [[int(j) for j in input().split()] for i in range(H)]
B = [(-1, -1) for j in range(H*W)]
for i in range(H):
for j in range(W):
B[A[i][j]-1] = (i, j)
C = [-1] * H*W
for i in range(H*W-D):
fx, fy = B[i+D]
tx, ty = B[i]
C[i] = abs(fx-tx)+abs... | H, W, D = list(map(int, input().split()))
A = [[int(i) for i in input().split()] for _ in range(H)]
Q = int(eval(input()))
query = [(int(i) for i in input().split()) for _ in range(Q)]
x = [-1]*H*W
y = [-1]*H*W
for i in range(H):
for j in range(W):
x[A[i][j]-1] = i
y[A[i][j]-1] = j
X... | 25 | 24 | 559 | 543 | H, W, D = list(map(int, input().split()))
A = [[int(j) for j in input().split()] for i in range(H)]
B = [(-1, -1) for j in range(H * W)]
for i in range(H):
for j in range(W):
B[A[i][j] - 1] = (i, j)
C = [-1] * H * W
for i in range(H * W - D):
fx, fy = B[i + D]
tx, ty = B[i]
C[i] = abs(fx - tx) +... | H, W, D = list(map(int, input().split()))
A = [[int(i) for i in input().split()] for _ in range(H)]
Q = int(eval(input()))
query = [(int(i) for i in input().split()) for _ in range(Q)]
x = [-1] * H * W
y = [-1] * H * W
for i in range(H):
for j in range(W):
x[A[i][j] - 1] = i
y[A[i][j] - 1] = j
X = [... | false | 4 | [
"-A = [[int(j) for j in input().split()] for i in range(H)]",
"-B = [(-1, -1) for j in range(H * W)]",
"+A = [[int(i) for i in input().split()] for _ in range(H)]",
"+Q = int(eval(input()))",
"+query = [(int(i) for i in input().split()) for _ in range(Q)]",
"+x = [-1] * H * W",
"+y = [-1] * H * W",
"-... | false | 0.043983 | 0.046235 | 0.951287 | [
"s972063139",
"s751604345"
] |
u426534722 | p02245 | python | s515806773 | s234078733 | 880 | 60 | 31,360 | 8,884 | Accepted | Accepted | 93.18 | from heapq import heapify, heappush, heappop
from collections import deque
from copy import deepcopy, copy
N = 3
m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}
def g(i, j, a):
if i > j:
i, j = j, i
return a[:i] + a[j] + a[i + 1:j]... | from collections import deque
N = 3
def g(i, j, a):
if i > j:
i, j = j, i
return a[:i] + a[j] + a[i + 1:j] + a[i] + a[j + 1:]
goal = "123456780"
def solve():
m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}
MAP = "".join(in... | 31 | 30 | 901 | 920 | from heapq import heapify, heappush, heappop
from collections import deque
from copy import deepcopy, copy
N = 3
m = {
8: {7, 5},
7: {8, 6, 4},
6: {7, 3},
5: {8, 4, 2},
4: {7, 5, 3, 1},
3: {6, 4, 0},
2: {5, 1},
1: {4, 2, 0},
0: {3, 1},
}
def g(i, j, a):
if i > j:
i, j ... | from collections import deque
N = 3
def g(i, j, a):
if i > j:
i, j = j, i
return a[:i] + a[j] + a[i + 1 : j] + a[i] + a[j + 1 :]
goal = "123456780"
def solve():
m = {
8: {7, 5},
7: {8, 6, 4},
6: {7, 3},
5: {8, 4, 2},
4: {7, 5, 3, 1},
3: {6, 4, 0... | false | 3.225806 | [
"-from heapq import heapify, heappush, heappop",
"-from copy import deepcopy, copy",
"-m = {",
"- 8: {7, 5},",
"- 7: {8, 6, 4},",
"- 6: {7, 3},",
"- 5: {8, 4, 2},",
"- 4: {7, 5, 3, 1},",
"- 3: {6, 4, 0},",
"- 2: {5, 1},",
"- 1: {4, 2, 0},",
"- 0: {3, 1},",
"-}",
... | false | 0.117803 | 0.03993 | 2.950264 | [
"s515806773",
"s234078733"
] |
u263830634 | p02936 | python | s308320229 | s418884715 | 1,862 | 1,188 | 55,856 | 55,856 | Accepted | Accepted | 36.2 | N, Q = list(map(int, input().split()))
graph = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
count = [0] * N
for _ in range(Q):
p, x = list(map(int, input().split()))
count[p - 1] += x
... | import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
graph = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
count = [0] * N
for _ in range(Q):
p, x = list(map(int, inpu... | 26 | 30 | 558 | 634 | N, Q = list(map(int, input().split()))
graph = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
count = [0] * N
for _ in range(Q):
p, x = list(map(int, input().split()))
count[p - 1] += x
used = [False] *... | import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
graph = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
count = [0] * N
for _ in range(Q):
p, x = list(map(int, input().split()))... | false | 13.333333 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+s_pop = stack.pop",
"+s_append = stack.append",
"- tmp = stack.pop()",
"+ tmp = s_pop()",
"- stack.append(i)",
"+ s_append(i)"
] | false | 0.042103 | 0.058768 | 0.71643 | [
"s308320229",
"s418884715"
] |
u386819480 | p04045 | python | s751677948 | s929094410 | 264 | 76 | 3,064 | 3,064 | Accepted | Accepted | 71.21 | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, D: "List[int]"):
while(True):
nl = list(map(int,list(str(N))))
f = True
for i in range(len(nl)):
if(nl[i] in D):
f = False
if(f):
print(N)
exit()
... | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, D: "List[int]"):
d = set(map(str, D))
while set(str(N))&d:
N += 1
print(N)
return
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line... | 35 | 28 | 915 | 732 | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, D: "List[int]"):
while True:
nl = list(map(int, list(str(N))))
f = True
for i in range(len(nl)):
if nl[i] in D:
f = False
if f:
print(N)
exit()
else:
... | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, D: "List[int]"):
d = set(map(str, D))
while set(str(N)) & d:
N += 1
print(N)
return
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your... | false | 20 | [
"- while True:",
"- nl = list(map(int, list(str(N))))",
"- f = True",
"- for i in range(len(nl)):",
"- if nl[i] in D:",
"- f = False",
"- if f:",
"- print(N)",
"- exit()",
"- else:",
"- N += 1",
"+... | false | 0.042171 | 0.006917 | 6.096648 | [
"s751677948",
"s929094410"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.