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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u150984829 | p02240 | python | s892632596 | s271736211 | 630 | 520 | 23,904 | 23,896 | Accepted | Accepted | 17.46 | n,m=list(map(int,input().split()))
P=[[]for _ in[0]*n]
C=[0]*n
k=0
for _ in[0]*m:
s,t=list(map(int,input().split()));P[s]+=[t];P[t]+=[s]
for i in range(n):
k+=1
if C[i]<1:
s=[i];C[i]=k
while s:
u=s.pop()
for v in P[u]:
if C[v]<1:C[v]=k;s+=[v]
for _ in[0]*int(eval(input())):
a,b=list(map... | def s():
n,m=list(map(int,input().split()))
P=[[]for _ in[0]*n]
C=[0]*n
k=0
for _ in[0]*m:
s,t=list(map(int,input().split()));P[s]+=[t];P[t]+=[s]
for i in range(n):
k+=1
if C[i]<1:
s=[i];C[i]=k
while s:
u=s.pop()
for v in P[u]:
if C[v]<1:C[v]=k;s+=[v]
for _ in[0]*int(eval(... | 17 | 19 | 353 | 408 | n, m = list(map(int, input().split()))
P = [[] for _ in [0] * n]
C = [0] * n
k = 0
for _ in [0] * m:
s, t = list(map(int, input().split()))
P[s] += [t]
P[t] += [s]
for i in range(n):
k += 1
if C[i] < 1:
s = [i]
C[i] = k
while s:
u = s.pop()
for v in P[... | def s():
n, m = list(map(int, input().split()))
P = [[] for _ in [0] * n]
C = [0] * n
k = 0
for _ in [0] * m:
s, t = list(map(int, input().split()))
P[s] += [t]
P[t] += [s]
for i in range(n):
k += 1
if C[i] < 1:
s = [i]
C[i] = k
... | false | 10.526316 | [
"-n, m = list(map(int, input().split()))",
"-P = [[] for _ in [0] * n]",
"-C = [0] * n",
"-k = 0",
"-for _ in [0] * m:",
"- s, t = list(map(int, input().split()))",
"- P[s] += [t]",
"- P[t] += [s]",
"-for i in range(n):",
"- k += 1",
"- if C[i] < 1:",
"- s = [i]",
"- ... | false | 0.058041 | 0.038492 | 1.507871 | [
"s892632596",
"s271736211"
] |
u077291787 | p03647 | python | s757491257 | s726342129 | 249 | 143 | 18,884 | 46,660 | Accepted | Accepted | 42.57 | # ABC068C - Cat Snuke and a Voyage (ARC079C)
import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
s, d = set(), set() # start, destination
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
s.add(b) # 1 to X
... | # ABC068C - Cat Snuke and a Voyage (ARC079C)
def main():
N, M, *AB = list(map(int, open(0).read().split()))
from_1, to_N = set(), set()
for a, b in zip(*[iter(AB)] * 2):
if a == 1:
from_1.add(b)
if b == N:
to_N.add(a)
flg = from_1 & to_N # intermediate p... | 19 | 15 | 497 | 431 | # ABC068C - Cat Snuke and a Voyage (ARC079C)
import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().split()))
s, d = set(), set() # start, destination
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
s.add(b) # 1 to X
elif ... | # ABC068C - Cat Snuke and a Voyage (ARC079C)
def main():
N, M, *AB = list(map(int, open(0).read().split()))
from_1, to_N = set(), set()
for a, b in zip(*[iter(AB)] * 2):
if a == 1:
from_1.add(b)
if b == N:
to_N.add(a)
flg = from_1 & to_N # intermediate point of b... | false | 21.052632 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"- n, m = list(map(int, input().split()))",
"- s, d = set(), set() # start, destination",
"- for _ in range(m):",
"- a, b = list(map(int, input().split()))",
"+ N, M, *AB = list(map(int, open(0).read().split()))",
"... | false | 0.045857 | 0.044987 | 1.019342 | [
"s757491257",
"s726342129"
] |
u145231176 | p03329 | python | s505878202 | s306982031 | 316 | 276 | 70,088 | 88,928 | Accepted | Accepted | 12.66 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
from collections import d... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 47 | 89 | 1,003 | 2,130 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
from collections import def... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 47.191011 | [
"+def rand_N(ran1, ran2):",
"+ return random.randint(ran1, ran2)",
"+",
"+",
"+def rand_List(ran1, ran2, rantime):",
"+ return [random.randint(ran1, ran2) for i in range(rantime)]",
"+",
"+",
"+def rand_ints_nodup(ran1, ran2, rantime):",
"+ ns = []",
"+ while len(ns) < rantime:",
"... | false | 0.16692 | 0.15223 | 1.096498 | [
"s505878202",
"s306982031"
] |
u934442292 | p03037 | python | s219433983 | s822638220 | 366 | 117 | 10,868 | 10,868 | Accepted | Accepted | 68.03 | N, M = [int(i) for i in input().strip().split()]
L = [0] * M
R = [0] * M
for i in range(M):
L[i], R[i] = [int(i) for i in input().strip().split()]
LL, RR = L[0], R[0]
is_zero = False
for i in range(1, M):
if RR < L[i]:
is_zero = True
break
elif LL <= L[i] <= RR:
LL = ma... | import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
L = [None] * M
R = [None] * M
for i in range(M):
L[i], R[i] = list(map(int, input().split()))
L_max = max(L)
R_min = min(R)
if L_max > R_min:
print((0))
else:
... | 25 | 22 | 527 | 380 | N, M = [int(i) for i in input().strip().split()]
L = [0] * M
R = [0] * M
for i in range(M):
L[i], R[i] = [int(i) for i in input().strip().split()]
LL, RR = L[0], R[0]
is_zero = False
for i in range(1, M):
if RR < L[i]:
is_zero = True
break
elif LL <= L[i] <= RR:
LL = max(LL, L[i])
... | import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
L = [None] * M
R = [None] * M
for i in range(M):
L[i], R[i] = list(map(int, input().split()))
L_max = max(L)
R_min = min(R)
if L_max > R_min:
print((0))
else:
print((R_min ... | false | 12 | [
"-N, M = [int(i) for i in input().strip().split()]",
"-L = [0] * M",
"-R = [0] * M",
"-for i in range(M):",
"- L[i], R[i] = [int(i) for i in input().strip().split()]",
"-LL, RR = L[0], R[0]",
"-is_zero = False",
"-for i in range(1, M):",
"- if RR < L[i]:",
"- is_zero = True",
"- ... | false | 0.038294 | 0.035098 | 1.09106 | [
"s219433983",
"s822638220"
] |
u261103969 | p02675 | python | s306412570 | s527381656 | 64 | 23 | 61,640 | 9,104 | Accepted | Accepted | 64.06 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
n = eval(input())
c = n[-1]
if c in ["2", "4", "5", "7", "9"]:
print("hon")
elif c in ["0", "1", "6", "8"]:
print("pon")
else:
print("... | n = eval(input())
c = n[-1]
if c in ["3"]:
print("bon")
elif c in ["0", "1", "6", "8"]:
print("pon")
else:
print("hon") | 22 | 9 | 364 | 128 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
n = eval(input())
c = n[-1]
if c in ["2", "4", "5", "7", "9"]:
print("hon")
elif c in ["0", "1", "6", "8"]:
print("pon")
else:
print("bon")
if __name__ ==... | n = eval(input())
c = n[-1]
if c in ["3"]:
print("bon")
elif c in ["0", "1", "6", "8"]:
print("pon")
else:
print("hon")
| false | 59.090909 | [
"-import sys",
"-",
"-readline = sys.stdin.readline",
"-MOD = 10**9 + 7",
"-INF = float(\"INF\")",
"-sys.setrecursionlimit(10**5)",
"-",
"-",
"-def main():",
"- n = eval(input())",
"- c = n[-1]",
"- if c in [\"2\", \"4\", \"5\", \"7\", \"9\"]:",
"- print(\"hon\")",
"- el... | false | 0.053488 | 0.036003 | 1.485673 | [
"s306412570",
"s527381656"
] |
u572142121 | p02597 | python | s954481696 | s684193403 | 124 | 43 | 9,488 | 9,496 | Accepted | Accepted | 65.32 | N=int(eval(input()))
d=eval(input())
r=d.count('R')
w=N-r
ans=r
leftr,leftw,rightr,rightw=0,0,r,N-r
for i in range(N):
if d[i]=='R':
leftr+=1
rightr-=1
else:
leftw+=1
rightw-=1
if leftw==rightr:
f=rightr
elif leftw<rightr:
f=rightr
else:
f=leftw
ans=min(ans,f)
... | N=int(eval(input()))
s=eval(input())
r=s.count('R')
cnt=0
for i in range(r):
if s[i]=='W':
cnt+=1
print(cnt) | 21 | 8 | 319 | 109 | N = int(eval(input()))
d = eval(input())
r = d.count("R")
w = N - r
ans = r
leftr, leftw, rightr, rightw = 0, 0, r, N - r
for i in range(N):
if d[i] == "R":
leftr += 1
rightr -= 1
else:
leftw += 1
rightw -= 1
if leftw == rightr:
f = rightr
elif leftw < rightr:
... | N = int(eval(input()))
s = eval(input())
r = s.count("R")
cnt = 0
for i in range(r):
if s[i] == "W":
cnt += 1
print(cnt)
| false | 61.904762 | [
"-d = eval(input())",
"-r = d.count(\"R\")",
"-w = N - r",
"-ans = r",
"-leftr, leftw, rightr, rightw = 0, 0, r, N - r",
"-for i in range(N):",
"- if d[i] == \"R\":",
"- leftr += 1",
"- rightr -= 1",
"- else:",
"- leftw += 1",
"- rightw -= 1",
"- if leftw... | false | 0.041808 | 0.03665 | 1.140746 | [
"s954481696",
"s684193403"
] |
u729133443 | p02771 | python | s094067464 | s370234639 | 64 | 26 | 61,656 | 8,896 | Accepted | Accepted | 59.38 | print((len(set(eval(input())))%2*'Yes'or'No')) | print((len({*eval(input())})%2*'Yes'or'No')) | 1 | 1 | 38 | 36 | print((len(set(eval(input()))) % 2 * "Yes" or "No"))
| print((len({*eval(input())}) % 2 * "Yes" or "No"))
| false | 0 | [
"-print((len(set(eval(input()))) % 2 * \"Yes\" or \"No\"))",
"+print((len({*eval(input())}) % 2 * \"Yes\" or \"No\"))"
] | false | 0.039197 | 0.048179 | 0.81356 | [
"s094067464",
"s370234639"
] |
u334712262 | p02669 | python | s029316394 | s426408549 | 1,962 | 941 | 171,976 | 116,556 | Accepted | Accepted | 52.04 | # -*- coding: utf-8 -*-
# import bisect
# import heapq
# import math
# import random
# from collections import Counter, defaultdict, deque
# from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache
# from itertools import combinations, combinations_with_replacement, product, per... | # -*- coding: utf-8 -*-
from functools import lru_cache
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return... | 105 | 84 | 2,331 | 1,602 | # -*- coding: utf-8 -*-
# import bisect
# import heapq
# import math
# import random
# from collections import Counter, defaultdict, deque
# from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache
# from itertools import combinations, combinations_with_replacement, product, permutatio... | # -*- coding: utf-8 -*-
from functools import lru_cache
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, b... | false | 20 | [
"-# import bisect",
"-# import heapq",
"-# import math",
"-# import random",
"-# from collections import Counter, defaultdict, deque",
"-# from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal",
"-",
"-# from itertools import combinations, combinations_with_replacement, product, permutations",
"... | false | 2.737567 | 0.600875 | 4.555966 | [
"s029316394",
"s426408549"
] |
u729133443 | p03795 | python | s098498199 | s873590942 | 163 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.57 | n=int(eval(input()));print((n*800-n//15*200)) | n=int(eval(input()));print((int(40/3*(n*59+n%15)))) | 1 | 1 | 37 | 43 | n = int(eval(input()))
print((n * 800 - n // 15 * 200))
| n = int(eval(input()))
print((int(40 / 3 * (n * 59 + n % 15))))
| false | 0 | [
"-print((n * 800 - n // 15 * 200))",
"+print((int(40 / 3 * (n * 59 + n % 15))))"
] | false | 0.040361 | 0.04077 | 0.989966 | [
"s098498199",
"s873590942"
] |
u699089116 | p03831 | python | s661403326 | s099224354 | 241 | 93 | 63,000 | 85,292 | Accepted | Accepted | 61.41 | n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
dp = [float("INF") for _ in range(n)]
dp[0] = 0
for i in range(n-1):
dp[i+1] = min(dp[i] + (x[i+1] - x[i]) * a, dp[i] + b)
print((dp[-1])) | n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
fatigue = 0
for i in range(n-1):
fatigue += min((x[i+1] - x[i]) * a, b)
print(fatigue) | 10 | 8 | 224 | 171 | n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
dp = [float("INF") for _ in range(n)]
dp[0] = 0
for i in range(n - 1):
dp[i + 1] = min(dp[i] + (x[i + 1] - x[i]) * a, dp[i] + b)
print((dp[-1]))
| n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
fatigue = 0
for i in range(n - 1):
fatigue += min((x[i + 1] - x[i]) * a, b)
print(fatigue)
| false | 20 | [
"-dp = [float(\"INF\") for _ in range(n)]",
"-dp[0] = 0",
"+fatigue = 0",
"- dp[i + 1] = min(dp[i] + (x[i + 1] - x[i]) * a, dp[i] + b)",
"-print((dp[-1]))",
"+ fatigue += min((x[i + 1] - x[i]) * a, b)",
"+print(fatigue)"
] | false | 0.043185 | 0.035477 | 1.217283 | [
"s661403326",
"s099224354"
] |
u852690916 | p03387 | python | s921165869 | s540234388 | 176 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.34 | a,b,c=list(map(int, input().split()))
mx=max((a,b,c))
sm=sum((a,b,c))
d=mx*3-sm
print(((d+3)//2 if d&1 else d//2)) | A,B,C=list(map(int, input().split()))
S=max(A,B,C)*3
S+=3 if S&1!=(A+B+C)&1 else 0
print(((S-(A+B+C))//2)) | 5 | 4 | 110 | 101 | a, b, c = list(map(int, input().split()))
mx = max((a, b, c))
sm = sum((a, b, c))
d = mx * 3 - sm
print(((d + 3) // 2 if d & 1 else d // 2))
| A, B, C = list(map(int, input().split()))
S = max(A, B, C) * 3
S += 3 if S & 1 != (A + B + C) & 1 else 0
print(((S - (A + B + C)) // 2))
| false | 20 | [
"-a, b, c = list(map(int, input().split()))",
"-mx = max((a, b, c))",
"-sm = sum((a, b, c))",
"-d = mx * 3 - sm",
"-print(((d + 3) // 2 if d & 1 else d // 2))",
"+A, B, C = list(map(int, input().split()))",
"+S = max(A, B, C) * 3",
"+S += 3 if S & 1 != (A + B + C) & 1 else 0",
"+print(((S - (A + B +... | false | 0.043076 | 0.0383 | 1.124691 | [
"s921165869",
"s540234388"
] |
u096359533 | p03211 | python | s945906199 | s581995765 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | import math
S = eval(input())
thlist = [(753 - int(S[i:i+3]))**2 for i in range(len(S)-2)]
print((int(math.sqrt(min(thlist))))) | S = eval(input())
thlist = [abs(753 - int(S[i:i+3])) for i in range(len(S)-2)]
print((min(thlist))) | 4 | 3 | 122 | 93 | import math
S = eval(input())
thlist = [(753 - int(S[i : i + 3])) ** 2 for i in range(len(S) - 2)]
print((int(math.sqrt(min(thlist)))))
| S = eval(input())
thlist = [abs(753 - int(S[i : i + 3])) for i in range(len(S) - 2)]
print((min(thlist)))
| false | 25 | [
"-import math",
"-",
"-thlist = [(753 - int(S[i : i + 3])) ** 2 for i in range(len(S) - 2)]",
"-print((int(math.sqrt(min(thlist)))))",
"+thlist = [abs(753 - int(S[i : i + 3])) for i in range(len(S) - 2)]",
"+print((min(thlist)))"
] | false | 0.045257 | 0.044282 | 1.022026 | [
"s945906199",
"s581995765"
] |
u785578220 | p03163 | python | s144305477 | s682486749 | 704 | 359 | 171,268 | 61,040 | Accepted | Accepted | 49.01 | n,k = list(map(int,input().split()))
w=[]
v=[]
dp =[[0 for i in range(k+1)] for j in range(n+1)]
for i in range(n):
a,b = list(map(int,input().split()))
w.append(a)
v.append(b)
for i in range(n):
for sum_w in range(k+1):
if sum_w - w[i] >=0:
dp[i+1][sum_w]=max(dp[i][sum_... | N, W = list(map(int, input().split()))
a = []
for i in range(N):
x,y = list(map(int,input().split()))
a.append([x,y])
dp = [0]*(W+1)
max_weight = 0
for w, v in a:
max_w = min(max_weight, W-w)
for old_v, from_i in zip(dp[max_w::-1], list(range(max_w, -1, -1))):
if dp[from_i+w] < old_v... | 17 | 16 | 415 | 403 | n, k = list(map(int, input().split()))
w = []
v = []
dp = [[0 for i in range(k + 1)] for j in range(n + 1)]
for i in range(n):
a, b = list(map(int, input().split()))
w.append(a)
v.append(b)
for i in range(n):
for sum_w in range(k + 1):
if sum_w - w[i] >= 0:
dp[i + 1][sum_w] = max(dp[... | N, W = list(map(int, input().split()))
a = []
for i in range(N):
x, y = list(map(int, input().split()))
a.append([x, y])
dp = [0] * (W + 1)
max_weight = 0
for w, v in a:
max_w = min(max_weight, W - w)
for old_v, from_i in zip(dp[max_w::-1], list(range(max_w, -1, -1))):
if dp[from_i + w] < old_v ... | false | 5.882353 | [
"-n, k = list(map(int, input().split()))",
"-w = []",
"-v = []",
"-dp = [[0 for i in range(k + 1)] for j in range(n + 1)]",
"-for i in range(n):",
"- a, b = list(map(int, input().split()))",
"- w.append(a)",
"- v.append(b)",
"-for i in range(n):",
"- for sum_w in range(k + 1):",
"- ... | false | 0.087753 | 0.040902 | 2.145425 | [
"s144305477",
"s682486749"
] |
u747602774 | p03806 | python | s836525105 | s353190801 | 495 | 306 | 98,780 | 44,908 | Accepted | Accepted | 38.18 | N,Ma,Mb = list(map(int,input().split()))
INF = 10000
dp = [[[INF for b in range(401)] for a in range(401)] for i in range(N+1)]
dp[0][0][0] = 0
for i in range(1,N+1):
ai,bi,ci = list(map(int,input().split()))
for a in range(401):
for b in range(401):
if a-ai >= 0 and b-bi >= ... | N,Ma,Mb = list(map(int,input().split()))
INF = 10000
dp = [[INF for b in range(401)] for a in range(401)]
dp[0][0] = 0
for i in range(1,N+1):
ai,bi,ci = list(map(int,input().split()))
for a in range(400,-1,-1):
for b in range(400,-1,-1):
if a-ai >= 0 and b-bi >= 0:
... | 24 | 22 | 610 | 515 | N, Ma, Mb = list(map(int, input().split()))
INF = 10000
dp = [[[INF for b in range(401)] for a in range(401)] for i in range(N + 1)]
dp[0][0][0] = 0
for i in range(1, N + 1):
ai, bi, ci = list(map(int, input().split()))
for a in range(401):
for b in range(401):
if a - ai >= 0 and b - bi >= 0... | N, Ma, Mb = list(map(int, input().split()))
INF = 10000
dp = [[INF for b in range(401)] for a in range(401)]
dp[0][0] = 0
for i in range(1, N + 1):
ai, bi, ci = list(map(int, input().split()))
for a in range(400, -1, -1):
for b in range(400, -1, -1):
if a - ai >= 0 and b - bi >= 0:
... | false | 8.333333 | [
"-dp = [[[INF for b in range(401)] for a in range(401)] for i in range(N + 1)]",
"-dp[0][0][0] = 0",
"+dp = [[INF for b in range(401)] for a in range(401)]",
"+dp[0][0] = 0",
"- for a in range(401):",
"- for b in range(401):",
"+ for a in range(400, -1, -1):",
"+ for b in range(400... | false | 0.686782 | 0.331027 | 2.074701 | [
"s836525105",
"s353190801"
] |
u657994700 | p03261 | python | s541183644 | s795197236 | 19 | 17 | 3,064 | 3,060 | Accepted | Accepted | 10.53 | N = int(eval(input()))
W = []
for i in range(0,N):
W.append(eval(input()))
result = 'Yes'
for i,w in enumerate(W):
if i>0 and W[i-1][-1] != W[i][0]:
result = 'No'
Wset = set(W)
if len(W) != len(Wset):
result = 'No'
print(result) | # PROXY
N = int(eval(input()))
list = [eval(input()) for i in range(N)]
def has_duplicates(seq):
return len(seq) != len(set(seq))
if has_duplicates(list):
print("No")
else:
i = 1
while i < N:
if list[i-1][-1] != list[i][0]:
print("No")
break
els... | 17 | 18 | 265 | 363 | N = int(eval(input()))
W = []
for i in range(0, N):
W.append(eval(input()))
result = "Yes"
for i, w in enumerate(W):
if i > 0 and W[i - 1][-1] != W[i][0]:
result = "No"
Wset = set(W)
if len(W) != len(Wset):
result = "No"
print(result)
| # PROXY
N = int(eval(input()))
list = [eval(input()) for i in range(N)]
def has_duplicates(seq):
return len(seq) != len(set(seq))
if has_duplicates(list):
print("No")
else:
i = 1
while i < N:
if list[i - 1][-1] != list[i][0]:
print("No")
break
else:
... | false | 5.555556 | [
"+# PROXY",
"-W = []",
"-for i in range(0, N):",
"- W.append(eval(input()))",
"-result = \"Yes\"",
"-for i, w in enumerate(W):",
"- if i > 0 and W[i - 1][-1] != W[i][0]:",
"- result = \"No\"",
"-Wset = set(W)",
"-if len(W) != len(Wset):",
"- result = \"No\"",
"-print(result)",
... | false | 0.042163 | 0.041214 | 1.023044 | [
"s541183644",
"s795197236"
] |
u094191970 | p02678 | python | s401541694 | s840906965 | 722 | 538 | 35,516 | 34,732 | Accepted | Accepted | 25.48 | from collections import deque
n,m=list(map(int,input().split()))
tree=[[] for i in range(n)]
for i in range(m):
a,b=list(map(int,input().split()))
a-=1
b-=1
tree[a].append(b)
tree[b].append(a)
dist=[-1 for i in range(n)]
dist[0]=0
ans=[-1 for i in range(n)]
ans[0]=0
dq=deque()
dq.appen... | from collections import deque
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
n,m=nii()
tree=[[] for i in range(n)]
for i in range(m):
a,b=nii()
a-=1
b-=1
tree[a].append(b)
tree[b].append(a)
ans=[-1 for i in range(n)]
ans[0]=0
dq=deque()
dq.append(0)
while dq:
... | 34 | 29 | 509 | 456 | from collections import deque
n, m = list(map(int, input().split()))
tree = [[] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
tree[a].append(b)
tree[b].append(a)
dist = [-1 for i in range(n)]
dist[0] = 0
ans = [-1 for i in range(n)]
ans[0] = 0
dq = deque... | from collections import deque
from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
n, m = nii()
tree = [[] for i in range(n)]
for i in range(m):
a, b = nii()
a -= 1
b -= 1
tree[a].append(b)
tree[b].append(a)
ans = [-1 for i in range(n)]
ans[0] = 0
dq = deque()
dq.append(0)
w... | false | 14.705882 | [
"+from sys import stdin",
"-n, m = list(map(int, input().split()))",
"+nii = lambda: list(map(int, stdin.readline().split()))",
"+n, m = nii()",
"- a, b = list(map(int, input().split()))",
"+ a, b = nii()",
"-dist = [-1 for i in range(n)]",
"-dist[0] = 0",
"-if -1 in ans:",
"- print(\"No\... | false | 0.037889 | 0.037682 | 1.005491 | [
"s401541694",
"s840906965"
] |
u597374218 | p02713 | python | s408470856 | s594384497 | 1,769 | 215 | 9,152 | 89,652 | Accepted | Accepted | 87.85 | import math
K=int(eval(input()))
print((sum(math.gcd(math.gcd(a,b),c) for a in range(1,K+1) for b in range(1,K+1) for c in range(1,K+1)))) | import numpy as np
K=int(eval(input()))
k=np.arange(1,K+1)
print((np.sum(np.gcd.outer(np.gcd.outer(k,k),k)))) | 3 | 4 | 132 | 104 | import math
K = int(eval(input()))
print(
(
sum(
math.gcd(math.gcd(a, b), c)
for a in range(1, K + 1)
for b in range(1, K + 1)
for c in range(1, K + 1)
)
)
)
| import numpy as np
K = int(eval(input()))
k = np.arange(1, K + 1)
print((np.sum(np.gcd.outer(np.gcd.outer(k, k), k))))
| false | 25 | [
"-import math",
"+import numpy as np",
"-print(",
"- (",
"- sum(",
"- math.gcd(math.gcd(a, b), c)",
"- for a in range(1, K + 1)",
"- for b in range(1, K + 1)",
"- for c in range(1, K + 1)",
"- )",
"- )",
"-)",
"+k = np.arange(1,... | false | 0.059571 | 0.410492 | 0.14512 | [
"s408470856",
"s594384497"
] |
u102461423 | p03092 | python | s845868073 | s074938538 | 1,704 | 1,512 | 14,536 | 14,536 | Accepted | Accepted | 11.27 | import numpy as np
N,A,B,*P=list(map(int,open(0).read().split()))
dp=np.full(N+1,10**18,np.int64)
dp[0]=0
for p in P:
dp[p]=min(dp[:p])
dp[p+1:]+=B
dp[:p]+=A
print((min(dp))) | from numpy import *
N,A,B,*P=list(map(int,open(0).read().split()));d=full(N+1,1<<60,'int');d[0]=0
for p in P:d[p]=min(d[:p]);d[p+1:]+=B;d[:p]+=A
print((min(d))) | 9 | 4 | 186 | 155 | import numpy as np
N, A, B, *P = list(map(int, open(0).read().split()))
dp = np.full(N + 1, 10**18, np.int64)
dp[0] = 0
for p in P:
dp[p] = min(dp[:p])
dp[p + 1 :] += B
dp[:p] += A
print((min(dp)))
| from numpy import *
N, A, B, *P = list(map(int, open(0).read().split()))
d = full(N + 1, 1 << 60, "int")
d[0] = 0
for p in P:
d[p] = min(d[:p])
d[p + 1 :] += B
d[:p] += A
print((min(d)))
| false | 55.555556 | [
"-import numpy as np",
"+from numpy import *",
"-dp = np.full(N + 1, 10**18, np.int64)",
"-dp[0] = 0",
"+d = full(N + 1, 1 << 60, \"int\")",
"+d[0] = 0",
"- dp[p] = min(dp[:p])",
"- dp[p + 1 :] += B",
"- dp[:p] += A",
"-print((min(dp)))",
"+ d[p] = min(d[:p])",
"+ d[p + 1 :] += ... | false | 0.553135 | 0.337761 | 1.637652 | [
"s845868073",
"s074938538"
] |
u017624958 | p03240 | python | s349099224 | s655578832 | 127 | 117 | 3,064 | 3,064 | Accepted | Accepted | 7.87 | N = int(eval(input()))
xyh = [list(map(int, input().split())) for i in range(N)]
# print(N, xyh)
height = None
found = False
for cx in range(0, 101):
for cy in range(0, 101):
candidate = 0
for x, y, h in xyh:
if h == 0: continue
dx = abs(x - cx)
dy = ... | N = int(eval(input()))
xyh = [list(map(int, input().split())) for i in range(N)]
# print(N, xyh)
height = None
found = False
for cx in range(0, 101):
for cy in range(0, 101):
candidate = 0
for x, y, h in xyh:
if h == 0: continue
dx = abs(x - cx)
dy = ... | 29 | 28 | 769 | 728 | N = int(eval(input()))
xyh = [list(map(int, input().split())) for i in range(N)]
# print(N, xyh)
height = None
found = False
for cx in range(0, 101):
for cy in range(0, 101):
candidate = 0
for x, y, h in xyh:
if h == 0:
continue
dx = abs(x - cx)
dy... | N = int(eval(input()))
xyh = [list(map(int, input().split())) for i in range(N)]
# print(N, xyh)
height = None
found = False
for cx in range(0, 101):
for cy in range(0, 101):
candidate = 0
for x, y, h in xyh:
if h == 0:
continue
dx = abs(x - cx)
dy... | false | 3.448276 | [
"- _h = candidate - abs(x - cx) - abs(y - cy)",
"- if h == 0 and _h <= 0:",
"- continue",
"- if not h == _h:",
"+ _h = max(candidate - abs(x - cx) - abs(y - cy), 0)",
"+ if h != _h:"
] | false | 0.094444 | 0.043339 | 2.179209 | [
"s349099224",
"s655578832"
] |
u912862653 | p02573 | python | s541706027 | s295801762 | 772 | 458 | 250,308 | 80,380 | Accepted | Accepted | 40.67 | from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
INF = float("inf")
def dfs(G, visited, v, cnt):
visited[v] = True
for nv in G[v]:
if visited[nv]:
continu... | from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
INF = float("inf")
# 1-indexed
class UnionFind():
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n ... | 56 | 78 | 1,037 | 1,861 | from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
INF = float("inf")
def dfs(G, visited, v, cnt):
visited[v] = True
for nv in G[v]:
if visited[nv]:
continue
cnt = ... | from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
INF = float("inf")
# 1-indexed
class UnionFind:
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[... | false | 28.205128 | [
"+# 1-indexed",
"+class UnionFind:",
"+ # 作りたい要素数nで初期化",
"+ # 使用するインスタンス変数の初期化",
"+ def __init__(self, n):",
"+ self.n = n",
"+ # root[x]<0ならそのノードが根かつその値が木の要素数",
"+ # rootノードでその木の要素数を記録する",
"+ self.root = [-1] * (n + 1)",
"+ # 木をくっつける時にアンバランスにならないように調整する... | false | 0.082541 | 0.062051 | 1.330227 | [
"s541706027",
"s295801762"
] |
u426534722 | p02257 | python | s385010368 | s249043062 | 300 | 190 | 5,648 | 5,760 | Accepted | Accepted | 36.67 | import sys
readline = sys.stdin.readline
prime = set([2])
for i in range(3, 10000, 2):
for j in prime:
if i % j == 0:
break
else:
prime.add(i)
n = int(eval(input()))
cnt = 0
for i in (int(readline()) for _ in range(n)):
if i in prime:
cnt += 1
contin... | from sys import stdin
import math
def isPrime(x):
if x == 2 or x == 3: return True
elif (x < 2 or x % 2 == 0 or x % 3 == 0): return False
s = int(math.sqrt(x) + 1)
for i in range(5, s + 1, 2):
if x % i == 0: return False
return True
print((sum([isPrime(int(stdin.readline())) for _ i... | 22 | 11 | 424 | 355 | import sys
readline = sys.stdin.readline
prime = set([2])
for i in range(3, 10000, 2):
for j in prime:
if i % j == 0:
break
else:
prime.add(i)
n = int(eval(input()))
cnt = 0
for i in (int(readline()) for _ in range(n)):
if i in prime:
cnt += 1
continue
for j ... | from sys import stdin
import math
def isPrime(x):
if x == 2 or x == 3:
return True
elif x < 2 or x % 2 == 0 or x % 3 == 0:
return False
s = int(math.sqrt(x) + 1)
for i in range(5, s + 1, 2):
if x % i == 0:
return False
return True
print((sum([isPrime(int(stdin... | false | 50 | [
"-import sys",
"+from sys import stdin",
"+import math",
"-readline = sys.stdin.readline",
"-prime = set([2])",
"-for i in range(3, 10000, 2):",
"- for j in prime:",
"- if i % j == 0:",
"- break",
"- else:",
"- prime.add(i)",
"-n = int(eval(input()))",
"-cnt = ... | false | 0.179171 | 0.040643 | 4.408393 | [
"s385010368",
"s249043062"
] |
u930705402 | p02714 | python | s357985588 | s135837224 | 1,939 | 423 | 75,940 | 68,168 | Accepted | Accepted | 78.18 | import bisect
import sys
input=sys.stdin.readline
def main():
N=int(eval(input()))
S=input().rstrip()
R,G,B=[],[],[]
for i in range(N):
if S[i]=='R':
R.append(i)
elif S[i]=='G':
G.append(i)
elif S[i]=='B':
B.append(i)
ans=0
... | N=int(eval(input()))
S=eval(input())
R,G,B=0,0,0
for i in range(N):
if(S[i]=='R'):
R+=1
elif(S[i]=='G'):
G+=1
else:
B+=1
res=R*G*B
cnt=0
for i in range(N):
lr=0
while(i-lr>=0 and i+lr<N):
s=set([S[i],S[i-lr],S[i+lr]])
if(len(s)==3):
... | 41 | 20 | 1,170 | 343 | import bisect
import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
S = input().rstrip()
R, G, B = [], [], []
for i in range(N):
if S[i] == "R":
R.append(i)
elif S[i] == "G":
G.append(i)
elif S[i] == "B":
B.append(i)
a... | N = int(eval(input()))
S = eval(input())
R, G, B = 0, 0, 0
for i in range(N):
if S[i] == "R":
R += 1
elif S[i] == "G":
G += 1
else:
B += 1
res = R * G * B
cnt = 0
for i in range(N):
lr = 0
while i - lr >= 0 and i + lr < N:
s = set([S[i], S[i - lr], S[i + lr]])
... | false | 51.219512 | [
"-import bisect",
"-import sys",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"-def main():",
"- N = int(eval(input()))",
"- S = input().rstrip()",
"- R, G, B = [], [], []",
"- for i in range(N):",
"- if S[i] == \"R\":",
"- R.append(i)",
"- elif S[i] =... | false | 0.038602 | 0.083412 | 0.462791 | [
"s357985588",
"s135837224"
] |
u332906195 | p02707 | python | s729844809 | s606762717 | 214 | 146 | 48,788 | 33,936 | Accepted | Accepted | 31.78 | N = int(eval(input()))
ans = {i + 1: 0 for i in range(N)}
for a in list(map(int, input().split())):
ans[a] += 1
for i in range(N):
print((ans[i + 1]))
| N = int(eval(input()))
ans = [0] * N
for a in list(map(int, input().split())):
ans[a - 1] += 1
for a in ans:
print(a)
| 7 | 6 | 158 | 125 | N = int(eval(input()))
ans = {i + 1: 0 for i in range(N)}
for a in list(map(int, input().split())):
ans[a] += 1
for i in range(N):
print((ans[i + 1]))
| N = int(eval(input()))
ans = [0] * N
for a in list(map(int, input().split())):
ans[a - 1] += 1
for a in ans:
print(a)
| false | 14.285714 | [
"-ans = {i + 1: 0 for i in range(N)}",
"+ans = [0] * N",
"- ans[a] += 1",
"-for i in range(N):",
"- print((ans[i + 1]))",
"+ ans[a - 1] += 1",
"+for a in ans:",
"+ print(a)"
] | false | 0.034408 | 0.037602 | 0.91506 | [
"s729844809",
"s606762717"
] |
u867069435 | p03721 | python | s736175396 | s978128125 | 531 | 364 | 27,872 | 14,940 | Accepted | Accepted | 31.45 | n, k = list(map(int, input().split()))
num = []
for i in range(n):
num.append(list(map(int, input().split())))
num.sort()
summ = 0
for i in range(len(num)):
if k <= summ + num[i][1]:
print((num[i][0]))
exit()
else:
summ += num[i][1] | from collections import defaultdict
n, k = list(map(int, input().split()))
s = defaultdict(int)
for j in range(n):
i, v = list(map(int, input().split()))
s[i] += v
f = sorted(s.items())
tmp = 0
for g in f:
tmp += g[1]
if tmp >= k:
print((g[0]))
exit()
| 12 | 13 | 271 | 282 | n, k = list(map(int, input().split()))
num = []
for i in range(n):
num.append(list(map(int, input().split())))
num.sort()
summ = 0
for i in range(len(num)):
if k <= summ + num[i][1]:
print((num[i][0]))
exit()
else:
summ += num[i][1]
| from collections import defaultdict
n, k = list(map(int, input().split()))
s = defaultdict(int)
for j in range(n):
i, v = list(map(int, input().split()))
s[i] += v
f = sorted(s.items())
tmp = 0
for g in f:
tmp += g[1]
if tmp >= k:
print((g[0]))
exit()
| false | 7.692308 | [
"+from collections import defaultdict",
"+",
"-num = []",
"-for i in range(n):",
"- num.append(list(map(int, input().split())))",
"-num.sort()",
"-summ = 0",
"-for i in range(len(num)):",
"- if k <= summ + num[i][1]:",
"- print((num[i][0]))",
"+s = defaultdict(int)",
"+for j in ra... | false | 0.041308 | 0.037387 | 1.10487 | [
"s736175396",
"s978128125"
] |
u912237403 | p02412 | python | s913795988 | s633291203 | 350 | 280 | 4,228 | 4,228 | Accepted | Accepted | 20 | while True:
n,x = list(map(int, input().split()))
if n == 0 and x == 0: break
c = 0
for i in range(1, n+1):
for j in range(i+1, n+1):
ij = i + j
for k in range(j+1, n+1):
if ij+k == x:
c += 1
print(c) | while True:
n,x = list(map(int, input().split()))
if n == 0 and x == 0: break
c = 0
for i in range(1, min(n+1,x/3)):
for j in range(i+1, min(n+1,x/2)):
for k in range(j+1, n+1):
ijk = i + j + k
if ijk == x:
c += 1
... | 11 | 13 | 299 | 389 | while True:
n, x = list(map(int, input().split()))
if n == 0 and x == 0:
break
c = 0
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
ij = i + j
for k in range(j + 1, n + 1):
if ij + k == x:
c += 1
print(c)
| while True:
n, x = list(map(int, input().split()))
if n == 0 and x == 0:
break
c = 0
for i in range(1, min(n + 1, x / 3)):
for j in range(i + 1, min(n + 1, x / 2)):
for k in range(j + 1, n + 1):
ijk = i + j + k
if ijk == x:
... | false | 15.384615 | [
"- for i in range(1, n + 1):",
"- for j in range(i + 1, n + 1):",
"- ij = i + j",
"+ for i in range(1, min(n + 1, x / 3)):",
"+ for j in range(i + 1, min(n + 1, x / 2)):",
"- if ij + k == x:",
"+ ijk = i + j + k",
"+ if ijk ==... | false | 0.044317 | 0.044284 | 1.00076 | [
"s913795988",
"s633291203"
] |
u312025627 | p03470 | python | s272147077 | s100512005 | 181 | 162 | 38,256 | 38,256 | Accepted | Accepted | 10.5 | n = int(eval(input()))
d = [int(eval(input())) for i in range(n)]
cnt = 0
value_before = 0
for i in range(n):
value = max(d)
if i == 0:
value_before = value
d.remove(value)
cnt += 1
continue
if value_before > value:
value_before = value
cnt += 1... | def main():
N = int(eval(input()))
d = {int(eval(input())) for _ in range(N)}
print((len(d)))
if __name__ == '__main__':
main()
| 18 | 8 | 343 | 139 | n = int(eval(input()))
d = [int(eval(input())) for i in range(n)]
cnt = 0
value_before = 0
for i in range(n):
value = max(d)
if i == 0:
value_before = value
d.remove(value)
cnt += 1
continue
if value_before > value:
value_before = value
cnt += 1
d.remove(v... | def main():
N = int(eval(input()))
d = {int(eval(input())) for _ in range(N)}
print((len(d)))
if __name__ == "__main__":
main()
| false | 55.555556 | [
"-n = int(eval(input()))",
"-d = [int(eval(input())) for i in range(n)]",
"-cnt = 0",
"-value_before = 0",
"-for i in range(n):",
"- value = max(d)",
"- if i == 0:",
"- value_before = value",
"- d.remove(value)",
"- cnt += 1",
"- continue",
"- if value_befo... | false | 0.048176 | 0.047527 | 1.013642 | [
"s272147077",
"s100512005"
] |
u844005364 | p03854 | python | s090838608 | s314029693 | 25 | 19 | 9,588 | 3,188 | Accepted | Accepted | 24 | import re
print(("YES" if re.match("^(eraser?|dream(er)?)*$",eval(input())) else "NO")) | s = eval(input())
if s.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream",""):
print("NO")
else:
print("YES") | 2 | 5 | 80 | 143 | import re
print(("YES" if re.match("^(eraser?|dream(er)?)*$", eval(input())) else "NO"))
| s = eval(input())
if (
s.replace("eraser", "")
.replace("erase", "")
.replace("dreamer", "")
.replace("dream", "")
):
print("NO")
else:
print("YES")
| false | 60 | [
"-import re",
"-",
"-print((\"YES\" if re.match(\"^(eraser?|dream(er)?)*$\", eval(input())) else \"NO\"))",
"+s = eval(input())",
"+if (",
"+ s.replace(\"eraser\", \"\")",
"+ .replace(\"erase\", \"\")",
"+ .replace(\"dreamer\", \"\")",
"+ .replace(\"dream\", \"\")",
"+):",
"+ prin... | false | 0.037042 | 0.081097 | 0.456767 | [
"s090838608",
"s314029693"
] |
u928784113 | p04001 | python | s632448066 | s112065325 | 309 | 168 | 65,900 | 13,640 | Accepted | Accepted | 45.63 | import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import ... | import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import s... | 80 | 81 | 2,161 | 2,201 | import itertools
from collections import deque, defaultdict, Counter
from itertools import accumulate
import bisect
from heapq import heappop, heappush, heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
# import numpy as np
# import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
... | import itertools
from collections import deque, defaultdict, Counter
from itertools import accumulate
import bisect
from heapq import heappop, heappush, heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
# import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sy... | false | 1.234568 | [
"+import numpy as np",
"-# import numpy as np",
"+ anslist = [sl[0]]",
"- anslist = [sl[0]]",
"- anslist.append(\"+\" + sl[j + 1])",
"+ anslist.append(\"+\")",
"+ anslist.append(sl[j + 1])",
"+ sublist = [-1] * n",
"- sublist = [-1] * ... | false | 0.050135 | 0.039724 | 1.262073 | [
"s632448066",
"s112065325"
] |
u952708174 | p03625 | python | s856631734 | s530246848 | 191 | 87 | 22,920 | 18,316 | Accepted | Accepted | 54.45 | def C_Make_a_Rectangle(lst):
N = lst[0]
A = lst[1:]
from collections import Counter, deque
c = sorted(list(Counter(A).items()), reverse=True) # リストの要素が何回現れたか
# cの0番要素は値、1番要素は度数
ans = deque([])
for k, v in c:
if v == 1:
continue
elif v == 2 or v == 3... | def c_make_a_rectangle(N, A):
from collections import Counter
count = Counter(A) # リストの要素が何回現れたか
cond = [] # 同じ長さのものが2個ある棒の長さ
for k, v in list(count.items()):
if v == 1: # 1個しかない棒では長方形を作れない
continue
else:
cond.extend([k] * (v // 2))
if len(cond) ... | 30 | 19 | 671 | 538 | def C_Make_a_Rectangle(lst):
N = lst[0]
A = lst[1:]
from collections import Counter, deque
c = sorted(list(Counter(A).items()), reverse=True) # リストの要素が何回現れたか
# cの0番要素は値、1番要素は度数
ans = deque([])
for k, v in c:
if v == 1:
continue
elif v == 2 or v == 3:
... | def c_make_a_rectangle(N, A):
from collections import Counter
count = Counter(A) # リストの要素が何回現れたか
cond = [] # 同じ長さのものが2個ある棒の長さ
for k, v in list(count.items()):
if v == 1: # 1個しかない棒では長方形を作れない
continue
else:
cond.extend([k] * (v // 2))
if len(cond) <= 1:
... | false | 36.666667 | [
"-def C_Make_a_Rectangle(lst):",
"- N = lst[0]",
"- A = lst[1:]",
"- from collections import Counter, deque",
"+def c_make_a_rectangle(N, A):",
"+ from collections import Counter",
"- c = sorted(list(Counter(A).items()), reverse=True) # リストの要素が何回現れたか",
"- # cの0番要素は値、1番要素は度数",
"- ... | false | 0.04617 | 0.04166 | 1.108242 | [
"s856631734",
"s530246848"
] |
u591295155 | p03417 | python | s523327902 | s047731773 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | N, M = list(map(int, input().split()))
print((abs(N-2)*abs(M-2))) | N,M= list(map(int,input().split()))
print((abs((N-2)*(M-2)))) | 2 | 2 | 58 | 54 | N, M = list(map(int, input().split()))
print((abs(N - 2) * abs(M - 2)))
| N, M = list(map(int, input().split()))
print((abs((N - 2) * (M - 2))))
| false | 0 | [
"-print((abs(N - 2) * abs(M - 2)))",
"+print((abs((N - 2) * (M - 2))))"
] | false | 0.038356 | 0.085265 | 0.449843 | [
"s523327902",
"s047731773"
] |
u893063840 | p02697 | python | s309131214 | s593192078 | 95 | 76 | 9,284 | 9,228 | Accepted | Accepted | 20 | n, m = list(map(int, input().split()))
l = m // 2 * 2 + 1
for i in range(1, l + 1):
if i < l - i + 1:
print((i, l - i + 1))
r = (m + 1) // 2 * 2 + l
for i in range(l + 1, r + 1):
if i < r - i + l + 1:
print((i, r - i + l + 1))
| n, m = list(map(int, input().split()))
odd = (m + 1) // 2
even = m - odd
l = 1
r = 2 * odd
while l < r:
print((l, r))
l += 1
r -= 1
l = n - 2 * even
r = n
while l < r:
print((l, r))
l += 1
r -= 1
| 11 | 18 | 253 | 230 | n, m = list(map(int, input().split()))
l = m // 2 * 2 + 1
for i in range(1, l + 1):
if i < l - i + 1:
print((i, l - i + 1))
r = (m + 1) // 2 * 2 + l
for i in range(l + 1, r + 1):
if i < r - i + l + 1:
print((i, r - i + l + 1))
| n, m = list(map(int, input().split()))
odd = (m + 1) // 2
even = m - odd
l = 1
r = 2 * odd
while l < r:
print((l, r))
l += 1
r -= 1
l = n - 2 * even
r = n
while l < r:
print((l, r))
l += 1
r -= 1
| false | 38.888889 | [
"-l = m // 2 * 2 + 1",
"-for i in range(1, l + 1):",
"- if i < l - i + 1:",
"- print((i, l - i + 1))",
"-r = (m + 1) // 2 * 2 + l",
"-for i in range(l + 1, r + 1):",
"- if i < r - i + l + 1:",
"- print((i, r - i + l + 1))",
"+odd = (m + 1) // 2",
"+even = m - odd",
"+l = 1",
... | false | 0.042642 | 0.04447 | 0.9589 | [
"s309131214",
"s593192078"
] |
u813098295 | p03475 | python | s175874171 | s074170946 | 128 | 90 | 2,692 | 2,692 | Accepted | Accepted | 29.69 | # coding: utf-8
import math
N = int(input())
CSF = [list(map(float, input().split())) for _ in range(N-1)]
for i in range(N-1):
ans = CSF[i][0] + CSF[i][1]
for j in range(i+1, N-1):
s, t, u = CSF[j][0], CSF[j][1], CSF[j][2]
if t < ans:
n = int(math.ceil((ans - t) / u))
... | import math
N = int(input())
CSF = [list(map(float, input().split())) for _ in range(N-1)]
for i in range(N-1):
ans = CSF[i][0] + CSF[i][1]
for j in range(i+1, N-1):
C, S, F = CSF[j][0], CSF[j][1], CSF[j][2]
if S < ans:
n = math.ceil((ans - S) / F)
ans = C + ... | 19 | 18 | 431 | 405 | # coding: utf-8
import math
N = int(input())
CSF = [list(map(float, input().split())) for _ in range(N - 1)]
for i in range(N - 1):
ans = CSF[i][0] + CSF[i][1]
for j in range(i + 1, N - 1):
s, t, u = CSF[j][0], CSF[j][1], CSF[j][2]
if t < ans:
n = int(math.ceil((ans - t) / u))
... | import math
N = int(input())
CSF = [list(map(float, input().split())) for _ in range(N - 1)]
for i in range(N - 1):
ans = CSF[i][0] + CSF[i][1]
for j in range(i + 1, N - 1):
C, S, F = CSF[j][0], CSF[j][1], CSF[j][2]
if S < ans:
n = math.ceil((ans - S) / F)
ans = C + S + ... | false | 5.263158 | [
"-# coding: utf-8",
"- s, t, u = CSF[j][0], CSF[j][1], CSF[j][2]",
"- if t < ans:",
"- n = int(math.ceil((ans - t) / u))",
"- ans = int(s + t + u * n)",
"+ C, S, F = CSF[j][0], CSF[j][1], CSF[j][2]",
"+ if S < ans:",
"+ n = math.ceil((ans - ... | false | 0.050459 | 0.038352 | 1.315683 | [
"s175874171",
"s074170946"
] |
u196746947 | p02727 | python | s578143325 | s085189629 | 1,842 | 262 | 23,328 | 23,328 | Accepted | Accepted | 85.78 | x,y,a,b,c=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)
A.sort()
B.sort()
C.sort(reverse=True)
A=A[a-x:]
B=B[b-y:]
i=0
j=0
k=0
lea=len(A)
leb=len(B)
while(True):
if len(C)<1:
break
... | x,y,a,b,c=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)
A.sort()
B.sort()
A=A[a-x:]
B=B[b-y:]
D=A+B+C
D.sort(reverse=True)
sum=0
for i in range(x+y):
sum+=D[i]
print(sum)
| 57 | 16 | 1,057 | 290 | x, y, a, b, c = 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)
A.sort()
B.sort()
C.sort(reverse=True)
A = A[a - x :]
B = B[b - y :]
i = 0
j = 0
k = 0
lea = len(A)
leb = len(B)
while True:
if len(C) < 1:... | x, y, a, b, c = 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)
A.sort()
B.sort()
A = A[a - x :]
B = B[b - y :]
D = A + B + C
D.sort(reverse=True)
sum = 0
for i in range(x + y):
sum += D[i]
print(sum)
| false | 71.929825 | [
"-C.sort(reverse=True)",
"-i = 0",
"-j = 0",
"-k = 0",
"-lea = len(A)",
"-leb = len(B)",
"-while True:",
"- if len(C) < 1:",
"- break",
"- if i < lea and j < leb:",
"- if A[i] > B[j]:",
"- if B[j] < C[0]:",
"- B[j] = C.pop(0)",
"- ... | false | 0.053941 | 0.034815 | 1.549348 | [
"s578143325",
"s085189629"
] |
u211160392 | p03013 | python | s282539367 | s500831686 | 657 | 230 | 460,020 | 7,668 | Accepted | Accepted | 64.99 | N,M = list(map(int,input().split()))
a = list(int(eval(input()))for i in range(M))
a= [-1]+a+[N+1]
r = []
for i in range(M+1):
r.append(a[i+1]-a[i]-1)
fi = [0,1,1]
for i in range(max(r)):
fi.append(fi[-1]+fi[-2])
ans = 1
for i in r:
ans = (ans*fi[i])%(10**9+7)
print(ans) | MOD = 10**9+7
N,M = list(map(int,input().split()))
DP = [0]*(N+3)
DP[0] = 1
state = [1]*(N+3)
for _ in range(M):
i = int(eval(input()))
state[i] = 0
for i in range(N):
for j in range(1,3):
if state[j+i]:
DP[j+i] += DP[i]
DP[j+i] %= MOD
print((DP[N]))
| 13 | 16 | 283 | 298 | N, M = list(map(int, input().split()))
a = list(int(eval(input())) for i in range(M))
a = [-1] + a + [N + 1]
r = []
for i in range(M + 1):
r.append(a[i + 1] - a[i] - 1)
fi = [0, 1, 1]
for i in range(max(r)):
fi.append(fi[-1] + fi[-2])
ans = 1
for i in r:
ans = (ans * fi[i]) % (10**9 + 7)
print(ans)
| MOD = 10**9 + 7
N, M = list(map(int, input().split()))
DP = [0] * (N + 3)
DP[0] = 1
state = [1] * (N + 3)
for _ in range(M):
i = int(eval(input()))
state[i] = 0
for i in range(N):
for j in range(1, 3):
if state[j + i]:
DP[j + i] += DP[i]
DP[j + i] %= MOD
print((DP[N]))
| false | 18.75 | [
"+MOD = 10**9 + 7",
"-a = list(int(eval(input())) for i in range(M))",
"-a = [-1] + a + [N + 1]",
"-r = []",
"-for i in range(M + 1):",
"- r.append(a[i + 1] - a[i] - 1)",
"-fi = [0, 1, 1]",
"-for i in range(max(r)):",
"- fi.append(fi[-1] + fi[-2])",
"-ans = 1",
"-for i in r:",
"- ans ... | false | 0.046448 | 0.036668 | 1.266727 | [
"s282539367",
"s500831686"
] |
u163783894 | p03309 | python | s737815194 | s038376003 | 515 | 159 | 120,596 | 40,656 | Accepted | Accepted | 69.13 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: list(map(int, read().split()))
in_s = l... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: list(map(int, read().split()))
in_s = lambda: readline().rstrip... | 49 | 56 | 991 | 1,149 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: list(map(int, read().split()))
in_s = lambda: readl... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: list(map(int, read().split()))
in_s = lambda: readline().rstrip().decode("... | false | 12.5 | [
"-from numba import njit",
"-@njit(\"(i8,i8[:],i8,)\", cache=True)",
"-def sad(N, A, x):",
"- s = 0",
"- for i in range(N):",
"- s += abs(A[i] - (x + i + 1))",
"- return s",
"+def solve(N, A):",
"+ def sad(x):",
"+ s = 0",
"+ for i in range(N):",
"+ ... | false | 0.247095 | 0.43503 | 0.567995 | [
"s737815194",
"s038376003"
] |
u797059905 | p02647 | python | s726938822 | s827977096 | 1,657 | 1,095 | 143,600 | 133,924 | Accepted | Accepted | 33.92 | from numba import jit
import sys
input = sys.stdin.readline
@jit
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
for _ in range(K):
B = [0]*(N+1)
for i, a in enumerate(A):
B[max(0, i-a)] += 1
B[min(N, i+a+1)] -= ... | from numba import jit
import sys
input = sys.stdin.readline
@jit
def solve(n, k, X):
for _ in range(k):
Y = [0]*(n+1)
for i, x in enumerate(X):
Y[max(0, i-x)] += 1
Y[min(n, i+x+1)] -= 1
for j in range(1, n):
Y[j] += Y[j-1]
if X == Y... | 28 | 29 | 564 | 563 | from numba import jit
import sys
input = sys.stdin.readline
@jit
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
for _ in range(K):
B = [0] * (N + 1)
for i, a in enumerate(A):
B[max(0, i - a)] += 1
B[min(N, i + a + 1)] -= 1
... | from numba import jit
import sys
input = sys.stdin.readline
@jit
def solve(n, k, X):
for _ in range(k):
Y = [0] * (n + 1)
for i, x in enumerate(X):
Y[max(0, i - x)] += 1
Y[min(n, i + x + 1)] -= 1
for j in range(1, n):
Y[j] += Y[j - 1]
if X == Y[... | false | 3.448276 | [
"+def solve(n, k, X):",
"+ for _ in range(k):",
"+ Y = [0] * (n + 1)",
"+ for i, x in enumerate(X):",
"+ Y[max(0, i - x)] += 1",
"+ Y[min(n, i + x + 1)] -= 1",
"+ for j in range(1, n):",
"+ Y[j] += Y[j - 1]",
"+ if X == Y[:-1]:",
"+ ... | false | 0.087846 | 0.039991 | 2.196663 | [
"s726938822",
"s827977096"
] |
u333768710 | p03633 | python | s234420698 | s040392017 | 39 | 17 | 5,432 | 3,060 | Accepted | Accepted | 56.41 | import fractions
def lcm(a, b):
return a * b // fractions.gcd(a, b)
def list_lcm(number_list):
lcm_number = 1
for j in range(len(number_list)):
lcm_number = lcm(lcm_number, number_list[j])
return lcm_number
if __name__ == '__main__':
number_count = int(eval(input()))
... | def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
def list_lcm(number_list):
lcm_number = 1
for j in range(len(number_list)):
lcm_number = lcm(lcm_number, number_list[j])
return lcm_number
if __name__ == '__main__':... | 21 | 24 | 439 | 480 | import fractions
def lcm(a, b):
return a * b // fractions.gcd(a, b)
def list_lcm(number_list):
lcm_number = 1
for j in range(len(number_list)):
lcm_number = lcm(lcm_number, number_list[j])
return lcm_number
if __name__ == "__main__":
number_count = int(eval(input()))
numbers = []
... | def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
def list_lcm(number_list):
lcm_number = 1
for j in range(len(number_list)):
lcm_number = lcm(lcm_number, number_list[j])
return lcm_number
if __name__ == "__main__":
number_count =... | false | 12.5 | [
"-import fractions",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"- return a * b // fractions.gcd(a, b)",
"+ return a * b // gcd(a, b)"
] | false | 0.07137 | 0.118167 | 0.60397 | [
"s234420698",
"s040392017"
] |
u912237403 | p00022 | python | s103419986 | s239022934 | 580 | 40 | 4,448 | 4,204 | Accepted | Accepted | 93.1 | n=eval(input())
while n:
x=[]
m=[]
s=0
for i in range(n):
a=eval(input())
x=[e+a for e in x]+[a]
m.append(max(x))
print(max(m))
n=eval(input()) | n=eval(input())
while n:
x=-100000
m=x
s=0
while n:
a=eval(input())
x=max(x,0)+a
m=max(m,x)
n-=1
print(m)
n=eval(input()) | 11 | 12 | 182 | 169 | n = eval(input())
while n:
x = []
m = []
s = 0
for i in range(n):
a = eval(input())
x = [e + a for e in x] + [a]
m.append(max(x))
print(max(m))
n = eval(input())
| n = eval(input())
while n:
x = -100000
m = x
s = 0
while n:
a = eval(input())
x = max(x, 0) + a
m = max(m, x)
n -= 1
print(m)
n = eval(input())
| false | 8.333333 | [
"- x = []",
"- m = []",
"+ x = -100000",
"+ m = x",
"- for i in range(n):",
"+ while n:",
"- x = [e + a for e in x] + [a]",
"- m.append(max(x))",
"- print(max(m))",
"+ x = max(x, 0) + a",
"+ m = max(m, x)",
"+ n -= 1",
"+ print(m)"
] | false | 0.052954 | 0.037245 | 1.421781 | [
"s103419986",
"s239022934"
] |
u278886389 | p03560 | python | s432397659 | s545302195 | 376 | 204 | 13,036 | 42,864 | Accepted | Accepted | 45.74 | from collections import deque
K = int(eval(input()))
D = [-1]*K
Q = deque()
Q.append([1,0])
while D[0] == -1:
k,v = Q.popleft()
D[k] = v
j = (k*10)%K
if D[j] == -1:
Q.appendleft([j,v])
l = (k+1)%K
if D[l] == -1:
Q.append([l,v+1])
print((D[0]+1)) | from collections import deque
K = int(eval(input()))
D = [9999]*K
D[1] = 1
H = deque()
H.append(1)
while len(H) != 0:
h = H.pop()
if D[(h*10)%K] > D[h]:
D[(h*10)%K] = D[h]
H.append((h*10)%K)
if D[(h+1)%K] > D[h] + 1:
D[(h+1)%K] = D[h] + 1
H.appendleft((h+1)%K)
... | 17 | 17 | 295 | 328 | from collections import deque
K = int(eval(input()))
D = [-1] * K
Q = deque()
Q.append([1, 0])
while D[0] == -1:
k, v = Q.popleft()
D[k] = v
j = (k * 10) % K
if D[j] == -1:
Q.appendleft([j, v])
l = (k + 1) % K
if D[l] == -1:
Q.append([l, v + 1])
print((D[0] + 1))
| from collections import deque
K = int(eval(input()))
D = [9999] * K
D[1] = 1
H = deque()
H.append(1)
while len(H) != 0:
h = H.pop()
if D[(h * 10) % K] > D[h]:
D[(h * 10) % K] = D[h]
H.append((h * 10) % K)
if D[(h + 1) % K] > D[h] + 1:
D[(h + 1) % K] = D[h] + 1
H.appendleft((... | false | 0 | [
"-D = [-1] * K",
"-Q = deque()",
"-Q.append([1, 0])",
"-while D[0] == -1:",
"- k, v = Q.popleft()",
"- D[k] = v",
"- j = (k * 10) % K",
"- if D[j] == -1:",
"- Q.appendleft([j, v])",
"- l = (k + 1) % K",
"- if D[l] == -1:",
"- Q.append([l, v + 1])",
"-print((D[... | false | 0.046582 | 0.038854 | 1.198912 | [
"s432397659",
"s545302195"
] |
u347640436 | p02793 | python | s177295861 | s997473435 | 1,627 | 124 | 11,272 | 82,764 | Accepted | Accepted | 92.38 | from fractions import gcd
from functools import reduce
N = int(eval(input()))
A = list(map(int, input().split()))
m = 1000000007
lcm = reduce(lambda a, b: a * b // gcd(a, b), A)
print((sum(lcm // a for a in A) % m))
| # エラトステネスの篩, フェルマーの小定理
def make_prime_table(N):
sieve = [0] * (N + 1)
sieve[0] = -1
sieve[1] = -1
for i in range(2, N + 1):
if sieve[i] != 0:
continue
sieve[i] = i
for j in range(i * i, N + 1, i):
if sieve[j] == 0:
sieve[j] = i
... | 10 | 47 | 220 | 1,011 | from fractions import gcd
from functools import reduce
N = int(eval(input()))
A = list(map(int, input().split()))
m = 1000000007
lcm = reduce(lambda a, b: a * b // gcd(a, b), A)
print((sum(lcm // a for a in A) % m))
| # エラトステネスの篩, フェルマーの小定理
def make_prime_table(N):
sieve = [0] * (N + 1)
sieve[0] = -1
sieve[1] = -1
for i in range(2, N + 1):
if sieve[i] != 0:
continue
sieve[i] = i
for j in range(i * i, N + 1, i):
if sieve[j] == 0:
sieve[j] = i
return s... | false | 78.723404 | [
"-from fractions import gcd",
"-from functools import reduce",
"+# エラトステネスの篩, フェルマーの小定理",
"+def make_prime_table(N):",
"+ sieve = [0] * (N + 1)",
"+ sieve[0] = -1",
"+ sieve[1] = -1",
"+ for i in range(2, N + 1):",
"+ if sieve[i] != 0:",
"+ continue",
"+ siev... | false | 0.127694 | 0.378208 | 0.337629 | [
"s177295861",
"s997473435"
] |
u141610915 | p03420 | python | s856572220 | s245983827 | 177 | 73 | 38,896 | 73,592 | Accepted | Accepted | 58.76 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
res = 0
for x in range(K + 1, N + 1):
res += (N // x) * (x - K) + max(0, N % x - K + (K > 0))
#print(x, res)
print(res) | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
if K == 0:
print((N ** 2))
exit(0)
res = 0
for i in range(1, N + 1):
if i <= K: continue
res += i - K
for j in range(i, N + 1, i):
res += min(N + 1, j + i) - min(N + 1, j + K)
print(res) | 8 | 13 | 201 | 281 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
res = 0
for x in range(K + 1, N + 1):
res += (N // x) * (x - K) + max(0, N % x - K + (K > 0))
# print(x, res)
print(res)
| import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
if K == 0:
print((N**2))
exit(0)
res = 0
for i in range(1, N + 1):
if i <= K:
continue
res += i - K
for j in range(i, N + 1, i):
res += min(N + 1, j + i) - min(N + 1, j + K)
print(res)
| false | 38.461538 | [
"+if K == 0:",
"+ print((N**2))",
"+ exit(0)",
"-for x in range(K + 1, N + 1):",
"- res += (N // x) * (x - K) + max(0, N % x - K + (K > 0))",
"- # print(x, res)",
"+for i in range(1, N + 1):",
"+ if i <= K:",
"+ continue",
"+ res += i - K",
"+ for j in range(i, N + 1,... | false | 0.03968 | 0.213123 | 0.186185 | [
"s856572220",
"s245983827"
] |
u747602774 | p02862 | python | s725444175 | s072581364 | 547 | 123 | 40,428 | 3,064 | Accepted | Accepted | 77.51 | def modinv(a,m):
return pow(a,m-2,m)
x,y = list(map(int,input().split()))
if (x+y)%3 != 0 or 2*y-x < 0 or 2*x-y < 0:
print((0))
else:
a = (2*y-x)//3
b = (2*x-y)//3
ans = 1
mod = 10**9+7
for i in range(1,a+1):
ans = ans*(i+b)*modinv(i,mod)%mod
print(ans)
| #nCrをmodで割った余りO(r)
def comb(n, r, mod):
r = min(r, n-r)
mol = 1
deno = 1
for i in range(1, r+1):
mol = mol * (n-r+i) % mod
deno = deno * i % mod
ret = mol * pow(deno, mod-2, mod) % mod
return ret
x,y = list(map(int,input().split()))
if (x+y)%3 != 0 or 2*y-x < 0 or 2*... | 14 | 19 | 300 | 431 | def modinv(a, m):
return pow(a, m - 2, m)
x, y = list(map(int, input().split()))
if (x + y) % 3 != 0 or 2 * y - x < 0 or 2 * x - y < 0:
print((0))
else:
a = (2 * y - x) // 3
b = (2 * x - y) // 3
ans = 1
mod = 10**9 + 7
for i in range(1, a + 1):
ans = ans * (i + b) * modinv(i, mod) ... | # nCrをmodで割った余りO(r)
def comb(n, r, mod):
r = min(r, n - r)
mol = 1
deno = 1
for i in range(1, r + 1):
mol = mol * (n - r + i) % mod
deno = deno * i % mod
ret = mol * pow(deno, mod - 2, mod) % mod
return ret
x, y = list(map(int, input().split()))
if (x + y) % 3 != 0 or 2 * y - x... | false | 26.315789 | [
"-def modinv(a, m):",
"- return pow(a, m - 2, m)",
"+# nCrをmodで割った余りO(r)",
"+def comb(n, r, mod):",
"+ r = min(r, n - r)",
"+ mol = 1",
"+ deno = 1",
"+ for i in range(1, r + 1):",
"+ mol = mol * (n - r + i) % mod",
"+ deno = deno * i % mod",
"+ ret = mol * pow(de... | false | 0.681315 | 0.083726 | 8.13745 | [
"s725444175",
"s072581364"
] |
u037430802 | p03078 | python | s166037734 | s657380118 | 685 | 121 | 8,708 | 8,708 | Accepted | Accepted | 82.34 | 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)
abc = []
for i in range (x):
for j in range(y):
for(k) in range(z):
... |
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)
ans = []
for i in range(X):
if (i+1) > K: break
for j in range(Y):
i... | 22 | 27 | 523 | 533 | 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)
abc = []
for i in range(x):
for j in range(y):
for k in range(z):
if (i + 1) * (... | 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)
ans = []
for i in range(X):
if (i + 1) > K:
break
for j in range(Y):
if (i + 1) ... | false | 18.518519 | [
"-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)",
"-abc = []",
"-for i in range(x):",
"- for j in ran... | false | 0.03563 | 0.035993 | 0.989912 | [
"s166037734",
"s657380118"
] |
u197078193 | p03290 | python | s910613103 | s000517239 | 33 | 29 | 3,064 | 3,188 | Accepted | Accepted | 12.12 | D,G = list(map(int,input().split()))
G = G/100
P = []; C = []
for i in range(D):
p,c = list(map(int,input().split()))
P.append(p)
C.append(c/100)
m = 10**3
for k in range(2**D):
R = list(range(D))[::-1]
point = G
prob = 0
for d in range(D):
if k%(2**(d+1)) >= 2**d:
p = P[d]; c = C[... | D,G = list(map(int,input().split()))
G = G/100
P = []; C = []
for i in range(D):
p,c = list(map(int,input().split()))
P.append(p)
C.append(c/100)
m = 10**3
for k in range(2**D):
R = list(range(D))[::-1]
point = G
prob = 0
for d in range(D):
if k & 1<<d:
p = P[d]; c = C[d]
po... | 30 | 30 | 616 | 604 | D, G = list(map(int, input().split()))
G = G / 100
P = []
C = []
for i in range(D):
p, c = list(map(int, input().split()))
P.append(p)
C.append(c / 100)
m = 10**3
for k in range(2**D):
R = list(range(D))[::-1]
point = G
prob = 0
for d in range(D):
if k % (2 ** (d + 1)) >= 2**d:
... | D, G = list(map(int, input().split()))
G = G / 100
P = []
C = []
for i in range(D):
p, c = list(map(int, input().split()))
P.append(p)
C.append(c / 100)
m = 10**3
for k in range(2**D):
R = list(range(D))[::-1]
point = G
prob = 0
for d in range(D):
if k & 1 << d:
p = P[d]
... | false | 0 | [
"- if k % (2 ** (d + 1)) >= 2**d:",
"+ if k & 1 << d:"
] | false | 0.036837 | 0.036236 | 1.016572 | [
"s910613103",
"s000517239"
] |
u408071652 | p02706 | python | s223687745 | s109006205 | 65 | 25 | 68,204 | 9,540 | Accepted | Accepted | 61.54 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = n- sum(a)
if ans>=0:
print(ans)
else:
print((-1)) | N, M = list(map(int,input().split()))
A =list(map(int,input().split()))
print((max(-1,N-sum(A)))) | 9 | 4 | 141 | 87 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = n - sum(a)
if ans >= 0:
print(ans)
else:
print((-1))
| N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
print((max(-1, N - sum(A))))
| false | 55.555556 | [
"-n, m = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-ans = n - sum(a)",
"-if ans >= 0:",
"- print(ans)",
"-else:",
"- print((-1))",
"+N, M = list(map(int, input().split()))",
"+A = list(map(int, input().split()))",
"+print((max(-1, N - sum(A))))"
] | false | 0.04209 | 0.092765 | 0.453726 | [
"s223687745",
"s109006205"
] |
u459150945 | p02785 | python | s085767655 | s689224184 | 188 | 151 | 26,024 | 26,180 | Accepted | Accepted | 19.68 | H, K = list(map(int, input().split()))
Hn = list(map(int, input().split()))
ans = 0
Hn.sort()
try:
for _ in range(K):
Hn.pop(-1)
except:
print((0))
exit()
ans = sum(Hn)
print(ans)
| H, K = list(map(int, input().split()))
Hn = list(map(int, input().split()))
ans = 0
Hn.sort()
K = min(H, K)
print((sum(Hn[:H-K]))) | 13 | 7 | 205 | 129 | H, K = list(map(int, input().split()))
Hn = list(map(int, input().split()))
ans = 0
Hn.sort()
try:
for _ in range(K):
Hn.pop(-1)
except:
print((0))
exit()
ans = sum(Hn)
print(ans)
| H, K = list(map(int, input().split()))
Hn = list(map(int, input().split()))
ans = 0
Hn.sort()
K = min(H, K)
print((sum(Hn[: H - K])))
| false | 46.153846 | [
"-try:",
"- for _ in range(K):",
"- Hn.pop(-1)",
"-except:",
"- print((0))",
"- exit()",
"-ans = sum(Hn)",
"-print(ans)",
"+K = min(H, K)",
"+print((sum(Hn[: H - K])))"
] | false | 0.045158 | 0.116438 | 0.38783 | [
"s085767655",
"s689224184"
] |
u197457087 | p02796 | python | s331795915 | s670922655 | 461 | 321 | 26,460 | 100,168 | Accepted | Accepted | 30.37 | N = int(eval(input()))
X = []
L = []
Y = []
for i in range(N):
tx,tL = list(map(int,input().split()))
X.append(tx)
L.append(tL)
Y.append((tx-tL,tx+tL))
Y.sort(key=lambda x : x[1])
select = 0
for i in range(N):
if i == 0:
temp = Y[i][1] #今の終わり
select += 1
else:
if Y[i][0] >=... | N = int(eval(input()))
X = [];L =[]
for i in range(N):
x,l = list(map(int,input().split()))
X.append(x);L.append(l)
#print(X,L)
Y = []
for i in range(N):
a = X[i]-L[i];b=X[i]+L[i]
Y.append([a,b])
#print(Y)
Y.sort(key=lambda x : x[1])
ans = 0
end = - float("inf")
for i in range(N):
if end > Y[i]... | 24 | 20 | 395 | 368 | N = int(eval(input()))
X = []
L = []
Y = []
for i in range(N):
tx, tL = list(map(int, input().split()))
X.append(tx)
L.append(tL)
Y.append((tx - tL, tx + tL))
Y.sort(key=lambda x: x[1])
select = 0
for i in range(N):
if i == 0:
temp = Y[i][1] # 今の終わり
select += 1
else:
if ... | N = int(eval(input()))
X = []
L = []
for i in range(N):
x, l = list(map(int, input().split()))
X.append(x)
L.append(l)
# print(X,L)
Y = []
for i in range(N):
a = X[i] - L[i]
b = X[i] + L[i]
Y.append([a, b])
# print(Y)
Y.sort(key=lambda x: x[1])
ans = 0
end = -float("inf")
for i in range(N):
... | false | 16.666667 | [
"+for i in range(N):",
"+ x, l = list(map(int, input().split()))",
"+ X.append(x)",
"+ L.append(l)",
"+# print(X,L)",
"- tx, tL = list(map(int, input().split()))",
"- X.append(tx)",
"- L.append(tL)",
"- Y.append((tx - tL, tx + tL))",
"+ a = X[i] - L[i]",
"+ b = X[i] + ... | false | 0.037479 | 0.037258 | 1.005916 | [
"s331795915",
"s670922655"
] |
u562935282 | p03111 | python | s584807233 | s725419344 | 363 | 326 | 3,064 | 3,064 | Accepted | Accepted | 10.19 | inf = float('inf')
def calc(mask):
cost = -30
t = [0] * 3
for j in range(n):
idx = (mask >> (2 * j)) & 3
if idx == 3: continue
t[idx] += l[j]
cost += 10
if 0 in t[:3]:
return inf
cost += sum(abs(tt - gg) for tt, gg in zip(t, goal))
retu... | inf = float('inf')
def calc(mask):
t = [0] * 3
cnt = 0
for j in range(n):
idx = (mask >> (2 * j)) & 3
if idx == 3:
cnt += 1
continue
t[idx] += l[j]
if 0 in t:
return inf
return sum(abs(tt - gg) for tt, gg in zip(t, goal)) + ... | 37 | 37 | 719 | 730 | inf = float("inf")
def calc(mask):
cost = -30
t = [0] * 3
for j in range(n):
idx = (mask >> (2 * j)) & 3
if idx == 3:
continue
t[idx] += l[j]
cost += 10
if 0 in t[:3]:
return inf
cost += sum(abs(tt - gg) for tt, gg in zip(t, goal))
return cos... | inf = float("inf")
def calc(mask):
t = [0] * 3
cnt = 0
for j in range(n):
idx = (mask >> (2 * j)) & 3
if idx == 3:
cnt += 1
continue
t[idx] += l[j]
if 0 in t:
return inf
return sum(abs(tt - gg) for tt, gg in zip(t, goal)) + (n - cnt - 3) * 10... | false | 0 | [
"- cost = -30",
"+ cnt = 0",
"+ cnt += 1",
"- cost += 10",
"- if 0 in t[:3]:",
"+ if 0 in t:",
"- cost += sum(abs(tt - gg) for tt, gg in zip(t, goal))",
"- return cost",
"+ return sum(abs(tt - gg) for tt, gg in zip(t, goal)) + (n - cnt - 3) * 10"
] | false | 0.192256 | 0.27122 | 0.708854 | [
"s584807233",
"s725419344"
] |
u647999897 | p02695 | python | s782975117 | s998295545 | 488 | 324 | 28,664 | 75,768 | Accepted | Accepted | 33.61 | def solve():
N,M,Q = list(map(int,input().split()))
req = []
for i in range(Q):
a,b,c,d = list(map(int,input().split()))
a -= 1
b -= 1
req.append([a,b,c,d])
res = []
dfs(list(), res,M,N)
mx = 0
for p in res:
point = 0
for a,b,c... | def solve():
N,M,Q = list(map(int,input().split()))
global info
info = []
for _ in range(Q):
a,b,c,d = list(map(int,input().split()))
a -= 1
b -= 1
info.append([a,b,c,d])
print((dfs(list(),M,N)))
def dfs(A,M,N):
if len(A) == N:
return calcP... | 41 | 34 | 774 | 693 | def solve():
N, M, Q = list(map(int, input().split()))
req = []
for i in range(Q):
a, b, c, d = list(map(int, input().split()))
a -= 1
b -= 1
req.append([a, b, c, d])
res = []
dfs(list(), res, M, N)
mx = 0
for p in res:
point = 0
for a, b, c, d... | def solve():
N, M, Q = list(map(int, input().split()))
global info
info = []
for _ in range(Q):
a, b, c, d = list(map(int, input().split()))
a -= 1
b -= 1
info.append([a, b, c, d])
print((dfs(list(), M, N)))
def dfs(A, M, N):
if len(A) == N:
return calcP... | false | 17.073171 | [
"- req = []",
"- for i in range(Q):",
"+ global info",
"+ info = []",
"+ for _ in range(Q):",
"- req.append([a, b, c, d])",
"- res = []",
"- dfs(list(), res, M, N)",
"- mx = 0",
"- for p in res:",
"- point = 0",
"- for a, b, c, d in req:",
"- ... | false | 0.082999 | 0.057965 | 1.431889 | [
"s782975117",
"s998295545"
] |
u312025627 | p02580 | python | s109277054 | s916262027 | 662 | 586 | 177,564 | 170,900 | Accepted | Accepted | 11.48 | def main():
H, W, M = (int(i) for i in input().split())
hc = [0]*(H+1)
wc = [0]*(W+1)
maps = set()
for _ in range(M):
h, w = (int(i) for i in input().split())
hc[h] += 1
wc[w] += 1
maps.add((h, w))
mah = max(hc)
maw = max(wc)
ans = mah+maw
... | def main():
H, W, M = (int(i) for i in input().split())
hc = [0]*(H+1)
wc = [0]*(W+1)
maps = set()
for _ in range(M):
h, w = (int(i) for i in input().split())
hc[h] += 1
wc[w] += 1
maps.add((h, w))
mah = max(hc)
maw = max(wc)
ans = mah+maw
... | 33 | 33 | 727 | 727 | def main():
H, W, M = (int(i) for i in input().split())
hc = [0] * (H + 1)
wc = [0] * (W + 1)
maps = set()
for _ in range(M):
h, w = (int(i) for i in input().split())
hc[h] += 1
wc[w] += 1
maps.add((h, w))
mah = max(hc)
maw = max(wc)
ans = mah + maw
hm... | def main():
H, W, M = (int(i) for i in input().split())
hc = [0] * (H + 1)
wc = [0] * (W + 1)
maps = set()
for _ in range(M):
h, w = (int(i) for i in input().split())
hc[h] += 1
wc[w] += 1
maps.add((h, w))
mah = max(hc)
maw = max(wc)
ans = mah + maw
hm... | false | 0 | [
"- hmaps = []",
"- wmaps = []",
"+ hmaps = set()",
"+ wmaps = set()",
"- hmaps.append(i)",
"+ hmaps.add(i)",
"- wmaps.append(i)",
"+ wmaps.add(i)"
] | false | 0.035361 | 0.04101 | 0.862273 | [
"s109277054",
"s916262027"
] |
u227082700 | p03040 | python | s490860439 | s712453546 | 1,131 | 996 | 67,792 | 56,768 | Accepted | Accepted | 11.94 | from heapq import heappop,heappush
q=int(eval(input()))
queries=[list(map(int,input().split()))for _ in range(q)]
l=[]
r=[]
ans=0
queonecount=0
mid=-1
for query in queries:
if query[0]==1:
queonecount+=1
_,a,b=query
ans+=b
heappush(l,-a)
heappush(r,a)
midl=-heappop(l)
midr=... | from heapq import heappop,heappush
q=int(eval(input()))
queries=[list(map(int,input().split()))for _ in range(q)]
l=[]
r=[]
ans=0
quecount=0
for query in queries:
if query[0]==1:
quecount+=1
_,a,b=query
ans+=b
if quecount==1:
mid=a
elif quecount%2==1:
if a<-l[0]:
... | 24 | 34 | 485 | 682 | from heapq import heappop, heappush
q = int(eval(input()))
queries = [list(map(int, input().split())) for _ in range(q)]
l = []
r = []
ans = 0
queonecount = 0
mid = -1
for query in queries:
if query[0] == 1:
queonecount += 1
_, a, b = query
ans += b
heappush(l, -a)
heappush(... | from heapq import heappop, heappush
q = int(eval(input()))
queries = [list(map(int, input().split())) for _ in range(q)]
l = []
r = []
ans = 0
quecount = 0
for query in queries:
if query[0] == 1:
quecount += 1
_, a, b = query
ans += b
if quecount == 1:
mid = a
el... | false | 29.411765 | [
"-queonecount = 0",
"-mid = -1",
"+quecount = 0",
"- queonecount += 1",
"+ quecount += 1",
"- heappush(l, -a)",
"- heappush(r, a)",
"- midl = -heappop(l)",
"- midr = heappop(r)",
"- ans += abs(midl - midr)",
"- heappush(l, -midr)",
"- ... | false | 0.052005 | 0.119213 | 0.436231 | [
"s490860439",
"s712453546"
] |
u806976856 | p02573 | python | s476581107 | s598030631 | 469 | 286 | 79,868 | 79,672 | Accepted | Accepted | 39.02 | import sys
sys.setrecursionlimit(10**9)
n,m=list(map(int,input().split()))
root=[-1]*(n+1)
def r(x):
if root[x]<0:
return x
else:
root[x]=r(root[x])
return root[x]
def unite(x,y):
x=r(x)
y=r(y)
if x==y:
return
if x>y:
x,y=y,x
root[x]... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
n,m=list(map(int,input().split()))
root=[-1]*(n+1)
def r(x):
if root[x]<0:
return x
else:
root[x]=r(root[x])
return root[x]
def unite(x,y):
x=r(x)
y=r(y)
if x==y:
return
if x>y:
... | 31 | 34 | 525 | 557 | import sys
sys.setrecursionlimit(10**9)
n, m = list(map(int, input().split()))
root = [-1] * (n + 1)
def r(x):
if root[x] < 0:
return x
else:
root[x] = r(root[x])
return root[x]
def unite(x, y):
x = r(x)
y = r(y)
if x == y:
return
if x > y:
x, y = y, ... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
n, m = list(map(int, input().split()))
root = [-1] * (n + 1)
def r(x):
if root[x] < 0:
return x
else:
root[x] = r(root[x])
return root[x]
def unite(x, y):
x = r(x)
y = r(y)
if x == y:
return
i... | false | 8.823529 | [
"+input = sys.stdin.readline"
] | false | 0.036913 | 0.040609 | 0.90898 | [
"s476581107",
"s598030631"
] |
u660912567 | p00767 | python | s505912149 | s547297270 | 120 | 80 | 8,956 | 9,060 | Accepted | Accepted | 33.33 | l = []
for i in range(1,151):
for j in range(1,151):
if i==j or i>j: continue
l += [[i**2+j**2,i,j]]
l = sorted(l)
while True:
h,w = map(int,input().split())
if w==h==0: break
i = l.index([w**2+h**2,h,w])+1
print(*l[i][1:],sep=' ')
| l = [[i**2+j**2,i,j] for j in range(1,151) for i in range(1,151) if i!=j and i<j]
l = sorted(l)
while True:
h,w = map(int,input().split())
if w==h==0: break
i = l.index([w**2+h**2,h,w])+1
print(*l[i][1:],sep=' ')
| 11 | 7 | 277 | 234 | l = []
for i in range(1, 151):
for j in range(1, 151):
if i == j or i > j:
continue
l += [[i**2 + j**2, i, j]]
l = sorted(l)
while True:
h, w = map(int, input().split())
if w == h == 0:
break
i = l.index([w**2 + h**2, h, w]) + 1
print(*l[i][1:], sep=" ")
| l = [
[i**2 + j**2, i, j]
for j in range(1, 151)
for i in range(1, 151)
if i != j and i < j
]
l = sorted(l)
while True:
h, w = map(int, input().split())
if w == h == 0:
break
i = l.index([w**2 + h**2, h, w]) + 1
print(*l[i][1:], sep=" ")
| false | 36.363636 | [
"-l = []",
"-for i in range(1, 151):",
"- for j in range(1, 151):",
"- if i == j or i > j:",
"- continue",
"- l += [[i**2 + j**2, i, j]]",
"+l = [",
"+ [i**2 + j**2, i, j]",
"+ for j in range(1, 151)",
"+ for i in range(1, 151)",
"+ if i != j and i < j",
... | false | 0.0874 | 0.079849 | 1.094562 | [
"s505912149",
"s547297270"
] |
u349091349 | p03048 | python | s854287471 | s405938900 | 406 | 198 | 40,684 | 67,552 | Accepted | Accepted | 51.23 | r,g,b,N=list(map(int,input().split()))
c=0
for i in range(N//r+1):
for j in range(N//g + 1):
t = (N-i*r-j*g)
if t%b ==0 and t>=0:
#print(i,j,t//b)
c+=1
print(c) | *s,n=list(map(int,input().split()))
s.sort()
c=0
for i in range(n//s[2]+1):
for j in range(n//s[1]+1):
if (n-s[2]*i-s[1]*j)%s[0] == 0 and 0<=(n-s[2]*i-s[1]*j):
#print(i,j,n-s[2]*i-s[1]*j)
c+=1
print(c) | 9 | 9 | 206 | 239 | r, g, b, N = list(map(int, input().split()))
c = 0
for i in range(N // r + 1):
for j in range(N // g + 1):
t = N - i * r - j * g
if t % b == 0 and t >= 0:
# print(i,j,t//b)
c += 1
print(c)
| *s, n = list(map(int, input().split()))
s.sort()
c = 0
for i in range(n // s[2] + 1):
for j in range(n // s[1] + 1):
if (n - s[2] * i - s[1] * j) % s[0] == 0 and 0 <= (n - s[2] * i - s[1] * j):
# print(i,j,n-s[2]*i-s[1]*j)
c += 1
print(c)
| false | 0 | [
"-r, g, b, N = list(map(int, input().split()))",
"+*s, n = list(map(int, input().split()))",
"+s.sort()",
"-for i in range(N // r + 1):",
"- for j in range(N // g + 1):",
"- t = N - i * r - j * g",
"- if t % b == 0 and t >= 0:",
"- # print(i,j,t//b)",
"+for i in range(n /... | false | 0.141352 | 0.063617 | 2.221912 | [
"s854287471",
"s405938900"
] |
u075836834 | p00008 | python | s385119052 | s493045045 | 200 | 50 | 7,548 | 7,616 | Accepted | Accepted | 75 |
while True:
try:
n=int(eval(input()))
cnt=0
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
if a+b+c+d==n:
cnt+=1
print(cnt)
except EOFError:
break |
while True:
try:
n=int(eval(input()))
cnt=0
for a in range(10):
for b in range(10):
for c in range(10):
d = n-(a+b+c)
if 0<=d<=9:
cnt+=1
print(cnt)
except EOFError:
break | 14 | 14 | 224 | 213 | while True:
try:
n = int(eval(input()))
cnt = 0
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
if a + b + c + d == n:
cnt += 1
print(cnt)
except EO... | while True:
try:
n = int(eval(input()))
cnt = 0
for a in range(10):
for b in range(10):
for c in range(10):
d = n - (a + b + c)
if 0 <= d <= 9:
cnt += 1
print(cnt)
except EOFError:
... | false | 0 | [
"- for d in range(10):",
"- if a + b + c + d == n:",
"- cnt += 1",
"+ d = n - (a + b + c)",
"+ if 0 <= d <= 9:",
"+ cnt += 1"
] | false | 0.103391 | 0.041024 | 2.520252 | [
"s385119052",
"s493045045"
] |
u525065967 | p03329 | python | s138868246 | s036283075 | 452 | 366 | 6,900 | 7,076 | Accepted | Accepted | 19.03 | coin = [1,
6,6**2,6**3,6**4,6**5,6**6,
9,9**2,9**3,9**4,9**5]
n = int(eval(input()))
inf = 10**9
dp = [inf]*(n+1)
dp[0] = 0
for c in coin:
for yen in range(c, n+1):
dp[yen] = min(dp[yen], dp[yen-c] + 1)
print((dp[n]))
| n = int(eval(input()))
dp = list(i for i in range(n+1))
def f(yen, p):
c = p
while yen >= c:
dp[yen] = min(dp[yen], dp[yen-c] + 1)
c *= p
for yen in range(6, n+1):
f(yen, 6)
f(yen, 9)
print((dp[n]))
| 11 | 13 | 232 | 237 | coin = [1, 6, 6**2, 6**3, 6**4, 6**5, 6**6, 9, 9**2, 9**3, 9**4, 9**5]
n = int(eval(input()))
inf = 10**9
dp = [inf] * (n + 1)
dp[0] = 0
for c in coin:
for yen in range(c, n + 1):
dp[yen] = min(dp[yen], dp[yen - c] + 1)
print((dp[n]))
| n = int(eval(input()))
dp = list(i for i in range(n + 1))
def f(yen, p):
c = p
while yen >= c:
dp[yen] = min(dp[yen], dp[yen - c] + 1)
c *= p
for yen in range(6, n + 1):
f(yen, 6)
f(yen, 9)
print((dp[n]))
| false | 15.384615 | [
"-coin = [1, 6, 6**2, 6**3, 6**4, 6**5, 6**6, 9, 9**2, 9**3, 9**4, 9**5]",
"-inf = 10**9",
"-dp = [inf] * (n + 1)",
"-dp[0] = 0",
"-for c in coin:",
"- for yen in range(c, n + 1):",
"+dp = list(i for i in range(n + 1))",
"+",
"+",
"+def f(yen, p):",
"+ c = p",
"+ while yen >= c:",
"... | false | 0.342867 | 0.12004 | 2.856274 | [
"s138868246",
"s036283075"
] |
u137226361 | p02725 | python | s989226544 | s168166312 | 122 | 98 | 31,532 | 31,512 | Accepted | Accepted | 19.67 | import sys
k, n = list(map(int, sys.stdin.readline().split()))
an = list(map(int, sys.stdin.readline().split()))
dai = an[0]+k-an[-1]
for i in range(1, n):
dai = max(dai, an[i]-an[i-1])
print((k-dai)) | import sys
k, n = list(map(int, sys.stdin.readline().split()))
an = list(map(int, sys.stdin.readline().split()))
dai = an[0]+k-an[-1]
for i in range(1, n):
if an[i]-an[i-1]>dai:
dai = an[i]-an[i-1]
print((k-dai)) | 10 | 11 | 208 | 229 | import sys
k, n = list(map(int, sys.stdin.readline().split()))
an = list(map(int, sys.stdin.readline().split()))
dai = an[0] + k - an[-1]
for i in range(1, n):
dai = max(dai, an[i] - an[i - 1])
print((k - dai))
| import sys
k, n = list(map(int, sys.stdin.readline().split()))
an = list(map(int, sys.stdin.readline().split()))
dai = an[0] + k - an[-1]
for i in range(1, n):
if an[i] - an[i - 1] > dai:
dai = an[i] - an[i - 1]
print((k - dai))
| false | 9.090909 | [
"- dai = max(dai, an[i] - an[i - 1])",
"+ if an[i] - an[i - 1] > dai:",
"+ dai = an[i] - an[i - 1]"
] | false | 0.077428 | 0.045495 | 1.701908 | [
"s989226544",
"s168166312"
] |
u912237403 | p00018 | python | s845315128 | s357362930 | 20 | 10 | 4,188 | 4,188 | Accepted | Accepted | 50 | x=sorted(map(int, input().split()))
for e in x[::-1]:
print(e, end=' ')
print() | x=sorted(map(int,input().split()))[::-1]
for e in x:
print(e, end=' ')
print() | 4 | 4 | 79 | 78 | x = sorted(map(int, input().split()))
for e in x[::-1]:
print(e, end=" ")
print()
| x = sorted(map(int, input().split()))[::-1]
for e in x:
print(e, end=" ")
print()
| false | 0 | [
"-x = sorted(map(int, input().split()))",
"-for e in x[::-1]:",
"+x = sorted(map(int, input().split()))[::-1]",
"+for e in x:"
] | false | 0.127849 | 0.120521 | 1.060799 | [
"s845315128",
"s357362930"
] |
u368796742 | p02585 | python | s823932725 | s281866912 | 961 | 668 | 74,320 | 68,928 | Accepted | Accepted | 30.49 | n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
used = [0]*n
c = list(map(int,input().split()))
ans = -float("INF")
def calc(x):
l = []
now = x
score = 0
while used[now] == 0:
used[now] = 1
l.append(c[now])
now = p[now]-1
S = sum(l)
l... | n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
used = [0]*n
c = list(map(int,input().split()))
ans = -float("INF")
def calc(x):
l = []
now = x
score = 0
while used[now] == 0:
used[now] = 1
l.append(c[now])
now = p[now]-1
S = sum(l)
l... | 39 | 41 | 941 | 1,009 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
used = [0] * n
c = list(map(int, input().split()))
ans = -float("INF")
def calc(x):
l = []
now = x
score = 0
while used[now] == 0:
used[now] = 1
l.append(c[now])
now = p[now] - 1
S = sum(l)
le = ... | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
used = [0] * n
c = list(map(int, input().split()))
ans = -float("INF")
def calc(x):
l = []
now = x
score = 0
while used[now] == 0:
used[now] = 1
l.append(c[now])
now = p[now] - 1
S = sum(l)
le = ... | false | 4.878049 | [
"- mod = k % le + le",
"+ mod = k % le",
"- for j in range(mod):",
"+ for j in range(le):",
"+ if j <= mod:",
"+ now = max(now, cal + S)"
] | false | 0.03741 | 0.037602 | 0.99491 | [
"s823932725",
"s281866912"
] |
u336564899 | p02659 | python | s502854700 | s175168143 | 27 | 23 | 10,040 | 9,136 | Accepted | Accepted | 14.81 | #a, b = map(float, input().split())
a, b = input().split()
from decimal import Decimal
import math
print((math.floor(int(a)*Decimal(b))))
| #解放1
a, b = input().split()
b = b.replace(".", "")
print((int(a)*int(b)//100)) | 6 | 4 | 142 | 79 | # a, b = map(float, input().split())
a, b = input().split()
from decimal import Decimal
import math
print((math.floor(int(a) * Decimal(b))))
| # 解放1
a, b = input().split()
b = b.replace(".", "")
print((int(a) * int(b) // 100))
| false | 33.333333 | [
"-# a, b = map(float, input().split())",
"+# 解放1",
"-from decimal import Decimal",
"-import math",
"-",
"-print((math.floor(int(a) * Decimal(b))))",
"+b = b.replace(\".\", \"\")",
"+print((int(a) * int(b) // 100))"
] | false | 0.043724 | 0.042541 | 1.027808 | [
"s502854700",
"s175168143"
] |
u028973125 | p03681 | python | s928158927 | s449493511 | 175 | 72 | 38,384 | 9,144 | Accepted | Accepted | 58.86 | import sys
def permutation(n, x, mod=10**9+7):
# nPx
# 順列
# ex) permutaion(5, 2) = 20
tmp = 1
for i in range(n, n-x, -1):
tmp = (tmp * i) % mod
return tmp
N, M = list(map(int, sys.stdin.readline().strip().split()))
if abs(N - M) > 1:
print((0))
elif abs(N - M) == 1:... | import sys
import math
mod = 10**9 + 7
N, M = list(map(int, sys.stdin.readline().split()))
diff = abs(N - M)
if diff > 1:
print((0))
sys.exit()
n_p = 1
for i in range(1, N+1):
n_p *= i
n_p %= mod
m_p = 1
for i in range(1, M+1):
m_p *= i
m_p %= mod
if diff == 0:
print((... | 19 | 23 | 448 | 366 | import sys
def permutation(n, x, mod=10**9 + 7):
# nPx
# 順列
# ex) permutaion(5, 2) = 20
tmp = 1
for i in range(n, n - x, -1):
tmp = (tmp * i) % mod
return tmp
N, M = list(map(int, sys.stdin.readline().strip().split()))
if abs(N - M) > 1:
print((0))
elif abs(N - M) == 1:
print... | import sys
import math
mod = 10**9 + 7
N, M = list(map(int, sys.stdin.readline().split()))
diff = abs(N - M)
if diff > 1:
print((0))
sys.exit()
n_p = 1
for i in range(1, N + 1):
n_p *= i
n_p %= mod
m_p = 1
for i in range(1, M + 1):
m_p *= i
m_p %= mod
if diff == 0:
print((2 * n_p * m_p % mo... | false | 17.391304 | [
"+import math",
"-",
"-def permutation(n, x, mod=10**9 + 7):",
"- # nPx",
"- # 順列",
"- # ex) permutaion(5, 2) = 20",
"- tmp = 1",
"- for i in range(n, n - x, -1):",
"- tmp = (tmp * i) % mod",
"- return tmp",
"-",
"-",
"-N, M = list(map(int, sys.stdin.readline().strip... | false | 0.087125 | 0.116542 | 0.747588 | [
"s928158927",
"s449493511"
] |
u174158426 | p02675 | python | s475071092 | s593143264 | 23 | 21 | 9,108 | 9,104 | Accepted | Accepted | 8.7 | number = eval(input())
number = int(number)
last_num = number % 10
last_num = str(last_num)
if last_num == '3':
print('bon')
elif last_num in '0168':
print('pon')
else:
print('hon') | number = eval(input())
last_num = number[-1]
if last_num == '3':
print('bon')
elif last_num in '0168':
print('pon')
else:
print('hon') | 11 | 9 | 198 | 149 | number = eval(input())
number = int(number)
last_num = number % 10
last_num = str(last_num)
if last_num == "3":
print("bon")
elif last_num in "0168":
print("pon")
else:
print("hon")
| number = eval(input())
last_num = number[-1]
if last_num == "3":
print("bon")
elif last_num in "0168":
print("pon")
else:
print("hon")
| false | 18.181818 | [
"-number = int(number)",
"-last_num = number % 10",
"-last_num = str(last_num)",
"+last_num = number[-1]"
] | false | 0.045451 | 0.039114 | 1.162028 | [
"s475071092",
"s593143264"
] |
u261103969 | p02582 | python | s754153995 | s275557891 | 89 | 32 | 61,628 | 9,056 | Accepted | Accepted | 64.04 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
s = eval(input())
if s == "RRR":
print((3))
elif "RR" in s:
print((2))
elif "R" in s:
print((1))
else:
print((0))
if __n... | s = eval(input())
ans = 0
for i in range(1, 4):
p = "R" * i
if p in s:
ans = i
print(ans)
| 23 | 9 | 339 | 110 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
s = eval(input())
if s == "RRR":
print((3))
elif "RR" in s:
print((2))
elif "R" in s:
print((1))
else:
print((0))
if __name__ == "__main__":
m... | s = eval(input())
ans = 0
for i in range(1, 4):
p = "R" * i
if p in s:
ans = i
print(ans)
| false | 60.869565 | [
"-import sys",
"-",
"-readline = sys.stdin.readline",
"-MOD = 10**9 + 7",
"-INF = float(\"INF\")",
"-sys.setrecursionlimit(10**5)",
"-",
"-",
"-def main():",
"- s = eval(input())",
"- if s == \"RRR\":",
"- print((3))",
"- elif \"RR\" in s:",
"- print((2))",
"- e... | false | 0.035779 | 0.054354 | 0.658245 | [
"s754153995",
"s275557891"
] |
u472696272 | p02860 | python | s188238553 | s548527217 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
s = eval(input())
if n%2!=0:
print('No')
else:
if s[0:int(n/2)] == s[int(n/2):n]:
print('Yes')
else:
print('No') | n = int(eval(input()))
s = list(eval(input()))
if n%2!=0: print('No')
else:
s1 = s[0:n//2]
s2 = s[n//2:n]
if s1==s2: print('Yes')
else: print('No')
| 10 | 8 | 147 | 151 | n = int(eval(input()))
s = eval(input())
if n % 2 != 0:
print("No")
else:
if s[0 : int(n / 2)] == s[int(n / 2) : n]:
print("Yes")
else:
print("No")
| n = int(eval(input()))
s = list(eval(input()))
if n % 2 != 0:
print("No")
else:
s1 = s[0 : n // 2]
s2 = s[n // 2 : n]
if s1 == s2:
print("Yes")
else:
print("No")
| false | 20 | [
"-s = eval(input())",
"+s = list(eval(input()))",
"- if s[0 : int(n / 2)] == s[int(n / 2) : n]:",
"+ s1 = s[0 : n // 2]",
"+ s2 = s[n // 2 : n]",
"+ if s1 == s2:"
] | false | 0.072599 | 0.072653 | 0.99926 | [
"s188238553",
"s548527217"
] |
u596276291 | p03472 | python | s523432641 | s234129864 | 637 | 314 | 62,808 | 12,852 | Accepted | Accepted | 50.71 | import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache,... | #!/usr/bin/python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cac... | 52 | 54 | 1,226 | 1,170 | import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache, reduce... | #!/usr/bin/python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import... | false | 3.703704 | [
"-import sys",
"+#!/usr/bin/python3",
"-from math import pi, sqrt, floor",
"+from math import pi, sqrt",
"-from functools import lru_cache, reduce",
"-from operator import xor",
"-from heapq import heappush, heappop",
"+from functools import lru_cache",
"+import sys",
"+sys.setrecursionlimit(10000... | false | 0.042008 | 0.093942 | 0.447173 | [
"s523432641",
"s234129864"
] |
u729939940 | p04001 | python | s546289815 | s637414550 | 27 | 24 | 9,104 | 8,964 | Accepted | Accepted | 11.11 | S=eval(input())
def dfs(s,i):
if i==len(S)-1:
return sum(map(int,s.split("+")))
return dfs(s+S[i+1],i+1)+dfs(s+"+"+S[i+1],i+1)
print((dfs(S[0],0))) | S=eval(input())
def dfs(s,i):
if i==len(S)-1:
return sum(map(int,s.split("+")))
return dfs(s+S[i+1],i+1)+dfs(f"{s}+{S[i+1]}",i+1)
print((dfs(S[0],0))) | 6 | 6 | 152 | 155 | S = eval(input())
def dfs(s, i):
if i == len(S) - 1:
return sum(map(int, s.split("+")))
return dfs(s + S[i + 1], i + 1) + dfs(s + "+" + S[i + 1], i + 1)
print((dfs(S[0], 0)))
| S = eval(input())
def dfs(s, i):
if i == len(S) - 1:
return sum(map(int, s.split("+")))
return dfs(s + S[i + 1], i + 1) + dfs(f"{s}+{S[i+1]}", i + 1)
print((dfs(S[0], 0)))
| false | 0 | [
"- return dfs(s + S[i + 1], i + 1) + dfs(s + \"+\" + S[i + 1], i + 1)",
"+ return dfs(s + S[i + 1], i + 1) + dfs(f\"{s}+{S[i+1]}\", i + 1)"
] | false | 0.118969 | 0.117941 | 1.008711 | [
"s546289815",
"s637414550"
] |
u644907318 | p03740 | python | s267479121 | s575187320 | 167 | 67 | 38,256 | 61,820 | Accepted | Accepted | 59.88 | X,Y = list(map(int,input().split()))
if abs(X-Y)>=2:
print("Alice")
else:
print("Brown") | X,Y = list(map(int,input().split()))
if abs(X-Y)>1:
print("Alice")
else:
print("Brown") | 5 | 5 | 94 | 89 | X, Y = list(map(int, input().split()))
if abs(X - Y) >= 2:
print("Alice")
else:
print("Brown")
| X, Y = list(map(int, input().split()))
if abs(X - Y) > 1:
print("Alice")
else:
print("Brown")
| false | 0 | [
"-if abs(X - Y) >= 2:",
"+if abs(X - Y) > 1:"
] | false | 0.041915 | 0.102519 | 0.408852 | [
"s267479121",
"s575187320"
] |
u645250356 | p03208 | python | s439358064 | s575853115 | 182 | 162 | 9,592 | 9,584 | Accepted | Accepted | 10.99 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
n,k ... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | 16 | 17 | 453 | 499 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().s... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | false | 5.882353 | [
"-import sys, bisect, math, itertools, fractions",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions, pprint"
] | false | 0.094716 | 0.07654 | 1.237474 | [
"s439358064",
"s575853115"
] |
u179169725 | p03309 | python | s427182260 | s692951467 | 514 | 211 | 31,008 | 25,884 | Accepted | Accepted | 58.95 | # https://atcoder.jp/contests/abc102/tasks/arc100_a
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
class cumsum1d:
def __init__(self, ls: list):
'''
1次元リストを受け取る
'''
from ... | # https://atcoder.jp/contests/abc102/tasks/arc100_a
# Aの数列を前処理で加工し、順番に依存しない数列Bに加工する
# abs(Bi-x)の和を最小化するxはBの中央値である。(立式しxで微分したのちKについて増減表を書いてみよ)
# それを答えとすれば良い
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
N = r... | 46 | 28 | 929 | 486 | # https://atcoder.jp/contests/abc102/tasks/arc100_a
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
class cumsum1d:
def __init__(self, ls: list):
"""
1次元リストを受け取る
"""
from itertools import ... | # https://atcoder.jp/contests/abc102/tasks/arc100_a
# Aの数列を前処理で加工し、順番に依存しない数列Bに加工する
# abs(Bi-x)の和を最小化するxはBの中央値である。(立式しxで微分したのちKについて増減表を書いてみよ)
# それを答えとすれば良い
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
N = read_a_int()
A =... | false | 39.130435 | [
"+# Aの数列を前処理で加工し、順番に依存しない数列Bに加工する",
"+# abs(Bi-x)の和を最小化するxはBの中央値である。(立式しxで微分したのちKについて増減表を書いてみよ)",
"+# それを答えとすれば良い",
"-class cumsum1d:",
"- def __init__(self, ls: list):",
"- \"\"\"",
"- 1次元リストを受け取る",
"- \"\"\"",
"- from itertools import accumulate",
"-",
"- ... | false | 0.035554 | 0.03269 | 1.087613 | [
"s427182260",
"s692951467"
] |
u340781749 | p03452 | python | s090811658 | s395166167 | 1,673 | 1,473 | 169,256 | 93,544 | Accepted | Accepted | 11.95 | import sys
sys.setrecursionlimit(100000)
def check(i, xs, checked):
xi = xs[i]
children = set()
for j, d in links[i]:
if checked[j]:
continue
if j not in xs:
xs[j] = xi + d
elif xi + d != xs[j]:
return False
children.add(j... | def check(si, xs, checked):
q = [si]
while q:
i = q.pop()
xi = xs[i]
for j, d in links[i]:
if checked[j]:
continue
if j not in xs:
xs[j] = xi + d
elif xi + d != xs[j]:
return False
... | 43 | 37 | 928 | 854 | import sys
sys.setrecursionlimit(100000)
def check(i, xs, checked):
xi = xs[i]
children = set()
for j, d in links[i]:
if checked[j]:
continue
if j not in xs:
xs[j] = xi + d
elif xi + d != xs[j]:
return False
children.add(j)
checked[i... | def check(si, xs, checked):
q = [si]
while q:
i = q.pop()
xi = xs[i]
for j, d in links[i]:
if checked[j]:
continue
if j not in xs:
xs[j] = xi + d
elif xi + d != xs[j]:
return False
q.append(j)... | false | 13.953488 | [
"-import sys",
"-",
"-sys.setrecursionlimit(100000)",
"-",
"-",
"-def check(i, xs, checked):",
"- xi = xs[i]",
"- children = set()",
"- for j, d in links[i]:",
"- if checked[j]:",
"- continue",
"- if j not in xs:",
"- xs[j] = xi + d",
"- ... | false | 0.043155 | 0.043505 | 0.991963 | [
"s090811658",
"s395166167"
] |
u941753895 | p03633 | python | s853687424 | s926076616 | 57 | 38 | 6,484 | 5,168 | Accepted | Accepted | 33.33 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
de... | import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for... | 37 | 37 | 799 | 809 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) ... | import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) for x in sys.stdin.readline().spl... | false | 0 | [
"-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy",
"+import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy",
"-def LI_():",
"- return [int(x) - 1 for x in sys.stdin.readline().split()]",
"+def LF():",
"+ retu... | false | 0.047685 | 0.088351 | 0.539724 | [
"s853687424",
"s926076616"
] |
u186838327 | p03408 | python | s670286376 | s511522508 | 176 | 82 | 38,256 | 67,020 | Accepted | Accepted | 53.41 | n = int(eval(input()))
S = {}
for i in range(n):
s = str(eval(input()))
if s not in S:
S[s] = 1
else:
S[s] += 1
m = int(eval(input()))
T = {}
for i in range(m):
t = str(eval(input()))
if t not in T:
T[t] = 1
else:
T[t] += 1
ans = 0
for k, v in l... | n = int(eval(input()))
S = [str(eval(input())) for _ in range(n)]
m = int(eval(input()))
T = [str(eval(input())) for _ in range(m)]
from collections import Counter
CS = Counter(S)
CT = Counter(T)
ans = 0
for k in list(CS.keys()):
if k not in CT:
ans = max(CS[k], ans)
else:
ans = ... | 24 | 16 | 403 | 332 | n = int(eval(input()))
S = {}
for i in range(n):
s = str(eval(input()))
if s not in S:
S[s] = 1
else:
S[s] += 1
m = int(eval(input()))
T = {}
for i in range(m):
t = str(eval(input()))
if t not in T:
T[t] = 1
else:
T[t] += 1
ans = 0
for k, v in list(S.items()):
... | n = int(eval(input()))
S = [str(eval(input())) for _ in range(n)]
m = int(eval(input()))
T = [str(eval(input())) for _ in range(m)]
from collections import Counter
CS = Counter(S)
CT = Counter(T)
ans = 0
for k in list(CS.keys()):
if k not in CT:
ans = max(CS[k], ans)
else:
ans = max(ans, max(0,... | false | 33.333333 | [
"-S = {}",
"-for i in range(n):",
"- s = str(eval(input()))",
"- if s not in S:",
"- S[s] = 1",
"+S = [str(eval(input())) for _ in range(n)]",
"+m = int(eval(input()))",
"+T = [str(eval(input())) for _ in range(m)]",
"+from collections import Counter",
"+",
"+CS = Counter(S)",
"+C... | false | 0.03415 | 0.12187 | 0.280218 | [
"s670286376",
"s511522508"
] |
u249372595 | p03061 | python | s889342895 | s850247231 | 237 | 148 | 16,144 | 20,660 | Accepted | Accepted | 37.55 | import fractions
from functools import reduce
N = int(eval(input()))
A = list(map(int,input().split()))
#累積GCD
left = [0]*(N+1)
right = [0]*(N+1)
for i in range(N):
left[i+1] = (fractions.gcd(left[i],A[i]))
right[N-i-1] = (fractions.gcd(right[N-i],A[N-1-i]))
ans = 0
for i in range(N):
ans = max(ans,... | import math
N = int(eval(input()))
A = list(map(int,input().split()))
dp_left=[0]*(N+1)
dp_right=[0]*(N+1)
for i in range(N):#左から累積GCD
dp_left[i+1]=math.gcd(dp_left[i],A[i])
dp_right[N-i-1]=math.gcd(dp_right[N-i],A[N-1-i])#右から累積GCD
ans = 0
for i in range(N):
ans = max(ans,math.gcd(dp_left[i],dp_right[... | 15 | 13 | 362 | 332 | import fractions
from functools import reduce
N = int(eval(input()))
A = list(map(int, input().split()))
# 累積GCD
left = [0] * (N + 1)
right = [0] * (N + 1)
for i in range(N):
left[i + 1] = fractions.gcd(left[i], A[i])
right[N - i - 1] = fractions.gcd(right[N - i], A[N - 1 - i])
ans = 0
for i in range(N):
a... | import math
N = int(eval(input()))
A = list(map(int, input().split()))
dp_left = [0] * (N + 1)
dp_right = [0] * (N + 1)
for i in range(N): # 左から累積GCD
dp_left[i + 1] = math.gcd(dp_left[i], A[i])
dp_right[N - i - 1] = math.gcd(dp_right[N - i], A[N - 1 - i]) # 右から累積GCD
ans = 0
for i in range(N):
ans = max(a... | false | 13.333333 | [
"-import fractions",
"-from functools import reduce",
"+import math",
"-# 累積GCD",
"-left = [0] * (N + 1)",
"-right = [0] * (N + 1)",
"-for i in range(N):",
"- left[i + 1] = fractions.gcd(left[i], A[i])",
"- right[N - i - 1] = fractions.gcd(right[N - i], A[N - 1 - i])",
"+dp_left = [0] * (N +... | false | 0.058714 | 0.042678 | 1.375724 | [
"s889342895",
"s850247231"
] |
u227020436 | p02682 | python | s070728279 | s830769896 | 23 | 21 | 9,096 | 9,152 | Accepted | Accepted | 8.7 | # B - Easy Linear Programming
a, b, c, k = list(map(int, input().split()))
if k <= a:
print(k)
elif a < k <= a + b:
print(a)
else:
print((a - (k - (a + b))))
| # B - Easy Linear Programming
a, b, c, k = list(map(int, input().split()))
print((min(k, a, a + a + b - k)))
| 9 | 4 | 171 | 105 | # B - Easy Linear Programming
a, b, c, k = list(map(int, input().split()))
if k <= a:
print(k)
elif a < k <= a + b:
print(a)
else:
print((a - (k - (a + b))))
| # B - Easy Linear Programming
a, b, c, k = list(map(int, input().split()))
print((min(k, a, a + a + b - k)))
| false | 55.555556 | [
"-if k <= a:",
"- print(k)",
"-elif a < k <= a + b:",
"- print(a)",
"-else:",
"- print((a - (k - (a + b))))",
"+print((min(k, a, a + a + b - k)))"
] | false | 0.040344 | 0.038518 | 1.047396 | [
"s070728279",
"s830769896"
] |
u983918956 | p03166 | python | s008446937 | s241892099 | 542 | 494 | 103,936 | 103,936 | Accepted | Accepted | 8.86 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N,M = list(map(int,input().split()))
ad = [[] for _ in range(N)]
for _ in range(M):
x,y = list(map(int,input().split()))
x -= 1
y -= 1
ad[y].append(x)
dp = [0]*N
def rec(v):
if dp[v] != 0:
return dp[v]
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N,M = list(map(int,input().split()))
ad = [[] for _ in range(N)]
for _ in range(M):
x,y = list(map(int,input().split()))
x -= 1
y -= 1
ad[y].append(x)
dp = [-1]*N
def rec(v):
if dp[v] != -1:
return dp[v]
... | 28 | 28 | 473 | 475 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N, M = list(map(int, input().split()))
ad = [[] for _ in range(N)]
for _ in range(M):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
ad[y].append(x)
dp = [0] * N
def rec(v):
if dp[v] != 0:
return dp[v]
res = 0
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N, M = list(map(int, input().split()))
ad = [[] for _ in range(N)]
for _ in range(M):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
ad[y].append(x)
dp = [-1] * N
def rec(v):
if dp[v] != -1:
return dp[v]
res = 0
... | false | 0 | [
"-dp = [0] * N",
"+dp = [-1] * N",
"- if dp[v] != 0:",
"+ if dp[v] != -1:"
] | false | 0.079572 | 0.04201 | 1.894145 | [
"s008446937",
"s241892099"
] |
u994988729 | p03937 | python | s318201338 | s688381677 | 274 | 17 | 20,548 | 2,940 | Accepted | Accepted | 93.8 | from collections import deque
import numpy as np
def isPossible(grid):
v = deque([[0, 0]])
while v:
x, y = v.popleft()
grid[x][y] = 0
if grid[x][y + 1]:
v.append([x, y + 1])
continue
elif grid[x + 1][y]:
v.append([x + 1, y])
... | H, W = list(map(int, input().split()))
cnt = 0
for _ in range(H):
cnt += input().count("#")
if cnt == H + W - 1:
print("Possible")
else:
print("Impossible")
| 33 | 10 | 729 | 174 | from collections import deque
import numpy as np
def isPossible(grid):
v = deque([[0, 0]])
while v:
x, y = v.popleft()
grid[x][y] = 0
if grid[x][y + 1]:
v.append([x, y + 1])
continue
elif grid[x + 1][y]:
v.append([x + 1, y])
conti... | H, W = list(map(int, input().split()))
cnt = 0
for _ in range(H):
cnt += input().count("#")
if cnt == H + W - 1:
print("Possible")
else:
print("Impossible")
| false | 69.69697 | [
"-from collections import deque",
"-import numpy as np",
"-",
"-",
"-def isPossible(grid):",
"- v = deque([[0, 0]])",
"- while v:",
"- x, y = v.popleft()",
"- grid[x][y] = 0",
"- if grid[x][y + 1]:",
"- v.append([x, y + 1])",
"- continue",
"- ... | false | 0.562469 | 0.03346 | 16.809953 | [
"s318201338",
"s688381677"
] |
u413165887 | p03610 | python | s009352089 | s030485331 | 29 | 17 | 4,268 | 3,192 | Accepted | Accepted | 41.38 | s = list(eval(input()))
print(("".join([s[i] for i in range(len(s)) if i%2==0]))) | print((input()[::2])) | 2 | 1 | 74 | 19 | s = list(eval(input()))
print(("".join([s[i] for i in range(len(s)) if i % 2 == 0])))
| print((input()[::2]))
| false | 50 | [
"-s = list(eval(input()))",
"-print((\"\".join([s[i] for i in range(len(s)) if i % 2 == 0])))",
"+print((input()[::2]))"
] | false | 0.039558 | 0.061038 | 0.648088 | [
"s009352089",
"s030485331"
] |
u438662618 | p02792 | python | s644097552 | s857732921 | 436 | 243 | 3,064 | 3,064 | Accepted | Accepted | 44.27 | n = int(eval(input()))
book = [[0] * 9 for i in range(9)]
ans = 0
for i in range(1, n+1) :
reverse = 0
tmp = i
time = 0
flag = False
end = -1
while(tmp!=0) :
remind = tmp % 10
if time == 0 :
if remind == 0 :
flag = True
... | n = int(eval(input()))
book = [[0] * 9 for i in range(9)]
ans = 0
for i in range(1, n+1) :
pre = int(str(i)[0])
end = int(str(i)[-1])
if end != 0 :
book[pre-1][end-1] += 1
for i in range(9) :
for j in range(i, 9) :
if i == j :
ans += book[i][j] * book[j][i]... | 39 | 26 | 902 | 610 | n = int(eval(input()))
book = [[0] * 9 for i in range(9)]
ans = 0
for i in range(1, n + 1):
reverse = 0
tmp = i
time = 0
flag = False
end = -1
while tmp != 0:
remind = tmp % 10
if time == 0:
if remind == 0:
flag = True
break
... | n = int(eval(input()))
book = [[0] * 9 for i in range(9)]
ans = 0
for i in range(1, n + 1):
pre = int(str(i)[0])
end = int(str(i)[-1])
if end != 0:
book[pre - 1][end - 1] += 1
for i in range(9):
for j in range(i, 9):
if i == j:
ans += book[i][j] * book[j][i]
# pri... | false | 33.333333 | [
"- reverse = 0",
"- tmp = i",
"- time = 0",
"- flag = False",
"- end = -1",
"- while tmp != 0:",
"- remind = tmp % 10",
"- if time == 0:",
"- if remind == 0:",
"- flag = True",
"- break",
"- pre = remind",
"-... | false | 0.208215 | 0.075049 | 2.774382 | [
"s644097552",
"s857732921"
] |
u044220565 | p03583 | python | s430288270 | s925121050 | 1,292 | 32 | 9,196 | 9,148 | Accepted | Accepted | 97.52 | # coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#imp... | # coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#imp... | 36 | 39 | 877 | 971 | # coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
# from heapq import heappop, heappush
# from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
# from itertools import product, accumulate, combinations, product
# import... | # coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
# from heapq import heappop, heappush
# from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
# from itertools import product, accumulate, combinations, product
# import... | false | 7.692308 | [
"- for n in range(1, 3501):",
"+ if 4 * h - N <= 0:",
"+ continue",
"+ s = math.ceil(N * h / (4 * h - N))",
"+ for n in range(s, 3501):"
] | false | 1.499808 | 0.035806 | 41.886818 | [
"s430288270",
"s925121050"
] |
u341543478 | p03160 | python | s660845225 | s167615575 | 153 | 119 | 20,620 | 20,644 | Accepted | Accepted | 22.22 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float('inf')] * n
dp[0] = 0
for i in range(n - 1):
if i <= n - 3:
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))
elif i == n - 2:
dp[i + 1] = min... | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0, abs(h[0] - h[1])]
for i in range(2, n):
dp.append(min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i])))
print((dp[-1]))
| 13 | 6 | 373 | 208 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(n - 1):
if i <= n - 3:
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))
elif i == n - 2:
dp[i + 1] = min(dp[i + 1],... | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0, abs(h[0] - h[1])]
for i in range(2, n):
dp.append(min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i])))
print((dp[-1]))
| false | 53.846154 | [
"-dp = [float(\"inf\")] * n",
"-dp[0] = 0",
"-for i in range(n - 1):",
"- if i <= n - 3:",
"- dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))",
"- dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))",
"- elif i == n - 2:",
"- dp[i + 1] = min(dp[i + 1], dp[i] + ... | false | 0.155903 | 0.131152 | 1.188719 | [
"s660845225",
"s167615575"
] |
u669812251 | p02774 | python | s443078791 | s059254622 | 1,117 | 560 | 32,276 | 89,684 | Accepted | Accepted | 49.87 | # -*- coding: utf-8 -*-
#尺取り法
import numpy as np
n, k = list(map(int,input().split()))
a = np.array(list(map(int,input().split())))
a.sort()
posi = a[a>0]
zero = a[a==0]
nega = a[a<0]
#print(posi)
# 2分探索, midより小さいものを数える
l = -10**18-1
r = 10**18+1
while r-l > 1:
mid = (r+l)//2
cnt = 0
if mi... | from bisect import bisect_left, bisect_right
def main():
N, K = [int(i) for i in input().split()]
A = sorted(list(map(int, input().split())))
nega_end = bisect_left(A, 0)
posi_start = bisect_right(A, 0)
posi_cnt = N - posi_start
nega_cnt = nega_end
zero_cnt = N - (posi_cnt + ... | 40 | 65 | 1,093 | 1,850 | # -*- coding: utf-8 -*-
# 尺取り法
import numpy as np
n, k = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
a.sort()
posi = a[a > 0]
zero = a[a == 0]
nega = a[a < 0]
# print(posi)
# 2分探索, midより小さいものを数える
l = -(10**18) - 1
r = 10**18 + 1
while r - l > 1:
mid = (r + l) // 2
cnt = 0
... | from bisect import bisect_left, bisect_right
def main():
N, K = [int(i) for i in input().split()]
A = sorted(list(map(int, input().split())))
nega_end = bisect_left(A, 0)
posi_start = bisect_right(A, 0)
posi_cnt = N - posi_start
nega_cnt = nega_end
zero_cnt = N - (posi_cnt + nega_cnt)
... | false | 38.461538 | [
"-# -*- coding: utf-8 -*-",
"-# 尺取り法",
"-import numpy as np",
"+from bisect import bisect_left, bisect_right",
"-n, k = list(map(int, input().split()))",
"-a = np.array(list(map(int, input().split())))",
"-a.sort()",
"-posi = a[a > 0]",
"-zero = a[a == 0]",
"-nega = a[a < 0]",
"-# print(posi)",
... | false | 0.217082 | 0.041211 | 5.26752 | [
"s443078791",
"s059254622"
] |
u691018832 | p02682 | python | s204849577 | s842322036 | 64 | 21 | 61,816 | 9,168 | Accepted | Accepted | 67.19 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
a, b, c, k = list(map(int, readline().split()))
if a + b >= k:
print((min(a, k)))
else:
print((a - (k - a - b)))
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
a, b, c, k = list(map(int, read().split()))
print((min(a, k) if a + b >= k else 2 * a + b - k))
| 11 | 8 | 269 | 243 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
a, b, c, k = list(map(int, readline().split()))
if a + b >= k:
print((min(a, k)))
else:
print((a - (k - a - b)))
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
a, b, c, k = list(map(int, read().split()))
print((min(a, k) if a + b >= k else 2 * a + b - k))
| false | 27.272727 | [
"-a, b, c, k = list(map(int, readline().split()))",
"-if a + b >= k:",
"- print((min(a, k)))",
"-else:",
"- print((a - (k - a - b)))",
"+a, b, c, k = list(map(int, read().split()))",
"+print((min(a, k) if a + b >= k else 2 * a + b - k))"
] | false | 0.037425 | 0.037799 | 0.990106 | [
"s204849577",
"s842322036"
] |
u296150111 | p03283 | python | s895996951 | s894700503 | 1,258 | 727 | 58,332 | 13,568 | Accepted | Accepted | 42.21 | import sys
input=sys.stdin.readline
n,m,q=list(map(int,input().split()))
num=[[0]*(n+1) for _ in range(n+1)]
for i in range(m):
l,r=list(map(int,input().split()))
num[l][r]+=1
for i in range(n):
for j in range(n):
num[i+1][j+1]+=num[i+1][j]
for i in range(q):
p,q=list(map(int,input().split()))
ans=0
... | import sys
input=sys.stdin.readline
n,m,q=list(map(int,input().split()))
num=[[0]*(n+1) for _ in range(n+1)]
for i in range(m):
l,r=list(map(int,input().split()))
num[l][r]+=1
for i in range(n):
for j in range(n):
num[i+1][j+1]+=num[i+1][j]
for i in range(n):
for j in range(n):
num[i+1][j+1]+=num[i]... | 18 | 19 | 374 | 436 | import sys
input = sys.stdin.readline
n, m, q = list(map(int, input().split()))
num = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(m):
l, r = list(map(int, input().split()))
num[l][r] += 1
for i in range(n):
for j in range(n):
num[i + 1][j + 1] += num[i + 1][j]
for i in range(q):
p, q =... | import sys
input = sys.stdin.readline
n, m, q = list(map(int, input().split()))
num = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(m):
l, r = list(map(int, input().split()))
num[l][r] += 1
for i in range(n):
for j in range(n):
num[i + 1][j + 1] += num[i + 1][j]
for i in range(n):
for j ... | false | 5.263158 | [
"+for i in range(n):",
"+ for j in range(n):",
"+ num[i + 1][j + 1] += num[i][j + 1]",
"- ans = 0",
"- for i in range(p, q + 1):",
"- ans += num[i][q] - num[i][p - 1]",
"+ ans = num[q][q] + num[p - 1][p - 1] - num[p - 1][q] - num[q][p - 1]"
] | false | 0.037638 | 0.037204 | 1.011666 | [
"s895996951",
"s894700503"
] |
u682467216 | p02936 | python | s133520958 | s283607958 | 1,375 | 1,142 | 223,348 | 252,620 | Accepted | Accepted | 16.95 | import sys
sys.setrecursionlimit(10**7)
N, Q = list(map(int, input().split()))
root = [[] for _ in range(N)]
ans = [0]*N
for _ in range(N-1):
a,b=list(map(int, input().split()))
a,b=a-1,b-1
root[a].append(b)
root[b].append(a)
for _ in range(Q):
p,x=list(map(int, input().split()))
ans[p-1... | from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
import copy
import... | 28 | 111 | 482 | 1,837 | import sys
sys.setrecursionlimit(10**7)
N, Q = list(map(int, input().split()))
root = [[] for _ in range(N)]
ans = [0] * N
for _ in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
root[a].append(b)
root[b].append(a)
for _ in range(Q):
p, x = list(map(int, input().split()))
... | from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import (
accumulate,
permutations,
combinations,
product,
combinations_with_replacement,
)
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop... | false | 74.774775 | [
"+from math import floor, ceil, sqrt, factorial, log, gcd",
"+from itertools import (",
"+ accumulate,",
"+ permutations,",
"+ combinations,",
"+ product,",
"+ combinations_with_replacement,",
"+)",
"+from bisect import bisect_left, bisect_right",
"+from collections import Counter, ... | false | 0.039941 | 0.110031 | 0.362999 | [
"s133520958",
"s283607958"
] |
u600402037 | p02891 | python | s795243305 | s286598611 | 19 | 17 | 3,188 | 3,064 | Accepted | Accepted | 10.53 | S = list(eval(input()))
K = int(eval(input()))
S2 = S[:]
if len(S) == 1:
print((K//2))
exit()
cons = 0
for i in range(len(S)-1):
if S[i] == S[i+1]:
cons += 1
S[i+1] = '_'
if K == 1:
print(cons)
exit()
if S[0] != S[-1]:
print((cons * K))
exit()
cons3 = 0
if... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = list(sr())
K = ir()
def count(s):
t = s.copy()
cur = ''
ret = 0
for i in range(len(t)):
if t[i] == cur:
t[i] = '_'
ret += 1
... | 42 | 31 | 776 | 536 | S = list(eval(input()))
K = int(eval(input()))
S2 = S[:]
if len(S) == 1:
print((K // 2))
exit()
cons = 0
for i in range(len(S) - 1):
if S[i] == S[i + 1]:
cons += 1
S[i + 1] = "_"
if K == 1:
print(cons)
exit()
if S[0] != S[-1]:
print((cons * K))
exit()
cons3 = 0
if len(set(S2)... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = list(sr())
K = ir()
def count(s):
t = s.copy()
cur = ""
ret = 0
for i in range(len(t)):
if t[i] == cur:
t[i] = "_"
ret += 1
cur = t[i]
... | false | 26.190476 | [
"-S = list(eval(input()))",
"-K = int(eval(input()))",
"-S2 = S[:]",
"-if len(S) == 1:",
"- print((K // 2))",
"- exit()",
"-cons = 0",
"-for i in range(len(S) - 1):",
"- if S[i] == S[i + 1]:",
"- cons += 1",
"- S[i + 1] = \"_\"",
"-if K == 1:",
"- print(cons)",
"-... | false | 0.070423 | 0.055953 | 1.258598 | [
"s795243305",
"s286598611"
] |
u891635666 | p03087 | python | s468911530 | s956157701 | 579 | 335 | 32,292 | 6,436 | Accepted | Accepted | 42.14 | import bisect
n, q = list(map(int, input().split()))
s = input().strip()
lrs = [list(map(int, input().split())) for _ in range(q)]
indices = []
for i, (c0, c1) in enumerate(zip(s, s[1:])):
if c0 == 'A' and c1 == 'C':
indices.append(i)
indices_c = [i + 1 for i in indices]
for (l, r) in lrs:
... | import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)... | 16 | 24 | 419 | 602 | import bisect
n, q = list(map(int, input().split()))
s = input().strip()
lrs = [list(map(int, input().split())) for _ in range(q)]
indices = []
for i, (c0, c1) in enumerate(zip(s, s[1:])):
if c0 == "A" and c1 == "C":
indices.append(i)
indices_c = [i + 1 for i in indices]
for (l, r) in lrs:
li = bisect.... | import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = la... | false | 33.333333 | [
"-import bisect",
"+import sys",
"-n, q = list(map(int, input().split()))",
"-s = input().strip()",
"-lrs = [list(map(int, input().split())) for _ in range(q)]",
"-indices = []",
"-for i, (c0, c1) in enumerate(zip(s, s[1:])):",
"- if c0 == \"A\" and c1 == \"C\":",
"- indices.append(i)",
... | false | 0.045848 | 0.096346 | 0.475871 | [
"s468911530",
"s956157701"
] |
u912237403 | p00084 | python | s013790127 | s556548040 | 20 | 10 | 4,192 | 4,200 | Accepted | Accepted | 50 | s=" "
x=input().replace(",",s).replace(".",s).split()
print(s.join([w for w in x if 2<len(w)<7])) | s=" "
x=input().replace(",",s).replace(".",s).split()
x=s.join([w for w in x if 2<len(w)<7])
print(x) | 3 | 4 | 102 | 107 | s = " "
x = input().replace(",", s).replace(".", s).split()
print(s.join([w for w in x if 2 < len(w) < 7]))
| s = " "
x = input().replace(",", s).replace(".", s).split()
x = s.join([w for w in x if 2 < len(w) < 7])
print(x)
| false | 25 | [
"-print(s.join([w for w in x if 2 < len(w) < 7]))",
"+x = s.join([w for w in x if 2 < len(w) < 7])",
"+print(x)"
] | false | 0.036622 | 0.035827 | 1.02221 | [
"s013790127",
"s556548040"
] |
u133936772 | p02898 | python | s833860301 | s513315336 | 52 | 43 | 11,908 | 9,988 | Accepted | Accepted | 17.31 | n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
ans = 0
for i in range(n):
if l[i] >= k:
ans += 1
print(ans) | _, k = list(map(int, input().split()))
l = list(map(int, input().split()))
print((sum(1 for i in l if i>=k))) | 10 | 4 | 147 | 99 | n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
ans = 0
for i in range(n):
if l[i] >= k:
ans += 1
print(ans)
| _, k = list(map(int, input().split()))
l = list(map(int, input().split()))
print((sum(1 for i in l if i >= k)))
| false | 60 | [
"-n, k = list(map(int, input().split()))",
"+_, k = list(map(int, input().split()))",
"-ans = 0",
"-for i in range(n):",
"- if l[i] >= k:",
"- ans += 1",
"-print(ans)",
"+print((sum(1 for i in l if i >= k)))"
] | false | 0.043486 | 0.044225 | 0.983288 | [
"s833860301",
"s513315336"
] |
u830054172 | p03087 | python | s962360887 | s197409244 | 903 | 300 | 9,540 | 7,872 | Accepted | Accepted | 66.78 | N, Q = list(map(int, input().split()))
S = eval(input())
t = [0] * (N+1)
for i in range(N):
t[i+1] = t[i]+(1 if S[i:i+2] == "AC" else 0)
for i in range(Q):
l, r = list(map(int, input().split()))
print((t[r-1]-t[l-1])) | import sys
import math
N, Q = list(map(int, input().split()))
S = eval(input())
a = [0 for _ in range(N)]
for i in range(1, N):
if S[i-1]+S[i] == "AC":
a[i] += 1 + a[i-1]
else:
a[i] += a[i-1]
for _ in range(Q):
l, r = list(map(int, sys.stdin.readline().strip().split()))
... | 8 | 16 | 216 | 326 | N, Q = list(map(int, input().split()))
S = eval(input())
t = [0] * (N + 1)
for i in range(N):
t[i + 1] = t[i] + (1 if S[i : i + 2] == "AC" else 0)
for i in range(Q):
l, r = list(map(int, input().split()))
print((t[r - 1] - t[l - 1]))
| import sys
import math
N, Q = list(map(int, input().split()))
S = eval(input())
a = [0 for _ in range(N)]
for i in range(1, N):
if S[i - 1] + S[i] == "AC":
a[i] += 1 + a[i - 1]
else:
a[i] += a[i - 1]
for _ in range(Q):
l, r = list(map(int, sys.stdin.readline().strip().split()))
print((a... | false | 50 | [
"+import sys",
"+import math",
"+",
"-t = [0] * (N + 1)",
"-for i in range(N):",
"- t[i + 1] = t[i] + (1 if S[i : i + 2] == \"AC\" else 0)",
"-for i in range(Q):",
"- l, r = list(map(int, input().split()))",
"- print((t[r - 1] - t[l - 1]))",
"+a = [0 for _ in range(N)]",
"+for i in rang... | false | 0.05327 | 0.063297 | 0.841595 | [
"s962360887",
"s197409244"
] |
u210827208 | p02936 | python | s743964402 | s646661383 | 1,830 | 1,433 | 105,364 | 223,188 | Accepted | Accepted | 21.69 | from collections import deque
n,q=list(map(int,input().split()))
g=[[] for _ in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
g[a-1].append(b-1)
g[b-1].append(a-1)
c=[0]*n
for j in range(q):
p,x=list(map(int,input().split()))
c[p-1]+=x
used=[0]*n
used[0]... | import sys
sys.setrecursionlimit(10**6)
n, q = list(map(int, input().split()))
g = [[] for _ in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
c = [0] * n
for j in range(q):
p, x = list(map(int, input().split()))
... | 34 | 29 | 523 | 519 | from collections import deque
n, q = list(map(int, input().split()))
g = [[] for _ in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
c = [0] * n
for j in range(q):
p, x = list(map(int, input().split()))
c[p - 1] += x
used = [0] ... | import sys
sys.setrecursionlimit(10**6)
n, q = list(map(int, input().split()))
g = [[] for _ in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
c = [0] * n
for j in range(q):
p, x = list(map(int, input().split()))
c[p - 1] += x
u... | false | 14.705882 | [
"-from collections import deque",
"+import sys",
"+sys.setrecursionlimit(10**6)",
"-next = deque([0])",
"-while next:",
"- v = next.popleft()",
"- cost = c[v]",
"- for nv in g[v]:",
"- if used[nv]:",
"+",
"+",
"+def dfs(x):",
"+ cost = c[x]",
"+ for nx in g[x]:",
"+... | false | 0.048508 | 0.049055 | 0.988854 | [
"s743964402",
"s646661383"
] |
u489959379 | p03062 | python | s112515487 | s091316306 | 80 | 67 | 14,412 | 20,144 | Accepted | Accepted | 16.25 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
b = []
for i in range(n):
if a[i] < 0:
cnt += 1
b.append(abs(a[i]))
if cnt % 2 == 0:
ans = sum(b)
print(ans)
else:
ans = sum(b) - 2 * min(b)
print(ans)
| import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
total = 0
mi = f_inf
for a in A:
total += abs(a)
if a < 0:
... | 16 | 30 | 262 | 511 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
b = []
for i in range(n):
if a[i] < 0:
cnt += 1
b.append(abs(a[i]))
if cnt % 2 == 0:
ans = sum(b)
print(ans)
else:
ans = sum(b) - 2 * min(b)
print(ans)
| import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
total = 0
mi = f_inf
for a in A:
total += abs(a)
if a < 0:
cnt += 1
if ... | false | 46.666667 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-cnt = 0",
"-b = []",
"-for i in range(n):",
"- if a[i] < 0:",
"- cnt += 1",
"- b.append(abs(a[i]))",
"-if cnt % 2 == 0:",
"- ans = sum(b)",
"- print(ans)",
"-else:",
"- ans = sum(b) - 2 * min(b)",
"-... | false | 0.085468 | 0.04608 | 1.854781 | [
"s112515487",
"s091316306"
] |
u923668099 | p02265 | python | s296555729 | s809667862 | 4,660 | 2,350 | 71,868 | 71,912 | Accepted | Accepted | 49.57 |
from collections import deque
n = int(eval(input()))
linked_list = deque([])
for i in range(n):
line = input().split()
cmd = line[0]
if len(line) == 2:
value = line[1]
if cmd == "insert":
linked_list.appendleft(value)
elif cmd == "delete":
if value in lin... |
import sys
from collections import deque
n = int(sys.stdin.readline())
linked_list = deque([])
for i in range(n):
line = sys.stdin.readline().split()
cmd = line[0]
if len(line) == 2:
value = line[1]
if cmd == "insert":
linked_list.appendleft(value)
elif cmd == "d... | 24 | 25 | 506 | 544 | from collections import deque
n = int(eval(input()))
linked_list = deque([])
for i in range(n):
line = input().split()
cmd = line[0]
if len(line) == 2:
value = line[1]
if cmd == "insert":
linked_list.appendleft(value)
elif cmd == "delete":
if value in linked_list:
... | import sys
from collections import deque
n = int(sys.stdin.readline())
linked_list = deque([])
for i in range(n):
line = sys.stdin.readline().split()
cmd = line[0]
if len(line) == 2:
value = line[1]
if cmd == "insert":
linked_list.appendleft(value)
elif cmd == "delete":
if v... | false | 4 | [
"+import sys",
"-n = int(eval(input()))",
"+n = int(sys.stdin.readline())",
"- line = input().split()",
"+ line = sys.stdin.readline().split()"
] | false | 0.088851 | 0.087451 | 1.016016 | [
"s296555729",
"s809667862"
] |
u310381103 | p03434 | python | s190935920 | s204280934 | 32 | 28 | 9,112 | 9,108 | Accepted | Accepted | 12.5 | n=int(eval(input()))
a=sorted(list(map(int,input().split())),reverse=True)
ans=0
for i in range(n):
if i%2==0:
ans+=a[i]
else:
ans-=a[i]
print(ans) | N=eval(input())
a=list(map(int,input().split()))
alice=0
bob=0
a=sorted(a,reverse=True)
for i in range(int(N)):
if i%2==0:
alice+=a[i]
else:
bob+=a[i]
print((alice-bob)) | 9 | 11 | 161 | 195 | n = int(eval(input()))
a = sorted(list(map(int, input().split())), reverse=True)
ans = 0
for i in range(n):
if i % 2 == 0:
ans += a[i]
else:
ans -= a[i]
print(ans)
| N = eval(input())
a = list(map(int, input().split()))
alice = 0
bob = 0
a = sorted(a, reverse=True)
for i in range(int(N)):
if i % 2 == 0:
alice += a[i]
else:
bob += a[i]
print((alice - bob))
| false | 18.181818 | [
"-n = int(eval(input()))",
"-a = sorted(list(map(int, input().split())), reverse=True)",
"-ans = 0",
"-for i in range(n):",
"+N = eval(input())",
"+a = list(map(int, input().split()))",
"+alice = 0",
"+bob = 0",
"+a = sorted(a, reverse=True)",
"+for i in range(int(N)):",
"- ans += a[i]",
... | false | 0.039995 | 0.036792 | 1.087082 | [
"s190935920",
"s204280934"
] |
u367130284 | p03449 | python | s311738027 | s685873770 | 20 | 18 | 3,060 | 2,940 | Accepted | Accepted | 10 | n=int(eval(input()));a=[list(map(int,input().split()))for i in[1]*2]
print((max(sum(a[0][:s+1]+a[1][s:])for s in range(n)))) | n,*a=list(map(int,open(0).read().split()));print((max(sum(a[:i+1]+a[n+i:])for i in range(n)))) | 2 | 1 | 117 | 86 | n = int(eval(input()))
a = [list(map(int, input().split())) for i in [1] * 2]
print((max(sum(a[0][: s + 1] + a[1][s:]) for s in range(n))))
| n, *a = list(map(int, open(0).read().split()))
print((max(sum(a[: i + 1] + a[n + i :]) for i in range(n))))
| false | 50 | [
"-n = int(eval(input()))",
"-a = [list(map(int, input().split())) for i in [1] * 2]",
"-print((max(sum(a[0][: s + 1] + a[1][s:]) for s in range(n))))",
"+n, *a = list(map(int, open(0).read().split()))",
"+print((max(sum(a[: i + 1] + a[n + i :]) for i in range(n))))"
] | false | 0.037579 | 0.034691 | 1.083261 | [
"s311738027",
"s685873770"
] |
u150984829 | p02386 | python | s798215108 | s549344524 | 80 | 70 | 5,616 | 5,608 | Accepted | Accepted | 12.5 | n=int(eval(input()))
a=[list(map(int,input().split()))for _ in range(n)]
for k in range(n):
b=a[k];b[3],b[4]=b[4],b[3]
t=0
for i in range(n-1):
if t==1:break
d=a[i]
for j in range(i+1,n):
if t==1:break
e=a[j]
for p in('012345','152043','215304','302541','410352','514320'):
if t==1:break
f=[... | n=int(eval(input()))
a=[list(map(int,input().split()))for _ in range(n)]
for k in range(n):
b=a[k];b[3],b[4]=b[4],b[3]
def f():
for i in range(n-1):
d=a[i]
for j in range(i+1,n):
e=a[j]
for p in('012345','152043','215304','302541','410352','514320'):
f=[d[int(k)]for k in p]
if f[0]==e[0]a... | 19 | 17 | 468 | 444 | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
for k in range(n):
b = a[k]
b[3], b[4] = b[4], b[3]
t = 0
for i in range(n - 1):
if t == 1:
break
d = a[i]
for j in range(i + 1, n):
if t == 1:
break
e = a[j]
for p in ("012345"... | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
for k in range(n):
b = a[k]
b[3], b[4] = b[4], b[3]
def f():
for i in range(n - 1):
d = a[i]
for j in range(i + 1, n):
e = a[j]
for p in ("012345", "152043", "215304", "302541", "410352",... | false | 10.526316 | [
"-t = 0",
"-for i in range(n - 1):",
"- if t == 1:",
"- break",
"- d = a[i]",
"- for j in range(i + 1, n):",
"- if t == 1:",
"- break",
"- e = a[j]",
"- for p in (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):",
"- ... | false | 0.067674 | 0.041361 | 1.636181 | [
"s798215108",
"s549344524"
] |
u703950586 | p03295 | python | s017921576 | s855575677 | 386 | 325 | 55,596 | 53,424 | Accepted | Accepted | 15.8 | import sys,queue,math,copy,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N,M = LI()
island = [0 for _ in range(N)]
req = [[] for _ in range(N)]
for _ in range(M)... | import sys
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
N,M = LI()
island = [0 for _ in range(N)]
req = [[] for _ in range(N)]
for _ in range(M):
a,b = LI()
req[a-1].append(b-1)
p = 1
ans = 0
for i in range(N):
if island[i] > p:
ans += 1
p = island[i]
fo... | 25 | 19 | 530 | 371 | import sys, queue, math, copy, itertools, bisect, collections, heapq
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())
N, M = LI()
island = [0 for _ in range(N)]
req = [[] for _ in range(N)]
for _ in range(M):
... | import sys
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
N, M = LI()
island = [0 for _ in range(N)]
req = [[] for _ in range(N)]
for _ in range(M):
a, b = LI()
req[a - 1].append(b - 1)
p = 1
ans = 0
for i in range(N):
if island[i] > p:
ans += 1
p = island[i]
for b in req[i... | false | 24 | [
"-import sys, queue, math, copy, itertools, bisect, collections, heapq",
"+import sys",
"-sys.setrecursionlimit(10**7)",
"-INF = 10**18",
"-MOD = 10**9 + 7",
"-NI = lambda: int(sys.stdin.readline())"
] | false | 0.04047 | 0.040997 | 0.987161 | [
"s017921576",
"s855575677"
] |
u506910932 | p03060 | python | s991049479 | s356966745 | 568 | 17 | 2,940 | 2,940 | Accepted | Accepted | 97.01 | def dfs(now,val,cost):
if now == n:
return val - cost
else:
return max(dfs(now+1,val+v[now],cost+c[now]),dfs(now+1,val,cost))
n = int(eval(input()))
v = list(map(int,input().split()))
c = list(map(int,input().split()))
print((dfs(0,0,0)))
| # def dfs(now,val,cost):
# if now == n:
# return val - cost
# else:
# return max(dfs(now+1,val+v[now],cost+c[now]),dfs(now+1,val,cost))
n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
# print(dfs(0,0,0))
ans = 0
for i in range(n):
... | 11 | 17 | 267 | 382 | def dfs(now, val, cost):
if now == n:
return val - cost
else:
return max(dfs(now + 1, val + v[now], cost + c[now]), dfs(now + 1, val, cost))
n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
print((dfs(0, 0, 0)))
| # def dfs(now,val,cost):
# if now == n:
# return val - cost
# else:
# return max(dfs(now+1,val+v[now],cost+c[now]),dfs(now+1,val,cost))
n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
# print(dfs(0,0,0))
ans = 0
for i in range(n):
tmp = v[i] - c... | false | 35.294118 | [
"-def dfs(now, val, cost):",
"- if now == n:",
"- return val - cost",
"- else:",
"- return max(dfs(now + 1, val + v[now], cost + c[now]), dfs(now + 1, val, cost))",
"-",
"-",
"+# def dfs(now,val,cost):",
"+# if now == n:",
"+# return val - cost",
"+# else:",
... | false | 0.096716 | 0.036274 | 2.666303 | [
"s991049479",
"s356966745"
] |
u992910889 | p03162 | python | s125988117 | s764130041 | 630 | 407 | 61,528 | 72,156 | Accepted | Accepted | 35.4 | # import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
n=int(eval(input()))
[A,B,C]=[[0]*n for _ in range(3)]
... | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
# https://qiita.com/drken/items/dc53c683d6de8aeacf5a#dp-%E5%AE%9F%E8%A3%85%E3%81%AE%E9%A0%86%E5%BA%8F
INF = 10**10 # INF+INFを計算してもオーバーフローしない範囲で大きく
N = int(eval(inpu... | 29 | 50 | 691 | 1,361 | # import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
n = int(eval(input()))
[A, B, C] = [[0] * n for _ in range(3)]
for i... | import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
# https://qiita.com/drken/items/dc53c683d6de8aeacf5a#dp-%E5%AE%9F%E8%A3%85%E3%81%AE%E9%A0%86%E5%BA%8F
INF = 10**10 # INF+INFを計算してもオーバーフローしない範囲で大きく
N = int(eval(input()))
L = [list(map(i... | false | 42 | [
"-# import bisect",
"-# import copy",
"-# import fractions",
"-# import math",
"-# import numpy as np",
"-# from collections import Counter, deque",
"-# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product",
"+import sys",
"+",
"+sys.setrecursionlimit(1... | false | 0.113856 | 0.042452 | 2.68197 | [
"s125988117",
"s764130041"
] |
u493520238 | p02726 | python | s284561754 | s012924803 | 1,930 | 1,430 | 3,444 | 3,444 | Accepted | Accepted | 25.91 | n, x, y = list(map(int, input().split()))
ans = [0] * n
for i in range(1,n):
for j in range(i+1, n+1):
r1 = j-i
r2 = abs(x-i) + 1 + abs(j-y)
r3 = abs(y-i) + 1 + abs(j-x)
ans[min(r1,r2,r3)] += 1
for i in range(1,n):
print((ans[i])) | def main():
n, x, y = list(map(int, input().split()))
ans = [0] * n
for i in range(1,n):
for j in range(i+1, n+1):
r1 = j-i
r2 = abs(x-i) + 1 + abs(j-y)
r3 = abs(y-i) + 1 + abs(j-x)
ans[min(r1,r2,r3)] += 1
for i in range(1,n):
... | 12 | 16 | 276 | 371 | n, x, y = list(map(int, input().split()))
ans = [0] * n
for i in range(1, n):
for j in range(i + 1, n + 1):
r1 = j - i
r2 = abs(x - i) + 1 + abs(j - y)
r3 = abs(y - i) + 1 + abs(j - x)
ans[min(r1, r2, r3)] += 1
for i in range(1, n):
print((ans[i]))
| def main():
n, x, y = list(map(int, input().split()))
ans = [0] * n
for i in range(1, n):
for j in range(i + 1, n + 1):
r1 = j - i
r2 = abs(x - i) + 1 + abs(j - y)
r3 = abs(y - i) + 1 + abs(j - x)
ans[min(r1, r2, r3)] += 1
for i in range(1, n):
... | false | 25 | [
"-n, x, y = list(map(int, input().split()))",
"-ans = [0] * n",
"-for i in range(1, n):",
"- for j in range(i + 1, n + 1):",
"- r1 = j - i",
"- r2 = abs(x - i) + 1 + abs(j - y)",
"- r3 = abs(y - i) + 1 + abs(j - x)",
"- ans[min(r1, r2, r3)] += 1",
"-for i in range(1, n... | false | 0.037816 | 0.042616 | 0.887356 | [
"s284561754",
"s012924803"
] |
u550146922 | p02659 | python | s875346364 | s509446318 | 42 | 30 | 10,372 | 10,060 | Accepted | Accepted | 28.57 | from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print((floor(a * b))) | from math import floor
from decimal import Decimal
a, b = input().split()
a = int(a)
b = Decimal(b)
print((floor(a * b))) | 6 | 6 | 128 | 124 | from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print((floor(a * b)))
| from math import floor
from decimal import Decimal
a, b = input().split()
a = int(a)
b = Decimal(b)
print((floor(a * b)))
| false | 0 | [
"-from fractions import Fraction",
"+from decimal import Decimal",
"-b = Fraction(b)",
"+b = Decimal(b)"
] | false | 0.045719 | 0.043815 | 1.04345 | [
"s875346364",
"s509446318"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.