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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u254871849 | p03001 | python | s899776528 | s823915605 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | # 2019-11-14 17:27:23(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
... | import sys
w, h, x, y = map(int, sys.stdin.readline().split())
def main():
s = w * h / 2
f = (x == w / 2 and y == h / 2) & 1
return s, f
if __name__ == '__main__':
ans = main()
print(*ans, sep=' ')
| 27 | 12 | 672 | 231 | # 2019-11-14 17:27:23(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import ... | import sys
w, h, x, y = map(int, sys.stdin.readline().split())
def main():
s = w * h / 2
f = (x == w / 2 and y == h / 2) & 1
return s, f
if __name__ == "__main__":
ans = main()
print(*ans, sep=" ")
| false | 55.555556 | [
"-# 2019-11-14 17:27:23(JST)",
"-# import collections",
"-# import math",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-# import itertools",
"-# from functools import reduce",
"-# import operator as op",
"-# fro... | false | 0.049851 | 0.04998 | 0.997415 | [
"s899776528",
"s823915605"
] |
u043048943 | p02579 | python | s645016611 | s925837519 | 1,948 | 1,361 | 233,008 | 266,408 | Accepted | Accepted | 30.13 | def main():
from sys import setrecursionlimit, stdin, stderr
from os import environ
from collections import defaultdict, deque, Counter
from math import ceil, floor
from itertools import accumulate, combinations, combinations_with_replacement
setrecursionlimit(10**6)
dbg = (lambda *so... | def main():
from sys import setrecursionlimit, stdin, stderr
from os import environ
from collections import defaultdict, deque, Counter
from math import ceil, floor
from itertools import accumulate, combinations, combinations_with_replacement
setrecursionlimit(10**6)
dbg = (lambda *so... | 65 | 67 | 1,763 | 1,819 | def main():
from sys import setrecursionlimit, stdin, stderr
from os import environ
from collections import defaultdict, deque, Counter
from math import ceil, floor
from itertools import accumulate, combinations, combinations_with_replacement
setrecursionlimit(10**6)
dbg = (
(
... | def main():
from sys import setrecursionlimit, stdin, stderr
from os import environ
from collections import defaultdict, deque, Counter
from math import ceil, floor
from itertools import accumulate, combinations, combinations_with_replacement
setrecursionlimit(10**6)
dbg = (
(
... | false | 2.985075 | [
"- targets = deque([(Ch, Cw, 0)])",
"+ targets = deque([(Ch, Cw, 0)])",
"+ if y == Dh and x == Dw:",
"+ break"
] | false | 0.045325 | 0.045514 | 0.995852 | [
"s645016611",
"s925837519"
] |
u054514819 | p03221 | python | s175265727 | s374493469 | 688 | 318 | 38,212 | 91,408 | Accepted | Accepted | 53.78 | N, M = list(map(int, input().split()))
from bisect import bisect_right
dic = [[] for i in range(N)]
shi = {}
for i in range(M):
p, y = list(map(int, input().split()))
dic[p-1].append(y)
shi[i] = (p, y)
for i in range(N):
dic[i].sort()
for j in range(M):
p, y = shi[j]
print(('{:... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N, M = mapint()
lis = [[] for _ in range(N)]
plis = []
for _ in range(M):
p, y = mapint()
lis[p-1].append(y)
plis.append((p, y))
for i in range(N):
... | 17 | 21 | 357 | 466 | N, M = list(map(int, input().split()))
from bisect import bisect_right
dic = [[] for i in range(N)]
shi = {}
for i in range(M):
p, y = list(map(int, input().split()))
dic[p - 1].append(y)
shi[i] = (p, y)
for i in range(N):
dic[i].sort()
for j in range(M):
p, y = shi[j]
print(("{:06}{:06}".forma... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N, M = mapint()
lis = [[] for _ in range(N)]
plis = []
for _ in range(M):
p, y = mapint()
lis[p - 1].append(y)
plis.append((p, y))
for i in range(N):
... | false | 19.047619 | [
"-N, M = list(map(int, input().split()))",
"-from bisect import bisect_right",
"+import sys",
"-dic = [[] for i in range(N)]",
"-shi = {}",
"-for i in range(M):",
"- p, y = list(map(int, input().split()))",
"- dic[p - 1].append(y)",
"- shi[i] = (p, y)",
"+",
"+def input():",
"+ ret... | false | 0.047024 | 0.046693 | 1.007081 | [
"s175265727",
"s374493469"
] |
u416011173 | p02600 | python | s876786173 | s249289170 | 32 | 28 | 9,120 | 9,160 | Accepted | Accepted | 12.5 | # -*- coding: utf-8 -*-
# 標準入力を取得
X = int(eval(input()))
# 求解処理
ans = int()
if X <= 599:
ans = 8
elif X <= 799:
ans = 7
elif X <= 999:
ans = 6
elif X <= 1199:
ans = 5
elif X <= 1399:
ans = 4
elif X <= 1599:
ans = 3
elif X <= 1799:
ans = 2
elif X <= 1999:
ans = 1
... | # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
X = int(eval(input()))
return X
def main(X: int) -> None:
"""
メイン処理.
Args:\n
X (int): 最高レーティング(400 <= X <= 1999)
"""
# 求解処理
ans = 10 - (X ... | 25 | 32 | 332 | 446 | # -*- coding: utf-8 -*-
# 標準入力を取得
X = int(eval(input()))
# 求解処理
ans = int()
if X <= 599:
ans = 8
elif X <= 799:
ans = 7
elif X <= 999:
ans = 6
elif X <= 1199:
ans = 5
elif X <= 1399:
ans = 4
elif X <= 1599:
ans = 3
elif X <= 1799:
ans = 2
elif X <= 1999:
ans = 1
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
X = int(eval(input()))
return X
def main(X: int) -> None:
"""
メイン処理.
Args:\n
X (int): 最高レーティング(400 <= X <= 1999)
"""
# 求解処理
ans = 10 - (X // 200)
# 結果出力
p... | false | 21.875 | [
"-# 標準入力を取得",
"-X = int(eval(input()))",
"-# 求解処理",
"-ans = int()",
"-if X <= 599:",
"- ans = 8",
"-elif X <= 799:",
"- ans = 7",
"-elif X <= 999:",
"- ans = 6",
"-elif X <= 1199:",
"- ans = 5",
"-elif X <= 1399:",
"- ans = 4",
"-elif X <= 1599:",
"- ans = 3",
"-eli... | false | 0.136563 | 0.007389 | 18.481852 | [
"s876786173",
"s249289170"
] |
u179169725 | p03283 | python | s831862724 | s577827943 | 1,458 | 1,255 | 48,984 | 48,896 | Accepted | Accepted | 13.92 | # https://atcoder.jp/contests/abc106/tasks/abc106_d
# どうやったら高速に区間[p,q]に完全に入っている区間の数を取得できるか?
# p,qを二次元座標として捉えると電車1本の線は二次元平面上の1点として表せる
# このときp,qの区間に完全に入っている電車の本数というのは、x軸、y軸の両方において[p,q]となる四角形内にある電車の本数
# queryに高速に答えるために二次元累積和を構築する
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, re... | # https://atcoder.jp/contests/abc106/tasks/abc106_d
# どうやったら高速に区間[p,q]に完全に入っている区間の数を取得できるか?
# p,qを二次元座標として捉えると電車1本の線は二次元平面上の1点として表せる
# このときp,qの区間に完全に入っている電車の本数というのは、x軸、y軸の両方において[p,q]となる四角形内にある電車の本数
# queryに高速に答えるために二次元累積和を構築する
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, re... | 42 | 49 | 1,019 | 1,165 | # https://atcoder.jp/contests/abc106/tasks/abc106_d
# どうやったら高速に区間[p,q]に完全に入っている区間の数を取得できるか?
# p,qを二次元座標として捉えると電車1本の線は二次元平面上の1点として表せる
# このときp,qの区間に完全に入っている電車の本数というのは、x軸、y軸の両方において[p,q]となる四角形内にある電車の本数
# queryに高速に答えるために二次元累積和を構築する
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().spli... | # https://atcoder.jp/contests/abc106/tasks/abc106_d
# どうやったら高速に区間[p,q]に完全に入っている区間の数を取得できるか?
# p,qを二次元座標として捉えると電車1本の線は二次元平面上の1点として表せる
# このときp,qの区間に完全に入っている電車の本数というのは、x軸、y軸の両方において[p,q]となる四角形内にある電車の本数
# queryに高速に答えるために二次元累積和を構築する
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().spli... | false | 14.285714 | [
"-# 二次元座標上へのプロット",
"-LR2d = np.zeros((N + 1, N + 1), np.int64)",
"+# # 二次元座標上へのプロット",
"+# LR2d = np.zeros((N + 1, N + 1), np.int64)",
"+# for L, R in LR:",
"+# LR2d[L, R] += 1 #ここがボトルネック",
"+# numpy使わずに再実装",
"+LR2d = [[0] * (N + 1) for _ in range(N + 1)]",
"- LR2d[L, R] += 1",
"+ LR2d[L]... | false | 0.252866 | 0.224501 | 1.126347 | [
"s831862724",
"s577827943"
] |
u648212584 | p03634 | python | s934491272 | s591764657 | 758 | 603 | 87,516 | 75,952 | Accepted | Accepted | 20.45 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N-1)]
Q,K = list(map(int,input().split()))
Y = [list(map(int,input().split())) for _ in range(Q)]
tree = [[] for _ in range(N)]
dif = [10**15 for _ in range(N)]... | import sys
input = sys.stdin.buffer.readline
import heapq
def main():
N = int(eval(input()))
edge = [[] for _ in range(N)]
for _ in range(N-1):
a,b,d = list(map(int,input().split()))
edge[a-1].append((b-1,d))
edge[b-1].append((a-1,d))
Q,K = list(map(int,input().split()))
dist = [-1]*N
dist[... | 30 | 30 | 794 | 634 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = list(map(int, input().split()))
Y = [list(map(int, input().split())) for _ in range(Q)]
tree = [[] for _ in range(N)]
dif = [10**15 for _ in range(N)]
... | import sys
input = sys.stdin.buffer.readline
import heapq
def main():
N = int(eval(input()))
edge = [[] for _ in range(N)]
for _ in range(N - 1):
a, b, d = list(map(int, input().split()))
edge[a - 1].append((b - 1, d))
edge[b - 1].append((a - 1, d))
Q, K = list(map(int, input(... | false | 0 | [
"-input = sys.stdin.readline",
"+input = sys.stdin.buffer.readline",
"+import heapq",
"- X = [list(map(int, input().split())) for _ in range(N - 1)]",
"+ edge = [[] for _ in range(N)]",
"+ for _ in range(N - 1):",
"+ a, b, d = list(map(int, input().split()))",
"+ edge[a - 1].app... | false | 0.042888 | 0.037564 | 1.14174 | [
"s934491272",
"s591764657"
] |
u753803401 | p02845 | python | s456783160 | s932554749 | 245 | 226 | 55,524 | 61,548 | Accepted | Accepted | 7.76 | import sys
import collections
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = list(map(int, readline().split()))
d = collections.defaultdict(int)
t = 1
for i in range(n):
if a[i] == 0:
t *= 3 - d[0]
d... | import sys
import collections
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n = int(input().rstrip('\n'))
a = list(map(int, input().rstrip('\n').split()))
d = collections.defaultdict(int)
d[-1] = 3
cnt = 1
for v in a:
cnt *= d[v-1]
d[v] += 1
... | 24 | 22 | 488 | 420 | import sys
import collections
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n = int(readline())
a = list(map(int, readline().split()))
d = collections.defaultdict(int)
t = 1
for i in range(n):
if a[i] == 0:
t *= 3 - d[0]
d[a[i]] += 1
... | import sys
import collections
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n = int(input().rstrip("\n"))
a = list(map(int, input().rstrip("\n").split()))
d = collections.defaultdict(int)
d[-1] = 3
cnt = 1
for v in a:
cnt *= d[v - 1]
d[v] += 1
d[v - 1]... | false | 8.333333 | [
"- readline = sys.stdin.buffer.readline",
"+ input = sys.stdin.readline",
"- n = int(readline())",
"- a = list(map(int, readline().split()))",
"+ n = int(input().rstrip(\"\\n\"))",
"+ a = list(map(int, input().rstrip(\"\\n\").split()))",
"- t = 1",
"- for i in range(n):",
"- ... | false | 0.050397 | 0.035219 | 1.43097 | [
"s456783160",
"s932554749"
] |
u543954314 | p02641 | python | s316240249 | s395410616 | 25 | 22 | 9,168 | 9,132 | Accepted | Accepted | 12 | x, n = list(map(int, input().split()))
a = set(map(int, input().split()))
print((min([i for i in range(102) if i not in a], key=lambda y:abs(x-y))))
| x, n = list(map(int, input().split()))
a = set(map(int, input().split()))
print((min((i for i in range(102) if i not in a), key=lambda y:abs(x-y))))
| 3 | 3 | 143 | 143 | x, n = list(map(int, input().split()))
a = set(map(int, input().split()))
print((min([i for i in range(102) if i not in a], key=lambda y: abs(x - y))))
| x, n = list(map(int, input().split()))
a = set(map(int, input().split()))
print((min((i for i in range(102) if i not in a), key=lambda y: abs(x - y))))
| false | 0 | [
"-print((min([i for i in range(102) if i not in a], key=lambda y: abs(x - y))))",
"+print((min((i for i in range(102) if i not in a), key=lambda y: abs(x - y))))"
] | false | 0.036718 | 0.069179 | 0.530766 | [
"s316240249",
"s395410616"
] |
u761320129 | p03633 | python | s808084111 | s747136160 | 42 | 35 | 5,432 | 5,048 | Accepted | Accepted | 16.67 | import fractions
N = int(eval(input()))
lcm = 1
for i in range(N):
t = int(eval(input()))
lcm = lcm * t // fractions.gcd(lcm,t)
print(lcm)
| from fractions import gcd
N = int(eval(input()))
ts = [int(eval(input())) for i in range(N)]
lcm = 1
for t in ts:
lcm = lcm * t // gcd(lcm,t)
print(lcm) | 7 | 8 | 141 | 152 | import fractions
N = int(eval(input()))
lcm = 1
for i in range(N):
t = int(eval(input()))
lcm = lcm * t // fractions.gcd(lcm, t)
print(lcm)
| from fractions import gcd
N = int(eval(input()))
ts = [int(eval(input())) for i in range(N)]
lcm = 1
for t in ts:
lcm = lcm * t // gcd(lcm, t)
print(lcm)
| false | 12.5 | [
"-import fractions",
"+from fractions import gcd",
"+ts = [int(eval(input())) for i in range(N)]",
"-for i in range(N):",
"- t = int(eval(input()))",
"- lcm = lcm * t // fractions.gcd(lcm, t)",
"+for t in ts:",
"+ lcm = lcm * t // gcd(lcm, t)"
] | false | 0.059521 | 0.060481 | 0.984124 | [
"s808084111",
"s747136160"
] |
u767797498 | p02597 | python | s862637636 | s462383698 | 65 | 29 | 9,316 | 9,384 | Accepted | Accepted | 55.38 | n=int(eval(input()))
s=eval(input())
cnt=0
ri=len(s)-1
for li,ss in enumerate(s):
if ss=="W":
while ri>li and s[ri]=="W":
ri-=1
if ri<=li:
break
ri-=1
cnt+=1
print(cnt)
| n=int(eval(input()))
s=eval(input())
rcnt=s.count("R")
wcnt=s[:rcnt].count("W")
print(wcnt) | 14 | 6 | 202 | 85 | n = int(eval(input()))
s = eval(input())
cnt = 0
ri = len(s) - 1
for li, ss in enumerate(s):
if ss == "W":
while ri > li and s[ri] == "W":
ri -= 1
if ri <= li:
break
ri -= 1
cnt += 1
print(cnt)
| n = int(eval(input()))
s = eval(input())
rcnt = s.count("R")
wcnt = s[:rcnt].count("W")
print(wcnt)
| false | 57.142857 | [
"-cnt = 0",
"-ri = len(s) - 1",
"-for li, ss in enumerate(s):",
"- if ss == \"W\":",
"- while ri > li and s[ri] == \"W\":",
"- ri -= 1",
"- if ri <= li:",
"- break",
"- ri -= 1",
"- cnt += 1",
"-print(cnt)",
"+rcnt = s.count(\"R\")",
"+wcn... | false | 0.034872 | 0.042679 | 0.817071 | [
"s862637636",
"s462383698"
] |
u367701763 | p02862 | python | s082305399 | s806283841 | 223 | 88 | 65,628 | 73,328 | Accepted | Accepted | 60.54 | # https://atcoder.jp/contests/abc145/tasks/abc145_d
X, Y = list(map(int, input().split()))
if (2*Y- X) % 3 or (2*X- Y) % 3:
print((0))
exit()
x = (2*Y - X) // 3
y = (2*X - Y) // 3
if x < 0 or y < 0:
print((0))
exit()
n = x + y
r = x
mod = 10**9 + 7
f = 1
for i in range(1, n... | from functools import reduce
def combination2(n, r, MOD=10**9+7):
if not 0 <= r <= n: return 0
r = min(r, n - r)
numerator = reduce(lambda x, y: x * y % MOD, list(range(n, n - r, -1)), 1)
denominator = reduce(lambda x, y: x * y % MOD, list(range(1, r + 1)), 1)
return numerator * pow(denomina... | 33 | 15 | 516 | 482 | # https://atcoder.jp/contests/abc145/tasks/abc145_d
X, Y = list(map(int, input().split()))
if (2 * Y - X) % 3 or (2 * X - Y) % 3:
print((0))
exit()
x = (2 * Y - X) // 3
y = (2 * X - Y) // 3
if x < 0 or y < 0:
print((0))
exit()
n = x + y
r = x
mod = 10**9 + 7
f = 1
for i in range(1, n + 1):
f = f * i... | from functools import reduce
def combination2(n, r, MOD=10**9 + 7):
if not 0 <= r <= n:
return 0
r = min(r, n - r)
numerator = reduce(lambda x, y: x * y % MOD, list(range(n, n - r, -1)), 1)
denominator = reduce(lambda x, y: x * y % MOD, list(range(1, r + 1)), 1)
return numerator * pow(deno... | false | 54.545455 | [
"-# https://atcoder.jp/contests/abc145/tasks/abc145_d",
"+from functools import reduce",
"+",
"+",
"+def combination2(n, r, MOD=10**9 + 7):",
"+ if not 0 <= r <= n:",
"+ return 0",
"+ r = min(r, n - r)",
"+ numerator = reduce(lambda x, y: x * y % MOD, list(range(n, n - r, -1)), 1)",
... | false | 0.174306 | 0.057421 | 3.035587 | [
"s082305399",
"s806283841"
] |
u414980766 | p02862 | python | s388338630 | s334541164 | 845 | 363 | 82,072 | 45,172 | Accepted | Accepted | 57.04 | x, y = list(map(int, input().split()))
if (x + y)%3 != 0:
print((0))
else:
k = (x + y)//3
if k <= x <= 2*k:
MOD = 10**9 + 7
fac = [0]*(k + 1)
finv = [0]*(k + 1)
inv = [0]*(k + 1)
fac[0] = 1; fac[1] = 1; finv[0] =1; finv[1] = 1; inv[1] = 1
for i in r... | # 拡張ユークリッド互除法を用いて逆元を求める
def modinv(a, m):
b = m; x0 = 1; x1 = 0
while b:
q = a//b
a, b = b, a%b
x0, x1 = x1, x0 - q*x1
return x0%m
x, y = list(map(int, input().split()))
if (x + y)%3 != 0:
print((0))
else:
k = (x + y)//3
if k <= x <= 2*k:
i = mi... | 20 | 33 | 597 | 836 | x, y = list(map(int, input().split()))
if (x + y) % 3 != 0:
print((0))
else:
k = (x + y) // 3
if k <= x <= 2 * k:
MOD = 10**9 + 7
fac = [0] * (k + 1)
finv = [0] * (k + 1)
inv = [0] * (k + 1)
fac[0] = 1
fac[1] = 1
finv[0] = 1
finv[1] = 1
... | # 拡張ユークリッド互除法を用いて逆元を求める
def modinv(a, m):
b = m
x0 = 1
x1 = 0
while b:
q = a // b
a, b = b, a % b
x0, x1 = x1, x0 - q * x1
return x0 % m
x, y = list(map(int, input().split()))
if (x + y) % 3 != 0:
print((0))
else:
k = (x + y) // 3
if k <= x <= 2 * k:
i =... | false | 39.393939 | [
"+# 拡張ユークリッド互除法を用いて逆元を求める",
"+def modinv(a, m):",
"+ b = m",
"+ x0 = 1",
"+ x1 = 0",
"+ while b:",
"+ q = a // b",
"+ a, b = b, a % b",
"+ x0, x1 = x1, x0 - q * x1",
"+ return x0 % m",
"+",
"+",
"+ i = min(x - k, 2 * k - x)",
"+ # 結局 コンビネーシ... | false | 0.218159 | 0.111499 | 1.956599 | [
"s388338630",
"s334541164"
] |
u581022379 | p03273 | python | s275884078 | s190273986 | 29 | 24 | 9,156 | 9,148 | Accepted | Accepted | 17.24 | H, W = list(map(int, input().split()))
field = []
for _ in range(H):
tmp = eval(input())
if tmp.count('#') == 0:
continue
else:
field.append(tmp)
ans_field = ["."] * len(field)
for column in range(W):
del_flag = True
for row in range(len(field)):
if field[row][col... | H, W = list(map(int, input().split()))
field = []
for _ in range(H):
tmp = eval(input())
if tmp.count('#') == 0:
continue
else:
field.append(tmp)
ans_field = [""] * len(field)
for column in range(W):
del_flag = True
for row in range(len(field)):
if field[row][colu... | 20 | 20 | 524 | 519 | H, W = list(map(int, input().split()))
field = []
for _ in range(H):
tmp = eval(input())
if tmp.count("#") == 0:
continue
else:
field.append(tmp)
ans_field = ["."] * len(field)
for column in range(W):
del_flag = True
for row in range(len(field)):
if field[row][column] == "#":... | H, W = list(map(int, input().split()))
field = []
for _ in range(H):
tmp = eval(input())
if tmp.count("#") == 0:
continue
else:
field.append(tmp)
ans_field = [""] * len(field)
for column in range(W):
del_flag = True
for row in range(len(field)):
if field[row][column] == "#":
... | false | 0 | [
"-ans_field = [\".\"] * len(field)",
"+ans_field = [\"\"] * len(field)",
"- print((val[1:]))",
"+ print(val)"
] | false | 0.036018 | 0.036952 | 0.974711 | [
"s275884078",
"s190273986"
] |
u072717685 | p02624 | python | s438722272 | s370921365 | 1,221 | 582 | 9,172 | 339,812 | Accepted | Accepted | 52.33 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
#import numpy as np
def main():
n = int(eval(input()))
if n == 1:
print((1))
sys.exit()
r = 0
for i1 in range(1, n + 1):
num_of_div = n // i1
r += num_of_div * (num... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
import numpy as np
def main():
n = int(eval(input()))
if n == 1:
print((1))
sys.exit()
divs = np.arange(1, n + 1)
divs2 = n // divs
divs3 = divs2 * (divs2 + 1) // 2
divs3 =... | 18 | 19 | 391 | 403 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
# import numpy as np
def main():
n = int(eval(input()))
if n == 1:
print((1))
sys.exit()
r = 0
for i1 in range(1, n + 1):
num_of_div = n // i1
r += num_of_div * (num_of_div + 1... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
import numpy as np
def main():
n = int(eval(input()))
if n == 1:
print((1))
sys.exit()
divs = np.arange(1, n + 1)
divs2 = n // divs
divs3 = divs2 * (divs2 + 1) // 2
divs3 = divs3 * d... | false | 5.263158 | [
"-# import numpy as np",
"+import numpy as np",
"+",
"+",
"- r = 0",
"- for i1 in range(1, n + 1):",
"- num_of_div = n // i1",
"- r += num_of_div * (num_of_div + 1) // 2 * i1",
"+ divs = np.arange(1, n + 1)",
"+ divs2 = n // divs",
"+ divs3 = divs2 * (divs2 + 1) // 2... | false | 0.551713 | 0.309924 | 1.780155 | [
"s438722272",
"s370921365"
] |
u197300260 | p03308 | python | s675048032 | s061547709 | 19 | 17 | 3,188 | 2,940 | Accepted | Accepted | 10.53 | # Problem https://atcoder.jp/contests/abc102/tasks/abc102_b
# Python 2nd Try
import sys
def solver(allN, numberList):
answer = 0
for j in range(0, allN):
for k in range(0, allN):
nowAbs = (numberList[j] - numberList[k]).__abs__()
if answer < nowAbs:
a... | # Problem https://atcoder.jp/contests/abc102/tasks/abc102_b
# Python 3rd Try
import sys
def solve(cells):
answer = 0
cells.sort(reverse=True)
answer = cells[0] - cells[-1]
return answer
if __name__ == "__main__":
X = list(map(int, sys.stdin.readline().split()))
AI = list(map(in... | 20 | 16 | 535 | 376 | # Problem https://atcoder.jp/contests/abc102/tasks/abc102_b
# Python 2nd Try
import sys
def solver(allN, numberList):
answer = 0
for j in range(0, allN):
for k in range(0, allN):
nowAbs = (numberList[j] - numberList[k]).__abs__()
if answer < nowAbs:
answer = now... | # Problem https://atcoder.jp/contests/abc102/tasks/abc102_b
# Python 3rd Try
import sys
def solve(cells):
answer = 0
cells.sort(reverse=True)
answer = cells[0] - cells[-1]
return answer
if __name__ == "__main__":
X = list(map(int, sys.stdin.readline().split()))
AI = list(map(int, sys.stdin.r... | false | 20 | [
"-# Python 2nd Try",
"+# Python 3rd Try",
"-def solver(allN, numberList):",
"+def solve(cells):",
"- for j in range(0, allN):",
"- for k in range(0, allN):",
"- nowAbs = (numberList[j] - numberList[k]).__abs__()",
"- if answer < nowAbs:",
"- answer = no... | false | 0.047172 | 0.045369 | 1.039724 | [
"s675048032",
"s061547709"
] |
u594859393 | p03354 | python | s386170595 | s895736087 | 816 | 747 | 61,488 | 61,360 | Accepted | Accepted | 8.46 | n, m = list(map(int, input().split()))
ps = [int(p)-1 for p in input().split()]
xys = [tuple(int(x)-1 for x in input().split()) for _ in range(m)]
nodes = list(range(n))
union = {node:node for node in nodes}
def root(node, previouss=None):
if not previouss:
previouss = []
if union[node] ==... | n, m = list(map(int, input().split()))
ps = [int(p)-1 for p in input().split()]
xys = [tuple(int(x)-1 for x in input().split()) for _ in range(m)]
nodes = list(range(n))
union = {node:node for node in nodes}
def root(node):
if union[node] == node:
return node
union[node] = root(union[node])
... | 33 | 27 | 843 | 679 | n, m = list(map(int, input().split()))
ps = [int(p) - 1 for p in input().split()]
xys = [tuple(int(x) - 1 for x in input().split()) for _ in range(m)]
nodes = list(range(n))
union = {node: node for node in nodes}
def root(node, previouss=None):
if not previouss:
previouss = []
if union[node] == node:
... | n, m = list(map(int, input().split()))
ps = [int(p) - 1 for p in input().split()]
xys = [tuple(int(x) - 1 for x in input().split()) for _ in range(m)]
nodes = list(range(n))
union = {node: node for node in nodes}
def root(node):
if union[node] == node:
return node
union[node] = root(union[node])
r... | false | 18.181818 | [
"-def root(node, previouss=None):",
"- if not previouss:",
"- previouss = []",
"+def root(node):",
"- for previous in previouss:",
"- union[previous] = node",
"- else:",
"- previouss.append(node)",
"- return root(union[node], previouss)",
"+ union[no... | false | 0.035851 | 0.036353 | 0.986195 | [
"s386170595",
"s895736087"
] |
u182765930 | p03814 | python | s478923800 | s788868686 | 19 | 17 | 3,516 | 3,500 | Accepted | Accepted | 10.53 | s=eval(input())
st=s.index('A')
end=s.rfind('Z')
print((end-st+1)) | s=eval(input())
print((s.rfind('Z')-s.find('A')+1)) | 4 | 2 | 61 | 44 | s = eval(input())
st = s.index("A")
end = s.rfind("Z")
print((end - st + 1))
| s = eval(input())
print((s.rfind("Z") - s.find("A") + 1))
| false | 50 | [
"-st = s.index(\"A\")",
"-end = s.rfind(\"Z\")",
"-print((end - st + 1))",
"+print((s.rfind(\"Z\") - s.find(\"A\") + 1))"
] | false | 0.067872 | 0.074069 | 0.916332 | [
"s478923800",
"s788868686"
] |
u347640436 | p02829 | python | s996896659 | s962423839 | 22 | 17 | 3,316 | 2,940 | Accepted | Accepted | 22.73 | A = int(eval(input()))
B = int(eval(input()))
print((*(set([1, 2, 3]) -set([A, B]))))
| A = int(eval(input()))
B = int(eval(input()))
print((6 - A - B))
| 4 | 4 | 77 | 55 | A = int(eval(input()))
B = int(eval(input()))
print((*(set([1, 2, 3]) - set([A, B]))))
| A = int(eval(input()))
B = int(eval(input()))
print((6 - A - B))
| false | 0 | [
"-print((*(set([1, 2, 3]) - set([A, B]))))",
"+print((6 - A - B))"
] | false | 0.037504 | 0.041352 | 0.906948 | [
"s996896659",
"s962423839"
] |
u285022453 | p02936 | python | s994989426 | s618046000 | 1,629 | 772 | 232,340 | 71,240 | Accepted | Accepted | 52.61 | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
n, q = list(map(int, input().split()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
frm, to = list(map(int, input().split()))
# 0-index
edges[frm - 1].append(to - 1)
edges[to - 1].append(frm - 1)
scores = [0] *... | import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
frm, to = list(map(int, input().split()))
# 0-index
edges[frm - 1].append(to - 1)
edges[to - 1].append(frm - 1)
scores = [0] * n
for _ in range(q):
v,... | 29 | 32 | 604 | 667 | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
n, q = list(map(int, input().split()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
frm, to = list(map(int, input().split()))
# 0-index
edges[frm - 1].append(to - 1)
edges[to - 1].append(frm - 1)
scores = [0] * n
for _ in range... | import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
frm, to = list(map(int, input().split()))
# 0-index
edges[frm - 1].append(to - 1)
edges[to - 1].append(frm - 1)
scores = [0] * n
for _ in range(q):
v, s = list(map(int,... | false | 9.375 | [
"-sys.setrecursionlimit(10**8)",
"-",
"-",
"-def dfs(frm, cur):",
"- if cur > 0:",
"- scores[cur] += scores[frm]",
"- for to in edges[cur]:",
"- if frm != to:",
"- dfs(cur, to)",
"-",
"-",
"-dfs(-1, 0)",
"+stack = [0]",
"+visited = [False] * n",
"+visited[0... | false | 0.059488 | 0.052196 | 1.139694 | [
"s994989426",
"s618046000"
] |
u235376569 | p02887 | python | s841815984 | s791420251 | 53 | 44 | 3,316 | 3,316 | Accepted | Accepted | 16.98 | N=int(eval(input()))
S=eval(input())
mae=S[0]
now=""
ans=S[0]
for i in range(N):
now=S[i]
if now==mae:
continue
else:
ans+=now
mae=now
print((len(ans))) | N=int(eval(input()))
S=eval(input())
mae=S[0]
now=""
ans=0
for i in range(N-1):
if S[i]!=S[i+1]:
ans+=1
print((ans+1))
| 14 | 9 | 170 | 119 | N = int(eval(input()))
S = eval(input())
mae = S[0]
now = ""
ans = S[0]
for i in range(N):
now = S[i]
if now == mae:
continue
else:
ans += now
mae = now
print((len(ans)))
| N = int(eval(input()))
S = eval(input())
mae = S[0]
now = ""
ans = 0
for i in range(N - 1):
if S[i] != S[i + 1]:
ans += 1
print((ans + 1))
| false | 35.714286 | [
"-ans = S[0]",
"-for i in range(N):",
"- now = S[i]",
"- if now == mae:",
"- continue",
"- else:",
"- ans += now",
"- mae = now",
"-print((len(ans)))",
"+ans = 0",
"+for i in range(N - 1):",
"+ if S[i] != S[i + 1]:",
"+ ans += 1",
"+print((ans + 1))"... | false | 0.096744 | 0.037627 | 2.571128 | [
"s841815984",
"s791420251"
] |
u098012509 | p02735 | python | s335946622 | s816839006 | 424 | 33 | 3,528 | 3,444 | Accepted | Accepted | 92.22 | import sys
import collections
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
H, W = [int(x) for x in input().split()]
S = [list(input().strip()) for _ in range(H)]
ans = 0
f = False
if S[0][0] == '#':
ans += 1
f = True
q = collection... | import sys
import collections
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
H, W = [int(x) for x in input().split()]
S = [list(input().strip()) for _ in range(H)]
dp = [[10 ** 9] * W for j in range(H)]
if S[0][0] == '#':
dp[0][0] = 1
else:
... | 60 | 33 | 1,310 | 785 | import sys
import collections
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
H, W = [int(x) for x in input().split()]
S = [list(input().strip()) for _ in range(H)]
ans = 0
f = False
if S[0][0] == "#":
ans += 1
f = True
q = collections.deque()
q.append(... | import sys
import collections
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
H, W = [int(x) for x in input().split()]
S = [list(input().strip()) for _ in range(H)]
dp = [[10**9] * W for j in range(H)]
if S[0][0] == "#":
dp[0][0] = 1
else:
dp[0][0] = 0
for ... | false | 45 | [
"- ans = 0",
"- f = False",
"+ dp = [[10**9] * W for j in range(H)]",
"- ans += 1",
"- f = True",
"- q = collections.deque()",
"- q.append([[0, 0], 0, f])",
"- d = [[10**9] * W for j in range(H)]",
"- while q:",
"- c = q.pop()",
"- dist = c[1]",
... | false | 0.054457 | 0.034349 | 1.585385 | [
"s335946622",
"s816839006"
] |
u361381049 | p02793 | python | s213426047 | s057701852 | 182 | 163 | 83,860 | 83,148 | Accepted | Accepted | 10.44 | from collections import Counter
MOD = 10**9+7
N = int(eval(input()))
A = list(map(int,input().split()))
def prime_factorize(n):
N = n
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= N:
if n % f == 0:
a.append(f)
n //= f
... | from collections import Counter
MOD = 10**9+7
N = int(eval(input()))
A = list(map(int,input().split()))
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
el... | 36 | 35 | 761 | 750 | from collections import Counter
MOD = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
def prime_factorize(n):
N = n
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= N:
if n % f == 0:
a.append(f)
n //= f
... | from collections import Counter
MOD = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
... | false | 2.777778 | [
"- N = n",
"- while f * f <= N:",
"+ while f * f <= n:"
] | false | 0.00887 | 0.252078 | 0.035188 | [
"s213426047",
"s057701852"
] |
u416011173 | p02640 | python | s543255409 | s667222259 | 24 | 22 | 9,172 | 9,204 | Accepted | Accepted | 8.33 | # -*- coding: utf-8 -*-
# モジュールのインポート
import math
# 標準入力の取得
X, Y = list(map(int, input().split()))
# 求解処理
result = False
for crane in range(X+1):
turtle = X - crane
if math.isclose(2*crane + 4*turtle, Y):
result = True
break
# 結果出力
if result:
print("Yes")
else:
prin... | # -*- coding: utf-8 -*-
# モジュールのインポート
import math
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
X, Y = list(map(int, input().split()))
return X, Y
def main(X: int, Y: int) -> None:
"""
求解処理を行う.
Args:
X (int): 庭の動物の総数
... | 20 | 39 | 328 | 642 | # -*- coding: utf-8 -*-
# モジュールのインポート
import math
# 標準入力の取得
X, Y = list(map(int, input().split()))
# 求解処理
result = False
for crane in range(X + 1):
turtle = X - crane
if math.isclose(2 * crane + 4 * turtle, Y):
result = True
break
# 結果出力
if result:
print("Yes")
else:
print("No")
| # -*- coding: utf-8 -*-
# モジュールのインポート
import math
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
X, Y = list(map(int, input().split()))
return X, Y
def main(X: int, Y: int) -> None:
"""
求解処理を行う.
Args:
X (int): 庭の動物の総数
Y (int): 庭の動物の足の総... | false | 48.717949 | [
"-# 標準入力の取得",
"-X, Y = list(map(int, input().split()))",
"-# 求解処理",
"-result = False",
"-for crane in range(X + 1):",
"- turtle = X - crane",
"- if math.isclose(2 * crane + 4 * turtle, Y):",
"- result = True",
"- break",
"-# 結果出力",
"-if result:",
"- print(\"Yes\")",
"-... | false | 0.069451 | 0.069983 | 0.992405 | [
"s543255409",
"s667222259"
] |
u537976628 | p03624 | python | s419556974 | s260290267 | 31 | 28 | 9,144 | 9,072 | Accepted | Accepted | 9.68 | s = eval(input())
alp = set("abcdefghijklmnopqrstuvwxyz")
print((sorted(list(alp - set(s)))[0] if len(alp - set(s)) != 0 else 'None')) | S = set(eval(input()))
s = list('abcdefghijklmnopqrstuvwxyz')
for i in s:
if i not in S:
print(i)
exit()
print('None') | 3 | 7 | 128 | 138 | s = eval(input())
alp = set("abcdefghijklmnopqrstuvwxyz")
print((sorted(list(alp - set(s)))[0] if len(alp - set(s)) != 0 else "None"))
| S = set(eval(input()))
s = list("abcdefghijklmnopqrstuvwxyz")
for i in s:
if i not in S:
print(i)
exit()
print("None")
| false | 57.142857 | [
"-s = eval(input())",
"-alp = set(\"abcdefghijklmnopqrstuvwxyz\")",
"-print((sorted(list(alp - set(s)))[0] if len(alp - set(s)) != 0 else \"None\"))",
"+S = set(eval(input()))",
"+s = list(\"abcdefghijklmnopqrstuvwxyz\")",
"+for i in s:",
"+ if i not in S:",
"+ print(i)",
"+ exit()"... | false | 0.034094 | 0.037641 | 0.905774 | [
"s419556974",
"s260290267"
] |
u423966555 | p02555 | python | s269289091 | s169754757 | 323 | 28 | 9,208 | 9,188 | Accepted | Accepted | 91.33 | def main():
s = int(eval(input()))
mod = 10**9+7
dp = [0] * (s+1)
dp[0] = 1
for i in range(1, s+1):
for j in range(0, (i-3)+1):
dp[i] += dp[j]
dp[i] %= mod
print((dp[s]))
if __name__ == "__main__":
main()
| def main():
s = int(eval(input()))
mod = 10**9+7
dp = [0] * (s+1)
dp[0] = 1
x = 0
for i in range(1, s+1):
if i-3 >= 0:
x += dp[i-3]
x %= mod
dp[i] = x
print((dp[s]))
if __name__ == "__main__":
main()
| 13 | 15 | 270 | 279 | def main():
s = int(eval(input()))
mod = 10**9 + 7
dp = [0] * (s + 1)
dp[0] = 1
for i in range(1, s + 1):
for j in range(0, (i - 3) + 1):
dp[i] += dp[j]
dp[i] %= mod
print((dp[s]))
if __name__ == "__main__":
main()
| def main():
s = int(eval(input()))
mod = 10**9 + 7
dp = [0] * (s + 1)
dp[0] = 1
x = 0
for i in range(1, s + 1):
if i - 3 >= 0:
x += dp[i - 3]
x %= mod
dp[i] = x
print((dp[s]))
if __name__ == "__main__":
main()
| false | 13.333333 | [
"+ x = 0",
"- for j in range(0, (i - 3) + 1):",
"- dp[i] += dp[j]",
"- dp[i] %= mod",
"+ if i - 3 >= 0:",
"+ x += dp[i - 3]",
"+ x %= mod",
"+ dp[i] = x"
] | false | 0.123141 | 0.037633 | 3.272186 | [
"s269289091",
"s169754757"
] |
u102461423 | p02604 | python | s496211773 | s797913798 | 2,256 | 1,901 | 117,544 | 36,416 | Accepted | Accepted | 15.74 | import sys
import numpy as np
import numba
from numba import njit
i8 = numba.int64
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((i8[:], ), cache=True)
def main(XYP):
X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]
N = len(X)
dp_X = n... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(XYP):
X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]
N = len(X)
dp_X = np.empty((1 << N, N), np.int64) # 建設、人 -> Xコスト
dp_X[0] = np.abs(X) * P
for n... | 49 | 60 | 1,338 | 1,587 | import sys
import numpy as np
import numba
from numba import njit
i8 = numba.int64
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@njit((i8[:],), cache=True)
def main(XYP):
X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]
N = len(X)
dp_X = np.empty((1 << ... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(XYP):
X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]
N = len(X)
dp_X = np.empty((1 << N, N), np.int64) # 建設、人 -> Xコスト
dp_X[0] = np.abs(X) * P
for n in range(N... | false | 18.333333 | [
"-import numba",
"-from numba import njit",
"-i8 = numba.int64",
"-@njit((i8[:],), cache=True)",
"+if sys.argv[-1] == \"ONLINE_JUDGE\":",
"+ import numba",
"+ from numba.pycc import CC",
"+",
"+ i8 = numba.int64",
"+ cc = CC(\"my_module\")",
"+",
"+ def cc_export(f, signature):"... | false | 0.195718 | 0.498015 | 0.392996 | [
"s496211773",
"s797913798"
] |
u598229387 | p03645 | python | s956695674 | s418457684 | 807 | 484 | 58,972 | 58,920 | Accepted | Accepted | 40.02 | n,m=list(map(int,input().split()))
ab=[[int(i) for i in input().split()] for j in range(m)]
li=[[] for i in range(n+1)]
for a,b in ab:
li[a].append(b)
li2=[]
for i in li[1]:
li2.append(i)
ans=False
for i in li2:
if n in li[i]:
ans=True
print(('POSSIBLE' if ans else 'IMPOSSIBLE')) | import sys
input = sys.stdin.readline
n,m=list(map(int,input().split()))
ab=[[int(i) for i in input().split()] for j in range(m)]
li=[[] for i in range(n+1)]
for a,b in ab:
li[a].append(b)
li2=[]
for i in li[1]:
li2.append(i)
ans=False
for i in li2:
if n in li[i]:
ans=True
prin... | 17 | 19 | 312 | 352 | n, m = list(map(int, input().split()))
ab = [[int(i) for i in input().split()] for j in range(m)]
li = [[] for i in range(n + 1)]
for a, b in ab:
li[a].append(b)
li2 = []
for i in li[1]:
li2.append(i)
ans = False
for i in li2:
if n in li[i]:
ans = True
print(("POSSIBLE" if ans else "IMPOSSIBLE"))
| import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
ab = [[int(i) for i in input().split()] for j in range(m)]
li = [[] for i in range(n + 1)]
for a, b in ab:
li[a].append(b)
li2 = []
for i in li[1]:
li2.append(i)
ans = False
for i in li2:
if n in li[i]:
ans = True
print(("... | false | 10.526316 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.156791 | 0.082384 | 1.90318 | [
"s956695674",
"s418457684"
] |
u785989355 | p02956 | python | s528157435 | s195518641 | 1,682 | 1,322 | 103,336 | 97,316 | Accepted | Accepted | 21.4 |
import sys
input = sys.stdin.readline
class SegmentTree:
def __init__(self, L, op, default_val):
self.op = op
self.default_val = default_val
self.sz = len(L)
self.n = 1
self.s = 1
for i in range(1000):
self.n *= 2
self.s += 1
... |
import sys
input = sys.stdin.readline
class BIT:
def __init__(self, L):
self.N = len(L)
self.bit = [0]*self.N
for i,l in enumerate(L):
self.add(i,l)
def add(self, a, w):
x = a + 1
for i in range(1000):
self.bit[x-1... | 121 | 72 | 3,015 | 1,332 | import sys
input = sys.stdin.readline
class SegmentTree:
def __init__(self, L, op, default_val):
self.op = op
self.default_val = default_val
self.sz = len(L)
self.n = 1
self.s = 1
for i in range(1000):
self.n *= 2
self.s += 1
if ... | import sys
input = sys.stdin.readline
class BIT:
def __init__(self, L):
self.N = len(L)
self.bit = [0] * self.N
for i, l in enumerate(L):
self.add(i, l)
def add(self, a, w):
x = a + 1
for i in range(1000):
self.bit[x - 1] += w
x += ... | false | 40.495868 | [
"-class SegmentTree:",
"- def __init__(self, L, op, default_val):",
"- self.op = op",
"- self.default_val = default_val",
"- self.sz = len(L)",
"- self.n = 1",
"- self.s = 1",
"+class BIT:",
"+ def __init__(self, L):",
"+ self.N = len(L)",
"+ ... | false | 0.047149 | 0.056244 | 0.838294 | [
"s528157435",
"s195518641"
] |
u349449706 | p03231 | python | s207099747 | s150062496 | 309 | 65 | 80,172 | 62,936 | Accepted | Accepted | 78.96 | import math
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
g = math.gcd(N,M)
l = N*M//g
print((l if S[::l//M] == T[::l//N] else -1))
| import math
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
g = math.gcd(N,M)
l = N*M//g
print((l if S[::N//g] == T[::M//g] else -1))
| 7 | 7 | 147 | 147 | import math
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
g = math.gcd(N, M)
l = N * M // g
print((l if S[:: l // M] == T[:: l // N] else -1))
| import math
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
g = math.gcd(N, M)
l = N * M // g
print((l if S[:: N // g] == T[:: M // g] else -1))
| false | 0 | [
"-print((l if S[:: l // M] == T[:: l // N] else -1))",
"+print((l if S[:: N // g] == T[:: M // g] else -1))"
] | false | 0.115934 | 0.089812 | 1.29086 | [
"s207099747",
"s150062496"
] |
u816631826 | p03447 | python | s616033227 | s204913429 | 17 | 10 | 2,940 | 2,568 | Accepted | Accepted | 41.18 | x=int(eval(input()))
a=int(eval(input()))
b=int(eval(input()))
x=x-a
re=x % b
print(re)
| x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)
| 9 | 5 | 81 | 76 | x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
x = x - a
re = x % b
print(re)
| x = int(input())
a = int(input())
b = int(input())
print((x - a) % b)
| false | 44.444444 | [
"-x = int(eval(input()))",
"-a = int(eval(input()))",
"-b = int(eval(input()))",
"-x = x - a",
"-re = x % b",
"-print(re)",
"+x = int(input())",
"+a = int(input())",
"+b = int(input())",
"+print((x - a) % b)"
] | false | 0.037322 | 0.037118 | 1.005482 | [
"s616033227",
"s204913429"
] |
u808427016 | p03329 | python | s750656900 | s016138039 | 483 | 277 | 16,800 | 2,940 | Accepted | Accepted | 42.65 | from heapq import *
N = int(eval(input()))
result = 100000
ns = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049]
h = []
xs = {}
heappush(h, (0, 0))
while 1:
r, m = heappop(h)
if m == N:
result = r
break
for n in ns:
s = r + 1
x = m + n
... | N = int(eval(input()))
result = 100000000000
def calc(x, base):
r = 0
while x:
x, m = divmod(x, base)
r += m
return r
for i in range(N + 1):
result = min(result, calc(i, 6) + calc(N - i, 9))
print(result)
| 28 | 15 | 424 | 249 | from heapq import *
N = int(eval(input()))
result = 100000
ns = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049]
h = []
xs = {}
heappush(h, (0, 0))
while 1:
r, m = heappop(h)
if m == N:
result = r
break
for n in ns:
s = r + 1
x = m + n
if x <= N and not x ... | N = int(eval(input()))
result = 100000000000
def calc(x, base):
r = 0
while x:
x, m = divmod(x, base)
r += m
return r
for i in range(N + 1):
result = min(result, calc(i, 6) + calc(N - i, 9))
print(result)
| false | 46.428571 | [
"-from heapq import *",
"+N = int(eval(input()))",
"+result = 100000000000",
"-N = int(eval(input()))",
"-result = 100000",
"-ns = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049]",
"-h = []",
"-xs = {}",
"-heappush(h, (0, 0))",
"-while 1:",
"- r, m = heappop(h)",
"- if m == N... | false | 0.090398 | 0.059937 | 1.508232 | [
"s750656900",
"s016138039"
] |
u419686324 | p03107 | python | s790383287 | s926465604 | 43 | 25 | 3,956 | 3,444 | Accepted | Accepted | 41.86 | S = eval(input())
stack = []
for s in S:
if stack and stack[-1] != s:
stack.pop()
else:
stack.append(s)
print((len(S) - len(stack))) | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import Counter
S = eval(input())
c = Counter(S)
print((min(c.get('0', 0), c.get('1', 0)) * 2)) | 9 | 7 | 157 | 157 | S = eval(input())
stack = []
for s in S:
if stack and stack[-1] != s:
stack.pop()
else:
stack.append(s)
print((len(S) - len(stack)))
| #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import Counter
S = eval(input())
c = Counter(S)
print((min(c.get("0", 0), c.get("1", 0)) * 2))
| false | 22.222222 | [
"+#!/usr/bin/env python3",
"+# -*- coding: utf-8 -*-",
"+from collections import Counter",
"+",
"-stack = []",
"-for s in S:",
"- if stack and stack[-1] != s:",
"- stack.pop()",
"- else:",
"- stack.append(s)",
"-print((len(S) - len(stack)))",
"+c = Counter(S)",
"+print((m... | false | 0.046492 | 0.045464 | 1.022607 | [
"s790383287",
"s926465604"
] |
u620084012 | p03240 | python | s350468470 | s657984335 | 672 | 257 | 3,064 | 45,020 | Accepted | Accepted | 61.76 | N = int(eval(input()))
G = [list(map(int,input().split())) for k in range(N)]
if N == 1:
print((G[0][0],G[0][1],G[0][2]))
exit(0)
G = sorted(G, key=lambda x: -x[2])
for Cx in range(101):
for Cy in range(101):
f = 1
H = G[0][2] + abs(Cx-G[0][0]) + abs(Cy-G[0][1])
for k i... | N = int(eval(input()))
L = [list(map(int, input().split())) for k in range(N)]
m = 0
for l in L:
m = max(m,l[2])
for x in range(101):
for y in range(101):
for h in range(m,m+101):
f = 1
for l in L:
if l[2]!=max(h-abs(l[0]-x)-abs(l[1]-y),0):
... | 18 | 17 | 463 | 430 | N = int(eval(input()))
G = [list(map(int, input().split())) for k in range(N)]
if N == 1:
print((G[0][0], G[0][1], G[0][2]))
exit(0)
G = sorted(G, key=lambda x: -x[2])
for Cx in range(101):
for Cy in range(101):
f = 1
H = G[0][2] + abs(Cx - G[0][0]) + abs(Cy - G[0][1])
for k in range... | N = int(eval(input()))
L = [list(map(int, input().split())) for k in range(N)]
m = 0
for l in L:
m = max(m, l[2])
for x in range(101):
for y in range(101):
for h in range(m, m + 101):
f = 1
for l in L:
if l[2] != max(h - abs(l[0] - x) - abs(l[1] - y), 0):
... | false | 5.555556 | [
"-G = [list(map(int, input().split())) for k in range(N)]",
"-if N == 1:",
"- print((G[0][0], G[0][1], G[0][2]))",
"- exit(0)",
"-G = sorted(G, key=lambda x: -x[2])",
"-for Cx in range(101):",
"- for Cy in range(101):",
"- f = 1",
"- H = G[0][2] + abs(Cx - G[0][0]) + abs(Cy - ... | false | 0.086081 | 0.172503 | 0.499012 | [
"s350468470",
"s657984335"
] |
u392319141 | p02850 | python | s696534044 | s229193121 | 896 | 783 | 38,908 | 64,980 | Accepted | Accepted | 12.61 | N = int(eval(input()))
edges = [[] for _ in range(N)]
for i in range(N - 1):
fr, to = [int(a) - 1 for a in input().split()]
edges[fr].append((i, to))
edges[to].append((i, fr))
ans = [-1] * (N - 1)
st = [(0, -1)]
while st:
now, pr = st.pop()
C = []
D = set()
for i, _ in edge... | N = int(input())
edges = [[] for _ in range(N)]
for i in range(N - 1):
fr, to = map(lambda a: int(a) - 1, input().split())
edges[fr].append((i, to))
edges[to].append((i, fr))
ans = [-1] * (N - 1)
A = [set() for _ in range(N)]
st = [0]
while st:
now = st.pop()
s = 1
for i, to in... | 31 | 27 | 649 | 559 | N = int(eval(input()))
edges = [[] for _ in range(N)]
for i in range(N - 1):
fr, to = [int(a) - 1 for a in input().split()]
edges[fr].append((i, to))
edges[to].append((i, fr))
ans = [-1] * (N - 1)
st = [(0, -1)]
while st:
now, pr = st.pop()
C = []
D = set()
for i, _ in edges[now]:
D.... | N = int(input())
edges = [[] for _ in range(N)]
for i in range(N - 1):
fr, to = map(lambda a: int(a) - 1, input().split())
edges[fr].append((i, to))
edges[to].append((i, fr))
ans = [-1] * (N - 1)
A = [set() for _ in range(N)]
st = [0]
while st:
now = st.pop()
s = 1
for i, to in edges[now]:
... | false | 12.903226 | [
"-N = int(eval(input()))",
"+N = int(input())",
"- fr, to = [int(a) - 1 for a in input().split()]",
"+ fr, to = map(lambda a: int(a) - 1, input().split())",
"-st = [(0, -1)]",
"+A = [set() for _ in range(N)]",
"+st = [0]",
"- now, pr = st.pop()",
"- C = []",
"- D = set()",
"- f... | false | 0.042535 | 0.03657 | 1.163104 | [
"s696534044",
"s229193121"
] |
u569960318 | p02412 | python | s592253549 | s118186433 | 830 | 20 | 7,744 | 7,696 | Accepted | Accepted | 97.59 | import itertools
while True:
n,x = [int(x) for x in input().split()]
if (n,x)==(0,0): break
cnt=0
for comb in itertools.combinations(list(range(1,n+1)),3):
if sum(comb) == x: cnt+=1
print(cnt) | while True:
n,x = [int(x) for x in input().split()]
if (n,x)==(0,0): break
cnt=0
if 3*(n-1) >= x: # If n-2 + n-1 + n < x, there is no combination
a_max = x//3 - 1 # a_max + a_max+1 + a_max+2 = x
if 2*n-1 < x:
a_min = x - (2*n-1) # set minimum value of a
e... | 8 | 16 | 221 | 606 | import itertools
while True:
n, x = [int(x) for x in input().split()]
if (n, x) == (0, 0):
break
cnt = 0
for comb in itertools.combinations(list(range(1, n + 1)), 3):
if sum(comb) == x:
cnt += 1
print(cnt)
| while True:
n, x = [int(x) for x in input().split()]
if (n, x) == (0, 0):
break
cnt = 0
if 3 * (n - 1) >= x: # If n-2 + n-1 + n < x, there is no combination
a_max = x // 3 - 1 # a_max + a_max+1 + a_max+2 = x
if 2 * n - 1 < x:
a_min = x - (2 * n - 1) # set minimum v... | false | 50 | [
"-import itertools",
"-",
"- for comb in itertools.combinations(list(range(1, n + 1)), 3):",
"- if sum(comb) == x:",
"- cnt += 1",
"+ if 3 * (n - 1) >= x: # If n-2 + n-1 + n < x, there is no combination",
"+ a_max = x // 3 - 1 # a_max + a_max+1 + a_max+2 = x",
"+ ... | false | 0.064482 | 0.041363 | 1.558916 | [
"s592253549",
"s118186433"
] |
u150984829 | p02390 | python | s434589648 | s913666138 | 30 | 20 | 5,588 | 5,580 | Accepted | Accepted | 33.33 | s=int(eval(input()))
print(f'{s//3600}:{s//60%60}:{s%60}') | s=int(input())
print(s//3600,s//60%60,s%60,sep=':')
| 2 | 2 | 53 | 52 | s = int(eval(input()))
print(f"{s//3600}:{s//60%60}:{s%60}")
| s = int(input())
print(s // 3600, s // 60 % 60, s % 60, sep=":")
| false | 0 | [
"-s = int(eval(input()))",
"-print(f\"{s//3600}:{s//60%60}:{s%60}\")",
"+s = int(input())",
"+print(s // 3600, s // 60 % 60, s % 60, sep=\":\")"
] | false | 0.036264 | 0.038473 | 0.94259 | [
"s434589648",
"s913666138"
] |
u852690916 | p03438 | python | s370659506 | s280400336 | 196 | 24 | 40,560 | 4,468 | Accepted | Accepted | 87.76 | import sys
def main():
input = sys.stdin.readline
N=int(eval(input()))
*A,=list(map(int, input().split()))
*B,=list(map(int, input().split()))
asum=sum(A)
bsum=sum(B)
asmall=0
bsmall=0
for a,b in zip(A,B):
asmall+=(max(0, b-a)+1)//2
bsmall+=max(0, a-b)
... | import sys
def main():
input = sys.stdin.readline
N=int(eval(input()))
*A,=list(map(int, input().split()))
*B,=list(map(int, input().split()))
opa=opb=0
for a,b in zip(A,B):
if a>=b:
opb+=a-b
else:
if (b-a)&1==0:
opa+=(b-a)//2... | 19 | 22 | 412 | 464 | import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
(*B,) = list(map(int, input().split()))
asum = sum(A)
bsum = sum(B)
asmall = 0
bsmall = 0
for a, b in zip(A, B):
asmall += (max(0, b - a) + 1) // 2
bsmal... | import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
(*B,) = list(map(int, input().split()))
opa = opb = 0
for a, b in zip(A, B):
if a >= b:
opb += a - b
else:
if (b - a) & 1 == 0:
... | false | 13.636364 | [
"- asum = sum(A)",
"- bsum = sum(B)",
"- asmall = 0",
"- bsmall = 0",
"+ opa = opb = 0",
"- asmall += (max(0, b - a) + 1) // 2",
"- bsmall += max(0, a - b)",
"- t = bsum - asum",
"- print((\"Yes\" if t >= max(asmall, bsmall) else \"No\"))",
"+ if a >= b:",... | false | 0.037593 | 0.036847 | 1.020249 | [
"s370659506",
"s280400336"
] |
u328510800 | p02880 | python | s832243586 | s848397893 | 31 | 27 | 9,136 | 9,104 | Accepted | Accepted | 12.9 | n = int(eval(input()))
def solve(n: int) -> str:
for l in range(1, 10):
for m in range(1, 10):
if n == l * m:
return "Yes"
return "No"
print((solve(n))) | n = int(eval(input()))
s = set([x for x in [x for x in range(1, 10)] if n % x == 0 and n / x < 10])
print(("No" if len(s) == 0 else "Yes")) | 10 | 3 | 179 | 137 | n = int(eval(input()))
def solve(n: int) -> str:
for l in range(1, 10):
for m in range(1, 10):
if n == l * m:
return "Yes"
return "No"
print((solve(n)))
| n = int(eval(input()))
s = set([x for x in [x for x in range(1, 10)] if n % x == 0 and n / x < 10])
print(("No" if len(s) == 0 else "Yes"))
| false | 70 | [
"-",
"-",
"-def solve(n: int) -> str:",
"- for l in range(1, 10):",
"- for m in range(1, 10):",
"- if n == l * m:",
"- return \"Yes\"",
"- return \"No\"",
"-",
"-",
"-print((solve(n)))",
"+s = set([x for x in [x for x in range(1, 10)] if n % x == 0 and n ... | false | 0.036983 | 0.035896 | 1.030255 | [
"s832243586",
"s848397893"
] |
u579699847 | p03162 | python | s333543156 | s876380922 | 885 | 814 | 51,340 | 51,380 | Accepted | Accepted | 8.02 | import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
abc = [LI() for _ in range(N)]
dp = [[0,0,0] for _ in range(N+1)]
for i,j,k in itertools.product(list(range(N)),[0,1,2],[0,1,2]):
if j==k:
continue
... | import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
abc = [LI() for _ in range(N)]
dp = [[0,0,0] for _ in range(N)]
dp[0] = abc[0]
for i,j,k in itertools.product(list(range(N)),[0,1,2],[0,1,2]):
if j==k:
... | 12 | 13 | 405 | 417 | import itertools, sys
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N = I()
abc = [LI() for _ in range(N)]
dp = [[0, 0, 0] for _ in range(N + 1)]
for i, j, k in itertools.product(list(range(N)), [0, 1, 2], [0, 1, 2]):
if j == ... | import itertools, sys
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N = I()
abc = [LI() for _ in range(N)]
dp = [[0, 0, 0] for _ in range(N)]
dp[0] = abc[0]
for i, j, k in itertools.product(list(range(N)), [0, 1, 2], [0, 1, 2]):
... | false | 7.692308 | [
"-dp = [[0, 0, 0] for _ in range(N + 1)]",
"+dp = [[0, 0, 0] for _ in range(N)]",
"+dp[0] = abc[0]",
"- if i + 1 <= N:",
"- dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + abc[i][j])",
"+ if i - 1 >= 0:",
"+ dp[i][j] = max(dp[i][j], dp[i - 1][k] + abc[i][j])"
] | false | 0.054583 | 0.037855 | 1.441876 | [
"s333543156",
"s876380922"
] |
u572012241 | p03160 | python | s260837645 | s068202314 | 240 | 156 | 93,956 | 14,056 | Accepted | Accepted | 35 | import sys
sys.setrecursionlimit(10**5+10)
n = int(eval(input()))
h = list(map(int, input().split()))
f_inf = float("inf")
dp = [f_inf] *(10**5 +10)
def chmin(a,b):
if a<b:
return a
else:
return b
def rec(i):
if dp[i] < f_inf: #更新されてたらそのまま返す
return dp[i]
if... | n = int(eval(input()))
h = [int(i) for i in input().split()]
# dpの最小値を変更する関数
def chmin(a, b):
if a > b:
return b
else:
return a
# 無限大の値
f_inf = float('inf')
# DP テーブルを初期化 (最小化問題なので INF に初期化)
dp = [f_inf] * (10**5+10)
# 初期条件
dp[0] = 0
# 足場 i-1 から足場 i へ移動する。コストは|h[i]−h[i-1]|
#... | 30 | 23 | 540 | 555 | import sys
sys.setrecursionlimit(10**5 + 10)
n = int(eval(input()))
h = list(map(int, input().split()))
f_inf = float("inf")
dp = [f_inf] * (10**5 + 10)
def chmin(a, b):
if a < b:
return a
else:
return b
def rec(i):
if dp[i] < f_inf: # 更新されてたらそのまま返す
return dp[i]
if i == 0:
... | n = int(eval(input()))
h = [int(i) for i in input().split()]
# dpの最小値を変更する関数
def chmin(a, b):
if a > b:
return b
else:
return a
# 無限大の値
f_inf = float("inf")
# DP テーブルを初期化 (最小化問題なので INF に初期化)
dp = [f_inf] * (10**5 + 10)
# 初期条件
dp[0] = 0
# 足場 i-1 から足場 i へ移動する。コストは|h[i]−h[i-1]|
# 足場 i-2 から足場 i へと... | false | 23.333333 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**5 + 10)",
"-h = list(map(int, input().split()))",
"-f_inf = float(\"inf\")",
"-dp = [f_inf] * (10**5 + 10)",
"+h = [int(i) for i in input().split()]",
"+# dpの最小値を変更する関数",
"+def chmin(a, b):",
"+ if a > b:",
"+ return b",
"+ else:",
... | false | 0.126529 | 0.037907 | 3.337917 | [
"s260837645",
"s068202314"
] |
u423665486 | p03162 | python | s741052044 | s613584776 | 849 | 662 | 22,824 | 58,932 | Accepted | Accepted | 22.03 | def resolve():
n = int(eval(input()))
dp = [[0]*3 for _ in range(n+1) ]
for i in range(1, n+1):
r = list(map(int, input().split()))
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i][j] = max(dp[i][j], dp[i-1][k] + r[j])
print((max(dp[-1])))
resolve() | def resolve():
n = int(eval(input()))
dp = [[0]*3 for _ in range(n+1)]
for i in range(1, n+1):
nums = list(map(int, input().split()))
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i][j] = max(dp[i][j], nums[j] + dp[i-1][k])
print((max(dp[-1])))
resolve() | 12 | 12 | 291 | 296 | def resolve():
n = int(eval(input()))
dp = [[0] * 3 for _ in range(n + 1)]
for i in range(1, n + 1):
r = list(map(int, input().split()))
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i][j] = max(dp[i][j], dp[i - 1... | def resolve():
n = int(eval(input()))
dp = [[0] * 3 for _ in range(n + 1)]
for i in range(1, n + 1):
nums = list(map(int, input().split()))
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i][j] = max(dp[i][j], nums[... | false | 0 | [
"- r = list(map(int, input().split()))",
"+ nums = list(map(int, input().split()))",
"- dp[i][j] = max(dp[i][j], dp[i - 1][k] + r[j])",
"+ dp[i][j] = max(dp[i][j], nums[j] + dp[i - 1][k])"
] | false | 0.037217 | 0.108391 | 0.343364 | [
"s741052044",
"s613584776"
] |
u622045059 | p03168 | python | s540681375 | s866188608 | 1,078 | 987 | 278,264 | 274,672 | Accepted | Accepted | 8.44 | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return ... | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def... | 44 | 46 | 1,513 | 1,559 | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a, b):
return fractions.gcd(a, b) # 最大公約数
def lcm(a, b):
return (a * b) // fractions.gcd(a, b) # 最小公倍数
def ... | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
def gcd(a, b):
return fractions.gcd(a, b) # 最大公約数
def lcm(a, b):
return (a * b) // fractions.gcd(a, b)... | false | 4.347826 | [
"+MOD = 10**9 + 7",
"-MOD = 10**9 + 7",
"+def add_mod(a, b):",
"+ return (a + b) % MOD",
"+",
"+",
"- for j in range(N):",
"+ for j in range(i + 1):",
"+ dp[i + 1][j] += dp[i][j] * (1 - p[i])",
"- dp[i + 1][j] += dp[i][j] * (1 - p[i])"
] | false | 0.126789 | 0.06213 | 2.040706 | [
"s540681375",
"s866188608"
] |
u176463385 | p03493 | python | s463614496 | s755985017 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | s = eval(input())
s1 = s[0]
s2 = s[1]
s3 = s[2]
n = 0
if s1 == '1':
n = n + 1
if s2 == '1':
n = n + 1
if s3 == '1':
n = n + 1
print (n) | s = eval(input())
n = 0
if s[0] == '1':
n = n + 1
if s[1] == '1':
n = n + 1
if s[2] == '1':
n = n + 1
print (n) | 12 | 9 | 146 | 119 | s = eval(input())
s1 = s[0]
s2 = s[1]
s3 = s[2]
n = 0
if s1 == "1":
n = n + 1
if s2 == "1":
n = n + 1
if s3 == "1":
n = n + 1
print(n)
| s = eval(input())
n = 0
if s[0] == "1":
n = n + 1
if s[1] == "1":
n = n + 1
if s[2] == "1":
n = n + 1
print(n)
| false | 25 | [
"-s1 = s[0]",
"-s2 = s[1]",
"-s3 = s[2]",
"-if s1 == \"1\":",
"+if s[0] == \"1\":",
"-if s2 == \"1\":",
"+if s[1] == \"1\":",
"-if s3 == \"1\":",
"+if s[2] == \"1\":"
] | false | 0.080911 | 0.081409 | 0.993882 | [
"s463614496",
"s755985017"
] |
u992875223 | p03338 | python | s488921006 | s259374293 | 22 | 18 | 3,060 | 3,064 | Accepted | Accepted | 18.18 | def f(s, t):
res = 0
for i in set(s):
for j in set(t):
if i == j:
res += 1
return res
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N):
ans = max(ans, f(S[:i], S[i:]))
print(ans) | def f(s, t):
return len(set(s) & set(t))
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N):
ans = max(ans, f(S[:i], S[i:]))
print(ans) | 14 | 9 | 250 | 156 | def f(s, t):
res = 0
for i in set(s):
for j in set(t):
if i == j:
res += 1
return res
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N):
ans = max(ans, f(S[:i], S[i:]))
print(ans)
| def f(s, t):
return len(set(s) & set(t))
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N):
ans = max(ans, f(S[:i], S[i:]))
print(ans)
| false | 35.714286 | [
"- res = 0",
"- for i in set(s):",
"- for j in set(t):",
"- if i == j:",
"- res += 1",
"- return res",
"+ return len(set(s) & set(t))"
] | false | 0.045028 | 0.041655 | 1.080977 | [
"s488921006",
"s259374293"
] |
u562935282 | p03576 | python | s285147126 | s468762553 | 289 | 214 | 45,032 | 42,224 | Accepted | Accepted | 25.95 | # 二次元累積和
# 写経
# https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2017/1014_abc075
from collections import namedtuple
from operator import attrgetter
Coordinates = namedtuple('Coordinates', ('ind', 'x', 'y'))
n, k = list(map(int, input().split()))
e = []
for ind in range(n):
x,... | # 二次元累積和
# 写経
# https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2017/1014_abc075
def solve():
from collections import namedtuple
from operator import attrgetter
import sys
input = sys.stdin.readline
Coordinates = namedtuple('Coordinates', ('x', 'y'))
n, k ... | 35 | 44 | 1,206 | 1,447 | # 二次元累積和
# 写経
# https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2017/1014_abc075
from collections import namedtuple
from operator import attrgetter
Coordinates = namedtuple("Coordinates", ("ind", "x", "y"))
n, k = list(map(int, input().split()))
e = []
for ind in range(n):
x, y = list(map(in... | # 二次元累積和
# 写経
# https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2017/1014_abc075
def solve():
from collections import namedtuple
from operator import attrgetter
import sys
input = sys.stdin.readline
Coordinates = namedtuple("Coordinates", ("x", "y"))
n, k = list(map(int, ... | false | 20.454545 | [
"-from collections import namedtuple",
"-from operator import attrgetter",
"+def solve():",
"+ from collections import namedtuple",
"+ from operator import attrgetter",
"+ import sys",
"-Coordinates = namedtuple(\"Coordinates\", (\"ind\", \"x\", \"y\"))",
"-n, k = list(map(int, input().split(... | false | 0.053341 | 0.035701 | 1.494099 | [
"s285147126",
"s468762553"
] |
u644778646 | p02937 | python | s731751275 | s127708034 | 256 | 233 | 8,996 | 9,300 | Accepted | Accepted | 8.98 | import bisect
s = list(eval(input()))
t = list(eval(input()))
ds = {} # sに含まれる文字それぞれの数
dsl = {} # sの文字の位置
for i in range(len(s)):
if s[i] not in list(ds.keys()):
ds[s[i]] = 0
dsl[s[i]] = []
ds[s[i]] += 1
dsl[s[i]].append(i)
for i in range(len(t)):
if t[i] not in list(ds... | import bisect
s = list(eval(input()))
t = list(eval(input()))
from collections import defaultdict
ds = defaultdict(int) # sに含まれる文字それぞれの数
dsl = defaultdict(list) # sの文字の位置
for i in range(len(s)):
ds[s[i]] += 1
dsl[s[i]].append(i)
ans = 0
now = -1#ここが-1じゃないと、最初の遷移でsの最初の文字を使えない
for i in range(len(... | 43 | 35 | 1,134 | 1,024 | import bisect
s = list(eval(input()))
t = list(eval(input()))
ds = {} # sに含まれる文字それぞれの数
dsl = {} # sの文字の位置
for i in range(len(s)):
if s[i] not in list(ds.keys()):
ds[s[i]] = 0
dsl[s[i]] = []
ds[s[i]] += 1
dsl[s[i]].append(i)
for i in range(len(t)):
if t[i] not in list(ds.keys()):
... | import bisect
s = list(eval(input()))
t = list(eval(input()))
from collections import defaultdict
ds = defaultdict(int) # sに含まれる文字それぞれの数
dsl = defaultdict(list) # sの文字の位置
for i in range(len(s)):
ds[s[i]] += 1
dsl[s[i]].append(i)
ans = 0
now = -1 # ここが-1じゃないと、最初の遷移でsの最初の文字を使えない
for i in range(len(t)):
i... | false | 18.604651 | [
"-ds = {} # sに含まれる文字それぞれの数",
"-dsl = {} # sの文字の位置",
"+from collections import defaultdict",
"+",
"+ds = defaultdict(int) # sに含まれる文字それぞれの数",
"+dsl = defaultdict(list) # sの文字の位置",
"- if s[i] not in list(ds.keys()):",
"- ds[s[i]] = 0",
"- dsl[s[i]] = []",
"-for i in range(len(t))... | false | 0.038745 | 0.043934 | 0.881892 | [
"s731751275",
"s127708034"
] |
u397384480 | p02695 | python | s249688256 | s245004924 | 496 | 145 | 126,556 | 84,944 | Accepted | Accepted | 70.77 | 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())))
lun = [0]*N
l = []
def make(n):
if len(n) > N:
return 0
if int(n) > 3234566667:
return 0
else:
p = []
... | import itertools
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())))
l = list(itertools.combinations_with_replacement(list(range(1,M+1)), N))
nax = 0
for x in l:
score = 0
for i in range(... | 43 | 21 | 787 | 425 | 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())))
lun = [0] * N
l = []
def make(n):
if len(n) > N:
return 0
if int(n) > 3234566667:
return 0
else:
p = []
... | import itertools
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())))
l = list(itertools.combinations_with_replacement(list(range(1, M + 1)), N))
nax = 0
for x in l:
score = 0
for i in range... | false | 51.162791 | [
"+import itertools",
"+",
"-lun = [0] * N",
"-l = []",
"-",
"-",
"-def make(n):",
"- if len(n) > N:",
"- return 0",
"- if int(n) > 3234566667:",
"- return 0",
"- else:",
"- p = []",
"- for i in range(int(n[-1]), M):",
"- p.append(str(i))",
... | false | 0.165287 | 0.079213 | 2.086611 | [
"s249688256",
"s245004924"
] |
u600402037 | p03055 | python | s124503619 | s040732351 | 1,510 | 1,327 | 89,856 | 69,320 | Accepted | Accepted | 12.12 | # 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()))
def dijkstra(start):
INF = 10 ** 15
dist = [INF] * (N+1)
dist[start] = 0
que = [(0, start)]
while que:
... | # 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()))
def tree_diameter(graph): # 木の直径
def dijkstra(start):
INF = 10 ** 15
dist = [INF] * (N+1)
dist[sta... | 40 | 41 | 973 | 1,104 | # 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()))
def dijkstra(start):
INF = 10**15
dist = [INF] * (N + 1)
dist[start] = 0
que = [(0, start)]
while que:
d, pre... | # 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()))
def tree_diameter(graph): # 木の直径
def dijkstra(start):
INF = 10**15
dist = [INF] * (N + 1)
dist[start] = 0
... | false | 2.439024 | [
"-def dijkstra(start):",
"- INF = 10**15",
"- dist = [INF] * (N + 1)",
"- dist[start] = 0",
"- que = [(0, start)]",
"- while que:",
"- d, prev = heappop(que)",
"- if dist[prev] < d:",
"- continue",
"- for next in graph[prev]:",
"- d1 = d ... | false | 0.123842 | 0.06577 | 1.88295 | [
"s124503619",
"s040732351"
] |
u949338836 | p02412 | python | s111848651 | s284630367 | 3,540 | 110 | 6,724 | 6,720 | Accepted | Accepted | 96.89 | #coding:utf-8
#1_7_B 2015.4.5
while True:
n,x = list(map(int,input().split()))
if n == x == 0:
break
count = 0
for i in range(1 , n + 1):
for j in range(1 , n + 1):
for k in range(1 , n + 1):
if i + j + k == x and i < j < k:
... | #coding:utf-8
#1_7_B 2015.4.5
while True:
n,x = list(map(int,input().split()))
if n == x == 0:
break
count = 0
for i in range(1 , n + 1):
for j in range(1 , n + 1):
if (x - i - j) <= n and i < j < (x - i -j):
count += 1
print(count) | 14 | 13 | 344 | 307 | # coding:utf-8
# 1_7_B 2015.4.5
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
count = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
for k in range(1, n + 1):
if i + j + k == x and i < j < k:
count += 1
... | # coding:utf-8
# 1_7_B 2015.4.5
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
count = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
if (x - i - j) <= n and i < j < (x - i - j):
count += 1
print(count)
| false | 7.142857 | [
"- for k in range(1, n + 1):",
"- if i + j + k == x and i < j < k:",
"- count += 1",
"+ if (x - i - j) <= n and i < j < (x - i - j):",
"+ count += 1"
] | false | 0.068133 | 0.03979 | 1.712292 | [
"s111848651",
"s284630367"
] |
u175426149 | p03309 | python | s106991515 | s660076350 | 271 | 211 | 27,232 | 27,224 | Accepted | Accepted | 22.14 | from statistics import median
N = int(eval(input()))
A = list(map(int, input().split()))
A_star = [a - (i + 1) for i, a in enumerate(A)]
def calc_score(b):
score = 0
for a in A_star:
score += abs(a - b)
return score
def decide_direction(b):
score0 = calc_score(b)
score1 = ... | from statistics import median
N = int(eval(input()))
A = list(map(int, input().split()))
A_star = [a - (i + 1) for i, a in enumerate(A)]
def calc_score(b):
score = 0
for a in A_star:
score += abs(a - b)
return score
print((calc_score(int(median(A_star))))) | 37 | 14 | 669 | 285 | from statistics import median
N = int(eval(input()))
A = list(map(int, input().split()))
A_star = [a - (i + 1) for i, a in enumerate(A)]
def calc_score(b):
score = 0
for a in A_star:
score += abs(a - b)
return score
def decide_direction(b):
score0 = calc_score(b)
score1 = calc_score(b +... | from statistics import median
N = int(eval(input()))
A = list(map(int, input().split()))
A_star = [a - (i + 1) for i, a in enumerate(A)]
def calc_score(b):
score = 0
for a in A_star:
score += abs(a - b)
return score
print((calc_score(int(median(A_star)))))
| false | 62.162162 | [
"-def decide_direction(b):",
"- score0 = calc_score(b)",
"- score1 = calc_score(b + 1)",
"- if score0 > score1:",
"- return 1",
"- else:",
"- return -1",
"-",
"-",
"-b = int(median(A_star))",
"-direction = decide_direction(b)",
"-pre_score = calc_score(b)",
"-while ... | false | 0.062846 | 0.058852 | 1.067864 | [
"s106991515",
"s660076350"
] |
u094191970 | p02726 | python | s667076994 | s911040400 | 1,454 | 1,200 | 203,448 | 3,444 | Accepted | Accepted | 17.47 | from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
import numpy as np
from collections import Counter
n,x,y=list(map(int,input().split()))
row,col,w=[],[],[]
for i in range(n-1):
row.append(i)
col.append(i+1)
w.append(1)
row.append(x-1)
col.append(y-1)
w.append(1)
g... | n,x,y=list(map(int,input().split()))
x-=1
y-=1
dist=[0 for i in range(n)]
for i in range(n-1):
for j in range(i+1,n):
dist[min(j-i,abs(x-i)+1+abs(j-y))]+=1
for i in dist[1:]:
print(i) | 26 | 12 | 467 | 199 | from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
import numpy as np
from collections import Counter
n, x, y = list(map(int, input().split()))
row, col, w = [], [], []
for i in range(n - 1):
row.append(i)
col.append(i + 1)
w.append(1)
row.append(x - 1)
col.append(y - 1)
w.append... | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
dist = [0 for i in range(n)]
for i in range(n - 1):
for j in range(i + 1, n):
dist[min(j - i, abs(x - i) + 1 + abs(j - y))] += 1
for i in dist[1:]:
print(i)
| false | 53.846154 | [
"-from scipy.sparse import csr_matrix",
"-from scipy.sparse.csgraph import dijkstra",
"-import numpy as np",
"-from collections import Counter",
"-",
"-row, col, w = [], [], []",
"+x -= 1",
"+y -= 1",
"+dist = [0 for i in range(n)]",
"- row.append(i)",
"- col.append(i + 1)",
"- w.appe... | false | 0.528522 | 0.116097 | 4.552403 | [
"s667076994",
"s911040400"
] |
u970197315 | p03805 | python | s271983594 | s023888097 | 40 | 30 | 9,304 | 9,088 | Accepted | Accepted | 25 | n,m=list(map(int,input().split()))
G=[[0]*n for i in range(n)]
for i in range(m):
a,b=list(map(int,input().split()))
G[a-1][b-1]=G[b-1][a-1]=1
from itertools import permutations
ans=0
p=list(permutations([x for x in range(1,n)]))
for pp in p:
ok=True
t=[0]+list(pp)
for i in range(1,n):
if G[... | def dfs(v,visited):
if all(visited):
return 1
res=0
for nv in G[v]:
if visited[nv]:
continue
visited[nv]=1
res+=dfs(nv,visited)
visited[nv]=0
return res
n,m=list(map(int, input().split()))
G=[[] for _ in range(n)]
visited=[0]*n
res=0
for i in range(m):
a,b=list(... | 17 | 24 | 370 | 417 | n, m = list(map(int, input().split()))
G = [[0] * n for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
G[a - 1][b - 1] = G[b - 1][a - 1] = 1
from itertools import permutations
ans = 0
p = list(permutations([x for x in range(1, n)]))
for pp in p:
ok = True
t = [0] + list(pp)
... | def dfs(v, visited):
if all(visited):
return 1
res = 0
for nv in G[v]:
if visited[nv]:
continue
visited[nv] = 1
res += dfs(nv, visited)
visited[nv] = 0
return res
n, m = list(map(int, input().split()))
G = [[] for _ in range(n)]
visited = [0] * n
res... | false | 29.166667 | [
"+def dfs(v, visited):",
"+ if all(visited):",
"+ return 1",
"+ res = 0",
"+ for nv in G[v]:",
"+ if visited[nv]:",
"+ continue",
"+ visited[nv] = 1",
"+ res += dfs(nv, visited)",
"+ visited[nv] = 0",
"+ return res",
"+",
"+",
"-G =... | false | 0.066662 | 0.040959 | 1.627544 | [
"s271983594",
"s023888097"
] |
u546285759 | p00217 | python | s025534766 | s998691533 | 760 | 680 | 8,872 | 14,264 | Accepted | Accepted | 10.53 | while True:
n = int(eval(input()))
if n == 0:
break
patients = []
for _ in range(n):
p, d1, d2 = list(map(int, input().split()))
patients.append((p, d1+d2))
print((*max(patients, key=lambda x: x[1]))) | while True:
n = int(eval(input()))
if n == 0:
break
patients = [list(map(int, input().split())) for _ in range(n)]
patients = [(p, d1+d2) for p, d1, d2 in patients]
print((*max(patients, key=lambda x: x[1]))) | 10 | 8 | 240 | 230 | while True:
n = int(eval(input()))
if n == 0:
break
patients = []
for _ in range(n):
p, d1, d2 = list(map(int, input().split()))
patients.append((p, d1 + d2))
print((*max(patients, key=lambda x: x[1])))
| while True:
n = int(eval(input()))
if n == 0:
break
patients = [list(map(int, input().split())) for _ in range(n)]
patients = [(p, d1 + d2) for p, d1, d2 in patients]
print((*max(patients, key=lambda x: x[1])))
| false | 20 | [
"- patients = []",
"- for _ in range(n):",
"- p, d1, d2 = list(map(int, input().split()))",
"- patients.append((p, d1 + d2))",
"+ patients = [list(map(int, input().split())) for _ in range(n)]",
"+ patients = [(p, d1 + d2) for p, d1, d2 in patients]"
] | false | 0.058725 | 0.056012 | 1.04845 | [
"s025534766",
"s998691533"
] |
u191874006 | p02835 | python | s163299137 | s186318013 | 186 | 71 | 38,384 | 65,552 | Accepted | Accepted | 61.83 | #!/usr/bin/env python3
#ABC147 A
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Count... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 27 | 25 | 655 | 637 | #!/usr/bin/env python3
# ABC147 A
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from c... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 7.407407 | [
"-# ABC147 A",
"-sys.setrecursionlimit(1000000)",
"+sys.setrecursionlimit(2147483647)",
"-a1, a2, a3 = LI()",
"-if a1 + a2 + a3 >= 22:",
"+a = LI()",
"+s = sum(a)",
"+if s >= 22:"
] | false | 0.045763 | 0.035463 | 1.290442 | [
"s163299137",
"s186318013"
] |
u867826040 | p02880 | python | s682175132 | s919764898 | 171 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.06 | N = int(eval(input()))
l = []
for i in range(1, 10):
for j in range(1, 10):
l.append(i * j)
if N in l:
print('Yes')
else:
print('No') | x = int(eval(input()))
ans = "No"
for i in range(1,10):
for j in range(1,10):
if i*j==x:
ans = "Yes"
print(ans) | 11 | 7 | 159 | 135 | N = int(eval(input()))
l = []
for i in range(1, 10):
for j in range(1, 10):
l.append(i * j)
if N in l:
print("Yes")
else:
print("No")
| x = int(eval(input()))
ans = "No"
for i in range(1, 10):
for j in range(1, 10):
if i * j == x:
ans = "Yes"
print(ans)
| false | 36.363636 | [
"-N = int(eval(input()))",
"-l = []",
"+x = int(eval(input()))",
"+ans = \"No\"",
"- l.append(i * j)",
"-if N in l:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+ if i * j == x:",
"+ ans = \"Yes\"",
"+print(ans)"
] | false | 0.115739 | 0.037755 | 3.065554 | [
"s682175132",
"s919764898"
] |
u514401521 | p02695 | python | s089520830 | s802904342 | 691 | 283 | 9,172 | 76,528 | Accepted | Accepted | 59.04 | import sys
sys.setrecursionlimit(10**9)
N, M, Q = list(map(int, input().split()))
A = []
B = []
C = []
D = []
ans = 0
for i in range(Q):
a, b, c, d = list(map(int, input().split()))
A.append(a)
B.append(b)
C.append(c)
D.append(d)
def dfs(n):
if len(n) == N+1:
global ans... | import sys
sys.setrecursionlimit(10**9)
N, M, Q = list(map(int, input().split()))
l = []
for _ in range(Q):
l.append(list(map(int, input().split())))
ans = 0
def dfs(n):
if len(n) == N+1:
global ans
tmp = 0
for i in range(Q):
abi = n[l[i][1]]
aai = n[... | 30 | 26 | 601 | 605 | import sys
sys.setrecursionlimit(10**9)
N, M, Q = list(map(int, input().split()))
A = []
B = []
C = []
D = []
ans = 0
for i in range(Q):
a, b, c, d = list(map(int, input().split()))
A.append(a)
B.append(b)
C.append(c)
D.append(d)
def dfs(n):
if len(n) == N + 1:
global ans
tmp ... | import sys
sys.setrecursionlimit(10**9)
N, M, Q = list(map(int, input().split()))
l = []
for _ in range(Q):
l.append(list(map(int, input().split())))
ans = 0
def dfs(n):
if len(n) == N + 1:
global ans
tmp = 0
for i in range(Q):
abi = n[l[i][1]]
aai = n[l[i][0]]... | false | 13.333333 | [
"-A = []",
"-B = []",
"-C = []",
"-D = []",
"+l = []",
"+for _ in range(Q):",
"+ l.append(list(map(int, input().split())))",
"-for i in range(Q):",
"- a, b, c, d = list(map(int, input().split()))",
"- A.append(a)",
"- B.append(b)",
"- C.append(c)",
"- D.append(d)",
"- ... | false | 0.083738 | 0.061227 | 1.36767 | [
"s089520830",
"s802904342"
] |
u059210959 | p02615 | python | s472614190 | s137626188 | 159 | 145 | 35,084 | 31,416 | Accepted | Accepted | 8.81 | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.de... | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
ans += A[0]
tmp = 1
for i in range(1, N - 1):
ans += A[tmp]
if i % 2 == 0:
tmp += 1
print(ans) | 30 | 13 | 568 | 206 | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect # bisect_left これで二部探索の大小検索が行える
import fractions # 最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9 + 7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.deque()
... | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
ans += A[0]
tmp = 1
for i in range(1, N - 1):
ans += A[tmp]
if i % 2 == 0:
tmp += 1
print(ans)
| false | 56.666667 | [
"-#!/usr/bin/env python3",
"-# encoding:utf-8",
"-import copy",
"-import random",
"-import bisect # bisect_left これで二部探索の大小検索が行える",
"-import fractions # 最小公倍数などはこっち",
"-import math",
"-import sys",
"-import collections",
"-from decimal import Decimal # 10進数で考慮できる",
"-",
"-mod = 10**9 + 7",
... | false | 0.049283 | 0.037101 | 1.328347 | [
"s472614190",
"s137626188"
] |
u761320129 | p03476 | python | s440763740 | s675194173 | 861 | 457 | 9,816 | 21,012 | Accepted | Accepted | 46.92 | MAXN = 10**5+10
sieve = [0,0] + [1]*MAXN
m = 2
while m*m <= MAXN:
if sieve[m]:
for n in range(2*m,MAXN,m):
sieve[n] = 0
m += 1
ok = [0]*MAXN
cums = [0]
for n in range(MAXN):
if sieve[n] and sieve[(n+1)//2]:
ok[n] = 1
cums.append(cums[-1] + ok[n])
Q = int(eva... | Q = int(eval(input()))
qs = [tuple(map(int,input().split())) for i in range(Q)]
MAXN = 10**5+10
sieve = [0,0] + [1]*MAXN
p = 2
while p*p <= MAXN:
if sieve[p]:
for q in range(2*p,MAXN+1,p):
sieve[q] = 0
p += 1
cums = [0]
for i in range(1,MAXN):
valid = sieve[i] and sieve[(... | 20 | 20 | 414 | 427 | MAXN = 10**5 + 10
sieve = [0, 0] + [1] * MAXN
m = 2
while m * m <= MAXN:
if sieve[m]:
for n in range(2 * m, MAXN, m):
sieve[n] = 0
m += 1
ok = [0] * MAXN
cums = [0]
for n in range(MAXN):
if sieve[n] and sieve[(n + 1) // 2]:
ok[n] = 1
cums.append(cums[-1] + ok[n])
Q = int(eval... | Q = int(eval(input()))
qs = [tuple(map(int, input().split())) for i in range(Q)]
MAXN = 10**5 + 10
sieve = [0, 0] + [1] * MAXN
p = 2
while p * p <= MAXN:
if sieve[p]:
for q in range(2 * p, MAXN + 1, p):
sieve[q] = 0
p += 1
cums = [0]
for i in range(1, MAXN):
valid = sieve[i] and sieve[(i... | false | 0 | [
"+Q = int(eval(input()))",
"+qs = [tuple(map(int, input().split())) for i in range(Q)]",
"-m = 2",
"-while m * m <= MAXN:",
"- if sieve[m]:",
"- for n in range(2 * m, MAXN, m):",
"- sieve[n] = 0",
"- m += 1",
"-ok = [0] * MAXN",
"+p = 2",
"+while p * p <= MAXN:",
"+ ... | false | 0.08942 | 0.142317 | 0.628317 | [
"s440763740",
"s675194173"
] |
u433380437 | p02579 | python | s448555342 | s807183565 | 919 | 821 | 179,540 | 178,636 | Accepted | Accepted | 10.66 | # ABC176 D Wizard
# 地図系。ワープ有 01BFS??
from collections import deque
H,W = list(map(int,input().split()))
sx,sy = list(map(int,input().split()))
gx,gy = list(map(int,input().split()))
sx,sy,gx,gy = sx-1,sy-1,gx-1,gy-1
C=[list(eval(input())) for i in range(H)]
inf = float("inf")
for i in range(H):
for... | # ABC176 D Wizard
# 地図系。ワープ有 01BFS??
from collections import deque
H,W = list(map(int,input().split()))
sx,sy = list(map(int,input().split()))
gx,gy = list(map(int,input().split()))
sx,sy,gx,gy = sx-1,sy-1,gx-1,gy-1
C=[list(eval(input())) for i in range(H)]
inf = float("inf")
for i in range(H):
for... | 43 | 43 | 1,193 | 1,153 | # ABC176 D Wizard
# 地図系。ワープ有 01BFS??
from collections import deque
H, W = list(map(int, input().split()))
sx, sy = list(map(int, input().split()))
gx, gy = list(map(int, input().split()))
sx, sy, gx, gy = sx - 1, sy - 1, gx - 1, gy - 1
C = [list(eval(input())) for i in range(H)]
inf = float("inf")
for i in range(H):
... | # ABC176 D Wizard
# 地図系。ワープ有 01BFS??
from collections import deque
H, W = list(map(int, input().split()))
sx, sy = list(map(int, input().split()))
gx, gy = list(map(int, input().split()))
sx, sy, gx, gy = sx - 1, sy - 1, gx - 1, gy - 1
C = [list(eval(input())) for i in range(H)]
inf = float("inf")
for i in range(H):
... | false | 0 | [
"- if (",
"- 0 <= nx < H",
"- and 0 <= ny < W",
"- and L + C[nx][ny] < dist[nx][ny]",
"- and C[nx][ny] == 0",
"- ):",
"- dist[nx][ny] = L + C[nx][ny]",
"+ if 0 <= nx < H and 0 <= ny < W and L < dist[nx][ny] and C[nx][ny] == 0:... | false | 0.081846 | 0.072268 | 1.132545 | [
"s448555342",
"s807183565"
] |
u811733736 | p00511 | python | s988047044 | s932893750 | 30 | 20 | 7,704 | 7,672 | Accepted | Accepted | 33.33 | if __name__ == '__main__':
opcode = [] # ?????????????¨???¶??¨
operand = [] # ?????´????¢??????????????¨???¶??¨
# ??????????????\???
while True:
data = eval(input())
if data == '=':
break
elif data == '+' or data == '-' or data... | if __name__ == '__main__':
opcode = [] # ?????????????¨???¶??¨
operand = [] # ?????´????¢??????????????¨???¶??¨
# ??????????????\???
while True:
data = eval(input())
if data == '=':
break
elif data in '+-*/':
opcod... | 29 | 29 | 1,021 | 979 | if __name__ == "__main__":
opcode = [] # ?????????????¨???¶??¨
operand = [] # ?????´????¢??????????????¨???¶??¨
# ??????????????\???
while True:
data = eval(input())
if data == "=":
break
elif data == "+" or data == "-" or data == "*" or data == "/":
opc... | if __name__ == "__main__":
opcode = [] # ?????????????¨???¶??¨
operand = [] # ?????´????¢??????????????¨???¶??¨
# ??????????????\???
while True:
data = eval(input())
if data == "=":
break
elif data in "+-*/":
opcode.append(data)
else:
... | false | 0 | [
"- elif data == \"+\" or data == \"-\" or data == \"*\" or data == \"/\":",
"+ elif data in \"+-*/\":"
] | false | 0.049679 | 0.045278 | 1.097185 | [
"s988047044",
"s932893750"
] |
u678167152 | p03715 | python | s470775324 | s873100315 | 169 | 107 | 38,392 | 73,912 | Accepted | Accepted | 36.69 | def solve():
H, W = list(map(int, input().split()))
if H*W%3==0:
return 0
if H%2==0 and W%2==0:
return min(H//2,W//2)
if H%2==0:
return min([H//2,H//3*2+W//2+1-min(H//3,W//2),W])
if W%2==0:
return min([W//2,W//3*2+H//2+1-min(W//3,H//2),H])
return min([H/... | def solve():
ans = float('inf')
H, W = list(map(int, input().split()))
for h in range(1,H):
o1 = (H-h)//2*W
o2 = (H-h)*W-o1
a = [h*W,o1,o2]
ans = min(ans,max(a)-min(a))
o1 = W//2*(H-h)
o2 = (H-h)*W-o1
a = [h*W,o1,o2]
ans = min(ans,max(a)-min(a))
for w in range(1,W):
... | 12 | 23 | 391 | 536 | def solve():
H, W = list(map(int, input().split()))
if H * W % 3 == 0:
return 0
if H % 2 == 0 and W % 2 == 0:
return min(H // 2, W // 2)
if H % 2 == 0:
return min([H // 2, H // 3 * 2 + W // 2 + 1 - min(H // 3, W // 2), W])
if W % 2 == 0:
return min([W // 2, W // 3 * 2... | def solve():
ans = float("inf")
H, W = list(map(int, input().split()))
for h in range(1, H):
o1 = (H - h) // 2 * W
o2 = (H - h) * W - o1
a = [h * W, o1, o2]
ans = min(ans, max(a) - min(a))
o1 = W // 2 * (H - h)
o2 = (H - h) * W - o1
a = [h * W, o1, o2]... | false | 47.826087 | [
"+ ans = float(\"inf\")",
"- if H * W % 3 == 0:",
"- return 0",
"- if H % 2 == 0 and W % 2 == 0:",
"- return min(H // 2, W // 2)",
"- if H % 2 == 0:",
"- return min([H // 2, H // 3 * 2 + W // 2 + 1 - min(H // 3, W // 2), W])",
"- if W % 2 == 0:",
"- return ... | false | 0.04414 | 0.04385 | 1.006628 | [
"s470775324",
"s873100315"
] |
u102461423 | p03724 | python | s598650512 | s770142544 | 191 | 149 | 21,936 | 39,256 | Accepted | Accepted | 21.99 | import sys
input = sys.stdin.readline
N,M = list(map(int,input().split()))
AB = [[int(x) for x in input().split()] for _ in range(M)]
# (x,y)をすることは、(1,x),(1,y)とすることと同じ
counter = [0] * (N+1)
for x,y in AB:
counter[x] += 1
counter[y] += 1
answer = 'NO' if any(x&1 for x in counter) else 'YES'
p... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
nums = np.array(read().split(), np.int32)[2:]
cond = np.all(np.bincount(nums) % 2 == 0)
print(('YES' if cond else 'NO')) | 16 | 11 | 326 | 266 | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(M)]
# (x,y)をすることは、(1,x),(1,y)とすることと同じ
counter = [0] * (N + 1)
for x, y in AB:
counter[x] += 1
counter[y] += 1
answer = "NO" if any(x & 1 for x in counter) else "YES"
print(answer)... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
nums = np.array(read().split(), np.int32)[2:]
cond = np.all(np.bincount(nums) % 2 == 0)
print(("YES" if cond else "NO"))
| false | 31.25 | [
"+import numpy as np",
"-input = sys.stdin.readline",
"-N, M = list(map(int, input().split()))",
"-AB = [[int(x) for x in input().split()] for _ in range(M)]",
"-# (x,y)をすることは、(1,x),(1,y)とすることと同じ",
"-counter = [0] * (N + 1)",
"-for x, y in AB:",
"- counter[x] += 1",
"- counter[y] += 1",
"-an... | false | 0.040905 | 0.353186 | 0.115818 | [
"s598650512",
"s770142544"
] |
u106095117 | p02682 | python | s572284690 | s518006578 | 26 | 20 | 9,204 | 9,104 | Accepted | Accepted | 23.08 |
A, B, C, K = list(map(int, input().split()))
sum = 0
if A <= K:
K -= A
sum += 1 * A
elif K > 0:
sum += 1 * K
K = 0
if B <= K:
K -= B
elif K > 0:
K = 0
if C <= K:
K -= C
sum -= 1 * C
elif K > 0:
sum -= 1 * K
print(sum) | a, b, c, k = list(map(int, input().split()))
if k <= a:
print(k)
elif k <= a + b:
print(a)
else:
print((a - (k - (a + b))))
| 19 | 8 | 266 | 136 | A, B, C, K = list(map(int, input().split()))
sum = 0
if A <= K:
K -= A
sum += 1 * A
elif K > 0:
sum += 1 * K
K = 0
if B <= K:
K -= B
elif K > 0:
K = 0
if C <= K:
K -= C
sum -= 1 * C
elif K > 0:
sum -= 1 * K
print(sum)
| a, b, c, k = list(map(int, input().split()))
if k <= a:
print(k)
elif k <= a + b:
print(a)
else:
print((a - (k - (a + b))))
| false | 57.894737 | [
"-A, B, C, K = list(map(int, input().split()))",
"-sum = 0",
"-if A <= K:",
"- K -= A",
"- sum += 1 * A",
"-elif K > 0:",
"- sum += 1 * K",
"- K = 0",
"-if B <= K:",
"- K -= B",
"-elif K > 0:",
"- K = 0",
"-if C <= K:",
"- K -= C",
"- sum -= 1 * C",
"-elif K > 0... | false | 0.036734 | 0.046454 | 0.790745 | [
"s572284690",
"s518006578"
] |
u116038906 | p02714 | python | s712320704 | s609558671 | 1,224 | 973 | 9,252 | 9,312 | Accepted | Accepted | 20.51 | # 初期入力
N= int(eval(input()))
S =eval(input())
#
R_index=[]
G_index=[]
B_index=[]
for i,v in enumerate(S):
if v =="R":
R_index.append(i)
if v =="G":
G_index.append(i)
if v =="B":
B_index.append(i)
# 例 R_index各要素から等距離離れたところに左にG、右にBがあればOK
R_B =[]
B_G =[]
count_ij_... | # 初期入力
N= int(eval(input()))
S =input().strip()
# RGBの各index
R =set([i for i, x in enumerate(S) if x == 'R'])
G =set([i for i, x in enumerate(S) if x == 'G'])
B =set([i for i, x in enumerate(S) if x == 'B'])
count =0
rgb =[]
for i in R:
for j in G:
k1 =j +(j -i)
if k1 in B: #inはlis... | 47 | 32 | 1,162 | 637 | # 初期入力
N = int(eval(input()))
S = eval(input())
#
R_index = []
G_index = []
B_index = []
for i, v in enumerate(S):
if v == "R":
R_index.append(i)
if v == "G":
G_index.append(i)
if v == "B":
B_index.append(i)
# 例 R_index各要素から等距離離れたところに左にG、右にBがあればOK
R_B = []
B_G = []
count_ij_jk_onaji ... | # 初期入力
N = int(eval(input()))
S = input().strip()
# RGBの各index
R = set([i for i, x in enumerate(S) if x == "R"])
G = set([i for i, x in enumerate(S) if x == "G"])
B = set([i for i, x in enumerate(S) if x == "B"])
count = 0
rgb = []
for i in R:
for j in G:
k1 = j + (j - i)
if k1 in B: # inはlistよりset... | false | 31.914894 | [
"-S = eval(input())",
"-#",
"-R_index = []",
"-G_index = []",
"-B_index = []",
"-for i, v in enumerate(S):",
"- if v == \"R\":",
"- R_index.append(i)",
"- if v == \"G\":",
"- G_index.append(i)",
"- if v == \"B\":",
"- B_index.append(i)",
"-# 例 R_index各要素から等距離離れた... | false | 0.101218 | 0.044016 | 2.299606 | [
"s712320704",
"s609558671"
] |
u879870653 | p03634 | python | s538391165 | s332595378 | 1,532 | 752 | 137,932 | 140,492 | Accepted | Accepted | 50.91 | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
T = [[] for _ in range(N+1)]
for _ in range(N-1) :
a,b,c = list(map(int,input().split()))
T[a].append([b,c])
T[b].append([a,c])
Q,K = list(map(int,input().split()))
dist = [None]*(N+1)
def dfs(now,d) :
dist[now] = d
... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(input())
T = [[] for _ in range(N+1)]
for _ in range(N-1) :
a,b,c = map(int,input().split())
T[a].append([b,c])
T[b].append([a,c])
Q,K = map(int,input().split())
dist = [None]*(N+1)
def dfs(now,d) :
dist... | 28 | 35 | 508 | 576 | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
T = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = list(map(int, input().split()))
T[a].append([b, c])
T[b].append([a, c])
Q, K = list(map(int, input().split()))
dist = [None] * (N + 1)
def dfs(now, d):
dist[now] = d
for ... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(input())
T = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = map(int, input().split())
T[a].append([b, c])
T[b].append([a, c])
Q, K = map(int, input().split())
dist = [None] * (N + 1)
def dfs(now, d):
dist[now] = d... | false | 20 | [
"-N = int(eval(input()))",
"+input = sys.stdin.readline",
"+N = int(input())",
"- a, b, c = list(map(int, input().split()))",
"+ a, b, c = map(int, input().split())",
"-Q, K = list(map(int, input().split()))",
"+Q, K = map(int, input().split())",
"-for _ in range(Q):",
"- u, v = list(map(in... | false | 0.037914 | 0.038085 | 0.995526 | [
"s538391165",
"s332595378"
] |
u781262926 | p03252 | python | s609735959 | s447795297 | 132 | 120 | 4,076 | 3,632 | Accepted | Accepted | 9.09 | from collections import defaultdict
S, T = [x.strip() for x in open(0).read().split()]
ds, dt = defaultdict(str), defaultdict(str)
ans = 'Yes'
for s, t in zip(S, T):
if not ds[s] or ds[s] == t:
ds[s] = t
else:
ans = 'No'
break
if not dt[t] or dt[t] == s:
dt[t] = ... | S, T = input().strip(), input().strip()
ds, dt = {}, {}
for s, t in zip(S, T):
if s not in ds or ds[s] == t:
ds[s] = t
else:
print('No')
exit()
if t not in dt or dt[t] == s:
dt[t] = s
else:
print('No')
exit()
print('Yes') | 17 | 15 | 384 | 300 | from collections import defaultdict
S, T = [x.strip() for x in open(0).read().split()]
ds, dt = defaultdict(str), defaultdict(str)
ans = "Yes"
for s, t in zip(S, T):
if not ds[s] or ds[s] == t:
ds[s] = t
else:
ans = "No"
break
if not dt[t] or dt[t] == s:
dt[t] = s
else:
... | S, T = input().strip(), input().strip()
ds, dt = {}, {}
for s, t in zip(S, T):
if s not in ds or ds[s] == t:
ds[s] = t
else:
print("No")
exit()
if t not in dt or dt[t] == s:
dt[t] = s
else:
print("No")
exit()
print("Yes")
| false | 11.764706 | [
"-from collections import defaultdict",
"-",
"-S, T = [x.strip() for x in open(0).read().split()]",
"-ds, dt = defaultdict(str), defaultdict(str)",
"-ans = \"Yes\"",
"+S, T = input().strip(), input().strip()",
"+ds, dt = {}, {}",
"- if not ds[s] or ds[s] == t:",
"+ if s not in ds or ds[s] == t... | false | 0.037786 | 0.036352 | 1.039466 | [
"s609735959",
"s447795297"
] |
u912237403 | p00133 | python | s184117978 | s281291582 | 20 | 10 | 4,192 | 4,192 | Accepted | Accepted | 50 | x = [list(input()) for _ in [0]*8]
for i in [1,2,3]:
x = list(zip(*x[::-1]))
print(i*90)
for e in x: print("".join(e)) | x = [input() for _ in [0] * 8]
for i in [1, 2, 3]:
x = list(zip(*x[::-1]))
print(i*90)
for e in x:
print("".join(e)) | 5 | 6 | 124 | 127 | x = [list(input()) for _ in [0] * 8]
for i in [1, 2, 3]:
x = list(zip(*x[::-1]))
print(i * 90)
for e in x:
print("".join(e))
| x = [input() for _ in [0] * 8]
for i in [1, 2, 3]:
x = list(zip(*x[::-1]))
print(i * 90)
for e in x:
print("".join(e))
| false | 16.666667 | [
"-x = [list(input()) for _ in [0] * 8]",
"+x = [input() for _ in [0] * 8]"
] | false | 0.039204 | 0.041999 | 0.933446 | [
"s184117978",
"s281291582"
] |
u456936625 | p02555 | python | s105137510 | s820515585 | 131 | 118 | 77,520 | 77,420 | Accepted | Accepted | 9.92 | # @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-09-15 19:45
# @url:
import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
from decimal import *
# region fastio
BUFSIZE = 8192
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0... | # @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-09-15 19:45
# @url:
import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
from decimal import *
# region fastio
BUFSIZE = 8192
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0... | 83 | 80 | 2,447 | 2,357 | # @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-09-15 19:45
# @url:
import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
# region fastio
BUFSIZE = 8192
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __... | # @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-09-15 19:45
# @url:
import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
# region fastio
BUFSIZE = 8192
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __... | false | 3.614458 | [
"- for j in range(3, i - 3 + 1):",
"- if i - j > 5:",
"- dp[i] += 1 + dp[i - j] % mod - 1",
"- else:",
"- dp[i] += dp[i - j] % mod",
"+ for j in range(3, i - 2):",
"+ dp[i] += dp[i - j] % mod"
] | false | 0.281408 | 0.102729 | 2.739327 | [
"s105137510",
"s820515585"
] |
u762955009 | p03112 | python | s320759183 | s908602314 | 1,840 | 1,113 | 35,360 | 35,368 | Accepted | Accepted | 39.51 | import bisect
A, B, Q = list(map(int, input().split()))
shrines = []
for i in range(A):
shrines.append(int(eval(input())))
temples = []
for i in range(B):
temples.append(int(eval(input())))
shortest_s_to_t = {}
for shrine in shrines:
index = bisect.bisect_left(temples, shrine)
if inde... | import bisect
import sys
def input():
return sys.stdin.readline()
A, B, Q = list(map(int, input().split()))
shrines = []
for i in range(A):
shrines.append(int(eval(input())))
temples = []
for i in range(B):
temples.append(int(eval(input())))
shortest_s_to_t = {}
for shrine in shrines:
... | 67 | 71 | 2,132 | 2,193 | import bisect
A, B, Q = list(map(int, input().split()))
shrines = []
for i in range(A):
shrines.append(int(eval(input())))
temples = []
for i in range(B):
temples.append(int(eval(input())))
shortest_s_to_t = {}
for shrine in shrines:
index = bisect.bisect_left(temples, shrine)
if index == 0:
di... | import bisect
import sys
def input():
return sys.stdin.readline()
A, B, Q = list(map(int, input().split()))
shrines = []
for i in range(A):
shrines.append(int(eval(input())))
temples = []
for i in range(B):
temples.append(int(eval(input())))
shortest_s_to_t = {}
for shrine in shrines:
index = bisect... | false | 5.633803 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()",
"+"
] | false | 0.038233 | 0.045227 | 0.845351 | [
"s320759183",
"s908602314"
] |
u627803856 | p02713 | python | s068020422 | s931898897 | 1,869 | 56 | 75,856 | 65,160 | Accepted | Accepted | 97 | # 3重ループでテスト
from functools import reduce
k = int(eval(input()))
def gcd(a, b):
# 最大公約数
while b:
a, b = b, a % b
return a
def gcds(*nums):
return reduce(gcd, nums)
res = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
res += gcds(a, b, c)... | from math import gcd
k = int(eval(input()))
gcd_sum = [0] * 201
res = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
gcd_sum[i] += gcd(i, j)
for a in range(1, k + 1):
for b in range(1, k + 1):
g = gcd(a, b)
res += gcd_sum[g]
print(res) | 22 | 17 | 328 | 265 | # 3重ループでテスト
from functools import reduce
k = int(eval(input()))
def gcd(a, b):
# 最大公約数
while b:
a, b = b, a % b
return a
def gcds(*nums):
return reduce(gcd, nums)
res = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
res += gcds(a, b... | from math import gcd
k = int(eval(input()))
gcd_sum = [0] * 201
res = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
gcd_sum[i] += gcd(i, j)
for a in range(1, k + 1):
for b in range(1, k + 1):
g = gcd(a, b)
res += gcd_sum[g]
print(res)
| false | 22.727273 | [
"-# 3重ループでテスト",
"-from functools import reduce",
"+from math import gcd",
"-",
"-",
"-def gcd(a, b):",
"- # 最大公約数",
"- while b:",
"- a, b = b, a % b",
"- return a",
"-",
"-",
"-def gcds(*nums):",
"- return reduce(gcd, nums)",
"-",
"-",
"+gcd_sum = [0] * 201",
"+f... | false | 0.111158 | 0.038798 | 2.865081 | [
"s068020422",
"s931898897"
] |
u899759239 | p03573 | python | s244434566 | s185790274 | 454 | 10 | 4,392 | 2,572 | Accepted | Accepted | 97.8 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
from collections import defaultdict
from math import factorial as f
from fractions import gcd as g
l = [int (i) for i in input ().split ()]
d = defaultdict (int)
for i in l: d [i] += 1
print([i for i in d if d [i] == 1][0])
| #!/usr/bin/env python
#-*- coding: utf-8 -*-
A, B, C = [int (i) for i in input ().split ()]
print(A ^ B ^ C) | 12 | 5 | 286 | 116 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import defaultdict
from math import factorial as f
from fractions import gcd as g
l = [int(i) for i in input().split()]
d = defaultdict(int)
for i in l:
d[i] += 1
print([i for i in d if d[i] == 1][0])
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
A, B, C = [int(i) for i in input().split()]
print(A ^ B ^ C)
| false | 58.333333 | [
"-from collections import defaultdict",
"-from math import factorial as f",
"-from fractions import gcd as g",
"-",
"-l = [int(i) for i in input().split()]",
"-d = defaultdict(int)",
"-for i in l:",
"- d[i] += 1",
"-print([i for i in d if d[i] == 1][0])",
"+A, B, C = [int(i) for i in input().sp... | false | 0.077102 | 0.036353 | 2.120926 | [
"s244434566",
"s185790274"
] |
u599114793 | p03014 | python | s038790294 | s244431520 | 1,980 | 1,555 | 320,008 | 287,112 | Accepted | Accepted | 21.46 | h,w = list(map(int,input().split()))
grid = []
grid_num1 = []
grid_num2 = []
for i in range(h):
lst = list(eval(input()))
lst.append("#")
grid.append(lst)
grid_num1.append([0]*w)
grid.append(["#"]*(w+1))
for j in range(w):
grid_num2.append([0]*h)
grid_t = [list(x) for x in zip(*grid)]
... | h,w = list(map(int,input().split()))
grid = []
grid_num1 = []
grid_num2 = []
for i in range(h):
lst = list(eval(input()))
lst.append("#")
grid.append(lst)
grid_num1.append([0]*w)
grid.append(["#"]*(w+1))
for j in range(w):
grid_num2.append([0]*h)
grid_t = [list(x) for x in zip(*grid)]
... | 54 | 54 | 1,406 | 1,408 | h, w = list(map(int, input().split()))
grid = []
grid_num1 = []
grid_num2 = []
for i in range(h):
lst = list(eval(input()))
lst.append("#")
grid.append(lst)
grid_num1.append([0] * w)
grid.append(["#"] * (w + 1))
for j in range(w):
grid_num2.append([0] * h)
grid_t = [list(x) for x in zip(*grid)]
for ... | h, w = list(map(int, input().split()))
grid = []
grid_num1 = []
grid_num2 = []
for i in range(h):
lst = list(eval(input()))
lst.append("#")
grid.append(lst)
grid_num1.append([0] * w)
grid.append(["#"] * (w + 1))
for j in range(w):
grid_num2.append([0] * h)
grid_t = [list(x) for x in zip(*grid)]
for ... | false | 0 | [
"-grid_num2 = [list(x) for x in zip(*grid_num2)]",
"+# grid_num2 = [list(x) for x in zip(*grid_num2)]",
"- ans = max(ans, grid_num1[i][j] + grid_num2[i][j] - 1)",
"+ ans = max(ans, grid_num1[i][j] + grid_num2[j][i] - 1)"
] | false | 0.044201 | 0.099165 | 0.445738 | [
"s038790294",
"s244431520"
] |
u562935282 | p03946 | python | s087645927 | s339986470 | 177 | 77 | 25,252 | 14,680 | Accepted | Accepted | 56.5 | n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
vm = a[n - 1]#数列を右から見た時の最大値
d = dict()
for i in range(n - 2, -1, -1):
if a[i] > vm:
vm = a[i]
else:
df = vm - a[i]
d[df] = d.get(df, 0) + 1
df_cnt = sorted(list(d.items()), key = lambda x:x[0], rever... | n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
vm = a[n - 1]#数列を右から見た時の最大値
dfm = 0
cnt = 0
for i in range(n - 2, -1, -1):
if a[i] > vm:
vm = a[i]
else:
df = vm - a[i]
if dfm < df:
dfm = df
cnt = 1
elif dfm == df:
... | 15 | 18 | 353 | 349 | n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
vm = a[n - 1] # 数列を右から見た時の最大値
d = dict()
for i in range(n - 2, -1, -1):
if a[i] > vm:
vm = a[i]
else:
df = vm - a[i]
d[df] = d.get(df, 0) + 1
df_cnt = sorted(list(d.items()), key=lambda x: x[0], reverse=True) # ... | n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
vm = a[n - 1] # 数列を右から見た時の最大値
dfm = 0
cnt = 0
for i in range(n - 2, -1, -1):
if a[i] > vm:
vm = a[i]
else:
df = vm - a[i]
if dfm < df:
dfm = df
cnt = 1
elif dfm == df:
... | false | 16.666667 | [
"-d = dict()",
"+dfm = 0",
"+cnt = 0",
"- d[df] = d.get(df, 0) + 1",
"-df_cnt = sorted(list(d.items()), key=lambda x: x[0], reverse=True) # 差が大きい方から並べる",
"-print((df_cnt[0][1]))",
"+ if dfm < df:",
"+ dfm = df",
"+ cnt = 1",
"+ elif dfm == df:",
"+ ... | false | 0.079492 | 0.081682 | 0.973184 | [
"s087645927",
"s339986470"
] |
u623349537 | p03035 | python | s041697690 | s324116961 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | A, B = list(map(int, input().split()))
if A >= 13:
print(B)
elif A >= 6:
print((B // 2))
else:
print((0)) | A, B = list(map(int, input().split()))
if A <= 5:
print((0))
elif A > 12:
print(B)
else:
print((B // 2)) | 7 | 7 | 113 | 112 | A, B = list(map(int, input().split()))
if A >= 13:
print(B)
elif A >= 6:
print((B // 2))
else:
print((0))
| A, B = list(map(int, input().split()))
if A <= 5:
print((0))
elif A > 12:
print(B)
else:
print((B // 2))
| false | 0 | [
"-if A >= 13:",
"+if A <= 5:",
"+ print((0))",
"+elif A > 12:",
"-elif A >= 6:",
"+else:",
"-else:",
"- print((0))"
] | false | 0.043058 | 0.044478 | 0.968087 | [
"s041697690",
"s324116961"
] |
u780962115 | p02763 | python | s681862221 | s177905099 | 1,234 | 1,068 | 604,896 | 392,196 | Accepted | Accepted | 13.45 | class SegTree():
def __init__(self, lists, function, basement):
self.n = len(lists)
self.K = (self.n-1).bit_length()
self.f = function
self.b = basement
self.seg = [basement]*2**(self.K+1)
self.lazy_seg = [basement]*2**(self.K+1)
X = 2**self.K
... | import sys
class SegTree():
def __init__(self, lists, function, basement):
self.n = len(lists)
self.K = (self.n-1).bit_length()
self.f = function
self.b = basement
self.seg = [basement]*2**(self.K+1)
X = 2**self.K
for i, v in enumerate(lists):
... | 71 | 73 | 1,870 | 1,918 | class SegTree:
def __init__(self, lists, function, basement):
self.n = len(lists)
self.K = (self.n - 1).bit_length()
self.f = function
self.b = basement
self.seg = [basement] * 2 ** (self.K + 1)
self.lazy_seg = [basement] * 2 ** (self.K + 1)
X = 2**self.K
... | import sys
class SegTree:
def __init__(self, lists, function, basement):
self.n = len(lists)
self.K = (self.n - 1).bit_length()
self.f = function
self.b = basement
self.seg = [basement] * 2 ** (self.K + 1)
X = 2**self.K
for i, v in enumerate(lists):
... | false | 2.739726 | [
"+import sys",
"+",
"+",
"- self.lazy_seg = [basement] * 2 ** (self.K + 1)",
"- # 0-indexでa[k]の値をvalueに変更",
"- # 0-index で[L,R)",
"-import sys",
"+input = sys.stdin.readline",
"-input = sys.stdin.readline",
"-N = int(eval(input()))",
"-S = list(eval(input()))",
"-Q = int(e... | false | 0.047919 | 0.040688 | 1.177714 | [
"s681862221",
"s177905099"
] |
u780565479 | p03085 | python | s126049719 | s512561145 | 178 | 19 | 38,256 | 2,940 | Accepted | Accepted | 89.33 | print((*["A" if x=="T" else "T" if x=="A" else "C" if x=="G" else "G" for x in str(eval(input()))])) | print(({"A":"T","T":"A","G":"C","C":"G"}[eval(input())])) | 1 | 1 | 92 | 49 | print(
(
*[
"A" if x == "T" else "T" if x == "A" else "C" if x == "G" else "G"
for x in str(eval(input()))
]
)
)
| print(({"A": "T", "T": "A", "G": "C", "C": "G"}[eval(input())]))
| false | 0 | [
"-print(",
"- (",
"- *[",
"- \"A\" if x == \"T\" else \"T\" if x == \"A\" else \"C\" if x == \"G\" else \"G\"",
"- for x in str(eval(input()))",
"- ]",
"- )",
"-)",
"+print(({\"A\": \"T\", \"T\": \"A\", \"G\": \"C\", \"C\": \"G\"}[eval(input())]))"
] | false | 0.125409 | 0.040208 | 3.118996 | [
"s126049719",
"s512561145"
] |
u761320129 | p03657 | python | s717396757 | s067694366 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | A,B = list(map(int, input().split()))
if A%3 == 0 or B%3==0 or (A+B)%3 ==0:
print('Possible')
else:
print('Impossible')
| A,B = list(map(int,input().split()))
print(('Possible' if A%3==0 or B%3==0 or (A+B)%3==0 else 'Impossible')) | 5 | 2 | 126 | 101 | A, B = list(map(int, input().split()))
if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
print("Possible")
else:
print("Impossible")
| A, B = list(map(int, input().split()))
print(("Possible" if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0 else "Impossible"))
| false | 60 | [
"-if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:",
"- print(\"Possible\")",
"-else:",
"- print(\"Impossible\")",
"+print((\"Possible\" if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0 else \"Impossible\"))"
] | false | 0.048185 | 0.047613 | 1.011999 | [
"s717396757",
"s067694366"
] |
u948524308 | p02939 | python | s448936022 | s179019664 | 154 | 110 | 3,500 | 4,840 | Accepted | Accepted | 28.57 | S = eval(input())
S0 = S[-1]
i = -1
j = 0
ans = 1
while i > -len(S) + 1:
if S0 != S[i - (j + 1):i]:
S0 = S[i - (j + 1):i]
ans = ans + 1
i = i - (1 + j)
j = 0
else:
j = j + 1
if i == -len(S) + 1 and S[-len(S)] != S0:
ans = ans + 1
print(ans) | S = list(eval(input()))
temp1 = S[0]
temp2 = ""
i = 1
c = 1
while i < len(S):
temp2 += S[i]
if temp1 != temp2:
c += 1
temp1 = temp2
temp2 = ""
i += 1
print(c)
| 19 | 15 | 307 | 205 | S = eval(input())
S0 = S[-1]
i = -1
j = 0
ans = 1
while i > -len(S) + 1:
if S0 != S[i - (j + 1) : i]:
S0 = S[i - (j + 1) : i]
ans = ans + 1
i = i - (1 + j)
j = 0
else:
j = j + 1
if i == -len(S) + 1 and S[-len(S)] != S0:
ans = ans + 1
print(ans)
| S = list(eval(input()))
temp1 = S[0]
temp2 = ""
i = 1
c = 1
while i < len(S):
temp2 += S[i]
if temp1 != temp2:
c += 1
temp1 = temp2
temp2 = ""
i += 1
print(c)
| false | 21.052632 | [
"-S = eval(input())",
"-S0 = S[-1]",
"-i = -1",
"-j = 0",
"-ans = 1",
"-while i > -len(S) + 1:",
"- if S0 != S[i - (j + 1) : i]:",
"- S0 = S[i - (j + 1) : i]",
"- ans = ans + 1",
"- i = i - (1 + j)",
"- j = 0",
"- else:",
"- j = j + 1",
"-if i == -l... | false | 0.077691 | 0.076068 | 1.021342 | [
"s448936022",
"s179019664"
] |
u806976856 | p02982 | python | s837718617 | s300720548 | 19 | 17 | 3,316 | 3,060 | Accepted | Accepted | 10.53 | n,d=list(map(int,input().split()))
X=[]
for _ in range(n):
X.append(list(map(int,input().split())))
f=0
for i in range(n-1):
for j in range(i+1,n):
l=0
for a in range(d):
l+=(X[i][a]-X[j][a])**2
if int(l**(1/2))==l**(1/2):
f+=1
print(f) | n,d=list(map(int,input().split()))
X=[list(map(int,input().split())) for _ in range(n)]
f=0
for i in range(n-1):
for j in range(i+1,n):
l=0
for a in range(d):
l+=(X[i][a]-X[j][a])**2
if int(l**(1/2))==l**(1/2):
f+=1
print(f) | 14 | 11 | 276 | 256 | n, d = list(map(int, input().split()))
X = []
for _ in range(n):
X.append(list(map(int, input().split())))
f = 0
for i in range(n - 1):
for j in range(i + 1, n):
l = 0
for a in range(d):
l += (X[i][a] - X[j][a]) ** 2
if int(l ** (1 / 2)) == l ** (1 / 2):
f += 1
pr... | n, d = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(n)]
f = 0
for i in range(n - 1):
for j in range(i + 1, n):
l = 0
for a in range(d):
l += (X[i][a] - X[j][a]) ** 2
if int(l ** (1 / 2)) == l ** (1 / 2):
f += 1
print(f)
| false | 21.428571 | [
"-X = []",
"-for _ in range(n):",
"- X.append(list(map(int, input().split())))",
"+X = [list(map(int, input().split())) for _ in range(n)]"
] | false | 0.048738 | 0.067802 | 0.718825 | [
"s837718617",
"s300720548"
] |
u503228842 | p03043 | python | s269823676 | s200127162 | 43 | 28 | 7,064 | 3,864 | Accepted | Accepted | 34.88 | N, K = list(map(int,input().split()))
from math import ceil, log2
m_list = [ceil(log2(K/(n+1))) if n+1<K else 0 for n in range(N)]
#print(m_list) #各nに対し勝つのに必要な表の数
#
# m_list = []
# for n in range(N):
# if n+1 >=
def calc_prob(x):
return (1/2)**x
prob_list = list(map(calc_prob,m_list))
# Kより大き... | N, K = list(map(int,input().split()))
from math import ceil, log2
m_list = [(1/2)**ceil(log2(K/(n+1))) if n+1<K else 1 for n in range(N)]
#print(m_list) #各nに対し勝つのに必要な表の数
print((sum(m_list)/N)) | 18 | 5 | 376 | 188 | N, K = list(map(int, input().split()))
from math import ceil, log2
m_list = [ceil(log2(K / (n + 1))) if n + 1 < K else 0 for n in range(N)]
# print(m_list) #各nに対し勝つのに必要な表の数
#
# m_list = []
# for n in range(N):
# if n+1 >=
def calc_prob(x):
return (1 / 2) ** x
prob_list = list(map(calc_prob, m_list))
# Kより大きい... | N, K = list(map(int, input().split()))
from math import ceil, log2
m_list = [(1 / 2) ** ceil(log2(K / (n + 1))) if n + 1 < K else 1 for n in range(N)]
# print(m_list) #各nに対し勝つのに必要な表の数
print((sum(m_list) / N))
| false | 72.222222 | [
"-m_list = [ceil(log2(K / (n + 1))) if n + 1 < K else 0 for n in range(N)]",
"+m_list = [(1 / 2) ** ceil(log2(K / (n + 1))) if n + 1 < K else 1 for n in range(N)]",
"-#",
"-# m_list = []",
"-# for n in range(N):",
"-# if n+1 >=",
"-def calc_prob(x):",
"- return (1 / 2) ** x",
"-",
"-",
"-... | false | 0.1851 | 0.05564 | 3.326734 | [
"s269823676",
"s200127162"
] |
u864202285 | p02727 | python | s234978414 | s999644765 | 322 | 274 | 21,552 | 23,008 | Accepted | Accepted | 14.91 | X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int,input().split())), reverse=True)[:X]
q = sorted(list(map(int,input().split())), reverse=True)[:Y]
r = sorted(list(map(int,input().split())), reverse=True)
colored_p = []
colored_q = []
for i in r:
p_min = p[len(p) - 1] if len(p)... | from collections import deque
X, Y, A, B, C = list(map(int, input().split()))
p = deque(sorted(list(map(int,input().split())))[-X:])
q = deque(sorted(list(map(int,input().split())))[-Y:])
r = sorted(list(map(int,input().split())), reverse=True)
for i in r:
p_min = p[0]
q_min = q[0]
if p_m... | 29 | 26 | 859 | 631 | X, Y, A, B, C = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse=True)[:X]
q = sorted(list(map(int, input().split())), reverse=True)[:Y]
r = sorted(list(map(int, input().split())), reverse=True)
colored_p = []
colored_q = []
for i in r:
p_min = p[len(p) - 1] if len(p) > 0 else col... | from collections import deque
X, Y, A, B, C = list(map(int, input().split()))
p = deque(sorted(list(map(int, input().split())))[-X:])
q = deque(sorted(list(map(int, input().split())))[-Y:])
r = sorted(list(map(int, input().split())), reverse=True)
for i in r:
p_min = p[0]
q_min = q[0]
if p_min > i and q_mi... | false | 10.344828 | [
"+from collections import deque",
"+",
"-p = sorted(list(map(int, input().split())), reverse=True)[:X]",
"-q = sorted(list(map(int, input().split())), reverse=True)[:Y]",
"+p = deque(sorted(list(map(int, input().split())))[-X:])",
"+q = deque(sorted(list(map(int, input().split())))[-Y:])",
"-colored_p =... | false | 0.078191 | 0.084817 | 0.921885 | [
"s234978414",
"s999644765"
] |
u022407960 | p02303 | python | s495201612 | s644194659 | 2,660 | 2,370 | 23,592 | 23,480 | Accepted | Accepted | 10.9 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3
0.0 0.0
2.0 0.0
1.0 1.0
output:
1.41421356237
"""
import math
import sys
from operator import attrgetter
class ClosestPair(object):
def __init__(self, ):
"""
Init closest pairs points set.
"""
_in... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3
0.0 0.0
2.0 0.0
1.0 1.0
output:
1.41421356237
"""
import sys
from operator import attrgetter
class ClosestPair(object):
def __init__(self, ):
"""
Init closest pairs points set.
"""
_input = sys.std... | 67 | 64 | 1,762 | 1,549 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3
0.0 0.0
2.0 0.0
1.0 1.0
output:
1.41421356237
"""
import math
import sys
from operator import attrgetter
class ClosestPair(object):
def __init__(
self,
):
"""
Init closest pairs points set.
"""
_input = sys.stdi... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3
0.0 0.0
2.0 0.0
1.0 1.0
output:
1.41421356237
"""
import sys
from operator import attrgetter
class ClosestPair(object):
def __init__(
self,
):
"""
Init closest pairs points set.
"""
_input = sys.stdin.readlines(... | false | 4.477612 | [
"-import math",
"+ # pre_sort by axis_X",
"- # assert len(p_list) == p_num",
"- # print(p_list)",
"- self.closest_pair(array[:mid], mid).real,",
"- self.closest_pair(array[mid:], array_length - mid).real,",
"+ self.closest_pair(array[:mid], mid),",
... | false | 0.046984 | 0.043697 | 1.075237 | [
"s495201612",
"s644194659"
] |
u089230684 | p02607 | python | s861308800 | s832386863 | 61 | 32 | 61,736 | 9,136 | Accepted | Accepted | 47.54 | n = int(eval(input()))
S = list(map(int, input().split()))
ans = 0
for i in range(0, n, 2):
if i%2 == 0 and S[i]%2 == 1:
ans += 1
print(ans)
| n = eval(input())
N = int(n)
list1 = input().split(" ")
Numbers = list1[:N]
count = 0
for i in range(0, N):
if (i+1) % 2 != 0:
if int(Numbers[i]) % 2 != 0:
count += 1
else:
continue
print(count)
| 7 | 14 | 153 | 240 | n = int(eval(input()))
S = list(map(int, input().split()))
ans = 0
for i in range(0, n, 2):
if i % 2 == 0 and S[i] % 2 == 1:
ans += 1
print(ans)
| n = eval(input())
N = int(n)
list1 = input().split(" ")
Numbers = list1[:N]
count = 0
for i in range(0, N):
if (i + 1) % 2 != 0:
if int(Numbers[i]) % 2 != 0:
count += 1
else:
continue
print(count)
| false | 50 | [
"-n = int(eval(input()))",
"-S = list(map(int, input().split()))",
"-ans = 0",
"-for i in range(0, n, 2):",
"- if i % 2 == 0 and S[i] % 2 == 1:",
"- ans += 1",
"-print(ans)",
"+n = eval(input())",
"+N = int(n)",
"+list1 = input().split(\" \")",
"+Numbers = list1[:N]",
"+count = 0",
... | false | 0.043636 | 0.03757 | 1.161448 | [
"s861308800",
"s832386863"
] |
u546285759 | p00423 | python | s648465711 | s156994982 | 120 | 110 | 7,688 | 7,576 | Accepted | Accepted | 8.33 | fin_a = []
fin_b = []
while True:
x = int(eval(input()))
if x == 0:
break
a = 0
b = 0
for i in range(x):
l = list(map(int, input().split()))
if l[0] > l[1]:
a += l[0] + l[1]
elif l[0] < l[1]:
b += l[0] + l[1]
else:
... | while True:
n = int(eval(input()))
score = [0, 0]
if n == 0:
break
for _ in range(n):
A, B = list(map(int, input().split()))
if A == B:
score[0], score[1] = score[0]+A, score[1]+B
else:
score[A<B] += A+B
print((*score)) | 22 | 12 | 449 | 292 | fin_a = []
fin_b = []
while True:
x = int(eval(input()))
if x == 0:
break
a = 0
b = 0
for i in range(x):
l = list(map(int, input().split()))
if l[0] > l[1]:
a += l[0] + l[1]
elif l[0] < l[1]:
b += l[0] + l[1]
else:
a += l[0]... | while True:
n = int(eval(input()))
score = [0, 0]
if n == 0:
break
for _ in range(n):
A, B = list(map(int, input().split()))
if A == B:
score[0], score[1] = score[0] + A, score[1] + B
else:
score[A < B] += A + B
print((*score))
| false | 45.454545 | [
"-fin_a = []",
"-fin_b = []",
"- x = int(eval(input()))",
"- if x == 0:",
"+ n = int(eval(input()))",
"+ score = [0, 0]",
"+ if n == 0:",
"- a = 0",
"- b = 0",
"- for i in range(x):",
"- l = list(map(int, input().split()))",
"- if l[0] > l[1]:",
"- ... | false | 0.036047 | 0.03638 | 0.990864 | [
"s648465711",
"s156994982"
] |
u729133443 | p02614 | python | s069129460 | s539684030 | 123 | 101 | 9,160 | 9,192 | Accepted | Accepted | 17.89 | h,*c=open(0)
h,w,k=list(map(int,h.split()))
print((sum(k==sum(y//2**w>>z//w&y%2**w>>z%w&1and'.'>c[z//w][z%w]for z in range(h*w))for y in range(1<<h+w)))) | h,*c=open(0)
h,w,k=list(map(int,h.split()))
print((sum(k==sum(y>>w>>z//w&y%2**w>>z%w&1and'.'>c[z//w][z%w]for z in range(h*w))for y in range(1<<h+w)))) | 3 | 3 | 147 | 144 | h, *c = open(0)
h, w, k = list(map(int, h.split()))
print(
(
sum(
k
== sum(
y // 2**w >> z // w & y % 2**w >> z % w & 1
and "." > c[z // w][z % w]
for z in range(h * w)
)
for y in range(1 << h + w)
)
... | h, *c = open(0)
h, w, k = list(map(int, h.split()))
print(
(
sum(
k
== sum(
y >> w >> z // w & y % 2**w >> z % w & 1 and "." > c[z // w][z % w]
for z in range(h * w)
)
for y in range(1 << h + w)
)
)
)
| false | 0 | [
"- y // 2**w >> z // w & y % 2**w >> z % w & 1",
"- and \".\" > c[z // w][z % w]",
"+ y >> w >> z // w & y % 2**w >> z % w & 1 and \".\" > c[z // w][z % w]"
] | false | 0.044915 | 0.044884 | 1.000697 | [
"s069129460",
"s539684030"
] |
u809898133 | p03078 | python | s680288468 | s004217342 | 992 | 723 | 147,948 | 48,092 | Accepted | Accepted | 27.12 | x,y,z,k = list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
tem = []
for i in range(x):
for j in range(y):
tem.append(a[i]+b[j])
tem.sort()
if(x*y > k):
tem2 = tem[x*y-k-1:]
else:
tem2 = tem
ans = []... | x,y,z,k = list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
def judge(p):
cnt = 0
for i in range(x):
for j in range(y):
for kk in ra... | 26 | 46 | 493 | 993 | x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
tem = []
for i in range(x):
for j in range(y):
tem.append(a[i] + b[j])
tem.sort()
if x * y > k:
tem2 = tem[x * y - k - 1 :]
else:
tem2 = tem
ans = ... | x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
def judge(p):
cnt = 0
for i in range(x):
for j in range(y):
for kk in rang... | false | 43.478261 | [
"-tem = []",
"+a.sort(reverse=True)",
"+b.sort(reverse=True)",
"+c.sort(reverse=True)",
"+",
"+",
"+def judge(p):",
"+ cnt = 0",
"+ for i in range(x):",
"+ for j in range(y):",
"+ for kk in range(z):",
"+ if a[i] + b[j] + c[kk] < p:",
"+ ... | false | 0.035021 | 0.035302 | 0.992045 | [
"s680288468",
"s004217342"
] |
u837673618 | p02725 | python | s762748236 | s727596351 | 166 | 84 | 18,672 | 19,140 | Accepted | Accepted | 49.4 | from itertools import chain
K, N = list(map(int, input().split()))
S = 0
M = 0
A = list(map(int, input().split()))
prev = next(A)
for a in chain(A, [prev+K]):
d = a - prev
S += d
M = max(M, d)
prev = a
print((S-M)) | from itertools import *
K, N = list(map(int, input().split()))
A, B = tee(list(map(int, input().split())), 2)
first = next(B)
M = max(b-a for a, b in zip_longest(A, B, fillvalue=first+K))
print((K-M))
| 15 | 8 | 225 | 196 | from itertools import chain
K, N = list(map(int, input().split()))
S = 0
M = 0
A = list(map(int, input().split()))
prev = next(A)
for a in chain(A, [prev + K]):
d = a - prev
S += d
M = max(M, d)
prev = a
print((S - M))
| from itertools import *
K, N = list(map(int, input().split()))
A, B = tee(list(map(int, input().split())), 2)
first = next(B)
M = max(b - a for a, b in zip_longest(A, B, fillvalue=first + K))
print((K - M))
| false | 46.666667 | [
"-from itertools import chain",
"+from itertools import *",
"-S = 0",
"-M = 0",
"-A = list(map(int, input().split()))",
"-prev = next(A)",
"-for a in chain(A, [prev + K]):",
"- d = a - prev",
"- S += d",
"- M = max(M, d)",
"- prev = a",
"-print((S - M))",
"+A, B = tee(list(map(in... | false | 0.035871 | 0.040411 | 0.887649 | [
"s762748236",
"s727596351"
] |
u554096168 | p03127 | python | s927356251 | s468940816 | 193 | 94 | 92,684 | 16,244 | Accepted | Accepted | 51.3 | import sys
import fractions
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7
N = INT()
A = LIST()
def gcd_all(n):
if len(n) == 1:
return n[0]
tail ... | import sys, fractions
sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ans = A[0]
for i in range(1, N):
ans = fractions.gcd(ans, A[i])
print(ans)
| 21 | 14 | 391 | 232 | import sys
import fractions
sys.setrecursionlimit(10**6)
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def LIST():
return [int(x) for x in input().split()]
MOD = 10**9 + 7
N = INT()
A = LIST()
def gcd_all(n):
if len(n) == 1:
return n[0]
tail... | import sys, fractions
sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
ans = A[0]
for i in range(1, N):
ans = fractions.gcd(ans, A[i])
print(ans)
| false | 33.333333 | [
"-import sys",
"-import fractions",
"+import sys, fractions",
"-sys.setrecursionlimit(10**6)",
"-",
"-",
"-def input():",
"- return sys.stdin.readline().strip()",
"-",
"-",
"-def INT():",
"- return int(eval(input()))",
"-",
"-",
"-def LIST():",
"- return [int(x) for x in input... | false | 0.046005 | 0.045048 | 1.021238 | [
"s927356251",
"s468940816"
] |
u254871849 | p02720 | python | s802951701 | s316412687 | 80 | 54 | 9,048 | 6,180 | Accepted | Accepted | 32.5 | import sys
from string import digits
k = int(sys.stdin.readline().rstrip())
def main():
if k <= 9:
print(k)
return
res = list(digits[1:])
r = k - 9
nex = []
while True:
for n in res:
o = ord(n[-1])
for i in range(-1, 2):
... | import sys
k = int(sys.stdin.readline().rstrip())
def main(k):
if k <= 9:
print(k)
return
res = list(range(1, 10))
k -= 9
while True:
nex = []
for n in res:
r = n % 10
n *= 10
for i in range(-1, 2):
if ... | 28 | 26 | 626 | 579 | import sys
from string import digits
k = int(sys.stdin.readline().rstrip())
def main():
if k <= 9:
print(k)
return
res = list(digits[1:])
r = k - 9
nex = []
while True:
for n in res:
o = ord(n[-1])
for i in range(-1, 2):
d = chr(o + ... | import sys
k = int(sys.stdin.readline().rstrip())
def main(k):
if k <= 9:
print(k)
return
res = list(range(1, 10))
k -= 9
while True:
nex = []
for n in res:
r = n % 10
n *= 10
for i in range(-1, 2):
if 0 <= r + i <= 9... | false | 7.142857 | [
"-from string import digits",
"-def main():",
"+def main(k):",
"- res = list(digits[1:])",
"- r = k - 9",
"- nex = []",
"+ res = list(range(1, 10))",
"+ k -= 9",
"+ nex = []",
"- o = ord(n[-1])",
"+ r = n % 10",
"+ n *= 10",
"- ... | false | 0.044635 | 0.05054 | 0.883158 | [
"s802951701",
"s316412687"
] |
u140191608 | p02706 | python | s404964837 | s203750386 | 23 | 21 | 10,188 | 10,044 | Accepted | Accepted | 8.7 | N , M = (list(map(int , input().split())))
A = list(map(int , input().split()))
ans = N - sum(A)
if ans < 0:
print((-1))
else:
print(ans) | N , M = (list(map(int , input().split())))
A = list(map(int , input().split()))
a = sum(A)
if (N-a)<0:
print((-1))
else:
print((N-a)) | 7 | 7 | 143 | 133 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = N - sum(A)
if ans < 0:
print((-1))
else:
print(ans)
| N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
a = sum(A)
if (N - a) < 0:
print((-1))
else:
print((N - a))
| false | 0 | [
"-ans = N - sum(A)",
"-if ans < 0:",
"+a = sum(A)",
"+if (N - a) < 0:",
"- print(ans)",
"+ print((N - a))"
] | false | 0.038897 | 0.044014 | 0.883746 | [
"s404964837",
"s203750386"
] |
u934442292 | p03032 | python | s932295351 | s079897721 | 44 | 32 | 3,064 | 9,132 | Accepted | Accepted | 27.27 | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
_V = V[::-1]
ans = 0
for k in range(K + 1):
n_pop = min(k, N)
n_push = K - n_pop
for i in range(n_pop + 1):
l, r = i, n_... | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = -float("inf")
for t in range(min(N, K) + 1):
s = K - t
for l in range(t + 1):
r = t - l
gem = V[:l]
ge... | 32 | 30 | 671 | 654 | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
_V = V[::-1]
ans = 0
for k in range(K + 1):
n_pop = min(k, N)
n_push = K - n_pop
for i in range(n_pop + 1):
l, r = i, n_pop - i
... | import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = -float("inf")
for t in range(min(N, K) + 1):
s = K - t
for l in range(t + 1):
r = t - l
gem = V[:l]
gem += V[-r:] if r... | false | 6.25 | [
"- _V = V[::-1]",
"- ans = 0",
"- for k in range(K + 1):",
"- n_pop = min(k, N)",
"- n_push = K - n_pop",
"- for i in range(n_pop + 1):",
"- l, r = i, n_pop - i",
"- L = V[:l] + _V[:r]",
"- L.sort()",
"- for j in range(min(n... | false | 0.035692 | 0.034603 | 1.031454 | [
"s932295351",
"s079897721"
] |
u708255304 | p02862 | python | s395271442 | s218598165 | 722 | 257 | 82,464 | 62,320 | Accepted | Accepted | 64.4 | # 階乗は英語でfactrial, ifacは階乗に対する逆元
def cmb(n, k, mod, fac, ifac):
# nCkを求める
k = min(k, n-k)
return fac[n] * ifac[k] * ifac[n-k] % mod
def make_tables(mod, n): # (mod mod)の世界における割り算に従ってテーブルを作る
# 階乗, 階乗に対する逆元のテーブルを作成する
fac = [1, 1] # 階乗デーブル
ifac = [1, 1] # 階乗に対する逆元のテーブル
inverse = ... | # 二項係数を"やるだけ"にしてくれるライブラリ
from collections import Counter
MAX = 1000010
MOD = 10**9+7
factrial = [0]*MAX
inverse = [0]*MAX
factrial_inverse = [0]*MAX
# テーブルを作る前処理
def COMinit():
global factrial, inverse, factrial_inverse
factrial[0] = 1
factrial[1] = 1
inverse[1] = 1
factrial_inverse... | 33 | 48 | 842 | 1,049 | # 階乗は英語でfactrial, ifacは階乗に対する逆元
def cmb(n, k, mod, fac, ifac):
# nCkを求める
k = min(k, n - k)
return fac[n] * ifac[k] * ifac[n - k] % mod
def make_tables(mod, n): # (mod mod)の世界における割り算に従ってテーブルを作る
# 階乗, 階乗に対する逆元のテーブルを作成する
fac = [1, 1] # 階乗デーブル
ifac = [1, 1] # 階乗に対する逆元のテーブル
inverse = [0, 1] ... | # 二項係数を"やるだけ"にしてくれるライブラリ
from collections import Counter
MAX = 1000010
MOD = 10**9 + 7
factrial = [0] * MAX
inverse = [0] * MAX
factrial_inverse = [0] * MAX
# テーブルを作る前処理
def COMinit():
global factrial, inverse, factrial_inverse
factrial[0] = 1
factrial[1] = 1
inverse[1] = 1
factrial_inverse[0] = 1
... | false | 31.25 | [
"-# 階乗は英語でfactrial, ifacは階乗に対する逆元",
"-def cmb(n, k, mod, fac, ifac):",
"- # nCkを求める",
"- k = min(k, n - k)",
"- return fac[n] * ifac[k] * ifac[n - k] % mod",
"+# 二項係数を\"やるだけ\"にしてくれるライブラリ",
"+from collections import Counter",
"+",
"+MAX = 1000010",
"+MOD = 10**9 + 7",
"+factrial = [0] * ... | false | 0.188779 | 1.974684 | 0.0956 | [
"s395271442",
"s218598165"
] |
u735008991 | p02861 | python | s762687791 | s156944202 | 202 | 170 | 42,588 | 38,896 | Accepted | Accepted | 15.84 | import itertools
import math
def dist(a, b):
return math.sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2)
N = int(eval(input()))
C = [tuple(map(int, input().split())) for _ in range(N)]
s = 0
for per in itertools.permutations(C):
for i in range(N-1):
s += dist(per[i], per[i+1])
print((s /... | import itertools
import math
def dist(a, b):
return math.sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2)
N = int(eval(input()))
C = [tuple(map(int, input().split())) for _ in range(N)]
s = 0
for cmb in itertools.combinations(C, 2):
s += 2 * dist(cmb[0], cmb[1]) / N
print(s)
| 17 | 16 | 352 | 292 | import itertools
import math
def dist(a, b):
return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
N = int(eval(input()))
C = [tuple(map(int, input().split())) for _ in range(N)]
s = 0
for per in itertools.permutations(C):
for i in range(N - 1):
s += dist(per[i], per[i + 1])
print((s / len(list(... | import itertools
import math
def dist(a, b):
return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
N = int(eval(input()))
C = [tuple(map(int, input().split())) for _ in range(N)]
s = 0
for cmb in itertools.combinations(C, 2):
s += 2 * dist(cmb[0], cmb[1]) / N
print(s)
| false | 5.882353 | [
"-for per in itertools.permutations(C):",
"- for i in range(N - 1):",
"- s += dist(per[i], per[i + 1])",
"-print((s / len(list(itertools.permutations(C)))))",
"+for cmb in itertools.combinations(C, 2):",
"+ s += 2 * dist(cmb[0], cmb[1]) / N",
"+print(s)"
] | false | 0.039865 | 0.12841 | 0.310452 | [
"s762687791",
"s156944202"
] |
u093739220 | p03013 | python | s573394368 | s120232779 | 452 | 173 | 460,020 | 11,884 | Accepted | Accepted | 61.73 | N, M = list(map(int, input().split(" ")))
A = {int(eval(input())) for _ in range(M)}
memo = [0] * (N + 1)
memo[0] = 0 if 0 in A else 1
memo[1] = 0 if 1 in A else 1
for i in range(2, N + 1):
if i in A:
continue
memo[i] = memo[i - 2] + memo[i - 1]
print((memo[N] % 1000000007)) | N, M = list(map(int, input().split(" ")))
A = {int(eval(input())) for _ in range(M)}
memo = [0] * (N + 1)
memo[0] = 1
memo[1] = 0 if 1 in A else 1
if N == 1:
print((memo[1]))
else:
for i in range(2, N + 1):
if i in A:
continue
memo[i] = (memo[i - 2] + memo[i - 1]) % 10... | 13 | 16 | 298 | 343 | N, M = list(map(int, input().split(" ")))
A = {int(eval(input())) for _ in range(M)}
memo = [0] * (N + 1)
memo[0] = 0 if 0 in A else 1
memo[1] = 0 if 1 in A else 1
for i in range(2, N + 1):
if i in A:
continue
memo[i] = memo[i - 2] + memo[i - 1]
print((memo[N] % 1000000007))
| N, M = list(map(int, input().split(" ")))
A = {int(eval(input())) for _ in range(M)}
memo = [0] * (N + 1)
memo[0] = 1
memo[1] = 0 if 1 in A else 1
if N == 1:
print((memo[1]))
else:
for i in range(2, N + 1):
if i in A:
continue
memo[i] = (memo[i - 2] + memo[i - 1]) % 1000000007
pr... | false | 18.75 | [
"-memo[0] = 0 if 0 in A else 1",
"+memo[0] = 1",
"-for i in range(2, N + 1):",
"- if i in A:",
"- continue",
"- memo[i] = memo[i - 2] + memo[i - 1]",
"-print((memo[N] % 1000000007))",
"+if N == 1:",
"+ print((memo[1]))",
"+else:",
"+ for i in range(2, N + 1):",
"+ if ... | false | 0.034528 | 0.035595 | 0.970017 | [
"s573394368",
"s120232779"
] |
u133936772 | p03060 | python | s797521273 | s421685948 | 31 | 24 | 9,124 | 9,096 | Accepted | Accepted | 22.58 | n=int(eval(input()))
v=[*list(map(int,input().split()))]
c=[*list(map(int,input().split()))]
print((sum(max(x-y,0) for x,y in zip(v,c)))) | eval(input())
f=lambda:list(map(int,input().split()))
print((sum(max(x-y,0) for x,y in zip(f(),f())))) | 4 | 3 | 120 | 90 | n = int(eval(input()))
v = [*list(map(int, input().split()))]
c = [*list(map(int, input().split()))]
print((sum(max(x - y, 0) for x, y in zip(v, c))))
| eval(input())
f = lambda: list(map(int, input().split()))
print((sum(max(x - y, 0) for x, y in zip(f(), f()))))
| false | 25 | [
"-n = int(eval(input()))",
"-v = [*list(map(int, input().split()))]",
"-c = [*list(map(int, input().split()))]",
"-print((sum(max(x - y, 0) for x, y in zip(v, c))))",
"+eval(input())",
"+f = lambda: list(map(int, input().split()))",
"+print((sum(max(x - y, 0) for x, y in zip(f(), f()))))"
] | false | 0.059484 | 0.041389 | 1.4372 | [
"s797521273",
"s421685948"
] |
u062691227 | p04046 | python | s152419936 | s742225886 | 193 | 178 | 91,404 | 88,896 | Accepted | Accepted | 7.77 | H, W, A, B = list(map(int, open(0).read().split()))
MOD = 10**9+7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i+1] = factorials[i] * (i + 1) % MOD
inv_factorials = list([pow(n, MOD - 2, MOD) for n in factorials])
def modcomb(m, n, mod):
ret... | H, W, A, B = list(map(int, open(0).read().split()))
MOD = 10**9+7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i+1] = factorials[i] * (i + 1) % MOD
inv_factorials = list([pow(n, MOD - 2, MOD) for n in factorials])
def modcomb(m, n, mod):
ret... | 21 | 21 | 577 | 583 | H, W, A, B = list(map(int, open(0).read().split()))
MOD = 10**9 + 7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i + 1] = factorials[i] * (i + 1) % MOD
inv_factorials = list([pow(n, MOD - 2, MOD) for n in factorials])
def modcomb(m, n, mod):
return factor... | H, W, A, B = list(map(int, open(0).read().split()))
MOD = 10**9 + 7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i + 1] = factorials[i] * (i + 1) % MOD
inv_factorials = list([pow(n, MOD - 2, MOD) for n in factorials])
def modcomb(m, n, mod):
return factor... | false | 0 | [
"- return factorials[m] * inv_factorials[n] * inv_factorials[m - n] % MOD",
"+ return factorials[m] * inv_factorials[n] % MOD * inv_factorials[m - n] % MOD"
] | false | 0.113404 | 0.110102 | 1.029989 | [
"s152419936",
"s742225886"
] |
u991156486 | p02258 | python | s402013222 | s833308005 | 570 | 480 | 13,588 | 5,608 | Accepted | Accepted | 15.79 | n = int(eval(input()))
x = []
for i in range(n):
x.append(int(eval(input())))
imin=0
imax=1
maxVal=x[imax]-x[imin]
for i in range(1,n):
if x[imin] > x[i]:
imin=i
imax=i+1
if imax > n-1:
break
dx = x[imax]-x[imin]
if maxVal < dx:
ma... | n = int(eval(input()))
maxVal = -2000000000
minVal = int(eval(input()))
for i in range(1,n):
x=int(eval(input()))
dx = x-minVal
if maxVal < dx:
maxVal = dx
if minVal > x:
minVal = x
print(maxVal)
| 24 | 11 | 459 | 220 | n = int(eval(input()))
x = []
for i in range(n):
x.append(int(eval(input())))
imin = 0
imax = 1
maxVal = x[imax] - x[imin]
for i in range(1, n):
if x[imin] > x[i]:
imin = i
imax = i + 1
if imax > n - 1:
break
dx = x[imax] - x[imin]
if maxVal < dx:
... | n = int(eval(input()))
maxVal = -2000000000
minVal = int(eval(input()))
for i in range(1, n):
x = int(eval(input()))
dx = x - minVal
if maxVal < dx:
maxVal = dx
if minVal > x:
minVal = x
print(maxVal)
| false | 54.166667 | [
"-x = []",
"-for i in range(n):",
"- x.append(int(eval(input())))",
"-imin = 0",
"-imax = 1",
"-maxVal = x[imax] - x[imin]",
"+maxVal = -2000000000",
"+minVal = int(eval(input()))",
"- if x[imin] > x[i]:",
"- imin = i",
"- imax = i + 1",
"- if imax > n - 1:",
"- ... | false | 0.077277 | 0.036912 | 2.093535 | [
"s402013222",
"s833308005"
] |
u163783894 | p03241 | python | s030405075 | s480995367 | 1,811 | 32 | 9,188 | 9,108 | Accepted | Accepted | 98.23 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode('utf-8')
def main():
N, M = in_nn()
ans = 1
inf = M // N + 1
for i in range(inf, 1,... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode('utf-8')
def make_divisors(n):
lower_divisors, upper_divisors = [], []
i = 1
while i * i <... | 25 | 36 | 461 | 770 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode("utf-8")
def main():
N, M = in_nn()
ans = 1
inf = M // N + 1
for i in range(inf, 1, -1):
if ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode("utf-8")
def make_divisors(n):
lower_divisors, upper_divisors = [], []
i = 1
while i * i <= n:
i... | false | 30.555556 | [
"+def make_divisors(n):",
"+ lower_divisors, upper_divisors = [], []",
"+ i = 1",
"+ while i * i <= n:",
"+ if n % i == 0:",
"+ lower_divisors.append(i)",
"+ if i != n // i:",
"+ upper_divisors.append(n // i)",
"+ i += 1",
"+ return lo... | false | 0.111274 | 0.053686 | 2.072675 | [
"s030405075",
"s480995367"
] |
u222668979 | p03215 | python | s093076930 | s540543032 | 1,230 | 141 | 28,824 | 107,404 | Accepted | Accepted | 88.54 | from itertools import accumulate
def main():
n, k = list(map(int, input().split()))
a = [0] + list(accumulate(list(map(int, input().split()))))
btfl = []
for i in range(0, n):
for j in range(i + 1, n + 1):
btfl.append(a[j] - a[i])
# 解説AC
ans = 0
for i in r... | from itertools import accumulate
n, k = list(map(int, input().split()))
a = [0] + list(accumulate(list(map(int, input().split()))))
btfl = []
for i in range(0, n):
for j in range(i + 1, n + 1):
btfl.append(a[j] - a[i])
# 解説AC
ans = 0
for i in range(50)[::-1]:
num, cnt = ans + pow(2, i), 0
... | 24 | 19 | 548 | 427 | from itertools import accumulate
def main():
n, k = list(map(int, input().split()))
a = [0] + list(accumulate(list(map(int, input().split()))))
btfl = []
for i in range(0, n):
for j in range(i + 1, n + 1):
btfl.append(a[j] - a[i])
# 解説AC
ans = 0
for i in range(50)[::-1]... | from itertools import accumulate
n, k = list(map(int, input().split()))
a = [0] + list(accumulate(list(map(int, input().split()))))
btfl = []
for i in range(0, n):
for j in range(i + 1, n + 1):
btfl.append(a[j] - a[i])
# 解説AC
ans = 0
for i in range(50)[::-1]:
num, cnt = ans + pow(2, i), 0
for b in ... | false | 20.833333 | [
"-",
"-def main():",
"- n, k = list(map(int, input().split()))",
"- a = [0] + list(accumulate(list(map(int, input().split()))))",
"- btfl = []",
"- for i in range(0, n):",
"- for j in range(i + 1, n + 1):",
"- btfl.append(a[j] - a[i])",
"- # 解説AC",
"- ans = 0",
... | false | 0.053658 | 0.075855 | 0.707381 | [
"s093076930",
"s540543032"
] |
u377989038 | p02959 | python | s241145447 | s148806336 | 154 | 106 | 19,228 | 19,228 | Accepted | Accepted | 31.17 | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
left = min(a[i], b[i])
ans += left
a[i] -= left
b[i] -= left
right = m... | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
tmp = 0
ans = 0
for i in range(n):
mon = max(0, a[i] - tmp)
if b[i] <= mon:
ans += b[i] + tmp
... | 23 | 28 | 441 | 545 | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
left = min(a[i], b[i])
ans += left
a[i] -= left
b[i] -= left
right = min(a[i + 1], b[... | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
tmp = 0
ans = 0
for i in range(n):
mon = max(0, a[i] - tmp)
if b[i] <= mon:
ans += b[i] + tmp
tmp = 0
... | false | 17.857143 | [
"+ tmp = 0",
"- left = min(a[i], b[i])",
"- ans += left",
"- a[i] -= left",
"- b[i] -= left",
"- right = min(a[i + 1], b[i])",
"- ans += right",
"- a[i + 1] -= right",
"+ mon = max(0, a[i] - tmp)",
"+ if b[i] <= mon:",
"+ ... | false | 0.038794 | 0.037543 | 1.033332 | [
"s241145447",
"s148806336"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.