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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u347640436 | p02679 | python | s719322819 | s780719256 | 1,583 | 1,355 | 159,512 | 151,468 | Accepted | Accepted | 14.4 | from math import gcd
N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N)]
t = []
d = {}
d[0] = {}
d[0][0] = 0
for a, b in AB:
i = gcd(a, b)
if i != 0:
a //= i
b //= i
t.append((a, b))
d.setdefault(a, {})
d[a].setdefault(b, 0)
d[a][b] ... | from math import gcd
N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N)]
m = 1000000007
t = []
d = {}
d[0] = {}
d[0][0] = 0
for a, b in AB:
i = gcd(a, b)
if i != 0:
a //= i
b //= i
t.append((a, b))
d.setdefault(a, {})
d[a].setdefault(b... | 44 | 45 | 916 | 892 | from math import gcd
N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N)]
t = []
d = {}
d[0] = {}
d[0][0] = 0
for a, b in AB:
i = gcd(a, b)
if i != 0:
a //= i
b //= i
t.append((a, b))
d.setdefault(a, {})
d[a].setdefault(b, 0)
d[a][b] += 1
t = set(t)
if... | from math import gcd
N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N)]
m = 1000000007
t = []
d = {}
d[0] = {}
d[0][0] = 0
for a, b in AB:
i = gcd(a, b)
if i != 0:
a //= i
b //= i
t.append((a, b))
d.setdefault(a, {})
d[a].setdefault(b, 0)
d[a][b] += ... | false | 2.222222 | [
"+m = 1000000007",
"-t = set(t)",
"-if (0, 0) in t:",
"- t.remove((0, 0))",
"+ if a == 0 and b == 0:",
"+ continue",
"- result *= pow(2, i + j, 1000000007) + pow(2, k + l, 1000000007) - 1",
"- result %= 1000000007",
"+ result *= pow(2, i + j, m) + pow(2, k + l, m) - 1",
"+ ... | false | 0.068147 | 0.103915 | 0.655802 | [
"s719322819",
"s780719256"
] |
u339199690 | p02959 | python | s568022552 | s746759753 | 163 | 144 | 20,680 | 19,228 | Accepted | Accepted | 11.66 | import sys, heapq, bisect, math, fractions
from collections import deque
N = int(eval(input()))
A = list(map(int, sys.stdin.readline().rsplit()))
B = list(map(int, sys.stdin.readline().rsplit()))
res = 0
for i, b in enumerate(B):
a = A[i]
a1 = A[i + 1]
if a >= b:
res += b
else:
... | import sys
N = int(eval(input()))
A = list(map(int, sys.stdin.readline().rsplit()))
B = list(map(int, sys.stdin.readline().rsplit()))
res = 0
for i, b in enumerate(B):
a = A[i]
a1 = A[i + 1]
if a >= b:
res += b
else:
res += a
if a1 >= b - a:
A[i + 1] ... | 23 | 22 | 495 | 432 | import sys, heapq, bisect, math, fractions
from collections import deque
N = int(eval(input()))
A = list(map(int, sys.stdin.readline().rsplit()))
B = list(map(int, sys.stdin.readline().rsplit()))
res = 0
for i, b in enumerate(B):
a = A[i]
a1 = A[i + 1]
if a >= b:
res += b
else:
res += a... | import sys
N = int(eval(input()))
A = list(map(int, sys.stdin.readline().rsplit()))
B = list(map(int, sys.stdin.readline().rsplit()))
res = 0
for i, b in enumerate(B):
a = A[i]
a1 = A[i + 1]
if a >= b:
res += b
else:
res += a
if a1 >= b - a:
A[i + 1] = a1 - (b - a)
... | false | 4.347826 | [
"-import sys, heapq, bisect, math, fractions",
"-from collections import deque",
"+import sys"
] | false | 0.041927 | 0.040759 | 1.028674 | [
"s568022552",
"s746759753"
] |
u729535891 | p03160 | python | s457687030 | s090442205 | 166 | 140 | 13,980 | 13,928 | Accepted | Accepted | 15.66 | n = int(eval(input()))
h = list(map(int, input().split()))
def chmin(a, b):
if a > b:
return b
else:
return a
dp = [float('inf')] * n
dp[0] = 0
for i in range(0, n - 1):
dp[i + 1] = chmin(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
if i < n - 2:
dp[i + 2] = chmin(dp[i ... | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float('inf')] * (n + 10)
dp[0] = 0
def chmin(a, b):
if a < b:
return a
else:
return b
for i in range(n):
if i == 0:
dp[i + 1] = dp[i] + abs(h[i + 1] - h[i])
if i < n - 2:
dp[i + 2] = chmin(dp[... | 16 | 17 | 369 | 398 | n = int(eval(input()))
h = list(map(int, input().split()))
def chmin(a, b):
if a > b:
return b
else:
return a
dp = [float("inf")] * n
dp[0] = 0
for i in range(0, n - 1):
dp[i + 1] = chmin(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
if i < n - 2:
dp[i + 2] = chmin(dp[i + 2], dp[i... | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * (n + 10)
dp[0] = 0
def chmin(a, b):
if a < b:
return a
else:
return b
for i in range(n):
if i == 0:
dp[i + 1] = dp[i] + abs(h[i + 1] - h[i])
if i < n - 2:
dp[i + 2] = chmin(
d... | false | 5.882353 | [
"+dp = [float(\"inf\")] * (n + 10)",
"+dp[0] = 0",
"- if a > b:",
"+ if a < b:",
"+ return a",
"+ else:",
"- else:",
"- return a",
"-dp = [float(\"inf\")] * n",
"-dp[0] = 0",
"-for i in range(0, n - 1):",
"- dp[i + 1] = chmin(dp[i + 1], dp[i] + abs(h[i + 1] - h[i])... | false | 0.047354 | 0.047261 | 1.001966 | [
"s457687030",
"s090442205"
] |
u347600233 | p02911 | python | s941332137 | s533617903 | 252 | 175 | 10,980 | 15,976 | Accepted | Accepted | 30.56 | n, k, q = map(int, input().split())
aq = [int(input()) for i in range(q)]
point = [k for i in range(n)]
correct_ans = [0] * n
for i in range(q):
correct_ans[aq[i] - 1] += 1
point = ['Yes' if p - (q - ca) > 0 else 'No' for (p, ca) in zip(point, correct_ans)]
print(*point, sep='\n')
| n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]
c = [0] * n
for ai in a:
c[ai - 1] += 1
ans = ['Yes' if k - q + ci > 0 else 'No' for ci in c]
print(*ans, sep='\n')
| 10 | 7 | 301 | 198 | n, k, q = map(int, input().split())
aq = [int(input()) for i in range(q)]
point = [k for i in range(n)]
correct_ans = [0] * n
for i in range(q):
correct_ans[aq[i] - 1] += 1
point = ["Yes" if p - (q - ca) > 0 else "No" for (p, ca) in zip(point, correct_ans)]
print(*point, sep="\n")
| n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]
c = [0] * n
for ai in a:
c[ai - 1] += 1
ans = ["Yes" if k - q + ci > 0 else "No" for ci in c]
print(*ans, sep="\n")
| false | 30 | [
"-aq = [int(input()) for i in range(q)]",
"-point = [k for i in range(n)]",
"-correct_ans = [0] * n",
"-for i in range(q):",
"- correct_ans[aq[i] - 1] += 1",
"-point = [\"Yes\" if p - (q - ca) > 0 else \"No\" for (p, ca) in zip(point, correct_ans)]",
"-print(*point, sep=\"\\n\")",
"+a = [int(input(... | false | 0.039489 | 0.04014 | 0.983779 | [
"s941332137",
"s533617903"
] |
u844646164 | p03111 | python | s404641985 | s962804916 | 797 | 269 | 82,192 | 46,812 | Accepted | Accepted | 66.25 | N, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
used = [0]*N
global pattern
pattern = []
global ans
ans = float('inf')
def dfs(A):
global pattern
global ans
if len(A) == N:
pattern.append(A)
ans = min(ans, MP(A))
return
... |
N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
def dfs(cur, a, b, c):
if cur == N:
return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) > 0 else float('inf')
ret0 = dfs(cur+1, a, b, c)
ret1 = dfs(cur+1, a+l[cur], b, c) + 10
ret2 = d... | 58 | 15 | 1,293 | 448 | N, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
used = [0] * N
global pattern
pattern = []
global ans
ans = float("inf")
def dfs(A):
global pattern
global ans
if len(A) == N:
pattern.append(A)
ans = min(ans, MP(A))
return
for i in range(4... | N, A, B, C = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(N)]
def dfs(cur, a, b, c):
if cur == N:
return (
abs(a - A) + abs(b - B) + abs(c - C) - 30
if min(a, b, c) > 0
else float("inf")
)
ret0 = dfs(cur + 1, a, b, c)
ret1 = dfs... | false | 74.137931 | [
"-N, a, b, c = list(map(int, input().split()))",
"+N, A, B, C = list(map(int, input().split()))",
"-used = [0] * N",
"-global pattern",
"-pattern = []",
"-global ans",
"-ans = float(\"inf\")",
"-def dfs(A):",
"- global pattern",
"- global ans",
"- if len(A) == N:",
"- pattern.a... | false | 0.984001 | 0.083977 | 11.717519 | [
"s404641985",
"s962804916"
] |
u811733736 | p02389 | python | s821361769 | s688367121 | 40 | 30 | 7,552 | 7,664 | Accepted | Accepted | 25 | if __name__ == '__main__':
key_in = eval(input())
data = key_in.split(' ')
height = int(data[0])
width = int(data[1])
area = height * width
perimeter = 2 * height + 2 * width
print(('{0} {1}'.format(area, perimeter))) | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
a, b = list(map(int, input().split()))
print((a*b, (a*2 + b*2)))
if __name__ == '__main__':
main(sys.argv[1:]... | 9 | 17 | 246 | 313 | if __name__ == "__main__":
key_in = eval(input())
data = key_in.split(" ")
height = int(data[0])
width = int(data[1])
area = height * width
perimeter = 2 * height + 2 * width
print(("{0} {1}".format(area, perimeter)))
| # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
a, b = list(map(int, input().split()))
print((a * b, (a * 2 + b * 2)))
if __name__ == "__main__":
main(sys.argv[1:])
| false | 47.058824 | [
"+# -*- coding: utf-8 -*-",
"+\"\"\"",
"+http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C&lang=jp",
"+\"\"\"",
"+import sys",
"+from sys import stdin",
"+",
"+input = stdin.readline",
"+",
"+",
"+def main(args):",
"+ a, b = list(map(int, input().split()))",
"+ print((a... | false | 0.041999 | 0.086057 | 0.488037 | [
"s821361769",
"s688367121"
] |
u588341295 | p03290 | python | s168781118 | s521554407 | 55 | 47 | 3,444 | 3,444 | Accepted | Accepted | 14.55 | # -*- coding: utf-8 -*-
""" ビット全検索をちゃんと使ってみる版 """
D, G = list(map(int, input().split()))
# 各点数問題毎の、全問解いた場合の回答数と得点を保持
class ScoreSet:
def __init__(self, times, score):
self.times = times
self.score = score
# 各パターン毎の、合計回答数と合計得点と、どの点数問題を全問解いたのかを保持
class ScoreSetSum:
def __init__(s... | # -*- coding: utf-8 -*-
""" ビット全検索をちゃんと使ってみる版2 """
D, G = list(map(int, input().split()))
# 各点数問題毎の、全問解いた場合の回答数と得点を保持
class ScoreSet:
def __init__(self, times, score):
self.times = times
self.score = score
# 各パターン毎の、合計回答数と合計得点と、どの点数問題を全問解いたのかを保持
class ScoreSetSum:
def __init__(... | 78 | 67 | 2,267 | 1,956 | # -*- coding: utf-8 -*-
""" ビット全検索をちゃんと使ってみる版 """
D, G = list(map(int, input().split()))
# 各点数問題毎の、全問解いた場合の回答数と得点を保持
class ScoreSet:
def __init__(self, times, score):
self.times = times
self.score = score
# 各パターン毎の、合計回答数と合計得点と、どの点数問題を全問解いたのかを保持
class ScoreSetSum:
def __init__(self, times, scor... | # -*- coding: utf-8 -*-
""" ビット全検索をちゃんと使ってみる版2 """
D, G = list(map(int, input().split()))
# 各点数問題毎の、全問解いた場合の回答数と得点を保持
class ScoreSet:
def __init__(self, times, score):
self.times = times
self.score = score
# 各パターン毎の、合計回答数と合計得点と、どの点数問題を全問解いたのかを保持
class ScoreSetSum:
def __init__(self, times, sco... | false | 14.102564 | [
"-\"\"\" ビット全検索をちゃんと使ってみる版 \"\"\"",
"+\"\"\" ビット全検索をちゃんと使ってみる版2 \"\"\"",
"-# どの点数問題を全問解いたのかの各パターンの全網羅",
"-# bool_lists = list(itertools.product([True, False], repeat=D))",
"-# ビット数に応じた全パターン数のループ",
"-bool_lists = []",
"+# ビット全検索のループとScoreSetのリストから、ScoreSetSumのリストを作成",
"+scoreSetSumList = []",
"- #... | false | 0.037497 | 0.037338 | 1.004252 | [
"s168781118",
"s521554407"
] |
u077852398 | p03814 | python | s715760282 | s509474565 | 53 | 30 | 10,548 | 9,316 | Accepted | Accepted | 43.4 | s = list(eval(input()))
for i,j in enumerate(s):
if j == 'A':
a = i
break
for i,j in enumerate(s):
if j == 'Z':
z = i
print((z-a+1)) | s = eval(input())
first = s.index('A')
end = s.rindex('Z')
ans = end - first + 1
print(ans) | 10 | 7 | 166 | 93 | s = list(eval(input()))
for i, j in enumerate(s):
if j == "A":
a = i
break
for i, j in enumerate(s):
if j == "Z":
z = i
print((z - a + 1))
| s = eval(input())
first = s.index("A")
end = s.rindex("Z")
ans = end - first + 1
print(ans)
| false | 30 | [
"-s = list(eval(input()))",
"-for i, j in enumerate(s):",
"- if j == \"A\":",
"- a = i",
"- break",
"-for i, j in enumerate(s):",
"- if j == \"Z\":",
"- z = i",
"-print((z - a + 1))",
"+s = eval(input())",
"+first = s.index(\"A\")",
"+end = s.rindex(\"Z\")",
"+ans ... | false | 0.04134 | 0.038961 | 1.061079 | [
"s715760282",
"s509474565"
] |
u835924161 | p02780 | python | s463764884 | s511342994 | 175 | 152 | 25,060 | 25,060 | Accepted | Accepted | 13.14 | n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
for i in range(n):
A[i]+=1
for i in range(n-1):
A[i+1]+=A[i]
ans=0.0
A.reverse()
A.append(0)
A.reverse()
for i in range(n-k+1):
now=A[i+k]-A[i]
if now>ans:
ans=now
print((ans/2)) | n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
for i in range(n-1):
A[i+1]+=A[i]
ans=0.0
A.reverse()
A.append(0)
A.reverse()
for i in range(n-k+1):
now=A[i+k]-A[i]
if now>ans:
ans=now
print(((ans+k)/2)) | 19 | 17 | 284 | 255 | n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(n):
A[i] += 1
for i in range(n - 1):
A[i + 1] += A[i]
ans = 0.0
A.reverse()
A.append(0)
A.reverse()
for i in range(n - k + 1):
now = A[i + k] - A[i]
if now > ans:
ans = now
print((ans / 2))
| n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(n - 1):
A[i + 1] += A[i]
ans = 0.0
A.reverse()
A.append(0)
A.reverse()
for i in range(n - k + 1):
now = A[i + k] - A[i]
if now > ans:
ans = now
print(((ans + k) / 2))
| false | 10.526316 | [
"-for i in range(n):",
"- A[i] += 1",
"-print((ans / 2))",
"+print(((ans + k) / 2))"
] | false | 0.046975 | 0.046635 | 1.007284 | [
"s463764884",
"s511342994"
] |
u996952235 | p03243 | python | s658701052 | s724592144 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | for i in range(int(eval(input())), 1000):
if(str(i)[0] == str(i)[1] and str(i)[1] == str(i)[2]):
print(i)
break | n = int(eval(input()))
for i in range(n,1000):
if i % 111 == 0:
print(i)
break | 4 | 6 | 118 | 84 | for i in range(int(eval(input())), 1000):
if str(i)[0] == str(i)[1] and str(i)[1] == str(i)[2]:
print(i)
break
| n = int(eval(input()))
for i in range(n, 1000):
if i % 111 == 0:
print(i)
break
| false | 33.333333 | [
"-for i in range(int(eval(input())), 1000):",
"- if str(i)[0] == str(i)[1] and str(i)[1] == str(i)[2]:",
"+n = int(eval(input()))",
"+for i in range(n, 1000):",
"+ if i % 111 == 0:"
] | false | 0.040332 | 0.038883 | 1.037244 | [
"s658701052",
"s724592144"
] |
u083960235 | p03574 | python | s345863165 | s933682712 | 55 | 45 | 5,524 | 10,668 | Accepted | Accepted | 18.18 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 54 | 48 | 1,551 | 1,494 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 11.111111 | [
"+from bisect import bisect, bisect_left, bisect_right",
"- return int(eval(input()))",
"+ return int(input())",
"- return list(map(int, input().split()))",
"+ return map(int, input().split())",
"- return list(map(str, input().split()))",
"+ return map(str, input().split())",
"-h, w ... | false | 0.041768 | 0.100335 | 0.416284 | [
"s345863165",
"s933682712"
] |
u219417113 | p02757 | python | s292700359 | s911195019 | 228 | 142 | 44,364 | 4,580 | Accepted | Accepted | 37.72 | n, p = list(map(int, input().split()))
s = eval(input())
if 10 % p == 0:
ans = sum(i + 1 for i, x in enumerate(s) if int(x) % p == 0)
print(ans)
else:
counter = [0] * p
counter[0] = 1
cur = 0
p10 = 1
ans = 0
for x in s[::-1]:
cur = (cur + int(x) * p10) % p
... | def main():
import sys
input = sys.stdin.readline
from collections import defaultdict
N, P = list(map(int, input().split()))
S = input().rstrip()
if P in (2, 5):
ans = 0
for i, c in enumerate(S):
if int(c) % P == 0:
ans += i + 1
prin... | 20 | 30 | 410 | 681 | n, p = list(map(int, input().split()))
s = eval(input())
if 10 % p == 0:
ans = sum(i + 1 for i, x in enumerate(s) if int(x) % p == 0)
print(ans)
else:
counter = [0] * p
counter[0] = 1
cur = 0
p10 = 1
ans = 0
for x in s[::-1]:
cur = (cur + int(x) * p10) % p
ans += counter[... | def main():
import sys
input = sys.stdin.readline
from collections import defaultdict
N, P = list(map(int, input().split()))
S = input().rstrip()
if P in (2, 5):
ans = 0
for i, c in enumerate(S):
if int(c) % P == 0:
ans += i + 1
print(ans)
... | false | 33.333333 | [
"-n, p = list(map(int, input().split()))",
"-s = eval(input())",
"-if 10 % p == 0:",
"- ans = sum(i + 1 for i, x in enumerate(s) if int(x) % p == 0)",
"+def main():",
"+ import sys",
"+",
"+ input = sys.stdin.readline",
"+ from collections import defaultdict",
"+",
"+ N, P = list(... | false | 0.153636 | 0.037874 | 4.056513 | [
"s292700359",
"s911195019"
] |
u021019433 | p03053 | python | s908343605 | s199907487 | 569 | 525 | 132,688 | 132,688 | Accepted | Accepted | 7.73 | h, w = list(map(int, input().split()))
rb = [['#'] * (w + 2)]
a = rb + [list('#' + eval(input()) + '#') for _ in range(h)] + rb
p = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1) if a[i][j] == '#']
d = (-1, 0), (1, 0), (0, -1), (0, 1)
r = -1
while p:
r += 1
s = []
for di, dj in d:
... | h, w = list(map(int, input().split()))
rb = [['#'] * (w + 2)]
a = rb + [list('#' + eval(input()) + '#') for _ in range(h)] + rb
p = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1) if a[i][j] == '#']
d = (-1, 0), (1, 0), (0, -1), (0, 1)
r = -1
while p:
r += 1
s = []
for i, j in p:
... | 18 | 18 | 485 | 491 | h, w = list(map(int, input().split()))
rb = [["#"] * (w + 2)]
a = rb + [list("#" + eval(input()) + "#") for _ in range(h)] + rb
p = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1) if a[i][j] == "#"]
d = (-1, 0), (1, 0), (0, -1), (0, 1)
r = -1
while p:
r += 1
s = []
for di, dj in d:
for i, ... | h, w = list(map(int, input().split()))
rb = [["#"] * (w + 2)]
a = rb + [list("#" + eval(input()) + "#") for _ in range(h)] + rb
p = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1) if a[i][j] == "#"]
d = (-1, 0), (1, 0), (0, -1), (0, 1)
r = -1
while p:
r += 1
s = []
for i, j in p:
for di, d... | false | 0 | [
"- for di, dj in d:",
"- for i, j in p:",
"- i += di",
"- j += dj",
"- if a[i][j] == \".\":",
"- a[i][j] = \"#\"",
"- s.append((i, j))",
"+ for i, j in p:",
"+ for di, dj in d:",
"+ di += i",
"+ ... | false | 0.03882 | 0.098075 | 0.395824 | [
"s908343605",
"s199907487"
] |
u600402037 | p02813 | python | s413709201 | s967455626 | 55 | 29 | 10,356 | 3,064 | Accepted | Accepted | 47.27 | import sys
import itertools
import math
#import numpy as np
stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip() # ignore trailing spaces
N = ri()
P = rl()
Q = rl()
L = []
for x in itertools.per... | import sys
import itertools
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
P = tuple(lr())
Q = tuple(lr())
a = -1; b = -1
for i, x in enumerate(itertools.permutations(list(range(1, N+1)), N)):
if x == P:
a = i
if x == ... | 26 | 19 | 506 | 368 | import sys
import itertools
import math
# import numpy as np
stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip() # ignore trailing spaces
N = ri()
P = rl()
Q = rl()
L = []
for x in itertools.permutations(list(... | import sys
import itertools
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
P = tuple(lr())
Q = tuple(lr())
a = -1
b = -1
for i, x in enumerate(itertools.permutations(list(range(1, N + 1)), N)):
if x == P:
a = i
if x == Q:
b =... | false | 26.923077 | [
"-import math",
"-# import numpy as np",
"-stdin = sys.stdin",
"-ri = lambda: int(rs())",
"-rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only",
"-rs = lambda: stdin.readline().rstrip() # ignore trailing spaces",
"-N = ri()",
"-P = rl()",
"-Q = rl()",
"-L = []",
"-... | false | 0.133352 | 0.04045 | 3.296689 | [
"s413709201",
"s967455626"
] |
u695811449 | p03287 | python | s924293235 | s067681372 | 113 | 91 | 14,696 | 16,556 | Accepted | Accepted | 19.47 |
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
S=[0]*(N+1)
for i in range(N):
S[i+1]=(A[i]+S[i])%M
def tr(k):
return k*(k-1)//2
S.sort()
S=[-1]+S+[-1]
count=0
ANS=0
for i in range(1,N+3):
if S[i]==S[i-1]:
count+=1
else:
ANS+=tr(count)... | N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
SUM=[0]
for a in A:
SUM.append((SUM[-1]+a)%M)
from collections import Counter
counter=Counter(SUM)
ANS=0
for i in list(counter.values()):
ANS+=i*(i-1)//2
print(ANS) | 28 | 15 | 346 | 246 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
S = [0] * (N + 1)
for i in range(N):
S[i + 1] = (A[i] + S[i]) % M
def tr(k):
return k * (k - 1) // 2
S.sort()
S = [-1] + S + [-1]
count = 0
ANS = 0
for i in range(1, N + 3):
if S[i] == S[i - 1]:
count += 1
else:
... | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
SUM = [0]
for a in A:
SUM.append((SUM[-1] + a) % M)
from collections import Counter
counter = Counter(SUM)
ANS = 0
for i in list(counter.values()):
ANS += i * (i - 1) // 2
print(ANS)
| false | 46.428571 | [
"-S = [0] * (N + 1)",
"-for i in range(N):",
"- S[i + 1] = (A[i] + S[i]) % M",
"+SUM = [0]",
"+for a in A:",
"+ SUM.append((SUM[-1] + a) % M)",
"+from collections import Counter",
"-",
"-def tr(k):",
"- return k * (k - 1) // 2",
"-",
"-",
"-S.sort()",
"-S = [-1] + S + [-1]",
"-c... | false | 0.09292 | 0.034071 | 2.727221 | [
"s924293235",
"s067681372"
] |
u726615467 | p03078 | python | s480954743 | s214308030 | 379 | 45 | 57,308 | 4,712 | Accepted | Accepted | 88.13 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = sorted(A)[::-1]
B = sorted(B)[::-1]
C = sorted(C)[::-1]
import bisect, heapq
def myidx(x, y, z, X, Y, Z): return(x * (Y * X) + y * Z + z)
ans = 0
... | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = sorted(A)[::-1]
B = sorted(B)[::-1]
C = sorted(C)[::-1]
import bisect, heapq
def myidx(x, y, z, X, Y, Z): return(x * (Y * X) + y * Z + z)
ans = 0
... | 50 | 50 | 1,522 | 1,555 | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = sorted(A)[::-1]
B = sorted(B)[::-1]
C = sorted(C)[::-1]
import bisect, heapq
def myidx(x, y, z, X, Y, Z):
return x * (Y * X) + y * Z + z
ans = 0
cnt = 0
sc... | X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = sorted(A)[::-1]
B = sorted(B)[::-1]
C = sorted(C)[::-1]
import bisect, heapq
def myidx(x, y, z, X, Y, Z):
return x * (Y * X) + y * Z + z
ans = 0
cnt = 0
sc... | false | 0 | [
"-history = []",
"+history = {}",
"- if idx_tmp not in history:",
"+ if history.setdefault(str(idx_tmp), 0) == 0:",
"- heapq.heappush(history, idx_tmp)",
"+ history[str(idx_tmp)] = 1",
"- if idx_tmp not in history:",
"+ if history.setdefault(str(idx_tm... | false | 0.036027 | 0.033872 | 1.063631 | [
"s480954743",
"s214308030"
] |
u814986259 | p02761 | python | s232894644 | s096484106 | 21 | 18 | 3,316 | 3,064 | Accepted | Accepted | 14.29 | import collections
N, M = list(map(int, input().split()))
sc = [tuple(map(int, input().split())) for i in range(M)]
t = collections.defaultdict(int)
flag = True
for s, c in sc:
if s in t and t[s] != c:
flag = False
break
else:
t[s] = c
if flag:
ans = []
for i in ra... | N,M=list(map(int,input().split()))
d = dict()
for i in range(M):
a,b=list(map(int,input().split()))
if a not in d:
d[a]=b
else:
if d[a]!=b:
print((-1))
exit(0)
tmp=0
for i in range(10):
if 3 in d and d[3] != i:
continue
for j in range(10):
if 2 in d and d[2] != j:
... | 33 | 25 | 769 | 504 | import collections
N, M = list(map(int, input().split()))
sc = [tuple(map(int, input().split())) for i in range(M)]
t = collections.defaultdict(int)
flag = True
for s, c in sc:
if s in t and t[s] != c:
flag = False
break
else:
t[s] = c
if flag:
ans = []
for i in range(1, N + 1):... | N, M = list(map(int, input().split()))
d = dict()
for i in range(M):
a, b = list(map(int, input().split()))
if a not in d:
d[a] = b
else:
if d[a] != b:
print((-1))
exit(0)
tmp = 0
for i in range(10):
if 3 in d and d[3] != i:
continue
for j in range(10)... | false | 24.242424 | [
"-import collections",
"-",
"-sc = [tuple(map(int, input().split())) for i in range(M)]",
"-t = collections.defaultdict(int)",
"-flag = True",
"-for s, c in sc:",
"- if s in t and t[s] != c:",
"- flag = False",
"- break",
"+d = dict()",
"+for i in range(M):",
"+ a, b = list... | false | 0.045531 | 0.044181 | 1.030547 | [
"s232894644",
"s096484106"
] |
u504836877 | p03450 | python | s328494373 | s529955868 | 1,958 | 1,410 | 104,424 | 66,284 | Accepted | Accepted | 27.99 | N,M = list(map(int, input().split()))
L = [0]*M
R = [0]*M
D = [0]*M
for i in range(M):
L[i], R[i], D[i] = list(map(int, input().split()))
G = [[] for _ in range(N)]
for i in range(M):
G[L[i]-1].append([R[i]-1, D[i]])
G[R[i]-1].append([L[i]-1, -D[i]])
ans = "Yes"
visited = ["?"]*N
for... | N,M = list(map(int, input().split()))
E = [[] for _ in range(N)]
for _ in range(M):
l,r,d = list(map(int, input().split()))
E[l-1].append((r-1, d))
E[r-1].append((l-1, -d))
from collections import deque
human = ["0"]*N
ans = "Yes"
for i in range(N):
if ans == "No":
break
if len... | 31 | 34 | 855 | 878 | N, M = list(map(int, input().split()))
L = [0] * M
R = [0] * M
D = [0] * M
for i in range(M):
L[i], R[i], D[i] = list(map(int, input().split()))
G = [[] for _ in range(N)]
for i in range(M):
G[L[i] - 1].append([R[i] - 1, D[i]])
G[R[i] - 1].append([L[i] - 1, -D[i]])
ans = "Yes"
visited = ["?"] * N
for i in r... | N, M = list(map(int, input().split()))
E = [[] for _ in range(N)]
for _ in range(M):
l, r, d = list(map(int, input().split()))
E[l - 1].append((r - 1, d))
E[r - 1].append((l - 1, -d))
from collections import deque
human = ["0"] * N
ans = "Yes"
for i in range(N):
if ans == "No":
break
if len... | false | 8.823529 | [
"-L = [0] * M",
"-R = [0] * M",
"-D = [0] * M",
"-for i in range(M):",
"- L[i], R[i], D[i] = list(map(int, input().split()))",
"-G = [[] for _ in range(N)]",
"-for i in range(M):",
"- G[L[i] - 1].append([R[i] - 1, D[i]])",
"- G[R[i] - 1].append([L[i] - 1, -D[i]])",
"+E = [[] for _ in rang... | false | 0.039331 | 0.03919 | 1.0036 | [
"s328494373",
"s529955868"
] |
u738898077 | p02678 | python | s707751130 | s947926032 | 841 | 755 | 38,408 | 36,044 | Accepted | Accepted | 10.23 | from collections import deque
n,m, = list(map(int,input().split()))
# ab =[list(map(int,input().split())) for i in range(m)]
v = [[i,-1] for i in range(n+1)]
v[1][1] = 0
for i in range(m):
a,b = list(map(int,input().split()))
v[a].append(b)
v[b].append(a)
dq = deque([])
dq.append(v[1])
# print(... | from collections import deque
n,m = list(map(int,input().split()))
# ab = [list(map(int,input().split())) for i in range(m)]
v = [[0]]*2 + [[10**9] for i in range(n-1)]
# print(v)
for i in range(m):
a,b = list(map(int,input().split()))
v[a].append(b)
v[b].append(a)
q = deque([1])
# print(v)
while... | 23 | 20 | 533 | 493 | from collections import deque
(
n,
m,
) = list(map(int, input().split()))
# ab =[list(map(int,input().split())) for i in range(m)]
v = [[i, -1] for i in range(n + 1)]
v[1][1] = 0
for i in range(m):
a, b = list(map(int, input().split()))
v[a].append(b)
v[b].append(a)
dq = deque([])
dq.append(v[1])
#... | from collections import deque
n, m = list(map(int, input().split()))
# ab = [list(map(int,input().split())) for i in range(m)]
v = [[0]] * 2 + [[10**9] for i in range(n - 1)]
# print(v)
for i in range(m):
a, b = list(map(int, input().split()))
v[a].append(b)
v[b].append(a)
q = deque([1])
# print(v)
while q... | false | 13.043478 | [
"-(",
"- n,",
"- m,",
"-) = list(map(int, input().split()))",
"-# ab =[list(map(int,input().split())) for i in range(m)]",
"-v = [[i, -1] for i in range(n + 1)]",
"-v[1][1] = 0",
"+n, m = list(map(int, input().split()))",
"+# ab = [list(map(int,input().split())) for i in range(m)]",
"+v = [[... | false | 0.035799 | 0.036183 | 0.989399 | [
"s707751130",
"s947926032"
] |
u612721349 | p03610 | python | s536871274 | s395822252 | 19 | 17 | 4,268 | 3,192 | Accepted | Accepted | 10.53 | print(("".join(list(eval(input()))[::2]))) | print((input()[::2])) | 1 | 1 | 34 | 19 | print(("".join(list(eval(input()))[::2])))
| print((input()[::2]))
| false | 0 | [
"-print((\"\".join(list(eval(input()))[::2])))",
"+print((input()[::2]))"
] | false | 0.039539 | 0.038525 | 1.026328 | [
"s536871274",
"s395822252"
] |
u111365362 | p03103 | python | s491304440 | s927416763 | 1,974 | 500 | 27,756 | 27,760 | Accepted | Accepted | 74.67 | N,M = list(map(int,input().split()))
ab = []
for i in range(N):
ab += [list(map(int,input().split()))]
ab.sort()
rest = M
cost = 0
while True:
if rest - ab[0][1] <= 0:
cost += rest * ab[0][0]
break
else:
rest -= ab[0][1]
cost += ab[0][0] * ab[0][1]
del ab[0]
print(cost) | n,m = list(map(int,input().split()))
ab = []
for _ in range(n):
ab.append(list(map(int,input().split())))
ab.sort()
ans = 0
for i in range(n):
a,b = ab[i]
if m > b:
m -= b
ans += a * b
else:
ans += a * m
break
#print(m,ans)
print(ans) | 16 | 16 | 305 | 269 | N, M = list(map(int, input().split()))
ab = []
for i in range(N):
ab += [list(map(int, input().split()))]
ab.sort()
rest = M
cost = 0
while True:
if rest - ab[0][1] <= 0:
cost += rest * ab[0][0]
break
else:
rest -= ab[0][1]
cost += ab[0][0] * ab[0][1]
del ab[0]
print(... | n, m = list(map(int, input().split()))
ab = []
for _ in range(n):
ab.append(list(map(int, input().split())))
ab.sort()
ans = 0
for i in range(n):
a, b = ab[i]
if m > b:
m -= b
ans += a * b
else:
ans += a * m
break
# print(m,ans)
print(ans)
| false | 0 | [
"-N, M = list(map(int, input().split()))",
"+n, m = list(map(int, input().split()))",
"-for i in range(N):",
"- ab += [list(map(int, input().split()))]",
"+for _ in range(n):",
"+ ab.append(list(map(int, input().split())))",
"-rest = M",
"-cost = 0",
"-while True:",
"- if rest - ab[0][1] ... | false | 0.047761 | 0.075796 | 0.630134 | [
"s491304440",
"s927416763"
] |
u546285759 | p00025 | python | s694480294 | s709924697 | 30 | 20 | 7,636 | 7,712 | Accepted | Accepted | 33.33 | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
hit = sum(1 for x, y in zip(a, b) if x == y)
hits = [x for x, y in zip(a, b) if x == y]
blow = sum(1 for x in a if x in b and x not in hits)
print((hit, blow))
except:... | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except:
break
print((sum(x == y for x, y in zip(a, b)), sum(a[i] != b[i] and a[i] in b for i in range(4)))) | 10 | 7 | 333 | 237 | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
hit = sum(1 for x, y in zip(a, b) if x == y)
hits = [x for x, y in zip(a, b) if x == y]
blow = sum(1 for x in a if x in b and x not in hits)
print((hit, blow))
except:
... | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except:
break
print(
(
sum(x == y for x, y in zip(a, b)),
sum(a[i] != b[i] and a[i] in b for i in range(4)),
)
)
| false | 30 | [
"- hit = sum(1 for x, y in zip(a, b) if x == y)",
"- hits = [x for x, y in zip(a, b) if x == y]",
"- blow = sum(1 for x in a if x in b and x not in hits)",
"- print((hit, blow))",
"+ print(",
"+ (",
"+ sum(x == y for x, y in zip(a, b)),",
"+ ... | false | 0.042878 | 0.04223 | 1.015339 | [
"s694480294",
"s709924697"
] |
u141786930 | p02918 | python | s482511472 | s973857605 | 43 | 32 | 3,956 | 3,316 | Accepted | Accepted | 25.58 | n, k = list(map(int, input().split()))
s = list(eval(input()))
h = 0
for i in range(1, len(s)):
if s[i-1] == s[i]:
h += 1
print((min(n-1, h+k*2)))
| def main():
N, K = list(map(int,input().split()))
S = eval(input())
#幸せな人の数
h = 0
s1 = 'S'
for s in S:
if s == s1:
h += 1
s1 = s
print((min(h+(K*2) ,N-1)))
if __name__ == '__main__':
main() | 9 | 16 | 163 | 254 | n, k = list(map(int, input().split()))
s = list(eval(input()))
h = 0
for i in range(1, len(s)):
if s[i - 1] == s[i]:
h += 1
print((min(n - 1, h + k * 2)))
| def main():
N, K = list(map(int, input().split()))
S = eval(input())
# 幸せな人の数
h = 0
s1 = "S"
for s in S:
if s == s1:
h += 1
s1 = s
print((min(h + (K * 2), N - 1)))
if __name__ == "__main__":
main()
| false | 43.75 | [
"-n, k = list(map(int, input().split()))",
"-s = list(eval(input()))",
"-h = 0",
"-for i in range(1, len(s)):",
"- if s[i - 1] == s[i]:",
"- h += 1",
"-print((min(n - 1, h + k * 2)))",
"+def main():",
"+ N, K = list(map(int, input().split()))",
"+ S = eval(input())",
"+ # 幸せな人... | false | 0.037544 | 0.038785 | 0.968005 | [
"s482511472",
"s973857605"
] |
u112364985 | p02548 | python | s647261574 | s567676753 | 151 | 30 | 9,172 | 9,176 | Accepted | Accepted | 80.13 | n=int(eval(input()))
cnt=0
for a in range(1,n):
cnt+=(n-1)//a
print(cnt) | n=int(eval(input()))
cnt=0
a=1
while(a*a<n):
cnt+=1
a+=1
a=1
while(a*a<n):
cnt+=max((n-1)//a-a,0)*2
a+=1
print(cnt) | 5 | 11 | 74 | 135 | n = int(eval(input()))
cnt = 0
for a in range(1, n):
cnt += (n - 1) // a
print(cnt)
| n = int(eval(input()))
cnt = 0
a = 1
while a * a < n:
cnt += 1
a += 1
a = 1
while a * a < n:
cnt += max((n - 1) // a - a, 0) * 2
a += 1
print(cnt)
| false | 54.545455 | [
"-for a in range(1, n):",
"- cnt += (n - 1) // a",
"+a = 1",
"+while a * a < n:",
"+ cnt += 1",
"+ a += 1",
"+a = 1",
"+while a * a < n:",
"+ cnt += max((n - 1) // a - a, 0) * 2",
"+ a += 1"
] | false | 0.067108 | 0.034334 | 1.954561 | [
"s647261574",
"s567676753"
] |
u821624310 | p02422 | python | s403285930 | s119088302 | 40 | 30 | 7,860 | 7,836 | Accepted | Accepted | 25 | s = list(input())
q = int(input())
for i in range(q):
cmd = [s for s in input().split()]
cmd[1] = int(cmd[1])
cmd[2] = int(cmd[2])
if cmd[0] == "replace":
c = list(cmd[3])
h = 0
for j in range(cmd[1], cmd[2]+1):
s[j] = c[h]
h+=1
elif cmd[0]... | str = [w for w in input()]
q = int(input())
for i in range(q):
command = [w for w in input().split()]
command[1] = int(command[1])
command[2] = int(command[2])
if command[0] == "print":
for i in range(command[1], command[2]+1):
print(str[i], end="")
print()
if c... | 27 | 23 | 632 | 688 | s = list(input())
q = int(input())
for i in range(q):
cmd = [s for s in input().split()]
cmd[1] = int(cmd[1])
cmd[2] = int(cmd[2])
if cmd[0] == "replace":
c = list(cmd[3])
h = 0
for j in range(cmd[1], cmd[2] + 1):
s[j] = c[h]
h += 1
elif cmd[0] == "rev... | str = [w for w in input()]
q = int(input())
for i in range(q):
command = [w for w in input().split()]
command[1] = int(command[1])
command[2] = int(command[2])
if command[0] == "print":
for i in range(command[1], command[2] + 1):
print(str[i], end="")
print()
if command[0... | false | 14.814815 | [
"-s = list(input())",
"+str = [w for w in input()]",
"- cmd = [s for s in input().split()]",
"- cmd[1] = int(cmd[1])",
"- cmd[2] = int(cmd[2])",
"- if cmd[0] == \"replace\":",
"- c = list(cmd[3])",
"- h = 0",
"- for j in range(cmd[1], cmd[2] + 1):",
"- s... | false | 0.187467 | 0.041453 | 4.52236 | [
"s403285930",
"s119088302"
] |
u125545880 | p03575 | python | s189442229 | s229989027 | 31 | 23 | 3,564 | 3,064 | Accepted | Accepted | 25.81 | import sys
import copy
readline = sys.stdin.readline
def dfs(p, x):
global graphtmp, check
to = graphtmp[x]
check[x] = 1
for t in to:
if p == t or check[t] == 1:
continue
dfs(x, t)
def main():
global graphtmp, check
N, M = list(map(int, readline().s... | import sys
readline = sys.stdin.readline
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
self.rank = [0] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(sel... | 40 | 56 | 896 | 1,317 | import sys
import copy
readline = sys.stdin.readline
def dfs(p, x):
global graphtmp, check
to = graphtmp[x]
check[x] = 1
for t in to:
if p == t or check[t] == 1:
continue
dfs(x, t)
def main():
global graphtmp, check
N, M = list(map(int, readline().split()))
g... | import sys
readline = sys.stdin.readline
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
self.rank = [0] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
... | false | 28.571429 | [
"-import copy",
"-def dfs(p, x):",
"- global graphtmp, check",
"- to = graphtmp[x]",
"- check[x] = 1",
"- for t in to:",
"- if p == t or check[t] == 1:",
"- continue",
"- dfs(x, t)",
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.n = n",... | false | 0.072041 | 0.031851 | 2.261816 | [
"s189442229",
"s229989027"
] |
u727148417 | p02773 | python | s902795975 | s144207538 | 835 | 529 | 53,476 | 35,952 | Accepted | Accepted | 36.65 | N = int(eval(input()))
S = {}
A = [""]*N
for i in range(0, N):
A[i] = A[i] + eval(input())
for i in range(0, N):
if not (A[i] in list(S.keys())):
S[A[i]] = 1
else:
S[A[i]] = S[A[i]] + 1
max = 0
for value in list(S.values()):
if value > max:
max = value
S0 ... | from collections import Counter
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
C = Counter(S)
dekai = max(C.values())
M = [kv[0] for kv in list(C.items()) if kv[1] == dekai]
M.sort()
A = '\n'.join(M)
print(A) | 35 | 9 | 521 | 212 | N = int(eval(input()))
S = {}
A = [""] * N
for i in range(0, N):
A[i] = A[i] + eval(input())
for i in range(0, N):
if not (A[i] in list(S.keys())):
S[A[i]] = 1
else:
S[A[i]] = S[A[i]] + 1
max = 0
for value in list(S.values()):
if value > max:
max = value
S0 = {}
n = 0
for key, va... | from collections import Counter
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
C = Counter(S)
dekai = max(C.values())
M = [kv[0] for kv in list(C.items()) if kv[1] == dekai]
M.sort()
A = "\n".join(M)
print(A)
| false | 74.285714 | [
"+from collections import Counter",
"+",
"-S = {}",
"-A = [\"\"] * N",
"-for i in range(0, N):",
"- A[i] = A[i] + eval(input())",
"-for i in range(0, N):",
"- if not (A[i] in list(S.keys())):",
"- S[A[i]] = 1",
"- else:",
"- S[A[i]] = S[A[i]] + 1",
"-max = 0",
"-for va... | false | 0.036487 | 0.035404 | 1.030596 | [
"s902795975",
"s144207538"
] |
u230621983 | p02891 | python | s513381997 | s880758461 | 20 | 18 | 3,188 | 3,064 | Accepted | Accepted | 10 | s = eval(input())
k = int(eval(input()))
if len(set(s)) == 1:
print(((len(s))*k//2))
exit()
first, last = s[0], s[-1]
first_flag = 1
a, b = 0, 0
tmp = s[0]
tmp_cnt = 0
cnt = 0
for i in range(len(s)):
c = s[i]
if c == first and first_flag:
a += 1
elif c != first:
... | s = eval(input())
k = int(eval(input()))
if len(set(s)) == 1:
print(((len(s))*k//2))
exit()
first, last = s[0], s[-1]
first_flag = 1
a, b = 0, 0
tmp = s[0]
tmp_cnt = 0
cnt = 0
for i in range(len(s)):
c = s[i]
if c == first and first_flag: # 最初に続く文字数をカウント (a)
a += 1
eli... | 37 | 38 | 637 | 758 | s = eval(input())
k = int(eval(input()))
if len(set(s)) == 1:
print(((len(s)) * k // 2))
exit()
first, last = s[0], s[-1]
first_flag = 1
a, b = 0, 0
tmp = s[0]
tmp_cnt = 0
cnt = 0
for i in range(len(s)):
c = s[i]
if c == first and first_flag:
a += 1
elif c != first:
first_flag = 0
... | s = eval(input())
k = int(eval(input()))
if len(set(s)) == 1:
print(((len(s)) * k // 2))
exit()
first, last = s[0], s[-1]
first_flag = 1
a, b = 0, 0
tmp = s[0]
tmp_cnt = 0
cnt = 0
for i in range(len(s)):
c = s[i]
if c == first and first_flag: # 最初に続く文字数をカウント (a)
a += 1
elif c != first:
... | false | 2.631579 | [
"- if c == first and first_flag:",
"+ if c == first and first_flag: # 最初に続く文字数をカウント (a)",
"- if c == tmp:",
"+ if c == tmp: # s単体のとき必要な操作回数を求める (cnt)",
"- if i == len(s) - 1:",
"+ if i == len(s) - 1: # 最後に続く文字数を取得 (b)",
"-if first != last:",
"+if first != last: # sの最初の文字と最後の文字が違う... | false | 0.048304 | 0.048513 | 0.995695 | [
"s513381997",
"s880758461"
] |
u969850098 | p03457 | python | s083408983 | s350997741 | 373 | 332 | 3,064 | 3,060 | Accepted | Accepted | 10.99 | import sys
N = int(eval(input()))
t, x, y = 0, 0, 0
for i in range(N):
in_t, in_x, in_y = list(map(int, input().split()))
t = in_t - t
x = abs(in_x - x)
y = abs(in_y - y)
if (t >= x + y) & ((t - (x + y)) % 2 == 0):
continue
print('No')
sys.exit()
print('Yes') | import sys
N = int(eval(input()))
for _ in range(N):
t, x, y = list(map(int, input().split()))
if (t >= x + y) & ((t - (x + y)) % 2 == 0):
continue
print('No')
sys.exit()
print('Yes') | 13 | 9 | 295 | 204 | import sys
N = int(eval(input()))
t, x, y = 0, 0, 0
for i in range(N):
in_t, in_x, in_y = list(map(int, input().split()))
t = in_t - t
x = abs(in_x - x)
y = abs(in_y - y)
if (t >= x + y) & ((t - (x + y)) % 2 == 0):
continue
print("No")
sys.exit()
print("Yes")
| import sys
N = int(eval(input()))
for _ in range(N):
t, x, y = list(map(int, input().split()))
if (t >= x + y) & ((t - (x + y)) % 2 == 0):
continue
print("No")
sys.exit()
print("Yes")
| false | 30.769231 | [
"-t, x, y = 0, 0, 0",
"-for i in range(N):",
"- in_t, in_x, in_y = list(map(int, input().split()))",
"- t = in_t - t",
"- x = abs(in_x - x)",
"- y = abs(in_y - y)",
"+for _ in range(N):",
"+ t, x, y = list(map(int, input().split()))"
] | false | 0.0479 | 0.047338 | 1.01187 | [
"s083408983",
"s350997741"
] |
u860002137 | p02983 | python | s091378295 | s796124585 | 724 | 58 | 75,412 | 6,808 | Accepted | Accepted | 91.99 | import sys
L, R = list(map(int, input().split()))
ans = []
def calc_mod(x, y):
return x * y % 2019
left = L % 2019
right = R % 2019
if R-L > 2019:
print((0))
sys.exit(0)
elif left > right:
print((0))
sys.exit(0)
elif left==0 or right==0:
print((0))
sys.exit(0)
for... | import sys
L, R = list(map(int, input().split()))
ans = []
def calc_mod(x, y):
return x * y % 2019
left = L % 2019
right = R % 2019
if R-L > 2019:
print((0))
sys.exit(0)
elif left > right:
print((0))
sys.exit(0)
elif left==0 or right==0:
print((0))
sys.exit(0)
for... | 27 | 31 | 423 | 503 | import sys
L, R = list(map(int, input().split()))
ans = []
def calc_mod(x, y):
return x * y % 2019
left = L % 2019
right = R % 2019
if R - L > 2019:
print((0))
sys.exit(0)
elif left > right:
print((0))
sys.exit(0)
elif left == 0 or right == 0:
print((0))
sys.exit(0)
for i in range(left,... | import sys
L, R = list(map(int, input().split()))
ans = []
def calc_mod(x, y):
return x * y % 2019
left = L % 2019
right = R % 2019
if R - L > 2019:
print((0))
sys.exit(0)
elif left > right:
print((0))
sys.exit(0)
elif left == 0 or right == 0:
print((0))
sys.exit(0)
for i in range(left,... | false | 12.903226 | [
"- ans.append(calc_mod(i, j))",
"+ x = calc_mod(i, j)",
"+ if x == 0:",
"+ print((0))",
"+ sys.exit(0)",
"+ ans.append(x)"
] | false | 0.036138 | 0.036625 | 0.986701 | [
"s091378295",
"s796124585"
] |
u883048396 | p04013 | python | s672642393 | s115983268 | 30 | 25 | 3,572 | 3,444 | Accepted | Accepted | 16.67 |
#人のすなるCounterなるものを我も書いてみんとてするなり
from collections import Counter
#方針 マイナスとプラスでDPを分割
iN,iA =[int(x) for x in input().split()]
aX = [int(x) - iA for x in input().split()]
aPlus = [x for x in aX if 0 < x ]
aMinus = [-1 * x for x in aX if x < 0 ]
iLenPlus = len(aPlus)
iLenMinus = len(aMinus)
iLen0 = iN - iLenP... | def 解():
iN,iA =[int(x) for x in input().split()]
aX = [int(x) - iA for x in input().split()]
aPlus = [x for x in aX if 0 < x ]
aMinus = [-1 * x for x in aX if x < 0 ]
iLenPlus = len(aPlus)
iLenMinus = len(aMinus)
iLen0 = iN - iLenPlus - iLenMinus
iCZero = 2**iLen0 - 1 #sum(k=... | 39 | 44 | 1,024 | 1,390 | # 人のすなるCounterなるものを我も書いてみんとてするなり
from collections import Counter
# 方針 マイナスとプラスでDPを分割
iN, iA = [int(x) for x in input().split()]
aX = [int(x) - iA for x in input().split()]
aPlus = [x for x in aX if 0 < x]
aMinus = [-1 * x for x in aX if x < 0]
iLenPlus = len(aPlus)
iLenMinus = len(aMinus)
iLen0 = iN - iLenPlus - iLenM... | def 解():
iN, iA = [int(x) for x in input().split()]
aX = [int(x) - iA for x in input().split()]
aPlus = [x for x in aX if 0 < x]
aMinus = [-1 * x for x in aX if x < 0]
iLenPlus = len(aPlus)
iLenMinus = len(aMinus)
iLen0 = iN - iLenPlus - iLenMinus
iCZero = 2**iLen0 - 1 # sum(k=1..N){nCk... | false | 11.363636 | [
"-# 人のすなるCounterなるものを我も書いてみんとてするなり",
"-from collections import Counter",
"+def 解():",
"+ iN, iA = [int(x) for x in input().split()]",
"+ aX = [int(x) - iA for x in input().split()]",
"+ aPlus = [x for x in aX if 0 < x]",
"+ aMinus = [-1 * x for x in aX if x < 0]",
"+ iLenPlus = len(aPlu... | false | 0.05033 | 0.255532 | 0.196962 | [
"s672642393",
"s115983268"
] |
u380524497 | p02814 | python | s762942340 | s348353397 | 278 | 51 | 21,180 | 18,208 | Accepted | Accepted | 81.65 | from math import gcd
from functools import reduce
import sys
input = sys.stdin.readline
def lcm(a, b):
return a*b // gcd(a, b)
def count_factor_2(num):
count = 0
while num % 2 == 0:
num //= 2
count += 1
return count
def main():
n, m = list(map(int, input().sp... | from math import gcd
from functools import reduce
import sys
input = sys.stdin.readline
def lcm(a, b):
return a*b // gcd(a, b)
def count_factor_2(num):
count = 0
while num % 2 == 0:
num //= 2
count += 1
return count
def main():
n, m = list(map(int, input().sp... | 35 | 35 | 624 | 634 | from math import gcd
from functools import reduce
import sys
input = sys.stdin.readline
def lcm(a, b):
return a * b // gcd(a, b)
def count_factor_2(num):
count = 0
while num % 2 == 0:
num //= 2
count += 1
return count
def main():
n, m = list(map(int, input().split()))
A = ... | from math import gcd
from functools import reduce
import sys
input = sys.stdin.readline
def lcm(a, b):
return a * b // gcd(a, b)
def count_factor_2(num):
count = 0
while num % 2 == 0:
num //= 2
count += 1
return count
def main():
n, m = list(map(int, input().split()))
A = ... | false | 0 | [
"- A = list([int(x) // 2 for x in input().split()])",
"+ A = list([x // 2 for x in set(map(int, input().split()))])"
] | false | 0.067457 | 0.047408 | 1.422915 | [
"s762942340",
"s348353397"
] |
u050428930 | p03310 | python | s858236056 | s471059396 | 859 | 673 | 25,972 | 25,972 | Accepted | Accepted | 21.65 | from itertools import accumulate
N=int(eval(input()))
s=list(accumulate(list(map(int,input().split()))))
ans=s[-1]
p=0
q=2
for i in range(2,N-1):
while abs(s[i-1]-2*s[p])>abs(s[i-1]-2*s[p+1]):
p+=1
while abs(s[q]*2-s[i-1]-s[-1])>abs(s[q+1]*2-s[i-1]-s[-1]):
q+=1
t=[s[i-1]-s[p],s[p]... | from itertools import accumulate
N=int(eval(input()))
s=list(accumulate(list(map(int,input().split()))))
def f(N,s):
ans=s[-1]
p=0
q=2
for i in range(2,N-1):
while abs(s[i-1]-2*s[p])>abs(s[i-1]-2*s[p+1]):
p+=1
while abs(s[q]*2-s[i-1]-s[-1])>abs(s[q+1]*2-s[i-1]-s[-1]... | 14 | 17 | 380 | 454 | from itertools import accumulate
N = int(eval(input()))
s = list(accumulate(list(map(int, input().split()))))
ans = s[-1]
p = 0
q = 2
for i in range(2, N - 1):
while abs(s[i - 1] - 2 * s[p]) > abs(s[i - 1] - 2 * s[p + 1]):
p += 1
while abs(s[q] * 2 - s[i - 1] - s[-1]) > abs(s[q + 1] * 2 - s[i - 1] - s[... | from itertools import accumulate
N = int(eval(input()))
s = list(accumulate(list(map(int, input().split()))))
def f(N, s):
ans = s[-1]
p = 0
q = 2
for i in range(2, N - 1):
while abs(s[i - 1] - 2 * s[p]) > abs(s[i - 1] - 2 * s[p + 1]):
p += 1
while abs(s[q] * 2 - s[i - 1] ... | false | 17.647059 | [
"-ans = s[-1]",
"-p = 0",
"-q = 2",
"-for i in range(2, N - 1):",
"- while abs(s[i - 1] - 2 * s[p]) > abs(s[i - 1] - 2 * s[p + 1]):",
"- p += 1",
"- while abs(s[q] * 2 - s[i - 1] - s[-1]) > abs(s[q + 1] * 2 - s[i - 1] - s[-1]):",
"- q += 1",
"- t = [s[i - 1] - s[p], s[p], s[q]... | false | 0.095976 | 0.076017 | 1.262558 | [
"s858236056",
"s471059396"
] |
u994521204 | p02703 | python | s707912703 | s465861428 | 648 | 521 | 128,004 | 24,364 | Accepted | Accepted | 19.6 | from heapq import heappush, heappop
infi = 10 ** 20
n, m, s = map(int, input().split())
s = min(s, 2500)
edges = [[] for _ in range(51 * 2501 + 1)]
# edge:1-50, max silver=0-2500
for _ in range(m):
u, v, a, b = map(int, input().split())
for i in range(a, 2501):
edges[v + 50 * i].append(... | # snuke解説板
from heapq import heappush, heappop
infi = 10 ** 20
n, m, s = map(int, input().split())
s = min(s, n * 50)
edges = [[] for _ in range(n + 1)]
# edge:1-50, max silver=0-2500
for _ in range(m): # a円, b分
u, v, a, b = map(int, input().split())
edges[v].append((u, a, b))
edges[u].ap... | 58 | 63 | 1,506 | 1,835 | from heapq import heappush, heappop
infi = 10**20
n, m, s = map(int, input().split())
s = min(s, 2500)
edges = [[] for _ in range(51 * 2501 + 1)]
# edge:1-50, max silver=0-2500
for _ in range(m):
u, v, a, b = map(int, input().split())
for i in range(a, 2501):
edges[v + 50 * i].append((b, u + 50 * (i - ... | # snuke解説板
from heapq import heappush, heappop
infi = 10**20
n, m, s = map(int, input().split())
s = min(s, n * 50)
edges = [[] for _ in range(n + 1)]
# edge:1-50, max silver=0-2500
for _ in range(m): # a円, b分
u, v, a, b = map(int, input().split())
edges[v].append((u, a, b))
edges[u].append((v, a, b))
exc... | false | 7.936508 | [
"+# snuke解説板",
"-s = min(s, 2500)",
"-edges = [[] for _ in range(51 * 2501 + 1)]",
"+s = min(s, n * 50)",
"+edges = [[] for _ in range(n + 1)]",
"-for _ in range(m):",
"+for _ in range(m): # a円, b分",
"- for i in range(a, 2501):",
"- edges[v + 50 * i].append((b, u + 50 * (i - a)))",
"- ... | false | 0.234021 | 0.062591 | 3.738924 | [
"s707912703",
"s465861428"
] |
u953110527 | p03487 | python | s095320556 | s950112816 | 125 | 101 | 14,244 | 85,400 | Accepted | Accepted | 19.2 | n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
count = 1
ans = 0
for i in range(1,n):
if a[i] != a[i-1]:
if a[i-1] < count:
ans += count - a[i-1]
elif a[i-1] > count:
ans += count
count = 1
else:
count+=1
if a[n-1] < count... | n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
count = 1
ans = 0
for i in range(n-1):
if a[i+1] != a[i]:
if count >= a[i]:
ans += count-a[i]
else:
ans += count
count = 1
else:
count+=1
if count >= a[-1]:
ans += count-... | 19 | 19 | 394 | 356 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
count = 1
ans = 0
for i in range(1, n):
if a[i] != a[i - 1]:
if a[i - 1] < count:
ans += count - a[i - 1]
elif a[i - 1] > count:
ans += count
count = 1
else:
count += 1
if a[n - 1] < count... | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
count = 1
ans = 0
for i in range(n - 1):
if a[i + 1] != a[i]:
if count >= a[i]:
ans += count - a[i]
else:
ans += count
count = 1
else:
count += 1
if count >= a[-1]:
ans += count - a[-1... | false | 0 | [
"-for i in range(1, n):",
"- if a[i] != a[i - 1]:",
"- if a[i - 1] < count:",
"- ans += count - a[i - 1]",
"- elif a[i - 1] > count:",
"+for i in range(n - 1):",
"+ if a[i + 1] != a[i]:",
"+ if count >= a[i]:",
"+ ans += count - a[i]",
"+ els... | false | 0.037914 | 0.03991 | 0.949997 | [
"s095320556",
"s950112816"
] |
u314050667 | p03557 | python | s293615964 | s709353019 | 1,154 | 950 | 23,348 | 24,836 | Accepted | Accepted | 17.68 | N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = list(map(int, input().split()))
C = sorted(list(map(int, input().split())))
def BinaryIndexSearch_floor(p, SL):
"""
search the minimum number among the larger numbers than the ginven nymber "n".
return the index of it under the list sor... | import numpy as np
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
A = np.array(A)
B = list(map(int, input().split()))
B.sort()
B = np.array(B)
C = list(map(int, input().split()))
C.sort()
C = np.array(C)
ans = 0
for i in range(N):
b = B[i]
a_ind = np.searchsorted(A,b,side='left')
... | 79 | 20 | 1,299 | 398 | N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = list(map(int, input().split()))
C = sorted(list(map(int, input().split())))
def BinaryIndexSearch_floor(p, SL):
"""
search the minimum number among the larger numbers than the ginven nymber "n".
return the index of it under the list so... | import numpy as np
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
A = np.array(A)
B = list(map(int, input().split()))
B.sort()
B = np.array(B)
C = list(map(int, input().split()))
C.sort()
C = np.array(C)
ans = 0
for i in range(N):
b = B[i]
a_ind = np.searchsorted(A, b, side="left")
c_i... | false | 74.683544 | [
"+import numpy as np",
"+",
"-A = sorted(list(map(int, input().split())))",
"+A = list(map(int, input().split()))",
"+A.sort()",
"+A = np.array(A)",
"-C = sorted(list(map(int, input().split())))",
"-",
"-",
"-def BinaryIndexSearch_floor(p, SL):",
"- \"\"\"",
"- search the minimum number ... | false | 0.049126 | 0.179446 | 0.273764 | [
"s293615964",
"s709353019"
] |
u620084012 | p03998 | python | s374256096 | s557655445 | 38 | 17 | 3,064 | 3,064 | Accepted | Accepted | 55.26 | A = str(eval(input()))
B = str(eval(input()))
C = str(eval(input()))
p = 0
while True:
if p == 0:
if A == "":
print("A")
exit()
if A[0] == "b":
p = 1
elif A[0] == "c":
p = 2
A = A[1:]
elif p == 1:
if B == ""... | A = [str(x) for x in eval(input())]
B = [str(x) for x in eval(input())]
C = [str(x) for x in eval(input())]
t = 0
c = ""
while True:
if t == 0:
if len(A) == 0:
print("A")
exit(0)
else:
c = A.pop(0)
elif t == 1:
if len(B) == 0:
... | 34 | 31 | 644 | 594 | A = str(eval(input()))
B = str(eval(input()))
C = str(eval(input()))
p = 0
while True:
if p == 0:
if A == "":
print("A")
exit()
if A[0] == "b":
p = 1
elif A[0] == "c":
p = 2
A = A[1:]
elif p == 1:
if B == "":
pri... | A = [str(x) for x in eval(input())]
B = [str(x) for x in eval(input())]
C = [str(x) for x in eval(input())]
t = 0
c = ""
while True:
if t == 0:
if len(A) == 0:
print("A")
exit(0)
else:
c = A.pop(0)
elif t == 1:
if len(B) == 0:
print("B")
... | false | 8.823529 | [
"-A = str(eval(input()))",
"-B = str(eval(input()))",
"-C = str(eval(input()))",
"-p = 0",
"+A = [str(x) for x in eval(input())]",
"+B = [str(x) for x in eval(input())]",
"+C = [str(x) for x in eval(input())]",
"+t = 0",
"+c = \"\"",
"- if p == 0:",
"- if A == \"\":",
"+ if t == 0... | false | 0.046951 | 0.20456 | 0.229523 | [
"s374256096",
"s557655445"
] |
u399616977 | p02899 | python | s705962026 | s191731786 | 157 | 143 | 25,700 | 23,652 | Accepted | Accepted | 8.92 |
n=int(eval(input()))
l=[]
tem=list(map(int,input().split()))
for i in range(n):
l.append((tem[i],i+1))
print((" ".join(list([str(x[1]) for x in sorted(l,key=lambda x: x[0])]))))
|
n=int(eval(input()))
l=[]
tem=list(map(int,input().split()))
print((" ".join(list([str(x[1]) for x in sorted(zip(tem,list(range(1,n+1))),key=lambda x: x[0])]))))
| 7 | 6 | 185 | 159 | n = int(eval(input()))
l = []
tem = list(map(int, input().split()))
for i in range(n):
l.append((tem[i], i + 1))
print((" ".join(list([str(x[1]) for x in sorted(l, key=lambda x: x[0])]))))
| n = int(eval(input()))
l = []
tem = list(map(int, input().split()))
print(
(
" ".join(
list(
[
str(x[1])
for x in sorted(zip(tem, list(range(1, n + 1))), key=lambda x: x[0])
]
)
)
)
)
| false | 14.285714 | [
"-for i in range(n):",
"- l.append((tem[i], i + 1))",
"-print((\" \".join(list([str(x[1]) for x in sorted(l, key=lambda x: x[0])]))))",
"+print(",
"+ (",
"+ \" \".join(",
"+ list(",
"+ [",
"+ str(x[1])",
"+ for x in sorte... | false | 0.118023 | 0.041458 | 2.846824 | [
"s705962026",
"s191731786"
] |
u844789719 | p02863 | python | s967597855 | s211094482 | 377 | 300 | 45,376 | 42,860 | Accepted | Accepted | 20.42 | I = [int(_) for _ in open(0).read().split()]
N, T = I[:2]
A, B = I[2::2], I[3::2]
dp = [-1] * 6001
dp[0] = 0
for a, b in sorted(zip(A, B)):
dp_new = dp[:]
for k in range(T):
if dp[k] == -1:
continue
dp_new[k + a] = max(dp[k + a], dp[k] + b)
dp = dp_new
print((max(dp))... | I = [int(_) for _ in open(0).read().split()]
N, T = I[:2]
A, B = I[2::2], I[3::2]
dp = [-1] * 6001
dp[0] = 0
for a, b in sorted(zip(A, B)):
for k in range(T - 1, -1, -1):
if dp[k] == -1:
continue
dp[k + a] = max(dp[k + a], dp[k] + b)
print((max(dp)))
| 13 | 11 | 320 | 291 | I = [int(_) for _ in open(0).read().split()]
N, T = I[:2]
A, B = I[2::2], I[3::2]
dp = [-1] * 6001
dp[0] = 0
for a, b in sorted(zip(A, B)):
dp_new = dp[:]
for k in range(T):
if dp[k] == -1:
continue
dp_new[k + a] = max(dp[k + a], dp[k] + b)
dp = dp_new
print((max(dp)))
| I = [int(_) for _ in open(0).read().split()]
N, T = I[:2]
A, B = I[2::2], I[3::2]
dp = [-1] * 6001
dp[0] = 0
for a, b in sorted(zip(A, B)):
for k in range(T - 1, -1, -1):
if dp[k] == -1:
continue
dp[k + a] = max(dp[k + a], dp[k] + b)
print((max(dp)))
| false | 15.384615 | [
"- dp_new = dp[:]",
"- for k in range(T):",
"+ for k in range(T - 1, -1, -1):",
"- dp_new[k + a] = max(dp[k + a], dp[k] + b)",
"- dp = dp_new",
"+ dp[k + a] = max(dp[k + a], dp[k] + b)"
] | false | 0.032246 | 0.048597 | 0.663543 | [
"s967597855",
"s211094482"
] |
u983918956 | p03078 | python | s116091626 | s168988660 | 722 | 35 | 8,708 | 5,104 | Accepted | Accepted | 95.15 | import sys
input = sys.stdin.readline
X,Y,Z,K = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
res = []
for i in range(X):
for j in range(Y):
... | from heapq import heappush, heappop
X, Y, Z, K = list(map(int,input().split()))
A = sorted(list(map(int,input().split())),reverse=True)
B = sorted(list(map(int,input().split())),reverse=True)
C = sorted(list(map(int,input().split())),reverse=True)
ans_list = []
s = set()
pq = []
item = (-(A[0]+B[0]+C[0]),0,... | 24 | 33 | 485 | 925 | import sys
input = sys.stdin.readline
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
res = []
for i in range(X):
for j in range(Y):
sup = ... | from heapq import heappush, heappop
X, Y, Z, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
ans_list = []
s = set()
pq = []
item = (-(A[0] + B[0] + C[0]), 0... | false | 27.272727 | [
"-import sys",
"+from heapq import heappush, heappop",
"-input = sys.stdin.readline",
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-C = list(map(int, input().split()))",
"-A.sort(reverse=True)",
"-B.sort(reverse=True)",
"-C.sort(reverse=True)",
"-res = []",
"-... | false | 0.052371 | 0.036173 | 1.447801 | [
"s116091626",
"s168988660"
] |
u372144784 | p02732 | python | s451867438 | s784076896 | 441 | 400 | 80,928 | 71,024 | Accepted | Accepted | 9.3 | import sys
from collections import Counter
readline = sys.stdin.buffer.readline
#二項係数(modなし) O(k)
def large_conbination(n,k): #no mod. return nCk.
res1 = 1
for i in range(n,n-k,-1):
res1*=i
res2 = 1
for i in range(1,k+1):
res2*= i
return res1//res2
n = int(readline())... | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
lst1 = list(map(int,readline().split()))
dic1 = defaultdict(int)
for i in lst1:
dic1[i] += 1
al = 0
for i in list(dic1.values()):
if i >= 2:
... | 29 | 24 | 619 | 468 | import sys
from collections import Counter
readline = sys.stdin.buffer.readline
# 二項係数(modなし) O(k)
def large_conbination(n, k): # no mod. return nCk.
res1 = 1
for i in range(n, n - k, -1):
res1 *= i
res2 = 1
for i in range(1, k + 1):
res2 *= i
return res1 // res2
n = int(readline... | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
def even(n):
return 1 if n % 2 == 0 else 0
n = int(readline())
lst1 = list(map(int, readline().split()))
dic1 = defaultdict(int)
for i in lst1:
dic1[i] += 1
al = 0
for i in list(dic1.values()):
if i >= 2:
al += ... | false | 17.241379 | [
"-from collections import Counter",
"+from collections import defaultdict",
"-# 二項係数(modなし) O(k)",
"-def large_conbination(n, k): # no mod. return nCk.",
"- res1 = 1",
"- for i in range(n, n - k, -1):",
"- res1 *= i",
"- res2 = 1",
"- for i in range(1, k + 1):",
"- res2 ... | false | 0.110735 | 0.108841 | 1.017405 | [
"s451867438",
"s784076896"
] |
u492910842 | p03487 | python | s801391927 | s899687797 | 138 | 103 | 107,428 | 102,348 | Accepted | Accepted | 25.36 | from collections import Counter
n=int(eval(input()))
a=Counter(list(map(int,input().split()))).most_common()
ans=0
for i in range(len(a)):
if a[i][0]<a[i][1]:
ans+=a[i][1]-a[i][0]
elif a[i][0]>a[i][1]:
ans+=a[i][1]
print(ans)
| from collections import Counter
n=int(eval(input()))
a=list(Counter(list(map(int,input().split()))).items())
ans=0
for i in range(len(a)):
if a[i][0]<a[i][1]:
ans+=a[i][1]-a[i][0]
elif a[i][0]>a[i][1]:
ans+=a[i][1]
print(ans)
| 11 | 11 | 243 | 243 | from collections import Counter
n = int(eval(input()))
a = Counter(list(map(int, input().split()))).most_common()
ans = 0
for i in range(len(a)):
if a[i][0] < a[i][1]:
ans += a[i][1] - a[i][0]
elif a[i][0] > a[i][1]:
ans += a[i][1]
print(ans)
| from collections import Counter
n = int(eval(input()))
a = list(Counter(list(map(int, input().split()))).items())
ans = 0
for i in range(len(a)):
if a[i][0] < a[i][1]:
ans += a[i][1] - a[i][0]
elif a[i][0] > a[i][1]:
ans += a[i][1]
print(ans)
| false | 0 | [
"-a = Counter(list(map(int, input().split()))).most_common()",
"+a = list(Counter(list(map(int, input().split()))).items())"
] | false | 0.046288 | 0.123047 | 0.376184 | [
"s801391927",
"s899687797"
] |
u285891772 | p03240 | python | s027746665 | s015112845 | 550 | 48 | 5,316 | 5,396 | Accepted | Accepted | 91.27 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | 46 | 41 | 1,358 | 1,294 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 10.869565 | [
"-xyh.sort(key=lambda x: [x[0], x[1]])",
"+ins = (-1, -1, -1)",
"+for x, y, h in xyh:",
"+ if h >= 1:",
"+ ins = (x, y, h)",
"+x1, y1, h1 = ins # h>=1 の条件中の任意の(x, y, h)",
"- H = 0",
"- H_max = INF",
"+ H = h1 + abs(x1 - Cx) + abs(y1 - Cy) # Hは条件中の任意の(x, y, h)で決定できる。"... | false | 0.083927 | 0.040086 | 2.09367 | [
"s027746665",
"s015112845"
] |
u606045429 | p03317 | python | s813284119 | s128070439 | 41 | 17 | 13,940 | 2,940 | Accepted | Accepted | 58.54 | N, K, *A = list(map(int, open(0).read().split()))
print((-(-(N - 1) // (K - 1))))
| N, K = list(map(int, input().split()))
print((-(-(N - 1) // (K - 1))))
| 2 | 2 | 75 | 64 | N, K, *A = list(map(int, open(0).read().split()))
print((-(-(N - 1) // (K - 1))))
| N, K = list(map(int, input().split()))
print((-(-(N - 1) // (K - 1))))
| false | 0 | [
"-N, K, *A = list(map(int, open(0).read().split()))",
"+N, K = list(map(int, input().split()))"
] | false | 0.037674 | 0.037998 | 0.991466 | [
"s813284119",
"s128070439"
] |
u977389981 | p02987 | python | s632188683 | s834443648 | 169 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.94 | from collections import Counter
S = Counter(eval(input()))
i = 0
count2 = 0
for k, v in list(S.items()):
i += 1
if v == 2:
count2 += 1
if i == 2 and count2 == 2:
print('Yes')
else:
print('No') | S = eval(input())
if len(set(S)) == 2:
for x in set(S):
if S.count(x) == 2:
continue
else:
print('No')
break
else:
print('Yes')
else:
print('No') | 14 | 13 | 227 | 224 | from collections import Counter
S = Counter(eval(input()))
i = 0
count2 = 0
for k, v in list(S.items()):
i += 1
if v == 2:
count2 += 1
if i == 2 and count2 == 2:
print("Yes")
else:
print("No")
| S = eval(input())
if len(set(S)) == 2:
for x in set(S):
if S.count(x) == 2:
continue
else:
print("No")
break
else:
print("Yes")
else:
print("No")
| false | 7.142857 | [
"-from collections import Counter",
"-",
"-S = Counter(eval(input()))",
"-i = 0",
"-count2 = 0",
"-for k, v in list(S.items()):",
"- i += 1",
"- if v == 2:",
"- count2 += 1",
"-if i == 2 and count2 == 2:",
"- print(\"Yes\")",
"+S = eval(input())",
"+if len(set(S)) == 2:",
"... | false | 0.042895 | 0.007566 | 5.66982 | [
"s632188683",
"s834443648"
] |
u297089927 | p02711 | python | s890440350 | s788212551 | 25 | 21 | 9,028 | 8,980 | Accepted | Accepted | 16 | N=str(eval(input()))
if "7" in N:
print("Yes")
else:
print("No") | n=eval(input())
if "7" in n:
print("Yes")
else:
print("No") | 5 | 5 | 66 | 61 | N = str(eval(input()))
if "7" in N:
print("Yes")
else:
print("No")
| n = eval(input())
if "7" in n:
print("Yes")
else:
print("No")
| false | 0 | [
"-N = str(eval(input()))",
"-if \"7\" in N:",
"+n = eval(input())",
"+if \"7\" in n:"
] | false | 0.039521 | 0.046706 | 0.846165 | [
"s890440350",
"s788212551"
] |
u026402121 | p03161 | python | s579404251 | s599827158 | 511 | 432 | 59,428 | 52,960 | Accepted | Accepted | 15.46 | import sys
input = sys.stdin.readline
N,K = list(map(int,input().split()))
h = [0] + list(map(int,input().split()))
dp = [None for _ in range(N+1)]
dp[1] = 0
for i in range(2,N+1):
scope = min(i-1,K)
jump = [dp[i-x] + abs(h[i]-h[i-x]) for x in range(1,scope+1)]
dp[i] = min(jump)
pri... | N,K = list(map(int,input().split()))
h = [0] + list(map(int,input().split()))
dp = [0] * (N+1)
for i in range(2,N+1):
scope = min(i-1,K)
jump = [dp[i-j]+abs(h[i]-h[i-j]) for j in range(1,scope+1)]
dp[i] = min(jump)
print((dp[N])) | 15 | 11 | 323 | 246 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
h = [0] + list(map(int, input().split()))
dp = [None for _ in range(N + 1)]
dp[1] = 0
for i in range(2, N + 1):
scope = min(i - 1, K)
jump = [dp[i - x] + abs(h[i] - h[i - x]) for x in range(1, scope + 1)]
dp[i] = min(jump)
print((... | N, K = list(map(int, input().split()))
h = [0] + list(map(int, input().split()))
dp = [0] * (N + 1)
for i in range(2, N + 1):
scope = min(i - 1, K)
jump = [dp[i - j] + abs(h[i] - h[i - j]) for j in range(1, scope + 1)]
dp[i] = min(jump)
print((dp[N]))
| false | 26.666667 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-dp = [None for _ in range(N + 1)]",
"-dp[1] = 0",
"+dp = [0] * (N + 1)",
"- jump = [dp[i - x] + abs(h[i] - h[i - x]) for x in range(1, scope + 1)]",
"+ jump = [dp[i - j] + abs(h[i] - h[i - j]) for j in range(1, scope + 1)]"
] | false | 0.045816 | 0.044428 | 1.031234 | [
"s579404251",
"s599827158"
] |
u803102116 | p03835 | python | s096707124 | s400376607 | 1,511 | 1,229 | 2,568 | 2,692 | Accepted | Accepted | 18.66 | # your code goes here
[K, S] = input().split()
K = int(K)
S = int(S)
res = 0
for X in range(K+1):
for Y in range(K+1):
Z = S - X - Y
if 0 <= Z <= K:
res+=1
print(res)
| [K, S] = input().split()
K = int(K)
S = int(S)
res = 0
for X in range(K+1):
for Y in range(K+1):
res += 0 <= S - X - Y <= K
print(res)
| 13 | 10 | 196 | 156 | # your code goes here
[K, S] = input().split()
K = int(K)
S = int(S)
res = 0
for X in range(K + 1):
for Y in range(K + 1):
Z = S - X - Y
if 0 <= Z <= K:
res += 1
print(res)
| [K, S] = input().split()
K = int(K)
S = int(S)
res = 0
for X in range(K + 1):
for Y in range(K + 1):
res += 0 <= S - X - Y <= K
print(res)
| false | 23.076923 | [
"-# your code goes here",
"- Z = S - X - Y",
"- if 0 <= Z <= K:",
"- res += 1",
"+ res += 0 <= S - X - Y <= K"
] | false | 0.115181 | 0.031184 | 3.693532 | [
"s096707124",
"s400376607"
] |
u408325839 | p03044 | python | s815375861 | s028526393 | 605 | 480 | 102,940 | 92,772 | Accepted | Accepted | 20.66 | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
paths = [dict() for i in range(N + 1)]
for i in range(N-1):
u, v, w = list(map(int,input().split()))
paths[u][v] = w
paths[v][u] = w
node_colors = [-1] * (N+1)
def route(last, now, dist):
for next_node, next_distance in zip(l... | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
paths = [dict() for i in range(N + 1)]
for i in range(N-1):
u, v, w = list(map(int,input().split()))
paths[u][v] = w
paths[v][u] = w
node_colors = [-1] * (N+1)
def route(last, now, dist):
for next_node, next_distance in list(... | 24 | 24 | 588 | 563 | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
paths = [dict() for i in range(N + 1)]
for i in range(N - 1):
u, v, w = list(map(int, input().split()))
paths[u][v] = w
paths[v][u] = w
node_colors = [-1] * (N + 1)
def route(last, now, dist):
for next_node, next_distance in zip(
... | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
paths = [dict() for i in range(N + 1)]
for i in range(N - 1):
u, v, w = list(map(int, input().split()))
paths[u][v] = w
paths[v][u] = w
node_colors = [-1] * (N + 1)
def route(last, now, dist):
for next_node, next_distance in list(paths[no... | false | 0 | [
"- for next_node, next_distance in zip(",
"- list(paths[now].keys()), list(paths[now].values())",
"- ):",
"+ for next_node, next_distance in list(paths[now].items()):"
] | false | 0.036016 | 0.032628 | 1.103843 | [
"s815375861",
"s028526393"
] |
u607563136 | p02756 | python | s176024443 | s709866134 | 968 | 390 | 11,840 | 13,892 | Accepted | Accepted | 59.71 | s = eval(input())
q = int(eval(input()))
f1 = 1
f2 = 2
st = ""
se = ""
for _ in range(q):
q = input().split()
if int(q[0]) == 1:
f1,f2 = f2,f1
elif int(q[0]) == 2:
if int(q[1]) == f1:
st = q[2] + st
elif int(q[1]) == f2:
se ... | from collections import deque
s = eval(input())
q = int(eval(input()))
dt = deque()
de = deque()
f1 = 1
f2 = 2
for _ in range(q):
q = input().split()
if int(q[0]) == 1:
f1,f2 = f2,f1
elif int(q[0]) == 2:
if int(q[1]) == f1:
dt.appendleft(q[2])
... | 27 | 32 | 452 | 559 | s = eval(input())
q = int(eval(input()))
f1 = 1
f2 = 2
st = ""
se = ""
for _ in range(q):
q = input().split()
if int(q[0]) == 1:
f1, f2 = f2, f1
elif int(q[0]) == 2:
if int(q[1]) == f1:
st = q[2] + st
elif int(q[1]) == f2:
se += q[2]
ans = st + s + se
if f1 ==... | from collections import deque
s = eval(input())
q = int(eval(input()))
dt = deque()
de = deque()
f1 = 1
f2 = 2
for _ in range(q):
q = input().split()
if int(q[0]) == 1:
f1, f2 = f2, f1
elif int(q[0]) == 2:
if int(q[1]) == f1:
dt.appendleft(q[2])
elif int(q[1]) == f2:
... | false | 15.625 | [
"+from collections import deque",
"+",
"+dt = deque()",
"+de = deque()",
"-st = \"\"",
"-se = \"\"",
"- st = q[2] + st",
"+ dt.appendleft(q[2])",
"- se += q[2]",
"+ de.append(q[2])",
"+st = \"\".join(dt)",
"+se = \"\".join(de)"
] | false | 0.037753 | 0.036286 | 1.04042 | [
"s176024443",
"s709866134"
] |
u449473917 | p02714 | python | s571217478 | s715437245 | 1,471 | 167 | 9,128 | 73,540 | Accepted | Accepted | 88.65 | n=int(eval(input()))
s=eval(input())
r=s.count('R')
g=s.count('G')
b=s.count('B')
ans=r*g*b
for i in range(n):
for d in range(n):
j=i+d
k=j+d
if k>=n: break
if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
ans-=1
print(ans)
| n=int(eval(input()))
s=eval(input())
r=s.count('R')
g=s.count('G')
b=s.count('B')
ans=r*g*b
for i in range(n):
for d in range(n):
j=i+d
k=j+d
if k<n:
if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
ans-=1
print(ans)
| 18 | 18 | 277 | 278 | n = int(eval(input()))
s = eval(input())
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r * g * b
for i in range(n):
for d in range(n):
j = i + d
k = j + d
if k >= n:
break
if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
ans -= 1
print(ans)
| n = int(eval(input()))
s = eval(input())
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r * g * b
for i in range(n):
for d in range(n):
j = i + d
k = j + d
if k < n:
if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
ans -= 1
print(ans)
| false | 0 | [
"- if k >= n:",
"- break",
"- if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:",
"- ans -= 1",
"+ if k < n:",
"+ if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:",
"+ ans -= 1"
] | false | 0.037983 | 0.053573 | 0.708996 | [
"s571217478",
"s715437245"
] |
u394950523 | p02881 | python | s827440606 | s818281897 | 159 | 144 | 3,060 | 3,060 | Accepted | Accepted | 9.43 | N = int(eval(input()))
n = int(N**0.5) + 1
A = 0
B = 0
b = 0
for a in range(1, n):
if N % a == 0:
b = N // a
A = a
B = b
ans = (A - 1) + (B - 1)
print(ans) | N = int(eval(input()))
n = int(N**0.5) + 1
for a in range(1, n):
if N % a == 0:
b = N // a
ans = (a - 1) + (b - 1)
print(ans) | 13 | 9 | 190 | 149 | N = int(eval(input()))
n = int(N**0.5) + 1
A = 0
B = 0
b = 0
for a in range(1, n):
if N % a == 0:
b = N // a
A = a
B = b
ans = (A - 1) + (B - 1)
print(ans)
| N = int(eval(input()))
n = int(N**0.5) + 1
for a in range(1, n):
if N % a == 0:
b = N // a
ans = (a - 1) + (b - 1)
print(ans)
| false | 30.769231 | [
"-A = 0",
"-B = 0",
"-b = 0",
"- A = a",
"- B = b",
"-ans = (A - 1) + (B - 1)",
"+ ans = (a - 1) + (b - 1)"
] | false | 0.050887 | 0.053856 | 0.944857 | [
"s827440606",
"s818281897"
] |
u425950110 | p02571 | python | s619745623 | s461288699 | 65 | 58 | 9,064 | 9,036 | Accepted | Accepted | 10.77 | S = list(eval(input()))
T = list(eval(input()))
lst_of_values = []
for i in range(len(S)):
current = 0
if i + len(T) > len(S):
break
k = 0
for j in range(i, i+len(T)):
if S[j] != T[k]:
current += 1
k+=1
lst_of_values.append(current)
k=0
pri... | S = eval(input())
T = eval(input())
counter = 0
for i in range(len(S)):
second = 0
group = S[i:i+len(T)]
if len(group) < len(T):
break
for j in range(len(T)):
if T[j] != group[j]:
second += 1
if counter == 0:
counter = second
elif second < count... | 19 | 19 | 333 | 357 | S = list(eval(input()))
T = list(eval(input()))
lst_of_values = []
for i in range(len(S)):
current = 0
if i + len(T) > len(S):
break
k = 0
for j in range(i, i + len(T)):
if S[j] != T[k]:
current += 1
k += 1
lst_of_values.append(current)
k = 0
print((min(lst_of... | S = eval(input())
T = eval(input())
counter = 0
for i in range(len(S)):
second = 0
group = S[i : i + len(T)]
if len(group) < len(T):
break
for j in range(len(T)):
if T[j] != group[j]:
second += 1
if counter == 0:
counter = second
elif second < counter:
... | false | 0 | [
"-S = list(eval(input()))",
"-T = list(eval(input()))",
"-lst_of_values = []",
"+S = eval(input())",
"+T = eval(input())",
"+counter = 0",
"- current = 0",
"- if i + len(T) > len(S):",
"+ second = 0",
"+ group = S[i : i + len(T)]",
"+ if len(group) < len(T):",
"- k = 0",
"-... | false | 0.046203 | 0.037859 | 1.220401 | [
"s619745623",
"s461288699"
] |
u604774382 | p02268 | python | s552157932 | s328085243 | 570 | 380 | 21,084 | 13,160 | Accepted | Accepted | 33.33 | n = int( eval(input( )) )
s = [ int( val ) for val in input( ).split( " " ) ]
q = int( eval(input( )) )
t = [ int( val ) for val in input( ).split( " " ) ]
cnt = 0
cnt = 0
for ti in t:
low = 0
high = n - 1
while low <= high:
m = ( low+high )//2
if ti < s[m]:
high = m - 1
elif s[m] < ti:
l... | n = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]
q = int( input( ) )
t = [ int( val ) for val in input( ).split( " " ) ]
cnt = 0
cnt = 0
for ti in t:
low = 0
high = n - 1
while low <= high:
m = ( low+high )//2
if ti < s[m]:
high = m - 1
elif s[m] < ti:
low = m + 1
... | 21 | 21 | 366 | 382 | n = int(eval(input()))
s = [int(val) for val in input().split(" ")]
q = int(eval(input()))
t = [int(val) for val in input().split(" ")]
cnt = 0
cnt = 0
for ti in t:
low = 0
high = n - 1
while low <= high:
m = (low + high) // 2
if ti < s[m]:
high = m - 1
elif s[m] < ti:
... | n = int(input())
s = [int(val) for val in input().split(" ")]
q = int(input())
t = [int(val) for val in input().split(" ")]
cnt = 0
cnt = 0
for ti in t:
low = 0
high = n - 1
while low <= high:
m = (low + high) // 2
if ti < s[m]:
high = m - 1
elif s[m] < ti:
lo... | false | 0 | [
"-n = int(eval(input()))",
"+n = int(input())",
"-q = int(eval(input()))",
"+q = int(input())"
] | false | 0.043243 | 0.060586 | 0.71374 | [
"s552157932",
"s328085243"
] |
u028973125 | p03817 | python | s816402822 | s275472582 | 164 | 28 | 38,360 | 8,992 | Accepted | Accepted | 82.93 | import sys
x = int(sys.stdin.readline().strip())
"""
1
5423
6
"""
r = x // 11
res = x - 11*r
if res == 0:
print((2*r))
elif res > 6:
print((2*r + 2))
else:
print((2*r + 1)) | import sys
x = int(sys.stdin.readline())
n = x // 11
r = x % 11
if r == 0:
print((2*n))
elif r <= 6:
print((2*n + 1))
else:
print((2 * (n+1))) | 18 | 11 | 198 | 159 | import sys
x = int(sys.stdin.readline().strip())
"""
1
5423
6
"""
r = x // 11
res = x - 11 * r
if res == 0:
print((2 * r))
elif res > 6:
print((2 * r + 2))
else:
print((2 * r + 1))
| import sys
x = int(sys.stdin.readline())
n = x // 11
r = x % 11
if r == 0:
print((2 * n))
elif r <= 6:
print((2 * n + 1))
else:
print((2 * (n + 1)))
| false | 38.888889 | [
"-x = int(sys.stdin.readline().strip())",
"-\"\"\"",
"-1",
"-5423",
"-6",
"-\"\"\"",
"-r = x // 11",
"-res = x - 11 * r",
"-if res == 0:",
"- print((2 * r))",
"-elif res > 6:",
"- print((2 * r + 2))",
"+x = int(sys.stdin.readline())",
"+n = x // 11",
"+r = x % 11",
"+if r == 0:",... | false | 0.082846 | 0.089036 | 0.930481 | [
"s816402822",
"s275472582"
] |
u102461423 | p03667 | python | s750372956 | s525368970 | 1,006 | 305 | 47,496 | 54,020 | Accepted | Accepted | 69.68 | import sys
input = sys.stdin.readline
"""
・とりあえず部分点解法:各クエリに対してO(N)
・いくつかを残していくつかを自由に埋める
・残すもの:被覆区間がoverlapしないように残す
・つまり、区間で覆えている点が処理できて、区間で覆えていない点が他所から持ってこないといけない。
"""
N,M = list(map(int,input().split()))
A = [int(x) for x in input().split()]
XY = [tuple(int(x) for x in input().split()) for _ in range(M)]... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(A, X, Y):
N = len(A)
count = np.zeros(N + 1, np.int64)
covered = np.zeros(N + 1, np.int64)
for x in A:
count[x] += 1
y = x - coun... | 46 | 55 | 1,137 | 1,368 | import sys
input = sys.stdin.readline
"""
・とりあえず部分点解法:各クエリに対してO(N)
・いくつかを残していくつかを自由に埋める
・残すもの:被覆区間がoverlapしないように残す
・つまり、区間で覆えている点が処理できて、区間で覆えていない点が他所から持ってこないといけない。
"""
N, M = list(map(int, input().split()))
A = [int(x) for x in input().split()]
XY = [tuple(int(x) for x in input().split()) for _ in range(M)]
def subs... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main(A, X, Y):
N = len(A)
count = np.zeros(N + 1, np.int64)
covered = np.zeros(N + 1, np.int64)
for x in A:
count[x] += 1
y = x - count[x] + 1
... | false | 16.363636 | [
"+import numpy as np",
"-input = sys.stdin.readline",
"-\"\"\"",
"-・とりあえず部分点解法:各クエリに対してO(N)",
"-・いくつかを残していくつかを自由に埋める",
"-・残すもの:被覆区間がoverlapしないように残す",
"-・つまり、区間で覆えている点が処理できて、区間で覆えていない点が他所から持ってこないといけない。",
"-\"\"\"",
"-N, M = list(map(int, input().split()))",
"-A = [int(x) for x in input().split()]",... | false | 0.042707 | 0.349415 | 0.122224 | [
"s750372956",
"s525368970"
] |
u419686324 | p04013 | python | s005331442 | s639120981 | 137 | 46 | 13,400 | 3,572 | Accepted | Accepted | 66.42 | N, A = list(map(int, input().split()))
X = [int(x) - A for x in input().split()]
import functools
@functools.lru_cache(maxsize=None)
def f(acc, left):
if not left: return 0
ret = 0
y = acc + left[0]
ret += 1 if y == 0 else 0
ret += f(y, left[1:])
ret += f(acc, left[1:])
return r... | N, A = list(map(int, input().split()))
X = [int(x) - A for x in input().split()]
from collections import Counter
total = Counter([0])
for x in X:
mix = Counter()
for i, cnt in list(total.items()):
mix[i + x] += cnt
total += mix
print((total[0] - 1)) | 14 | 13 | 339 | 270 | N, A = list(map(int, input().split()))
X = [int(x) - A for x in input().split()]
import functools
@functools.lru_cache(maxsize=None)
def f(acc, left):
if not left:
return 0
ret = 0
y = acc + left[0]
ret += 1 if y == 0 else 0
ret += f(y, left[1:])
ret += f(acc, left[1:])
return ret
... | N, A = list(map(int, input().split()))
X = [int(x) - A for x in input().split()]
from collections import Counter
total = Counter([0])
for x in X:
mix = Counter()
for i, cnt in list(total.items()):
mix[i + x] += cnt
total += mix
print((total[0] - 1))
| false | 7.142857 | [
"-import functools",
"+from collections import Counter",
"-",
"-@functools.lru_cache(maxsize=None)",
"-def f(acc, left):",
"- if not left:",
"- return 0",
"- ret = 0",
"- y = acc + left[0]",
"- ret += 1 if y == 0 else 0",
"- ret += f(y, left[1:])",
"- ret += f(acc, lef... | false | 0.040131 | 0.040735 | 0.985171 | [
"s005331442",
"s639120981"
] |
u429029348 | p02608 | python | s460954031 | s604890806 | 1,788 | 454 | 69,548 | 9,344 | Accepted | Accepted | 74.61 | n=int(eval(input()))
ans=0
for i in range(1,n+1):
cnt=0
for x in range(1,101):
if x**2>i:
break
for y in range(1,x+1):
if x**2+y**2>i:
break
for z in range(1,y+1):
if x**2+y**2+z**2+x*y+y*z+z*x==i:
if x==y==z:
cnt+=1
if (x>y and... | n = int(eval(input()))
ans = [0] * n
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
d = x * x + y * y + z * z + x * y + y * z + z * x
if d <= n:
ans[d - 1] += 1
for i in ans:
print(i)
| 20 | 12 | 428 | 272 | n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
cnt = 0
for x in range(1, 101):
if x**2 > i:
break
for y in range(1, x + 1):
if x**2 + y**2 > i:
break
for z in range(1, y + 1):
if x**2 + y**2 + z**2 + x * y + y * z + z ... | n = int(eval(input()))
ans = [0] * n
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
d = x * x + y * y + z * z + x * y + y * z + z * x
if d <= n:
ans[d - 1] += 1
for i in ans:
print(i)
| false | 40 | [
"-ans = 0",
"-for i in range(1, n + 1):",
"- cnt = 0",
"- for x in range(1, 101):",
"- if x**2 > i:",
"- break",
"- for y in range(1, x + 1):",
"- if x**2 + y**2 > i:",
"- break",
"- for z in range(1, y + 1):",
"- ... | false | 0.049794 | 0.938109 | 0.053079 | [
"s460954031",
"s604890806"
] |
u133038626 | p03304 | python | s032490187 | s767276343 | 38 | 17 | 5,304 | 2,940 | Accepted | Accepted | 55.26 | # coding: utf-8
import fractions
n, m, d = list(map(int, input().split()))
p = fractions.Fraction(2 * (n-d), n**2) if d != 0 else fractions.Fraction(1, n)
print((float(p * (m-1))))
| n,m,d=list(map(int,input().split()))
print(((2*(n-d)/n**2 if d!=0 else 1/n)*(m-1))) | 7 | 2 | 181 | 76 | # coding: utf-8
import fractions
n, m, d = list(map(int, input().split()))
p = fractions.Fraction(2 * (n - d), n**2) if d != 0 else fractions.Fraction(1, n)
print((float(p * (m - 1))))
| n, m, d = list(map(int, input().split()))
print(((2 * (n - d) / n**2 if d != 0 else 1 / n) * (m - 1)))
| false | 71.428571 | [
"-# coding: utf-8",
"-import fractions",
"-",
"-p = fractions.Fraction(2 * (n - d), n**2) if d != 0 else fractions.Fraction(1, n)",
"-print((float(p * (m - 1))))",
"+print(((2 * (n - d) / n**2 if d != 0 else 1 / n) * (m - 1)))"
] | false | 0.086798 | 0.070631 | 1.228892 | [
"s032490187",
"s767276343"
] |
u155024797 | p03040 | python | s298230746 | s612699542 | 1,997 | 852 | 90,968 | 89,304 | Accepted | Accepted | 57.34 | from heapq import heappop, heappush
def main():
Q = int(input())
y = 0
lheap = []
rheap = []
lsum = 0
rsum = 0
for _ in range(Q):
q = input()
if q[0] == '1':
# update
_, a, b = map(int, q.split())
y += b
if len... | from heapq import heappop, heappush
import sys
input = sys.stdin.readline
def main():
Q = int(input())
y = 0
lheap = []
rheap = []
lsum = 0
rsum = 0
for _ in range(Q):
q = input()
if q[0] == '1':
# update
_, a, b = map(int, q.split())... | 45 | 47 | 1,236 | 1,276 | from heapq import heappop, heappush
def main():
Q = int(input())
y = 0
lheap = []
rheap = []
lsum = 0
rsum = 0
for _ in range(Q):
q = input()
if q[0] == "1":
# update
_, a, b = map(int, q.split())
y += b
if len(lheap) == 0 or ... | from heapq import heappop, heappush
import sys
input = sys.stdin.readline
def main():
Q = int(input())
y = 0
lheap = []
rheap = []
lsum = 0
rsum = 0
for _ in range(Q):
q = input()
if q[0] == "1":
# update
_, a, b = map(int, q.split())
y ... | false | 4.255319 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.091052 | 0.081826 | 1.112747 | [
"s298230746",
"s612699542"
] |
u357751375 | p03598 | python | s355465710 | s025837339 | 32 | 25 | 9,160 | 9,096 | Accepted | Accepted | 21.88 | n = int(eval(input()))
k = int(eval(input()))
x = list(map(int,input().split()))
a = 0
b = 0
c = 0
for i in range(n):
a = x[i] * 2
b = abs(x[i] - k) * 2
c += min(a,b)
print(c) | n = int(eval(input()))
k = int(eval(input()))
x = list(map(int,input().split()))
ans = 0
for i in range(n):
a = x[i] * 2
b = abs(x[i] - k) * 2
ans += min(a,b)
print(ans) | 13 | 9 | 193 | 177 | n = int(eval(input()))
k = int(eval(input()))
x = list(map(int, input().split()))
a = 0
b = 0
c = 0
for i in range(n):
a = x[i] * 2
b = abs(x[i] - k) * 2
c += min(a, b)
print(c)
| n = int(eval(input()))
k = int(eval(input()))
x = list(map(int, input().split()))
ans = 0
for i in range(n):
a = x[i] * 2
b = abs(x[i] - k) * 2
ans += min(a, b)
print(ans)
| false | 30.769231 | [
"-a = 0",
"-b = 0",
"-c = 0",
"+ans = 0",
"- c += min(a, b)",
"-print(c)",
"+ ans += min(a, b)",
"+print(ans)"
] | false | 0.047641 | 0.047628 | 1.00027 | [
"s355465710",
"s025837339"
] |
u077291787 | p02726 | python | s405850198 | s753219665 | 1,269 | 1,024 | 3,188 | 3,188 | Accepted | Accepted | 19.31 | # D - Line++
def main():
N, X, Y = list(map(int, input().split()))
dist_cnt = [0] * N
calc_min_dist = lambda x, y: min(y - x, abs(X - x) + abs(Y - y) + 1) # assume x < y
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
dist_cnt[calc_min_dist(i, j)] += 1
print(("\n... | # D - Line++
def main():
N, X, Y = list(map(int, input().split()))
dist_cnt = [0] * N
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
dist_cnt[min(j - i, abs(X - i) + abs(Y - j) + 1)] += 1
print(("\n".join(map(str, dist_cnt[1:]))))
if __name__ == "__main__":
... | 13 | 12 | 389 | 319 | # D - Line++
def main():
N, X, Y = list(map(int, input().split()))
dist_cnt = [0] * N
calc_min_dist = lambda x, y: min(y - x, abs(X - x) + abs(Y - y) + 1) # assume x < y
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
dist_cnt[calc_min_dist(i, j)] += 1
print(("\n".join(m... | # D - Line++
def main():
N, X, Y = list(map(int, input().split()))
dist_cnt = [0] * N
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
dist_cnt[min(j - i, abs(X - i) + abs(Y - j) + 1)] += 1
print(("\n".join(map(str, dist_cnt[1:]))))
if __name__ == "__main__":
main()
| false | 7.692308 | [
"- calc_min_dist = lambda x, y: min(y - x, abs(X - x) + abs(Y - y) + 1) # assume x < y",
"- dist_cnt[calc_min_dist(i, j)] += 1",
"+ dist_cnt[min(j - i, abs(X - i) + abs(Y - j) + 1)] += 1"
] | false | 0.043233 | 0.047468 | 0.91078 | [
"s405850198",
"s753219665"
] |
u016128476 | p02585 | python | s201111979 | s150449044 | 603 | 510 | 74,412 | 75,124 | Accepted | Accepted | 15.42 | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))
INF = 10**9+1
def solve():
cycles = []
memo = [False] * N
i = 0
while i < N-1:
cycle = []
j = i
while not memo[j]:
cycle.append(j)
... | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))
INF = 10**9+1
def solve():
ans = -INF
for i in range(N):
memo = [0] * (N+1)
j = 0
p = i
while j < N:
memo[j+1] = memo[j] + C[p]
p... | 55 | 32 | 1,386 | 761 | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))
INF = 10**9 + 1
def solve():
cycles = []
memo = [False] * N
i = 0
while i < N - 1:
cycle = []
j = i
while not memo[j]:
cycle.append(j)
memo[j] ... | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))
INF = 10**9 + 1
def solve():
ans = -INF
for i in range(N):
memo = [0] * (N + 1)
j = 0
p = i
while j < N:
memo[j + 1] = memo[j] + C[p]
p = P[p] ... | false | 41.818182 | [
"- cycles = []",
"- memo = [False] * N",
"- i = 0",
"- while i < N - 1:",
"- cycle = []",
"- j = i",
"- while not memo[j]:",
"- cycle.append(j)",
"- memo[j] = True",
"- j = P[j] - 1",
"- k = i",
"- for i in range(k... | false | 0.036309 | 0.035172 | 1.032321 | [
"s201111979",
"s150449044"
] |
u102445737 | p03061 | python | s730921770 | s724244017 | 703 | 382 | 100,832 | 89,580 | Accepted | Accepted | 45.66 | printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
# # # # class Segtree # #... | printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
from fractions import gcd
... | 89 | 26 | 2,057 | 575 | printn = lambda x: print(x, end="")
inn = lambda: int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda: input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
# # # # class Segtree # # # #
# 0
# ... | printn = lambda x: print(x, end="")
inn = lambda: int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda: input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
from fractions import gcd
n = inn()
a = ... | false | 70.786517 | [
"-# # # # class Segtree # # # #",
"-# 0",
"-# 1 2",
"-# 3 4 5 6",
"-# :",
"-# leaf i - n-1+i",
"-# parent - (i-1)//2",
"-# children - 2*i+1, 2*i+2",
"-class Segtree:",
"- # modify UNIT and oper depending on the reduce operation",
"- # UNIT = 0 # sum/or:0 and:fff..f ... | false | 0.046842 | 0.078477 | 0.596888 | [
"s730921770",
"s724244017"
] |
u391875425 | p03074 | python | s013877051 | s020601862 | 197 | 104 | 46,320 | 8,856 | Accepted | Accepted | 47.21 | N, K = list(map(int, input().split()))
S = "1" + eval(input()) + "1"
arr = []
cnt = 0
flg = 1
for s in S:
if s == "1" and 1 - flg:
flg = 1
arr.append(cnt)
cnt = 1
elif s == "0" and flg:
flg = 0
arr.append(cnt)
cnt = 1
else:
cnt += 1
arr... | from itertools import accumulate
N, K = list(map(int, input().split()))
S = "1" + eval(input()) + "1"
arr = []
cnt = 0
flg = 1
for s in S:
if s == "1" and 1 - flg:
flg = 1
arr.append(cnt)
cnt = 1
elif s == "0" and flg:
flg = 0
arr.append(cnt)
cnt = 1... | 31 | 30 | 681 | 661 | N, K = list(map(int, input().split()))
S = "1" + eval(input()) + "1"
arr = []
cnt = 0
flg = 1
for s in S:
if s == "1" and 1 - flg:
flg = 1
arr.append(cnt)
cnt = 1
elif s == "0" and flg:
flg = 0
arr.append(cnt)
cnt = 1
else:
cnt += 1
arr.append(cnt)
csu... | from itertools import accumulate
N, K = list(map(int, input().split()))
S = "1" + eval(input()) + "1"
arr = []
cnt = 0
flg = 1
for s in S:
if s == "1" and 1 - flg:
flg = 1
arr.append(cnt)
cnt = 1
elif s == "0" and flg:
flg = 0
arr.append(cnt)
cnt = 1
else:
... | false | 3.225806 | [
"+from itertools import accumulate",
"+",
"-csum = [0] * (len(arr) + 1)",
"-for i in range(len(arr)):",
"- csum[i + 1] = csum[i] + arr[i]",
"+csum = [0] + list(accumulate(arr))"
] | false | 0.056068 | 0.037629 | 1.490036 | [
"s013877051",
"s020601862"
] |
u887207211 | p03804 | python | s357468430 | s742973726 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | N, M = list(map(int,input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
cnt = 0
tmp = []
for a in A:
for b in B:
if(tmp != B):
if(b in a):
tmp.append(b)
else:
break
if(tmp == B):
print("Yes")
else:
print("No")
| N, M = list(map(int,input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
tmp = []
for a in A:
for b in B:
if(tmp != B):
if(b in a):
tmp.append(b)
else:
break
if(tmp == B):
print('Yes')
else:
print('No') | 17 | 16 | 285 | 275 | N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
cnt = 0
tmp = []
for a in A:
for b in B:
if tmp != B:
if b in a:
tmp.append(b)
else:
break
if tmp == B:
print("Yes")
else:
print("No")
| N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
tmp = []
for a in A:
for b in B:
if tmp != B:
if b in a:
tmp.append(b)
else:
break
if tmp == B:
print("Yes")
else:
print("No")
| false | 5.882353 | [
"-cnt = 0"
] | false | 0.049533 | 0.049951 | 0.991643 | [
"s357468430",
"s742973726"
] |
u709304134 | p02695 | python | s366412780 | s473940589 | 163 | 113 | 107,536 | 67,996 | Accepted | Accepted | 30.67 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
INF = 10**10
MOD = 10**9 + 7
N, M, Q = list(map(int,input().split()))
query = []
for q in range(Q):
a,b,c,d = list(map(int,input().split()))
a-=1
b-=1
query.append((a,b,c,d))
old = []
for i in rang... | import itertools
N, M, Q = list(map(int,input().split()))
query = []
for q in range(Q):
a,b,c,d = list(map(int,input().split()))
a-=1
b-=1
query.append((a,b,c,d))
mx = 0
for comb in itertools.combinations_with_replacement([i for i in range(1,M+1)],N):
score = 0
for a,b,c,d in query:
... | 42 | 18 | 652 | 410 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
INF = 10**10
MOD = 10**9 + 7
N, M, Q = list(map(int, input().split()))
query = []
for q in range(Q):
a, b, c, d = list(map(int, input().split()))
a -= 1
b -= 1
query.append((a, b, c, d))
old = []
for i in range(1, M + 1):
old.append... | import itertools
N, M, Q = list(map(int, input().split()))
query = []
for q in range(Q):
a, b, c, d = list(map(int, input().split()))
a -= 1
b -= 1
query.append((a, b, c, d))
mx = 0
for comb in itertools.combinations_with_replacement([i for i in range(1, M + 1)], N):
score = 0
for a, b, c, d in... | false | 57.142857 | [
"-import sys",
"+import itertools",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"-INF = 10**10",
"-MOD = 10**9 + 7",
"-old = []",
"-for i in range(1, M + 1):",
"- old.append([i])",
"-for j in range(N - 1):",
"- new = []",
"- for e in old:",
"- for i in ran... | false | 0.062041 | 0.093653 | 0.662455 | [
"s366412780",
"s473940589"
] |
u556225812 | p03208 | python | s877436718 | s896156752 | 282 | 239 | 11,288 | 7,384 | Accepted | Accepted | 15.25 | N, K = list(map(int, input().split()))
lst = []
for i in range(N):
x = int(eval(input()))
lst.append(x)
lst.sort()
L = []
for i in range(N - K + 1):
L.append(lst[i + K -1] - lst[i])
L.sort()
print((L[0])) | N, K = list(map(int, input().split()))
lst = []
for i in range(N):
lst.append(int(eval(input())))
lst.sort()
dif = 10**9
for i in range(N-K+1):
if lst[i+K-1] - lst[i] < dif:
dif = lst[i+K-1] - lst[i]
print(dif) | 11 | 10 | 212 | 223 | N, K = list(map(int, input().split()))
lst = []
for i in range(N):
x = int(eval(input()))
lst.append(x)
lst.sort()
L = []
for i in range(N - K + 1):
L.append(lst[i + K - 1] - lst[i])
L.sort()
print((L[0]))
| N, K = list(map(int, input().split()))
lst = []
for i in range(N):
lst.append(int(eval(input())))
lst.sort()
dif = 10**9
for i in range(N - K + 1):
if lst[i + K - 1] - lst[i] < dif:
dif = lst[i + K - 1] - lst[i]
print(dif)
| false | 9.090909 | [
"- x = int(eval(input()))",
"- lst.append(x)",
"+ lst.append(int(eval(input())))",
"-L = []",
"+dif = 10**9",
"- L.append(lst[i + K - 1] - lst[i])",
"-L.sort()",
"-print((L[0]))",
"+ if lst[i + K - 1] - lst[i] < dif:",
"+ dif = lst[i + K - 1] - lst[i]",
"+print(dif)"
] | false | 0.039514 | 0.039589 | 0.998099 | [
"s877436718",
"s896156752"
] |
u124735330 | p02936 | python | s734643600 | s506917064 | 1,080 | 888 | 86,460 | 62,260 | Accepted | Accepted | 17.78 | import sys
from collections import deque
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
def main():
N, Q = list(map(int, input().split()))
con = [[] for i in range(N)]
ops = []
ans = [0] * N
for _ in range(N - 1):
a, b = list(map(int, input().split()))
con... | import sys
from collections import deque
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
def main():
N, Q = list(map(int, input().split()))
con = [[] for i in range(N)]
ans = [0] * N
for _ in range(N - 1):
a, b = list(map(int, input().split()))
con[a - 1].append... | 43 | 39 | 948 | 860 | import sys
from collections import deque
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
def main():
N, Q = list(map(int, input().split()))
con = [[] for i in range(N)]
ops = []
ans = [0] * N
for _ in range(N - 1):
a, b = list(map(int, input().split()))
con[a - 1].append(b... | import sys
from collections import deque
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
def main():
N, Q = list(map(int, input().split()))
con = [[] for i in range(N)]
ans = [0] * N
for _ in range(N - 1):
a, b = list(map(int, input().split()))
con[a - 1].append(b - 1)
... | false | 9.302326 | [
"- ops = []",
"- ops.append(tuple(map(int, input().split())))",
"- for op in ops:",
"- node = op[0] - 1",
"- pnt = op[1]",
"- ans[node] += pnt",
"+ p, v = list(map(int, input().split()))",
"+ ans[p - 1] += v"
] | false | 0.039757 | 0.042782 | 0.929291 | [
"s734643600",
"s506917064"
] |
u452337391 | p03544 | python | s901090038 | s224362737 | 30 | 26 | 9,032 | 9,060 | Accepted | Accepted | 13.33 | N = int(eval(input()))
R = [None] * (N+1)
R[0] = 2
if N == 0:
print((R[0]))
exit()
R[1] =1
if N == 1:
print((R[1]))
exit()
if N >= 2:
for i in range(2, N+1):
R[i] = R[i-1] + R[i-2]
print((R[N])) | N = int(eval(input()))
R = [2, 1]
if N < 2:
print((R[N]))
exit()
for i in range(2, N+1):
R.append(R[i-1] + R[i-2])
print((R[N])) | 15 | 8 | 229 | 137 | N = int(eval(input()))
R = [None] * (N + 1)
R[0] = 2
if N == 0:
print((R[0]))
exit()
R[1] = 1
if N == 1:
print((R[1]))
exit()
if N >= 2:
for i in range(2, N + 1):
R[i] = R[i - 1] + R[i - 2]
print((R[N]))
| N = int(eval(input()))
R = [2, 1]
if N < 2:
print((R[N]))
exit()
for i in range(2, N + 1):
R.append(R[i - 1] + R[i - 2])
print((R[N]))
| false | 46.666667 | [
"-R = [None] * (N + 1)",
"-R[0] = 2",
"-if N == 0:",
"- print((R[0]))",
"+R = [2, 1]",
"+if N < 2:",
"+ print((R[N]))",
"-R[1] = 1",
"-if N == 1:",
"- print((R[1]))",
"- exit()",
"-if N >= 2:",
"- for i in range(2, N + 1):",
"- R[i] = R[i - 1] + R[i - 2]",
"- pri... | false | 0.043069 | 0.042482 | 1.013805 | [
"s901090038",
"s224362737"
] |
u347640436 | p03014 | python | s657392211 | s906575946 | 1,687 | 1,514 | 38,900 | 38,900 | Accepted | Accepted | 10.25 | from sys import stdin
def main():
from itertools import repeat
from builtins import range
readline = stdin.readline
h, w = list(map(int, readline().split()))
s = [readline().rstrip('\r\n') + '#' for _ in range(h)]
s.append('#' * w)
yoko = [[0] * w for _ in range(h)]
for i in range(h):
star... | from sys import stdin
def main():
from builtins import range
readline = stdin.readline
h, w = list(map(int, readline().split()))
s = [readline().rstrip('\r\n') + '#' for _ in range(h)]
s.append('#' * w)
yoko = [[0] * w for _ in range(h)]
for i in range(h):
start = -1
si = s[i]
yokoi... | 42 | 41 | 1,032 | 995 | from sys import stdin
def main():
from itertools import repeat
from builtins import range
readline = stdin.readline
h, w = list(map(int, readline().split()))
s = [readline().rstrip("\r\n") + "#" for _ in range(h)]
s.append("#" * w)
yoko = [[0] * w for _ in range(h)]
for i in range(h):... | from sys import stdin
def main():
from builtins import range
readline = stdin.readline
h, w = list(map(int, readline().split()))
s = [readline().rstrip("\r\n") + "#" for _ in range(h)]
s.append("#" * w)
yoko = [[0] * w for _ in range(h)]
for i in range(h):
start = -1
si = ... | false | 2.380952 | [
"- from itertools import repeat",
"- yokoi[start:j] = repeat(t, t)",
"+ yokoi[start:j] = [t] * t"
] | false | 0.103937 | 0.108005 | 0.962337 | [
"s657392211",
"s906575946"
] |
u033606236 | p03329 | python | s581170155 | s662300096 | 1,044 | 881 | 3,828 | 3,828 | Accepted | Accepted | 15.61 | n = int(eval(input()))
dp = [float("Inf")]*(n+1)
for i in range(n+1):
if i < 6:dp[i] = i
power = 1
while i >= 6 ** power:
dp[i] = min(dp[i],dp[i-6**power]+1)
power += 1
power = 1
while i >= 9 ** power:
dp[i] = min(dp[i],dp[i-9**power]+1)
power += 1
print((... | n = int(eval(input()))
dp = [float("Inf")]*(n+1)
for i in range(n+1):
if i < 6:dp[i] = i
power = 1
while i >= 6 ** power:
if dp[i] > dp[i-6**power]+1:dp[i] = dp[i-6**power] + 1
power += 1
power = 1
while i >= 9 ** power:
if dp[i] > dp[i-9**power]+1:dp[i] = dp[i-9**p... | 13 | 13 | 319 | 362 | n = int(eval(input()))
dp = [float("Inf")] * (n + 1)
for i in range(n + 1):
if i < 6:
dp[i] = i
power = 1
while i >= 6**power:
dp[i] = min(dp[i], dp[i - 6**power] + 1)
power += 1
power = 1
while i >= 9**power:
dp[i] = min(dp[i], dp[i - 9**power] + 1)
power += ... | n = int(eval(input()))
dp = [float("Inf")] * (n + 1)
for i in range(n + 1):
if i < 6:
dp[i] = i
power = 1
while i >= 6**power:
if dp[i] > dp[i - 6**power] + 1:
dp[i] = dp[i - 6**power] + 1
power += 1
power = 1
while i >= 9**power:
if dp[i] > dp[i - 9**powe... | false | 0 | [
"- dp[i] = min(dp[i], dp[i - 6**power] + 1)",
"+ if dp[i] > dp[i - 6**power] + 1:",
"+ dp[i] = dp[i - 6**power] + 1",
"- dp[i] = min(dp[i], dp[i - 9**power] + 1)",
"+ if dp[i] > dp[i - 9**power] + 1:",
"+ dp[i] = dp[i - 9**power] + 1",
"-print((dp[n]))",... | false | 0.125645 | 0.116443 | 1.079021 | [
"s581170155",
"s662300096"
] |
u811967730 | p03835 | python | s619295369 | s709192946 | 1,916 | 1,626 | 2,940 | 2,940 | Accepted | Accepted | 15.14 | K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
if x > S:
break
for y in range(K + 1):
z = S - (x + y)
if z < 0:
break
if 0 <= z and z <= K:
count += 1
print(count)
| K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - (x + y)
if 0 <= z and z <= K:
count += 1
print(count)
| 14 | 10 | 262 | 194 | K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
if x > S:
break
for y in range(K + 1):
z = S - (x + y)
if z < 0:
break
if 0 <= z and z <= K:
count += 1
print(count)
| K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - (x + y)
if 0 <= z and z <= K:
count += 1
print(count)
| false | 28.571429 | [
"- if x > S:",
"- break",
"- if z < 0:",
"- break"
] | false | 0.116916 | 0.036385 | 3.21326 | [
"s619295369",
"s709192946"
] |
u672220554 | p02972 | python | s172533248 | s454636637 | 837 | 448 | 17,204 | 17,208 | Accepted | Accepted | 46.48 | n = int(eval(input()))
a = list(map(int,input().split()))
res = [0 for i in range(n)]
lres = []
for i in range(n,0,-1):
l = []
flag = 0
t = i*2
while t <= n:
flag = flag ^ res[t-1]
t = t+i
if a[i-1] != flag:
res[i-1] = 1
lres.append(str(i))
print((len(... | def main():
n = int(eval(input()))
a = list(map(int,input().split()))
res = [0 for i in range(n)]
lres = []
for i in range(n,0,-1):
l = []
flag = 0
t = i*2
while t <= n:
flag = flag ^ res[t-1]
t = t+i
if a[i-1] != flag:
... | 19 | 21 | 369 | 457 | n = int(eval(input()))
a = list(map(int, input().split()))
res = [0 for i in range(n)]
lres = []
for i in range(n, 0, -1):
l = []
flag = 0
t = i * 2
while t <= n:
flag = flag ^ res[t - 1]
t = t + i
if a[i - 1] != flag:
res[i - 1] = 1
lres.append(str(i))
print((len(lre... | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
res = [0 for i in range(n)]
lres = []
for i in range(n, 0, -1):
l = []
flag = 0
t = i * 2
while t <= n:
flag = flag ^ res[t - 1]
t = t + i
if a[i - 1] != flag:
... | false | 9.52381 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-res = [0 for i in range(n)]",
"-lres = []",
"-for i in range(n, 0, -1):",
"- l = []",
"- flag = 0",
"- t = i * 2",
"- while t <= n:",
"- flag = flag ^ res[t - 1]",
"- t = t + i",
"- if a[i - 1] !=... | false | 0.045632 | 0.046037 | 0.991208 | [
"s172533248",
"s454636637"
] |
u753803401 | p02868 | python | s746037804 | s824032379 | 1,231 | 1,119 | 103,772 | 96,348 | Accepted | Accepted | 9.1 | import sys
class AlgSegmentTreeMin:
def __init__(self, n, default_value):
self.Nelem = n
self.default_value = default_value
self.size = 1 << (n.bit_length())
self.data = [default_value] * (2 * self.size)
def update(self, i, x):
i += self.size
self.d... | import sys
class AlgSegmentTreeMin:
def __init__(self, n, default_value):
self.Nelem = n
self.default_value = default_value
self.size = 1 << (n.bit_length())
self.data = [default_value] * (2 * self.size)
def update(self, i, x):
i += self.size
self.d... | 60 | 59 | 1,600 | 1,577 | import sys
class AlgSegmentTreeMin:
def __init__(self, n, default_value):
self.Nelem = n
self.default_value = default_value
self.size = 1 << (n.bit_length())
self.data = [default_value] * (2 * self.size)
def update(self, i, x):
i += self.size
self.data[i] = x
... | import sys
class AlgSegmentTreeMin:
def __init__(self, n, default_value):
self.Nelem = n
self.default_value = default_value
self.size = 1 << (n.bit_length())
self.data = [default_value] * (2 * self.size)
def update(self, i, x):
i += self.size
self.data[i] = x
... | false | 1.666667 | [
"- input = sys.stdin.readline",
"+ input = sys.stdin.buffer.readline",
"- n, m = list(map(int, input().rstrip(\"\\n\").split()))",
"+ n, m = list(map(int, input().split()))",
"- lrc = [list(map(int, input().rstrip(\"\\n\").split())) for _ in range(m)]",
"+ lrc = [list(map(int, input().sp... | false | 0.037241 | 0.037076 | 1.004448 | [
"s746037804",
"s824032379"
] |
u489959379 | p02784 | python | s701985879 | s218511971 | 54 | 39 | 13,964 | 13,864 | Accepted | Accepted | 27.78 | h, n = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(n):
h -= a[i]
if h <= 0:
print("Yes")
else:
print("No") | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
h, n = list(map(int, input().split()))
A = list(map(int, input().split()))
print(("Yes" if h <= sum(A) else "No"))
if __name__ == '__main__':
resolve()
| 10 | 17 | 162 | 305 | h, n = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(n):
h -= a[i]
if h <= 0:
print("Yes")
else:
print("No")
| import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
h, n = list(map(int, input().split()))
A = list(map(int, input().split()))
print(("Yes" if h <= sum(A) else "No"))
if __name__ == "__main__":
resolve()
| false | 41.176471 | [
"-h, n = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-for i in range(n):",
"- h -= a[i]",
"-if h <= 0:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+input = sys.stdin.readline",
"+f_inf = floa... | false | 0.078052 | 0.03504 | 2.227486 | [
"s701985879",
"s218511971"
] |
u340500592 | p02390 | python | s608800399 | s877019269 | 30 | 20 | 7,660 | 7,664 | Accepted | Accepted | 33.33 | S = int(eval(input()))
h = int(S / 3600)
m = int( (S - h * 60**2) / 60)
s = int( (S - h * 60**2 - m * 60))
print((str(h) + ':' + str(m) + ':' + str(s))) | S = int(eval(input()))
h = S // 3600
m = (S % 3600) // 60
s = (S % 3600) % 60
print((str(h) + ':' + str(m) + ':' + str(s))) | 5 | 5 | 148 | 119 | S = int(eval(input()))
h = int(S / 3600)
m = int((S - h * 60**2) / 60)
s = int((S - h * 60**2 - m * 60))
print((str(h) + ":" + str(m) + ":" + str(s)))
| S = int(eval(input()))
h = S // 3600
m = (S % 3600) // 60
s = (S % 3600) % 60
print((str(h) + ":" + str(m) + ":" + str(s)))
| false | 0 | [
"-h = int(S / 3600)",
"-m = int((S - h * 60**2) / 60)",
"-s = int((S - h * 60**2 - m * 60))",
"+h = S // 3600",
"+m = (S % 3600) // 60",
"+s = (S % 3600) % 60"
] | false | 0.061167 | 0.060307 | 1.014261 | [
"s608800399",
"s877019269"
] |
u747602774 | p02781 | python | s532733122 | s931731635 | 45 | 19 | 3,188 | 3,444 | Accepted | Accepted | 57.78 | import itertools
N = eval(input())
K = int(eval(input()))
lN = len(N)
if K == 1:
ans = int(N[0])+9*(lN-1)
print(ans)
elif K == 2:
not0 = 1000
for i in range(1,lN):
if int(N[i]) != 0:
not0 = i
break
ans = 0
n = [i for i in range(lN)]
for v ... | N = int(eval(input()))
K = int(eval(input()))
S = str(N)
'''
ans = 0
li = []
for i in range(1,N+1):
if str(i).count('0') == len(str(i)) - K:
ans += 1
li.append(i)
print(ans)
print(li)
'''
L = len(S)
dp = [[[1, 0], [0, 0], [0, 0], [0, 0]] for i in range(L)]
dp[0] = [[1, 0], [int(S[0]... | 58 | 40 | 1,414 | 1,047 | import itertools
N = eval(input())
K = int(eval(input()))
lN = len(N)
if K == 1:
ans = int(N[0]) + 9 * (lN - 1)
print(ans)
elif K == 2:
not0 = 1000
for i in range(1, lN):
if int(N[i]) != 0:
not0 = i
break
ans = 0
n = [i for i in range(lN)]
for v in itertools.... | N = int(eval(input()))
K = int(eval(input()))
S = str(N)
"""
ans = 0
li = []
for i in range(1,N+1):
if str(i).count('0') == len(str(i)) - K:
ans += 1
li.append(i)
print(ans)
print(li)
"""
L = len(S)
dp = [[[1, 0], [0, 0], [0, 0], [0, 0]] for i in range(L)]
dp[0] = [[1, 0], [int(S[0]) - 1, 1], [0, 0]... | false | 31.034483 | [
"-import itertools",
"-",
"-N = eval(input())",
"+N = int(eval(input()))",
"-lN = len(N)",
"-if K == 1:",
"- ans = int(N[0]) + 9 * (lN - 1)",
"- print(ans)",
"-elif K == 2:",
"- not0 = 1000",
"- for i in range(1, lN):",
"- if int(N[i]) != 0:",
"- not0 = i",
"-... | false | 0.048657 | 0.048468 | 1.003888 | [
"s532733122",
"s931731635"
] |
u782001565 | p03424 | python | s757972791 | s760797852 | 30 | 27 | 9,140 | 9,164 | Accepted | Accepted | 10 | N = int(eval(input()))
S = list(map(str, input().split()))
candy_list = ['P', 'W', 'G', 'Y']
answer = 0
for i in range(4):
if candy_list[i] in S:
answer += 1
if answer == 3:
print('Three')
if answer == 4:
print('Four') | N = int(eval(input()))
S = list(map(str, input().split()))
if 'Y' in S:
answer = 'Four'
else:
answer = 'Three'
print(answer) | 13 | 8 | 246 | 134 | N = int(eval(input()))
S = list(map(str, input().split()))
candy_list = ["P", "W", "G", "Y"]
answer = 0
for i in range(4):
if candy_list[i] in S:
answer += 1
if answer == 3:
print("Three")
if answer == 4:
print("Four")
| N = int(eval(input()))
S = list(map(str, input().split()))
if "Y" in S:
answer = "Four"
else:
answer = "Three"
print(answer)
| false | 38.461538 | [
"-candy_list = [\"P\", \"W\", \"G\", \"Y\"]",
"-answer = 0",
"-for i in range(4):",
"- if candy_list[i] in S:",
"- answer += 1",
"-if answer == 3:",
"- print(\"Three\")",
"-if answer == 4:",
"- print(\"Four\")",
"+if \"Y\" in S:",
"+ answer = \"Four\"",
"+else:",
"+ ans... | false | 0.047698 | 0.184069 | 0.259133 | [
"s757972791",
"s760797852"
] |
u059210959 | p03208 | python | s025890509 | s470753818 | 426 | 207 | 24,196 | 15,088 | Accepted | Accepted | 51.41 | # encoding:utf-8
import copy
import numpy as np
import random
n,k = list(map(int,input().split()))
h = []
for i in range(n):
h.append(int(eval(input())))
h.sort()
# print(h)
max_tree = []
min_tree = []
ans = 10**9
for i in range(n-k+1):
ans = min(h[i+k-1]-h[i],ans)
print(ans)
| #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.de... | 21 | 28 | 298 | 611 | # encoding:utf-8
import copy
import numpy as np
import random
n, k = list(map(int, input().split()))
h = []
for i in range(n):
h.append(int(eval(input())))
h.sort()
# print(h)
max_tree = []
min_tree = []
ans = 10**9
for i in range(n - k + 1):
ans = min(h[i + k - 1] - h[i], ans)
print(ans)
| #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect # bisect_left これで二部探索の大小検索が行える
import fractions # 最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9 + 7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.deque()
... | false | 25 | [
"+#!/usr/bin/env python3",
"-import numpy as np",
"+import bisect # bisect_left これで二部探索の大小検索が行える",
"+import fractions # 最小公倍数などはこっち",
"+import math",
"+import sys",
"+import collections",
"+from decimal import Decimal # 10進数で考慮できる",
"-n, k = list(map(int, input().split()))",
"-h = []",
"-for ... | false | 0.119676 | 0.148508 | 0.805857 | [
"s025890509",
"s470753818"
] |
u565149926 | p03075 | python | s702090925 | s886538978 | 165 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.7 | num_a = 5
antennas = [int(eval(input())) for _ in range(num_a)]
k = int(eval(input()))
exist = False
for q in range(num_a - 1, 0, -1):
for p in range(q - 1, -1, -1):
if antennas[q] - antennas[p] > k:
exist = True
break
if exist:
print(":(")
else:
print("Yay!")
| N = 5
inputs = [int(eval(input())) for _ in range(N)]
k = int(eval(input()))
print((":(" if inputs[N-1] - inputs[0] > k else "Yay!"))
| 14 | 4 | 307 | 123 | num_a = 5
antennas = [int(eval(input())) for _ in range(num_a)]
k = int(eval(input()))
exist = False
for q in range(num_a - 1, 0, -1):
for p in range(q - 1, -1, -1):
if antennas[q] - antennas[p] > k:
exist = True
break
if exist:
print(":(")
else:
print("Yay!")
| N = 5
inputs = [int(eval(input())) for _ in range(N)]
k = int(eval(input()))
print((":(" if inputs[N - 1] - inputs[0] > k else "Yay!"))
| false | 71.428571 | [
"-num_a = 5",
"-antennas = [int(eval(input())) for _ in range(num_a)]",
"+N = 5",
"+inputs = [int(eval(input())) for _ in range(N)]",
"-exist = False",
"-for q in range(num_a - 1, 0, -1):",
"- for p in range(q - 1, -1, -1):",
"- if antennas[q] - antennas[p] > k:",
"- exist = Tru... | false | 0.03619 | 0.037749 | 0.958707 | [
"s702090925",
"s886538978"
] |
u102461423 | p03216 | python | s974541417 | s341530514 | 1,289 | 1,063 | 55,512 | 58,432 | Accepted | Accepted | 17.53 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
S = np.frombuffer(b'-'+readline().rstrip(),'S1')
Q = int(readline())
query = list(map(int,read().split()))
isD = S == b'D'
isM = S == b'M'
isC = S =... | from numpy import *
I=input
N=int(I())
S=array(list('-'+I()))
Q=int(I())
query = list(map(int,I().split()))
D=S=='D';M=S=='M';C=S=='C'
d=D.cumsum(dtype=int64);m=M.cumsum(dtype=int64)
for K in query:
x=d.copy();x[K:]-=d[:-K];x*=M
x[K+1:]-=D[1:-K]*(m[K:-1]-m[:-K-1])
print((sum(cumsum(x)*C))) | 26 | 12 | 598 | 299 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
S = np.frombuffer(b"-" + readline().rstrip(), "S1")
Q = int(readline())
query = list(map(int, read().split()))
isD = S == b"D"
isM = S == b"M"
isC = S == b"C"
cumD... | from numpy import *
I = input
N = int(I())
S = array(list("-" + I()))
Q = int(I())
query = list(map(int, I().split()))
D = S == "D"
M = S == "M"
C = S == "C"
d = D.cumsum(dtype=int64)
m = M.cumsum(dtype=int64)
for K in query:
x = d.copy()
x[K:] -= d[:-K]
x *= M
x[K + 1 :] -= D[1:-K] * (m[K:-1] - m[: -K... | false | 53.846154 | [
"-import sys",
"+from numpy import *",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"-import numpy as np",
"-",
"-N = int(readline())",
"-S = np.frombuffer(b\"-\" + readline().rstrip(), \"S1\")",
"-Q = int(readline())",
"-qu... | false | 0.580445 | 0.194599 | 2.982778 | [
"s974541417",
"s341530514"
] |
u173148629 | p02756 | python | s844097413 | s237443527 | 839 | 523 | 70,232 | 8,692 | Accepted | Accepted | 37.66 | S=eval(input())
Q=int(eval(input()))
X=[]
Y=[]
f=1
for _ in range(Q):
A=list(input().split())
if A[0]=="1":
f*=-1
if A[0]=="2":
if A[1]=="1":
if f==1:
X.append(A[2])
if f==-1:
Y.append(A[2])
if A[1]=="2":
... | from collections import deque
S=eval(input())
Q=int(eval(input()))
X=deque(S)
f=1
for _ in range(Q):
A=list(input().split())
if A[0]=="1":
f*=-1
if A[0]=="2":
if A[1]=="1":
if f==1:
X.appendleft(A[2])
if f==-1:
X.append(... | 33 | 26 | 557 | 537 | S = eval(input())
Q = int(eval(input()))
X = []
Y = []
f = 1
for _ in range(Q):
A = list(input().split())
if A[0] == "1":
f *= -1
if A[0] == "2":
if A[1] == "1":
if f == 1:
X.append(A[2])
if f == -1:
Y.append(A[2])
if A[1] == "2... | from collections import deque
S = eval(input())
Q = int(eval(input()))
X = deque(S)
f = 1
for _ in range(Q):
A = list(input().split())
if A[0] == "1":
f *= -1
if A[0] == "2":
if A[1] == "1":
if f == 1:
X.appendleft(A[2])
if f == -1:
X.... | false | 21.212121 | [
"+from collections import deque",
"+",
"-X = []",
"-Y = []",
"+X = deque(S)",
"+ X.appendleft(A[2])",
"+ if f == -1:",
"- if f == -1:",
"- Y.append(A[2])",
"+ X.appendleft(A[2])",
"+ if f == 1:",
"- if f =... | false | 0.126318 | 0.08928 | 1.414851 | [
"s844097413",
"s237443527"
] |
u994307795 | p02785 | python | s748277449 | s131543698 | 189 | 152 | 25,768 | 26,024 | Accepted | Accepted | 19.58 | n, k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
h = sorted(h)[::-1]
ans = 0
for i in range(k, n):
ans += h[i]
print(ans) | n, k = list(map(int, input().split()))
h = sorted(list(map(int, input().split())), reverse=True)
print((sum(h[k:]))) | 10 | 3 | 156 | 110 | n, k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
h = sorted(h)[::-1]
ans = 0
for i in range(k, n):
ans += h[i]
print(ans)
| n, k = list(map(int, input().split()))
h = sorted(list(map(int, input().split())), reverse=True)
print((sum(h[k:])))
| false | 70 | [
"-h = [int(i) for i in input().split()]",
"-h = sorted(h)[::-1]",
"-ans = 0",
"-for i in range(k, n):",
"- ans += h[i]",
"-print(ans)",
"+h = sorted(list(map(int, input().split())), reverse=True)",
"+print((sum(h[k:])))"
] | false | 0.045676 | 0.045364 | 1.006878 | [
"s748277449",
"s131543698"
] |
u869919400 | p02743 | python | s280799280 | s850872148 | 260 | 194 | 59,756 | 38,384 | Accepted | Accepted | 25.38 | a, b, c = list(map(int, input().split()))
from decimal import Decimal
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print('Yes')
else:
print('No') | a,b,c = list(map(int, input().split()))
if 4*a*b < (c-a-b)**2 and c-a-b > 0:
print('Yes')
else:
print('No') | 8 | 6 | 173 | 115 | a, b, c = list(map(int, input().split()))
from decimal import Decimal
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0:
print("Yes")
else:
print("No")
| false | 25 | [
"-from decimal import Decimal",
"-",
"-if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():",
"+if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0:"
] | false | 0.040242 | 0.037905 | 1.061642 | [
"s280799280",
"s850872148"
] |
u001024152 | p03212 | python | s930025760 | s613365111 | 89 | 53 | 3,060 | 3,316 | Accepted | Accepted | 40.45 | N = int(eval(input()))
def dfs(s):
if int(s)>N:
return 0
for c in list("753"):
if s.count(c) < 1:
ret = 0
break
else:
ret = 1
for c in list("753"):
ret += dfs(s+c)
return ret
print((dfs("0"))) | from collections import deque
N = int(eval(input()))
ans = 0
q = deque([7, 5, 3])
while q:
s = q.pop()
str_s = str(s)
ok = True
ok &= "7" in str_s
ok &= "5" in str_s
ok &= "3" in str_s
ok &= s <= N
if ok:
ans += 1
if len(str_s) < 9:
q.append(10*s + ... | 16 | 22 | 278 | 387 | N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
for c in list("753"):
if s.count(c) < 1:
ret = 0
break
else:
ret = 1
for c in list("753"):
ret += dfs(s + c)
return ret
print((dfs("0")))
| from collections import deque
N = int(eval(input()))
ans = 0
q = deque([7, 5, 3])
while q:
s = q.pop()
str_s = str(s)
ok = True
ok &= "7" in str_s
ok &= "5" in str_s
ok &= "3" in str_s
ok &= s <= N
if ok:
ans += 1
if len(str_s) < 9:
q.append(10 * s + 3)
q.app... | false | 27.272727 | [
"+from collections import deque",
"+",
"-",
"-",
"-def dfs(s):",
"- if int(s) > N:",
"- return 0",
"- for c in list(\"753\"):",
"- if s.count(c) < 1:",
"- ret = 0",
"- break",
"- else:",
"- ret = 1",
"- for c in list(\"753\"):",
"- ... | false | 0.114542 | 0.070627 | 1.621789 | [
"s930025760",
"s613365111"
] |
u878545651 | p02577 | python | s405798833 | s884754063 | 205 | 52 | 9,264 | 10,764 | Accepted | Accepted | 74.63 | def main():
N = int(input())
print('Yes') if N % 9 == 0 else print('No')
if __name__ == '__main__':
main()
| def main():
N = str(input())
M = list(map(int, N))
S = sum(M)
print('Yes') if S % 9 == 0 else print('No')
if __name__ == '__main__':
main()
| 7 | 10 | 126 | 174 | def main():
N = int(input())
print("Yes") if N % 9 == 0 else print("No")
if __name__ == "__main__":
main()
| def main():
N = str(input())
M = list(map(int, N))
S = sum(M)
print("Yes") if S % 9 == 0 else print("No")
if __name__ == "__main__":
main()
| false | 30 | [
"- N = int(input())",
"- print(\"Yes\") if N % 9 == 0 else print(\"No\")",
"+ N = str(input())",
"+ M = list(map(int, N))",
"+ S = sum(M)",
"+ print(\"Yes\") if S % 9 == 0 else print(\"No\")"
] | false | 0.095897 | 0.038528 | 2.48904 | [
"s405798833",
"s884754063"
] |
u638282348 | p03220 | python | s511533246 | s974019210 | 327 | 150 | 21,556 | 12,484 | Accepted | Accepted | 54.13 | from numpy import array, argmin
eval(input())
temp_on_sea, oracle = list(map(int, input().rstrip("\n").split()))
heights = list(map(int , input().rstrip("\n").split()))
temp_diff = [abs(temp_on_sea - height * 0.006 - oracle) for height in heights]
print((array(temp_diff).argmin() + 1))
| from numpy import argmin
eval(input())
T, A = list(map(int, input().split()))
print((argmin([abs(T - x * 0.006 - A) for x in map(int, input().split())]) + 1)) | 8 | 4 | 282 | 147 | from numpy import array, argmin
eval(input())
temp_on_sea, oracle = list(map(int, input().rstrip("\n").split()))
heights = list(map(int, input().rstrip("\n").split()))
temp_diff = [abs(temp_on_sea - height * 0.006 - oracle) for height in heights]
print((array(temp_diff).argmin() + 1))
| from numpy import argmin
eval(input())
T, A = list(map(int, input().split()))
print((argmin([abs(T - x * 0.006 - A) for x in map(int, input().split())]) + 1))
| false | 50 | [
"-from numpy import array, argmin",
"+from numpy import argmin",
"-temp_on_sea, oracle = list(map(int, input().rstrip(\"\\n\").split()))",
"-heights = list(map(int, input().rstrip(\"\\n\").split()))",
"-temp_diff = [abs(temp_on_sea - height * 0.006 - oracle) for height in heights]",
"-print((array(temp_di... | false | 0.176352 | 0.20932 | 0.842498 | [
"s511533246",
"s974019210"
] |
u837745858 | p02842 | python | s226632909 | s707692772 | 31 | 17 | 2,940 | 2,940 | Accepted | Accepted | 45.16 | # Input the amount of money Takahashi paid
N = int(eval(input()))
# Check if the price before tax is X, for X = 1, 2, 3, ..., N
ans = -1
for i in range(1, N + 1):
if int(i * 1.08) == N:
ans = i
# Print answer
if ans != -1:
print(ans)
else:
print(":(") | import math
# Input the amount of money Takahashi paid
N = int(eval(input()))
# Find nearest integer price more than or equal to X/1.08
X = math.ceil(N / 1.08)
# Check if the "taxed price" is equal to N yen
if math.floor(X * 1.08) == N:
print(X)
else:
print(":(") | 14 | 13 | 265 | 274 | # Input the amount of money Takahashi paid
N = int(eval(input()))
# Check if the price before tax is X, for X = 1, 2, 3, ..., N
ans = -1
for i in range(1, N + 1):
if int(i * 1.08) == N:
ans = i
# Print answer
if ans != -1:
print(ans)
else:
print(":(")
| import math
# Input the amount of money Takahashi paid
N = int(eval(input()))
# Find nearest integer price more than or equal to X/1.08
X = math.ceil(N / 1.08)
# Check if the "taxed price" is equal to N yen
if math.floor(X * 1.08) == N:
print(X)
else:
print(":(")
| false | 7.142857 | [
"+import math",
"+",
"-# Check if the price before tax is X, for X = 1, 2, 3, ..., N",
"-ans = -1",
"-for i in range(1, N + 1):",
"- if int(i * 1.08) == N:",
"- ans = i",
"-# Print answer",
"-if ans != -1:",
"- print(ans)",
"+# Find nearest integer price more than or equal to X/1.08... | false | 0.046293 | 0.045591 | 1.015403 | [
"s226632909",
"s707692772"
] |
u844789719 | p02911 | python | s361599013 | s642203694 | 260 | 231 | 10,472 | 40,732 | Accepted | Accepted | 11.15 | N, K, Q = [int(_) for _ in input().split()]
A = [int(eval(input())) for _ in range(Q)]
s = [K - Q] * (N + 1)
for a in A:
s[a] += 1
for i in range(1, N + 1):
if s[i] > 0:
print('Yes')
else:
print('No')
| import sys
import numpy as np
def main(stdin):
N, K, Q = stdin[:3]
ans = np.full(N + 1, K - Q, dtype=np.int64)
for i in stdin[3:]:
ans[i] += 1
ans = np.where(ans > 0, 'Yes', 'No')
return ans[1:]
if sys.argv[-1] == 'ONLINE_JUDGE':
import numba
from numba.pycc import... | 10 | 24 | 232 | 616 | N, K, Q = [int(_) for _ in input().split()]
A = [int(eval(input())) for _ in range(Q)]
s = [K - Q] * (N + 1)
for a in A:
s[a] += 1
for i in range(1, N + 1):
if s[i] > 0:
print("Yes")
else:
print("No")
| import sys
import numpy as np
def main(stdin):
N, K, Q = stdin[:3]
ans = np.full(N + 1, K - Q, dtype=np.int64)
for i in stdin[3:]:
ans[i] += 1
ans = np.where(ans > 0, "Yes", "No")
return ans[1:]
if sys.argv[-1] == "ONLINE_JUDGE":
import numba
from numba.pycc import CC
cc = C... | false | 58.333333 | [
"-N, K, Q = [int(_) for _ in input().split()]",
"-A = [int(eval(input())) for _ in range(Q)]",
"-s = [K - Q] * (N + 1)",
"-for a in A:",
"- s[a] += 1",
"-for i in range(1, N + 1):",
"- if s[i] > 0:",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"+import sys",
"+impo... | false | 0.045044 | 0.72001 | 0.06256 | [
"s361599013",
"s642203694"
] |
u391589398 | p02661 | python | s939698051 | s190744560 | 575 | 488 | 42,132 | 27,140 | Accepted | Accepted | 15.13 | n = int(eval(input()))
AB = []
for _ in range(n):
ab = tuple(map(int, input().split()))
AB.append(ab)
AB_A = sorted(AB, key=lambda x: x[0])
AB_B = sorted(AB, key=lambda x: x[1])
if n%2==1:
sa, sb = AB_A[n//2]
la, lb = AB_B[n//2]
print((lb - sa + 1))
else:
sal, sbl = AB_A[n//2-1... | n = int(eval(input()))
A = []
B = []
for _ in range(n):
a, b = tuple(map(int, input().split()))
A.append(a)
B.append(b)
A = sorted(A)
B = sorted(B)
if n%2==1:
sa = A[n//2]
lb = B[n//2]
print((lb - sa + 1))
else:
sal = A[n//2-1]
sar = A[n//2]
lbl = B[n//2-1]
... | 21 | 22 | 440 | 368 | n = int(eval(input()))
AB = []
for _ in range(n):
ab = tuple(map(int, input().split()))
AB.append(ab)
AB_A = sorted(AB, key=lambda x: x[0])
AB_B = sorted(AB, key=lambda x: x[1])
if n % 2 == 1:
sa, sb = AB_A[n // 2]
la, lb = AB_B[n // 2]
print((lb - sa + 1))
else:
sal, sbl = AB_A[n // 2 - 1]
... | n = int(eval(input()))
A = []
B = []
for _ in range(n):
a, b = tuple(map(int, input().split()))
A.append(a)
B.append(b)
A = sorted(A)
B = sorted(B)
if n % 2 == 1:
sa = A[n // 2]
lb = B[n // 2]
print((lb - sa + 1))
else:
sal = A[n // 2 - 1]
sar = A[n // 2]
lbl = B[n // 2 - 1]
lbr ... | false | 4.545455 | [
"-AB = []",
"+A = []",
"+B = []",
"- ab = tuple(map(int, input().split()))",
"- AB.append(ab)",
"-AB_A = sorted(AB, key=lambda x: x[0])",
"-AB_B = sorted(AB, key=lambda x: x[1])",
"+ a, b = tuple(map(int, input().split()))",
"+ A.append(a)",
"+ B.append(b)",
"+A = sorted(A)",
"+... | false | 0.035681 | 0.042651 | 0.836586 | [
"s939698051",
"s190744560"
] |
u620868411 | p02760 | python | s678775469 | s312677492 | 174 | 18 | 39,760 | 3,064 | Accepted | Accepted | 89.66 | al = [input().split() for _ in range(3)]
n = int(eval(input()))
for _ in range(n):
b = eval(input())
for i in range(3):
for j in range(3):
if al[i][j]==b:
al[i][j] = "0"
if al[0][0]=="0" and al[0][1]=="0" and al[0][2]=="0":
print("Yes")
elif al[1][0]=="0" and ... | al = [list(map(int, input().split())) for _ in range(3)]
n = int(eval(input()))
for _ in range(n):
x = int(eval(input()))
for i in range(3):
for j in range(3):
if al[i][j]==x:
al[i][j] = -1
for i in range(3):
if -3==sum(al[i]):
print("Yes")
... | 27 | 27 | 832 | 551 | al = [input().split() for _ in range(3)]
n = int(eval(input()))
for _ in range(n):
b = eval(input())
for i in range(3):
for j in range(3):
if al[i][j] == b:
al[i][j] = "0"
if al[0][0] == "0" and al[0][1] == "0" and al[0][2] == "0":
print("Yes")
elif al[1][0] == "0" and al... | al = [list(map(int, input().split())) for _ in range(3)]
n = int(eval(input()))
for _ in range(n):
x = int(eval(input()))
for i in range(3):
for j in range(3):
if al[i][j] == x:
al[i][j] = -1
for i in range(3):
if -3 == sum(al[i]):
print("Yes")
exit()
... | false | 0 | [
"-al = [input().split() for _ in range(3)]",
"+al = [list(map(int, input().split())) for _ in range(3)]",
"- b = eval(input())",
"+ x = int(eval(input()))",
"- if al[i][j] == b:",
"- al[i][j] = \"0\"",
"-if al[0][0] == \"0\" and al[0][1] == \"0\" and al[0][2] == \"0\":",
... | false | 0.092951 | 0.037793 | 2.459474 | [
"s678775469",
"s312677492"
] |
u729133443 | p02909 | python | s461103006 | s638622277 | 64 | 23 | 61,312 | 8,924 | Accepted | Accepted | 64.06 | print(('CRSlauoinunndyyy'[ord(input()[0])%7%3::3])) | print(('CRSlauoinunndyyy'[id(id)%3::3])) | 1 | 1 | 49 | 38 | print(("CRSlauoinunndyyy"[ord(input()[0]) % 7 % 3 :: 3]))
| print(("CRSlauoinunndyyy"[id(id) % 3 :: 3]))
| false | 0 | [
"-print((\"CRSlauoinunndyyy\"[ord(input()[0]) % 7 % 3 :: 3]))",
"+print((\"CRSlauoinunndyyy\"[id(id) % 3 :: 3]))"
] | false | 0.040583 | 0.039977 | 1.015146 | [
"s461103006",
"s638622277"
] |
u982591663 | p03073 | python | s265863380 | s632499850 | 56 | 49 | 3,956 | 3,956 | Accepted | Accepted | 12.5 | S = list(eval(input()))
ans = 0
if len(S) > 1:
for i in range(len(S)-1):
if S[i] == S[i+1]:
if S[i+1] == "0":
S[i+1] = "1"
ans += 1
else:
S[i+1] = "0"
ans += 1
print(ans)
else:
print((0))
| S = list(eval(input()))
before_tile = S[0]
ans = 0
for i in range(1, len(S)):
if S[i] == before_tile:
ans += 1
if S[i] == "0":
S[i] = "1"
else:
S[i] = "0"
before_tile = S[i]
print(ans)
| 15 | 15 | 303 | 252 | S = list(eval(input()))
ans = 0
if len(S) > 1:
for i in range(len(S) - 1):
if S[i] == S[i + 1]:
if S[i + 1] == "0":
S[i + 1] = "1"
ans += 1
else:
S[i + 1] = "0"
ans += 1
print(ans)
else:
print((0))
| S = list(eval(input()))
before_tile = S[0]
ans = 0
for i in range(1, len(S)):
if S[i] == before_tile:
ans += 1
if S[i] == "0":
S[i] = "1"
else:
S[i] = "0"
before_tile = S[i]
print(ans)
| false | 0 | [
"+before_tile = S[0]",
"-if len(S) > 1:",
"- for i in range(len(S) - 1):",
"- if S[i] == S[i + 1]:",
"- if S[i + 1] == \"0\":",
"- S[i + 1] = \"1\"",
"- ans += 1",
"- else:",
"- S[i + 1] = \"0\"",
"- ans +=... | false | 0.043661 | 0.045559 | 0.958325 | [
"s265863380",
"s632499850"
] |
u992910889 | p03221 | python | s118886110 | s672211358 | 1,071 | 947 | 78,296 | 89,432 | Accepted | Accepted | 11.58 | # import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(1... | # import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit... | 36 | 36 | 853 | 716 | # import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10**5 + 1... | # import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10**5 + 1... | false | 0 | [
"- P = []",
"- city_count = [0] * N",
"- city_end = [1] * N",
"- for i in range(M):",
"- p, y = list(map(int, input().split()))",
"- city_count[p - 1] += 1",
"- P.append([p, y])",
"- P1 = sorted(P, key=lambda x: x[1])",
"- P1 = sorted(P1)",
"- for i in P1:... | false | 0.049383 | 0.038306 | 1.289171 | [
"s118886110",
"s672211358"
] |
u932465688 | p03329 | python | s925703271 | s446205528 | 917 | 682 | 3,828 | 3,828 | Accepted | Accepted | 25.63 | N = int(eval(input()))
dp = [0]*100001
L = [1,6,36,216,1296,7776,46656,9,81,729,6561,59049]
for i in range(100001):
for j in range(len(L)):
if 1 <= i+L[j] <= 100000:
if dp[i+L[j]] == 0:
dp[i+L[j]] = dp[i]+1
else:
dp[i+L[j]] = min(dp[i]+1,dp[i+... | N = int(eval(input()))
dp = [float('inf')]*100001
dp[0],dp[1] = 0,1
L = [1,6,36,216,1296,7776,46656,9,81,729,6561,59049]
for i in range(2,100001):
for j in range(len(L)):
if i-L[j] >= 0:
dp[i] = min(dp[i-L[j]]+1,dp[i])
print((dp[N])) | 11 | 9 | 335 | 245 | N = int(eval(input()))
dp = [0] * 100001
L = [1, 6, 36, 216, 1296, 7776, 46656, 9, 81, 729, 6561, 59049]
for i in range(100001):
for j in range(len(L)):
if 1 <= i + L[j] <= 100000:
if dp[i + L[j]] == 0:
dp[i + L[j]] = dp[i] + 1
else:
dp[i + L[j]] = min... | N = int(eval(input()))
dp = [float("inf")] * 100001
dp[0], dp[1] = 0, 1
L = [1, 6, 36, 216, 1296, 7776, 46656, 9, 81, 729, 6561, 59049]
for i in range(2, 100001):
for j in range(len(L)):
if i - L[j] >= 0:
dp[i] = min(dp[i - L[j]] + 1, dp[i])
print((dp[N]))
| false | 18.181818 | [
"-dp = [0] * 100001",
"+dp = [float(\"inf\")] * 100001",
"+dp[0], dp[1] = 0, 1",
"-for i in range(100001):",
"+for i in range(2, 100001):",
"- if 1 <= i + L[j] <= 100000:",
"- if dp[i + L[j]] == 0:",
"- dp[i + L[j]] = dp[i] + 1",
"- else:",
"- ... | false | 2.148806 | 0.883839 | 2.431218 | [
"s925703271",
"s446205528"
] |
u057109575 | p03043 | python | s681476593 | s215483424 | 171 | 61 | 39,536 | 65,336 | Accepted | Accepted | 64.33 | N, K = list(map(int, input().split()))
coin = [0] * N
for i in range(len(coin)):
cnt = 0
v = i + 1
while v < K:
cnt += 1
v *= 2
coin[i] = cnt
ans = 0
for v in coin:
ans += 0.5 ** v
print((ans / N))
|
N, K = list(map(int, input().split()))
cnt = 0
for n in range(1, N + 1):
tmp = 0
while n < K:
n *= 2
tmp += 1
cnt += 1 / 2 ** tmp
print((cnt / N))
| 15 | 12 | 246 | 181 | N, K = list(map(int, input().split()))
coin = [0] * N
for i in range(len(coin)):
cnt = 0
v = i + 1
while v < K:
cnt += 1
v *= 2
coin[i] = cnt
ans = 0
for v in coin:
ans += 0.5**v
print((ans / N))
| N, K = list(map(int, input().split()))
cnt = 0
for n in range(1, N + 1):
tmp = 0
while n < K:
n *= 2
tmp += 1
cnt += 1 / 2**tmp
print((cnt / N))
| false | 20 | [
"-coin = [0] * N",
"-for i in range(len(coin)):",
"- cnt = 0",
"- v = i + 1",
"- while v < K:",
"- cnt += 1",
"- v *= 2",
"- coin[i] = cnt",
"-ans = 0",
"-for v in coin:",
"- ans += 0.5**v",
"-print((ans / N))",
"+cnt = 0",
"+for n in range(1, N + 1):",
"+ ... | false | 0.057774 | 0.084746 | 0.681731 | [
"s681476593",
"s215483424"
] |
u425762225 | p02848 | python | s288926034 | s981005196 | 37 | 33 | 9,604 | 9,592 | Accepted | Accepted | 10.81 | from functools import partial
N = int(eval(input()))
S = eval(input())
lst = [chr(ord("A")+i) for i in range(26)]
def convert(x,n):
id = ord(x) - ord("A")
return lst[(id+n)%26]
convert1 = partial(convert,n=N)
ans = "".join(map(convert1,S))
print(ans) | from functools import partial
N = int(eval(input()))
S = eval(input())
lst = [chr(ord("A")+i) for i in range(26)]
def convert(x,n,l):
id = ord(x) - ord("A")
return l[(id+n)%26]
ans = "".join(map(partial(convert,n=N,l=lst),S))
print(ans) | 15 | 12 | 261 | 242 | from functools import partial
N = int(eval(input()))
S = eval(input())
lst = [chr(ord("A") + i) for i in range(26)]
def convert(x, n):
id = ord(x) - ord("A")
return lst[(id + n) % 26]
convert1 = partial(convert, n=N)
ans = "".join(map(convert1, S))
print(ans)
| from functools import partial
N = int(eval(input()))
S = eval(input())
lst = [chr(ord("A") + i) for i in range(26)]
def convert(x, n, l):
id = ord(x) - ord("A")
return l[(id + n) % 26]
ans = "".join(map(partial(convert, n=N, l=lst), S))
print(ans)
| false | 20 | [
"-def convert(x, n):",
"+def convert(x, n, l):",
"- return lst[(id + n) % 26]",
"+ return l[(id + n) % 26]",
"-convert1 = partial(convert, n=N)",
"-ans = \"\".join(map(convert1, S))",
"+ans = \"\".join(map(partial(convert, n=N, l=lst), S))"
] | false | 0.037221 | 0.037397 | 0.995317 | [
"s288926034",
"s981005196"
] |
u576917603 | p02899 | python | s311080442 | s247678683 | 339 | 179 | 62,888 | 14,008 | Accepted | Accepted | 47.2 | n=int(input())
a=list(map(int,input().split()))
b={}
cnt=1;
for i in a:
b[i]=cnt
cnt+=1
for i in range(1,n+1):
print(b[i], end=" ")
| n=int(input())
a=list(map(int,input().split()))
d=[None]*n
for x,i in enumerate(a):
d[i-1]=x+1
for i in d:
print(i,end=" ")
| 9 | 7 | 151 | 137 | n = int(input())
a = list(map(int, input().split()))
b = {}
cnt = 1
for i in a:
b[i] = cnt
cnt += 1
for i in range(1, n + 1):
print(b[i], end=" ")
| n = int(input())
a = list(map(int, input().split()))
d = [None] * n
for x, i in enumerate(a):
d[i - 1] = x + 1
for i in d:
print(i, end=" ")
| false | 22.222222 | [
"-b = {}",
"-cnt = 1",
"-for i in a:",
"- b[i] = cnt",
"- cnt += 1",
"-for i in range(1, n + 1):",
"- print(b[i], end=\" \")",
"+d = [None] * n",
"+for x, i in enumerate(a):",
"+ d[i - 1] = x + 1",
"+for i in d:",
"+ print(i, end=\" \")"
] | false | 0.118755 | 0.045028 | 2.63737 | [
"s311080442",
"s247678683"
] |
u368796742 | p02820 | python | s908491664 | s514738686 | 468 | 50 | 38,776 | 4,468 | Accepted | Accepted | 89.32 | import copy
n,k = list(map(int,input().split()))
r,s,p = list(map(int,input().split()))
T = list(eval(input()))
mo = [[] for i in range(k)]
for i in range(n):
num = i % k
mo[num].append(T[i])
mo1 = copy.deepcopy(mo)
for i in range(k):
for j in range(len(mo[i])):
if mo[i][j] == ... | import copy
n,k = list(map(int,input().split()))
r,s,p = list(map(int,input().split()))
T = list(eval(input()))
for i in range(n-k):
if T[i] == T[i+k]:
T[i+k] = "x"
cr = T.count("r")
cp = T.count("p")
cs = T.count("s")
print((cp*s+cr*p+cs*r))
| 33 | 13 | 753 | 249 | import copy
n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
T = list(eval(input()))
mo = [[] for i in range(k)]
for i in range(n):
num = i % k
mo[num].append(T[i])
mo1 = copy.deepcopy(mo)
for i in range(k):
for j in range(len(mo[i])):
if mo[i][j] == "r":
... | import copy
n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
T = list(eval(input()))
for i in range(n - k):
if T[i] == T[i + k]:
T[i + k] = "x"
cr = T.count("r")
cp = T.count("p")
cs = T.count("s")
print((cp * s + cr * p + cs * r))
| false | 60.606061 | [
"-mo = [[] for i in range(k)]",
"-for i in range(n):",
"- num = i % k",
"- mo[num].append(T[i])",
"-mo1 = copy.deepcopy(mo)",
"-for i in range(k):",
"- for j in range(len(mo[i])):",
"- if mo[i][j] == \"r\":",
"- mo1[i][j] = \"p\"",
"- elif mo[i][j] == \"p\":",
"... | false | 0.045325 | 0.042514 | 1.066109 | [
"s908491664",
"s514738686"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.