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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u600402037 | p03033 | python | s388143618 | s738699702 | 1,663 | 1,525 | 134,300 | 134,324 | Accepted | Accepted | 8.3 | # 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, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
event = []
append = event.append
for s, t, x in STX:
append((s-x, 0, x)... | # 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, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
event = []
append = event.append
for s, t, x in STX:
append((s-x, 0, x)... | 46 | 44 | 941 | 913 | # 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, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
event = []
append = event.append
for s, t, x in STX:
append((s - x, 0, x))
append... | # 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, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
event = []
append = event.append
for s, t, x in STX:
append((s - x, 0, x))
append... | false | 4.347826 | [
"-add = cur.add",
"-remove = cur.remove",
"- add(c)",
"+ cur.add(c)",
"- remove(c)",
"+ cur.remove(c)"
] | false | 0.03812 | 0.049611 | 0.768392 | [
"s388143618",
"s738699702"
] |
u248364740 | p02909 | python | s656586306 | s230221997 | 23 | 20 | 9,020 | 9,068 | Accepted | Accepted | 13.04 | # 問題:https://atcoder.jp/contests/abc141/tasks/abc141_a
s = eval(input())
if s == 'Sunny':
print('Cloudy')
elif s == 'Cloudy':
print('Rainy')
elif s == 'Rainy':
print('Sunny')
| # 問題:https://atcoder.jp/contests/abc141/tasks/abc141_a
import sys
weather = ['Sunny', 'Cloudy', 'Rainy']
s = eval(input())
if weather.count(s) < 1:
sys.exit()
current_index = weather.index(s)
next_index = (current_index + 1) % 3
print((weather[next_index]))
| 10 | 12 | 192 | 268 | # 問題:https://atcoder.jp/contests/abc141/tasks/abc141_a
s = eval(input())
if s == "Sunny":
print("Cloudy")
elif s == "Cloudy":
print("Rainy")
elif s == "Rainy":
print("Sunny")
| # 問題:https://atcoder.jp/contests/abc141/tasks/abc141_a
import sys
weather = ["Sunny", "Cloudy", "Rainy"]
s = eval(input())
if weather.count(s) < 1:
sys.exit()
current_index = weather.index(s)
next_index = (current_index + 1) % 3
print((weather[next_index]))
| false | 16.666667 | [
"+import sys",
"+",
"+weather = [\"Sunny\", \"Cloudy\", \"Rainy\"]",
"-if s == \"Sunny\":",
"- print(\"Cloudy\")",
"-elif s == \"Cloudy\":",
"- print(\"Rainy\")",
"-elif s == \"Rainy\":",
"- print(\"Sunny\")",
"+if weather.count(s) < 1:",
"+ sys.exit()",
"+current_index = weather.i... | false | 0.048663 | 0.049172 | 0.989649 | [
"s656586306",
"s230221997"
] |
u977389981 | p03964 | python | s346492778 | s687735241 | 23 | 21 | 3,188 | 3,188 | Accepted | Accepted | 8.7 | n = int(eval(input()))
A = [[int(i) for i in input().split()] for i in range(n)]
x, y = 1, 1
for i in range(n):
a, b = A[i]
m = max(-(-x // a), -(-y // b))
x, y = a * m, b * m
#print(x, y)
print((x + y)) | n = int(eval(input()))
A = [[int(i) for i in input().split()] for i in range(n)]
x, y = A[0]
for a, b in A[1:]:
m = max(-(-x // a), -(-y // b))
x = a * m
y = b * m
#print(x, y)
print((x + y)) | 11 | 11 | 231 | 219 | n = int(eval(input()))
A = [[int(i) for i in input().split()] for i in range(n)]
x, y = 1, 1
for i in range(n):
a, b = A[i]
m = max(-(-x // a), -(-y // b))
x, y = a * m, b * m
# print(x, y)
print((x + y))
| n = int(eval(input()))
A = [[int(i) for i in input().split()] for i in range(n)]
x, y = A[0]
for a, b in A[1:]:
m = max(-(-x // a), -(-y // b))
x = a * m
y = b * m
# print(x, y)
print((x + y))
| false | 0 | [
"-x, y = 1, 1",
"-for i in range(n):",
"- a, b = A[i]",
"+x, y = A[0]",
"+for a, b in A[1:]:",
"- x, y = a * m, b * m",
"+ x = a * m",
"+ y = b * m"
] | false | 0.044294 | 0.044445 | 0.996618 | [
"s346492778",
"s687735241"
] |
u632360669 | p02683 | python | s468781655 | s529865613 | 299 | 129 | 9,044 | 9,120 | Accepted | Accepted | 56.86 | N, M, X = list(map(int, input().split()))
CAAA = [input().split() for i in range(N)]
ans=100000000000
for i in range(1, 2**N):
price=0
rikaido = [0]*M
for j in range(N):
if i>>j & 1:
price += int(CAAA[j][0])
for k in range(M):
rikaido[k] += int(CAAA[j][k+1])
for l in... | N, M, X = list(map(int, input().split()))
CAAA = [input().split() for i in range(N)]
ans=100000000000
for i in range(1, 2**N):
price=0
rikaido = [0]*M
for j in range(N):
if i>>j & 1:
price += int(CAAA[j][0])
for k in range(M):
rikaido[k] += int(CAAA[j][k+1])
for l in rikai... | 22 | 23 | 470 | 446 | N, M, X = list(map(int, input().split()))
CAAA = [input().split() for i in range(N)]
ans = 100000000000
for i in range(1, 2**N):
price = 0
rikaido = [0] * M
for j in range(N):
if i >> j & 1:
price += int(CAAA[j][0])
for k in range(M):
rikaido[k] += int(CAAA[j]... | N, M, X = list(map(int, input().split()))
CAAA = [input().split() for i in range(N)]
ans = 100000000000
for i in range(1, 2**N):
price = 0
rikaido = [0] * M
for j in range(N):
if i >> j & 1:
price += int(CAAA[j][0])
for k in range(M):
rikaido[k] += int(CAAA[j]... | false | 4.347826 | [
"- for l in rikaido:",
"- if l < X:",
"- break",
"- else:",
"- ans = min(ans, price)",
"+ for l in rikaido:",
"+ if l < X:",
"+ break",
"+ else:",
"+ ans = min(ans, price)"
] | false | 0.039232 | 0.084204 | 0.465911 | [
"s468781655",
"s529865613"
] |
u462329577 | p03062 | python | s939326699 | s606046244 | 242 | 62 | 66,644 | 14,252 | Accepted | Accepted | 74.38 | #!/usr/bin/env python3
n = int(eval(input()))
a = list(map(int,input().split()))
# sum(|a|)がmaxでこれを実現できないケースは負の数が連続で奇数個並んでいる箇所がある時
# その時は両端とその隣の正の数の4つの中で絶対値がminのものを負にするとOK
# 例外は負の数が連続で奇数個並んでいる箇所が1つ間に正を挟んで並んでいる時
# この考えだと簡単に言い換えできない。解説をみるとtotalの負の数が偶数なら全部せいにできる
s = sum([abs(i) for i in a])
if len([i for i in a if... | #!/usr/bin/env python3
n = int(eval(input()))
a = list(map(int, input().split()))
# 欲しいのは絶対値の和、abs の絶対値、負の数
if len([i for i in a if i < 0]) % 2:
print((sum([abs(i) for i in a]) - 2 * min([abs(i) for i in a])))
else:
print((sum([abs(i) for i in a])))
| 12 | 8 | 391 | 255 | #!/usr/bin/env python3
n = int(eval(input()))
a = list(map(int, input().split()))
# sum(|a|)がmaxでこれを実現できないケースは負の数が連続で奇数個並んでいる箇所がある時
# その時は両端とその隣の正の数の4つの中で絶対値がminのものを負にするとOK
# 例外は負の数が連続で奇数個並んでいる箇所が1つ間に正を挟んで並んでいる時
# この考えだと簡単に言い換えできない。解説をみるとtotalの負の数が偶数なら全部せいにできる
s = sum([abs(i) for i in a])
if len([i for i in a if i < 0]... | #!/usr/bin/env python3
n = int(eval(input()))
a = list(map(int, input().split()))
# 欲しいのは絶対値の和、abs の絶対値、負の数
if len([i for i in a if i < 0]) % 2:
print((sum([abs(i) for i in a]) - 2 * min([abs(i) for i in a])))
else:
print((sum([abs(i) for i in a])))
| false | 33.333333 | [
"-# sum(|a|)がmaxでこれを実現できないケースは負の数が連続で奇数個並んでいる箇所がある時",
"-# その時は両端とその隣の正の数の4つの中で絶対値がminのものを負にするとOK",
"-# 例外は負の数が連続で奇数個並んでいる箇所が1つ間に正を挟んで並んでいる時",
"-# この考えだと簡単に言い換えできない。解説をみるとtotalの負の数が偶数なら全部せいにできる",
"-s = sum([abs(i) for i in a])",
"-if len([i for i in a if i < 0]) % 2 == 0:",
"- print(s)",
"+# 欲しいのは絶対... | false | 0.034665 | 0.04605 | 0.752772 | [
"s939326699",
"s606046244"
] |
u576917603 | p03043 | python | s096493812 | s139162393 | 84 | 43 | 2,940 | 3,060 | Accepted | Accepted | 48.81 | n,k=list(map(int,input().split()))
x=1/n
y=1/2
ans=0
for i in range(1,n+1):
for j in range(18):
if i*2**j>=k:
ans+=x*y**j
break
print(ans) | n,k=list(map(int,input().split()))
x=1/n
y=1/2
ans=0
for i in range(1,n+1):
if i>=k:
ans+=x
continue
for j in range(18):
if i*2**j>=k:
ans+=x*y**j
break
print(ans) | 10 | 13 | 177 | 225 | n, k = list(map(int, input().split()))
x = 1 / n
y = 1 / 2
ans = 0
for i in range(1, n + 1):
for j in range(18):
if i * 2**j >= k:
ans += x * y**j
break
print(ans)
| n, k = list(map(int, input().split()))
x = 1 / n
y = 1 / 2
ans = 0
for i in range(1, n + 1):
if i >= k:
ans += x
continue
for j in range(18):
if i * 2**j >= k:
ans += x * y**j
break
print(ans)
| false | 23.076923 | [
"+ if i >= k:",
"+ ans += x",
"+ continue"
] | false | 0.106873 | 0.042987 | 2.486184 | [
"s096493812",
"s139162393"
] |
u588341295 | p02919 | python | s803513308 | s333493686 | 1,195 | 1,086 | 61,664 | 59,244 | Accepted | Accepted | 9.12 | # -*- 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 ... | # -*- 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 ... | 136 | 111 | 3,319 | 2,907 | # -*- 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... | # -*- 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 | 18.382353 | [
"+ def bisearch_left(self, l, r, x):",
"+ \"\"\"区間l,rで左からx番目の値がある位置\"\"\"",
"+ l_val = self.sum(l)",
"+ ok = r",
"+ ng = l",
"+ while ng + 1 < ok:",
"+ mid = (ok + ng) // 2",
"+ if self.sum(mid) - l_val >= x:",
"+ ok = mid",
... | false | 0.043247 | 0.041984 | 1.03008 | [
"s803513308",
"s333493686"
] |
u764600134 | p03557 | python | s236641736 | s097282321 | 407 | 368 | 38,708 | 39,916 | Accepted | Accepted | 9.58 | # -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc077/tasks/arc084_a
"""
import sys
from sys import stdin
from bisect import bisect_left, bisect_right
input = stdin.readline
def main(args):
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input... | # -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc077/tasks/arc084_a
"""
import sys
from sys import stdin
from bisect import bisect_left, bisect_right
input = stdin.readline
def main(args):
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input... | 40 | 41 | 747 | 852 | # -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc077/tasks/arc084_a
"""
import sys
from sys import stdin
from bisect import bisect_left, bisect_right
input = stdin.readline
def main(args):
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
... | # -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc077/tasks/arc084_a
"""
import sys
from sys import stdin
from bisect import bisect_left, bisect_right
input = stdin.readline
def main(args):
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
... | false | 2.439024 | [
"- B.sort()",
"+ # B.sort()",
"- lut_A = {}",
"- lut_C = {}",
"- for b in B:",
"- i = bisect_left(A, b)",
"- lut_A[b] = i",
"- j = bisect_right(C, b)",
"- lut_C[b] = N - j",
"+ # lut_A = {}",
"+ # lut_C = {}",
"+ # for b in B:",
... | false | 0.040248 | 0.03977 | 1.012028 | [
"s236641736",
"s097282321"
] |
u426534722 | p02244 | python | s549563220 | s306395293 | 40 | 30 | 7,796 | 7,784 | Accepted | Accepted | 25 | from sys import stdin
N = 8
FREE = -1
NOT_FREE = 1
row = [FREE] * N
col = [FREE] * N
dpos = [FREE] * (2 * N - 1)
dneg = [FREE] * (2 * N - 1)
X = [[False] * N for _ in range(N)]
n = int(stdin.readline())
for _ in range(0, n):
r, c = list(map(int, stdin.readline().split()))
X[r][c] = True
def printBo... | from sys import stdin
from itertools import permutations as per
def check(queen):
for r1, c1 in queen:
if not all((r1 == r2 and c1 == c2) or (r1 + c1 != r2 + c2 and r1 - c1 != r2 - c2) for r2, c2 in queen):
return False
return True
k = int(stdin.readline())
R, C = [[i for i in range(... | 32 | 21 | 940 | 669 | from sys import stdin
N = 8
FREE = -1
NOT_FREE = 1
row = [FREE] * N
col = [FREE] * N
dpos = [FREE] * (2 * N - 1)
dneg = [FREE] * (2 * N - 1)
X = [[False] * N for _ in range(N)]
n = int(stdin.readline())
for _ in range(0, n):
r, c = list(map(int, stdin.readline().split()))
X[r][c] = True
def printBoard():
... | from sys import stdin
from itertools import permutations as per
def check(queen):
for r1, c1 in queen:
if not all(
(r1 == r2 and c1 == c2) or (r1 + c1 != r2 + c2 and r1 - c1 != r2 - c2)
for r2, c2 in queen
):
return False
return True
k = int(stdin.readline... | false | 34.375 | [
"-",
"-N = 8",
"-FREE = -1",
"-NOT_FREE = 1",
"-row = [FREE] * N",
"-col = [FREE] * N",
"-dpos = [FREE] * (2 * N - 1)",
"-dneg = [FREE] * (2 * N - 1)",
"-X = [[False] * N for _ in range(N)]",
"-n = int(stdin.readline())",
"-for _ in range(0, n):",
"- r, c = list(map(int, stdin.readline().sp... | false | 0.077196 | 0.051 | 1.513645 | [
"s549563220",
"s306395293"
] |
u197968862 | p03680 | python | s159025837 | s378000870 | 428 | 199 | 7,084 | 7,212 | Accepted | Accepted | 53.5 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
if 2 not in a:
print((-1))
quit()
else:
t = a.index(2)
s = 1
count = 0
while count <= 10**6:
s = a[s-1]
count += 1
if s == 2:
print(count)
quit()
print((-1)) | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
if 2 not in a:
print((-1))
quit()
else:
s = 1
count = 0
while count <= n:
s = a[s-1]
count += 1
if s == 2:
print(count)
quit()
print((-1)) | 16 | 15 | 294 | 270 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
if 2 not in a:
print((-1))
quit()
else:
t = a.index(2)
s = 1
count = 0
while count <= 10**6:
s = a[s - 1]
count += 1
if s == 2:
print(count)
quit()
print((-1))
| n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
if 2 not in a:
print((-1))
quit()
else:
s = 1
count = 0
while count <= n:
s = a[s - 1]
count += 1
if s == 2:
print(count)
quit()
print((-1))
| false | 6.25 | [
"- t = a.index(2)",
"- while count <= 10**6:",
"+ while count <= n:"
] | false | 0.111445 | 0.078409 | 1.421335 | [
"s159025837",
"s378000870"
] |
u967442619 | p02642 | python | s147938083 | s009013861 | 390 | 236 | 218,044 | 151,580 | Accepted | Accepted | 39.49 | from collections import Counter
N = int(eval(input()))
A = [int(i) for i in input().split()]
maxA = max(A)
dp = {}
for i in range(1, maxA+1):
dp[i] = True
for i in range(N):
if dp[A[i]]:
tmp = 2 * A[i]
while maxA >= tmp:
if dp[tmp]:
dp[tmp] = False
... | from collections import Counter
N = int(eval(input()))
A = [int(i) for i in input().split()]
maxA = max(A)
dp = {}
for each in A:
dp[each] = True
for i in range(N):
if dp[A[i]]:
tmp = 2 * A[i]
while maxA >= tmp:
if tmp in dp and dp[tmp]:
dp[tmp] = False
... | 20 | 20 | 453 | 458 | from collections import Counter
N = int(eval(input()))
A = [int(i) for i in input().split()]
maxA = max(A)
dp = {}
for i in range(1, maxA + 1):
dp[i] = True
for i in range(N):
if dp[A[i]]:
tmp = 2 * A[i]
while maxA >= tmp:
if dp[tmp]:
dp[tmp] = False
tmp ... | from collections import Counter
N = int(eval(input()))
A = [int(i) for i in input().split()]
maxA = max(A)
dp = {}
for each in A:
dp[each] = True
for i in range(N):
if dp[A[i]]:
tmp = 2 * A[i]
while maxA >= tmp:
if tmp in dp and dp[tmp]:
dp[tmp] = False
t... | false | 0 | [
"-for i in range(1, maxA + 1):",
"- dp[i] = True",
"+for each in A:",
"+ dp[each] = True",
"- if dp[tmp]:",
"+ if tmp in dp and dp[tmp]:"
] | false | 0.044912 | 0.044831 | 1.00181 | [
"s147938083",
"s009013861"
] |
u131634965 | p03633 | python | s214101845 | s503971806 | 38 | 35 | 5,332 | 5,076 | Accepted | Accepted | 7.89 | n=int(eval(input()))
# 最上公倍数を考える
from fractions import gcd
from functools import reduce
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
num_list=[]
for _ in range(n):
num_list.append(int(eval(input())))
print((lcm(*num_list))) | n=int(eval(input()))
# 最上公倍数を考える
from fractions import gcd
from functools import reduce
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers)
num_list=[]
for _ in range(n):
num_list.append(int(eval(input())))
print((lcm(*num_list))) | 16 | 16 | 298 | 295 | n = int(eval(input()))
# 最上公倍数を考える
from fractions import gcd
from functools import reduce
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
num_list = []
for _ in range(n):
num_list.append(int(eval(input())))
print((lcm(*num_list)))
| n = int(eval(input()))
# 最上公倍数を考える
from fractions import gcd
from functools import reduce
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers)
num_list = []
for _ in range(n):
num_list.append(int(eval(input())))
print((lcm(*num_list)))
| false | 0 | [
"- return reduce(lcm_base, numbers, 1)",
"+ return reduce(lcm_base, numbers)"
] | false | 0.056393 | 0.12789 | 0.440947 | [
"s214101845",
"s503971806"
] |
u596505843 | p02579 | python | s080040745 | s527750572 | 504 | 466 | 103,084 | 99,008 | Accepted | Accepted | 7.54 | import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int... | import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int... | 58 | 59 | 1,499 | 1,550 | import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(eval(i... | import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(eval(i... | false | 1.694915 | [
"-visited = narr((H, W), lambda: float(\"inf\"))",
"+# visited = narr((H, W), lambda: float('inf'))",
"+visited = [[float(\"inf\")] * W for _ in range(H)]"
] | false | 0.007356 | 0.038036 | 0.193407 | [
"s080040745",
"s527750572"
] |
u506858457 | p03610 | python | s873679410 | s273291630 | 80 | 17 | 5,292 | 3,188 | Accepted | Accepted | 78.75 | s=list(input())
for i in range(len(s)):
if i%2==0:
print(s[i],end='')
| s=eval(input())
print((s[::2])) | 5 | 2 | 80 | 24 | s = list(input())
for i in range(len(s)):
if i % 2 == 0:
print(s[i], end="")
| s = eval(input())
print((s[::2]))
| false | 60 | [
"-s = list(input())",
"-for i in range(len(s)):",
"- if i % 2 == 0:",
"- print(s[i], end=\"\")",
"+s = eval(input())",
"+print((s[::2]))"
] | false | 0.045976 | 0.058877 | 0.780874 | [
"s873679410",
"s273291630"
] |
u986190948 | p02695 | python | s728951198 | s959224069 | 1,120 | 419 | 9,092 | 9,196 | Accepted | Accepted | 62.59 | from itertools import combinations_with_replacement as comb_rplc
n,m,q=list(map(int,input().split()))
a=[0]*q
b=[0]*q
c=[0]*q
d=[0]*q
for i in range(q):
a[i],b[i],c[i],d[i]=list(map(int,input().split()))
ans=0
for A in comb_rplc(list(range(1,m+1)),n):
sum=0
for i in range(q):
if A[b[i]-1]-A[a[i]-1]==... | from itertools import combinations_with_replacement as comb_rplc
n,m,q=list(map(int,input().split()))
a=[0]*q
b=[0]*q
c=[0]*q
d=[0]*q
for i in range(q):
a[i],b[i],c[i],d[i]=list(map(int,input().split()))
ans=0
def dfs(A):
ans=0
if len(A)==n:#数列が完成
score1=0
for i in range(q):
if A[b[i]-1]-A[a[i... | 19 | 28 | 364 | 520 | from itertools import combinations_with_replacement as comb_rplc
n, m, q = list(map(int, input().split()))
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
a[i], b[i], c[i], d[i] = list(map(int, input().split()))
ans = 0
for A in comb_rplc(list(range(1, m + 1)), n):
sum = 0
for i in range... | from itertools import combinations_with_replacement as comb_rplc
n, m, q = list(map(int, input().split()))
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
a[i], b[i], c[i], d[i] = list(map(int, input().split()))
ans = 0
def dfs(A):
ans = 0
if len(A) == n: # 数列が完成
score1 = 0
... | false | 32.142857 | [
"-for A in comb_rplc(list(range(1, m + 1)), n):",
"- sum = 0",
"- for i in range(q):",
"- if A[b[i] - 1] - A[a[i] - 1] == c[i]:",
"- sum = sum + d[i]",
"- if sum >= ans:",
"- ans = sum",
"+",
"+",
"+def dfs(A):",
"+ ans = 0",
"+ if len(A) == n: # 数列が完成"... | false | 0.045186 | 0.173498 | 0.260438 | [
"s728951198",
"s959224069"
] |
u512212329 | p03448 | python | s250332161 | s600595480 | 52 | 37 | 2,940 | 3,064 | Accepted | Accepted | 28.85 | a, b, c, x = [int(eval(input())) for i in range(4)]
g = (
500 * i + 100 * j + 50 * k == x
for i in range(a + 1)
for j in range(b + 1)
for k in range(c + 1)
)
print((sum(g)))
| def main(a, b, c, x):
def gen(coin, n_of_coins, x_parts):
for x_part in x_parts:
for i in range(n_of_coins + 1):
new_x_part = x_part + coin * i
if new_x_part <= x:
yield new_x_part
x_maybe_iter = gen(50, c, gen(100, b, gen(500, a... | 8 | 17 | 189 | 524 | a, b, c, x = [int(eval(input())) for i in range(4)]
g = (
500 * i + 100 * j + 50 * k == x
for i in range(a + 1)
for j in range(b + 1)
for k in range(c + 1)
)
print((sum(g)))
| def main(a, b, c, x):
def gen(coin, n_of_coins, x_parts):
for x_part in x_parts:
for i in range(n_of_coins + 1):
new_x_part = x_part + coin * i
if new_x_part <= x:
yield new_x_part
x_maybe_iter = gen(50, c, gen(100, b, gen(500, a, [0])))
... | false | 52.941176 | [
"-a, b, c, x = [int(eval(input())) for i in range(4)]",
"-g = (",
"- 500 * i + 100 * j + 50 * k == x",
"- for i in range(a + 1)",
"- for j in range(b + 1)",
"- for k in range(c + 1)",
"-)",
"-print((sum(g)))",
"+def main(a, b, c, x):",
"+ def gen(coin, n_of_coins, x_parts):",
"+ ... | false | 0.114438 | 0.051757 | 2.211069 | [
"s250332161",
"s600595480"
] |
u955248595 | p03013 | python | s451567384 | s623597938 | 510 | 200 | 469,184 | 13,452 | Accepted | Accepted | 60.78 | N,M = (int(x) for x in input().split())
Broken = [True]*(N+1)
for TM in range(0,M):
Broken[int(eval(input()))] = False
DP = [1]+[0]*N
for Now in range(0,N):
for Next in range(Now+1,min(N+1,Now+3)):
if Broken[Next]==True: DP[Next] += DP[Now]
print((DP[N]%1000000007)) | N,M = (int(x) for x in input().split())
Broken = [True]*(N+1)
for TM in range(0,M):
Broken[int(eval(input()))] = False
DP = [1]+[0]*N
for Now in range(0,N):
for Next in range(Now+1,min(N+1,Now+3)):
if Broken[Next]==True:
DP[Next] = (DP[Next]+DP[Now])%1000000007
print((DP[N])) | 10 | 10 | 284 | 305 | N, M = (int(x) for x in input().split())
Broken = [True] * (N + 1)
for TM in range(0, M):
Broken[int(eval(input()))] = False
DP = [1] + [0] * N
for Now in range(0, N):
for Next in range(Now + 1, min(N + 1, Now + 3)):
if Broken[Next] == True:
DP[Next] += DP[Now]
print((DP[N] % 1000000007))
| N, M = (int(x) for x in input().split())
Broken = [True] * (N + 1)
for TM in range(0, M):
Broken[int(eval(input()))] = False
DP = [1] + [0] * N
for Now in range(0, N):
for Next in range(Now + 1, min(N + 1, Now + 3)):
if Broken[Next] == True:
DP[Next] = (DP[Next] + DP[Now]) % 1000000007
print... | false | 0 | [
"- DP[Next] += DP[Now]",
"-print((DP[N] % 1000000007))",
"+ DP[Next] = (DP[Next] + DP[Now]) % 1000000007",
"+print((DP[N]))"
] | false | 0.082882 | 0.04468 | 1.855002 | [
"s451567384",
"s623597938"
] |
u073852194 | p02564 | python | s582380864 | s991691204 | 2,135 | 1,974 | 308,972 | 244,224 | Accepted | Accepted | 7.54 | class Graph(): #directed
def __init__(self, n, edge, indexed=1):
self.n = n
self.graph = [[] for _ in range(n)]
self.rev = [[] for _ in range(n)]
self.deg = [0 for _ in range(n)]
for e in edge:
self.graph[e[0] - indexed].append(e[1] - indexed)
... | class StronglyConnectedComponents():
def __init__(self, n):
self.n = n
self.graph = [[] for _ in range(n)]
self.rev = [[] for _ in range(n)]
def add_edge(self, fr, to):
self.graph[fr].append(to)
self.rev[to].append(fr)
def scc_id(self):
group = [-... | 65 | 65 | 2,060 | 1,752 | class Graph: # directed
def __init__(self, n, edge, indexed=1):
self.n = n
self.graph = [[] for _ in range(n)]
self.rev = [[] for _ in range(n)]
self.deg = [0 for _ in range(n)]
for e in edge:
self.graph[e[0] - indexed].append(e[1] - indexed)
self.rev... | class StronglyConnectedComponents:
def __init__(self, n):
self.n = n
self.graph = [[] for _ in range(n)]
self.rev = [[] for _ in range(n)]
def add_edge(self, fr, to):
self.graph[fr].append(to)
self.rev[to].append(fr)
def scc_id(self):
group = [-1] * self.n
... | false | 0 | [
"-class Graph: # directed",
"- def __init__(self, n, edge, indexed=1):",
"+class StronglyConnectedComponents:",
"+ def __init__(self, n):",
"- self.deg = [0 for _ in range(n)]",
"- for e in edge:",
"- self.graph[e[0] - indexed].append(e[1] - indexed)",
"- sel... | false | 0.035777 | 0.043055 | 0.830961 | [
"s582380864",
"s991691204"
] |
u285891772 | p02631 | python | s336524138 | s853168866 | 678 | 169 | 131,080 | 34,236 | Accepted | Accepted | 75.07 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import i... | 49 | 33 | 1,261 | 1,076 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
log,
)
from itertools import (
accumulate,
permutations,
combi... | false | 32.653061 | [
"+ log,",
"- return int(eval(input()))",
"+ return int(input())",
"- return list(map(int, input().split()))",
"+ return map(int, input().split())",
"- return list(zip(*(MAP() for _ in range(n))))",
"+ return zip(*(MAP() for _ in range(n)))",
"+# mod = 998244353",
"+from decimal ... | false | 0.037472 | 0.053074 | 0.706027 | [
"s336524138",
"s853168866"
] |
u592248346 | p03779 | python | s282670492 | s790352030 | 38 | 35 | 9,104 | 9,096 | Accepted | Accepted | 7.89 | x = int(eval(input()))
ans = 0
i = 1
while ans<x:
ans+=i
i+=1
print((i-1)) | x = int(eval(input()))
i,cnt = 0,0
while cnt < x:
i = i + 1
cnt += i
print(i) | 7 | 6 | 80 | 84 | x = int(eval(input()))
ans = 0
i = 1
while ans < x:
ans += i
i += 1
print((i - 1))
| x = int(eval(input()))
i, cnt = 0, 0
while cnt < x:
i = i + 1
cnt += i
print(i)
| false | 14.285714 | [
"-ans = 0",
"-i = 1",
"-while ans < x:",
"- ans += i",
"- i += 1",
"-print((i - 1))",
"+i, cnt = 0, 0",
"+while cnt < x:",
"+ i = i + 1",
"+ cnt += i",
"+print(i)"
] | false | 0.048012 | 0.044776 | 1.072264 | [
"s282670492",
"s790352030"
] |
u017810624 | p03155 | python | s058497755 | s720513289 | 20 | 18 | 3,316 | 2,940 | Accepted | Accepted | 10 | n=int(eval(input()))
h=int(eval(input()))
w=int(eval(input()))
print(((n-h+1)*(n-w+1))) | n=int(eval(input()))
print(((n-int(eval(input()))+1)*(n-int(eval(input()))+1))) | 4 | 2 | 70 | 60 | n = int(eval(input()))
h = int(eval(input()))
w = int(eval(input()))
print(((n - h + 1) * (n - w + 1)))
| n = int(eval(input()))
print(((n - int(eval(input())) + 1) * (n - int(eval(input())) + 1)))
| false | 50 | [
"-h = int(eval(input()))",
"-w = int(eval(input()))",
"-print(((n - h + 1) * (n - w + 1)))",
"+print(((n - int(eval(input())) + 1) * (n - int(eval(input())) + 1)))"
] | false | 0.052444 | 0.036065 | 1.454148 | [
"s058497755",
"s720513289"
] |
u620084012 | p03077 | python | s074920313 | s778920857 | 179 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.5 | from math import ceil
N = int(eval(input()))
L = [int(eval(input())) for k in range(5)]
ans = 5
for k in range(5):
ans = max(ans,4+ceil(N/L[k]))
print(ans)
| from math import ceil
N = int(eval(input()))
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
D = int(eval(input()))
E = int(eval(input()))
L = [A,B,C,D,E]
m = min(L)
print((4+ceil(N/m)))
| 7 | 10 | 154 | 179 | from math import ceil
N = int(eval(input()))
L = [int(eval(input())) for k in range(5)]
ans = 5
for k in range(5):
ans = max(ans, 4 + ceil(N / L[k]))
print(ans)
| from math import ceil
N = int(eval(input()))
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
D = int(eval(input()))
E = int(eval(input()))
L = [A, B, C, D, E]
m = min(L)
print((4 + ceil(N / m)))
| false | 30 | [
"-L = [int(eval(input())) for k in range(5)]",
"-ans = 5",
"-for k in range(5):",
"- ans = max(ans, 4 + ceil(N / L[k]))",
"-print(ans)",
"+A = int(eval(input()))",
"+B = int(eval(input()))",
"+C = int(eval(input()))",
"+D = int(eval(input()))",
"+E = int(eval(input()))",
"+L = [A, B, C, D, E]... | false | 0.056204 | 0.03692 | 1.522308 | [
"s074920313",
"s778920857"
] |
u707124227 | p02670 | python | s667158307 | s707318142 | 1,881 | 1,281 | 168,308 | 120,500 | Accepted | Accepted | 31.9 | from numba import njit
import numpy as np
@njit
def dfs(v,c,h,stay):
# hを更新
x,y=divmod(v,n)
for dx,dy in ((0,1),(0,-1),(1,0),(-1,0)):
nx,ny=x+dx,y+dy
if 0<=nx<n and 0<=ny<n:
nv=nx*n+ny
if h[nv]>c:
h[nv]=c
dfs(nv,c+stay[nv],h... | from numba import njit
import numpy as np
@njit
def dfs(v,c,h,stay,todo):
# hを更新
todo[0]=v
now=0
while now>=0:
vv=todo[now]
now-=1
x,y=divmod(vv,n)
for dx,dy in ((0,1),(0,-1),(1,0),(-1,0)):
nx,ny=x+dx,y+dy
if 0<=nx<n and 0<=ny<n:
... | 35 | 39 | 767 | 924 | from numba import njit
import numpy as np
@njit
def dfs(v, c, h, stay):
# hを更新
x, y = divmod(v, n)
for dx, dy in ((0, 1), (0, -1), (1, 0), (-1, 0)):
nx, ny = x + dx, y + dy
if 0 <= nx < n and 0 <= ny < n:
nv = nx * n + ny
if h[nv] > c:
h[nv] = c
... | from numba import njit
import numpy as np
@njit
def dfs(v, c, h, stay, todo):
# hを更新
todo[0] = v
now = 0
while now >= 0:
vv = todo[now]
now -= 1
x, y = divmod(vv, n)
for dx, dy in ((0, 1), (0, -1), (1, 0), (-1, 0)):
nx, ny = x + dx, y + dy
if 0 <... | false | 10.25641 | [
"-def dfs(v, c, h, stay):",
"+def dfs(v, c, h, stay, todo):",
"- x, y = divmod(v, n)",
"- for dx, dy in ((0, 1), (0, -1), (1, 0), (-1, 0)):",
"- nx, ny = x + dx, y + dy",
"- if 0 <= nx < n and 0 <= ny < n:",
"- nv = nx * n + ny",
"- if h[nv] > c:",
"- ... | false | 0.082965 | 0.048218 | 1.720621 | [
"s667158307",
"s707318142"
] |
u089376182 | p03796 | python | s890545048 | s678682817 | 229 | 36 | 3,972 | 2,940 | Accepted | Accepted | 84.28 | import math
print((math.factorial(int(eval(input()))) % (10**9 + 7))) | n = int(eval(input()))
mod_n = 10**9+7
ans = 1
for i in range(1, n+1):
ans = ans*i%mod_n
print(ans)
| 3 | 9 | 64 | 109 | import math
print((math.factorial(int(eval(input()))) % (10**9 + 7)))
| n = int(eval(input()))
mod_n = 10**9 + 7
ans = 1
for i in range(1, n + 1):
ans = ans * i % mod_n
print(ans)
| false | 66.666667 | [
"-import math",
"-",
"-print((math.factorial(int(eval(input()))) % (10**9 + 7)))",
"+n = int(eval(input()))",
"+mod_n = 10**9 + 7",
"+ans = 1",
"+for i in range(1, n + 1):",
"+ ans = ans * i % mod_n",
"+print(ans)"
] | false | 0.086166 | 0.049935 | 1.725567 | [
"s890545048",
"s678682817"
] |
u389910364 | p03600 | python | s148317884 | s205785837 | 675 | 407 | 45,516 | 17,860 | Accepted | Accepted | 39.7 | import itertools
import sys
sys.setrecursionlimit(10000)
INF = float('inf')
N = int(sys.stdin.readline())
A = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def solve():
# 消していいやつ
useless = [[0] * N for _ in range(N)]
# 1 つ経由するのだけ考えれば OK
for st, en in itertools.comb... | import sys
import numpy as np
sys.setrecursionlimit(10000)
INF = float('inf')
N = int(sys.stdin.readline())
A = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
A = np.array(A, dtype=float) + np.diag([np.inf] * N)
useless = np.zeros((N, N), dtype=bool)
impossible = np.zeros((N, N), dtype... | 28 | 23 | 771 | 585 | import itertools
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
N = int(sys.stdin.readline())
A = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def solve():
# 消していいやつ
useless = [[0] * N for _ in range(N)]
# 1 つ経由するのだけ考えれば OK
for st, en in itertools.combinations(list(ran... | import sys
import numpy as np
sys.setrecursionlimit(10000)
INF = float("inf")
N = int(sys.stdin.readline())
A = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
A = np.array(A, dtype=float) + np.diag([np.inf] * N)
useless = np.zeros((N, N), dtype=bool)
impossible = np.zeros((N, N), dtype=bool)
for via ... | false | 17.857143 | [
"-import itertools",
"+import numpy as np",
"-",
"-",
"-def solve():",
"- # 消していいやつ",
"- useless = [[0] * N for _ in range(N)]",
"- # 1 つ経由するのだけ考えれば OK",
"- for st, en in itertools.combinations(list(range(N)), r=2):",
"- for via in range(N):",
"- if via in [st, en]:... | false | 0.042295 | 0.368439 | 0.114796 | [
"s148317884",
"s205785837"
] |
u644907318 | p02995 | python | s500304080 | s263134980 | 170 | 63 | 38,384 | 61,928 | Accepted | Accepted | 62.94 | def gcd(x,y):
while y>0:
x,y = y,x%y
return x
A,B,C,D = list(map(int,input().split()))
E = (C//gcd(C,D))*D
c1 = B//C
d1 = B//D
e1 = B//E
y = B-(c1+d1-e1)
c2 = (A-1)//C
d2 = (A-1)//D
e2 = (A-1)//E
x = (A-1)-(c2+d2-e2)
print((y-x)) | A,B,C,D =list(map(int,input().split()))
x = C
y = D
while y>0:
x,y = y,x%y
E = (C//x)*D
bc = B//C
bd = B//D
be = B//E
b = B-(bc+bd-be)
ac = (A-1)//C
ad = (A-1)//D
ae = (A-1)//E
a = A-1-(ac+ad-ae)
print((b-a)) | 15 | 15 | 251 | 218 | def gcd(x, y):
while y > 0:
x, y = y, x % y
return x
A, B, C, D = list(map(int, input().split()))
E = (C // gcd(C, D)) * D
c1 = B // C
d1 = B // D
e1 = B // E
y = B - (c1 + d1 - e1)
c2 = (A - 1) // C
d2 = (A - 1) // D
e2 = (A - 1) // E
x = (A - 1) - (c2 + d2 - e2)
print((y - x))
| A, B, C, D = list(map(int, input().split()))
x = C
y = D
while y > 0:
x, y = y, x % y
E = (C // x) * D
bc = B // C
bd = B // D
be = B // E
b = B - (bc + bd - be)
ac = (A - 1) // C
ad = (A - 1) // D
ae = (A - 1) // E
a = A - 1 - (ac + ad - ae)
print((b - a))
| false | 0 | [
"-def gcd(x, y):",
"- while y > 0:",
"- x, y = y, x % y",
"- return x",
"-",
"-",
"-E = (C // gcd(C, D)) * D",
"-c1 = B // C",
"-d1 = B // D",
"-e1 = B // E",
"-y = B - (c1 + d1 - e1)",
"-c2 = (A - 1) // C",
"-d2 = (A - 1) // D",
"-e2 = (A - 1) // E",
"-x = (A - 1) - (c2 + d... | false | 0.042594 | 0.121293 | 0.351166 | [
"s500304080",
"s263134980"
] |
u340781749 | p03392 | python | s876207507 | s647620109 | 1,371 | 928 | 3,764 | 3,772 | Accepted | Accepted | 32.31 | def solve(s):
if all(a == b for a, b in zip(s, s[1:])):
return 1
if len(s) == 2:
return 2
elif len(s) == 3:
if s[0] == s[1] or s[1] == s[2]:
return 6
elif s[0] == s[2]:
return 7
else:
return 3
# dp[has succession][mo... | def solve(s):
if all(a == b for a, b in zip(s, s[1:])):
return 1
if len(s) == 2:
return 2
elif len(s) == 3:
if s[0] == s[1] or s[1] == s[2]:
return 6
elif s[0] == s[2]:
return 7
else:
return 3
# dp[has succession=0][... | 47 | 41 | 1,737 | 1,473 | def solve(s):
if all(a == b for a, b in zip(s, s[1:])):
return 1
if len(s) == 2:
return 2
elif len(s) == 3:
if s[0] == s[1] or s[1] == s[2]:
return 6
elif s[0] == s[2]:
return 7
else:
return 3
# dp[has succession][mod 3][last ch... | def solve(s):
if all(a == b for a, b in zip(s, s[1:])):
return 1
if len(s) == 2:
return 2
elif len(s) == 3:
if s[0] == s[1] or s[1] == s[2]:
return 6
elif s[0] == s[2]:
return 7
else:
return 3
# dp[has succession=0][mod 3][last ... | false | 12.765957 | [
"- # dp[has succession][mod 3][last char]",
"- dp = [[[0] * 3 for _ in range(3)] for _ in range(2)]",
"+ # dp[has succession=0][mod 3][last char], dp[has succession=1][mod 3]",
"+ dp = [[[0] * 3 for _ in range(3)], [0] * 3]",
"- ndp = [[[0] * 3 for _ in range(3)] for _ in range(2)]",
"+... | false | 0.036867 | 0.037306 | 0.98822 | [
"s876207507",
"s647620109"
] |
u127499732 | p03634 | python | s117835719 | s795785363 | 645 | 533 | 193,304 | 184,088 | Accepted | Accepted | 17.36 | def main():
from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)
n, *rem = list(map(int, open(0).read().split()))
t = 3 * (n - 1)
abc = rem[:t]
q, k = rem[t], rem[t + 1]
xy = rem[t + 2:]
m = [[] for _ in range(n + 1)]
dist = defaultdict(dict)
... | def main():
from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)
n, *rem = list(map(int, open(0).read().split()))
t = 3 * (n - 1)
abc = rem[:t]
q, k = rem[t], rem[t + 1]
xy = rem[t + 2:]
dist = defaultdict(dict)
for a, b, c in zip(*[iter(abc)]... | 46 | 41 | 1,006 | 901 | def main():
from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)
n, *rem = list(map(int, open(0).read().split()))
t = 3 * (n - 1)
abc = rem[:t]
q, k = rem[t], rem[t + 1]
xy = rem[t + 2 :]
m = [[] for _ in range(n + 1)]
dist = defaultdict(dict)
for a,... | def main():
from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)
n, *rem = list(map(int, open(0).read().split()))
t = 3 * (n - 1)
abc = rem[:t]
q, k = rem[t], rem[t + 1]
xy = rem[t + 2 :]
dist = defaultdict(dict)
for a, b, c in zip(*[iter(abc)] * 3):
... | false | 10.869565 | [
"- m = [[] for _ in range(n + 1)]",
"- m[a].append(b)",
"- m[b].append(a)",
"- def dfs(frm, to):",
"- if vis[to]:",
"+ def dfs(a, b):",
"+ if vis[b]:",
"- vis[to] = True",
"- cost[to] = cost[frm] + dist[frm][to]",
"- frm = to",
"- ... | false | 0.041485 | 0.040295 | 1.029524 | [
"s117835719",
"s795785363"
] |
u680851063 | p02731 | python | s605626524 | s819217888 | 43 | 17 | 5,332 | 2,940 | Accepted | Accepted | 60.47 | from decimal import Decimal
#x = Decimal(5).sqrt()
#print(x)
n = int(eval(input()))
print(((Decimal(str(n)) / Decimal(str(3))) ** Decimal(str(3))))
| x = int(eval(input()))
print(((x/3)**3))
| 11 | 3 | 156 | 36 | from decimal import Decimal
# x = Decimal(5).sqrt()
# print(x)
n = int(eval(input()))
print(((Decimal(str(n)) / Decimal(str(3))) ** Decimal(str(3))))
| x = int(eval(input()))
print(((x / 3) ** 3))
| false | 72.727273 | [
"-from decimal import Decimal",
"-",
"-# x = Decimal(5).sqrt()",
"-# print(x)",
"-n = int(eval(input()))",
"-print(((Decimal(str(n)) / Decimal(str(3))) ** Decimal(str(3))))",
"+x = int(eval(input()))",
"+print(((x / 3) ** 3))"
] | false | 0.086722 | 0.042784 | 2.026985 | [
"s605626524",
"s819217888"
] |
u231518782 | p02681 | python | s160258287 | s192662396 | 23 | 21 | 9,076 | 9,108 | Accepted | Accepted | 8.7 | import sys
S = eval(input())
T = eval(input())
if S == T[:-1]:
print("Yes")
else:
print("No") | S = eval(input())
T = eval(input())
if len(S) + 1 == len(T) and S == T[:-1] and 1 <= len(S) <= 10 and T.islower() == True and S.islower() == True:
print("Yes")
else:
print("No") | 9 | 7 | 99 | 181 | import sys
S = eval(input())
T = eval(input())
if S == T[:-1]:
print("Yes")
else:
print("No")
| S = eval(input())
T = eval(input())
if (
len(S) + 1 == len(T)
and S == T[:-1]
and 1 <= len(S) <= 10
and T.islower() == True
and S.islower() == True
):
print("Yes")
else:
print("No")
| false | 22.222222 | [
"-import sys",
"-",
"-if S == T[:-1]:",
"+if (",
"+ len(S) + 1 == len(T)",
"+ and S == T[:-1]",
"+ and 1 <= len(S) <= 10",
"+ and T.islower() == True",
"+ and S.islower() == True",
"+):"
] | false | 0.035998 | 0.060781 | 0.592263 | [
"s160258287",
"s192662396"
] |
u546338822 | p02948 | python | s000184745 | s689021086 | 467 | 306 | 26,072 | 29,232 | Accepted | Accepted | 34.48 | def main():
import heapq
n,m = list(map(int,input().split()))
jobs = {}
for i in range(n):
a,b = list(map(int,input().split()))
if a not in list(jobs.keys()):
jobs[a] = [b]
else:
jobs[a] += [b]
ob = []
ans = 0
for i in range(1,m+1):... | def main():
import heapq
n,m = list(map(int,input().split()))
job = {}
for i in range(n):
a,b = list(map(int,input().split()))
if a not in list(job.keys()):
job[a] = [b]
else:
job[a].append(b)
ans = 0
hp = []
for i in range(1,m+1):
... | 22 | 22 | 547 | 544 | def main():
import heapq
n, m = list(map(int, input().split()))
jobs = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a not in list(jobs.keys()):
jobs[a] = [b]
else:
jobs[a] += [b]
ob = []
ans = 0
for i in range(1, m + 1):
... | def main():
import heapq
n, m = list(map(int, input().split()))
job = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a not in list(job.keys()):
job[a] = [b]
else:
job[a].append(b)
ans = 0
hp = []
for i in range(1, m + 1):
... | false | 0 | [
"- jobs = {}",
"+ job = {}",
"- if a not in list(jobs.keys()):",
"- jobs[a] = [b]",
"+ if a not in list(job.keys()):",
"+ job[a] = [b]",
"- jobs[a] += [b]",
"- ob = []",
"+ job[a].append(b)",
"+ hp = []",
"- if i in lis... | false | 0.043239 | 0.037419 | 1.155522 | [
"s000184745",
"s689021086"
] |
u670180528 | p03142 | python | s323459396 | s614893300 | 1,652 | 210 | 37,488 | 37,892 | Accepted | Accepted | 87.29 | def main():
v, e, *L = list(map(int, open(0).read().split()))
g = [[] for _ in range(v)]
deg = [0] * v
for s, t in zip(*[iter(L)] * 2):
g[s - 1].append(t - 1)
deg[t - 1] += 1
q = []
for i, d in enumerate(deg):
if not d:
q.append(i)
ans = [0] * v
while q:
c = q.pop(0)
for n in g[c]:
... | from collections import*
def main():
v, e, *L = list(map(int, open(0).read().split()))
g = [[] for _ in range(v)]
deg = [0] * v
for s, t in zip(*[iter(L)] * 2):
g[s - 1].append(t - 1)
deg[t - 1] += 1
q = deque()
for i, d in enumerate(deg):
if not d:
q.append(i)
ans = [0] * v
while q:
... | 23 | 25 | 456 | 492 | def main():
v, e, *L = list(map(int, open(0).read().split()))
g = [[] for _ in range(v)]
deg = [0] * v
for s, t in zip(*[iter(L)] * 2):
g[s - 1].append(t - 1)
deg[t - 1] += 1
q = []
for i, d in enumerate(deg):
if not d:
q.append(i)
ans = [0] * v
while ... | from collections import *
def main():
v, e, *L = list(map(int, open(0).read().split()))
g = [[] for _ in range(v)]
deg = [0] * v
for s, t in zip(*[iter(L)] * 2):
g[s - 1].append(t - 1)
deg[t - 1] += 1
q = deque()
for i, d in enumerate(deg):
if not d:
q.appen... | false | 8 | [
"+from collections import *",
"+",
"+",
"- q = []",
"+ q = deque()",
"- c = q.pop(0)",
"+ c = q.popleft()"
] | false | 0.036834 | 0.054481 | 0.676089 | [
"s323459396",
"s614893300"
] |
u256464928 | p03568 | python | s727037347 | s141759194 | 1,369 | 17 | 14,392 | 2,940 | Accepted | Accepted | 98.76 | def main():
import numpy as np
N = int(eval(input()))
A = list(map(int,input().split()))
def ternary (n):
if n == 0:
return '0'
nums = []
while n:
n, r = divmod(n, 3)
nums.append(str(r))
return ''.join(reversed(nums))
ans = 0
AA = np.arr... | def main():
N = int(eval(input()))
A = list(map(int,input().split()))
tmp = 1
for i in range(N):
if A[i] % 2 == 0:
tmp *= 2
print((3**N - tmp))
main() | 30 | 9 | 607 | 174 | def main():
import numpy as np
N = int(eval(input()))
A = list(map(int, input().split()))
def ternary(n):
if n == 0:
return "0"
nums = []
while n:
n, r = divmod(n, 3)
nums.append(str(r))
return "".join(reversed(nums))
ans = 0
... | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
tmp = 1
for i in range(N):
if A[i] % 2 == 0:
tmp *= 2
print((3**N - tmp))
main()
| false | 70 | [
"- import numpy as np",
"-",
"-",
"- def ternary(n):",
"- if n == 0:",
"- return \"0\"",
"- nums = []",
"- while n:",
"- n, r = divmod(n, 3)",
"- nums.append(str(r))",
"- return \"\".join(reversed(nums))",
"-",
"- ans = 0"... | false | 0.698603 | 0.048147 | 14.509756 | [
"s727037347",
"s141759194"
] |
u326261815 | p03308 | python | s053968705 | s900917456 | 30 | 27 | 9,008 | 9,088 | Accepted | Accepted | 10 | count=eval(input())
list=input().rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(list2[0]-list2[int(count)-1])
if sa<0:
print((-1*sa))
else:
print(sa) | count=eval(input())
list=input().rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(max(list2)-min(list2))
if sa<0:
print((-1*sa))
else:
print(sa) | 9 | 9 | 182 | 175 | count = eval(input())
list = input().rstrip().split(" ")
list_1 = [int(s) for s in list]
list2 = sorted(list_1)
sa = list2[0] - list2[int(count) - 1]
if sa < 0:
print((-1 * sa))
else:
print(sa)
| count = eval(input())
list = input().rstrip().split(" ")
list_1 = [int(s) for s in list]
list2 = sorted(list_1)
sa = max(list2) - min(list2)
if sa < 0:
print((-1 * sa))
else:
print(sa)
| false | 0 | [
"-sa = list2[0] - list2[int(count) - 1]",
"+sa = max(list2) - min(list2)"
] | false | 0.040693 | 0.038847 | 1.047517 | [
"s053968705",
"s900917456"
] |
u268793453 | p03409 | python | s450132511 | s322887587 | 50 | 21 | 3,064 | 3,064 | Accepted | Accepted | 58 | n = int(eval(input()))
A = [[int(i) for i in input().split()] for j in range(n)]
C = [[int(i) for i in input().split()] for j in range(n)]
ans = []
for bits in range(1, 2**4):
cnt = 0
used = [False] * n
A.sort(key=lambda x:x[bits & 1], reverse=bits >> 1 & 1)
C.sort(key=lambda x:x[bits >> 2... | n = int(eval(input()))
A = [[int(i) for i in input().split()] for j in range(n)]
C = [[int(i) for i in input().split()] for j in range(n)]
ans = 0
used = [False] * n
A.sort(key=lambda x:x[1], reverse=True)
C.sort()
for c, d in C:
i = 0
while i < n and (used[i] or A[i][0] >= c or A[i][1] >= d):
... | 27 | 20 | 621 | 409 | n = int(eval(input()))
A = [[int(i) for i in input().split()] for j in range(n)]
C = [[int(i) for i in input().split()] for j in range(n)]
ans = []
for bits in range(1, 2**4):
cnt = 0
used = [False] * n
A.sort(key=lambda x: x[bits & 1], reverse=bits >> 1 & 1)
C.sort(key=lambda x: x[bits >> 2 & 1], rever... | n = int(eval(input()))
A = [[int(i) for i in input().split()] for j in range(n)]
C = [[int(i) for i in input().split()] for j in range(n)]
ans = 0
used = [False] * n
A.sort(key=lambda x: x[1], reverse=True)
C.sort()
for c, d in C:
i = 0
while i < n and (used[i] or A[i][0] >= c or A[i][1] >= d):
i += 1
... | false | 25.925926 | [
"-ans = []",
"-for bits in range(1, 2**4):",
"- cnt = 0",
"- used = [False] * n",
"- A.sort(key=lambda x: x[bits & 1], reverse=bits >> 1 & 1)",
"- C.sort(key=lambda x: x[bits >> 2 & 1], reverse=bits >> 3 & 1)",
"- for a, b in A:",
"- i = 0",
"- while i < n and (used[i] o... | false | 0.040696 | 0.035512 | 1.145969 | [
"s450132511",
"s322887587"
] |
u201234972 | p02793 | python | s565680829 | s901931778 | 1,951 | 1,115 | 4,844 | 4,468 | Accepted | Accepted | 42.85 | import sys
input = sys.stdin.readline
from collections import defaultdict
def prime_factors(d,N): #素因数 1を含まないことに注意
ret = []
middle = int( N**(1/2))
tmp = N
for i in range(2, middle+1):
if tmp%i == 0:
c = 0
while tmp%i == 0:
tmp //= i
... | import sys
input = sys.stdin.readline
from collections import defaultdict
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def prime_factors(d,N): #素因数 1を含まないことに注意
ret = []
middle = int( N**(1/2))
tmp = N
for i in range(2, middle+1):
if tmp%i == 0:
... | 39 | 44 | 835 | 947 | import sys
input = sys.stdin.readline
from collections import defaultdict
def prime_factors(d, N): # 素因数 1を含まないことに注意
ret = []
middle = int(N ** (1 / 2))
tmp = N
for i in range(2, middle + 1):
if tmp % i == 0:
c = 0
while tmp % i == 0:
tmp //= i
... | import sys
input = sys.stdin.readline
from collections import defaultdict
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def prime_factors(d, N): # 素因数 1を含まないことに注意
ret = []
middle = int(N ** (1 / 2))
tmp = N
for i in range(2, middle + 1):
if tmp % i == 0:
... | false | 11.363636 | [
"+",
"+",
"+def gcd(a, b):",
"+ while b != 0:",
"+ a, b = b, a % b",
"+ return a",
"- d = defaultdict(int)",
"+ # d = defaultdict( int)",
"+ # for a in A:",
"+ # prime_factors(d, a)",
"+ s = 1",
"- prime_factors(d, a)",
"- s = 1",
"- for key, va... | false | 0.04727 | 0.154212 | 0.306522 | [
"s565680829",
"s901931778"
] |
u011621222 | p01846 | python | s601448697 | s112578151 | 30 | 20 | 5,604 | 5,624 | Accepted | Accepted | 33.33 |
while True:
s = eval(input())
if s == '#':
break
rows = s.split('/')
a, b, c, d = list(map(int, input().split()))
a -= 1
b -= 1
c -= 1
d -= 1
grid = ['' for _ in rows]
for i, row in enumerate(rows):
for kk in row:
if kk == 'b':
... | while True:
st = list(input().split("/"))
if st == ["#"]:
break
a, b, c, d = list(map(int, input().split()))
s=[]
for i in range(len(st)):
str=[]
for ele in st[i]:
if ele=="b":
str.append("b")
else:
for _ i... | 44 | 60 | 958 | 1,357 | while True:
s = eval(input())
if s == "#":
break
rows = s.split("/")
a, b, c, d = list(map(int, input().split()))
a -= 1
b -= 1
c -= 1
d -= 1
grid = ["" for _ in rows]
for i, row in enumerate(rows):
for kk in row:
if kk == "b":
grid[i] ... | while True:
st = list(input().split("/"))
if st == ["#"]:
break
a, b, c, d = list(map(int, input().split()))
s = []
for i in range(len(st)):
str = []
for ele in st[i]:
if ele == "b":
str.append("b")
else:
for _ in range(... | false | 26.666667 | [
"- s = eval(input())",
"- if s == \"#\":",
"+ st = list(input().split(\"/\"))",
"+ if st == [\"#\"]:",
"- rows = s.split(\"/\")",
"- a -= 1",
"- b -= 1",
"- c -= 1",
"- d -= 1",
"- grid = [\"\" for _ in rows]",
"- for i, row in enumerate(rows):",
"- for ... | false | 0.038592 | 0.03913 | 0.986261 | [
"s601448697",
"s112578151"
] |
u661141510 | p03103 | python | s557523519 | s063711437 | 537 | 347 | 28,656 | 27,804 | Accepted | Accepted | 35.38 | N, M = list(map(int, input().split()))
AB = [0] * N
for i in range(N):
AB[i] = list(map(int, input().split()))
AB = sorted(AB)
cnt = 0
ans = 0
for e in AB:
if cnt + e[1] < M:
ans += e[0] * e[1]
cnt += e[1]
else:
ans += e[0] * (M - cnt)
break
print(ans) | import sys
N, M = list(map(int, sys.stdin.readline().split()))
AB = [None] * N
for i in range(N):
AB[i] = list(map(int, sys.stdin.readline().split()))
AB.sort()
cnt = 0
ans = 0
for a,b in AB:
if cnt + b < M:
ans += a * b
cnt += b
else:
ans += a * (M - cnt)
... | 18 | 20 | 311 | 335 | N, M = list(map(int, input().split()))
AB = [0] * N
for i in range(N):
AB[i] = list(map(int, input().split()))
AB = sorted(AB)
cnt = 0
ans = 0
for e in AB:
if cnt + e[1] < M:
ans += e[0] * e[1]
cnt += e[1]
else:
ans += e[0] * (M - cnt)
break
print(ans)
| import sys
N, M = list(map(int, sys.stdin.readline().split()))
AB = [None] * N
for i in range(N):
AB[i] = list(map(int, sys.stdin.readline().split()))
AB.sort()
cnt = 0
ans = 0
for a, b in AB:
if cnt + b < M:
ans += a * b
cnt += b
else:
ans += a * (M - cnt)
break
print(ans)
| false | 10 | [
"-N, M = list(map(int, input().split()))",
"-AB = [0] * N",
"+import sys",
"+",
"+N, M = list(map(int, sys.stdin.readline().split()))",
"+AB = [None] * N",
"- AB[i] = list(map(int, input().split()))",
"-AB = sorted(AB)",
"+ AB[i] = list(map(int, sys.stdin.readline().split()))",
"+AB.sort()",... | false | 0.043382 | 0.03885 | 1.11664 | [
"s557523519",
"s063711437"
] |
u057415180 | p03476 | python | s404798537 | s970069465 | 1,610 | 400 | 15,912 | 16,376 | Accepted | Accepted | 75.16 | def l(): return list(map(int, input().split()))
def m(): return list(map(int, input().split()))
def sieve(n): # エラトステネスの篩ですよ
num = [True]*n
num[0] = num[1] = False
for i in range(2,int(n**0.5)+1):
if num[i]:
for j in range(i**2, n, i):
num[j] = False
return [i for i in range(2,n) if... | def l(): return list(map(int, input().split()))
def m(): return list(map(int, input().split()))
def sieve(n): # エラトステネスの篩ですよ
num = [True]*n
num[0] = num[1] = False
for i in range(2,int(n**0.5)+1):
if num[i]:
for j in range(i**2, n, i):
num[j] = False
return num
def main():
q =... | 34 | 34 | 770 | 772 | def l():
return list(map(int, input().split()))
def m():
return list(map(int, input().split()))
def sieve(n): # エラトステネスの篩ですよ
num = [True] * n
num[0] = num[1] = False
for i in range(2, int(n**0.5) + 1):
if num[i]:
for j in range(i**2, n, i):
num[j] = False
... | def l():
return list(map(int, input().split()))
def m():
return list(map(int, input().split()))
def sieve(n): # エラトステネスの篩ですよ
num = [True] * n
num[0] = num[1] = False
for i in range(2, int(n**0.5) + 1):
if num[i]:
for j in range(i**2, n, i):
num[j] = False
... | false | 0 | [
"- return [i for i in range(2, n) if num[i]]",
"+ return num",
"- rr = max(r)",
"+ rr = 101010",
"- for i in prime:",
"- if (i + 1) // 2 in prime:",
"- likp[i - 1] = 1",
"+ for i in range(rr):",
"+ if i % 2 == 0:",
"+ continue",
"+ if ... | false | 0.037892 | 0.070414 | 0.538135 | [
"s404798537",
"s970069465"
] |
u983918956 | p03166 | python | s690358445 | s882933961 | 421 | 351 | 74,996 | 75,004 | Accepted | Accepted | 16.63 | import sys
input = sys.stdin.readline
from collections import deque
N,M = list(map(int,input().split()))
dp = [-1]*N
ad = [deque() for _ in range(N)]
num = [0]*N
for _ in range(M):
x,y = list(map(int,input().split()))
x -= 1; y -= 1
ad[x].append(y)
num[y] += 1
L = []
S = deque()
for ... | def main():
import sys
input = sys.stdin.readline
from collections import deque
N,M = list(map(int,input().split()))
dp = [-1]*N
ad = [deque() for _ in range(N)]
num = [0]*N
for _ in range(M):
x,y = list(map(int,input().split()))
x -= 1; y -= 1
ad[x].... | 35 | 38 | 671 | 814 | import sys
input = sys.stdin.readline
from collections import deque
N, M = list(map(int, input().split()))
dp = [-1] * N
ad = [deque() for _ in range(N)]
num = [0] * N
for _ in range(M):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
ad[x].append(y)
num[y] += 1
L = []
S = deque()
for v in ra... | def main():
import sys
input = sys.stdin.readline
from collections import deque
N, M = list(map(int, input().split()))
dp = [-1] * N
ad = [deque() for _ in range(N)]
num = [0] * N
for _ in range(M):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
ad... | false | 7.894737 | [
"-import sys",
"+def main():",
"+ import sys",
"-input = sys.stdin.readline",
"-from collections import deque",
"+ input = sys.stdin.readline",
"+ from collections import deque",
"-N, M = list(map(int, input().split()))",
"-dp = [-1] * N",
"-ad = [deque() for _ in range(N)]",
"-num = [0... | false | 0.051947 | 0.049787 | 1.043392 | [
"s690358445",
"s882933961"
] |
u375616706 | p02960 | python | s805789707 | s826226273 | 796 | 588 | 65,244 | 61,916 | Accepted | Accepted | 26.13 | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
MOD = 10**9+7
S = input()[:-1]
#dp[文字列をしたの桁からI番目まで見て][あまりがjになる数] = のこすう
dp = [[0]*13 for _ in range(len(S)+1)]
dp[0][0] = 1
# 文字列を逆順から見ていく
S = list(reversed(S))
for i in range(len(S)):
if S[i] == "?":
dig = pow(10, i, 13)
... | S=eval(input())
N=len(S)
C=13
MOD=10**9+7
DP=[[0]*C for _ in range(N+1)]#DP[i][j]はi番目まで見て、あまりがjノヤツの個数
DP[0][0]=1
for i,s in enumerate(S,1):
if s=="?":
for k in range(C):
for j in range(10):
new_mod=k*10+j
DP[i][new_mod%13]+=DP[i-1][k]
else:
... | 28 | 22 | 756 | 482 | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
MOD = 10**9 + 7
S = input()[:-1]
# dp[文字列をしたの桁からI番目まで見て][あまりがjになる数] = のこすう
dp = [[0] * 13 for _ in range(len(S) + 1)]
dp[0][0] = 1
# 文字列を逆順から見ていく
S = list(reversed(S))
for i in range(len(S)):
if S[i] == "?":
dig = pow(10, i, 13)
# ?... | S = eval(input())
N = len(S)
C = 13
MOD = 10**9 + 7
DP = [[0] * C for _ in range(N + 1)] # DP[i][j]はi番目まで見て、あまりがjノヤツの個数
DP[0][0] = 1
for i, s in enumerate(S, 1):
if s == "?":
for k in range(C):
for j in range(10):
new_mod = k * 10 + j
DP[i][new_mod % 13] += DP[i ... | false | 21.428571 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**9)",
"-input = sys.stdin.readline",
"+S = eval(input())",
"+N = len(S)",
"+C = 13",
"-S = input()[:-1]",
"-# dp[文字列をしたの桁からI番目まで見て][あまりがjになる数] = のこすう",
"-dp = [[0] * 13 for _ in range(len(S) + 1)]",
"-dp[0][0] = 1",
"-# 文字列を逆順から見ていく",
"-S = list... | false | 0.039651 | 0.037749 | 1.050364 | [
"s805789707",
"s826226273"
] |
u312025627 | p03720 | python | s862043262 | s879322012 | 184 | 165 | 38,384 | 38,504 | Accepted | Accepted | 10.33 | n, m = (int(i) for i in input().split())
city2city = [0] * n
for i in range(m):
a,b = (int(i) for i in input().split())
city2city[a-1] += 1
city2city[b-1] += 1
for c in city2city:
print(c)
| def main():
N, M = (int(i) for i in input().split())
c = [0 for i in range(N)]
for i in range(M):
a, b = (int(i) for i in input().split())
c[a-1] += 1
c[b-1] += 1
print(*c, sep="\n")
if __name__ == '__main__':
main()
| 9 | 12 | 214 | 274 | n, m = (int(i) for i in input().split())
city2city = [0] * n
for i in range(m):
a, b = (int(i) for i in input().split())
city2city[a - 1] += 1
city2city[b - 1] += 1
for c in city2city:
print(c)
| def main():
N, M = (int(i) for i in input().split())
c = [0 for i in range(N)]
for i in range(M):
a, b = (int(i) for i in input().split())
c[a - 1] += 1
c[b - 1] += 1
print(*c, sep="\n")
if __name__ == "__main__":
main()
| false | 25 | [
"-n, m = (int(i) for i in input().split())",
"-city2city = [0] * n",
"-for i in range(m):",
"- a, b = (int(i) for i in input().split())",
"- city2city[a - 1] += 1",
"- city2city[b - 1] += 1",
"-for c in city2city:",
"- print(c)",
"+def main():",
"+ N, M = (int(i) for i in input().sp... | false | 0.049303 | 0.101244 | 0.486972 | [
"s862043262",
"s879322012"
] |
u462329577 | p03623 | python | s894445629 | s148452940 | 169 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.94 | def print_ans(x,a,b):
"""Print min(abs(x-a),abs(x-b))
Parameters
--------------
Examples
------------
>>> print_ans(3,0,1)
B
>>> print_ans(3,2,5)
A
>>> print_ans(2,5,9)
A
"""
#print(min(abs(x-a),abs(x-b)))
if min(abs(x-a),abs(x-b)) == abs(x-b):
... | #!/usr/bin/env python3
import sys
n,a,b = list(map(int,input().split()))
#print(min(abs(n-a),abs(n-b)))
print(("A" if abs(n-a) < abs(n-b) else "B" )) | 27 | 6 | 462 | 147 | def print_ans(x, a, b):
"""Print min(abs(x-a),abs(x-b))
Parameters
--------------
Examples
------------
>>> print_ans(3,0,1)
B
>>> print_ans(3,2,5)
A
>>> print_ans(2,5,9)
A
"""
# print(min(abs(x-a),abs(x-b)))
if min(abs(x - a), abs(x - b)) == abs(x - b):
p... | #!/usr/bin/env python3
import sys
n, a, b = list(map(int, input().split()))
# print(min(abs(n-a),abs(n-b)))
print(("A" if abs(n - a) < abs(n - b) else "B"))
| false | 77.777778 | [
"-def print_ans(x, a, b):",
"- \"\"\"Print min(abs(x-a),abs(x-b))",
"- Parameters",
"- Examples",
"- >>> print_ans(3,0,1)",
"- B",
"- >>> print_ans(3,2,5)",
"- A",
"- >>> print_ans(2,5,9)",
"- A",
"- \"\"\"",
"- # print(min(abs(x-a),abs(x-b)))",
"- if min(... | false | 0.054683 | 0.035668 | 1.533128 | [
"s894445629",
"s148452940"
] |
u050428930 | p03363 | python | s804880891 | s735455902 | 1,489 | 133 | 42,252 | 42,232 | Accepted | Accepted | 91.07 | n=int(eval(input()))
s=list(map(int,input().split()))
from itertools import accumulate
from collections import Counter
from math import factorial
p=0
def f(n,m):
return factorial(n)//(factorial(n-m)*factorial(m))
t=[0]+list(accumulate(s))
for i in list(Counter(t).values()):
if i>1:
p+=f(i,2)
... | n=int(eval(input()))
s=list(map(int,input().split()))
from itertools import accumulate
from collections import Counter
p=0
t=[0]+list(accumulate(s))
for i in list(Counter(t).values()):
if i>1:
p+=i*(i-1)//2
print(p) | 13 | 10 | 317 | 224 | n = int(eval(input()))
s = list(map(int, input().split()))
from itertools import accumulate
from collections import Counter
from math import factorial
p = 0
def f(n, m):
return factorial(n) // (factorial(n - m) * factorial(m))
t = [0] + list(accumulate(s))
for i in list(Counter(t).values()):
if i > 1:
... | n = int(eval(input()))
s = list(map(int, input().split()))
from itertools import accumulate
from collections import Counter
p = 0
t = [0] + list(accumulate(s))
for i in list(Counter(t).values()):
if i > 1:
p += i * (i - 1) // 2
print(p)
| false | 23.076923 | [
"-from math import factorial",
"-",
"-",
"-def f(n, m):",
"- return factorial(n) // (factorial(n - m) * factorial(m))",
"-",
"-",
"- p += f(i, 2)",
"+ p += i * (i - 1) // 2"
] | false | 0.03632 | 0.052442 | 0.692574 | [
"s804880891",
"s735455902"
] |
u775681539 | p02954 | python | s005645124 | s638930297 | 197 | 178 | 5,544 | 6,492 | Accepted | Accepted | 9.64 | #python3
def main():
s = list(input())
n = len(s)
ans = [0 for _ in range(n)]
for _ in range(2):
c = 0
for i in range(n):
if s[i] == 'R':
c += 1
else:
ans[i-1] += (c+1)//2
ans[i] += c//2
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
S = readline().decode().rstrip()
T = ['L' if i == 'R' else 'R' for i in S[::-1]]
N = len(S)
def calc(S):
cnt = 0
score = [0 for _ in range(N)]
... | 29 | 27 | 651 | 758 | # python3
def main():
s = list(input())
n = len(s)
ans = [0 for _ in range(n)]
for _ in range(2):
c = 0
for i in range(n):
if s[i] == "R":
c += 1
else:
ans[i - 1] += (c + 1) // 2
ans[i] += c // 2
c = ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
S = readline().decode().rstrip()
T = ["L" if i == "R" else "R" for i in S[::-1]]
N = len(S)
def calc(S):
cnt = 0
score = [0 for _ in range(N)]
f = T... | false | 6.896552 | [
"-# python3",
"-def main():",
"- s = list(input())",
"- n = len(s)",
"- ans = [0 for _ in range(n)]",
"- for _ in range(2):",
"- c = 0",
"- for i in range(n):",
"- if s[i] == \"R\":",
"- c += 1",
"- else:",
"- ans[i ... | false | 0.046547 | 0.047538 | 0.97916 | [
"s005645124",
"s638930297"
] |
u186838327 | p03252 | python | s640245162 | s207481074 | 198 | 92 | 41,676 | 74,520 | Accepted | Accepted | 53.54 | s = str(eval(input()))
t = str(eval(input()))
ds = {}
dt = {}
for i in range(len(s)):
if s[i] not in ds:
ds[s[i]] = 1
else:
ds[s[i]] += 1
for i in range(len(t)):
if t[i] not in dt:
dt[t[i]] = 1
else:
dt[t[i]] += 1
vs = list(ds.values())
vt = list(dt... | s = str(eval(input()))
t = str(eval(input()))
from collections import Counter
cs = Counter(s)
ct = Counter(t)
cs = list(cs.values())
ct = list(ct.values())
cs.sort()
ct.sort()
if cs == ct:
print('Yes')
else:
print('No')
| 30 | 17 | 424 | 236 | s = str(eval(input()))
t = str(eval(input()))
ds = {}
dt = {}
for i in range(len(s)):
if s[i] not in ds:
ds[s[i]] = 1
else:
ds[s[i]] += 1
for i in range(len(t)):
if t[i] not in dt:
dt[t[i]] = 1
else:
dt[t[i]] += 1
vs = list(ds.values())
vt = list(dt.values())
vs.sort()
vt... | s = str(eval(input()))
t = str(eval(input()))
from collections import Counter
cs = Counter(s)
ct = Counter(t)
cs = list(cs.values())
ct = list(ct.values())
cs.sort()
ct.sort()
if cs == ct:
print("Yes")
else:
print("No")
| false | 43.333333 | [
"-ds = {}",
"-dt = {}",
"-for i in range(len(s)):",
"- if s[i] not in ds:",
"- ds[s[i]] = 1",
"- else:",
"- ds[s[i]] += 1",
"-for i in range(len(t)):",
"- if t[i] not in dt:",
"- dt[t[i]] = 1",
"- else:",
"- dt[t[i]] += 1",
"-vs = list(ds.values())",
... | false | 0.041796 | 0.041622 | 1.004173 | [
"s640245162",
"s207481074"
] |
u540877546 | p02742 | python | s742376876 | s838385509 | 171 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.06 | h, w = list(map(int, input().split()))
if h == 1 or w == 1:
print((1))
exit()
if h % 2 == 0 or w % 2 == 0:
print((h*w//2))
else:
if h <= w:
a = (w-1)*h//2
b = (h+1)//2
else:
a = (h-1)*w//2
b = (w+1)//2
print((a+b))
| h, w = list(map(int, input().split()))
if h == 1 or w == 1:
print((1))
exit()
if h % 2 == 0 or w % 2 == 0:
print((h*w//2))
else:
print(((w-1)*h//2+(h+1)//2))
| 15 | 9 | 274 | 171 | h, w = list(map(int, input().split()))
if h == 1 or w == 1:
print((1))
exit()
if h % 2 == 0 or w % 2 == 0:
print((h * w // 2))
else:
if h <= w:
a = (w - 1) * h // 2
b = (h + 1) // 2
else:
a = (h - 1) * w // 2
b = (w + 1) // 2
print((a + b))
| h, w = list(map(int, input().split()))
if h == 1 or w == 1:
print((1))
exit()
if h % 2 == 0 or w % 2 == 0:
print((h * w // 2))
else:
print(((w - 1) * h // 2 + (h + 1) // 2))
| false | 40 | [
"- if h <= w:",
"- a = (w - 1) * h // 2",
"- b = (h + 1) // 2",
"- else:",
"- a = (h - 1) * w // 2",
"- b = (w + 1) // 2",
"- print((a + b))",
"+ print(((w - 1) * h // 2 + (h + 1) // 2))"
] | false | 0.042627 | 0.042299 | 1.007746 | [
"s742376876",
"s838385509"
] |
u896741788 | p03796 | python | s276894956 | s896279067 | 230 | 32 | 3,984 | 2,940 | Accepted | Accepted | 86.09 | import math
a=int(eval(input()))
print((math.factorial(a)%(10**9+7)))
| n=int(eval(input()))
def a(x):
if x==1:
return 1
else:
d=1
for i in range(x+1)[1:]:
d *= i
d %= 10**9+7
return d
print((a(n))) | 3 | 11 | 64 | 160 | import math
a = int(eval(input()))
print((math.factorial(a) % (10**9 + 7)))
| n = int(eval(input()))
def a(x):
if x == 1:
return 1
else:
d = 1
for i in range(x + 1)[1:]:
d *= i
d %= 10**9 + 7
return d
print((a(n)))
| false | 72.727273 | [
"-import math",
"+n = int(eval(input()))",
"-a = int(eval(input()))",
"-print((math.factorial(a) % (10**9 + 7)))",
"+",
"+def a(x):",
"+ if x == 1:",
"+ return 1",
"+ else:",
"+ d = 1",
"+ for i in range(x + 1)[1:]:",
"+ d *= i",
"+ d %= 10**9... | false | 0.118782 | 0.089625 | 1.325323 | [
"s276894956",
"s896279067"
] |
u669812251 | p02720 | python | s877211954 | s929178607 | 172 | 58 | 11,956 | 7,320 | Accepted | Accepted | 66.28 | # -*- coding: utf-8 -*-
from collections import deque
k = int(eval(input()))
dq = deque(list(range(1, 10)))
rep = 0
while rep < k:
now = dq.popleft()
rep+=1
for i in (-1, 0, 1):
if 0<=now%10+i<10:
dq.append(now*10+now%10+i)
print(now)
| def main():
k = int(eval(input()))
a = [i for i in range(1,10)]
x = 0
while(1):
if k <= len(a):
print((a[k-1]))
return
for i in range(-1,2):
d = a[x]%10 +i
if 0 <= d and d < 10:
a.append(a[x]*10 + d)
x+=1... | 13 | 16 | 274 | 354 | # -*- coding: utf-8 -*-
from collections import deque
k = int(eval(input()))
dq = deque(list(range(1, 10)))
rep = 0
while rep < k:
now = dq.popleft()
rep += 1
for i in (-1, 0, 1):
if 0 <= now % 10 + i < 10:
dq.append(now * 10 + now % 10 + i)
print(now)
| def main():
k = int(eval(input()))
a = [i for i in range(1, 10)]
x = 0
while 1:
if k <= len(a):
print((a[k - 1]))
return
for i in range(-1, 2):
d = a[x] % 10 + i
if 0 <= d and d < 10:
a.append(a[x] * 10 + d)
x += 1
... | false | 18.75 | [
"-# -*- coding: utf-8 -*-",
"-from collections import deque",
"+def main():",
"+ k = int(eval(input()))",
"+ a = [i for i in range(1, 10)]",
"+ x = 0",
"+ while 1:",
"+ if k <= len(a):",
"+ print((a[k - 1]))",
"+ return",
"+ for i in range(-1, 2):"... | false | 0.007501 | 0.042114 | 0.178104 | [
"s877211954",
"s929178607"
] |
u065446124 | p03488 | python | s415937696 | s352320884 | 1,486 | 1,282 | 3,548 | 3,528 | Accepted | Accepted | 13.73 | s=eval(input())+"T"
X,Y=list(map(int,input().split()))
xy=[[],[]]
t=0
m=0
for i in s:
if(i=="T"):
xy[m].append(t)
m^=1
t=0
else:
t+=1
x,y=xy
l=[x[0]]
s=set()
for i in x[1:]:
s.clear()
for j in l:
s.add(j+i)
s.add(j-i)
l=list(s)
if(... | s=input().split("T")
X,Y=list(map(int,input().split()))
x=list(map(len,s[::2]))
y=list(map(len,s[1::2]))
l=[x[0]]
s=set()
for i in x[1:]:
s.clear()
for j in l:
s.add(j+i)
s.add(j-i)
l=list(s)
if(not X in l):
print("No")
quit()
l=[0]
for i in y:
s.clear()
for... | 35 | 26 | 515 | 436 | s = eval(input()) + "T"
X, Y = list(map(int, input().split()))
xy = [[], []]
t = 0
m = 0
for i in s:
if i == "T":
xy[m].append(t)
m ^= 1
t = 0
else:
t += 1
x, y = xy
l = [x[0]]
s = set()
for i in x[1:]:
s.clear()
for j in l:
s.add(j + i)
s.add(j - i)
l... | s = input().split("T")
X, Y = list(map(int, input().split()))
x = list(map(len, s[::2]))
y = list(map(len, s[1::2]))
l = [x[0]]
s = set()
for i in x[1:]:
s.clear()
for j in l:
s.add(j + i)
s.add(j - i)
l = list(s)
if not X in l:
print("No")
quit()
l = [0]
for i in y:
s.clear()
... | false | 25.714286 | [
"-s = eval(input()) + \"T\"",
"+s = input().split(\"T\")",
"-xy = [[], []]",
"-t = 0",
"-m = 0",
"-for i in s:",
"- if i == \"T\":",
"- xy[m].append(t)",
"- m ^= 1",
"- t = 0",
"- else:",
"- t += 1",
"-x, y = xy",
"+x = list(map(len, s[::2]))",
"+y = lis... | false | 0.085087 | 0.047412 | 1.794636 | [
"s415937696",
"s352320884"
] |
u173148629 | p02802 | python | s376052054 | s734614803 | 311 | 283 | 29,428 | 29,420 | Accepted | Accepted | 9 | N,M=list(map(int,input().split()))
d={} #正解の辞書
e={} #誤答の辞書
f={} #ペナの辞書
for _ in range(M):
p,s=input().split()
d.setdefault(p,0)
e.setdefault(p,0)
f.setdefault(p,0)
if s=="WA" and d[p]==0:
e[p]+=1
elif s=="AC":
d[p]=1
f[p]=e[p]
print((sum(d.values()),sum(f.... | N,M=list(map(int,input().split()))
d={} #正解の辞書
e={} #誤答の辞書
f={} #ペナの辞書
for _ in range(M):
p,s=input().split()
d.setdefault(p,0)
e.setdefault(p,0)
#f.setdefault(p,0)
if s=="WA" and d[p]==0:
e[p]+=1
elif s=="AC":
d[p]=1
f[p]=e[p]
print((sum(d.values()),sum(f... | 17 | 17 | 326 | 327 | N, M = list(map(int, input().split()))
d = {} # 正解の辞書
e = {} # 誤答の辞書
f = {} # ペナの辞書
for _ in range(M):
p, s = input().split()
d.setdefault(p, 0)
e.setdefault(p, 0)
f.setdefault(p, 0)
if s == "WA" and d[p] == 0:
e[p] += 1
elif s == "AC":
d[p] = 1
f[p] = e[p]
print((sum(... | N, M = list(map(int, input().split()))
d = {} # 正解の辞書
e = {} # 誤答の辞書
f = {} # ペナの辞書
for _ in range(M):
p, s = input().split()
d.setdefault(p, 0)
e.setdefault(p, 0)
# f.setdefault(p,0)
if s == "WA" and d[p] == 0:
e[p] += 1
elif s == "AC":
d[p] = 1
f[p] = e[p]
print((sum... | false | 0 | [
"- f.setdefault(p, 0)",
"+ # f.setdefault(p,0)"
] | false | 0.072092 | 0.007387 | 9.758801 | [
"s376052054",
"s734614803"
] |
u887207211 | p03210 | python | s026468015 | s772454531 | 19 | 17 | 3,064 | 2,940 | Accepted | Accepted | 10.53 | X = int(eval(input()))
if(X in [7, 5, 3]):
print("YES")
else:
print("NO") | x = int(eval(input()))
ans = "NO"
if x in [7, 5, 3]:
ans = "YES"
print(ans) | 5 | 5 | 75 | 75 | X = int(eval(input()))
if X in [7, 5, 3]:
print("YES")
else:
print("NO")
| x = int(eval(input()))
ans = "NO"
if x in [7, 5, 3]:
ans = "YES"
print(ans)
| false | 0 | [
"-X = int(eval(input()))",
"-if X in [7, 5, 3]:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+x = int(eval(input()))",
"+ans = \"NO\"",
"+if x in [7, 5, 3]:",
"+ ans = \"YES\"",
"+print(ans)"
] | false | 0.038299 | 0.037903 | 1.010437 | [
"s026468015",
"s772454531"
] |
u450956662 | p03356 | python | s438616311 | s619728224 | 633 | 387 | 13,812 | 13,876 | Accepted | Accepted | 38.86 | def root(v):
if v == par[v]:
return v
par[v] = root(par[v])
return par[v]
def unite(u, v):
u = root(u)
v = root(v)
if u == v:
return
if rank[u] < rank[v]:
par[u] = v
else:
par[v] = u
if rank[u] == rank[v]:
rank[v] += 1
... | import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
def root(v):
if v == par[v]:
return v
par[v] = root(par[v])
return par[v]
def unite(u, v):
u = root(u)
v = root(v)
if u == v:
return
if rank[u] < rank[v]:
u, v = v, u
par[v] = ... | 39 | 35 | 688 | 710 | def root(v):
if v == par[v]:
return v
par[v] = root(par[v])
return par[v]
def unite(u, v):
u = root(u)
v = root(v)
if u == v:
return
if rank[u] < rank[v]:
par[u] = v
else:
par[v] = u
if rank[u] == rank[v]:
rank[v] += 1
def same(u, v... | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
def root(v):
if v == par[v]:
return v
par[v] = root(par[v])
return par[v]
def unite(u, v):
u = root(u)
v = root(v)
if u == v:
return
if rank[u] < rank[v]:
u, v = v, u
par[v] = u
if rank[u]... | false | 10.25641 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**6)",
"+input = sys.stdin.readline",
"+",
"+",
"- par[u] = v",
"- else:",
"- par[v] = u",
"- if rank[u] == rank[v]:",
"- rank[v] += 1",
"+ u, v = v, u",
"+ par[v] = u",
"+ if rank[u] == rank[v]:"... | false | 0.050584 | 0.039738 | 1.272949 | [
"s438616311",
"s619728224"
] |
u629454253 | p02699 | python | s807602637 | s589275876 | 24 | 20 | 9,160 | 9,160 | Accepted | Accepted | 16.67 | s, w = list(map(int, input().split()))
if s <= w:
print('unsafe')
else:
print('safe') | s, w = list(map(int, input().split()))
if w >= s:
print('unsafe')
else:
print('safe') | 6 | 5 | 89 | 91 | s, w = list(map(int, input().split()))
if s <= w:
print("unsafe")
else:
print("safe")
| s, w = list(map(int, input().split()))
if w >= s:
print("unsafe")
else:
print("safe")
| false | 16.666667 | [
"-if s <= w:",
"+if w >= s:"
] | false | 0.007694 | 0.037599 | 0.204635 | [
"s807602637",
"s589275876"
] |
u046158516 | p03045 | python | s378745412 | s769427384 | 873 | 353 | 69,592 | 80,492 | Accepted | Accepted | 59.56 | n,m=list(map(int,input().split()))
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.paren... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | 52 | 53 | 1,337 | 1,339 | n, m = list(map(int, input().split()))
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | false | 1.886792 | [
"-n, m = list(map(int, input().split()))",
"-",
"-",
"+n, k = list(map(int, input().split()))",
"-for i in range(m):",
"- x, y, z = list(map(int, input().split()))",
"- uf.union(x - 1, y - 1)",
"+for i in range(k):",
"+ a, b, c = list(map(int, input().split()))",
"+ uf.union(a - 1, b -... | false | 0.091129 | 0.125453 | 0.726398 | [
"s378745412",
"s769427384"
] |
u777283665 | p02899 | python | s883763459 | s548561433 | 252 | 106 | 23,412 | 13,812 | Accepted | Accepted | 57.94 | n = int(input())
A = map(int, input().split())
ind = 1
x = []
for a in A:
x.append((ind, a))
ind += 1
x = sorted(x, key=lambda x: x[1])
for i in x:
print(i[0], end=" ")
| n = int(eval(input()))
a = list(map(int, input().split()))
x = [0] * n
for i in range(n):
x[a[i]-1] = i + 1
print((*x)) | 13 | 9 | 195 | 126 | n = int(input())
A = map(int, input().split())
ind = 1
x = []
for a in A:
x.append((ind, a))
ind += 1
x = sorted(x, key=lambda x: x[1])
for i in x:
print(i[0], end=" ")
| n = int(eval(input()))
a = list(map(int, input().split()))
x = [0] * n
for i in range(n):
x[a[i] - 1] = i + 1
print((*x))
| false | 30.769231 | [
"-n = int(input())",
"-A = map(int, input().split())",
"-ind = 1",
"-x = []",
"-for a in A:",
"- x.append((ind, a))",
"- ind += 1",
"-x = sorted(x, key=lambda x: x[1])",
"-for i in x:",
"- print(i[0], end=\" \")",
"+n = int(eval(input()))",
"+a = list(map(int, input().split()))",
"+... | false | 0.035829 | 0.037126 | 0.965062 | [
"s883763459",
"s548561433"
] |
u036104576 | p03436 | python | s371478950 | s323577000 | 47 | 34 | 9,676 | 9,476 | Accepted | Accepted | 27.66 | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())... | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())... | 62 | 62 | 1,312 | 1,332 | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10**7)
INF = 10**9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
H, W = list(map(in... | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10**7)
INF = 10**9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
H, W = list(map(in... | false | 0 | [
"-import queue",
"+from collections import deque",
"- q = queue.Queue()",
"+ q = deque([])",
"- q.put(start)",
"+ q.append(start)",
"- while not q.empty():",
"- y, x = q.get()",
"+ while len(q) > 0:",
"+ y, x = q.popleft()",
"- q.put((ny, nx))",
"+ ... | false | 0.045989 | 0.04577 | 1.004785 | [
"s371478950",
"s323577000"
] |
u148551245 | p03307 | python | s868241101 | s299520433 | 178 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.45 | n = int(eval(input()))
if n % 2:
print((2 * n))
else:
print(n) | n = int(eval(input()))
if n % 2 == 0:
ans = n
else:
ans = 2*n
print(ans) | 5 | 6 | 66 | 79 | n = int(eval(input()))
if n % 2:
print((2 * n))
else:
print(n)
| n = int(eval(input()))
if n % 2 == 0:
ans = n
else:
ans = 2 * n
print(ans)
| false | 16.666667 | [
"-if n % 2:",
"- print((2 * n))",
"+if n % 2 == 0:",
"+ ans = n",
"- print(n)",
"+ ans = 2 * n",
"+print(ans)"
] | false | 0.149123 | 0.073821 | 2.020074 | [
"s868241101",
"s299520433"
] |
u021763820 | p02612 | python | s015646272 | s594790300 | 30 | 26 | 9,164 | 9,160 | Accepted | Accepted | 13.33 | # -*- coding: utf-8 -*-
n = int(eval(input()))
a = 1000-n%1000
if a != 1000:
print(a)
else:
print((0)) | # -*- coding: utf-8 -*-
n = int(eval(input()))
p = n%1000
if p != 0:
print((1000-p))
else:
print((0)) | 7 | 7 | 108 | 105 | # -*- coding: utf-8 -*-
n = int(eval(input()))
a = 1000 - n % 1000
if a != 1000:
print(a)
else:
print((0))
| # -*- coding: utf-8 -*-
n = int(eval(input()))
p = n % 1000
if p != 0:
print((1000 - p))
else:
print((0))
| false | 0 | [
"-a = 1000 - n % 1000",
"-if a != 1000:",
"- print(a)",
"+p = n % 1000",
"+if p != 0:",
"+ print((1000 - p))"
] | false | 0.040911 | 0.044806 | 0.913061 | [
"s015646272",
"s594790300"
] |
u729133443 | p03598 | python | s598032709 | s300076893 | 171 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.06 | _,k,*x=list(map(int,open(0).read().split()));print((sum(min(t,k-t)*2for t in x))) | _,k,t=open(0);print((sum(min(x,int(k)-x)*2for x in map(int,t.split())))) | 1 | 1 | 73 | 70 | _, k, *x = list(map(int, open(0).read().split()))
print((sum(min(t, k - t) * 2 for t in x)))
| _, k, t = open(0)
print((sum(min(x, int(k) - x) * 2 for x in map(int, t.split()))))
| false | 0 | [
"-_, k, *x = list(map(int, open(0).read().split()))",
"-print((sum(min(t, k - t) * 2 for t in x)))",
"+_, k, t = open(0)",
"+print((sum(min(x, int(k) - x) * 2 for x in map(int, t.split()))))"
] | false | 0.035371 | 0.034233 | 1.03323 | [
"s598032709",
"s300076893"
] |
u476604182 | p03584 | python | s269970267 | s430166163 | 648 | 334 | 25,564 | 100,336 | Accepted | Accepted | 48.46 | N,K,*X = list(map(int, open(0).read().split()))
S = bin(K)[2:]
L = len(S)
one = set()
ls = [(a,b) for a,b in zip(*[iter(X)]*2) if a<=K]
kls = [K]
ans = 0
for i in range(L):
if S[i]=='1':
m = int(S[:i]+'0'+'1'*(L-i-1),2)
kls.append(m)
for k in kls:
m = 0
for a,b in ls:
if k==k|a:
m... | N,K,*X = list(map(int,open(0).read().split()))
S = bin(K)[2:]
L = len(S)
ls = [(a,b) for a,b in zip(*[iter(X)]*2)]
s = '0'
ans = 0
for i,c in enumerate(S):
if c=='0':
s += c
continue
j = L-i
m = (1<<(j-1))-1
n = int(s,2)<<j
x = m|n
v = 0
for a,b in ls:
if x==x|a:
v += b
... | 18 | 26 | 351 | 423 | N, K, *X = list(map(int, open(0).read().split()))
S = bin(K)[2:]
L = len(S)
one = set()
ls = [(a, b) for a, b in zip(*[iter(X)] * 2) if a <= K]
kls = [K]
ans = 0
for i in range(L):
if S[i] == "1":
m = int(S[:i] + "0" + "1" * (L - i - 1), 2)
kls.append(m)
for k in kls:
m = 0
for a, b in ls:
... | N, K, *X = list(map(int, open(0).read().split()))
S = bin(K)[2:]
L = len(S)
ls = [(a, b) for a, b in zip(*[iter(X)] * 2)]
s = "0"
ans = 0
for i, c in enumerate(S):
if c == "0":
s += c
continue
j = L - i
m = (1 << (j - 1)) - 1
n = int(s, 2) << j
x = m | n
v = 0
for a, b in ls:... | false | 30.769231 | [
"-one = set()",
"-ls = [(a, b) for a, b in zip(*[iter(X)] * 2) if a <= K]",
"-kls = [K]",
"+ls = [(a, b) for a, b in zip(*[iter(X)] * 2)]",
"+s = \"0\"",
"-for i in range(L):",
"- if S[i] == \"1\":",
"- m = int(S[:i] + \"0\" + \"1\" * (L - i - 1), 2)",
"- kls.append(m)",
"-for k i... | false | 0.039841 | 0.041589 | 0.957966 | [
"s269970267",
"s430166163"
] |
u944643608 | p02695 | python | s380948155 | s870082629 | 1,549 | 1,427 | 21,356 | 21,580 | Accepted | Accepted | 7.88 | #標準入力
N, M, Q = list(map(int, input().split()))
abcd = []
for _ in range(Q):
tmp = list(map(int, input().split()))
abcd.append(tmp)
#実装
import itertools as it
A_candidate = list(it.combinations_with_replacement(list(range(1, M + 1)), N))
ans = 0
for i in range(len(A_candidate)):
tmp = 0
fo... | #標準入力
N, M, Q = list(map(int, input().split()))
abcd = []
for _ in range(Q):
tmp = list(map(int, input().split()))
abcd.append(tmp)
#実装
import itertools as it
A_candidate = list(it.combinations_with_replacement(list(range(1, M + 1)), N))
ans = 0
for i in range(len(A_candidate)):
tmp = 0
fo... | 20 | 21 | 518 | 530 | # 標準入力
N, M, Q = list(map(int, input().split()))
abcd = []
for _ in range(Q):
tmp = list(map(int, input().split()))
abcd.append(tmp)
# 実装
import itertools as it
A_candidate = list(it.combinations_with_replacement(list(range(1, M + 1)), N))
ans = 0
for i in range(len(A_candidate)):
tmp = 0
for j in rang... | # 標準入力
N, M, Q = list(map(int, input().split()))
abcd = []
for _ in range(Q):
tmp = list(map(int, input().split()))
abcd.append(tmp)
# 実装
import itertools as it
A_candidate = list(it.combinations_with_replacement(list(range(1, M + 1)), N))
ans = 0
for i in range(len(A_candidate)):
tmp = 0
for j in rang... | false | 4.761905 | [
"- if (",
"- A_candidate[i][abcd[j][1] - 1] - A_candidate[i][abcd[j][0] - 1]",
"- == abcd[j][2]",
"- ):",
"- tmp += abcd[j][3]",
"+ ABCD = abcd[j]",
"+ if A_candidate[i][ABCD[1] - 1] - A_candidate[i][ABCD[0] - 1] == ABCD[2]:",
"+ ... | false | 0.069611 | 0.068202 | 1.020669 | [
"s380948155",
"s870082629"
] |
u064505481 | p03178 | python | s712337151 | s558784640 | 1,825 | 1,477 | 130,908 | 130,012 | Accepted | Accepted | 19.07 | from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict
from functools import lru_cache
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
INF, NINF = float('inf'), float('-inf')
setrecursionlimit(1... | from sys import stdin, stdout
from collections import deque, defaultdict
from functools import lru_cache
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
INF, NINF = float('inf'), float('-inf')
def main():
MOD = 10**9 + 7
x = []... | 43 | 35 | 1,035 | 879 | from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict
from functools import lru_cache
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
INF, NINF = float("inf"), float("-inf")
setrecursionlimit(100000)
def... | from sys import stdin, stdout
from collections import deque, defaultdict
from functools import lru_cache
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
INF, NINF = float("inf"), float("-inf")
def main():
MOD = 10**9 + 7
x = []
f... | false | 18.604651 | [
"-from sys import stdin, stdout, setrecursionlimit",
"+from sys import stdin, stdout",
"-setrecursionlimit(100000)",
"- k, d = int(rl()), int(rl())",
"+ x = []",
"+ for c in rll()[0]:",
"+ x.append(int(c))",
"+ d = int(rl())",
"-",
"- def totup(num):",
"- ans = deque... | false | 0.042435 | 0.049227 | 0.862036 | [
"s712337151",
"s558784640"
] |
u949338836 | p02264 | python | s722482233 | s230884377 | 790 | 330 | 19,608 | 16,064 | Accepted | Accepted | 58.23 | #coding:utf-8
#1_3_B
n, q = list(map(int, input().split()))
total_time = 0
queue = [input().split() for i in range(n)]
while queue:
ps = queue.pop(0)
time = int(ps[1])
if time <= q:
total_time += time
print((ps[0], total_time))
else:
total_time += q
time ... | #coding:utf-8
#1_3_B
from collections import deque
n, quantum = list(map(int, input().split()))
q = deque()
total_time = 0
for i in range(n):
name, time = input().split()
q.append([name, int(time)])
while q:
ps_name, ps_time = q.popleft()
if ps_time <= quantum:
total_time += ps_t... | 18 | 20 | 364 | 461 | # coding:utf-8
# 1_3_B
n, q = list(map(int, input().split()))
total_time = 0
queue = [input().split() for i in range(n)]
while queue:
ps = queue.pop(0)
time = int(ps[1])
if time <= q:
total_time += time
print((ps[0], total_time))
else:
total_time += q
time -= q
ps... | # coding:utf-8
# 1_3_B
from collections import deque
n, quantum = list(map(int, input().split()))
q = deque()
total_time = 0
for i in range(n):
name, time = input().split()
q.append([name, int(time)])
while q:
ps_name, ps_time = q.popleft()
if ps_time <= quantum:
total_time += ps_time
p... | false | 10 | [
"-n, q = list(map(int, input().split()))",
"+from collections import deque",
"+",
"+n, quantum = list(map(int, input().split()))",
"+q = deque()",
"-queue = [input().split() for i in range(n)]",
"-while queue:",
"- ps = queue.pop(0)",
"- time = int(ps[1])",
"- if time <= q:",
"- ... | false | 0.199866 | 0.17466 | 1.144318 | [
"s722482233",
"s230884377"
] |
u764600134 | p03032 | python | s936710525 | s557594288 | 71 | 65 | 3,772 | 3,064 | Accepted | Accepted | 8.45 | # -*- coding: utf-8 -*-
"""
"""
import sys
from collections import deque
from functools import lru_cache
@lru_cache(maxsize=None)
def dig_left(n, q):
res = [0]
for di in range(1, min(n, len(q))+1):
bu = n - di
dig = list(q[:di])
dig.sort()
while bu and di... | # -*- coding: utf-8 -*-
"""
D - equeue
https://atcoder.jp/contests/abc128/tasks/abc128_d
"""
import sys
def dig_lr(n, q, lr='L'):
# 左(もしくは右)側から最大でn回操作した時の結果の最大値を求める
res = [0]
for di in range(1, min(n, len(q))+1): # diは最大で掘る回数
bu = n - di # 埋める方に使用する操作回数
dig = l... | 61 | 45 | 1,263 | 1,174 | # -*- coding: utf-8 -*-
"""
"""
import sys
from collections import deque
from functools import lru_cache
@lru_cache(maxsize=None)
def dig_left(n, q):
res = [0]
for di in range(1, min(n, len(q)) + 1):
bu = n - di
dig = list(q[:di])
dig.sort()
while bu and dig and dig[0] < 0:
... | # -*- coding: utf-8 -*-
"""
D - equeue
https://atcoder.jp/contests/abc128/tasks/abc128_d
"""
import sys
def dig_lr(n, q, lr="L"):
# 左(もしくは右)側から最大でn回操作した時の結果の最大値を求める
res = [0]
for di in range(1, min(n, len(q)) + 1): # diは最大で掘る回数
bu = n - di # 埋める方に使用する操作回数
dig = list(q[:di]) if lr == "L... | false | 26.229508 | [
"+D - equeue",
"+https://atcoder.jp/contests/abc128/tasks/abc128_d",
"-from collections import deque",
"-from functools import lru_cache",
"-@lru_cache(maxsize=None)",
"-def dig_left(n, q):",
"+def dig_lr(n, q, lr=\"L\"):",
"+ # 左(もしくは右)側から最大でn回操作した時の結果の最大値を求める",
"- for di in range(1, min(n, l... | false | 0.116035 | 0.083231 | 1.394131 | [
"s936710525",
"s557594288"
] |
u366482170 | p02844 | python | s655467798 | s271839362 | 746 | 587 | 43,776 | 132,708 | Accepted | Accepted | 21.31 | #import sys
MOD = 10 ** 9 + 7
#input = sys.stdin.readline
import math
#import bisect
def sosuhante(n):
for k in range(2, int(math.sqrt(n))+1):
if n% k ==0:
return False
return True
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
... | #import sys
MOD = 10 ** 9 + 7
#input = sys.stdin.readline
import math
#import bisect
def sosuhante(n):
for k in range(2, int(math.sqrt(n))+1):
if n% k ==0:
return False
return True
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
... | 68 | 91 | 1,609 | 2,029 | # import sys
MOD = 10**9 + 7
# input = sys.stdin.readline
import math
# import bisect
def sosuhante(n):
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
def cmb(n, r):
if n - r < r:
r = n - r
if r == 0:
return 1
if r == 1:
... | # import sys
MOD = 10**9 + 7
# input = sys.stdin.readline
import math
# import bisect
def sosuhante(n):
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
def cmb(n, r):
if n - r < r:
r = n - r
if r == 0:
return 1
if r == 1:
... | false | 25.274725 | [
"+def my_index(l, x, default=False):",
"+ if x in l:",
"+ return l.index(x)",
"+ else:",
"+ return default",
"+",
"+",
"- s = list(map(int, eval(input())))",
"- c = [[-2 for j in range(11)] for i in range(10)]",
"- d = {0}",
"- # print(c)",
"- for i in rang... | false | 0.043764 | 0.038316 | 1.142205 | [
"s655467798",
"s271839362"
] |
u853728588 | p02717 | python | s747260880 | s526039434 | 25 | 21 | 9,148 | 8,948 | Accepted | Accepted | 16 | X, Y, Z = list(map(int, input().split()))
print((Z, X, Y)) | x, y, z = list(map(int, input().split()))
print((z, x, y)) | 3 | 3 | 53 | 53 | X, Y, Z = list(map(int, input().split()))
print((Z, X, Y))
| x, y, z = list(map(int, input().split()))
print((z, x, y))
| false | 0 | [
"-X, Y, Z = list(map(int, input().split()))",
"-print((Z, X, Y))",
"+x, y, z = list(map(int, input().split()))",
"+print((z, x, y))"
] | false | 0.04209 | 0.042981 | 0.979271 | [
"s747260880",
"s526039434"
] |
u383025592 | p02614 | python | s498703963 | s638934632 | 206 | 134 | 78,752 | 74,180 | Accepted | Accepted | 34.95 | import copy
H, W, K, = list(map(int, input().split()))
C = [0] * H
for i in range(H):
C[i] = eval(input())
C[i] = [1 if(C[i][j] == "#") else 0 for j in range(W)]
h = 2 ** H
w = 2 ** W
ans = 0
for i in range(2 ** H):
w = 2 ** W
for j in range(2 ** W):
D = copy.deepcopy(C)
for k in range(H):
... | H, W, K, = list(map(int, input().split()))
C = [0] * H
for i in range(H):
C[i] = eval(input())
C[i] = [1 if(C[i][j] == "#") else 0 for j in range(W)]
h = 2 ** H
w = 2 ** W
ans = 0
cnt = 0
for i in range(2 ** H):
w = 2 ** W
for j in range(2 ** W):
cnt = 0
for k in range(H):
for l in r... | 21 | 21 | 491 | 466 | import copy
(
H,
W,
K,
) = list(map(int, input().split()))
C = [0] * H
for i in range(H):
C[i] = eval(input())
C[i] = [1 if (C[i][j] == "#") else 0 for j in range(W)]
h = 2**H
w = 2**W
ans = 0
for i in range(2**H):
w = 2**W
for j in range(2**W):
D = copy.deepcopy(C)
for k in... | (
H,
W,
K,
) = list(map(int, input().split()))
C = [0] * H
for i in range(H):
C[i] = eval(input())
C[i] = [1 if (C[i][j] == "#") else 0 for j in range(W)]
h = 2**H
w = 2**W
ans = 0
cnt = 0
for i in range(2**H):
w = 2**W
for j in range(2**W):
cnt = 0
for k in range(H):
... | false | 0 | [
"-import copy",
"-",
"+cnt = 0",
"- D = copy.deepcopy(C)",
"+ cnt = 0",
"- if bin(h)[k + 3] == \"1\" or bin(w)[l + 3] == \"1\":",
"- D[k][l] = 0",
"- ans += sum(map(sum, D)) == K",
"+ if bin(h)[k + 3] == \"0\" and bin(w)[l + 3] ==... | false | 0.039942 | 0.03861 | 1.034487 | [
"s498703963",
"s638934632"
] |
u321035578 | p02678 | python | s500810935 | s662976175 | 1,024 | 898 | 37,204 | 37,080 | Accepted | Accepted | 12.3 | import queue
def main():
n,m = list(map(int,input().split()))
ab = [[] for i in range(n)]
for _ in range(m):
a,b = list(map(int,input().split()))
ab[a-1].append(b-1)
ab[b-1].append(a-1)
q =queue.Queue()
q.put(0)
ans = [-1] * n
ans[0] = 0
while q:
... | import queue
def main():
n,m = list(map(int,input().split()))
ab = [[] for i in range(n)]
for _ in range(m):
a,b = list(map(int,input().split()))
ab[a-1].append(b-1)
ab[b-1].append(a-1)
q =queue.Queue()
q.put(0)
ans = [-1] * n
ans[0] = 0
while not q.em... | 28 | 27 | 620 | 600 | import queue
def main():
n, m = list(map(int, input().split()))
ab = [[] for i in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
ab[a - 1].append(b - 1)
ab[b - 1].append(a - 1)
q = queue.Queue()
q.put(0)
ans = [-1] * n
ans[0] = 0
while q:
... | import queue
def main():
n, m = list(map(int, input().split()))
ab = [[] for i in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
ab[a - 1].append(b - 1)
ab[b - 1].append(a - 1)
q = queue.Queue()
q.put(0)
ans = [-1] * n
ans[0] = 0
while not q... | false | 3.571429 | [
"- while q:",
"+ while not q.empty():",
"- if q.empty():",
"- break"
] | false | 0.105941 | 0.058624 | 1.807129 | [
"s500810935",
"s662976175"
] |
u294721290 | p03037 | python | s852689767 | s574847818 | 373 | 330 | 11,440 | 3,060 | Accepted | Accepted | 11.53 | N,M=list(map(int,input().split()))
L=[]
R=[]
for _ in range(M):
l,r=list(map(int,input().split()))
L.append(l)
R.append(r)
L.sort()
R.sort()
print((0 if R[0]<L[-1] else R[0]-L[-1]+1)) | N,M=list(map(int,input().split()))
L=0
R=10**9
for _ in range(M):
l,r=list(map(int,input().split()))
L=max(L,l)
R=min(R,r)
print((0 if R<L else R-L+1)) | 10 | 8 | 190 | 156 | N, M = list(map(int, input().split()))
L = []
R = []
for _ in range(M):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
L.sort()
R.sort()
print((0 if R[0] < L[-1] else R[0] - L[-1] + 1))
| N, M = list(map(int, input().split()))
L = 0
R = 10**9
for _ in range(M):
l, r = list(map(int, input().split()))
L = max(L, l)
R = min(R, r)
print((0 if R < L else R - L + 1))
| false | 20 | [
"-L = []",
"-R = []",
"+L = 0",
"+R = 10**9",
"- L.append(l)",
"- R.append(r)",
"-L.sort()",
"-R.sort()",
"-print((0 if R[0] < L[-1] else R[0] - L[-1] + 1))",
"+ L = max(L, l)",
"+ R = min(R, r)",
"+print((0 if R < L else R - L + 1))"
] | false | 0.042391 | 0.03907 | 1.085002 | [
"s852689767",
"s574847818"
] |
u604774382 | p02266 | python | s857615361 | s865399086 | 60 | 40 | 7,484 | 5,260 | Accepted | Accepted | 33.33 | from collections import deque
section = eval(input( ))
depth = 0
area = 0
depthArr = deque( )
areaArr = deque( )
for i, ground in enumerate( section ):
if "\\" == ground:
depth += 1
depthArr.append( i )
elif 0 < depth and "/" == ground:
if len( depthArr ):
j = depthArr.pop( )
pool = i - ... | from collections import deque
section = input( )
area = 0
depthPosArr = deque( )
depthPosPoolArr = deque( )
for ipos, ground in enumerate( section ):
if "\\" == ground:
depthPosArr.append( ipos )
elif "/" == ground:
if len( depthPosArr ):
jpos = depthPosArr.pop( )
pool = ipos - jpos
area... | 33 | 31 | 687 | 750 | from collections import deque
section = eval(input())
depth = 0
area = 0
depthArr = deque()
areaArr = deque()
for i, ground in enumerate(section):
if "\\" == ground:
depth += 1
depthArr.append(i)
elif 0 < depth and "/" == ground:
if len(depthArr):
j = depthArr.pop()
... | from collections import deque
section = input()
area = 0
depthPosArr = deque()
depthPosPoolArr = deque()
for ipos, ground in enumerate(section):
if "\\" == ground:
depthPosArr.append(ipos)
elif "/" == ground:
if len(depthPosArr):
jpos = depthPosArr.pop()
pool = ipos - jp... | false | 6.060606 | [
"-section = eval(input())",
"-depth = 0",
"+section = input()",
"-depthArr = deque()",
"-areaArr = deque()",
"-for i, ground in enumerate(section):",
"+depthPosArr = deque()",
"+depthPosPoolArr = deque()",
"+for ipos, ground in enumerate(section):",
"- depth += 1",
"- depthArr.appe... | false | 0.046295 | 0.043194 | 1.071783 | [
"s857615361",
"s865399086"
] |
u691018832 | p02888 | python | s184293186 | s851154686 | 1,704 | 1,278 | 3,188 | 3,188 | Accepted | Accepted | 25 | import sys
import bisect
input = sys.stdin.readline
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
for j in range(i + 1, n):
check = bisect.bisect_left(l, l[i] + l[j])
ans += max(0, check - j - 1)
print(ans)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from bisect import bisect_left
n = int(readline())
l = sorted(list(map(int, readline().split())))
ans = 0
for i in range(n - 2):
for j in range(i + 1, n - ... | 13 | 15 | 283 | 390 | import sys
import bisect
input = sys.stdin.readline
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
for j in range(i + 1, n):
check = bisect.bisect_left(l, l[i] + l[j])
ans += max(0, check - j - 1)
print(ans)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from bisect import bisect_left
n = int(readline())
l = sorted(list(map(int, readline().split())))
ans = 0
for i in range(n - 2):
for j in range(i + 1, n - 1):
an... | false | 13.333333 | [
"-import bisect",
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"-l = list(map(int, input().split()))",
"-l.sort()",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+sys.setrecursionlimit(10**7)",
"+from bisect impor... | false | 0.043261 | 0.043755 | 0.988709 | [
"s184293186",
"s851154686"
] |
u591016708 | p02984 | python | s363729041 | s888356465 | 179 | 82 | 14,028 | 19,148 | Accepted | Accepted | 54.19 | def main(X,A,N):
for i in range(N-1):
X[i+1] = 2*A[i] - X[i]
return X
N = int(input())
A = list(map(int, input().split()))
S = sum(A)
Aoddsum = sum(A[1:N:2])
X1 = S - 2*Aoddsum
X = [0]*N
X[0] = X1
main(X,A,N)
for x in X:
print(x, end=" ")
| def main(X,A,N):
for i in range(N-1):
X[i+1] = 2*A[i] - X[i]
return X
N = int(eval(input()))
A = list(map(int, input().split()))
S = sum(A)
Aoddsum = sum(A[1:N:2])
X1 = S - 2*Aoddsum
X = [0]*N
X[0] = X1
main(X,A,N)
print((" ".join(list(map(str, X)))))
| 14 | 14 | 272 | 274 | def main(X, A, N):
for i in range(N - 1):
X[i + 1] = 2 * A[i] - X[i]
return X
N = int(input())
A = list(map(int, input().split()))
S = sum(A)
Aoddsum = sum(A[1:N:2])
X1 = S - 2 * Aoddsum
X = [0] * N
X[0] = X1
main(X, A, N)
for x in X:
print(x, end=" ")
| def main(X, A, N):
for i in range(N - 1):
X[i + 1] = 2 * A[i] - X[i]
return X
N = int(eval(input()))
A = list(map(int, input().split()))
S = sum(A)
Aoddsum = sum(A[1:N:2])
X1 = S - 2 * Aoddsum
X = [0] * N
X[0] = X1
main(X, A, N)
print((" ".join(list(map(str, X)))))
| false | 0 | [
"-N = int(input())",
"+N = int(eval(input()))",
"-for x in X:",
"- print(x, end=\" \")",
"+print((\" \".join(list(map(str, X)))))"
] | false | 0.037728 | 0.099791 | 0.378075 | [
"s363729041",
"s888356465"
] |
u187995255 | p03160 | python | s222788747 | s116859295 | 236 | 143 | 94,100 | 13,980 | Accepted | Accepted | 39.41 | import sys
sys.setrecursionlimit(10**6)
#import numpy as np
#N = map(int, input().split())
N = int(eval(input()))
h = list(map(int,input().split()))
# メモ化再帰
#memo = np.full(N, -1)
memo = [-1]*N
def func(i):
if memo[i] != -1:
return memo[i]
if i == 0:
return 0
elif i == 1:
... | N = int(eval(input()))
h = list(map(int,input().split()))
memo = [-1]*N
memo[0] = 0
memo[1] = abs(h[1]-h[0])
for i in range(2,N):
a = memo[i-1] + abs(h[i]-h[i-1])
b = memo[i-2] + abs(h[i]-h[i-2])
memo[i] = min(a,b)
print((memo[N-1])) | 26 | 12 | 560 | 250 | import sys
sys.setrecursionlimit(10**6)
# import numpy as np
# N = map(int, input().split())
N = int(eval(input()))
h = list(map(int, input().split()))
# メモ化再帰
# memo = np.full(N, -1)
memo = [-1] * N
def func(i):
if memo[i] != -1:
return memo[i]
if i == 0:
return 0
elif i == 1:
re... | N = int(eval(input()))
h = list(map(int, input().split()))
memo = [-1] * N
memo[0] = 0
memo[1] = abs(h[1] - h[0])
for i in range(2, N):
a = memo[i - 1] + abs(h[i] - h[i - 1])
b = memo[i - 2] + abs(h[i] - h[i - 2])
memo[i] = min(a, b)
print((memo[N - 1]))
| false | 53.846154 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"-# import numpy as np",
"-# N = map(int, input().split())",
"-# メモ化再帰",
"-# memo = np.full(N, -1)",
"-",
"-",
"-def func(i):",
"- if memo[i] != -1:",
"- return memo[i]",
"- if i == 0:",
"- return 0",
"- elif i =... | false | 0.043257 | 0.03786 | 1.142552 | [
"s222788747",
"s116859295"
] |
u296518383 | p02813 | python | s019403878 | s303868382 | 180 | 27 | 44,912 | 8,052 | Accepted | Accepted | 85 | from itertools import permutations
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
A = list(permutations(list(range(1, N + 1))))
#print("A:", A)
print((abs((A.index(P) - A.index(Q))))) | from itertools import permutations
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
D = list(permutations(list(range(1, N + 1))))
print((abs(D.index(P) - D.index(Q)))) | 10 | 8 | 231 | 210 | from itertools import permutations
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
A = list(permutations(list(range(1, N + 1))))
# print("A:", A)
print((abs((A.index(P) - A.index(Q)))))
| from itertools import permutations
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
D = list(permutations(list(range(1, N + 1))))
print((abs(D.index(P) - D.index(Q))))
| false | 20 | [
"-A = list(permutations(list(range(1, N + 1))))",
"-# print(\"A:\", A)",
"-print((abs((A.index(P) - A.index(Q)))))",
"+D = list(permutations(list(range(1, N + 1))))",
"+print((abs(D.index(P) - D.index(Q))))"
] | false | 0.039269 | 0.041725 | 0.941132 | [
"s019403878",
"s303868382"
] |
u644907318 | p03435 | python | s803200151 | s961369912 | 167 | 66 | 38,256 | 62,060 | Accepted | Accepted | 60.48 | C = [list(map(int,input().split())) for _ in range(3)]
if C[1][0]-C[0][0]==C[1][1]-C[0][1]==C[1][2]-C[0][2] and C[2][0]-C[0][0]==C[2][1]-C[0][1]==C[2][2]-C[0][2] \
and C[0][1]-C[0][0]==C[1][1]-C[1][0]==C[2][1]-C[2][0] and C[0][2]-C[0][0]==C[1][2]-C[1][0]==C[2][2]-C[2][0]:
print("Yes")
else:
print("No")
| C = [list(map(int,input().split())) for _ in range(3)]
if C[0][1]-C[0][0]==C[1][1]-C[1][0]==C[2][1]-C[2][0] and C[0][2]-C[0][1]==C[1][2]-C[1][1]==C[2][2]-C[2][1]\
and C[1][0]-C[0][0]==C[1][1]-C[0][1]==C[1][2]-C[0][2] and C[2][0]-C[1][0]==C[2][1]-C[1][1]==C[2][2]-C[1][2]:
print("Yes")
else:
print("No")
| 6 | 6 | 316 | 319 | C = [list(map(int, input().split())) for _ in range(3)]
if (
C[1][0] - C[0][0] == C[1][1] - C[0][1] == C[1][2] - C[0][2]
and C[2][0] - C[0][0] == C[2][1] - C[0][1] == C[2][2] - C[0][2]
and C[0][1] - C[0][0] == C[1][1] - C[1][0] == C[2][1] - C[2][0]
and C[0][2] - C[0][0] == C[1][2] - C[1][0] == C[2][2] -... | C = [list(map(int, input().split())) for _ in range(3)]
if (
C[0][1] - C[0][0] == C[1][1] - C[1][0] == C[2][1] - C[2][0]
and C[0][2] - C[0][1] == C[1][2] - C[1][1] == C[2][2] - C[2][1]
and C[1][0] - C[0][0] == C[1][1] - C[0][1] == C[1][2] - C[0][2]
and C[2][0] - C[1][0] == C[2][1] - C[1][1] == C[2][2] -... | false | 0 | [
"- C[1][0] - C[0][0] == C[1][1] - C[0][1] == C[1][2] - C[0][2]",
"- and C[2][0] - C[0][0] == C[2][1] - C[0][1] == C[2][2] - C[0][2]",
"- and C[0][1] - C[0][0] == C[1][1] - C[1][0] == C[2][1] - C[2][0]",
"- and C[0][2] - C[0][0] == C[1][2] - C[1][0] == C[2][2] - C[2][0]",
"+ C[0][1] - C[0][0] ... | false | 0.108901 | 0.110802 | 0.98284 | [
"s803200151",
"s961369912"
] |
u729133443 | p02917 | python | s336095283 | s041150038 | 185 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.81 | _,b=open(0);*b,=list(map(int,b.split()));print((b[0]+sum(min(t)for t in zip(b,b[1:]))+b[-1])) | _,b=open(0);*b,=list(map(int,b.split()));print((b[0]+sum(map(min,list(zip(b,b[1:]))))+b[-1])) | 1 | 1 | 85 | 79 | _, b = open(0)
(*b,) = list(map(int, b.split()))
print((b[0] + sum(min(t) for t in zip(b, b[1:])) + b[-1]))
| _, b = open(0)
(*b,) = list(map(int, b.split()))
print((b[0] + sum(map(min, list(zip(b, b[1:])))) + b[-1]))
| false | 0 | [
"-print((b[0] + sum(min(t) for t in zip(b, b[1:])) + b[-1]))",
"+print((b[0] + sum(map(min, list(zip(b, b[1:])))) + b[-1]))"
] | false | 0.084726 | 0.063511 | 1.334034 | [
"s336095283",
"s041150038"
] |
u775681539 | p02690 | python | s016841091 | s956912542 | 957 | 758 | 9,248 | 9,324 | Accepted | Accepted | 20.79 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
X = int(readline())
for b in range(-1000, 1001):
for a in range(b, 1001):
if a**5 -b**5 == X:
A = a
B = b
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from itertools import combinations
def main():
X = int(readline())
p = [int(i) for i in range(-1000, 1001)]
for b, a in combinations(p, 2):
if a**5 - b**5 == X:
A... | 15 | 16 | 403 | 419 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
X = int(readline())
for b in range(-1000, 1001):
for a in range(b, 1001):
if a**5 - b**5 == X:
A = a
B = b
break
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from itertools import combinations
def main():
X = int(readline())
p = [int(i) for i in range(-1000, 1001)]
for b, a in combinations(p, 2):
if a**5 - b**5 == X:
A = a
... | false | 6.25 | [
"+from itertools import combinations",
"- for b in range(-1000, 1001):",
"- for a in range(b, 1001):",
"- if a**5 - b**5 == X:",
"- A = a",
"- B = b",
"- break",
"+ p = [int(i) for i in range(-1000, 1001)]",
"+ for b, a in combi... | false | 2.290543 | 1.054625 | 2.171903 | [
"s016841091",
"s956912542"
] |
u367130284 | p03425 | python | s522236595 | s122083438 | 153 | 56 | 3,828 | 10,668 | Accepted | Accepted | 63.4 | from itertools import*;d,o=[0]*91,ord
for _ in[0]*int(eval(input())):d[o(input()[0])]+=1
print((sum(d[p]*d[q]*d[r]for p,q,r in combinations(list(map(o,'MARCH')),3)))) | from itertools import*
x=sorted(s[0]for s in open(0).readlines()[1:])
#print(list(x))
c=[len(list(v))for k,v in groupby(x)if k in"MARCH"]
#print(c)
y=combinations(c,3)
#print(list(y))
print((sum(p*q*r for p,q,r in list(y)))) | 3 | 8 | 154 | 229 | from itertools import *
d, o = [0] * 91, ord
for _ in [0] * int(eval(input())):
d[o(input()[0])] += 1
print((sum(d[p] * d[q] * d[r] for p, q, r in combinations(list(map(o, "MARCH")), 3))))
| from itertools import *
x = sorted(s[0] for s in open(0).readlines()[1:])
# print(list(x))
c = [len(list(v)) for k, v in groupby(x) if k in "MARCH"]
# print(c)
y = combinations(c, 3)
# print(list(y))
print((sum(p * q * r for p, q, r in list(y))))
| false | 62.5 | [
"-d, o = [0] * 91, ord",
"-for _ in [0] * int(eval(input())):",
"- d[o(input()[0])] += 1",
"-print((sum(d[p] * d[q] * d[r] for p, q, r in combinations(list(map(o, \"MARCH\")), 3))))",
"+x = sorted(s[0] for s in open(0).readlines()[1:])",
"+# print(list(x))",
"+c = [len(list(v)) for k, v in groupby(x)... | false | 0.0453 | 0.084665 | 0.535048 | [
"s522236595",
"s122083438"
] |
u113971909 | p02621 | python | s587479352 | s525436234 | 33 | 25 | 9,148 | 9,124 | Accepted | Accepted | 24.24 | #!/usr/bin python3
# -*- coding: utf-8 -*-
def main():
N = int(eval(input()))
print((N+N*N+N*N*N))
if __name__ == '__main__':
main() | #!/usr/bin python3
# -*- coding: utf-8 -*-
def main():
a = int(eval(input()))
print((a+a*a+a*a*a))
if __name__ == '__main__':
main() | 10 | 10 | 148 | 148 | #!/usr/bin python3
# -*- coding: utf-8 -*-
def main():
N = int(eval(input()))
print((N + N * N + N * N * N))
if __name__ == "__main__":
main()
| #!/usr/bin python3
# -*- coding: utf-8 -*-
def main():
a = int(eval(input()))
print((a + a * a + a * a * a))
if __name__ == "__main__":
main()
| false | 0 | [
"- N = int(eval(input()))",
"- print((N + N * N + N * N * N))",
"+ a = int(eval(input()))",
"+ print((a + a * a + a * a * a))"
] | false | 0.121489 | 0.047319 | 2.567443 | [
"s587479352",
"s525436234"
] |
u434872492 | p03687 | python | s232636878 | s365628878 | 185 | 64 | 41,452 | 63,048 | Accepted | Accepted | 65.41 | s=eval(input())
x=dict()
for i in range(len(s)):
S=s[i]
if S in x:
x[S]+=1
else:
x[S]=1
M=0
cnt=0
for idx in x:
M=max(M,x[idx])
cnt+=1
if cnt==1:
print((0))
exit()
#y=sorted(x.items(),key=lambda x:x[1],reverse=True)
ans=10**10
#print(y)
for idy in x:
... | s = list(eval(input()))
abc = "abcdefghijklmnopqrstuvwxyz"
ans = len(s)
for a in abc:
if a in s:
t = s.index(a)
anst = t
for i in range(t+1,len(s)):
if s[i]==a:
anst=max(anst,i-t-1)
t = i
anst = max(anst,len(s)-t-1)
... | 50 | 19 | 898 | 352 | s = eval(input())
x = dict()
for i in range(len(s)):
S = s[i]
if S in x:
x[S] += 1
else:
x[S] = 1
M = 0
cnt = 0
for idx in x:
M = max(M, x[idx])
cnt += 1
if cnt == 1:
print((0))
exit()
# y=sorted(x.items(),key=lambda x:x[1],reverse=True)
ans = 10**10
# print(y)
for idy in x:
... | s = list(eval(input()))
abc = "abcdefghijklmnopqrstuvwxyz"
ans = len(s)
for a in abc:
if a in s:
t = s.index(a)
anst = t
for i in range(t + 1, len(s)):
if s[i] == a:
anst = max(anst, i - t - 1)
t = i
anst = max(anst, len(s) - t - 1)
... | false | 62 | [
"-s = eval(input())",
"-x = dict()",
"-for i in range(len(s)):",
"- S = s[i]",
"- if S in x:",
"- x[S] += 1",
"- else:",
"- x[S] = 1",
"-M = 0",
"-cnt = 0",
"-for idx in x:",
"- M = max(M, x[idx])",
"- cnt += 1",
"-if cnt == 1:",
"- print((0))",
"- ex... | false | 0.007357 | 0.037751 | 0.194881 | [
"s232636878",
"s365628878"
] |
u537782349 | p03146 | python | s999465808 | s925033453 | 19 | 17 | 2,940 | 3,060 | Accepted | Accepted | 10.53 | a = int(eval(input()))
b = [a]
c = 1
while True:
c += 1
if a % 2 == 0:
a = a // 2
else:
a = 3 * a + 1
if a in b:
print(c)
exit()
else:
b.append(a)
| a = int(eval(input()))
b = [a]
d = 1
while True:
c = b[len(b)-1]
d += 1
if c % 2 == 0:
c = c // 2
else:
c = c * 3 + 1
if c not in b:
b.append(c)
else:
print(d)
exit()
| 14 | 15 | 214 | 239 | a = int(eval(input()))
b = [a]
c = 1
while True:
c += 1
if a % 2 == 0:
a = a // 2
else:
a = 3 * a + 1
if a in b:
print(c)
exit()
else:
b.append(a)
| a = int(eval(input()))
b = [a]
d = 1
while True:
c = b[len(b) - 1]
d += 1
if c % 2 == 0:
c = c // 2
else:
c = c * 3 + 1
if c not in b:
b.append(c)
else:
print(d)
exit()
| false | 6.666667 | [
"-c = 1",
"+d = 1",
"- c += 1",
"- if a % 2 == 0:",
"- a = a // 2",
"+ c = b[len(b) - 1]",
"+ d += 1",
"+ if c % 2 == 0:",
"+ c = c // 2",
"- a = 3 * a + 1",
"- if a in b:",
"- print(c)",
"+ c = c * 3 + 1",
"+ if c not in b:",
"+ ... | false | 0.046599 | 0.160731 | 0.289922 | [
"s999465808",
"s925033453"
] |
u562935282 | p02734 | python | s521646325 | s426449984 | 1,808 | 1,353 | 3,316 | 3,316 | Accepted | Accepted | 25.17 | # https://atcoder.jp/contests/abc159/submissions/11139734
def main():
MOD = 998244353
N, S = list(map(int, input().split()))
*A, = list(map(int, input().split()))
ans = 0
dp = [0] * (S + 1)
for i, a in enumerate(A, start=1):
dp[0] = i # i以前の(i+1)通りの起点がある(以後未取得)
an... | def main():
MOD = 998244353
N, S = list(map(int, input().split()))
*A, = list(map(int, input().split()))
dp = [0] * (S + 1)
ans = 0
for x in A:
dp[0] += 1
for j in range(S, x - 1, -1):
dp[j] = (dp[j] + dp[j - x]) % MOD
ans = (ans + dp[S]) % MOD
... | 25 | 18 | 583 | 367 | # https://atcoder.jp/contests/abc159/submissions/11139734
def main():
MOD = 998244353
N, S = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
ans = 0
dp = [0] * (S + 1)
for i, a in enumerate(A, start=1):
dp[0] = i # i以前の(i+1)通りの起点がある(以後未取得)
ans += dp[S] #... | def main():
MOD = 998244353
N, S = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
dp = [0] * (S + 1)
ans = 0
for x in A:
dp[0] += 1
for j in range(S, x - 1, -1):
dp[j] = (dp[j] + dp[j - x]) % MOD
ans = (ans + dp[S]) % MOD
print(ans... | false | 28 | [
"-# https://atcoder.jp/contests/abc159/submissions/11139734",
"+ dp = [0] * (S + 1)",
"- dp = [0] * (S + 1)",
"- for i, a in enumerate(A, start=1):",
"- dp[0] = i # i以前の(i+1)通りの起点がある(以後未取得)",
"- ans += dp[S] # aを取らずにclose",
"- if S >= a:",
"- ans += dp[S - a]... | false | 0.037442 | 0.035701 | 1.048743 | [
"s521646325",
"s426449984"
] |
u735069283 | p03494 | python | s247847404 | s080873784 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | N = int(eval(input()))
A = [int(x) for x in input().split()]
result = float('inf')
for i in range(N):
r=0
while A[i]%2==0:
A[i]=A[i]/2
r +=1
result=min(result,r)
print(result) | N= int(eval(input()))
A =[int(x) for x in input().split()]
answer=float('inf')
for i in range(N):
cut=len(bin(A[i]))-bin(A[i]).rfind('1')-1
answer=min(answer,cut)
print(answer) | 10 | 7 | 192 | 180 | N = int(eval(input()))
A = [int(x) for x in input().split()]
result = float("inf")
for i in range(N):
r = 0
while A[i] % 2 == 0:
A[i] = A[i] / 2
r += 1
result = min(result, r)
print(result)
| N = int(eval(input()))
A = [int(x) for x in input().split()]
answer = float("inf")
for i in range(N):
cut = len(bin(A[i])) - bin(A[i]).rfind("1") - 1
answer = min(answer, cut)
print(answer)
| false | 30 | [
"-result = float(\"inf\")",
"+answer = float(\"inf\")",
"- r = 0",
"- while A[i] % 2 == 0:",
"- A[i] = A[i] / 2",
"- r += 1",
"- result = min(result, r)",
"-print(result)",
"+ cut = len(bin(A[i])) - bin(A[i]).rfind(\"1\") - 1",
"+ answer = min(answer, cut)",
"+print(... | false | 0.036272 | 0.038076 | 0.952631 | [
"s247847404",
"s080873784"
] |
u047393579 | p03722 | python | s130770958 | s883339515 | 1,612 | 642 | 3,364 | 3,316 | Accepted | Accepted | 60.17 | N, M = list(map(int, input().split()))
E = []
for _ in range(M):
a,b,c = list(map(int, input().split()))
E.append((a,b,c))
dist = [-N*10**9]*(N+1)
dist[1] = 0
flag = False
for i in range(N):
for (a,b,c) in E:
newlen = dist[a] + c
if newlen > dist[b]:
if i == N-1:
... | N, M = list(map(int, input().split()))
E = []
for _ in range(M):
a,b,c = list(map(int, input().split()))
E.append((a,b,c))
dist = [-N*10**9]*(N+1)
dist[1] = 0
flag = False
for i in range(N):
for (a,b,c) in E:
newlen = dist[a] + c
if newlen > dist[b]:
dist[b] = newlen
... | 27 | 21 | 621 | 447 | N, M = list(map(int, input().split()))
E = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
E.append((a, b, c))
dist = [-N * 10**9] * (N + 1)
dist[1] = 0
flag = False
for i in range(N):
for (a, b, c) in E:
newlen = dist[a] + c
if newlen > dist[b]:
if i == N - 1:
... | N, M = list(map(int, input().split()))
E = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
E.append((a, b, c))
dist = [-N * 10**9] * (N + 1)
dist[1] = 0
flag = False
for i in range(N):
for (a, b, c) in E:
newlen = dist[a] + c
if newlen > dist[b]:
dist[b] = newlen
... | false | 22.222222 | [
"- if i == N - 1:",
"- flag = True",
"- predist = dist[N]",
"-dist2 = dist.copy()",
"-for i in range(N):",
"- for (a, b, c) in E:",
"- newlen = dist2[a] + c",
"- if newlen > dist2[b]:",
"- dist2[b] = newlen",
"-if dist2[N] > dist[N]:... | false | 0.037899 | 0.03641 | 1.040913 | [
"s130770958",
"s883339515"
] |
u413456759 | p02389 | python | s677869836 | s487368936 | 20 | 10 | 4,204 | 4,184 | Accepted | Accepted | 50 | #!/usr/bin/env python
# coding: utf-8
def main():
a, b = [int(x) for x in input().split(" ")]
print(a * b, (a + b) * 2)
if __name__ == '__main__':
main() | #!/usr/bin/env python
# coding: utf-8
if __name__ == '__main__':
x, y = list(map(int, input().split()))
print(x * y, 2 * (x + y)) | 9 | 8 | 169 | 144 | #!/usr/bin/env python
# coding: utf-8
def main():
a, b = [int(x) for x in input().split(" ")]
print(a * b, (a + b) * 2)
if __name__ == "__main__":
main()
| #!/usr/bin/env python
# coding: utf-8
if __name__ == "__main__":
x, y = list(map(int, input().split()))
print(x * y, 2 * (x + y))
| false | 11.111111 | [
"-def main():",
"- a, b = [int(x) for x in input().split(\" \")]",
"- print(a * b, (a + b) * 2)",
"-",
"-",
"- main()",
"+ x, y = list(map(int, input().split()))",
"+ print(x * y, 2 * (x + y))"
] | false | 0.167349 | 0.119676 | 1.398342 | [
"s677869836",
"s487368936"
] |
u562935282 | p03006 | python | s405177159 | s023908956 | 25 | 23 | 3,948 | 3,564 | Accepted | Accepted | 8 | from collections import Counter
N = int(eval(input()))
p = []
for _ in range(N):
p.append(tuple(map(int, input().split())))
if N == 1:
print((1))
exit()
d = []
for i, p1 in enumerate(p):
for j, p2 in enumerate(p):
if i == j:
continue
x = p1[0] - p2[0]
... | def main():
from collections import Counter, namedtuple
pt = namedtuple('pt', 'x y')
def delta(a: pt, b: pt) -> pt:
x = a.x - b.x
y = a.y - b.y
if (x < 0) or (x == 0 and y < 0):
x = -x
y = -y
return pt(x=x, y=y)
n = int(eval(input()... | 24 | 36 | 426 | 703 | from collections import Counter
N = int(eval(input()))
p = []
for _ in range(N):
p.append(tuple(map(int, input().split())))
if N == 1:
print((1))
exit()
d = []
for i, p1 in enumerate(p):
for j, p2 in enumerate(p):
if i == j:
continue
x = p1[0] - p2[0]
y = p1[1] - p2[... | def main():
from collections import Counter, namedtuple
pt = namedtuple("pt", "x y")
def delta(a: pt, b: pt) -> pt:
x = a.x - b.x
y = a.y - b.y
if (x < 0) or (x == 0 and y < 0):
x = -x
y = -y
return pt(x=x, y=y)
n = int(eval(input()))
if n =... | false | 33.333333 | [
"-from collections import Counter",
"+def main():",
"+ from collections import Counter, namedtuple",
"-N = int(eval(input()))",
"-p = []",
"-for _ in range(N):",
"- p.append(tuple(map(int, input().split())))",
"-if N == 1:",
"- print((1))",
"- exit()",
"-d = []",
"-for i, p1 in enu... | false | 0.045779 | 0.044918 | 1.019173 | [
"s405177159",
"s023908956"
] |
u599547273 | p02882 | python | s575997183 | s648855481 | 20 | 18 | 3,316 | 3,064 | Accepted | Accepted | 10 | from math import tan, radians, pi
A, B, X = list(map(int, input().split()))
def angle_to_max_water(angle):
c = A*tan(radians(angle))
if c <= B:
return A*B - (A*c/2)
else:
d = B*tan(radians(90-angle))
# print(d)
return B*d/2
l, r = 0, 90
for i in range(30):
... | from math import tan, radians, pi
A, B, X = list(map(int, input().split()))
def solve(angle):
c = A*tan(radians(angle))
if c <= B:
max_water = A*B - (A*c/2)
else:
d = B*tan(radians(90-angle))
max_water = B*d/2
return max_water >= X/A
ok = 0
ng = 90
for i in rang... | 24 | 25 | 489 | 483 | from math import tan, radians, pi
A, B, X = list(map(int, input().split()))
def angle_to_max_water(angle):
c = A * tan(radians(angle))
if c <= B:
return A * B - (A * c / 2)
else:
d = B * tan(radians(90 - angle))
# print(d)
return B * d / 2
l, r = 0, 90
for i in range(30)... | from math import tan, radians, pi
A, B, X = list(map(int, input().split()))
def solve(angle):
c = A * tan(radians(angle))
if c <= B:
max_water = A * B - (A * c / 2)
else:
d = B * tan(radians(90 - angle))
max_water = B * d / 2
return max_water >= X / A
ok = 0
ng = 90
for i in... | false | 4 | [
"-def angle_to_max_water(angle):",
"+def solve(angle):",
"- return A * B - (A * c / 2)",
"+ max_water = A * B - (A * c / 2)",
"- # print(d)",
"- return B * d / 2",
"+ max_water = B * d / 2",
"+ return max_water >= X / A",
"-l, r = 0, 90",
"+ok = 0",
"+ng = 9... | false | 0.275674 | 0.25642 | 1.075091 | [
"s575997183",
"s648855481"
] |
u761320129 | p03862 | python | s562103935 | s140732771 | 150 | 109 | 14,052 | 14,052 | Accepted | Accepted | 27.33 | N,X = list(map(int,input().split()))
src = list(map(int,input().split()))
prev = ans1 = 0
for a in src:
if prev+a > X:
eat = prev+a - X
ans1 += eat
prev = max(0, a-eat)
else:
prev = a
prev = ans2 = 0
for a in src[::-1]:
if prev+a > X:
eat = prev+a - X... | N,X = list(map(int,input().split()))
A = list(map(int,input().split()))
ans = 0
for i in range(1,N):
if A[i] + A[i-1] <= X: continue
diff = A[i] + A[i-1] - X
ans += diff
if diff < A[i]:
A[i] -= diff
else:
#diff -= A[i]
A[i] = 0
#A[i-1] -= diff
print(ans... | 22 | 15 | 420 | 315 | N, X = list(map(int, input().split()))
src = list(map(int, input().split()))
prev = ans1 = 0
for a in src:
if prev + a > X:
eat = prev + a - X
ans1 += eat
prev = max(0, a - eat)
else:
prev = a
prev = ans2 = 0
for a in src[::-1]:
if prev + a > X:
eat = prev + a - X
... | N, X = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(1, N):
if A[i] + A[i - 1] <= X:
continue
diff = A[i] + A[i - 1] - X
ans += diff
if diff < A[i]:
A[i] -= diff
else:
# diff -= A[i]
A[i] = 0
# A[i-1] -= diff
print(... | false | 31.818182 | [
"-src = list(map(int, input().split()))",
"-prev = ans1 = 0",
"-for a in src:",
"- if prev + a > X:",
"- eat = prev + a - X",
"- ans1 += eat",
"- prev = max(0, a - eat)",
"+A = list(map(int, input().split()))",
"+ans = 0",
"+for i in range(1, N):",
"+ if A[i] + A[i - 1... | false | 0.037292 | 0.043263 | 0.861984 | [
"s562103935",
"s140732771"
] |
u519939795 | p02784 | python | s838940616 | s154268172 | 41 | 37 | 13,964 | 9,944 | Accepted | Accepted | 9.76 | h,n=list(map(int,input().split()))
l=list(map(int,input().split()))
print(('Yes' if sum(l)>=h else 'No')) | H, N = list(map(int, input().split()))
A = sum(map(int, input().split()))
print(("Yes" if H <= A else "No")) | 3 | 3 | 99 | 102 | h, n = list(map(int, input().split()))
l = list(map(int, input().split()))
print(("Yes" if sum(l) >= h else "No"))
| H, N = list(map(int, input().split()))
A = sum(map(int, input().split()))
print(("Yes" if H <= A else "No"))
| false | 0 | [
"-h, n = list(map(int, input().split()))",
"-l = list(map(int, input().split()))",
"-print((\"Yes\" if sum(l) >= h else \"No\"))",
"+H, N = list(map(int, input().split()))",
"+A = sum(map(int, input().split()))",
"+print((\"Yes\" if H <= A else \"No\"))"
] | false | 0.044017 | 0.045617 | 0.964919 | [
"s838940616",
"s154268172"
] |
u461993794 | p02622 | python | s716592834 | s579768909 | 214 | 101 | 73,596 | 73,944 | Accepted | Accepted | 52.8 | s = eval(input())
t = eval(input())
ans = 0
for i in range(len(s)):
if s[i] != t[i]:
ans += 1
print(ans)
| s = eval(input())
t = eval(input())
ans = 0
for i, sv in enumerate(s):
if sv != t[i]:
ans += 1
print(ans)
| 7 | 8 | 111 | 114 | s = eval(input())
t = eval(input())
ans = 0
for i in range(len(s)):
if s[i] != t[i]:
ans += 1
print(ans)
| s = eval(input())
t = eval(input())
ans = 0
for i, sv in enumerate(s):
if sv != t[i]:
ans += 1
print(ans)
| false | 12.5 | [
"-for i in range(len(s)):",
"- if s[i] != t[i]:",
"+for i, sv in enumerate(s):",
"+ if sv != t[i]:"
] | false | 0.084902 | 0.037238 | 2.27999 | [
"s716592834",
"s579768909"
] |
u644907318 | p03038 | python | s899066102 | s068950436 | 780 | 351 | 82,968 | 101,884 | Accepted | Accepted | 55 | N,M = list(map(int,input().split()))
A = sorted(list(map(int,input().split())))
B = sorted([list(map(int,input().split())) for _ in range(M)],key=lambda x:x[1],reverse=True)
cur = 0
cnt = 0
for i in range(N):
if A[i]<B[cur][1] and cnt<B[cur][0]:
A[i]=B[cur][1]
cnt += 1
elif A[i]>=B[cur]... | N,M = list(map(int,input().split()))
A = sorted(list(map(int,input().split())))
B = sorted([list(map(int,input().split())) for _ in range(M)],key=lambda x:x[1],reverse=True)
cur = 0
cnt = B[0][0]
for i in range(N):
a = A[i]
if cur<M and B[cur][1]>a:
if cnt>0:
A[i] = B[cur][1]
... | 18 | 19 | 504 | 538 | N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
B = sorted(
[list(map(int, input().split())) for _ in range(M)],
key=lambda x: x[1],
reverse=True,
)
cur = 0
cnt = 0
for i in range(N):
if A[i] < B[cur][1] and cnt < B[cur][0]:
A[i] = B[cur][1]
cnt += 1
... | N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
B = sorted(
[list(map(int, input().split())) for _ in range(M)],
key=lambda x: x[1],
reverse=True,
)
cur = 0
cnt = B[0][0]
for i in range(N):
a = A[i]
if cur < M and B[cur][1] > a:
if cnt > 0:
A[i]... | false | 5.263158 | [
"-cnt = 0",
"+cnt = B[0][0]",
"- if A[i] < B[cur][1] and cnt < B[cur][0]:",
"- A[i] = B[cur][1]",
"- cnt += 1",
"- elif A[i] >= B[cur][1]:",
"- break",
"- elif cnt >= B[cur][0]:",
"- cur += 1",
"- cnt = 0",
"- if cur >= M:",
"- brea... | false | 0.113259 | 0.043722 | 2.590451 | [
"s899066102",
"s068950436"
] |
u486065927 | p02678 | python | s885272944 | s057888845 | 1,140 | 680 | 35,504 | 42,392 | Accepted | Accepted | 40.35 | from collections import deque
n, m = list(map(int, input().split()))
lis = [0]*(n+1)
c = [[] for i in range(n+1)]
for i in range(m):
a, b = list(map(int, input().split()))
c[a].append(b)
c[b].append(a)
que = deque([1])
check = [0 for i in range(n+1)]
check[1] = 1
while que:
now = que.p... | from collections import deque
n, m = list(map(int, input().split()))
lis = [0]*(n+1)
c = [[] for i in range(n+1)]
for i in range(m):
a, b = list(map(int, input().split()))
c[a].append(b)
c[b].append(a)
que = deque([1])
check = [0 for i in range(n+1)]
check[1] = 1
while que:
now = que.p... | 27 | 26 | 568 | 569 | from collections import deque
n, m = list(map(int, input().split()))
lis = [0] * (n + 1)
c = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
c[a].append(b)
c[b].append(a)
que = deque([1])
check = [0 for i in range(n + 1)]
check[1] = 1
while que:
now = que.popleft()
... | from collections import deque
n, m = list(map(int, input().split()))
lis = [0] * (n + 1)
c = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
c[a].append(b)
c[b].append(a)
que = deque([1])
check = [0 for i in range(n + 1)]
check[1] = 1
while que:
now = que.popleft()
... | false | 3.703704 | [
"- for i in lis[2:]:",
"- print(i)",
"+ print((\"\\n\".join(map(str, lis[2:]))))"
] | false | 0.101314 | 0.038002 | 2.666027 | [
"s885272944",
"s057888845"
] |
u376420711 | p03659 | python | s218939477 | s917521665 | 198 | 173 | 24,824 | 25,056 | Accepted | Accepted | 12.63 | n = int(eval(input()))
a = list(map(int, input().split()))
s = sum(a)
ans = 10**10
sunuke = 0
for i in range(n - 1):
sunuke += a[i]
ans = min(ans, abs(2 * sunuke - s))
print(ans)
| n = int(eval(input()))
a = tuple(map(int, input().split()))
s = sum(a)
ans = 10**10
sunuke = 0
for i in range(n - 1):
sunuke += a[i]
ans = min(ans, abs(2 * sunuke - s))
print(ans)
| 9 | 9 | 189 | 190 | n = int(eval(input()))
a = list(map(int, input().split()))
s = sum(a)
ans = 10**10
sunuke = 0
for i in range(n - 1):
sunuke += a[i]
ans = min(ans, abs(2 * sunuke - s))
print(ans)
| n = int(eval(input()))
a = tuple(map(int, input().split()))
s = sum(a)
ans = 10**10
sunuke = 0
for i in range(n - 1):
sunuke += a[i]
ans = min(ans, abs(2 * sunuke - s))
print(ans)
| false | 0 | [
"-a = list(map(int, input().split()))",
"+a = tuple(map(int, input().split()))"
] | false | 0.045909 | 0.045758 | 1.003304 | [
"s218939477",
"s917521665"
] |
u627803856 | p03212 | python | s046639307 | s615456870 | 250 | 226 | 45,424 | 43,228 | Accepted | Accepted | 9.6 | from itertools import product
from bisect import bisect_left, bisect_right
n = int(eval(input()))
s = []
for i in range(3, 10):
for v in product('753', repeat=i):
if len(set(v)) >= 3:
s.append(int(''.join(v)))
s.sort()
idx = bisect_right(s, n)
print((len(s[:idx]))) | n = int(eval(input()))
def dfs(val, A):
if val > n:
return
A.append(val)
dfs(10 * val + 3, A)
dfs(10 * val + 5, A)
dfs(10 * val + 7, A)
A = []
dfs(3, A)
dfs(5, A)
dfs(7, A)
cnt = 0
for v in A:
if len(set(list(str(v)))) == 3:
cnt += 1
print(cnt) | 14 | 20 | 297 | 300 | from itertools import product
from bisect import bisect_left, bisect_right
n = int(eval(input()))
s = []
for i in range(3, 10):
for v in product("753", repeat=i):
if len(set(v)) >= 3:
s.append(int("".join(v)))
s.sort()
idx = bisect_right(s, n)
print((len(s[:idx])))
| n = int(eval(input()))
def dfs(val, A):
if val > n:
return
A.append(val)
dfs(10 * val + 3, A)
dfs(10 * val + 5, A)
dfs(10 * val + 7, A)
A = []
dfs(3, A)
dfs(5, A)
dfs(7, A)
cnt = 0
for v in A:
if len(set(list(str(v)))) == 3:
cnt += 1
print(cnt)
| false | 30 | [
"-from itertools import product",
"-from bisect import bisect_left, bisect_right",
"+n = int(eval(input()))",
"-n = int(eval(input()))",
"-s = []",
"-for i in range(3, 10):",
"- for v in product(\"753\", repeat=i):",
"- if len(set(v)) >= 3:",
"- s.append(int(\"\".join(v)))",
"... | false | 0.086169 | 0.056524 | 1.524467 | [
"s046639307",
"s615456870"
] |
u940139461 | p02788 | python | s639848026 | s978215742 | 1,589 | 1,404 | 85,592 | 117,720 | Accepted | Accepted | 11.64 | from collections import deque
def updiv(a,b):
if a % b == 0:
return a // b
else:
return a // b + 1
N,D,A = list(map(int,input().split()))
XH = []
for i in range(N):
x,h = list(map(int,input().split()))
XH.append([x,h])
XH.sort()
q = deque([])
qs = 0
ans = 0
... | import bisect
from collections import deque
import math
n, d, A = list(map(int, input().split()))
xh = []
for _ in range(n):
x, h = list(map(int, input().split()))
xh.append([x, h])
xh.sort(key=lambda x: x[0])
monster_x = []
monster_hp = []
for i in range(n):
monster_x.append(xh[i][0])
mo... | 44 | 33 | 647 | 855 | from collections import deque
def updiv(a, b):
if a % b == 0:
return a // b
else:
return a // b + 1
N, D, A = list(map(int, input().split()))
XH = []
for i in range(N):
x, h = list(map(int, input().split()))
XH.append([x, h])
XH.sort()
q = deque([])
qs = 0
ans = 0
for i in range(N):
... | import bisect
from collections import deque
import math
n, d, A = list(map(int, input().split()))
xh = []
for _ in range(n):
x, h = list(map(int, input().split()))
xh.append([x, h])
xh.sort(key=lambda x: x[0])
monster_x = []
monster_hp = []
for i in range(n):
monster_x.append(xh[i][0])
monster_hp.appen... | false | 25 | [
"+import bisect",
"+import math",
"-",
"-def updiv(a, b):",
"- if a % b == 0:",
"- return a // b",
"- else:",
"- return a // b + 1",
"-",
"-",
"-N, D, A = list(map(int, input().split()))",
"-XH = []",
"-for i in range(N):",
"+n, d, A = list(map(int, input().split()))",
... | false | 0.047503 | 0.048571 | 0.978011 | [
"s639848026",
"s978215742"
] |
u265506056 | p03013 | python | s993052600 | s465953581 | 1,015 | 466 | 921,200 | 460,020 | Accepted | Accepted | 54.09 | N,M=list(map(int,input().split()))
A=[]
B=[]
a=[]
a.append(0)
x=0
d=1
A.append(1)
A.append(2)
B.append(1)
B.append(1)
for j in range(2,N):
A.append(A[j-1]+A[j-2])
B.append(B[j-1]+B[j-2])
for i in range(1,M+1):
a.append(int(eval(input())))
if a[i-1]==0:
if a[i]==1:
d... | N,M=list(map(int,input().split()))
dp=[1]*(N+1)
for _ in range(M):
a=int(eval(input()))
dp[a]=0
for i in range(2,N+1):
if dp[i]!=0:
dp[i]=dp[i-1]+dp[i-2]
print((dp[N]%(10**9+7))) | 39 | 9 | 664 | 192 | N, M = list(map(int, input().split()))
A = []
B = []
a = []
a.append(0)
x = 0
d = 1
A.append(1)
A.append(2)
B.append(1)
B.append(1)
for j in range(2, N):
A.append(A[j - 1] + A[j - 2])
B.append(B[j - 1] + B[j - 2])
for i in range(1, M + 1):
a.append(int(eval(input())))
if a[i - 1] == 0:
if a[i] =... | N, M = list(map(int, input().split()))
dp = [1] * (N + 1)
for _ in range(M):
a = int(eval(input()))
dp[a] = 0
for i in range(2, N + 1):
if dp[i] != 0:
dp[i] = dp[i - 1] + dp[i - 2]
print((dp[N] % (10**9 + 7)))
| false | 76.923077 | [
"-A = []",
"-B = []",
"-a = []",
"-a.append(0)",
"-x = 0",
"-d = 1",
"-A.append(1)",
"-A.append(2)",
"-B.append(1)",
"-B.append(1)",
"-for j in range(2, N):",
"- A.append(A[j - 1] + A[j - 2])",
"- B.append(B[j - 1] + B[j - 2])",
"-for i in range(1, M + 1):",
"- a.append(int(eval... | false | 0.03851 | 0.007425 | 5.186316 | [
"s993052600",
"s465953581"
] |
u833543158 | p03044 | python | s049449250 | s078525698 | 637 | 520 | 56,020 | 56,012 | Accepted | Accepted | 18.37 | N = int(eval(input()))
nodes = [set() for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
u, v = (u - 1, v - 1)
nodes[u].add((v, w))
nodes[v].add((u, w))
ans = [-1] * N
q = [(0, 0, -1)]
while q:
v, dist, parent = q.pop()
if dist % 2 == 0:
... | import sys
N = int(eval(input()))
nodes = [set() for _ in range(N)]
for line in sys.stdin:
u, v, w = list(map(int, line.split()))
u, v = (u - 1, v - 1)
nodes[u].add((v, w))
nodes[v].add((u, w))
ans = [-1 for _ in range(N)]
q = [(0, 0, -1)]
while q:
v, dist, parent = q.pop()
... | 27 | 29 | 502 | 527 | N = int(eval(input()))
nodes = [set() for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
u, v = (u - 1, v - 1)
nodes[u].add((v, w))
nodes[v].add((u, w))
ans = [-1] * N
q = [(0, 0, -1)]
while q:
v, dist, parent = q.pop()
if dist % 2 == 0:
ans[v] = 0
el... | import sys
N = int(eval(input()))
nodes = [set() for _ in range(N)]
for line in sys.stdin:
u, v, w = list(map(int, line.split()))
u, v = (u - 1, v - 1)
nodes[u].add((v, w))
nodes[v].add((u, w))
ans = [-1 for _ in range(N)]
q = [(0, 0, -1)]
while q:
v, dist, parent = q.pop()
if dist % 2 == 0:
... | false | 6.896552 | [
"+import sys",
"+",
"-for _ in range(N - 1):",
"- u, v, w = list(map(int, input().split()))",
"+for line in sys.stdin:",
"+ u, v, w = list(map(int, line.split()))",
"-ans = [-1] * N",
"+ans = [-1 for _ in range(N)]"
] | false | 0.042122 | 0.037547 | 1.121862 | [
"s049449250",
"s078525698"
] |
u021019433 | p02757 | python | s400689753 | s036398035 | 494 | 153 | 4,464 | 3,500 | Accepted | Accepted | 69.03 | from itertools import accumulate
from collections import Counter
I = lambda s:list(map(int, s))
p = int(input().split()[1])
s = eval(input())
if 10 % p == 0:
r = sum(i for i, x in enumerate(I(s), 1) if x % p == 0)
else:
a = accumulate(x * pow(10, i, p) for i, x in enumerate(I(reversed(s)), 1))
c = Co... | I = lambda s:list(map(int, s))
p = int(input().split()[1])
s = eval(input())
if 10 % p == 0:
r = sum(i for i, x in enumerate(I(s), 1) if x % p == 0)
else:
d = [1] + [0] * (p - 1)
t, y = 0, 1
for i, x in enumerate(I(reversed(s)), 1):
t = (t + x * y) % p
d[t] += 1
y = y * 10 % p;
r = s... | 15 | 15 | 405 | 350 | from itertools import accumulate
from collections import Counter
I = lambda s: list(map(int, s))
p = int(input().split()[1])
s = eval(input())
if 10 % p == 0:
r = sum(i for i, x in enumerate(I(s), 1) if x % p == 0)
else:
a = accumulate(x * pow(10, i, p) for i, x in enumerate(I(reversed(s)), 1))
c = Counter... | I = lambda s: list(map(int, s))
p = int(input().split()[1])
s = eval(input())
if 10 % p == 0:
r = sum(i for i, x in enumerate(I(s), 1) if x % p == 0)
else:
d = [1] + [0] * (p - 1)
t, y = 0, 1
for i, x in enumerate(I(reversed(s)), 1):
t = (t + x * y) % p
d[t] += 1
y = y * 10 % p
... | false | 0 | [
"-from itertools import accumulate",
"-from collections import Counter",
"-",
"- a = accumulate(x * pow(10, i, p) for i, x in enumerate(I(reversed(s)), 1))",
"- c = Counter(x % p for x in a)",
"- c[0] += 1",
"- r = sum(i * (i - 1) // 2 for i in list(c.values()))",
"+ d = [1] + [0] * (p ... | false | 0.085678 | 0.036703 | 2.334342 | [
"s400689753",
"s036398035"
] |
u738898077 | p02645 | python | s272718476 | s571009182 | 22 | 20 | 9,024 | 9,120 | Accepted | Accepted | 9.09 | s = eval(input())
print((s[:3])) | print((input()[:3])) | 2 | 1 | 25 | 18 | s = eval(input())
print((s[:3]))
| print((input()[:3]))
| false | 50 | [
"-s = eval(input())",
"-print((s[:3]))",
"+print((input()[:3]))"
] | false | 0.045082 | 0.040672 | 1.10844 | [
"s272718476",
"s571009182"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.