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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u780475861 | p03031 | python | s420206266 | s720580526 | 24 | 22 | 3,064 | 3,064 | Accepted | Accepted | 8.33 | import sys
readline=sys.stdin.readline
N,M=list(map(int,readline().split()))
mlst = [0] * M
for i in range(1,M+1):
_, *tmp = list(map(int,readline().split()))
for j in tmp:
mlst[i-1] |= 1<<(j-1)
def popcnt(n):
# 求1的个数
c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
c ... | import sys
readline=sys.stdin.readline
def main():
N,M=list(map(int,readline().split()))
mlst = [0] * M
for i in range(1,M+1):
_, *tmp = list(map(int,readline().split()))
for j in tmp:
mlst[i-1] |= 1<<(j-1)
def popcnt(n):
# 求1的个数
c = (n & 0x5555555555555555) + ((n >> 1) & ... | 31 | 33 | 878 | 902 | import sys
readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
mlst = [0] * M
for i in range(1, M + 1):
_, *tmp = list(map(int, readline().split()))
for j in tmp:
mlst[i - 1] |= 1 << (j - 1)
def popcnt(n):
# 求1的个数
c = (n & 0x5555555555555555) + ((n >> 1) & 0x55555555555555... | import sys
readline = sys.stdin.readline
def main():
N, M = list(map(int, readline().split()))
mlst = [0] * M
for i in range(1, M + 1):
_, *tmp = list(map(int, readline().split()))
for j in tmp:
mlst[i - 1] |= 1 << (j - 1)
def popcnt(n):
# 求1的个数
c = (n & 0... | false | 6.060606 | [
"-N, M = list(map(int, readline().split()))",
"-mlst = [0] * M",
"-for i in range(1, M + 1):",
"- _, *tmp = list(map(int, readline().split()))",
"- for j in tmp:",
"- mlst[i - 1] |= 1 << (j - 1)",
"-def popcnt(n):",
"- # 求1的个数",
"- c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555... | false | 0.049225 | 0.200429 | 0.245596 | [
"s420206266",
"s720580526"
] |
u994988729 | p03096 | python | s084330761 | s469237566 | 483 | 337 | 31,332 | 25,956 | Accepted | Accepted | 30.23 | from collections import defaultdict
N = int(eval(input()))
tmp = [int(eval(input())) for _ in range(N)]
mod = 10 ** 9 + 7
C = []
for c in tmp:
if not C:
C.append(c)
continue
if C[-1] != c:
C.append(c)
N = len(C)
last = defaultdict(int)
ans = 1
for c in C:
ans += la... | import sys
input = sys.stdin.readline
N = int(eval(input()))
C = [int(eval(input())) for _ in range(N)]
mod = 10 ** 9 + 7
newC = []
while C:
c = C.pop()
if not newC or newC[-1] != c:
newC.append(c)
N = len(newC)
seen = [0] * (2*10 ** 5 + 10)
dp = [0] * (N + 1)
dp[0] = 1
seen[newC[0]]... | 22 | 26 | 363 | 488 | from collections import defaultdict
N = int(eval(input()))
tmp = [int(eval(input())) for _ in range(N)]
mod = 10**9 + 7
C = []
for c in tmp:
if not C:
C.append(c)
continue
if C[-1] != c:
C.append(c)
N = len(C)
last = defaultdict(int)
ans = 1
for c in C:
ans += last[c]
ans %= mod... | import sys
input = sys.stdin.readline
N = int(eval(input()))
C = [int(eval(input())) for _ in range(N)]
mod = 10**9 + 7
newC = []
while C:
c = C.pop()
if not newC or newC[-1] != c:
newC.append(c)
N = len(newC)
seen = [0] * (2 * 10**5 + 10)
dp = [0] * (N + 1)
dp[0] = 1
seen[newC[0]] = 1
for i, c in enum... | false | 15.384615 | [
"-from collections import defaultdict",
"+import sys",
"+input = sys.stdin.readline",
"-tmp = [int(eval(input())) for _ in range(N)]",
"+C = [int(eval(input())) for _ in range(N)]",
"-C = []",
"-for c in tmp:",
"- if not C:",
"- C.append(c)",
"- continue",
"- if C[-1] != c:",... | false | 0.037287 | 0.038219 | 0.975611 | [
"s084330761",
"s469237566"
] |
u931209993 | p03493 | python | s594668273 | s683849789 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a = int(eval(input()))
cnt = 0
while a != 0:
if a%10 == 1:
cnt += 1
a = int(a/10)
print(cnt) | a = eval(input())
cnt = 0
if a[0] == '1':
cnt += 1
if a[1] == '1':
cnt += 1
if a[2] == '1':
cnt += 1
print(cnt) | 9 | 10 | 107 | 123 | a = int(eval(input()))
cnt = 0
while a != 0:
if a % 10 == 1:
cnt += 1
a = int(a / 10)
print(cnt)
| a = eval(input())
cnt = 0
if a[0] == "1":
cnt += 1
if a[1] == "1":
cnt += 1
if a[2] == "1":
cnt += 1
print(cnt)
| false | 10 | [
"-a = int(eval(input()))",
"+a = eval(input())",
"-while a != 0:",
"- if a % 10 == 1:",
"- cnt += 1",
"- a = int(a / 10)",
"+if a[0] == \"1\":",
"+ cnt += 1",
"+if a[1] == \"1\":",
"+ cnt += 1",
"+if a[2] == \"1\":",
"+ cnt += 1"
] | false | 0.039425 | 0.040037 | 0.984718 | [
"s594668273",
"s683849789"
] |
u077291787 | p03069 | python | s999308243 | s376551013 | 189 | 55 | 14,184 | 3,500 | Accepted | Accepted | 70.9 | import sys
input = sys.stdin.readline
n = int(eval(input()))
s = list(eval(input()))
res = 10 ** 9
cta = 0
ctb = 0
a = [0] * n
b = [0] * n
for i in range(n):
if s[i] == ".":
cta += 1
else:
ctb += 1
a[i] = cta
b[i] = ctb
for i in range(n):
res = min(res, b[i] + ... | # TPBC201C - Stones
import sys
input = sys.stdin.readline
n = int(eval(input()))
s = input().rstrip()
ans = 0
blk = 0
for i in s:
if i == "#":
blk += 1
else:
if blk > 0:
ans += 1
blk -= 1
print(ans)
| 23 | 16 | 363 | 257 | import sys
input = sys.stdin.readline
n = int(eval(input()))
s = list(eval(input()))
res = 10**9
cta = 0
ctb = 0
a = [0] * n
b = [0] * n
for i in range(n):
if s[i] == ".":
cta += 1
else:
ctb += 1
a[i] = cta
b[i] = ctb
for i in range(n):
res = min(res, b[i] + a[-1] - a[i])
res = min(... | # TPBC201C - Stones
import sys
input = sys.stdin.readline
n = int(eval(input()))
s = input().rstrip()
ans = 0
blk = 0
for i in s:
if i == "#":
blk += 1
else:
if blk > 0:
ans += 1
blk -= 1
print(ans)
| false | 30.434783 | [
"+# TPBC201C - Stones",
"-s = list(eval(input()))",
"-res = 10**9",
"-cta = 0",
"-ctb = 0",
"-a = [0] * n",
"-b = [0] * n",
"-for i in range(n):",
"- if s[i] == \".\":",
"- cta += 1",
"+s = input().rstrip()",
"+ans = 0",
"+blk = 0",
"+for i in s:",
"+ if i == \"#\":",
"+ ... | false | 0.036128 | 0.107968 | 0.334619 | [
"s999308243",
"s376551013"
] |
u729133443 | p03588 | python | s843246894 | s485499653 | 181 | 73 | 25,940 | 25,940 | Accepted | Accepted | 59.67 | n,*t=list(map(int,open(0).read().split()));print((sum(sorted(zip(t[::2],t[1::2]))[-1]))) | n,*t=list(map(int,open(0).read().split()));print((sum(max(list(zip(t[::2],t[1::2])))))) | 1 | 1 | 80 | 73 | n, *t = list(map(int, open(0).read().split()))
print((sum(sorted(zip(t[::2], t[1::2]))[-1])))
| n, *t = list(map(int, open(0).read().split()))
print((sum(max(list(zip(t[::2], t[1::2]))))))
| false | 0 | [
"-print((sum(sorted(zip(t[::2], t[1::2]))[-1])))",
"+print((sum(max(list(zip(t[::2], t[1::2]))))))"
] | false | 0.036649 | 0.037693 | 0.972299 | [
"s843246894",
"s485499653"
] |
u707124227 | p03332 | python | s029587884 | s284534201 | 1,008 | 730 | 134,932 | 44,672 | Accepted | Accepted | 27.58 | n,a,b,k=list(map(int,input().split()))
mod=998244353
import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
g=math.gcd(a,b)
if k%g!=0:
print((0))
exit()
k//=g
a//=g
b//=g
# コンビネーション、さらに高速。あらかじめO(N)の計算をすることでのちの計算が早くなる
def cmb(n,r,mod):
if (r<0 or r>n):
return 0
r=min(r,n-r)
return... | n,a,b,k=list(map(int,input().split()))
mod=998244353
# コンビネーション、さらに高速。あらかじめO(N)の計算をすることでのちの計算が早くなる
def cmb(n,r,mod):
if (r<0 or r>n):
return 0
r=min(r,n-r)
return g1[n]*g2[r]*g2[n-r]%mod
g1=[1,1] # g1[i]=i! % mod :階乗
g2=[1,1] # g2[i]=(i!)^(-1) % mod :階乗の逆元
inverse=[0,1]
for i in range(2,n+1):
... | 71 | 33 | 1,364 | 711 | n, a, b, k = list(map(int, input().split()))
mod = 998244353
import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
g = math.gcd(a, b)
if k % g != 0:
print((0))
exit()
k //= g
a //= g
b //= g
# コンビネーション、さらに高速。あらかじめO(N)の計算をすることでのちの計算が早くなる
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
... | n, a, b, k = list(map(int, input().split()))
mod = 998244353
# コンビネーション、さらに高速。あらかじめO(N)の計算をすることでのちの計算が早くなる
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
g1 = [1, 1] # g1[i]=i! % mod :階乗
g2 = [1, 1] # g2[i]=(i!)^(-1) % mod :階乗の逆元
inverse ... | false | 53.521127 | [
"-import math",
"-",
"-",
"-def lcm(x, y):",
"- return (x * y) // math.gcd(x, y)",
"-",
"-",
"-g = math.gcd(a, b)",
"-if k % g != 0:",
"- print((0))",
"- exit()",
"-k //= g",
"-a //= g",
"-b //= g",
"- ret = 1",
"- ret *= cmb(n, na, mod)",
"- ret %= mod",
"- re... | false | 0.112146 | 0.06893 | 1.626959 | [
"s029587884",
"s284534201"
] |
u489247698 | p02571 | python | s798545649 | s841790829 | 68 | 62 | 9,432 | 9,068 | Accepted | Accepted | 8.82 | from collections import deque
import sys, copy, itertools,heapq
#input = sys.stdin.readline
S = eval(input())
T = eval(input())
result = float('inf')
for i in range(len(S) - len(T) + 1):
t = 0
for j in range(len(T)):
if S[i + j] != T[j]:
t += 1
result = min(result, t)
p... | #input = sys.stdin.readline
S = eval(input())
T = eval(input())
result = float('inf')
for i in range(len(S) - len(T) + 1):
t = 0
for j in range(len(T)):
if S[i + j] != T[j]:
t += 1
result = min(result, t)
print(result) | 15 | 13 | 320 | 254 | from collections import deque
import sys, copy, itertools, heapq
# input = sys.stdin.readline
S = eval(input())
T = eval(input())
result = float("inf")
for i in range(len(S) - len(T) + 1):
t = 0
for j in range(len(T)):
if S[i + j] != T[j]:
t += 1
result = min(result, t)
print(result)
| # input = sys.stdin.readline
S = eval(input())
T = eval(input())
result = float("inf")
for i in range(len(S) - len(T) + 1):
t = 0
for j in range(len(T)):
if S[i + j] != T[j]:
t += 1
result = min(result, t)
print(result)
| false | 13.333333 | [
"-from collections import deque",
"-import sys, copy, itertools, heapq",
"-"
] | false | 0.038753 | 0.043229 | 0.896453 | [
"s798545649",
"s841790829"
] |
u926080943 | p02713 | python | s522099214 | s931353503 | 1,859 | 1,387 | 13,136 | 9,176 | Accepted | Accepted | 25.39 | from functools import lru_cache
@lru_cache(maxsize=None)
def gcd(a, b):
if a < b:
a, b = b, a
if a % b == 0:
return b
return gcd(b, a % b)
def main():
ans = 0
k = int(eval(input()))
for i in range(1, k+1):
for j in range(1, k+1):
for l in ... | from math import gcd
def main():
ans = 0
k = int(eval(input()))
for i in range(1, k+1):
for j in range(1, k+1):
for l in range(1, k+1):
ans += gcd(gcd(i, j), l)
print(ans)
if __name__ == '__main__':
main()
| 24 | 15 | 431 | 274 | from functools import lru_cache
@lru_cache(maxsize=None)
def gcd(a, b):
if a < b:
a, b = b, a
if a % b == 0:
return b
return gcd(b, a % b)
def main():
ans = 0
k = int(eval(input()))
for i in range(1, k + 1):
for j in range(1, k + 1):
for l in range(1, k + ... | from math import gcd
def main():
ans = 0
k = int(eval(input()))
for i in range(1, k + 1):
for j in range(1, k + 1):
for l in range(1, k + 1):
ans += gcd(gcd(i, j), l)
print(ans)
if __name__ == "__main__":
main()
| false | 37.5 | [
"-from functools import lru_cache",
"-",
"-",
"-@lru_cache(maxsize=None)",
"-def gcd(a, b):",
"- if a < b:",
"- a, b = b, a",
"- if a % b == 0:",
"- return b",
"- return gcd(b, a % b)",
"+from math import gcd"
] | false | 0.057275 | 0.427856 | 0.133865 | [
"s522099214",
"s931353503"
] |
u102461423 | p04017 | python | s288686023 | s736523240 | 1,074 | 590 | 31,900 | 39,380 | Accepted | Accepted | 45.07 | import sys
input = sys.stdin.readline
import numpy as np
N = int(eval(input()))
X = np.array(input().split(), dtype = np.int64)
L = int(eval(input()))
U = N.bit_length()
# 各ホテルから、2^n回でどこまで行けるか
next_x = []
next_x.append((np.searchsorted(X, X+L, side = 'right') - 1).tolist())
for i in range(U):
next_x.... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
X = np.array(readline().split(),np.int64)
L = int(readline())
Q = int(readline())
AB = np.array(read().split(),np.int64).reshape(-1,2)
AB -= 1
AB.so... | 33 | 34 | 719 | 725 | import sys
input = sys.stdin.readline
import numpy as np
N = int(eval(input()))
X = np.array(input().split(), dtype=np.int64)
L = int(eval(input()))
U = N.bit_length()
# 各ホテルから、2^n回でどこまで行けるか
next_x = []
next_x.append((np.searchsorted(X, X + L, side="right") - 1).tolist())
for i in range(U):
next_x.append([next_x[... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
X = np.array(readline().split(), np.int64)
L = int(readline())
Q = int(readline())
AB = np.array(read().split(), np.int64).reshape(-1, 2)
AB -= 1
AB.sort(axis=1)
A... | false | 2.941176 | [
"-input = sys.stdin.readline",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"-N = int(eval(input()))",
"-X = np.array(input().split(), dtype=np.int64)",
"-L = int(eval(input()))",
"-U = N.bit_length()",
"-# 各ホテルから、2^n回でどこまで行けるか"... | false | 0.206074 | 0.157842 | 1.305572 | [
"s288686023",
"s736523240"
] |
u461513098 | p02813 | python | s042666078 | s246637282 | 30 | 27 | 3,064 | 3,060 | Accepted | Accepted | 10 | import itertools
N = int(eval(input()))
P = tuple([int(p) for p in input().split()])
Q = tuple([int(q) for q in input().split()])
a, b = -1, -1
count = 1
for seq in itertools.permutations(tuple(range(1, N+1))):
if seq == P:
a = count
if seq == Q:
b = count
if a != -1 and b != -1... | import sys
import itertools
input = sys.stdin.readline
def main():
a, b = -1, -1
count = 0
for p in itertools.permutations(list(range(1, N+1))):
if p == P:
a = count
if p == Q:
b = count
if a != -1 and b != -1:
break
co... | 16 | 26 | 363 | 510 | import itertools
N = int(eval(input()))
P = tuple([int(p) for p in input().split()])
Q = tuple([int(q) for q in input().split()])
a, b = -1, -1
count = 1
for seq in itertools.permutations(tuple(range(1, N + 1))):
if seq == P:
a = count
if seq == Q:
b = count
if a != -1 and b != -1:
... | import sys
import itertools
input = sys.stdin.readline
def main():
a, b = -1, -1
count = 0
for p in itertools.permutations(list(range(1, N + 1))):
if p == P:
a = count
if p == Q:
b = count
if a != -1 and b != -1:
break
count += 1
pri... | false | 38.461538 | [
"+import sys",
"-N = int(eval(input()))",
"-P = tuple([int(p) for p in input().split()])",
"-Q = tuple([int(q) for q in input().split()])",
"-a, b = -1, -1",
"-count = 1",
"-for seq in itertools.permutations(tuple(range(1, N + 1))):",
"- if seq == P:",
"- a = count",
"- if seq == Q:",... | false | 0.103576 | 0.038724 | 2.674705 | [
"s042666078",
"s246637282"
] |
u531220228 | p02947 | python | s214222156 | s745172356 | 502 | 327 | 120,828 | 27,044 | Accepted | Accepted | 34.86 | N = int(eval(input()))
s = [eval(input()) for _ in range(N)]
import collections
sortedList = [''.join(sorted(x)) for x in s]
countNum = list(collections.Counter(sortedList).values())
import sys
sys.setrecursionlimit(100000000)
nCr = {}
def cmb(n, r):
if r == 0 or r == n: return 1
if r == 1: r... | N = int(eval(input()))
S = [""]*N
for i in range(N):
S[i] = eval(input())
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p in range(2,r+1):
... | 27 | 54 | 598 | 1,104 | N = int(eval(input()))
s = [eval(input()) for _ in range(N)]
import collections
sortedList = ["".join(sorted(x)) for x in s]
countNum = list(collections.Counter(sortedList).values())
import sys
sys.setrecursionlimit(100000000)
nCr = {}
def cmb(n, r):
if r == 0 or r == n:
return 1
if r == 1:
... | N = int(eval(input()))
S = [""] * N
for i in range(N):
S[i] = eval(input())
def cmb(n, r):
if n - r < r:
r = n - r
if r == 0:
return 1
if r == 1:
return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p in range(2, r + 1):... | false | 50 | [
"-s = [eval(input()) for _ in range(N)]",
"-import collections",
"-",
"-sortedList = [\"\".join(sorted(x)) for x in s]",
"-countNum = list(collections.Counter(sortedList).values())",
"-import sys",
"-",
"-sys.setrecursionlimit(100000000)",
"-nCr = {}",
"+S = [\"\"] * N",
"+for i in range(N):",
... | false | 0.043619 | 0.042951 | 1.01555 | [
"s214222156",
"s745172356"
] |
u394721319 | p02983 | python | s389618914 | s466802724 | 691 | 219 | 3,060 | 40,812 | Accepted | Accepted | 68.31 | L,R = [int(zz) for zz in input().split()]
Lm = L%2019
Rm = R%2019
if Lm*Rm == 0 or R-L > 2017 or Rm <= Lm:
print((0))
exit()
ans = 2019
for i in range(Lm,Rm+1):
for j in range(i+1,Rm+1):
ans = min(ans,i*j%2019)
print(ans)
| L,R = [int(zz) for zz in input().split()]
if R-L >= 2018:
print((0))
else:
ans = 2019
for i in range(L,R):
for j in range(i+1,R+1):
ans = min(ans,i*j%2019)
print(ans)
| 14 | 10 | 256 | 211 | L, R = [int(zz) for zz in input().split()]
Lm = L % 2019
Rm = R % 2019
if Lm * Rm == 0 or R - L > 2017 or Rm <= Lm:
print((0))
exit()
ans = 2019
for i in range(Lm, Rm + 1):
for j in range(i + 1, Rm + 1):
ans = min(ans, i * j % 2019)
print(ans)
| L, R = [int(zz) for zz in input().split()]
if R - L >= 2018:
print((0))
else:
ans = 2019
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, i * j % 2019)
print(ans)
| false | 28.571429 | [
"-Lm = L % 2019",
"-Rm = R % 2019",
"-if Lm * Rm == 0 or R - L > 2017 or Rm <= Lm:",
"+if R - L >= 2018:",
"- exit()",
"-ans = 2019",
"-for i in range(Lm, Rm + 1):",
"- for j in range(i + 1, Rm + 1):",
"- ans = min(ans, i * j % 2019)",
"-print(ans)",
"+else:",
"+ ans = 2019",
... | false | 0.036035 | 0.062964 | 0.572311 | [
"s389618914",
"s466802724"
] |
u829735607 | p02786 | python | s041280815 | s411065142 | 271 | 38 | 59,736 | 5,144 | Accepted | Accepted | 85.98 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, asc... | 22 | 22 | 791 | 774 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | false | 0 | [
"-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"+from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2",
"-print((sum([2**i for i in range(len(\"{:b}\".format(H)))])))",
"+print((2 ** len(\"{:b}\".format(H)) - 1))"
] | false | 0.06178 | 0.061271 | 1.00831 | [
"s041280815",
"s411065142"
] |
u787562674 | p03102 | python | s799333195 | s241649829 | 301 | 174 | 18,644 | 13,504 | Accepted | Accepted | 42.19 | import numpy as np
N, M, C = list(map(int, input().split()))
B = np.array([int(i) for i in input().split()])
inputs = [
np.array([int(i) for i in input().split()]) * B for _ in range(N)
]
ans = 0
for i in range(N):
if C + sum(inputs[i]) > 0:
ans += 1
print(ans)
| import numpy as np
N, M, C = list(map(int, input().split()))
B = np.array([int(i) for i in input().split()])
inputs = [
sum(np.array([int(i) for i in input().split()]) * B) + C for _ in range(N)
]
print((sum([1 if inputs[i] > 0 else 0 for i in range(N)])))
| 14 | 9 | 288 | 263 | import numpy as np
N, M, C = list(map(int, input().split()))
B = np.array([int(i) for i in input().split()])
inputs = [np.array([int(i) for i in input().split()]) * B for _ in range(N)]
ans = 0
for i in range(N):
if C + sum(inputs[i]) > 0:
ans += 1
print(ans)
| import numpy as np
N, M, C = list(map(int, input().split()))
B = np.array([int(i) for i in input().split()])
inputs = [sum(np.array([int(i) for i in input().split()]) * B) + C for _ in range(N)]
print((sum([1 if inputs[i] > 0 else 0 for i in range(N)])))
| false | 35.714286 | [
"-inputs = [np.array([int(i) for i in input().split()]) * B for _ in range(N)]",
"-ans = 0",
"-for i in range(N):",
"- if C + sum(inputs[i]) > 0:",
"- ans += 1",
"-print(ans)",
"+inputs = [sum(np.array([int(i) for i in input().split()]) * B) + C for _ in range(N)]",
"+print((sum([1 if inputs... | false | 0.17178 | 0.18827 | 0.912415 | [
"s799333195",
"s241649829"
] |
u562935282 | p03682 | python | s744816662 | s343677200 | 1,911 | 1,173 | 86,064 | 81,364 | Accepted | Accepted | 38.62 | def solve_abc065d():
from collections import namedtuple
from heapq import heappush, heappop
from operator import attrgetter
from itertools import tee
import sys
input = sys.stdin.readline
City = namedtuple('City', 'x y idx')
Edge = namedtuple('Edge', 'cost to')
N = int(e... | class UnionFind:
def __init__(self, n):
self.v = [-1] * n
def find(self, x):
if self.v[x] < 0:
return x
else:
self.v[x] = self.find(self.v[x])
return self.v[x]
def unite(self, x, y):
x = self.find(x)
y = self.find(y)
... | 79 | 82 | 1,918 | 1,873 | def solve_abc065d():
from collections import namedtuple
from heapq import heappush, heappop
from operator import attrgetter
from itertools import tee
import sys
input = sys.stdin.readline
City = namedtuple("City", "x y idx")
Edge = namedtuple("Edge", "cost to")
N = int(eval(input())... | class UnionFind:
def __init__(self, n):
self.v = [-1] * n
def find(self, x):
if self.v[x] < 0:
return x
else:
self.v[x] = self.find(self.v[x])
return self.v[x]
def unite(self, x, y):
x = self.find(x)
y = self.find(y)
if x ... | false | 3.658537 | [
"-def solve_abc065d():",
"- from collections import namedtuple",
"- from heapq import heappush, heappop",
"- from operator import attrgetter",
"- from itertools import tee",
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.v = [-1] * n",
"+",
"+ def find(self, x):"... | false | 0.127434 | 0.046502 | 2.740383 | [
"s744816662",
"s343677200"
] |
u077291787 | p02936 | python | s205819067 | s513218905 | 1,989 | 1,634 | 265,740 | 265,776 | Accepted | Accepted | 17.85 | # ABC138D - Ki
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10 ** 5 + 100)
def dfs(v: int, p: int) -> None:
x = cnt[v]
for u in T[v]:
if u != p: # p: parent -> skip
cnt[u] += x # cumulative sum
dfs(u, v)
def main():
# Ai (A[i][0]) may... | # ABC138D - Ki
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10 ** 5 + 10)
def dfs(v: int, p: int) -> None:
x = cnt[v]
for u in T[v]:
if u != p: # p: parent -> skip
cnt[u] += x # cumulative sum
dfs(u, v)
def main():
# Ai (A[i][0]) may ... | 34 | 34 | 868 | 867 | # ABC138D - Ki
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**5 + 100)
def dfs(v: int, p: int) -> None:
x = cnt[v]
for u in T[v]:
if u != p: # p: parent -> skip
cnt[u] += x # cumulative sum
dfs(u, v)
def main():
# Ai (A[i][0]) may be not a parent o... | # ABC138D - Ki
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**5 + 10)
def dfs(v: int, p: int) -> None:
x = cnt[v]
for u in T[v]:
if u != p: # p: parent -> skip
cnt[u] += x # cumulative sum
dfs(u, v)
def main():
# Ai (A[i][0]) may be not a parent of... | false | 0 | [
"-sys.setrecursionlimit(2 * 10**5 + 100)",
"+sys.setrecursionlimit(2 * 10**5 + 10)"
] | false | 0.048414 | 0.048681 | 0.994523 | [
"s205819067",
"s513218905"
] |
u551909378 | p02744 | python | s743632000 | s342932222 | 269 | 195 | 16,628 | 11,864 | Accepted | Accepted | 27.51 | import copy
N = int(eval(input()))
w = [['a']]
for n in range(1,N):
nw = [[] for _ in range(n+1)]
for i in range(n):
nw[i] += [x+chr(97+j) for j in range(i+1) for x in w[i]]
nw[i+1] += [x+chr(97+i+1) for x in w[i]]
w = copy.deepcopy(nw)
ans = []
for i in range(N):
ans += ... | from collections import deque
N = int(eval(input()))
que = deque(['a'])
while len(que) > 0:
s = que.popleft()
if len(s) == N:
print(s)
else:
for i in range(ord(sorted(s)[-1]) - 95):
que.append(s + chr(97 + i)) | 16 | 11 | 368 | 254 | import copy
N = int(eval(input()))
w = [["a"]]
for n in range(1, N):
nw = [[] for _ in range(n + 1)]
for i in range(n):
nw[i] += [x + chr(97 + j) for j in range(i + 1) for x in w[i]]
nw[i + 1] += [x + chr(97 + i + 1) for x in w[i]]
w = copy.deepcopy(nw)
ans = []
for i in range(N):
ans +... | from collections import deque
N = int(eval(input()))
que = deque(["a"])
while len(que) > 0:
s = que.popleft()
if len(s) == N:
print(s)
else:
for i in range(ord(sorted(s)[-1]) - 95):
que.append(s + chr(97 + i))
| false | 31.25 | [
"-import copy",
"+from collections import deque",
"-w = [[\"a\"]]",
"-for n in range(1, N):",
"- nw = [[] for _ in range(n + 1)]",
"- for i in range(n):",
"- nw[i] += [x + chr(97 + j) for j in range(i + 1) for x in w[i]]",
"- nw[i + 1] += [x + chr(97 + i + 1) for x in w[i]]",
"- ... | false | 0.041027 | 0.037538 | 1.092936 | [
"s743632000",
"s342932222"
] |
u589843455 | p03631 | python | s648484187 | s250098495 | 179 | 164 | 38,384 | 38,256 | Accepted | Accepted | 8.38 | a,b,c = eval(input())
print(('Yes' if a == c else 'No')) | a = eval(input())
print(('Yes' if a[0] == a[2] else 'No')) | 2 | 2 | 49 | 51 | a, b, c = eval(input())
print(("Yes" if a == c else "No"))
| a = eval(input())
print(("Yes" if a[0] == a[2] else "No"))
| false | 0 | [
"-a, b, c = eval(input())",
"-print((\"Yes\" if a == c else \"No\"))",
"+a = eval(input())",
"+print((\"Yes\" if a[0] == a[2] else \"No\"))"
] | false | 0.043393 | 0.047968 | 0.904638 | [
"s648484187",
"s250098495"
] |
u375616706 | p02598 | python | s008588328 | s282803686 | 366 | 221 | 93,788 | 93,940 | Accepted | Accepted | 39.62 | from math import ceil
N,K = list(map(int,input().split()))
A=list(map(int,input().split()))
low=0
high=10**9+1
while low<=high:
mid=(low+high)//2
if mid==0:
print((1))
exit()
cnt=0
for a in A:
if a<=mid:
continue
v=ceil(a/mid)
cn... | from math import ceil
N,K = list(map(int,input().split()))
A=list(map(int,input().split()))
low=0
high=10**9+1
while low<=high:
mid=(low+high)//2
if mid==0: #0-div errorを消す
print((1))
exit()
cnt=0
for a in A:
v=ceil(a/mid)
cnt+=v-1
if cnt<=K:
... | 26 | 24 | 399 | 373 | from math import ceil
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
low = 0
high = 10**9 + 1
while low <= high:
mid = (low + high) // 2
if mid == 0:
print((1))
exit()
cnt = 0
for a in A:
if a <= mid:
continue
v = ceil(a / mid)
... | from math import ceil
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
low = 0
high = 10**9 + 1
while low <= high:
mid = (low + high) // 2
if mid == 0: # 0-div errorを消す
print((1))
exit()
cnt = 0
for a in A:
v = ceil(a / mid)
cnt += v - 1
if... | false | 7.692308 | [
"- if mid == 0:",
"+ if mid == 0: # 0-div errorを消す",
"- if a <= mid:",
"- continue"
] | false | 0.042007 | 0.038689 | 1.085758 | [
"s008588328",
"s282803686"
] |
u363610900 | p03998 | python | s444685034 | s697110516 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | # -*- coding: utf-8 -*-
a = eval(input())
b = eval(input())
c = eval(input())
sa = [a[i] for i in range(len(a))]
sb = [b[i] for i in range(len(b))]
sc = [c[i] for i in range(len(c))]
turn = sa[0]
while True:
if turn == 'a':
if len(sa) == 0:
print("A")
break
tur... | a = eval(input())
b = eval(input())
c = eval(input())
sa = [i for i in a]
sb = [i for i in b]
sc = [i for i in c]
turn = sa[0]
while True:
if turn == 'a':
if len(sa) == 0:
print('A')
break
turn = sa[0]
sa.pop(0)
if turn == 'b':
if len(sb) ==... | 28 | 26 | 592 | 520 | # -*- coding: utf-8 -*-
a = eval(input())
b = eval(input())
c = eval(input())
sa = [a[i] for i in range(len(a))]
sb = [b[i] for i in range(len(b))]
sc = [c[i] for i in range(len(c))]
turn = sa[0]
while True:
if turn == "a":
if len(sa) == 0:
print("A")
break
turn = sa[0]
... | a = eval(input())
b = eval(input())
c = eval(input())
sa = [i for i in a]
sb = [i for i in b]
sc = [i for i in c]
turn = sa[0]
while True:
if turn == "a":
if len(sa) == 0:
print("A")
break
turn = sa[0]
sa.pop(0)
if turn == "b":
if len(sb) == 0:
... | false | 7.142857 | [
"-# -*- coding: utf-8 -*-",
"-sa = [a[i] for i in range(len(a))]",
"-sb = [b[i] for i in range(len(b))]",
"-sc = [c[i] for i in range(len(c))]",
"+sa = [i for i in a]",
"+sb = [i for i in b]",
"+sc = [i for i in c]"
] | false | 0.038736 | 0.038157 | 1.01518 | [
"s444685034",
"s697110516"
] |
u375870553 | p03493 | python | s843676719 | s059642154 | 82 | 17 | 3,444 | 2,940 | Accepted | Accepted | 79.27 | def main():
n=eval(input())
from collections import Counter
c=Counter(list(n))
print((c['1']))
if __name__=='__main__':
main()
| def main():
s = eval(input())
ans = 0
for ss in s:
if ss == "1":
ans += 1
print(ans)
if __name__ == '__main__':
main() | 8 | 12 | 147 | 166 | def main():
n = eval(input())
from collections import Counter
c = Counter(list(n))
print((c["1"]))
if __name__ == "__main__":
main()
| def main():
s = eval(input())
ans = 0
for ss in s:
if ss == "1":
ans += 1
print(ans)
if __name__ == "__main__":
main()
| false | 33.333333 | [
"- n = eval(input())",
"- from collections import Counter",
"-",
"- c = Counter(list(n))",
"- print((c[\"1\"]))",
"+ s = eval(input())",
"+ ans = 0",
"+ for ss in s:",
"+ if ss == \"1\":",
"+ ans += 1",
"+ print(ans)"
] | false | 0.115498 | 0.047526 | 2.430237 | [
"s843676719",
"s059642154"
] |
u046187684 | p03326 | python | s529905335 | s566306741 | 1,492 | 162 | 21,652 | 12,588 | Accepted | Accepted | 89.14 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
n, m = list(map(int, input().split()))
xyz = [list(map(int, input().split())) for _ in range(n)]
xyz = np.asarray(xyz)
ans = 0
for i in [-1, 1]:
for j in [-1, 1]:
for k in [-1, 1]:
tmp = xyz.copy()
tmp[:, ... | from itertools import product
import numpy as np
def solve(string):
n, m, *xyz = list(map(int, string.split()))
xyz = [[x, y, z] for x, y, z in zip(xyz[::3], xyz[1::3], xyz[2::3])]
xyz = np.asarray(xyz)
ans = 0
for i, j, k in product([-1, 1], repeat=3):
tmp = xyz.copy()
... | 19 | 23 | 550 | 683 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
n, m = list(map(int, input().split()))
xyz = [list(map(int, input().split())) for _ in range(n)]
xyz = np.asarray(xyz)
ans = 0
for i in [-1, 1]:
for j in [-1, 1]:
for k in [-1, 1]:
tmp = xyz.copy()
tmp[:, 0] = i * xyz... | from itertools import product
import numpy as np
def solve(string):
n, m, *xyz = list(map(int, string.split()))
xyz = [[x, y, z] for x, y, z in zip(xyz[::3], xyz[1::3], xyz[2::3])]
xyz = np.asarray(xyz)
ans = 0
for i, j, k in product([-1, 1], repeat=3):
tmp = xyz.copy()
tmp[:, 0] =... | false | 17.391304 | [
"-#!/usr/bin/env python3",
"-# -*- coding: utf-8 -*-",
"+from itertools import product",
"-n, m = list(map(int, input().split()))",
"-xyz = [list(map(int, input().split())) for _ in range(n)]",
"-xyz = np.asarray(xyz)",
"-ans = 0",
"-for i in [-1, 1]:",
"- for j in [-1, 1]:",
"- for k in... | false | 0.873605 | 0.592069 | 1.475512 | [
"s529905335",
"s566306741"
] |
u736729525 | p02948 | python | s735880529 | s188268424 | 672 | 608 | 31,580 | 25,692 | Accepted | Accepted | 9.52 | import heapq
N, M = [int(x) for x in input().split()]
AB = [0] * N
for i in range(N):
AB[i] = [int(x) for x in input().split()]
AB = sorted(AB)
jobs = set()
answer = 0
nextpush = 0
candidates = []
for day in range(M)[::-1]:
while nextpush < N:
a, b = AB[nextpush]
if day + ... | # 優先度キューを使う
import heapq
N, M = [int(x) for x in input().split()]
AB = [0] * N
for i in range(N):
AB[i] = [int(x) for x in input().split()]
# 毎日、候補となる集合を再計算すると間に合わない
# M-1日後から当日に向けて計算してけば、
# day 日時点で day + a = M となる仕事だけを候補に追加することで
# day + 1日までに追加した候補を再利用できる。
# さらに、候補からpopした要素は次回から考慮しないため、設問の条件とも一致する... | 30 | 45 | 540 | 1,021 | import heapq
N, M = [int(x) for x in input().split()]
AB = [0] * N
for i in range(N):
AB[i] = [int(x) for x in input().split()]
AB = sorted(AB)
jobs = set()
answer = 0
nextpush = 0
candidates = []
for day in range(M)[::-1]:
while nextpush < N:
a, b = AB[nextpush]
if day + a <= M:
he... | # 優先度キューを使う
import heapq
N, M = [int(x) for x in input().split()]
AB = [0] * N
for i in range(N):
AB[i] = [int(x) for x in input().split()]
# 毎日、候補となる集合を再計算すると間に合わない
# M-1日後から当日に向けて計算してけば、
# day 日時点で day + a = M となる仕事だけを候補に追加することで
# day + 1日までに追加した候補を再利用できる。
# さらに、候補からpopした要素は次回から考慮しないため、設問の条件とも一致する。
# 仕事の候補、徐々に追加... | false | 33.333333 | [
"+# 優先度キューを使う",
"+# 毎日、候補となる集合を再計算すると間に合わない",
"+# M-1日後から当日に向けて計算してけば、",
"+# day 日時点で day + a = M となる仕事だけを候補に追加することで",
"+# day + 1日までに追加した候補を再利用できる。",
"+# さらに、候補からpopした要素は次回から考慮しないため、設問の条件とも一致する。",
"+# 仕事の候補、徐々に追加していく",
"+candidates = []",
"+# nextpush 次に候補としてpush するか判定するcandidates の添え字",
"+nextpu... | false | 0.040966 | 0.04122 | 0.993835 | [
"s735880529",
"s188268424"
] |
u978178314 | p03330 | python | s326144738 | s307765463 | 1,065 | 741 | 5,620 | 7,540 | Accepted | Accepted | 30.42 | import itertools
N, C = list(map(int, input().split()))
D = [list(map(int, input().split())) for _ in range(C)]
G = [list(map(int, input().split())) for _ in range(N)]
count_color = [[0 for _ in range(C+1)] for _ in range(3)]
for y in range(N):
for x in range(N):
count_color[(x+y)%3][G[y][x]] += 1
ans = 1... | N, C = list(map(int, input().split()))
D = [list(map(int, input().split())) for _ in range(C)]
G = [list(map(int, input().split())) for _ in range(N)]
GC = []
GC.append([0]*C)
GC.append([0]*C)
GC.append([0]*C)
for y in range(N):
for x in range(N):
GC[(y+x)%3][G[y][x]-1] += 1
ans = 1000000000
for a in r... | 18 | 26 | 555 | 633 | import itertools
N, C = list(map(int, input().split()))
D = [list(map(int, input().split())) for _ in range(C)]
G = [list(map(int, input().split())) for _ in range(N)]
count_color = [[0 for _ in range(C + 1)] for _ in range(3)]
for y in range(N):
for x in range(N):
count_color[(x + y) % 3][G[y][x]] += 1
an... | N, C = list(map(int, input().split()))
D = [list(map(int, input().split())) for _ in range(C)]
G = [list(map(int, input().split())) for _ in range(N)]
GC = []
GC.append([0] * C)
GC.append([0] * C)
GC.append([0] * C)
for y in range(N):
for x in range(N):
GC[(y + x) % 3][G[y][x] - 1] += 1
ans = 1000000000
for... | false | 30.769231 | [
"-import itertools",
"-",
"-count_color = [[0 for _ in range(C + 1)] for _ in range(3)]",
"+GC = []",
"+GC.append([0] * C)",
"+GC.append([0] * C)",
"+GC.append([0] * C)",
"- count_color[(x + y) % 3][G[y][x]] += 1",
"-ans = 10**12",
"-for colors in itertools.permutations(list(range(1, C + 1)... | false | 0.042372 | 0.036778 | 1.152109 | [
"s326144738",
"s307765463"
] |
u077291787 | p03044 | python | s805377321 | s741618537 | 547 | 484 | 86,708 | 81,564 | Accepted | Accepted | 11.52 | # ABC126D - Even Relation
import sys
sys.setrecursionlimit(10 ** 9)
def dfs(v: int, p: int) -> None:
for u, w in T[v]:
if u != p:
D[u] = D[v] + w
dfs(u, v)
def main():
global T, D
N, *A = map(int, open(0).read().split())
T = [[] for _ in range(N + 1)]... | # ABC126D - Even Relation
import sys
sys.setrecursionlimit(10 ** 9)
def dfs(v: int, p: int) -> None:
for u, w in T[v]:
if u != p:
D[u] = (D[v] + w) % 2
dfs(u, v)
def main():
global T, D
N, *A = map(int, open(0).read().split())
T = [[] for _ in range(N... | 29 | 28 | 670 | 603 | # ABC126D - Even Relation
import sys
sys.setrecursionlimit(10**9)
def dfs(v: int, p: int) -> None:
for u, w in T[v]:
if u != p:
D[u] = D[v] + w
dfs(u, v)
def main():
global T, D
N, *A = map(int, open(0).read().split())
T = [[] for _ in range(N + 1)]
for i in rang... | # ABC126D - Even Relation
import sys
sys.setrecursionlimit(10**9)
def dfs(v: int, p: int) -> None:
for u, w in T[v]:
if u != p:
D[u] = (D[v] + w) % 2
dfs(u, v)
def main():
global T, D
N, *A = map(int, open(0).read().split())
T = [[] for _ in range(N + 1)]
for i i... | false | 3.448276 | [
"- D[u] = D[v] + w",
"+ D[u] = (D[v] + w) % 2",
"- ans = [i % 2 for i in D[1:]] # same parity of distance -> same group",
"- print(*ans, sep=\"\\n\")",
"+ print(*D[1:], sep=\"\\n\")"
] | false | 0.045378 | 0.063079 | 0.719381 | [
"s805377321",
"s741618537"
] |
u114641312 | p02726 | python | s414861158 | s158596061 | 1,975 | 278 | 12,768 | 47,068 | Accepted | Accepted | 85.92 | # from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
import numpy as np
# import scipy as scp
# strlist = "a... | # from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
# import numpy as np
# import scipy as scp
# strlist = ... | 27 | 27 | 732 | 734 | # from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
import numpy as np
# import scipy as scp
# strlist = "abcdefghijklm... | # from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
# import numpy as np
# import scipy as scp
# strlist = "abcdefghijkl... | false | 0 | [
"-import numpy as np",
"-",
"+# import numpy as np"
] | false | 0.065478 | 0.059768 | 1.095543 | [
"s414861158",
"s158596061"
] |
u997641430 | p02744 | python | s807167592 | s020522264 | 426 | 352 | 4,412 | 4,340 | Accepted | Accepted | 17.37 | # Panasonic2020 D - String Equivalence
def generator(n):
if n == 1:
yield [0]
else:
for A in generator(n - 1):
for i in range(max(A) + 2):
A.append(i)
yield A
A.pop()
n = int(eval(input()))
for A in generator(n):
s =... | def generator(n):
if n == 1:
yield [0]
else:
for A in generator(n - 1):
for i in range(max(A) + 2):
A.append(i)
yield A
A.pop()
n = int(eval(input()))
for A in generator(n):
print((''.join([chr(a + 97) for a in A]))) | 18 | 14 | 375 | 311 | # Panasonic2020 D - String Equivalence
def generator(n):
if n == 1:
yield [0]
else:
for A in generator(n - 1):
for i in range(max(A) + 2):
A.append(i)
yield A
A.pop()
n = int(eval(input()))
for A in generator(n):
s = ""
for a ... | def generator(n):
if n == 1:
yield [0]
else:
for A in generator(n - 1):
for i in range(max(A) + 2):
A.append(i)
yield A
A.pop()
n = int(eval(input()))
for A in generator(n):
print(("".join([chr(a + 97) for a in A])))
| false | 22.222222 | [
"-# Panasonic2020 D - String Equivalence",
"- s = \"\"",
"- for a in A:",
"- s += chr(a + 97)",
"- print(s)",
"+ print((\"\".join([chr(a + 97) for a in A])))"
] | false | 0.069059 | 0.037465 | 1.8433 | [
"s807167592",
"s020522264"
] |
u762420987 | p03043 | python | s097608344 | s811653478 | 43 | 38 | 2,940 | 3,188 | Accepted | Accepted | 11.63 | N,K = list(map(int,input().split()))
res = 0
for i in range(1,N+1):
counter = 0
while i < K:
counter += 1
i *= 2
res += (2**(-counter))
print(((1/N)*res)) | from math import log2, ceil
N, K = list(map(int, input().split()))
ans = 0
for i in range(1, N+1):
if i >= K:
ans += (1/N)
else:
p = K / i
ans += (1/N)*(1/2)**(ceil(log2(p)))
print(ans)
| 9 | 10 | 182 | 221 | N, K = list(map(int, input().split()))
res = 0
for i in range(1, N + 1):
counter = 0
while i < K:
counter += 1
i *= 2
res += 2 ** (-counter)
print(((1 / N) * res))
| from math import log2, ceil
N, K = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
if i >= K:
ans += 1 / N
else:
p = K / i
ans += (1 / N) * (1 / 2) ** (ceil(log2(p)))
print(ans)
| false | 10 | [
"+from math import log2, ceil",
"+",
"-res = 0",
"+ans = 0",
"- counter = 0",
"- while i < K:",
"- counter += 1",
"- i *= 2",
"- res += 2 ** (-counter)",
"-print(((1 / N) * res))",
"+ if i >= K:",
"+ ans += 1 / N",
"+ else:",
"+ p = K / i",
"+ ... | false | 0.132539 | 0.089365 | 1.483116 | [
"s097608344",
"s811653478"
] |
u411353821 | p02898 | python | s854636803 | s722723971 | 56 | 44 | 12,016 | 11,908 | Accepted | Accepted | 21.43 | N, *D, = [list(map(int, s.split())) for s in open(0)]
D = D[0]
num = 0
for i in range(N[0]):
if D[i] >= N[1]:
num += 1
print(num) | def main():
N, k = list(map(int, input().split()))
M = list(map(int, input().split()))
num = 0
for m in M:
if m >= k:
num += 1
print(num)
if __name__ == "__main__":
main()
| 8 | 12 | 157 | 223 | (
N,
*D,
) = [list(map(int, s.split())) for s in open(0)]
D = D[0]
num = 0
for i in range(N[0]):
if D[i] >= N[1]:
num += 1
print(num)
| def main():
N, k = list(map(int, input().split()))
M = list(map(int, input().split()))
num = 0
for m in M:
if m >= k:
num += 1
print(num)
if __name__ == "__main__":
main()
| false | 33.333333 | [
"-(",
"- N,",
"- *D,",
"-) = [list(map(int, s.split())) for s in open(0)]",
"-D = D[0]",
"-num = 0",
"-for i in range(N[0]):",
"- if D[i] >= N[1]:",
"- num += 1",
"-print(num)",
"+def main():",
"+ N, k = list(map(int, input().split()))",
"+ M = list(map(int, input().spl... | false | 0.038153 | 0.032809 | 1.16289 | [
"s854636803",
"s722723971"
] |
u609061751 | p03387 | python | s713096324 | s609547826 | 176 | 18 | 38,256 | 3,064 | Accepted | Accepted | 89.77 | import sys
input = sys.stdin.readline
a = [int(x) for x in input().split()]
cnt = 0
a.sort()
cnt += a[-1] - a[1]
a[0] += cnt
if (a[-1] - a[0]) % 2 == 1:
cnt += 1
a[-1] += 1
cnt += (a[-1] - a[0]) // 2
print(cnt) | import sys
input = sys.stdin.readline
a = [int(x) for x in input().split()]
a.sort()
ans = 0
ans += a[2] - a[1]
a[0] += ans
if (a[2] - a[0]) % 2 == 0:
ans += (a[2] - a[0])//2
print(ans)
else:
ans += (a[2] - a[0])//2
ans += 2
print(ans)
| 13 | 16 | 235 | 273 | import sys
input = sys.stdin.readline
a = [int(x) for x in input().split()]
cnt = 0
a.sort()
cnt += a[-1] - a[1]
a[0] += cnt
if (a[-1] - a[0]) % 2 == 1:
cnt += 1
a[-1] += 1
cnt += (a[-1] - a[0]) // 2
print(cnt)
| import sys
input = sys.stdin.readline
a = [int(x) for x in input().split()]
a.sort()
ans = 0
ans += a[2] - a[1]
a[0] += ans
if (a[2] - a[0]) % 2 == 0:
ans += (a[2] - a[0]) // 2
print(ans)
else:
ans += (a[2] - a[0]) // 2
ans += 2
print(ans)
| false | 18.75 | [
"-cnt = 0",
"-cnt += a[-1] - a[1]",
"-a[0] += cnt",
"-if (a[-1] - a[0]) % 2 == 1:",
"- cnt += 1",
"- a[-1] += 1",
"-cnt += (a[-1] - a[0]) // 2",
"-print(cnt)",
"+ans = 0",
"+ans += a[2] - a[1]",
"+a[0] += ans",
"+if (a[2] - a[0]) % 2 == 0:",
"+ ans += (a[2] - a[0]) // 2",
"+ pr... | false | 0.13181 | 0.042597 | 3.094332 | [
"s713096324",
"s609547826"
] |
u475503988 | p03196 | python | s999671602 | s218479232 | 129 | 86 | 3,316 | 3,316 | Accepted | Accepted | 33.33 | N, P = list(map(int, input().split()))
from collections import defaultdict
d = defaultdict(int)
i = 2
while P >= i*i:
if P%i==0:
P //= i
d[i] += 1
# elif i == 2:
# i += 1
else:
i += 1
# i += 2
if P != 1:
d[P] += 1
ans = 1
for k, v in list(d.ite... | N, P = list(map(int, input().split()))
from collections import defaultdict
d = defaultdict(int)
i = 2
while P >= i*i:
if P%i==0:
P //= i
d[i] += 1
elif i == 2:
i += 1
else:
i += 2
if P != 1:
d[P] += 1
ans = 1
for k, v in list(d.items()):
# print(k,... | 23 | 24 | 379 | 403 | N, P = list(map(int, input().split()))
from collections import defaultdict
d = defaultdict(int)
i = 2
while P >= i * i:
if P % i == 0:
P //= i
d[i] += 1
# elif i == 2:
# i += 1
else:
i += 1
# i += 2
if P != 1:
d[P] += 1
ans = 1
for k, v in list(d.items()):
# ... | N, P = list(map(int, input().split()))
from collections import defaultdict
d = defaultdict(int)
i = 2
while P >= i * i:
if P % i == 0:
P //= i
d[i] += 1
elif i == 2:
i += 1
else:
i += 2
if P != 1:
d[P] += 1
ans = 1
for k, v in list(d.items()):
# print(k, v)
if v ... | false | 4.166667 | [
"- # elif i == 2:",
"- # i += 1",
"+ elif i == 2:",
"+ i += 1",
"- i += 1",
"- # i += 2",
"+ i += 2",
"- z = v // N",
"- ans *= k**z",
"+ if v >= N:",
"+ ans *= k ** (v // N)",
"+ # z = v // N",
"+ # ans *= k**z"
] | false | 0.048669 | 0.086654 | 0.561655 | [
"s999671602",
"s218479232"
] |
u744920373 | p02713 | python | s250809691 | s185403539 | 853 | 593 | 75,948 | 137,576 | Accepted | Accepted | 30.48 | 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... | 51 | 43 | 1,704 | 1,528 | 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 | 15.686275 | [
"- for j in range(i + 1, K + 1):",
"- for k in range(j + 1, K + 1):",
"- \"\"\"",
"- #l = sorted([i, j, k])",
"- l = [i, j, k]",
"- a, b, c = l[0], l[1], l[2]",
"+ for j in range(1, K + 1):",
"+ for k in range(1, K + 1):",
"+ ... | false | 0.076621 | 0.040432 | 1.89506 | [
"s250809691",
"s185403539"
] |
u137226361 | p02935 | python | s530246526 | s613101636 | 31 | 27 | 9,136 | 9,152 | Accepted | Accepted | 12.9 | n = int(eval(input()))
v =list(map(int, input().split()))
v.sort()
a = (v[0]+v[1])/2
for i in range(2, n):
a = (a+v[i])/2
print(a) | n = int(eval(input()))
v =list(map(int, input().split()))
v.sort()
a = v[0]
for i in range(1, n):
a = (a+v[i])/2
print(a) | 12 | 12 | 144 | 135 | n = int(eval(input()))
v = list(map(int, input().split()))
v.sort()
a = (v[0] + v[1]) / 2
for i in range(2, n):
a = (a + v[i]) / 2
print(a)
| n = int(eval(input()))
v = list(map(int, input().split()))
v.sort()
a = v[0]
for i in range(1, n):
a = (a + v[i]) / 2
print(a)
| false | 0 | [
"-a = (v[0] + v[1]) / 2",
"-for i in range(2, n):",
"+a = v[0]",
"+for i in range(1, n):"
] | false | 0.05776 | 0.036302 | 1.591084 | [
"s530246526",
"s613101636"
] |
u545368057 | p03639 | python | s437444074 | s014513539 | 71 | 65 | 14,252 | 15,020 | Accepted | Accepted | 8.45 | n = int(eval(input()))
As = list(map(int, input().split()))
four = sum([1 for a in As if a%4 == 0])
odd = sum([1 for a in As if a%2 == 1])
two = sum([1 for a in As if a%2 == 0 and a%4 != 0])
if four < two%2 + odd - 1:
print("No")
else:
print("Yes") | n = int(eval(input()))
As = list(map(int, input().split()))
# four = sum([1 for a in As if a%4 == 0])
# odd = sum([1 for a in As if a%2 == 1])
# two = sum([1 for a in As if a%2 == 0 and a%4 != 0])
four = 0
odd = 0
two = 0
for a in As:
if a % 2 == 1:
odd += 1
elif a % 4 == 0:
four +... | 10 | 23 | 260 | 423 | n = int(eval(input()))
As = list(map(int, input().split()))
four = sum([1 for a in As if a % 4 == 0])
odd = sum([1 for a in As if a % 2 == 1])
two = sum([1 for a in As if a % 2 == 0 and a % 4 != 0])
if four < two % 2 + odd - 1:
print("No")
else:
print("Yes")
| n = int(eval(input()))
As = list(map(int, input().split()))
# four = sum([1 for a in As if a%4 == 0])
# odd = sum([1 for a in As if a%2 == 1])
# two = sum([1 for a in As if a%2 == 0 and a%4 != 0])
four = 0
odd = 0
two = 0
for a in As:
if a % 2 == 1:
odd += 1
elif a % 4 == 0:
four += 1
else:
... | false | 56.521739 | [
"-four = sum([1 for a in As if a % 4 == 0])",
"-odd = sum([1 for a in As if a % 2 == 1])",
"-two = sum([1 for a in As if a % 2 == 0 and a % 4 != 0])",
"+# four = sum([1 for a in As if a%4 == 0])",
"+# odd = sum([1 for a in As if a%2 == 1])",
"+# two = sum([1 for a in As if a%2 == 0 and a%4 != 0])",
"+fo... | false | 0.036654 | 0.040136 | 0.913243 | [
"s437444074",
"s014513539"
] |
u945181840 | p02901 | python | s839405099 | s296572505 | 1,433 | 549 | 3,188 | 3,188 | Accepted | Accepted | 61.69 | import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
INF = 10 ** 10
p = 2 ** N
dp = [INF] * p
dp[0] = 0
for _ in range(M):
a, b = list(map(int, input().split()))
c = sum([2 ** (i - 1) for i in map(int, input().split())])
... | import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
INF = 10 ** 10
p = 2 ** N
dp = [INF] * p
dp[0] = 0
for _ in range(M):
a, b = list(map(int, input().split()))
c = sum([2 ** (i - 1) for i in map(int, input().split())])
... | 25 | 26 | 501 | 528 | import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
INF = 10**10
p = 2**N
dp = [INF] * p
dp[0] = 0
for _ in range(M):
a, b = list(map(int, input().split()))
c = sum([2 ** (i - 1) for i in map(int, input().split())])
for i in range(p... | import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
INF = 10**10
p = 2**N
dp = [INF] * p
dp[0] = 0
for _ in range(M):
a, b = list(map(int, input().split()))
c = sum([2 ** (i - 1) for i in map(int, input().split())])
for i in range(p... | false | 3.846154 | [
"- dp[i | c] = min(dp[i] + a, dp[i | c])",
"+ if dp[i | c] > dp[i] + a:",
"+ dp[i | c] = dp[i] + a"
] | false | 0.037266 | 0.043634 | 0.854071 | [
"s839405099",
"s296572505"
] |
u780698286 | p02897 | python | s995612731 | s034326854 | 28 | 24 | 9,028 | 9,048 | Accepted | Accepted | 14.29 | n = int(eval(input()))
if n % 2 == 0:
print((0.5))
else:
print(((n//2 + 1) / n)) | n = int(eval(input()))
if n % 2 == 0:
print((0.5))
else:
print(((n+1)//2/n)) | 5 | 5 | 78 | 78 | n = int(eval(input()))
if n % 2 == 0:
print((0.5))
else:
print(((n // 2 + 1) / n))
| n = int(eval(input()))
if n % 2 == 0:
print((0.5))
else:
print(((n + 1) // 2 / n))
| false | 0 | [
"- print(((n // 2 + 1) / n))",
"+ print(((n + 1) // 2 / n))"
] | false | 0.041407 | 0.037039 | 1.117941 | [
"s995612731",
"s034326854"
] |
u150984829 | p02272 | python | s442570685 | s597420203 | 3,500 | 3,070 | 61,872 | 63,912 | Accepted | Accepted | 12.29 | def m(L,R):
global c;c+=len(L)+len(R)
T=[];j=0
for l in L:
while j-len(R)and R[j]<l:T+=[R[j]];j+=1
T+=[l]
while j-len(R):T+=[R[j]];j+=1
return T
def d(A):s=len(A)//2;return m(d(A[:s]),d(A[s:])) if len(A)>1 else A
c=0
eval(input())
print((*d(list(map(int,input().split())))))
print(c)
| def m(L,R):
global c;c+=len(L)+len(R)
T=[]
for l in L[::-1]:
while R and R[-1]>l:T+=[R.pop()]
T+=[l]
T+=R[::-1]
return T[::-1]
def d(A):s=len(A)//2;return m(d(A[:s]),d(A[s:])) if len(A)>1 else A
c=0
eval(input())
print((*d(list(map(int,input().split())))))
print(c)
| 13 | 13 | 297 | 279 | def m(L, R):
global c
c += len(L) + len(R)
T = []
j = 0
for l in L:
while j - len(R) and R[j] < l:
T += [R[j]]
j += 1
T += [l]
while j - len(R):
T += [R[j]]
j += 1
return T
def d(A):
s = len(A) // 2
return m(d(A[:s]), d(A[s:])... | def m(L, R):
global c
c += len(L) + len(R)
T = []
for l in L[::-1]:
while R and R[-1] > l:
T += [R.pop()]
T += [l]
T += R[::-1]
return T[::-1]
def d(A):
s = len(A) // 2
return m(d(A[:s]), d(A[s:])) if len(A) > 1 else A
c = 0
eval(input())
print((*d(list(ma... | false | 0 | [
"- j = 0",
"- for l in L:",
"- while j - len(R) and R[j] < l:",
"- T += [R[j]]",
"- j += 1",
"+ for l in L[::-1]:",
"+ while R and R[-1] > l:",
"+ T += [R.pop()]",
"- while j - len(R):",
"- T += [R[j]]",
"- j += 1",
"- ... | false | 0.04225 | 0.036861 | 1.14617 | [
"s442570685",
"s597420203"
] |
u620084012 | p03862 | python | s081999444 | s010340052 | 224 | 114 | 63,984 | 14,252 | Accepted | Accepted | 49.11 | N, x = list(map(int,input().split()))
a = list(map(int,input().split()))
ans = 0
for k in range(1,N):
if a[k-1] + a[k] > x:
if a[k]+a[k-1]-x <= a[k]:
ans += (a[k]+a[k-1])-x
a[k] -= (a[k]+a[k-1])-x
else:
ans += a[k]+a[k-1]-x
a[k-1] -= a[k]-x
... | N, x = list(map(int,input().split()))
a = list(map(int,input().split()))
ans = 0
for k in range(1,N):
if a[k-1] + a[k] > x:
t = (a[k-1] + a[k]) - x
ans += t
if a[k] >= t:
a[k] -= t
else:
a[k-1] -= t-a[k]
a[k] = 0
print(ans)
| 13 | 14 | 347 | 304 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for k in range(1, N):
if a[k - 1] + a[k] > x:
if a[k] + a[k - 1] - x <= a[k]:
ans += (a[k] + a[k - 1]) - x
a[k] -= (a[k] + a[k - 1]) - x
else:
ans += a[k] + a[k - 1] - x
... | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for k in range(1, N):
if a[k - 1] + a[k] > x:
t = (a[k - 1] + a[k]) - x
ans += t
if a[k] >= t:
a[k] -= t
else:
a[k - 1] -= t - a[k]
a[k] = 0
print(ans)
| false | 7.142857 | [
"- if a[k] + a[k - 1] - x <= a[k]:",
"- ans += (a[k] + a[k - 1]) - x",
"- a[k] -= (a[k] + a[k - 1]) - x",
"+ t = (a[k - 1] + a[k]) - x",
"+ ans += t",
"+ if a[k] >= t:",
"+ a[k] -= t",
"- ans += a[k] + a[k - 1] - x",
"- ... | false | 0.030828 | 0.036096 | 0.854062 | [
"s081999444",
"s010340052"
] |
u723792785 | p02676 | python | s268010494 | s363830052 | 22 | 20 | 9,164 | 9,168 | Accepted | Accepted | 9.09 | k = int(eval(input()))
s = eval(input())
lens = len(s)
if lens > k:
print((s[0:k]+"..."))
else:
print(s) | k=int(eval(input()));s=eval(input());l=len(s)
print((s[0:min(k,l)]+"."*3*(k<l))) | 7 | 2 | 98 | 67 | k = int(eval(input()))
s = eval(input())
lens = len(s)
if lens > k:
print((s[0:k] + "..."))
else:
print(s)
| k = int(eval(input()))
s = eval(input())
l = len(s)
print((s[0 : min(k, l)] + "." * 3 * (k < l)))
| false | 71.428571 | [
"-lens = len(s)",
"-if lens > k:",
"- print((s[0:k] + \"...\"))",
"-else:",
"- print(s)",
"+l = len(s)",
"+print((s[0 : min(k, l)] + \".\" * 3 * (k < l)))"
] | false | 0.038457 | 0.03694 | 1.041074 | [
"s268010494",
"s363830052"
] |
u417791069 | p02971 | python | s270728418 | s843551307 | 580 | 296 | 14,112 | 25,036 | Accepted | Accepted | 48.97 | n = int(eval(input()))
l = []
for i in range(n):
l.append(int(eval(input())))
l_b = sorted(l)
max_a = l_b[-1]
max_b = l_b[-2]
for j in range(len(l)):
if max_a == l[j]:
print(max_b)
else:
print(max_a)
| N, *l = list(map(int, open(0).read().split()))
l_b = sorted(l)
max_a = l_b[-1]
max_b = l_b[-2]
for j in range(N):
if max_a == l[j]:
print(max_b)
else:
print(max_a)
| 14 | 11 | 231 | 194 | n = int(eval(input()))
l = []
for i in range(n):
l.append(int(eval(input())))
l_b = sorted(l)
max_a = l_b[-1]
max_b = l_b[-2]
for j in range(len(l)):
if max_a == l[j]:
print(max_b)
else:
print(max_a)
| N, *l = list(map(int, open(0).read().split()))
l_b = sorted(l)
max_a = l_b[-1]
max_b = l_b[-2]
for j in range(N):
if max_a == l[j]:
print(max_b)
else:
print(max_a)
| false | 21.428571 | [
"-n = int(eval(input()))",
"-l = []",
"-for i in range(n):",
"- l.append(int(eval(input())))",
"+N, *l = list(map(int, open(0).read().split()))",
"-for j in range(len(l)):",
"+for j in range(N):"
] | false | 0.038533 | 0.037434 | 1.029343 | [
"s270728418",
"s843551307"
] |
u528470578 | p02899 | python | s098326677 | s277251613 | 301 | 256 | 23,036 | 100,124 | Accepted | Accepted | 14.95 | N = int(input())
A = list(map(int, input().split()))
An = [[i+1, A[i]] for i in range(N)]
An = sorted(An, key=lambda x: x[1])
for i in range(N):
print(An[i][0], end=" ")
| N = int(input())
A = list(map(int, input().split()))
d = []
for n in range(N):
d.append([A[n], n])
d = sorted(d, key=lambda x:x[0])
for i, j in d:
print(j+1, end=" ")
| 6 | 8 | 178 | 181 | N = int(input())
A = list(map(int, input().split()))
An = [[i + 1, A[i]] for i in range(N)]
An = sorted(An, key=lambda x: x[1])
for i in range(N):
print(An[i][0], end=" ")
| N = int(input())
A = list(map(int, input().split()))
d = []
for n in range(N):
d.append([A[n], n])
d = sorted(d, key=lambda x: x[0])
for i, j in d:
print(j + 1, end=" ")
| false | 25 | [
"-An = [[i + 1, A[i]] for i in range(N)]",
"-An = sorted(An, key=lambda x: x[1])",
"-for i in range(N):",
"- print(An[i][0], end=\" \")",
"+d = []",
"+for n in range(N):",
"+ d.append([A[n], n])",
"+d = sorted(d, key=lambda x: x[0])",
"+for i, j in d:",
"+ print(j + 1, end=\" \")"
] | false | 0.071208 | 0.072586 | 0.981018 | [
"s098326677",
"s277251613"
] |
u089376182 | p03220 | python | s285228613 | s366210147 | 20 | 18 | 3,060 | 3,060 | Accepted | Accepted | 10 | n = int(eval(input()))
t, a = list(map(int, input().split()))
diff_list = [abs(t-h_i*0.006-a) for h_i in map(int, input().split())]
print((diff_list.index(min(diff_list))+1)) | n = int(eval(input()))
t,a = list(map(int, input().split()))
tmp_diff_list = [abs(t-i*0.006-a) for i in list(map(int, input().split()))]
print((tmp_diff_list.index(min(tmp_diff_list))+1)) | 4 | 6 | 163 | 180 | n = int(eval(input()))
t, a = list(map(int, input().split()))
diff_list = [abs(t - h_i * 0.006 - a) for h_i in map(int, input().split())]
print((diff_list.index(min(diff_list)) + 1))
| n = int(eval(input()))
t, a = list(map(int, input().split()))
tmp_diff_list = [abs(t - i * 0.006 - a) for i in list(map(int, input().split()))]
print((tmp_diff_list.index(min(tmp_diff_list)) + 1))
| false | 33.333333 | [
"-diff_list = [abs(t - h_i * 0.006 - a) for h_i in map(int, input().split())]",
"-print((diff_list.index(min(diff_list)) + 1))",
"+tmp_diff_list = [abs(t - i * 0.006 - a) for i in list(map(int, input().split()))]",
"+print((tmp_diff_list.index(min(tmp_diff_list)) + 1))"
] | false | 0.040646 | 0.039671 | 1.024582 | [
"s285228613",
"s366210147"
] |
u597374218 | p02790 | python | s793492882 | s227080820 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a,b=input().split()
print((min(a*int(b),b*int(a)))) | a, b = input().split()
print((a*int(b) if a < b else b*int(a))) | 2 | 2 | 50 | 62 | a, b = input().split()
print((min(a * int(b), b * int(a))))
| a, b = input().split()
print((a * int(b) if a < b else b * int(a)))
| false | 0 | [
"-print((min(a * int(b), b * int(a))))",
"+print((a * int(b) if a < b else b * int(a)))"
] | false | 0.067197 | 0.069042 | 0.973267 | [
"s793492882",
"s227080820"
] |
u023229441 | p02972 | python | s908873003 | s879939033 | 245 | 191 | 14,124 | 13,508 | Accepted | Accepted | 22.04 | n=int(eval(input()))
A=list(map(int,input().split()))[::-1]
B=[0]*n
for i in range(n):
k=n-i
if A[i]!=(B[k-1::k].count(1))%2:
B[k-1]=1
o=B.count(1)
print(o)
P=[[i+1 for i, x in enumerate(B) if x ==1]]
if o!=0:
print((*P[0]))
| n=int(eval(input()))
A=list(map(int,input().split()))
B=[0 for i in range(n)]
B[n//2:]=A[n//2:]
for i in range(n//2,0,-1):
B[i-1]= (sum(B[i*2-1::i])%2 != A[i-1])
print((sum(B)))
for i,j in enumerate(B):
if j==1:
print((i+1)) | 13 | 13 | 244 | 245 | n = int(eval(input()))
A = list(map(int, input().split()))[::-1]
B = [0] * n
for i in range(n):
k = n - i
if A[i] != (B[k - 1 :: k].count(1)) % 2:
B[k - 1] = 1
o = B.count(1)
print(o)
P = [[i + 1 for i, x in enumerate(B) if x == 1]]
if o != 0:
print((*P[0]))
| n = int(eval(input()))
A = list(map(int, input().split()))
B = [0 for i in range(n)]
B[n // 2 :] = A[n // 2 :]
for i in range(n // 2, 0, -1):
B[i - 1] = sum(B[i * 2 - 1 :: i]) % 2 != A[i - 1]
print((sum(B)))
for i, j in enumerate(B):
if j == 1:
print((i + 1))
| false | 0 | [
"-A = list(map(int, input().split()))[::-1]",
"-B = [0] * n",
"-for i in range(n):",
"- k = n - i",
"- if A[i] != (B[k - 1 :: k].count(1)) % 2:",
"- B[k - 1] = 1",
"-o = B.count(1)",
"-print(o)",
"-P = [[i + 1 for i, x in enumerate(B) if x == 1]]",
"-if o != 0:",
"- print((*P[0])... | false | 0.037599 | 0.035969 | 1.045319 | [
"s908873003",
"s879939033"
] |
u984276646 | p02623 | python | s907625562 | s727463025 | 1,313 | 1,190 | 48,292 | 47,316 | Accepted | Accepted | 9.37 | N, M, K = list(map(int, input().split()))
INF = int(1e18)
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = A[:]
B = B[:]
i, j = 0, 0
mcnt = 0
tmp = M+1
ccnt = 0
while tmp != 0:
ccnt += 1
tmp //= 2
LA = [0 for _ in range(N+1)]
LB = [0 for _ in range(M+1)]
for i in range(N):
... | N, M, K = list(map(int, input().split()))
INF = int(1e18)
A = list(map(int, input().split()))
B = list(map(int, input().split()))
i, j = 0, 0
mcnt = 0
tmp = M+1
ccnt = 0
while tmp != 0:
ccnt += 1
tmp //= 2
LA = [0 for _ in range(N+1)]
LB = [0 for _ in range(M+1)]
for i in range(N):
LA[i+1] = LA[i] +... | 37 | 35 | 766 | 747 | N, M, K = list(map(int, input().split()))
INF = int(1e18)
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = A[:]
B = B[:]
i, j = 0, 0
mcnt = 0
tmp = M + 1
ccnt = 0
while tmp != 0:
ccnt += 1
tmp //= 2
LA = [0 for _ in range(N + 1)]
LB = [0 for _ in range(M + 1)]
for i in range(N):
L... | N, M, K = list(map(int, input().split()))
INF = int(1e18)
A = list(map(int, input().split()))
B = list(map(int, input().split()))
i, j = 0, 0
mcnt = 0
tmp = M + 1
ccnt = 0
while tmp != 0:
ccnt += 1
tmp //= 2
LA = [0 for _ in range(N + 1)]
LB = [0 for _ in range(M + 1)]
for i in range(N):
LA[i + 1] = LA[i] +... | false | 5.405405 | [
"-A = A[:]",
"-B = B[:]"
] | false | 0.115444 | 0.068388 | 1.688083 | [
"s907625562",
"s727463025"
] |
u622045059 | p03476 | python | s340554310 | s235178639 | 533 | 334 | 32,140 | 15,796 | Accepted | Accepted | 37.34 | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def... | # python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大... | 59 | 65 | 1,864 | 2,170 | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
def gcd(a, b):
return fractions.gcd(a, b) # 最大公約数
def lcm(a, b):
return (a * b) // fractions.gcd(a, b)... | # python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
INF = float("inf") # 無限大
def gcd(a, b):
return fractions.gcd(a, b) # 最... | false | 9.230769 | [
"+# python3.4.2用",
"+from decimal import *",
"+INF = float(\"inf\") # 無限大",
"- return int(eval(input())) # 整数読み込み",
"+ return int(sys.stdin.readline()) # 整数読み込み",
"- return float(eval(input())) # 浮動小数点読み込み",
"+ return float(sys.stdin.readline()) # 浮動小数点読み込み",
"- return input().spli... | false | 0.080753 | 0.145876 | 0.553574 | [
"s340554310",
"s235178639"
] |
u749321340 | p02726 | python | s566145131 | s154525743 | 1,963 | 307 | 36,852 | 76,124 | Accepted | Accepted | 84.36 | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
cnt = [0] * n
dist = []
for i in range(n):
dist.append([-1] * n)
for i in range(n):
dist[i][x] = abs(i-x)
dist[i][y] = abs(i-y)
dist[x][i] = abs(i-x)
dist[y][i] = abs(i-y)
for i in range(n):
for j in range(n):
if... | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
cnt = [0] * n
dist = []
for i in range(n):
dist.append([-1] * n)
for i in range(n):
dist[i][x] = abs(i-x)
dist[i][y] = abs(i-y)
dist[x][i] = abs(i-x)
dist[y][i] = abs(i-y)
for i in range(n):
for j in range(n):
if... | 23 | 23 | 500 | 471 | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
cnt = [0] * n
dist = []
for i in range(n):
dist.append([-1] * n)
for i in range(n):
dist[i][x] = abs(i - x)
dist[i][y] = abs(i - y)
dist[x][i] = abs(i - x)
dist[y][i] = abs(i - y)
for i in range(n):
for j in range(n):
if i >= j:
... | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
cnt = [0] * n
dist = []
for i in range(n):
dist.append([-1] * n)
for i in range(n):
dist[i][x] = abs(i - x)
dist[i][y] = abs(i - y)
dist[x][i] = abs(i - x)
dist[y][i] = abs(i - y)
for i in range(n):
for j in range(n):
if i >= j:
... | false | 0 | [
"- dis = min(j - i, dist[j][y] + 1 + dist[i][x], dist[j][x] + 1 + dist[i][y])",
"+ dis = min(j - i, dist[i][x] + 1 + dist[y][j])"
] | false | 0.038817 | 0.033417 | 1.161597 | [
"s566145131",
"s154525743"
] |
u141786930 | p02913 | python | s766167541 | s028786786 | 81 | 74 | 6,388 | 6,388 | Accepted | Accepted | 8.64 | n = int(eval(input()))
s = eval(input())
high = n//2
low = 1
ans = 0
while low <= high:
t = set()
i = (high+low)//2
for j in range(n-i*2+1):
t.add(s[j:i+j])
if s[i+j:j+2*i] in t:
if ans < i:
ans = i
low = i+1
break
... | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
s = eval(input())
high = n//2
low = 1
ans = 0
while low <= high:
t = set()
i = (high+low)//2
for j in range(n-i*2+1):
t.add(s[j:i+j])
if s[i+j:j+2*i] in t:
... | 19 | 26 | 355 | 525 | n = int(eval(input()))
s = eval(input())
high = n // 2
low = 1
ans = 0
while low <= high:
t = set()
i = (high + low) // 2
for j in range(n - i * 2 + 1):
t.add(s[j : i + j])
if s[i + j : j + 2 * i] in t:
if ans < i:
ans = i
low = i + 1
... | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
s = eval(input())
high = n // 2
low = 1
ans = 0
while low <= high:
t = set()
i = (high + low) // 2
for j in range(n - i * 2 + 1):
t.add(s[j : i + j])
if s[i + j : j + 2 * i... | false | 26.923077 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-high = n // 2",
"-low = 1",
"-ans = 0",
"-while low <= high:",
"- t = set()",
"- i = (high + low) // 2",
"- for j in range(n - i * 2 + 1):",
"- t.add(s[j : i + j])",
"- if s[i + j : j + 2 * i] in t:",
"- if an... | false | 0.042421 | 0.042532 | 0.99738 | [
"s766167541",
"s028786786"
] |
u994502918 | p02708 | python | s426723498 | s375267625 | 123 | 106 | 9,616 | 9,152 | Accepted | Accepted | 13.82 | import itertools
import math
from functools import reduce
n, k = list(map(int, input().split()))
pattern = 0
for i in range(k, n + 2):
min = i * (0 + i - 1) // 2
max = i * (n + n - i + 1) // 2
pattern += max - min + 1
pattern %= 10 ** 9 + 7
print(pattern) | n, k = list(map(int, input().split()))
pattern = 0
for i in range(k, n + 2):
min = (0 + i - 1) // 2 * i
max = ((n - i) + (1 + n)) // 2 * i
pattern += max - min + 1
pattern %= 10 ** 9 + 7
print(pattern) | 16 | 12 | 289 | 226 | import itertools
import math
from functools import reduce
n, k = list(map(int, input().split()))
pattern = 0
for i in range(k, n + 2):
min = i * (0 + i - 1) // 2
max = i * (n + n - i + 1) // 2
pattern += max - min + 1
pattern %= 10**9 + 7
print(pattern)
| n, k = list(map(int, input().split()))
pattern = 0
for i in range(k, n + 2):
min = (0 + i - 1) // 2 * i
max = ((n - i) + (1 + n)) // 2 * i
pattern += max - min + 1
pattern %= 10**9 + 7
print(pattern)
| false | 25 | [
"-import itertools",
"-import math",
"-from functools import reduce",
"-",
"- min = i * (0 + i - 1) // 2",
"- max = i * (n + n - i + 1) // 2",
"+ min = (0 + i - 1) // 2 * i",
"+ max = ((n - i) + (1 + n)) // 2 * i"
] | false | 0.100429 | 0.098216 | 1.022529 | [
"s426723498",
"s375267625"
] |
u340781749 | p02726 | python | s375778952 | s756878181 | 1,573 | 1,417 | 3,188 | 3,188 | Accepted | Accepted | 9.92 | n, x, y = list(map(int, input().split()))
ans = [0] * n
for i in range(1, n):
for j in range(i + 1, n + 1):
if i < x:
if j < x:
d = j - i
elif x <= j <= y:
d = min(j - i, y - j + x - i + 1)
else:
d = j - y + x - ... | n, x, y = list(map(int, input().split()))
ans = [0] * n
for i in range(1, n):
for j in range(i + 1, n + 1):
ans[min(j - i, abs(i - x) + abs(j - y) + 1)] += 1
print(('\n'.join(map(str, ans[1:]))))
| 22 | 7 | 596 | 213 | n, x, y = list(map(int, input().split()))
ans = [0] * n
for i in range(1, n):
for j in range(i + 1, n + 1):
if i < x:
if j < x:
d = j - i
elif x <= j <= y:
d = min(j - i, y - j + x - i + 1)
else:
d = j - y + x - i + 1
... | n, x, y = list(map(int, input().split()))
ans = [0] * n
for i in range(1, n):
for j in range(i + 1, n + 1):
ans[min(j - i, abs(i - x) + abs(j - y) + 1)] += 1
print(("\n".join(map(str, ans[1:]))))
| false | 68.181818 | [
"- if i < x:",
"- if j < x:",
"- d = j - i",
"- elif x <= j <= y:",
"- d = min(j - i, y - j + x - i + 1)",
"- else:",
"- d = j - y + x - i + 1",
"- elif x <= i <= y:",
"- if j <= y:",
"- ... | false | 0.096968 | 0.040136 | 2.415972 | [
"s375778952",
"s756878181"
] |
u633255271 | p02629 | python | s598220343 | s329602077 | 85 | 68 | 61,668 | 61,628 | Accepted | Accepted | 20 | N = int(eval(input()))
ans = ''
while N != 0:
N -= 1
ans += chr(ord('a') + N%26)
N //= 26
print((ans[::-1])) | N = int(eval(input()))
n = N
ans = ''
while n > 0:
n -= 1
ans = chr(ord('a') + n%26) + ans
n //= 26
print(ans) | 7 | 8 | 118 | 117 | N = int(eval(input()))
ans = ""
while N != 0:
N -= 1
ans += chr(ord("a") + N % 26)
N //= 26
print((ans[::-1]))
| N = int(eval(input()))
n = N
ans = ""
while n > 0:
n -= 1
ans = chr(ord("a") + n % 26) + ans
n //= 26
print(ans)
| false | 12.5 | [
"+n = N",
"-while N != 0:",
"- N -= 1",
"- ans += chr(ord(\"a\") + N % 26)",
"- N //= 26",
"-print((ans[::-1]))",
"+while n > 0:",
"+ n -= 1",
"+ ans = chr(ord(\"a\") + n % 26) + ans",
"+ n //= 26",
"+print(ans)"
] | false | 0.040427 | 0.040821 | 0.990329 | [
"s598220343",
"s329602077"
] |
u600402037 | p02780 | python | s034095331 | s963537406 | 299 | 208 | 33,740 | 33,964 | Accepted | Accepted | 30.43 | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
P = np.array([0] + lr(), np.float64)
P = (P+1) / 2
Pcum = P.cumsum()
expectation = Pcum[K:] - Pcum[:-K]
answer = expectation.max()
print(a... | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
P = np.array(lr())
P = np.hstack([[0], P+1])
Pcum = P.cumsum()
result = Pcum[K:] - Pcum[:-K]
answer = result.max()
print((answer / 2))
| 15 | 15 | 327 | 315 | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
P = np.array([0] + lr(), np.float64)
P = (P + 1) / 2
Pcum = P.cumsum()
expectation = Pcum[K:] - Pcum[:-K]
answer = expectation.max()
print(answer)
| # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
P = np.array(lr())
P = np.hstack([[0], P + 1])
Pcum = P.cumsum()
result = Pcum[K:] - Pcum[:-K]
answer = result.max()
print((answer / 2))
| false | 0 | [
"-P = np.array([0] + lr(), np.float64)",
"-P = (P + 1) / 2",
"+P = np.array(lr())",
"+P = np.hstack([[0], P + 1])",
"-expectation = Pcum[K:] - Pcum[:-K]",
"-answer = expectation.max()",
"-print(answer)",
"+result = Pcum[K:] - Pcum[:-K]",
"+answer = result.max()",
"+print((answer / 2))"
] | false | 0.22568 | 0.339694 | 0.664362 | [
"s034095331",
"s963537406"
] |
u067983636 | p02629 | python | s024198429 | s909795198 | 112 | 64 | 68,836 | 61,880 | Accepted | Accepted | 42.86 | import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 998244353
def read_values(): return list(map(int, input().split()))
def read_index(): return [int(x) - 1 for x in inpu... | N = int(eval(input()))
res = ""
while N > 0:
r = (N - 1) % 26
res = chr(r + 97) + res
N -= r + 1
N //= 26
print(res) | 36 | 9 | 712 | 135 | import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 998244353
def read_values():
return list(map(int, input().split()))
def read_index():
return [int(x) - 1 for x in input... | N = int(eval(input()))
res = ""
while N > 0:
r = (N - 1) % 26
res = chr(r + 97) + res
N -= r + 1
N //= 26
print(res)
| false | 75 | [
"-import bisect",
"-import copy",
"-import heapq",
"-import sys",
"-import itertools",
"-import math",
"-import queue",
"-from functools import lru_cache",
"-",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(1000000)",
"-mod = 998244353",
"-",
"-",
"-def read_values():",
"- ... | false | 0.045222 | 0.036564 | 1.236787 | [
"s024198429",
"s909795198"
] |
u023229441 | p02720 | python | s711020151 | s632343498 | 174 | 151 | 13,556 | 7,388 | Accepted | Accepted | 13.22 | n=int(eval(input()))
if n<=10 :
print(n)
exit()
ans=[0 for i in range(10**5+21)]
Q=[0,1,2,3]
def li(x):
if x==0 : return [0,1]
if x==9 : return [8,9]
return [x-1,x,x+1]
now=0
for q in Q:
W=[i for i in range(10)] if q==0 else li(q)
for w in W:
E=[i for i in range(10)] if [q,w]==[0,... | n=int(eval(input()))
ans=[0 for i in range(10**5+21)]
Q=[0,1,2,3]
def li(x):
if x==0 : return [0,1]
if x==9 : return [8,9]
return [x-1,x,x+1]
now=0
for q in Q:
W=[i for i in range(10)] if q==0 else li(q)
for w in W:
E=[i for i in range(10)] if [q,w]==[0,0] else li(w)
for e in E:
R... | 42 | 36 | 1,377 | 1,300 | n = int(eval(input()))
if n <= 10:
print(n)
exit()
ans = [0 for i in range(10**5 + 21)]
Q = [0, 1, 2, 3]
def li(x):
if x == 0:
return [0, 1]
if x == 9:
return [8, 9]
return [x - 1, x, x + 1]
now = 0
for q in Q:
W = [i for i in range(10)] if q == 0 else li(q)
for w in W:
... | n = int(eval(input()))
ans = [0 for i in range(10**5 + 21)]
Q = [0, 1, 2, 3]
def li(x):
if x == 0:
return [0, 1]
if x == 9:
return [8, 9]
return [x - 1, x, x + 1]
now = 0
for q in Q:
W = [i for i in range(10)] if q == 0 else li(q)
for w in W:
E = [i for i in range(10)] if... | false | 14.285714 | [
"-if n <= 10:",
"- print(n)",
"- exit()",
"- == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
"+ == [0, 0, 0, 0, 0, 0, 0, 0, 0]",
"-ans = list(set(ans))",
"-n -= 8",
"-ans.sort()"
] | false | 0.400385 | 0.751224 | 0.532976 | [
"s711020151",
"s632343498"
] |
u296150111 | p03372 | python | s669784410 | s105246316 | 574 | 451 | 45,648 | 45,624 | Accepted | Accepted | 21.43 | import sys
input=sys.stdin.readline
l=[[0,0,0]]
r=[[0,0,0]]
n,c=list(map(int,input().split()))
for i in range(n):
x,v=list(map(int,input().split()))
r.append([x,v])
l.append([c-x,v])
r.sort()
l.sort()
now=0
for i in range(n):
now+=r[i+1][1]
r[i+1].append(max(now-r[i+1][0],r[i][2]))
if r[i+1][2]==r[... | def main():
import sys
input=sys.stdin.readline
l=[[0,0,0]];r=[[0,0,0]]
n,c=list(map(int,input().split()))
for i in range(n):
x,v=list(map(int,input().split()))
r.append([x,v])
l.append([c-x,v])
r.sort()
l.sort()
for x in (l,r):
now=0
for i in range(n):
now+=x[i+1][1]
x[i+1].appen... | 29 | 26 | 579 | 539 | import sys
input = sys.stdin.readline
l = [[0, 0, 0]]
r = [[0, 0, 0]]
n, c = list(map(int, input().split()))
for i in range(n):
x, v = list(map(int, input().split()))
r.append([x, v])
l.append([c - x, v])
r.sort()
l.sort()
now = 0
for i in range(n):
now += r[i + 1][1]
r[i + 1].append(max(now - r[i ... | def main():
import sys
input = sys.stdin.readline
l = [[0, 0, 0]]
r = [[0, 0, 0]]
n, c = list(map(int, input().split()))
for i in range(n):
x, v = list(map(int, input().split()))
r.append([x, v])
l.append([c - x, v])
r.sort()
l.sort()
for x in (l, r):
... | false | 10.344828 | [
"-import sys",
"+def main():",
"+ import sys",
"-input = sys.stdin.readline",
"-l = [[0, 0, 0]]",
"-r = [[0, 0, 0]]",
"-n, c = list(map(int, input().split()))",
"-for i in range(n):",
"- x, v = list(map(int, input().split()))",
"- r.append([x, v])",
"- l.append([c - x, v])",
"-r.so... | false | 0.076023 | 0.069192 | 1.098733 | [
"s669784410",
"s105246316"
] |
u332906195 | p02860 | python | s175611761 | s653167727 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
S = eval(input())
if N % 2 == 1 or S[:N // 2] != S[N // 2:]:
print("No")
else:
print("Yes")
| N = int(eval(input()))
S = eval(input())
print(("Yes" if S[:N // 2] == S[N // 2:] else "No"))
| 6 | 3 | 116 | 82 | N = int(eval(input()))
S = eval(input())
if N % 2 == 1 or S[: N // 2] != S[N // 2 :]:
print("No")
else:
print("Yes")
| N = int(eval(input()))
S = eval(input())
print(("Yes" if S[: N // 2] == S[N // 2 :] else "No"))
| false | 50 | [
"-if N % 2 == 1 or S[: N // 2] != S[N // 2 :]:",
"- print(\"No\")",
"-else:",
"- print(\"Yes\")",
"+print((\"Yes\" if S[: N // 2] == S[N // 2 :] else \"No\"))"
] | false | 0.037011 | 0.039794 | 0.930073 | [
"s175611761",
"s653167727"
] |
u918276501 | p02278 | python | s418719463 | s287242087 | 100 | 40 | 7,856 | 7,828 | Accepted | Accepted | 60 | def swap(A,i,j):
A[i],A[j] = A[j],A[i]
return A
def mincost(A):
B = sorted(A)
cost = 0
for i, bi in enumerate(B):
t = 0
j = A.index(bi)
tmp_cost = 0
# swap in a cyclic group
while j != i:
t += 1
bj = B[j]
... | def swap(A,i,j):
A[i],A[j] = A[j],A[i]
return A
def mincost(A):
B = sorted(A)
cost = 0
b0 = B[0]
for i, bi in enumerate(B):
t = 0
j = A.index(bi)
tmp_cost = 0
# swap in a cyclic group
while j != i:
t += 1
... | 37 | 38 | 803 | 814 | def swap(A, i, j):
A[i], A[j] = A[j], A[i]
return A
def mincost(A):
B = sorted(A)
cost = 0
for i, bi in enumerate(B):
t = 0
j = A.index(bi)
tmp_cost = 0
# swap in a cyclic group
while j != i:
t += 1
bj = B[j]
k = A.index(b... | def swap(A, i, j):
A[i], A[j] = A[j], A[i]
return A
def mincost(A):
B = sorted(A)
cost = 0
b0 = B[0]
for i, bi in enumerate(B):
t = 0
j = A.index(bi)
tmp_cost = 0
# swap in a cyclic group
while j != i:
t += 1
bj = B[j]
... | false | 2.631579 | [
"+ b0 = B[0]",
"- dec = t * (bi - B[0])",
"- inc = 2 * (bi + B[0])",
"+ dec = t * (bi - b0)",
"+ inc = 2 * (bi + b0)"
] | false | 0.034591 | 0.036054 | 0.959444 | [
"s418719463",
"s287242087"
] |
u645250356 | p03730 | python | s226180318 | s499762699 | 175 | 57 | 38,512 | 5,332 | Accepted | Accepted | 67.43 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.st... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | 16 | 19 | 486 | 504 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inpln(n):
r... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | false | 15.789474 | [
"-import sys, bisect, math, itertools",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint",
"+INF = float(\"inf\")",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) for i in range(n))",
"-",
"-",
"-for i in range(100000):",
"- if (c ... | false | 0.095057 | 0.049261 | 1.929648 | [
"s226180318",
"s499762699"
] |
u119148115 | p02629 | python | s324022814 | s379350494 | 81 | 73 | 61,884 | 61,920 | Accepted | Accepted | 9.88 | 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())
N = I()
A = [0]
for i in range(1,13):
A.append(A[-1]+26**i)
ANS = []
for i in range(1,12):
if N > A[i]:
continue
else:
a = N-A[i-1]-1
for j in range(i):
ANS.append(a % 26)
a = (a... | 32 | 26 | 800 | 445 | 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())
N = I()
A = [0]
for i in range(1, 13):
A.append(A[-1] + 26**i)
ANS = []
for i in range(1, 12):
if N > A[i]:
continue
else:
a = N - A[i - 1] - 1
for j in range(i):
ANS.append(a % 26)
a = (a -... | false | 18.75 | [
"-",
"-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().... | false | 0.096875 | 0.036185 | 2.677258 | [
"s324022814",
"s379350494"
] |
u117494854 | p03456 | python | s136633672 | s268614441 | 150 | 17 | 12,376 | 3,060 | Accepted | Accepted | 88.67 | import numpy as np
a = int(input().replace(" ", ""))
b = np.sqrt(a)
c = b - int(b)
if c == 0.0:
print("Yes")
else:
print("No")
| a = int(input().replace(" ", ""))
b = a**0.5
c = b - int(b)
if c == 0.0:
print("Yes")
else:
print("No")
| 12 | 10 | 150 | 124 | import numpy as np
a = int(input().replace(" ", ""))
b = np.sqrt(a)
c = b - int(b)
if c == 0.0:
print("Yes")
else:
print("No")
| a = int(input().replace(" ", ""))
b = a**0.5
c = b - int(b)
if c == 0.0:
print("Yes")
else:
print("No")
| false | 16.666667 | [
"-import numpy as np",
"-",
"-b = np.sqrt(a)",
"+b = a**0.5"
] | false | 0.737909 | 0.036515 | 20.208121 | [
"s136633672",
"s268614441"
] |
u562935282 | p03029 | python | s458728534 | s576429862 | 165 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.7 | A, P = list(map(int, input().split()))
print(((A * 3 + P) // 2))
| def main():
A, P = list(map(int, input().split()))
print(((A * 3 + P) // 2))
if __name__ == '__main__':
main()
| 2 | 7 | 58 | 123 | A, P = list(map(int, input().split()))
print(((A * 3 + P) // 2))
| def main():
A, P = list(map(int, input().split()))
print(((A * 3 + P) // 2))
if __name__ == "__main__":
main()
| false | 71.428571 | [
"-A, P = list(map(int, input().split()))",
"-print(((A * 3 + P) // 2))",
"+def main():",
"+ A, P = list(map(int, input().split()))",
"+ print(((A * 3 + P) // 2))",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.040211 | 0.037947 | 1.059671 | [
"s458728534",
"s576429862"
] |
u991567869 | p02898 | python | s048869823 | s977050254 | 74 | 52 | 11,912 | 11,912 | Accepted | Accepted | 29.73 | n, k = list(map(int, input().split()))
h = sorted(list(map(int, input().split())))
c = 0
for i in range(n):
if h[i] < k:
c = c + 1
else:
print((n - c))
exit()
print((n - c)) | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
c = 0
for i in range(n):
if h[i] < k:
c = c + 1
print((n - c)) | 11 | 8 | 206 | 149 | n, k = list(map(int, input().split()))
h = sorted(list(map(int, input().split())))
c = 0
for i in range(n):
if h[i] < k:
c = c + 1
else:
print((n - c))
exit()
print((n - c))
| n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
c = 0
for i in range(n):
if h[i] < k:
c = c + 1
print((n - c))
| false | 27.272727 | [
"-h = sorted(list(map(int, input().split())))",
"+h = list(map(int, input().split()))",
"- else:",
"- print((n - c))",
"- exit()"
] | false | 0.037672 | 0.037563 | 1.002882 | [
"s048869823",
"s977050254"
] |
u737842024 | p02595 | python | s839928794 | s840773635 | 479 | 390 | 9,096 | 9,100 | Accepted | Accepted | 18.58 | N, D = list(map(int, input().split()))
ans = 0
for i in range(N):
X, Y = list(map(int, input().split()))
if X**2 + Y**2 <= D**2:
ans += 1
print(ans) | N,D=list(map(int,input().split()))
ans=0
for i in range(N):
x,y=list(map(int,input().split()))
if x*x + y*y<=D*D:
ans+=1
print(ans)
| 8 | 10 | 153 | 148 | N, D = list(map(int, input().split()))
ans = 0
for i in range(N):
X, Y = list(map(int, input().split()))
if X**2 + Y**2 <= D**2:
ans += 1
print(ans)
| N, D = list(map(int, input().split()))
ans = 0
for i in range(N):
x, y = list(map(int, input().split()))
if x * x + y * y <= D * D:
ans += 1
print(ans)
| false | 20 | [
"- X, Y = list(map(int, input().split()))",
"- if X**2 + Y**2 <= D**2:",
"+ x, y = list(map(int, input().split()))",
"+ if x * x + y * y <= D * D:"
] | false | 0.036016 | 0.03748 | 0.960917 | [
"s839928794",
"s840773635"
] |
u185966380 | p02928 | python | s297739936 | s273602520 | 1,996 | 975 | 3,188 | 3,188 | Accepted | Accepted | 51.15 | def tasu(a):
out = (a*(a-1))//2 + a
return out%(10**9 + 7)
N, K = list(map(int, input().split()))
A_list = list(map(int, input().split()))
count = 0
count1 = 0
for i in range(N):
for j in range(N):
if i == j:
continue
elif (i<j) & (A_list[i] > A_list[j]):
count += 1
... | N, K = list(map(int, input().split()))
A_list = list(map(int, input().split()))
same = 0
diff = 0
for i in range(N):
for j in range(N):
if A_list[i] > A_list[j]:
if i < j:
same += 1
diff += 1
elif i>j:
diff += 1
ans = (same*K) + (diff*((K * (K-1))//2))
print(... | 21 | 16 | 447 | 330 | def tasu(a):
out = (a * (a - 1)) // 2 + a
return out % (10**9 + 7)
N, K = list(map(int, input().split()))
A_list = list(map(int, input().split()))
count = 0
count1 = 0
for i in range(N):
for j in range(N):
if i == j:
continue
elif (i < j) & (A_list[i] > A_list[j]):
... | N, K = list(map(int, input().split()))
A_list = list(map(int, input().split()))
same = 0
diff = 0
for i in range(N):
for j in range(N):
if A_list[i] > A_list[j]:
if i < j:
same += 1
diff += 1
elif i > j:
diff += 1
ans = (same * K) + (di... | false | 23.809524 | [
"-def tasu(a):",
"- out = (a * (a - 1)) // 2 + a",
"- return out % (10**9 + 7)",
"-",
"-",
"-count = 0",
"-count1 = 0",
"+same = 0",
"+diff = 0",
"- if i == j:",
"- continue",
"- elif (i < j) & (A_list[i] > A_list[j]):",
"- count += 1",
"- e... | false | 0.035399 | 0.03752 | 0.943473 | [
"s297739936",
"s273602520"
] |
u939814144 | p02266 | python | s974244239 | s881918941 | 30 | 20 | 8,188 | 8,204 | Accepted | Accepted | 33.33 | def cross_section_diagram():
down = []
edge = []
pool = []
for i, c in enumerate(eval(input())):
if c == '\\':
down.append(i)
elif c == '/' and down:
left = down.pop()
area = i - left
while edge:
if edge[-1] < left:
break
edge.pop()
area += pool.pop()
edge.ap... | def cross_section_diagram():
down = []
edge = []
pool = []
for i, c in enumerate(eval(input())):
if c == '\\':
down.append(i)
elif c == '/' and down:
left = down.pop()
area = i - left
while edge:
if edge[-1] > left:
edge.pop()
area += pool.pop()
else:
break
... | 26 | 27 | 449 | 462 | def cross_section_diagram():
down = []
edge = []
pool = []
for i, c in enumerate(eval(input())):
if c == "\\":
down.append(i)
elif c == "/" and down:
left = down.pop()
area = i - left
while edge:
if edge[-1] < left:
... | def cross_section_diagram():
down = []
edge = []
pool = []
for i, c in enumerate(eval(input())):
if c == "\\":
down.append(i)
elif c == "/" and down:
left = down.pop()
area = i - left
while edge:
if edge[-1] > left:
... | false | 3.703704 | [
"- if edge[-1] < left:",
"+ if edge[-1] > left:",
"+ edge.pop()",
"+ area += pool.pop()",
"+ else:",
"- edge.pop()",
"- area += pool.pop()"
] | false | 0.045263 | 0.096151 | 0.470746 | [
"s974244239",
"s881918941"
] |
u489959379 | p03775 | python | s651755982 | s409529207 | 42 | 28 | 3,060 | 3,060 | Accepted | Accepted | 33.33 | def make_divisors(n):
ans = float("inf")
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
div1 = i
div2 = n // i
res = max(len(str(div1)), len(str(div2)))
ans = min(ans, res)
return ans
if __name__ == '__main__':
n = int(eval(input()))
... | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
def f(a, b):
return max(len(str(a)), len(str(b)))
res = f_inf
for a in range(1, int(pow(n, 0.5)) + 1):
if n % a == 0:
b = n // a
... | 13 | 25 | 342 | 428 | def make_divisors(n):
ans = float("inf")
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
div1 = i
div2 = n // i
res = max(len(str(div1)), len(str(div2)))
ans = min(ans, res)
return ans
if __name__ == "__main__":
n = int(eval(input()))
print((m... | import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
def f(a, b):
return max(len(str(a)), len(str(b)))
res = f_inf
for a in range(1, int(pow(n, 0.5)) + 1):
if n % a == 0:
b = n // a
t = f(a, b)
... | false | 48 | [
"-def make_divisors(n):",
"- ans = float(\"inf\")",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- div1 = i",
"- div2 = n // i",
"- res = max(len(str(div1)), len(str(div2)))",
"- ans = min(ans, res)",
"- return ans",
"+import... | false | 0.047433 | 0.047881 | 0.990626 | [
"s651755982",
"s409529207"
] |
u768128363 | p02858 | python | s823734934 | s790646936 | 946 | 284 | 292,256 | 64,748 | Accepted | Accepted | 69.98 | from fractions import gcd
MOD = 10**9 + 7
H, W, T = list(map(int, input().split()))
ga, gb = gcd(H, T), gcd(W, T)
H //= ga
W //= gb
ans = (pow(2, H, MOD) + pow(2, W, MOD) - 1 + pow(2, gcd(H, W)) - 2) % MOD
print((pow(ans, ga*gb, MOD)))
| from fractions import gcd
MOD = 10**9 + 7
H, W, T = list(map(int, input().split()))
ga, gb = gcd(H, T), gcd(W, T)
H //= ga
W //= gb
ans = (pow(2, H, MOD) + pow(2, W, MOD) - 1 + pow(2, gcd(H, W), MOD) - 2) % MOD
print((pow(ans, ga*gb, MOD)))
| 8 | 8 | 235 | 240 | from fractions import gcd
MOD = 10**9 + 7
H, W, T = list(map(int, input().split()))
ga, gb = gcd(H, T), gcd(W, T)
H //= ga
W //= gb
ans = (pow(2, H, MOD) + pow(2, W, MOD) - 1 + pow(2, gcd(H, W)) - 2) % MOD
print((pow(ans, ga * gb, MOD)))
| from fractions import gcd
MOD = 10**9 + 7
H, W, T = list(map(int, input().split()))
ga, gb = gcd(H, T), gcd(W, T)
H //= ga
W //= gb
ans = (pow(2, H, MOD) + pow(2, W, MOD) - 1 + pow(2, gcd(H, W), MOD) - 2) % MOD
print((pow(ans, ga * gb, MOD)))
| false | 0 | [
"-ans = (pow(2, H, MOD) + pow(2, W, MOD) - 1 + pow(2, gcd(H, W)) - 2) % MOD",
"+ans = (pow(2, H, MOD) + pow(2, W, MOD) - 1 + pow(2, gcd(H, W), MOD) - 2) % MOD"
] | false | 0.109453 | 0.048424 | 2.26028 | [
"s823734934",
"s790646936"
] |
u089230684 | p04012 | python | s995111457 | s249643121 | 28 | 24 | 9,056 | 9,064 | Accepted | Accepted | 14.29 | a = [0]*26
s = str(eval(input()))
for i in range(0, len(s)):
p = ord(s[i]) - 97
a[p] += 1
ans = "Yes"
for i in range(0, 26):
if a[i]%2==1:
ans = ans.replace(ans, "No")
print(ans) | w=eval(input())
lst=[]
flag = 0
for i in w:
lst.append(i)
for i in range(len(w)):
if lst[i] == 99:
continue
c = 1
j = i + 1
while j < len(w):
if lst[i] == lst[j]:
lst[j] = 99
c += 1
j += 1
if c % 2 != 0:
print("No")
... | 10 | 23 | 201 | 376 | a = [0] * 26
s = str(eval(input()))
for i in range(0, len(s)):
p = ord(s[i]) - 97
a[p] += 1
ans = "Yes"
for i in range(0, 26):
if a[i] % 2 == 1:
ans = ans.replace(ans, "No")
print(ans)
| w = eval(input())
lst = []
flag = 0
for i in w:
lst.append(i)
for i in range(len(w)):
if lst[i] == 99:
continue
c = 1
j = i + 1
while j < len(w):
if lst[i] == lst[j]:
lst[j] = 99
c += 1
j += 1
if c % 2 != 0:
print("No")
flag = 1
... | false | 56.521739 | [
"-a = [0] * 26",
"-s = str(eval(input()))",
"-for i in range(0, len(s)):",
"- p = ord(s[i]) - 97",
"- a[p] += 1",
"-ans = \"Yes\"",
"-for i in range(0, 26):",
"- if a[i] % 2 == 1:",
"- ans = ans.replace(ans, \"No\")",
"-print(ans)",
"+w = eval(input())",
"+lst = []",
"+flag =... | false | 0.044637 | 0.106404 | 0.419506 | [
"s995111457",
"s249643121"
] |
u441320782 | p02813 | python | s486798505 | s556182465 | 47 | 28 | 3,064 | 8,052 | Accepted | Accepted | 40.43 | import itertools
N=int(eval(input()))
candi=[str(i) for i in range(1,N+1)]
P="".join(input().split())
Q="".join(input().split())
count=0
#候補列挙
for j in itertools.permutations(candi,N):
k="".join(list(j))
count+=1
if k==P:
a=count
if k==Q:
b=count
print((abs(a-b))) | #Favorite Answers
from itertools import permutations
n=int(eval(input()))
p=tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
l = list(permutations(list(range(1,n+1))))
print((abs(l.index(p)-l.index(q)))) | 15 | 7 | 286 | 214 | import itertools
N = int(eval(input()))
candi = [str(i) for i in range(1, N + 1)]
P = "".join(input().split())
Q = "".join(input().split())
count = 0
# 候補列挙
for j in itertools.permutations(candi, N):
k = "".join(list(j))
count += 1
if k == P:
a = count
if k == Q:
b = count
print((abs(a ... | # Favorite Answers
from itertools import permutations
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
l = list(permutations(list(range(1, n + 1))))
print((abs(l.index(p) - l.index(q))))
| false | 53.333333 | [
"-import itertools",
"+# Favorite Answers",
"+from itertools import permutations",
"-N = int(eval(input()))",
"-candi = [str(i) for i in range(1, N + 1)]",
"-P = \"\".join(input().split())",
"-Q = \"\".join(input().split())",
"-count = 0",
"-# 候補列挙",
"-for j in itertools.permutations(candi, N):",
... | false | 0.106899 | 0.073171 | 1.460944 | [
"s486798505",
"s556182465"
] |
u340781749 | p03346 | python | s211838440 | s264098711 | 433 | 393 | 34,912 | 18,876 | Accepted | Accepted | 9.24 | n = int(eval(input()))
ppp = list(map(int, (eval(input()) for _ in range(n))))
tmp_f = {}
for p in ppp:
if p - 1 in tmp_f:
tmp_f[p] = tmp_f[p - 1] + 1
else:
tmp_f[p] = 1
# tmp_b = {}
# for p in ppp[::-1]:
# if p + 1 in tmp_b:
# tmp_b[p] = tmp_b[p + 1] + 1
# else:
... | n = int(eval(input()))
ppp = list(map(int, (eval(input()) for _ in range(n))))
tmp = [0] * (n + 1)
for p in ppp:
tmp[p] = tmp[p - 1] + 1
print((n - max(tmp)))
| 19 | 8 | 377 | 158 | n = int(eval(input()))
ppp = list(map(int, (eval(input()) for _ in range(n))))
tmp_f = {}
for p in ppp:
if p - 1 in tmp_f:
tmp_f[p] = tmp_f[p - 1] + 1
else:
tmp_f[p] = 1
# tmp_b = {}
# for p in ppp[::-1]:
# if p + 1 in tmp_b:
# tmp_b[p] = tmp_b[p + 1] + 1
# else:
# tmp_b[... | n = int(eval(input()))
ppp = list(map(int, (eval(input()) for _ in range(n))))
tmp = [0] * (n + 1)
for p in ppp:
tmp[p] = tmp[p - 1] + 1
print((n - max(tmp)))
| false | 57.894737 | [
"-tmp_f = {}",
"+tmp = [0] * (n + 1)",
"- if p - 1 in tmp_f:",
"- tmp_f[p] = tmp_f[p - 1] + 1",
"- else:",
"- tmp_f[p] = 1",
"-# tmp_b = {}",
"-# for p in ppp[::-1]:",
"-# if p + 1 in tmp_b:",
"-# tmp_b[p] = tmp_b[p + 1] + 1",
"-# else:",
"-# tmp_b[p... | false | 0.064728 | 0.035485 | 1.824113 | [
"s211838440",
"s264098711"
] |
u863442865 | p03241 | python | s060105335 | s622936745 | 1,750 | 24 | 3,316 | 3,316 | Accepted | Accepted | 98.63 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
#from itertools import product
from bisect import bisec... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
#from itertools import product
from bisect import bisec... | 25 | 37 | 697 | 1,002 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
# from itertools import product
from bisect import bisect_l... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
# from itertools import product
from bisect import bisect_l... | false | 32.432432 | [
"- a = m // n",
"- for i in range(a, 0, -1):",
"- if m % i == 0:",
"+",
"+ def yakusuu(N):",
"+ n = int(N**0.5) + 1",
"+ res1 = []",
"+ res2 = []",
"+ for i in range(1, n):",
"+ if N % i == 0:",
"+ res1.append(i)",
"+ ... | false | 0.065293 | 0.049528 | 1.318298 | [
"s060105335",
"s622936745"
] |
u816116805 | p03283 | python | s871562401 | s580317839 | 2,687 | 1,854 | 125,400 | 54,076 | Accepted | Accepted | 31 | from collections import Counter
from itertools import product
n,m,q = list(map(int,input().split()))
rails=[tuple(map(int,input().split())) for i in range(m)]
qs=[tuple(map(int,input().split())) for i in range(q)]
xlist = [[0 for j in range(n)] for i in range(n)]
sumlist = [[0 for j in range(n+1)] for i in r... |
from collections import Counter
from itertools import product
import numpy as np
n,m,q = list(map(int,input().split()))
rails=[tuple(map(int,input().split())) for i in range(m)]
qs=[tuple(map(int,input().split())) for i in range(q)]
xlist = np.array([[0 for j in range(n)] for i in range(n)])
for (l,r),i i... | 26 | 23 | 780 | 630 | from collections import Counter
from itertools import product
n, m, q = list(map(int, input().split()))
rails = [tuple(map(int, input().split())) for i in range(m)]
qs = [tuple(map(int, input().split())) for i in range(q)]
xlist = [[0 for j in range(n)] for i in range(n)]
sumlist = [[0 for j in range(n + 1)] for i in ... | from collections import Counter
from itertools import product
import numpy as np
n, m, q = list(map(int, input().split()))
rails = [tuple(map(int, input().split())) for i in range(m)]
qs = [tuple(map(int, input().split())) for i in range(q)]
xlist = np.array([[0 for j in range(n)] for i in range(n)])
for (l, r), i in ... | false | 11.538462 | [
"+import numpy as np",
"-xlist = [[0 for j in range(n)] for i in range(n)]",
"-sumlist = [[0 for j in range(n + 1)] for i in range(n)]",
"-sumsumlist = [[0 for j in range(n + 1)] for i in range(n + 1)]",
"+xlist = np.array([[0 for j in range(n)] for i in range(n)])",
"- xlist[l - 1][r - 1] = i",
"-fo... | false | 0.039076 | 0.45169 | 0.086511 | [
"s871562401",
"s580317839"
] |
u912237403 | p00122 | python | s018224290 | s312947793 | 20 | 10 | 4,284 | 4,284 | Accepted | Accepted | 50 | R1=list(range(-2,3))
R2=list(range(-1,2))
A1=[(x,y) for x in R1 for y in R1 if 3<x**2+y**2<6]
A2=[(x,y) for x in R2 for y in R2]
def fi(): return list(map(int,input().split(" ")))
def f(p,i):
x,y=p
A=[A1,A2][i>0]
return set([(x+dx,y+dy) for dx,dy in A if 0<=x+dx<10 and 0<=y+dy<10])
while 1:
xf,yf=fi... | R1=list(range(-2,3))
R2=list(range(-1,2))
A1=[(x,y) for x in R1 for y in R1 if 3<x**2+y**2<6]
A2=[(x,y) for x in R2 for y in R2]
def fi(): return list(map(int,input().split(" ")))
def f(x,y,i):
A=[A1,A2][i>0]
return set([(x+dx,y+dy) for dx,dy in A if 0<=x+dx<10 and 0<=y+dy<10])
while 1:
xf,yf=fi()
i... | 23 | 22 | 544 | 549 | R1 = list(range(-2, 3))
R2 = list(range(-1, 2))
A1 = [(x, y) for x in R1 for y in R1 if 3 < x**2 + y**2 < 6]
A2 = [(x, y) for x in R2 for y in R2]
def fi():
return list(map(int, input().split(" ")))
def f(p, i):
x, y = p
A = [A1, A2][i > 0]
return set(
[(x + dx, y + dy) for dx, dy in A if 0 ... | R1 = list(range(-2, 3))
R2 = list(range(-1, 2))
A1 = [(x, y) for x in R1 for y in R1 if 3 < x**2 + y**2 < 6]
A2 = [(x, y) for x in R2 for y in R2]
def fi():
return list(map(int, input().split(" ")))
def f(x, y, i):
A = [A1, A2][i > 0]
return set(
[(x + dx, y + dy) for dx, dy in A if 0 <= x + dx ... | false | 4.347826 | [
"-def f(p, i):",
"- x, y = p",
"+def f(x, y, i):",
"- for ps in PA:",
"- SA = f(ps, 1)",
"+ for xs, ys in PA:",
"+ SA = f(xs, ys, 1)",
"- for pf in FA:",
"- tmp = tmp | (SA & f(pf, 0))",
"+ for xf, yf in FA:",
"+ tmp = tmp | (SA & f(xf, ... | false | 0.041563 | 0.071918 | 0.577916 | [
"s018224290",
"s312947793"
] |
u659159398 | p02628 | python | s449596658 | s762734357 | 168 | 94 | 72,800 | 62,028 | Accepted | Accepted | 44.05 | from sys import stdin
from collections import defaultdict as dd
from collections import deque as dq
import itertools as it
from math import sqrt, log, log2
from fractions import Fraction
n, k = list(map(int, input().split()))
nums = list(map(int, stdin.readline().split()))
nums.sort()
print((sum(nums[:k])))
| n, k = list(map(int, input().split()))
nums = list(map(int, input().split()))
print((sum(sorted(nums)[:k]))) | 11 | 4 | 312 | 104 | from sys import stdin
from collections import defaultdict as dd
from collections import deque as dq
import itertools as it
from math import sqrt, log, log2
from fractions import Fraction
n, k = list(map(int, input().split()))
nums = list(map(int, stdin.readline().split()))
nums.sort()
print((sum(nums[:k])))
| n, k = list(map(int, input().split()))
nums = list(map(int, input().split()))
print((sum(sorted(nums)[:k])))
| false | 63.636364 | [
"-from sys import stdin",
"-from collections import defaultdict as dd",
"-from collections import deque as dq",
"-import itertools as it",
"-from math import sqrt, log, log2",
"-from fractions import Fraction",
"-",
"-nums = list(map(int, stdin.readline().split()))",
"-nums.sort()",
"-print((sum(n... | false | 0.048184 | 0.048709 | 0.98923 | [
"s449596658",
"s762734357"
] |
u708378905 | p04001 | python | s852359118 | s395820383 | 21 | 18 | 3,060 | 3,060 | Accepted | Accepted | 14.29 | s = eval(input())
result_sum = 0 # 総和
plus_count = len(s) - 1 # 集合の要素数
for bit in range(1 << plus_count): # bit全探索
splitted_string = s[0] # 最初の数字を取る
for iter_plus in range(plus_count):
if bit & (1 << iter_plus): # ビットを立てる -> +を挿入する
splitted_string += '+'
splitted_string += s[iter_plus+1] # ... | def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:
if len(splitted) == depth:
return a + b
else:
# 左のdfs() 呼び出し -> +を挿入しなかったとき
# 右のdfs() 呼び出し -> +を挿入したとき
return dfs(splitted, a, b * 10, depth + 1) + dfs(splitted, a + b, splitted[depth], depth + 1)
s = [int(x) for x... | 15 | 10 | 487 | 356 | s = eval(input())
result_sum = 0 # 総和
plus_count = len(s) - 1 # 集合の要素数
for bit in range(1 << plus_count): # bit全探索
splitted_string = s[0] # 最初の数字を取る
for iter_plus in range(plus_count):
if bit & (1 << iter_plus): # ビットを立てる -> +を挿入する
splitted_string += "+"
splitted_string += s[ite... | def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:
if len(splitted) == depth:
return a + b
else:
# 左のdfs() 呼び出し -> +を挿入しなかったとき
# 右のdfs() 呼び出し -> +を挿入したとき
return dfs(splitted, a, b * 10, depth + 1) + dfs(
splitted, a + b, splitted[depth], dept... | false | 33.333333 | [
"-s = eval(input())",
"-result_sum = 0 # 総和",
"-plus_count = len(s) - 1 # 集合の要素数",
"-for bit in range(1 << plus_count): # bit全探索",
"- splitted_string = s[0] # 最初の数字を取る",
"- for iter_plus in range(plus_count):",
"- if bit & (1 << iter_plus): # ビットを立てる -> +を挿入する",
"- splitte... | false | 0.039208 | 0.048026 | 0.816384 | [
"s852359118",
"s395820383"
] |
u706414019 | p03986 | python | s089828057 | s382520937 | 62 | 51 | 9,196 | 9,252 | Accepted | Accepted | 17.74 | S = eval(input())
s_cnt =0
t_cnt =0
for s in S:
if s == 'S':
s_cnt += 1
if s == 'T':
t_cnt += 1
if s_cnt >0:
t_cnt -= 1
s_cnt -= 1
print((t_cnt + s_cnt))
| S = eval(input())
s_cnt =0
t_cnt =0
for s in S:
if s == 'S':
s_cnt += 1
else:
if s_cnt >0:
s_cnt -= 1
else:
t_cnt += 1
print((t_cnt + s_cnt))
| 13 | 14 | 215 | 217 | S = eval(input())
s_cnt = 0
t_cnt = 0
for s in S:
if s == "S":
s_cnt += 1
if s == "T":
t_cnt += 1
if s_cnt > 0:
t_cnt -= 1
s_cnt -= 1
print((t_cnt + s_cnt))
| S = eval(input())
s_cnt = 0
t_cnt = 0
for s in S:
if s == "S":
s_cnt += 1
else:
if s_cnt > 0:
s_cnt -= 1
else:
t_cnt += 1
print((t_cnt + s_cnt))
| false | 7.142857 | [
"- if s == \"T\":",
"- t_cnt += 1",
"+ else:",
"- t_cnt -= 1",
"+ else:",
"+ t_cnt += 1"
] | false | 0.087601 | 0.086555 | 1.012077 | [
"s089828057",
"s382520937"
] |
u511379665 | p03162 | python | s673198290 | s164421984 | 757 | 589 | 53,036 | 42,588 | Accepted | Accepted | 22.19 | import numpy as np
n=int(eval(input()))
H=[]
for i in range(n):
a,b,c=list(map(int,input().split()))
H.append([a,b,c])
dp=[[0 for i in range(3)] for j in range(n+1)]
dp[0][0]=H[0][0]
dp[0][1]=H[0][1]
dp[0][2]=H[0][2]
for i in range(0,n-1):
dp[i+1][0]=max(dp[i][1],dp[i][2])+H[i+1][0]
dp... | n=int(eval(input()))
H=[]
for i in range(n):
a,b,c=list(map(int,input().split()))
H.append([a,b,c])
if n==1:
print((max(H[0][0],H[0][1],H[0][2])))
exit()
dp=[[0,0,0]for j in range(n)]
for i in range(3):
dp[0][i]=H[0][i]
for i in range(0,n-1):
dp[i+1][0]=max(dp[i][1],dp[i][2])+H[i... | 19 | 19 | 446 | 476 | import numpy as np
n = int(eval(input()))
H = []
for i in range(n):
a, b, c = list(map(int, input().split()))
H.append([a, b, c])
dp = [[0 for i in range(3)] for j in range(n + 1)]
dp[0][0] = H[0][0]
dp[0][1] = H[0][1]
dp[0][2] = H[0][2]
for i in range(0, n - 1):
dp[i + 1][0] = max(dp[i][1], dp[i][2]) + H[... | n = int(eval(input()))
H = []
for i in range(n):
a, b, c = list(map(int, input().split()))
H.append([a, b, c])
if n == 1:
print((max(H[0][0], H[0][1], H[0][2])))
exit()
dp = [[0, 0, 0] for j in range(n)]
for i in range(3):
dp[0][i] = H[0][i]
for i in range(0, n - 1):
dp[i + 1][0] = max(dp[i][1],... | false | 0 | [
"-import numpy as np",
"-",
"-dp = [[0 for i in range(3)] for j in range(n + 1)]",
"-dp[0][0] = H[0][0]",
"-dp[0][1] = H[0][1]",
"-dp[0][2] = H[0][2]",
"+if n == 1:",
"+ print((max(H[0][0], H[0][1], H[0][2])))",
"+ exit()",
"+dp = [[0, 0, 0] for j in range(n)]",
"+for i in range(3):",
"+... | false | 0.048075 | 0.048222 | 0.996961 | [
"s673198290",
"s164421984"
] |
u604774382 | p02414 | python | s092463640 | s881923391 | 590 | 290 | 9,988 | 5,536 | Accepted | Accepted | 50.85 | import sys
n, m, l = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
matrixA = [ [ int( val ) for val in sys.stdin.readline().split( " " ) ] for row in range( n ) ]
matrixB = [ [ int( val ) for val in sys.stdin.readline().split( " " ) ] for row in range( m ) ]
matrixC = [ [ 0 for row in range( l ) ... | import sys
n, m, l = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
matrixA = [ [ int( val ) for val in sys.stdin.readline().split( " " ) ] for row in range( n ) ]
matrixB = [ [ int( val ) for val in sys.stdin.readline().split( " " ) ] for row in range( m ) ]
c = 0
output = []
for i in range( ... | 20 | 21 | 642 | 569 | import sys
n, m, l = [int(val) for val in sys.stdin.readline().split(" ")]
matrixA = [[int(val) for val in sys.stdin.readline().split(" ")] for row in range(n)]
matrixB = [[int(val) for val in sys.stdin.readline().split(" ")] for row in range(m)]
matrixC = [[0 for row in range(l)] for row in range(n)]
output = []
for ... | import sys
n, m, l = [int(val) for val in sys.stdin.readline().split(" ")]
matrixA = [[int(val) for val in sys.stdin.readline().split(" ")] for row in range(n)]
matrixB = [[int(val) for val in sys.stdin.readline().split(" ")] for row in range(m)]
c = 0
output = []
for i in range(n):
for j in range(l):
c = ... | false | 4.761905 | [
"-matrixC = [[0 for row in range(l)] for row in range(n)]",
"+c = 0",
"+ c = 0",
"- matrixC[i][j] += matrixA[i][k] * matrixB[k][j]",
"- output.append(\"{:d}\".format(matrixC[i][j]))",
"+ c += matrixA[i][k] * matrixB[k][j]",
"+ output.append(\"{:d}\".format(c))"... | false | 0.044232 | 0.044451 | 0.995059 | [
"s092463640",
"s881923391"
] |
u529722835 | p03308 | python | s863200739 | s419191483 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | N = int(eval(input()))
A_list = [int(a) for a in input().split()]
list = []
for j in range(N):
for k in range(N):
list.append(abs(A_list[j]-A_list[k]))
print((max(list))) | N = int(eval(input()))
A_list = [int(a) for a in input().split()]
A_list.sort()
print((A_list[-1]-A_list[0])) | 7 | 4 | 180 | 104 | N = int(eval(input()))
A_list = [int(a) for a in input().split()]
list = []
for j in range(N):
for k in range(N):
list.append(abs(A_list[j] - A_list[k]))
print((max(list)))
| N = int(eval(input()))
A_list = [int(a) for a in input().split()]
A_list.sort()
print((A_list[-1] - A_list[0]))
| false | 42.857143 | [
"-list = []",
"-for j in range(N):",
"- for k in range(N):",
"- list.append(abs(A_list[j] - A_list[k]))",
"-print((max(list)))",
"+A_list.sort()",
"+print((A_list[-1] - A_list[0]))"
] | false | 0.042903 | 0.118018 | 0.363526 | [
"s863200739",
"s419191483"
] |
u282228874 | p03495 | python | s010075723 | s059138402 | 167 | 116 | 41,392 | 32,564 | Accepted | Accepted | 30.54 | from collections import Counter
n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
D = Counter(A)
K = []
for key in list(D.keys()):
K.append(key)
if len(set(K)) <= k:
print((0))
else:
V = []
for v in list(D.values()):
V.append(v)
V.sort(reverse=True)
... | from collections import Counter
n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
D = Counter(A)
V = []
for v in list(D.values()):
V.append(v)
V.sort(reverse=True)
print((max(n-sum(V[:k]),0))) | 17 | 11 | 321 | 216 | from collections import Counter
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
D = Counter(A)
K = []
for key in list(D.keys()):
K.append(key)
if len(set(K)) <= k:
print((0))
else:
V = []
for v in list(D.values()):
V.append(v)
V.sort(reverse=True)
print((n - s... | from collections import Counter
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
D = Counter(A)
V = []
for v in list(D.values()):
V.append(v)
V.sort(reverse=True)
print((max(n - sum(V[:k]), 0)))
| false | 35.294118 | [
"-K = []",
"-for key in list(D.keys()):",
"- K.append(key)",
"-if len(set(K)) <= k:",
"- print((0))",
"-else:",
"- V = []",
"- for v in list(D.values()):",
"- V.append(v)",
"- V.sort(reverse=True)",
"- print((n - sum(V[:k])))",
"+V = []",
"+for v in list(D.values()):... | false | 0.04114 | 0.039817 | 1.033229 | [
"s010075723",
"s059138402"
] |
u254871849 | p03219 | python | s238331975 | s960214186 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | # 2019-11-11 14:35:02(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
... | import sys
x, y = list(map(int, sys.stdin.readline().split()))
def main():
return x + y // 2
if __name__ == '__main__':
ans = main()
print(ans) | 21 | 10 | 500 | 161 | # 2019-11-11 14:35:02(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import ... | import sys
x, y = list(map(int, sys.stdin.readline().split()))
def main():
return x + y // 2
if __name__ == "__main__":
ans = main()
print(ans)
| false | 52.380952 | [
"-# 2019-11-11 14:35:02(JST)",
"-# import collections",
"-# import math",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-# from bisect import bisect_left as bi_l, bisect_right as bi_r",
"-# import itertools",
"-# from functools import reduce",
"-# import operator as op",
"-# fro... | false | 0.070485 | 0.070133 | 1.005018 | [
"s238331975",
"s960214186"
] |
u971091945 | p02583 | python | s688444289 | s787011952 | 150 | 94 | 9,212 | 9,188 | Accepted | Accepted | 37.33 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
if n<3:
print((0))
exit()
for i in range(n):
for j in range(i+1, n):
for k in range(j+1, n):
if a[i]==a[j] or a[j]==a[k] or a[k]==a[i]:
continue
if a[i]+a[j]<=a[k] or a[j]+a[k]<=... | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n):
for j in range(i+1, n):
for k in range(j+1, n):
if a[i] != a[j] and a[j] != a[k] and a[k] != a[i] and a[i]+a[j] > a[k]:
ans += 1
print(ans) | 18 | 12 | 398 | 281 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
if n < 3:
print((0))
exit()
for i in range(n):
for j in range(i + 1, n):
for k in range(j + 1, n):
if a[i] == a[j] or a[j] == a[k] or a[k] == a[i]:
continue
if a[i] + a[j] <= a[k] or a[j] + a[k... | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n):
for j in range(i + 1, n):
for k in range(j + 1, n):
if a[i] != a[j] and a[j] != a[k] and a[k] != a[i] and a[i] + a[j] > a[k]:
ans += 1
print(ans)
| false | 33.333333 | [
"+a.sort()",
"-if n < 3:",
"- print((0))",
"- exit()",
"- if a[i] == a[j] or a[j] == a[k] or a[k] == a[i]:",
"- continue",
"- if a[i] + a[j] <= a[k] or a[j] + a[k] <= a[i] or a[k] + a[i] <= a[j]:",
"- continue",
"- ans += 1",
"+ ... | false | 0.035943 | 0.058776 | 0.611528 | [
"s688444289",
"s787011952"
] |
u279955105 | p02410 | python | s484270557 | s630901054 | 40 | 20 | 7,960 | 6,012 | Accepted | Accepted | 50 | n,m = list(map(int,input().split()))
A = [[0 for q in range(m)] for w in range(n)]
B = [0 for e in range(m)]
for i in range(n):
A[i] = list(map(int, input().split()))
for j in range(m):
B[j] = int(eval(input()))
for i in range(n):
c = 0
for j in range(m):
c += A[i][j] * B[j]
print(c) | listA = []
listB = []
Answer = []
n, m = list(map(int, input().split()))
for i in range(n):
listA.append(list(map(int, input().split())))
for j in range(m):
listB.append(int(eval(input())))
for k in range(n):
result = 0
for l in range(m):
result += listA[k][l]*listB[l]
Answer.app... | 15 | 15 | 302 | 362 | n, m = list(map(int, input().split()))
A = [[0 for q in range(m)] for w in range(n)]
B = [0 for e in range(m)]
for i in range(n):
A[i] = list(map(int, input().split()))
for j in range(m):
B[j] = int(eval(input()))
for i in range(n):
c = 0
for j in range(m):
c += A[i][j] * B[j]
print(c)
| listA = []
listB = []
Answer = []
n, m = list(map(int, input().split()))
for i in range(n):
listA.append(list(map(int, input().split())))
for j in range(m):
listB.append(int(eval(input())))
for k in range(n):
result = 0
for l in range(m):
result += listA[k][l] * listB[l]
Answer.append(result... | false | 0 | [
"+listA = []",
"+listB = []",
"+Answer = []",
"-A = [[0 for q in range(m)] for w in range(n)]",
"-B = [0 for e in range(m)]",
"- A[i] = list(map(int, input().split()))",
"+ listA.append(list(map(int, input().split())))",
"- B[j] = int(eval(input()))",
"-for i in range(n):",
"- c = 0",
... | false | 0.036801 | 0.034853 | 1.055882 | [
"s484270557",
"s630901054"
] |
u374829922 | p02947 | python | s505235374 | s429247761 | 472 | 367 | 18,232 | 17,852 | Accepted | Accepted | 22.25 | from collections import Counter
n = int(eval(input()))
count = 0
lists =[]
count_dict = Counter()
for i in range(n):
input_data = ''.join(sorted(eval(input())))
if input_data in count_dict:
count += count_dict[input_data]
count_dict[input_data] += 1
else:
count_dict[in... | def main():
n = int(eval(input()))
count = 0
count_dict = {}
for i in range(n):
input_data = ''.join(sorted(eval(input())))
if input_data in count_dict:
count += count_dict[input_data]
count_dict[input_data] += 1
else:
count_dict[in... | 16 | 18 | 337 | 386 | from collections import Counter
n = int(eval(input()))
count = 0
lists = []
count_dict = Counter()
for i in range(n):
input_data = "".join(sorted(eval(input())))
if input_data in count_dict:
count += count_dict[input_data]
count_dict[input_data] += 1
else:
count_dict[input_data] = 1... | def main():
n = int(eval(input()))
count = 0
count_dict = {}
for i in range(n):
input_data = "".join(sorted(eval(input())))
if input_data in count_dict:
count += count_dict[input_data]
count_dict[input_data] += 1
else:
count_dict[input_data] = ... | false | 11.111111 | [
"-from collections import Counter",
"+def main():",
"+ n = int(eval(input()))",
"+ count = 0",
"+ count_dict = {}",
"+ for i in range(n):",
"+ input_data = \"\".join(sorted(eval(input())))",
"+ if input_data in count_dict:",
"+ count += count_dict[input_data]",
... | false | 0.035662 | 0.034542 | 1.032424 | [
"s505235374",
"s429247761"
] |
u593019570 | p03137 | python | s739953460 | s005899133 | 142 | 126 | 13,968 | 13,968 | Accepted | Accepted | 11.27 | # coding: utf-8
# Your code here!
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()
c = []
if len(b) != 1:
for i in range(len(b) - 1):
c.append(b[i+1] - b[i])
if len(b) == 1:
print((0))
else:
c.sort()
for j in range(min(a[0] - 1,a[1])):
c[len(c)... | a,b = list(map(int,input().split()))
c = list(map(int,input().split()))
c.sort()
d = []
for i in range(b-1):
d.append(c[i+1] - c[i])
d.sort()
#print(c,d)
for k in range(a - 1):
if d == []:
print((0))
exit()
d.pop()
print((sum(d))) | 21 | 20 | 350 | 273 | # coding: utf-8
# Your code here!
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort()
c = []
if len(b) != 1:
for i in range(len(b) - 1):
c.append(b[i + 1] - b[i])
if len(b) == 1:
print((0))
else:
c.sort()
for j in range(min(a[0] - 1, a[1])):
c[len(c) - 1 - j]... | a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
c.sort()
d = []
for i in range(b - 1):
d.append(c[i + 1] - c[i])
d.sort()
# print(c,d)
for k in range(a - 1):
if d == []:
print((0))
exit()
d.pop()
print((sum(d)))
| false | 4.761905 | [
"-# coding: utf-8",
"-# Your code here!",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-b.sort()",
"-c = []",
"-if len(b) != 1:",
"- for i in range(len(b) - 1):",
"- c.append(b[i + 1] - b[i])",
"-if len(b) == 1:",
"- print((0))",
"-else:",
"- ... | false | 0.043154 | 0.043351 | 0.995448 | [
"s739953460",
"s005899133"
] |
u163320134 | p02743 | python | s888195406 | s900291474 | 266 | 34 | 59,372 | 5,076 | Accepted | Accepted | 87.22 | from decimal import *
a,b,c=list(map(int,input().split()))
a,b,c=Decimal(a),Decimal(b),Decimal(c)
if (max(0,c-(a+b)))**2>4*a*b:
print('Yes')
else:
print('No') | from decimal import *
a,b,c=list(map(int,input().split()))
a,b,c=Decimal(a),Decimal(b),Decimal(c)
if c**Decimal(0.5)>a**Decimal(0.5)+b**Decimal(0.5):
print('Yes')
else:
print('No') | 8 | 8 | 164 | 186 | from decimal import *
a, b, c = list(map(int, input().split()))
a, b, c = Decimal(a), Decimal(b), Decimal(c)
if (max(0, c - (a + b))) ** 2 > 4 * a * b:
print("Yes")
else:
print("No")
| from decimal import *
a, b, c = list(map(int, input().split()))
a, b, c = Decimal(a), Decimal(b), Decimal(c)
if c ** Decimal(0.5) > a ** Decimal(0.5) + b ** Decimal(0.5):
print("Yes")
else:
print("No")
| false | 0 | [
"-if (max(0, c - (a + b))) ** 2 > 4 * a * b:",
"+if c ** Decimal(0.5) > a ** Decimal(0.5) + b ** Decimal(0.5):"
] | false | 0.037784 | 0.065149 | 0.57996 | [
"s888195406",
"s900291474"
] |
u912237403 | p00070 | python | s864777683 | s445238493 | 2,810 | 300 | 4,240 | 7,148 | Accepted | Accepted | 89.32 | import sys
def f0070(A,n,s):
if n==1:return s in A
A=sorted(A)
b1=0
b2=0
c=0
j=1
for e,f in zip(A[:n][::-1],A[-n:]):
b1+=j*e
b2+=j*f
j+=1
if b1<=s<=b2:
for i in range(len(A)):
c+=f0070(A[:i]+A[i+1:],n-1,s-A[i]*n)
return c
for a in sys.stdin:
n,s=list(map(int,... | import sys
K=1024
N=331
R=list(range(K))
B=[1,2,4,8,16,32,64,128,256,512]
C=[0]*K
D=[[0 for i in range(N)]for j in R]
def init():
global C,D
for i in R:
s=format(i,'b')
n=s.count('1')
C[i]=n
if n==1:D[i][B.index(i)]=1
else:
for j in range(len(s)):
if s[-j-1]=='1':... | 20 | 30 | 355 | 557 | import sys
def f0070(A, n, s):
if n == 1:
return s in A
A = sorted(A)
b1 = 0
b2 = 0
c = 0
j = 1
for e, f in zip(A[:n][::-1], A[-n:]):
b1 += j * e
b2 += j * f
j += 1
if b1 <= s <= b2:
for i in range(len(A)):
c += f0070(A[:i] + A[i + 1 ... | import sys
K = 1024
N = 331
R = list(range(K))
B = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
C = [0] * K
D = [[0 for i in range(N)] for j in R]
def init():
global C, D
for i in R:
s = format(i, "b")
n = s.count("1")
C[i] = n
if n == 1:
D[i][B.index(i)] = 1
el... | false | 33.333333 | [
"-",
"-def f0070(A, n, s):",
"- if n == 1:",
"- return s in A",
"- A = sorted(A)",
"- b1 = 0",
"- b2 = 0",
"- c = 0",
"- j = 1",
"- for e, f in zip(A[:n][::-1], A[-n:]):",
"- b1 += j * e",
"- b2 += j * f",
"- j += 1",
"- if b1 <= s <= b2:... | false | 0.046911 | 0.822248 | 0.057052 | [
"s864777683",
"s445238493"
] |
u680851063 | p02837 | python | s480487960 | s296812218 | 635 | 60 | 9,204 | 9,076 | Accepted | Accepted | 90.55 | n = int(eval(input()))
testimony = [[] for _ in range(n)]
for i in range(n):
tmp = int(eval(input()))
for j in range(tmp):
person, state = list(map(int, input().split()))
testimony[i].append([person-1, state])
#print(testimony)
from itertools import product
s = [0,1]
ptns = list(p... | n = int(eval(input()))
testimony = [[] for _ in range(n)]
for i in range(n):
tmp = int(eval(input()))
for j in range(tmp):
person, state = list(map(int, input().split()))
testimony[i].append([person-1, state])
#print(testimony)
from itertools import product
s = [0,1]
ptns = sorted... | 27 | 27 | 642 | 665 | n = int(eval(input()))
testimony = [[] for _ in range(n)]
for i in range(n):
tmp = int(eval(input()))
for j in range(tmp):
person, state = list(map(int, input().split()))
testimony[i].append([person - 1, state])
# print(testimony)
from itertools import product
s = [0, 1]
ptns = list(product(s, ... | n = int(eval(input()))
testimony = [[] for _ in range(n)]
for i in range(n):
tmp = int(eval(input()))
for j in range(tmp):
person, state = list(map(int, input().split()))
testimony[i].append([person - 1, state])
# print(testimony)
from itertools import product
s = [0, 1]
ptns = sorted(list(prod... | false | 0 | [
"-ptns = list(product(s, repeat=n))",
"-ptns = list(reversed(ptns))",
"+ptns = sorted(list(product(s, repeat=n)), reverse=1)",
"- error = 0",
"- error = 1",
"- if error == 0:",
"+ break",
"+ else:",
"+ continue",
"+ b... | false | 0.042514 | 0.038019 | 1.118231 | [
"s480487960",
"s296812218"
] |
u835482198 | p03683 | python | s632136357 | s116397956 | 39 | 36 | 3,064 | 3,064 | Accepted | Accepted | 7.69 | N, M = list(map(int, input().split()))
# N, M = 100000, 100000
# N, M = 2, 3
mod = 10 ** 9 + 7
if abs(N - M) >= 2:
print((0))
else:
if N == M:
prod = 1
for i in range(2, N + 1):
prod = (prod * i) % mod
print(((prod * prod * 2) % mod))
else:
if N < M... |
N, M = list(map(int, input().split()))
# N, M = 100000, 100000
mod = 10 ** 9 + 7
if N > M:
N, M = M, N
if M - N >= 2:
print((0))
elif M - N == 1:
prod = 1
for i in range(1, N + 1):
prod = (prod * i) % mod
print(((prod * prod * M) % mod))
else:
prod = 1
for i in ra... | 23 | 20 | 545 | 394 | N, M = list(map(int, input().split()))
# N, M = 100000, 100000
# N, M = 2, 3
mod = 10**9 + 7
if abs(N - M) >= 2:
print((0))
else:
if N == M:
prod = 1
for i in range(2, N + 1):
prod = (prod * i) % mod
print(((prod * prod * 2) % mod))
else:
if N < M:
N, ... | N, M = list(map(int, input().split()))
# N, M = 100000, 100000
mod = 10**9 + 7
if N > M:
N, M = M, N
if M - N >= 2:
print((0))
elif M - N == 1:
prod = 1
for i in range(1, N + 1):
prod = (prod * i) % mod
print(((prod * prod * M) % mod))
else:
prod = 1
for i in range(1, N + 1):
... | false | 13.043478 | [
"-# N, M = 2, 3",
"-if abs(N - M) >= 2:",
"+if N > M:",
"+ N, M = M, N",
"+if M - N >= 2:",
"+elif M - N == 1:",
"+ prod = 1",
"+ for i in range(1, N + 1):",
"+ prod = (prod * i) % mod",
"+ print(((prod * prod * M) % mod))",
"- if N == M:",
"- prod = 1",
"- ... | false | 0.046776 | 0.052017 | 0.899239 | [
"s632136357",
"s116397956"
] |
u408071652 | p02693 | python | s535664997 | s151162408 | 24 | 21 | 9,000 | 9,172 | Accepted | Accepted | 12.5 | k = int(eval(input()))
a, b = list(map(int,input().split()))
bb = b//k
aa , i = divmod(a, k)
if (aa != bb) or ( i ==0):
print("OK")
else:
print("NG") | K = int(eval(input()))
A, B =list(map(int,input().split()))
ad,am=divmod(A,K)
bd,bm=divmod(B,K)
if bd>ad:
print("OK")
elif am ==0:
print("OK")
else:
print("NG") | 8 | 10 | 152 | 169 | k = int(eval(input()))
a, b = list(map(int, input().split()))
bb = b // k
aa, i = divmod(a, k)
if (aa != bb) or (i == 0):
print("OK")
else:
print("NG")
| K = int(eval(input()))
A, B = list(map(int, input().split()))
ad, am = divmod(A, K)
bd, bm = divmod(B, K)
if bd > ad:
print("OK")
elif am == 0:
print("OK")
else:
print("NG")
| false | 20 | [
"-k = int(eval(input()))",
"-a, b = list(map(int, input().split()))",
"-bb = b // k",
"-aa, i = divmod(a, k)",
"-if (aa != bb) or (i == 0):",
"+K = int(eval(input()))",
"+A, B = list(map(int, input().split()))",
"+ad, am = divmod(A, K)",
"+bd, bm = divmod(B, K)",
"+if bd > ad:",
"+ print(\"OK... | false | 0.092666 | 0.037634 | 2.462312 | [
"s535664997",
"s151162408"
] |
u143322814 | p02713 | python | s446365753 | s499239743 | 1,819 | 37 | 9,192 | 9,212 | Accepted | Accepted | 97.97 | import math
def main():
n = int(eval(input()))
ans = 0
for i in range(1,n+1):
for j in range(1,n+1):
for k in range(1,n+1):
tmp = math.gcd(i,j)
ans += math.gcd(tmp,k)
print(ans)
if __name__ == "__main__":
main() | import math
def main():
n = int(eval(input()))
ans = 0
a = {}
for i in range(1,n+1):
for j in range(1,n+1):
tmp = math.gcd(i,j)
a[tmp] = a.get(tmp, 0)
a[tmp] += 1
for key, val in list(a.items()):
for j in range(1, n+1):
... | 15 | 21 | 294 | 399 | import math
def main():
n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
for k in range(1, n + 1):
tmp = math.gcd(i, j)
ans += math.gcd(tmp, k)
print(ans)
if __name__ == "__main__":
main()
| import math
def main():
n = int(eval(input()))
ans = 0
a = {}
for i in range(1, n + 1):
for j in range(1, n + 1):
tmp = math.gcd(i, j)
a[tmp] = a.get(tmp, 0)
a[tmp] += 1
for key, val in list(a.items()):
for j in range(1, n + 1):
ans +... | false | 28.571429 | [
"+ a = {}",
"- for k in range(1, n + 1):",
"- tmp = math.gcd(i, j)",
"- ans += math.gcd(tmp, k)",
"+ tmp = math.gcd(i, j)",
"+ a[tmp] = a.get(tmp, 0)",
"+ a[tmp] += 1",
"+ for key, val in list(a.items()):",
"+ for... | false | 0.123655 | 0.04159 | 2.973209 | [
"s446365753",
"s499239743"
] |
u588794534 | p02921 | python | s646031156 | s395680166 | 166 | 72 | 38,384 | 61,780 | Accepted | Accepted | 56.63 | s=eval(input())
w=eval(input())
i=0
cnt=0
while i <len(s):
if s[i]==w[i]:
cnt+=1
i+=1
print(cnt)
| s=eval(input())
t=eval(input())
cnt=0
for i in range(3):
if s[i]==t[i]:
cnt+=1
print(cnt) | 12 | 8 | 110 | 97 | s = eval(input())
w = eval(input())
i = 0
cnt = 0
while i < len(s):
if s[i] == w[i]:
cnt += 1
i += 1
print(cnt)
| s = eval(input())
t = eval(input())
cnt = 0
for i in range(3):
if s[i] == t[i]:
cnt += 1
print(cnt)
| false | 33.333333 | [
"-w = eval(input())",
"-i = 0",
"+t = eval(input())",
"-while i < len(s):",
"- if s[i] == w[i]:",
"+for i in range(3):",
"+ if s[i] == t[i]:",
"- i += 1"
] | false | 0.084727 | 0.045252 | 1.87235 | [
"s646031156",
"s395680166"
] |
u391589398 | p03031 | python | s271051903 | s947774369 | 39 | 35 | 9,212 | 9,212 | Accepted | Accepted | 10.26 | n, m = list(map(int, input().split()))
denq = []
for _ in range(m):
ks = tuple([int(x)-1 for x in input().split()])
denq.append(ks[1:])
P = tuple(map(int, input().split()))
ans = 0
for i in range(2**n):
# switch_states = [(i>>j)&1 for j in range(n)]
for idq, dq in enumerate(denq):
co... | n, m = list(map(int, input().split()))
denq = []
for _ in range(m):
ks = tuple([int(x)-1 for x in input().split()])
denq.append(ks[1:])
P = tuple(map(int, input().split()))
ans = 0
for i in range(2**n):
switch_states = [(i>>j)&1 for j in range(n)]
for idq, dq in enumerate(denq):
coun... | 19 | 19 | 473 | 480 | n, m = list(map(int, input().split()))
denq = []
for _ in range(m):
ks = tuple([int(x) - 1 for x in input().split()])
denq.append(ks[1:])
P = tuple(map(int, input().split()))
ans = 0
for i in range(2**n):
# switch_states = [(i>>j)&1 for j in range(n)]
for idq, dq in enumerate(denq):
counts = 0
... | n, m = list(map(int, input().split()))
denq = []
for _ in range(m):
ks = tuple([int(x) - 1 for x in input().split()])
denq.append(ks[1:])
P = tuple(map(int, input().split()))
ans = 0
for i in range(2**n):
switch_states = [(i >> j) & 1 for j in range(n)]
for idq, dq in enumerate(denq):
counts = 0... | false | 0 | [
"- # switch_states = [(i>>j)&1 for j in range(n)]",
"+ switch_states = [(i >> j) & 1 for j in range(n)]",
"- counts += (i >> s) & 1",
"+ counts += switch_states[s]"
] | false | 0.039602 | 0.039437 | 1.004199 | [
"s271051903",
"s947774369"
] |
u949831615 | p02699 | python | s333007279 | s921903059 | 24 | 22 | 9,160 | 9,152 | Accepted | Accepted | 8.33 | S, W = list(map(int, input().split()))
if W >= S:
print('unsafe')
else:
print('safe') | S, W = input().split()
if int(W) >= int(S):
print('unsafe')
else:
print('safe')
| 6 | 5 | 93 | 88 | S, W = list(map(int, input().split()))
if W >= S:
print("unsafe")
else:
print("safe")
| S, W = input().split()
if int(W) >= int(S):
print("unsafe")
else:
print("safe")
| false | 16.666667 | [
"-S, W = list(map(int, input().split()))",
"-if W >= S:",
"+S, W = input().split()",
"+if int(W) >= int(S):"
] | false | 0.137933 | 0.048214 | 2.860853 | [
"s333007279",
"s921903059"
] |
u930705402 | p03607 | python | s792040375 | s287228652 | 253 | 206 | 8,276 | 11,884 | Accepted | Accepted | 18.58 | N=int(eval(input()))
A=[]
for i in range(N):
A.append(int(eval(input())))
B=sorted(A)
ans=0
tmp=B[0]
cnt=1
for i in range(1,N):
if(tmp==B[i]):
cnt+=1
else:
ans+=(cnt%2)
cnt=1
tmp=B[i]
ans+=cnt%2
print(ans) | N=int(eval(input()))
s=set()
for i in range(N):
A=int(eval(input()))
if(A in s):
s.remove(A)
else:
s.add(A)
print((len(s))) | 17 | 9 | 253 | 145 | N = int(eval(input()))
A = []
for i in range(N):
A.append(int(eval(input())))
B = sorted(A)
ans = 0
tmp = B[0]
cnt = 1
for i in range(1, N):
if tmp == B[i]:
cnt += 1
else:
ans += cnt % 2
cnt = 1
tmp = B[i]
ans += cnt % 2
print(ans)
| N = int(eval(input()))
s = set()
for i in range(N):
A = int(eval(input()))
if A in s:
s.remove(A)
else:
s.add(A)
print((len(s)))
| false | 47.058824 | [
"-A = []",
"+s = set()",
"- A.append(int(eval(input())))",
"-B = sorted(A)",
"-ans = 0",
"-tmp = B[0]",
"-cnt = 1",
"-for i in range(1, N):",
"- if tmp == B[i]:",
"- cnt += 1",
"+ A = int(eval(input()))",
"+ if A in s:",
"+ s.remove(A)",
"- ans += cnt % 2",... | false | 0.047791 | 0.106867 | 0.447204 | [
"s792040375",
"s287228652"
] |
u796942881 | p03137 | python | s579803723 | s372490875 | 222 | 111 | 22,960 | 13,840 | Accepted | Accepted | 50 | import numpy as np
N, M = list(map(int, input().split()))
X = [int(i) for i in input().split()]
# 昇順
X.sort()
# numpy array 配列の差分
D = np.diff(X)
# numpy array 降順
D = np.sort(D)[::-1]
# numpy array 先頭から N - 2 まで 合計
print((X[-1] - X[0] - np.sum(D[:N - 1])))
| N, M = list(map(int, input().split()))
X = [int(i) for i in input().split()]
X.sort()
D = [X[i+1] - X[i] for i in range(M - 1)]
D.sort()
print((0 if M <= N else sum(D[:M-N])))
| 16 | 10 | 268 | 181 | import numpy as np
N, M = list(map(int, input().split()))
X = [int(i) for i in input().split()]
# 昇順
X.sort()
# numpy array 配列の差分
D = np.diff(X)
# numpy array 降順
D = np.sort(D)[::-1]
# numpy array 先頭から N - 2 まで 合計
print((X[-1] - X[0] - np.sum(D[: N - 1])))
| N, M = list(map(int, input().split()))
X = [int(i) for i in input().split()]
X.sort()
D = [X[i + 1] - X[i] for i in range(M - 1)]
D.sort()
print((0 if M <= N else sum(D[: M - N])))
| false | 37.5 | [
"-import numpy as np",
"-",
"-# 昇順",
"-# numpy array 配列の差分",
"-D = np.diff(X)",
"-# numpy array 降順",
"-D = np.sort(D)[::-1]",
"-# numpy array 先頭から N - 2 まで 合計",
"-print((X[-1] - X[0] - np.sum(D[: N - 1])))",
"+D = [X[i + 1] - X[i] for i in range(M - 1)]",
"+D.sort()",
"+print((0 if M <= N else... | false | 0.18565 | 0.034932 | 5.314615 | [
"s579803723",
"s372490875"
] |
u667084803 | p03739 | python | s101580132 | s025490860 | 339 | 225 | 14,084 | 14,332 | Accepted | Accepted | 33.63 | # -*- coding: utf-8 -*-
# 整数の入力
n=int(eval(input()))
a=list(map(int, input().split()))
b=a[:]
c=a[:]
# a[0]の符号をそのままにした場合の計算
counter_1=0
S=int(a[0])
for i in range(1,n):
if S<0 and S+int(a[i])<=0:
counter_1+=-S-int(a[i])+1
a[i]=-S+1
elif S>0 and S+int(a[i])>=0:
counter_1+=S+int(a[i])+1
... | # -*- coding: utf-8 -*-
# 整数の入力
n=int(eval(input()))
a=list(map(int, input().split()))
b=a[:]
c=a[:]
# a[0]の符号をそのままにした場合の計算
counter_1=0
S=int(a[0])
for i in range(1,n):
if S<0 and S+a[i]<=0:
counter_1+=-S-a[i]+1
a[i]=-S+1
elif S>0 and S+a[i]>=0:
counter_1+=S+a[i]+1
a[i]=-S-1
S+=a[i... | 42 | 42 | 893 | 808 | # -*- coding: utf-8 -*-
# 整数の入力
n = int(eval(input()))
a = list(map(int, input().split()))
b = a[:]
c = a[:]
# a[0]の符号をそのままにした場合の計算
counter_1 = 0
S = int(a[0])
for i in range(1, n):
if S < 0 and S + int(a[i]) <= 0:
counter_1 += -S - int(a[i]) + 1
a[i] = -S + 1
elif S > 0 and S + int(a[i]) >= 0:
... | # -*- coding: utf-8 -*-
# 整数の入力
n = int(eval(input()))
a = list(map(int, input().split()))
b = a[:]
c = a[:]
# a[0]の符号をそのままにした場合の計算
counter_1 = 0
S = int(a[0])
for i in range(1, n):
if S < 0 and S + a[i] <= 0:
counter_1 += -S - a[i] + 1
a[i] = -S + 1
elif S > 0 and S + a[i] >= 0:
counter... | false | 0 | [
"- if S < 0 and S + int(a[i]) <= 0:",
"- counter_1 += -S - int(a[i]) + 1",
"+ if S < 0 and S + a[i] <= 0:",
"+ counter_1 += -S - a[i] + 1",
"- elif S > 0 and S + int(a[i]) >= 0:",
"- counter_1 += S + int(a[i]) + 1",
"+ elif S > 0 and S + a[i] >= 0:",
"+ counter_... | false | 0.048531 | 0.131523 | 0.368988 | [
"s101580132",
"s025490860"
] |
u620868411 | p03722 | python | s768441462 | s662400818 | 1,104 | 640 | 3,316 | 3,316 | Accepted | Accepted | 42.03 | # -*- coding: utf-8 -*-
inf = 10**15
n,m = list(map(int, input().split()))
edge = []
for _ in range(m):
a,b,c = list(map(int, input().split()))
a -= 1
b -= 1
edge.append((a,b,c))
d = [inf for _ in range(n)]
d[0] = 0
for _ in range(n):
update = False
for i in range(m):
a,b... | # -*- coding: utf-8 -*-
def bellmanFord(e,n,s):
inf = 10**18
d = [inf]*n
d[s] = 0
loop = False
for i in range(n):
updated = False
for v in range(n):
for u,c in e[v]:
if d[v]!=inf and d[u]>d[v]+c:
d[u] = d[v]+c
... | 49 | 34 | 1,123 | 744 | # -*- coding: utf-8 -*-
inf = 10**15
n, m = list(map(int, input().split()))
edge = []
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
edge.append((a, b, c))
d = [inf for _ in range(n)]
d[0] = 0
for _ in range(n):
update = False
for i in range(m):
a, b, c = edge... | # -*- coding: utf-8 -*-
def bellmanFord(e, n, s):
inf = 10**18
d = [inf] * n
d[s] = 0
loop = False
for i in range(n):
updated = False
for v in range(n):
for u, c in e[v]:
if d[v] != inf and d[u] > d[v] + c:
d[u] = d[v] + c
... | false | 30.612245 | [
"-inf = 10**15",
"+def bellmanFord(e, n, s):",
"+ inf = 10**18",
"+ d = [inf] * n",
"+ d[s] = 0",
"+ loop = False",
"+ for i in range(n):",
"+ updated = False",
"+ for v in range(n):",
"+ for u, c in e[v]:",
"+ if d[v] != inf and d[u] > d[v]... | false | 0.056961 | 0.092668 | 0.614679 | [
"s768441462",
"s662400818"
] |
u261103969 | p02623 | python | s493731651 | s827392583 | 1,105 | 242 | 49,068 | 50,592 | Accepted | Accepted | 78.1 | from itertools import accumulate
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_acc = [0] + list(accumulate(a)) # aを0冊読む=1冊も読まない場合があるので
b_acc = [0] + list((accumulate(b))) # 今度は[0]が必要です
ans = 0
for an in range(n + 1):
rem = k - a_a... | from itertools import accumulate
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_acc = [0] + list(accumulate(a))
b_acc = [0] + list((accumulate(b)))
ans = 0
bn = m
for an in range(n + 1):
rem = k - a_acc[an]
if rem < 0:
... | 33 | 23 | 766 | 488 | from itertools import accumulate
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_acc = [0] + list(accumulate(a)) # aを0冊読む=1冊も読まない場合があるので
b_acc = [0] + list((accumulate(b))) # 今度は[0]が必要です
ans = 0
for an in range(n + 1):
rem = k - a_acc[an]
if... | from itertools import accumulate
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_acc = [0] + list(accumulate(a))
b_acc = [0] + list((accumulate(b)))
ans = 0
bn = m
for an in range(n + 1):
rem = k - a_acc[an]
if rem < 0:
break
# rem... | false | 30.30303 | [
"-a_acc = [0] + list(accumulate(a)) # aを0冊読む=1冊も読まない場合があるので",
"-b_acc = [0] + list((accumulate(b))) # 今度は[0]が必要です",
"+a_acc = [0] + list(accumulate(a))",
"+b_acc = [0] + list((accumulate(b)))",
"+bn = m",
"- # 最初は 0 <= x < m + 1 の範囲で、この範囲を狭めていきます",
"- ok = 0",
"- ng = m + 1",
"- # ng =... | false | 0.140915 | 0.063842 | 2.207257 | [
"s493731651",
"s827392583"
] |
u551083572 | p02315 | python | s872367348 | s740391328 | 1,150 | 800 | 29,176 | 27,512 | Accepted | Accepted | 30.43 | # coding: utf-8
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
def array2d(row, col, init = None):
return [[init for _ in range(col)] for _ in range(row)]
N, W = list(map(int, input().split(" ")))
v = []
w ... | # coding: utf-8
def array2d(d1, d2, init = None):
return [[init for _ in range(d2)] for _ in range(d1)]
def solve(N, W, v, w):
# dp[i][k]: 0~i?????????item????????????????????????????????????k??¨??????????????????????????´??????max value
# return: max(dp[N-1][*])
# dp[i][k] = max(dp[i-1][k],... | 42 | 32 | 904 | 933 | # coding: utf-8
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
def array2d(row, col, init=None):
return [[init for _ in range(col)] for _ in range(row)]
N, W = list(map(int, input().split(" ")))
v = []
w = []
for i in range(N):
... | # coding: utf-8
def array2d(d1, d2, init=None):
return [[init for _ in range(d2)] for _ in range(d1)]
def solve(N, W, v, w):
# dp[i][k]: 0~i?????????item????????????????????????????????????k??¨??????????????????????????´??????max value
# return: max(dp[N-1][*])
# dp[i][k] = max(dp[i-1][k], dp[i-1][k-w... | false | 23.809524 | [
"-import math",
"-import string",
"-import itertools",
"-import fractions",
"-import heapq",
"-import collections",
"-import re",
"-import array",
"-import bisect",
"+def array2d(d1, d2, init=None):",
"+ return [[init for _ in range(d2)] for _ in range(d1)]",
"-def array2d(row, col, init=No... | false | 0.111849 | 0.041613 | 2.687872 | [
"s872367348",
"s740391328"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.