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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u761320129 | p03425 | python | s617395002 | s293375746 | 221 | 180 | 3,316 | 10,112 | Accepted | Accepted | 18.55 | from collections import Counter
from itertools import combinations
N = int(eval(input()))
ctr = Counter()
for i in range(N):
s = eval(input())
ctr[s[0]] += 1
ans = 0
for ptn in combinations('MARCH', 3):
tmp = 1
for c in ptn:
tmp *= ctr[c]
ans += tmp
print(ans) | import itertools
from collections import Counter
N = int(eval(input()))
src = [eval(input()) for i in range(N)]
ctr = Counter()
for s in src:
ctr[s[0]] += 1
ans = 0
for ptn in itertools.combinations('MARCH',3):
a,b,c = ptn
ans += ctr[a]*ctr[b]*ctr[c]
print(ans) | 16 | 13 | 293 | 274 | from collections import Counter
from itertools import combinations
N = int(eval(input()))
ctr = Counter()
for i in range(N):
s = eval(input())
ctr[s[0]] += 1
ans = 0
for ptn in combinations("MARCH", 3):
tmp = 1
for c in ptn:
tmp *= ctr[c]
ans += tmp
print(ans)
| import itertools
from collections import Counter
N = int(eval(input()))
src = [eval(input()) for i in range(N)]
ctr = Counter()
for s in src:
ctr[s[0]] += 1
ans = 0
for ptn in itertools.combinations("MARCH", 3):
a, b, c = ptn
ans += ctr[a] * ctr[b] * ctr[c]
print(ans)
| false | 18.75 | [
"+import itertools",
"-from itertools import combinations",
"+src = [eval(input()) for i in range(N)]",
"-for i in range(N):",
"- s = eval(input())",
"+for s in src:",
"-for ptn in combinations(\"MARCH\", 3):",
"- tmp = 1",
"- for c in ptn:",
"- tmp *= ctr[c]",
"- ans += tmp",... | false | 0.035679 | 0.035769 | 0.997492 | [
"s617395002",
"s293375746"
] |
u703528810 | p02659 | python | s543949041 | s927238566 | 25 | 21 | 9,152 | 9,184 | Accepted | Accepted | 16 | a,b=input().split()
a=int(a)
b=int(float(b)*1000)
print((int(a*b//1000))) | A,B=input().split()
a=int(A)
b=""
p=0
for i in range(len(B)):
if B[i]==".":
p=i
break
b+=B[i]
b=int(b)*100+int(B[p+1:p+3])
print((a*b//100)) | 4 | 11 | 74 | 172 | a, b = input().split()
a = int(a)
b = int(float(b) * 1000)
print((int(a * b // 1000)))
| A, B = input().split()
a = int(A)
b = ""
p = 0
for i in range(len(B)):
if B[i] == ".":
p = i
break
b += B[i]
b = int(b) * 100 + int(B[p + 1 : p + 3])
print((a * b // 100))
| false | 63.636364 | [
"-a, b = input().split()",
"-a = int(a)",
"-b = int(float(b) * 1000)",
"-print((int(a * b // 1000)))",
"+A, B = input().split()",
"+a = int(A)",
"+b = \"\"",
"+p = 0",
"+for i in range(len(B)):",
"+ if B[i] == \".\":",
"+ p = i",
"+ break",
"+ b += B[i]",
"+b = int(b) *... | false | 0.041934 | 0.034556 | 1.213514 | [
"s543949041",
"s927238566"
] |
u724687935 | p02918 | python | s246350742 | s346353882 | 46 | 41 | 3,956 | 3,956 | Accepted | Accepted | 10.87 | N, K = list(map(int, input().split()))
S = eval(input())
T = []
g = S[0]
cnt = 0
for s in S:
if s == g:
cnt += 1
else:
T.append(cnt)
cnt = 1
g = s
else:
T.append(cnt)
t = len(T)
for k in range(K):
t -= 2
if t <= 1:
print((N - 1))
else:
... | N, K = list(map(int, input().split()))
S = eval(input())
T = []
g = S[0]
cnt = 0
for s in S:
if s == g:
cnt += 1
else:
T.append(cnt)
cnt = 1
g = s
else:
T.append(cnt)
print((N - max(1, len(T) - 2 * K)))
| 25 | 18 | 319 | 253 | N, K = list(map(int, input().split()))
S = eval(input())
T = []
g = S[0]
cnt = 0
for s in S:
if s == g:
cnt += 1
else:
T.append(cnt)
cnt = 1
g = s
else:
T.append(cnt)
t = len(T)
for k in range(K):
t -= 2
if t <= 1:
print((N - 1))
else:
print((N - t))
| N, K = list(map(int, input().split()))
S = eval(input())
T = []
g = S[0]
cnt = 0
for s in S:
if s == g:
cnt += 1
else:
T.append(cnt)
cnt = 1
g = s
else:
T.append(cnt)
print((N - max(1, len(T) - 2 * K)))
| false | 28 | [
"-t = len(T)",
"-for k in range(K):",
"- t -= 2",
"-if t <= 1:",
"- print((N - 1))",
"-else:",
"- print((N - t))",
"+print((N - max(1, len(T) - 2 * K)))"
] | false | 0.040922 | 0.045481 | 0.899761 | [
"s246350742",
"s346353882"
] |
u906501980 | p02744 | python | s623560636 | s389761913 | 200 | 110 | 21,820 | 4,412 | Accepted | Accepted | 45 | class Node:
__slots__ = ["string", "index"]
def __init__(self, string, index):
self.string = string
self.index = index
def get_children(self):
parent = self.string
out = [None]*(self.index+1)
for i, c in enumerate(s[:self.index]):
out[i] = Node(... | def dfs(s, mx):
if len(s) == n:
print(s)
return
for c in a[:mx]:
dfs(s+c, mx)
dfs(s+a[mx], mx+1)
n = int(eval(input()))
a = "abcdefghij"
dfs("", 0) | 28 | 11 | 780 | 188 | class Node:
__slots__ = ["string", "index"]
def __init__(self, string, index):
self.string = string
self.index = index
def get_children(self):
parent = self.string
out = [None] * (self.index + 1)
for i, c in enumerate(s[: self.index]):
out[i] = Node(pare... | def dfs(s, mx):
if len(s) == n:
print(s)
return
for c in a[:mx]:
dfs(s + c, mx)
dfs(s + a[mx], mx + 1)
n = int(eval(input()))
a = "abcdefghij"
dfs("", 0)
| false | 60.714286 | [
"-class Node:",
"- __slots__ = [\"string\", \"index\"]",
"-",
"- def __init__(self, string, index):",
"- self.string = string",
"- self.index = index",
"-",
"- def get_children(self):",
"- parent = self.string",
"- out = [None] * (self.index + 1)",
"- ... | false | 0.106839 | 0.057945 | 1.843805 | [
"s623560636",
"s389761913"
] |
u970197315 | p02928 | python | s434269398 | s600160157 | 1,097 | 787 | 3,188 | 9,368 | Accepted | Accepted | 28.26 | n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
ans=0
mod=10**9+7
inner=0
for i in range(n-1):
for j in range(i+1,n):
if a[i]>a[j]:
inner+=1
outer=0
for i in range(n):
for j in range(n):
if a[i]>a[j]:
outer+=1
ans=inner*k+outer*k*(k-1)//2
print((ans%mod)) | n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
ans=0
mod=10**9+7
inside=0
for i in range(n-1):
for j in range(i+1,n):
if a[i]>a[j]:
inside+=1
outside=0
for i in range(n):
for j in range(n):
if a[i]>a[j]:
outside+=1
print(((k*inside+(k*(k-1)//2)*outside)%mod))
... | 16 | 16 | 306 | 313 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
inner = 0
for i in range(n - 1):
for j in range(i + 1, n):
if a[i] > a[j]:
inner += 1
outer = 0
for i in range(n):
for j in range(n):
if a[i] > a[j]:
outer += 1
ans = inner ... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
inside = 0
for i in range(n - 1):
for j in range(i + 1, n):
if a[i] > a[j]:
inside += 1
outside = 0
for i in range(n):
for j in range(n):
if a[i] > a[j]:
outside += 1
print(... | false | 0 | [
"-inner = 0",
"+inside = 0",
"- inner += 1",
"-outer = 0",
"+ inside += 1",
"+outside = 0",
"- outer += 1",
"-ans = inner * k + outer * k * (k - 1) // 2",
"-print((ans % mod))",
"+ outside += 1",
"+print(((k * inside + (k * (k - 1) // 2) * outside) % m... | false | 0.036049 | 0.036037 | 1.000337 | [
"s434269398",
"s600160157"
] |
u780698286 | p03807 | python | s887383421 | s501255376 | 67 | 55 | 20,056 | 20,100 | Accepted | Accepted | 17.91 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
if a[i] % 2 == 1:
cnt += 1
if cnt % 2 == 1:
print("NO")
else:
print("YES") | n = int(input())
a = [i for i in list(map(int, input().split())) if i % 2 == 1]
print("YES") if len(a)%2==0 else print("NO")
| 10 | 3 | 183 | 126 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
if a[i] % 2 == 1:
cnt += 1
if cnt % 2 == 1:
print("NO")
else:
print("YES")
| n = int(input())
a = [i for i in list(map(int, input().split())) if i % 2 == 1]
print("YES") if len(a) % 2 == 0 else print("NO")
| false | 70 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-cnt = 0",
"-for i in range(n):",
"- if a[i] % 2 == 1:",
"- cnt += 1",
"-if cnt % 2 == 1:",
"- print(\"NO\")",
"-else:",
"- print(\"YES\")",
"+n = int(input())",
"+a = [i for i in list(map(int, input().split())... | false | 0.048836 | 0.04919 | 0.992795 | [
"s887383421",
"s501255376"
] |
u281303342 | p04000 | python | s408544315 | s516148305 | 1,926 | 1,704 | 166,500 | 191,204 | Accepted | Accepted | 11.53 | H,W,N = list(map(int,input().split()))
dic = {}
for i in range(N):
a,b = list(map(int,input().split()))
for dh in range(3):
for dw in range(3):
if 0<a-dh<=H-2 and 0<b-dw<=W-2:
if (a-dh,b-dw) not in list(dic.keys()):
dic[(a-dh,b-dw)] = 1
... | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
from collections import defaultdict
H,W,N = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(N)]
dic = defaultdict(int)
for a,b in AB:
for dh in range(3):
for dw in range(3):
if 0 < a-... | 23 | 26 | 510 | 535 | H, W, N = list(map(int, input().split()))
dic = {}
for i in range(N):
a, b = list(map(int, input().split()))
for dh in range(3):
for dw in range(3):
if 0 < a - dh <= H - 2 and 0 < b - dw <= W - 2:
if (a - dh, b - dw) not in list(dic.keys()):
dic[(a - dh, b... | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
from collections import defaultdict
H, W, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
dic = defaultdict(int)
for a, b in AB:
for dh in range(3):
for dw in range(3):
if 0 < a - dh <= ... | false | 11.538462 | [
"+# python3 (3.4.3)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+# main",
"+from collections import defaultdict",
"+",
"-dic = {}",
"-for i in range(N):",
"- a, b = list(map(int, input().split()))",
"+AB = [list(map(int, input().split())) for _ in range(N)]",
"+dic = defaultdict(i... | false | 0.048517 | 0.045454 | 1.067392 | [
"s408544315",
"s516148305"
] |
u367701763 | p03354 | python | s502599082 | s874115536 | 287 | 194 | 84,624 | 83,232 | Accepted | Accepted | 32.4 | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x): # 根を見つける関数を定義(同時にxを直接根にくっつける操作も行う)
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.pa... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
""" 根を見つける関数を定義(同時にxを直接根にくっつける操作も行う)"""
tmp = []
parents = self.parents
while parents[x] >= 0:
tmp.append(x)
x = parents[x]
... | 65 | 76 | 2,750 | 2,103 | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x): # 根を見つける関数を定義(同時にxを直接根にくっつける操作も行う)
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(
self.parents[x]
) # 右辺で再帰的に根... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
"""根を見つける関数を定義(同時にxを直接根にくっつける操作も行う)"""
tmp = []
parents = self.parents
while parents[x] >= 0:
tmp.append(x)
x = parents[x]
for y in tmp:
... | false | 14.473684 | [
"- def find(self, x): # 根を見つける関数を定義(同時にxを直接根にくっつける操作も行う)",
"- if self.parents[x] < 0:",
"- return x",
"- else:",
"- self.parents[x] = self.find(",
"- self.parents[x]",
"- ) # 右辺で再帰的に根を探索。根に到達すると一つ目のif判定に引っかかるので、",
"- # 最終的にs... | false | 0.037839 | 0.074416 | 0.508479 | [
"s502599082",
"s874115536"
] |
u724687935 | p03452 | python | s526240614 | s091566613 | 1,540 | 1,368 | 8,944 | 128,996 | Accepted | Accepted | 11.17 | class WeightedUnionFind():
def __init__(self, n):
self.parents = [-1] * n
self.par_weight = [0] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
root = self.find(self.parents[x])
self.par_weight[x] += self.par_weight[sel... | import sys
sys.setrecursionlimit(10 ** 6)
def dfs(p):
for edge in G[p]:
if X[edge[0]] is not None:
if X[edge[0]] - X[p] != edge[1]:
print('No')
exit()
else:
X[edge[0]] = X[p] + edge[1]
dfs(edge[0])
N, M = list(map... | 59 | 32 | 1,591 | 614 | class WeightedUnionFind:
def __init__(self, n):
self.parents = [-1] * n
self.par_weight = [0] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
root = self.find(self.parents[x])
self.par_weight[x] += self.par_weight[self.parents[x]... | import sys
sys.setrecursionlimit(10**6)
def dfs(p):
for edge in G[p]:
if X[edge[0]] is not None:
if X[edge[0]] - X[p] != edge[1]:
print("No")
exit()
else:
X[edge[0]] = X[p] + edge[1]
dfs(edge[0])
N, M = list(map(int, input().sp... | false | 45.762712 | [
"-class WeightedUnionFind:",
"- def __init__(self, n):",
"- self.parents = [-1] * n",
"- self.par_weight = [0] * n",
"+import sys",
"- def find(self, x):",
"- if self.parents[x] < 0:",
"- return x",
"+sys.setrecursionlimit(10**6)",
"+",
"+",
"+def dfs(p):"... | false | 0.062026 | 0.067987 | 0.912319 | [
"s526240614",
"s091566613"
] |
u673361376 | p03696 | python | s637072435 | s022088734 | 174 | 19 | 38,384 | 3,188 | Accepted | Accepted | 89.08 | N = int(eval(input()))
S = eval(input())
A1, A2 = [0 for _ in range(N)], [0 for _ in range(N)]
for i, s in enumerate(S):
if i == 0:
if s == '(': A1[i] = 1
else: A2[i] = 1
else:
if s == '(':
A1[i] = A1[i-1] + 1
A2[i] = A2[i-1]
else:
A1[i] = A1[i-1]
A2[i] = A2[... | from itertools import groupby
N = int(eval(input()))
S = eval(input())
cnt_l = 0
cnt_r = 0
ans = ''
for key, elems in groupby(S):
elems = list(elems)
if key == '(':
cnt_l += len(elems)
ans += '(' * len(elems)
else:
cnt_r += len(elems)
ans += ')' * len(elems)
... | 32 | 21 | 742 | 458 | N = int(eval(input()))
S = eval(input())
A1, A2 = [0 for _ in range(N)], [0 for _ in range(N)]
for i, s in enumerate(S):
if i == 0:
if s == "(":
A1[i] = 1
else:
A2[i] = 1
else:
if s == "(":
A1[i] = A1[i - 1] + 1
A2[i] = A2[i - 1]
el... | from itertools import groupby
N = int(eval(input()))
S = eval(input())
cnt_l = 0
cnt_r = 0
ans = ""
for key, elems in groupby(S):
elems = list(elems)
if key == "(":
cnt_l += len(elems)
ans += "(" * len(elems)
else:
cnt_r += len(elems)
ans += ")" * len(elems)
if cnt_l... | false | 34.375 | [
"+from itertools import groupby",
"+",
"-A1, A2 = [0 for _ in range(N)], [0 for _ in range(N)]",
"-for i, s in enumerate(S):",
"- if i == 0:",
"- if s == \"(\":",
"- A1[i] = 1",
"- else:",
"- A2[i] = 1",
"+cnt_l = 0",
"+cnt_r = 0",
"+ans = \"\"",
"+for ... | false | 0.047864 | 0.038966 | 1.228348 | [
"s637072435",
"s022088734"
] |
u352394527 | p01646 | python | s112565343 | s292986813 | 4,840 | 4,380 | 5,656 | 5,640 | Accepted | Accepted | 9.5 | def add_edge(node, adj_lst, adj_rev, s1, s2):
ind = 0
max_len = min(len(s1), len(s2))
while ind < max_len and s1[ind] == s2[ind]:
ind += 1
if ind == max_len:
if max_len < len(s1):
return True
return False
c1 = ord(s1[ind]) - ord("a")
c2 = ord(s2[ind]) - ord("a")
adj_lst[c1].ad... | def add_edge(node, adj_lst, adj_rev, s1, s2):
ind = 0
max_len = min(len(s1), len(s2))
while ind < max_len and s1[ind] == s2[ind]:
ind += 1
if ind == max_len:
if max_len < len(s1):
return True
return False
c1 = ord(s1[ind]) - ord("a")
c2 = ord(s2[ind]) - ord("a")
adj_lst[c1].ad... | 66 | 53 | 1,501 | 1,260 | def add_edge(node, adj_lst, adj_rev, s1, s2):
ind = 0
max_len = min(len(s1), len(s2))
while ind < max_len and s1[ind] == s2[ind]:
ind += 1
if ind == max_len:
if max_len < len(s1):
return True
return False
c1 = ord(s1[ind]) - ord("a")
c2 = ord(s2[ind]) - ord("a... | def add_edge(node, adj_lst, adj_rev, s1, s2):
ind = 0
max_len = min(len(s1), len(s2))
while ind < max_len and s1[ind] == s2[ind]:
ind += 1
if ind == max_len:
if max_len < len(s1):
return True
return False
c1 = ord(s1[ind]) - ord("a")
c2 = ord(s2[ind]) - ord("a... | false | 19.69697 | [
"-\"\"\"",
"-def dfs(x, visited, adj_lst, order):",
"- visited[x] = True",
"- for to in adj_lst[x]:",
"- if not visited[to]:",
"- dfs(to, visited, adj_lst, order)",
"- order.append(x)",
"-def dfs_rev(x, used, adj_rev):",
"- used.append(x)",
"- for to in adj_rev[x]:",
"- if not to... | false | 0.039222 | 0.037632 | 1.042255 | [
"s112565343",
"s292986813"
] |
u557565572 | p02743 | python | s106798377 | s377454123 | 150 | 17 | 14,428 | 2,940 | Accepted | Accepted | 88.67 | # import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
import numpy as np
# import math
a,b,c = list(map(int, input().split()))
# p = list(map(int, input().split()))
... | # import bisect
# # import heapq
# # from copy import deepcopy
# # from collections import deque
# # from collections import Counter
# # from itertools import accumulate
# # from itertools import permutations
# import numpy as np
# # import math
a,b,c = list(map(int, input().split()))
# n = int(input())
# ... | 25 | 20 | 547 | 436 | # import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
import numpy as np
# import math
a, b, c = list(map(int, input().split()))
# p = list(map(int, input().split()))
ans = "No... | # import bisect
# # import heapq
# # from copy import deepcopy
# # from collections import deque
# # from collections import Counter
# # from itertools import accumulate
# # from itertools import permutations
# import numpy as np
# # import math
a, b, c = list(map(int, input().split()))
# n = int(input())
# p = list(ma... | false | 20 | [
"-# import heapq",
"-# from copy import deepcopy",
"-# from collections import deque",
"-# from collections import Counter",
"-# from itertools import accumulate",
"-# from itertools import permutations",
"-import numpy as np",
"-",
"-# import math",
"+# # import heapq",
"+# # from copy import d... | false | 0.124789 | 0.037076 | 3.365777 | [
"s106798377",
"s377454123"
] |
u596536048 | p02700 | python | s851592979 | s076567179 | 30 | 25 | 9,100 | 9,120 | Accepted | Accepted | 16.67 | A, B, C, D = list(map(int, input().split()))
print(('Yes' if (C-1) // B <= (A-1) // D else 'No')) | A, B, C, D = list(map(int, input().split()))
print(('No' if -A // D > -C // B else 'Yes')) | 2 | 2 | 90 | 83 | A, B, C, D = list(map(int, input().split()))
print(("Yes" if (C - 1) // B <= (A - 1) // D else "No"))
| A, B, C, D = list(map(int, input().split()))
print(("No" if -A // D > -C // B else "Yes"))
| false | 0 | [
"-print((\"Yes\" if (C - 1) // B <= (A - 1) // D else \"No\"))",
"+print((\"No\" if -A // D > -C // B else \"Yes\"))"
] | false | 0.04523 | 0.043174 | 1.047604 | [
"s851592979",
"s076567179"
] |
u408071652 | p02863 | python | s478038704 | s645515396 | 190 | 107 | 74,204 | 74,304 | Accepted | Accepted | 43.68 | import sys
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N, T = list(map(int, input().split()))
dp = [0] * (T + 1)
AB = []
for k in range(N):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB.sort()
maxdp = 0
temp = 1
... | import sys
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N, T = list(map(int, input().split()))
dp = [0] * (T + 1)
AB = []
for k in range(N):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB.sort()
maxdp = 0
temp = 1
... | 31 | 32 | 633 | 665 | import sys
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N, T = list(map(int, input().split()))
dp = [0] * (T + 1)
AB = []
for k in range(N):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB.sort()
maxdp = 0
temp = 1
for i in range(N... | import sys
# \n
def input():
return sys.stdin.readline().rstrip()
def main():
N, T = list(map(int, input().split()))
dp = [0] * (T + 1)
AB = []
for k in range(N):
a, b = list(map(int, input().split()))
AB.append((a, b))
AB.sort()
maxdp = 0
temp = 1
for i in range(N... | false | 3.125 | [
"- dp[j] = max(dp[j], dp[j - a] + b)",
"- maxdp = max(dp[j], maxdp)",
"+ if dp[j] < dp[j - a] + b:",
"+ dp[j] = dp[j - a] + b",
"+ maxdp = max(dp[j], maxdp)"
] | false | 0.037427 | 0.037413 | 1.00037 | [
"s478038704",
"s645515396"
] |
u353797797 | p03171 | python | s127707118 | s795294243 | 1,884 | 1,459 | 234,176 | 234,176 | Accepted | Accepted | 22.56 | def kukan(n, a):
dp = [[0] * n for _ in range(n)]
for i in range(n):
dp[i][i] = a[i]
for i in range(n - 2, -1, -1):
for j in range(i + 1, n):
L = a[i] - dp[i + 1][j]
R = a[j] - dp[i][j - 1]
dp[i][j] = L if L > R else R
return dp[0][n - 1]
... | def kukan(n, a):
dp = [[0] * n for _ in range(n)]
for i in range(n):
dp[i][i] = a[i]
for i in range(n - 2, -1, -1):
g0 = dp[i]
g1 = dp[i + 1]
for j in range(i + 1, n):
L = a[i] - g1[j]
R = a[j] - g0[j - 1]
dp[i][j] = L if L > R el... | 15 | 17 | 395 | 429 | def kukan(n, a):
dp = [[0] * n for _ in range(n)]
for i in range(n):
dp[i][i] = a[i]
for i in range(n - 2, -1, -1):
for j in range(i + 1, n):
L = a[i] - dp[i + 1][j]
R = a[j] - dp[i][j - 1]
dp[i][j] = L if L > R else R
return dp[0][n - 1]
n = int(eva... | def kukan(n, a):
dp = [[0] * n for _ in range(n)]
for i in range(n):
dp[i][i] = a[i]
for i in range(n - 2, -1, -1):
g0 = dp[i]
g1 = dp[i + 1]
for j in range(i + 1, n):
L = a[i] - g1[j]
R = a[j] - g0[j - 1]
dp[i][j] = L if L > R else R
r... | false | 11.764706 | [
"+ g0 = dp[i]",
"+ g1 = dp[i + 1]",
"- L = a[i] - dp[i + 1][j]",
"- R = a[j] - dp[i][j - 1]",
"+ L = a[i] - g1[j]",
"+ R = a[j] - g0[j - 1]"
] | false | 0.049138 | 0.04581 | 1.072651 | [
"s127707118",
"s795294243"
] |
u623687794 | p02858 | python | s118299665 | s595872596 | 1,011 | 272 | 539,660 | 64,364 | Accepted | Accepted | 73.1 | from fractions import gcd
mod=10**9+7
def pow_r(x, n):
if n == 0: # exit case
return 1
if n % 2 == 0: # standard case ① n is even
return pow_r(x ** 2%mod, n // 2)%mod
else: # standard case ② n is odd
return x * pow_r(x ** 2%mod, (n - 1) // 2)%mod
h,w,t=list(map(int,input(... | from fractions import gcd
mod=10**9+7
def pow_r(x, n):
if n == 0: # exit case
return 1
if n % 2 == 0: # standard case ① n is even
return pow_r(x ** 2%mod, n // 2)%mod
else: # standard case ② n is odd
return x * pow_r(x ** 2%mod, (n - 1) // 2)%mod
h,w,t=list(map(int,input(... | 17 | 17 | 497 | 505 | from fractions import gcd
mod = 10**9 + 7
def pow_r(x, n):
if n == 0: # exit case
return 1
if n % 2 == 0: # standard case ① n is even
return pow_r(x**2 % mod, n // 2) % mod
else: # standard case ② n is odd
return x * pow_r(x**2 % mod, (n - 1) // 2) % mod
h, w, t = list(map(in... | from fractions import gcd
mod = 10**9 + 7
def pow_r(x, n):
if n == 0: # exit case
return 1
if n % 2 == 0: # standard case ① n is even
return pow_r(x**2 % mod, n // 2) % mod
else: # standard case ② n is odd
return x * pow_r(x**2 % mod, (n - 1) // 2) % mod
h, w, t = list(map(in... | false | 0 | [
"-cnt = (2 ** (unit[0]) + 2 ** (unit[1]) - 3) % mod",
"+cnt = (pow_r(2, unit[0]) + pow_r(2, unit[1]) - 3) % mod"
] | false | 0.04742 | 0.007316 | 6.481888 | [
"s118299665",
"s595872596"
] |
u057109575 | p03253 | python | s736904146 | s518103090 | 185 | 168 | 38,512 | 38,640 | Accepted | Accepted | 9.19 | from collections import defaultdict
N, M = list(map(int, input().split()))
prime = defaultdict(int)
m = M
for i in range(2, 10 ** 5):
while m % i == 0 and m > 1:
prime[i] += 1
m //= i
if m > 1:
prime[M] = 1
MOD = 10 ** 9 + 7
def comb(n, k):
a = 1
for i in range(1, k ... | from collections import defaultdict
N, M = list(map(int, input().split()))
prime = defaultdict(int)
m = M
for i in range(2, 10 ** 5):
while m % i == 0 and m > 1:
prime[i] += 1
m //= i
if m > 1:
prime[m] = 1
MOD = 10 ** 9 + 7
def comb(n, k):
a = 1
for i in range(1, k ... | 33 | 33 | 555 | 555 | from collections import defaultdict
N, M = list(map(int, input().split()))
prime = defaultdict(int)
m = M
for i in range(2, 10**5):
while m % i == 0 and m > 1:
prime[i] += 1
m //= i
if m > 1:
prime[M] = 1
MOD = 10**9 + 7
def comb(n, k):
a = 1
for i in range(1, k + 1):
a *= n -... | from collections import defaultdict
N, M = list(map(int, input().split()))
prime = defaultdict(int)
m = M
for i in range(2, 10**5):
while m % i == 0 and m > 1:
prime[i] += 1
m //= i
if m > 1:
prime[m] = 1
MOD = 10**9 + 7
def comb(n, k):
a = 1
for i in range(1, k + 1):
a *= n -... | false | 0 | [
"- prime[M] = 1",
"+ prime[m] = 1"
] | false | 0.055203 | 0.168136 | 0.328322 | [
"s736904146",
"s518103090"
] |
u669696235 | p04039 | python | s566111680 | s102796449 | 133 | 70 | 3,060 | 2,940 | Accepted | Accepted | 47.37 | N,K=list(map(int,input().split()))
d=list(map(int,input().split()))
dr=len(d)
for i in range(N,100000):
s=list(str(i))
num=0
for j in d:
if(str(j) in s):
break
else:
num+=1
if(num==dr):
print(i)
break | N,K=list(map(int,input().split()))
D=list(input().split())
for i in range(N,100000):
ans=True
for j in str(i):
if(str(j) in D):
ans=False
break
if(ans):
print(i)
exit()
| 15 | 12 | 281 | 295 | N, K = list(map(int, input().split()))
d = list(map(int, input().split()))
dr = len(d)
for i in range(N, 100000):
s = list(str(i))
num = 0
for j in d:
if str(j) in s:
break
else:
num += 1
if num == dr:
print(i)
break
| N, K = list(map(int, input().split()))
D = list(input().split())
for i in range(N, 100000):
ans = True
for j in str(i):
if str(j) in D:
ans = False
break
if ans:
print(i)
exit()
| false | 20 | [
"-d = list(map(int, input().split()))",
"-dr = len(d)",
"+D = list(input().split())",
"- s = list(str(i))",
"- num = 0",
"- for j in d:",
"- if str(j) in s:",
"+ ans = True",
"+ for j in str(i):",
"+ if str(j) in D:",
"+ ans = False",
"- else:",
... | false | 0.03436 | 0.03408 | 1.008226 | [
"s566111680",
"s102796449"
] |
u744920373 | p02713 | python | s638724738 | s031017930 | 998 | 428 | 136,500 | 139,864 | Accepted | Accepted | 57.11 | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): ret... | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): ret... | 43 | 45 | 1,532 | 1,164 | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
de... | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
de... | false | 4.444444 | [
"-from math import gcd",
"+# from math import gcd",
"+",
"+",
"+def gcd(a, b):",
"+ if a < b:",
"+ a, b = b, a",
"+ r = a % b",
"+ if r == 0:",
"+ return b",
"+ return gcd(r, b)",
"+ for j in range(i + 1, K + 1):",
"+ for k in range(j + 1, K + 1):",
"+ ... | false | 0.043301 | 0.186768 | 0.231841 | [
"s638724738",
"s031017930"
] |
u747602774 | p03854 | python | s251032168 | s870118663 | 36 | 28 | 4,084 | 3,188 | Accepted | Accepted | 22.22 | S=list(eval(input()))
l=0
while l!=len(S):
l=len(S)
if S[-1]=='m' and S[-2]=='a' and S[-3]=='e' and S[-4]=='r' and S[-5]=='d':
del S[-5:]
if len(S)==0:
break
if S[-1]=='e' and S[-2]=='s' and S[-3]=='a' and S[-4]=='r' and S[-5]=='e':
del S[-5:]
if len(S)==0:
break
if S[-1]=='r' an... | S = eval(input())
idx = len(S)
ans = 'YES'
while idx > 0:
if S[idx-5:idx] == 'dream':
idx -= 5
elif S[idx-5:idx] == 'erase':
idx -= 5
elif S[idx-7:idx] == 'dreamer':
idx -= 7
elif S[idx-6:idx] == 'eraser':
idx -= 6
else:
ans = 'NO'
break
... | 25 | 16 | 638 | 325 | S = list(eval(input()))
l = 0
while l != len(S):
l = len(S)
if S[-1] == "m" and S[-2] == "a" and S[-3] == "e" and S[-4] == "r" and S[-5] == "d":
del S[-5:]
if len(S) == 0:
break
if S[-1] == "e" and S[-2] == "s" and S[-3] == "a" and S[-4] == "r" and S[-5] == "e":
del S[-5:]
if... | S = eval(input())
idx = len(S)
ans = "YES"
while idx > 0:
if S[idx - 5 : idx] == "dream":
idx -= 5
elif S[idx - 5 : idx] == "erase":
idx -= 5
elif S[idx - 7 : idx] == "dreamer":
idx -= 7
elif S[idx - 6 : idx] == "eraser":
idx -= 6
else:
ans = "NO"
brea... | false | 36 | [
"-S = list(eval(input()))",
"-l = 0",
"-while l != len(S):",
"- l = len(S)",
"- if S[-1] == \"m\" and S[-2] == \"a\" and S[-3] == \"e\" and S[-4] == \"r\" and S[-5] == \"d\":",
"- del S[-5:]",
"- if len(S) == 0:",
"+S = eval(input())",
"+idx = len(S)",
"+ans = \"YES\"",
"+while i... | false | 0.036963 | 0.035397 | 1.044238 | [
"s251032168",
"s870118663"
] |
u840247626 | p02264 | python | s232619651 | s571730090 | 800 | 620 | 12,236 | 13,012 | Accepted | Accepted | 22.5 | n,q = list(map(int,input().split()))
queue = []
for i in range(n):
name,time = input().split()
queue.append((name, int(time)))
t = 0
while queue:
name,time = queue.pop(0)
t += min(q, time)
if time > q:
queue.append((name, time-q))
else:
print((name,t))
| n,q = list(map(int,input().split()))
queue = []
for i in range(n):
name,time = input().split()
queue.append([name, int(time)])
t = 0
i = 0
while queue:
i %= len(queue)
p = queue[i]
t += min(q, p[1])
if p[1] > q:
p[1] -= q
i += 1
else:
print((p[0], t))
queue.pop(i)
| 14 | 18 | 269 | 290 | n, q = list(map(int, input().split()))
queue = []
for i in range(n):
name, time = input().split()
queue.append((name, int(time)))
t = 0
while queue:
name, time = queue.pop(0)
t += min(q, time)
if time > q:
queue.append((name, time - q))
else:
print((name, t))
| n, q = list(map(int, input().split()))
queue = []
for i in range(n):
name, time = input().split()
queue.append([name, int(time)])
t = 0
i = 0
while queue:
i %= len(queue)
p = queue[i]
t += min(q, p[1])
if p[1] > q:
p[1] -= q
i += 1
else:
print((p[0], t))
queue... | false | 22.222222 | [
"- queue.append((name, int(time)))",
"+ queue.append([name, int(time)])",
"+i = 0",
"- name, time = queue.pop(0)",
"- t += min(q, time)",
"- if time > q:",
"- queue.append((name, time - q))",
"+ i %= len(queue)",
"+ p = queue[i]",
"+ t += min(q, p[1])",
"+ if p[... | false | 0.035719 | 0.113337 | 0.315155 | [
"s232619651",
"s571730090"
] |
u512294098 | p03141 | python | s773571517 | s201754990 | 570 | 520 | 25,660 | 36,880 | Accepted | Accepted | 8.77 | import numpy as np
N = int(eval(input()))
A = []
B = []
val = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
val.append(a + b)
A = np.array(A)
B = np.array(B)
val = np.array(val)
sort_index = val.argsort()
A = (A[sort_index][::-1])
B = (B[so... | n = int(eval(input()))
happiness_hash = {}
for i in range(n):
a, b = tuple(map(int, input().split(' ')))
happiness_hash[i] = (a, b)
sorted_happiness = sorted(list(happiness_hash.items()), key = lambda x : x[1][0] + x[1][1], reverse = True)
total = 0
i = 0
for k, v in sorted_happiness:
happ... | 26 | 22 | 400 | 500 | import numpy as np
N = int(eval(input()))
A = []
B = []
val = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
val.append(a + b)
A = np.array(A)
B = np.array(B)
val = np.array(val)
sort_index = val.argsort()
A = A[sort_index][::-1]
B = B[sort_index][::-1]
taka = A[0:... | n = int(eval(input()))
happiness_hash = {}
for i in range(n):
a, b = tuple(map(int, input().split(" ")))
happiness_hash[i] = (a, b)
sorted_happiness = sorted(
list(happiness_hash.items()), key=lambda x: x[1][0] + x[1][1], reverse=True
)
total = 0
i = 0
for k, v in sorted_happiness:
happiness, selected =... | false | 15.384615 | [
"-import numpy as np",
"-",
"-N = int(eval(input()))",
"-A = []",
"-B = []",
"-val = []",
"-for i in range(N):",
"- a, b = list(map(int, input().split()))",
"- A.append(a)",
"- B.append(b)",
"- val.append(a + b)",
"-A = np.array(A)",
"-B = np.array(B)",
"-val = np.array(val)",
... | false | 0.185651 | 0.036373 | 5.104018 | [
"s773571517",
"s201754990"
] |
u770077083 | p03013 | python | s821255437 | s493018698 | 372 | 192 | 460,492 | 8,056 | Accepted | Accepted | 48.39 | import math
from collections import deque
memo = deque([1, 2])
floor = 1
def search(x):
global memo, floor
while x > floor:
memo.append(memo[-1] + memo[-2])
floor += 1
return memo[x-1]
CONST = 1000000007
n,m = list(map(int,input().split()))
lis = []
prev = -1
for _ in range... | from collections import deque
CONST = 1000000007
n,m = list(map(int,input().split()))
lis = deque([int(eval(input())) for _ in range(m)])
lis.append(n+1)
nhole = lis.popleft()
memo = deque([0, 1])
for i in range(1,n+1):
if i == nhole:
memo.append(0)
nhole = lis.popleft()
else:
... | 31 | 17 | 562 | 373 | import math
from collections import deque
memo = deque([1, 2])
floor = 1
def search(x):
global memo, floor
while x > floor:
memo.append(memo[-1] + memo[-2])
floor += 1
return memo[x - 1]
CONST = 1000000007
n, m = list(map(int, input().split()))
lis = []
prev = -1
for _ in range(m):
... | from collections import deque
CONST = 1000000007
n, m = list(map(int, input().split()))
lis = deque([int(eval(input())) for _ in range(m)])
lis.append(n + 1)
nhole = lis.popleft()
memo = deque([0, 1])
for i in range(1, n + 1):
if i == nhole:
memo.append(0)
nhole = lis.popleft()
else:
me... | false | 45.16129 | [
"-import math",
"-",
"-memo = deque([1, 2])",
"-floor = 1",
"-",
"-",
"-def search(x):",
"- global memo, floor",
"- while x > floor:",
"- memo.append(memo[-1] + memo[-2])",
"- floor += 1",
"- return memo[x - 1]",
"-",
"-lis = []",
"-prev = -1",
"-for _ in range(m... | false | 0.034559 | 0.034452 | 1.003107 | [
"s821255437",
"s493018698"
] |
u136090046 | p03206 | python | s007591870 | s319039457 | 20 | 18 | 3,316 | 2,940 | Accepted | Accepted | 10 | d = int(eval(input()))
if d == 25:
print("Christmas")
elif d == 24:
print("Christmas Eve")
elif d == 23:
print("Christmas Eve Eve")
else:
print("Christmas Eve Eve Eve")
| D = eval(input())
if D == "25":
print("Christmas")
elif D == "24":
print("Christmas Eve")
elif D == "23":
print("Christmas Eve Eve")
elif D == "22":
print("Christmas Eve Eve Eve") | 11 | 9 | 194 | 189 | d = int(eval(input()))
if d == 25:
print("Christmas")
elif d == 24:
print("Christmas Eve")
elif d == 23:
print("Christmas Eve Eve")
else:
print("Christmas Eve Eve Eve")
| D = eval(input())
if D == "25":
print("Christmas")
elif D == "24":
print("Christmas Eve")
elif D == "23":
print("Christmas Eve Eve")
elif D == "22":
print("Christmas Eve Eve Eve")
| false | 18.181818 | [
"-d = int(eval(input()))",
"-if d == 25:",
"+D = eval(input())",
"+if D == \"25\":",
"-elif d == 24:",
"+elif D == \"24\":",
"-elif d == 23:",
"+elif D == \"23\":",
"-else:",
"+elif D == \"22\":"
] | false | 0.035107 | 0.034675 | 1.01247 | [
"s007591870",
"s319039457"
] |
u330039499 | p03273 | python | s723738262 | s296066415 | 1,528 | 228 | 16,124 | 16,520 | Accepted | Accepted | 85.08 | import numpy as np
H, W = list(map(int, input().split()))
a = []
for i in range(H):
_a = list(input())
a.append(_a)
a = np.array(a)
b = a.copy()
while True:
r_exist = False
c_exist = False
for i in range(len(a)):
if not '#' in a[i, :]:
b = np.delete(a, i, 0)
r_exist = True
a = b.copy()
... | import numpy as np
import sys
H, W = list(map(int, input().split()))
a = []
for i in range(H):
_a = list(input())
a.append(_a)
a = np.array(a)
row_exist = [False] * H
col_exist = [False] * W
for i in range(H):
if '#' in a[i, :]:
row_exist[i] = True
for i in range(W):
if '#' in a[:, i]:
col_ex... | 26 | 24 | 510 | 475 | import numpy as np
H, W = list(map(int, input().split()))
a = []
for i in range(H):
_a = list(input())
a.append(_a)
a = np.array(a)
b = a.copy()
while True:
r_exist = False
c_exist = False
for i in range(len(a)):
if not "#" in a[i, :]:
b = np.delete(a, i, 0)
r_exist ... | import numpy as np
import sys
H, W = list(map(int, input().split()))
a = []
for i in range(H):
_a = list(input())
a.append(_a)
a = np.array(a)
row_exist = [False] * H
col_exist = [False] * W
for i in range(H):
if "#" in a[i, :]:
row_exist[i] = True
for i in range(W):
if "#" in a[:, i]:
... | false | 7.692308 | [
"+import sys",
"-b = a.copy()",
"-while True:",
"- r_exist = False",
"- c_exist = False",
"- for i in range(len(a)):",
"- if not \"#\" in a[i, :]:",
"- b = np.delete(a, i, 0)",
"- r_exist = True",
"- a = b.copy()",
"- for i in range(len(b[0])):",
"- ... | false | 0.500489 | 0.558311 | 0.896435 | [
"s723738262",
"s296066415"
] |
u798260206 | p03160 | python | s614822006 | s859421616 | 130 | 120 | 13,928 | 20,544 | Accepted | Accepted | 7.69 | n = int(eval(input()))
h = list(map(int, input().split()))
a = [0 for _ in range(n)]
a[1] = abs(h[1] - h[0])
for i in range(2,n):
a[i] = min(a[i-1]+abs(h[i]-h[i-1]), a[i-2]+abs(h[i]-h[i-2]))
print((a[-1])) | n = int(eval(input()))
h = list(map(int,input().split()))
inf = float("inf")
dp =[inf for i in range(n)]
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2,n):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1])) | 10 | 10 | 219 | 243 | n = int(eval(input()))
h = list(map(int, input().split()))
a = [0 for _ in range(n)]
a[1] = abs(h[1] - h[0])
for i in range(2, n):
a[i] = min(a[i - 1] + abs(h[i] - h[i - 1]), a[i - 2] + abs(h[i] - h[i - 2]))
print((a[-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
inf = float("inf")
dp = [inf for i in range(n)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| false | 0 | [
"-a = [0 for _ in range(n)]",
"-a[1] = abs(h[1] - h[0])",
"+inf = float(\"inf\")",
"+dp = [inf for i in range(n)]",
"+dp[0] = 0",
"+dp[1] = abs(h[1] - h[0])",
"- a[i] = min(a[i - 1] + abs(h[i] - h[i - 1]), a[i - 2] + abs(h[i] - h[i - 2]))",
"-print((a[-1]))",
"+ dp[i] = min(dp[i - 1] + abs(h[i... | false | 0.03694 | 0.060041 | 0.615257 | [
"s614822006",
"s859421616"
] |
u760569096 | p03043 | python | s316066840 | s467915639 | 53 | 47 | 9,936 | 9,432 | Accepted | Accepted | 11.32 | n,k = list(map(int, input().split()))
a = []
for i in range(1,n+1):
j = i
b =0
while j<k:
j*=2
b+=1
a.append(b)
ans = 0
for i in range(n):
ans+=0.5**a[i]
print((ans/n)) | n,k = list(map(int, input().split()))
ans = 0
for i in range(1,n+1):
j = i
b =0
while j<k:
j*=2
b+=1
ans+=0.5**b
print((ans/n)) | 13 | 10 | 190 | 144 | n, k = list(map(int, input().split()))
a = []
for i in range(1, n + 1):
j = i
b = 0
while j < k:
j *= 2
b += 1
a.append(b)
ans = 0
for i in range(n):
ans += 0.5 ** a[i]
print((ans / n))
| n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
j = i
b = 0
while j < k:
j *= 2
b += 1
ans += 0.5**b
print((ans / n))
| false | 23.076923 | [
"-a = []",
"+ans = 0",
"- a.append(b)",
"-ans = 0",
"-for i in range(n):",
"- ans += 0.5 ** a[i]",
"+ ans += 0.5**b"
] | false | 0.075165 | 0.145021 | 0.518306 | [
"s316066840",
"s467915639"
] |
u887207211 | p03495 | python | s528964598 | s059149016 | 190 | 121 | 38,964 | 32,184 | Accepted | Accepted | 36.32 | N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
d = {}
for a in A:
if(a not in d):
d[a] = 1
else:
d[a] += 1
if(len(d) <= K):
print((0))
else:
tmp = sorted(list(d.items()), key = lambda x: -x[1])[K:]
print((sum(t[1] for t in tmp))) | N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
d = {}
for a in A:
if(a not in d):
d[a] = 1
else:
d[a] += 1
print((sum(sorted(d.values())[:-K]))) | 14 | 11 | 271 | 186 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
d = {}
for a in A:
if a not in d:
d[a] = 1
else:
d[a] += 1
if len(d) <= K:
print((0))
else:
tmp = sorted(list(d.items()), key=lambda x: -x[1])[K:]
print((sum(t[1] for t in tmp)))
| N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
d = {}
for a in A:
if a not in d:
d[a] = 1
else:
d[a] += 1
print((sum(sorted(d.values())[:-K])))
| false | 21.428571 | [
"-if len(d) <= K:",
"- print((0))",
"-else:",
"- tmp = sorted(list(d.items()), key=lambda x: -x[1])[K:]",
"- print((sum(t[1] for t in tmp)))",
"+print((sum(sorted(d.values())[:-K])))"
] | false | 0.045104 | 0.044297 | 1.018223 | [
"s528964598",
"s059149016"
] |
u576917603 | p02881 | python | s841095059 | s762623637 | 169 | 114 | 3,268 | 3,296 | Accepted | Accepted | 32.54 | n=int(eval(input()))
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)
if n==divisors[-1]**2:
print((divisors[-1]*2-2))
else:
print((divisors[-1]+divisors[-2]-2)) | n=int(eval(input()))
divisors = []
def a(n):
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
divisors.append(n//i)
divisors.sort()
return divisors
a(n)
x=len(divisors)//2
print((divisors[x]+divisors[x-1]-2)) | 11 | 12 | 272 | 274 | n = int(eval(input()))
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)
if n == divisors[-1] ** 2:
print((divisors[-1] * 2 - 2))
else:
print((divisors[-1] + divisors[-2] - 2))
| n = int(eval(input()))
divisors = []
def a(n):
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
divisors.append(n // i)
divisors.sort()
return divisors
a(n)
x = len(divisors) // 2
print((divisors[x] + divisors[x - 1] - 2))
| false | 8.333333 | [
"-for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- divisors.append(i)",
"- if i != n // i:",
"+",
"+",
"+def a(n):",
"+ for i in range(1, int(n**0.5) + 1):",
"+ if n % i == 0:",
"+ divisors.append(i)",
"-if n == divisors[-1] ** 2:",
"- print... | false | 0.038807 | 0.11025 | 0.351992 | [
"s841095059",
"s762623637"
] |
u649769812 | p02572 | python | s554621132 | s786173006 | 175 | 97 | 31,748 | 31,600 | Accepted | Accepted | 44.57 | n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9+7
ans = 0
sum_j = [0] * n
sum_tmp = 0
for i in reversed(list(range(n))):
sum_tmp += a[i]
sum_j[i] = sum_tmp
for i in range(n-1):
ans += a[i] * sum_j[i+1] % mod
print((ans % mod))
| n = int(eval(input()))
A = list(map(int, input().split()))
S = sum(A)
S2 = sum([x * x for x in A])
print(((S * S - S2) // 2 % (10 ** 9 + 7)))
| 17 | 7 | 269 | 147 | n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
sum_j = [0] * n
sum_tmp = 0
for i in reversed(list(range(n))):
sum_tmp += a[i]
sum_j[i] = sum_tmp
for i in range(n - 1):
ans += a[i] * sum_j[i + 1] % mod
print((ans % mod))
| n = int(eval(input()))
A = list(map(int, input().split()))
S = sum(A)
S2 = sum([x * x for x in A])
print(((S * S - S2) // 2 % (10**9 + 7)))
| false | 58.823529 | [
"-a = list(map(int, input().split()))",
"-mod = 10**9 + 7",
"-ans = 0",
"-sum_j = [0] * n",
"-sum_tmp = 0",
"-for i in reversed(list(range(n))):",
"- sum_tmp += a[i]",
"- sum_j[i] = sum_tmp",
"-for i in range(n - 1):",
"- ans += a[i] * sum_j[i + 1] % mod",
"-print((ans % mod))",
"+A =... | false | 0.08636 | 0.036986 | 2.334931 | [
"s554621132",
"s786173006"
] |
u997641430 | p02642 | python | s551284511 | s718985336 | 1,470 | 1,244 | 203,556 | 104,020 | Accepted | Accepted | 15.37 | n = int(eval(input()))
*A, = list(map(int, input().split()))
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in range(1, maxA + 1)}
for a in A:
C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in range(1, maxA + 1)}
for a in A:
if C[a] > 0:
tmp = 2
while a * tmp <= maxA:
... | n = int(eval(input()))
*A, = list(map(int, input().split()))
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
if C[a] > 0:
tmp = 2
while a * tmp <= maxA:
D[a * tmp] = 1
t... | 20 | 20 | 435 | 401 | n = int(eval(input()))
(*A,) = list(map(int, input().split()))
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in range(1, maxA + 1)}
for a in A:
C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in range(1, maxA + 1)}
for a in A:
if C[a] > 0:
tmp = 2
while a * tmp <= maxA:
D[a * ... | n = int(eval(input()))
(*A,) = list(map(int, input().split()))
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
if C[a] > 0:
tmp = 2
while a * tmp <= maxA:
D[a * tmp] = 1
tmp += 1
ans ... | false | 0 | [
"-C = {a: 0 for a in range(1, maxA + 1)}",
"+C = {a: 0 for a in A}",
"-D = {a: 0 for a in range(1, maxA + 1)}",
"+D = {a: 0 for a in A}"
] | false | 0.048635 | 0.12944 | 0.375735 | [
"s551284511",
"s718985336"
] |
u483645888 | p03160 | python | s947850867 | s245495271 | 1,780 | 136 | 22,696 | 13,980 | Accepted | Accepted | 92.36 | import numpy as np
n = int(eval(input()))
k = 2
h = np.array(list(map(int, input().split())))
dp = np.array([0]*n)
for i in range(1,n):
s = max(i-k,0)
dp[i] = np.min(dp[s:i]+np.abs(h[s:i]-h[i]))
print((dp[n-1])) | n = int(eval(input()))
l = list(map(int, input().split()))
#print(l)
dp = [0]*n
dp[1] = abs(l[1]-l[0])
for i in range(1,n-1):
dp[i+1] = min(dp[i]+abs(l[i+1]-l[i]), dp[i-1]+abs(l[i+1]-l[i-1]))
print((dp[-1])) | 10 | 8 | 217 | 208 | import numpy as np
n = int(eval(input()))
k = 2
h = np.array(list(map(int, input().split())))
dp = np.array([0] * n)
for i in range(1, n):
s = max(i - k, 0)
dp[i] = np.min(dp[s:i] + np.abs(h[s:i] - h[i]))
print((dp[n - 1]))
| n = int(eval(input()))
l = list(map(int, input().split()))
# print(l)
dp = [0] * n
dp[1] = abs(l[1] - l[0])
for i in range(1, n - 1):
dp[i + 1] = min(dp[i] + abs(l[i + 1] - l[i]), dp[i - 1] + abs(l[i + 1] - l[i - 1]))
print((dp[-1]))
| false | 20 | [
"-import numpy as np",
"-",
"-k = 2",
"-h = np.array(list(map(int, input().split())))",
"-dp = np.array([0] * n)",
"-for i in range(1, n):",
"- s = max(i - k, 0)",
"- dp[i] = np.min(dp[s:i] + np.abs(h[s:i] - h[i]))",
"-print((dp[n - 1]))",
"+l = list(map(int, input().split()))",
"+# print(... | false | 0.499716 | 0.036249 | 13.785529 | [
"s947850867",
"s245495271"
] |
u572561929 | p03854 | python | s621526129 | s872198310 | 69 | 21 | 3,188 | 3,188 | Accepted | Accepted | 69.57 | S = input()[::-1]
T = list(['maerd', 'remaerd', 'esare', 'resare'])
while(1):
if len(S) == 0:
print('YES')
break
elif S[:5] in T:
S = S[5:]
elif S[:6] in T:
S = S[6:]
elif S[:7] in T:
S = S[7:]
else:
print('NO')
break
| S = eval(input())
T = list(['eraser', 'erase', 'dreamer', 'dream', ])
for i in range(4):
S = S.replace(T[i], '')
if S == '':
print('YES')
else:
print('NO') | 15 | 8 | 308 | 168 | S = input()[::-1]
T = list(["maerd", "remaerd", "esare", "resare"])
while 1:
if len(S) == 0:
print("YES")
break
elif S[:5] in T:
S = S[5:]
elif S[:6] in T:
S = S[6:]
elif S[:7] in T:
S = S[7:]
else:
print("NO")
break
| S = eval(input())
T = list(
[
"eraser",
"erase",
"dreamer",
"dream",
]
)
for i in range(4):
S = S.replace(T[i], "")
if S == "":
print("YES")
else:
print("NO")
| false | 46.666667 | [
"-S = input()[::-1]",
"-T = list([\"maerd\", \"remaerd\", \"esare\", \"resare\"])",
"-while 1:",
"- if len(S) == 0:",
"- print(\"YES\")",
"- break",
"- elif S[:5] in T:",
"- S = S[5:]",
"- elif S[:6] in T:",
"- S = S[6:]",
"- elif S[:7] in T:",
"- ... | false | 0.069595 | 0.043276 | 1.608158 | [
"s621526129",
"s872198310"
] |
u002459665 | p03161 | python | s732689526 | s760318914 | 415 | 351 | 54,880 | 53,496 | Accepted | Accepted | 15.42 | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
INF = 10**6
# DP = [INF] * N
# DP = [INF] * ((10**5)+10)
DP = [float('inf')] * N
DP[0] = 0
# for i in range(1, N):
# for j in range(1, K+1):
# if 0 <= i - j < N:
# DP[i] = min(DP[i], DP[i-j] + abs(H[i-j] -... | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
INF = 10**4 * 10**5 + 1
DP = [INF] * N
# DP = [INF] * ((10**5)+10)
# DP = [float('inf')] * N
DP[0] = 0
# for i in range(1, N):
# for j in range(1, K+1):
# if 0 <= i - j < N:
# DP[i] = min(DP[i], DP[i-j] + ... | 24 | 24 | 548 | 560 | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
INF = 10**6
# DP = [INF] * N
# DP = [INF] * ((10**5)+10)
DP = [float("inf")] * N
DP[0] = 0
# for i in range(1, N):
# for j in range(1, K+1):
# if 0 <= i - j < N:
# DP[i] = min(DP[i], DP[i-j] + abs(H[i-j] - H[i]))
for i in... | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
INF = 10**4 * 10**5 + 1
DP = [INF] * N
# DP = [INF] * ((10**5)+10)
# DP = [float('inf')] * N
DP[0] = 0
# for i in range(1, N):
# for j in range(1, K+1):
# if 0 <= i - j < N:
# DP[i] = min(DP[i], DP[i-j] + abs(H[i-j] - H[i... | false | 0 | [
"-INF = 10**6",
"-# DP = [INF] * N",
"+INF = 10**4 * 10**5 + 1",
"+DP = [INF] * N",
"-DP = [float(\"inf\")] * N",
"+# DP = [float('inf')] * N"
] | false | 0.042482 | 0.053406 | 0.795445 | [
"s732689526",
"s760318914"
] |
u813098295 | p03209 | python | s581789994 | s450270526 | 21 | 18 | 3,188 | 3,064 | Accepted | Accepted | 14.29 | N, X = list(map(int, input().split()))
b_len = [1]
for i in range(1, 55):
b_len += [ b_len[i-1] * 2 + 3 ]
t = [0, 1, 2, 3, 3]
dp = {}
def solve(N, X):
if dp.get((N, X), -1) != -1:
return dp[(N,X)]
elif N == 0:
return 1
elif N == 1:
if X > 5:
dp[(N... | #!/usr/bin/env python3
N, X = map(int, input().split())
burger_len = [1]
for i in range(N):
burger_len += [ burger_len[i] * 2 + 3 ]
def rec(N, X):
if X == 1:
return 1 if N == 0 else 0
elif 1 < X <= burger_len[N-1] + 1:
return rec(N-1, X-1)
elif X == burger_len[N-1] + 2:
... | 38 | 22 | 927 | 610 | N, X = list(map(int, input().split()))
b_len = [1]
for i in range(1, 55):
b_len += [b_len[i - 1] * 2 + 3]
t = [0, 1, 2, 3, 3]
dp = {}
def solve(N, X):
if dp.get((N, X), -1) != -1:
return dp[(N, X)]
elif N == 0:
return 1
elif N == 1:
if X > 5:
dp[(N, X)] = t[4]
... | #!/usr/bin/env python3
N, X = map(int, input().split())
burger_len = [1]
for i in range(N):
burger_len += [burger_len[i] * 2 + 3]
def rec(N, X):
if X == 1:
return 1 if N == 0 else 0
elif 1 < X <= burger_len[N - 1] + 1:
return rec(N - 1, X - 1)
elif X == burger_len[N - 1] + 2:
r... | false | 42.105263 | [
"-N, X = list(map(int, input().split()))",
"-b_len = [1]",
"-for i in range(1, 55):",
"- b_len += [b_len[i - 1] * 2 + 3]",
"-t = [0, 1, 2, 3, 3]",
"-dp = {}",
"+#!/usr/bin/env python3",
"+N, X = map(int, input().split())",
"+burger_len = [1]",
"+for i in range(N):",
"+ burger_len += [burge... | false | 0.077491 | 0.107625 | 0.720011 | [
"s581789994",
"s450270526"
] |
u589886885 | p02385 | python | s592475199 | s543398594 | 50 | 30 | 7,788 | 7,788 | Accepted | Accepted | 40 | class Dice():
def __init__(self, label):
self.label = label
def north(self):
self.change([2, 6, 3, 4, 1, 5])
def west(self):
self.change([3, 2, 6, 1, 5, 4])
def east(self):
self.change([4, 2, 1, 6, 5, 3])
def south(self):
self.change([5, 1,... | class Dice():
def __init__(self, label):
self.label = label
def north(self):
self.change([2, 6, 3, 4, 1, 5])
def west(self):
self.change([3, 2, 6, 1, 5, 4])
def east(self):
self.change([4, 2, 1, 6, 5, 3])
def south(self):
self.change([5, 1,... | 49 | 51 | 1,058 | 1,138 | class Dice:
def __init__(self, label):
self.label = label
def north(self):
self.change([2, 6, 3, 4, 1, 5])
def west(self):
self.change([3, 2, 6, 1, 5, 4])
def east(self):
self.change([4, 2, 1, 6, 5, 3])
def south(self):
self.change([5, 1, 3, 4, 6, 2])
... | class Dice:
def __init__(self, label):
self.label = label
def north(self):
self.change([2, 6, 3, 4, 1, 5])
def west(self):
self.change([3, 2, 6, 1, 5, 4])
def east(self):
self.change([4, 2, 1, 6, 5, 3])
def south(self):
self.change([5, 1, 3, 4, 6, 2])
... | false | 3.921569 | [
"+ def rotate(self):",
"+ self.change([1, 4, 2, 5, 3, 6])",
"+",
"+ def is_same_dice(self, another_dice):",
"+ for i in range(6):",
"+ if i % 2 == 0:",
"+ self.north()",
"+ else:",
"+ self.west()",
"+ for j in range... | false | 0.04225 | 0.070447 | 0.599741 | [
"s592475199",
"s543398594"
] |
u119148115 | p02621 | python | s115664859 | s252478660 | 77 | 62 | 61,752 | 61,772 | Accepted | Accepted | 19.48 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.st... | import sys
def I(): return int(sys.stdin.readline().rstrip())
a = I()
print((a+a**2+a**3)) | 13 | 7 | 454 | 97 | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().rstrip())) # 空白なし
def S():
return sys.stdin.readline().rstrip()
def L... | import sys
def I():
return int(sys.stdin.readline().rstrip())
a = I()
print((a + a**2 + a**3))
| false | 46.153846 | [
"-",
"-sys.setrecursionlimit(10**7)",
"-def LI():",
"- return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり",
"-",
"-",
"-def LI2():",
"- return list(map(int, sys.stdin.readline().rstrip())) # 空白なし",
"-",
"-",
"-def S():",
"- return sys.stdin.readline().rstrip()",
"... | false | 0.039146 | 0.04421 | 0.885472 | [
"s115664859",
"s252478660"
] |
u571524394 | p02659 | python | s830915826 | s601696103 | 93 | 67 | 71,288 | 61,792 | Accepted | Accepted | 27.96 | from decimal import Decimal
a, b = input(). split()
a = int(a)
b = Decimal(b)
print((int(a*b))) | a, b = input(). split()
a = int(a)
b = int(float(b)*100+0.5)
print((a*b//100)) | 5 | 4 | 97 | 79 | from decimal import Decimal
a, b = input().split()
a = int(a)
b = Decimal(b)
print((int(a * b)))
| a, b = input().split()
a = int(a)
b = int(float(b) * 100 + 0.5)
print((a * b // 100))
| false | 20 | [
"-from decimal import Decimal",
"-",
"-b = Decimal(b)",
"-print((int(a * b)))",
"+b = int(float(b) * 100 + 0.5)",
"+print((a * b // 100))"
] | false | 0.049388 | 0.046498 | 1.062147 | [
"s830915826",
"s601696103"
] |
u522293645 | p02574 | python | s896009974 | s679482077 | 1,945 | 864 | 128,672 | 132,024 | Accepted | Accepted | 55.58 | from math import gcd # Python3.6以降
# --------------------------------------------------------------
# n以下の素数列挙: O-nlogn
# def primes(n):
# prs = []
# is_prime = [True] * (n + 1)
# is_prime[0] = False
# is_prime[1] = False
# for i in range(2, int(n**0.5)+1):
# if not is_prime[i]:
... | from math import gcd # Python3.6以降
# --------------------------------------------------------------
# n以下の素数列挙: O-nlogn
def primes(n):
prs = []
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5)+1):
if not is_prime[i]:
co... | 49 | 49 | 1,127 | 1,098 | from math import gcd # Python3.6以降
# --------------------------------------------------------------
# n以下の素数列挙: O-nlogn
# def primes(n):
# prs = []
# is_prime = [True] * (n + 1)
# is_prime[0] = False
# is_prime[1] = False
# for i in range(2, int(n**0.5)+1):
# if not is_prime[i]:
# ... | from math import gcd # Python3.6以降
# --------------------------------------------------------------
# n以下の素数列挙: O-nlogn
def primes(n):
prs = []
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
... | false | 0 | [
"-# def primes(n):",
"-# prs = []",
"-# is_prime = [True] * (n + 1)",
"-# is_prime[0] = False",
"-# is_prime[1] = False",
"-# for i in range(2, int(n**0.5)+1):",
"-# if not is_prime[i]:",
"-# continue",
"-# for j in range(i*2, n+1, i):",
"-# ... | false | 1.931031 | 1.064901 | 1.813344 | [
"s896009974",
"s679482077"
] |
u129836004 | p03472 | python | s300176440 | s485134774 | 567 | 388 | 28,920 | 11,312 | Accepted | Accepted | 31.57 | import math
N, H = list(map(int, input().split()))
sword =[list(map(int, input().split())) for _ in range(N)]
def f1(l):
a, b = l
return a
def f2(l):
a, b = l
return b
sword.sort(key = f2)
sword.sort(key = f1)
amax, b1 = sword[-1]
sword.sort(key = f2)
dam = 0
ans = 0
while sword:
a, ... | import math
N, H = list(map(int, input().split()))
As = []
Bs = []
for i in range(N):
a, b = list(map(int, input().split()))
As.append(a)
Bs.append(b)
As.sort()
Bs.sort()
amax = As[-1]
ans = 0
dam = 0
while Bs:
b = Bs.pop()
if b < amax or dam >= H:
break
else:
a... | 29 | 23 | 556 | 394 | import math
N, H = list(map(int, input().split()))
sword = [list(map(int, input().split())) for _ in range(N)]
def f1(l):
a, b = l
return a
def f2(l):
a, b = l
return b
sword.sort(key=f2)
sword.sort(key=f1)
amax, b1 = sword[-1]
sword.sort(key=f2)
dam = 0
ans = 0
while sword:
a, b = sword.pop(... | import math
N, H = list(map(int, input().split()))
As = []
Bs = []
for i in range(N):
a, b = list(map(int, input().split()))
As.append(a)
Bs.append(b)
As.sort()
Bs.sort()
amax = As[-1]
ans = 0
dam = 0
while Bs:
b = Bs.pop()
if b < amax or dam >= H:
break
else:
ans += 1
d... | false | 20.689655 | [
"-sword = [list(map(int, input().split())) for _ in range(N)]",
"-",
"-",
"-def f1(l):",
"- a, b = l",
"- return a",
"-",
"-",
"-def f2(l):",
"- a, b = l",
"- return b",
"-",
"-",
"-sword.sort(key=f2)",
"-sword.sort(key=f1)",
"-amax, b1 = sword[-1]",
"-sword.sort(key=f2)"... | false | 0.037165 | 0.041577 | 0.893875 | [
"s300176440",
"s485134774"
] |
u077291787 | p02888 | python | s815158765 | s489994229 | 570 | 398 | 3,188 | 3,188 | Accepted | Accepted | 30.18 | # ABC143D - Triangles
def binary_search(cur: int, upper_bound: int = 1 << 60, lower_bound: int = -1) -> int:
ok, ng, ret = upper_bound, lower_bound, 0
while abs(ok - ng) > 0:
if L[ok] + L[ng] > cur:
ret += ok - ng
ok -= 1
else:
ng += 1
return ret
... | # ABC143D - Triangles
def binary_search(cur: int, upper_bound: int = 1 << 60, lower_bound: int = -1) -> int:
ok, ng, ret = upper_bound, lower_bound, 0
while ok > ng:
if L[ok] + L[ng] > cur:
ret += ok - ng
ok -= 1
else:
ng += 1
return ret
def ... | 23 | 23 | 590 | 581 | # ABC143D - Triangles
def binary_search(cur: int, upper_bound: int = 1 << 60, lower_bound: int = -1) -> int:
ok, ng, ret = upper_bound, lower_bound, 0
while abs(ok - ng) > 0:
if L[ok] + L[ng] > cur:
ret += ok - ng
ok -= 1
else:
ng += 1
return ret
def mai... | # ABC143D - Triangles
def binary_search(cur: int, upper_bound: int = 1 << 60, lower_bound: int = -1) -> int:
ok, ng, ret = upper_bound, lower_bound, 0
while ok > ng:
if L[ok] + L[ng] > cur:
ret += ok - ng
ok -= 1
else:
ng += 1
return ret
def main():
... | false | 0 | [
"- while abs(ok - ng) > 0:",
"+ while ok > ng:"
] | false | 0.119616 | 0.072567 | 1.648359 | [
"s815158765",
"s489994229"
] |
u822044226 | p02641 | python | s983136269 | s658109738 | 30 | 26 | 8,956 | 9,052 | Accepted | Accepted | 13.33 | X,N = list(map(int,input().split()))
if N == 0:
print(X)
exit();
p = [int(i) for i in input().split()]
if X not in p:
print(X)
exit();
if N == 1 and p[0] == X:
print((X-1))
exit();
for j in range(101):
if X-j not in p:
print((X-j))
exit();
if X+j not in p:
print((X+... | X,N = list(map(int,input().split()))
if N == 0:
print(X)
exit();
p = [int(i) for i in input().split()]
q = set(range(102)) - set(p)
r = sorted(q,key=lambda x:(abs(x-X),x))
print((r[0])) | 23 | 13 | 325 | 204 | X, N = list(map(int, input().split()))
if N == 0:
print(X)
exit()
p = [int(i) for i in input().split()]
if X not in p:
print(X)
exit()
if N == 1 and p[0] == X:
print((X - 1))
exit()
for j in range(101):
if X - j not in p:
print((X - j))
exit()
if X + j not in p:
p... | X, N = list(map(int, input().split()))
if N == 0:
print(X)
exit()
p = [int(i) for i in input().split()]
q = set(range(102)) - set(p)
r = sorted(q, key=lambda x: (abs(x - X), x))
print((r[0]))
| false | 43.478261 | [
"-if X not in p:",
"- print(X)",
"- exit()",
"-if N == 1 and p[0] == X:",
"- print((X - 1))",
"- exit()",
"-for j in range(101):",
"- if X - j not in p:",
"- print((X - j))",
"- exit()",
"- if X + j not in p:",
"- print((X + j))",
"- exit()",
"... | false | 0.044898 | 0.037542 | 1.195962 | [
"s983136269",
"s658109738"
] |
u844789719 | p03283 | python | s214333666 | s840992374 | 2,404 | 1,183 | 119,640 | 58,496 | Accepted | Accepted | 50.79 | N, M, Q = [int(_) for _ in input().split()]
LR = [[int(_) for _ in input().split()] for _ in range(M)]
PQ = [[int(_) for _ in input().split()] for _ in range(Q)]
cumsum = [[0] * (N+2) for _ in range(N+1)]
for lr in LR:
cumsum[lr[0]][lr[0]] += 1
if lr[1] < N:
cumsum[lr[0]][lr[1]+1] -= 1
for i i... | N, M, Q = [int(_) for _ in input().split()]
LR = [[int(_) for _ in input().split()] for _ in range(M)]
PQ = [[int(_) for _ in input().split()] for _ in range(Q)]
cumsum = [[0] * (N + 2) for _ in range(N + 2)]
for l, r in LR:
cumsum[l][r + 1] += 1
for i in range(1, N + 2):
for j in range(1, N + 2):
... | 15 | 14 | 514 | 525 | N, M, Q = [int(_) for _ in input().split()]
LR = [[int(_) for _ in input().split()] for _ in range(M)]
PQ = [[int(_) for _ in input().split()] for _ in range(Q)]
cumsum = [[0] * (N + 2) for _ in range(N + 1)]
for lr in LR:
cumsum[lr[0]][lr[0]] += 1
if lr[1] < N:
cumsum[lr[0]][lr[1] + 1] -= 1
for i in ra... | N, M, Q = [int(_) for _ in input().split()]
LR = [[int(_) for _ in input().split()] for _ in range(M)]
PQ = [[int(_) for _ in input().split()] for _ in range(Q)]
cumsum = [[0] * (N + 2) for _ in range(N + 2)]
for l, r in LR:
cumsum[l][r + 1] += 1
for i in range(1, N + 2):
for j in range(1, N + 2):
cumsu... | false | 6.666667 | [
"-cumsum = [[0] * (N + 2) for _ in range(N + 1)]",
"-for lr in LR:",
"- cumsum[lr[0]][lr[0]] += 1",
"- if lr[1] < N:",
"- cumsum[lr[0]][lr[1] + 1] -= 1",
"-for i in range(N + 1):",
"- for j in range(i, N):",
"- cumsum[i][j + 1] += cumsum[i][j]",
"-for pq in PQ:",
"- print... | false | 0.042968 | 0.091154 | 0.471384 | [
"s214333666",
"s840992374"
] |
u562935282 | p03111 | python | s221950497 | s637205521 | 606 | 429 | 3,064 | 3,064 | Accepted | Accepted | 29.21 | # 4進数
N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
INF = float('inf')
ans = INF
for ptn in range(1 << (2 * N)):
abc = [0 for _ in range(4)]
v = [None for _ in range(N)]
# lの各idxをどの竹用に割り当てるか, ABC無 = 0123
cnt = 0
for j in range(N):
... | # dfs
N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
INF = float('inf')
def calc(mask):
abc = [0 for _ in range(4)]
cnt = 0
for j in range(N):
idx = (mask >> (2 * j)) & 3
abc[idx] += l[j]
if 0 <= idx < 3:
cnt += 1
... | 23 | 31 | 547 | 637 | # 4進数
N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
INF = float("inf")
ans = INF
for ptn in range(1 << (2 * N)):
abc = [0 for _ in range(4)]
v = [None for _ in range(N)]
# lの各idxをどの竹用に割り当てるか, ABC無 = 0123
cnt = 0
for j in range(N):
v[j] = (ptn >> (2 *... | # dfs
N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
INF = float("inf")
def calc(mask):
abc = [0 for _ in range(4)]
cnt = 0
for j in range(N):
idx = (mask >> (2 * j)) & 3
abc[idx] += l[j]
if 0 <= idx < 3:
cnt += 1
if 0 in abc... | false | 25.806452 | [
"-# 4進数",
"+# dfs",
"-ans = INF",
"-for ptn in range(1 << (2 * N)):",
"+",
"+",
"+def calc(mask):",
"- v = [None for _ in range(N)]",
"- # lの各idxをどの竹用に割り当てるか, ABC無 = 0123",
"- v[j] = (ptn >> (2 * j)) & 3",
"- abc[v[j]] += l[j]",
"- if 0 <= v[j] < 3:",
"+ idx... | false | 0.348428 | 0.304776 | 1.143226 | [
"s221950497",
"s637205521"
] |
u535803878 | p02703 | python | s335028797 | s117382584 | 1,721 | 1,089 | 124,904 | 190,780 | Accepted | Accepted | 36.72 | import sys
input = lambda : sys.stdin.readline().rstrip()
import heapq
h = []
heapq.heapify(h)
n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]
ns = {u: [] for u in range(n)}
uv2e = {}
for i in range(m):
u,v,a[i],b[i] = list(map(i... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n,m,s = list(map(int, input().split()))
cd = [None]*n
from collections import defaultdict
ns = defaultdict(set)
nns = defaultdict(set)
uvab = [None]*m
for i in range... | 50 | 50 | 1,237 | 1,321 | import sys
input = lambda: sys.stdin.readline().rstrip()
import heapq
h = []
heapq.heapify(h)
n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]
ns = {u: [] for u in range(n)}
uv2e = {}
for i in range(m):
u, v, a[i], b[i] = list(map(int, input().s... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n, m, s = list(map(int, input().split()))
cd = [None] * n
from collections import defaultdict
ns = defaultdict(set)
nns = defaultdict(set)
uvab = [None] * m
for i in range(m):
... | false | 0 | [
"-import heapq",
"+sys.setrecursionlimit(max(1000, 10**9))",
"+write = lambda x: sys.stdout.write(x + \"\\n\")",
"+n, m, s = list(map(int, input().split()))",
"+cd = [None] * n",
"+from collections import defaultdict",
"-h = []",
"-heapq.heapify(h)",
"-n, m, s = list(map(int, input().split()))",
"... | false | 0.037926 | 0.046184 | 0.821204 | [
"s335028797",
"s117382584"
] |
u863370423 | p02641 | python | s551642584 | s959893215 | 31 | 26 | 9,180 | 9,120 | Accepted | Accepted | 16.13 | #array to get nearest values
A, B = list(map(int, input().split()))
p = list(map(int, input().split()))
for d in range(A + 1):
for s in [-1, +1]:
x = A + s * d
if p.count(x) == 0:
print(x)
exit(0) | # inpute integer (x) along with integer sequence (n)
# finding the integer nearest to x within the given range 100
# no time i have to submit
x, n = list(map(int, input().split())) # take input from the user
P = list(map(int, input().split()))
for i in range(101): # loop through the range
length = x - i
... | 11 | 16 | 248 | 463 | # array to get nearest values
A, B = list(map(int, input().split()))
p = list(map(int, input().split()))
for d in range(A + 1):
for s in [-1, +1]:
x = A + s * d
if p.count(x) == 0:
print(x)
exit(0)
| # inpute integer (x) along with integer sequence (n)
# finding the integer nearest to x within the given range 100
# no time i have to submit
x, n = list(map(int, input().split())) # take input from the user
P = list(map(int, input().split()))
for i in range(101): # loop through the range
length = x - i
resul... | false | 31.25 | [
"-# array to get nearest values",
"-A, B = list(map(int, input().split()))",
"-p = list(map(int, input().split()))",
"-for d in range(A + 1):",
"- for s in [-1, +1]:",
"- x = A + s * d",
"- if p.count(x) == 0:",
"- print(x)",
"- exit(0)",
"+# inpute integer (... | false | 0.043578 | 0.043933 | 0.991934 | [
"s551642584",
"s959893215"
] |
u090225501 | p03343 | python | s374807455 | s212902302 | 797 | 638 | 12,404 | 10,140 | Accepted | Accepted | 19.95 | import heapq
def main():
_, k, q = list(map(int, input().split()))
a = list(map(int, input().split()))
idx = make_index(a)
groups = [(0, len(a))]
m = float('inf')
for y in sorted(set(a)):
xs = []
for start, stop in groups:
xs.extend(nsmallest(stop - star... | import heapq
def main():
_, k, q = list(map(int, input().split()))
a = list(map(int, input().split()))
idx = make_index(a)
groups = [(0, len(a))]
m = float('inf')
for y in sorted(set(a)):
xs = []
for start, stop in groups:
xs.extend(nsmallest(min(stop - ... | 67 | 67 | 1,431 | 1,439 | import heapq
def main():
_, k, q = list(map(int, input().split()))
a = list(map(int, input().split()))
idx = make_index(a)
groups = [(0, len(a))]
m = float("inf")
for y in sorted(set(a)):
xs = []
for start, stop in groups:
xs.extend(nsmallest(stop - start - k + 1, a... | import heapq
def main():
_, k, q = list(map(int, input().split()))
a = list(map(int, input().split()))
idx = make_index(a)
groups = [(0, len(a))]
m = float("inf")
for y in sorted(set(a)):
xs = []
for start, stop in groups:
xs.extend(nsmallest(min(stop - start - k + ... | false | 0 | [
"- xs.extend(nsmallest(stop - start - k + 1, a, start, stop))",
"+ xs.extend(nsmallest(min(stop - start - k + 1, q), a, start, stop))"
] | false | 0.046785 | 0.049605 | 0.943146 | [
"s374807455",
"s212902302"
] |
u506287026 | p03720 | python | s363211833 | s246291727 | 21 | 18 | 3,316 | 3,064 | Accepted | Accepted | 14.29 | from collections import defaultdict
N, M = list(map(int, input().split()))
city_road_nums = defaultdict(int)
for _ in range(M):
a, b = list(map(int, input().split()))
city_road_nums[a] += 1
city_road_nums[b] += 1
for i in range(1, N+1):
print((city_road_nums[i]))
| N, M = list(map(int, input().split()))
ABs = [input().split() for i in range(M)]
MPs = {}
for a, b in ABs:
a = int(a)
b = int(b)
if a not in MPs:
MPs[a] = 1
else:
MPs[a] += 1
if b not in MPs:
MPs[b] = 1
else:
MPs[b] += 1
for mp in range(1, N... | 11 | 23 | 278 | 415 | from collections import defaultdict
N, M = list(map(int, input().split()))
city_road_nums = defaultdict(int)
for _ in range(M):
a, b = list(map(int, input().split()))
city_road_nums[a] += 1
city_road_nums[b] += 1
for i in range(1, N + 1):
print((city_road_nums[i]))
| N, M = list(map(int, input().split()))
ABs = [input().split() for i in range(M)]
MPs = {}
for a, b in ABs:
a = int(a)
b = int(b)
if a not in MPs:
MPs[a] = 1
else:
MPs[a] += 1
if b not in MPs:
MPs[b] = 1
else:
MPs[b] += 1
for mp in range(1, N + 1):
if mp not in... | false | 52.173913 | [
"-from collections import defaultdict",
"-",
"-city_road_nums = defaultdict(int)",
"-for _ in range(M):",
"- a, b = list(map(int, input().split()))",
"- city_road_nums[a] += 1",
"- city_road_nums[b] += 1",
"-for i in range(1, N + 1):",
"- print((city_road_nums[i]))",
"+ABs = [input().s... | false | 0.054697 | 0.048144 | 1.136102 | [
"s363211833",
"s246291727"
] |
u789436713 | p02760 | python | s202471921 | s163043830 | 22 | 20 | 3,316 | 3,316 | Accepted | Accepted | 9.09 | from collections import Counter
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(eval(input()))
for _ in range(N):
b=int(eval(input()))
#穴をあける
for tmpA in A:
if b in tmpA:
index=tmpA.index(b)
tmpA[index]=-1
... | from collections import Counter
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(eval(input()))
for _ in range(N):
b=int(eval(input()))
#穴をあける
for tmpA in A:
if b in tmpA:
index=tmpA.index(b)
tmpA[index]=-1
... | 29 | 29 | 691 | 639 | from collections import Counter
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
A = [A1, A2, A3]
N = int(eval(input()))
for _ in range(N):
b = int(eval(input()))
# 穴をあける
for tmpA in A:
if b in tmpA:
index = tmpA.index(b)
... | from collections import Counter
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
A = [A1, A2, A3]
N = int(eval(input()))
for _ in range(N):
b = int(eval(input()))
# 穴をあける
for tmpA in A:
if b in tmpA:
index = tmpA.index(b)
... | false | 0 | [
"-if (",
"- A[0][0] == A[1][0]",
"- and A[1][0] == A[2][0]",
"- or A[0][1] == A[1][1]",
"- and A[1][1] == A[2][1]",
"- or A[0][2] == A[1][2]",
"- and A[1][2] == A[2][2]",
"-):",
"+if True in [A[0][i] == A[1][i] and A[1][i] == A[2][i] for i in range(3)]:"
] | false | 0.039982 | 0.038966 | 1.02606 | [
"s202471921",
"s163043830"
] |
u546285759 | p00516 | python | s212848953 | s524092847 | 210 | 170 | 7,780 | 7,776 | Accepted | Accepted | 19.05 | N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(N)]
B = [int(eval(input())) for _ in range(M)]
ans = []
for x in B:
for i, v in enumerate(A):
if x - v > -1:
ans.append(i)
break
print((max(ans, key=ans.count) + 1)) | N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(N)]
B = [int(eval(input())) for _ in range(M)]
votes = [0] * N
for x in B:
for i, v in enumerate(A):
if x - v > -1:
votes[i] += 1
break
print((votes.index(max(votes)) + 1)) | 11 | 11 | 270 | 277 | N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(N)]
B = [int(eval(input())) for _ in range(M)]
ans = []
for x in B:
for i, v in enumerate(A):
if x - v > -1:
ans.append(i)
break
print((max(ans, key=ans.count) + 1))
| N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(N)]
B = [int(eval(input())) for _ in range(M)]
votes = [0] * N
for x in B:
for i, v in enumerate(A):
if x - v > -1:
votes[i] += 1
break
print((votes.index(max(votes)) + 1))
| false | 0 | [
"-ans = []",
"+votes = [0] * N",
"- ans.append(i)",
"+ votes[i] += 1",
"-print((max(ans, key=ans.count) + 1))",
"+print((votes.index(max(votes)) + 1))"
] | false | 0.051369 | 0.125622 | 0.408916 | [
"s212848953",
"s524092847"
] |
u263830634 | p03181 | python | s426945988 | s650164518 | 1,161 | 981 | 87,012 | 36,116 | Accepted | Accepted | 15.5 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
N, MOD = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
x, y = list(map(int, input().split()))
G[x].append(y)
G[y].append(x)
G[0].append(1)
G[1].append(0)
DP1 = [-1] * (N + 1)
DP... | import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 7)
N, MOD = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
x, y = list(map(int, input().split()))
G[x].append(y)
G[y].append(x)
G[0].append(1)
G[1].append(0)
DP1 = [0] * (N + 1)
... | 75 | 80 | 1,562 | 1,681 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N, MOD = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
x, y = list(map(int, input().split()))
G[x].append(y)
G[y].append(x)
G[0].append(1)
G[1].append(0)
DP1 = [-1] * (N + 1)
DP1[0] = 0
parent = [-1] ... | import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 7)
N, MOD = list(map(int, input().split()))
G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
x, y = list(map(int, input().split()))
G[x].append(y)
G[y].append(x)
G[0].append(1)
G[1].append(0)
DP1 = [0] * (N + 1)
parent = [-1] * (N + 1... | false | 6.25 | [
"-sys.setrecursionlimit(10**7)",
"+# sys.setrecursionlimit(10 ** 7)",
"-DP1 = [-1] * (N + 1)",
"-DP1[0] = 0",
"+DP1 = [0] * (N + 1)",
"-",
"-",
"-def dfs(x, p):",
"- tmp = 1",
"+order = []",
"+order_append = order.append",
"+stack = [1]",
"+stack_pop = stack.pop",
"+stack_append = stack... | false | 0.035665 | 0.036242 | 0.984085 | [
"s426945988",
"s650164518"
] |
u864197622 | p02843 | python | s812956638 | s918432508 | 162 | 17 | 3,828 | 2,940 | Accepted | Accepted | 89.51 | X = [0] * 101010
X[0] = 1
for i in range(100, 101010):
for j in range(100, 106):
if X[i-j]:
X[i] = 1
print((X[int(eval(input()))])) | A = 7175816845464090776455207507270117755723765735430536804658747273399161802972634276448409301356909248005606116656073561929444931323143190717332175076262060295351620527202705615498306139275508555689509950694997345595674093104433020700546656778950085095645658807229584194806623377338842753774743833376783450229118372573... | 9 | 3 | 157 | 660 | X = [0] * 101010
X[0] = 1
for i in range(100, 101010):
for j in range(100, 106):
if X[i - j]:
X[i] = 1
print((X[int(eval(input()))]))
| A = 7175816845464090776455207507270117755723765735430536804658747273399161802972634276448409301356909248005606116656073561929444931323143190717332175076262060295351620527202705615498306139275508555689509950694997345595674093104433020700546656778950085095645658807229584194806623377338842753774743833376783450229118372573... | false | 66.666667 | [
"-X = [0] * 101010",
"-X[0] = 1",
"-for i in range(100, 101010):",
"- for j in range(100, 106):",
"- if X[i - j]:",
"- X[i] = 1",
"-print((X[int(eval(input()))]))",
"+A = 71758168454640907764552075072701177557237657354305368046587472733991618029726342764484093013569092480056061166... | false | 0.58398 | 0.042871 | 13.621801 | [
"s812956638",
"s918432508"
] |
u352394527 | p02361 | python | s654565914 | s350277953 | 3,440 | 2,680 | 140,088 | 90,300 | Accepted | Accepted | 22.09 | from heapq import heappop as pop
from heapq import heappush as push
INF = 10 ** 18
class edge:
def __init__(self, to, cost):
self.to = to
self.cost = cost
V, E, r = list(map(int,input().split()))
G = [[] for i in range(V)]
#G[i]...頂点iからの辺、(行き先、コスト)
d = [0 for i in range(V)]
#d[i]...スタートからみた... | from heapq import heappush, heappop
INF = 10 ** 20
v_num, e_num, r = list(map(int, input().split()))
edges_lst = [[] for _ in range(v_num)]
dist_lst = [INF for _ in range(v_num)]
for _ in range(e_num):
s, t, dist = list(map(int, input().split()))
edges_lst[s].append((t, dist))
que = []
heappush(que... | 47 | 29 | 896 | 614 | from heapq import heappop as pop
from heapq import heappush as push
INF = 10**18
class edge:
def __init__(self, to, cost):
self.to = to
self.cost = cost
V, E, r = list(map(int, input().split()))
G = [[] for i in range(V)]
# G[i]...頂点iからの辺、(行き先、コスト)
d = [0 for i in range(V)]
# d[i]...スタートからみた頂点i... | from heapq import heappush, heappop
INF = 10**20
v_num, e_num, r = list(map(int, input().split()))
edges_lst = [[] for _ in range(v_num)]
dist_lst = [INF for _ in range(v_num)]
for _ in range(e_num):
s, t, dist = list(map(int, input().split()))
edges_lst[s].append((t, dist))
que = []
heappush(que, (0, r))
dist... | false | 38.297872 | [
"-from heapq import heappop as pop",
"-from heapq import heappush as push",
"+from heapq import heappush, heappop",
"-INF = 10**18",
"-",
"-",
"-class edge:",
"- def __init__(self, to, cost):",
"- self.to = to",
"- self.cost = cost",
"-",
"-",
"-V, E, r = list(map(int, input... | false | 0.043872 | 0.044212 | 0.992306 | [
"s654565914",
"s350277953"
] |
u708255304 | p03329 | python | s526163548 | s493066031 | 655 | 224 | 89,716 | 52,080 | Accepted | Accepted | 65.8 | import sys
sys.setrecursionlimit(10**7)
# 再帰的に求められる
memo = [-1] * 110000
# ベキ乗は英語でpower
def withdrawals(n):
if n == 0: # 最後まで下ろせたら完了である
return 0
if memo[n] != -1: # すでに最適解がもとまっているならばその解を返す
return memo[n]
res = n # すべて1円で支払ったと仮定する
pow6 = 1
while pow6 <= n:
re... | bank = [1]
N = int(eval(input()))
for i in range(20):
if 100000 >= 6**i:
bank.append(6**i)
if 100000 >= 9**i:
bank.append(9**i)
# print(bank)
dp = [[10**10]*(N+1) for _ in range(len(bank)+1)]
dp[0][0] = 0
# i番目の引き出し方法を使う
for i in range(len(bank)):
for j in range(N+1):
... | 29 | 21 | 578 | 542 | import sys
sys.setrecursionlimit(10**7)
# 再帰的に求められる
memo = [-1] * 110000
# ベキ乗は英語でpower
def withdrawals(n):
if n == 0: # 最後まで下ろせたら完了である
return 0
if memo[n] != -1: # すでに最適解がもとまっているならばその解を返す
return memo[n]
res = n # すべて1円で支払ったと仮定する
pow6 = 1
while pow6 <= n:
res = min(res, w... | bank = [1]
N = int(eval(input()))
for i in range(20):
if 100000 >= 6**i:
bank.append(6**i)
if 100000 >= 9**i:
bank.append(9**i)
# print(bank)
dp = [[10**10] * (N + 1) for _ in range(len(bank) + 1)]
dp[0][0] = 0
# i番目の引き出し方法を使う
for i in range(len(bank)):
for j in range(N + 1):
# 使わない場... | false | 27.586207 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**7)",
"-# 再帰的に求められる",
"-memo = [-1] * 110000",
"-# ベキ乗は英語でpower",
"-def withdrawals(n):",
"- if n == 0: # 最後まで下ろせたら完了である",
"- return 0",
"- if memo[n] != -1: # すでに最適解がもとまっているならばその解を返す",
"- return memo[n]",
"- res = n # すべ... | false | 0.090092 | 0.444727 | 0.202579 | [
"s526163548",
"s493066031"
] |
u477977638 | p03077 | python | s931870663 | s771237428 | 118 | 64 | 27,092 | 62,088 | Accepted | Accepted | 45.76 | import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return input().rstrip().decode()
def II(): return int(eval(input()))
def FI(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float,input... | import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return input().rstrip().decode()
def II(): return int(eval(input()))
def FI(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float,input... | 33 | 32 | 635 | 615 | import sys
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return input().rstrip().decode()
def II():
return int(eval(input()))
def FI():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
return ... | import sys
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return input().rstrip().decode()
def II():
return int(eval(input()))
def FI():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
return ... | false | 3.030303 | [
"-import numpy as np",
"-",
"-"
] | false | 0.158162 | 0.038378 | 4.121146 | [
"s931870663",
"s771237428"
] |
u912237403 | p00005 | python | s024415072 | s850008764 | 20 | 10 | 4,192 | 4,200 | Accepted | Accepted | 50 | import sys
def gcm(a,b):
return gcm(b,a%b) if b else a
for s in sys.stdin:
a,b=list(map(int,s.split()))
c=gcm(a,b)
print(c,a/c*b) | import sys
def gcm(a,b):
x=gcm(b,a%b) if b else a
return x
for s in sys.stdin:
a,b=list(map(int,s.split()))
c=gcm(a,b)
print(c,a/c*b) | 7 | 8 | 144 | 153 | import sys
def gcm(a, b):
return gcm(b, a % b) if b else a
for s in sys.stdin:
a, b = list(map(int, s.split()))
c = gcm(a, b)
print(c, a / c * b)
| import sys
def gcm(a, b):
x = gcm(b, a % b) if b else a
return x
for s in sys.stdin:
a, b = list(map(int, s.split()))
c = gcm(a, b)
print(c, a / c * b)
| false | 12.5 | [
"- return gcm(b, a % b) if b else a",
"+ x = gcm(b, a % b) if b else a",
"+ return x"
] | false | 0.037726 | 0.042424 | 0.889274 | [
"s024415072",
"s850008764"
] |
u637289184 | p03361 | python | s692726845 | s406629532 | 35 | 29 | 9,220 | 9,188 | Accepted | Accepted | 17.14 | h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
ans = [[0]*w for _ in range(h)]
cnt=0
def dfs(x,y):
if 0 <= x < h and 0 <= y < w:
if s[x][y] == "#" and cnt<2 and ans[x][y]==0:
ans[x][y] = 1
for i in range(h):
for j in range(w):
... | h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
ans = [[0]*w for _ in range(h)]
def dfs(x,y):
if 0 <= x < h and 0 <= y < w:
if s[x][y] == "#":
ans[x][y] = 1
for i in range(h):
for j in range(w):
if s[i][j] == '#':
... | 25 | 22 | 617 | 565 | h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
ans = [[0] * w for _ in range(h)]
cnt = 0
def dfs(x, y):
if 0 <= x < h and 0 <= y < w:
if s[x][y] == "#" and cnt < 2 and ans[x][y] == 0:
ans[x][y] = 1
for i in range(h):
for j in range(w):
if s[i][... | h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
ans = [[0] * w for _ in range(h)]
def dfs(x, y):
if 0 <= x < h and 0 <= y < w:
if s[x][y] == "#":
ans[x][y] = 1
for i in range(h):
for j in range(w):
if s[i][j] == "#":
dfs(i + 1, j)
... | false | 12 | [
"-cnt = 0",
"- if s[x][y] == \"#\" and cnt < 2 and ans[x][y] == 0:",
"+ if s[x][y] == \"#\":",
"- cnt = 0"
] | false | 0.131824 | 0.037464 | 3.518733 | [
"s692726845",
"s406629532"
] |
u644907318 | p03436 | python | s944768679 | s405643860 | 195 | 75 | 40,304 | 73,744 | Accepted | Accepted | 61.54 | from collections import deque
H,W = list(map(int,input().split()))
S = [input().strip() for _ in range(H)]
cnt = 0
for i in range(H):
for j in range(W):
if S[i][j]==".":
cnt += 1
dist = [[-1 for _ in range(W)] for _ in range(H)]
que = deque([(0,0,0)])
dist[0][0] = 0
while que:
i,... | from collections import deque
INFTY = 10000
H,W = list(map(int,input().split()))
S = [input().strip() for _ in range(H)]
A = [[-1 for _ in range(W)] for _ in range(H)]
cnt = 0
for i in range(H):
for j in range(W):
if S[i][j]=="#":
A[i][j]=INFTY
cnt += 1
que = deque([(0,0,0... | 30 | 31 | 854 | 796 | from collections import deque
H, W = list(map(int, input().split()))
S = [input().strip() for _ in range(H)]
cnt = 0
for i in range(H):
for j in range(W):
if S[i][j] == ".":
cnt += 1
dist = [[-1 for _ in range(W)] for _ in range(H)]
que = deque([(0, 0, 0)])
dist[0][0] = 0
while que:
i, j, d... | from collections import deque
INFTY = 10000
H, W = list(map(int, input().split()))
S = [input().strip() for _ in range(H)]
A = [[-1 for _ in range(W)] for _ in range(H)]
cnt = 0
for i in range(H):
for j in range(W):
if S[i][j] == "#":
A[i][j] = INFTY
cnt += 1
que = deque([(0, 0, 0)]... | false | 3.225806 | [
"+INFTY = 10000",
"+A = [[-1 for _ in range(W)] for _ in range(H)]",
"- if S[i][j] == \".\":",
"+ if S[i][j] == \"#\":",
"+ A[i][j] = INFTY",
"-dist = [[-1 for _ in range(W)] for _ in range(H)]",
"-dist[0][0] = 0",
"+A[0][0] = 0",
"- if j + 1 < W and dist[i][j + 1] < 0 an... | false | 0.048784 | 0.043239 | 1.128241 | [
"s944768679",
"s405643860"
] |
u759412327 | p03401 | python | s626728601 | s203948274 | 180 | 125 | 14,040 | 20,484 | Accepted | Accepted | 30.56 | n = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
D = [abs(A[i+1]-A[i]) for i in range(len(A)-1)]
base = sum(D)
for i in range(n):
print((base-D[i]-D[i+1]+abs(A[i+2]-A[i]))) | N = int(eval(input()))
A = [0]+list(map(int,input().split()))+[0]
B = [abs(a-b) for a,b in zip(A,A[1:])]
C = sum(B)
for n in range(N):
print((C+abs(A[n]-A[n+2])-(B[n]+B[n+1]))) | 8 | 7 | 197 | 177 | n = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
D = [abs(A[i + 1] - A[i]) for i in range(len(A) - 1)]
base = sum(D)
for i in range(n):
print((base - D[i] - D[i + 1] + abs(A[i + 2] - A[i])))
| N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
B = [abs(a - b) for a, b in zip(A, A[1:])]
C = sum(B)
for n in range(N):
print((C + abs(A[n] - A[n + 2]) - (B[n] + B[n + 1])))
| false | 12.5 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-D = [abs(A[i + 1] - A[i]) for i in range(len(A) - 1)]",
"-base = sum(D)",
"-for i in range(n):",
"- print((base - D[i] - D[i + 1] + abs(A[i + 2] - A[i])))",
"+B = [abs(a - b) for a, b in zip(A, A[1:])]",
"+C = sum(B)",
"+for n in range(N):",... | false | 0.044644 | 0.044042 | 1.013653 | [
"s626728601",
"s203948274"
] |
u790710233 | p03355 | python | s617570322 | s916747436 | 64 | 36 | 8,164 | 4,592 | Accepted | Accepted | 43.75 | s = eval(input())
n = len(s)
K = int(eval(input()))
ans = set()
for i in range(n):
end = min(n, i+10)
for j in range(i+1, end+1):
ans.add(s[i:j])
print((sorted(list(ans))[K-1]))
| s = eval(input())
n = len(s)
K = int(eval(input()))
ans = set()
for i in range(n):
end = min(n, i+K)
for j in range(i+1, end+1):
ans.add(s[i:j])
print((sorted(list(ans))[K-1]))
| 11 | 11 | 192 | 191 | s = eval(input())
n = len(s)
K = int(eval(input()))
ans = set()
for i in range(n):
end = min(n, i + 10)
for j in range(i + 1, end + 1):
ans.add(s[i:j])
print((sorted(list(ans))[K - 1]))
| s = eval(input())
n = len(s)
K = int(eval(input()))
ans = set()
for i in range(n):
end = min(n, i + K)
for j in range(i + 1, end + 1):
ans.add(s[i:j])
print((sorted(list(ans))[K - 1]))
| false | 0 | [
"- end = min(n, i + 10)",
"+ end = min(n, i + K)"
] | false | 0.11991 | 0.043122 | 2.780736 | [
"s617570322",
"s916747436"
] |
u150984829 | p02258 | python | s176534957 | s935656589 | 170 | 140 | 5,640 | 5,632 | Accepted | Accepted | 17.65 | import sys
b,s=-1e10,1e10
eval(input())
for r in map(int,sys.stdin):
if b<r-s:b=r-s
if s>r:s=r
print(b)
| import sys
s=1e10;b=-s
eval(input())
for r in map(int,sys.stdin):
if b<r-s:b=r-s
if s>r:s=r
print(b)
| 7 | 7 | 106 | 103 | import sys
b, s = -1e10, 1e10
eval(input())
for r in map(int, sys.stdin):
if b < r - s:
b = r - s
if s > r:
s = r
print(b)
| import sys
s = 1e10
b = -s
eval(input())
for r in map(int, sys.stdin):
if b < r - s:
b = r - s
if s > r:
s = r
print(b)
| false | 0 | [
"-b, s = -1e10, 1e10",
"+s = 1e10",
"+b = -s"
] | false | 0.046437 | 0.096906 | 0.479202 | [
"s176534957",
"s935656589"
] |
u073852194 | p02824 | python | s135020206 | s685546848 | 255 | 206 | 65,304 | 14,480 | Accepted | Accepted | 19.22 | N,M,V,P = list(map(int,input().split()))
A = sorted(list(map(int,input().split())))
B = A[:N-P+1]
S = sum(B)
accum = [0]
for i in range(N-P+1):
accum.append(accum[-1]+B[i])
ans = P-1
for i in range(N-P+1):
if B[i]+M-B[-1]<0:
continue
if B[i]*(N-P-i)-S+accum[i+1]+M*(N-P)>=max(M*(V-P),0... | N,M,V,P = list(map(int,input().split()))
A = sorted(list(map(int,input().split())))
B = A[:N-P+1]
S = [0]
for i in range(N-P+1):
S.append(S[-1]+B[i])
ans = P-1
for i in range(N-P+1):
if B[i]+M-B[-1]<0:
continue
if B[i]*(N-P-i)-(S[-1]-S[i+1])+M*(N-P)>=max(M*(V-P),0):
ans += 1... | 17 | 17 | 348 | 328 | N, M, V, P = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
B = A[: N - P + 1]
S = sum(B)
accum = [0]
for i in range(N - P + 1):
accum.append(accum[-1] + B[i])
ans = P - 1
for i in range(N - P + 1):
if B[i] + M - B[-1] < 0:
continue
if B[i] * (N - P - i) - S + accum[i + ... | N, M, V, P = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
B = A[: N - P + 1]
S = [0]
for i in range(N - P + 1):
S.append(S[-1] + B[i])
ans = P - 1
for i in range(N - P + 1):
if B[i] + M - B[-1] < 0:
continue
if B[i] * (N - P - i) - (S[-1] - S[i + 1]) + M * (N - P) >= m... | false | 0 | [
"-S = sum(B)",
"-accum = [0]",
"+S = [0]",
"- accum.append(accum[-1] + B[i])",
"+ S.append(S[-1] + B[i])",
"- if B[i] * (N - P - i) - S + accum[i + 1] + M * (N - P) >= max(M * (V - P), 0):",
"+ if B[i] * (N - P - i) - (S[-1] - S[i + 1]) + M * (N - P) >= max(M * (V - P), 0):"
] | false | 0.094345 | 0.081832 | 1.152904 | [
"s135020206",
"s685546848"
] |
u562935282 | p02996 | python | s852597871 | s561851001 | 1,251 | 897 | 81,496 | 29,456 | Accepted | Accepted | 28.3 | from operator import itemgetter
N = int(eval(input()))
wl = [tuple(map(int, input().split())) for _ in range(N)]
wl.sort(key=itemgetter(1))
# (work_time, time_limit)
cur = 0
can = True
for t, lmt in wl:
cur += t
if cur > lmt:
can = False
break
print(('Yes' if can else 'No'))
| n = int(eval(input()))
e = []
for _ in range(n):
a, b = list(map(int, input().split()))
e.append((b, a))
e.sort()
cur = 0
can = True
for b, a in e:
cur += a
if cur > b:
can = False
break
print(('Yes' if can else 'No'))
| 16 | 16 | 310 | 254 | from operator import itemgetter
N = int(eval(input()))
wl = [tuple(map(int, input().split())) for _ in range(N)]
wl.sort(key=itemgetter(1))
# (work_time, time_limit)
cur = 0
can = True
for t, lmt in wl:
cur += t
if cur > lmt:
can = False
break
print(("Yes" if can else "No"))
| n = int(eval(input()))
e = []
for _ in range(n):
a, b = list(map(int, input().split()))
e.append((b, a))
e.sort()
cur = 0
can = True
for b, a in e:
cur += a
if cur > b:
can = False
break
print(("Yes" if can else "No"))
| false | 0 | [
"-from operator import itemgetter",
"-",
"-N = int(eval(input()))",
"-wl = [tuple(map(int, input().split())) for _ in range(N)]",
"-wl.sort(key=itemgetter(1))",
"-# (work_time, time_limit)",
"+n = int(eval(input()))",
"+e = []",
"+for _ in range(n):",
"+ a, b = list(map(int, input().split()))",... | false | 0.048484 | 0.038466 | 1.260443 | [
"s852597871",
"s561851001"
] |
u353797797 | p03287 | python | s724142981 | s506903410 | 104 | 95 | 14,424 | 13,904 | Accepted | Accepted | 8.65 | def f(n, m):
aa = [int(ak) % m for ak in input().split()]
mod = {}
ans = 0
zi = 0
for a in aa:
zi = (zi - a) % m
ai = (zi + a) % m
mod.setdefault(ai, 0)
mod[ai] += 1
ans += mod.get(zi, 0)
print(ans)
n, m = list(map(int, input().split()))
f... | def f(m):
aa = [int(ak) % m for ak in input().split()]
mod = {}
ans = 0
zi = 0
for a in aa:
mod.setdefault(zi, 0)
mod[zi] += 1
zi = (zi - a) % m
ans += mod.get(zi, 0)
print(ans)
_, m = list(map(int, input().split()))
f(m)
| 16 | 15 | 321 | 288 | def f(n, m):
aa = [int(ak) % m for ak in input().split()]
mod = {}
ans = 0
zi = 0
for a in aa:
zi = (zi - a) % m
ai = (zi + a) % m
mod.setdefault(ai, 0)
mod[ai] += 1
ans += mod.get(zi, 0)
print(ans)
n, m = list(map(int, input().split()))
f(n, m)
| def f(m):
aa = [int(ak) % m for ak in input().split()]
mod = {}
ans = 0
zi = 0
for a in aa:
mod.setdefault(zi, 0)
mod[zi] += 1
zi = (zi - a) % m
ans += mod.get(zi, 0)
print(ans)
_, m = list(map(int, input().split()))
f(m)
| false | 6.25 | [
"-def f(n, m):",
"+def f(m):",
"+ mod.setdefault(zi, 0)",
"+ mod[zi] += 1",
"- ai = (zi + a) % m",
"- mod.setdefault(ai, 0)",
"- mod[ai] += 1",
"-n, m = list(map(int, input().split()))",
"-f(n, m)",
"+_, m = list(map(int, input().split()))",
"+f(m)"
] | false | 0.032622 | 0.08722 | 0.37402 | [
"s724142981",
"s506903410"
] |
u690536347 | p03044 | python | s601122491 | s089050636 | 882 | 810 | 86,108 | 86,112 | Accepted | Accepted | 8.16 | from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)
d = defaultdict(list)
cost = defaultdict(int)
N = int(eval(input()))
for _ in range(N-1):
u, v, w = list(map(int, input().split()))
d[u].append(v)
d[v].append(u)
cost[(u, v)] = w
visited = [False]*(N+1)
col... | from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)
d = defaultdict(list)
cost = defaultdict(int)
N = int(eval(input()))
for _ in range(N-1):
u, v, w = list(map(int, input().split()))
d[u].append(v)
d[v].append(u)
cost[(u, v)] = w
visited = [False]*(N+1)
color... | 37 | 29 | 718 | 583 | from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)
d = defaultdict(list)
cost = defaultdict(int)
N = int(eval(input()))
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
d[u].append(v)
d[v].append(u)
cost[(u, v)] = w
visited = [False] * (N + 1)
color = [-1] * (... | from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)
d = defaultdict(list)
cost = defaultdict(int)
N = int(eval(input()))
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
d[u].append(v)
d[v].append(u)
cost[(u, v)] = w
visited = [False] * (N + 1)
color = [-1] * (... | false | 21.621622 | [
"+color[1] = 0",
"- if color[x] == -1:",
"- color[x] = 0",
"- if c % 2 == 0:",
"- color[y] = 0 if color[x] == 0 else 1",
"- else:",
"- color[y] = 1 if color[x] == 0 else 0",
"+ color[y] = color[x] ^ 1 if c % 2 else color[x]"
] | false | 0.037939 | 0.043937 | 0.863486 | [
"s601122491",
"s089050636"
] |
u671060652 | p02683 | python | s899646810 | s895900911 | 394 | 340 | 73,268 | 73,388 | Accepted | Accepted | 13.71 | import itertools
import math
import fractions
import functools
n, m, x = list(map(int, input().split()))
c = []
a_do = []
for i in range(n):
a = list(map(int, input().split()))
c.append(a[0])
a_do.append(a[1:])
# minimum = 10**20
# for pat in range(0, (1<<n)): #参考書の選び方の全パターン
# cost = ... | import itertools
import math
import fractions
import functools
n, m, x = list(map(int, input().split()))
a_do = []
for i in range(n):
a = list(map(int, input().split()))
a_do.append(a)
nums = []
for i in range(n):
nums.append(i)
minimum = 10**20
temp = []
for i in range(1, n+1):
... | 73 | 46 | 1,544 | 970 | import itertools
import math
import fractions
import functools
n, m, x = list(map(int, input().split()))
c = []
a_do = []
for i in range(n):
a = list(map(int, input().split()))
c.append(a[0])
a_do.append(a[1:])
# minimum = 10**20
# for pat in range(0, (1<<n)): #参考書の選び方の全パターン
# cost = 0
# rikaido = ... | import itertools
import math
import fractions
import functools
n, m, x = list(map(int, input().split()))
a_do = []
for i in range(n):
a = list(map(int, input().split()))
a_do.append(a)
nums = []
for i in range(n):
nums.append(i)
minimum = 10**20
temp = []
for i in range(1, n + 1):
for v in itertools.co... | false | 36.986301 | [
"-c = []",
"- c.append(a[0])",
"- a_do.append(a[1:])",
"-# minimum = 10**20",
"-# for pat in range(0, (1<<n)): #参考書の選び方の全パターン",
"-# cost = 0",
"-# rikaido = [0] * m",
"-# for i in range(n):",
"-# if((pat >> i) & 1): #i番目の参考書を読む",
"-# cost += c[i]",
"-# ... | false | 0.045604 | 0.038149 | 1.195413 | [
"s899646810",
"s895900911"
] |
u912237403 | p00035 | python | s462098582 | s359019197 | 20 | 10 | 4,260 | 4,256 | Accepted | Accepted | 50 | import sys
def sign(x):
if x>0: s=1
elif x==0: s=0
else: s=-1
return s
def f(p1,p2,p3):
s = sign((p3[1]-p1[1])*(p2[0]-p1[0])-(p2[1]-p1[1])*(p3[0]-p1[0]))
return s
for s in sys.stdin:
D =list(map(float, s.split(",")))
p1=D[0:2]; p2=D[2:4]; p3=D[4:6]; p4=D[6:8]
x = f(p1... | import sys
def sign(x):
if x>0: s=1
elif x<0: s=-1
else: s=0
return s
def f(p1,p2,p3):
x1,y1 = p1
s = sign((p3[1]-y1)*(p2[0]-x1)-(p2[1]-y1)*(p3[0]-x1))
return s
for s in sys.stdin:
D = list(map(float, s.split(",")))
p1 = D[0:2]
p2 = D[2:4]
p3 = D[4:6]
p... | 16 | 20 | 394 | 418 | import sys
def sign(x):
if x > 0:
s = 1
elif x == 0:
s = 0
else:
s = -1
return s
def f(p1, p2, p3):
s = sign((p3[1] - p1[1]) * (p2[0] - p1[0]) - (p2[1] - p1[1]) * (p3[0] - p1[0]))
return s
for s in sys.stdin:
D = list(map(float, s.split(",")))
p1 = D[0:2]
... | import sys
def sign(x):
if x > 0:
s = 1
elif x < 0:
s = -1
else:
s = 0
return s
def f(p1, p2, p3):
x1, y1 = p1
s = sign((p3[1] - y1) * (p2[0] - x1) - (p2[1] - y1) * (p3[0] - x1))
return s
for s in sys.stdin:
D = list(map(float, s.split(",")))
p1 = D[0:2]... | false | 20 | [
"- elif x == 0:",
"+ elif x < 0:",
"+ s = -1",
"+ else:",
"- else:",
"- s = -1",
"- s = sign((p3[1] - p1[1]) * (p2[0] - p1[0]) - (p2[1] - p1[1]) * (p3[0] - p1[0]))",
"+ x1, y1 = p1",
"+ s = sign((p3[1] - y1) * (p2[0] - x1) - (p2[1] - y1) * (p3[0] - x1))"
] | false | 0.048852 | 0.043826 | 1.114673 | [
"s462098582",
"s359019197"
] |
u102461423 | p02883 | python | s923482461 | s450461453 | 1,188 | 369 | 26,200 | 26,180 | Accepted | Accepted | 68.94 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N,K = list(map(int,readline().split()))
A = np.array(readline().split(),np.int64)
F = np.array(readline().split(),np.int64)
A.sort(); F.sort(); F=F[::-1]
def test(x):
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N,K = list(map(int,readline().split()))
A = np.array(readline().split(),np.int64)
F = np.array(readline().split(),np.int64)
A.sort(); F.sort(); F=F[::-1]
Asum = A.sum()... | 28 | 30 | 588 | 611 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N, K = list(map(int, readline().split()))
A = np.array(readline().split(), np.int64)
F = np.array(readline().split(), np.int64)
A.sort()
F.sort()
F = F[::-1]
def test(x):
# 全員がx... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N, K = list(map(int, readline().split()))
A = np.array(readline().split(), np.int64)
F = np.array(readline().split(), np.int64)
A.sort()
F.sort()
F = F[::-1]
Asum = A.sum()
def test... | false | 6.666667 | [
"+Asum = A.sum()",
"- return np.maximum(0, A - x // F).sum() <= K",
"+ return Asum - np.minimum(A, x // F).sum() <= K"
] | false | 0.382351 | 0.505449 | 0.756458 | [
"s923482461",
"s450461453"
] |
u515740713 | p02991 | python | s290240938 | s072594388 | 354 | 231 | 134,980 | 109,700 | Accepted | Accepted | 34.75 | # -*- coding: utf-8 -*-
#E - Hopscotch Addict
import sys
from collections import deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
graph = [[[] for _ in range(3)] for _ in range(N+1)]
for i in range(M):
... | # -*- coding: utf-8 -*-
#E - Hopscotch Addict
import sys
from collections import deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
graph = [[] for _ in range(3*N+1)]
for _ in range(M):
x,y = list(map(in... | 34 | 34 | 883 | 803 | # -*- coding: utf-8 -*-
# E - Hopscotch Addict
import sys
from collections import deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
graph = [[[] for _ in range(3)] for _ in range(N + 1)]
for i in range(M):
x, y =... | # -*- coding: utf-8 -*-
# E - Hopscotch Addict
import sys
from collections import deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
graph = [[] for _ in range(3 * N + 1)]
for _ in range(M):
x, y = list(map(int, r... | false | 0 | [
"-graph = [[[] for _ in range(3)] for _ in range(N + 1)]",
"-for i in range(M):",
"+graph = [[] for _ in range(3 * N + 1)]",
"+for _ in range(M):",
"- graph[x][0].append((y, 1))",
"- graph[x][1].append((y, 2))",
"- graph[x][2].append((y, 0))",
"+ graph[x].append(y + N)",
"+ graph[x + ... | false | 0.036106 | 0.079487 | 0.454243 | [
"s290240938",
"s072594388"
] |
u094191970 | p02793 | python | s738517202 | s467051829 | 1,895 | 1,511 | 6,072 | 6,140 | Accepted | Accepted | 20.26 | from fractions import gcd
n=int(eval(input()))
a=list(map(int,input().split()))
mod=10**9+7
lcm=1
for i in a:
lcm=(lcm*i)//gcd(lcm,i)
'''
ans=0
mod=10**9+7
for i in a:
ans+=lcm//i
ans%=mod
print(ans)
'''
'''
from functools import reduce
lcm=reduce(lambda x,y :(x*y)//gcd(x,y),a)
'''
'''... | from fractions import gcd
n=int(eval(input()))
a=list(map(int,input().split()))
mod=10**9+7
'''
lcm=1
for i in a:
lcm=(lcm*i)//gcd(lcm,i)
'''
'''
ans=0
mod=10**9+7
for i in a:
ans+=lcm//i
ans%=mod
print(ans)
'''
'''
from functools import reduce
lcm=reduce(lambda x,y :(x*y)//gcd(x,y),a)
''... | 35 | 38 | 427 | 508 | from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
lcm = 1
for i in a:
lcm = (lcm * i) // gcd(lcm, i)
"""
ans=0
mod=10**9+7
for i in a:
ans+=lcm//i
ans%=mod
print(ans)
"""
"""
from functools import reduce
lcm=reduce(lambda x,y :(x*y)//gcd(x,y),a)
"""
"""
ans=0
mo... | from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10**9 + 7
"""
lcm=1
for i in a:
lcm=(lcm*i)//gcd(lcm,i)
"""
"""
ans=0
mod=10**9+7
for i in a:
ans+=lcm//i
ans%=mod
print(ans)
"""
"""
from functools import reduce
lcm=reduce(lambda x,y :(x*y)//gcd(x,y),a)
"""
from functools i... | false | 7.894737 | [
"-lcm = 1",
"+\"\"\"",
"+lcm=1",
"- lcm = (lcm * i) // gcd(lcm, i)",
"+ lcm=(lcm*i)//gcd(lcm,i)",
"+\"\"\"",
"+from functools import reduce",
"+",
"+lcm = reduce(lambda x, y: x * (y // gcd(x, y)), a)"
] | false | 0.092293 | 0.123356 | 0.748189 | [
"s738517202",
"s467051829"
] |
u270681687 | p02973 | python | s739510257 | s631004800 | 547 | 273 | 56,024 | 8,068 | Accepted | Accepted | 50.09 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = []
for ai in a:
if len(b) == 0:
b.append(ai)
else:
if ai <= b[-1]:
b.append(ai)
else:
l = -1
r = len(b)
mid = (l + r) // 2
while (r - l > 1... | from collections import deque
import bisect
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = deque([])
for ai in a:
if len(b) == 0:
b.append(ai)
else:
if ai <= b[0]:
b.appendleft(ai)
else:
index = bisect.bisect_left(b, ai)
... | 25 | 20 | 502 | 354 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = []
for ai in a:
if len(b) == 0:
b.append(ai)
else:
if ai <= b[-1]:
b.append(ai)
else:
l = -1
r = len(b)
mid = (l + r) // 2
while r - l > 1:
mi... | from collections import deque
import bisect
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = deque([])
for ai in a:
if len(b) == 0:
b.append(ai)
else:
if ai <= b[0]:
b.appendleft(ai)
else:
index = bisect.bisect_left(b, ai)
b[index... | false | 20 | [
"+from collections import deque",
"+import bisect",
"+",
"-b = []",
"+b = deque([])",
"- if ai <= b[-1]:",
"- b.append(ai)",
"+ if ai <= b[0]:",
"+ b.appendleft(ai)",
"- l = -1",
"- r = len(b)",
"- mid = (l + r) // 2",
"- ... | false | 0.007265 | 0.032034 | 0.226791 | [
"s739510257",
"s631004800"
] |
u932868243 | p02688 | python | s048923397 | s568644942 | 23 | 20 | 9,164 | 9,200 | Accepted | Accepted | 13.04 | n,k=list(map(int,input().split()))
lists=[]
for _ in range(k):
d=int(eval(input()))
lis=list(map(int,input().split()))
lists.append(lis)
ans=[0]*n
for list in lists:
for i in range(len(list)):
ans[list[i]-1]+=1
count=0
for h in ans:
if h==0:
count+=1
print(count) | n,k=list(map(int,input().split()))
lists=[]
for _ in range(k):
d=int(eval(input()))
a=list(map(int,input().split()))
lists.append(a)
num=[0]*n
for list in lists:
for __ in range(len(list)):
num[list[__]-1]+=1
count=0
for nn in num:
if nn==0:
count+=1
print(count) | 15 | 15 | 283 | 283 | n, k = list(map(int, input().split()))
lists = []
for _ in range(k):
d = int(eval(input()))
lis = list(map(int, input().split()))
lists.append(lis)
ans = [0] * n
for list in lists:
for i in range(len(list)):
ans[list[i] - 1] += 1
count = 0
for h in ans:
if h == 0:
count += 1
print(co... | n, k = list(map(int, input().split()))
lists = []
for _ in range(k):
d = int(eval(input()))
a = list(map(int, input().split()))
lists.append(a)
num = [0] * n
for list in lists:
for __ in range(len(list)):
num[list[__] - 1] += 1
count = 0
for nn in num:
if nn == 0:
count += 1
print(co... | false | 0 | [
"- lis = list(map(int, input().split()))",
"- lists.append(lis)",
"-ans = [0] * n",
"+ a = list(map(int, input().split()))",
"+ lists.append(a)",
"+num = [0] * n",
"- for i in range(len(list)):",
"- ans[list[i] - 1] += 1",
"+ for __ in range(len(list)):",
"+ num[lis... | false | 0.065266 | 0.122247 | 0.533885 | [
"s048923397",
"s568644942"
] |
u606878291 | p02702 | python | s802798409 | s458003385 | 186 | 156 | 11,320 | 11,320 | Accepted | Accepted | 16.13 | from collections import Counter
MOD = 2019
S = eval(input())
S = tuple(map(int, reversed(S)))
counter = Counter()
digit = 1
cumsum = 0
ans = 0
for i in range(len(S)):
counter[cumsum] += 1
cumsum += (S[i] * digit) % MOD
cumsum %= MOD
ans += counter[cumsum]
digit *= 10
digit %= M... | from collections import Counter
MOD = 2019
S = eval(input())
S = tuple(map(int, reversed(S)))
counter = Counter([0])
digit = 1
cumsum = 0
for i in range(len(S)):
cumsum += S[i] * digit % MOD
cumsum %= MOD
counter[cumsum] += 1
digit = digit * 10 % MOD
print((sum([v * (v - 1) // 2 for v ... | 19 | 16 | 331 | 336 | from collections import Counter
MOD = 2019
S = eval(input())
S = tuple(map(int, reversed(S)))
counter = Counter()
digit = 1
cumsum = 0
ans = 0
for i in range(len(S)):
counter[cumsum] += 1
cumsum += (S[i] * digit) % MOD
cumsum %= MOD
ans += counter[cumsum]
digit *= 10
digit %= MOD
print(ans)
| from collections import Counter
MOD = 2019
S = eval(input())
S = tuple(map(int, reversed(S)))
counter = Counter([0])
digit = 1
cumsum = 0
for i in range(len(S)):
cumsum += S[i] * digit % MOD
cumsum %= MOD
counter[cumsum] += 1
digit = digit * 10 % MOD
print((sum([v * (v - 1) // 2 for v in list(counter.v... | false | 15.789474 | [
"-counter = Counter()",
"+counter = Counter([0])",
"-ans = 0",
"+ cumsum += S[i] * digit % MOD",
"+ cumsum %= MOD",
"- cumsum += (S[i] * digit) % MOD",
"- cumsum %= MOD",
"- ans += counter[cumsum]",
"- digit *= 10",
"- digit %= MOD",
"-print(ans)",
"+ digit = digit * 10... | false | 0.034182 | 0.040439 | 0.845263 | [
"s802798409",
"s458003385"
] |
u761529120 | p03003 | python | s187933606 | s038632297 | 537 | 361 | 104,156 | 72,796 | Accepted | Accepted | 32.77 | def main():
N, M = list(map(int, input().split()))
S = list(map(int, input().split())) + [0]
T = list(map(int, input().split())) + [0]
dp0 = [[0] * (M + 5) for _ in range(N + 5)]
dp1 = [[0] * (M + 5) for _ in range(N + 5)]
MOD = 10 ** 9 + 7
dp0[0][0] = 1
for i in range(N + 1):
... | def main():
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10 ** 9 + 7
dp = [[0] * (M + 5) for _ in range(N + 5)]
for i in range(N+1):
dp[i][0] = 1
for j in range(M+1):
dp[0][j] = 1
for i in... | 27 | 25 | 752 | 642 | def main():
N, M = list(map(int, input().split()))
S = list(map(int, input().split())) + [0]
T = list(map(int, input().split())) + [0]
dp0 = [[0] * (M + 5) for _ in range(N + 5)]
dp1 = [[0] * (M + 5) for _ in range(N + 5)]
MOD = 10**9 + 7
dp0[0][0] = 1
for i in range(N + 1):
for ... | def main():
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10**9 + 7
dp = [[0] * (M + 5) for _ in range(N + 5)]
for i in range(N + 1):
dp[i][0] = 1
for j in range(M + 1):
dp[0][j] = 1
for i in range(1, ... | false | 7.407407 | [
"- S = list(map(int, input().split())) + [0]",
"- T = list(map(int, input().split())) + [0]",
"- dp0 = [[0] * (M + 5) for _ in range(N + 5)]",
"- dp1 = [[0] * (M + 5) for _ in range(N + 5)]",
"+ S = list(map(int, input().split()))",
"+ T = list(map(int, input().split()))",
"- dp0[0]... | false | 0.037439 | 0.037882 | 0.988285 | [
"s187933606",
"s038632297"
] |
u761320129 | p02850 | python | s221147382 | s068676704 | 637 | 386 | 93,960 | 102,500 | Accepted | Accepted | 39.4 | import sys
sys.setrecursionlimit(10**8)
N = int(input())
AB = [tuple(map(int,input().split())) for i in range(N-1)]
es = [[] for i in range(N)]
for i,(a,b) in enumerate(AB):
a,b = a-1,b-1
es[a].append((b,i))
es[b].append((a,i))
visited = [0]*N
ans = [None]*(N-1)
def dfs(v,c=-1):
nc = 1
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
N = int(input())
AB = [tuple(map(int,input().split())) for i in range(N-1)]
es = [[] for _ in range(N)]
for i,(a,b) in enumerate(AB):
a,b = a-1,b-1
es[a].append((b,i))
es[b].append((a,i))
ans = [None] * (N-1)
def dfs(v,p=-1,c=... | 26 | 25 | 545 | 525 | import sys
sys.setrecursionlimit(10**8)
N = int(input())
AB = [tuple(map(int, input().split())) for i in range(N - 1)]
es = [[] for i in range(N)]
for i, (a, b) in enumerate(AB):
a, b = a - 1, b - 1
es[a].append((b, i))
es[b].append((a, i))
visited = [0] * N
ans = [None] * (N - 1)
def dfs(v, c=-1):
n... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
N = int(input())
AB = [tuple(map(int, input().split())) for i in range(N - 1)]
es = [[] for _ in range(N)]
for i, (a, b) in enumerate(AB):
a, b = a - 1, b - 1
es[a].append((b, i))
es[b].append((a, i))
ans = [None] * (N - 1)
def dfs(v, p=-... | false | 3.846154 | [
"+input = sys.stdin.readline",
"-es = [[] for i in range(N)]",
"+es = [[] for _ in range(N)]",
"-visited = [0] * N",
"-def dfs(v, c=-1):",
"+def dfs(v, p=-1, c=-1):",
"- for to, i in es[v]:",
"- if visited[to]:",
"+ for to, e in es[v]:",
"+ if to == p:",
"- visited[v] ... | false | 0.044868 | 0.043544 | 1.030413 | [
"s221147382",
"s068676704"
] |
u334712262 | p02558 | python | s011368638 | s861716317 | 846 | 663 | 163,904 | 160,172 | Accepted | Accepted | 21.63 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with... | 128 | 136 | 2,761 | 2,915 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
combinations,
combinations_wit... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
combinations,
combinations_wit... | false | 5.882353 | [
"- elif x != self.__table[x]:",
"- self.__table[x] = self.__root(self.__table[x])",
"+ return x",
"+ else:",
"+ a = x",
"+ ul = []",
"+ while a != self.__table[a]:",
"+ ul.append(a)",
"+ a = self.__tab... | false | 0.045891 | 0.106258 | 0.431882 | [
"s011368638",
"s861716317"
] |
u310678820 | p03176 | python | s244687546 | s522343802 | 949 | 602 | 123,600 | 123,600 | Accepted | Accepted | 36.56 | mod = 10**9+7
class RMQ:
def __init__(self, N):
self.N0 = 2**(N-1).bit_length()
self.INF = float('inf')
self.data = [self.INF]*(2*self.N0)
def update(self, k, x):
k+=self.N0-1
self.data[k] = x
while k>=0:
k = (k-1)//2
self.data[k... | mod = 10**9+7
class SegmentTree:
def __init__(self, N, id, fun):
self.N0 = 2**(N-1).bit_length()
self.id = id
self.data = [self.id]*(2*self.N0)
self.fun = fun
def update(self, k, x):
k+=self.N0-1
self.data[k] = x
while k>=0:
k = (k-1... | 50 | 48 | 1,033 | 1,044 | mod = 10**9 + 7
class RMQ:
def __init__(self, N):
self.N0 = 2 ** (N - 1).bit_length()
self.INF = float("inf")
self.data = [self.INF] * (2 * self.N0)
def update(self, k, x):
k += self.N0 - 1
self.data[k] = x
while k >= 0:
k = (k - 1) // 2
... | mod = 10**9 + 7
class SegmentTree:
def __init__(self, N, id, fun):
self.N0 = 2 ** (N - 1).bit_length()
self.id = id
self.data = [self.id] * (2 * self.N0)
self.fun = fun
def update(self, k, x):
k += self.N0 - 1
self.data[k] = x
while k >= 0:
... | false | 4 | [
"-class RMQ:",
"- def __init__(self, N):",
"+class SegmentTree:",
"+ def __init__(self, N, id, fun):",
"- self.INF = float(\"inf\")",
"- self.data = [self.INF] * (2 * self.N0)",
"+ self.id = id",
"+ self.data = [self.id] * (2 * self.N0)",
"+ self.fun = fun",
... | false | 0.088438 | 0.064823 | 1.364301 | [
"s244687546",
"s522343802"
] |
u863076295 | p03286 | python | s847564936 | s076355399 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | # abc105c
N = int(eval(input()))
if N==0:
print((0))
exit()
a = ""
b = -2
while N!=1:
if N%b==0:
a += "0"
N = N//b
else:
a += "1"
if N>0:
N = N//b + 1
else:
N = N//b + 1
if N==1:
a += "1"
print((a[::-1])) | import sys
N = int(eval(input()))
if N==0:
print((0))
sys.exit()
ans = ""
b = -2
while N!=1:
if N%b==0:
ans += "0"
N = N/b
else:
ans += "1"
N = (N-1)/b
ans += "1"
print((ans[::-1])) | 24 | 19 | 305 | 240 | # abc105c
N = int(eval(input()))
if N == 0:
print((0))
exit()
a = ""
b = -2
while N != 1:
if N % b == 0:
a += "0"
N = N // b
else:
a += "1"
if N > 0:
N = N // b + 1
else:
N = N // b + 1
if N == 1:
a += "1"
print((a[::-1]))
| import sys
N = int(eval(input()))
if N == 0:
print((0))
sys.exit()
ans = ""
b = -2
while N != 1:
if N % b == 0:
ans += "0"
N = N / b
else:
ans += "1"
N = (N - 1) / b
ans += "1"
print((ans[::-1]))
| false | 20.833333 | [
"-# abc105c",
"+import sys",
"+",
"- exit()",
"-a = \"\"",
"+ sys.exit()",
"+ans = \"\"",
"- a += \"0\"",
"- N = N // b",
"+ ans += \"0\"",
"+ N = N / b",
"- a += \"1\"",
"- if N > 0:",
"- N = N // b + 1",
"- else:",
"- ... | false | 0.03721 | 0.042746 | 0.870491 | [
"s847564936",
"s076355399"
] |
u426534722 | p02371 | python | s399238821 | s005725381 | 710 | 560 | 55,628 | 52,972 | Accepted | Accepted | 21.13 | import sys
readline = sys.stdin.readline
from collections import deque
from math import isinf
INF = float("inf")
sys.setrecursionlimit(200000)
n = int(readline())
G = [[] for _ in range(n)]
D = [INF] * n
for _ in [0] * (n - 1):
s, t, w = list(map(int, readline().split()))
G[s].append([t, w])
G[t... | import sys
readline = sys.stdin.readline
def dfs(root):
visited = [False] * n
queue = [(0, root)]
longest = (-1, -1)
while queue:
total_weight, node = queue.pop()
if visited[node]:
continue
visited[node] = True
longest = max(longest, (total_weight, ... | 35 | 25 | 835 | 685 | import sys
readline = sys.stdin.readline
from collections import deque
from math import isinf
INF = float("inf")
sys.setrecursionlimit(200000)
n = int(readline())
G = [[] for _ in range(n)]
D = [INF] * n
for _ in [0] * (n - 1):
s, t, w = list(map(int, readline().split()))
G[s].append([t, w])
G[t].append([... | import sys
readline = sys.stdin.readline
def dfs(root):
visited = [False] * n
queue = [(0, root)]
longest = (-1, -1)
while queue:
total_weight, node = queue.pop()
if visited[node]:
continue
visited[node] = True
longest = max(longest, (total_weight, node))
... | false | 28.571429 | [
"-from collections import deque",
"-from math import isinf",
"-",
"-INF = float(\"inf\")",
"-sys.setrecursionlimit(200000)",
"-n = int(readline())",
"-G = [[] for _ in range(n)]",
"-D = [INF] * n",
"-for _ in [0] * (n - 1):",
"- s, t, w = list(map(int, readline().split()))",
"- G[s].append... | false | 0.037585 | 0.037855 | 0.992846 | [
"s399238821",
"s005725381"
] |
u320567105 | p03111 | python | s100817385 | s413182963 | 882 | 263 | 3,188 | 3,064 | Accepted | Accepted | 70.18 | ri = lambda: int(eval(input()))
rl = lambda: list(map(int,input().split()))
N,A,B,C=rl()
l=[0]*N
for i in range(N):
l[i] = ri()
ans = float('inf')
for n in range(4**N):
a,b,c=0,0,0
ans_ = 0
for i in range(N):
sn = format(n>>(2*i),'0{}b'.format(N))[-2:]
if sn=='01':
... | ri = lambda: int(eval(input()))
rl = lambda: list(map(int,input().split()))
N,A,B,C=rl()
l=[ri() for _ in range(N)]
ans = 10**18
import itertools
for seq in itertools.product(list(range(4)),repeat=N):
a,b,c=0,0,0
rst = 0
for i in range(N):
if seq[i]==1:
a+=l[i]
... | 28 | 26 | 630 | 575 | ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
N, A, B, C = rl()
l = [0] * N
for i in range(N):
l[i] = ri()
ans = float("inf")
for n in range(4**N):
a, b, c = 0, 0, 0
ans_ = 0
for i in range(N):
sn = format(n >> (2 * i), "0{}b".format(N))[-2:]
if sn == "01":... | ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
N, A, B, C = rl()
l = [ri() for _ in range(N)]
ans = 10**18
import itertools
for seq in itertools.product(list(range(4)), repeat=N):
a, b, c = 0, 0, 0
rst = 0
for i in range(N):
if seq[i] == 1:
a += l[i]
... | false | 7.142857 | [
"-l = [0] * N",
"-for i in range(N):",
"- l[i] = ri()",
"-ans = float(\"inf\")",
"-for n in range(4**N):",
"+l = [ri() for _ in range(N)]",
"+ans = 10**18",
"+import itertools",
"+",
"+for seq in itertools.product(list(range(4)), repeat=N):",
"- ans_ = 0",
"+ rst = 0",
"- sn ... | false | 0.675421 | 0.279969 | 2.412481 | [
"s100817385",
"s413182963"
] |
u903005414 | p02791 | python | s637735902 | s708812078 | 154 | 124 | 24,744 | 25,124 | Accepted | Accepted | 19.48 | N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
mins = [10**6]
for i in P:
v = min(mins[-1], i)
mins.append(v)
mins.pop(0)
ans = 0
for i, j in zip(P, mins):
if i <= j:
ans += 1
print(ans)
| from itertools import accumulate
N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
accmin = accumulate(P, min)
for i, j in zip(P, accmin):
if i <= j:
ans += 1
print(ans)
| 15 | 10 | 237 | 203 | N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
mins = [10**6]
for i in P:
v = min(mins[-1], i)
mins.append(v)
mins.pop(0)
ans = 0
for i, j in zip(P, mins):
if i <= j:
ans += 1
print(ans)
| from itertools import accumulate
N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
accmin = accumulate(P, min)
for i, j in zip(P, accmin):
if i <= j:
ans += 1
print(ans)
| false | 33.333333 | [
"+from itertools import accumulate",
"+",
"-mins = [10**6]",
"-for i in P:",
"- v = min(mins[-1], i)",
"- mins.append(v)",
"-mins.pop(0)",
"-ans = 0",
"-for i, j in zip(P, mins):",
"+accmin = accumulate(P, min)",
"+for i, j in zip(P, accmin):"
] | false | 0.039475 | 0.072683 | 0.543107 | [
"s637735902",
"s708812078"
] |
u277104886 | p02695 | python | s702980316 | s263949235 | 1,048 | 641 | 9,108 | 22,652 | Accepted | Accepted | 38.84 | from itertools import combinations_with_replacement as comb_rplc
n, m, q = list(map(int, input().split()))
req = [list(map(int, input().split())) for _ in range(q)]
ans = 0
for seq in comb_rplc(list(range(1,m+1)),n):
now = 0
for a, b, c, d in req:
if seq[b-1] - seq[a-1] == c:
now... | from _collections import deque
def cacl(seq):
score = 0
for a, b, c, d in req:
if seq[b-1] - seq[a-1] == c:
score += d
return score
n, m, q = list(map(int, input().split()))
req = [list(map(int, input().split())) for _ in range(q)]
ans = 0
que = deque()
for i in range(... | 14 | 29 | 358 | 603 | from itertools import combinations_with_replacement as comb_rplc
n, m, q = list(map(int, input().split()))
req = [list(map(int, input().split())) for _ in range(q)]
ans = 0
for seq in comb_rplc(list(range(1, m + 1)), n):
now = 0
for a, b, c, d in req:
if seq[b - 1] - seq[a - 1] == c:
now +=... | from _collections import deque
def cacl(seq):
score = 0
for a, b, c, d in req:
if seq[b - 1] - seq[a - 1] == c:
score += d
return score
n, m, q = list(map(int, input().split()))
req = [list(map(int, input().split())) for _ in range(q)]
ans = 0
que = deque()
for i in range(1, m + 1):
... | false | 51.724138 | [
"-from itertools import combinations_with_replacement as comb_rplc",
"+from _collections import deque",
"+",
"+",
"+def cacl(seq):",
"+ score = 0",
"+ for a, b, c, d in req:",
"+ if seq[b - 1] - seq[a - 1] == c:",
"+ score += d",
"+ return score",
"+",
"-for seq in c... | false | 0.159276 | 0.09233 | 1.72506 | [
"s702980316",
"s263949235"
] |
u227082700 | p03282 | python | s902888421 | s525079985 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | s=eval(input())
k=int(eval(input()))
i=0
while i!=k and s[i]=="1":i+=1
if i==k:print((1))
else:print((s[i])) | s=eval(input())
k=int(eval(input()))
ans,bns=0,0
for i in range(len(s)):
if s[i]!="1":
ans=s[i]
break
else:
bns+=1 #0の連続
if k<=bns: #k=何番目
print((1))
else:
print(ans) | 6 | 13 | 97 | 204 | s = eval(input())
k = int(eval(input()))
i = 0
while i != k and s[i] == "1":
i += 1
if i == k:
print((1))
else:
print((s[i]))
| s = eval(input())
k = int(eval(input()))
ans, bns = 0, 0
for i in range(len(s)):
if s[i] != "1":
ans = s[i]
break
else:
bns += 1 # 0の連続
if k <= bns: # k=何番目
print((1))
else:
print(ans)
| false | 53.846154 | [
"-i = 0",
"-while i != k and s[i] == \"1\":",
"- i += 1",
"-if i == k:",
"+ans, bns = 0, 0",
"+for i in range(len(s)):",
"+ if s[i] != \"1\":",
"+ ans = s[i]",
"+ break",
"+ else:",
"+ bns += 1 # 0の連続",
"+if k <= bns: # k=何番目",
"- print((s[i]))",
"+ pr... | false | 0.038479 | 0.038744 | 0.993154 | [
"s902888421",
"s525079985"
] |
u813098295 | p03338 | python | s087651879 | s064556272 | 193 | 18 | 40,176 | 3,060 | Accepted | Accepted | 90.67 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n):
d = {}
for j in s[:i]:
if d.get(j, 0) == 0:
d[j] = 1
for j in s[i:]:
if d.get(j, 0) == 1:
d[j] = 2
t = 0
for j in d:
if d[j] == 2:
t += 1
ans = max(ans... | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1, n):
head = s[:i]
tail = s[i:]
cnt = 0
for i in range(26):
c = chr(ord('a') + i)
if c in head and c in tail:
cnt += 1
ans = max(ans, cnt)
print(ans) | 19 | 16 | 327 | 268 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n):
d = {}
for j in s[:i]:
if d.get(j, 0) == 0:
d[j] = 1
for j in s[i:]:
if d.get(j, 0) == 1:
d[j] = 2
t = 0
for j in d:
if d[j] == 2:
t += 1
ans = max(ans, t)
print(ans)
| n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1, n):
head = s[:i]
tail = s[i:]
cnt = 0
for i in range(26):
c = chr(ord("a") + i)
if c in head and c in tail:
cnt += 1
ans = max(ans, cnt)
print(ans)
| false | 15.789474 | [
"-for i in range(n):",
"- d = {}",
"- for j in s[:i]:",
"- if d.get(j, 0) == 0:",
"- d[j] = 1",
"- for j in s[i:]:",
"- if d.get(j, 0) == 1:",
"- d[j] = 2",
"- t = 0",
"- for j in d:",
"- if d[j] == 2:",
"- t += 1",
"- a... | false | 0.161996 | 0.068589 | 2.361821 | [
"s087651879",
"s064556272"
] |
u143492911 | p03805 | python | s126290171 | s297302630 | 164 | 30 | 14,424 | 4,212 | Accepted | Accepted | 81.71 | import numpy as np
n,m=list(map(int,input().split()))
if m==0:
print((0))
exit()
ans=[[] for i in range(n)]
for i in range(m):
a,b=list(map(int,input().split()))
ans[a-1].append((b-1))
ans[b-1].append((a-1))
v=[]
def dfs(now,visited=[]):
global v
if len(visited)==n:
v.a... | n,m=list(map(int,input().split()))
if m==0:
print((0))
exit()
ans=[[] for i in range(n)]
for i in range(m):
a,b=list(map(int,input().split()))
ans[a-1].append((b-1))
ans[b-1].append((a-1))
v=[]#全ての点を訪問済み
def dfs(now,visited=[]):
global v
if len(visited)==n:
v.append([vis... | 21 | 20 | 452 | 442 | import numpy as np
n, m = list(map(int, input().split()))
if m == 0:
print((0))
exit()
ans = [[] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
ans[a - 1].append((b - 1))
ans[b - 1].append((a - 1))
v = []
def dfs(now, visited=[]):
global v
if len(visited) == ... | n, m = list(map(int, input().split()))
if m == 0:
print((0))
exit()
ans = [[] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
ans[a - 1].append((b - 1))
ans[b - 1].append((a - 1))
v = [] # 全ての点を訪問済み
def dfs(now, visited=[]):
global v
if len(visited) == n:
... | false | 4.761905 | [
"-import numpy as np",
"-",
"-v = []",
"+v = [] # 全ての点を訪問済み"
] | false | 0.056976 | 0.034571 | 1.648096 | [
"s126290171",
"s297302630"
] |
u519939795 | p03146 | python | s826997148 | s386499822 | 158 | 17 | 12,488 | 2,940 | Accepted | Accepted | 89.24 | s=int(eval(input()))
l=[s]
ans=[]
for i in range(10**5):
if s%2==0:
s=s/2
l.append(s)
else:
s=s*3+1
l.append(s)
for i in range(10**3):
for j in range(i+1,10**3):
if l[i]==l[j]:
ans.append(j)
print((min(ans)+1)) | def f(n):
if n%2 == 0:
return n//2
else:
return 3*n + 1
L = [int(eval(input()))]
for i in range(10**10):
L.append(f(L[i]))
if L[i+1] in L[:i]:
print((i+2))
break
| 16 | 14 | 290 | 218 | s = int(eval(input()))
l = [s]
ans = []
for i in range(10**5):
if s % 2 == 0:
s = s / 2
l.append(s)
else:
s = s * 3 + 1
l.append(s)
for i in range(10**3):
for j in range(i + 1, 10**3):
if l[i] == l[j]:
ans.append(j)
print((min(ans) + 1))
| def f(n):
if n % 2 == 0:
return n // 2
else:
return 3 * n + 1
L = [int(eval(input()))]
for i in range(10**10):
L.append(f(L[i]))
if L[i + 1] in L[:i]:
print((i + 2))
break
| false | 12.5 | [
"-s = int(eval(input()))",
"-l = [s]",
"-ans = []",
"-for i in range(10**5):",
"- if s % 2 == 0:",
"- s = s / 2",
"- l.append(s)",
"+def f(n):",
"+ if n % 2 == 0:",
"+ return n // 2",
"- s = s * 3 + 1",
"- l.append(s)",
"-for i in range(10**3):",
"-... | false | 0.823757 | 0.046529 | 17.70422 | [
"s826997148",
"s386499822"
] |
u880730787 | p02554 | python | s402951147 | s906193094 | 453 | 392 | 9,160 | 11,052 | Accepted | Accepted | 13.47 | mod = 10**9+7
def powmod(x,y):
res = 1
for i in range(y):
res = res*x%mod
return res
N = int(eval(input()))
ans = powmod(10,N)-powmod(9,N)-powmod(9,N)+powmod(8,N)
ans %=mod
ans = (ans+mod)%mod
print(ans) | mod = 10**9+7
N = int(eval(input()))
ans = 10**N-(9**N)*2+8**N
ans %=mod
print(ans) | 13 | 5 | 235 | 81 | mod = 10**9 + 7
def powmod(x, y):
res = 1
for i in range(y):
res = res * x % mod
return res
N = int(eval(input()))
ans = powmod(10, N) - powmod(9, N) - powmod(9, N) + powmod(8, N)
ans %= mod
ans = (ans + mod) % mod
print(ans)
| mod = 10**9 + 7
N = int(eval(input()))
ans = 10**N - (9**N) * 2 + 8**N
ans %= mod
print(ans)
| false | 61.538462 | [
"-",
"-",
"-def powmod(x, y):",
"- res = 1",
"- for i in range(y):",
"- res = res * x % mod",
"- return res",
"-",
"-",
"-ans = powmod(10, N) - powmod(9, N) - powmod(9, N) + powmod(8, N)",
"+ans = 10**N - (9**N) * 2 + 8**N",
"-ans = (ans + mod) % mod"
] | false | 0.130281 | 0.130557 | 0.997889 | [
"s402951147",
"s906193094"
] |
u600402037 | p03032 | python | s816896537 | s080913697 | 192 | 90 | 3,064 | 3,064 | Accepted | Accepted | 53.12 | import sys
sys.setrecursionlimit(10 ** 9)
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
V2 = V * 2
answer = 0
for i in range(1, min(N, K)+1): # iは宝石を取り出す個数
for j in range(0, min(i, K-i)+1): # jは何個の宝石を手離すか
for k in range(max(0, N-i), N+1): # V2の中で何番目から取り出すか
... | # coding: utf-8
import sys
sys.setrecursionlimit(10 ** 7)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 持っている宝石をDに詰めるのは最後
N, K = lr()
V = lr()
answer = 0
V = V[::-1] + V[::-1]
for x in range(K+1):
# x回Dから取り出す、K-x回戻すことが可能
x = min(x,... | 17 | 29 | 458 | 688 | import sys
sys.setrecursionlimit(10**9)
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
V2 = V * 2
answer = 0
for i in range(1, min(N, K) + 1): # iは宝石を取り出す個数
for j in range(0, min(i, K - i) + 1): # jは何個の宝石を手離すか
for k in range(max(0, N - i), N + 1): # V2の中で何番目から取り出すか
... | # coding: utf-8
import sys
sys.setrecursionlimit(10**7)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 持っている宝石をDに詰めるのは最後
N, K = lr()
V = lr()
answer = 0
V = V[::-1] + V[::-1]
for x in range(K + 1):
# x回Dから取り出す、K-x回戻すことが可能
x = min(x, N)
for i in... | false | 41.37931 | [
"+# coding: utf-8",
"-sys.setrecursionlimit(10**9)",
"-N, K = list(map(int, input().split()))",
"-V = list(map(int, input().split()))",
"-V2 = V * 2",
"+sys.setrecursionlimit(10**7)",
"+sr = lambda: sys.stdin.readline().rstrip()",
"+ir = lambda: int(sr())",
"+lr = lambda: list(map(int, sr().split())... | false | 0.070294 | 0.03665 | 1.917987 | [
"s816896537",
"s080913697"
] |
u795630164 | p03478 | python | s859481268 | s238185288 | 36 | 33 | 3,060 | 3,060 | Accepted | Accepted | 8.33 | N, A, B = list(map(int, input().split()))
answer = 0
for i in range(1, N+1):
l = [int(x) for x in list(str(i))]
if A <= sum(l) <= B: answer += i
print(answer) | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N+1):
x = 0
for s in str(i):
x += int(s)
if A <= x <= B:
ans += i
print(ans) | 8 | 11 | 175 | 184 | N, A, B = list(map(int, input().split()))
answer = 0
for i in range(1, N + 1):
l = [int(x) for x in list(str(i))]
if A <= sum(l) <= B:
answer += i
print(answer)
| N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
x = 0
for s in str(i):
x += int(s)
if A <= x <= B:
ans += i
print(ans)
| false | 27.272727 | [
"-answer = 0",
"+ans = 0",
"- l = [int(x) for x in list(str(i))]",
"- if A <= sum(l) <= B:",
"- answer += i",
"-print(answer)",
"+ x = 0",
"+ for s in str(i):",
"+ x += int(s)",
"+ if A <= x <= B:",
"+ ans += i",
"+print(ans)"
] | false | 0.047492 | 0.148158 | 0.32055 | [
"s859481268",
"s238185288"
] |
u894258749 | p03087 | python | s721022723 | s501221758 | 918 | 581 | 6,108 | 58,584 | Accepted | Accepted | 36.71 | inpl = lambda: list(map(int,input().split()))
N, Q = inpl()
S = eval(input())
T = [0]*N
a_flag = False
ac_num = 0
for i in range(N):
if S[i] == 'A':
a_flag = True
elif a_flag and S[i] == 'C':
ac_num += 1
a_flag = False
else:
a_flag = False
T[i] = ac_num
... | from bisect import bisect_left
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N, Q = inpl()
S = eval(input())
ACs = []
for i in range(N-1):
if S[i:i+2] == 'AC':
ACs.append(i)
for i in range(Q):
l, r = ... | 20 | 19 | 378 | 400 | inpl = lambda: list(map(int, input().split()))
N, Q = inpl()
S = eval(input())
T = [0] * N
a_flag = False
ac_num = 0
for i in range(N):
if S[i] == "A":
a_flag = True
elif a_flag and S[i] == "C":
ac_num += 1
a_flag = False
else:
a_flag = False
T[i] = ac_num
for _ in range(... | from bisect import bisect_left
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int, input().split()))
N, Q = inpl()
S = eval(input())
ACs = []
for i in range(N - 1):
if S[i : i + 2] == "AC":
ACs.append(i)
for i in range(Q):
l, r = inpl()
... | false | 5 | [
"+from bisect import bisect_left",
"+import sys",
"+",
"+sys.setrecursionlimit(10**9)",
"+input = lambda: sys.stdin.readline().rstrip()",
"-T = [0] * N",
"-a_flag = False",
"-ac_num = 0",
"-for i in range(N):",
"- if S[i] == \"A\":",
"- a_flag = True",
"- elif a_flag and S[i] == \... | false | 0.037618 | 0.097529 | 0.385717 | [
"s721022723",
"s501221758"
] |
u585482323 | p03816 | python | s618017560 | s784552294 | 1,602 | 108 | 18,848 | 18,848 | Accepted | Accepted | 93.26 | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
... | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
... | 97 | 90 | 1,306 | 1,203 | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(map(list, sys.stdin.readline().... | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(map(list, sys.stdin.readline().... | false | 7.216495 | [
"-i = 0",
"-while i < len(l):",
"- if d[l[i]] < 2:",
"- l.pop(i)",
"- i -= 1",
"- i += 1",
"-l.sort()"
] | false | 0.14373 | 0.037362 | 3.846949 | [
"s618017560",
"s784552294"
] |
u367701763 | p03078 | python | s092606587 | s714178619 | 1,081 | 873 | 241,752 | 233,572 | Accepted | Accepted | 19.24 | from itertools import product
X, Y, Z, K = list(map(int, input().split()))
AB = []
for ab in product(list(map(int, input().split())), list(map(int, input().split()))):
AB.append(ab[0] + ab[1])
AB.sort(reverse=True)
AB = AB[:K]
ABC = []
for abc in product(AB, list(map(int, input().split()))):
ABC.append... | from itertools import product
X, Y, Z, K = list(map(int, input().split()))
AB = []
for ab in product(list(map(int, input().split())), list(map(int, input().split()))):
AB.append(ab[0] + ab[1])
AB.sort(reverse=True)
AB = AB[:min(K,X*Y)]
ABC = []
for abc in product(AB, list(map(int, input().split()))):
A... | 13 | 13 | 375 | 384 | from itertools import product
X, Y, Z, K = list(map(int, input().split()))
AB = []
for ab in product(list(map(int, input().split())), list(map(int, input().split()))):
AB.append(ab[0] + ab[1])
AB.sort(reverse=True)
AB = AB[:K]
ABC = []
for abc in product(AB, list(map(int, input().split()))):
ABC.append(abc[0] ... | from itertools import product
X, Y, Z, K = list(map(int, input().split()))
AB = []
for ab in product(list(map(int, input().split())), list(map(int, input().split()))):
AB.append(ab[0] + ab[1])
AB.sort(reverse=True)
AB = AB[: min(K, X * Y)]
ABC = []
for abc in product(AB, list(map(int, input().split()))):
ABC.a... | false | 0 | [
"-AB = AB[:K]",
"+AB = AB[: min(K, X * Y)]"
] | false | 0.047425 | 0.037907 | 1.251077 | [
"s092606587",
"s714178619"
] |
u631277801 | p03476 | python | s808322215 | s806296835 | 452 | 311 | 29,116 | 18,372 | Accepted | Accepted | 31.19 | import math as m
def judge_prime(num):
isPrime = [True]*(num+1)
isPrime[0] = False
isPrime[1] = False
border = m.sqrt(num)
i = 2
while i <= border:
if isPrime[i]:
j = i*2
while j <= num:
isPrime[j] = False
j += i
... | 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.rea... | 74 | 61 | 1,510 | 1,521 | import math as m
def judge_prime(num):
isPrime = [True] * (num + 1)
isPrime[0] = False
isPrime[1] = False
border = m.sqrt(num)
i = 2
while i <= border:
if isPrime[i]:
j = i * 2
while j <= num:
isPrime[j] = False
j += i
i +... | 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 | 17.567568 | [
"-import math as m",
"+import sys",
"+",
"+stdin = sys.stdin",
"+sys.setrecursionlimit(10**5)",
"-def judge_prime(num):",
"- isPrime = [True] * (num + 1)",
"+def li():",
"+ return list(map(int, stdin.readline().split()))",
"+",
"+",
"+def li_():",
"+ return [int(x) - 1 for x in stdi... | false | 0.194819 | 0.096943 | 2.009617 | [
"s808322215",
"s806296835"
] |
u704563784 | p02731 | python | s648168607 | s488948613 | 37 | 17 | 5,076 | 3,060 | Accepted | Accepted | 54.05 | from decimal import *
getcontext().prec = 28
n = Decimal(eval(input()))
print(((n/Decimal(3.0))**Decimal(3))) | n = int(eval(input()))
print(((n/3.0)**3))
| 4 | 2 | 104 | 36 | from decimal import *
getcontext().prec = 28
n = Decimal(eval(input()))
print(((n / Decimal(3.0)) ** Decimal(3)))
| n = int(eval(input()))
print(((n / 3.0) ** 3))
| false | 50 | [
"-from decimal import *",
"-",
"-getcontext().prec = 28",
"-n = Decimal(eval(input()))",
"-print(((n / Decimal(3.0)) ** Decimal(3)))",
"+n = int(eval(input()))",
"+print(((n / 3.0) ** 3))"
] | false | 0.074651 | 0.067565 | 1.104886 | [
"s648168607",
"s488948613"
] |
u494748969 | p03448 | python | s143897472 | s944810106 | 59 | 52 | 3,060 | 3,064 | Accepted | Accepted | 11.86 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
i = 0
while i <= a:
j = 0
while j <= b:
k = 0
while k <= c:
if 500 * i + 100 * j + 50 * k == x:
count += 1
k += 1
j += 1
i += 1... | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if 500 * i + 100 * j + 50 * k == x:
count += 1
print(count) | 17 | 11 | 311 | 263 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
i = 0
while i <= a:
j = 0
while j <= b:
k = 0
while k <= c:
if 500 * i + 100 * j + 50 * k == x:
count += 1
k += 1
j += 1
i += 1
print(count)
| a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if 500 * i + 100 * j + 50 * k == x:
count += 1
print(count)
| false | 35.294118 | [
"-i = 0",
"-while i <= a:",
"- j = 0",
"- while j <= b:",
"- k = 0",
"- while k <= c:",
"+for i in range(a + 1):",
"+ for j in range(b + 1):",
"+ for k in range(c + 1):",
"- k += 1",
"- j += 1",
"- i += 1"
] | false | 0.078707 | 0.067423 | 1.16737 | [
"s143897472",
"s944810106"
] |
u319725914 | p00223 | python | s427028249 | s518822140 | 4,450 | 4,050 | 35,192 | 35,196 | Accepted | Accepted | 8.99 | # from line_profiler import LineProfiler
from collections import deque
from sys import stdin
def main():
while(True):
W, H = list(map(int, stdin.readline().split()))
if not W: break
tx,ty = list(map(int, stdin.readline().split()))
kx,ky = list(map(int, stdin.readline().spli... | # from line_profiler import LineProfiler
from collections import deque
from sys import stdin
def main():
while(True):
W, H = list(map(int, stdin.readline().split()))
if not W: break
tx,ty = list(map(int, stdin.readline().split()))
kx,ky = list(map(int, stdin.readline().spli... | 36 | 35 | 1,306 | 1,279 | # from line_profiler import LineProfiler
from collections import deque
from sys import stdin
def main():
while True:
W, H = list(map(int, stdin.readline().split()))
if not W:
break
tx, ty = list(map(int, stdin.readline().split()))
kx, ky = list(map(int, stdin.readline()... | # from line_profiler import LineProfiler
from collections import deque
from sys import stdin
def main():
while True:
W, H = list(map(int, stdin.readline().split()))
if not W:
break
tx, ty = list(map(int, stdin.readline().split()))
kx, ky = list(map(int, stdin.readline()... | false | 2.777778 | [
"- ttx, tty, kkx, kky = tx + tdx, ty + tdy, kx + kdx, ky + kdy",
"- if (ttx, tty, kkx, kky) in pas:",
"+ if (tx + tdx, ty + tdy, kx + kdx, ky + kdy) in pas:",
"- que.append([ttx, tty, kkx, kky, c + 1])",
"- pas.add((ttx, tty, kkx, kk... | false | 0.075208 | 0.040685 | 1.848524 | [
"s427028249",
"s518822140"
] |
u488127128 | p03456 | python | s303474170 | s751252833 | 20 | 17 | 3,188 | 2,940 | Accepted | Accepted | 15 | a = input().replace(' ','')
if int(a)**0.5 % 1 == 0:
print('Yes')
else:
print('No')
| a = input().replace(' ','')
print(('Yes' if int(a)**0.5 % 1 == 0 else 'No')) | 5 | 2 | 96 | 75 | a = input().replace(" ", "")
if int(a) ** 0.5 % 1 == 0:
print("Yes")
else:
print("No")
| a = input().replace(" ", "")
print(("Yes" if int(a) ** 0.5 % 1 == 0 else "No"))
| false | 60 | [
"-if int(a) ** 0.5 % 1 == 0:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+print((\"Yes\" if int(a) ** 0.5 % 1 == 0 else \"No\"))"
] | false | 0.05559 | 0.056847 | 0.977884 | [
"s303474170",
"s751252833"
] |
u347184682 | p02572 | python | s901241228 | s505266398 | 233 | 143 | 31,760 | 31,560 | Accepted | Accepted | 38.63 | n=int(eval(input()))
mod=10**9+7
a=[int(x) for x in input().split()]
a.sort(reverse=True)
ruiseki=[a[0]]
for i in range(1,n):
ruiseki.append(a[i]+ruiseki[i-1])
ans=0
ruiseki.sort(reverse=True)
a.sort()
for i in range(1,n):
ans+=((a[i-1])*ruiseki[i])%mod
print((ans%mod))
| n=int(eval(input()))
a=[int(x) for x in input().split()]
al=sum(a)
ans=0
mod=10**9+7
for i in range(n):
al-=a[i]
ans+=(a[i]*al)%mod
print((ans%mod))
| 16 | 10 | 285 | 155 | n = int(eval(input()))
mod = 10**9 + 7
a = [int(x) for x in input().split()]
a.sort(reverse=True)
ruiseki = [a[0]]
for i in range(1, n):
ruiseki.append(a[i] + ruiseki[i - 1])
ans = 0
ruiseki.sort(reverse=True)
a.sort()
for i in range(1, n):
ans += ((a[i - 1]) * ruiseki[i]) % mod
print((ans % mod))
| n = int(eval(input()))
a = [int(x) for x in input().split()]
al = sum(a)
ans = 0
mod = 10**9 + 7
for i in range(n):
al -= a[i]
ans += (a[i] * al) % mod
print((ans % mod))
| false | 37.5 | [
"+a = [int(x) for x in input().split()]",
"+al = sum(a)",
"+ans = 0",
"-a = [int(x) for x in input().split()]",
"-a.sort(reverse=True)",
"-ruiseki = [a[0]]",
"-for i in range(1, n):",
"- ruiseki.append(a[i] + ruiseki[i - 1])",
"-ans = 0",
"-ruiseki.sort(reverse=True)",
"-a.sort()",
"-for i ... | false | 0.036684 | 0.038313 | 0.957492 | [
"s901241228",
"s505266398"
] |
u136869985 | p03477 | python | s644652992 | s636809970 | 20 | 17 | 3,316 | 3,060 | Accepted | Accepted | 15 | def main():
A, B, C, D = list(map(int, input().split()))
hoge = A + B
fuga = C + D
if hoge > fuga:
print("Left")
elif hoge == fuga:
print("Balanced")
else:
print("Right")
if __name__ == "__main__":
main() | A, B, C, D = list(map(int, input().split()))
hoge = A + B
fuga = C + D
if hoge > fuga:
print("Left")
elif hoge == fuga:
print("Balanced")
else:
print("Right") | 15 | 10 | 267 | 174 | def main():
A, B, C, D = list(map(int, input().split()))
hoge = A + B
fuga = C + D
if hoge > fuga:
print("Left")
elif hoge == fuga:
print("Balanced")
else:
print("Right")
if __name__ == "__main__":
main()
| A, B, C, D = list(map(int, input().split()))
hoge = A + B
fuga = C + D
if hoge > fuga:
print("Left")
elif hoge == fuga:
print("Balanced")
else:
print("Right")
| false | 33.333333 | [
"-def main():",
"- A, B, C, D = list(map(int, input().split()))",
"- hoge = A + B",
"- fuga = C + D",
"- if hoge > fuga:",
"- print(\"Left\")",
"- elif hoge == fuga:",
"- print(\"Balanced\")",
"- else:",
"- print(\"Right\")",
"-",
"-",
"-if __name__ == ... | false | 0.046259 | 0.047624 | 0.971327 | [
"s644652992",
"s636809970"
] |
u048945791 | p03240 | python | s020347621 | s759310719 | 95 | 87 | 3,188 | 3,064 | Accepted | Accepted | 8.42 | n = int(eval(input()))
xyh = [None] * n
for i in range(n):
xyh[i] = list(map(int, input().split()))
isOk = False
i = 0
j = 0
constant = -1
for i in range(101):
for j in range(101):
constant = -1
for xyhTemp in xyh:
if xyhTemp[2] != 0:
temp = xy... | n = int(eval(input()))
xyh = [list(map(int, input().split())) for _ in range(n)]
isOk = False
i = 0
j = 0
constant = -1
for i in range(101):
for j in range(101):
constant = -1
for xyhTemp in xyh:
if xyhTemp[2] != 0:
temp = xyhTemp[2] + abs(i - xyhTemp[0... | 39 | 36 | 805 | 777 | n = int(eval(input()))
xyh = [None] * n
for i in range(n):
xyh[i] = list(map(int, input().split()))
isOk = False
i = 0
j = 0
constant = -1
for i in range(101):
for j in range(101):
constant = -1
for xyhTemp in xyh:
if xyhTemp[2] != 0:
temp = xyhTemp[2] + abs(i - xyhTe... | n = int(eval(input()))
xyh = [list(map(int, input().split())) for _ in range(n)]
isOk = False
i = 0
j = 0
constant = -1
for i in range(101):
for j in range(101):
constant = -1
for xyhTemp in xyh:
if xyhTemp[2] != 0:
temp = xyhTemp[2] + abs(i - xyhTemp[0]) + abs(j - xyhTem... | false | 7.692308 | [
"-xyh = [None] * n",
"-for i in range(n):",
"- xyh[i] = list(map(int, input().split()))",
"+xyh = [list(map(int, input().split())) for _ in range(n)]"
] | false | 0.036014 | 0.0523 | 0.688612 | [
"s020347621",
"s759310719"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.