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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u888092736 | p02712 | python | s807080087 | s510163058 | 156 | 21 | 9,160 | 9,168 | Accepted | Accepted | 86.54 | n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
if i % 3 == 0 or i % 5 == 0:
continue
ans += i
print(ans)
| n = int(eval(input()))
total = {}
for i in (1, 3, 5, 15):
total[i] = i * (n // i) * (n // i + 1) // 2
print((total[1] - total[3] - total[5] + total[15]))
| 7 | 7 | 131 | 158 | n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
if i % 3 == 0 or i % 5 == 0:
continue
ans += i
print(ans)
| n = int(eval(input()))
total = {}
for i in (1, 3, 5, 15):
total[i] = i * (n // i) * (n // i + 1) // 2
print((total[1] - total[3] - total[5] + total[15]))
| false | 0 | [
"-ans = 0",
"-for i in range(1, n + 1):",
"- if i % 3 == 0 or i % 5 == 0:",
"- continue",
"- ans += i",
"-print(ans)",
"+total = {}",
"+for i in (1, 3, 5, 15):",
"+ total[i] = i * (n // i) * (n // i + 1) // 2",
"+print((total[1] - total[3] - total[5] + total[15]))"
] | false | 0.333462 | 0.035852 | 9.301089 | [
"s807080087",
"s510163058"
] |
u173178698 | p02595 | python | s252597282 | s712397700 | 489 | 313 | 9,600 | 23,472 | Accepted | Accepted | 35.99 | n, d = list(map(int,input().split()))
ans =0
for i in range(n):
x, y = list(map(int,input().split()))
if pow((x**2+y**2),0.5)<=d:
ans += 1
print(ans) | import sys
N, D = list(map(int, input().split()))
cnt = 0
for s in sys.stdin.readlines():
x, y = list(map(int, s.split()))
d = pow(x, 2) + pow(y, 2)
cnt += (d <= pow(D, 2))
print(cnt) | 8 | 9 | 161 | 192 | n, d = list(map(int, input().split()))
ans = 0
for i in range(n):
x, y = list(map(int, input().split()))
if pow((x**2 + y**2), 0.5) <= d:
ans += 1
print(ans)
| import sys
N, D = list(map(int, input().split()))
cnt = 0
for s in sys.stdin.readlines():
x, y = list(map(int, s.split()))
d = pow(x, 2) + pow(y, 2)
cnt += d <= pow(D, 2)
print(cnt)
| false | 11.111111 | [
"-n, d = list(map(int, input().split()))",
"-ans = 0",
"-for i in range(n):",
"- x, y = list(map(int, input().split()))",
"- if pow((x**2 + y**2), 0.5) <= d:",
"- ans += 1",
"-print(ans)",
"+import sys",
"+",
"+N, D = list(map(int, input().split()))",
"+cnt = 0",
"+for s in sys.st... | false | 0.110097 | 0.036401 | 3.024571 | [
"s252597282",
"s712397700"
] |
u037430802 | p03681 | python | s949653280 | s884225552 | 701 | 52 | 5,184 | 6,900 | Accepted | Accepted | 92.58 | import math
n,m = list(map(int, input().split()))
num_b = max([n,m]) #多い方
num_l = min([n,m]) #少ない方
ans = 0
if num_b - num_l >= 2: #差が2以上あると、隣接なしでは並べられない
ans = 0
elif num_b - num_l == 1:
#差が1匹の場合
#多い方が(num_b)!通り、少ない方が(num_l)!通りの並び方なので、その積をとる
ans = math.factorial(num_b) * math.factorial(num_l) % (10 *... |
N,M = list(map(int, input().split()))
MOD = 10**9+7
if abs(N - M) > 1:
print((0))
exit()
factorial = [1] * (max(N,M)+1)
for i in range(1,max(N,M)+1):
factorial[i] = (factorial[i-1]*i) % MOD
if abs(N - M) == 0:
ans = ((factorial[N]**2) * 2) % MOD
else:
ans = (factorial[N] * factori... | 18 | 17 | 542 | 336 | import math
n, m = list(map(int, input().split()))
num_b = max([n, m]) # 多い方
num_l = min([n, m]) # 少ない方
ans = 0
if num_b - num_l >= 2: # 差が2以上あると、隣接なしでは並べられない
ans = 0
elif num_b - num_l == 1:
# 差が1匹の場合
# 多い方が(num_b)!通り、少ない方が(num_l)!通りの並び方なので、その積をとる
ans = math.factorial(num_b) * math.factorial(num_l)... | N, M = list(map(int, input().split()))
MOD = 10**9 + 7
if abs(N - M) > 1:
print((0))
exit()
factorial = [1] * (max(N, M) + 1)
for i in range(1, max(N, M) + 1):
factorial[i] = (factorial[i - 1] * i) % MOD
if abs(N - M) == 0:
ans = ((factorial[N] ** 2) * 2) % MOD
else:
ans = (factorial[N] * factorial[... | false | 5.555556 | [
"-import math",
"-",
"-n, m = list(map(int, input().split()))",
"-num_b = max([n, m]) # 多い方",
"-num_l = min([n, m]) # 少ない方",
"-ans = 0",
"-if num_b - num_l >= 2: # 差が2以上あると、隣接なしでは並べられない",
"- ans = 0",
"-elif num_b - num_l == 1:",
"- # 差が1匹の場合",
"- # 多い方が(num_b)!通り、少ない方が(num_l)!通りの並び方... | false | 0.139678 | 0.041495 | 3.366177 | [
"s949653280",
"s884225552"
] |
u266014018 | p02626 | python | s211055481 | s658897465 | 33 | 28 | 9,220 | 9,144 | Accepted | Accepted | 15.15 | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
n = int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i in range(2, n):
x ^= a[i]
d = a[0]+a[1]-x
if d%2 == 1 or d < 0:
print((-1))
return
d >>= 1
if d&x... | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
n = int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i in range(2, n):
x ^= a[i]
d = a[0]+a[1]-x
if d%2 == 1 or d < 0:
print((-1))
return
d >>= 1
if d&x... | 33 | 33 | 680 | 679 | def main():
import sys
def input():
return sys.stdin.readline().rstrip()
n = int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i in range(2, n):
x ^= a[i]
d = a[0] + a[1] - x
if d % 2 == 1 or d < 0:
print((-1))
return
d >>= 1
if d ... | def main():
import sys
def input():
return sys.stdin.readline().rstrip()
n = int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i in range(2, n):
x ^= a[i]
d = a[0] + a[1] - x
if d % 2 == 1 or d < 0:
print((-1))
return
d >>= 1
if d ... | false | 0 | [
"- for i in range(40, -1, -1):",
"+ for i in range(k, -1, -1):"
] | false | 0.039669 | 0.039906 | 0.994067 | [
"s211055481",
"s658897465"
] |
u606045429 | p03768 | python | s973812625 | s123174770 | 1,002 | 781 | 51,776 | 50,252 | Accepted | Accepted | 22.06 | from collections import deque
N, M, *L = list(map(int, open(0).read().split()))
AB, VDC = L[:2 * M], L[2 * M + 1:]
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
E[b].append(a)
colors = [0] * (N + 1)
visited = [-1] * (N + 1)
for v, d, c in reversed(tuple(zip(*[i... | from collections import deque
def main():
N, M, *L = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(L[:2 * M])] * 2):
E[a].append(b)
E[b].append(a)
colors = [0] * (N + 1)
visited = [-1] * (N + 1)
for v, d, c in revers... | 27 | 30 | 644 | 759 | from collections import deque
N, M, *L = list(map(int, open(0).read().split()))
AB, VDC = L[: 2 * M], L[2 * M + 1 :]
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
E[a].append(b)
E[b].append(a)
colors = [0] * (N + 1)
visited = [-1] * (N + 1)
for v, d, c in reversed(tuple(zip(*[iter(VDC)] * 3)... | from collections import deque
def main():
N, M, *L = list(map(int, open(0).read().split()))
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(L[: 2 * M])] * 2):
E[a].append(b)
E[b].append(a)
colors = [0] * (N + 1)
visited = [-1] * (N + 1)
for v, d, c in reversed(tuple(zip(*... | false | 10 | [
"-N, M, *L = list(map(int, open(0).read().split()))",
"-AB, VDC = L[: 2 * M], L[2 * M + 1 :]",
"-E = [[] for _ in range(N + 1)]",
"-for a, b in zip(*[iter(AB)] * 2):",
"- E[a].append(b)",
"- E[b].append(a)",
"-colors = [0] * (N + 1)",
"-visited = [-1] * (N + 1)",
"-for v, d, c in reversed(tupl... | false | 0.047677 | 0.038022 | 1.253926 | [
"s973812625",
"s123174770"
] |
u863442865 | p03175 | python | s276709870 | s733714278 | 1,093 | 493 | 139,028 | 31,920 | Accepted | Accepted | 54.89 | #木DP, 木上の数え上げ
#前処理
#隣接リストを作る
#隣接頂点が最も多い頂点を根にして木を作る
#
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate
... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate
#from itertools import product
from bisect import bisect_left,bi... | 84 | 56 | 1,820 | 1,343 | # 木DP, 木上の数え上げ
# 前処理
# 隣接リストを作る
# 隣接頂点が最も多い頂点を根にして木を作る
#
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate
# from itert... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate
# from itertools import product
from bisect import bisect_left, bise... | false | 33.333333 | [
"-# 木DP, 木上の数え上げ",
"-# 前処理",
"-# 隣接リストを作る",
"-# 隣接頂点が最も多い頂点を根にして木を作る",
"-#",
"- sys.setrecursionlimit(10000000)",
"+ sys.setrecursionlimit(10**7)",
"- # 頂点:0~N-1",
"+ # 隣接リスト作成",
"- # 隣接する頂点が一番多い頂点を根にする",
"- root = -1",
"- l = -1",
"- for i in range(N):",
"- ... | false | 0.006895 | 0.034334 | 0.200822 | [
"s276709870",
"s733714278"
] |
u077291787 | p02948 | python | s048122127 | s907774694 | 281 | 238 | 29,504 | 19,284 | Accepted | Accepted | 15.3 | # ABC137D - Summer Vacation
import sys
from heapq import heappop, heappush
readline = sys.stdin.buffer.readline
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, readline().split()))
all_jobs = tuple(tuple(map(int, readline... | # ABC137D - Summer Vacation
import sys
from heapq import heappop, heappush
readline = sys.stdin.buffer.readline
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, readline().split()))
available_jobs = [[] for _ in range(M + ... | 28 | 28 | 794 | 759 | # ABC137D - Summer Vacation
import sys
from heapq import heappop, heappush
readline = sys.stdin.buffer.readline
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, readline().split()))
all_jobs = tuple(tuple(map(int, readline().split())... | # ABC137D - Summer Vacation
import sys
from heapq import heappop, heappush
readline = sys.stdin.buffer.readline
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, readline().split()))
available_jobs = [[] for _ in range(M + 1)]
for... | false | 0 | [
"- all_jobs = tuple(tuple(map(int, readline().split())) for _ in range(N))",
"- for waiting_days, reward in all_jobs:",
"+ for _ in range(N):",
"+ waiting_days, reward = list(map(int, readline().split()))"
] | false | 0.079687 | 0.048348 | 1.648213 | [
"s048122127",
"s907774694"
] |
u798260206 | p03273 | python | s781288636 | s623144370 | 28 | 20 | 4,468 | 3,064 | Accepted | Accepted | 28.57 | h,w = map(int,input().split())
maze = []
for _ in range(h):
s = input()
if s != '.'*w:
maze.append(s)
h = len(maze)
skip = []
for j in range(w):
for i in range(h):
if maze[i][j] == '#':
break
else:
skip.append(j)
for i in range(h):
for j in range(w):
if j not in skip:
... | H,W=list(map(int,input().split()))
l=[]
for i in range(H):
x=eval(input())
# 白いマスのみからなる場合は追加しない
if x!='.'*W:
l.append(x)
rm=[]
for i in range(W):
# フラグ
f=True
for j in range(len(l)):
if l[j][i]=='#':
f=False
# 取り除く列の添字を保存しておく
if f:
rm.append(i)
a=[]
for x in l... | 20 | 30 | 363 | 433 | h, w = map(int, input().split())
maze = []
for _ in range(h):
s = input()
if s != "." * w:
maze.append(s)
h = len(maze)
skip = []
for j in range(w):
for i in range(h):
if maze[i][j] == "#":
break
else:
skip.append(j)
for i in range(h):
for j in range(w):
i... | H, W = list(map(int, input().split()))
l = []
for i in range(H):
x = eval(input())
# 白いマスのみからなる場合は追加しない
if x != "." * W:
l.append(x)
rm = []
for i in range(W):
# フラグ
f = True
for j in range(len(l)):
if l[j][i] == "#":
f = False
# 取り除く列の添字を保存しておく
if f:
... | false | 33.333333 | [
"-h, w = map(int, input().split())",
"-maze = []",
"-for _ in range(h):",
"- s = input()",
"- if s != \".\" * w:",
"- maze.append(s)",
"-h = len(maze)",
"-skip = []",
"-for j in range(w):",
"- for i in range(h):",
"- if maze[i][j] == \"#\":",
"- break",
"- ... | false | 0.054426 | 0.058592 | 0.928893 | [
"s781288636",
"s623144370"
] |
u977389981 | p03377 | python | s114986629 | s537371436 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | a, b, x = list(map(int, input().split()))
if x >= a and x - a <= b:
print('YES')
else:
print('NO') | a, b, x = list(map(int, input().split()))
print(('YES' if a <= x <= (a + b) else 'NO')) | 5 | 2 | 104 | 80 | a, b, x = list(map(int, input().split()))
if x >= a and x - a <= b:
print("YES")
else:
print("NO")
| a, b, x = list(map(int, input().split()))
print(("YES" if a <= x <= (a + b) else "NO"))
| false | 60 | [
"-if x >= a and x - a <= b:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+print((\"YES\" if a <= x <= (a + b) else \"NO\"))"
] | false | 0.046539 | 0.046282 | 1.005552 | [
"s114986629",
"s537371436"
] |
u621935300 | p03221 | python | s137869292 | s650517756 | 690 | 233 | 76,828 | 53,148 | Accepted | Accepted | 66.23 | N,M=list(map(int, input().split()))
P=[]
for i in range(M):
x,y=list(map(int, input().split()))
P.append( [i,x,y] )
P.sort(key=lambda x:(x[1],x[2]))
prev_y=None
for idx,t in enumerate(P):
x=t[0]; y=t[1]; z=t[2]
if prev_y is None:
cnt=1
elif y!=prev_y:
cnt=1
else:
cnt+=1
P[id... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_left, bisect_right
N,M=list(map(int, sys.stdin.readline().split()))
P=[ [] for _ in range(N+1) ] #Prefecture 県
Q=[] #クエリー
for _ in range(M):
p,y=list(map(int, sys.stdin.readline().split()))
P[p].append(y)
Q.append((p,y))
for i ... | 34 | 18 | 473 | 421 | N, M = list(map(int, input().split()))
P = []
for i in range(M):
x, y = list(map(int, input().split()))
P.append([i, x, y])
P.sort(key=lambda x: (x[1], x[2]))
prev_y = None
for idx, t in enumerate(P):
x = t[0]
y = t[1]
z = t[2]
if prev_y is None:
cnt = 1
elif y != prev_y:
cnt... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_left, bisect_right
N, M = list(map(int, sys.stdin.readline().split()))
P = [[] for _ in range(N + 1)] # Prefecture 県
Q = [] # クエリー
for _ in range(M):
p, y = list(map(int, sys.stdin.readline().split()))
P[p].append(y)
Q.append((p, y))
for i in r... | false | 47.058824 | [
"-N, M = list(map(int, input().split()))",
"-P = []",
"-for i in range(M):",
"- x, y = list(map(int, input().split()))",
"- P.append([i, x, y])",
"-P.sort(key=lambda x: (x[1], x[2]))",
"-prev_y = None",
"-for idx, t in enumerate(P):",
"- x = t[0]",
"- y = t[1]",
"- z = t[2]",
"-... | false | 0.036545 | 0.037042 | 0.986577 | [
"s137869292",
"s650517756"
] |
u970449052 | p03338 | python | s477343192 | s075006908 | 21 | 17 | 3,064 | 3,060 | Accepted | Accepted | 19.05 | n=int(eval(input()))
s=eval(input())
st='abcdefghijklmnopqrstuvwxyz'
ans=0
for i in range(1,n-1):
ll=[0]*26
rl=[0]*26
for j in range(i):
ll[st.index(s[j])]+=1
for j in range(i,n):
rl[st.index(s[j])]+=1
cnt=0
for j in range(26):
cnt+=1 if ll[j]>0 and rl[j]>0 e... | n=int(eval(input()))
s=eval(input())
ans=0
for i in range(n):
t1=set(s[:i])
t2=set(s[i:])
ans=max(ans,len(t1&t2))
print(ans) | 16 | 8 | 347 | 131 | n = int(eval(input()))
s = eval(input())
st = "abcdefghijklmnopqrstuvwxyz"
ans = 0
for i in range(1, n - 1):
ll = [0] * 26
rl = [0] * 26
for j in range(i):
ll[st.index(s[j])] += 1
for j in range(i, n):
rl[st.index(s[j])] += 1
cnt = 0
for j in range(26):
cnt += 1 if ll[j] ... | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n):
t1 = set(s[:i])
t2 = set(s[i:])
ans = max(ans, len(t1 & t2))
print(ans)
| false | 50 | [
"-st = \"abcdefghijklmnopqrstuvwxyz\"",
"-for i in range(1, n - 1):",
"- ll = [0] * 26",
"- rl = [0] * 26",
"- for j in range(i):",
"- ll[st.index(s[j])] += 1",
"- for j in range(i, n):",
"- rl[st.index(s[j])] += 1",
"- cnt = 0",
"- for j in range(26):",
"- ... | false | 0.04675 | 0.041405 | 1.12909 | [
"s477343192",
"s075006908"
] |
u116038906 | p02660 | python | s496906914 | s777757811 | 873 | 200 | 9,364 | 9,460 | Accepted | Accepted | 77.09 | #約数
def make_divisors(n): #約数をリストで返す
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
# divisors.sort()
return divisors
#素因数分解
def soinsu_bunkai(m):
pf={}
for... | #約数
def make_divisors(n): #約数をリストで返す
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
# divisors.sort()
return divisors
#素因数分解
def soinsu_bunkai(m):
pf={}
for... | 41 | 39 | 769 | 762 | # 約数
def make_divisors(n): # 約数をリストで返す
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort()
return divisors
# 素因数分解
def soinsu_bunkai(m):
pf = {}
for i in r... | # 約数
def make_divisors(n): # 約数をリストで返す
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort()
return divisors
# 素因数分解
def soinsu_bunkai(m):
pf = {}
for i in r... | false | 4.878049 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-div = make_divisors(N)",
"+div = make_divisors(N) # Nの約数",
"-div_2 = div[1:]",
"+div_1_except = div[1:]",
"-for i in div_2:",
"- i2 = soinsu_bunkai(i)",
"- if len(i2) == 1:",
"- q, mod = divmod(N, i)",
"- if mod == 0:",
... | false | 0.165734 | 0.139989 | 1.183905 | [
"s496906914",
"s777757811"
] |
u254871849 | p03999 | python | s433539833 | s537068169 | 25 | 17 | 3,064 | 3,060 | Accepted | Accepted | 32 | import sys
from itertools import combinations
s = list(sys.stdin.readline().rstrip())
l = len(s)
def main():
res = 0
cand = list(range(1, l))
for inser_cnt in range(l):
for idces in combinations(cand, inser_cnt):
t = s.copy()
idces = list(idces)
for... | import sys
s = sys.stdin.readline().rstrip()
n = len(s)
def c(n):
return pow(2, max(0, n - 1))
def main():
res = 0
for l in range(n):
for r in range(l, n):
res += int(s[l:r+1]) * c(l) * c(n - 1 - r)
print(res)
if __name__ == '__main__':
main() | 22 | 17 | 518 | 306 | import sys
from itertools import combinations
s = list(sys.stdin.readline().rstrip())
l = len(s)
def main():
res = 0
cand = list(range(1, l))
for inser_cnt in range(l):
for idces in combinations(cand, inser_cnt):
t = s.copy()
idces = list(idces)
for i in idces[... | import sys
s = sys.stdin.readline().rstrip()
n = len(s)
def c(n):
return pow(2, max(0, n - 1))
def main():
res = 0
for l in range(n):
for r in range(l, n):
res += int(s[l : r + 1]) * c(l) * c(n - 1 - r)
print(res)
if __name__ == "__main__":
main()
| false | 22.727273 | [
"-from itertools import combinations",
"-s = list(sys.stdin.readline().rstrip())",
"-l = len(s)",
"+s = sys.stdin.readline().rstrip()",
"+n = len(s)",
"+",
"+",
"+def c(n):",
"+ return pow(2, max(0, n - 1))",
"- cand = list(range(1, l))",
"- for inser_cnt in range(l):",
"- for ... | false | 0.045148 | 0.036751 | 1.228489 | [
"s433539833",
"s537068169"
] |
u257374434 | p03319 | python | s117880302 | s903685833 | 41 | 18 | 13,812 | 3,060 | Accepted | Accepted | 56.1 | import math
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
assert isinstance(A,list)
a = A.index(1)
print((math.ceil((N-1)/(K-1)))) | import math
N, K = list(map(int, input().split()))
print((math.ceil((N-1)/(K-1)))) | 8 | 3 | 166 | 82 | import math
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
assert isinstance(A, list)
a = A.index(1)
print((math.ceil((N - 1) / (K - 1))))
| import math
N, K = list(map(int, input().split()))
print((math.ceil((N - 1) / (K - 1))))
| false | 62.5 | [
"-A = list(map(int, input().split()))",
"-assert isinstance(A, list)",
"-a = A.index(1)"
] | false | 0.03975 | 0.038847 | 1.023232 | [
"s117880302",
"s903685833"
] |
u296518383 | p02883 | python | s846284661 | s260297874 | 755 | 638 | 96,824 | 83,736 | Accepted | Accepted | 15.5 | import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines
N,K=list(map(int,readline().split()))
A=list(map(int,readline().split()))
F=list(map(int,readline().split()))
#print(N,K)
#print("A:",A)
#print(F)
A.sort()
F.sort(reverse=True)
#print("A:",A)
#... | import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines
N,K=list(map(int,readline().split()))
A=list(map(int,readline().split()))
F=list(map(int,readline().split()))
#print(N,K)
#print("A:",A)
#print(F)
A.sort()
F.sort(reverse=True)
#print("A:",A)
#... | 34 | 34 | 644 | 631 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K = list(map(int, readline().split()))
A = list(map(int, readline().split()))
F = list(map(int, readline().split()))
# print(N,K)
# print("A:",A)
# print(F)
A.sort()
F.sort(reverse=True)
# print("A:",... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K = list(map(int, readline().split()))
A = list(map(int, readline().split()))
F = list(map(int, readline().split()))
# print(N,K)
# print("A:",A)
# print(F)
A.sort()
F.sort(reverse=True)
# print("A:",... | false | 0 | [
"- tmp = [0] * (N)",
"+ tmp = 0",
"- tmp[i] = max(A[i] - mid // F[i], 0)",
"- if sum(tmp) <= K:",
"+ tmp += max(A[i] - mid // F[i], 0)",
"+ if tmp <= K:"
] | false | 0.109751 | 0.055441 | 1.979611 | [
"s846284661",
"s260297874"
] |
u614181788 | p02708 | python | s830171356 | s789095959 | 189 | 168 | 9,052 | 9,188 | Accepted | Accepted | 11.11 | n,k = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for i in range(k, n+2):
ans += max(0, n*(n+1)//2 - (n-i)*(n+1-i)//2 - i*(i-1)//2 + 1)
ans %= mod
print(ans) | n,k = list(map(int,input().split()))
mod = 10**9 + 7
ans = 1
for i in range(k,n+1):
low = i*(i-1)//2
high = n*(n+1)//2 - (n-i)*(n-i+1)//2
ans += high - low + 1
ans %= mod
print(ans) | 7 | 10 | 176 | 201 | n, k = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for i in range(k, n + 2):
ans += max(0, n * (n + 1) // 2 - (n - i) * (n + 1 - i) // 2 - i * (i - 1) // 2 + 1)
ans %= mod
print(ans)
| n, k = list(map(int, input().split()))
mod = 10**9 + 7
ans = 1
for i in range(k, n + 1):
low = i * (i - 1) // 2
high = n * (n + 1) // 2 - (n - i) * (n - i + 1) // 2
ans += high - low + 1
ans %= mod
print(ans)
| false | 30 | [
"-ans = 0",
"-for i in range(k, n + 2):",
"- ans += max(0, n * (n + 1) // 2 - (n - i) * (n + 1 - i) // 2 - i * (i - 1) // 2 + 1)",
"+ans = 1",
"+for i in range(k, n + 1):",
"+ low = i * (i - 1) // 2",
"+ high = n * (n + 1) // 2 - (n - i) * (n - i + 1) // 2",
"+ ans += high - low + 1"
] | false | 0.079718 | 0.08585 | 0.928568 | [
"s830171356",
"s789095959"
] |
u863442865 | p02836 | python | s651464281 | s927550075 | 166 | 21 | 38,384 | 3,444 | Accepted | Accepted | 87.35 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
#from itertools import product
from bisect import bisec... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
#from itertools import product
from bisect import bisec... | 28 | 26 | 703 | 702 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
# from itertools import product
from bisect import bisect_l... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
# from itertools import product
from bisect import bisect_l... | false | 7.142857 | [
"- r = len(s)",
"- for i in range(r // 2):",
"- if s[i] != s[-(i + 1)]:",
"+ ss = s[::-1]",
"+ for i in range(len(s)):",
"+ if s[i] != ss[i]:",
"- print(res)",
"+ print((res // 2))"
] | false | 0.039688 | 0.03703 | 1.071792 | [
"s651464281",
"s927550075"
] |
u796942881 | p02983 | python | s212622820 | s134973648 | 397 | 37 | 2,940 | 2,940 | Accepted | Accepted | 90.68 | def main():
L, R = list(map(int, input().split()))
if L + 2018 <= R:
print((0))
return
print((min(i * j % 2019 for i in range(L, R + 1)
for j in range(i + 1, R + 1))))
return
main()
| def main():
L, R = list(map(int, input().split()))
# [3, 673]
if L + 672 <= R:
print((0))
return
print((min(i * j % 2019 for i in range(L, R + 1)
for j in range(i + 1, R + 1))))
return
main()
| 11 | 12 | 230 | 245 | def main():
L, R = list(map(int, input().split()))
if L + 2018 <= R:
print((0))
return
print((min(i * j % 2019 for i in range(L, R + 1) for j in range(i + 1, R + 1))))
return
main()
| def main():
L, R = list(map(int, input().split()))
# [3, 673]
if L + 672 <= R:
print((0))
return
print((min(i * j % 2019 for i in range(L, R + 1) for j in range(i + 1, R + 1))))
return
main()
| false | 8.333333 | [
"- if L + 2018 <= R:",
"+ # [3, 673]",
"+ if L + 672 <= R:"
] | false | 0.148002 | 0.082906 | 1.785166 | [
"s212622820",
"s134973648"
] |
u038408819 | p03329 | python | s841429921 | s908215933 | 691 | 221 | 3,828 | 44,880 | Accepted | Accepted | 68.02 | n = int(eval(input()))
dp = [float('Inf')] * (100000 + 1)
dp[0] = 0
for i in range(1, n + 1):
dp[i] = dp[i - 1] + 1
cnt = 1
for j in range(0, 7):
cnt *= 6
if i - cnt >= 0:
dp[i] = min(dp[i], dp[i - cnt] + 1)
cnt = 1
for j in range(0, 6):
cnt *= 9
... | n = int(eval(input()))
dp = [float('Inf')] * (n + 1)
dp[0] = 0
for i in range(1, n + 1):
j = 1
while j <= i:
dp[i] = min(dp[i], dp[i - j] + 1)
j *= 6
j = 1
while j <= i:
dp[i] = min(dp[i], dp[i - j] + 1)
j *= 9
print((dp[n])) | 16 | 13 | 398 | 277 | n = int(eval(input()))
dp = [float("Inf")] * (100000 + 1)
dp[0] = 0
for i in range(1, n + 1):
dp[i] = dp[i - 1] + 1
cnt = 1
for j in range(0, 7):
cnt *= 6
if i - cnt >= 0:
dp[i] = min(dp[i], dp[i - cnt] + 1)
cnt = 1
for j in range(0, 6):
cnt *= 9
if i - cn... | n = int(eval(input()))
dp = [float("Inf")] * (n + 1)
dp[0] = 0
for i in range(1, n + 1):
j = 1
while j <= i:
dp[i] = min(dp[i], dp[i - j] + 1)
j *= 6
j = 1
while j <= i:
dp[i] = min(dp[i], dp[i - j] + 1)
j *= 9
print((dp[n]))
| false | 18.75 | [
"-dp = [float(\"Inf\")] * (100000 + 1)",
"+dp = [float(\"Inf\")] * (n + 1)",
"- dp[i] = dp[i - 1] + 1",
"- cnt = 1",
"- for j in range(0, 7):",
"- cnt *= 6",
"- if i - cnt >= 0:",
"- dp[i] = min(dp[i], dp[i - cnt] + 1)",
"- cnt = 1",
"- for j in range(0, 6):... | false | 0.107105 | 0.098273 | 1.089877 | [
"s841429921",
"s908215933"
] |
u498487134 | p03003 | python | s351244637 | s036828716 | 396 | 353 | 104,284 | 72,412 | Accepted | Accepted | 10.86 |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,M=MI()
S=LI()
T=LI()
dp=[[0]*(M+1) for _ in range(N+1)]
dp[0][0]=1
#dp[i][j]はSのi文字目,Tのj文字目を使う時の通り数
cumsum=[[... |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
#シンプルに!!
mod=10**9+7
N,M=MI()
S=LI()
T=LI()
dp=[[0]*(M+1) for _ in range(N+1)]
#i文字目までとj文字目まで見た.
for i in rang... | 38 | 35 | 930 | 726 | def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N, M = MI()
S = LI()
T = LI()
dp = [[0] * (M + 1) for _ in range(N + 1)]
dp[0][0] = 1
# dp[i][j]はSのi文字目,Tのj文字目を使う... | def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
# シンプルに!!
mod = 10**9 + 7
N, M = MI()
S = LI()
T = LI()
dp = [[0] * (M + 1) for _ in range(N + 1)]
# i文字目までとj文字目まで見た.
for i i... | false | 7.894737 | [
"+ # シンプルに!!",
"- dp[0][0] = 1",
"- # dp[i][j]はSのi文字目,Tのj文字目を使う時の通り数",
"- cumsum = [[0] * (M + 2) for _ in range(N + 2)]",
"- # 2D累積和",
"- for i in range(1, N + 2):",
"- cumsum[i][1] = 1",
"- for j in range(1, M + 2):",
"- cumsum[1][j] = 1",
"+ # i文字目までとj文字目まで... | false | 0.035431 | 0.044267 | 0.800397 | [
"s351244637",
"s036828716"
] |
u419877586 | p02786 | python | s319240885 | s127753768 | 173 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.17 | H=int(eval(input()))
cnt=0
while H>0:
cnt+=1
H=H//2
print((2**cnt-1)) | H = int(eval(input()))
cnt = 0
while H > 0:
H //= 2
cnt += 1
print((2**cnt-1)) | 6 | 7 | 70 | 85 | H = int(eval(input()))
cnt = 0
while H > 0:
cnt += 1
H = H // 2
print((2**cnt - 1))
| H = int(eval(input()))
cnt = 0
while H > 0:
H //= 2
cnt += 1
print((2**cnt - 1))
| false | 14.285714 | [
"+ H //= 2",
"- H = H // 2"
] | false | 0.040808 | 0.047078 | 0.866813 | [
"s319240885",
"s127753768"
] |
u696240348 | p03494 | python | s418684354 | s577940316 | 189 | 165 | 39,152 | 38,640 | Accepted | Accepted | 12.7 | n = eval(input())
A = list(map(int, input().split()))
ans = 0
while not any (a%2 for a in A):
ans+=1
A = [a/2 for a in A]
print(ans) | def times_divisible(n):
ans = 0
while n%2 ==0:
n/=2
ans +=1
return ans
n= int(eval(input()))
A=[int(a) for a in input().split()]
ans = min(times_divisible(a) for a in A)
print(ans) | 7 | 10 | 140 | 212 | n = eval(input())
A = list(map(int, input().split()))
ans = 0
while not any(a % 2 for a in A):
ans += 1
A = [a / 2 for a in A]
print(ans)
| def times_divisible(n):
ans = 0
while n % 2 == 0:
n /= 2
ans += 1
return ans
n = int(eval(input()))
A = [int(a) for a in input().split()]
ans = min(times_divisible(a) for a in A)
print(ans)
| false | 30 | [
"-n = eval(input())",
"-A = list(map(int, input().split()))",
"-ans = 0",
"-while not any(a % 2 for a in A):",
"- ans += 1",
"- A = [a / 2 for a in A]",
"+def times_divisible(n):",
"+ ans = 0",
"+ while n % 2 == 0:",
"+ n /= 2",
"+ ans += 1",
"+ return ans",
"+",... | false | 0.043512 | 0.069188 | 0.628901 | [
"s418684354",
"s577940316"
] |
u738898077 | p02647 | python | s742191594 | s734517595 | 430 | 308 | 220,072 | 171,944 | Accepted | Accepted | 28.37 | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
imos = [0]*(2*10**5+1)
for j in range(min(k,100)):
imos = [0]*(2*10**5+1)
for i in range(n):
imos[max(i-a[i],0)] += 1
imos[min(i+a[i]+1,2*10**5)] -= 1
for i in range(1,n):
imos[i] += imos[i-1]
a = i... | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
imos = [0]*(2*10**5+1)
for j in range(min(k,50)):
imos = [0]*(2*10**5+1)
for i in range(n):
imos[max(i-a[i],0)] += 1
imos[min(i+a[i]+1,2*10**5)] -= 1
for i in range(1,n):
imos[i] += imos[i-1]
a = im... | 12 | 12 | 336 | 335 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
imos = [0] * (2 * 10**5 + 1)
for j in range(min(k, 100)):
imos = [0] * (2 * 10**5 + 1)
for i in range(n):
imos[max(i - a[i], 0)] += 1
imos[min(i + a[i] + 1, 2 * 10**5)] -= 1
for i in range(1, n):
imos[i] += im... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
imos = [0] * (2 * 10**5 + 1)
for j in range(min(k, 50)):
imos = [0] * (2 * 10**5 + 1)
for i in range(n):
imos[max(i - a[i], 0)] += 1
imos[min(i + a[i] + 1, 2 * 10**5)] -= 1
for i in range(1, n):
imos[i] += imo... | false | 0 | [
"-for j in range(min(k, 100)):",
"+for j in range(min(k, 50)):"
] | false | 0.047556 | 0.039064 | 1.217399 | [
"s742191594",
"s734517595"
] |
u079022693 | p04034 | python | s187100508 | s966746915 | 206 | 164 | 21,108 | 12,404 | Accepted | Accepted | 20.39 | from sys import stdin
def main():
#入力
readline=stdin.readline
N,M=list(map(int,readline().split()))
x=[0]*M
y=[0]*M
for i in range(M):
a,b=list(map(int,readline().split()))
x[i]=a
y[i]=b
li=[[1,0] for _ in range(N+1)]
li[1][1]=1
for i in range(M... | from sys import stdin
def main():
#入力
readline=stdin.readline
N,M=list(map(int,readline().split()))
x=[0]*M
y=[0]*M
for i in range(M):
x[i],y[i]=list(map(int,readline().split()))
box=[1]*(N+1)
flags=[False]*(N+1)
flags[1]=True
for i in range(M):
o... | 39 | 33 | 825 | 692 | from sys import stdin
def main():
# 入力
readline = stdin.readline
N, M = list(map(int, readline().split()))
x = [0] * M
y = [0] * M
for i in range(M):
a, b = list(map(int, readline().split()))
x[i] = a
y[i] = b
li = [[1, 0] for _ in range(N + 1)]
li[1][1] = 1
... | from sys import stdin
def main():
# 入力
readline = stdin.readline
N, M = list(map(int, readline().split()))
x = [0] * M
y = [0] * M
for i in range(M):
x[i], y[i] = list(map(int, readline().split()))
box = [1] * (N + 1)
flags = [False] * (N + 1)
flags[1] = True
for i in r... | false | 15.384615 | [
"- a, b = list(map(int, readline().split()))",
"- x[i] = a",
"- y[i] = b",
"- li = [[1, 0] for _ in range(N + 1)]",
"- li[1][1] = 1",
"+ x[i], y[i] = list(map(int, readline().split()))",
"+ box = [1] * (N + 1)",
"+ flags = [False] * (N + 1)",
"+ flags[1] = ... | false | 0.037268 | 0.03694 | 1.008875 | [
"s187100508",
"s966746915"
] |
u936985471 | p03476 | python | s042449060 | s964568984 | 1,073 | 862 | 5,876 | 4,980 | Accepted | Accepted | 19.66 | f=[True]*(10**5+1)
like=[False]*(10**5+1)
f[0]=False
f[1]=False
import math
for i in range(2,len(f)):
if not f[i]:
continue
fact=True
for j in range(2,int(math.sqrt(i))+1):
if i%j==0:
fact=False
break
if fact:
f[i]=True
if i*2-1<len(like):
like[i*2-1]=True
... | Q=int(eval(input()))
fact=[True]*(10**5+1)
fact[0]=False
fact[1]=False
num=[0]*(10**5+1)
cur=0
for i in range(len(fact)):
if fact[i]:
for j in range(i*2,len(fact),i):
fact[j]=False
if fact[(i+1)//2]:
cur+=1
num[i]=cur
for i in range(Q):
l,r=list(map(int,input().split(... | 34 | 19 | 608 | 338 | f = [True] * (10**5 + 1)
like = [False] * (10**5 + 1)
f[0] = False
f[1] = False
import math
for i in range(2, len(f)):
if not f[i]:
continue
fact = True
for j in range(2, int(math.sqrt(i)) + 1):
if i % j == 0:
fact = False
break
if fact:
f[i] = True
... | Q = int(eval(input()))
fact = [True] * (10**5 + 1)
fact[0] = False
fact[1] = False
num = [0] * (10**5 + 1)
cur = 0
for i in range(len(fact)):
if fact[i]:
for j in range(i * 2, len(fact), i):
fact[j] = False
if fact[(i + 1) // 2]:
cur += 1
num[i] = cur
for i in range(Q):
... | false | 44.117647 | [
"-f = [True] * (10**5 + 1)",
"-like = [False] * (10**5 + 1)",
"-f[0] = False",
"-f[1] = False",
"-import math",
"-",
"-for i in range(2, len(f)):",
"- if not f[i]:",
"- continue",
"- fact = True",
"- for j in range(2, int(math.sqrt(i)) + 1):",
"- if i % j == 0:",
"- ... | false | 1.045713 | 0.149827 | 6.979462 | [
"s042449060",
"s964568984"
] |
u623819879 | p03054 | python | s527475970 | s611398698 | 271 | 237 | 54,772 | 54,112 | Accepted | Accepted | 12.55 | import time
st_time=time.time()
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import random
def I():
return int(input())
def MI():
return ma... | d='URLD'
m={'U':0,'R':1,'D':2,'U':3}
m=dict(list(zip(d,list(range(4)))))
v={'L':'R','R':'L','D':'U','U':'D'}
v=dict([(d[i],d[3-i]) for i in range(4)])
v=dict(list(zip(d,d[::-1])))
h,w,n=list(map(int,input().split()))
b=[h,w,w,h]
r,c=list(map(int,input().split()))
o=[h-r+1,c,w-c+1,r]
s=eval(input())
t=[v[i] f... | 59 | 25 | 1,150 | 516 | import time
st_time = time.time()
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations
import sys
import bisect
import string
import math
import random
def I():
return int(input())
def MI():
return map(int,... | d = "URLD"
m = {"U": 0, "R": 1, "D": 2, "U": 3}
m = dict(list(zip(d, list(range(4)))))
v = {"L": "R", "R": "L", "D": "U", "U": "D"}
v = dict([(d[i], d[3 - i]) for i in range(4)])
v = dict(list(zip(d, d[::-1])))
h, w, n = list(map(int, input().split()))
b = [h, w, w, h]
r, c = list(map(int, input().split()))
o = [h - r ... | false | 57.627119 | [
"-import time",
"-",
"-st_time = time.time()",
"-from heapq import heappush, heappop",
"-from collections import deque, defaultdict, Counter",
"-import itertools",
"-from itertools import permutations, combinations",
"-import sys",
"-import bisect",
"-import string",
"-import math",
"-import r... | false | 0.037312 | 0.041089 | 0.908068 | [
"s527475970",
"s611398698"
] |
u102278909 | p02847 | python | s239061818 | s609712247 | 209 | 172 | 43,376 | 38,384 | Accepted | Accepted | 17.7 | # coding: utf-8
import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : retu... | # coding: utf-8
import sys
import math
import collections
import itertools
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return... | 25 | 23 | 839 | 622 | # coding: utf-8
import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10**10
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def gcd(x, y):
return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y):
return (x * y) // gcd(x, y)
def I():
... | # coding: utf-8
import sys
import math
import collections
import itertools
INF = 10**10
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def gcd(x, y):
return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y):
return (x * y) // gcd(x, y)
def I():
return int(input())
def LI():
... | false | 8 | [
"-from inspect import currentframe",
"- return int(eval(input()))",
"-",
"-",
"-def MI():",
"- return list(map(int, input().split()))",
"+ return int(input())",
"- return [int(eval(input())) for _ in range(N)]",
"+ return [int(input()) for _ in range(N)]",
"-def chkprint(*args):",
... | false | 0.064738 | 0.126115 | 0.513326 | [
"s239061818",
"s609712247"
] |
u901582103 | p02720 | python | s066733660 | s190629563 | 587 | 462 | 20,184 | 30,736 | Accepted | Accepted | 21.29 | k=int(eval(input()))
L=[1,2,3,4,5,6,7,8,9]
Sz=['0']
Tz=[]
Sn=[1,2,3,4,5,6,7,8,9]
Tn=[]
i=9
while i<=k:
for z in Sz:
L.append(int('1'+z))
i+=1
Tn.append(int('1'+z))
Tz.append('0'+z)
Sz=[]
Sz=Tz[:]
Tz=[]
for n in Sn:
if int(str... | k=int(eval(input()))
L=[1,2,3,4,5,6,7,8,9]
temp1=[L[:]]
temp2=[]
def dfs(n):
if n>3234566667:
return
temp2=[]
for i in range(3):
m=int(str(n)[-1])
if 0<=m+i-1<=9:
nn=n*10+m+i-1
temp2.append(nn)
L.append(nn)
if temp2:
temp1.append(temp2)
for n in temp1[-1]:
dfs(n)
for i in r... | 47 | 26 | 1,288 | 370 | k = int(eval(input()))
L = [1, 2, 3, 4, 5, 6, 7, 8, 9]
Sz = ["0"]
Tz = []
Sn = [1, 2, 3, 4, 5, 6, 7, 8, 9]
Tn = []
i = 9
while i <= k:
for z in Sz:
L.append(int("1" + z))
i += 1
Tn.append(int("1" + z))
Tz.append("0" + z)
Sz = []
Sz = Tz[:]
Tz = []
for n in Sn:
... | k = int(eval(input()))
L = [1, 2, 3, 4, 5, 6, 7, 8, 9]
temp1 = [L[:]]
temp2 = []
def dfs(n):
if n > 3234566667:
return
temp2 = []
for i in range(3):
m = int(str(n)[-1])
if 0 <= m + i - 1 <= 9:
nn = n * 10 + m + i - 1
temp2.append(nn)
L.append(nn)... | false | 44.680851 | [
"-Sz = [\"0\"]",
"-Tz = []",
"-Sn = [1, 2, 3, 4, 5, 6, 7, 8, 9]",
"-Tn = []",
"-i = 9",
"-while i <= k:",
"- for z in Sz:",
"- L.append(int(\"1\" + z))",
"- i += 1",
"- Tn.append(int(\"1\" + z))",
"- Tz.append(\"0\" + z)",
"- Sz = []",
"- Sz = Tz[:]",
"... | false | 0.222012 | 1.306361 | 0.169947 | [
"s066733660",
"s190629563"
] |
u597455618 | p02838 | python | s050826833 | s724110572 | 308 | 182 | 82,124 | 38,200 | Accepted | Accepted | 40.91 | import numpy as np
N = int(eval(input()))
mod = 10**9 + 7
A = np.array(input().split(), int)
ans = 0
for i in range(60):
b = np.count_nonzero(A >> i & 1)
ans += 2**i*(b*(N-b))
ans %= mod
c = np.count_nonzero(A >> i & 1)
print(ans)
| import sys
import numpy as np
MOD = 10**9+7
n = int(sys.stdin.buffer.readline())
a = np.fromstring(sys.stdin.buffer.readline(), dtype = np.int64, sep = ' ')
ans = 0
for i in range(60):
s = int((a&1).sum())
ans += s*(n-s) * 2**i
ans %= MOD
a >>= 1
print(ans)
| 14 | 13 | 257 | 287 | import numpy as np
N = int(eval(input()))
mod = 10**9 + 7
A = np.array(input().split(), int)
ans = 0
for i in range(60):
b = np.count_nonzero(A >> i & 1)
ans += 2**i * (b * (N - b))
ans %= mod
c = np.count_nonzero(A >> i & 1)
print(ans)
| import sys
import numpy as np
MOD = 10**9 + 7
n = int(sys.stdin.buffer.readline())
a = np.fromstring(sys.stdin.buffer.readline(), dtype=np.int64, sep=" ")
ans = 0
for i in range(60):
s = int((a & 1).sum())
ans += s * (n - s) * 2**i
ans %= MOD
a >>= 1
print(ans)
| false | 7.142857 | [
"+import sys",
"-N = int(eval(input()))",
"-mod = 10**9 + 7",
"-A = np.array(input().split(), int)",
"+MOD = 10**9 + 7",
"+n = int(sys.stdin.buffer.readline())",
"+a = np.fromstring(sys.stdin.buffer.readline(), dtype=np.int64, sep=\" \")",
"- b = np.count_nonzero(A >> i & 1)",
"- ans += 2**i *... | false | 0.170607 | 0.169115 | 1.008822 | [
"s050826833",
"s724110572"
] |
u216392490 | p02596 | python | s704755355 | s570247376 | 718 | 363 | 95,956 | 9,140 | Accepted | Accepted | 49.44 | import sys
import math
import time
import numpy
sys.setrecursionlimit(int(1e6))
#dprint = print
def dprint(*args):
pass
k = list(map(int, input().split()))[0]
s = set()
i = 1
x = 7 % k
while(not (x in s)):
if (x == 0):
print(i)
exit()
s.add(x)
x = (x*10+7)%k
i... | import sys
import math
import time
sys.setrecursionlimit(int(1e6))
if False:
dprint = print
else:
def dprint(*args):
pass
k = list(map(int, input().split()))[0]
if (k % 7 == 0):
l = 9*k/7
else:
l = 9*k
dprint('k, l = ', k, l)
i = 1
n = 10
while(i < 10**6):
m = n % l
... | 24 | 31 | 342 | 480 | import sys
import math
import time
import numpy
sys.setrecursionlimit(int(1e6))
# dprint = print
def dprint(*args):
pass
k = list(map(int, input().split()))[0]
s = set()
i = 1
x = 7 % k
while not (x in s):
if x == 0:
print(i)
exit()
s.add(x)
x = (x * 10 + 7) % k
i = i + 1
print((-... | import sys
import math
import time
sys.setrecursionlimit(int(1e6))
if False:
dprint = print
else:
def dprint(*args):
pass
k = list(map(int, input().split()))[0]
if k % 7 == 0:
l = 9 * k / 7
else:
l = 9 * k
dprint("k, l = ", k, l)
i = 1
n = 10
while i < 10**6:
m = n % l
if m == 1: # ... | false | 22.580645 | [
"-import numpy",
"-# dprint = print",
"-def dprint(*args):",
"- pass",
"+if False:",
"+ dprint = print",
"+else:",
"+",
"+ def dprint(*args):",
"+ pass",
"-s = set()",
"+if k % 7 == 0:",
"+ l = 9 * k / 7",
"+else:",
"+ l = 9 * k",
"+dprint(\"k, l = \", k, l)",
"... | false | 0.123119 | 0.292896 | 0.420352 | [
"s704755355",
"s570247376"
] |
u235376569 | p02791 | python | s693027587 | s935366725 | 137 | 115 | 25,768 | 32,224 | Accepted | Accepted | 16.06 | N=int(eval(input()))
P=[int(x) for x in input().rstrip().split()]
mi=2*10**5+1
cnt=0
for i in P:
if i<=mi:
cnt+=1
mi=min(mi,i)
print(cnt)
| n=int(eval(input()))
p=[int(x) for x in input().rstrip().split()]
now_min=float('inf')
cnt=0
for i in range(n):
if p[i]<=now_min:
cnt+=1
now_min=p[i]
print(cnt)
| 11 | 12 | 154 | 181 | N = int(eval(input()))
P = [int(x) for x in input().rstrip().split()]
mi = 2 * 10**5 + 1
cnt = 0
for i in P:
if i <= mi:
cnt += 1
mi = min(mi, i)
print(cnt)
| n = int(eval(input()))
p = [int(x) for x in input().rstrip().split()]
now_min = float("inf")
cnt = 0
for i in range(n):
if p[i] <= now_min:
cnt += 1
now_min = p[i]
print(cnt)
| false | 8.333333 | [
"-N = int(eval(input()))",
"-P = [int(x) for x in input().rstrip().split()]",
"-mi = 2 * 10**5 + 1",
"+n = int(eval(input()))",
"+p = [int(x) for x in input().rstrip().split()]",
"+now_min = float(\"inf\")",
"-for i in P:",
"- if i <= mi:",
"+for i in range(n):",
"+ if p[i] <= now_min:",
"... | false | 0.040871 | 0.120152 | 0.340164 | [
"s693027587",
"s935366725"
] |
u994988729 | p02769 | python | s341044822 | s937275451 | 1,884 | 515 | 18,892 | 26,916 | Accepted | Accepted | 72.66 | N, K = list(map(int, input().split()))
mod = 10 ** 9 + 7
K = min(K, N - 1)
fact = [1]
facinv = [1]
for i in range(1, N + 1):
fact.append(fact[-1]*i % mod)
def nCr(n, r):
num = fact[n]
div = fact[r] * fact[n - r] % mod
return num * pow(div, mod - 2, mod) % mod
move = [0] * (N + 1)
... | from itertools import accumulate
class Combination:
def __init__(self, N, MOD=10 ** 9 + 7):
self.MOD = MOD
self.fact, self.inv = self._make_factorial_list(N)
def __call__(self, n, k):
if k < 0 or k > n:
return 0
res = self.fact[n] * self.inv[k] % self.MO... | 28 | 41 | 519 | 1,105 | N, K = list(map(int, input().split()))
mod = 10**9 + 7
K = min(K, N - 1)
fact = [1]
facinv = [1]
for i in range(1, N + 1):
fact.append(fact[-1] * i % mod)
def nCr(n, r):
num = fact[n]
div = fact[r] * fact[n - r] % mod
return num * pow(div, mod - 2, mod) % mod
move = [0] * (N + 1)
move[0] = 1
for i i... | from itertools import accumulate
class Combination:
def __init__(self, N, MOD=10**9 + 7):
self.MOD = MOD
self.fact, self.inv = self._make_factorial_list(N)
def __call__(self, n, k):
if k < 0 or k > n:
return 0
res = self.fact[n] * self.inv[k] % self.MOD
res... | false | 31.707317 | [
"-N, K = list(map(int, input().split()))",
"-mod = 10**9 + 7",
"-K = min(K, N - 1)",
"-fact = [1]",
"-facinv = [1]",
"-for i in range(1, N + 1):",
"- fact.append(fact[-1] * i % mod)",
"+from itertools import accumulate",
"-def nCr(n, r):",
"- num = fact[n]",
"- div = fact[r] * fact[n - ... | false | 0.855908 | 1.16926 | 0.732008 | [
"s341044822",
"s937275451"
] |
u312025627 | p02779 | python | s231384086 | s876090821 | 284 | 169 | 101,332 | 25,168 | Accepted | Accepted | 40.49 | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
s = set(A)
if N == len(s):
print("YES")
else:
print("NO")
if __name__ == '__main__':
main()
| def main():
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
for i in range(N-1):
if A[i] == A[i+1]:
return print("NO")
print("YES")
if __name__ == '__main__':
main()
| 12 | 12 | 212 | 239 | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
s = set(A)
if N == len(s):
print("YES")
else:
print("NO")
if __name__ == "__main__":
main()
| def main():
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
for i in range(N - 1):
if A[i] == A[i + 1]:
return print("NO")
print("YES")
if __name__ == "__main__":
main()
| false | 0 | [
"- N = int(eval(input()))",
"+ N = int(input())",
"- s = set(A)",
"- if N == len(s):",
"- print(\"YES\")",
"- else:",
"- print(\"NO\")",
"+ A.sort()",
"+ for i in range(N - 1):",
"+ if A[i] == A[i + 1]:",
"+ return print(\"NO\")",
"+ prin... | false | 0.035858 | 0.033676 | 1.064783 | [
"s231384086",
"s876090821"
] |
u137226361 | p03855 | python | s178850812 | s367407297 | 830 | 766 | 58,452 | 58,720 | Accepted | Accepted | 7.71 | from collections import Counter
n,k,l=map(int,input().split())
city1=[i for i in range(n)]
city2=[i for i in range(n)]
def root(c,x):
if x==c[x]:
return x
else:
return root(c,c[x])
def union(c,x,y):
rx=root(c,x)
ry=root(c,y)
if rx>ry:
c[rx]=ry
else:
c[ry]=rx
for i in ... | N, K, L = map(int, input().split())
par = [i for i in range(N)]
def find(x, P):
if P[x] == x:
return x
else:
b = find(P[x], P)
P[x] = b
return b
def unite(x, y, P):
root_x = find(x, P)
root_y = find(y, P)
if root_y > root_x:
P[root_x] = root... | 36 | 45 | 642 | 830 | from collections import Counter
n, k, l = map(int, input().split())
city1 = [i for i in range(n)]
city2 = [i for i in range(n)]
def root(c, x):
if x == c[x]:
return x
else:
return root(c, c[x])
def union(c, x, y):
rx = root(c, x)
ry = root(c, y)
if rx > ry:
c[rx] = ry
... | N, K, L = map(int, input().split())
par = [i for i in range(N)]
def find(x, P):
if P[x] == x:
return x
else:
b = find(P[x], P)
P[x] = b
return b
def unite(x, y, P):
root_x = find(x, P)
root_y = find(y, P)
if root_y > root_x:
P[root_x] = root_y
else:
... | false | 20 | [
"-from collections import Counter",
"-",
"-n, k, l = map(int, input().split())",
"-city1 = [i for i in range(n)]",
"-city2 = [i for i in range(n)]",
"+N, K, L = map(int, input().split())",
"+par = [i for i in range(N)]",
"-def root(c, x):",
"- if x == c[x]:",
"+def find(x, P):",
"+ if P[x]... | false | 0.046885 | 0.047777 | 0.981339 | [
"s178850812",
"s367407297"
] |
u046187684 | p03108 | python | s578252045 | s841527447 | 614 | 530 | 26,672 | 26,648 | Accepted | Accepted | 13.68 | class uf:
def __init__(self, n):
self.table = [-1] * (n + 1)
self.size = [1] * (n + 1)
def merge(self, r1, r2):
self.table[r1] = r2
self.size[r2] += self.size[r1]
self.size[r1] = 0
def find_root(self, k):
path = []
curr = k
whi... | class uf:
def __init__(self, n):
self.table = [-1] * (n + 1)
self.size = [1] * (n + 1)
def merge(self, r1, r2):
self.table[r1] = r2
self.size[r2] += self.size[r1]
self.size[r1] = 0
def find_root(self, k):
path = []
curr = k
whi... | 55 | 44 | 1,557 | 1,195 | class uf:
def __init__(self, n):
self.table = [-1] * (n + 1)
self.size = [1] * (n + 1)
def merge(self, r1, r2):
self.table[r1] = r2
self.size[r2] += self.size[r1]
self.size[r1] = 0
def find_root(self, k):
path = []
curr = k
while self.table[c... | class uf:
def __init__(self, n):
self.table = [-1] * (n + 1)
self.size = [1] * (n + 1)
def merge(self, r1, r2):
self.table[r1] = r2
self.size[r2] += self.size[r1]
self.size[r1] = 0
def find_root(self, k):
path = []
curr = k
while self.table[c... | false | 20 | [
"+ self.defrag(curr, path)",
"-",
"- def in_same_group(self, k1, k2):",
"- r1, p1 = self.find_root(k1)",
"- r2, p2 = self.find_root(k2)",
"- if r1 == r2:",
"- self.defrag(r1, p1 + p2)",
"- else:",
"- self.defrag(r1, p1)",
"- se... | false | 0.08912 | 0.040517 | 2.199561 | [
"s578252045",
"s841527447"
] |
u279605379 | p02294 | python | s538343110 | s469796547 | 40 | 30 | 7,864 | 7,708 | Accepted | Accepted | 25 | class Line:
def __init__(self,p1,p2):
if p1[1] < p2[1]:self.s=p2;self.e=p1
elif p1[1] > p2[1]:self.s=p1;self.e=p2
else:
if p1[0] < p2[0]:self.s=p1;self.e=p2
else:self.s=p2;self.e=p1
def dot(a,b):return a[0]*b[0] + a[1]*b[1]
def cross(a,b):return a[0]*b[1] - a[... | def cross(a,b):return a[0]*b[1] - a[1]*b[0]
q = list(range(int(eval(input()))))
for i in q:
a,b,c,d,e,f,g,h = [int(x) for x in input().split()]
A = [c-a,d-b]; B = [e-a,f-b]; C = [g-a,h-b];
D = [g-e,h-f]; E = [a-e,b-f]; F = [c-e,d-f];
if max(a,c) < min(e,g) or max(e,g) < min(a,c) or max(b,d) < mi... | 26 | 13 | 1,079 | 482 | class Line:
def __init__(self, p1, p2):
if p1[1] < p2[1]:
self.s = p2
self.e = p1
elif p1[1] > p2[1]:
self.s = p1
self.e = p2
else:
if p1[0] < p2[0]:
self.s = p1
self.e = p2
else:
... | def cross(a, b):
return a[0] * b[1] - a[1] * b[0]
q = list(range(int(eval(input()))))
for i in q:
a, b, c, d, e, f, g, h = [int(x) for x in input().split()]
A = [c - a, d - b]
B = [e - a, f - b]
C = [g - a, h - b]
D = [g - e, h - f]
E = [a - e, b - f]
F = [c - e, d - f]
if (
... | false | 50 | [
"-class Line:",
"- def __init__(self, p1, p2):",
"- if p1[1] < p2[1]:",
"- self.s = p2",
"- self.e = p1",
"- elif p1[1] > p2[1]:",
"- self.s = p1",
"- self.e = p2",
"- else:",
"- if p1[0] < p2[0]:",
"- ... | false | 0.103936 | 0.035327 | 2.942113 | [
"s538343110",
"s469796547"
] |
u708255304 | p03724 | python | s508204016 | s676189281 | 367 | 244 | 15,084 | 14,660 | Accepted | Accepted | 33.51 | N, M = list(map(int, input().split())) # N頂点, M個のクエリ
counter = {}
for i in range(1, N+1):
counter.setdefault(i, 0)
for i in range(M):
a, b = list(map(int, input().split()))
counter[a] += 1
counter[b] += 1
for num in list(counter.values()):
if num % 2 == 1:
print('NO')
... | from collections import defaultdict
N, M = list(map(int, input().split()))
c = defaultdict(int)
for _ in range(M):
a, b = list(map(int, input().split()))
c[a] += 1
c[b] += 1
flag = True
for k, v in list(c.items()):
if v % 2 != 0:
flag = False
if flag:
print("YES")
else:
p... | 17 | 16 | 334 | 313 | N, M = list(map(int, input().split())) # N頂点, M個のクエリ
counter = {}
for i in range(1, N + 1):
counter.setdefault(i, 0)
for i in range(M):
a, b = list(map(int, input().split()))
counter[a] += 1
counter[b] += 1
for num in list(counter.values()):
if num % 2 == 1:
print("NO")
exit()
print... | from collections import defaultdict
N, M = list(map(int, input().split()))
c = defaultdict(int)
for _ in range(M):
a, b = list(map(int, input().split()))
c[a] += 1
c[b] += 1
flag = True
for k, v in list(c.items()):
if v % 2 != 0:
flag = False
if flag:
print("YES")
else:
print("NO")
| false | 5.882353 | [
"-N, M = list(map(int, input().split())) # N頂点, M個のクエリ",
"-counter = {}",
"-for i in range(1, N + 1):",
"- counter.setdefault(i, 0)",
"-for i in range(M):",
"+from collections import defaultdict",
"+",
"+N, M = list(map(int, input().split()))",
"+c = defaultdict(int)",
"+for _ in range(M):",
... | false | 0.034223 | 0.035271 | 0.970272 | [
"s508204016",
"s676189281"
] |
u020604402 | p03729 | python | s586133509 | s797575776 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | L = list(input().split())
for i in range(len(L)-1):
if L[i][-1] != L[i+1][0]:
print("NO")
break
else:
print("YES")
| a,b,c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
print("YES")
else:
print("NO")
| 7 | 5 | 144 | 99 | L = list(input().split())
for i in range(len(L) - 1):
if L[i][-1] != L[i + 1][0]:
print("NO")
break
else:
print("YES")
| a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
print("YES")
else:
print("NO")
| false | 28.571429 | [
"-L = list(input().split())",
"-for i in range(len(L) - 1):",
"- if L[i][-1] != L[i + 1][0]:",
"- print(\"NO\")",
"- break",
"+a, b, c = input().split()",
"+if a[-1] == b[0] and b[-1] == c[0]:",
"+ print(\"YES\")",
"- print(\"YES\")",
"+ print(\"NO\")"
] | false | 0.096937 | 0.046472 | 2.085935 | [
"s586133509",
"s797575776"
] |
u588341295 | p03112 | python | s835950052 | s694600668 | 1,101 | 930 | 14,500 | 12,868 | Accepted | Accepted | 15.53 | # -*- coding: utf-8 -*-
"""
参考:https://img.atcoder.jp/abc119/editorial.pdf
・前計算しないで直接やる版
・INFがfloat('inf')だとダメで10**18にしたらいけた。INF-INFがnanになるからだった。
・上記を考慮して修正版
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_left, bisect_right
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d f... | 74 | 55 | 2,436 | 1,405 | # -*- coding: utf-8 -*-
"""
参考:https://img.atcoder.jp/abc119/editorial.pdf
・前計算しないで直接やる版
・INFがfloat('inf')だとダメで10**18にしたらいけた。INF-INFがnanになるからだった。
・上記を考慮して修正版
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_left, bisect_right
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
retur... | false | 25.675676 | [
"-\"\"\"",
"-参考:https://img.atcoder.jp/abc119/editorial.pdf",
"-・前計算しないで直接やる版",
"-・INFがfloat('inf')だとダメで10**18にしたらいけた。INF-INFがnanになるからだった。",
"-・上記を考慮して修正版",
"-\"\"\"",
"-import sys, re",
"-from collections import deque, defaultdict, Counter",
"-from math import sqrt, hypot, factorial, pi, sin, cos, ... | false | 0.047632 | 0.046987 | 1.013726 | [
"s835950052",
"s694600668"
] |
u811841526 | p02380 | python | s986563280 | s395200885 | 30 | 20 | 7,912 | 5,696 | Accepted | Accepted | 33.33 | import math
a, b, C = list(map(int, input().split()))
rad = C / 180 * math.pi
h = b * math.sin(rad)
S = a * h / 2
c = math.sqrt(h**2 + (a-b*math.cos(rad))**2)
L = a + b + c
print((S, L, h)) | import math
a, b, C = list(map(float, input().split()))
C = C / 180 * math.pi # convert to radian
h = b * math.sin(C)
S = a * h / 2
c = math.sqrt((a - b * math.cos(C)) ** 2 + h ** 2)
L = a + b + c
print(S)
print(L)
print(h)
| 8 | 14 | 188 | 236 | import math
a, b, C = list(map(int, input().split()))
rad = C / 180 * math.pi
h = b * math.sin(rad)
S = a * h / 2
c = math.sqrt(h**2 + (a - b * math.cos(rad)) ** 2)
L = a + b + c
print((S, L, h))
| import math
a, b, C = list(map(float, input().split()))
C = C / 180 * math.pi # convert to radian
h = b * math.sin(C)
S = a * h / 2
c = math.sqrt((a - b * math.cos(C)) ** 2 + h**2)
L = a + b + c
print(S)
print(L)
print(h)
| false | 42.857143 | [
"-a, b, C = list(map(int, input().split()))",
"-rad = C / 180 * math.pi",
"-h = b * math.sin(rad)",
"+a, b, C = list(map(float, input().split()))",
"+C = C / 180 * math.pi # convert to radian",
"+h = b * math.sin(C)",
"-c = math.sqrt(h**2 + (a - b * math.cos(rad)) ** 2)",
"+c = math.sqrt((a - b * mat... | false | 0.041485 | 0.041703 | 0.994793 | [
"s986563280",
"s395200885"
] |
u729133443 | p03700 | python | s685907444 | s007370795 | 1,987 | 311 | 14,092 | 71,228 | Accepted | Accepted | 84.35 | n,a,b,*h=list(map(int,open(0).read().split()));i,j=0,-(-max(h)*n//a)
while j-i>1:
k=c=(j+i+1)//2
for t in h:c+=min(0,(b*k-t)//(a-b))
if c>=0:j=k
else:i=k
print(j) | n,a,b,*h=list(map(int,open(0).read().split()));i,j=0,-(-max(h)*n//a)
while j-i>1:
k=c=(j+i)//2
for t in h:c+=min(0,(b*k-t)//(a-b))
if c>=0:j=k
else:i=k
print(j) | 7 | 7 | 166 | 164 | n, a, b, *h = list(map(int, open(0).read().split()))
i, j = 0, -(-max(h) * n // a)
while j - i > 1:
k = c = (j + i + 1) // 2
for t in h:
c += min(0, (b * k - t) // (a - b))
if c >= 0:
j = k
else:
i = k
print(j)
| n, a, b, *h = list(map(int, open(0).read().split()))
i, j = 0, -(-max(h) * n // a)
while j - i > 1:
k = c = (j + i) // 2
for t in h:
c += min(0, (b * k - t) // (a - b))
if c >= 0:
j = k
else:
i = k
print(j)
| false | 0 | [
"- k = c = (j + i + 1) // 2",
"+ k = c = (j + i) // 2"
] | false | 0.03935 | 0.044178 | 0.89072 | [
"s685907444",
"s007370795"
] |
u253681061 | p02743 | python | s128336399 | s747625334 | 35 | 17 | 5,076 | 2,940 | Accepted | Accepted | 51.43 | import math
from decimal import Decimal
a,b,c = [int(x) for x in input().split()]
if (Decimal(a).sqrt() + Decimal(b).sqrt()) < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| a,b,c = [int(x) for x in input().split()]
if c - a - b < 0:
print("No")
elif 4 * a * b < (c - a - b) ** 2:
print("Yes")
else:
print("No")
| 8 | 8 | 193 | 158 | import math
from decimal import Decimal
a, b, c = [int(x) for x in input().split()]
if (Decimal(a).sqrt() + Decimal(b).sqrt()) < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| a, b, c = [int(x) for x in input().split()]
if c - a - b < 0:
print("No")
elif 4 * a * b < (c - a - b) ** 2:
print("Yes")
else:
print("No")
| false | 0 | [
"-import math",
"-from decimal import Decimal",
"-",
"-if (Decimal(a).sqrt() + Decimal(b).sqrt()) < Decimal(c).sqrt():",
"+if c - a - b < 0:",
"+ print(\"No\")",
"+elif 4 * a * b < (c - a - b) ** 2:"
] | false | 0.148187 | 0.066701 | 2.221648 | [
"s128336399",
"s747625334"
] |
u777283665 | p02791 | python | s474685442 | s656759813 | 121 | 90 | 24,744 | 24,744 | Accepted | Accepted | 25.62 | n = int(eval(input()))
p = list(map(int, input().split()))
ans = 1
mi = p[0]
for i in range(1, n):
if mi > p[i]:
mi = p[i]
ans += 1
print(ans) | n = int(eval(input()))
p = list(map(int, input().split()))
mi = 10 ** 6
cnt = 0
for i in p:
if mi > i:
cnt += 1
mi = i
print(cnt) | 9 | 10 | 164 | 153 | n = int(eval(input()))
p = list(map(int, input().split()))
ans = 1
mi = p[0]
for i in range(1, n):
if mi > p[i]:
mi = p[i]
ans += 1
print(ans)
| n = int(eval(input()))
p = list(map(int, input().split()))
mi = 10**6
cnt = 0
for i in p:
if mi > i:
cnt += 1
mi = i
print(cnt)
| false | 10 | [
"-ans = 1",
"-mi = p[0]",
"-for i in range(1, n):",
"- if mi > p[i]:",
"- mi = p[i]",
"- ans += 1",
"-print(ans)",
"+mi = 10**6",
"+cnt = 0",
"+for i in p:",
"+ if mi > i:",
"+ cnt += 1",
"+ mi = i",
"+print(cnt)"
] | false | 0.091916 | 0.083785 | 1.097042 | [
"s474685442",
"s656759813"
] |
u672822075 | p00008 | python | s898395260 | s745631936 | 170 | 30 | 6,720 | 6,724 | Accepted | Accepted | 82.35 | while True:
try:
cnt=0
i=int(eval(input()))
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
if a+b+c+d==i:
cnt+=1
print(cnt)
except:
break | x=[0]*51
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
x[a+b+c+d]+=1
while True:
try:
print((x[int(eval(input()))]))
except:
break | 13 | 11 | 213 | 182 | while True:
try:
cnt = 0
i = int(eval(input()))
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
if a + b + c + d == i:
cnt += 1
print(cnt)
except:
... | x = [0] * 51
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
x[a + b + c + d] += 1
while True:
try:
print((x[int(eval(input()))]))
except:
break
| false | 15.384615 | [
"+x = [0] * 51",
"+for a in range(10):",
"+ for b in range(10):",
"+ for c in range(10):",
"+ for d in range(10):",
"+ x[a + b + c + d] += 1",
"- cnt = 0",
"- i = int(eval(input()))",
"- for a in range(10):",
"- for b in range(10)... | false | 0.053524 | 0.051094 | 1.047569 | [
"s898395260",
"s745631936"
] |
u525065967 | p02573 | python | s302026636 | s517948573 | 905 | 769 | 14,696 | 14,780 | Accepted | Accepted | 15.03 | class UnionFind: # simple
def __init__(self, n):
self.prsz = [-1] * n # parent ' size
def find(self, v): # root
if self.prsz[v] < 0: return v
else:
self.prsz[v] = self.find(self.prsz[v])
return self.prsz[v]
def union(self, v, u): # unite
v = s... | class UnionFind: # simple
def __init__(self, n):
self.prsz = [-1] * n # parent ' size
def find(self, v): # root
if self.prsz[v] < 0: return v
else:
self.prsz[v] = self.find(self.prsz[v])
return self.prsz[v]
def union(self, v, u): # unite
v = s... | 23 | 23 | 788 | 800 | class UnionFind: # simple
def __init__(self, n):
self.prsz = [-1] * n # parent ' size
def find(self, v): # root
if self.prsz[v] < 0:
return v
else:
self.prsz[v] = self.find(self.prsz[v])
return self.prsz[v]
def union(self, v, u): # unite
... | class UnionFind: # simple
def __init__(self, n):
self.prsz = [-1] * n # parent ' size
def find(self, v): # root
if self.prsz[v] < 0:
return v
else:
self.prsz[v] = self.find(self.prsz[v])
return self.prsz[v]
def union(self, v, u): # unite
... | false | 0 | [
"- if self.g_size(v) < self.g_size(u):",
"- v, u = u, v",
"+ if self.prsz[v] > self.prsz[u]:",
"+ v, u = u, v # size(v) < size(u)",
"- def g_size(self, v):",
"+ def size(self, v):",
"- ans = max(ans, uf.g_size(i))",
"+ ans = max(ans, uf.size(i))"
] | false | 0.046347 | 0.049557 | 0.935221 | [
"s302026636",
"s517948573"
] |
u703950586 | p02709 | python | s224697540 | s070853389 | 203 | 136 | 104,028 | 100,296 | Accepted | Accepted | 33 | import sys,math,copy,queue,itertools,bisect
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N = NI()
data = [[a,i] for i,a in enumerate(LI())]
data.sort(reverse=True)
dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(N):
a, p = data[... | import sys
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N = NI()
data = [(a,i) for i,a in enumerate(LI())]
data.sort(reverse=True)
dp = [[0] * (N+1) for _ in range(N+1)]
for i in range(N):
a, p = data[i]
for j in range(i+1):
dp[i+1]... | 16 | 16 | 500 | 455 | import sys, math, copy, queue, itertools, bisect
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())
N = NI()
data = [[a, i] for i, a in enumerate(LI())]
data.sort(reverse=True)
dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
for i in range(N):
a, p = data[i]
... | import sys
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())
N = NI()
data = [(a, i) for i, a in enumerate(LI())]
data.sort(reverse=True)
dp = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N):
a, p = data[i]
for j in range(i + 1):
dp[i + 1][j + 1]... | false | 0 | [
"-import sys, math, copy, queue, itertools, bisect",
"+import sys",
"-data = [[a, i] for i, a in enumerate(LI())]",
"+data = [(a, i) for i, a in enumerate(LI())]",
"-dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]",
"+dp = [[0] * (N + 1) for _ in range(N + 1)]"
] | false | 0.078871 | 0.074888 | 1.053183 | [
"s224697540",
"s070853389"
] |
u426534722 | p02279 | python | s334176093 | s207746177 | 1,000 | 790 | 47,636 | 47,640 | Accepted | Accepted | 21 | class Tree:
def __init__(self):
self.id = 0
self.p = -1
self.depth = -1
self.type = "leaf"
self.len_c = 0
self.c = []
def __str__(self):
return f"node {self.id}: parent = {self.p}, depth = {self.depth}, {self.type}, {self.c}"
n = int(eval(input()... | import sys
readline = sys.stdin.readline
class Tree:
def __init__(self):
self.id = 0
self.p = -1
self.depth = -1
self.type = "leaf"
self.len_c = 0
self.c = []
def __str__(self):
return f"node {self.id}: parent = {self.p}, depth = {self.depth}, {... | 39 | 41 | 896 | 942 | class Tree:
def __init__(self):
self.id = 0
self.p = -1
self.depth = -1
self.type = "leaf"
self.len_c = 0
self.c = []
def __str__(self):
return f"node {self.id}: parent = {self.p}, depth = {self.depth}, {self.type}, {self.c}"
n = int(eval(input()))
li =... | import sys
readline = sys.stdin.readline
class Tree:
def __init__(self):
self.id = 0
self.p = -1
self.depth = -1
self.type = "leaf"
self.len_c = 0
self.c = []
def __str__(self):
return f"node {self.id}: parent = {self.p}, depth = {self.depth}, {self.ty... | false | 4.878049 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+",
"+",
"- id, k, *c = list(map(int, input().split()))",
"+ id, k, *c = list(map(int, readline().split()))"
] | false | 0.039141 | 0.046022 | 0.850475 | [
"s334176093",
"s207746177"
] |
u631277801 | p03309 | python | s623384136 | s138077562 | 247 | 214 | 27,684 | 27,280 | Accepted | Accepted | 13.36 | N = int(eval(input()))
A = list(map(int,input().split()))
#N = 1
#A = [10**9]*N
A_n = [A[i-1] - i for i in range(1,N+1)]
A_n.sort()
if N%2 == 0:
cent_max = A_n[N//2]
cent_min = A_n[N//2-1]
else:
cent = A_n[N//2]
if N%2 == 0:
sadness1 = sum([abs(A_n[i]-cent_min) for i in ran... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readl... | 25 | 22 | 506 | 603 | N = int(eval(input()))
A = list(map(int, input().split()))
# N = 1
# A = [10**9]*N
A_n = [A[i - 1] - i for i in range(1, N + 1)]
A_n.sort()
if N % 2 == 0:
cent_max = A_n[N // 2]
cent_min = A_n[N // 2 - 1]
else:
cent = A_n[N // 2]
if N % 2 == 0:
sadness1 = sum([abs(A_n[i] - cent_min) for i in range(N)])
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 12 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-# N = 1",
"-# A = [10**9]*N",
"-A_n = [A[i - 1] - i for i in range(1, N + 1)]",
"-A_n.sort()",
"-if N % 2 == 0:",
"- cent_max = A_n[N // 2]",
"- cent_min = A_n[N // 2 - 1]",
"-else:",
"- cent = A_n[N // 2]",
"-if N %... | false | 0.045397 | 0.044605 | 1.017744 | [
"s623384136",
"s138077562"
] |
u057109575 | p02696 | python | s254181273 | s527353350 | 66 | 61 | 61,760 | 61,820 | Accepted | Accepted | 7.58 |
A, B, N = list(map(int, input().split()))
x = min(B - 1, N)
print(((A * x) // B - A * (x // B)))
|
A, B, N = list(map(int, input().split()))
if N >= B:
print((A * (B - 1) // B))
else:
print((A * N // B))
| 5 | 7 | 95 | 111 | A, B, N = list(map(int, input().split()))
x = min(B - 1, N)
print(((A * x) // B - A * (x // B)))
| A, B, N = list(map(int, input().split()))
if N >= B:
print((A * (B - 1) // B))
else:
print((A * N // B))
| false | 28.571429 | [
"-x = min(B - 1, N)",
"-print(((A * x) // B - A * (x // B)))",
"+if N >= B:",
"+ print((A * (B - 1) // B))",
"+else:",
"+ print((A * N // B))"
] | false | 0.04324 | 0.043529 | 0.993358 | [
"s254181273",
"s527353350"
] |
u706929073 | p03354 | python | s967518245 | s458298987 | 658 | 595 | 36,124 | 36,124 | Accepted | Accepted | 9.57 | n, m = list(map(int, input().split()))
p = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]
par = [i for i in range(n)]
rank = [1 for _ in range(n)]
def root(x):
if x == par[x]:
return x
par[x] = root(par[x])
return par[x]
def is_same(x, y)... | n, m = list(map(int, input().split()))
p = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]
par = [i for i in range(n)]
rank = [0 for _ in range(n)]
def root(x):
if x == par[x]:
return x
par[x] = root(par[x]) # 経路圧縮
return par[x]
def is_sa... | 35 | 40 | 601 | 729 | n, m = list(map(int, input().split()))
p = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]
par = [i for i in range(n)]
rank = [1 for _ in range(n)]
def root(x):
if x == par[x]:
return x
par[x] = root(par[x])
return par[x]
def is_same(x, y):
return roo... | n, m = list(map(int, input().split()))
p = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]
par = [i for i in range(n)]
rank = [0 for _ in range(n)]
def root(x):
if x == par[x]:
return x
par[x] = root(par[x]) # 経路圧縮
return par[x]
def is_same(x, y):
re... | false | 12.5 | [
"-rank = [1 for _ in range(n)]",
"+rank = [0 for _ in range(n)]",
"- par[x] = root(par[x])",
"+ par[x] = root(par[x]) # 経路圧縮",
"- par[x] = y",
"+ if rank[x] < rank[y]:",
"+ par[x] = y",
"+ else:",
"+ par[y] = x",
"+ if rank[x] == rank[y]:",
"+ rank... | false | 0.035283 | 0.031752 | 1.1112 | [
"s967518245",
"s458298987"
] |
u102461423 | p02680 | python | s389804262 | s115598107 | 2,262 | 1,238 | 179,540 | 180,024 | Accepted | Accepted | 45.27 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
N, M = list(map(int, readline().split()))
data = np.int64(read().split()).reshape(-1, 3)
A = data[:N, 0]
B = data[:N, 1]
C = da... | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np... | 95 | 95 | 2,127 | 2,279 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
N, M = list(map(int, readline().split()))
data = np.int64(read().split()).reshape(-1, 3)
A = data[:N, 0]
B = data[:N, 1]
C = data[:N, 2]
D = data... | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np.concatenate([... | false | 0 | [
"-N, M = list(map(int, readline().split()))",
"-data = np.int64(read().split()).reshape(-1, 3)",
"-A = data[:N, 0]",
"-B = data[:N, 1]",
"-C = data[:N, 2]",
"-D = data[N:, 0]",
"-E = data[N:, 1]",
"-F = data[N:, 2]",
"-X = np.unique(np.concatenate([A, B, D, [0, -INF, INF]]))",
"-Y = np.unique(np.c... | false | 0.157724 | 0.408213 | 0.386376 | [
"s389804262",
"s115598107"
] |
u351426847 | p03567 | python | s156054365 | s561549433 | 14 | 11 | 2,696 | 2,568 | Accepted | Accepted | 21.43 | # coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ!!
if __name__ == '__main__':
S = input()
flg = True
for index in range(len(S) - 1):
if S[index]+S[index+1] == 'AC':
print('Yes')
flg = False
break
if flg:
print('No')
| # coding: utf-8
if __name__ == '__main__':
S = input()
if 'AC' in S:
print('Yes')
else:
print('No')
| 13 | 7 | 291 | 136 | # coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ!!
if __name__ == "__main__":
S = input()
flg = True
for index in range(len(S) - 1):
if S[index] + S[index + 1] == "AC":
print("Yes")
flg = False
break
if flg:
print("No")
| # coding: utf-8
if __name__ == "__main__":
S = input()
if "AC" in S:
print("Yes")
else:
print("No")
| false | 46.153846 | [
"-# 自分の得意な言語で",
"-# Let's チャレンジ!!",
"- flg = True",
"- for index in range(len(S) - 1):",
"- if S[index] + S[index + 1] == \"AC\":",
"- print(\"Yes\")",
"- flg = False",
"- break",
"- if flg:",
"+ if \"AC\" in S:",
"+ print(\"Yes\")",
"... | false | 0.040724 | 0.074129 | 0.549371 | [
"s156054365",
"s561549433"
] |
u796942881 | p03681 | python | s075556415 | s514153883 | 56 | 39 | 3,572 | 3,572 | Accepted | Accepted | 30.36 | from functools import reduce
INF = int(1e9 + 7)
def modmulti(a, b):
# aとbを掛けた値をmodする(a * b mod p)
return a * b % INF
def factorial(x):
FCT = 1
FCT = reduce(modmulti, list(range(2, x + 1)), FCT)
return FCT
def main():
N, M = list(map(int, input().split()))
if N == M or ... | from functools import reduce
INF = int(1e9 + 7)
def modmulti(a, b):
# aとbを掛けた値をmodする(a * b mod p)
return a * b % INF
def factorial(x):
FCT = 1
FCT = reduce(modmulti, list(range(2, x + 1)), FCT)
return FCT
def main():
N, M = list(map(int, input().split()))
MIN_NM = fact... | 27 | 28 | 522 | 554 | from functools import reduce
INF = int(1e9 + 7)
def modmulti(a, b):
# aとbを掛けた値をmodする(a * b mod p)
return a * b % INF
def factorial(x):
FCT = 1
FCT = reduce(modmulti, list(range(2, x + 1)), FCT)
return FCT
def main():
N, M = list(map(int, input().split()))
if N == M or N + 1 == M or N ... | from functools import reduce
INF = int(1e9 + 7)
def modmulti(a, b):
# aとbを掛けた値をmodする(a * b mod p)
return a * b % INF
def factorial(x):
FCT = 1
FCT = reduce(modmulti, list(range(2, x + 1)), FCT)
return FCT
def main():
N, M = list(map(int, input().split()))
MIN_NM = factorial(min(N, M))... | false | 3.571429 | [
"+ MIN_NM = factorial(min(N, M))",
"- modmulti(2, modmulti(factorial(N), factorial(M)))",
"+ modmulti(2, modmulti(MIN_NM, MIN_NM))",
"- else modmulti(factorial(N), factorial(M))",
"+ else modmulti(MIN_NM, modmulti(MIN_NM, max(N, M)))"
] | false | 0.090236 | 0.078811 | 1.144969 | [
"s075556415",
"s514153883"
] |
u727148417 | p02912 | python | s585814268 | s982482826 | 765 | 162 | 14,436 | 14,252 | Accepted | Accepted | 78.82 | import heapq
import math
#これを加える!!!!
def _heappush_max(heap, item):
heap.append(item)
heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
"""Maxheap version of a heappop."""
lastelt = heap.pop() # raises appropriate IndexError if heap is empty
if heap:
returnitem =... | import heapq
n, m = list(map(int, input().split()))
a = list([int(x)*(-1) for x in input().split()])
heapq.heapify(a) # aを優先度付きキューに
for _ in range(m):
tmp_min = heapq.heappop(a)
heapq.heappush(a, (-1)*(-tmp_min//2)) # 計算誤差の関係で-1を2回かけてます
print((-sum(a))) | 45 | 10 | 920 | 271 | import heapq
import math
# これを加える!!!!
def _heappush_max(heap, item):
heap.append(item)
heapq._siftdown_max(heap, 0, len(heap) - 1)
def _heappop_max(heap):
"""Maxheap version of a heappop."""
lastelt = heap.pop() # raises appropriate IndexError if heap is empty
if heap:
returnitem = heap[... | import heapq
n, m = list(map(int, input().split()))
a = list([int(x) * (-1) for x in input().split()])
heapq.heapify(a) # aを優先度付きキューに
for _ in range(m):
tmp_min = heapq.heappop(a)
heapq.heappush(a, (-1) * (-tmp_min // 2)) # 計算誤差の関係で-1を2回かけてます
print((-sum(a)))
| false | 77.777778 | [
"-import math",
"-# これを加える!!!!",
"-def _heappush_max(heap, item):",
"- heap.append(item)",
"- heapq._siftdown_max(heap, 0, len(heap) - 1)",
"-",
"-",
"-def _heappop_max(heap):",
"- \"\"\"Maxheap version of a heappop.\"\"\"",
"- lastelt = heap.pop() # raises appropriate IndexError if h... | false | 0.113262 | 0.059027 | 1.918833 | [
"s585814268",
"s982482826"
] |
u888092736 | p02624 | python | s592852877 | s787860165 | 2,001 | 560 | 188,648 | 108,928 | Accepted | Accepted | 72.01 | from numba import njit
import numpy as np
@njit("i8(i8)")
def solve(n):
ans = 1
res = np.ones(n + 1, dtype=np.int64)
for i in range(2, n + 1):
for j in range(i, n + 1, i):
res[j] += 1
ans += i * res[i]
return ans
N = int(eval(input()))
print((solve(N)))
| from numba import njit, i8
@njit(i8(i8))
def solve(N):
ans = 0
for i in range(1, N + 1):
for j in range(i, N + 1, i):
ans += j
return ans
N = int(eval(input()))
print((solve(N)))
| 17 | 14 | 310 | 220 | from numba import njit
import numpy as np
@njit("i8(i8)")
def solve(n):
ans = 1
res = np.ones(n + 1, dtype=np.int64)
for i in range(2, n + 1):
for j in range(i, n + 1, i):
res[j] += 1
ans += i * res[i]
return ans
N = int(eval(input()))
print((solve(N)))
| from numba import njit, i8
@njit(i8(i8))
def solve(N):
ans = 0
for i in range(1, N + 1):
for j in range(i, N + 1, i):
ans += j
return ans
N = int(eval(input()))
print((solve(N)))
| false | 17.647059 | [
"-from numba import njit",
"-import numpy as np",
"+from numba import njit, i8",
"-@njit(\"i8(i8)\")",
"-def solve(n):",
"- ans = 1",
"- res = np.ones(n + 1, dtype=np.int64)",
"- for i in range(2, n + 1):",
"- for j in range(i, n + 1, i):",
"- res[j] += 1",
"- a... | false | 0.129506 | 0.039076 | 3.314199 | [
"s592852877",
"s787860165"
] |
u707124227 | p02586 | python | s579858412 | s324372711 | 1,426 | 1,117 | 140,172 | 131,424 | Accepted | Accepted | 21.67 | import sys
input = sys.stdin.readline
def main(R,C,K,rcv):
inf=float('inf')
dp0=[[-inf,-inf,-inf,0] for _ in range(C)]
# dp0[i][j]:i列目の時点で残りちょうどj個取れる時の最大値
rcv.sort(key=lambda x:C*R*x[0]+x[1])
i=0
nowc=0
for j in range(R):
# j+1行目に対する操作
# 初期化
for c in range(C):
dp0[c][3]=max(... | import sys
input = sys.stdin.readline
# 文字列をinput()した場合、末尾に改行が入るので注意
def main(R,C,K,rcv):
inf=float('inf')
dp0=[[-inf,-inf,-inf,0] for _ in range(C)]
dp1=[[-inf]*4 for _ in range(C)]
dp0[0][3]=0
rcv.sort(key=lambda x:C*R*x[0]+x[1])
i=0
nowc=0
while i<K and rcv[i][0]==1:
nextc=rcv[i][1]-1... | 40 | 64 | 1,206 | 1,739 | import sys
input = sys.stdin.readline
def main(R, C, K, rcv):
inf = float("inf")
dp0 = [[-inf, -inf, -inf, 0] for _ in range(C)]
# dp0[i][j]:i列目の時点で残りちょうどj個取れる時の最大値
rcv.sort(key=lambda x: C * R * x[0] + x[1])
i = 0
nowc = 0
for j in range(R):
# j+1行目に対する操作
# 初期化
fo... | import sys
input = sys.stdin.readline
# 文字列をinput()した場合、末尾に改行が入るので注意
def main(R, C, K, rcv):
inf = float("inf")
dp0 = [[-inf, -inf, -inf, 0] for _ in range(C)]
dp1 = [[-inf] * 4 for _ in range(C)]
dp0[0][3] = 0
rcv.sort(key=lambda x: C * R * x[0] + x[1])
i = 0
nowc = 0
while i < K and r... | false | 37.5 | [
"-",
"-",
"+# 文字列をinput()した場合、末尾に改行が入るので注意",
"- # dp0[i][j]:i列目の時点で残りちょうどj個取れる時の最大値",
"+ dp1 = [[-inf] * 4 for _ in range(C)]",
"+ dp0[0][3] = 0",
"- for j in range(R):",
"- # j+1行目に対する操作",
"- # 初期化",
"+ while i < K and rcv[i][0] == 1:",
"+ nextc = rcv[i][1] -... | false | 0.032201 | 0.037797 | 0.851947 | [
"s579858412",
"s324372711"
] |
u318345739 | p02573 | python | s244196346 | s562711921 | 1,730 | 1,532 | 85,204 | 85,100 | Accepted | Accepted | 11.45 | class UFTree:
def __init__(self, N):
self.nodes = [Node(i) for i in range(N)]
self.N = N
def find_max_child_num(self):
result = 0
for i in range(self.N):
result = max(result, self.nodes[i].child_num)
return result
class Node:
def __init__(sel... | class UFTree:
def __init__(self, N):
self.nodes = [Node(i) for i in range(N)]
self.N = N
def find_max_child_num(self):
result = 0
for i in range(self.N):
result = max(result, self.nodes[i].child_num)
return result
class Node:
def __init__(sel... | 67 | 57 | 1,592 | 1,304 | class UFTree:
def __init__(self, N):
self.nodes = [Node(i) for i in range(N)]
self.N = N
def find_max_child_num(self):
result = 0
for i in range(self.N):
result = max(result, self.nodes[i].child_num)
return result
class Node:
def __init__(self, ID):
... | class UFTree:
def __init__(self, N):
self.nodes = [Node(i) for i in range(N)]
self.N = N
def find_max_child_num(self):
result = 0
for i in range(self.N):
result = max(result, self.nodes[i].child_num)
return result
class Node:
def __init__(self, ID):
... | false | 14.925373 | [
"- def is_in_same_tree(self, another):",
"- return self.get_root().ID == another.get_root().ID",
"-",
"- if self.is_in_same_tree(another):",
"- return",
"+ # is in a same tree.",
"+ if sr.ID == ar.ID:",
"+ return",
"-# # for debug",
"-# for i in... | false | 0.03126 | 0.076668 | 0.407732 | [
"s244196346",
"s562711921"
] |
u583507988 | p03290 | python | s045286611 | s796406633 | 56 | 34 | 9,224 | 9,160 | Accepted | Accepted | 39.29 | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
pc = pc[::-1]
#print(pc)
ans = float('inf')
for i in range(2**d):
total = 0
cnt = 0
for j in range(d):
if (i>>j) & 1:
total += 100*(d-j)*pc[j][0] + pc[j][1]
cnt += pc[j][0]
if total >=... | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
ans = float('inf')
for i in range(1 << d):
count = 0
sum = 0
nokori = set(range(1, d+1))
for j in range(d):
if i & (1<<j):
sum += pc[j][0] * (j+1) * 100 + pc[j][1]
count += pc[j][0]
... | 27 | 26 | 595 | 538 | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
pc = pc[::-1]
# print(pc)
ans = float("inf")
for i in range(2**d):
total = 0
cnt = 0
for j in range(d):
if (i >> j) & 1:
total += 100 * (d - j) * pc[j][0] + pc[j][1]
cnt += pc[j][0... | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
ans = float("inf")
for i in range(1 << d):
count = 0
sum = 0
nokori = set(range(1, d + 1))
for j in range(d):
if i & (1 << j):
sum += pc[j][0] * (j + 1) * 100 + pc[j][1]
count ... | false | 3.703704 | [
"-pc = pc[::-1]",
"-# print(pc)",
"-for i in range(2**d):",
"- total = 0",
"- cnt = 0",
"+for i in range(1 << d):",
"+ count = 0",
"+ sum = 0",
"+ nokori = set(range(1, d + 1))",
"- if (i >> j) & 1:",
"- total += 100 * (d - j) * pc[j][0] + pc[j][1]",
"- ... | false | 0.043793 | 0.037242 | 1.175903 | [
"s045286611",
"s796406633"
] |
u593973932 | p03325 | python | s866182492 | s038071258 | 116 | 94 | 3,828 | 3,956 | Accepted | Accepted | 18.97 | eval(input())
a = list(map(int, input().split(' ')))
ans = 0
for ax in a:
while ax % 2 == 0:
ax /= 2
ans += 1
print(ans)
| eval(input())
a = list(map(int, input().split(' ')))
ans = 0
for ax in a:
while ax % 2 == 0:
ax //= 2
ans += 1
print(ans)
| 10 | 10 | 140 | 141 | eval(input())
a = list(map(int, input().split(" ")))
ans = 0
for ax in a:
while ax % 2 == 0:
ax /= 2
ans += 1
print(ans)
| eval(input())
a = list(map(int, input().split(" ")))
ans = 0
for ax in a:
while ax % 2 == 0:
ax //= 2
ans += 1
print(ans)
| false | 0 | [
"- ax /= 2",
"+ ax //= 2"
] | false | 0.050078 | 0.049421 | 1.013296 | [
"s866182492",
"s038071258"
] |
u021019433 | p02773 | python | s325925624 | s206072151 | 912 | 829 | 44,544 | 32,352 | Accepted | Accepted | 9.1 | from collections import Counter
from itertools import groupby
from operator import itemgetter
c = Counter(eval(input()) for _ in range(int(eval(input()))))
a = sorted((-c[x],x) for x in c)
for _, s in next(groupby(a, itemgetter(0)))[1]:
print(s)
| from itertools import groupby
from operator import itemgetter
a = sorted(eval(input()) for _ in range(int(eval(input()))))
a = sorted((-sum(1 for _ in g), s) for s, g in groupby(a))
for _, s in next(groupby(a, itemgetter(0)))[1]:
print(s)
| 8 | 7 | 244 | 236 | from collections import Counter
from itertools import groupby
from operator import itemgetter
c = Counter(eval(input()) for _ in range(int(eval(input()))))
a = sorted((-c[x], x) for x in c)
for _, s in next(groupby(a, itemgetter(0)))[1]:
print(s)
| from itertools import groupby
from operator import itemgetter
a = sorted(eval(input()) for _ in range(int(eval(input()))))
a = sorted((-sum(1 for _ in g), s) for s, g in groupby(a))
for _, s in next(groupby(a, itemgetter(0)))[1]:
print(s)
| false | 12.5 | [
"-from collections import Counter",
"-c = Counter(eval(input()) for _ in range(int(eval(input()))))",
"-a = sorted((-c[x], x) for x in c)",
"+a = sorted(eval(input()) for _ in range(int(eval(input()))))",
"+a = sorted((-sum(1 for _ in g), s) for s, g in groupby(a))"
] | false | 0.067113 | 0.149739 | 0.448198 | [
"s325925624",
"s206072151"
] |
u197955752 | p02585 | python | s033163215 | s167476942 | 1,964 | 1,723 | 169,232 | 169,468 | Accepted | Accepted | 12.27 | from collections import defaultdict
INF = float('inf')
N, K = [int(x) for x in input().split()]
P = [0] + [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]
max_score = -INF
for init in range(1, N + 1): # 初めの場所をiとする
score = defaultdict(int) # int/bool/list....
visited = [... | from collections import defaultdict
N, K = [int(x) for x in input().split()]
P = [0] + [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]
max_score = max(C[1:])
for init in range(1, N + 1): # 初めの場所をiとする
score = defaultdict(int) # int/bool/list....
visited = [-1] * (N + 1... | 61 | 52 | 1,729 | 1,461 | from collections import defaultdict
INF = float("inf")
N, K = [int(x) for x in input().split()]
P = [0] + [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]
max_score = -INF
for init in range(1, N + 1): # 初めの場所をiとする
score = defaultdict(int) # int/bool/list....
visited = [-1] * (N +... | from collections import defaultdict
N, K = [int(x) for x in input().split()]
P = [0] + [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]
max_score = max(C[1:])
for init in range(1, N + 1): # 初めの場所をiとする
score = defaultdict(int) # int/bool/list....
visited = [-1] * (N + 1)
visit... | false | 14.754098 | [
"-INF = float(\"inf\")",
"-max_score = -INF",
"+max_score = max(C[1:])",
"- # max_init = -INF",
"- # max_init = max(max_init, score[i])",
"- # max_init = max(max_init, score[i])",
"- max_score = max(max_score, score[i])",
"- if k == K:",
"- break # これ以上... | false | 0.038592 | 0.111899 | 0.344886 | [
"s033163215",
"s167476942"
] |
u186838327 | p02945 | python | s156259479 | s296588416 | 177 | 17 | 38,556 | 2,940 | Accepted | Accepted | 90.4 | a, b = list(map(int, input().split()))
print((max(a+b, a-b, a*b))) | a, b = list(map(int, input().split()))
print((max([a+b, a-b, a*b])))
| 2 | 2 | 60 | 62 | a, b = list(map(int, input().split()))
print((max(a + b, a - b, a * b)))
| a, b = list(map(int, input().split()))
print((max([a + b, a - b, a * b])))
| false | 0 | [
"-print((max(a + b, a - b, a * b)))",
"+print((max([a + b, a - b, a * b])))"
] | false | 0.04505 | 0.039712 | 1.134421 | [
"s156259479",
"s296588416"
] |
u268793453 | p03255 | python | s365243884 | s518625372 | 1,938 | 1,013 | 31,676 | 31,180 | Accepted | Accepted | 47.73 | n, p = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
ans = []
S = [0]
for x in X:
S.append(S[-1] + x)
for t in range(1, n+1):
cur = n - t
time = 5
tmp = time * (S[-1] - S[cur]) + (t + n) * p
cur -= t
while True:
tmp += time * (S[cur+t] - S[max(... | n, p = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
ans = []
S = [0]
for x in X:
S.append(S[-1] + x)
for t in range(1, n+1):
tmp = 5 * S[n] + (t + n) * p
cur = n - t * 2
while cur > 0:
tmp += 2 * S[cur]
cur -= t
ans.append(tmp)
print(... | 24 | 19 | 448 | 329 | n, p = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
ans = []
S = [0]
for x in X:
S.append(S[-1] + x)
for t in range(1, n + 1):
cur = n - t
time = 5
tmp = time * (S[-1] - S[cur]) + (t + n) * p
cur -= t
while True:
tmp += time * (S[cur + t] - S[max(0, cur)])
... | n, p = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
ans = []
S = [0]
for x in X:
S.append(S[-1] + x)
for t in range(1, n + 1):
tmp = 5 * S[n] + (t + n) * p
cur = n - t * 2
while cur > 0:
tmp += 2 * S[cur]
cur -= t
ans.append(tmp)
print((min(ans)))
| false | 20.833333 | [
"- cur = n - t",
"- time = 5",
"- tmp = time * (S[-1] - S[cur]) + (t + n) * p",
"- cur -= t",
"- while True:",
"- tmp += time * (S[cur + t] - S[max(0, cur)])",
"- if cur <= 0:",
"- break",
"+ tmp = 5 * S[n] + (t + n) * p",
"+ cur = n - t * 2",
"+ ... | false | 0.098993 | 0.155736 | 0.63565 | [
"s365243884",
"s518625372"
] |
u186838327 | p02881 | python | s736625417 | s584664387 | 116 | 85 | 3,268 | 68,308 | Accepted | Accepted | 26.72 | n =int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
#divisors.sort(reverse=True)
return divisors
l = make_divisors(n)
ans = float... | n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divisors
d = make_divisors(n)
ans = 10**18
for a in ... | 17 | 17 | 379 | 361 | n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort(reverse=True)
return divisors
l = make_divisors(n)
ans = float("inf... | n = int(eval(input()))
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
d = make_divisors(n)
ans = 10**18
for a in d:
a... | false | 0 | [
"- # divisors.sort(reverse=True)",
"+ divisors.sort()",
"-l = make_divisors(n)",
"-ans = float(\"inf\")",
"-for i in l:",
"- ans = min(ans, i - 1 + n // i - 1)",
"+d = make_divisors(n)",
"+ans = 10**18",
"+for a in d:",
"+ ans = min(ans, n // a - 1 + a - 1)"
] | false | 0.035788 | 0.038489 | 0.929815 | [
"s736625417",
"s584664387"
] |
u160244242 | p03401 | python | s259414723 | s052210614 | 221 | 153 | 14,172 | 20,388 | Accepted | Accepted | 30.77 | n = int(eval(input()))
lst = list(map(int, input().split()))
lst.insert(0, 0)
lst.append(0)
s = 0
for i in range(len(lst)-1):
s += abs(lst[i+1]-lst[i])
for i in range(1, len(lst)-1):
a = lst[i-1]
b = lst[i]
c = lst[i+1]
if (b - a > 0 and c - b > 0) or (b - a < 0 and c - b < 0):
... | n = int(eval(input()))
lst = list(map(int,input().split()))
s = 0
diff_lst = []
sign_lst = []
for i in lst + [0]:
diff = i - s
diff_lst.append(abs(diff))
sign_lst.append(1) if diff > 0 else sign_lst.append(-1)
s = i
su = sum(diff_lst)
for i in range(n):
if sign_lst[i] * sign_lst[i+1]... | 17 | 18 | 391 | 433 | n = int(eval(input()))
lst = list(map(int, input().split()))
lst.insert(0, 0)
lst.append(0)
s = 0
for i in range(len(lst) - 1):
s += abs(lst[i + 1] - lst[i])
for i in range(1, len(lst) - 1):
a = lst[i - 1]
b = lst[i]
c = lst[i + 1]
if (b - a > 0 and c - b > 0) or (b - a < 0 and c - b < 0):
p... | n = int(eval(input()))
lst = list(map(int, input().split()))
s = 0
diff_lst = []
sign_lst = []
for i in lst + [0]:
diff = i - s
diff_lst.append(abs(diff))
sign_lst.append(1) if diff > 0 else sign_lst.append(-1)
s = i
su = sum(diff_lst)
for i in range(n):
if sign_lst[i] * sign_lst[i + 1] > 0:
... | false | 5.555556 | [
"-lst.insert(0, 0)",
"-lst.append(0)",
"-for i in range(len(lst) - 1):",
"- s += abs(lst[i + 1] - lst[i])",
"-for i in range(1, len(lst) - 1):",
"- a = lst[i - 1]",
"- b = lst[i]",
"- c = lst[i + 1]",
"- if (b - a > 0 and c - b > 0) or (b - a < 0 and c - b < 0):",
"- print(s)... | false | 0.033467 | 0.04418 | 0.757509 | [
"s259414723",
"s052210614"
] |
u062147869 | p03143 | python | s260611657 | s714583661 | 1,237 | 1,084 | 126,748 | 111,896 | Accepted | Accepted | 12.37 | import sys
input = sys.stdin.readline
from collections import deque
class Unionfindtree:
def __init__(self, number,L):
self.par = [i for i in range(number)]
self.rank = [0] * (number)
self.count = L
def find(self, x): # 親を探す
if self.par[x] == x:
return x
... | import sys
input = sys.stdin.readline
from collections import deque
class Unionfindtree:
def __init__(self, number,L):
self.par = [i for i in range(number)]
self.rank = [0] * (number)
self.cost = L
self.count = [0] * (number)
def find(self, x): # 親を探す
if self... | 86 | 61 | 1,854 | 1,541 | import sys
input = sys.stdin.readline
from collections import deque
class Unionfindtree:
def __init__(self, number, L):
self.par = [i for i in range(number)]
self.rank = [0] * (number)
self.count = L
def find(self, x): # 親を探す
if self.par[x] == x:
return x
... | import sys
input = sys.stdin.readline
from collections import deque
class Unionfindtree:
def __init__(self, number, L):
self.par = [i for i in range(number)]
self.rank = [0] * (number)
self.cost = L
self.count = [0] * (number)
def find(self, x): # 親を探す
if self.par[x]... | false | 29.069767 | [
"- self.count = L",
"+ self.cost = L",
"+ self.count = [0] * (number)",
"+ self.count[py] += 1",
"- self.count[py] += self.count[px]",
"+ self.cost[py] += self.cost[px]",
"+ self.count[py] += self.count[px] + 1",
"- self.count... | false | 0.040307 | 0.040885 | 0.985853 | [
"s260611657",
"s714583661"
] |
u644907318 | p03575 | python | s304225932 | s284559136 | 228 | 82 | 43,100 | 74,512 | Accepted | Accepted | 64.04 | def find(x):
if x != T[x][0]:
while x!=T[x][0]:
x = T[x][0]
return x
def union(x,y):
rt0 = find(x)
rt1 = find(y)
if T[rt0][1]>T[rt1][1]:
T[rt1][0] = rt0
elif T[rt0][1]==T[rt1][1]:
T[rt1][0] = rt0
T[rt0][1] += 1
else:
T[rt0][0]... | from collections import deque
N,M = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(M)]
cnt = 0
for x in A:
G = {i:[] for i in range(1,N+1)}
for y in A:
if y!=x:
a,b = y
G[a].append(b)
G[b].append(a)
hist = [0 for _ in ... | 33 | 23 | 763 | 568 | def find(x):
if x != T[x][0]:
while x != T[x][0]:
x = T[x][0]
return x
def union(x, y):
rt0 = find(x)
rt1 = find(y)
if T[rt0][1] > T[rt1][1]:
T[rt1][0] = rt0
elif T[rt0][1] == T[rt1][1]:
T[rt1][0] = rt0
T[rt0][1] += 1
else:
T[rt0][0] = rt... | from collections import deque
N, M = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(M)]
cnt = 0
for x in A:
G = {i: [] for i in range(1, N + 1)}
for y in A:
if y != x:
a, b = y
G[a].append(b)
G[b].append(a)
hist = [0 for _ in ... | false | 30.30303 | [
"-def find(x):",
"- if x != T[x][0]:",
"- while x != T[x][0]:",
"- x = T[x][0]",
"- return x",
"-",
"-",
"-def union(x, y):",
"- rt0 = find(x)",
"- rt1 = find(y)",
"- if T[rt0][1] > T[rt1][1]:",
"- T[rt1][0] = rt0",
"- elif T[rt0][1] == T[rt1][1]:",... | false | 0.070338 | 0.03546 | 1.983567 | [
"s304225932",
"s284559136"
] |
u893063840 | p03716 | python | s791382714 | s051133067 | 630 | 452 | 37,836 | 38,188 | Accepted | Accepted | 28.25 | # -*- coding: utf-8 -*-
import heapq
class MaxHeap:
def __init__(self, li):
self.heap = [-e for e in li]
heapq.heapify(self.heap)
def push(self, val):
heapq.heappush(self.heap, -val)
def pop(self):
return -heapq.heappop(self.heap)
n = int(eval(input())... | from heapq import heapify, heappop, heappush
class MaxHeap:
def __init__(self, li):
self.hp = []
for e in li:
heappush(self.hp, -e)
def push(self, x):
heappush(self.hp, -x)
def pop(self):
ret = heappop(self.hp)
ret *= -1
return r... | 50 | 58 | 972 | 975 | # -*- coding: utf-8 -*-
import heapq
class MaxHeap:
def __init__(self, li):
self.heap = [-e for e in li]
heapq.heapify(self.heap)
def push(self, val):
heapq.heappush(self.heap, -val)
def pop(self):
return -heapq.heappop(self.heap)
n = int(eval(input()))
a = list(map(int... | from heapq import heapify, heappop, heappush
class MaxHeap:
def __init__(self, li):
self.hp = []
for e in li:
heappush(self.hp, -e)
def push(self, x):
heappush(self.hp, -x)
def pop(self):
ret = heappop(self.hp)
ret *= -1
return ret
def sea... | false | 13.793103 | [
"-# -*- coding: utf-8 -*-",
"-import heapq",
"+from heapq import heapify, heappop, heappush",
"- self.heap = [-e for e in li]",
"- heapq.heapify(self.heap)",
"+ self.hp = []",
"+ for e in li:",
"+ heappush(self.hp, -e)",
"- def push(self, val):",
"- ... | false | 0.1099 | 0.034466 | 3.188605 | [
"s791382714",
"s051133067"
] |
u350491208 | p02572 | python | s563265139 | s585291963 | 152 | 126 | 31,660 | 31,404 | Accepted | Accepted | 17.11 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
su = 0
a = 0
for i in range(N-1,-1,-1):
su+= (A[i] * a) % mod
a += A[i]
print((su % mod)) | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
B = list([x ** 2 for x in A])
SA = sum(A)
SB = sum(B)
print((((SA * SA - SB) // 2) % mod)) | 10 | 10 | 176 | 176 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
su = 0
a = 0
for i in range(N - 1, -1, -1):
su += (A[i] * a) % mod
a += A[i]
print((su % mod))
| N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
B = list([x**2 for x in A])
SA = sum(A)
SB = sum(B)
print((((SA * SA - SB) // 2) % mod))
| false | 0 | [
"-su = 0",
"-a = 0",
"-for i in range(N - 1, -1, -1):",
"- su += (A[i] * a) % mod",
"- a += A[i]",
"-print((su % mod))",
"+B = list([x**2 for x in A])",
"+SA = sum(A)",
"+SB = sum(B)",
"+print((((SA * SA - SB) // 2) % mod))"
] | false | 0.122073 | 0.036388 | 3.354759 | [
"s563265139",
"s585291963"
] |
u045953894 | p03478 | python | s407273735 | s289050733 | 42 | 35 | 2,940 | 2,940 | Accepted | Accepted | 16.67 | n,a,b = input().split()
C = 0
for j in range(1,int(n)+1): #1<=j<=nを出力
j = str(j)
S = 0
for i in range(len(j)): #整数の各位の和を求める
S += int(j[i])
if int(a) <= S <= int(b): #a<=S<=bに収まるかどうかでCに加算するか判別
C += int(j)
else:
C += 0
print(C) | N, A, B = list(map(int, input().split()))
res = 0
for i in range(N+1):
if A <= sum([int(s) for s in str(i)]) <= B:
res += i
print(res) | 14 | 6 | 262 | 145 | n, a, b = input().split()
C = 0
for j in range(1, int(n) + 1): # 1<=j<=nを出力
j = str(j)
S = 0
for i in range(len(j)): # 整数の各位の和を求める
S += int(j[i])
if int(a) <= S <= int(b): # a<=S<=bに収まるかどうかでCに加算するか判別
C += int(j)
else:
C += 0
print(C)
| N, A, B = list(map(int, input().split()))
res = 0
for i in range(N + 1):
if A <= sum([int(s) for s in str(i)]) <= B:
res += i
print(res)
| false | 57.142857 | [
"-n, a, b = input().split()",
"-C = 0",
"-for j in range(1, int(n) + 1): # 1<=j<=nを出力",
"- j = str(j)",
"- S = 0",
"- for i in range(len(j)): # 整数の各位の和を求める",
"- S += int(j[i])",
"- if int(a) <= S <= int(b): # a<=S<=bに収まるかどうかでCに加算するか判別",
"- C += int(j)",
"- else:",
... | false | 0.142525 | 0.043772 | 3.256107 | [
"s407273735",
"s289050733"
] |
u170913092 | p02572 | python | s589914608 | s533040808 | 216 | 195 | 31,540 | 31,840 | Accepted | Accepted | 9.72 | N = int(eval(input()))
A = [int(x) for x in input().split()]
#A = list(map(int, input().split()))
mod = 10**9+7
partial_sum = A.copy()
sum_now = A[N-1]
for j in range(N-2,-1,-1):
sum_now = int((sum_now+A[j])%mod)
partial_sum[j] = sum_now
res = 0
for i in range(N-1):
res = (res + (A[i]*partial_s... | N = int(eval(input()))
A = [int(x) for x in input().split()]
partial_sum = A.copy()
sum_now = A[N-1]
for j in range(N-2,-1,-1):
sum_now = int((sum_now+A[j])%(10**9+7))
partial_sum[j] = sum_now
res = 0
for i in range(N-1):
res = (res + (A[i]*partial_sum[i+1])%(10**9+7)) %(10**9+7)
print((int(res... | 14 | 12 | 350 | 315 | N = int(eval(input()))
A = [int(x) for x in input().split()]
# A = list(map(int, input().split()))
mod = 10**9 + 7
partial_sum = A.copy()
sum_now = A[N - 1]
for j in range(N - 2, -1, -1):
sum_now = int((sum_now + A[j]) % mod)
partial_sum[j] = sum_now
res = 0
for i in range(N - 1):
res = (res + (A[i] * parti... | N = int(eval(input()))
A = [int(x) for x in input().split()]
partial_sum = A.copy()
sum_now = A[N - 1]
for j in range(N - 2, -1, -1):
sum_now = int((sum_now + A[j]) % (10**9 + 7))
partial_sum[j] = sum_now
res = 0
for i in range(N - 1):
res = (res + (A[i] * partial_sum[i + 1]) % (10**9 + 7)) % (10**9 + 7)
pr... | false | 14.285714 | [
"-# A = list(map(int, input().split()))",
"-mod = 10**9 + 7",
"- sum_now = int((sum_now + A[j]) % mod)",
"+ sum_now = int((sum_now + A[j]) % (10**9 + 7))",
"- res = (res + (A[i] * partial_sum[i + 1]) % mod) % mod",
"+ res = (res + (A[i] * partial_sum[i + 1]) % (10**9 + 7)) % (10**9 + 7)"
] | false | 0.045375 | 0.045832 | 0.990039 | [
"s589914608",
"s533040808"
] |
u201387466 | p02838 | python | s651979735 | s093216049 | 868 | 333 | 123,260 | 48,792 | Accepted | Accepted | 61.64 | import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#from bisect import insort_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(inp... | import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#from bisect import insort_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(inp... | 39 | 37 | 966 | 922 | import sys
input = sys.stdin.readline
# from collections import defaultdict
# d = defaultdict(int)
# import fractions
# import math
# import collections
# from collections import deque
# from bisect import bisect_left
# from bisect import insort_left
# N = int(input())
# A = list(map(int,input().split()))
# S = list(i... | import sys
input = sys.stdin.readline
# from collections import defaultdict
# d = defaultdict(int)
# import fractions
# import math
# import collections
# from collections import deque
# from bisect import bisect_left
# from bisect import insort_left
# N = int(input())
# A = list(map(int,input().split()))
# S = list(i... | false | 5.128205 | [
"+# import numpy as np",
"+import numpy as np",
"-for k in A:",
"- c = 0",
"- while k > 0:",
"- if k % 2 == 1:",
"- d[c][0] -= 1",
"- d[c][1] += 1",
"- k = k // 2",
"- c += 1",
"-s = 0",
"-for i in range(60):",
"- li = d[i]",
"- s += (... | false | 0.037465 | 0.00751 | 4.988583 | [
"s651979735",
"s093216049"
] |
u619458041 | p03262 | python | s969341437 | s961702437 | 1,470 | 168 | 17,864 | 17,864 | Accepted | Accepted | 88.57 | import sys
def main():
input = sys.stdin.readline
N, S = list(map(int, input().split()))
C = list(map(int, input().split()))
C = list(set([abs(c - S) for c in C]))
min_C = min(C)
ans = 1
for i in range(min_C, 1, -1):
if min_C % i != 0:
continue
if all([c % i == 0 for c in ... | import sys
def gcd(a, b):
a, b = max(a, b), min(a, b)
if b == 0:
return a
else:
return gcd(b, a % b)
def main():
input = sys.stdin.readline
N, S = list(map(int, input().split()))
C = list(map(int, input().split()))
C = list(set([abs(c - S) for c in C]))
ans = C[0]
for i ... | 21 | 25 | 402 | 419 | import sys
def main():
input = sys.stdin.readline
N, S = list(map(int, input().split()))
C = list(map(int, input().split()))
C = list(set([abs(c - S) for c in C]))
min_C = min(C)
ans = 1
for i in range(min_C, 1, -1):
if min_C % i != 0:
continue
if all([c % i == ... | import sys
def gcd(a, b):
a, b = max(a, b), min(a, b)
if b == 0:
return a
else:
return gcd(b, a % b)
def main():
input = sys.stdin.readline
N, S = list(map(int, input().split()))
C = list(map(int, input().split()))
C = list(set([abs(c - S) for c in C]))
ans = C[0]
... | false | 16 | [
"+",
"+",
"+def gcd(a, b):",
"+ a, b = max(a, b), min(a, b)",
"+ if b == 0:",
"+ return a",
"+ else:",
"+ return gcd(b, a % b)",
"- min_C = min(C)",
"- ans = 1",
"- for i in range(min_C, 1, -1):",
"- if min_C % i != 0:",
"- continue",
"- ... | false | 0.038783 | 0.191625 | 0.202391 | [
"s969341437",
"s961702437"
] |
u935558307 | p03290 | python | s223876117 | s451953962 | 25 | 19 | 3,064 | 3,064 | Accepted | Accepted | 24 | import math
D,G = list(map(int,input().split()))
pc = [list(map(int,input().split()))for _ in range(D)]
digit = "0"+str(D)+"b"
ans = float('INF')
for i in range(2**D):
flags = list(str(format(i,digit)))
point = 0
count = 0
last0 = -1
for j in range(D):
if flags[j] == "1":
... | import math
D,G = list(map(int,input().split()))
PC = [list(map(int,input().split())) for _ in range(D)]
def dfs(d,flag,point,count,tmp):
point += flag * (PC[d-1][1]+PC[d-1][0]*d*100)
count += flag * (PC[d-1][0])
if flag == 0:
tmp = d
if d == D:
if point < G:
r = ... | 29 | 24 | 714 | 659 | import math
D, G = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(D)]
digit = "0" + str(D) + "b"
ans = float("INF")
for i in range(2**D):
flags = list(str(format(i, digit)))
point = 0
count = 0
last0 = -1
for j in range(D):
if flags[j] == "1":
... | import math
D, G = list(map(int, input().split()))
PC = [list(map(int, input().split())) for _ in range(D)]
def dfs(d, flag, point, count, tmp):
point += flag * (PC[d - 1][1] + PC[d - 1][0] * d * 100)
count += flag * (PC[d - 1][0])
if flag == 0:
tmp = d
if d == D:
if point < G:
... | false | 17.241379 | [
"-pc = [list(map(int, input().split())) for _ in range(D)]",
"-digit = \"0\" + str(D) + \"b\"",
"-ans = float(\"INF\")",
"-for i in range(2**D):",
"- flags = list(str(format(i, digit)))",
"- point = 0",
"- count = 0",
"- last0 = -1",
"- for j in range(D):",
"- if flags[j] == ... | false | 0.041757 | 0.040804 | 1.023343 | [
"s223876117",
"s451953962"
] |
u673338219 | p02936 | python | s509514444 | s557762438 | 1,952 | 900 | 117,964 | 104,908 | Accepted | Accepted | 53.89 | from collections import deque
def submit():
n,q = map(int,input().split())
y = [[] for _ in range(n)]
c = [0]*n
for _ in range(n-1):
ai,bi = map(int,input().split())
y[ai-1].append(bi-1)
y[bi-1].append(ai-1)
for _ in range(q):
pi,xi = map(int,input().split())
c[pi-1] += xi
z ... | def submit():
from collections import deque
import sys
input = sys.stdin.readline
n,q = map(int,input().split())
y = [[] for _ in range(n)]
c = [0]*n
for _ in range(n-1):
ai,bi = map(int,input().split())
y[ai-1].append(bi-1)
y[bi-1].append(ai-1)
for _ in range(q):
pi,xi = map... | 22 | 24 | 518 | 564 | from collections import deque
def submit():
n, q = map(int, input().split())
y = [[] for _ in range(n)]
c = [0] * n
for _ in range(n - 1):
ai, bi = map(int, input().split())
y[ai - 1].append(bi - 1)
y[bi - 1].append(ai - 1)
for _ in range(q):
pi, xi = map(int, input... | def submit():
from collections import deque
import sys
input = sys.stdin.readline
n, q = map(int, input().split())
y = [[] for _ in range(n)]
c = [0] * n
for _ in range(n - 1):
ai, bi = map(int, input().split())
y[ai - 1].append(bi - 1)
y[bi - 1].append(ai - 1)
f... | false | 8.333333 | [
"-from collections import deque",
"+def submit():",
"+ from collections import deque",
"+ import sys",
"-",
"-def submit():",
"+ input = sys.stdin.readline"
] | false | 0.037006 | 0.057032 | 0.648865 | [
"s509514444",
"s557762438"
] |
u285443936 | p03503 | python | s153193053 | s284639375 | 137 | 75 | 3,064 | 3,064 | Accepted | Accepted | 45.26 | N = int(eval(input()))
F = [list(map(int,input().split())) for i in range(N)]
P = [list(map(int,input().split())) for i in range(N)]
ans = -(10**7) * 10 * 100
for i in range(1,2**10):
counter = [0]*N #店iとjoisinoのかぶっている数
tmp = 0 #
for j in range(10):
if (i>>j) & 1:
for k in range(N):... | n = int(eval(input()))
bits = []
for i in range(n):
bit = int(input().replace(" ", ""), 2)
bits.append(bit)
p = [[int(item) for item in input().split()] for _ in range(n)]
ans = - 10**9
for i in range(1,2**10):
val = 0
for j,mise in enumerate(p):
val += mise[bin(i & bits[j]).count("1")]
ans... | 19 | 15 | 483 | 342 | N = int(eval(input()))
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
ans = -(10**7) * 10 * 100
for i in range(1, 2**10):
counter = [0] * N # 店iとjoisinoのかぶっている数
tmp = 0 #
for j in range(10):
if (i >> j) & 1:
for k in rang... | n = int(eval(input()))
bits = []
for i in range(n):
bit = int(input().replace(" ", ""), 2)
bits.append(bit)
p = [[int(item) for item in input().split()] for _ in range(n)]
ans = -(10**9)
for i in range(1, 2**10):
val = 0
for j, mise in enumerate(p):
val += mise[bin(i & bits[j]).count("1")]
a... | false | 21.052632 | [
"-N = int(eval(input()))",
"-F = [list(map(int, input().split())) for i in range(N)]",
"-P = [list(map(int, input().split())) for i in range(N)]",
"-ans = -(10**7) * 10 * 100",
"+n = int(eval(input()))",
"+bits = []",
"+for i in range(n):",
"+ bit = int(input().replace(\" \", \"\"), 2)",
"+ bi... | false | 0.095478 | 0.092513 | 1.03205 | [
"s153193053",
"s284639375"
] |
u540762794 | p02843 | python | s496916436 | s551950212 | 68 | 26 | 9,200 | 9,104 | Accepted | Accepted | 61.76 | # -*- coding: utf-8 -*-
X = int(eval(input()))
num = X // 100
reminder = X % 100
if reminder == 0:
print("1")
exit()
for i in range(num+1):
for j in range(num+1):
if i+j > num:
continue
for k in range(num+1):
if i+j+k > num:
continue... | # -*- coding: utf-8 -*-
X = int(eval(input()))
num = X // 100
if num*100 <= X and X<=num*105:
print("1")
else:
print("0")
| 30 | 9 | 699 | 134 | # -*- coding: utf-8 -*-
X = int(eval(input()))
num = X // 100
reminder = X % 100
if reminder == 0:
print("1")
exit()
for i in range(num + 1):
for j in range(num + 1):
if i + j > num:
continue
for k in range(num + 1):
if i + j + k > num:
continue
... | # -*- coding: utf-8 -*-
X = int(eval(input()))
num = X // 100
if num * 100 <= X and X <= num * 105:
print("1")
else:
print("0")
| false | 70 | [
"-reminder = X % 100",
"-if reminder == 0:",
"+if num * 100 <= X and X <= num * 105:",
"- exit()",
"-for i in range(num + 1):",
"- for j in range(num + 1):",
"- if i + j > num:",
"- continue",
"- for k in range(num + 1):",
"- if i + j + k > num:",
"- ... | false | 0.042566 | 0.042641 | 0.998256 | [
"s496916436",
"s551950212"
] |
u759412327 | p03379 | python | s358302152 | s985332009 | 293 | 243 | 26,772 | 34,324 | Accepted | Accepted | 17.06 | eval(input())
x=list(map(int,input().split()))
z=sorted(x)[(len(x))//2-1:]
for c in x:print((z[c<=z[0]])) | from statistics import *
N = int(eval(input()))
X = list(map(int,input().split()))
Y = sorted(X)
m = median(X)
for x in X:
if x<=m:
print((Y[N//2]))
else:
print((Y[N//2-1])) | 4 | 11 | 100 | 186 | eval(input())
x = list(map(int, input().split()))
z = sorted(x)[(len(x)) // 2 - 1 :]
for c in x:
print((z[c <= z[0]]))
| from statistics import *
N = int(eval(input()))
X = list(map(int, input().split()))
Y = sorted(X)
m = median(X)
for x in X:
if x <= m:
print((Y[N // 2]))
else:
print((Y[N // 2 - 1]))
| false | 63.636364 | [
"-eval(input())",
"-x = list(map(int, input().split()))",
"-z = sorted(x)[(len(x)) // 2 - 1 :]",
"-for c in x:",
"- print((z[c <= z[0]]))",
"+from statistics import *",
"+",
"+N = int(eval(input()))",
"+X = list(map(int, input().split()))",
"+Y = sorted(X)",
"+m = median(X)",
"+for x in X:"... | false | 0.120434 | 0.049595 | 2.428366 | [
"s358302152",
"s985332009"
] |
u783589546 | p03292 | python | s741473930 | s927743496 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | a,b,c=sorted(list(map(int,input().split())))
print(((c-b)+(b-a))) | *a,=list(map(int,input().split()))
print((max(a)-min(a))) | 2 | 2 | 64 | 50 | a, b, c = sorted(list(map(int, input().split())))
print(((c - b) + (b - a)))
| (*a,) = list(map(int, input().split()))
print((max(a) - min(a)))
| false | 0 | [
"-a, b, c = sorted(list(map(int, input().split())))",
"-print(((c - b) + (b - a)))",
"+(*a,) = list(map(int, input().split()))",
"+print((max(a) - min(a)))"
] | false | 0.040325 | 0.041239 | 0.977834 | [
"s741473930",
"s927743496"
] |
u281610856 | p03575 | python | s069760679 | s060638215 | 186 | 22 | 39,536 | 3,316 | Accepted | Accepted | 88.17 | from collections import defaultdict, deque
import sys
input = sys.stdin.readline
def bfs(s, n, g):
dist = [-1] * n
dist[s] = 0
que = deque([])
que.append(s)
while que:
v = que.popleft()
for nv in g[v]:
if dist[nv] != -1:
continue
... | from collections import defaultdict, deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
# INF = float("inf")
def bfs(s, n, g):
dist = [-1] * n
dist[s] = 0
que = deque([])
que.append(s)
while que:
v = que.popleft()
for nv ... | 46 | 49 | 950 | 1,045 | from collections import defaultdict, deque
import sys
input = sys.stdin.readline
def bfs(s, n, g):
dist = [-1] * n
dist[s] = 0
que = deque([])
que.append(s)
while que:
v = que.popleft()
for nv in g[v]:
if dist[nv] != -1:
continue
dist[nv] = ... | from collections import defaultdict, deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
# INF = float("inf")
def bfs(s, n, g):
dist = [-1] * n
dist[s] = 0
que = deque([])
que.append(s)
while que:
v = que.popleft()
for nv in g[v]:
... | false | 6.122449 | [
"-",
"-",
"+# sys.setrecursionlimit(1000000)",
"+# MOD = 10 ** 9 + 7",
"+# INF = float(\"inf\")",
"- continue",
"+ continue # すでに探索している時はスルー"
] | false | 0.035238 | 0.035635 | 0.988852 | [
"s069760679",
"s060638215"
] |
u576432509 | p02550 | python | s599837487 | s434642386 | 751 | 64 | 68,840 | 67,272 | Accepted | Accepted | 91.48 | n,x,m=list(map(int,input().split()))
def f(ai,m):
return (ai*ai)%m
if x==0:
print((0))
elif x==1:
print(n)
elif m==1:
print((0))
elif n<=m*2:
asum=x
ai=x
for i in range(1,n):
ai=f(ai,m)
asum+=ai
print(asum)
else:
aa=[]
ai,icnt,asum=x,0,0
... | n,x,m=list(map(int,input().split()))
def f(ai,m):
return (ai*ai)%m
if x==0:
print((0))
elif x==1:
print(n)
elif m==1:
print((0))
elif n<=m*2:
asum=x
ai=x
for i in range(1,n):
ai=f(ai,m)
asum+=ai
print(asum)
else:
chk=[-1]*m
asum00=[0]*m
... | 48 | 48 | 920 | 839 | n, x, m = list(map(int, input().split()))
def f(ai, m):
return (ai * ai) % m
if x == 0:
print((0))
elif x == 1:
print(n)
elif m == 1:
print((0))
elif n <= m * 2:
asum = x
ai = x
for i in range(1, n):
ai = f(ai, m)
asum += ai
print(asum)
else:
aa = []
ai, icnt,... | n, x, m = list(map(int, input().split()))
def f(ai, m):
return (ai * ai) % m
if x == 0:
print((0))
elif x == 1:
print(n)
elif m == 1:
print((0))
elif n <= m * 2:
asum = x
ai = x
for i in range(1, n):
ai = f(ai, m)
asum += ai
print(asum)
else:
chk = [-1] * m
as... | false | 0 | [
"- aa = []",
"- ai, icnt, asum = x, 0, 0",
"- while not ai in aa:",
"+ chk = [-1] * m",
"+ asum00 = [0] * m",
"+ ai, asum = x, 0",
"+ for i in range(m):",
"+ if chk[ai] != -1:",
"+ icnt0 = chk[ai]",
"+ break",
"+ else:",
"+ ch... | false | 0.045426 | 0.037609 | 1.207868 | [
"s599837487",
"s434642386"
] |
u952708174 | p03380 | python | s456291195 | s458976305 | 111 | 84 | 14,052 | 19,700 | Accepted | Accepted | 24.32 | def d_binomial_coefficients():
from bisect import bisect_left
N = int(eval(input()))
A = sorted([int(i) for i in input().split()]) # ソートしておく
n = A[-1] # comb(n, r) の n をこの値以外にする理由はない
r = min(A[:-1], key=lambda x: abs(n / 2 - x))
return '{0} {1}'.format(n, r)
print((d_binomial_coeffi... | def d_binomial_coefficients():
N = int(eval(input()))
A = sorted([int(i) for i in input().split()]) # ソートしておく
n = A[-1] # n を大きく、r を n/2 に近づけると comb(n, r) は大きい
r = min(A[:-1], key=lambda x: abs(n / 2 - x))
return f'{n} {r}'
print((d_binomial_coefficients())) | 10 | 9 | 322 | 282 | def d_binomial_coefficients():
from bisect import bisect_left
N = int(eval(input()))
A = sorted([int(i) for i in input().split()]) # ソートしておく
n = A[-1] # comb(n, r) の n をこの値以外にする理由はない
r = min(A[:-1], key=lambda x: abs(n / 2 - x))
return "{0} {1}".format(n, r)
print((d_binomial_coefficients()... | def d_binomial_coefficients():
N = int(eval(input()))
A = sorted([int(i) for i in input().split()]) # ソートしておく
n = A[-1] # n を大きく、r を n/2 に近づけると comb(n, r) は大きい
r = min(A[:-1], key=lambda x: abs(n / 2 - x))
return f"{n} {r}"
print((d_binomial_coefficients()))
| false | 10 | [
"- from bisect import bisect_left",
"-",
"- n = A[-1] # comb(n, r) の n をこの値以外にする理由はない",
"+ n = A[-1] # n を大きく、r を n/2 に近づけると comb(n, r) は大きい",
"- return \"{0} {1}\".format(n, r)",
"+ return f\"{n} {r}\""
] | false | 0.048505 | 0.044848 | 1.081539 | [
"s456291195",
"s458976305"
] |
u363995337 | p03455 | python | s943768675 | s048355341 | 163 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.57 | a,b = list(map(int,input().split()))
if(a * b) % 2 == 0 :
print("Even")
else:
print("Odd") | x,y = map(int,input().split())
print('Even') if((x*y%2) == 0) else print('Odd')
| 6 | 2 | 98 | 80 | a, b = list(map(int, input().split()))
if (a * b) % 2 == 0:
print("Even")
else:
print("Odd")
| x, y = map(int, input().split())
print("Even") if ((x * y % 2) == 0) else print("Odd")
| false | 66.666667 | [
"-a, b = list(map(int, input().split()))",
"-if (a * b) % 2 == 0:",
"- print(\"Even\")",
"-else:",
"- print(\"Odd\")",
"+x, y = map(int, input().split())",
"+print(\"Even\") if ((x * y % 2) == 0) else print(\"Odd\")"
] | false | 0.118423 | 0.007496 | 15.798334 | [
"s943768675",
"s048355341"
] |
u940139461 | p02792 | python | s173698954 | s064789248 | 244 | 219 | 40,428 | 40,428 | Accepted | Accepted | 10.25 | n = int(eval(input()))
dp = [[0] * 10 for _ in range(10)]
for i in range(1, n + 1):
s = str(i)
x = int(s[0])
y = int(s[-1])
dp[x][y] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += dp[i][j] * dp[j][i]
print(ans) | n = int(eval(input()))
dp = [[0] * 10 for _ in range(10)]
for i in range(1, n + 1):
s = str(i)
dp[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += dp[i][j] * dp[j][i]
print(ans) | 15 | 12 | 268 | 238 | n = int(eval(input()))
dp = [[0] * 10 for _ in range(10)]
for i in range(1, n + 1):
s = str(i)
x = int(s[0])
y = int(s[-1])
dp[x][y] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += dp[i][j] * dp[j][i]
print(ans)
| n = int(eval(input()))
dp = [[0] * 10 for _ in range(10)]
for i in range(1, n + 1):
s = str(i)
dp[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += dp[i][j] * dp[j][i]
print(ans)
| false | 20 | [
"- x = int(s[0])",
"- y = int(s[-1])",
"- dp[x][y] += 1",
"+ dp[int(s[0])][int(s[-1])] += 1",
"-for i in range(1, 10):",
"- for j in range(1, 10):",
"+for i in range(10):",
"+ for j in range(10):"
] | false | 0.072904 | 0.070493 | 1.034196 | [
"s173698954",
"s064789248"
] |
u254871849 | p03796 | python | s564073971 | s710953077 | 231 | 36 | 4,020 | 2,940 | Accepted | Accepted | 84.42 | from math import factorial
mod = 10 ** 9 + 7
n = int(eval(input()))
ans = factorial(n)
print((ans % mod))
| mod = int(1e9+7)
n = int(eval(input()))
power = 1
for i in range(1, n+1):
power = power * i % mod
print(power) | 7 | 7 | 106 | 115 | from math import factorial
mod = 10**9 + 7
n = int(eval(input()))
ans = factorial(n)
print((ans % mod))
| mod = int(1e9 + 7)
n = int(eval(input()))
power = 1
for i in range(1, n + 1):
power = power * i % mod
print(power)
| false | 0 | [
"-from math import factorial",
"-",
"-mod = 10**9 + 7",
"+mod = int(1e9 + 7)",
"-ans = factorial(n)",
"-print((ans % mod))",
"+power = 1",
"+for i in range(1, n + 1):",
"+ power = power * i % mod",
"+print(power)"
] | false | 0.18905 | 0.042164 | 4.483636 | [
"s564073971",
"s710953077"
] |
u668642853 | p02714 | python | s458592891 | s557989213 | 1,185 | 1,038 | 9,240 | 9,196 | Accepted | Accepted | 12.41 | from itertools import product
x1 = int(eval(input()))
x2 = eval(input())
R_i = [i for i, x in enumerate(x2) if x == "R"]
G_i = [i for i, x in enumerate(x2) if x == "G"]
B_i = {i for i, x in enumerate(x2) if x == "B"}
R = len(R_i)
G = len(G_i)
B = len(B_i)
xs = list(map(sorted, product(R_i, G_i)))
s ... | from itertools import product
x1 = int(eval(input()))
x2 = eval(input())
R_i = [i for i, x in enumerate(x2) if x == "R"]
G_i = [i for i, x in enumerate(x2) if x == "G"]
B_i = {i for i, x in enumerate(x2) if x == "B"}
R = len(R_i)
G = len(G_i)
B = len(B_i)
xs = list(map(sorted, product(R_i, G_i)))
s ... | 29 | 27 | 577 | 536 | from itertools import product
x1 = int(eval(input()))
x2 = eval(input())
R_i = [i for i, x in enumerate(x2) if x == "R"]
G_i = [i for i, x in enumerate(x2) if x == "G"]
B_i = {i for i, x in enumerate(x2) if x == "B"}
R = len(R_i)
G = len(G_i)
B = len(B_i)
xs = list(map(sorted, product(R_i, G_i)))
s = 0
for a in xs:
... | from itertools import product
x1 = int(eval(input()))
x2 = eval(input())
R_i = [i for i, x in enumerate(x2) if x == "R"]
G_i = [i for i, x in enumerate(x2) if x == "G"]
B_i = {i for i, x in enumerate(x2) if x == "B"}
R = len(R_i)
G = len(G_i)
B = len(B_i)
xs = list(map(sorted, product(R_i, G_i)))
s = 0
for a in xs:
... | false | 6.896552 | [
"- j = (a[0] + a[1]) / 2",
"- if j.is_integer():",
"- j = int(j)",
"- if j in B_i:",
"- s += 1",
"+ j = (a[0] + a[1]) / 2 # (i+k)/2",
"+ if j in B_i:",
"+ s += 1"
] | false | 0.046549 | 0.047107 | 0.988154 | [
"s458592891",
"s557989213"
] |
u156815136 | p03329 | python | s191798655 | s942351434 | 228 | 205 | 3,060 | 42,220 | Accepted | Accepted | 10.09 | #import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
mod = 10**9 + 7
def readInts():
return list(map(int,input().split()))
def main():
n = int(eval(input()))
def count_(num,x):
i = 0
while num > 0:
i += n... | n = int(eval(input()))
dp = [n] * (n+1)
dp[0] = 0
# 貰うdp -- dp[i] に遷移を集める
for i in range(1,n+1):
pow6 = 1
while pow6 <= i: # i円を実現できるか、を回す
dp[i] = min(dp[i],dp[i-pow6] + 1)
pow6 *= 6
pow9 = 1
while pow9 <= i:
dp[i] = min(dp[i], dp[i-pow9] + 1)
pow9 *= 9
print... | 27 | 14 | 517 | 322 | # import collections
# aa = collections.Counter(a) # list to list
# from itertools import combinations # (string,3) 3回
mod = 10**9 + 7
def readInts():
return list(map(int, input().split()))
def main():
n = int(eval(input()))
def count_(num, x):
i = 0
while num > 0:
i += num ... | n = int(eval(input()))
dp = [n] * (n + 1)
dp[0] = 0
# 貰うdp -- dp[i] に遷移を集める
for i in range(1, n + 1):
pow6 = 1
while pow6 <= i: # i円を実現できるか、を回す
dp[i] = min(dp[i], dp[i - pow6] + 1)
pow6 *= 6
pow9 = 1
while pow9 <= i:
dp[i] = min(dp[i], dp[i - pow9] + 1)
pow9 *= 9
print((... | false | 48.148148 | [
"-# import collections",
"-# aa = collections.Counter(a) # list to list",
"-# from itertools import combinations # (string,3) 3回",
"-mod = 10**9 + 7",
"-",
"-",
"-def readInts():",
"- return list(map(int, input().split()))",
"-",
"-",
"-def main():",
"- n = int(eval(input()))",
"-",
... | false | 0.070816 | 0.143186 | 0.494574 | [
"s191798655",
"s942351434"
] |
u968166680 | p02863 | python | s049294392 | s877549361 | 245 | 115 | 144,652 | 74,120 | Accepted | Accepted | 53.06 | import sys
read = sys.stdin.buffer.read
def main():
N, T, *AB = list(map(int, read().split()))
D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]
D.sort()
dp = [[0] * T for _ in range(N + 1)]
for i, (a, b) in enumerate(D):
for t in range(T):
if 0 <= t - a:
... | import sys
read = sys.stdin.buffer.read
def main():
N, T, *AB = list(map(int, read().split()))
D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]
D.sort()
dp = [0] * T
max_sum = [0] * N
for i, (a, b) in enumerate(D):
for t in range(T - 1, -1, -1):
if t >= a and... | 30 | 30 | 653 | 614 | import sys
read = sys.stdin.buffer.read
def main():
N, T, *AB = list(map(int, read().split()))
D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]
D.sort()
dp = [[0] * T for _ in range(N + 1)]
for i, (a, b) in enumerate(D):
for t in range(T):
if 0 <= t - a:
dp[i + 1]... | import sys
read = sys.stdin.buffer.read
def main():
N, T, *AB = list(map(int, read().split()))
D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]
D.sort()
dp = [0] * T
max_sum = [0] * N
for i, (a, b) in enumerate(D):
for t in range(T - 1, -1, -1):
if t >= a and dp[t] < dp[t - a... | false | 0 | [
"- dp = [[0] * T for _ in range(N + 1)]",
"+ dp = [0] * T",
"+ max_sum = [0] * N",
"- for t in range(T):",
"- if 0 <= t - a:",
"- dp[i + 1][t] = dp[i][t - a] + b",
"- if dp[i + 1][t] < dp[i][t]:",
"- dp[i + 1][t] = dp[i][t]",
"+ ... | false | 0.086723 | 0.040127 | 2.161214 | [
"s049294392",
"s877549361"
] |
u496821919 | p02631 | python | s208993873 | s530522616 | 427 | 187 | 110,728 | 105,640 | Accepted | Accepted | 56.21 | n = int(eval(input()))
A = list(map(int,input().split()))
B = [0]*30
ans = []
for i in A:
for j in range(30):
if (i>>j) & 1:
B[j] += 1
for i in A:
C = [c for c in B]
for j in range(30):
if (i>>j) & 1:
C[j] -= 1
a = 0
for j in range(30):
... | n = int(input())
A = list(map(int,input().split()))
s = A[0]
for i in range(1,n):
s ^= A[i]
for i in A:
print(s^i,end=" ")
print("\n")
| 19 | 8 | 400 | 149 | n = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * 30
ans = []
for i in A:
for j in range(30):
if (i >> j) & 1:
B[j] += 1
for i in A:
C = [c for c in B]
for j in range(30):
if (i >> j) & 1:
C[j] -= 1
a = 0
for j in range(30):
if C[j] ... | n = int(input())
A = list(map(int, input().split()))
s = A[0]
for i in range(1, n):
s ^= A[i]
for i in A:
print(s ^ i, end=" ")
print("\n")
| false | 57.894737 | [
"-n = int(eval(input()))",
"+n = int(input())",
"-B = [0] * 30",
"-ans = []",
"+s = A[0]",
"+for i in range(1, n):",
"+ s ^= A[i]",
"- for j in range(30):",
"- if (i >> j) & 1:",
"- B[j] += 1",
"-for i in A:",
"- C = [c for c in B]",
"- for j in range(30):",
"... | false | 0.040623 | 0.088714 | 0.45791 | [
"s208993873",
"s530522616"
] |
u512212329 | p02572 | python | s234122198 | s036961606 | 129 | 114 | 31,716 | 25,032 | Accepted | Accepted | 11.63 | def main():
eval(input()) # n
array = [int(x) for x in input().split()]
mod = 10 ** 9 + 7
total = 0
center_blocks = 0
for x in array:
total += x
center_blocks += x ** 2
total = total ** 2
return (total - center_blocks) // 2 % mod
if __name__ == '__main__':... | def main():
eval(input())
array = (int(x) for x in input().split())
mod = 10 ** 9 + 7
ans = 0
multiplier = 0
for x in array:
ans = (ans + x * multiplier) % mod
multiplier = (multiplier + x) % mod
return ans
if __name__ == '__main__':
print((main()))
| 15 | 14 | 334 | 305 | def main():
eval(input()) # n
array = [int(x) for x in input().split()]
mod = 10**9 + 7
total = 0
center_blocks = 0
for x in array:
total += x
center_blocks += x**2
total = total**2
return (total - center_blocks) // 2 % mod
if __name__ == "__main__":
print((main())... | def main():
eval(input())
array = (int(x) for x in input().split())
mod = 10**9 + 7
ans = 0
multiplier = 0
for x in array:
ans = (ans + x * multiplier) % mod
multiplier = (multiplier + x) % mod
return ans
if __name__ == "__main__":
print((main()))
| false | 6.666667 | [
"- eval(input()) # n",
"- array = [int(x) for x in input().split()]",
"+ eval(input())",
"+ array = (int(x) for x in input().split())",
"- total = 0",
"- center_blocks = 0",
"+ ans = 0",
"+ multiplier = 0",
"- total += x",
"- center_blocks += x**2",
"- t... | false | 0.042501 | 0.034967 | 1.215468 | [
"s234122198",
"s036961606"
] |
u989345508 | p02788 | python | s291153946 | s609750685 | 1,733 | 1,582 | 67,268 | 69,908 | Accepted | Accepted | 8.71 | import bisect
import math
n,d,a=list(map(int,input().split()))
xh=[list(map(int,input().split())) for i in range(n)]
xh.sort()
x=[xh[i][0] for i in range(n)]
h=[xh[i][1] for i in range(n)]
g=[0]*n
cnt=0
for i in range(n):
#print(h)
if h[i]>0:
m=math.ceil(h[i]/a)
cnt+=m
k=bi... | import bisect
import math
import sys
input=sys.stdin.readline
n,d,a=list(map(int,input().split()))
xh=[list(map(int,input().split())) for i in range(n)]
xh.sort()
x=[xh[i][0] for i in range(n)]
h=[xh[i][1] for i in range(n)]
g=[0]*n
cnt=0
for i in range(n):
if h[i]>0:
m=math.ceil(h[i]/a)
... | 27 | 27 | 614 | 614 | import bisect
import math
n, d, a = list(map(int, input().split()))
xh = [list(map(int, input().split())) for i in range(n)]
xh.sort()
x = [xh[i][0] for i in range(n)]
h = [xh[i][1] for i in range(n)]
g = [0] * n
cnt = 0
for i in range(n):
# print(h)
if h[i] > 0:
m = math.ceil(h[i] / a)
cnt += ... | import bisect
import math
import sys
input = sys.stdin.readline
n, d, a = list(map(int, input().split()))
xh = [list(map(int, input().split())) for i in range(n)]
xh.sort()
x = [xh[i][0] for i in range(n)]
h = [xh[i][1] for i in range(n)]
g = [0] * n
cnt = 0
for i in range(n):
if h[i] > 0:
m = math.ceil(h[... | false | 0 | [
"+import sys",
"+input = sys.stdin.readline",
"- # print(h)",
"- h[i] -= m * a"
] | false | 0.060224 | 0.060118 | 1.001756 | [
"s291153946",
"s609750685"
] |
u654470292 | p02630 | python | s555776081 | s310027841 | 216 | 161 | 91,236 | 111,080 | Accepted | Accepted | 25.46 | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
sys.setrecurs... | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
sys.setrecurs... | 36 | 44 | 776 | 1,000 | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
sys.setrecursionl... | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
sys.setrecursionl... | false | 18.181818 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-q = int(eval(input()))",
"-bc = [list(map(int, input().split())) for i in range(q)]",
"+# n=int(input())",
"+# a=list(map(int,input().split()))",
"+# q=int(input())",
"+# bc=[list(map(int,input().split())) for i in range(q)]",
"+re... | false | 0.042574 | 0.04559 | 0.933843 | [
"s555776081",
"s310027841"
] |
u241159583 | p03208 | python | s714155850 | s678979466 | 284 | 234 | 7,448 | 7,384 | Accepted | Accepted | 17.61 | N, K = list(map(int, input().split()))
h = list(int(eval(input())) for _ in range(N))
h.sort()
i = 0
ans = 10 ** 9
while i + K - 1 < N:
n = abs(h[i+K-1] - h[i])
if ans > n: ans = n
i += 1
print(ans) | n, k = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(n)]
h.sort()
ans = 10 ** 9
for i in range(n-k+1):
if h[i+k-1] - h[i] < ans:
ans = h[i+k-1] - h[i]
print(ans) | 11 | 8 | 203 | 193 | N, K = list(map(int, input().split()))
h = list(int(eval(input())) for _ in range(N))
h.sort()
i = 0
ans = 10**9
while i + K - 1 < N:
n = abs(h[i + K - 1] - h[i])
if ans > n:
ans = n
i += 1
print(ans)
| n, k = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(n)]
h.sort()
ans = 10**9
for i in range(n - k + 1):
if h[i + k - 1] - h[i] < ans:
ans = h[i + k - 1] - h[i]
print(ans)
| false | 27.272727 | [
"-N, K = list(map(int, input().split()))",
"-h = list(int(eval(input())) for _ in range(N))",
"+n, k = list(map(int, input().split()))",
"+h = [int(eval(input())) for _ in range(n)]",
"-i = 0",
"-while i + K - 1 < N:",
"- n = abs(h[i + K - 1] - h[i])",
"- if ans > n:",
"- ans = n",
"-... | false | 0.087387 | 0.045537 | 1.919028 | [
"s714155850",
"s678979466"
] |
u886747123 | p03835 | python | s533211629 | s173123758 | 1,439 | 17 | 2,940 | 3,060 | Accepted | Accepted | 98.82 | K, S = list(map(int, input().split()))
# S-K<=X+Y<=S を満たすX,Yの組の数が答え
ans = 0
for X in range(K+1):
for Y in range(K+1):
if S-K <= X+Y <= S:
ans += 1
print(ans) | K, S = list(map(int, input().split()))
# 各ケースごとに格子点の個数を求める
if 0 <= S <= K:
print((int((S+1)*(S+2)/2)))
elif K < S <= 2*K:
print((int((K+1)**2 - (2*K-S)*(2*K-S+1)/2 - (S-K)*(S-K+1)/2)))
else:
print((int((3*K-S+1)*(3*K-S+2)/2))) | 10 | 9 | 186 | 235 | K, S = list(map(int, input().split()))
# S-K<=X+Y<=S を満たすX,Yの組の数が答え
ans = 0
for X in range(K + 1):
for Y in range(K + 1):
if S - K <= X + Y <= S:
ans += 1
print(ans)
| K, S = list(map(int, input().split()))
# 各ケースごとに格子点の個数を求める
if 0 <= S <= K:
print((int((S + 1) * (S + 2) / 2)))
elif K < S <= 2 * K:
print(
(
int(
(K + 1) ** 2
- (2 * K - S) * (2 * K - S + 1) / 2
- (S - K) * (S - K + 1) / 2
)
... | false | 10 | [
"-# S-K<=X+Y<=S を満たすX,Yの組の数が答え",
"-ans = 0",
"-for X in range(K + 1):",
"- for Y in range(K + 1):",
"- if S - K <= X + Y <= S:",
"- ans += 1",
"-print(ans)",
"+# 各ケースごとに格子点の個数を求める",
"+if 0 <= S <= K:",
"+ print((int((S + 1) * (S + 2) / 2)))",
"+elif K < S <= 2 * K:",
"+... | false | 0.06683 | 0.039829 | 1.677918 | [
"s533211629",
"s173123758"
] |
u893063840 | p02735 | python | s175791030 | s769698649 | 45 | 34 | 5,748 | 4,084 | Accepted | Accepted | 24.44 | from math import ceil
from collections import defaultdict
h, w = list(map(int, input().split()))
s = [eval(input()) for _ in range(h)]
n = h * w
INF = 100 * 100
dp = defaultdict(lambda: INF)
if s[0][0] == "#":
dp[(1, 1, 1)] = 1
else:
dp[(1, 1, 0)] = 0
for i in range(1, h + 1):
for j in r... | def f(c):
if c == "#":
ret = 1
else:
ret = 0
return ret
h, w = list(map(int, input().split()))
s = [list(map(f, "#" * (w + 1)))]
for _ in range(h):
s.append([1] + list(map(f, eval(input()))))
INF = 100 * 100
dp = [[[INF] * 2 for _ in range(w + 1)] for _ in range(h + 1)... | 26 | 25 | 715 | 628 | from math import ceil
from collections import defaultdict
h, w = list(map(int, input().split()))
s = [eval(input()) for _ in range(h)]
n = h * w
INF = 100 * 100
dp = defaultdict(lambda: INF)
if s[0][0] == "#":
dp[(1, 1, 1)] = 1
else:
dp[(1, 1, 0)] = 0
for i in range(1, h + 1):
for j in range(1, w + 1):
... | def f(c):
if c == "#":
ret = 1
else:
ret = 0
return ret
h, w = list(map(int, input().split()))
s = [list(map(f, "#" * (w + 1)))]
for _ in range(h):
s.append([1] + list(map(f, eval(input()))))
INF = 100 * 100
dp = [[[INF] * 2 for _ in range(w + 1)] for _ in range(h + 1)]
dp[1][1][s[1][1... | false | 3.846154 | [
"-from math import ceil",
"-from collections import defaultdict",
"+def f(c):",
"+ if c == \"#\":",
"+ ret = 1",
"+ else:",
"+ ret = 0",
"+ return ret",
"+",
"-s = [eval(input()) for _ in range(h)]",
"-n = h * w",
"+s = [list(map(f, \"#\" * (w + 1)))]",
"+for _ in rang... | false | 0.046885 | 0.08537 | 0.549204 | [
"s175791030",
"s769698649"
] |
u073852194 | p02846 | python | s625966102 | s398735590 | 171 | 33 | 39,728 | 9,128 | Accepted | Accepted | 80.7 | T1,T2 = list(map(int,input().split()))
A1,A2 = list(map(int,input().split()))
B1,B2 = list(map(int,input().split()))
C1 = (A1-B1)*T1
C2 = (A2-B2)*T2
if C1+C2==0:
print('infinity')
elif C1*(C1+C2)>0:
print((0))
else:
if abs(C1)%abs(C1+C2)==0:
print((abs(C1)//abs(C1+C2)*2))
else:
... | T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))
C1 = A1 - B1
C2 = A2 - B2
if C1 * C2 >= 0:
print((0))
else:
if C1 < 0:
C1, C2 = -C1, -C2
P = T1 * C1
Q = P + T2 * C2
if Q > 0:
print((0))
... | 16 | 32 | 336 | 656 | T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))
C1 = (A1 - B1) * T1
C2 = (A2 - B2) * T2
if C1 + C2 == 0:
print("infinity")
elif C1 * (C1 + C2) > 0:
print((0))
else:
if abs(C1) % abs(C1 + C2) == 0:
print((abs(C1) // abs(C1 + C... | T1, T2 = list(map(int, input().split()))
A1, A2 = list(map(int, input().split()))
B1, B2 = list(map(int, input().split()))
C1 = A1 - B1
C2 = A2 - B2
if C1 * C2 >= 0:
print((0))
else:
if C1 < 0:
C1, C2 = -C1, -C2
P = T1 * C1
Q = P + T2 * C2
if Q > 0:
print((0))
elif Q == 0:
... | false | 50 | [
"-C1 = (A1 - B1) * T1",
"-C2 = (A2 - B2) * T2",
"-if C1 + C2 == 0:",
"- print(\"infinity\")",
"-elif C1 * (C1 + C2) > 0:",
"+C1 = A1 - B1",
"+C2 = A2 - B2",
"+if C1 * C2 >= 0:",
"- if abs(C1) % abs(C1 + C2) == 0:",
"- print((abs(C1) // abs(C1 + C2) * 2))",
"+ if C1 < 0:",
"+ ... | false | 0.04703 | 0.039682 | 1.185178 | [
"s625966102",
"s398735590"
] |
u977661421 | p02953 | python | s654649362 | s158663253 | 88 | 77 | 14,396 | 14,396 | Accepted | Accepted | 12.5 | # -*- coding: utf-8 -*-
n = int(eval(input()))
h = [int(i) for i in input().split()]
flag = True
for i in reversed(list(range(n - 1))):
if h[i] - h[i + 1] == 1:
h[i] -= 1
elif h[i] > h[i + 1]:
flag = False
if flag:
print("Yes")
else:
print("No")
| # -*- coding: utf-8 -*-
n = int(eval(input()))
h = [int(i) for i in input().split()]
flag = True
for i in reversed(list(range(n - 1))):
if h[i] - h[i + 1] == 1:
h[i] -= 1
elif h[i] > h[i + 1]:
flag = False
break
if flag:
print("Yes")
else:
print("No")
| 14 | 15 | 280 | 295 | # -*- coding: utf-8 -*-
n = int(eval(input()))
h = [int(i) for i in input().split()]
flag = True
for i in reversed(list(range(n - 1))):
if h[i] - h[i + 1] == 1:
h[i] -= 1
elif h[i] > h[i + 1]:
flag = False
if flag:
print("Yes")
else:
print("No")
| # -*- coding: utf-8 -*-
n = int(eval(input()))
h = [int(i) for i in input().split()]
flag = True
for i in reversed(list(range(n - 1))):
if h[i] - h[i + 1] == 1:
h[i] -= 1
elif h[i] > h[i + 1]:
flag = False
break
if flag:
print("Yes")
else:
print("No")
| false | 6.666667 | [
"+ break"
] | false | 0.046024 | 0.045635 | 1.008517 | [
"s654649362",
"s158663253"
] |
u489959379 | p02793 | python | s781609442 | s251025553 | 1,678 | 686 | 10,084 | 28,152 | Accepted | Accepted | 59.12 | import sys
from math import gcd
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def lcm(a, b):
return a * b // gcd(a, b)
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
L = 1
for a in A:
L = l... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
class Eratosthenes:
def __init__(self, n):
self.n = n
self.min_factor = [-1] * (n + 1)
self.min_factor[0], self.min_factor[1] = 0, 1
def get_primes(self):
... | 30 | 68 | 479 | 1,663 | import sys
from math import gcd
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def lcm(a, b):
return a * b // gcd(a, b)
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
L = 1
for a in A:
L = lcm(L, a)
res = 0
... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
class Eratosthenes:
def __init__(self, n):
self.n = n
self.min_factor = [-1] * (n + 1)
self.min_factor[0], self.min_factor[1] = 0, 1
def get_primes(self):
primes = []
... | false | 55.882353 | [
"-from math import gcd",
"-def lcm(a, b):",
"- return a * b // gcd(a, b)",
"+class Eratosthenes:",
"+ def __init__(self, n):",
"+ self.n = n",
"+ self.min_factor = [-1] * (n + 1)",
"+ self.min_factor[0], self.min_factor[1] = 0, 1",
"+",
"+ def get_primes(self):",
"+... | false | 0.038195 | 0.29182 | 0.130885 | [
"s781609442",
"s251025553"
] |
u350997995 | p02882 | python | s517013195 | s257617180 | 73 | 17 | 3,064 | 3,060 | Accepted | Accepted | 76.71 | import time
import math
a,b,x = list(map(int,input().split()))
x /= a
c = a*b/2
if x<c:
l,r = 0,90
for i in range(1000):
mid = (l+r)/2
S = b*b*math.tan(math.radians(mid))/2
if S<=x: l = mid
else: r = mid
print((90-mid))
elif x==c:
print((math.degrees(math.at... | import math
a,b,x = list(map(int,input().split()))
x = x/a
if a*b/2>=x:
S = (2*x)/(b*b)
theta = math.atan(S)
theta = math.degrees(theta)
print((90-theta))
else:
S = 2*(a*b-x)/(a*a)
theta = math.atan(S)
theta = math.degrees(theta)
print(theta) | 23 | 15 | 512 | 282 | import time
import math
a, b, x = list(map(int, input().split()))
x /= a
c = a * b / 2
if x < c:
l, r = 0, 90
for i in range(1000):
mid = (l + r) / 2
S = b * b * math.tan(math.radians(mid)) / 2
if S <= x:
l = mid
else:
r = mid
print((90 - mid))
elif x... | import math
a, b, x = list(map(int, input().split()))
x = x / a
if a * b / 2 >= x:
S = (2 * x) / (b * b)
theta = math.atan(S)
theta = math.degrees(theta)
print((90 - theta))
else:
S = 2 * (a * b - x) / (a * a)
theta = math.atan(S)
theta = math.degrees(theta)
print(theta)
| false | 34.782609 | [
"-import time",
"-x /= a",
"-c = a * b / 2",
"-if x < c:",
"- l, r = 0, 90",
"- for i in range(1000):",
"- mid = (l + r) / 2",
"- S = b * b * math.tan(math.radians(mid)) / 2",
"- if S <= x:",
"- l = mid",
"- else:",
"- r = mid",
"- p... | false | 0.04108 | 0.041167 | 0.997887 | [
"s517013195",
"s257617180"
] |
u348293370 | p02577 | python | s021802190 | s440949050 | 203 | 78 | 9,160 | 9,228 | Accepted | Accepted | 61.58 | n = int(eval(input()))
if n % 9 == 0:
print("Yes")
else:
print("No") | n = eval(input())
s = 0
for i in range(len(n)):
s += int(n[i])
if s % 9 == 0:
print("Yes")
else:
print("No") | 5 | 9 | 74 | 123 | n = int(eval(input()))
if n % 9 == 0:
print("Yes")
else:
print("No")
| n = eval(input())
s = 0
for i in range(len(n)):
s += int(n[i])
if s % 9 == 0:
print("Yes")
else:
print("No")
| false | 44.444444 | [
"-n = int(eval(input()))",
"-if n % 9 == 0:",
"+n = eval(input())",
"+s = 0",
"+for i in range(len(n)):",
"+ s += int(n[i])",
"+if s % 9 == 0:"
] | false | 0.043751 | 0.041466 | 1.055098 | [
"s021802190",
"s440949050"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.