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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u017810624 | p02875 | python | s085010683 | s914029377 | 2,506 | 2,311 | 193,148 | 191,100 | Accepted | Accepted | 7.78 | n=int(eval(input()));l=[0,1];a=0;b=c=1;p=998244353
for i in range(2,n):
l+=[l[p%i]*(p-int(p/i))%p]
for i in range(n,n//2,-1):
a+=b*c%p;b=2*b%p;c=c*i*l[n+1-i]%p
print(((pow(3,n,p)-2*a+p)%p)) | n=int(eval(input()));l=[0,1];a=0;b=c=1;p=998244353
for i in range(2,n):
l+=[l[p%i]*(p-int(p/i))%p]
for i in range(n,n//2,-1):
a+=b*c%p;b=2*b%p;c=c*i*l[n+1-i]%p
print(((pow(3,n,p)-2*a)%p)) | 6 | 6 | 188 | 186 | n = int(eval(input()))
l = [0, 1]
a = 0
b = c = 1
p = 998244353
for i in range(2, n):
l += [l[p % i] * (p - int(p / i)) % p]
for i in range(n, n // 2, -1):
a += b * c % p
b = 2 * b % p
c = c * i * l[n + 1 - i] % p
print(((pow(3, n, p) - 2 * a + p) % p))
| n = int(eval(input()))
l = [0, 1]
a = 0
b = c = 1
p = 998244353
for i in range(2, n):
l += [l[p % i] * (p - int(p / i)) % p]
for i in range(n, n // 2, -1):
a += b * c % p
b = 2 * b % p
c = c * i * l[n + 1 - i] % p
print(((pow(3, n, p) - 2 * a) % p))
| false | 0 | [
"-print(((pow(3, n, p) - 2 * a + p) % p))",
"+print(((pow(3, n, p) - 2 * a) % p))"
] | false | 0.361123 | 0.545188 | 0.662382 | [
"s085010683",
"s914029377"
] |
u540631540 | p02695 | python | s025898668 | s363765445 | 1,558 | 1,018 | 12,700 | 12,696 | Accepted | Accepted | 34.66 | n, m, q = list(map(int, input().split()))
l = []
for i in range(q):
l1, l2, l3, l4 = list(map(int, input().split()))
l.append([l1, l2, l3, l4])
B = []
for a in range(1, m + 1):
for b in range(a, m + 1):
for c in range(b, m + 1):
for d in range(c, m + 1):
for e i... | def main():
n, m, q = list(map(int, input().split()))
l = []
for i in range(q):
l1, l2, l3, l4 = list(map(int, input().split()))
l.append([l1, l2, l3, l4])
B = []
for a in range(1, m + 1):
for b in range(a, m + 1):
for c in range(b, m + 1):
... | 26 | 29 | 1,174 | 1,305 | n, m, q = list(map(int, input().split()))
l = []
for i in range(q):
l1, l2, l3, l4 = list(map(int, input().split()))
l.append([l1, l2, l3, l4])
B = []
for a in range(1, m + 1):
for b in range(a, m + 1):
for c in range(b, m + 1):
for d in range(c, m + 1):
for e in range(d,... | def main():
n, m, q = list(map(int, input().split()))
l = []
for i in range(q):
l1, l2, l3, l4 = list(map(int, input().split()))
l.append([l1, l2, l3, l4])
B = []
for a in range(1, m + 1):
for b in range(a, m + 1):
for c in range(b, m + 1):
for d i... | false | 10.344828 | [
"-n, m, q = list(map(int, input().split()))",
"-l = []",
"-for i in range(q):",
"- l1, l2, l3, l4 = list(map(int, input().split()))",
"- l.append([l1, l2, l3, l4])",
"-B = []",
"-for a in range(1, m + 1):",
"- for b in range(a, m + 1):",
"- for c in range(b, m + 1):",
"- ... | false | 0.132361 | 0.07468 | 1.772378 | [
"s025898668",
"s363765445"
] |
u528899139 | p03194 | python | s935701948 | s026336830 | 30 | 24 | 3,064 | 3,064 | Accepted | Accepted | 20 | # -*- coding: utf-8 -*-
from sys import stdin
n,x = [int(i) for i in stdin.readline().split()]
limit = int(x ** (1.0/n)) + 1
def factorize(x):
ans = 1
p = 2
if x % p == 0:
count = 1
x /= p
while x % p == 0:
count += 1
x /= p
if cou... | # -*- coding: utf-8 -*-
from sys import stdin
n,x = [int(i) for i in stdin.readline().split()]
limit = int(x ** (1.0/n)) + 1
def devide_counter(x, p):
count = 1
x = x // p
while x % p == 0:
count += 1
x = x // p
return x, count
def factorize(x):
an... | 40 | 40 | 797 | 823 | # -*- coding: utf-8 -*-
from sys import stdin
n, x = [int(i) for i in stdin.readline().split()]
limit = int(x ** (1.0 / n)) + 1
def factorize(x):
ans = 1
p = 2
if x % p == 0:
count = 1
x /= p
while x % p == 0:
count += 1
x /= p
if count >= n:
... | # -*- coding: utf-8 -*-
from sys import stdin
n, x = [int(i) for i in stdin.readline().split()]
limit = int(x ** (1.0 / n)) + 1
def devide_counter(x, p):
count = 1
x = x // p
while x % p == 0:
count += 1
x = x // p
return x, count
def factorize(x):
ans = 1
p = 2
if x % p... | false | 0 | [
"+def devide_counter(x, p):",
"+ count = 1",
"+ x = x // p",
"+ while x % p == 0:",
"+ count += 1",
"+ x = x // p",
"+ return x, count",
"+",
"+",
"- count = 1",
"- x /= p",
"- while x % p == 0:",
"- count += 1",
"- x /= ... | false | 0.046274 | 0.046342 | 0.998535 | [
"s935701948",
"s026336830"
] |
u872271866 | p02713 | python | s686560157 | s434529636 | 1,623 | 1,422 | 9,100 | 9,104 | Accepted | Accepted | 12.38 | from math import gcd
def main():
ans = 0
k = int(eval(input()))
for i in range(k):
for j in range(k):
for l in range(k):
ans += gcd(i+1,gcd(j+1,l+1))
print(ans)
if __name__ == "__main__":
main() | from math import gcd
def main():
ans = 0
k = int(eval(input()))
for i in range(1,1+k):
for j in range(1,1+k):
for l in range(1,1+k):
ans += gcd(i,gcd(j,l))
print(ans)
if __name__ == "__main__":
main() | 13 | 13 | 258 | 264 | from math import gcd
def main():
ans = 0
k = int(eval(input()))
for i in range(k):
for j in range(k):
for l in range(k):
ans += gcd(i + 1, gcd(j + 1, l + 1))
print(ans)
if __name__ == "__main__":
main()
| from math import gcd
def main():
ans = 0
k = int(eval(input()))
for i in range(1, 1 + k):
for j in range(1, 1 + k):
for l in range(1, 1 + k):
ans += gcd(i, gcd(j, l))
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"- for i in range(k):",
"- for j in range(k):",
"- for l in range(k):",
"- ans += gcd(i + 1, gcd(j + 1, l + 1))",
"+ for i in range(1, 1 + k):",
"+ for j in range(1, 1 + k):",
"+ for l in range(1, 1 + k):",
"+ ans += gcd(i, gcd(j,... | false | 0.186097 | 0.043006 | 4.327215 | [
"s686560157",
"s434529636"
] |
u588341295 | p04045 | python | s711470071 | s176376815 | 118 | 108 | 3,192 | 3,064 | Accepted | Accepted | 8.47 | # -*- coding: utf-8 -*-
N,K = list(map(int, input().split()))
Dk = list(map(str, input().split()))
for i in range(N, 100000):
i = str(i)
for j in range(K):
if i.find(Dk[j]) != -1:
break
if j == K-1:
print(i)
exit() | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 13 | 33 | 282 | 879 | # -*- coding: utf-8 -*-
N, K = list(map(int, input().split()))
Dk = list(map(str, input().split()))
for i in range(N, 100000):
i = str(i)
for j in range(K):
if i.find(Dk[j]) != -1:
break
if j == K - 1:
print(i)
exit()
| # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 60.606061 | [
"-N, K = list(map(int, input().split()))",
"-Dk = list(map(str, input().split()))",
"-for i in range(N, 100000):",
"- i = str(i)",
"- for j in range(K):",
"- if i.find(Dk[j]) != -1:",
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",... | false | 0.040651 | 0.092983 | 0.437188 | [
"s711470071",
"s176376815"
] |
u968166680 | p03044 | python | s301686520 | s298249663 | 845 | 394 | 164,600 | 58,808 | Accepted | Accepted | 53.37 | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N = int(readline())
G = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = map(int, readline().s... | import sys
from heapq import heappush, heappop
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *UVW = map(int, read().split())
G = [[] for _ in range(N)]
for u, v, w in zip(*[ite... | 37 | 41 | 765 | 900 | import sys
from collections import deque
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N = int(readline())
G = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = map(int, readline().split())
... | import sys
from heapq import heappush, heappop
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *UVW = map(int, read().split())
G = [[] for _ in range(N)]
for u, v, w in zip(*[iter(UVW)] * 3):
... | false | 9.756098 | [
"-from collections import deque",
"+from heapq import heappush, heappop",
"+MOD = 1000000007",
"- N = int(readline())",
"+ N, *UVW = map(int, read().split())",
"- for _ in range(N - 1):",
"- u, v, w = map(int, readline().split())",
"+ for u, v, w in zip(*[iter(UVW)] * 3):",
"- ... | false | 0.08097 | 0.039427 | 2.05367 | [
"s301686520",
"s298249663"
] |
u745087332 | p03745 | python | s887192039 | s317566132 | 75 | 56 | 14,252 | 14,168 | Accepted | Accepted | 25.33 | # coding:utf-8
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
ans = 1
prev = A[0]
state = 0 # 1: 増加, 0: 横ばい, -1: 減少
for i in range(1, N):
if state == 0:
if A[i] > prev:
state = 1
elif A[i] < prev:
state = -1
... | # coding:utf-8
import sys
# from collections import Counter, defaultdict
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return ... | 32 | 42 | 517 | 907 | # coding:utf-8
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
ans = 1
prev = A[0]
state = 0 # 1: 増加, 0: 横ばい, -1: 減少
for i in range(1, N):
if state == 0:
if A[i] > prev:
state = 1
elif A[i] < prev:
state = -1
elif state == 1:
... | # coding:utf-8
import sys
# from collections import Counter, defaultdict
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
def II():
... | false | 23.809524 | [
"-def inpl():",
"- return list(map(int, input().split()))",
"+import sys",
"+",
"+# from collections import Counter, defaultdict",
"+INF = float(\"inf\")",
"+MOD = 10**9 + 7",
"-N = int(eval(input()))",
"-A = inpl()",
"-ans = 1",
"-prev = A[0]",
"-state = 0 # 1: 増加, 0: 横ばい, -1: 減少",
"-fo... | false | 0.035286 | 0.058362 | 0.604607 | [
"s887192039",
"s317566132"
] |
u548545174 | p03556 | python | s746545545 | s722897948 | 55 | 27 | 4,360 | 2,940 | Accepted | Accepted | 50.91 | N = int(eval(input()))
sq = [i ** 2 for i in range(10 ** 5) if i ** 2 <= N]
print((sq[-1])) | N = int(eval(input()))
for i in range(10 ** 5):
if i ** 2 <= N:
continue
else:
print(((i - 1) ** 2))
break | 3 | 7 | 85 | 136 | N = int(eval(input()))
sq = [i**2 for i in range(10**5) if i ** 2 <= N]
print((sq[-1]))
| N = int(eval(input()))
for i in range(10**5):
if i**2 <= N:
continue
else:
print(((i - 1) ** 2))
break
| false | 57.142857 | [
"-sq = [i**2 for i in range(10**5) if i ** 2 <= N]",
"-print((sq[-1]))",
"+for i in range(10**5):",
"+ if i**2 <= N:",
"+ continue",
"+ else:",
"+ print(((i - 1) ** 2))",
"+ break"
] | false | 0.077203 | 0.073177 | 1.055017 | [
"s746545545",
"s722897948"
] |
u983918956 | p03212 | python | s851536690 | s133191940 | 293 | 139 | 31,148 | 14,996 | Accepted | Accepted | 52.56 | N = eval(input())
def rec(list1,list2,initial,time):
for e in list1:
for b in [0,1,2,3]:
if b == 0:
e_copy = e
list2.append(e_copy)
elif b == 1:
e_copy = e + "3"
list2.append(e_copy)
elif b == 2:
... | N = eval(input())
def rec(list1,initial,time):
empty = []
for e in list1:
for b in [0,1,2]:
if b == 0:
e_copy = e + "3"
empty.append(e_copy)
elif b == 1:
e_copy = e + "5"
empty.append(e_copy)
e... | 34 | 33 | 911 | 865 | N = eval(input())
def rec(list1, list2, initial, time):
for e in list1:
for b in [0, 1, 2, 3]:
if b == 0:
e_copy = e
list2.append(e_copy)
elif b == 1:
e_copy = e + "3"
list2.append(e_copy)
elif b == 2:
... | N = eval(input())
def rec(list1, initial, time):
empty = []
for e in list1:
for b in [0, 1, 2]:
if b == 0:
e_copy = e + "3"
empty.append(e_copy)
elif b == 1:
e_copy = e + "5"
empty.append(e_copy)
elif b... | false | 2.941176 | [
"-def rec(list1, list2, initial, time):",
"+def rec(list1, initial, time):",
"+ empty = []",
"- for b in [0, 1, 2, 3]:",
"+ for b in [0, 1, 2]:",
"- e_copy = e",
"- list2.append(e_copy)",
"+ e_copy = e + \"3\"",
"+ empty.ap... | false | 0.037042 | 0.038644 | 0.958541 | [
"s851536690",
"s133191940"
] |
u525065967 | p02570 | python | s260858284 | s196466963 | 33 | 30 | 9,084 | 9,164 | Accepted | Accepted | 9.09 | d, t, s = list(map(int, input().split()))
# s*t = d'
if s*t >= d: print('Yes')
else:print('No')
| d, t, s = list(map(int, input().split()))
print(('No' if s*t < d else 'Yes'))
| 6 | 2 | 97 | 71 | d, t, s = list(map(int, input().split()))
# s*t = d'
if s * t >= d:
print("Yes")
else:
print("No")
| d, t, s = list(map(int, input().split()))
print(("No" if s * t < d else "Yes"))
| false | 66.666667 | [
"-# s*t = d'",
"-if s * t >= d:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+print((\"No\" if s * t < d else \"Yes\"))"
] | false | 0.051279 | 0.047081 | 1.089167 | [
"s260858284",
"s196466963"
] |
u792720861 | p03126 | python | s537643609 | s425383645 | 30 | 27 | 9,092 | 9,120 | Accepted | Accepted | 10 | n, m = list(map(int, input().split()))
S = set(range(1, m+1))
for i in range(n):
k, *a = list(map(int, input().split()))
S &= set(a)
print((len(S)))
| n, m = list(map(int, input().split()))
s = set(range(1, m+1))
for i in range(n):
k, *a = list(map(int, input().split()))
s &= set(a)
print((len(s)))
| 8 | 8 | 152 | 152 | n, m = list(map(int, input().split()))
S = set(range(1, m + 1))
for i in range(n):
k, *a = list(map(int, input().split()))
S &= set(a)
print((len(S)))
| n, m = list(map(int, input().split()))
s = set(range(1, m + 1))
for i in range(n):
k, *a = list(map(int, input().split()))
s &= set(a)
print((len(s)))
| false | 0 | [
"-S = set(range(1, m + 1))",
"+s = set(range(1, m + 1))",
"- S &= set(a)",
"-print((len(S)))",
"+ s &= set(a)",
"+print((len(s)))"
] | false | 0.035328 | 0.0885 | 0.399189 | [
"s537643609",
"s425383645"
] |
u775681539 | p02803 | python | s453401421 | s816787681 | 393 | 353 | 3,316 | 3,440 | Accepted | Accepted | 10.18 | #python3
from collections import deque
INF = int(1e9)
dd = [(-1, 0), (1, 0), (0, 1), (0, -1)]
def main():
h, w = list(map(int, input().split()))
maze = [eval(input()) for _ in range(h)]
ans = -1
for i in range(h):
for j in range(w):
if maze[i][j] == '#':
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
INF = 100000
dir = ((1, 0), (-1, 0), (0, 1), (0, -1))
def main():
H, W = list(map(int, readline().split()))
maze = []
for _ in range(H):
s = ... | 40 | 52 | 1,204 | 1,471 | # python3
from collections import deque
INF = int(1e9)
dd = [(-1, 0), (1, 0), (0, 1), (0, -1)]
def main():
h, w = list(map(int, input().split()))
maze = [eval(input()) for _ in range(h)]
ans = -1
for i in range(h):
for j in range(w):
if maze[i][j] == "#":
continue
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
INF = 100000
dir = ((1, 0), (-1, 0), (0, 1), (0, -1))
def main():
H, W = list(map(int, readline().split()))
maze = []
for _ in range(H):
s = readline(... | false | 23.076923 | [
"-# python3",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"-INF = int(1e9)",
"-dd = [(-1, 0), (1, 0), (0, 1), (0, -1)]",
"+INF = 100000",
"+dir = ((1, 0), (-1, 0), (0, 1), (0, -1))",
"- h, w = list(ma... | false | 0.043238 | 0.05738 | 0.753536 | [
"s453401421",
"s816787681"
] |
u094191970 | p02675 | python | s155726468 | s680335951 | 24 | 21 | 9,184 | 9,040 | Accepted | Accepted | 12.5 | n=list(eval(input()))
if int(n[-1]) in [2,4,5,7,9]:
print('hon')
if int(n[-1]) in [0,1,6,8]:
print('pon')
if int(n[-1])==3:
print('bon') | n=input()[-1]
if n=='3':
print('bon')
elif n in '0168':
print('pon')
else:
print('hon') | 7 | 7 | 142 | 99 | n = list(eval(input()))
if int(n[-1]) in [2, 4, 5, 7, 9]:
print("hon")
if int(n[-1]) in [0, 1, 6, 8]:
print("pon")
if int(n[-1]) == 3:
print("bon")
| n = input()[-1]
if n == "3":
print("bon")
elif n in "0168":
print("pon")
else:
print("hon")
| false | 0 | [
"-n = list(eval(input()))",
"-if int(n[-1]) in [2, 4, 5, 7, 9]:",
"+n = input()[-1]",
"+if n == \"3\":",
"+ print(\"bon\")",
"+elif n in \"0168\":",
"+ print(\"pon\")",
"+else:",
"-if int(n[-1]) in [0, 1, 6, 8]:",
"- print(\"pon\")",
"-if int(n[-1]) == 3:",
"- print(\"bon\")"
] | false | 0.150408 | 0.114416 | 1.314573 | [
"s155726468",
"s680335951"
] |
u303039933 | p02691 | python | s384476461 | s622148786 | 311 | 197 | 81,296 | 137,532 | Accepted | Accepted | 36.66 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner():
... | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
import decimal
class Scanner():
@stati... | 120 | 139 | 2,525 | 2,963 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner:
@staticmethod
d... | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
import decimal
class Scanner:
@staticmethod
def int(... | false | 13.669065 | [
"-from decimal import *",
"+import decimal",
"+ @staticmethod",
"+ def fact(N):",
"+ res = {}",
"+ tmp = N",
"+ for i in range(2, int(N**0.5 + 1) + 1):",
"+ cnt = 0",
"+ while tmp % i == 0:",
"+ cnt += 1",
"+ tmp //= ... | false | 0.047839 | 0.041101 | 1.163922 | [
"s384476461",
"s622148786"
] |
u697559326 | p03163 | python | s429324875 | s763914203 | 1,466 | 441 | 7,668 | 118,512 | Accepted | Accepted | 69.92 | """memo
numpyでやるときは配列を一気に更新するが(numpy使いたくないのでやらない),
このやり方は後ろの方から更新することで後の更新に影響を与えない(考え方すごい).
(参考#9889377)
"""
import sys
input = sys.stdin.readline
def main():
#1:初期化
N,W = list(map(int,input().split()))
dp = [0]*(W+1)
#2:初期値(元からゼロなので記述無し)
#3:dp実行部(貰うDP)
for i in ... |
import sys
input = sys.stdin.readline
def main():
#1:初期化
N,W = list(map(int,input().split()))
wv = []
for _ in range(N):
wv.append(list(map(int,input().split())))
dp = [[0]*(W+1) for i in range(N+1)]
#print(dp)
#print(dp2)
#2:初期値(元からゼロなので記述無し)
#3:dp実行部(貰... | 30 | 32 | 594 | 713 | """memo
numpyでやるときは配列を一気に更新するが(numpy使いたくないのでやらない),
このやり方は後ろの方から更新することで後の更新に影響を与えない(考え方すごい).
(参考#9889377)
"""
import sys
input = sys.stdin.readline
def main():
# 1:初期化
N, W = list(map(int, input().split()))
dp = [0] * (W + 1)
# 2:初期値(元からゼロなので記述無し)
# 3:dp実行部(貰うDP)
for i in range(N):... | import sys
input = sys.stdin.readline
def main():
# 1:初期化
N, W = list(map(int, input().split()))
wv = []
for _ in range(N):
wv.append(list(map(int, input().split())))
dp = [[0] * (W + 1) for i in range(N + 1)]
# print(dp)
# print(dp2)
# 2:初期値(元からゼロなので記述無し)
# 3:dp実行部(貰うDP)
... | false | 6.25 | [
"-\"\"\"memo",
"- numpyでやるときは配列を一気に更新するが(numpy使いたくないのでやらない),",
"- このやり方は後ろの方から更新することで後の更新に影響を与えない(考え方すごい).",
"- (参考#9889377)",
"-\"\"\"",
"- dp = [0] * (W + 1)",
"+ wv = []",
"+ for _ in range(N):",
"+ wv.append(list(map(int, input().split())))",
"+ dp = [[0] * (W + 1) ... | false | 0.042726 | 0.039569 | 1.0798 | [
"s429324875",
"s763914203"
] |
u936985471 | p02788 | python | s747977301 | s102496790 | 1,259 | 906 | 66,456 | 66,456 | Accepted | Accepted | 28.04 | N,D,A=list(map(int,input().split()))
D*=2 # 爆発の長さ
X=[None]*N
for i in range(N):
X[i]=list(map(int,input().split()))
X=sorted(X,key=lambda x:x[0])
# lastX=X[-1][0] # 最後のモンスターの場所
damage=0 # 現在の爆発が与えられるダメージ
from collections import deque
bombs=deque() # 爆弾が切れるタイミング
# [位置、効力]
ans=0
for i in range(len(X)):
... | import sys
readline=sys.stdin.readline
N,D,A=list(map(int,readline().split()))
D*=2 # 爆発の長さ
X=[None]*N
for i in range(N):
X[i]=list(map(int,readline().split()))
X=sorted(X,key=lambda x:x[0])
# lastX=X[-1][0] # 最後のモンスターの場所
damage=0 # 現在の爆発が与えられるダメージ
from collections import deque
bombs=deque() # 爆弾が切れるタイ... | 31 | 34 | 620 | 670 | N, D, A = list(map(int, input().split()))
D *= 2 # 爆発の長さ
X = [None] * N
for i in range(N):
X[i] = list(map(int, input().split()))
X = sorted(X, key=lambda x: x[0])
# lastX=X[-1][0] # 最後のモンスターの場所
damage = 0 # 現在の爆発が与えられるダメージ
from collections import deque
bombs = deque() # 爆弾が切れるタイミング
# [位置、効力]
ans = 0
for i in r... | import sys
readline = sys.stdin.readline
N, D, A = list(map(int, readline().split()))
D *= 2 # 爆発の長さ
X = [None] * N
for i in range(N):
X[i] = list(map(int, readline().split()))
X = sorted(X, key=lambda x: x[0])
# lastX=X[-1][0] # 最後のモンスターの場所
damage = 0 # 現在の爆発が与えられるダメージ
from collections import deque
bombs = deq... | false | 8.823529 | [
"-N, D, A = list(map(int, input().split()))",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N, D, A = list(map(int, readline().split()))",
"- X[i] = list(map(int, input().split()))",
"+ X[i] = list(map(int, readline().split()))"
] | false | 0.043287 | 0.128452 | 0.336988 | [
"s747977301",
"s102496790"
] |
u197968862 | p03162 | python | s777479137 | s878771429 | 691 | 284 | 74,840 | 100,476 | Accepted | Accepted | 58.9 | n = int(eval(input()))
abc = [list(map(int,input().split())) for _ in range(n)]
dp = [[0 for _ in range(3)] for _ in range(n+1)]
for i in range(1,n+1):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i][k] = max(dp[i][k],dp[i-1][j] + abc[i-1][... | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n)]
dp = [[0]*3 for _ in range(n+1)]
for i in range(n):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i+1][j] = max(abc[i][j]+dp[i][k], dp[i+1][j])
dp[... | 14 | 14 | 350 | 381 | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n)]
dp = [[0 for _ in range(3)] for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i][k] = max(dp[i][k], dp[i - 1][j] + abc[i - 1][k... | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n + 1)]
for i in range(n):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i + 1][j] = max(abc[i][j] + dp[i][k], dp[i + 1][j])
dp[i +... | false | 0 | [
"-dp = [[0 for _ in range(3)] for _ in range(n + 1)]",
"-for i in range(1, n + 1):",
"+dp = [[0] * 3 for _ in range(n + 1)]",
"+for i in range(n):",
"- dp[i][k] = max(dp[i][k], dp[i - 1][j] + abc[i - 1][k])",
"-ans = max(dp[-1])",
"-print(ans)",
"+ dp[i + 1][j] = max(abc[i][j] + ... | false | 0.036309 | 0.056811 | 0.639113 | [
"s777479137",
"s878771429"
] |
u867848444 | p03160 | python | s667337726 | s807465011 | 167 | 141 | 13,980 | 13,928 | Accepted | Accepted | 15.57 | n=int(eval(input()))
h=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0#初期条件を設定
for i in range(1,n):
dp[i]=min(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
#i=1の時i-2<0となるので先にここを計算する
if i>=2:
dp[i]=min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1])) | #DP-A
n=int(eval(input()))
h=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
for i in range(1,n):
#2パターンの遷移を考え小さいほうを保存する
dp[i]=dp[i-1]+abs(h[i]-h[i-1])
if i>1:
dp[i]=min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1])) | 13 | 14 | 280 | 256 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0 # 初期条件を設定
for i in range(1, n):
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
# i=1の時i-2<0となるので先にここを計算する
if i >= 2:
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| # DP-A
n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
# 2パターンの遷移を考え小さいほうを保存する
dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])
if i > 1:
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| false | 7.142857 | [
"+# DP-A",
"-dp[0] = 0 # 初期条件を設定",
"+dp[0] = 0",
"- dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))",
"- # i=1の時i-2<0となるので先にここを計算する",
"- if i >= 2:",
"+ # 2パターンの遷移を考え小さいほうを保存する",
"+ dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])",
"+ if i > 1:"
] | false | 0.037168 | 0.162509 | 0.228711 | [
"s667337726",
"s807465011"
] |
u620480037 | p03031 | python | s223695502 | s038352525 | 219 | 92 | 43,888 | 74,292 | Accepted | Accepted | 57.99 | N,M=list(map(int,input().split()))
S=[0 for i in range(N)]
A=[]
for x in range(M):
s=list(map(int,input().split()))
X=[]
for y in range(1,s[0]+1):
X.append(s[y])
A.append(X)
P=list(map(int,input().split()))
#print(A)
ANS=0
for i in range(2**N):
n=i
for j in range(N):
... | N,M=list(map(int,input().split()))
L=[]
for i in range(M):
m=list(map(int,input().split()))
L.append(m[1:])
#print(L)
S=list(map(int,input().split()))
ans=0
for i in range(2**N):
sw=[0 for i in range(M)]
I=i+0
for j in range(N):
if I&1==True:
for k in range... | 37 | 30 | 679 | 539 | N, M = list(map(int, input().split()))
S = [0 for i in range(N)]
A = []
for x in range(M):
s = list(map(int, input().split()))
X = []
for y in range(1, s[0] + 1):
X.append(s[y])
A.append(X)
P = list(map(int, input().split()))
# print(A)
ANS = 0
for i in range(2**N):
n = i
for j in range(... | N, M = list(map(int, input().split()))
L = []
for i in range(M):
m = list(map(int, input().split()))
L.append(m[1:])
# print(L)
S = list(map(int, input().split()))
ans = 0
for i in range(2**N):
sw = [0 for i in range(M)]
I = i + 0
for j in range(N):
if I & 1 == True:
for k in ran... | false | 18.918919 | [
"-S = [0 for i in range(N)]",
"-A = []",
"-for x in range(M):",
"- s = list(map(int, input().split()))",
"- X = []",
"- for y in range(1, s[0] + 1):",
"- X.append(s[y])",
"- A.append(X)",
"-P = list(map(int, input().split()))",
"-# print(A)",
"-ANS = 0",
"+L = []",
"+for i... | false | 0.05371 | 0.083803 | 0.640905 | [
"s223695502",
"s038352525"
] |
u047655753 | p02862 | python | s544875176 | s096454393 | 548 | 269 | 55,832 | 29,464 | Accepted | Accepted | 50.91 | mod = int(1e9 + 7)
def powmod(a, b):
ans = 1
while(b):
if(b&1): ans = ans*a%mod
a = a*a%mod
b >>= 1
return ans
x, y = list(map(int,input().split()))
if(2*x < y or 2*y < x or (2*x-y)%3 or (2*y-x)%3): print((0))
else:
x, y = (2*x-y)//3, (2*y-x)//3
#print(x,y)
f... | mod = int(1e9 + 7)
x, y = list(map(int,input().split()))
if(2*x < y or 2*y < x or (2*x-y)%3 or (2*y-x)%3): print((0))
else:
x, y = (2*x-y)//3, (2*y-x)//3
#print(x,y)
fac = [0 for i in range(x+y+1)]
fac[0] = 1
for i in range(1,x+y+1):
fac[i] = fac[i-1]*i%mod
ans = fac[x+y]*pow(f... | 23 | 12 | 622 | 370 | mod = int(1e9 + 7)
def powmod(a, b):
ans = 1
while b:
if b & 1:
ans = ans * a % mod
a = a * a % mod
b >>= 1
return ans
x, y = list(map(int, input().split()))
if 2 * x < y or 2 * y < x or (2 * x - y) % 3 or (2 * y - x) % 3:
print((0))
else:
x, y = (2 * x - y) /... | mod = int(1e9 + 7)
x, y = list(map(int, input().split()))
if 2 * x < y or 2 * y < x or (2 * x - y) % 3 or (2 * y - x) % 3:
print((0))
else:
x, y = (2 * x - y) // 3, (2 * y - x) // 3
# print(x,y)
fac = [0 for i in range(x + y + 1)]
fac[0] = 1
for i in range(1, x + y + 1):
fac[i] = fac[i -... | false | 47.826087 | [
"-",
"-",
"-def powmod(a, b):",
"- ans = 1",
"- while b:",
"- if b & 1:",
"- ans = ans * a % mod",
"- a = a * a % mod",
"- b >>= 1",
"- return ans",
"-",
"-",
"- inv = [0 for i in range(x + y + 1)]",
"- inv[x + y] = powmod(fac[x + y], mod - 2)... | false | 0.538853 | 0.338453 | 1.592105 | [
"s544875176",
"s096454393"
] |
u703950586 | p02863 | python | s577074221 | s398247914 | 601 | 510 | 123,992 | 113,624 | Accepted | Accepted | 15.14 | N,T = list(map(int,input().split()))
A = [[0,0] for _ in range(N+1)]
for i in range(1,N+1):
a,b = list(map(int,input().split()))
A[i][0] = a
A[i][1] = b
A.sort()
dp = [[0 for _ in range(T+1)] for _ in range(N+1)]
for i in range(1,N+1):
for j in range(T,0,-1):
if j < T:
... | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N,T = LI()
A = [LI() for _ in range(N)]
A.... | 20 | 29 | 557 | 773 | N, T = list(map(int, input().split()))
A = [[0, 0] for _ in range(N + 1)]
for i in range(1, N + 1):
a, b = list(map(int, input().split()))
A[i][0] = a
A[i][1] = b
A.sort()
dp = [[0 for _ in range(T + 1)] for _ in range(N + 1)]
for i in range(1, N + 1):
for j in range(T, 0, -1):
if j < T:
... | import sys, queue, math, copy, itertools, bisect, collections, heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())
N, T = LI()
A = [LI() for _ in range(N)]
A.sort(... | false | 31.034483 | [
"-N, T = list(map(int, input().split()))",
"-A = [[0, 0] for _ in range(N + 1)]",
"-for i in range(1, N + 1):",
"- a, b = list(map(int, input().split()))",
"- A[i][0] = a",
"- A[i][1] = b",
"-A.sort()",
"-dp = [[0 for _ in range(T + 1)] for _ in range(N + 1)]",
"-for i in range(1, N + 1):",... | false | 0.036749 | 0.056066 | 0.655461 | [
"s577074221",
"s398247914"
] |
u445404615 | p02819 | python | s999005666 | s203531566 | 286 | 30 | 2,940 | 2,940 | Accepted | Accepted | 89.51 | x = int(eval(input()))
for i in range(x,10**5+100):
flg = 'so'
for j in range(2,x):
if i % j == 0:
flg = 'no'
if flg == 'so':
print(i)
exit() | x = int(eval(input()))
for i in range(x,10**5+100):
flg = 'so'
for j in range(2,x):
if i % j == 0:
flg = 'no'
break
if flg == 'so':
print(i)
exit() | 12 | 13 | 208 | 227 | x = int(eval(input()))
for i in range(x, 10**5 + 100):
flg = "so"
for j in range(2, x):
if i % j == 0:
flg = "no"
if flg == "so":
print(i)
exit()
| x = int(eval(input()))
for i in range(x, 10**5 + 100):
flg = "so"
for j in range(2, x):
if i % j == 0:
flg = "no"
break
if flg == "so":
print(i)
exit()
| false | 7.692308 | [
"+ break"
] | false | 0.071294 | 0.038302 | 1.861362 | [
"s999005666",
"s203531566"
] |
u017810624 | p03722 | python | s095103529 | s593434886 | 348 | 319 | 46,168 | 42,972 | Accepted | Accepted | 8.33 | n,m=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(m)]
distance=[float('inf')]*n
distance[0]=0
for i in range(n-1):
for j in range(m):
if distance[l[j][1]-1]>distance[l[j][0]-1]-l[j][2]:
distance[l[j][1]-1]=distance[l[j][0]-1]-l[j][2]
x=distance[n-1]
for i in range(... | (n,m),*l=[list(map(int,s.split()))for s in open(0)];d=[0]*2+[9e99]*n
for i in range(n*2):
for a,b,c in l:
if d[b]>d[a]-c:d[b]=[d[a]-c,-9e99][i>n]
if i==n:x=d[n]
print(([-x,'inf'][d[n]!=x])) | 17 | 6 | 507 | 196 | n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
distance = [float("inf")] * n
distance[0] = 0
for i in range(n - 1):
for j in range(m):
if distance[l[j][1] - 1] > distance[l[j][0] - 1] - l[j][2]:
distance[l[j][1] - 1] = distance[l[j][0] - 1] - l[j][... | (n, m), *l = [list(map(int, s.split())) for s in open(0)]
d = [0] * 2 + [9e99] * n
for i in range(n * 2):
for a, b, c in l:
if d[b] > d[a] - c:
d[b] = [d[a] - c, -9e99][i > n]
if i == n:
x = d[n]
print(([-x, "inf"][d[n] != x]))
| false | 64.705882 | [
"-n, m = list(map(int, input().split()))",
"-l = [list(map(int, input().split())) for i in range(m)]",
"-distance = [float(\"inf\")] * n",
"-distance[0] = 0",
"-for i in range(n - 1):",
"- for j in range(m):",
"- if distance[l[j][1] - 1] > distance[l[j][0] - 1] - l[j][2]:",
"- dis... | false | 0.124587 | 0.069538 | 1.791649 | [
"s095103529",
"s593434886"
] |
u141574039 | p03161 | python | s396929321 | s401475213 | 416 | 363 | 52,448 | 52,448 | Accepted | Accepted | 12.74 | N,K=list(map(int,input().split()))
H=list(map(int,input().split()))
DP=[0]*(N)
DP[0]=0
DP[1]=abs(H[1]-H[0])
for i in range(2,N):
DP[i]=min([abs(H[i]-H[k])+DP[k] for k in range(max(i-K,0),i)])
print((DP[N-1])) | N,K=list(map(int,input().split()))
H=list(map(int,input().split()))
cost =10**10
DP=[0]*(N+10)
DP[0]=0
DP[1]=abs(H[1]-H[0])
for i in range(2,N):
cost=10**10
for k in range(max(i-K,0),i):
cost=min(cost,(abs(H[i]-H[k])+DP[k]))
DP[i]=cost
print((DP[N-1])) | 8 | 12 | 209 | 265 | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
DP = [0] * (N)
DP[0] = 0
DP[1] = abs(H[1] - H[0])
for i in range(2, N):
DP[i] = min([abs(H[i] - H[k]) + DP[k] for k in range(max(i - K, 0), i)])
print((DP[N - 1]))
| N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
cost = 10**10
DP = [0] * (N + 10)
DP[0] = 0
DP[1] = abs(H[1] - H[0])
for i in range(2, N):
cost = 10**10
for k in range(max(i - K, 0), i):
cost = min(cost, (abs(H[i] - H[k]) + DP[k]))
DP[i] = cost
print((DP[N - 1]))
| false | 33.333333 | [
"-DP = [0] * (N)",
"+cost = 10**10",
"+DP = [0] * (N + 10)",
"- DP[i] = min([abs(H[i] - H[k]) + DP[k] for k in range(max(i - K, 0), i)])",
"+ cost = 10**10",
"+ for k in range(max(i - K, 0), i):",
"+ cost = min(cost, (abs(H[i] - H[k]) + DP[k]))",
"+ DP[i] = cost"
] | false | 0.007991 | 0.035893 | 0.222624 | [
"s396929321",
"s401475213"
] |
u477977638 | p02730 | python | s926411182 | s726703280 | 183 | 27 | 38,384 | 8,984 | Accepted | Accepted | 85.25 | import sys
input = sys.stdin.readline
#input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
def RD(): return sys.stdin.read()
def II(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().... | import sys
#input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return sys.stdin.read()
def II(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float,input().split()))
def LI(): return list(map(int... | 34 | 30 | 635 | 677 | import sys
input = sys.stdin.readline
# input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
def RD():
return sys.stdin.read()
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def TI():
return t... | import sys
# input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return sys.stdin.read()
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
return list(map(float, input().split()))
def LI():
... | false | 11.764706 | [
"-input = sys.stdin.readline",
"+# from functools import lru_cache",
"+def MF():",
"+ return list(map(float, input().split()))",
"+",
"+",
"+",
"+",
"+def LF():",
"+ return list(map(float, input().split()))",
"-# rstrip().decode('utf-8')",
"+# rstrip().decode()",
"-from collections imp... | false | 0.073465 | 0.037862 | 1.940342 | [
"s926411182",
"s726703280"
] |
u464205401 | p02678 | python | s998249442 | s977596566 | 751 | 678 | 34,740 | 34,904 | Accepted | Accepted | 9.72 | from collections import deque
n,m=list(map(int,input().split()))
graph=[[] for _ in range(n)]
for _ in range(m):
a,b=list(map(int,input().split()))
graph[a-1].append(b-1)
graph[b-1].append(a-1)
#print(graph)
dist=[-1]*n
dist[0]=0
queue=deque([0])
while queue:
v=queue.popleft()
for nv in... | from collections import deque
n, m = map(int, input().split())
graph = [[] for _ in range(n+1)]
for i in range(m):
a, b = map(int, input().split())
graph[a].append(b)
graph[b].append(a)
#print(graph)
dist = [-1] * (n+1)
dist[0] = 0
dist[1] = 0
d = deque()
d.append(1)
while d: #dの中が空になるまで続ける... | 29 | 31 | 464 | 697 | from collections import deque
n, m = list(map(int, input().split()))
graph = [[] for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
# print(graph)
dist = [-1] * n
dist[0] = 0
queue = deque([0])
while queue:
v = queue.poplef... | from collections import deque
n, m = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for i in range(m):
a, b = map(int, input().split())
graph[a].append(b)
graph[b].append(a)
# print(graph)
dist = [-1] * (n + 1)
dist[0] = 0
dist[1] = 0
d = deque()
d.append(1)
while d: # dの中が空になるまで続ける
v = ... | false | 6.451613 | [
"-n, m = list(map(int, input().split()))",
"-graph = [[] for _ in range(n)]",
"-for _ in range(m):",
"- a, b = list(map(int, input().split()))",
"- graph[a - 1].append(b - 1)",
"- graph[b - 1].append(a - 1)",
"+n, m = map(int, input().split())",
"+graph = [[] for _ in range(n + 1)]",
"+for ... | false | 0.036224 | 0.036677 | 0.987632 | [
"s998249442",
"s977596566"
] |
u017810624 | p02936 | python | s185865827 | s616568384 | 1,053 | 891 | 147,420 | 148,924 | Accepted | Accepted | 15.38 | import sys
input=sys.stdin.readline
n,q=list(map(int,input().split()))
l=[]
for i in range(n-1):
l.append(list(map(int,input().split())))
l2=[]
for i in range(q):
l2.append(list(map(int,input().split())))
connection=[]
for i in range(n):
connection.append([])
for i in range(n-1):
connection[l[i][0]... | import sys
input=sys.stdin.readline
n,q=list(map(int,input().split()))
l=[]
for i in range(n-1):
l.append(list(map(int,input().split())))
l2=[]
for i in range(q):
l2.append(list(map(int,input().split())))
connection=[]
for i in range(n):
connection.append([])
for i in range(n-1):
connection[l[i][0]... | 39 | 35 | 873 | 801 | import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
l = []
for i in range(n - 1):
l.append(list(map(int, input().split())))
l2 = []
for i in range(q):
l2.append(list(map(int, input().split())))
connection = []
for i in range(n):
connection.append([])
for i in range(n - 1):
conn... | import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
l = []
for i in range(n - 1):
l.append(list(map(int, input().split())))
l2 = []
for i in range(q):
l2.append(list(map(int, input().split())))
connection = []
for i in range(n):
connection.append([])
for i in range(n - 1):
conn... | false | 10.25641 | [
"-L4 = []",
"-for i in range(n):",
"- L4.append(0)",
"+L4 = [0] * n",
"-distance = []",
"-for i in range(n):",
"- distance.append(0)",
"+distance = [0] * n"
] | false | 0.036448 | 0.03533 | 1.03165 | [
"s185865827",
"s616568384"
] |
u312025627 | p03476 | python | s443051690 | s178279455 | 431 | 182 | 80,396 | 80,380 | Accepted | Accepted | 57.77 | def main():
Q = int(eval(input()))
def Eratosthenes(sup: int) -> set:
primes = [True for i in range(sup+1)]
primes[0] = False
primes[1] = False
for i in range(2, sup+1):
if sup < i*i:
break
if primes[i]:
mul = 2
... | def main():
import sys
input = sys.stdin.buffer.readline
Q = int(eval(input()))
def Eratosthenes(sup: int) -> set:
primes = [True for i in range(sup+1)]
primes[0] = False
primes[1] = False
for i in range(2, sup+1):
if sup < i*i:
bre... | 30 | 32 | 817 | 872 | def main():
Q = int(eval(input()))
def Eratosthenes(sup: int) -> set:
primes = [True for i in range(sup + 1)]
primes[0] = False
primes[1] = False
for i in range(2, sup + 1):
if sup < i * i:
break
if primes[i]:
mul = 2
... | def main():
import sys
input = sys.stdin.buffer.readline
Q = int(eval(input()))
def Eratosthenes(sup: int) -> set:
primes = [True for i in range(sup + 1)]
primes[0] = False
primes[1] = False
for i in range(2, sup + 1):
if sup < i * i:
break
... | false | 6.25 | [
"+ import sys",
"+",
"+ input = sys.stdin.buffer.readline"
] | false | 0.008268 | 0.196327 | 0.042116 | [
"s443051690",
"s178279455"
] |
u606878291 | p03862 | python | s176962042 | s422829680 | 180 | 152 | 14,252 | 14,060 | Accepted | Accepted | 15.56 | N, X = list(map(int, input().split(' ')))
A = list(map(int, input().split(' ')))
cost = 0
diff = max(0, sum(A[0:2]) - X)
A[0] -= max(0, diff - A[1])
A[1] -= min(A[1], diff)
cost += diff
for i in range(2, N):
diff = max(0, A[i - 1] + A[i] - X)
A[i - 1] -= max(0, diff - A[i])
A[i] -= min(A[i], d... | N, X = list(map(int, input().split(' ')))
A = list(map(int, input().split(' ')))
cost = max(0, A[0] + A[1] - X)
A[1] = max(0, A[1] - cost)
for i in range(2, N):
cost += max(0, A[i - 1] + A[i] - X)
A[i] = max(0, A[i] - max(0, A[i - 1] + A[i] - X))
print(cost)
| 16 | 11 | 352 | 274 | N, X = list(map(int, input().split(" ")))
A = list(map(int, input().split(" ")))
cost = 0
diff = max(0, sum(A[0:2]) - X)
A[0] -= max(0, diff - A[1])
A[1] -= min(A[1], diff)
cost += diff
for i in range(2, N):
diff = max(0, A[i - 1] + A[i] - X)
A[i - 1] -= max(0, diff - A[i])
A[i] -= min(A[i], diff)
cost ... | N, X = list(map(int, input().split(" ")))
A = list(map(int, input().split(" ")))
cost = max(0, A[0] + A[1] - X)
A[1] = max(0, A[1] - cost)
for i in range(2, N):
cost += max(0, A[i - 1] + A[i] - X)
A[i] = max(0, A[i] - max(0, A[i - 1] + A[i] - X))
print(cost)
| false | 31.25 | [
"-cost = 0",
"-diff = max(0, sum(A[0:2]) - X)",
"-A[0] -= max(0, diff - A[1])",
"-A[1] -= min(A[1], diff)",
"-cost += diff",
"+cost = max(0, A[0] + A[1] - X)",
"+A[1] = max(0, A[1] - cost)",
"- diff = max(0, A[i - 1] + A[i] - X)",
"- A[i - 1] -= max(0, diff - A[i])",
"- A[i] -= min(A[i], ... | false | 0.03362 | 0.039697 | 0.84692 | [
"s176962042",
"s422829680"
] |
u022407960 | p02378 | python | s437718220 | s082031991 | 220 | 70 | 8,396 | 8,524 | Accepted | Accepted | 68.18 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 4 6
0 0
0 2
0 3
1 1
2 1
2 3
output:
3
"""
import sys
def generate_adj_table(_edges):
for edge in _edges:
vx, vy = list(map(int, edge))
init_adj_table[vx].append(vy)
return init_adj_table
def graph_dfs(... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 4 6
0 0
0 2
0 3
1 1
2 1
2 3
output:
3
"""
import sys
def generate_adj_table(_edges):
for edge in _edges:
vx, vy = list(map(int, edge))
init_adj_table[vx].append(vy)
return init_adj_table
def graph_dfs(... | 58 | 57 | 1,178 | 1,151 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 4 6
0 0
0 2
0 3
1 1
2 1
2 3
output:
3
"""
import sys
def generate_adj_table(_edges):
for edge in _edges:
vx, vy = list(map(int, edge))
init_adj_table[vx].append(vy)
return init_adj_table
def graph_dfs(current, matching, visited):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 4 6
0 0
0 2
0 3
1 1
2 1
2 3
output:
3
"""
import sys
def generate_adj_table(_edges):
for edge in _edges:
vx, vy = list(map(int, edge))
init_adj_table[vx].append(vy)
return init_adj_table
def graph_dfs(current, matching, visited):
... | false | 1.724138 | [
"- if adj in adj_table[current] and not visited[adj]:",
"+ if (not visited[adj]) and adj in adj_table[current]:",
"- # v_num = x_num + y_num"
] | false | 0.094556 | 0.095199 | 0.993244 | [
"s437718220",
"s082031991"
] |
u303039933 | p02984 | python | s649628191 | s806592438 | 373 | 110 | 87,444 | 22,332 | Accepted | Accepted | 70.51 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner():
... | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal
... | 116 | 75 | 2,456 | 1,483 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner:
@staticmethod
d... | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal
class Scanner:
... | false | 35.344828 | [
"+from collections import deque",
"-from decimal import *",
"+import decimal",
"- return [eval(input()) for i in range(n)]",
"+ return [Scanner.string() for i in range(n)]",
"- return [int(eval(input())) for i in range(n)]",
"-",
"-",
"-class Math:",
"- @staticmethod",
"-... | false | 0.059906 | 0.082565 | 0.725565 | [
"s649628191",
"s806592438"
] |
u186838327 | p02954 | python | s160814806 | s123638302 | 298 | 254 | 54,648 | 51,004 | Accepted | Accepted | 14.77 | s = list(str(eval(input())))
t = list(reversed(s))
#print(s)
#print(t)
n = len(s)
r = []
temp = 0
for i in range(n):
if s[i] == 'R':
temp += 1
else:
if i >=1 and s[i-1] == 'R' and s[i] == 'L':
r.append(temp)
l = []
temp = 0
for i in range(n):
if t[i] == 'L'... | s = str(eval(input()))
n = len(s)
t = []
for i in range(n-1):
if s[i] == 'R' and s[i+1] == 'L':
ir = i
#il = i+1
#t.append([ir, il])
t.append(ir)
from collections import deque
t.append(10**6)
t_ = deque(t)
post = []
ans = [0]*n
for i in range(n):
ir = t_.popleft(... | 50 | 33 | 923 | 723 | s = list(str(eval(input())))
t = list(reversed(s))
# print(s)
# print(t)
n = len(s)
r = []
temp = 0
for i in range(n):
if s[i] == "R":
temp += 1
else:
if i >= 1 and s[i - 1] == "R" and s[i] == "L":
r.append(temp)
l = []
temp = 0
for i in range(n):
if t[i] == "L":
temp += ... | s = str(eval(input()))
n = len(s)
t = []
for i in range(n - 1):
if s[i] == "R" and s[i + 1] == "L":
ir = i
# il = i+1
# t.append([ir, il])
t.append(ir)
from collections import deque
t.append(10**6)
t_ = deque(t)
post = []
ans = [0] * n
for i in range(n):
ir = t_.popleft()
if... | false | 34 | [
"-s = list(str(eval(input())))",
"-t = list(reversed(s))",
"-# print(s)",
"-# print(t)",
"+s = str(eval(input()))",
"-r = []",
"-temp = 0",
"+t = []",
"+for i in range(n - 1):",
"+ if s[i] == \"R\" and s[i + 1] == \"L\":",
"+ ir = i",
"+ # il = i+1",
"+ # t.append([ir... | false | 0.037081 | 0.039621 | 0.935904 | [
"s160814806",
"s123638302"
] |
u893962649 | p04019 | python | s068302684 | s671915215 | 32 | 29 | 8,816 | 9,044 | Accepted | Accepted | 9.38 | S = eval(input())
if (("N" in S and "S" in S)
or("N" not in S and "S" not in S)):
if (("E" in S and "W" in S)
or ("E" not in S and "W" not in S)):
print('Yes')
exit()
print('No') | S = eval(input())
if ((("N" in S and "S" in S)
or("N" not in S and "S" not in S))
and(("E" in S and "W" in S)
or ("E" not in S and "W" not in S))):
print('Yes')
else:
print('No') | 9 | 9 | 206 | 190 | S = eval(input())
if ("N" in S and "S" in S) or ("N" not in S and "S" not in S):
if ("E" in S and "W" in S) or ("E" not in S and "W" not in S):
print("Yes")
exit()
print("No")
| S = eval(input())
if (("N" in S and "S" in S) or ("N" not in S and "S" not in S)) and (
("E" in S and "W" in S) or ("E" not in S and "W" not in S)
):
print("Yes")
else:
print("No")
| false | 0 | [
"-if (\"N\" in S and \"S\" in S) or (\"N\" not in S and \"S\" not in S):",
"- if (\"E\" in S and \"W\" in S) or (\"E\" not in S and \"W\" not in S):",
"- print(\"Yes\")",
"- exit()",
"-print(\"No\")",
"+if ((\"N\" in S and \"S\" in S) or (\"N\" not in S and \"S\" not in S)) and (",
"+ ... | false | 0.102648 | 0.037984 | 2.702393 | [
"s068302684",
"s671915215"
] |
u046187684 | p02972 | python | s408798891 | s161460778 | 1,354 | 165 | 24,172 | 14,516 | Accepted | Accepted | 87.81 | import numpy as np
def solve(string):
n, *a = list(map(int, string.split()))
a = np.asarray([0] + a)
for i in range(n // 2, 0, -1):
a[i] = a[i::i].sum() % 2
ans = np.where(a == 1)[0]
return "0" if len(ans) == 0 else "{}\n{}".format(len(ans), " ".join(map(str, ans)))
if __name... | def solve(string):
n, *a = list(map(int, string.split()))
for i in range(n // 2, 0, -1):
a[i - 1] = sum(a[i - 1::i]) % 2
ans = [str(i + 1) for i, _a in enumerate(a) if _a == 1]
return "0" if len(ans) == 0 else "{}\n{}".format(len(ans), " ".join(ans))
if __name__ == '__main__':
pri... | 14 | 10 | 381 | 355 | import numpy as np
def solve(string):
n, *a = list(map(int, string.split()))
a = np.asarray([0] + a)
for i in range(n // 2, 0, -1):
a[i] = a[i::i].sum() % 2
ans = np.where(a == 1)[0]
return "0" if len(ans) == 0 else "{}\n{}".format(len(ans), " ".join(map(str, ans)))
if __name__ == "__mai... | def solve(string):
n, *a = list(map(int, string.split()))
for i in range(n // 2, 0, -1):
a[i - 1] = sum(a[i - 1 :: i]) % 2
ans = [str(i + 1) for i, _a in enumerate(a) if _a == 1]
return "0" if len(ans) == 0 else "{}\n{}".format(len(ans), " ".join(ans))
if __name__ == "__main__":
print((sol... | false | 28.571429 | [
"-import numpy as np",
"-",
"-",
"- a = np.asarray([0] + a)",
"- a[i] = a[i::i].sum() % 2",
"- ans = np.where(a == 1)[0]",
"- return \"0\" if len(ans) == 0 else \"{}\\n{}\".format(len(ans), \" \".join(map(str, ans)))",
"+ a[i - 1] = sum(a[i - 1 :: i]) % 2",
"+ ans = [str(i ... | false | 0.160916 | 0.068988 | 2.33253 | [
"s408798891",
"s161460778"
] |
u208713671 | p03013 | python | s007700050 | s739381062 | 213 | 136 | 11,040 | 76,256 | Accepted | Accepted | 36.15 | NM = list(map(int,input().split()))
N = NM[0]
M = NM[1]
A =[]
while True:
try:
A.append(int(eval(input())))
except:
break;
countlist = [1,1,2]
if N >3:
for i in range(3,N+1):
a = countlist[i-2]+countlist[i-1]
if a>1000000007:
a = a%1000000007
... | N,M = list(map(int,input().split()))
p=10**9+7
A = [0]*(N+1)
flag = 0
for i in range(M):
tmp = int(eval(input()))
A[tmp]=1
if A[tmp]*A[tmp-1]>0:
flag=1
break
if flag==1:
print((0))
else:
dp = [0]*(N+1)
dp[0] = 1
dp[1] = 1-A[1]
for i in range(2,N+1):
... | 49 | 21 | 928 | 402 | NM = list(map(int, input().split()))
N = NM[0]
M = NM[1]
A = []
while True:
try:
A.append(int(eval(input())))
except:
break
countlist = [1, 1, 2]
if N > 3:
for i in range(3, N + 1):
a = countlist[i - 2] + countlist[i - 1]
if a > 1000000007:
a = a % 1000000007
... | N, M = list(map(int, input().split()))
p = 10**9 + 7
A = [0] * (N + 1)
flag = 0
for i in range(M):
tmp = int(eval(input()))
A[tmp] = 1
if A[tmp] * A[tmp - 1] > 0:
flag = 1
break
if flag == 1:
print((0))
else:
dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 1 - A[1]
for i in range(2,... | false | 57.142857 | [
"-NM = list(map(int, input().split()))",
"-N = NM[0]",
"-M = NM[1]",
"-A = []",
"-while True:",
"- try:",
"- A.append(int(eval(input())))",
"- except:",
"+N, M = list(map(int, input().split()))",
"+p = 10**9 + 7",
"+A = [0] * (N + 1)",
"+flag = 0",
"+for i in range(M):",
"+ ... | false | 0.064507 | 0.041565 | 1.551949 | [
"s007700050",
"s739381062"
] |
u131464432 | p03687 | python | s630362279 | s145370031 | 32 | 25 | 9,404 | 8,944 | Accepted | Accepted | 21.88 | import collections
s = eval(input())
a = []
for i in range(26):
cnt = collections.Counter(s)[chr(i+97)]
if cnt == 0:
a.append(len(s))
continue
num = 0
ma = 0
for j in s:
if j == chr(i+97):
ans = num
ma = max(ma, ans)
num = 0
... | s = eval(input())
a = "qwertyuiopasdfghjklzxcvbnm"
mi = 100
for i in a:
ma,cnt = 0,0
for j in s:
if j != i:
cnt += 1
else:
ma = max(ma, cnt)
cnt = 0
ma = max(ma,cnt)
mi = min(mi,ma)
print(mi) | 21 | 14 | 428 | 270 | import collections
s = eval(input())
a = []
for i in range(26):
cnt = collections.Counter(s)[chr(i + 97)]
if cnt == 0:
a.append(len(s))
continue
num = 0
ma = 0
for j in s:
if j == chr(i + 97):
ans = num
ma = max(ma, ans)
num = 0
el... | s = eval(input())
a = "qwertyuiopasdfghjklzxcvbnm"
mi = 100
for i in a:
ma, cnt = 0, 0
for j in s:
if j != i:
cnt += 1
else:
ma = max(ma, cnt)
cnt = 0
ma = max(ma, cnt)
mi = min(mi, ma)
print(mi)
| false | 33.333333 | [
"-import collections",
"-",
"-a = []",
"-for i in range(26):",
"- cnt = collections.Counter(s)[chr(i + 97)]",
"- if cnt == 0:",
"- a.append(len(s))",
"- continue",
"- num = 0",
"- ma = 0",
"+a = \"qwertyuiopasdfghjklzxcvbnm\"",
"+mi = 100",
"+for i in a:",
"+ m... | false | 0.0399 | 0.041283 | 0.96652 | [
"s630362279",
"s145370031"
] |
u992910889 | p03164 | python | s705134208 | s364415753 | 1,133 | 860 | 311,888 | 300,904 | Accepted | Accepted | 24.1 | N, W = list(map(int, input().split()))
w, v = [0] * N, [0] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
V = sum(v)
# dp[i][j]:i番目までの品物から価値がj以上になるよう選んだときの重さの総和の最小値
dp = [[float("inf")] * (V + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j in range(V + 1):
# i+1番目を選... | # import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
N, W = list(map(int, input().split()))
weight, value = [0] * ... | 24 | 48 | 571 | 1,194 | N, W = list(map(int, input().split()))
w, v = [0] * N, [0] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
V = sum(v)
# dp[i][j]:i番目までの品物から価値がj以上になるよう選んだときの重さの総和の最小値
dp = [[float("inf")] * (V + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j in range(V + 1):
# i+1番目を選... | # import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
N, W = list(map(int, input().split()))
weight, value = [0] * N, [0] * N
... | false | 50 | [
"-N, W = list(map(int, input().split()))",
"-w, v = [0] * N, [0] * N",
"-for i in range(N):",
"- w[i], v[i] = list(map(int, input().split()))",
"-V = sum(v)",
"-# dp[i][j]:i番目までの品物から価値がj以上になるよう選んだときの重さの総和の最小値",
"-dp = [[float(\"inf\")] * (V + 1) for _ in range(N + 1)]",
"-dp[0][0] = 0",
"-for i i... | false | 0.078583 | 0.038856 | 2.022428 | [
"s705134208",
"s364415753"
] |
u562016607 | p03665 | python | s625267075 | s236489612 | 24 | 19 | 3,064 | 3,064 | Accepted | Accepted | 20.83 | def C(n,m):
S=1
for i in range(1,n+1):
S=S*i
for i in range(1,m+1):
S=S//i
for i in range(1,n-m+1):
S=S//i
return S
N,P=list(map(int,input().split()))
A=[int(i) for i in input().split()]
X=0;Y=0
#X:偶数
#Y:奇数
for i in range(N):
if A[i]%2==0:
X+=1
... | '''
方針:各Aiをそれぞれ見て、いくつ偶数があっていくつ奇数があるかを数える。
以下偶数がX個、奇数がY個あるとする。(X+Y=N,0≦X,Y)
そしてこの問題は偶数の集合の中からの選ぶことと奇数の集合の中から選ぶことを独立に考えることができる。
よって(偶数の集合からの選び方)×(奇数の集合からの選び方)で求めることができる。
(偶数の集合からの選び方)については、どのように選んでも全体の合計を2で割った余りは変わらないので全事象を考えることができる。
よって2^Xである。
(奇数の集合からの選び方)についてはY個のうちk個(k≡P mod 2)である場合の数の合計なので
Σ[k:0→Y and k≡P mod... | 24 | 35 | 415 | 842 | def C(n, m):
S = 1
for i in range(1, n + 1):
S = S * i
for i in range(1, m + 1):
S = S // i
for i in range(1, n - m + 1):
S = S // i
return S
N, P = list(map(int, input().split()))
A = [int(i) for i in input().split()]
X = 0
Y = 0
# X:偶数
# Y:奇数
for i in range(N):
if A[i... | """
方針:各Aiをそれぞれ見て、いくつ偶数があっていくつ奇数があるかを数える。
以下偶数がX個、奇数がY個あるとする。(X+Y=N,0≦X,Y)
そしてこの問題は偶数の集合の中からの選ぶことと奇数の集合の中から選ぶことを独立に考えることができる。
よって(偶数の集合からの選び方)×(奇数の集合からの選び方)で求めることができる。
(偶数の集合からの選び方)については、どのように選んでも全体の合計を2で割った余りは変わらないので全事象を考えることができる。
よって2^Xである。
(奇数の集合からの選び方)についてはY個のうちk個(k≡P mod 2)である場合の数の合計なので
Σ[k:0→Y and k≡P mod 2]C(Y,k... | false | 31.428571 | [
"+\"\"\"",
"+方針:各Aiをそれぞれ見て、いくつ偶数があっていくつ奇数があるかを数える。",
"+以下偶数がX個、奇数がY個あるとする。(X+Y=N,0≦X,Y)",
"+そしてこの問題は偶数の集合の中からの選ぶことと奇数の集合の中から選ぶことを独立に考えることができる。",
"+よって(偶数の集合からの選び方)×(奇数の集合からの選び方)で求めることができる。",
"+(偶数の集合からの選び方)については、どのように選んでも全体の合計を2で割った余りは変わらないので全事象を考えることができる。",
"+よって2^Xである。",
"+(奇数の集合からの選び方)についてはY個のうちk個(... | false | 0.041694 | 0.059949 | 0.695488 | [
"s625267075",
"s236489612"
] |
u410118019 | p03096 | python | s605850856 | s020761658 | 1,526 | 979 | 764,032 | 98,904 | Accepted | Accepted | 35.85 | from collections import defaultdict
MOD = 10**9+7
n = int(eval(input()))
dp = [1]
d = defaultdict(list)
cur = int(eval(input()))
d[cur].append(0)
for i in range(1,n):
pre,cur = cur,int(eval(input()))
c = dp[-1]
if pre != cur and d[cur]:
c += dp[d[cur][-1]]
dp.append(c)
d[cur].append(i)
print... | from collections import defaultdict
MOD = 10**9+7
n = int(eval(input()))
dp = [1]
d = defaultdict(list)
cur = int(eval(input()))
d[cur].append(0)
for i in range(1,n):
pre,cur = cur,int(eval(input()))
c = dp[-1]
if pre != cur and d[cur]:
c += dp[d[cur][-1]]
dp.append(c%MOD)
d[cur].append(i)
p... | 15 | 15 | 314 | 314 | from collections import defaultdict
MOD = 10**9 + 7
n = int(eval(input()))
dp = [1]
d = defaultdict(list)
cur = int(eval(input()))
d[cur].append(0)
for i in range(1, n):
pre, cur = cur, int(eval(input()))
c = dp[-1]
if pre != cur and d[cur]:
c += dp[d[cur][-1]]
dp.append(c)
d[cur].append(i)... | from collections import defaultdict
MOD = 10**9 + 7
n = int(eval(input()))
dp = [1]
d = defaultdict(list)
cur = int(eval(input()))
d[cur].append(0)
for i in range(1, n):
pre, cur = cur, int(eval(input()))
c = dp[-1]
if pre != cur and d[cur]:
c += dp[d[cur][-1]]
dp.append(c % MOD)
d[cur].app... | false | 0 | [
"- dp.append(c)",
"+ dp.append(c % MOD)",
"-print((dp[-1] % MOD))",
"+print((dp[-1]))"
] | false | 0.128868 | 0.038644 | 3.334712 | [
"s605850856",
"s020761658"
] |
u294485299 | p03163 | python | s192002423 | s649990765 | 520 | 109 | 218,640 | 68,740 | Accepted | Accepted | 79.04 | import math
n, w = list(map(int, input().split()))
weights = []
costs = []
for i in range(n):
a,b = list(map(int, input().split()))
weights.append(a)
costs.append(b)
dp = [[0 for i in range(w+1)] for i in range(n)]
for i in range(w+1):
if(i>= weights[0]):
dp[0][i] = costs[0]
for ... | import math
n, W = list(map(int, input().split()))
dp = [0]*(W+1)
for i in range(n):
weight, cost = list(map(int, input().split()))
for weight_already in range(W-weight, -1, -1):
dp[weight_already+weight] = max(dp[weight_already+weight], dp[weight_already]+cost)
ans = max(dp)
print(ans) | 22 | 10 | 559 | 301 | import math
n, w = list(map(int, input().split()))
weights = []
costs = []
for i in range(n):
a, b = list(map(int, input().split()))
weights.append(a)
costs.append(b)
dp = [[0 for i in range(w + 1)] for i in range(n)]
for i in range(w + 1):
if i >= weights[0]:
dp[0][i] = costs[0]
for i in range... | import math
n, W = list(map(int, input().split()))
dp = [0] * (W + 1)
for i in range(n):
weight, cost = list(map(int, input().split()))
for weight_already in range(W - weight, -1, -1):
dp[weight_already + weight] = max(
dp[weight_already + weight], dp[weight_already] + cost
)
ans = ... | false | 54.545455 | [
"-n, w = list(map(int, input().split()))",
"-weights = []",
"-costs = []",
"+n, W = list(map(int, input().split()))",
"+dp = [0] * (W + 1)",
"- a, b = list(map(int, input().split()))",
"- weights.append(a)",
"- costs.append(b)",
"-dp = [[0 for i in range(w + 1)] for i in range(n)]",
"-for... | false | 0.039915 | 0.051666 | 0.77256 | [
"s192002423",
"s649990765"
] |
u608088992 | p03141 | python | s401675983 | s588799336 | 745 | 476 | 36,388 | 36,016 | Accepted | Accepted | 36.11 | N = int(eval(input()))
Takahashi = [None] * N
Aoki = [None] * N
Used = [False] * N
for i in range(N):
a, b = list(map(int, input().split()))
Takahashi[i] = (-a-b, -a, i)
Aoki[i] = (-b-a, -b, i)
Takahashi.sort()
Aoki.sort()
TotalPoint = 0
usedDish = 0
tnum, anum = 0, 0
while usedDish < N:
... | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
T, A = [None] * N, [None] * N
used = [False] * N
for i in range(N):
a, b = list(map(int, input().split()))
T[i] = (a + b, a, i)
A[i] = (a + b, b, i)
T.sort(reverse = True)
A.sort(re... | 29 | 32 | 689 | 781 | N = int(eval(input()))
Takahashi = [None] * N
Aoki = [None] * N
Used = [False] * N
for i in range(N):
a, b = list(map(int, input().split()))
Takahashi[i] = (-a - b, -a, i)
Aoki[i] = (-b - a, -b, i)
Takahashi.sort()
Aoki.sort()
TotalPoint = 0
usedDish = 0
tnum, anum = 0, 0
while usedDish < N:
if usedDish... | import sys
def solve():
input = sys.stdin.readline
N = int(eval(input()))
T, A = [None] * N, [None] * N
used = [False] * N
for i in range(N):
a, b = list(map(int, input().split()))
T[i] = (a + b, a, i)
A[i] = (a + b, b, i)
T.sort(reverse=True)
A.sort(reverse=True)
... | false | 9.375 | [
"-N = int(eval(input()))",
"-Takahashi = [None] * N",
"-Aoki = [None] * N",
"-Used = [False] * N",
"-for i in range(N):",
"- a, b = list(map(int, input().split()))",
"- Takahashi[i] = (-a - b, -a, i)",
"- Aoki[i] = (-b - a, -b, i)",
"-Takahashi.sort()",
"-Aoki.sort()",
"-TotalPoint = 0"... | false | 0.109206 | 0.038632 | 2.82683 | [
"s401675983",
"s588799336"
] |
u724687935 | p02901 | python | s212729503 | s472004826 | 420 | 287 | 78,696 | 45,160 | Accepted | Accepted | 31.67 | N, M = list(map(int, input().split()))
A = [None] * M
K = [None] * M
for i in range(M):
a, b = list(map(int, input().split()))
C = list(map(int, input().split()))
A[i] = a
K[i] = sum([2 ** (i - 1) for i in C])
INF = (1 << 32) - 1
dp = [[INF] * (2 ** N) for _ in range(M + 1)]
for i in range... | N, M = list(map(int, input().split()))
A = [None] * M
K = [None] * M
for i in range(M):
a, b = list(map(int, input().split()))
C = list(map(int, input().split()))
A[i] = a
K[i] = sum([2 ** (i - 1) for i in C])
INF = (1 << 32) - 1
dp = [INF] * (2 ** N)
dp[0] = 0
for i in range(M):
k... | 25 | 22 | 629 | 468 | N, M = list(map(int, input().split()))
A = [None] * M
K = [None] * M
for i in range(M):
a, b = list(map(int, input().split()))
C = list(map(int, input().split()))
A[i] = a
K[i] = sum([2 ** (i - 1) for i in C])
INF = (1 << 32) - 1
dp = [[INF] * (2**N) for _ in range(M + 1)]
for i in range(M + 1):
dp[... | N, M = list(map(int, input().split()))
A = [None] * M
K = [None] * M
for i in range(M):
a, b = list(map(int, input().split()))
C = list(map(int, input().split()))
A[i] = a
K[i] = sum([2 ** (i - 1) for i in C])
INF = (1 << 32) - 1
dp = [INF] * (2**N)
dp[0] = 0
for i in range(M):
k = K[i]
a = A[i]... | false | 12 | [
"-dp = [[INF] * (2**N) for _ in range(M + 1)]",
"-for i in range(M + 1):",
"- dp[i][0] = 0",
"+dp = [INF] * (2**N)",
"+dp[0] = 0",
"- here = dp[i][j]",
"- dp[i + 1][j] = min(dp[i + 1][j], here)",
"- dp[i + 1][j | k] = min(dp[i + 1][j | k], dp[i][j | k], here + a)",
"-ans = dp... | false | 0.034253 | 0.036422 | 0.940447 | [
"s212729503",
"s472004826"
] |
u945181840 | p03464 | python | s926096236 | s649977259 | 142 | 129 | 14,092 | 14,092 | Accepted | Accepted | 9.15 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
K, *A = list(map(int, read().split()))
maximum = 2
minimum = 2
for i in A[::-1]:
if i > maximum:
print((-1))
exit()
if i >= minimum:
new_minimum = i
else:
new_minimum = (minimum + i - 1) // i * i
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
K, *A = list(map(int, read().split()))
maximum = 2
minimum = 2
for i in A[::-1]:
if maximum // i - (minimum - 1) // i >= 1:
maximum = maximum // i * i + i - 1
minimum = (minimum + i - 1) // i * i
else:
print((-... | 24 | 17 | 556 | 359 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
K, *A = list(map(int, read().split()))
maximum = 2
minimum = 2
for i in A[::-1]:
if i > maximum:
print((-1))
exit()
if i >= minimum:
new_minimum = i
else:
new_minimum = (minimum + i - 1) // i * i
new_maximum ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
K, *A = list(map(int, read().split()))
maximum = 2
minimum = 2
for i in A[::-1]:
if maximum // i - (minimum - 1) // i >= 1:
maximum = maximum // i * i + i - 1
minimum = (minimum + i - 1) // i * i
else:
print((-1))
ex... | false | 29.166667 | [
"- if i > maximum:",
"- print((-1))",
"- exit()",
"- if i >= minimum:",
"- new_minimum = i",
"- else:",
"- new_minimum = (minimum + i - 1) // i * i",
"- new_maximum = maximum // i * i + i - 1",
"- if minimum <= new_minimum <= new_maximum and maximum <= new_... | false | 0.039205 | 0.0384 | 1.020956 | [
"s926096236",
"s649977259"
] |
u670180528 | p03297 | python | s457446253 | s450843803 | 44 | 18 | 5,432 | 3,188 | Accepted | Accepted | 59.09 | from fractions import gcd
_, *Q = list(map(int, open(0).read().split()))
for a, b, c, d in zip(*[iter(Q)] * 4):
if a < b or d < b:
print("No")
continue
if c >= b:
print("Yes")
continue
a %= b
g = gcd(b, d)
# b - g + a - g * (a // g) < b
if b - g + a - g * (a // g) > c:
print("No")
else:
... | def gcd(x, y):
while y:
x, y = y, x % y
return x
_, *Q = list(map(int, open(0).read().split()))
for a, b, c, d in zip(*[iter(Q)] * 4):
if a < b or d < b:
print("No")
continue
if c >= b:
print("Yes")
continue
a %= b
g = gcd(b, d)
# b - g + a - g * (a // g) < b
if b - g + a - g * (a // ... | 16 | 20 | 328 | 360 | from fractions import gcd
_, *Q = list(map(int, open(0).read().split()))
for a, b, c, d in zip(*[iter(Q)] * 4):
if a < b or d < b:
print("No")
continue
if c >= b:
print("Yes")
continue
a %= b
g = gcd(b, d)
# b - g + a - g * (a // g) < b
if b - g + a - g * (a // g... | def gcd(x, y):
while y:
x, y = y, x % y
return x
_, *Q = list(map(int, open(0).read().split()))
for a, b, c, d in zip(*[iter(Q)] * 4):
if a < b or d < b:
print("No")
continue
if c >= b:
print("Yes")
continue
a %= b
g = gcd(b, d)
# b - g + a - g * (a ... | false | 20 | [
"-from fractions import gcd",
"+def gcd(x, y):",
"+ while y:",
"+ x, y = y, x % y",
"+ return x",
"+"
] | false | 0.121816 | 0.05436 | 2.240905 | [
"s457446253",
"s450843803"
] |
u600402037 | p02703 | python | s881803561 | s075816437 | 1,183 | 437 | 52,724 | 114,216 | Accepted | Accepted | 63.06 | # coding: utf-8
import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 同じ地点で銀貨の枚数によって別の状態として扱う(最大max(A)*(N-1))
N, M, S = lr()
UVAB = [lr() for _ in range(M)]
CD = [lr() for _ in range(N)] # 0-ind... | # coding: utf-8
import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 銀貨を何枚持っているかの状態数、N*2501の都市, dijkstra
N, M, S = lr()
limit = 2500
S = min(S, limit)
graph = [[] for _ in range((N+1) * (limit+... | 60 | 45 | 1,543 | 1,239 | # coding: utf-8
import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 同じ地点で銀貨の枚数によって別の状態として扱う(最大max(A)*(N-1))
N, M, S = lr()
UVAB = [lr() for _ in range(M)]
CD = [lr() for _ in range(N)] # 0-indexed
Amax = ... | # coding: utf-8
import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 銀貨を何枚持っているかの状態数、N*2501の都市, dijkstra
N, M, S = lr()
limit = 2500
S = min(S, limit)
graph = [[] for _ in range((N + 1) * (limit + 1))] # 1... | false | 25 | [
"-# 同じ地点で銀貨の枚数によって別の状態として扱う(最大max(A)*(N-1))",
"+# 銀貨を何枚持っているかの状態数、N*2501の都市, dijkstra",
"-UVAB = [lr() for _ in range(M)]",
"-CD = [lr() for _ in range(N)] # 0-indexed",
"-Amax = 0",
"-for i in range(M):",
"- a = UVAB[i][2]",
"- if a > Amax:",
"- Amax = a",
"-limit = Amax * (N - 1)",... | false | 0.074505 | 0.093332 | 0.798277 | [
"s881803561",
"s075816437"
] |
u845620905 | p02669 | python | s706029686 | s586817321 | 327 | 272 | 11,000 | 10,904 | Accepted | Accepted | 16.82 | T = int(eval(input()))
while(T > 0):
N, A, B, C, D = list(map(int, input().split()))
dp = {}
def d(n):
if n == 0:
return 0
if n == 1:
return D
if n in dp:
return dp[n]
ret = min(
D * n,
D * abs(n... | T = int(eval(input()))
while(T > 0):
N, A, B, C, D = list(map(int, input().split()))
memo = {}
def d(n):
if n == 0:
return 0
if n == 1:
return D
if n in memo:
return memo[n]
ret = n * D
if (n % 2 == 0):
... | 30 | 39 | 738 | 875 | T = int(eval(input()))
while T > 0:
N, A, B, C, D = list(map(int, input().split()))
dp = {}
def d(n):
if n == 0:
return 0
if n == 1:
return D
if n in dp:
return dp[n]
ret = min(
D * n,
D * abs(n - (n // 2) * 2) + A ... | T = int(eval(input()))
while T > 0:
N, A, B, C, D = list(map(int, input().split()))
memo = {}
def d(n):
if n == 0:
return 0
if n == 1:
return D
if n in memo:
return memo[n]
ret = n * D
if n % 2 == 0:
ret = min(ret, A + ... | false | 23.076923 | [
"- dp = {}",
"+ memo = {}",
"- if n in dp:",
"- return dp[n]",
"- ret = min(",
"- D * n,",
"- D * abs(n - (n // 2) * 2) + A + d(n // 2),",
"- D * abs(n - ((n + 1) // 2) * 2) + A + d((n + 1) // 2),",
"- D * abs(n - (n // 3) * ... | false | 0.242667 | 0.141505 | 1.714898 | [
"s706029686",
"s586817321"
] |
u994988729 | p03733 | python | s769614445 | s189766613 | 209 | 133 | 35,704 | 22,004 | Accepted | Accepted | 36.36 | import numpy as np
N, T = list(map(int, input().split()))
t = np.array(input().split(), dtype=int)
dt = np.diff(t)
dt = np.minimum(dt, T)
print((T + dt.sum())) | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
N, T = list(map(int, input().split()))
time = list(map(int, input().split()))
ans = T
for x, y in zip(time[:-1], time[1:]):
ans += min(T, y - x)
print(ans) | 7 | 11 | 158 | 241 | import numpy as np
N, T = list(map(int, input().split()))
t = np.array(input().split(), dtype=int)
dt = np.diff(t)
dt = np.minimum(dt, T)
print((T + dt.sum()))
| import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
N, T = list(map(int, input().split()))
time = list(map(int, input().split()))
ans = T
for x, y in zip(time[:-1], time[1:]):
ans += min(T, y - x)
print(ans)
| false | 36.363636 | [
"-import numpy as np",
"+import sys",
"+input = sys.stdin.buffer.readline",
"+sys.setrecursionlimit(10**7)",
"-t = np.array(input().split(), dtype=int)",
"-dt = np.diff(t)",
"-dt = np.minimum(dt, T)",
"-print((T + dt.sum()))",
"+time = list(map(int, input().split()))",
"+ans = T",
"+for x, y in ... | false | 0.478323 | 0.043002 | 11.1233 | [
"s769614445",
"s189766613"
] |
u347640436 | p03450 | python | s768714312 | s059756406 | 1,358 | 1,044 | 39,100 | 39,088 | Accepted | Accepted | 23.12 | # Union Find 木
from sys import setrecursionlimit
def find(parent, diff_weight, i):
t = parent[i]
if t < 0:
return i
t = find(parent, diff_weight, t)
diff_weight[i] += diff_weight[parent[i]]
parent[i] = t
return t
def weight(parent, diff_weight, i):
find(parent, dif... | # Union Find 木
from sys import setrecursionlimit, stdin
def find(parent, diff_weight, i):
t = parent[i]
if t < 0:
return i
t = find(parent, diff_weight, t)
diff_weight[i] += diff_weight[parent[i]]
parent[i] = t
return t
def weight(parent, diff_weight, i):
find(pare... | 48 | 48 | 1,161 | 1,186 | # Union Find 木
from sys import setrecursionlimit
def find(parent, diff_weight, i):
t = parent[i]
if t < 0:
return i
t = find(parent, diff_weight, t)
diff_weight[i] += diff_weight[parent[i]]
parent[i] = t
return t
def weight(parent, diff_weight, i):
find(parent, diff_weight, i)
... | # Union Find 木
from sys import setrecursionlimit, stdin
def find(parent, diff_weight, i):
t = parent[i]
if t < 0:
return i
t = find(parent, diff_weight, t)
diff_weight[i] += diff_weight[parent[i]]
parent[i] = t
return t
def weight(parent, diff_weight, i):
find(parent, diff_weight... | false | 0 | [
"-from sys import setrecursionlimit",
"+from sys import setrecursionlimit, stdin",
"-N, M = list(map(int, input().split()))",
"-LRD = [tuple(map(int, input().split())) for _ in range(M)]",
"+N, M = list(map(int, stdin.readline().split()))",
"+LRD = [tuple(map(int, stdin.readline().split())) for _ in range... | false | 0.095799 | 0.114508 | 0.836616 | [
"s768714312",
"s059756406"
] |
u922449550 | p02920 | python | s298282873 | s655424517 | 1,893 | 1,434 | 32,960 | 34,676 | Accepted | Accepted | 24.25 | N = int(eval(input()))
N2 = 2**N
S = list(map(int, input().split()))
S.sort(reverse=True)
slimes = [S[0]]
S[0] = float('inf')
num = 1
min_idx = 1
for i in range(N):
slimes.sort()
n = num
idx = min_idx
is_continuous = True
while n and idx<=N2-1:
if S[idx] < slimes[n-1]:
slimes.append... | N = int(eval(input()))
N2 = 2**N
S = list(map(int, input().split()))
S.sort(reverse=True)
slimes = [S[0]]
INF = S[0] + 1
S[0] = INF
num = 1
min_idx = 1
for i in range(N):
slimes.sort()
n = num
idx = min_idx
is_continuous = True
while n and idx<=N2-1:
if S[idx] < slimes[n-1]:
slimes... | 34 | 35 | 610 | 599 | N = int(eval(input()))
N2 = 2**N
S = list(map(int, input().split()))
S.sort(reverse=True)
slimes = [S[0]]
S[0] = float("inf")
num = 1
min_idx = 1
for i in range(N):
slimes.sort()
n = num
idx = min_idx
is_continuous = True
while n and idx <= N2 - 1:
if S[idx] < slimes[n - 1]:
slim... | N = int(eval(input()))
N2 = 2**N
S = list(map(int, input().split()))
S.sort(reverse=True)
slimes = [S[0]]
INF = S[0] + 1
S[0] = INF
num = 1
min_idx = 1
for i in range(N):
slimes.sort()
n = num
idx = min_idx
is_continuous = True
while n and idx <= N2 - 1:
if S[idx] < slimes[n - 1]:
... | false | 2.857143 | [
"-S[0] = float(\"inf\")",
"+INF = S[0] + 1",
"+S[0] = INF",
"- S[idx] = float(\"inf\")",
"+ S[idx] = INF",
"- if S[idx] < float(\"inf\"):",
"+ if S[idx] < INF:"
] | false | 0.047326 | 0.008563 | 5.526905 | [
"s298282873",
"s655424517"
] |
u867848444 | p03385 | python | s411686499 | s706462004 | 20 | 17 | 3,064 | 3,064 | Accepted | Accepted | 15 | s=list(eval(input()))
s.sort()
print(('Yes' if s==['a','b','c'] else 'No')) | s = eval(input())
print(('Yes' if len(set(s)) == 3 else 'No')) | 3 | 2 | 69 | 55 | s = list(eval(input()))
s.sort()
print(("Yes" if s == ["a", "b", "c"] else "No"))
| s = eval(input())
print(("Yes" if len(set(s)) == 3 else "No"))
| false | 33.333333 | [
"-s = list(eval(input()))",
"-s.sort()",
"-print((\"Yes\" if s == [\"a\", \"b\", \"c\"] else \"No\"))",
"+s = eval(input())",
"+print((\"Yes\" if len(set(s)) == 3 else \"No\"))"
] | false | 0.051336 | 0.052235 | 0.982788 | [
"s411686499",
"s706462004"
] |
u892916452 | p02393 | python | s900107447 | s961903277 | 20 | 10 | 6,332 | 6,432 | Accepted | Accepted | 50 | s = input()
nlist = list(map(int, s.split()))
a, b, c= nlist
if a<b:
if b<c:
print('%d %d %d' %(a, b, c))
elif c<a:
print('%d %d %d' %(c, a, b))
else:
print('%d %d %d' %(a, c, b))
else:
if a<c:
print('%d %d %d' %(b, a, c))
elif c<b:
pri... | s = input()
nlist = list(map(int, s.split()))
a, b, c= nlist
#print nlist.sort()
ls = sorted(nlist)
print('%d %d %d' %(ls[0], ls[1], ls[2])) | 18 | 6 | 386 | 143 | s = input()
nlist = list(map(int, s.split()))
a, b, c = nlist
if a < b:
if b < c:
print("%d %d %d" % (a, b, c))
elif c < a:
print("%d %d %d" % (c, a, b))
else:
print("%d %d %d" % (a, c, b))
else:
if a < c:
print("%d %d %d" % (b, a, c))
elif c < b:
print("%d %d... | s = input()
nlist = list(map(int, s.split()))
a, b, c = nlist
# print nlist.sort()
ls = sorted(nlist)
print("%d %d %d" % (ls[0], ls[1], ls[2]))
| false | 66.666667 | [
"-if a < b:",
"- if b < c:",
"- print(\"%d %d %d\" % (a, b, c))",
"- elif c < a:",
"- print(\"%d %d %d\" % (c, a, b))",
"- else:",
"- print(\"%d %d %d\" % (a, c, b))",
"-else:",
"- if a < c:",
"- print(\"%d %d %d\" % (b, a, c))",
"- elif c < b:",
"- ... | false | 0.044429 | 0.047868 | 0.928148 | [
"s900107447",
"s961903277"
] |
u737758066 | p02682 | python | s157183025 | s913548050 | 23 | 20 | 9,184 | 9,096 | Accepted | Accepted | 13.04 | a, b, c, k = list(map(int, input().split()))
if k <= a:
print((k*1))
elif k <= a + b:
print((1*a))
elif k <= a + b + c:
print((1*a+(k-a-b)*-1))
else:
print((1*1+c*-1))
| a, b, c, k = list(map(int, input().split()))
if a >= k:
print(k)
else:
print((a-((k-a)-b)))
| 10 | 6 | 180 | 98 | a, b, c, k = list(map(int, input().split()))
if k <= a:
print((k * 1))
elif k <= a + b:
print((1 * a))
elif k <= a + b + c:
print((1 * a + (k - a - b) * -1))
else:
print((1 * 1 + c * -1))
| a, b, c, k = list(map(int, input().split()))
if a >= k:
print(k)
else:
print((a - ((k - a) - b)))
| false | 40 | [
"-if k <= a:",
"- print((k * 1))",
"-elif k <= a + b:",
"- print((1 * a))",
"-elif k <= a + b + c:",
"- print((1 * a + (k - a - b) * -1))",
"+if a >= k:",
"+ print(k)",
"- print((1 * 1 + c * -1))",
"+ print((a - ((k - a) - b)))"
] | false | 0.040163 | 0.043093 | 0.932022 | [
"s157183025",
"s913548050"
] |
u082657995 | p02345 | python | s081137028 | s654271858 | 1,630 | 980 | 9,052 | 29,244 | Accepted | Accepted | 39.88 | # https://atcoder.jp/contests/abc014/submissions/3935971
class SegmentTree(object):
__slots__ = ["elem_size", "tree", "default", "op"]
def __init__(self, a: list, default: int, op):
from math import ceil, log
real_size = len(a)
self.elem_size = elem_size = 1 << ceil(log(real_size... | class Rmq:
# 平方分割
# 値を変更すると元のリストの値も書き換わる
# 検証: http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3990652#1
def __init__(self, a, sqrt_n=150, inf=(1<<31)-1):
self.sqrt_n = sqrt_n
if hasattr(a, "__iter__"):
from itertools import zip_longest
self.n = len(a... | 50 | 65 | 1,599 | 2,014 | # https://atcoder.jp/contests/abc014/submissions/3935971
class SegmentTree(object):
__slots__ = ["elem_size", "tree", "default", "op"]
def __init__(self, a: list, default: int, op):
from math import ceil, log
real_size = len(a)
self.elem_size = elem_size = 1 << ceil(log(real_size, 2))
... | class Rmq:
# 平方分割
# 値を変更すると元のリストの値も書き換わる
# 検証: http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3990652#1
def __init__(self, a, sqrt_n=150, inf=(1 << 31) - 1):
self.sqrt_n = sqrt_n
if hasattr(a, "__iter__"):
from itertools import zip_longest
self.n = len(a)
... | false | 23.076923 | [
"-# https://atcoder.jp/contests/abc014/submissions/3935971",
"-class SegmentTree(object):",
"- __slots__ = [\"elem_size\", \"tree\", \"default\", \"op\"]",
"+class Rmq:",
"+ # 平方分割",
"+ # 値を変更すると元のリストの値も書き換わる",
"+ # 検証: http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3990652#1",
"+ ... | false | 0.045641 | 0.040684 | 1.121847 | [
"s081137028",
"s654271858"
] |
u666772276 | p02586 | python | s032582979 | s433691153 | 546 | 277 | 132,908 | 128,724 | Accepted | Accepted | 49.27 | import sys
inp = [int(x) for x in sys.stdin.read().split()]; ii = 0
rows, cols, k = inp[ii:ii+3]; ii += 3
items = [[] for _ in range(rows+1)]
best = [0]*(cols+1)
for _ in range(k):
r, c, v = inp[ii:ii+3]; ii += 3
items[r].append([c, v])
for i in range(rows+1):
items[i].sort()
ans = 0
for r in range(1,... | import sys
inp = [int(x) for x in sys.stdin.read().split()]; ii = 0
shift = int(10**9 + 1)
rows, cols, k = inp[ii:ii+3]; ii += 3
items = [[] for _ in range(rows+1)]
best = [0]*(cols+1)
for _ in range(k):
r, c, v = inp[ii:ii+3]; ii += 3
items[r].append(c*shift+v)
for i in range(rows+1):
items[i].sort()
a... | 40 | 42 | 801 | 856 | import sys
inp = [int(x) for x in sys.stdin.read().split()]
ii = 0
rows, cols, k = inp[ii : ii + 3]
ii += 3
items = [[] for _ in range(rows + 1)]
best = [0] * (cols + 1)
for _ in range(k):
r, c, v = inp[ii : ii + 3]
ii += 3
items[r].append([c, v])
for i in range(rows + 1):
items[i].sort()
ans = 0
for r... | import sys
inp = [int(x) for x in sys.stdin.read().split()]
ii = 0
shift = int(10**9 + 1)
rows, cols, k = inp[ii : ii + 3]
ii += 3
items = [[] for _ in range(rows + 1)]
best = [0] * (cols + 1)
for _ in range(k):
r, c, v = inp[ii : ii + 3]
ii += 3
items[r].append(c * shift + v)
for i in range(rows + 1):
... | false | 4.761905 | [
"+shift = int(10**9 + 1)",
"- items[r].append([c, v])",
"+ items[r].append(c * shift + v)",
"- for c, v in Row:",
"+ for X in Row:",
"+ c, v = X // shift, X % shift",
"- if best[Row[j][0]] < dp[j]:",
"- best[Row[j][0]] = dp[j]",
"+ c = Row[j] // shift",
... | false | 0.037157 | 0.033281 | 1.116454 | [
"s032582979",
"s433691153"
] |
u738898077 | p02882 | python | s158334537 | s359113463 | 20 | 18 | 3,060 | 3,060 | Accepted | Accepted | 10 | import math
a,b,x = list(map(int,input().split()))
x /= a
if x >= a*b/2:
print((math.atan(2/(a**2)*(a*b-x))/math.pi*180))
else:
print((90-(math.atan((2*x/b**2))/math.pi*180))) | import math
p = 3.14159
a,b,x = list(map(int,input().split()))
x /= a
if x >= a*b/2:
print((math.atan(2/(a**2)*(a*b-x))/p*180))
else:
print((90-(math.atan((2*x/b**2))/p*180))) | 7 | 8 | 180 | 181 | import math
a, b, x = list(map(int, input().split()))
x /= a
if x >= a * b / 2:
print((math.atan(2 / (a**2) * (a * b - x)) / math.pi * 180))
else:
print((90 - (math.atan((2 * x / b**2)) / math.pi * 180)))
| import math
p = 3.14159
a, b, x = list(map(int, input().split()))
x /= a
if x >= a * b / 2:
print((math.atan(2 / (a**2) * (a * b - x)) / p * 180))
else:
print((90 - (math.atan((2 * x / b**2)) / p * 180)))
| false | 12.5 | [
"+p = 3.14159",
"- print((math.atan(2 / (a**2) * (a * b - x)) / math.pi * 180))",
"+ print((math.atan(2 / (a**2) * (a * b - x)) / p * 180))",
"- print((90 - (math.atan((2 * x / b**2)) / math.pi * 180)))",
"+ print((90 - (math.atan((2 * x / b**2)) / p * 180)))"
] | false | 0.090012 | 0.040839 | 2.204082 | [
"s158334537",
"s359113463"
] |
u779293207 | p03456 | python | s118368092 | s369513811 | 83 | 18 | 2,940 | 2,940 | Accepted | Accepted | 78.31 | a,b=list(map(int,input().split()))
for i in range (1,100100):
if 1<=b<=9:
if 10*a+b==i**2:
print('Yes')
exit()
if 10<=b<=99:
if 100*a+b==i**2:
print('Yes')
exit()
if b==100:
if 1000*a+b==i**2:
print('Yes')
exit()
print('No')
| a,b=input().split()
c=a+b
for i in range(1,1000):
if int(c)==i**2:
print('Yes')
exit()
print('No') | 17 | 7 | 294 | 114 | a, b = list(map(int, input().split()))
for i in range(1, 100100):
if 1 <= b <= 9:
if 10 * a + b == i**2:
print("Yes")
exit()
if 10 <= b <= 99:
if 100 * a + b == i**2:
print("Yes")
exit()
if b == 100:
if 1000 * a + b == i**2:
... | a, b = input().split()
c = a + b
for i in range(1, 1000):
if int(c) == i**2:
print("Yes")
exit()
print("No")
| false | 58.823529 | [
"-a, b = list(map(int, input().split()))",
"-for i in range(1, 100100):",
"- if 1 <= b <= 9:",
"- if 10 * a + b == i**2:",
"- print(\"Yes\")",
"- exit()",
"- if 10 <= b <= 99:",
"- if 100 * a + b == i**2:",
"- print(\"Yes\")",
"- exit... | false | 0.143109 | 0.036541 | 3.91635 | [
"s118368092",
"s369513811"
] |
u077291787 | p04040 | python | s006720902 | s284472014 | 1,552 | 198 | 10,868 | 18,804 | Accepted | Accepted | 87.24 | """
fast way to compute a combination using inverse factorials
O(N) to construct tables -> O(1) to compute each combination
"""
def get_factorials(limit: int, MOD: int) -> list:
"""Compute a mod table of factorials (1-indexed)."""
factorials = [0] * (limit + 1)
factorials[0] = 1
x = 1
f... | """
fast way to compute a combination using inverse factorials
O(N) to construct tables -> O(1) to compute each combination
"""
def get_fact_and_inv(limit: int, MOD: int) -> tuple:
"""Compute mod tables of factorials and inverse factorials (1-indexed)."""
factorials = [0] * (limit + 1)
factorials... | 36 | 43 | 1,077 | 1,345 | """
fast way to compute a combination using inverse factorials
O(N) to construct tables -> O(1) to compute each combination
"""
def get_factorials(limit: int, MOD: int) -> list:
"""Compute a mod table of factorials (1-indexed)."""
factorials = [0] * (limit + 1)
factorials[0] = 1
x = 1
for i in ran... | """
fast way to compute a combination using inverse factorials
O(N) to construct tables -> O(1) to compute each combination
"""
def get_fact_and_inv(limit: int, MOD: int) -> tuple:
"""Compute mod tables of factorials and inverse factorials (1-indexed)."""
factorials = [0] * (limit + 1)
factorials[0] = 1
... | false | 16.27907 | [
"-def get_factorials(limit: int, MOD: int) -> list:",
"- \"\"\"Compute a mod table of factorials (1-indexed).\"\"\"",
"+def get_fact_and_inv(limit: int, MOD: int) -> tuple:",
"+ \"\"\"Compute mod tables of factorials and inverse factorials (1-indexed).\"\"\"",
"- return factorials",
"+ inverse... | false | 0.274588 | 0.097349 | 2.820658 | [
"s006720902",
"s284472014"
] |
u343977188 | p02630 | python | s374949188 | s213660134 | 427 | 248 | 84,620 | 28,368 | Accepted | Accepted | 41.92 | def main():
N=int(eval(input()))
A=list(map(int,input().split()))
s=sum(A)
Q=int(eval(input()))
d=[0]*(10**5 +1)#各数字の個数
for i in A:
d[i]+=1
for i in range(Q):
B,C=list(map(int,input().split()))
s += (C-B)*d[B]
print(s)
d[C]+=d[B]
d[B]=0
if __name__ == "__main__":
... | def main():
N=int(eval(input()))
A=list(map(int,input().split()))
s=sum(A)
Q=int(eval(input()))
d=[0]*(10**5 +1)#各数字の個数
ans=[]
for i in A:
d[i]+=1
for i in range(Q):
B,C=list(map(int,input().split()))
s += (C-B)*d[B]
ans.append(s)
d[C]+=d[B]
d[B]=0
print(... | 18 | 21 | 313 | 369 | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A)
Q = int(eval(input()))
d = [0] * (10**5 + 1) # 各数字の個数
for i in A:
d[i] += 1
for i in range(Q):
B, C = list(map(int, input().split()))
s += (C - B) * d[B]
print(s)
d[C] +... | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A)
Q = int(eval(input()))
d = [0] * (10**5 + 1) # 各数字の個数
ans = []
for i in A:
d[i] += 1
for i in range(Q):
B, C = list(map(int, input().split()))
s += (C - B) * d[B]
ans.append... | false | 14.285714 | [
"+ ans = []",
"- print(s)",
"+ ans.append(s)",
"+ print((\"\\n\".join(map(str, ans))))"
] | false | 0.036263 | 0.092326 | 0.392773 | [
"s374949188",
"s213660134"
] |
u371467115 | p04044 | python | s483194133 | s062345097 | 21 | 17 | 3,060 | 3,060 | Accepted | Accepted | 19.05 | N,L=list(map(int,input().split()))
s=[eval(input()) for i in range(N)]
s=sorted(s)
print(("".join(s)))
| n,l=list(map(int,input().split()))
s=[eval(input()) for i in range(n)]
print(("".join(sorted(s))))
| 5 | 3 | 94 | 87 | N, L = list(map(int, input().split()))
s = [eval(input()) for i in range(N)]
s = sorted(s)
print(("".join(s)))
| n, l = list(map(int, input().split()))
s = [eval(input()) for i in range(n)]
print(("".join(sorted(s))))
| false | 40 | [
"-N, L = list(map(int, input().split()))",
"-s = [eval(input()) for i in range(N)]",
"-s = sorted(s)",
"-print((\"\".join(s)))",
"+n, l = list(map(int, input().split()))",
"+s = [eval(input()) for i in range(n)]",
"+print((\"\".join(sorted(s))))"
] | false | 0.070007 | 0.042455 | 1.648965 | [
"s483194133",
"s062345097"
] |
u745087332 | p03798 | python | s133399455 | s924110782 | 335 | 178 | 3,700 | 8,328 | Accepted | Accepted | 46.87 | # coding:utf-8
import sys
# from collections import Counter, defaultdict
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return eval(input())
n = II(... | # coding:utf-8
import sys
import itertools
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
n = II()
S = [c == 'o' for c in SI()]
S +... | 40 | 32 | 1,008 | 710 | # coding:utf-8
import sys
# from collections import Counter, defaultdict
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
def II():
return int(sys.stdin.readline())
def SI():
return eval(input())
n... | # coding:utf-8
import sys
import itertools
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
def II():
return int(sys.stdin.readline())
def SI():
return input()
n = II()
S = [c == "o" for c in SI()]... | false | 20 | [
"+import itertools",
"-# from collections import Counter, defaultdict",
"- return eval(input())",
"+ return input()",
"-s = SI()",
"-s = s[-1] + s + s[0]",
"-P = (\"00\", \"01\", \"10\", \"11\") # 0: S, 1: W",
"-for p in P:",
"- for i in range(1, n):",
"- # print(i, p[-1], s[i])",... | false | 0.044868 | 0.083983 | 0.534251 | [
"s133399455",
"s924110782"
] |
u278296307 | p02707 | python | s068182813 | s551999733 | 308 | 156 | 50,560 | 24,512 | Accepted | Accepted | 49.35 | n = int(eval(input()))
a_list = list(map(int, input().split()))
nl = {str(i):0 for i in range(n)}
for a in a_list:
nl[str(a-1)] += 1
for v in list(nl.values()):
print(("{}".format(v))) | n = int(eval(input()))
a_list = list(map(int, input().split()))
nl = [0] * n
for a in a_list:
nl[a-1] += 1
for v in nl:
print(("{}".format(v))) | 7 | 7 | 178 | 143 | n = int(eval(input()))
a_list = list(map(int, input().split()))
nl = {str(i): 0 for i in range(n)}
for a in a_list:
nl[str(a - 1)] += 1
for v in list(nl.values()):
print(("{}".format(v)))
| n = int(eval(input()))
a_list = list(map(int, input().split()))
nl = [0] * n
for a in a_list:
nl[a - 1] += 1
for v in nl:
print(("{}".format(v)))
| false | 0 | [
"-nl = {str(i): 0 for i in range(n)}",
"+nl = [0] * n",
"- nl[str(a - 1)] += 1",
"-for v in list(nl.values()):",
"+ nl[a - 1] += 1",
"+for v in nl:"
] | false | 0.043296 | 0.034516 | 1.254357 | [
"s068182813",
"s551999733"
] |
u562935282 | p03241 | python | s061176138 | s169546224 | 26 | 24 | 3,060 | 3,064 | Accepted | Accepted | 7.69 | from bisect import bisect_left
n, m = list(map(int, input().split()))
st = set()
i = 1
while i * i <= m:
if m % i == 0:
st.add(i)
st.add(m // i)
i += 1
divs = tuple(sorted(st))
i = bisect_left(divs, n)
print((m // divs[i]))
| def main():
N, M = list(map(int, input().split()))
st = {1, M}
d = 2
while d * d <= M:
if M % d == 0:
st.add(d)
st.add(M // d)
d += 1
ans = 1
for d in st:
if d >= N:
e = M // d
ans = max(ans, e)
print(a... | 15 | 21 | 257 | 362 | from bisect import bisect_left
n, m = list(map(int, input().split()))
st = set()
i = 1
while i * i <= m:
if m % i == 0:
st.add(i)
st.add(m // i)
i += 1
divs = tuple(sorted(st))
i = bisect_left(divs, n)
print((m // divs[i]))
| def main():
N, M = list(map(int, input().split()))
st = {1, M}
d = 2
while d * d <= M:
if M % d == 0:
st.add(d)
st.add(M // d)
d += 1
ans = 1
for d in st:
if d >= N:
e = M // d
ans = max(ans, e)
print(ans)
if __name__ ... | false | 28.571429 | [
"-from bisect import bisect_left",
"+def main():",
"+ N, M = list(map(int, input().split()))",
"+ st = {1, M}",
"+ d = 2",
"+ while d * d <= M:",
"+ if M % d == 0:",
"+ st.add(d)",
"+ st.add(M // d)",
"+ d += 1",
"+ ans = 1",
"+ for d in st... | false | 0.062436 | 0.12466 | 0.500852 | [
"s061176138",
"s169546224"
] |
u288948615 | p03125 | python | s249740756 | s283935879 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | A, B = list(map(int, input().split()))
if B % A == 0:
print((A+B))
else:
print((B-A)) | A, B = list(map(int, input().split()))
print((B+A if B%A == 0 else B-A)) | 6 | 2 | 89 | 65 | A, B = list(map(int, input().split()))
if B % A == 0:
print((A + B))
else:
print((B - A))
| A, B = list(map(int, input().split()))
print((B + A if B % A == 0 else B - A))
| false | 66.666667 | [
"-if B % A == 0:",
"- print((A + B))",
"-else:",
"- print((B - A))",
"+print((B + A if B % A == 0 else B - A))"
] | false | 0.042983 | 0.043649 | 0.984747 | [
"s249740756",
"s283935879"
] |
u379562612 | p02767 | python | s130289096 | s496247303 | 22 | 17 | 3,064 | 3,060 | Accepted | Accepted | 22.73 | import sys
l = sys.stdin.readline().strip()
N = int(l)
l = sys.stdin.readline().strip()
nums = list(map(int, l.split()))
nums = sorted(nums)
start = nums[0]
end = nums[-1] + 1
mi = float("INF")
def compute_dist(p):
dist = 0
for n in nums:
dist += (n-p) ** 2
return dist
for i in range(start, end)... | import sys
l = sys.stdin.readline().strip()
N = int(l)
l = sys.stdin.readline().strip()
nums = list(map(int, l.split()))
a = sum(nums) / len(nums)
a1 = int(a)
a2 = int(a) + 1
def count(p):
d = 0
for n in nums:
d += (n-p)**2
return d
print((min(count(a1), count(a2))))
| 19 | 14 | 375 | 299 | import sys
l = sys.stdin.readline().strip()
N = int(l)
l = sys.stdin.readline().strip()
nums = list(map(int, l.split()))
nums = sorted(nums)
start = nums[0]
end = nums[-1] + 1
mi = float("INF")
def compute_dist(p):
dist = 0
for n in nums:
dist += (n - p) ** 2
return dist
for i in range(start, e... | import sys
l = sys.stdin.readline().strip()
N = int(l)
l = sys.stdin.readline().strip()
nums = list(map(int, l.split()))
a = sum(nums) / len(nums)
a1 = int(a)
a2 = int(a) + 1
def count(p):
d = 0
for n in nums:
d += (n - p) ** 2
return d
print((min(count(a1), count(a2))))
| false | 26.315789 | [
"-nums = sorted(nums)",
"-start = nums[0]",
"-end = nums[-1] + 1",
"-mi = float(\"INF\")",
"+a = sum(nums) / len(nums)",
"+a1 = int(a)",
"+a2 = int(a) + 1",
"-def compute_dist(p):",
"- dist = 0",
"+def count(p):",
"+ d = 0",
"- dist += (n - p) ** 2",
"- return dist",
"+ ... | false | 0.037436 | 0.03601 | 1.039595 | [
"s130289096",
"s496247303"
] |
u440566786 | p02868 | python | s831023982 | s884583238 | 1,896 | 1,678 | 294,108 | 277,268 | Accepted | Accepted | 11.5 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from heapq import heappop, heappush
def resolve():
n, m = list(map(int, input().split()))
N = 1 << (n - 1).bit_length()
N2, now = N << 1, N << 2
E = [[] for _ in ... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from heapq import heappop, heappush
def resolve():
n, m = list(map(int, input().split()))
N = 1 << (n - 1).bit_length()
N2, now = N * 2, N * 3
E = [[] for _ in ra... | 70 | 69 | 1,863 | 1,872 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
from heapq import heappop, heappush
def resolve():
n, m = list(map(int, input().split()))
N = 1 << (n - 1).bit_length()
N2, now = N << 1, N << 2
E = [[] for _ in range... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
from heapq import heappop, heappush
def resolve():
n, m = list(map(int, input().split()))
N = 1 << (n - 1).bit_length()
N2, now = N * 2, N * 3
E = [[] for _ in range(N... | false | 1.428571 | [
"- N2, now = N << 1, N << 2",
"- E = [[] for _ in range((N << 2) + (m << 1))]",
"+ N2, now = N * 2, N * 3",
"+ E = [[] for _ in range(N * 3 + m * 2)]",
"+ ref = lambda v: v if v < 3 * N else v - N2",
"- for i in range(N, N2):",
"- E[i].append((i + N2, 0))",
"- E[cl + N2... | false | 0.040531 | 0.040845 | 0.992313 | [
"s831023982",
"s884583238"
] |
u623814058 | p02707 | python | s956580532 | s924858225 | 320 | 183 | 32,156 | 32,184 | Accepted | Accepted | 42.81 | N=int(eval(input()))
*A,=sorted(map(int,input().split()))
import bisect
for i in range(1,N+1):
print((bisect.bisect_right(A,i)-bisect.bisect_left(A,i))) | N=int(eval(input()))
*A,=sorted(map(int,input().split()))
s=[0]*N
for i in A:
s[i-1]+=1
for t in s:
print(t) | 7 | 8 | 156 | 118 | N = int(eval(input()))
(*A,) = sorted(map(int, input().split()))
import bisect
for i in range(1, N + 1):
print((bisect.bisect_right(A, i) - bisect.bisect_left(A, i)))
| N = int(eval(input()))
(*A,) = sorted(map(int, input().split()))
s = [0] * N
for i in A:
s[i - 1] += 1
for t in s:
print(t)
| false | 12.5 | [
"-import bisect",
"-",
"-for i in range(1, N + 1):",
"- print((bisect.bisect_right(A, i) - bisect.bisect_left(A, i)))",
"+s = [0] * N",
"+for i in A:",
"+ s[i - 1] += 1",
"+for t in s:",
"+ print(t)"
] | false | 0.044031 | 0.04734 | 0.930108 | [
"s956580532",
"s924858225"
] |
u546338822 | p02732 | python | s182919107 | s722139573 | 470 | 269 | 24,748 | 33,256 | Accepted | Accepted | 42.77 | def main():
n = int(eval(input()))
a = list(map(int,input().split()))
import collections
c =collections.Counter(a)
ans = 0
for k in list(c.keys()):
ans += c[k]*(c[k]-1)//2
for i in range(n):
draw = c[a[i]]*(c[a[i]]-1)//2-(c[a[i]]-1)*(c[a[i]]-2)//2
print((ans... | def main():
n = int(eval(input()))
a = list(map(int,input().split()))
d = {}
for i in range(n):
if d.get(a[i]) == None:
d[a[i]] = 1
else:
d[a[i]] += 1
ans = 0
for k in list(d.keys()):
ans += d[k] * (d[k]-1) //2
for i in range(n):
... | 14 | 17 | 355 | 428 | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
import collections
c = collections.Counter(a)
ans = 0
for k in list(c.keys()):
ans += c[k] * (c[k] - 1) // 2
for i in range(n):
draw = c[a[i]] * (c[a[i]] - 1) // 2 - (c[a[i]] - 1) * (c[a[i]] - 2) // 2
... | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in range(n):
if d.get(a[i]) == None:
d[a[i]] = 1
else:
d[a[i]] += 1
ans = 0
for k in list(d.keys()):
ans += d[k] * (d[k] - 1) // 2
for i in range(n):
pr... | false | 17.647059 | [
"- import collections",
"-",
"- c = collections.Counter(a)",
"+ d = {}",
"+ for i in range(n):",
"+ if d.get(a[i]) == None:",
"+ d[a[i]] = 1",
"+ else:",
"+ d[a[i]] += 1",
"- for k in list(c.keys()):",
"- ans += c[k] * (c[k] - 1) // 2",
... | false | 0.040966 | 0.115927 | 0.353378 | [
"s182919107",
"s722139573"
] |
u928784113 | p03162 | python | s893165283 | s570329736 | 653 | 450 | 49,576 | 95,320 | Accepted | Accepted | 31.09 | import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
inp... | import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
inp... | 81 | 81 | 2,106 | 2,106 | import itertools
from collections import deque, defaultdict, Counter
from itertools import accumulate
import bisect
from heapq import heappop, heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
# import numpy as np
# import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
input = s... | import itertools
from collections import deque, defaultdict, Counter
from itertools import accumulate
import bisect
from heapq import heappop, heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
# import numpy as np
# import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
input = s... | false | 0 | [
"- dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + abc[i][k])",
"+ dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + abc[i][j])"
] | false | 0.07654 | 0.093016 | 0.822863 | [
"s893165283",
"s570329736"
] |
u095021077 | p03044 | python | s747207315 | s661105651 | 1,068 | 732 | 98,476 | 84,428 | Accepted | Accepted | 31.46 | import sys
sys.setrecursionlimit(10**5+1)
N=int(eval(input()))
uvw=[list(map(int, input().split())) for i in range(N-1)]
nodelink=[[] for i in range(N+1)]
for i in range(N-1):
nodelink[uvw[i][0]].append([uvw[i][1], uvw[i][2]])
nodelink[uvw[i][1]].append([uvw[i][0], uvw[i][2]])
color=[-1]*(N+1)
def ... | import sys
sys.setrecursionlimit(10**5)
def f(x):
for tmp in links[x]:
if c[tmp[0]]<0:
if tmp[1]%2==0:
c[tmp[0]]=c[x]+0
else:
c[tmp[0]]=1-c[x]
f(tmp[0])
N=int(input())
links=[[] for _ in range(N+1)]
for _ in range(N-1):
u, v, w=map(int, input().split())
link... | 26 | 24 | 584 | 425 | import sys
sys.setrecursionlimit(10**5 + 1)
N = int(eval(input()))
uvw = [list(map(int, input().split())) for i in range(N - 1)]
nodelink = [[] for i in range(N + 1)]
for i in range(N - 1):
nodelink[uvw[i][0]].append([uvw[i][1], uvw[i][2]])
nodelink[uvw[i][1]].append([uvw[i][0], uvw[i][2]])
color = [-1] * (N +... | import sys
sys.setrecursionlimit(10**5)
def f(x):
for tmp in links[x]:
if c[tmp[0]] < 0:
if tmp[1] % 2 == 0:
c[tmp[0]] = c[x] + 0
else:
c[tmp[0]] = 1 - c[x]
f(tmp[0])
N = int(input())
links = [[] for _ in range(N + 1)]
for _ in range(N... | false | 7.692308 | [
"-sys.setrecursionlimit(10**5 + 1)",
"-N = int(eval(input()))",
"-uvw = [list(map(int, input().split())) for i in range(N - 1)]",
"-nodelink = [[] for i in range(N + 1)]",
"-for i in range(N - 1):",
"- nodelink[uvw[i][0]].append([uvw[i][1], uvw[i][2]])",
"- nodelink[uvw[i][1]].append([uvw[i][0], u... | false | 0.037359 | 0.035825 | 1.042843 | [
"s747207315",
"s661105651"
] |
u531768068 | p03198 | python | s189573461 | s805887478 | 1,763 | 424 | 34,248 | 101,532 | Accepted | Accepted | 75.95 | #
import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)
def getIntList():
return list(map(int, input().split()))
try :
#raise ModuleNotFoundError
import numpy
def dprint(*args, **kwargs):
#print(*args, **kwargs, file=sys.stderr)
# in python... | #
import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)
def getIntList():
return list(map(int, input().split()))
try :
#raise ModuleNotFoundError
import numpy
def dprint(*args, **kwargs):
#print(*args, **kwargs, file=sys.stderr)
# in python... | 100 | 100 | 2,294 | 2,307 | #
import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)
def getIntList():
return list(map(int, input().split()))
try:
# raise ModuleNotFoundError
import numpy
def dprint(*args, **kwargs):
# print(*args, **kwargs, file=sys.stderr)
# in python 3.4 **kwargs is i... | #
import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)
def getIntList():
return list(map(int, input().split()))
try:
# raise ModuleNotFoundError
import numpy
def dprint(*args, **kwargs):
# print(*args, **kwargs, file=sys.stderr)
# in python 3.4 **kwargs is i... | false | 0 | [
"- N = 1000",
"+ N = 100",
"+ dprint(st)"
] | false | 0.066012 | 0.047789 | 1.381335 | [
"s189573461",
"s805887478"
] |
u684120680 | p02984 | python | s030127985 | s909366694 | 143 | 98 | 14,092 | 14,092 | Accepted | Accepted | 31.47 | def main():
n, *a = list(map(int, open(0).read().split()))
b = [sum([cur_a * (-1) ** in_i for in_i, cur_a in enumerate(a)])]
for cur_a in a[:-1]:
b.append((cur_a - b[-1] // 2) * 2)
ans = b
print((*ans))
return()
if __name__ == '__main__':
main()
| def main():
n, *a = list(map(int, open(0).read().split()))
# b[0] == a[0] - a[1] + a[2] - a[3] + ...
b = [sum(a) - 2 * sum(a[1::2])]
for cur_a in a[:-1]:
b.append(cur_a * 2 - b[-1])
ans = b
print((*ans))
return()
if __name__ == '__main__':
main()
| 14 | 15 | 291 | 297 | def main():
n, *a = list(map(int, open(0).read().split()))
b = [sum([cur_a * (-1) ** in_i for in_i, cur_a in enumerate(a)])]
for cur_a in a[:-1]:
b.append((cur_a - b[-1] // 2) * 2)
ans = b
print((*ans))
return ()
if __name__ == "__main__":
main()
| def main():
n, *a = list(map(int, open(0).read().split()))
# b[0] == a[0] - a[1] + a[2] - a[3] + ...
b = [sum(a) - 2 * sum(a[1::2])]
for cur_a in a[:-1]:
b.append(cur_a * 2 - b[-1])
ans = b
print((*ans))
return ()
if __name__ == "__main__":
main()
| false | 6.666667 | [
"- b = [sum([cur_a * (-1) ** in_i for in_i, cur_a in enumerate(a)])]",
"+ # b[0] == a[0] - a[1] + a[2] - a[3] + ...",
"+ b = [sum(a) - 2 * sum(a[1::2])]",
"- b.append((cur_a - b[-1] // 2) * 2)",
"+ b.append(cur_a * 2 - b[-1])"
] | false | 0.044939 | 0.046151 | 0.973734 | [
"s030127985",
"s909366694"
] |
u664373116 | p03614 | python | s467243182 | s606318308 | 74 | 68 | 14,008 | 14,008 | Accepted | Accepted | 8.11 | n=int(eval(input()))
a=list(map(int,input().split()))
f=[True if a[i]==i+1 else False for i in range(n)]
ans=0
for i in range(n-1):
if f[i] and f[i+1]:
f[i]=False
f[i+1]=False
ans+=1
ans+=sum(f)
print(ans) | n=int(eval(input()))
a=list(map(int,input().split()))
f=[True if a[i]==i+1 else False for i in range(n)]
ans=0
for i in range(n-1):
if f[i]:
f[i]=False
f[i+1]=False
ans+=1
if f[n-1]:
ans+=1
print(ans) | 12 | 13 | 239 | 239 | n = int(eval(input()))
a = list(map(int, input().split()))
f = [True if a[i] == i + 1 else False for i in range(n)]
ans = 0
for i in range(n - 1):
if f[i] and f[i + 1]:
f[i] = False
f[i + 1] = False
ans += 1
ans += sum(f)
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
f = [True if a[i] == i + 1 else False for i in range(n)]
ans = 0
for i in range(n - 1):
if f[i]:
f[i] = False
f[i + 1] = False
ans += 1
if f[n - 1]:
ans += 1
print(ans)
| false | 7.692308 | [
"- if f[i] and f[i + 1]:",
"+ if f[i]:",
"-ans += sum(f)",
"+if f[n - 1]:",
"+ ans += 1"
] | false | 0.048256 | 0.044788 | 1.077418 | [
"s467243182",
"s606318308"
] |
u885634168 | p03805 | python | s278074708 | s839337572 | 230 | 80 | 45,020 | 68,112 | Accepted | Accepted | 65.22 | N, M = list(map(int,input().split()))
graph = [[-1 for i in range(N)] for i in range(N)]
for i in range(M):
a, b = list(map(int,input().split()))
graph[a - 1][b - 1] = 1
graph[b - 1][a - 1] = 1
def dfs(node, depth):
global visited
global ans
if depth == N - 1:
if sum(visi... | N, M = list(map(int,input().split()))
G = [[] for _ in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
def dfs(depth, node):
global visited
global ans
visited[node] = 1
if depth == N - 1:
if sum(visited) =... | 27 | 23 | 637 | 534 | N, M = list(map(int, input().split()))
graph = [[-1 for i in range(N)] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
graph[a - 1][b - 1] = 1
graph[b - 1][a - 1] = 1
def dfs(node, depth):
global visited
global ans
if depth == N - 1:
if sum(visited) == N:
... | N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
def dfs(depth, node):
global visited
global ans
visited[node] = 1
if depth == N - 1:
if sum(visited) == N:
... | false | 14.814815 | [
"-graph = [[-1 for i in range(N)] for i in range(N)]",
"+G = [[] for _ in range(N)]",
"- graph[a - 1][b - 1] = 1",
"- graph[b - 1][a - 1] = 1",
"+ G[a - 1].append(b - 1)",
"+ G[b - 1].append(a - 1)",
"-def dfs(node, depth):",
"+def dfs(depth, node):",
"+ visited[node] = 1",
"- fo... | false | 0.047298 | 0.068168 | 0.693842 | [
"s278074708",
"s839337572"
] |
u063052907 | p03379 | python | s927834445 | s614509774 | 417 | 288 | 93,780 | 26,016 | Accepted | Accepted | 30.94 | n = int(eval(input()))
lst_x = list(map(int, input().split()))
lst = lst_x[:]
lst.sort()
b1 = lst[n//2 - 1]
b2 = lst[n//2]
for x in lst_x:
if x <= b1:
ans = b2
else:
ans = b1
print(ans) | n = int(eval(input()))
lst_x = list(map(int, input().split()))
lst = lst_x[:]
lst.sort()
b1 = lst[n//2 - 1]
b2 = lst[n//2]
for x in lst_x:
print((b2 if x <= b1 else b1))
| 14 | 10 | 222 | 177 | n = int(eval(input()))
lst_x = list(map(int, input().split()))
lst = lst_x[:]
lst.sort()
b1 = lst[n // 2 - 1]
b2 = lst[n // 2]
for x in lst_x:
if x <= b1:
ans = b2
else:
ans = b1
print(ans)
| n = int(eval(input()))
lst_x = list(map(int, input().split()))
lst = lst_x[:]
lst.sort()
b1 = lst[n // 2 - 1]
b2 = lst[n // 2]
for x in lst_x:
print((b2 if x <= b1 else b1))
| false | 28.571429 | [
"- if x <= b1:",
"- ans = b2",
"- else:",
"- ans = b1",
"- print(ans)",
"+ print((b2 if x <= b1 else b1))"
] | false | 0.039422 | 0.037449 | 1.052673 | [
"s927834445",
"s614509774"
] |
u899308536 | p02846 | python | s600143566 | s281422610 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | T1,T2,A1,A2,B1,B2=list(map(int, open(0).read().split()))
D1,D2 = (A1-B1)*T1, (A1-B1)*T1+(A2-B2)*T2
if D1*D2 > 0: print((0))
elif D2 == 0: print("infinity")
elif -D1%D2 == 0: print((-D1//D2*2))
else: print((-D1//D2*2+1)) | T1,T2,A1,A2,B1,B2 = list(map(int, open(0).read().split()))
D1,D2 = (A1-B1)*T1, (A1-B1)*T1+(A2-B2)*T2
if D1*D2 > 0: print((0))
elif D2 == 0: print("infinity")
else: print((-D1//D2*2+1 - (-D1%D2 == 0))) | 6 | 5 | 232 | 202 | T1, T2, A1, A2, B1, B2 = list(map(int, open(0).read().split()))
D1, D2 = (A1 - B1) * T1, (A1 - B1) * T1 + (A2 - B2) * T2
if D1 * D2 > 0:
print((0))
elif D2 == 0:
print("infinity")
elif -D1 % D2 == 0:
print((-D1 // D2 * 2))
else:
print((-D1 // D2 * 2 + 1))
| T1, T2, A1, A2, B1, B2 = list(map(int, open(0).read().split()))
D1, D2 = (A1 - B1) * T1, (A1 - B1) * T1 + (A2 - B2) * T2
if D1 * D2 > 0:
print((0))
elif D2 == 0:
print("infinity")
else:
print((-D1 // D2 * 2 + 1 - (-D1 % D2 == 0)))
| false | 16.666667 | [
"-elif -D1 % D2 == 0:",
"- print((-D1 // D2 * 2))",
"- print((-D1 // D2 * 2 + 1))",
"+ print((-D1 // D2 * 2 + 1 - (-D1 % D2 == 0)))"
] | false | 0.040905 | 0.050219 | 0.814546 | [
"s600143566",
"s281422610"
] |
u167647458 | p02719 | python | s546953417 | s170622619 | 24 | 22 | 9,124 | 9,036 | Accepted | Accepted | 8.33 | n, k = list(map(int, input().split()))
def solve():
global n, k
n = n - (k * (n // k))
pre = n
while True:
n = min(n, abs(n-k))
if n == pre:
break
pre = n
return n
print((solve())) | n, k = list(map(int, input().split()))
n = n % k
print((min(abs(n - k), n))) | 14 | 4 | 243 | 72 | n, k = list(map(int, input().split()))
def solve():
global n, k
n = n - (k * (n // k))
pre = n
while True:
n = min(n, abs(n - k))
if n == pre:
break
pre = n
return n
print((solve()))
| n, k = list(map(int, input().split()))
n = n % k
print((min(abs(n - k), n)))
| false | 71.428571 | [
"-",
"-",
"-def solve():",
"- global n, k",
"- n = n - (k * (n // k))",
"- pre = n",
"- while True:",
"- n = min(n, abs(n - k))",
"- if n == pre:",
"- break",
"- pre = n",
"- return n",
"-",
"-",
"-print((solve()))",
"+n = n % k",
"+prin... | false | 0.069623 | 0.066768 | 1.04276 | [
"s546953417",
"s170622619"
] |
u017810624 | p02642 | python | s989241758 | s631316583 | 807 | 298 | 167,432 | 173,916 | Accepted | Accepted | 63.07 | n=int(eval(input()))
a=list(map(int,input().split()))
if n!=1 and len(set(a))==1:
print((0))
exit()
l=[0 for i in range(10**6+1)]
for i in range(n):
l[a[i]]+=1
if n!=1 and min(a)>max(a)/2:
ct=0
for i in range(len(l)):
if l[i]==1:
ct+=1
print(ct)
exit()
d={}
ans=0
for i in range(... | n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
ct=[0 for i in range(10**6+1)]
check=[0 for i in range(10**6+1)]
dp=[1 for i in range(10**6+1)]
for i in range(n):
ct[a[i]]+=1
if check[a[i]]==0:
check[a[i]]=1
for j in range(2,10**6+1):
if a[i]*j<=10**6:
dp[a[i]*j]=0
... | 38 | 20 | 715 | 426 | n = int(eval(input()))
a = list(map(int, input().split()))
if n != 1 and len(set(a)) == 1:
print((0))
exit()
l = [0 for i in range(10**6 + 1)]
for i in range(n):
l[a[i]] += 1
if n != 1 and min(a) > max(a) / 2:
ct = 0
for i in range(len(l)):
if l[i] == 1:
ct += 1
print(ct)
... | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
ct = [0 for i in range(10**6 + 1)]
check = [0 for i in range(10**6 + 1)]
dp = [1 for i in range(10**6 + 1)]
for i in range(n):
ct[a[i]] += 1
if check[a[i]] == 0:
check[a[i]] = 1
for j in range(2, 10**6 + 1):
if a[i] ... | false | 47.368421 | [
"-if n != 1 and len(set(a)) == 1:",
"- print((0))",
"- exit()",
"-l = [0 for i in range(10**6 + 1)]",
"+a.sort()",
"+ct = [0 for i in range(10**6 + 1)]",
"+check = [0 for i in range(10**6 + 1)]",
"+dp = [1 for i in range(10**6 + 1)]",
"- l[a[i]] += 1",
"-if n != 1 and min(a) > max(a) / 2:... | false | 0.090513 | 1.758057 | 0.051485 | [
"s989241758",
"s631316583"
] |
u827202523 | p02691 | python | s197307594 | s694164922 | 296 | 240 | 131,448 | 120,836 | Accepted | Accepted | 18.92 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
from collections import defaultdict, Counter
from sys import exit
import math
def main():
n = getN()
nums = getList()
den = [num - i f... | import sys
from collections import defaultdict, deque
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: li... | 27 | 70 | 608 | 1,351 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
from collections import defaultdict, Counter
from sys import exit
import math
def main():
n = getN()
nums = getList()
den = [num - i for i, num ... | import sys
from collections import defaultdict, deque
import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int, input... | false | 61.428571 | [
"-def getN():",
"- return int(eval(input()))",
"+import sys",
"+from collections import defaultdict, deque",
"+import math",
"+",
"+# import copy",
"+from bisect import bisect_left, bisect_right",
"+",
"+# import heapq",
"+# sys.setrecursionlimit(1000000)",
"+# input aliases",
"+input = s... | false | 0.048158 | 0.048213 | 0.998855 | [
"s197307594",
"s694164922"
] |
u332657092 | p03060 | python | s300278333 | s661397025 | 705 | 165 | 41,256 | 38,384 | Accepted | Accepted | 76.6 | n = int(eval(input()))
V = list(map(int, input().split()))
C = list(map(int, input().split()))
from itertools import product
max_total = 0
for lis in product((0, 1), repeat=n):
total = 0
for i, zero_one in enumerate(lis):
total += (V[i]-C[i]) * zero_one
max_total = max(max_total, total)
print(max_to... | n = int(eval(input()))
V = list(map(int, input().split()))
C = list(map(int, input().split()))
total = 0
for i in range(n):
if V[i] - C[i] > 0:
total += V[i] - C[i]
print(total) | 11 | 8 | 318 | 184 | n = int(eval(input()))
V = list(map(int, input().split()))
C = list(map(int, input().split()))
from itertools import product
max_total = 0
for lis in product((0, 1), repeat=n):
total = 0
for i, zero_one in enumerate(lis):
total += (V[i] - C[i]) * zero_one
max_total = max(max_total, total)
print(max... | n = int(eval(input()))
V = list(map(int, input().split()))
C = list(map(int, input().split()))
total = 0
for i in range(n):
if V[i] - C[i] > 0:
total += V[i] - C[i]
print(total)
| false | 27.272727 | [
"-from itertools import product",
"-",
"-max_total = 0",
"-for lis in product((0, 1), repeat=n):",
"- total = 0",
"- for i, zero_one in enumerate(lis):",
"- total += (V[i] - C[i]) * zero_one",
"- max_total = max(max_total, total)",
"-print(max_total)",
"+total = 0",
"+for i in ra... | false | 0.16437 | 0.038263 | 4.295847 | [
"s300278333",
"s661397025"
] |
u585482323 | p02834 | python | s327697112 | s420264705 | 722 | 502 | 121,248 | 67,820 | Accepted | Accepted | 30.47 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | 96 | 73 | 2,342 | 1,652 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | false | 23.958333 | [
"- def lca(x, y):",
"- k = depth[x] - depth[y]",
"- while k > 0:",
"- x = par[x][int(math.log(k, 2))]",
"- k = depth[x] - depth[y]",
"- k = -k",
"- while k > 0:",
"- y = par[y][int(math.log(k, 2))]",
"- k = depth[y] - depth[x... | false | 0.061701 | 0.053582 | 1.151523 | [
"s327697112",
"s420264705"
] |
u832039789 | p03210 | python | s102281346 | s431162085 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | x = int(eval(input()))
if x in (7,5,3):
print('YES')
else:
print('NO')
| n = int(eval(input()))
if n in (7, 5, 3):
print('YES')
else:
print('NO')
| 5 | 5 | 77 | 79 | x = int(eval(input()))
if x in (7, 5, 3):
print("YES")
else:
print("NO")
| n = int(eval(input()))
if n in (7, 5, 3):
print("YES")
else:
print("NO")
| false | 0 | [
"-x = int(eval(input()))",
"-if x in (7, 5, 3):",
"+n = int(eval(input()))",
"+if n in (7, 5, 3):"
] | false | 0.05011 | 0.049936 | 1.003487 | [
"s102281346",
"s431162085"
] |
u127499732 | p02727 | python | s019301298 | s381689378 | 402 | 265 | 31,648 | 25,536 | Accepted | Accepted | 34.08 | def main():
import sys
import numpy as np
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, sys.stdin.readline().split()))
q = list(map(int, sys.stdin.readline().split()))
r = list(map(int, sys.stdin.readline().split()))
p = sorted(p,reverse=True)
q = sorted(q... | def main():
s = open(0).readlines()
x, y, a, b, c = list(map(int, s[0].split()))
f = lambda x: list(map(int, x.split()))
p, q, r = list(map(f, s[1:]))
p = sorted(p, reverse=True)
q = sorted(q, reverse=True)
r = sorted(r, reverse=True)
p = p[:x]
q = q[:y]
i = m... | 33 | 31 | 685 | 591 | def main():
import sys
import numpy as np
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, sys.stdin.readline().split()))
q = list(map(int, sys.stdin.readline().split()))
r = list(map(int, sys.stdin.readline().split()))
p = sorted(p, reverse=True)
q = sorted(q, reverse=... | def main():
s = open(0).readlines()
x, y, a, b, c = list(map(int, s[0].split()))
f = lambda x: list(map(int, x.split()))
p, q, r = list(map(f, s[1:]))
p = sorted(p, reverse=True)
q = sorted(q, reverse=True)
r = sorted(r, reverse=True)
p = p[:x]
q = q[:y]
i = max(r)
j = sum(x ... | false | 6.060606 | [
"- import sys",
"- import numpy as np",
"-",
"- x, y, a, b, c = list(map(int, input().split()))",
"- p = list(map(int, sys.stdin.readline().split()))",
"- q = list(map(int, sys.stdin.readline().split()))",
"- r = list(map(int, sys.stdin.readline().split()))",
"+ s = open(0).readli... | false | 0.032249 | 0.036629 | 0.880421 | [
"s019301298",
"s381689378"
] |
u185896732 | p03212 | python | s737466622 | s163495604 | 316 | 62 | 50,268 | 3,060 | Accepted | Accepted | 80.38 | def dfs(s,num):
if int(s)>num:
return 0
if s.count('7')>0 and s.count('5')>0 and s.count('3')>0:
ret=1
else:
ret=0
for i in "753":
ret+=dfs(s+i,num)
return ret
n=int(eval(input()))
print((dfs('0',n))) | n=int(eval(input()))
def dfs(now):
if int(now)>n:
return 0
for i in "753":
if i not in now:
ret=0
break
else:
ret=1
for i in "753":
ret+=dfs(now+i)
return ret
print((dfs("0"))) | 12 | 15 | 255 | 259 | def dfs(s, num):
if int(s) > num:
return 0
if s.count("7") > 0 and s.count("5") > 0 and s.count("3") > 0:
ret = 1
else:
ret = 0
for i in "753":
ret += dfs(s + i, num)
return ret
n = int(eval(input()))
print((dfs("0", n)))
| n = int(eval(input()))
def dfs(now):
if int(now) > n:
return 0
for i in "753":
if i not in now:
ret = 0
break
else:
ret = 1
for i in "753":
ret += dfs(now + i)
return ret
print((dfs("0")))
| false | 20 | [
"-def dfs(s, num):",
"- if int(s) > num:",
"+n = int(eval(input()))",
"+",
"+",
"+def dfs(now):",
"+ if int(now) > n:",
"- if s.count(\"7\") > 0 and s.count(\"5\") > 0 and s.count(\"3\") > 0:",
"+ for i in \"753\":",
"+ if i not in now:",
"+ ret = 0",
"+ ... | false | 0.09091 | 0.084978 | 1.069796 | [
"s737466622",
"s163495604"
] |
u645250356 | p02838 | python | s989159845 | s537175333 | 1,568 | 1,085 | 127,084 | 127,084 | Accepted | Accepted | 30.8 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.rea... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.rea... | 33 | 28 | 846 | 742 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
mod2 = 998244353
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(in... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
mod2 = 998244353
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(in... | false | 15.151515 | [
"-bit = [defaultdict(int) for i in range(ln)]",
"+bit = [[0, 0] for i in range(ln)]",
"- tmp = bin(i)",
"- for _, j in enumerate(tmp[:1:-1]):",
"- # print(_,j)",
"- bit[_][j] += 1",
"-# pprint.pprint(bit)",
"+ for j in range(ln):",
"+ tmp = 0",
"+ if (i >> j) %... | false | 0.105698 | 0.037958 | 2.78463 | [
"s989159845",
"s537175333"
] |
u133347536 | p03212 | python | s405083863 | s979117487 | 737 | 92 | 28,020 | 76,056 | Accepted | Accepted | 87.52 | import math
n_in = int(eval(input()))
def sgs(n, a, s, s_temp):
if a == math.ceil(math.log(n, 10)):
c = 0
for i in s:
i_listed = list(map(int, list(str(i))))
if 3 in i_listed and 5 in i_listed and 7 in i_listed:
if i <= n:
c +=... | import collections
N = int(eval(input()))
def generate(n):
_list = []
queue = collections.deque([0])
while queue:
_temp = queue.popleft()
if _temp <= n and '3' in str(_temp) and '7' in str(_temp) and '5' in str(_temp):
_list.append(_temp)
if len(str(_temp)) >... | 29 | 21 | 732 | 513 | import math
n_in = int(eval(input()))
def sgs(n, a, s, s_temp):
if a == math.ceil(math.log(n, 10)):
c = 0
for i in s:
i_listed = list(map(int, list(str(i))))
if 3 in i_listed and 5 in i_listed and 7 in i_listed:
if i <= n:
c += 1
els... | import collections
N = int(eval(input()))
def generate(n):
_list = []
queue = collections.deque([0])
while queue:
_temp = queue.popleft()
if _temp <= n and "3" in str(_temp) and "7" in str(_temp) and "5" in str(_temp):
_list.append(_temp)
if len(str(_temp)) > 9:
... | false | 27.586207 | [
"-import math",
"+import collections",
"-n_in = int(eval(input()))",
"+N = int(eval(input()))",
"-def sgs(n, a, s, s_temp):",
"- if a == math.ceil(math.log(n, 10)):",
"- c = 0",
"- for i in s:",
"- i_listed = list(map(int, list(str(i))))",
"- if 3 in i_listed... | false | 0.215404 | 0.069821 | 3.085109 | [
"s405083863",
"s979117487"
] |
u941407962 | p03185 | python | s516937874 | s509168524 | 485 | 430 | 93,900 | 94,540 | Accepted | Accepted | 11.34 | def fi(i, x):
a, b = lines[i]
return a*x+b
def find(x):
if len(lines) == 1:
return 0
def f(i):
# 0<=i<len(lines)-1
return fi(i+1,x) > fi(i,x)
mn, mx = 0, len(lines)-2
idx = (mn+mx)//2
if f(mn):
return 0
if not f(mx):
return mx+1
... | def fi(i, x):
a, b = lines[i]
return a*x+b
def find(x):
def f(i):
return fi(i+1,x) > fi(i,x)
mn, mx = -1, len(lines)-1
idx = (mn+mx)//2
while mx-mn>1:
if f(idx):
mx, idx = idx, (mn + idx)//2
continue
mn, idx = idx, (mx + idx)//2
... | 48 | 32 | 1,041 | 745 | def fi(i, x):
a, b = lines[i]
return a * x + b
def find(x):
if len(lines) == 1:
return 0
def f(i):
# 0<=i<len(lines)-1
return fi(i + 1, x) > fi(i, x)
mn, mx = 0, len(lines) - 2
idx = (mn + mx) // 2
if f(mn):
return 0
if not f(mx):
return mx + 1... | def fi(i, x):
a, b = lines[i]
return a * x + b
def find(x):
def f(i):
return fi(i + 1, x) > fi(i, x)
mn, mx = -1, len(lines) - 1
idx = (mn + mx) // 2
while mx - mn > 1:
if f(idx):
mx, idx = idx, (mn + idx) // 2
continue
mn, idx = idx, (mx + idx)... | false | 33.333333 | [
"- if len(lines) == 1:",
"- return 0",
"-",
"- # 0<=i<len(lines)-1",
"- mn, mx = 0, len(lines) - 2",
"+ mn, mx = -1, len(lines) - 1",
"- if f(mn):",
"- return 0",
"- if not f(mx):",
"- return mx + 1",
"- return idx + 1",
"+ return fi(idx + 1, x)... | false | 0.037292 | 0.049877 | 0.747694 | [
"s516937874",
"s509168524"
] |
u600402037 | p03062 | python | s719044804 | s880901197 | 504 | 183 | 23,380 | 23,384 | Accepted | Accepted | 63.69 | import numpy as np
N = int(eval(input()))
A = np.array(list(map(int, input().split())))
A2 = np.abs(A)
x = A2.min()
s = A2.sum()
A3 = A < 0
if sum(A3) % 2 == 0:
print(s)
else:
print((s-2*x))
| import numpy as np
N = int(eval(input()))
A = np.array(list(map(int, input().split())))
A2 = np.abs(A)
x = A2.min()
s = A2.sum()
A3 = A < 0
if A3.sum() % 2 == 0:
print(s)
else:
print((s-2*x))
| 14 | 14 | 207 | 208 | import numpy as np
N = int(eval(input()))
A = np.array(list(map(int, input().split())))
A2 = np.abs(A)
x = A2.min()
s = A2.sum()
A3 = A < 0
if sum(A3) % 2 == 0:
print(s)
else:
print((s - 2 * x))
| import numpy as np
N = int(eval(input()))
A = np.array(list(map(int, input().split())))
A2 = np.abs(A)
x = A2.min()
s = A2.sum()
A3 = A < 0
if A3.sum() % 2 == 0:
print(s)
else:
print((s - 2 * x))
| false | 0 | [
"-if sum(A3) % 2 == 0:",
"+if A3.sum() % 2 == 0:"
] | false | 0.40035 | 0.628115 | 0.637384 | [
"s719044804",
"s880901197"
] |
u614314290 | p03112 | python | s751950097 | s651232044 | 1,241 | 821 | 18,336 | 42,008 | Accepted | Accepted | 33.84 | import bisect
A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
"""
def bsr(a, v, lo=0, hi=None):
if None == hi:
hi = len(a) - 1
while lo <= hi:
mi = (lo + hi) // 2
if a[mi] <= v... | # お約束
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
return int(n) - 1
def parse(args, *params):
return tuple(p(v) for p, v in zip(params, next(args).split()))
from bisect import bisect_right as bsr
# エントリーポイント
def main(args):
A, B, Q = parse(args, int, int, int)
S = list(int(next(arg... | 37 | 34 | 1,009 | 958 | import bisect
A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
"""
def bsr(a, v, lo=0, hi=None):
if None == hi:
hi = len(a) - 1
while lo <= hi:
mi = (lo + hi) // 2
if a[mi] <= v:
lo = mi... | # お約束
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
return int(n) - 1
def parse(args, *params):
return tuple(p(v) for p, v in zip(params, next(args).split()))
from bisect import bisect_right as bsr
# エントリーポイント
def main(args):
A, B, Q = parse(args, int, int, int)
S = list(int(next(args)) for ... | false | 8.108108 | [
"-import bisect",
"+# お約束",
"+INF = float(\"inf\")",
"+MOD = int(1e9 + 7)",
"-A, B, Q = list(map(int, input().split()))",
"-S = [int(eval(input())) for _ in range(A)]",
"-T = [int(eval(input())) for _ in range(B)]",
"-X = [int(eval(input())) for _ in range(Q)]",
"-\"\"\"",
"-def bsr(a, v, lo=0, hi... | false | 0.037764 | 0.091739 | 0.411646 | [
"s751950097",
"s651232044"
] |
u241159583 | p03680 | python | s739376616 | s183711020 | 210 | 165 | 7,852 | 13,780 | Accepted | Accepted | 21.43 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
A = [0]*n
i = 0
ok = False
cnt = 0
for _ in range(n):
cnt += 1
A[i] = 1
if a[i] == 2:
ok = True
break
i = a[i]-1
if A[i] == 1: break
print((cnt if ok else -1)) | n = int(eval(input()))
a = [0]+[int(eval(input())) for _ in range(n)]
check = [0] * (n+1)
now = 1
cnt = 0
while now != 2:
if check[now] == 1: break
cnt += 1
check[now] = 1
now = a[now]
print((cnt if now == 2 else -1)) | 15 | 11 | 244 | 229 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
A = [0] * n
i = 0
ok = False
cnt = 0
for _ in range(n):
cnt += 1
A[i] = 1
if a[i] == 2:
ok = True
break
i = a[i] - 1
if A[i] == 1:
break
print((cnt if ok else -1))
| n = int(eval(input()))
a = [0] + [int(eval(input())) for _ in range(n)]
check = [0] * (n + 1)
now = 1
cnt = 0
while now != 2:
if check[now] == 1:
break
cnt += 1
check[now] = 1
now = a[now]
print((cnt if now == 2 else -1))
| false | 26.666667 | [
"-a = [int(eval(input())) for _ in range(n)]",
"-A = [0] * n",
"-i = 0",
"-ok = False",
"+a = [0] + [int(eval(input())) for _ in range(n)]",
"+check = [0] * (n + 1)",
"+now = 1",
"-for _ in range(n):",
"+while now != 2:",
"+ if check[now] == 1:",
"+ break",
"- A[i] = 1",
"- i... | false | 0.036743 | 0.036418 | 1.008923 | [
"s739376616",
"s183711020"
] |
u922449550 | p02889 | python | s750340438 | s541652523 | 1,500 | 1,239 | 26,956 | 17,472 | Accepted | Accepted | 17.4 | from scipy.sparse.csgraph import floyd_warshall
import numpy as np
N, M, L = list(map(int, input().split()))
D = np.ones([N, N]) * np.inf
D[np.eye(N, dtype=bool)] = 0
for _ in range(M):
A, B, C = list(map(int, input().split()))
D[A-1, B-1] = C
D[B-1, A-1] = C
D = floyd_warshall(D)
D2 = D <= L
... | from scipy.sparse.csgraph import floyd_warshall
import numpy as np
N, M, L = list(map(int, input().split()))
D = np.ones([N, N]) * np.inf
D[np.eye(N, dtype=bool)] = 0
for _ in range(M):
A, B, C = list(map(int, input().split()))
D[A-1, B-1] = C
D[B-1, A-1] = C
D = floyd_warshall(D)
D2 = (D<=L)*1.... | 27 | 28 | 496 | 570 | from scipy.sparse.csgraph import floyd_warshall
import numpy as np
N, M, L = list(map(int, input().split()))
D = np.ones([N, N]) * np.inf
D[np.eye(N, dtype=bool)] = 0
for _ in range(M):
A, B, C = list(map(int, input().split()))
D[A - 1, B - 1] = C
D[B - 1, A - 1] = C
D = floyd_warshall(D)
D2 = D <= L
D2 = ... | from scipy.sparse.csgraph import floyd_warshall
import numpy as np
N, M, L = list(map(int, input().split()))
D = np.ones([N, N]) * np.inf
D[np.eye(N, dtype=bool)] = 0
for _ in range(M):
A, B, C = list(map(int, input().split()))
D[A - 1, B - 1] = C
D[B - 1, A - 1] = C
D = floyd_warshall(D)
D2 = (D <= L) * 1... | false | 3.571429 | [
"-D2 = D <= L",
"-D2 = floyd_warshall(D2)",
"+D2 = (D <= L) * 1.0 # boolean -> float",
"+D2[D2 == 0] = np.inf",
"+# D2 = (D <= L) + (D > L)*np.inf",
"+D2 = floyd_warshall(D2) - 1",
"- r = D2[s - 1, t - 1] - 1",
"+ r = D2[s - 1, t - 1]"
] | false | 0.512017 | 0.557741 | 0.918018 | [
"s750340438",
"s541652523"
] |
u733738237 | p03612 | python | s425114473 | s259302811 | 77 | 61 | 13,880 | 13,940 | Accepted | Accepted | 20.78 | n=int(eval(input()))
p=[int(i) for i in input().split()]
cnt=0
for i in range(n-1):
if p[i]==i+1:
p[i],p[i+1]=p[i+1],p[i]
cnt+=1
if p[-1]==n:cnt+=1
print(cnt) | n,*p=list(map(int,open(0).read().split()))
i=c=0
while i<n:
if p[i]==i+1:
i+=1
c+=1
i+=1
print(c) | 9 | 8 | 165 | 104 | n = int(eval(input()))
p = [int(i) for i in input().split()]
cnt = 0
for i in range(n - 1):
if p[i] == i + 1:
p[i], p[i + 1] = p[i + 1], p[i]
cnt += 1
if p[-1] == n:
cnt += 1
print(cnt)
| n, *p = list(map(int, open(0).read().split()))
i = c = 0
while i < n:
if p[i] == i + 1:
i += 1
c += 1
i += 1
print(c)
| false | 11.111111 | [
"-n = int(eval(input()))",
"-p = [int(i) for i in input().split()]",
"-cnt = 0",
"-for i in range(n - 1):",
"+n, *p = list(map(int, open(0).read().split()))",
"+i = c = 0",
"+while i < n:",
"- p[i], p[i + 1] = p[i + 1], p[i]",
"- cnt += 1",
"-if p[-1] == n:",
"- cnt += 1",
"-p... | false | 0.042244 | 0.033952 | 1.244246 | [
"s425114473",
"s259302811"
] |
u723711163 | p03579 | python | s744075643 | s293788238 | 1,232 | 1,098 | 213,904 | 212,036 | Accepted | Accepted | 10.88 | import sys
sys.setrecursionlimit(100000)
N,M = list(map(int,input().split()))
adj_list = { i: [] for i in range(1, N+1) }
for i in range(M):
a,b = list(map(int, input().split()))
adj_list[a].append(b)
adj_list[b].append(a)
visited = [False]*(N+1)
colors = [None] * (N)
is_bipartite = True
## imp... | import sys
sys.setrecursionlimit(100000)
N,M = list(map(int,input().split()))
adj = [ [] for _ in range(N) ]
for _ in range(M):
u,v = list(map(int,input().split()))
u -= 1
v -= 1
adj[u].append(v)
adj[v].append(u)
color = [None] * N
def dfs(n, c):
color[n] = c
for nei in adj[n]:
if co... | 32 | 30 | 655 | 574 | import sys
sys.setrecursionlimit(100000)
N, M = list(map(int, input().split()))
adj_list = {i: [] for i in range(1, N + 1)}
for i in range(M):
a, b = list(map(int, input().split()))
adj_list[a].append(b)
adj_list[b].append(a)
visited = [False] * (N + 1)
colors = [None] * (N)
is_bipartite = True
## improved... | import sys
sys.setrecursionlimit(100000)
N, M = list(map(int, input().split()))
adj = [[] for _ in range(N)]
for _ in range(M):
u, v = list(map(int, input().split()))
u -= 1
v -= 1
adj[u].append(v)
adj[v].append(u)
color = [None] * N
def dfs(n, c):
color[n] = c
for nei in adj[n]:
... | false | 6.25 | [
"-adj_list = {i: [] for i in range(1, N + 1)}",
"-for i in range(M):",
"- a, b = list(map(int, input().split()))",
"- adj_list[a].append(b)",
"- adj_list[b].append(a)",
"-visited = [False] * (N + 1)",
"-colors = [None] * (N)",
"-is_bipartite = True",
"-## improved dfs ###",
"-def dfs(node... | false | 0.040398 | 0.103494 | 0.390337 | [
"s744075643",
"s293788238"
] |
u634079249 | p02546 | python | s447679920 | s385469627 | 40 | 32 | 9,824 | 9,656 | Accepted | Accepted | 20 | import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip(... | import sys
import os
import math
import bisect
import itertools
import collections
import heapq
import queue
import array
# 時々使う
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
# 再帰の制限設定
sys.setrecursionli... | 33 | 52 | 1,046 | 1,226 | import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = la... | import sys
import os
import math
import bisect
import itertools
import collections
import heapq
import queue
import array
# 時々使う
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
# 再帰の制限設定
sys.setrecursionlimit(10000000)
d... | false | 36.538462 | [
"-import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array",
"+import sys",
"+import os",
"+import math",
"+import bisect",
"+import itertools",
"+import collections",
"+import heapq",
"+import queue",
"+import array",
"+# 時々使う",
"+# 再帰の制限設定",
"-ii = lambda: int(sys.st... | false | 0.106747 | 0.101834 | 1.048249 | [
"s447679920",
"s385469627"
] |
u753803401 | p03355 | python | s168147013 | s427958089 | 227 | 182 | 43,760 | 39,792 | Accepted | Accepted | 19.82 | def main():
import sys
input = sys.stdin.readline
s = str(input().rstrip('\n'))
k = int(input().rstrip('\n'))
d = []
for i in range(len(s)):
for j in range(i + 1, min(i + 1 + k, len(s) + 1)):
d.append(s[i:j])
import collections
d = sorted(collections.Counter... | def slove():
import sys
import collections
input = sys.stdin.readline
t = str(input().rstrip('\n'))
s = collections.Counter(t).most_common()
k = int(input().rstrip('\n'))
s.sort()
d = {}
for key, v in s:
for i in range(len(t)):
if t[i] == key:
... | 16 | 21 | 405 | 529 | def main():
import sys
input = sys.stdin.readline
s = str(input().rstrip("\n"))
k = int(input().rstrip("\n"))
d = []
for i in range(len(s)):
for j in range(i + 1, min(i + 1 + k, len(s) + 1)):
d.append(s[i:j])
import collections
d = sorted(collections.Counter(d).most... | def slove():
import sys
import collections
input = sys.stdin.readline
t = str(input().rstrip("\n"))
s = collections.Counter(t).most_common()
k = int(input().rstrip("\n"))
s.sort()
d = {}
for key, v in s:
for i in range(len(t)):
if t[i] == key:
for... | false | 23.809524 | [
"-def main():",
"+def slove():",
"+ import collections",
"- s = str(input().rstrip(\"\\n\"))",
"+ t = str(input().rstrip(\"\\n\"))",
"+ s = collections.Counter(t).most_common()",
"- d = []",
"- for i in range(len(s)):",
"- for j in range(i + 1, min(i + 1 + k, len(s) + 1)):",... | false | 0.09187 | 0.050518 | 1.818552 | [
"s168147013",
"s427958089"
] |
u729133443 | p02559 | python | s156627613 | s407229128 | 4,403 | 3,477 | 296,496 | 174,784 | Accepted | Accepted | 21.03 | def main():
def f(i,x):
while i<=n:
b[i]+=x
i+=i&-i
def g(i):
s=0
while i:
s+=b[i]
i-=i&-i
return s
(n,q,*w),a,*t=[list(map(int,t.split()))for t in open(0)]
b=[0]*-~n
*list(map(f,list(range(1,n+1)),a)),
for q,l,r in t:
if q:w+=g(r)-g(l),
else:f... | def main():
def f(i,x):
while i<=n:
b[i]+=x
i+=i&-i
def g(i):
s=0
while i:
s+=b[i]
i-=i&-i
return s
(n,q,*w),a,*t=[[*list(map(int,t.split()))]for t in open(0)]
b=[0]*-~n
*list(map(f,list(range(1,n+1)),a)),
for q,l,r in t:
if q:w+=g(r)-g(l),
els... | 19 | 19 | 348 | 351 | def main():
def f(i, x):
while i <= n:
b[i] += x
i += i & -i
def g(i):
s = 0
while i:
s += b[i]
i -= i & -i
return s
(n, q, *w), a, *t = [list(map(int, t.split())) for t in open(0)]
b = [0] * -~n
*list(map(f, list(rang... | def main():
def f(i, x):
while i <= n:
b[i] += x
i += i & -i
def g(i):
s = 0
while i:
s += b[i]
i -= i & -i
return s
(n, q, *w), a, *t = [[*list(map(int, t.split()))] for t in open(0)]
b = [0] * -~n
*list(map(f, list(r... | false | 0 | [
"- (n, q, *w), a, *t = [list(map(int, t.split())) for t in open(0)]",
"+ (n, q, *w), a, *t = [[*list(map(int, t.split()))] for t in open(0)]"
] | false | 0.042505 | 0.045275 | 0.93881 | [
"s156627613",
"s407229128"
] |
u509405951 | p02995 | python | s065943585 | s881916167 | 35 | 17 | 5,048 | 3,064 | Accepted | Accepted | 51.43 | import fractions
A, B, C, D = list(map(int, input().split()))
A -= 1
lcm=C*D // fractions.gcd(C, D)
ex = A - (A // C + A // D - A // lcm)
num = B - (B // C + B // D - B // lcm)
print((num-ex)) | import math
def gcd(a,b):
while b!=0:
a,b=b,a%b
return a
def lcm(a,b):
if a >= b:
return a*b//gcd(a,b)
else:
return a*b//gcd(b,a)
A, B, C, D = list(map(int, input().split()))
A -= 1
k1 = A // C
k2 = B // C
k3 = A // D
k4 = B // D
k5 = k2 - k1 + 1
k6 = k4 - k3 + 1
... | 11 | 32 | 201 | 430 | import fractions
A, B, C, D = list(map(int, input().split()))
A -= 1
lcm = C * D // fractions.gcd(C, D)
ex = A - (A // C + A // D - A // lcm)
num = B - (B // C + B // D - B // lcm)
print((num - ex))
| import math
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def lcm(a, b):
if a >= b:
return a * b // gcd(a, b)
else:
return a * b // gcd(b, a)
A, B, C, D = list(map(int, input().split()))
A -= 1
k1 = A // C
k2 = B // C
k3 = A // D
k4 = B // D
k5 = k2 - k1 + 1
k6 = k4... | false | 65.625 | [
"-import fractions",
"+import math",
"+",
"+",
"+def gcd(a, b):",
"+ while b != 0:",
"+ a, b = b, a % b",
"+ return a",
"+",
"+",
"+def lcm(a, b):",
"+ if a >= b:",
"+ return a * b // gcd(a, b)",
"+ else:",
"+ return a * b // gcd(b, a)",
"+",
"-lcm = ... | false | 0.048183 | 0.064709 | 0.744618 | [
"s065943585",
"s881916167"
] |
u750651325 | p03680 | python | s082110976 | s613434081 | 209 | 190 | 7,084 | 14,376 | Accepted | Accepted | 9.09 |
N = int(eval(input()))
A = []
for i in range(N):
a = int(eval(input()))
A.append(a)
aaa = 0
ans = A[0]
count = 1
for i in range(N):
if ans == 2:
aaa = 1
break
else:
ans = A[ans-1]
count += 1
if aaa == 1:
print(count)
else:
print((-1... | import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return eval(input())
def k(): return int(eval(input()))
def S(): return input().split()
def I(): return list(map(int,input().split... | 23 | 46 | 315 | 895 | N = int(eval(input()))
A = []
for i in range(N):
a = int(eval(input()))
A.append(a)
aaa = 0
ans = A[0]
count = 1
for i in range(N):
if ans == 2:
aaa = 1
break
else:
ans = A[ans - 1]
count += 1
if aaa == 1:
print(count)
else:
print((-1))
| import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque, Counter
from decimal import Decimal
import functools
def v():
return eval(input())
def k():
return int(eval(input()))
def S():
return input().split()
def I():
return list(map(int,... | false | 50 | [
"-N = int(eval(input()))",
"+import re",
"+import sys",
"+import math",
"+import itertools",
"+import bisect",
"+from copy import copy",
"+from collections import deque, Counter",
"+from decimal import Decimal",
"+import functools",
"+",
"+",
"+def v():",
"+ return eval(input())",
"+"... | false | 0.153762 | 0.040096 | 3.834823 | [
"s082110976",
"s613434081"
] |
u261103969 | p02935 | python | s543569443 | s530667387 | 150 | 64 | 11,976 | 61,652 | Accepted | Accepted | 57.33 | import sys
import math
import bisect
import numpy as np
input = sys.stdin.readline
MOD = 10**9 + 7
INF = float('INF')
def main():
n = int(eval(input()))
v = list(map(float,input().split()))
v = np.array(v)
v.sort()
for i in range(n, 1, -1):
v[:i] = v[:i] * 0.5
ans = s... | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
N = int(readline())
v = list(map(int, readline().split()))
v.sort()
cur = v[0]
for i in range(1, N):
cur += v[i]
cur /= 2
print(cur)
... | 23 | 23 | 379 | 361 | import sys
import math
import bisect
import numpy as np
input = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
def main():
n = int(eval(input()))
v = list(map(float, input().split()))
v = np.array(v)
v.sort()
for i in range(n, 1, -1):
v[:i] = v[:i] * 0.5
ans = sum(v)
print(... | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
N = int(readline())
v = list(map(int, readline().split()))
v.sort()
cur = v[0]
for i in range(1, N):
cur += v[i]
cur /= 2
print(cur)
if __name__ == "__main__"... | false | 0 | [
"-import math",
"-import bisect",
"-import numpy as np",
"-input = sys.stdin.readline",
"+readline = sys.stdin.readline",
"+sys.setrecursionlimit(10**5)",
"- n = int(eval(input()))",
"- v = list(map(float, input().split()))",
"- v = np.array(v)",
"+ N = int(readline())",
"+ v = li... | false | 0.506699 | 0.007605 | 66.627564 | [
"s543569443",
"s530667387"
] |
u018679195 | p03564 | python | s778033951 | s456107586 | 17 | 10 | 2,940 | 2,568 | Accepted | Accepted | 41.18 | N = int(eval(input()))
K = int(eval(input()))
x = 1
for i in range (N):
if x*2 < x + K:
x=x*2
else:
x = x + K
print(x) | n=int(input())
k=int(input())
ip=1
for i in range(n):
if ip*2-ip<k:
ip=ip*2
else:
ip=ip+k
print(ip) | 9 | 11 | 138 | 126 | N = int(eval(input()))
K = int(eval(input()))
x = 1
for i in range(N):
if x * 2 < x + K:
x = x * 2
else:
x = x + K
print(x)
| n = int(input())
k = int(input())
ip = 1
for i in range(n):
if ip * 2 - ip < k:
ip = ip * 2
else:
ip = ip + k
print(ip)
| false | 18.181818 | [
"-N = int(eval(input()))",
"-K = int(eval(input()))",
"-x = 1",
"-for i in range(N):",
"- if x * 2 < x + K:",
"- x = x * 2",
"+n = int(input())",
"+k = int(input())",
"+ip = 1",
"+for i in range(n):",
"+ if ip * 2 - ip < k:",
"+ ip = ip * 2",
"- x = x + K",
"-pri... | false | 0.036985 | 0.071902 | 0.514374 | [
"s778033951",
"s456107586"
] |
u964998676 | p03478 | python | s773021667 | s898777487 | 37 | 34 | 3,060 | 2,940 | Accepted | Accepted | 8.11 | N, A, B = list(map(int, input('').split()))
total = 0
for x in range(1, N + 1):
num = str(x)
digit_total = 0
for y in range(len(num)):
digit_total += int(num[y])
if digit_total >= A and digit_total <= B:
total += x
print(total) | N, A, B = list(map(int, input('').split()))
answer = 0
for x in range(1, N + 1):
total = sum(int(d) for d in str(x))
if A <= total <= B:
answer += x
print(answer) | 11 | 8 | 254 | 178 | N, A, B = list(map(int, input("").split()))
total = 0
for x in range(1, N + 1):
num = str(x)
digit_total = 0
for y in range(len(num)):
digit_total += int(num[y])
if digit_total >= A and digit_total <= B:
total += x
print(total)
| N, A, B = list(map(int, input("").split()))
answer = 0
for x in range(1, N + 1):
total = sum(int(d) for d in str(x))
if A <= total <= B:
answer += x
print(answer)
| false | 27.272727 | [
"-total = 0",
"+answer = 0",
"- num = str(x)",
"- digit_total = 0",
"- for y in range(len(num)):",
"- digit_total += int(num[y])",
"- if digit_total >= A and digit_total <= B:",
"- total += x",
"-print(total)",
"+ total = sum(int(d) for d in str(x))",
"+ if A <= t... | false | 0.037521 | 0.037861 | 0.991045 | [
"s773021667",
"s898777487"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.