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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u526094365 | p02831 | python | s980632992 | s828380285 | 53 | 35 | 5,688 | 5,052 | Accepted | Accepted | 33.96 | import fractions
A, B = list(map(int, input().split()))
def abc(A, B):
return (A*B) // fractions.gcd(A, B)
print((abc(A, B)))
| import fractions
A, B = list(map(int, input().split()))
print((int(A*B/fractions.gcd(A, B))))
| 10 | 4 | 136 | 90 | import fractions
A, B = list(map(int, input().split()))
def abc(A, B):
return (A * B) // fractions.gcd(A, B)
print((abc(A, B)))
| import fractions
A, B = list(map(int, input().split()))
print((int(A * B / fractions.gcd(A, B))))
| false | 60 | [
"-",
"-",
"-def abc(A, B):",
"- return (A * B) // fractions.gcd(A, B)",
"-",
"-",
"-print((abc(A, B)))",
"+print((int(A * B / fractions.gcd(A, B))))"
] | false | 0.176245 | 0.075062 | 2.347992 | [
"s980632992",
"s828380285"
] |
u922449550 | p02599 | python | s821371826 | s570969522 | 1,998 | 1,441 | 236,172 | 172,668 | Accepted | Accepted | 27.88 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
class SegmentTree:
def __init__(self, a):
self.padding = 0
self.n = len(a)
self.N = 2 ** (self.n-1).bit_length()
self.seg_data = [self.padding]*(self.N... | class SegmentTree:
def __init__(self, a):
self.padding = 0
self.n = len(a)
self.N = 2 ** (self.n-1).bit_length()
self.seg_data = [self.padding]*(self.N-1) + a + [self.padding]*(self.N-self.n)
for i in range(2*self.N-2, 0, -2):
self.seg_data[(i-1)//2] = self... | 73 | 66 | 2,060 | 1,967 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
class SegmentTree:
def __init__(self, a):
self.padding = 0
self.n = len(a)
self.N = 2 ** (self.n - 1).bit_length()
self.seg_data = (
[self.padding] * (se... | class SegmentTree:
def __init__(self, a):
self.padding = 0
self.n = len(a)
self.N = 2 ** (self.n - 1).bit_length()
self.seg_data = (
[self.padding] * (self.N - 1) + a + [self.padding] * (self.N - self.n)
)
for i in range(2 * self.N - 2, 0, -2):
... | false | 9.589041 | [
"-import sys",
"-",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"-",
"-",
"-N, Q = map(int, readline().split())",
"-C = list(map(int, readline().split()))",
"-data = list(map(int, read().split()))",
"-lr = [[i, data[2 * i],... | false | 0.035738 | 0.03688 | 0.969021 | [
"s821371826",
"s570969522"
] |
u200887663 | p02719 | python | s026179748 | s538137079 | 142 | 43 | 5,688 | 5,560 | Accepted | Accepted | 69.72 | #n=int(input())
n,k=list(map(int,input().split()))
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
ans=0
import fractions
newval=n%k
if n>=k:
if n%k==0:
ans=0
else:
#ans=fractions.gcd(n,k)
ans=n%k
templ=[]
ans=min(ans,... | #n=int(input())
n,k=list(map(int,input().split()))
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
ans=0
import fractions
newval=n%k
if n>=k:
ans=min(n%k,abs(k-n%k))
else:
ans=min(k-n,n)
print(ans) | 21 | 12 | 418 | 250 | # n=int(input())
n, k = list(map(int, input().split()))
# l=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
ans = 0
import fractions
newval = n % k
if n >= k:
if n % k == 0:
ans = 0
else:
# ans=fractions.gcd(n,k)
ans = n % k
templ = []
... | # n=int(input())
n, k = list(map(int, input().split()))
# l=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
ans = 0
import fractions
newval = n % k
if n >= k:
ans = min(n % k, abs(k - n % k))
else:
ans = min(k - n, n)
print(ans)
| false | 42.857143 | [
"- if n % k == 0:",
"- ans = 0",
"- else:",
"- # ans=fractions.gcd(n,k)",
"- ans = n % k",
"- templ = []",
"- ans = min(ans, abs(ans - k))",
"+ ans = min(n % k, abs(k - n % k))",
"- # ans=fractions.gcd(n,k)",
"- ans = n % k",
"- ans = min(ans,... | false | 0.034587 | 0.054087 | 0.639474 | [
"s026179748",
"s538137079"
] |
u519939795 | p03073 | python | s838571985 | s028746281 | 69 | 59 | 3,188 | 3,956 | Accepted | Accepted | 14.49 | S = eval(input())
C = ["0","1"]
count1=count2=0
for i in range(len(S)):
# case 1
if S[i] == C[i%2]:
count1+=1
# case 2
if S[i] == C[(i+1)%2]:
count2+=1
print((min([count1, count2])))
| s = list(str(eval(input())))
n = len(s)
cnt = 0
for i in range(n):
if (i % 2) != int(s[i]):
cnt += 1
print((min(cnt, n - cnt)))
| 13 | 7 | 206 | 138 | S = eval(input())
C = ["0", "1"]
count1 = count2 = 0
for i in range(len(S)):
# case 1
if S[i] == C[i % 2]:
count1 += 1
# case 2
if S[i] == C[(i + 1) % 2]:
count2 += 1
print((min([count1, count2])))
| s = list(str(eval(input())))
n = len(s)
cnt = 0
for i in range(n):
if (i % 2) != int(s[i]):
cnt += 1
print((min(cnt, n - cnt)))
| false | 46.153846 | [
"-S = eval(input())",
"-C = [\"0\", \"1\"]",
"-count1 = count2 = 0",
"-for i in range(len(S)):",
"- # case 1",
"- if S[i] == C[i % 2]:",
"- count1 += 1",
"- # case 2",
"- if S[i] == C[(i + 1) % 2]:",
"- count2 += 1",
"-print((min([count1, count2])))",
"+s = list(str(e... | false | 0.044207 | 0.040468 | 1.092412 | [
"s838571985",
"s028746281"
] |
u060938295 | p02691 | python | s247088388 | s106112613 | 431 | 173 | 50,924 | 50,904 | Accepted | Accepted | 59.86 | # -*- coding: utf-8 -*-
"""
Created on Sun May 3 21:27:48 2020
"""
import sys
import numpy as np
import itertools
sys.setrecursionlimit(10 ** 9)
#def input():
# return sys.stdin.readline()[:-1]
mod = 10**9+7
N = int(eval(input()))
#X, Y = map(int,input().split())
A = list(map(int,input().split())... | # -*- coding: utf-8 -*-
"""
Created on Sun May 3 21:27:48 2020
"""
import sys
import numpy as np
import itertools
sys.setrecursionlimit(10 ** 9)
N = int(eval(input()))
A = np.array(list(map(int,input().split())))
B = np.arange(N)
x = B - A
y = B + A
x = x[x>0]
y = y[y<N]
x_count = np.bincount(x,... | 53 | 25 | 942 | 419 | # -*- coding: utf-8 -*-
"""
Created on Sun May 3 21:27:48 2020
"""
import sys
import numpy as np
import itertools
sys.setrecursionlimit(10**9)
# def input():
# return sys.stdin.readline()[:-1]
mod = 10**9 + 7
N = int(eval(input()))
# X, Y = map(int,input().split())
A = list(map(int, input().split()))
A = np.array(... | # -*- coding: utf-8 -*-
"""
Created on Sun May 3 21:27:48 2020
"""
import sys
import numpy as np
import itertools
sys.setrecursionlimit(10**9)
N = int(eval(input()))
A = np.array(list(map(int, input().split())))
B = np.arange(N)
x = B - A
y = B + A
x = x[x > 0]
y = y[y < N]
x_count = np.bincount(x, minlength=N)
y_cou... | false | 52.830189 | [
"-# def input():",
"-# return sys.stdin.readline()[:-1]",
"-mod = 10**9 + 7",
"-# X, Y = map(int,input().split())",
"-A = list(map(int, input().split()))",
"-A = np.array(A)",
"+A = np.array(list(map(int, input().split())))",
"-x = A - B",
"-y = A + B",
"-x.sort()",
"-y.sort()",
"-ans = 0",... | false | 0.17816 | 0.175831 | 1.013249 | [
"s247088388",
"s106112613"
] |
u957872856 | p02814 | python | s096211389 | s877390842 | 486 | 254 | 89,580 | 16,316 | Accepted | Accepted | 47.74 | from fractions import gcd
def lcm(p,q):
return p*q//gcd(p,q)
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
x = 1
for i in range(n):
a[i] = a[i]//2
x = lcm(x,a[i])
for i in range(n):
if (x//a[i])%2==0:
print((0))
exit()
p = m//x
print((p//2 if p%2... | from fractions import gcd
def lcm(p,q):
return p*q//gcd(p,q)
N, M = list(map(int, input().split()))
a = [int(i)//2 for i in input().split()]
x = 1
for i in range(N):
x = lcm(x, a[i])
for i in range(N):
if (x//a[i])%2==0:
print((0))
exit()
num = M//x
print((num//2 if num%2==0 else num//2+1))... | 15 | 14 | 327 | 311 | from fractions import gcd
def lcm(p, q):
return p * q // gcd(p, q)
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
x = 1
for i in range(n):
a[i] = a[i] // 2
x = lcm(x, a[i])
for i in range(n):
if (x // a[i]) % 2 == 0:
print((0))
exit()
p = m // x
print((p /... | from fractions import gcd
def lcm(p, q):
return p * q // gcd(p, q)
N, M = list(map(int, input().split()))
a = [int(i) // 2 for i in input().split()]
x = 1
for i in range(N):
x = lcm(x, a[i])
for i in range(N):
if (x // a[i]) % 2 == 0:
print((0))
exit()
num = M // x
print((num // 2 if num... | false | 6.666667 | [
"-n, m = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"+N, M = list(map(int, input().split()))",
"+a = [int(i) // 2 for i in input().split()]",
"-for i in range(n):",
"- a[i] = a[i] // 2",
"+for i in range(N):",
"-for i in range(n):",
"+for i in range(N):",
"-p = m ... | false | 0.048229 | 0.06003 | 0.803417 | [
"s096211389",
"s877390842"
] |
u531599639 | p02881 | python | s586560327 | s656349468 | 202 | 163 | 9,064 | 9,136 | Accepted | Accepted | 19.31 | n = int(eval(input()))
def divisor(n):
i = 1
a = 0
b = 0
out = float('inf')
while i * i <= n:
if n%i == 0:
a = i
b = n//i
if a+b < out:
out = a+b
i += 1
return out
print((divisor(n)-2)) | n = int(eval(input()))
def divisor(n):
i = 1
out = float('inf')
while i * i <= n:
if n%i == 0:
out = min((i+n//i),out)
i += 1
return out
print((divisor(n)-2)) | 15 | 10 | 274 | 202 | n = int(eval(input()))
def divisor(n):
i = 1
a = 0
b = 0
out = float("inf")
while i * i <= n:
if n % i == 0:
a = i
b = n // i
if a + b < out:
out = a + b
i += 1
return out
print((divisor(n) - 2))
| n = int(eval(input()))
def divisor(n):
i = 1
out = float("inf")
while i * i <= n:
if n % i == 0:
out = min((i + n // i), out)
i += 1
return out
print((divisor(n) - 2))
| false | 33.333333 | [
"- a = 0",
"- b = 0",
"- a = i",
"- b = n // i",
"- if a + b < out:",
"- out = a + b",
"+ out = min((i + n // i), out)"
] | false | 0.007966 | 0.1371 | 0.058107 | [
"s586560327",
"s656349468"
] |
u721316601 | p03087 | python | s189826232 | s404792918 | 1,132 | 252 | 7,800 | 6,436 | Accepted | Accepted | 77.74 | import bisect
N, Q = list(map(int, input().split()))
S = eval(input()) + ' '
x, y = [], []
for i in range(N):
if S[i:i+2] == 'AC':
x.append(i+1)
y.append(i+2)
for i in range(Q):
l, r = list(map(int, input().split()))
idx = [-1, -1]
idx[0] = bisect.bisect_left(x, l)
... | import sys
input = sys.stdin.readline
def main():
N, Q = list(map(int, input().split()))
S = eval(input())
count = [0] * N
for i in range(1, N):
if S[i-1:i+1] == 'AC': count[i] = count[i-1] + 1
else: count[i] = count[i-1]
for i in range(Q):
l, ... | 20 | 21 | 382 | 429 | import bisect
N, Q = list(map(int, input().split()))
S = eval(input()) + " "
x, y = [], []
for i in range(N):
if S[i : i + 2] == "AC":
x.append(i + 1)
y.append(i + 2)
for i in range(Q):
l, r = list(map(int, input().split()))
idx = [-1, -1]
idx[0] = bisect.bisect_left(x, l)
idx[1] = ... | import sys
input = sys.stdin.readline
def main():
N, Q = list(map(int, input().split()))
S = eval(input())
count = [0] * N
for i in range(1, N):
if S[i - 1 : i + 1] == "AC":
count[i] = count[i - 1] + 1
else:
count[i] = count[i - 1]
for i in range(Q):
... | false | 4.761905 | [
"-import bisect",
"+import sys",
"-N, Q = list(map(int, input().split()))",
"-S = eval(input()) + \" \"",
"-x, y = [], []",
"-for i in range(N):",
"- if S[i : i + 2] == \"AC\":",
"- x.append(i + 1)",
"- y.append(i + 2)",
"-for i in range(Q):",
"- l, r = list(map(int, input().... | false | 0.043031 | 0.043963 | 0.9788 | [
"s189826232",
"s404792918"
] |
u796942881 | p02923 | python | s268806438 | s832224368 | 56 | 51 | 14,252 | 15,020 | Accepted | Accepted | 8.93 | def main():
eval(input())
H = [int(i) for i in input().split()]
ans = 0
prev = float('inf')
cnt = -1
for cur in H:
if prev >= cur:
cnt += 1
else:
if ans < cnt:
ans = cnt
cnt = 0
prev = cur
if ans < cnt:... | def main():
eval(input())
H = list(map(int, input().split()))
ans = 0
prev = float('inf')
cnt = -1
for cur in H:
if prev >= cur:
cnt += 1
else:
if ans < cnt:
ans = cnt
cnt = 0
prev = cur
if ans < cnt:
... | 21 | 21 | 374 | 372 | def main():
eval(input())
H = [int(i) for i in input().split()]
ans = 0
prev = float("inf")
cnt = -1
for cur in H:
if prev >= cur:
cnt += 1
else:
if ans < cnt:
ans = cnt
cnt = 0
prev = cur
if ans < cnt:
ans =... | def main():
eval(input())
H = list(map(int, input().split()))
ans = 0
prev = float("inf")
cnt = -1
for cur in H:
if prev >= cur:
cnt += 1
else:
if ans < cnt:
ans = cnt
cnt = 0
prev = cur
if ans < cnt:
ans = c... | false | 0 | [
"- H = [int(i) for i in input().split()]",
"+ H = list(map(int, input().split()))"
] | false | 0.039881 | 0.047156 | 0.845718 | [
"s268806438",
"s832224368"
] |
u480847874 | p02678 | python | s139589652 | s870301898 | 1,357 | 562 | 35,216 | 35,476 | Accepted | Accepted | 58.59 |
def m():
N, M = list(map(int, input().split()))
g = [[] for _ in range(N + 1)]
dp = [10 ** 9] * (N + 1)
visited = [False] * (N + 1)
for _ in range(M):
a, b = list(map(int, input().split()))
g[a].append(b)
g[b].append(a)
def bfs(root):
visited[root]... | from collections import deque
def m():
N, M = list(map(int, input().split()))
g = [[] for _ in range(N + 1)]
dp = [10 ** 9] * (N + 1)
visited = [False] * (N + 1)
for _ in range(M):
a, b = list(map(int, input().split()))
g[a].append(b)
g[b].append(a)
def bf... | 39 | 40 | 854 | 895 | def m():
N, M = list(map(int, input().split()))
g = [[] for _ in range(N + 1)]
dp = [10**9] * (N + 1)
visited = [False] * (N + 1)
for _ in range(M):
a, b = list(map(int, input().split()))
g[a].append(b)
g[b].append(a)
def bfs(root):
visited[root] = True
d... | from collections import deque
def m():
N, M = list(map(int, input().split()))
g = [[] for _ in range(N + 1)]
dp = [10**9] * (N + 1)
visited = [False] * (N + 1)
for _ in range(M):
a, b = list(map(int, input().split()))
g[a].append(b)
g[b].append(a)
def bfs(root):
... | false | 2.5 | [
"+from collections import deque",
"+",
"+",
"- queue = []",
"+ queue = deque([])",
"- q = queue.pop(0)",
"+ q = queue.popleft()"
] | false | 0.036633 | 0.038692 | 0.946767 | [
"s139589652",
"s870301898"
] |
u903699277 | p02689 | python | s438911021 | s758747978 | 259 | 236 | 20,904 | 20,052 | Accepted | Accepted | 8.88 | N, M = list(map(int, input().split()))
p_list = [1 for _ in range(N)]
e_list = list(map(int, input().split()))
for _ in range(M):
a, b = list(map(int, input().split()))
if e_list[a - 1] <= e_list[b - 1]:
p_list[a - 1] = 0
if e_list[b - 1] <= e_list[a - 1]:
p_list[b - 1] = 0
print((sum(p_... | def main():
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
# S = [list(map(int, input(_).split())) for _ in range(M)]
#LIST = [1] * N
LIST = [ 1 for _ in range(N)]
for _ in range(M):
A, B = list(map(int, input().split()))
if H[A-1] >= H[B-1]: LI... | 10 | 13 | 313 | 395 | N, M = list(map(int, input().split()))
p_list = [1 for _ in range(N)]
e_list = list(map(int, input().split()))
for _ in range(M):
a, b = list(map(int, input().split()))
if e_list[a - 1] <= e_list[b - 1]:
p_list[a - 1] = 0
if e_list[b - 1] <= e_list[a - 1]:
p_list[b - 1] = 0
print((sum(p_list... | def main():
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
# S = [list(map(int, input(_).split())) for _ in range(M)]
# LIST = [1] * N
LIST = [1 for _ in range(N)]
for _ in range(M):
A, B = list(map(int, input().split()))
if H[A - 1] >= H[B - 1]:
... | false | 23.076923 | [
"-N, M = list(map(int, input().split()))",
"-p_list = [1 for _ in range(N)]",
"-e_list = list(map(int, input().split()))",
"-for _ in range(M):",
"- a, b = list(map(int, input().split()))",
"- if e_list[a - 1] <= e_list[b - 1]:",
"- p_list[a - 1] = 0",
"- if e_list[b - 1] <= e_list[a -... | false | 0.040289 | 0.039769 | 1.013062 | [
"s438911021",
"s758747978"
] |
u064434060 | p03103 | python | s211994858 | s165795501 | 440 | 325 | 29,372 | 29,164 | Accepted | Accepted | 26.14 | #import sys
#import numpy as np
#import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
#from fractions import gcd
#input=sys.stdin.readline
n,m=list(map(int,input().split()))
b=[list(map(int,input().split())) for _ in range(n)]
res=0
an... | #python 2.7
n,m=list(map(int,input().split()))
ab=[list(map(int,input().split())) for i in range(n)]
ab=sorted(ab,key=lambda x:x[0])
res=ans=0
for i in range(n):
if res+ab[i][1]>=m:
ans+=(ab[i][0])*(m-res)
break
else:
ans+=(ab[i][0])*ab[i][1]
res+=ab[i][1]
print(ans) | 23 | 13 | 509 | 293 | # import sys
# import numpy as np
# import math
# import itertools
# from fractions import Fraction
# import itertools
from collections import deque
# import heapq
# from fractions import gcd
# input=sys.stdin.readline
n, m = list(map(int, input().split()))
b = [list(map(int, input().split())) for _ in range(n)]
res ... | # python 2.7
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]
ab = sorted(ab, key=lambda x: x[0])
res = ans = 0
for i in range(n):
if res + ab[i][1] >= m:
ans += (ab[i][0]) * (m - res)
break
else:
ans += (ab[i][0]) * ab[i][1]
res += ... | false | 43.478261 | [
"-# import sys",
"-# import numpy as np",
"-# import math",
"-# import itertools",
"-# from fractions import Fraction",
"-# import itertools",
"-from collections import deque",
"-",
"-# import heapq",
"-# from fractions import gcd",
"-# input=sys.stdin.readline",
"+# python 2.7",
"-b = [lis... | false | 0.078861 | 0.036635 | 2.152603 | [
"s211994858",
"s165795501"
] |
u609061751 | p03164 | python | s532555265 | s649567378 | 1,271 | 1,022 | 311,272 | 311,304 | Accepted | Accepted | 19.59 | import sys
input = sys.stdin.readline
N, W = [int(x) for x in input().split()]
wv = []
for _ in range(N):
wv.append([int(x) for x in input().split()])
V = 10 ** 5
inf = float("inf")
dp = [[inf] * (V + 1) for _ in range(N + 1)]
dp[0][0] = 0
ans = -1
for i in range(N):
for j in range(V + 1):
... | import sys
input = sys.stdin.readline
n, W = [int(x) for x in input().split()]
wv = [[int(x) for x in input().split()] for _ in range(n)]
dp = [[float('inf')] * (10**5 + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i in range(1, n + 1):
w, v = wv[i - 1]
for j in range(10**5 + 1):
if j - v >... | 24 | 24 | 544 | 546 | import sys
input = sys.stdin.readline
N, W = [int(x) for x in input().split()]
wv = []
for _ in range(N):
wv.append([int(x) for x in input().split()])
V = 10**5
inf = float("inf")
dp = [[inf] * (V + 1) for _ in range(N + 1)]
dp[0][0] = 0
ans = -1
for i in range(N):
for j in range(V + 1):
w, v = wv[i]
... | import sys
input = sys.stdin.readline
n, W = [int(x) for x in input().split()]
wv = [[int(x) for x in input().split()] for _ in range(n)]
dp = [[float("inf")] * (10**5 + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i in range(1, n + 1):
w, v = wv[i - 1]
for j in range(10**5 + 1):
if j - v >= 0:
... | false | 0 | [
"-N, W = [int(x) for x in input().split()]",
"-wv = []",
"-for _ in range(N):",
"- wv.append([int(x) for x in input().split()])",
"-V = 10**5",
"-inf = float(\"inf\")",
"-dp = [[inf] * (V + 1) for _ in range(N + 1)]",
"+n, W = [int(x) for x in input().split()]",
"+wv = [[int(x) for x in input().s... | false | 1.219719 | 0.956364 | 1.275372 | [
"s532555265",
"s649567378"
] |
u726615467 | p03262 | python | s597350407 | s375962415 | 136 | 103 | 15,020 | 14,252 | Accepted | Accepted | 24.26 | # encoding: utf-8
import math
N, X = list(map(int, input().split()))
x = sorted(list(map(int, input().split())) + [X])
def gcf2(a, b):
if b == 0: return a
else: return gcf2(b, (a % b))
# Greatest common factor
# print(x)
GCF = x[1] - x[0]
x_min = x[0]
for i, xi in enumerate(x):
if i == 0: ... | N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
# targ = []
# # targ.append(abs(X - x[0]))
# for i in range(N - 1):
# targ.append(abs(x[i + 1] - x[i]))
def mygcd(a, b):
# print("#", a, b)
if a < b: return mygcd(b, a)
elif b == 0: return a
else: return mygcd(b... | 19 | 19 | 371 | 427 | # encoding: utf-8
import math
N, X = list(map(int, input().split()))
x = sorted(list(map(int, input().split())) + [X])
def gcf2(a, b):
if b == 0:
return a
else:
return gcf2(b, (a % b))
# Greatest common factor
# print(x)
GCF = x[1] - x[0]
x_min = x[0]
for i, xi in enumerate(x):
if i == ... | N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
# targ = []
# # targ.append(abs(X - x[0]))
# for i in range(N - 1):
# targ.append(abs(x[i + 1] - x[i]))
def mygcd(a, b):
# print("#", a, b)
if a < b:
return mygcd(b, a)
elif b == 0:
return a
else:
retu... | false | 0 | [
"-# encoding: utf-8",
"-import math",
"-",
"-x = sorted(list(map(int, input().split())) + [X])",
"+x = list(map(int, input().split()))",
"+# targ = []",
"+# # targ.append(abs(X - x[0]))",
"+# for i in range(N - 1):",
"+# targ.append(abs(x[i + 1] - x[i]))",
"+def mygcd(a, b):",
"+ # print(... | false | 0.047493 | 0.047989 | 0.98967 | [
"s597350407",
"s375962415"
] |
u600402037 | p02755 | python | s386153884 | s613147178 | 35 | 19 | 3,060 | 3,060 | Accepted | Accepted | 45.71 | import sys
import math
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
A, B = lr()
answer = -1
for x in range(1001):
if math.floor(x * 0.08) == A and math.floor(x * 0.1) == B:
answer = x
break
print(answer)
| # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
A, B = lr()
for x in range(1, 10001):
if x * 8 // 100 == A and x * 10 // 100 == B:
print(x); exit()
print((-1)) | 15 | 13 | 304 | 271 | import sys
import math
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
A, B = lr()
answer = -1
for x in range(1001):
if math.floor(x * 0.08) == A and math.floor(x * 0.1) == B:
answer = x
break
print(answer)
| # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
A, B = lr()
for x in range(1, 10001):
if x * 8 // 100 == A and x * 10 // 100 == B:
print(x)
exit()
print((-1))
| false | 13.333333 | [
"+# coding: utf-8",
"-import math",
"-answer = -1",
"-for x in range(1001):",
"- if math.floor(x * 0.08) == A and math.floor(x * 0.1) == B:",
"- answer = x",
"- break",
"-print(answer)",
"+for x in range(1, 10001):",
"+ if x * 8 // 100 == A and x * 10 // 100 == B:",
"+ ... | false | 0.036677 | 0.036204 | 1.01307 | [
"s386153884",
"s613147178"
] |
u481187938 | p02558 | python | s712190443 | s975477094 | 605 | 371 | 130,152 | 130,044 | Accepted | Accepted | 38.68 | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L(): return sys.stdin.readline... | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L(): return sys.stdin.readline... | 83 | 84 | 2,807 | 2,824 | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L():
return sys.stdin.readline().spl... | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L():
return sys.stdin.readline().spl... | false | 1.190476 | [
"- if self._parent[x] == x:",
"- return x",
"- px = self._parent[x]",
"- root = self.find(px)",
"- self._parent[x] = root",
"- return root",
"+ vs = []",
"+ while self._parent[x] != x:",
"+ vs.append(x)",
"+ x = self... | false | 0.115225 | 0.082381 | 1.39868 | [
"s712190443",
"s975477094"
] |
u057109575 | p03014 | python | s496608119 | s385934733 | 974 | 390 | 126,168 | 142,908 | Accepted | Accepted | 59.96 | H, W = list(map(int, input().split()))
grid = [eval(input()) for _ in range(H)]
graph_1 = [[0] * W for _ in range(H)]
for i in range(H):
for j in range(W):
if grid[i][j] == '.':
if j != 0 and grid[i][j - 1] == '.':
graph_1[i][j] = graph_1[i][j - 1] + 1
else:... | H, W = list(map(int, input().split()))
X = [eval(input()) for _ in range(H)]
grid0 = [[0] * (W + 1) for _ in range(H + 1)]
# L -> R
for i in range(H):
for j in range(W):
if X[i][j] == ".":
grid0[i + 1][j + 1] = grid0[i + 1][j] + 1
# L <- R
for i in range(H):
for j in ... | 37 | 33 | 1,083 | 910 | H, W = list(map(int, input().split()))
grid = [eval(input()) for _ in range(H)]
graph_1 = [[0] * W for _ in range(H)]
for i in range(H):
for j in range(W):
if grid[i][j] == ".":
if j != 0 and grid[i][j - 1] == ".":
graph_1[i][j] = graph_1[i][j - 1] + 1
else:
... | H, W = list(map(int, input().split()))
X = [eval(input()) for _ in range(H)]
grid0 = [[0] * (W + 1) for _ in range(H + 1)]
# L -> R
for i in range(H):
for j in range(W):
if X[i][j] == ".":
grid0[i + 1][j + 1] = grid0[i + 1][j] + 1
# L <- R
for i in range(H):
for j in reversed(list(range(W)))... | false | 10.810811 | [
"-grid = [eval(input()) for _ in range(H)]",
"-graph_1 = [[0] * W for _ in range(H)]",
"+X = [eval(input()) for _ in range(H)]",
"+grid0 = [[0] * (W + 1) for _ in range(H + 1)]",
"+# L -> R",
"- if grid[i][j] == \".\":",
"- if j != 0 and grid[i][j - 1] == \".\":",
"- g... | false | 0.039719 | 0.09698 | 0.409557 | [
"s496608119",
"s385934733"
] |
u486065927 | p02887 | python | s880155574 | s505319609 | 164 | 37 | 14,828 | 3,316 | Accepted | Accepted | 77.44 | import numpy as np
n = int(eval(input()))
s = [ord(i) for i in eval(input())]
print((np.sum(np.diff(s)!=0)+1)) | n = int(eval(input()))
s = eval(input())
t = s[0]
c = 1
for i in s:
if t != i:
t = i
c += 1
print(c)
| 4 | 9 | 99 | 117 | import numpy as np
n = int(eval(input()))
s = [ord(i) for i in eval(input())]
print((np.sum(np.diff(s) != 0) + 1))
| n = int(eval(input()))
s = eval(input())
t = s[0]
c = 1
for i in s:
if t != i:
t = i
c += 1
print(c)
| false | 55.555556 | [
"-import numpy as np",
"-",
"-s = [ord(i) for i in eval(input())]",
"-print((np.sum(np.diff(s) != 0) + 1))",
"+s = eval(input())",
"+t = s[0]",
"+c = 1",
"+for i in s:",
"+ if t != i:",
"+ t = i",
"+ c += 1",
"+print(c)"
] | false | 0.304801 | 0.069793 | 4.367215 | [
"s880155574",
"s505319609"
] |
u855710796 | p02632 | python | s251934233 | s660332443 | 1,382 | 441 | 217,252 | 220,744 | Accepted | Accepted | 68.09 | K = int(eval(input()))
S = eval(input())
mod = 10**9 + 7
class Combination:
def __init__(self, n):
self.facts = [1 for i in range(n+1)]
self.invs = [1 for i in range(n+1)]
for i in range(1, n+1):
self.facts[i] = self.facts[i-1] * i % mod
self.in... | K = int(eval(input()))
S = eval(input())
mod = 10**9 + 7
class Combination:
def __init__(self, n):
self.facts = [1 for i in range(n+1)]
self.invs = [1 for i in range(n+1)]
for i in range(1, n+1):
self.facts[i] = self.facts[i-1] * i % mod
self.invs[n] = pow(... | 44 | 46 | 1,051 | 1,135 | K = int(eval(input()))
S = eval(input())
mod = 10**9 + 7
class Combination:
def __init__(self, n):
self.facts = [1 for i in range(n + 1)]
self.invs = [1 for i in range(n + 1)]
for i in range(1, n + 1):
self.facts[i] = self.facts[i - 1] * i % mod
self.invs[i] = pow(s... | K = int(eval(input()))
S = eval(input())
mod = 10**9 + 7
class Combination:
def __init__(self, n):
self.facts = [1 for i in range(n + 1)]
self.invs = [1 for i in range(n + 1)]
for i in range(1, n + 1):
self.facts[i] = self.facts[i - 1] * i % mod
self.invs[n] = pow(self.... | false | 4.347826 | [
"- self.invs[i] = pow(self.facts[i], mod - 2, mod)",
"+ self.invs[n] = pow(self.facts[n], mod - 2, mod)",
"+ for i in range(1, n + 1):",
"+ self.invs[n - i] = self.invs[n - i + 1] * (n - i + 1) % mod"
] | false | 0.047301 | 0.047199 | 1.00216 | [
"s251934233",
"s660332443"
] |
u895515293 | p03074 | python | s218516210 | s759546598 | 208 | 183 | 3,316 | 3,316 | Accepted | Accepted | 12.02 | N,K=list(map(int, input().split()))
instr=eval(input())
lft=0
rgt=1
voids=0 if instr[0] == '1' else 1
maxlen=0
while lft < rgt:
maxlen = max(maxlen, rgt-lft)
if rgt < N and (instr[rgt] == '1' or (instr[rgt-1] == '0' and instr[rgt] == '0')):
rgt += 1
elif rgt < N and instr[rgt] == '0' and... | N,K=list(map(int, input().split()))
instr=eval(input())
lft=0
rgt=1
voids=int(instr[0] == '0')
maxlen=0
while lft < rgt:
maxlen = max(maxlen, rgt-lft)
if rgt < N and (instr[rgt] == '1' or (instr[rgt-1] == '0' and instr[rgt] == '0')):
rgt += 1
elif rgt < N and voids < K:
voids += 1... | 20 | 17 | 497 | 445 | N, K = list(map(int, input().split()))
instr = eval(input())
lft = 0
rgt = 1
voids = 0 if instr[0] == "1" else 1
maxlen = 0
while lft < rgt:
maxlen = max(maxlen, rgt - lft)
if rgt < N and (instr[rgt] == "1" or (instr[rgt - 1] == "0" and instr[rgt] == "0")):
rgt += 1
elif rgt < N and instr[rgt] == "0... | N, K = list(map(int, input().split()))
instr = eval(input())
lft = 0
rgt = 1
voids = int(instr[0] == "0")
maxlen = 0
while lft < rgt:
maxlen = max(maxlen, rgt - lft)
if rgt < N and (instr[rgt] == "1" or (instr[rgt - 1] == "0" and instr[rgt] == "0")):
rgt += 1
elif rgt < N and voids < K:
void... | false | 15 | [
"-voids = 0 if instr[0] == \"1\" else 1",
"+voids = int(instr[0] == \"0\")",
"- elif rgt < N and instr[rgt] == \"0\" and voids < K:",
"+ elif rgt < N and voids < K:",
"- if lft + 1 < N and instr[lft] == \"0\" and instr[lft + 1] == \"1\":",
"- voids -= 1",
"+ voids -= lft +... | false | 0.050211 | 0.048057 | 1.044825 | [
"s218516210",
"s759546598"
] |
u017810624 | p03252 | python | s097480238 | s481304009 | 794 | 257 | 3,632 | 81,484 | Accepted | Accepted | 67.63 | s=eval(input());t=eval(input())
u=[];c=0
for i in range(len(s)):
v=[s[i],t[i]]
if v not in u:
u.append(v)
for k in range(len(u)):
for m in range(len(u)):
if u[k][0]==u[m][0]:
if u[k][1]!=u[m][1]:c+=1
for p in range(len(u)):
for q in range(len(u)):
if u[p][1]==u[q][1]:
if u[p... | import sys
s=list(eval(input()))
t=list(eval(input()))
c=[chr(i) for i in range(97, 97+26)]
l=[[] for i in range(26)]
l2=[[] for i in range(26)]
for i in range(len(s)):
l[c.index(s[i])].append(t[i])
l2[c.index(t[i])].append(s[i])
for i in range(26):
l[i]=list(set(l[i]))
l2[i]=list(set(l2[i]))
for i ... | 16 | 20 | 366 | 442 | s = eval(input())
t = eval(input())
u = []
c = 0
for i in range(len(s)):
v = [s[i], t[i]]
if v not in u:
u.append(v)
for k in range(len(u)):
for m in range(len(u)):
if u[k][0] == u[m][0]:
if u[k][1] != u[m][1]:
c += 1
for p in range(len(u)):
for q in range(len... | import sys
s = list(eval(input()))
t = list(eval(input()))
c = [chr(i) for i in range(97, 97 + 26)]
l = [[] for i in range(26)]
l2 = [[] for i in range(26)]
for i in range(len(s)):
l[c.index(s[i])].append(t[i])
l2[c.index(t[i])].append(s[i])
for i in range(26):
l[i] = list(set(l[i]))
l2[i] = list(set(l... | false | 20 | [
"-s = eval(input())",
"-t = eval(input())",
"-u = []",
"-c = 0",
"+import sys",
"+",
"+s = list(eval(input()))",
"+t = list(eval(input()))",
"+c = [chr(i) for i in range(97, 97 + 26)]",
"+l = [[] for i in range(26)]",
"+l2 = [[] for i in range(26)]",
"- v = [s[i], t[i]]",
"- if v not i... | false | 0.039607 | 0.035846 | 1.104914 | [
"s097480238",
"s481304009"
] |
u054514819 | p02647 | python | s627162045 | s676916475 | 513 | 356 | 182,908 | 196,256 | Accepted | Accepted | 30.6 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N, K = mapint()
now = list(mapint())
from itertools import accumulate
iteration = min(N.bit_length()*4, K)
for k in range(iteration):
nx = [0]*N
for i, a in e... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N, K = mapint()
As = list(mapint())
from itertools import accumulate
for _ in range(K):
lamps = [0]*N
for i, a in enumerate(As):
lamps[max(0, i-a)] ... | 18 | 19 | 468 | 457 | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N, K = mapint()
now = list(mapint())
from itertools import accumulate
iteration = min(N.bit_length() * 4, K)
for k in range(iteration):
nx = [0] * N
for i,... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N, K = mapint()
As = list(mapint())
from itertools import accumulate
for _ in range(K):
lamps = [0] * N
for i, a in enumerate(As):
lamps[max(0, i -... | false | 5.263158 | [
"-now = list(mapint())",
"+As = list(mapint())",
"-iteration = min(N.bit_length() * 4, K)",
"-for k in range(iteration):",
"- nx = [0] * N",
"- for i, a in enumerate(now):",
"- nx[max(0, i - a)] += 1",
"- if i + a + 1 < N:",
"- nx[i + a + 1] -= 1",
"- nx = list(ac... | false | 0.14001 | 0.041244 | 3.394654 | [
"s627162045",
"s676916475"
] |
u823458368 | p03325 | python | s260810696 | s681125754 | 161 | 66 | 13,276 | 10,024 | Accepted | Accepted | 59.01 | import math
import numpy as np
n = int(eval(input()))
a = list(map(int, input().split()))
b = []
for i in range(n):
b.append(format(a[i], 'b')[::-1].find('1'))
print((sum(b))) | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while i%2==0:
i//=2
ans+=1
print(ans) | 9 | 9 | 184 | 139 | import math
import numpy as np
n = int(eval(input()))
a = list(map(int, input().split()))
b = []
for i in range(n):
b.append(format(a[i], "b")[::-1].find("1"))
print((sum(b)))
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while i % 2 == 0:
i //= 2
ans += 1
print(ans)
| false | 0 | [
"-import math",
"-import numpy as np",
"-",
"-b = []",
"-for i in range(n):",
"- b.append(format(a[i], \"b\")[::-1].find(\"1\"))",
"-print((sum(b)))",
"+ans = 0",
"+for i in a:",
"+ while i % 2 == 0:",
"+ i //= 2",
"+ ans += 1",
"+print(ans)"
] | false | 0.036239 | 0.052707 | 0.68756 | [
"s260810696",
"s681125754"
] |
u565149926 | p03137 | python | s865817816 | s879326029 | 113 | 104 | 13,960 | 13,968 | Accepted | Accepted | 7.96 | N, M = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
dist = sorted([abs(X[i] - X[i+1]) for i in range(M-1)])
print((sum(dist[:M-N]) if N < M else 0))
| N, M = list(map(int, input().split()))
X = sorted(map(int, input().split()))
dist = sorted([X[i+1] - X[i] for i in range(M-1)])[::-1]
print((sum(dist[N-1:])))
| 4 | 4 | 175 | 154 | N, M = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
dist = sorted([abs(X[i] - X[i + 1]) for i in range(M - 1)])
print((sum(dist[: M - N]) if N < M else 0))
| N, M = list(map(int, input().split()))
X = sorted(map(int, input().split()))
dist = sorted([X[i + 1] - X[i] for i in range(M - 1)])[::-1]
print((sum(dist[N - 1 :])))
| false | 0 | [
"-X = sorted(list(map(int, input().split())))",
"-dist = sorted([abs(X[i] - X[i + 1]) for i in range(M - 1)])",
"-print((sum(dist[: M - N]) if N < M else 0))",
"+X = sorted(map(int, input().split()))",
"+dist = sorted([X[i + 1] - X[i] for i in range(M - 1)])[::-1]",
"+print((sum(dist[N - 1 :])))"
] | false | 0.045827 | 0.045481 | 1.007619 | [
"s865817816",
"s879326029"
] |
u514401521 | p03294 | python | s008169533 | s954289294 | 177 | 162 | 5,368 | 3,808 | Accepted | Accepted | 8.47 | import fractions
from functools import reduce
n = int(eval(input()))
a = list(map(int, input().split()))
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
m = lcm(*a)
... | from functools import reduce
n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(x, y):
if y == 0:
return x
return gcd(y, x % y)
def gcd2(number):
return reduce(gcd, number)
def lcm(x, y):
return x * y // gcd(x, y)
def lcm2(number):
return reduce(lcm, n... | 20 | 24 | 387 | 412 | import fractions
from functools import reduce
n = int(eval(input()))
a = list(map(int, input().split()))
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
m = lcm(*a)
ans = 0
fo... | from functools import reduce
n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(x, y):
if y == 0:
return x
return gcd(y, x % y)
def gcd2(number):
return reduce(gcd, number)
def lcm(x, y):
return x * y // gcd(x, y)
def lcm2(number):
return reduce(lcm, number)
m = lc... | false | 16.666667 | [
"-import fractions",
"-def lcm_base(x, y):",
"- return (x * y) // fractions.gcd(x, y)",
"+def gcd(x, y):",
"+ if y == 0:",
"+ return x",
"+ return gcd(y, x % y)",
"-def lcm(*numbers):",
"- return reduce(lcm_base, numbers, 1)",
"+def gcd2(number):",
"+ return reduce(gcd, num... | false | 0.203139 | 0.073432 | 2.766362 | [
"s008169533",
"s954289294"
] |
u539692012 | p03295 | python | s060204136 | s895699868 | 725 | 191 | 102,796 | 75,404 | Accepted | Accepted | 73.66 | n, m = list(map(int, input().split()))
events = []
for i in range(m):
a, b = list(map(int, input().split()))
events.append((a, 0, i))
events.append((b-1, 1, i))
events.sort()
solved = [False] * m
todo = []
ans = 0
for i, etype, req in events:
if etype == 0:
todo.append(req)
else... | n, m = list(map(int, input().split()))
x = [-1] * (n+1)
for _ in range(m):
a, b = list(map(int, input().split()))
x[b] = max(x[b], a)
ans = 0
bmx = 0
for i in range(n+1):
if bmx <= x[i]:
ans += 1
bmx = i
print(ans) | 20 | 12 | 467 | 241 | n, m = list(map(int, input().split()))
events = []
for i in range(m):
a, b = list(map(int, input().split()))
events.append((a, 0, i))
events.append((b - 1, 1, i))
events.sort()
solved = [False] * m
todo = []
ans = 0
for i, etype, req in events:
if etype == 0:
todo.append(req)
else:
i... | n, m = list(map(int, input().split()))
x = [-1] * (n + 1)
for _ in range(m):
a, b = list(map(int, input().split()))
x[b] = max(x[b], a)
ans = 0
bmx = 0
for i in range(n + 1):
if bmx <= x[i]:
ans += 1
bmx = i
print(ans)
| false | 40 | [
"-events = []",
"-for i in range(m):",
"+x = [-1] * (n + 1)",
"+for _ in range(m):",
"- events.append((a, 0, i))",
"- events.append((b - 1, 1, i))",
"-events.sort()",
"-solved = [False] * m",
"-todo = []",
"+ x[b] = max(x[b], a)",
"-for i, etype, req in events:",
"- if etype == 0:"... | false | 0.108205 | 0.047379 | 2.283847 | [
"s060204136",
"s895699868"
] |
u385644001 | p02912 | python | s821303037 | s252163774 | 238 | 202 | 14,180 | 14,180 | Accepted | Accepted | 15.13 | import heapq
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list([x * (-1) for x in a])
heapq.heapify(a)
while m != 0:
price = heapq.heappop(a)
price = price/2
m -= 1
heapq.heappush(a, price)
for i in range(len(a)):
a[i] = int(a[i])
print((sum(a) * (-1))... | import heapq
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(len(a)):
a[i] = a[i]*-1.0
heapq.heapify(a)
while m != 0:
price = heapq.heappop(a)
price = price/2
m -= 1
heapq.heappush(a, price)
for i in range(len(a)):
a[i] = int(a[i])
... | 14 | 18 | 318 | 337 | import heapq
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list([x * (-1) for x in a])
heapq.heapify(a)
while m != 0:
price = heapq.heappop(a)
price = price / 2
m -= 1
heapq.heappush(a, price)
for i in range(len(a)):
a[i] = int(a[i])
print((sum(a) * (-1)))
| import heapq
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(len(a)):
a[i] = a[i] * -1.0
heapq.heapify(a)
while m != 0:
price = heapq.heappop(a)
price = price / 2
m -= 1
heapq.heappush(a, price)
for i in range(len(a)):
a[i] = int(a[i])
print((sum(a) * (... | false | 22.222222 | [
"-a = list([x * (-1) for x in a])",
"+for i in range(len(a)):",
"+ a[i] = a[i] * -1.0"
] | false | 0.058272 | 0.046847 | 1.243882 | [
"s821303037",
"s252163774"
] |
u729133443 | p03033 | python | s741349321 | s404235862 | 1,629 | 797 | 170,436 | 99,288 | Accepted | Accepted | 51.07 | from subprocess import*
call(('pypy3','-c',r"""
def main():
from bisect import bisect_left
I=10**9+1
n,q,*t=map(int,open(0).read().split())
d=tuple(t[-q:])
t=t[:-q]
N0=2**(q-1).bit_length()
data=[I]*2*N0
for x,l,r in sorted(((x,bisect_left(d,s-x)+N0,bisect_left(d,t-x)+N0)for s,... | from bisect import*
b=bisect_left
n,q,*t=list(map(int,open(0).read().split()))
p=t[-q:]
*a,=o=[-1]*q
for x,t,s in sorted(zip(*[iter(t[~q::-1])]*3)):
l,r=b(p,s-x),b(p,t-x)
while l<r:
if~o[l]:l=o[l]
else:a[l],o[l]=x,r;l+=1
print((*a)) | 30 | 11 | 784 | 240 | from subprocess import *
call(
(
"pypy3",
"-c",
r"""
def main():
from bisect import bisect_left
I=10**9+1
n,q,*t=map(int,open(0).read().split())
d=tuple(t[-q:])
t=t[:-q]
N0=2**(q-1).bit_length()
data=[I]*2*N0
for x,l,r in sorted(((x,bisect_left(d,s-x)+N0,bise... | from bisect import *
b = bisect_left
n, q, *t = list(map(int, open(0).read().split()))
p = t[-q:]
(*a,) = o = [-1] * q
for x, t, s in sorted(zip(*[iter(t[~q::-1])] * 3)):
l, r = b(p, s - x), b(p, t - x)
while l < r:
if ~o[l]:
l = o[l]
else:
a[l], o[l] = x, r
... | false | 63.333333 | [
"-from subprocess import *",
"+from bisect import *",
"-call(",
"- (",
"- \"pypy3\",",
"- \"-c\",",
"- r\"\"\"",
"-def main():",
"- from bisect import bisect_left",
"- I=10**9+1",
"- n,q,*t=map(int,open(0).read().split())",
"- d=tuple(t[-q:])",
"- t=t[:... | false | 0.145931 | 0.18678 | 0.781299 | [
"s741349321",
"s404235862"
] |
u707124227 | p03212 | python | s229684493 | s628078817 | 426 | 92 | 52,184 | 2,940 | Accepted | Accepted | 78.4 | from collections import deque
from collections import Counter
n=int(eval(input()))
if n<357:
print((0))
exit()
i=357
ans=0
while i<=n:
c=Counter(str(i))
if '3' in c and '5' in c and '7' in c:
if c['3']+c['5']+c['7']==len(str(i)):
ans+=1
a=list(map(int,list(str(i))))
a[-1]+=2
j... | n=int(eval(input()))
def dfs(s):
if int(s)>n:
return 0
ret=1 if all(s.count(c) for c in '753') else 0
for c in '753':
ret+=dfs(s+c)
return ret
print((dfs('0'))) | 25 | 9 | 455 | 176 | from collections import deque
from collections import Counter
n = int(eval(input()))
if n < 357:
print((0))
exit()
i = 357
ans = 0
while i <= n:
c = Counter(str(i))
if "3" in c and "5" in c and "7" in c:
if c["3"] + c["5"] + c["7"] == len(str(i)):
ans += 1
a = list(map(int, list... | n = int(eval(input()))
def dfs(s):
if int(s) > n:
return 0
ret = 1 if all(s.count(c) for c in "753") else 0
for c in "753":
ret += dfs(s + c)
return ret
print((dfs("0")))
| false | 64 | [
"-from collections import deque",
"-from collections import Counter",
"+n = int(eval(input()))",
"-n = int(eval(input()))",
"-if n < 357:",
"- print((0))",
"- exit()",
"-i = 357",
"-ans = 0",
"-while i <= n:",
"- c = Counter(str(i))",
"- if \"3\" in c and \"5\" in c and \"7\" in c:... | false | 0.207786 | 0.065038 | 3.194835 | [
"s229684493",
"s628078817"
] |
u047796752 | p03078 | python | s622407311 | s662103372 | 746 | 352 | 148,676 | 45,660 | Accepted | Accepted | 52.82 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
AB = []
for i in range(X):
for j in range(Y):
AB.append(A[i]+B[j])
AB.sor... | def judge(x):
cnt = 0
for i in range(X):
for j in range(Y):
for k in range(Z):
if A[i]+B[j]+C[k]<x:
break
cnt += 1
if cnt>=K:
return True
retu... | 27 | 55 | 500 | 1,081 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
AB = []
for i in range(X):
for j in range(Y):
AB.append(A[i] + B[j])
AB.sort(reverse=True)
A... | def judge(x):
cnt = 0
for i in range(X):
for j in range(Y):
for k in range(Z):
if A[i] + B[j] + C[k] < x:
break
cnt += 1
if cnt >= K:
return True
return False
def binary_search():
l, r = 0, 10**... | false | 50.909091 | [
"+def judge(x):",
"+ cnt = 0",
"+ for i in range(X):",
"+ for j in range(Y):",
"+ for k in range(Z):",
"+ if A[i] + B[j] + C[k] < x:",
"+ break",
"+ cnt += 1",
"+ if cnt >= K:",
"+ return Tru... | false | 0.054759 | 0.078533 | 0.697275 | [
"s622407311",
"s662103372"
] |
u280096880 | p02933 | python | s568698835 | s551729379 | 264 | 17 | 18,588 | 2,940 | Accepted | Accepted | 93.56 | import numpy
A = int(eval(input()))
S = eval(input())
if A >= 3200:
print(S)
else:
print("red") | A = int(eval(input()))
S = eval(input())
if A >= 3200:
print(S)
else:
print("red") | 9 | 7 | 101 | 85 | import numpy
A = int(eval(input()))
S = eval(input())
if A >= 3200:
print(S)
else:
print("red")
| A = int(eval(input()))
S = eval(input())
if A >= 3200:
print(S)
else:
print("red")
| false | 22.222222 | [
"-import numpy",
"-"
] | false | 0.04067 | 0.038317 | 1.061421 | [
"s568698835",
"s551729379"
] |
u576434377 | p02923 | python | s466756565 | s774747709 | 263 | 221 | 14,252 | 14,224 | Accepted | Accepted | 15.97 | N = int(eval(input()))
Hs = list(map(int, input().split()))
res = [0] * N
for index, h in enumerate(Hs):
l = 0
if index > 0:
l = max(res[index - 1] - 3, 0)
tmp = h
while index + l + 1 < N and tmp >= Hs[index + l + 1]:
tmp = Hs[index + l + 1]
l += 1
res[index] =... | N = int(eval(input()))
Hs = list(map(int, input().split()))
res = [0] * N
for index, h in enumerate(Hs):
l = 0
if index > 0:
l = max(res[index - 1] - 2, 0)
tmp = h
while index + l + 1 < N and tmp >= Hs[index + l + 1]:
tmp = Hs[index + l + 1]
l += 1
res[index] =... | 16 | 16 | 335 | 335 | N = int(eval(input()))
Hs = list(map(int, input().split()))
res = [0] * N
for index, h in enumerate(Hs):
l = 0
if index > 0:
l = max(res[index - 1] - 3, 0)
tmp = h
while index + l + 1 < N and tmp >= Hs[index + l + 1]:
tmp = Hs[index + l + 1]
l += 1
res[index] = l
print((max(r... | N = int(eval(input()))
Hs = list(map(int, input().split()))
res = [0] * N
for index, h in enumerate(Hs):
l = 0
if index > 0:
l = max(res[index - 1] - 2, 0)
tmp = h
while index + l + 1 < N and tmp >= Hs[index + l + 1]:
tmp = Hs[index + l + 1]
l += 1
res[index] = l
print((max(r... | false | 0 | [
"- l = max(res[index - 1] - 3, 0)",
"+ l = max(res[index - 1] - 2, 0)"
] | false | 0.034652 | 0.03455 | 1.002976 | [
"s466756565",
"s774747709"
] |
u177370876 | p02642 | python | s430659863 | s748411738 | 171 | 158 | 93,000 | 92,928 | Accepted | Accepted | 7.6 | n = int(eval(input()))
a = list(map(int, input().split()))
result=0
flug = 0
if(len(a) == 1):
print((1))
else:
a.sort()
dp = [True] * a[-1]
flug = 1
for j in range(n):
if(dp[a[j]-1] == True):
if(a[j] == a[j-1]):
if(flug == 0):
res... | n = int(eval(input()))
a = list(map(int, input().split()))
result=0
flug = 0
if(len(a) == 1):
print((1))
else:
a.sort()
dp = [True] * a[-1]
flug = 1
for j in range(n):
if(dp[a[j]-1] == True):
if(a[j] == a[j-1]):
if(flug == 0):
res... | 25 | 25 | 576 | 592 | n = int(eval(input()))
a = list(map(int, input().split()))
result = 0
flug = 0
if len(a) == 1:
print((1))
else:
a.sort()
dp = [True] * a[-1]
flug = 1
for j in range(n):
if dp[a[j] - 1] == True:
if a[j] == a[j - 1]:
if flug == 0:
result -= 1
... | n = int(eval(input()))
a = list(map(int, input().split()))
result = 0
flug = 0
if len(a) == 1:
print((1))
else:
a.sort()
dp = [True] * a[-1]
flug = 1
for j in range(n):
if dp[a[j] - 1] == True:
if a[j] == a[j - 1]:
if flug == 0:
result -= 1
... | false | 0 | [
"- k = a[j] * 2",
"- while k - 1 < len(dp):",
"- dp[k - 1] = False",
"- k += a[j]",
"+ k = a[j] * 2",
"+ while k - 1 < len(dp):",
"+ dp[k - 1] = False",
"+ k += a[j]"
] | false | 0.044077 | 0.038567 | 1.14285 | [
"s430659863",
"s748411738"
] |
u150984829 | p02277 | python | s848755757 | s852368642 | 660 | 610 | 26,992 | 26,992 | Accepted | Accepted | 7.58 | import sys
def t(A,p,r):
x=A[r][1];i=p-1
for j in range(p,r):
if A[j][1]<=x:i+=1;A[i],A[j]=A[j],A[i]
A[i+1],A[r]=A[r],A[i+1]
return i+1
def k(A,p,r):
if p<r:q=t(A,p,r);k(A,p,q-1);k(A,q+1,r)
def s(A):
for i in range(n-1):
if A[i][1]==A[i+1][1]and A[i][2]>A[i+1][2]:return'Not s'
return'S'
n=int(ev... | import sys
def t(A,p,r):
x=A[r][1];i=p-1
for j in range(p,r):
if A[j][1]<=x:i+=1;A[i],A[j]=A[j],A[i]
A[i+1],A[r]=A[r],A[i+1]
return i+1
def k(A,p,r):
if p<r:q=t(A,p,r);k(A,p,q-1);k(A,q+1,r)
def s(A):
for i in range(n-1):
if A[i][1]==A[i+1][1]and A[i][2]>A[i+1][2]:return'Not s'
return'S'
n=int(ev... | 18 | 18 | 463 | 460 | import sys
def t(A, p, r):
x = A[r][1]
i = p - 1
for j in range(p, r):
if A[j][1] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
def k(A, p, r):
if p < r:
q = t(A, p, r)
k(A, p, q - 1)
k(A, q + 1, r)
... | import sys
def t(A, p, r):
x = A[r][1]
i = p - 1
for j in range(p, r):
if A[j][1] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
def k(A, p, r):
if p < r:
q = t(A, p, r)
k(A, p, q - 1)
k(A, q + 1, r)
... | false | 0 | [
"-print((\"\\n\".join(f\"{a} {b}\" for a, b, c in A)))",
"+print((\"\\n\".join(f\"{a} {b}\" for a, b, _ in A)))"
] | false | 0.036422 | 0.037769 | 0.964336 | [
"s848755757",
"s852368642"
] |
u309120194 | p03011 | python | s734849633 | s170442761 | 28 | 24 | 9,088 | 9,044 | Accepted | Accepted | 14.29 | P, Q, R = list(map(int, input().split()))
print((min(P+Q, Q+R, R+P))) | P, Q, R = list(map(int, input().split()))
print((P + Q + R - max(P, Q, R))) | 3 | 3 | 64 | 71 | P, Q, R = list(map(int, input().split()))
print((min(P + Q, Q + R, R + P)))
| P, Q, R = list(map(int, input().split()))
print((P + Q + R - max(P, Q, R)))
| false | 0 | [
"-print((min(P + Q, Q + R, R + P)))",
"+print((P + Q + R - max(P, Q, R)))"
] | false | 0.035458 | 0.148024 | 0.239542 | [
"s734849633",
"s170442761"
] |
u261103969 | p02761 | python | s254001119 | s124145462 | 170 | 19 | 38,384 | 3,064 | Accepted | Accepted | 88.82 | #import math
#import bisect
#import numpy as np
#import itertools
#import copy
import sys
ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
n, m = list(map(int,ipti().split()))
s = [0] * m
c = [0] * m
ans = [-1] * n
for i i... | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
n, m = list(map(int, readline().split()))
restriction = [list(map(int, readline().split())) for _ in range(m)]
# n桁の数字の下限と上限 [begin,end)
begin = (None, 0, 10, 100)
... | 52 | 33 | 995 | 786 | # import math
# import bisect
# import numpy as np
# import itertools
# import copy
import sys
ipti = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
n, m = list(map(int, ipti().split()))
s = [0] * m
c = [0] * m
ans = [-1] * n
for i in range(m):
... | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
n, m = list(map(int, readline().split()))
restriction = [list(map(int, readline().split())) for _ in range(m)]
# n桁の数字の下限と上限 [begin,end)
begin = (None, 0, 10, 100)
end = (None, 10,... | false | 36.538462 | [
"-# import math",
"-# import bisect",
"-# import numpy as np",
"-# import itertools",
"-# import copy",
"-ipti = sys.stdin.readline",
"+readline = sys.stdin.readline",
"- n, m = list(map(int, ipti().split()))",
"- s = [0] * m",
"- c = [0] * m",
"- ans = [-1] * n",
"- for i in ra... | false | 0.082444 | 0.037633 | 2.190736 | [
"s254001119",
"s124145462"
] |
u952708174 | p02862 | python | s845647856 | s415918846 | 412 | 120 | 90,036 | 3,064 | Accepted | Accepted | 70.87 | def d_knight():
X, Y = [int(i) for i in input().split()]
if (abs(X) + abs(Y)) % 3 != 0 or Y > 2 * X or 2 * Y < X:
return 0
n = (abs(X) + abs(Y)) // 3
k = -1
for x in range(n, 2 * n + 1):
if Y == 3 * n - x:
k = x - n
break
class Combination(... | def d_knight():
X, Y = [int(i) for i in input().split()]
def combination(n, r, mod):
r = min(r, n - r)
numerator, denominator = 1, 1
for i in range(1, r + 1):
numerator = (numerator * (n + 1 - i)) % mod
denominator = (denominator * i) % mod
retur... | 38 | 22 | 1,231 | 641 | def d_knight():
X, Y = [int(i) for i in input().split()]
if (abs(X) + abs(Y)) % 3 != 0 or Y > 2 * X or 2 * Y < X:
return 0
n = (abs(X) + abs(Y)) // 3
k = -1
for x in range(n, 2 * n + 1):
if Y == 3 * n - x:
k = x - n
break
class Combination(object):
... | def d_knight():
X, Y = [int(i) for i in input().split()]
def combination(n, r, mod):
r = min(r, n - r)
numerator, denominator = 1, 1
for i in range(1, r + 1):
numerator = (numerator * (n + 1 - i)) % mod
denominator = (denominator * i) % mod
return numerat... | false | 42.105263 | [
"- if (abs(X) + abs(Y)) % 3 != 0 or Y > 2 * X or 2 * Y < X:",
"+",
"+ def combination(n, r, mod):",
"+ r = min(r, n - r)",
"+ numerator, denominator = 1, 1",
"+ for i in range(1, r + 1):",
"+ numerator = (numerator * (n + 1 - i)) % mod",
"+ denominator ... | false | 0.249529 | 0.050767 | 4.915203 | [
"s845647856",
"s415918846"
] |
u426534722 | p02326 | python | s104010014 | s659965801 | 2,880 | 2,250 | 58,592 | 57,944 | Accepted | Accepted | 21.88 | import sys
h, w = list(map(int, sys.stdin.readline().split()))
dp = [[0 for j in range(w)] for i in range(h)]
G = [[int(j) for j in sys.stdin.readline().split()] for i in range(h)]
maxWidth = 0
for i in range(0, h):
for j in range(0, w):
dp[i][j] = (G[i][j] + 1) % 2
maxWidth |= dp[i][j]
for... | import sys
h, w = list(map(int, sys.stdin.readline().split()))
dp = [[0] * w for _ in range(h)]
G = [[int(j) for j in sys.stdin.readline().split()] for _ in range(h)]
for i in range(0, h):
for j in range(0, w):
dp[i][j] = (G[i][j] + 1) % 2
for i in range(1, h):
for j in range(1, w):
if(... | 16 | 12 | 566 | 449 | import sys
h, w = list(map(int, sys.stdin.readline().split()))
dp = [[0 for j in range(w)] for i in range(h)]
G = [[int(j) for j in sys.stdin.readline().split()] for i in range(h)]
maxWidth = 0
for i in range(0, h):
for j in range(0, w):
dp[i][j] = (G[i][j] + 1) % 2
maxWidth |= dp[i][j]
for i in ra... | import sys
h, w = list(map(int, sys.stdin.readline().split()))
dp = [[0] * w for _ in range(h)]
G = [[int(j) for j in sys.stdin.readline().split()] for _ in range(h)]
for i in range(0, h):
for j in range(0, w):
dp[i][j] = (G[i][j] + 1) % 2
for i in range(1, h):
for j in range(1, w):
if G[i][j] ... | false | 25 | [
"-dp = [[0 for j in range(w)] for i in range(h)]",
"-G = [[int(j) for j in sys.stdin.readline().split()] for i in range(h)]",
"-maxWidth = 0",
"+dp = [[0] * w for _ in range(h)]",
"+G = [[int(j) for j in sys.stdin.readline().split()] for _ in range(h)]",
"- maxWidth |= dp[i][j]",
"- if... | false | 0.036732 | 0.06459 | 0.568693 | [
"s104010014",
"s659965801"
] |
u159994501 | p02995 | python | s243770752 | s243147528 | 40 | 35 | 5,372 | 5,076 | Accepted | Accepted | 12.5 | from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
A, B, C, D = list(map(int, input().split()))
SUM = B - A + 1
c = (B // C - (A - 1) // C)
d = (B // D - (A - 1) // D)
cd = (B // lcm(C, D) - (A - 1) // lcm(C, D))
print((B - A + 1 - (B // C - (A - 1) // C + B // D - (A - 1) // D - c... | from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
A, B, C, D = list(map(int, input().split()))
SUM = B - A + 1
c = (B // C - (A - 1) // C)
d = (B // D - (A - 1) // D)
cd = (B // lcm(C, D) - (A - 1) // lcm(C, D))
print((B - A + 1 - (B // C - (A - 1) // C + B // D - (A - 1) // D - (... | 13 | 13 | 317 | 354 | from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
A, B, C, D = list(map(int, input().split()))
SUM = B - A + 1
c = B // C - (A - 1) // C
d = B // D - (A - 1) // D
cd = B // lcm(C, D) - (A - 1) // lcm(C, D)
print((B - A + 1 - (B // C - (A - 1) // C + B // D - (A - 1) // D - cd)))
| from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
A, B, C, D = list(map(int, input().split()))
SUM = B - A + 1
c = B // C - (A - 1) // C
d = B // D - (A - 1) // D
cd = B // lcm(C, D) - (A - 1) // lcm(C, D)
print(
(
B
- A
+ 1
- (
B // C
... | false | 0 | [
"-print((B - A + 1 - (B // C - (A - 1) // C + B // D - (A - 1) // D - cd)))",
"+print(",
"+ (",
"+ B",
"+ - A",
"+ + 1",
"+ - (",
"+ B // C",
"+ - (A - 1) // C",
"+ + B // D",
"+ - (A - 1) // D",
"+ - (B // l... | false | 0.045139 | 0.118859 | 0.379772 | [
"s243770752",
"s243147528"
] |
u875291233 | p03560 | python | s497355154 | s674238927 | 279 | 136 | 38,424 | 14,964 | Accepted | Accepted | 51.25 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意
k = int(eval(input()))
g = [[] for _ in range(k)]
for i in range(k):
g[i].append(((i+1)%k,1))
if i: g[i].append((10*i%k,0))
#print(g)
from collections import deque
q = deque([... | # coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline
k, = list(map(int, readline().split()))
from collections import deque
INF = 1<<30
res = [INF]*k
res[1] = 1
q = deque([(1,1)])
while q:
dv,v = q.popleft()
if res[v] < dv: continue
#if v==goal:... | 32 | 28 | 633 | 589 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline # 文字列入力のときは注意
k = int(eval(input()))
g = [[] for _ in range(k)]
for i in range(k):
g[i].append(((i + 1) % k, 1))
if i:
g[i].append((10 * i % k, 0))
# print(g)
from collections import deque
q = dequ... | # coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline
(k,) = list(map(int, readline().split()))
from collections import deque
INF = 1 << 30
res = [INF] * k
res[1] = 1
q = deque([(1, 1)])
while q:
dv, v = q.popleft()
if res[v] < dv:
continue
# if v==goal: ... | false | 12.5 | [
"-sys.setrecursionlimit(10**6)",
"-readline = sys.stdin.readline # 文字列入力のときは注意",
"-k = int(eval(input()))",
"-g = [[] for _ in range(k)]",
"-for i in range(k):",
"- g[i].append(((i + 1) % k, 1))",
"- if i:",
"- g[i].append((10 * i % k, 0))",
"-# print(g)",
"+read = sys.stdin.read",
... | false | 0.118253 | 0.129933 | 0.910107 | [
"s497355154",
"s674238927"
] |
u912237403 | p00168 | python | s388503412 | s323256652 | 20 | 10 | 4,216 | 4,208 | Accepted | Accepted | 50 | N = []
while 1:
x = eval(input())
if x==0: break
N.append(x)
n0 = max(N)-2
A = [1,1,2]+[0]*n0
for i in range(0, n0): A[i+3] = sum(A[i:i+3])
for e in N: print(A[e]/3650+[0,1][A[e]%3650>0]) | N = []
while 1:
x = int(input())
if x==0: break
N.append(x)
n0 = max(N)-2
A = [1,1,2]+[0]*n0
for i in range(0, n0): A[i+3] = sum(A[i:i+3])
for e in N: print((A[e]+3649)/3650) | 9 | 9 | 194 | 191 | N = []
while 1:
x = eval(input())
if x == 0:
break
N.append(x)
n0 = max(N) - 2
A = [1, 1, 2] + [0] * n0
for i in range(0, n0):
A[i + 3] = sum(A[i : i + 3])
for e in N:
print(A[e] / 3650 + [0, 1][A[e] % 3650 > 0])
| N = []
while 1:
x = int(input())
if x == 0:
break
N.append(x)
n0 = max(N) - 2
A = [1, 1, 2] + [0] * n0
for i in range(0, n0):
A[i + 3] = sum(A[i : i + 3])
for e in N:
print((A[e] + 3649) / 3650)
| false | 0 | [
"- x = eval(input())",
"+ x = int(input())",
"- print(A[e] / 3650 + [0, 1][A[e] % 3650 > 0])",
"+ print((A[e] + 3649) / 3650)"
] | false | 0.035031 | 0.040372 | 0.867716 | [
"s388503412",
"s323256652"
] |
u201856486 | p03208 | python | s509965344 | s055300241 | 281 | 232 | 11,288 | 11,292 | Accepted | Accepted | 17.44 | n, k = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(n)]
a.sort()
b = 0
ans = []
for i in range(n - k + 1):
b = a[i + k - 1] - a[i]
ans.append(b)
ans.sort()
print((ans[0])) | n, k = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(n)]
a.sort()
ans = []
for i in range(n - k + 1):
b = a[i + k - 1] - a[i]
ans.append(b)
print((min(ans))) | 12 | 11 | 210 | 196 | n, k = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(n)]
a.sort()
b = 0
ans = []
for i in range(n - k + 1):
b = a[i + k - 1] - a[i]
ans.append(b)
ans.sort()
print((ans[0]))
| n, k = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(n)]
a.sort()
ans = []
for i in range(n - k + 1):
b = a[i + k - 1] - a[i]
ans.append(b)
print((min(ans)))
| false | 8.333333 | [
"-b = 0",
"-ans.sort()",
"-print((ans[0]))",
"+print((min(ans)))"
] | false | 0.041812 | 0.044385 | 0.942039 | [
"s509965344",
"s055300241"
] |
u580697892 | p02802 | python | s189329337 | s684652934 | 359 | 284 | 21,192 | 4,760 | Accepted | Accepted | 20.89 | # coding: utf-8
N, M = list(map(int, input().split()))
ac, wa = 0, 0
l = {}
T = {}
idx, sta = -1, -1
for i in range(M):
tmp = input().split()
p = int(tmp[0])
s = tmp[1]
if p not in list(l.keys()):
l[p] = 0
T[p] = False
if s == "AC" and not T[p]:
ac += 1
... | # coding: utf-8
N, M = list(map(int, input().split()))
AC, WA = [], []
AC = [False for _ in range(10**5)]
WA = [0 for _ in range(10**5)]
ac, wa = 0, 0
for i in range(M):
tmp = input().split()
p = int(tmp[0]) - 1
s = tmp[1]
if AC[p]:
continue
else:
if s == "AC":
... | 24 | 22 | 475 | 457 | # coding: utf-8
N, M = list(map(int, input().split()))
ac, wa = 0, 0
l = {}
T = {}
idx, sta = -1, -1
for i in range(M):
tmp = input().split()
p = int(tmp[0])
s = tmp[1]
if p not in list(l.keys()):
l[p] = 0
T[p] = False
if s == "AC" and not T[p]:
ac += 1
T[p] = True
... | # coding: utf-8
N, M = list(map(int, input().split()))
AC, WA = [], []
AC = [False for _ in range(10**5)]
WA = [0 for _ in range(10**5)]
ac, wa = 0, 0
for i in range(M):
tmp = input().split()
p = int(tmp[0]) - 1
s = tmp[1]
if AC[p]:
continue
else:
if s == "AC":
AC[p] = Tr... | false | 8.333333 | [
"+AC, WA = [], []",
"+AC = [False for _ in range(10**5)]",
"+WA = [0 for _ in range(10**5)]",
"-l = {}",
"-T = {}",
"-idx, sta = -1, -1",
"- p = int(tmp[0])",
"+ p = int(tmp[0]) - 1",
"- if p not in list(l.keys()):",
"- l[p] = 0",
"- T[p] = False",
"- if s == \"AC\" a... | false | 0.076378 | 0.113642 | 0.672095 | [
"s189329337",
"s684652934"
] |
u426534722 | p02244 | python | s544879370 | s549563220 | 50 | 40 | 7,796 | 7,796 | Accepted | Accepted | 20 | from sys import stdin
N = 8
FREE = -1
NOT_FREE = 1
row = [FREE] * N
col = [FREE] * N
dpos = [FREE] * (2 * N - 1)
dneg = [FREE] * (2 * N - 1)
X = [[False] * N for _ in range(N)]
n = int(stdin.readline())
for _ in range(0, n):
r, c = list(map(int, stdin.readline().split()))
X[r][c] = True
def printBo... | from sys import stdin
N = 8
FREE = -1
NOT_FREE = 1
row = [FREE] * N
col = [FREE] * N
dpos = [FREE] * (2 * N - 1)
dneg = [FREE] * (2 * N - 1)
X = [[False] * N for _ in range(N)]
n = int(stdin.readline())
for _ in range(0, n):
r, c = list(map(int, stdin.readline().split()))
X[r][c] = True
def printBo... | 32 | 32 | 953 | 940 | from sys import stdin
N = 8
FREE = -1
NOT_FREE = 1
row = [FREE] * N
col = [FREE] * N
dpos = [FREE] * (2 * N - 1)
dneg = [FREE] * (2 * N - 1)
X = [[False] * N for _ in range(N)]
n = int(stdin.readline())
for _ in range(0, n):
r, c = list(map(int, stdin.readline().split()))
X[r][c] = True
def printBoard():
... | from sys import stdin
N = 8
FREE = -1
NOT_FREE = 1
row = [FREE] * N
col = [FREE] * N
dpos = [FREE] * (2 * N - 1)
dneg = [FREE] * (2 * N - 1)
X = [[False] * N for _ in range(N)]
n = int(stdin.readline())
for _ in range(0, n):
r, c = list(map(int, stdin.readline().split()))
X[r][c] = True
def printBoard():
... | false | 0 | [
"- print((\"\".join((\"Q\" if row[i] == j else \".\" for j in range(N)))))",
"+ print((\".\" * row[i] + \"Q\" + \".\" * (8 - row[i] - 1)))"
] | false | 0.073397 | 0.077196 | 0.950792 | [
"s544879370",
"s549563220"
] |
u072053884 | p02414 | python | s061797363 | s139025849 | 300 | 210 | 8,948 | 9,100 | Accepted | Accepted | 30 | n, m, l = list(map(int, input().split()))
A = []
B = []
C = [[] for i in range(n)]
for i in range(n):
tmp_row = list(map(int, input().split()))
A.append(tmp_row)
for i in range(m):
tmp_row = list(map(int, input().split()))
B.append(tmp_row)
for i in range(n):
for j in range(l):
... | n, m, l = list(map(int, input().split()))
A = []
B = []
C = [[] for i in range(n)]
for i in range(n):
tmp_row = list(map(int, input().split()))
A.append(tmp_row)
for i in range(m):
tmp_row = list(map(int, input().split()))
B.append(tmp_row)
for i in range(n):
for bj in zip(*B):
... | 21 | 21 | 442 | 431 | n, m, l = list(map(int, input().split()))
A = []
B = []
C = [[] for i in range(n)]
for i in range(n):
tmp_row = list(map(int, input().split()))
A.append(tmp_row)
for i in range(m):
tmp_row = list(map(int, input().split()))
B.append(tmp_row)
for i in range(n):
for j in range(l):
ab = sum([A[i... | n, m, l = list(map(int, input().split()))
A = []
B = []
C = [[] for i in range(n)]
for i in range(n):
tmp_row = list(map(int, input().split()))
A.append(tmp_row)
for i in range(m):
tmp_row = list(map(int, input().split()))
B.append(tmp_row)
for i in range(n):
for bj in zip(*B):
c = sum(aik *... | false | 0 | [
"- for j in range(l):",
"- ab = sum([A[i][k] * B[k][j] for k in range(m)])",
"- C[i].append(ab)",
"+ for bj in zip(*B):",
"+ c = sum(aik * bjk for aik, bjk in zip(A[i], bj))",
"+ C[i].append(c)",
"- print((\" \".join(map(str, i))))",
"+ print((*i))"
] | false | 0.036756 | 0.037158 | 0.989177 | [
"s061797363",
"s139025849"
] |
u952708174 | p03767 | python | s704908785 | s935518967 | 278 | 235 | 37,084 | 39,492 | Accepted | Accepted | 15.47 | def a_atCoder_group_contest(N, A):
A.sort()
ans = 0
for k in range(N):
group = [A[k], A[3 * N - (2 * k + 2)], A[3 * N - (2 * k + 1)]]
ans += group[1]
return ans
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((a_atCoder_group_contest(N, A))) | def a_atCoder_group_contest(N, A):
A.sort(reverse=True)
ans = sum(A[1:2 * N:2]) # Aが0-indexedなので、 1, 3,..., 2N-1 番の和をとる
return ans
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((a_atCoder_group_contest(N, A))) | 11 | 8 | 295 | 243 | def a_atCoder_group_contest(N, A):
A.sort()
ans = 0
for k in range(N):
group = [A[k], A[3 * N - (2 * k + 2)], A[3 * N - (2 * k + 1)]]
ans += group[1]
return ans
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((a_atCoder_group_contest(N, A)))
| def a_atCoder_group_contest(N, A):
A.sort(reverse=True)
ans = sum(A[1 : 2 * N : 2]) # Aが0-indexedなので、 1, 3,..., 2N-1 番の和をとる
return ans
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((a_atCoder_group_contest(N, A)))
| false | 27.272727 | [
"- A.sort()",
"- ans = 0",
"- for k in range(N):",
"- group = [A[k], A[3 * N - (2 * k + 2)], A[3 * N - (2 * k + 1)]]",
"- ans += group[1]",
"+ A.sort(reverse=True)",
"+ ans = sum(A[1 : 2 * N : 2]) # Aが0-indexedなので、 1, 3,..., 2N-1 番の和をとる"
] | false | 0.052863 | 0.03671 | 1.440015 | [
"s704908785",
"s935518967"
] |
u279266699 | p02836 | python | s928248796 | s467993178 | 30 | 26 | 9,068 | 9,092 | Accepted | Accepted | 13.33 | s = eval(input())
if len(s) % 2 == 0:
s_1 = s[:len(s) // 2]
s_2 = s[len(s) // 2:][::-1]
else:
s_1 = s[:len(s) // 2 + 1]
s_2 = s[len(s) // 2:][::-1]
ans = 0
for i in range(len(s_1)):
if s_1[i] != s_2[i]:
ans += 1
print(ans) | s = eval(input())
ans = 0
for i in range(len(s) // 2):
if s[i] != s[-i - 1]:
ans += 1
print(ans) | 12 | 6 | 255 | 107 | s = eval(input())
if len(s) % 2 == 0:
s_1 = s[: len(s) // 2]
s_2 = s[len(s) // 2 :][::-1]
else:
s_1 = s[: len(s) // 2 + 1]
s_2 = s[len(s) // 2 :][::-1]
ans = 0
for i in range(len(s_1)):
if s_1[i] != s_2[i]:
ans += 1
print(ans)
| s = eval(input())
ans = 0
for i in range(len(s) // 2):
if s[i] != s[-i - 1]:
ans += 1
print(ans)
| false | 50 | [
"-if len(s) % 2 == 0:",
"- s_1 = s[: len(s) // 2]",
"- s_2 = s[len(s) // 2 :][::-1]",
"-else:",
"- s_1 = s[: len(s) // 2 + 1]",
"- s_2 = s[len(s) // 2 :][::-1]",
"-for i in range(len(s_1)):",
"- if s_1[i] != s_2[i]:",
"+for i in range(len(s) // 2):",
"+ if s[i] != s[-i - 1]:"
] | false | 0.046068 | 0.187256 | 0.246015 | [
"s928248796",
"s467993178"
] |
u257162238 | p02727 | python | s708744195 | s135397510 | 431 | 390 | 33,292 | 31,484 | Accepted | Accepted | 9.51 | from pprint import pprint
from bisect import bisect_left
import numpy
def read():
X, Y, A, B, C = list(map(int, input().strip().split()))
P = list(map(int, input().strip().split()))
Q = list(map(int, input().strip().split()))
R = list(map(int, input().strip().split()))
return X, Y, A, B,... | from pprint import pprint
from bisect import bisect_left
import numpy
def read():
X, Y, A, B, C = list(map(int, input().strip().split()))
P = list(map(int, input().strip().split()))
Q = list(map(int, input().strip().split()))
R = list(map(int, input().strip().split()))
return X, Y, A, B,... | 52 | 52 | 1,449 | 1,470 | from pprint import pprint
from bisect import bisect_left
import numpy
def read():
X, Y, A, B, C = list(map(int, input().strip().split()))
P = list(map(int, input().strip().split()))
Q = list(map(int, input().strip().split()))
R = list(map(int, input().strip().split()))
return X, Y, A, B, C, P, Q, ... | from pprint import pprint
from bisect import bisect_left
import numpy
def read():
X, Y, A, B, C = list(map(int, input().strip().split()))
P = list(map(int, input().strip().split()))
Q = list(map(int, input().strip().split()))
R = list(map(int, input().strip().split()))
return X, Y, A, B, C, P, Q, ... | false | 0 | [
"- elif Q[j - 1] < r:",
"+ elif Q[j - 1] <= P[i - 1] and Q[j - 1] < r:"
] | false | 0.04163 | 0.046083 | 0.903373 | [
"s708744195",
"s135397510"
] |
u028973125 | p03486 | python | s358922042 | s396331681 | 30 | 24 | 9,004 | 9,044 | Accepted | Accepted | 20 | import sys
s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()
if sorted(s) < sorted(t, reverse=True):
print("Yes")
else:
print("No") | import sys
input = sys.stdin.readline
s = list(input().strip())
t = list(input().strip())
if sorted(s) < sorted(t, reverse=True):
print("Yes")
else:
print("No") | 9 | 9 | 165 | 177 | import sys
s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()
if sorted(s) < sorted(t, reverse=True):
print("Yes")
else:
print("No")
| import sys
input = sys.stdin.readline
s = list(input().strip())
t = list(input().strip())
if sorted(s) < sorted(t, reverse=True):
print("Yes")
else:
print("No")
| false | 0 | [
"-s = sys.stdin.readline().strip()",
"-t = sys.stdin.readline().strip()",
"+input = sys.stdin.readline",
"+s = list(input().strip())",
"+t = list(input().strip())"
] | false | 0.101216 | 0.108348 | 0.934173 | [
"s358922042",
"s396331681"
] |
u580697892 | p03101 | python | s522353155 | s605632606 | 341 | 17 | 22,020 | 2,940 | Accepted | Accepted | 95.01 | #coding: utf-8
import numpy as np
H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))
goban = np.array([[1 for i in range(W)] for j in range(H)])
goban[:h :] = 0
goban[:, :w] = 0
print((np.sum(goban))) | H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))
print(((H-h) * (W-w))) | 8 | 3 | 220 | 88 | # coding: utf-8
import numpy as np
H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))
goban = np.array([[1 for i in range(W)] for j in range(H)])
goban[:h:] = 0
goban[:, :w] = 0
print((np.sum(goban)))
| H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))
print(((H - h) * (W - w)))
| false | 62.5 | [
"-# coding: utf-8",
"-import numpy as np",
"-",
"-goban = np.array([[1 for i in range(W)] for j in range(H)])",
"-goban[:h:] = 0",
"-goban[:, :w] = 0",
"-print((np.sum(goban)))",
"+print(((H - h) * (W - w)))"
] | false | 0.171281 | 0.034369 | 4.983644 | [
"s522353155",
"s605632606"
] |
u309141201 | p03487 | python | s169582961 | s988114763 | 120 | 80 | 18,672 | 18,676 | Accepted | Accepted | 33.33 | import collections
N=int(eval(input()))
a=list(map(int,input().split()))
a_counter=collections.Counter(a)
answer = 0
# print(a_counter)
# print(a_counter[0])
# print(a_counter[1])
# print(a_counter[2])
# print(a_counter[3])
for i in a_counter:
# print(i)
# print(i == a_counter[i])
if i != a_cou... | import collections
N = int(eval(input()))
a = list(map(int, input().split()))
a_count = collections.Counter(a)
# print(a_count)
ans = 0
for i, j in list(a_count.items()):
# print(i, j)
if i <= j:
ans += j - i
else:
ans += j
print(ans) | 20 | 14 | 460 | 264 | import collections
N = int(eval(input()))
a = list(map(int, input().split()))
a_counter = collections.Counter(a)
answer = 0
# print(a_counter)
# print(a_counter[0])
# print(a_counter[1])
# print(a_counter[2])
# print(a_counter[3])
for i in a_counter:
# print(i)
# print(i == a_counter[i])
if i != a_counter[... | import collections
N = int(eval(input()))
a = list(map(int, input().split()))
a_count = collections.Counter(a)
# print(a_count)
ans = 0
for i, j in list(a_count.items()):
# print(i, j)
if i <= j:
ans += j - i
else:
ans += j
print(ans)
| false | 30 | [
"-a_counter = collections.Counter(a)",
"-answer = 0",
"-# print(a_counter)",
"-# print(a_counter[0])",
"-# print(a_counter[1])",
"-# print(a_counter[2])",
"-# print(a_counter[3])",
"-for i in a_counter:",
"- # print(i)",
"- # print(i == a_counter[i])",
"- if i != a_counter[i]:",
"- ... | false | 0.043736 | 0.045241 | 0.966749 | [
"s169582961",
"s988114763"
] |
u839537730 | p03631 | python | s117066792 | s794330125 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | N = eval(input())
revN = N[::-1]
if int(N) == int(revN):
print("Yes")
else:
print("No") | N = eval(input())
if N[0] == N[-1]:
print("Yes")
else:
print("No") | 7 | 6 | 96 | 74 | N = eval(input())
revN = N[::-1]
if int(N) == int(revN):
print("Yes")
else:
print("No")
| N = eval(input())
if N[0] == N[-1]:
print("Yes")
else:
print("No")
| false | 14.285714 | [
"-revN = N[::-1]",
"-if int(N) == int(revN):",
"+if N[0] == N[-1]:"
] | false | 0.039362 | 0.039874 | 0.987157 | [
"s117066792",
"s794330125"
] |
u936985471 | p03166 | python | s507574411 | s229938226 | 327 | 240 | 18,736 | 27,480 | Accepted | Accepted | 26.61 | import sys
readline = sys.stdin.readline
N,M = list(map(int,readline().split()))
G = [[] for i in range(N)]
indegree = [0 for i in range(N)]
for i in range(M):
x,y = list(map(int,readline().split()))
G[x - 1].append(y - 1)
indegree[y - 1] += 1
stack = []
for i in range(len(indegree)):
if inde... | import sys
readline = sys.stdin.readline
N,M = list(map(int,readline().split()))
G = [[] for i in range(N)]
indegree = [0] * N
for i in range(M):
x,y = list(map(int,readline().split()))
G[x - 1].append(y - 1)
indegree[y - 1] += 1
start = set()
for i in range(len(indegree)):
if indegree[i] =... | 30 | 34 | 588 | 592 | import sys
readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
G = [[] for i in range(N)]
indegree = [0 for i in range(N)]
for i in range(M):
x, y = list(map(int, readline().split()))
G[x - 1].append(y - 1)
indegree[y - 1] += 1
stack = []
for i in range(len(indegree)):
if indegree[i... | import sys
readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
G = [[] for i in range(N)]
indegree = [0] * N
for i in range(M):
x, y = list(map(int, readline().split()))
G[x - 1].append(y - 1)
indegree[y - 1] += 1
start = set()
for i in range(len(indegree)):
if indegree[i] == 0:
... | false | 11.764706 | [
"-indegree = [0 for i in range(N)]",
"+indegree = [0] * N",
"-stack = []",
"+start = set()",
"- stack.append(i)",
"-cnt = -1",
"-while stack:",
"- cnt += 1",
"- newstack = []",
"- while stack:",
"- v = stack.pop()",
"- for child in G[v]:",
"- indegree... | false | 0.081928 | 0.119751 | 0.684157 | [
"s507574411",
"s229938226"
] |
u562935282 | p03264 | python | s898567851 | s117516737 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | def iin(): return int(eval(input()))
def nl(): return list(map(int, input().split()))
def ary(r, c, v): return [[v for _ in range(c)] for _ in range(r)]
k = iin()
if k % 2 == 0:
ans = (k // 2) ** 2
else:
ans = (k // 2) * (k // 2 + 1)
print(ans) | k = int(eval(input()))
even = k // 2
odd = k - even
print((even * odd)) | 10 | 5 | 256 | 68 | def iin():
return int(eval(input()))
def nl():
return list(map(int, input().split()))
def ary(r, c, v):
return [[v for _ in range(c)] for _ in range(r)]
k = iin()
if k % 2 == 0:
ans = (k // 2) ** 2
else:
ans = (k // 2) * (k // 2 + 1)
print(ans)
| k = int(eval(input()))
even = k // 2
odd = k - even
print((even * odd))
| false | 50 | [
"-def iin():",
"- return int(eval(input()))",
"-",
"-",
"-def nl():",
"- return list(map(int, input().split()))",
"-",
"-",
"-def ary(r, c, v):",
"- return [[v for _ in range(c)] for _ in range(r)]",
"-",
"-",
"-k = iin()",
"-if k % 2 == 0:",
"- ans = (k // 2) ** 2",
"-else... | false | 0.039582 | 0.040418 | 0.979299 | [
"s898567851",
"s117516737"
] |
u268793453 | p04020 | python | s121251850 | s927798260 | 232 | 189 | 7,072 | 7,072 | Accepted | Accepted | 18.53 | n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
ans = A[0] // 2
A[0] %= 2
for i in range(1, n):
ans += (A[i-1] + A[i]) // 2
if A[i] == 0:
pass
elif A[i-1] == 1:
if A[i] % 2 == 0:
A[i] = 1
else:
A[i] = 0
else:
A[i... | n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
ans = 0
s = 0
for a in A:
s += a
if a == 0:
ans += s//2
s = 0
print((ans + s//2)) | 19 | 14 | 328 | 164 | n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
ans = A[0] // 2
A[0] %= 2
for i in range(1, n):
ans += (A[i - 1] + A[i]) // 2
if A[i] == 0:
pass
elif A[i - 1] == 1:
if A[i] % 2 == 0:
A[i] = 1
else:
A[i] = 0
else:
A[i] %= 2
print(a... | n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
ans = 0
s = 0
for a in A:
s += a
if a == 0:
ans += s // 2
s = 0
print((ans + s // 2))
| false | 26.315789 | [
"-ans = A[0] // 2",
"-A[0] %= 2",
"-for i in range(1, n):",
"- ans += (A[i - 1] + A[i]) // 2",
"- if A[i] == 0:",
"- pass",
"- elif A[i - 1] == 1:",
"- if A[i] % 2 == 0:",
"- A[i] = 1",
"- else:",
"- A[i] = 0",
"- else:",
"- A[i] ... | false | 0.038424 | 0.046384 | 0.828406 | [
"s121251850",
"s927798260"
] |
u688219499 | p02947 | python | s331808496 | s275344124 | 530 | 255 | 24,652 | 22,224 | Accepted | Accepted | 51.89 | n=int(eval(input()))
dictionary=[]
count=1
ans=0
for i in range(n):
s=list(eval(input()))
s.sort()
dictionary.append(s)
dictionary.sort()
for i in range(n-1):
if dictionary[i]==dictionary[i+1]:
count+=1
else:
ans+=count*(count-1)//2
count=1
if i==n-2:
... | n = int(eval(input()))
d = dict()
for i in range(n):
s = list(eval(input()))
s.sort()
s = "".join(s)
if s not in list(d.keys()):
d[s] = 1
else:
d[s] += 1
count = 0
for i in list(d.values()):
count += i * (i-1) // 2
print(count) | 18 | 14 | 348 | 256 | n = int(eval(input()))
dictionary = []
count = 1
ans = 0
for i in range(n):
s = list(eval(input()))
s.sort()
dictionary.append(s)
dictionary.sort()
for i in range(n - 1):
if dictionary[i] == dictionary[i + 1]:
count += 1
else:
ans += count * (count - 1) // 2
count = 1
if ... | n = int(eval(input()))
d = dict()
for i in range(n):
s = list(eval(input()))
s.sort()
s = "".join(s)
if s not in list(d.keys()):
d[s] = 1
else:
d[s] += 1
count = 0
for i in list(d.values()):
count += i * (i - 1) // 2
print(count)
| false | 22.222222 | [
"-dictionary = []",
"-count = 1",
"-ans = 0",
"+d = dict()",
"- dictionary.append(s)",
"-dictionary.sort()",
"-for i in range(n - 1):",
"- if dictionary[i] == dictionary[i + 1]:",
"- count += 1",
"+ s = \"\".join(s)",
"+ if s not in list(d.keys()):",
"+ d[s] = 1",
"... | false | 0.099674 | 0.082079 | 1.214369 | [
"s331808496",
"s275344124"
] |
u654470292 | p03380 | python | s004304422 | s550558338 | 228 | 116 | 62,832 | 89,880 | Accepted | Accepted | 49.12 | import sys
import math
def input():
return sys.stdin.readline()[:-1]
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
half=float(a[-1])/2
len=float("inf")
ans=a[0]
for i in range(n-1):
if len>abs(half-a[i]):
ans=a[i]
len=abs(half-a[i])
print((a[-1]))
print(ans) | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 16 | 25 | 306 | 659 | import sys
import math
def input():
return sys.stdin.readline()[:-1]
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
half = float(a[-1]) / 2
len = float("inf")
ans = a[0]
for i in range(n - 1):
if len > abs(half - a[i]):
ans = a[i]
len = abs(half - a[i])
print((a[-1]))
pr... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 36 | [
"-import sys",
"-import math",
"+import bisect, copy, heapq, math, sys",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"+def ruiseki(lst):",
"+ return [0] + list(accumulate(lst))",
"+",
"+",
"+def ce... | false | 0.088777 | 0.03908 | 2.271699 | [
"s004304422",
"s550558338"
] |
u124228697 | p02552 | python | s219301529 | s858744369 | 33 | 26 | 9,016 | 9,144 | Accepted | Accepted | 21.21 | bin = [1,0]
print((bin[int(eval(input()))])) | print((int(bin(int(eval(input())) ^ 1), 2))) | 2 | 1 | 37 | 36 | bin = [1, 0]
print((bin[int(eval(input()))]))
| print((int(bin(int(eval(input())) ^ 1), 2)))
| false | 50 | [
"-bin = [1, 0]",
"-print((bin[int(eval(input()))]))",
"+print((int(bin(int(eval(input())) ^ 1), 2)))"
] | false | 0.038252 | 0.038745 | 0.987278 | [
"s219301529",
"s858744369"
] |
u246401133 | p02582 | python | s383262869 | s402530577 | 33 | 27 | 8,964 | 9,100 | Accepted | Accepted | 18.18 | s = eval(input())
a = "SSS"
b = "RRR"
c = ["SRR", "RRS"]
if s == a:
x = 0
elif s == b:
x = 3
elif s in c:
x = 2
else:
x = 1
print(x) | s = eval(input())
if s == "RRR":
x = 3
elif s == "RRS" or s == "SRR":
x = 2
elif s == "SSS":
x = 0
else:
x = 1
print(x) | 13 | 10 | 154 | 138 | s = eval(input())
a = "SSS"
b = "RRR"
c = ["SRR", "RRS"]
if s == a:
x = 0
elif s == b:
x = 3
elif s in c:
x = 2
else:
x = 1
print(x)
| s = eval(input())
if s == "RRR":
x = 3
elif s == "RRS" or s == "SRR":
x = 2
elif s == "SSS":
x = 0
else:
x = 1
print(x)
| false | 23.076923 | [
"-a = \"SSS\"",
"-b = \"RRR\"",
"-c = [\"SRR\", \"RRS\"]",
"-if s == a:",
"+if s == \"RRR\":",
"+ x = 3",
"+elif s == \"RRS\" or s == \"SRR\":",
"+ x = 2",
"+elif s == \"SSS\":",
"-elif s == b:",
"- x = 3",
"-elif s in c:",
"- x = 2"
] | false | 0.032723 | 0.033603 | 0.973787 | [
"s383262869",
"s402530577"
] |
u562935282 | p02769 | python | s333789721 | s222923656 | 574 | 478 | 36,724 | 18,804 | Accepted | Accepted | 16.72 | class Calc:
def __init__(self, max_value, mod):
"""combination(max_value, all)"""
fact = [-1] * (max_value + 1)
fact[0] = 1
fact[1] = 1
for x in range(2, max_value + 1):
fact[x] = x * fact[x - 1] % mod
invs = [1] * (max_value + 1)
invs[m... | class Calc:
def __init__(self, max_value, mod):
"""combination(max_value, all)"""
fact = [-1] * (max_value + 1)
fact[0] = 1
fact[1] = 1
for x in range(2, max_value + 1):
fact[x] = x * fact[x - 1] % mod
invs = [1] * (max_value + 1)
invs[m... | 61 | 67 | 1,402 | 1,405 | class Calc:
def __init__(self, max_value, mod):
"""combination(max_value, all)"""
fact = [-1] * (max_value + 1)
fact[0] = 1
fact[1] = 1
for x in range(2, max_value + 1):
fact[x] = x * fact[x - 1] % mod
invs = [1] * (max_value + 1)
invs[max_value] =... | class Calc:
def __init__(self, max_value, mod):
"""combination(max_value, all)"""
fact = [-1] * (max_value + 1)
fact[0] = 1
fact[1] = 1
for x in range(2, max_value + 1):
fact[x] = x * fact[x - 1] % mod
invs = [1] * (max_value + 1)
invs[max_value] =... | false | 8.955224 | [
"- def factorial(self, n):",
"- return self.fact[n]",
"-",
"- mi = min(k, n - 1)",
"- cl = Calc(max_value=n * 2 - 1, mod=mod)",
"+ cl = Calc(max_value=n, mod=mod)",
"+ m = min(k, n - 1)",
"- for r in range(mi + 1):",
"- ret += cl.combination(n - 1, n - r - 1) * cl.com... | false | 0.339989 | 0.451361 | 0.753253 | [
"s333789721",
"s222923656"
] |
u947883560 | p02728 | python | s819631653 | s873120618 | 1,809 | 1,596 | 141,940 | 131,636 | Accepted | Accepted | 11.77 | #!/usr/bin/env python3
import sys
from collections import defaultdict
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 1000000007 # type: int
class Graph(object):
def __init__(self, N):
self.N = N
self.E = defau... | #!/usr/bin/env python3
import sys
from collections import defaultdict
from functools import lru_cache
from collections import deque
MOD = 1000000007 # type: int
class Graph(object):
def __init__(self, N):
self.N = N
self.E = defaultdict(list)
def add_edge(self, src, dest, w=1):
... | 147 | 124 | 3,611 | 2,974 | #!/usr/bin/env python3
import sys
from collections import defaultdict
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 1000000007 # type: int
class Graph(object):
def __init__(self, N):
self.N = N
self.E = defaultdict(list)
... | #!/usr/bin/env python3
import sys
from collections import defaultdict
from functools import lru_cache
from collections import deque
MOD = 1000000007 # type: int
class Graph(object):
def __init__(self, N):
self.N = N
self.E = defaultdict(list)
def add_edge(self, src, dest, w=1):
self... | false | 15.646259 | [
"-sys.setrecursionlimit(10**8)",
"-INF = float(\"inf\")",
"- @lru_cache(maxsize=None)",
"- # print(div(3, 2))",
"- # 全方位木DPをやるぞ!",
"- # 1. 木DPによって頂点ごとにhogeを求める",
"- # 2. 木DPで求めたhogeを使って、上手く求める",
"- dp = [1] * N # 節点vを根とした部分木の塗り方dp[v]",
"- size = [0] * N # 節点vを根とした部分木のサイズsize[v... | false | 0.037246 | 0.047383 | 0.786064 | [
"s819631653",
"s873120618"
] |
u730769327 | p03470 | python | s319357177 | s621455489 | 185 | 171 | 38,512 | 38,512 | Accepted | Accepted | 7.57 | n=int(eval(input()))
a=[]
a.append(int(eval(input())))
for i in range(1,n):
dumy=int(eval(input()))
for j in range(len(a)):
if a[j]==dumy:
break
else:
a.append(dumy)
print((len(a)))
| n=int(eval(input()))
a=[]
a.append(int(eval(input())))
for i in range(1,n):
dumy=int(eval(input()))
for j in a:
if j==dumy:
break
else:
a.append(dumy)
print((len(a)))
| 13 | 13 | 201 | 186 | n = int(eval(input()))
a = []
a.append(int(eval(input())))
for i in range(1, n):
dumy = int(eval(input()))
for j in range(len(a)):
if a[j] == dumy:
break
else:
a.append(dumy)
print((len(a)))
| n = int(eval(input()))
a = []
a.append(int(eval(input())))
for i in range(1, n):
dumy = int(eval(input()))
for j in a:
if j == dumy:
break
else:
a.append(dumy)
print((len(a)))
| false | 0 | [
"- for j in range(len(a)):",
"- if a[j] == dumy:",
"+ for j in a:",
"+ if j == dumy:"
] | false | 0.04651 | 0.035342 | 1.315998 | [
"s319357177",
"s621455489"
] |
u580093517 | p03862 | python | s964765023 | s694882971 | 136 | 120 | 15,564 | 14,132 | Accepted | Accepted | 11.76 | N,x = list(map(int,input().split()))
A = list(map(int,input().split()))
eaten = 0
ans = 0
for i in range(N-1):
if A[i]+A[i+1]<=x:continue
else:
eaten = A[i] + A[i+1] -x
A[i+1] = max(0,A[i+1]-eaten)
ans += eaten
print(ans) | N,x = list(map(int,input().split()))
A = list(map(int,input().split()))
ans = 0
for i in range(1,N):
cnt = A[i-1] + A[i] - x
if cnt > 0:
A[i] = max(0,A[i]-cnt)
ans += cnt
print(ans) | 11 | 9 | 257 | 207 | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
eaten = 0
ans = 0
for i in range(N - 1):
if A[i] + A[i + 1] <= x:
continue
else:
eaten = A[i] + A[i + 1] - x
A[i + 1] = max(0, A[i + 1] - eaten)
ans += eaten
print(ans)
| N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(1, N):
cnt = A[i - 1] + A[i] - x
if cnt > 0:
A[i] = max(0, A[i] - cnt)
ans += cnt
print(ans)
| false | 18.181818 | [
"-eaten = 0",
"-for i in range(N - 1):",
"- if A[i] + A[i + 1] <= x:",
"- continue",
"- else:",
"- eaten = A[i] + A[i + 1] - x",
"- A[i + 1] = max(0, A[i + 1] - eaten)",
"- ans += eaten",
"+for i in range(1, N):",
"+ cnt = A[i - 1] + A[i] - x",
"+ if cnt >... | false | 0.046844 | 0.042664 | 1.097988 | [
"s964765023",
"s694882971"
] |
u790012205 | p03607 | python | s171929554 | s133402540 | 233 | 162 | 8,276 | 20,596 | Accepted | Accepted | 30.47 | N = int(eval(input()))
A = sorted([int(eval(input())) for i in range(N)])
c = 0
n = 1
for i in range(N - 1):
if A[i + 1] == A[i]:
n += 1
else:
if n % 2 == 1:
c += 1
n = 1
if n % 2 == 1:
c += 1
print(c) | from collections import Counter
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
C = Counter(A)
c = 0
for k, v in list(C.items()):
if v % 2 == 1:
c += 1
print(c) | 14 | 9 | 250 | 180 | N = int(eval(input()))
A = sorted([int(eval(input())) for i in range(N)])
c = 0
n = 1
for i in range(N - 1):
if A[i + 1] == A[i]:
n += 1
else:
if n % 2 == 1:
c += 1
n = 1
if n % 2 == 1:
c += 1
print(c)
| from collections import Counter
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
C = Counter(A)
c = 0
for k, v in list(C.items()):
if v % 2 == 1:
c += 1
print(c)
| false | 35.714286 | [
"+from collections import Counter",
"+",
"-A = sorted([int(eval(input())) for i in range(N)])",
"+A = [int(eval(input())) for _ in range(N)]",
"+C = Counter(A)",
"-n = 1",
"-for i in range(N - 1):",
"- if A[i + 1] == A[i]:",
"- n += 1",
"- else:",
"- if n % 2 == 1:",
"- ... | false | 0.043116 | 0.066192 | 0.651379 | [
"s171929554",
"s133402540"
] |
u225388820 | p02651 | python | s015747540 | s513907868 | 135 | 106 | 8,984 | 9,224 | Accepted | Accepted | 21.48 | # 解説AC
def solve():
n=int(eval(input()))
a=list(map(int,input().split()))
s=eval(input())
basis=[]
for i in range(n-1,-1,-1):
# 基底を求める
for e in basis:
a[i]=min(a[i],a[i]^e)
if a[i]:
if s[i]=="0":
basis.append(a[i])
... | # F_2 ^nの基底クラス
class F2n:
# LISTを受け取ってbasisを生成する.(掃き出し法)
def __init__(self,LIST):
self.basis = []
for ele in LIST:
for vec in self.basis:
ele = min(ele, vec^ele)
if ele:
self.basis.append(ele)
# basisに要素eleを追加できるなら追加しTrueを返す. ... | 21 | 34 | 431 | 860 | # 解説AC
def solve():
n = int(eval(input()))
a = list(map(int, input().split()))
s = eval(input())
basis = []
for i in range(n - 1, -1, -1):
# 基底を求める
for e in basis:
a[i] = min(a[i], a[i] ^ e)
if a[i]:
if s[i] == "0":
basis.append(a[i])
... | # F_2 ^nの基底クラス
class F2n:
# LISTを受け取ってbasisを生成する.(掃き出し法)
def __init__(self, LIST):
self.basis = []
for ele in LIST:
for vec in self.basis:
ele = min(ele, vec ^ ele)
if ele:
self.basis.append(ele)
# basisに要素eleを追加できるなら追加しTrueを返す. 追加できない... | false | 38.235294 | [
"-# 解説AC",
"+# F_2 ^nの基底クラス",
"+class F2n:",
"+ # LISTを受け取ってbasisを生成する.(掃き出し法)",
"+ def __init__(self, LIST):",
"+ self.basis = []",
"+ for ele in LIST:",
"+ for vec in self.basis:",
"+ ele = min(ele, vec ^ ele)",
"+ if ele:",
"+ ... | false | 0.088097 | 0.083366 | 1.056753 | [
"s015747540",
"s513907868"
] |
u280552586 | p02773 | python | s824653660 | s770248699 | 492 | 399 | 45,040 | 35,932 | Accepted | Accepted | 18.9 | import sys
from collections import Counter
input = sys.stdin.readline
n = int(input())
S = [input().rstrip() for _ in range(n)]
c = Counter(S).most_common()
words = []
max = c[0][1]
for i in range(len(c)):
if max == c[i][1]:
words.append(c[i][0])
words.sort()
print(*words, sep='\n')
| import sys
from collections import Counter
input = sys.stdin.readline
n = int(input())
S = [input().rstrip() for _ in range(n)]
c = Counter(S)
max = max(c.values())
words = [k for k, v in c.items() if max == v]
words.sort()
print(*words, sep='\n')
| 18 | 15 | 318 | 267 | import sys
from collections import Counter
input = sys.stdin.readline
n = int(input())
S = [input().rstrip() for _ in range(n)]
c = Counter(S).most_common()
words = []
max = c[0][1]
for i in range(len(c)):
if max == c[i][1]:
words.append(c[i][0])
words.sort()
print(*words, sep="\n")
| import sys
from collections import Counter
input = sys.stdin.readline
n = int(input())
S = [input().rstrip() for _ in range(n)]
c = Counter(S)
max = max(c.values())
words = [k for k, v in c.items() if max == v]
words.sort()
print(*words, sep="\n")
| false | 16.666667 | [
"-c = Counter(S).most_common()",
"-words = []",
"-max = c[0][1]",
"-for i in range(len(c)):",
"- if max == c[i][1]:",
"- words.append(c[i][0])",
"+c = Counter(S)",
"+max = max(c.values())",
"+words = [k for k, v in c.items() if max == v]"
] | false | 0.042705 | 0.042358 | 1.008194 | [
"s824653660",
"s770248699"
] |
u179169725 | p03078 | python | s938360496 | s243617742 | 79 | 39 | 5,972 | 5,236 | Accepted | Accepted | 50.63 | # ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では?
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
X, Y, Z, K = read_... | # ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では?
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
X, Y, Z, K = read_... | 47 | 46 | 1,142 | 1,194 | # ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では?
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
X, Y, Z, K = read_ints()
A = re... | # ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では?
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
X, Y, Z, K = read_ints()
A = re... | false | 2.12766 | [
"-from queue import PriorityQueue",
"+from heapq import heapify, heappop, heappush, heappushpop",
"-heap = PriorityQueue()",
"-heap.put((-(A[0] + B[0] + C[0]), 0, 0, 0))",
"+heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0))",
"+ans = []",
"-ans = []",
"- heap_max, i, j, k = heap.get()",
"+ heap... | false | 0.046147 | 0.056228 | 0.820703 | [
"s938360496",
"s243617742"
] |
u492910842 | p03127 | python | s783698337 | s265575325 | 660 | 101 | 91,148 | 87,944 | Accepted | Accepted | 84.7 | import functools
import fractions
N=int(eval(input()))
A=list(map(int,input().split()))
print((functools.reduce(fractions.gcd,A))) | import functools
import math
N=int(eval(input()))
A=list(map(int,input().split()))
print((functools.reduce(math.gcd,A))) | 5 | 5 | 126 | 116 | import functools
import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
print((functools.reduce(fractions.gcd, A)))
| import functools
import math
N = int(eval(input()))
A = list(map(int, input().split()))
print((functools.reduce(math.gcd, A)))
| false | 0 | [
"-import fractions",
"+import math",
"-print((functools.reduce(fractions.gcd, A)))",
"+print((functools.reduce(math.gcd, A)))"
] | false | 0.051962 | 0.040937 | 1.269315 | [
"s783698337",
"s265575325"
] |
u767664985 | p03106 | python | s629472203 | s105361991 | 38 | 17 | 5,308 | 2,940 | Accepted | Accepted | 55.26 | import fractions
A, B, K = list(map(int, input().split()))
# はじめにgcd(a, b)を求める
G = fractions.gcd(A, B)
# Gの約数がA, Bの公約数になるのでこれを列挙し、大きい順に並べてK番目を出力
i = 1
divisors = []
while i ** 2 <= G:
if G % i == 0:
divisors.append(i)
divisors.append(G // i)
i += 1
divisors = sorted(list(set(divisors)))[:: -1]
print(... | A, B, K = list(map(int, input().split()))
D = []
for i in range(A, 0, -1):
if A % i == 0 and B % i == 0:
D.append(i)
print((D[K - 1]))
| 14 | 6 | 331 | 135 | import fractions
A, B, K = list(map(int, input().split()))
# はじめにgcd(a, b)を求める
G = fractions.gcd(A, B)
# Gの約数がA, Bの公約数になるのでこれを列挙し、大きい順に並べてK番目を出力
i = 1
divisors = []
while i**2 <= G:
if G % i == 0:
divisors.append(i)
divisors.append(G // i)
i += 1
divisors = sorted(list(set(divisors)))[::-1]
pri... | A, B, K = list(map(int, input().split()))
D = []
for i in range(A, 0, -1):
if A % i == 0 and B % i == 0:
D.append(i)
print((D[K - 1]))
| false | 57.142857 | [
"-import fractions",
"-",
"-# はじめにgcd(a, b)を求める",
"-G = fractions.gcd(A, B)",
"-# Gの約数がA, Bの公約数になるのでこれを列挙し、大きい順に並べてK番目を出力",
"-i = 1",
"-divisors = []",
"-while i**2 <= G:",
"- if G % i == 0:",
"- divisors.append(i)",
"- divisors.append(G // i)",
"- i += 1",
"-divisors = s... | false | 0.058329 | 0.091484 | 0.637589 | [
"s629472203",
"s105361991"
] |
u216015528 | p02628 | python | s673135754 | s399189342 | 72 | 30 | 62,292 | 9,232 | Accepted | Accepted | 58.33 | import sys
def resolve():
readline = sys.stdin.readline
N, K = list(map(int, readline().split()))
P = [int(x) for x in readline().split()]
P = sorted(P)
print((sum(P[:K])))
resolve()
| import sys
def resolve():
readline = sys.stdin.readline
N, K = list(map(int, readline().split()))
P = sorted([int(x) for x in readline().split()])
print((sum(P[:K])))
resolve()
| 14 | 12 | 214 | 201 | import sys
def resolve():
readline = sys.stdin.readline
N, K = list(map(int, readline().split()))
P = [int(x) for x in readline().split()]
P = sorted(P)
print((sum(P[:K])))
resolve()
| import sys
def resolve():
readline = sys.stdin.readline
N, K = list(map(int, readline().split()))
P = sorted([int(x) for x in readline().split()])
print((sum(P[:K])))
resolve()
| false | 14.285714 | [
"- P = [int(x) for x in readline().split()]",
"- P = sorted(P)",
"+ P = sorted([int(x) for x in readline().split()])"
] | false | 0.035885 | 0.035078 | 1.023026 | [
"s673135754",
"s399189342"
] |
u612721349 | p03605 | python | s645246831 | s046997009 | 161 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.44 | print((input().count("9")and"Yes"or"No")) | print(("YNeos"[input().count("9")<1::2])) | 1 | 1 | 39 | 39 | print((input().count("9") and "Yes" or "No"))
| print(("YNeos"[input().count("9") < 1 :: 2]))
| false | 0 | [
"-print((input().count(\"9\") and \"Yes\" or \"No\"))",
"+print((\"YNeos\"[input().count(\"9\") < 1 :: 2]))"
] | false | 0.036648 | 0.037516 | 0.976867 | [
"s645246831",
"s046997009"
] |
u948524308 | p03044 | python | s046545411 | s375027285 | 863 | 694 | 116,004 | 51,576 | Accepted | Accepted | 19.58 |
from copy import copy
N=int(eval(input()))
G=[[] for _ in range(N)]
di=[-1]*N
for i in range(N-1):
u,v,w=list(map(int,input().split()))
G[u-1].append([v-1,w])
G[v-1].append([u-1,w])
di[0]=0
for g,w in G[0]:
di[g]=w
for i in range(1,N):
if di[i]!=-1:continue
seen=[0]*N
sta... |
from copy import copy
N=int(eval(input()))
G=[[] for _ in range(N)]
di=[-1]*N
for i in range(N-1):
u,v,w=list(map(int,input().split()))
G[u-1].append([v-1,w])
G[v-1].append([u-1,w])
di[0]=0
for i in range(1,N):
if di[i]!=-1:continue
seen=[0]*N
stack=[[0,0]]
while stack:
... | 38 | 30 | 760 | 609 | from copy import copy
N = int(eval(input()))
G = [[] for _ in range(N)]
di = [-1] * N
for i in range(N - 1):
u, v, w = list(map(int, input().split()))
G[u - 1].append([v - 1, w])
G[v - 1].append([u - 1, w])
di[0] = 0
for g, w in G[0]:
di[g] = w
for i in range(1, N):
if di[i] != -1:
continue... | from copy import copy
N = int(eval(input()))
G = [[] for _ in range(N)]
di = [-1] * N
for i in range(N - 1):
u, v, w = list(map(int, input().split()))
G[u - 1].append([v - 1, w])
G[v - 1].append([u - 1, w])
di[0] = 0
for i in range(1, N):
if di[i] != -1:
continue
seen = [0] * N
stack = ... | false | 21.052632 | [
"-for g, w in G[0]:",
"- di[g] = w",
"- stack = copy(G[0])",
"- seen[0] = 1",
"- dis = 0",
"+ stack = [[0, 0]]",
"- if y == i:",
"- di[i] = dis + d",
"- break",
"- else:",
"- for z, dist in G[y]:",
"- if seen[z] == 0:... | false | 0.041286 | 0.038922 | 1.060753 | [
"s046545411",
"s375027285"
] |
u968166680 | p03014 | python | s611043766 | s895201213 | 765 | 547 | 122,076 | 204,620 | Accepted | Accepted | 28.5 | import sys
from itertools import groupby
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def len_count(S):
H, W = len(S), len(S[0])
L = [[0] * W for _ in range(H)]
for row_S, row_L in zip(S, L):
vec = [... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
H, W = list(map(int, readline().split()))
S = [readline().strip() for _ in range(H)]
L = [[0] * W for _ in range(H)]
R = [[0] * W for ... | 85 | 62 | 1,995 | 1,449 | import sys
from itertools import groupby
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def len_count(S):
H, W = len(S), len(S[0])
L = [[0] * W for _ in range(H)]
for row_S, row_L in zip(S, L):
vec = [1]
for i... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
H, W = list(map(int, readline().split()))
S = [readline().strip() for _ in range(H)]
L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
... | false | 27.058824 | [
"-from itertools import groupby",
"-def len_count(S):",
"- H, W = len(S), len(S[0])",
"- L = [[0] * W for _ in range(H)]",
"- for row_S, row_L in zip(S, L):",
"- vec = [1]",
"- for i in range(1, W):",
"- if row_S[i - 1] == row_S[i]:",
"- vec[-1] += 1"... | false | 0.049264 | 0.093721 | 0.525642 | [
"s611043766",
"s895201213"
] |
u759412327 | p02579 | python | s084385536 | s605397455 | 1,974 | 1,793 | 23,696 | 23,456 | Accepted | Accepted | 9.17 | from collections import *
def main():
H,W = list(map(int, input().split()))
ch,cw = list(map(int, input().split()))
dh,dw = list(map(int, input().split()))
s = ["#"*(W+4)]
s.append("#"*(W+4))
for i in range(H):
s.append("##"+eval(input())+"##")
s.append("#"*(W+4))
s.a... | from collections import *
def main():
H,W = list(map(int, input().split()))
ch,cw = list(map(int, input().split()))
dh,dw = list(map(int, input().split()))
s = ["#"*(W+4)]
s.append("#"*(W+4))
for i in range(H):
s.append("##"+eval(input())+"##")
s.append("#"*(W+4))
s.a... | 53 | 47 | 1,557 | 1,461 | from collections import *
def main():
H, W = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
s = ["#" * (W + 4)]
s.append("#" * (W + 4))
for i in range(H):
s.append("##" + eval(input()) + "##")
s.append("#" * (W + 4)... | from collections import *
def main():
H, W = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
s = ["#" * (W + 4)]
s.append("#" * (W + 4))
for i in range(H):
s.append("##" + eval(input()) + "##")
s.append("#" * (W + 4)... | false | 11.320755 | [
"- [-1, 0],",
"- [0, -1],",
"- [0, 0],",
"- [0, 1],",
"- [1, 0],"
] | false | 0.036178 | 0.040665 | 0.88964 | [
"s084385536",
"s605397455"
] |
u153665391 | p02268 | python | s820654012 | s724256456 | 390 | 30 | 16,712 | 18,500 | Accepted | Accepted | 92.31 | N = int(eval(input()))
S = list(map(int, input().split()))
Q = int(eval(input()))
T = list(map(int, input().split()))
def binary_search(target_num, head, tail):
while head <= tail:
idx = int((head+tail)/2)
if target_num == S[idx]:
return True
elif target_num < S[idx]:
... | N = int(eval(input()))
S = set(input().split())
Q = int(eval(input()))
T = set(input().split())
print((len(S & T)))
| 23 | 5 | 541 | 106 | N = int(eval(input()))
S = list(map(int, input().split()))
Q = int(eval(input()))
T = list(map(int, input().split()))
def binary_search(target_num, head, tail):
while head <= tail:
idx = int((head + tail) / 2)
if target_num == S[idx]:
return True
elif target_num < S[idx]:
... | N = int(eval(input()))
S = set(input().split())
Q = int(eval(input()))
T = set(input().split())
print((len(S & T)))
| false | 78.26087 | [
"-S = list(map(int, input().split()))",
"+S = set(input().split())",
"-T = list(map(int, input().split()))",
"-",
"-",
"-def binary_search(target_num, head, tail):",
"- while head <= tail:",
"- idx = int((head + tail) / 2)",
"- if target_num == S[idx]:",
"- return True"... | false | 0.075403 | 0.049572 | 1.521098 | [
"s820654012",
"s724256456"
] |
u948524308 | p02720 | python | s073232762 | s116115529 | 152 | 131 | 12,404 | 12,404 | Accepted | Accepted | 13.82 | K=int(eval(input()))
from collections import deque
d=deque([1,2,3,4,5,6,7,8,9])
k=1
while True:
a=d.popleft()
if k==K:
print(a)
exit()
else:
k+=1
r=a%10
if r==0:
for i in [0,1]:
temp=a*10+i
d.append(temp)
elif r==9:
... | K=int(eval(input()))
from collections import deque
d=deque([1,2,3,4,5,6,7,8,9])
k=1
while True:
a=d.popleft()
if k==K:
print(a)
exit()
else:
k+=1
r=a%10
if 0<r<=9:
temp = a * 10 + (r -1)
d.append(temp)
temp=a*10+r
d.append(temp)
... | 27 | 23 | 486 | 378 | K = int(eval(input()))
from collections import deque
d = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
k = 1
while True:
a = d.popleft()
if k == K:
print(a)
exit()
else:
k += 1
r = a % 10
if r == 0:
for i in [0, 1]:
temp = a * 10 + i
d.append(temp)
e... | K = int(eval(input()))
from collections import deque
d = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
k = 1
while True:
a = d.popleft()
if k == K:
print(a)
exit()
else:
k += 1
r = a % 10
if 0 < r <= 9:
temp = a * 10 + (r - 1)
d.append(temp)
temp = a * 10 + r
d.... | false | 14.814815 | [
"- if r == 0:",
"- for i in [0, 1]:",
"- temp = a * 10 + i",
"- d.append(temp)",
"- elif r == 9:",
"- for i in [8, 9]:",
"- temp = a * 10 + i",
"- d.append(temp)",
"- else:",
"- for i in [-1, 0, 1]:",
"- temp = ... | false | 0.052335 | 0.05262 | 0.994577 | [
"s073232762",
"s116115529"
] |
u982896977 | p03161 | python | s929637512 | s303127442 | 455 | 350 | 53,472 | 52,448 | Accepted | Accepted | 23.08 | n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
dp = [10**100]*n
dp[0] = 0
for i in range(1,n):
for j in range(1,k+1):
if i-j >= 0:
dp[i] = min(dp[i-j]+abs(h[i]-h[i-j]),dp[i])
else:
break
print((dp[-1])) | n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
inf = 10**12
dp = [inf]*n
dp[0] = 0
for i in range(n):
for j in range(1,k+1):
if i+j < n:
dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
print((dp[-1])) | 11 | 10 | 273 | 249 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [10**100] * n
dp[0] = 0
for i in range(1, n):
for j in range(1, k + 1):
if i - j >= 0:
dp[i] = min(dp[i - j] + abs(h[i] - h[i - j]), dp[i])
else:
break
print((dp[-1]))
| n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
inf = 10**12
dp = [inf] * n
dp[0] = 0
for i in range(n):
for j in range(1, k + 1):
if i + j < n:
dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]))
print((dp[-1]))
| false | 9.090909 | [
"-dp = [10**100] * n",
"+inf = 10**12",
"+dp = [inf] * n",
"-for i in range(1, n):",
"+for i in range(n):",
"- if i - j >= 0:",
"- dp[i] = min(dp[i - j] + abs(h[i] - h[i - j]), dp[i])",
"- else:",
"- break",
"+ if i + j < n:",
"+ dp[i + j] = ... | false | 0.036222 | 0.036134 | 1.00243 | [
"s929637512",
"s303127442"
] |
u409371339 | p02659 | python | s231732861 | s477470935 | 27 | 22 | 10,052 | 9,096 | Accepted | Accepted | 18.52 | from decimal import Decimal
a, b = [Decimal(str(x)) for x in input().split()]
c = a * b
print((int(c))) | a, b = input().split()
a = int(a)
b = float(b)
c = a * round(b * 100) // 100
print(c) | 7 | 7 | 110 | 94 | from decimal import Decimal
a, b = [Decimal(str(x)) for x in input().split()]
c = a * b
print((int(c)))
| a, b = input().split()
a = int(a)
b = float(b)
c = a * round(b * 100) // 100
print(c)
| false | 0 | [
"-from decimal import Decimal",
"-",
"-a, b = [Decimal(str(x)) for x in input().split()]",
"-c = a * b",
"-print((int(c)))",
"+a, b = input().split()",
"+a = int(a)",
"+b = float(b)",
"+c = a * round(b * 100) // 100",
"+print(c)"
] | false | 0.048816 | 0.045164 | 1.080859 | [
"s231732861",
"s477470935"
] |
u562935282 | p02998 | python | s569889623 | s272091175 | 646 | 368 | 9,496 | 14,076 | Accepted | Accepted | 43.03 | class UnionFind:
def __init__(self, n):
self.v = [-1 for _ in range(n)]
def find(self, x):
if self.v[x] < 0: # (負)は根
return x
else:
self.v[x] = self.find(self.v[x])
return self.v[x]
def unite(self, x, y):
x = self.find(x)
... | # https://drken1215.hatenablog.com/entry/2019/06/23/004700
# https://tjkendev.github.io/procon-library/python/union_find/union_find.html
def main():
import sys
input = sys.stdin.readline
MX = 10 ** 5 + 10
*p, = [r for r in range(MX * 2)]
def root(x):
if x == p[x]:
... | 53 | 51 | 1,028 | 1,043 | class UnionFind:
def __init__(self, n):
self.v = [-1 for _ in range(n)]
def find(self, x):
if self.v[x] < 0: # (負)は根
return x
else:
self.v[x] = self.find(self.v[x])
return self.v[x]
def unite(self, x, y):
x = self.find(x)
y = sel... | # https://drken1215.hatenablog.com/entry/2019/06/23/004700
# https://tjkendev.github.io/procon-library/python/union_find/union_find.html
def main():
import sys
input = sys.stdin.readline
MX = 10**5 + 10
(*p,) = [r for r in range(MX * 2)]
def root(x):
if x == p[x]:
return x
... | false | 3.773585 | [
"-class UnionFind:",
"- def __init__(self, n):",
"- self.v = [-1 for _ in range(n)]",
"+# https://drken1215.hatenablog.com/entry/2019/06/23/004700",
"+# https://tjkendev.github.io/procon-library/python/union_find/union_find.html",
"+def main():",
"+ import sys",
"- def find(self, x):",... | false | 0.155697 | 0.121251 | 1.284092 | [
"s569889623",
"s272091175"
] |
u467736898 | p02816 | python | s563991980 | s938214551 | 912 | 374 | 79,016 | 66,844 | Accepted | Accepted | 58.99 | def z_algo(S):
# Z-algoirhm O(n)
# Z[i] := S と S[i:] で prefix が何文字一致しているか
# 検証: https://atcoder.jp/contests/arc055/submissions/14179788
i, j, n = 1, 0, len(S)
Z = [0] * n
Z[0] = n
while i < n:
while i+j < n and S[j] == S[i+j]:
j += 1
if j == 0:
... | import os
import sys
import numpy as np
def z_algo(S):
# Z-algoirhm O(n)
# Z[i] := S と S[i:] で prefix が何文字一致しているか
# 検証: https://atcoder.jp/contests/arc055/submissions/14179788
i, j, n = 1, 0, len(S)
Z = np.zeros_like(S)
Z[0] = n
while i < n:
while i+j < n and S[j] == S[... | 54 | 76 | 1,245 | 2,019 | def z_algo(S):
# Z-algoirhm O(n)
# Z[i] := S と S[i:] で prefix が何文字一致しているか
# 検証: https://atcoder.jp/contests/arc055/submissions/14179788
i, j, n = 1, 0, len(S)
Z = [0] * n
Z[0] = n
while i < n:
while i + j < n and S[j] == S[i + j]:
j += 1
if j == 0:
i ... | import os
import sys
import numpy as np
def z_algo(S):
# Z-algoirhm O(n)
# Z[i] := S と S[i:] で prefix が何文字一致しているか
# 検証: https://atcoder.jp/contests/arc055/submissions/14179788
i, j, n = 1, 0, len(S)
Z = np.zeros_like(S)
Z[0] = n
while i < n:
while i + j < n and S[j] == S[i + j]:
... | false | 28.947368 | [
"+import os",
"+import sys",
"+import numpy as np",
"+",
"+",
"- Z = [0] * n",
"+ Z = np.zeros_like(S)",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-A_diff = []",
"-a2 = A[-1]",
"-for a in A:",
"- A_diff.append(a ^ a... | false | 0.035938 | 0.202867 | 0.177151 | [
"s563991980",
"s938214551"
] |
u905203728 | p02726 | python | s958715652 | s136113664 | 548 | 341 | 50,468 | 77,236 | Accepted | Accepted | 37.77 | from collections import deque
def BFS(s):
color=["white" for _ in range(n+1)]
D=[0 for _ in range(n+1)]
D[s]=0
color[s]="gray"
queue=deque([s])
while len(queue)>0:
u=queue.popleft()
for i in M[u]:
if color[i]=="white":
D[i]=D[u]+1
... | from collections import deque
inf=10**9
def BFS(num):
color=["white" for _ in range(n+1)]
D=[inf for _ in range(n+1)]
queue=deque([num])
color[num]="gray"
D[num]=0
while len(queue)>0:
u=queue.popleft()
for i in M[u]:
if color[i]=="white" and D[u]+1<... | 38 | 39 | 701 | 760 | from collections import deque
def BFS(s):
color = ["white" for _ in range(n + 1)]
D = [0 for _ in range(n + 1)]
D[s] = 0
color[s] = "gray"
queue = deque([s])
while len(queue) > 0:
u = queue.popleft()
for i in M[u]:
if color[i] == "white":
D[i] = D[u]... | from collections import deque
inf = 10**9
def BFS(num):
color = ["white" for _ in range(n + 1)]
D = [inf for _ in range(n + 1)]
queue = deque([num])
color[num] = "gray"
D[num] = 0
while len(queue) > 0:
u = queue.popleft()
for i in M[u]:
if color[i] == "white" and D... | false | 2.564103 | [
"+inf = 10**9",
"-def BFS(s):",
"+",
"+def BFS(num):",
"- D = [0 for _ in range(n + 1)]",
"- D[s] = 0",
"- color[s] = \"gray\"",
"- queue = deque([s])",
"+ D = [inf for _ in range(n + 1)]",
"+ queue = deque([num])",
"+ color[num] = \"gray\"",
"+ D[num] = 0",
"- ... | false | 0.078016 | 0.079034 | 0.987115 | [
"s958715652",
"s136113664"
] |
u050428930 | p03607 | python | s402165825 | s234349494 | 228 | 209 | 16,268 | 16,268 | Accepted | Accepted | 8.33 | N=int(eval(input()))
s=[int(eval(input())) for i in range(N)]
d,ans={},0
for j in s:
d[j]=d.get(j,0)+1
d=list(d.values())
for k in range(len(d)):
if d[k]%2==1:
ans+=1
print(ans) | N=int(eval(input()))
s=[int(eval(input())) for i in range(N)]
d,ans={},0
for j in s:
d[j]=d.get(j,0)+1
d=list(d.values())
for k in d:
if k%2==1:
ans+=1
print(ans) | 10 | 10 | 193 | 178 | N = int(eval(input()))
s = [int(eval(input())) for i in range(N)]
d, ans = {}, 0
for j in s:
d[j] = d.get(j, 0) + 1
d = list(d.values())
for k in range(len(d)):
if d[k] % 2 == 1:
ans += 1
print(ans)
| N = int(eval(input()))
s = [int(eval(input())) for i in range(N)]
d, ans = {}, 0
for j in s:
d[j] = d.get(j, 0) + 1
d = list(d.values())
for k in d:
if k % 2 == 1:
ans += 1
print(ans)
| false | 0 | [
"-for k in range(len(d)):",
"- if d[k] % 2 == 1:",
"+for k in d:",
"+ if k % 2 == 1:"
] | false | 0.095901 | 0.069407 | 1.381725 | [
"s402165825",
"s234349494"
] |
u146803137 | p02790 | python | s844160864 | s301470140 | 65 | 25 | 61,568 | 8,988 | Accepted | Accepted | 61.54 | a,b = input().split()
if a > b:
tmp = a
a = b
b = tmp
for i in range(int(b)):
print(a,end='')
| a,b = map(int,input().split())
if a < b:
for i in range(b):
print(a,end = '')
else:
for i in range(a):
print(b,end = '')
| 7 | 7 | 116 | 151 | a, b = input().split()
if a > b:
tmp = a
a = b
b = tmp
for i in range(int(b)):
print(a, end="")
| a, b = map(int, input().split())
if a < b:
for i in range(b):
print(a, end="")
else:
for i in range(a):
print(b, end="")
| false | 0 | [
"-a, b = input().split()",
"-if a > b:",
"- tmp = a",
"- a = b",
"- b = tmp",
"-for i in range(int(b)):",
"- print(a, end=\"\")",
"+a, b = map(int, input().split())",
"+if a < b:",
"+ for i in range(b):",
"+ print(a, end=\"\")",
"+else:",
"+ for i in range(a):",
"+... | false | 0.039344 | 0.080319 | 0.489852 | [
"s844160864",
"s301470140"
] |
u191874006 | p03060 | python | s371132621 | s872789912 | 1,712 | 176 | 21,916 | 38,384 | Accepted | Accepted | 89.72 | #!/usr/bin/env python3
#B
import numpy as np
import math
import re
n = int(eval(input()))
x = eval(input())
y = eval(input())
x = re.split(" ",x)
y = re.split(" ",y)
sum = 0
for i in range(n):
if(( int(x[i]) - int(y[i]) )> 0):
sum += int(x[i]) - int(y[i])
print(sum)
| #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 17 | 28 | 280 | 709 | #!/usr/bin/env python3
# B
import numpy as np
import math
import re
n = int(eval(input()))
x = eval(input())
y = eval(input())
x = re.split(" ", x)
y = re.split(" ", y)
sum = 0
for i in range(n):
if (int(x[i]) - int(y[i])) > 0:
sum += int(x[i]) - int(y[i])
print(sum)
| #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 39.285714 | [
"-# B",
"-import numpy as np",
"+import sys",
"-import re",
"+from bisect import bisect_right as br",
"+from bisect import bisect_left as bl",
"-n = int(eval(input()))",
"-x = eval(input())",
"-y = eval(input())",
"-x = re.split(\" \", x)",
"-y = re.split(\" \", y)",
"-sum = 0",
"+sys.setrec... | false | 0.052803 | 0.046906 | 1.125717 | [
"s371132621",
"s872789912"
] |
u269391636 | p01300 | python | s048123244 | s520700970 | 3,730 | 3,440 | 37,200 | 37,200 | Accepted | Accepted | 7.77 | while(True):
s = eval(input())
m = len(s)
if s == "0":
quit()
dp = [[0 for j in range(11)] for i in range(m)]
for i in range(m):
n = int(s[i])
if n == 0:
tmp = dp[i-1][1:]
tmp.reverse()
dp[i] = [dp[i-1][0]]+tmp
else:
... | #教室内の位置は右*中央
#問題は「Eleven Lover」(http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2182&lang=jp)
#本当は問題「Planning Rolling Blackouts」(http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1176&lang=jp)
#を解こうとしたのですが、小区間での分割をひたすら統合する解法までは立ったものの実装力がなかったので一旦やめました
while(True):
#今回はinputの数字を文字列として一桁ずつ扱った方が嬉しい... | 23 | 38 | 551 | 1,299 | while True:
s = eval(input())
m = len(s)
if s == "0":
quit()
dp = [[0 for j in range(11)] for i in range(m)]
for i in range(m):
n = int(s[i])
if n == 0:
tmp = dp[i - 1][1:]
tmp.reverse()
dp[i] = [dp[i - 1][0]] + tmp
else:
... | # 教室内の位置は右*中央
# 問題は「Eleven Lover」(http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2182&lang=jp)
# 本当は問題「Planning Rolling Blackouts」(http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1176&lang=jp)
# を解こうとしたのですが、小区間での分割をひたすら統合する解法までは立ったものの実装力がなかったので一旦やめました
while True:
# 今回はinputの数字を文字列として一桁ずつ扱った方が嬉しいの... | false | 39.473684 | [
"+# 教室内の位置は右*中央",
"+# 問題は「Eleven Lover」(http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2182&lang=jp)",
"+# 本当は問題「Planning Rolling Blackouts」(http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1176&lang=jp)",
"+# を解こうとしたのですが、小区間での分割をひたすら統合する解法までは立ったものの実装力がなかったので一旦やめました",
"+ # 今回はinputの数字を文... | false | 0.043552 | 0.036646 | 1.188453 | [
"s048123244",
"s520700970"
] |
u476604182 | p02721 | python | s156920641 | s819925770 | 252 | 228 | 35,592 | 24,944 | Accepted | Accepted | 9.52 | N, K, C = list(map(int, input().split()))
S = eval(input())
p = -C-1
L = []
R = []
for i in range(N):
if i>p+C and S[i]=='o':
L.append(i)
p = i
p = N+C
for i in range(N-1,-1,-1):
if p>C+i and S[i]=='o':
R.append(i)
p = i
R = R[::-1]
if len(L)>K or len(R)>K:
exit()
ans = []
for a,... | N,K,C = list(map(int, input().split()))
S = eval(input())
dp0 = [0]*K
dp1 = [0]*K
step = C
cnt = 0
for i in range(N):
if step>=C and S[i]=='o':
dp0[cnt] = i
cnt += 1
if cnt==K:
break
step = 0
else:
step += 1
step = C
cnt = K-1
for i in range(N-1,-1,-1):
if step>=C and S... | 22 | 30 | 383 | 495 | N, K, C = list(map(int, input().split()))
S = eval(input())
p = -C - 1
L = []
R = []
for i in range(N):
if i > p + C and S[i] == "o":
L.append(i)
p = i
p = N + C
for i in range(N - 1, -1, -1):
if p > C + i and S[i] == "o":
R.append(i)
p = i
R = R[::-1]
if len(L) > K or len(R) > K... | N, K, C = list(map(int, input().split()))
S = eval(input())
dp0 = [0] * K
dp1 = [0] * K
step = C
cnt = 0
for i in range(N):
if step >= C and S[i] == "o":
dp0[cnt] = i
cnt += 1
if cnt == K:
break
step = 0
else:
step += 1
step = C
cnt = K - 1
for i in range(N - ... | false | 26.666667 | [
"-p = -C - 1",
"-L = []",
"-R = []",
"+dp0 = [0] * K",
"+dp1 = [0] * K",
"+step = C",
"+cnt = 0",
"- if i > p + C and S[i] == \"o\":",
"- L.append(i)",
"- p = i",
"-p = N + C",
"+ if step >= C and S[i] == \"o\":",
"+ dp0[cnt] = i",
"+ cnt += 1",
"+ ... | false | 0.036558 | 0.032317 | 1.13124 | [
"s156920641",
"s819925770"
] |
u077291787 | p02936 | python | s858169173 | s994824372 | 1,634 | 1,402 | 265,792 | 251,184 | Accepted | Accepted | 14.2 | # ABC138D - Ki
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
def dfs(v: int, p: int) -> None:
x = cnt[v]
for u in T[v]:
if u != p: # p: parent -> skip
cnt[u] += x # cumulative sum
dfs(u, v)
def main():
# Ai (A[i][0]) may be not a ... | # ABC138D - Ki
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
def dfs(v: int, p: int) -> None:
x = cnt[v]
for u in T[v]:
if u != p:
cnt[u] += x # cumulative sum
dfs(u, v)
def main():
# Ai (A[i][0]) may be not a parent of Bi (A[i][1]... | 34 | 32 | 885 | 741 | # ABC138D - Ki
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def dfs(v: int, p: int) -> None:
x = cnt[v]
for u in T[v]:
if u != p: # p: parent -> skip
cnt[u] += x # cumulative sum
dfs(u, v)
def main():
# Ai (A[i][0]) may be not a parent of Bi (A[i]... | # ABC138D - Ki
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def dfs(v: int, p: int) -> None:
x = cnt[v]
for u in T[v]:
if u != p:
cnt[u] += x # cumulative sum
dfs(u, v)
def main():
# Ai (A[i][0]) may be not a parent of Bi (A[i][1])
global T, cn... | false | 5.882353 | [
"-sys.setrecursionlimit(10**9)",
"+sys.setrecursionlimit(10**6)",
"- if u != p: # p: parent -> skip",
"+ if u != p:",
"- N, Q = tuple(map(int, input().rstrip().split())) # vertices and queues",
"- E = tuple(tuple(map(int, input().rstrip().split())) for _ in range(N - 1))",
"- P ... | false | 0.043222 | 0.04301 | 1.004944 | [
"s858169173",
"s994824372"
] |
u077291787 | p03457 | python | s643361994 | s132717299 | 199 | 184 | 17,440 | 17,440 | Accepted | Accepted | 7.54 | # ABC086C - Traveling (ARC089C)
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
for t, x, y in A:
if x + y > t or (t + x + y) % 2 != 0:
print("No")
break
else:
... | # ABC086C - Traveling (ARC089C)
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().split())) for _ in range(n))
for t, x, y in A:
if x + y > t or (t + x + y) % 2 != 0:
print("No")
break
else:
prin... | 17 | 17 | 375 | 366 | # ABC086C - Traveling (ARC089C)
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
for t, x, y in A:
if x + y > t or (t + x + y) % 2 != 0:
print("No")
break
else:
print... | # ABC086C - Traveling (ARC089C)
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = tuple(tuple(map(int, input().split())) for _ in range(n))
for t, x, y in A:
if x + y > t or (t + x + y) % 2 != 0:
print("No")
break
else:
print("Yes")
... | false | 0 | [
"- A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))",
"+ A = tuple(tuple(map(int, input().split())) for _ in range(n))"
] | false | 0.041713 | 0.107091 | 0.389512 | [
"s643361994",
"s132717299"
] |
u358254559 | p02948 | python | s029455599 | s434883419 | 1,000 | 743 | 72,152 | 67,292 | Accepted | Accepted | 25.7 | n,m= list(map(int, input().split()))
ab_list=[]
for _ in range(n):
a, b = list(map(int, input().split()))
ab_list.append([a,b])
ab_list.sort()
import heapq
l = []
heapq.heapify(l)
ind=0
ans=0
for i in range(1,m+1):
while n>ind and ab_list[ind][0] <= i:
heapq.heappush(l,-ab_list[ind]... | import sys
input=sys.stdin.readline
n,m= list(map(int, input().split()))
ab_list=[]
for _ in range(n):
a, b = list(map(int, input().split()))
ab_list.append([a,b])
ab_list.sort()
import heapq
l = []
heapq.heapify(l)
ind=0
ans=0
for i in range(1,m+1):
while n>ind and ab_list[ind][0] <= i:... | 22 | 25 | 409 | 449 | n, m = list(map(int, input().split()))
ab_list = []
for _ in range(n):
a, b = list(map(int, input().split()))
ab_list.append([a, b])
ab_list.sort()
import heapq
l = []
heapq.heapify(l)
ind = 0
ans = 0
for i in range(1, m + 1):
while n > ind and ab_list[ind][0] <= i:
heapq.heappush(l, -ab_list[ind][... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
ab_list = []
for _ in range(n):
a, b = list(map(int, input().split()))
ab_list.append([a, b])
ab_list.sort()
import heapq
l = []
heapq.heapify(l)
ind = 0
ans = 0
for i in range(1, m + 1):
while n > ind and ab_list[ind][0] <= i:
... | false | 12 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.038114 | 0.037609 | 1.013428 | [
"s029455599",
"s434883419"
] |
u046187684 | p03326 | python | s566306741 | s696738074 | 162 | 33 | 12,588 | 3,916 | Accepted | Accepted | 79.63 | from itertools import product
import numpy as np
def solve(string):
n, m, *xyz = list(map(int, string.split()))
xyz = [[x, y, z] for x, y, z in zip(xyz[::3], xyz[1::3], xyz[2::3])]
xyz = np.asarray(xyz)
ans = 0
for i, j, k in product([-1, 1], repeat=3):
tmp = xyz.copy()
... | from functools import partial
from itertools import islice
def take(n, iterable):
return list(islice(iterable, n))
def chunked(iterable, n):
return iter(partial(take, n, iter(iterable)), [])
def solve(s):
n, m, *xyz = list(map(int, s.split()))
ans = 0
for sign_x in [1, -1]:
... | 23 | 28 | 683 | 759 | from itertools import product
import numpy as np
def solve(string):
n, m, *xyz = list(map(int, string.split()))
xyz = [[x, y, z] for x, y, z in zip(xyz[::3], xyz[1::3], xyz[2::3])]
xyz = np.asarray(xyz)
ans = 0
for i, j, k in product([-1, 1], repeat=3):
tmp = xyz.copy()
tmp[:, 0] =... | from functools import partial
from itertools import islice
def take(n, iterable):
return list(islice(iterable, n))
def chunked(iterable, n):
return iter(partial(take, n, iter(iterable)), [])
def solve(s):
n, m, *xyz = list(map(int, s.split()))
ans = 0
for sign_x in [1, -1]:
for sign_y ... | false | 17.857143 | [
"-from itertools import product",
"-import numpy as np",
"+from functools import partial",
"+from itertools import islice",
"-def solve(string):",
"- n, m, *xyz = list(map(int, string.split()))",
"- xyz = [[x, y, z] for x, y, z in zip(xyz[::3], xyz[1::3], xyz[2::3])]",
"- xyz = np.asarray(xyz... | false | 0.592069 | 0.04288 | 13.807517 | [
"s566306741",
"s696738074"
] |
u934119021 | p02608 | python | s693178480 | s557171014 | 511 | 441 | 9,096 | 9,136 | Accepted | Accepted | 13.7 | n = int(eval(input()))
ans = [0] * 10050
for i in range(1,105):
for j in range(1,105):
for k in range(1,105):
v = i*i+j*j+k*k+i*j+j*k+k*i
if v<10050:
ans[v]+=1
for i in range(n):
print((ans[i+1])) | n = int(eval(input()))
ans = [0] * 10050
for i in range(1,101):
for j in range(1,101):
for k in range(1,101):
v = i*i+j*j+k*k+i*j+j*k+k*i
if v<10050:
ans[v]+=1
for i in range(n):
print((ans[i+1])) | 10 | 10 | 225 | 225 | n = int(eval(input()))
ans = [0] * 10050
for i in range(1, 105):
for j in range(1, 105):
for k in range(1, 105):
v = i * i + j * j + k * k + i * j + j * k + k * i
if v < 10050:
ans[v] += 1
for i in range(n):
print((ans[i + 1]))
| n = int(eval(input()))
ans = [0] * 10050
for i in range(1, 101):
for j in range(1, 101):
for k in range(1, 101):
v = i * i + j * j + k * k + i * j + j * k + k * i
if v < 10050:
ans[v] += 1
for i in range(n):
print((ans[i + 1]))
| false | 0 | [
"-for i in range(1, 105):",
"- for j in range(1, 105):",
"- for k in range(1, 105):",
"+for i in range(1, 101):",
"+ for j in range(1, 101):",
"+ for k in range(1, 101):"
] | false | 1.441694 | 1.363859 | 1.05707 | [
"s693178480",
"s557171014"
] |
u131984977 | p02390 | python | s290622755 | s119113078 | 40 | 30 | 6,724 | 6,724 | Accepted | Accepted | 25 | S = int(eval(input()))
h = S // 3600
m = S // 60 % 60
s = S % 60
#print(str(h) + ':' + str(m) + ':' + str(s))
print(('{0}:{1}:{2}'.format(h,m,s))) | S = int(input())
h = S // 3600
m = S % 3600 // 60
s = S % 60
print(h,m,s, sep=':')
| 8 | 5 | 147 | 86 | S = int(eval(input()))
h = S // 3600
m = S // 60 % 60
s = S % 60
# print(str(h) + ':' + str(m) + ':' + str(s))
print(("{0}:{1}:{2}".format(h, m, s)))
| S = int(input())
h = S // 3600
m = S % 3600 // 60
s = S % 60
print(h, m, s, sep=":")
| false | 37.5 | [
"-S = int(eval(input()))",
"+S = int(input())",
"-m = S // 60 % 60",
"+m = S % 3600 // 60",
"-# print(str(h) + ':' + str(m) + ':' + str(s))",
"-print((\"{0}:{1}:{2}\".format(h, m, s)))",
"+print(h, m, s, sep=\":\")"
] | false | 0.048651 | 0.047731 | 1.019271 | [
"s290622755",
"s119113078"
] |
u815659544 | p03013 | python | s174006519 | s101930700 | 114 | 75 | 6,964 | 7,764 | Accepted | Accepted | 34.21 | import sys
INPUT = sys.stdin.readline
def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return list(map(int, INPUT().split()))
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()
MOD = 10 ** 9 + 7
N, ... | import sys
INPUT = sys.stdin.readline
MOD = 10 ** 9 + 7
def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return list(map(int, INPUT().split()))
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()
def s... | 37 | 50 | 766 | 1,110 | import sys
INPUT = sys.stdin.readline
def SINGLE_INT():
return int(INPUT())
def MULTIPLE_INT_LIST():
return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP():
return list(map(int, INPUT().split()))
def SINGLE_STRING():
return INPUT()
def MULTIPLE_STRING():
return INPUT().split()
MO... | import sys
INPUT = sys.stdin.readline
MOD = 10**9 + 7
def SINGLE_INT():
return int(INPUT())
def MULTIPLE_INT_LIST():
return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP():
return list(map(int, INPUT().split()))
def SINGLE_STRING():
return INPUT()
def MULTIPLE_STRING():
return INPU... | false | 26 | [
"+MOD = 10**9 + 7",
"-MOD = 10**9 + 7",
"+def solve(n, m):",
"+ floors = [0] * (n + 1)",
"+ floors[0] = 1",
"+ floors[1] = 1",
"+ last, current = 0, 0",
"+ for i in range(m):",
"+ if i == 0:",
"+ current = SINGLE_INT()",
"+ floors[current] = -1",
"+ ... | false | 0.035174 | 0.05845 | 0.601774 | [
"s174006519",
"s101930700"
] |
u816587940 | p02586 | python | s872461120 | s799897366 | 1,040 | 732 | 428,792 | 461,624 | Accepted | Accepted | 29.62 | import sys
input=sys.stdin.readline
class list2D:
def __init__(self, H, W, num):
self.__H = H
self.__W = W
self.__dat = [num] * (H * W)
def __getitem__(self, a):
return self.__dat[a[0]*self.__W+a[1]]
def __setitem__(self, a, b):
self.__dat[a[0]*self.__... | import sys
inp = [int(x) for x in sys.stdin.read().split()]
ii = 0
r, c, k = inp[ii:ii+3]
ii += 3
v=[0] * (c * r)
for _ in range(k):
ri,ci,a = inp[ii:ii+3]
ii += 3
v[(ri-1)*c + (ci-1)]=a
dp= [0] * (c * r * 4)
x = c * r
if v[0]>0: dp[x] = v[0]
for i in range(r):
for j in range(c):
... | 71 | 38 | 1,820 | 895 | import sys
input = sys.stdin.readline
class list2D:
def __init__(self, H, W, num):
self.__H = H
self.__W = W
self.__dat = [num] * (H * W)
def __getitem__(self, a):
return self.__dat[a[0] * self.__W + a[1]]
def __setitem__(self, a, b):
self.__dat[a[0] * self.__W +... | import sys
inp = [int(x) for x in sys.stdin.read().split()]
ii = 0
r, c, k = inp[ii : ii + 3]
ii += 3
v = [0] * (c * r)
for _ in range(k):
ri, ci, a = inp[ii : ii + 3]
ii += 3
v[(ri - 1) * c + (ci - 1)] = a
dp = [0] * (c * r * 4)
x = c * r
if v[0] > 0:
dp[x] = v[0]
for i in range(r):
for j in range... | false | 46.478873 | [
"-input = sys.stdin.readline",
"-",
"-",
"-class list2D:",
"- def __init__(self, H, W, num):",
"- self.__H = H",
"- self.__W = W",
"- self.__dat = [num] * (H * W)",
"-",
"- def __getitem__(self, a):",
"- return self.__dat[a[0] * self.__W + a[1]]",
"-",
"- ... | false | 0.043938 | 0.043222 | 1.016577 | [
"s872461120",
"s799897366"
] |
u729133443 | p02741 | python | s945615178 | s182551652 | 167 | 18 | 38,256 | 2,940 | Accepted | Accepted | 89.22 | print((ord(' 3 '[int(eval(input()))%14]))) | print((b' 3 '[int(eval(input()))%14])) | 1 | 1 | 45 | 41 | print((ord(" 3 "[int(eval(input())) % 14])))
| print((b" 3 "[int(eval(input())) % 14]))
| false | 0 | [
"-print((ord(\"\u0004\u0001\u000e 3\u0001\u0002 \u0005 \u000f \u0005\"[int(eval(input())) % 14])))",
"+print((b\"\u0004\u0001\u000e 3\u0001\u0002 \u0005 \u000f \u0005\"[int(eval(input())) % 14]))"
] | false | 0.040453 | 0.039392 | 1.026945 | [
"s945615178",
"s182551652"
] |
u325227960 | p03142 | python | s589521268 | s538518990 | 477 | 438 | 77,788 | 77,676 | Accepted | Accepted | 8.18 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
C = [list(map(int,input().split())) for i in range(n-1+m)]
r = -1
R = [1] * (n+1)
for i in range(len(C)):
R[C[i][1]] = 0
for i in range(1, n+1):
if R[i] == 1:
r = i
# print(r)
F = [0] * (n+1)
P = [0] * (n+1)
... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
C = [list(map(int,input().split())) for i in range(n-1+m)]
r = -1
R = [1] * (n+1)
for i in range(len(C)):
R[C[i][1]] = 0
for i in range(1, n+1):
if R[i] == 1:
r = i
# print(r)
IN = [0] * (n+1)
P = [0] * (n+1)
... | 39 | 43 | 673 | 749 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
C = [list(map(int, input().split())) for i in range(n - 1 + m)]
r = -1
R = [1] * (n + 1)
for i in range(len(C)):
R[C[i][1]] = 0
for i in range(1, n + 1):
if R[i] == 1:
r = i
# print(r)
F = [0] * (n + 1)
P = [0] * (n + 1)
M = [... | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
C = [list(map(int, input().split())) for i in range(n - 1 + m)]
r = -1
R = [1] * (n + 1)
for i in range(len(C)):
R[C[i][1]] = 0
for i in range(1, n + 1):
if R[i] == 1:
r = i
# print(r)
IN = [0] * (n + 1)
P = [0] * (n + 1)
M = ... | false | 9.302326 | [
"-F = [0] * (n + 1)",
"+IN = [0] * (n + 1)",
"- F[C[i][1]] += 1",
"-# 1始まりの場合",
"-Q = [r]",
"+ IN[C[i][1]] += 1",
"+# INはその頂点を指している辺の本数のリスト",
"+S = []",
"-# V[r] = 1",
"-while s < len(Q):",
"- i = Q[s]",
"- for x in M[i]:",
"- F[x] -= 1",
"- if F[x] == 0:",
"- ... | false | 0.105107 | 0.047624 | 2.207038 | [
"s589521268",
"s538518990"
] |
u707498674 | p03835 | python | s333653096 | s017414181 | 1,555 | 1,222 | 3,060 | 41,112 | Accepted | Accepted | 21.41 | K, S = list(map(int, input().split()))
count = 0
for X in range(K + 1):
for Y in range(K + 1):
Z = S - X - Y
if 0 <= Z and Z <= K:
count += 1
print(count) | def main():
K, S = list(map(int, input().split()))
ans = sum([1 for X in range(K+1) for Y in range(K+1) if S-X-Y>=0 and S-X-Y<=K])
print(ans)
if __name__ == "__main__":
main() | 8 | 6 | 188 | 190 | K, S = list(map(int, input().split()))
count = 0
for X in range(K + 1):
for Y in range(K + 1):
Z = S - X - Y
if 0 <= Z and Z <= K:
count += 1
print(count)
| def main():
K, S = list(map(int, input().split()))
ans = sum(
[
1
for X in range(K + 1)
for Y in range(K + 1)
if S - X - Y >= 0 and S - X - Y <= K
]
)
print(ans)
if __name__ == "__main__":
main()
| false | 25 | [
"-K, S = list(map(int, input().split()))",
"-count = 0",
"-for X in range(K + 1):",
"- for Y in range(K + 1):",
"- Z = S - X - Y",
"- if 0 <= Z and Z <= K:",
"- count += 1",
"-print(count)",
"+def main():",
"+ K, S = list(map(int, input().split()))",
"+ ans = su... | false | 0.127872 | 0.137777 | 0.928107 | [
"s333653096",
"s017414181"
] |
u989345508 | p03632 | python | s277455700 | s327229884 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | x=[int(_) for _ in input().split()]
if x[1]<=x[2] or x[3]<=x[0]:
print((0))
else:
print((min([x[1],x[3]])-max([x[0],x[2]])))
| a,b,c,d=list(map(int,input().split()))
if b<c:
print((0))
elif d<a:
print((0))
else:
print((min(b,d)-max(a,c)))
| 5 | 7 | 133 | 118 | x = [int(_) for _ in input().split()]
if x[1] <= x[2] or x[3] <= x[0]:
print((0))
else:
print((min([x[1], x[3]]) - max([x[0], x[2]])))
| a, b, c, d = list(map(int, input().split()))
if b < c:
print((0))
elif d < a:
print((0))
else:
print((min(b, d) - max(a, c)))
| false | 28.571429 | [
"-x = [int(_) for _ in input().split()]",
"-if x[1] <= x[2] or x[3] <= x[0]:",
"+a, b, c, d = list(map(int, input().split()))",
"+if b < c:",
"+ print((0))",
"+elif d < a:",
"- print((min([x[1], x[3]]) - max([x[0], x[2]])))",
"+ print((min(b, d) - max(a, c)))"
] | false | 0.041187 | 0.040081 | 1.027615 | [
"s277455700",
"s327229884"
] |
u119148115 | p02601 | python | s845522278 | s099823592 | 89 | 70 | 61,828 | 61,872 | Accepted | Accepted | 21.35 | 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())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
A,B,C = MI()
K = I()
a = 0 # 魔術を行った回数
while B <= A:
B *= 2
a += 1
while C <= B:
C *= 2
a += 1
print(('Yes' if a <= K else 'No'))
| 26 | 16 | 655 | 288 | 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())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
A, B, C = MI()
K = I()
a = 0 # 魔術を行った回数
while B <= A:
B *= 2
a += 1
while C <= B:
C *= 2
a += 1
print(("Yes" if a <= K else "No"))
| false | 38.461538 | [
"-",
"-sys.setrecursionlimit(10**7)",
"-def LI():",
"- return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり",
"-",
"-",
"-def LI2():",
"- return list(map(int, sys.stdin.readline().rstrip())) # 空白なし",
"-",
"-",
"-def S():",
"- return sys.stdin.readline().rstrip()",
"... | false | 0.072078 | 0.034505 | 2.088938 | [
"s845522278",
"s099823592"
] |
u186838327 | p03437 | python | s797772730 | s744734219 | 164 | 62 | 38,384 | 61,520 | Accepted | Accepted | 62.2 | x, y = list(map(int, input().split()))
if x%y != 0:
print(x)
else:
print((-1)) | x, y = list(map(int, input().split()))
if x%y == 0:
print((-1))
else:
print(x)
| 5 | 5 | 78 | 83 | x, y = list(map(int, input().split()))
if x % y != 0:
print(x)
else:
print((-1))
| x, y = list(map(int, input().split()))
if x % y == 0:
print((-1))
else:
print(x)
| false | 0 | [
"-if x % y != 0:",
"+if x % y == 0:",
"+ print((-1))",
"+else:",
"-else:",
"- print((-1))"
] | false | 0.035376 | 0.077526 | 0.456315 | [
"s797772730",
"s744734219"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.