Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03776 (python)

Fixed submission:
from math import factorial

n, a, b = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)

n1 = v.count(v[a - 1])
n2 = v[:a].count(v[:a][a - 1])

print(sum(v[:a]) / a)
if len(set(v[:a])) != 1:
	if n1 == n2:
		print(1)
	else:
		print(int(factorial(n1) / (factorial(n2) * factorial(n1 - n2))))
else:
	ans = 0
	if n1 == 1:
		print(1)
	else:
		for i in range(a, min(n1 + 1, b + 1)):
			ans += int(factorial(n1) / (factorial(i) * factorial(n1 - i)))
		print(int(ans))

Buggy submission (verdict: Runtime Error):
from math import factorial

n, a, b = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)

n1 = v.count(v[a - 1])
n2 = v[:a].count(v[:a][a - 1])

print(sum(v[:a]) / a)
if len(set(v[:a])) != 1:
	if n1 == n2:
		print(1)
	else:
		print(int(factorial(n1) / (factorial(n2) * factorial(n1 - n2))))
else:
	ans = 0
	if n1 == 1:
		print(1)
	else:
		for i in range(a, min(n1, b + 1)):
			if 
			ans += int(factorial(n1) / (factorial(i) * factorial(n1 - i)))
		print(int(ans))

Buggy submission (verdict: Runtime Error):
from math import factorial

n, a, b = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)

n1 = v.count(v[a - 1])
n2 = v[:a].count(v[:a][a - 1])

print(sum(v[:a]) / a)
if len(set(v[:a])) != 1:
	if n1 == n2:
		print(1)
	else:
		print(int(factorial(n1) / (factorial(n2) * factorial(n1 - n2))))
else:
	ans = 0
	if n1 == 1:
		print(1)
	else:
		for i in range(a, b + 1):
			ans += int(factorial(n1) / (factorial(i) * factorial(n1 - i)))
		print(int(ans))

Buggy submission (verdict: Runtime Error):
from math import factorial

n, a, b = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)

n1 = v.count(v[a - 1])
n2 = v[:a].count(v[:a][a - 1])

print(sum(v[:a]) / a)
if len(set(v[:a])) != 1:
	print(int(factorial(n1) / (factorial(n2) * factorial(n1 - n2))))
else:
	ans = 0
	for i in range(a, b + 1):
		ans += int(factorial(n1) / (factorial(i) * factorial(n1 - i)))
	print(int(ans))

Buggy submission (verdict: Runtime Error):
from fractions import factorial

n, a, b = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)

n1 = v.count(v[a - 1])
n2 = v[:a].count(v[:a][a - 1])

print(sum(v[:a]) / a)
if len(set(v[:a])) != 1:
	print(int(factorial(n1) / (factorial(n2) * factorial(n1 - n2))))
else:
	ans = 0
	for i in range(a, b + 1):
		ans += int(factorial(n1) / (factorial(i) * factorial(n1 - i)))
	print(int(ans))

Buggy submission (verdict: Runtime Error):
import math

n, a, b = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)

n1 = v.count(v[a - 1])
n2 = v[:a].count(v[:a][a - 1])

print(sum(v[:a]) / a)
if len(set(v[:a])) != 1:
	print(int(math.factorial(n1) / (math.factorial(n2) * math.factorial(n1 - n2))))
else:
	ans = 0
	for i in range(a, b + 1):
		ans += int(math.factorial(n1) / (math.factorial(i) * math.factorial(n1 - i)))
	print(ans)
Problem p02659 (python)

Fixed submission:
import math

A, B = map(float, input().split())
a=int(A)
b = round(B * 100)
x =  a*b //100

print(math.floor(x))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(float, input().split())
a=int(A)
x = a*B 
y = math.round(x)
print(int(y))
Problem p02552 (python)

Fixed submission:
X = input()
if X == "1":
    print("0")
else:
    print("1")

Buggy submission (verdict: Runtime Error):
x = input()
if X == "1":
    print("0")
else:
    print("1")
Problem p02627 (python)

Fixed submission:
word = input()
A = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
if word in A:
    print("A")
else:
    print("a")

Buggy submission (verdict: Runtime Error):
N = input()
A = [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]
if N in A:
    print("A")
else:
    print("a")
Problem p02682 (python)

Fixed submission:
a = list(map(int,input().split()))
A = a[0]
B = a[1]
C = a[2]
K = a[3]
if A > K :
    print(K)
elif (A + B) > K:
    print(A)
else:
    print(A-(K-A-B))

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
A = a[0]
B = a[1]
C = a[2]
K = a[3]
if A > k :
    print(A)
elif (A + B) > K:
    print(A)
else:
    print(A-(K-A-B))
Problem p02549 (python)

Fixed submission:
mod = 998244353

# 貰うDP
def main(N, S):
    dp = [0 if n != 0 else 1 for n in range(N)]     # dp[i]はマスiに行く通り数． (答えはdp[-1]), dp[0] = 1 (最初にいる場所だから1通り)
    A = [0 if n != 0 else 1 for n in range(N)]      # dp[i] = A[i] - A[i-1] (i >= 1), A[0] = dp[0] = 1 (i = 0) が成り立つような配列を考える．

    for i in range(1, N):   # 今いる点 (注目点)
        for l, r in S:  # 選択行動範囲 (l: 始点, r: 終点)
            if i - l < 0:   # 注目点が選択行動範囲の始点より手前の場合 → 注目点に来るために使用することはできない．
                break
            else:           # 注目点に来るために使用することができる場合
                dp[i] += A[i-l] - A[max(i-r, 0)-1]  # lからrの間で，注目点に行くために使用できる点を逆算． そこに行くことができる = 選択行動範囲の値を選択することで注目点に達することができる通り数．
        dp[i] %= mod
        A[i] = (A[i-1] + dp[i]) % mod
    print(dp[-1])

if __name__ == '__main__':
    N, K = list(map(int, input().split()))
    S = {tuple(map(int, input().split())) for k in range(K)}
    S = sorted(list(S), key = lambda x:x[0])    # 始点でsort (範囲の重複がないため)
    main(N, S)

Buggy submission (verdict: Runtime Error):
def main(N, S):
    dp = [0 if n != 0 else 1 for n in range(N)] # 初期値
    lst_S = sorted(list(S))

    for i in range(N):
        if dp[i] == 0:  # 計算時間削減のため， 時間さえ間に合えば不要かも．
            continue
        for j in lst_S:
            if i + j > N - 1:
                break
            else:
                dp[i+j] = (dp[i+j] + dp[i]) % mod
    print(dp[-1])


if __name__ == '__main__':
    N, K = list(map(int, input().split()))
    S = set()
    for k in range(K):
        L, R = map(int, input().split())
        {S.add(i) for i in range(L, R+1)}
    main(N, S)
Problem p02571 (python)

Fixed submission:
def main():
    S = input()
    T = input()
    # Sのi文字目をTの先頭として，それらの文字列の一致度を見る．

    st = set()
    for i in range(len(S)-len(T)+1):
        cnt = 0
        for s, t in zip(S[i:i+len(T)], T):
            cnt += s == t
        st.add(cnt)
    print(len(T) - max(st))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    S = input()
    T = input()
    # Sのi文字目をTの先頭として，それらの文字列の一致度を見る．

    st = {}
    for i in range(len(S)-len(T)+1):
        cnt = 0
        for s, t in zip(S[i:i+len(T)], T):
            cnt += s == t
        st.add(cnt)
    print(len(T) - max(st))


if __name__ == '__main__':
    main()
Problem p02729 (python)

Fixed submission:
N, M = list(map(int, input().split(' ')))

ans = int((N + M) * (N + M - 1) / 2 - N * M)
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
import math

#****************************************************************
def comb(n):
    if n < 2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
#****************************************************************

N = int(input())
A = list(map(int, input().split()))

c = collections.Counter(A)
dict_ans = {i:0 for i in c.keys()}
full_ans = sum(list(map(comb, c.values())))

for i in c.keys():
    target = c.copy()
    target[i] -= 1
    if target[i] == 0:
        dict_ans[i] = full_ans
    else:
        dict_ans[i] = sum(list(map(comb, target.values())))

for i in A:
    print(dict_ans[i])
Problem p03036 (python)

Fixed submission:
r, D, x = map(int, input().split())

def calc(r, D, x):
  return (r * x) - D

for _ in range(10):
  x = calc(r, D, x)
  print(x)

Buggy submission (verdict: Runtime Error):
r, D, x = map(int, input(),split())

def calc(r, D, x):
  return (r * x) - D

for _ in range(10):
  x = calc(r, D, x)
  print(x)
Problem p02547 (python)

Fixed submission:
def judge():
    cnt = 0  
    for _ in range(N):
        x, y = map(int, input().split())
        if x == y:
            cnt += 1
        else:
            cnt = 0
        if cnt == 3:
            return True
    return False

N = int(input())

if judge():  
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
  d = map(int, input().split())


answer = 'No'

count = 0
for i in range(n):
    if d[i][0] != d[i][1]:
        count = 0
    else:
        count += 1

    if count == 3:
        answer = 'Yes'
        break

print(answer)
Problem p02627 (python)

Fixed submission:
s = str(input())
if s.isupper():
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
s = input()
if s.issupper == True:
  print("A")
else:
  print("a")
Problem p02725 (python)

Fixed submission:
K, N = map(int,input().split())
A = list(map(int, input().split()))
li = []
for i in range(N - 1):
  li.append(A[i + 1] - A[i]) 
li.append(abs(A[0] + (K - A[-1]))) 
print(sum(li) - max(li))

Buggy submission (verdict: Runtime Error):
K, N = map(int,input().split())　
A = list(map(int, input().split()))
li = []
for i in range(N - 1):
  li.append(A[i + 1] - A[i]) 

li.append(abs(A[0] + (K - A[-1]))) 
print(sum(li) - max(li))
Problem p02759 (python)

Fixed submission:
n = int(input())
if n%2==0:
  print(n//2)
else:
  print(n//2+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n%2=0:
  print(n//2)
else:
  print(n//2+1)
Problem p02948 (python)

Fixed submission:
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
v=[[]for _ in'_'*M]
z=0
for a,b in t:
	if a<=M:v[a-1]+=[b]
q=[0]*M
for i in v:
	for j in i:heappush(q,-j)
	z-=heappop(q)
print(z)

Buggy submission (verdict: Runtime Error):
from heapq import*
N,M,*t=map(int,open(0).read().split())
v=[[]for _ in'_'*M]
for i in range(N):
	if M<t[2*i]:v[t[2*i]-1]+=[t[2*i+1]]
z=0
q=[]
for i in v:
	for j in i:heappush(q,-j)
	z-=len(q)and heappop(q)
print(z)

Buggy submission (verdict: Runtime Error):
from heapq import*
N,M,*t=map(int,open(0).read().split())
v=[[]for _ in'_'*M]
for i in range(N):M<t[2*i]or v[t[2*i]-1].append(t[2*i+1])
z=0
q=[]
for i in v:
	for j in i:heappush(q,-j)
	z-=q[0]and heappop(q)
print(z)
Problem p03041 (python)

Fixed submission:
n,k=input().split()
s=input()
k=int(k)-1
for i,c in enumerate(s):
	if i==k:c=chr(ord(c)+32)
	print(c,end='')

Buggy submission (verdict: Runtime Error):
n,k=input().split()
s=input()
k=int(k)-1
s[k]=chr(ord(s[k])+32)
print(s)
Problem p03072 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
print(sum(max(h[:i]+[0])<=h[i]for i in range(n)))

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
print(sum(max(h[:i])<=h[i]for i in range(n)))

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
print(count(max(h[:i]+[0])<=h[i]for i in range(n)))

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
print(count(max(h[:i])<=h[i]for i in range(n)))
Problem p03250 (python)

Fixed submission:
a=list(map(int,input().split()));print(sum(a)+9*max(a))

Buggy submission (verdict: Runtime Error):
a=map(int,input().split());print(sum(a)+9*max(a))
Problem p03803 (python)

Fixed submission:
a,b=[(int(i)+11)%13 for i in input().split()]
print("Bob" if a<b else "Alice" if a>b else "Draw")

Buggy submission (verdict: Runtime Error):
a,b=(int(i)+11)%13 for i in input().split()
print("Bob" if a<b else "Alice" if a>b else "Draw")
Problem p03953 (python)

Fixed submission:
from numpy import*
n,*a=map(int,open(0).read().split())
t=arange(n-1)
*s,=t
for i in a[-a[n]:]:t[i-2],t[i-1]=t[i-1],t[i-2]
k=a[n+1]
while k:
    if k%2:s=t[s]
    t=t[t]
    k//=2
print(*cumsum(a[:1]+list(diff(a[:n])[s])))

Buggy submission (verdict: Runtime Error):
from numpy import*
n,*a=map(int,open(0).read().split())
x=a[:n]
d=diff(x)
t=arange(n-1)
*s,=t
for i in a[-a[n]:]:t[i-2],t[i-1]=t[i-1],t[i-2]
k=a[n+1]
while k:
    if k%2:s=t[s]
    t=t[t]
    k//=2
print(*cumsum([x[0],*d[s]]))
Problem p02557 (python)

Fixed submission:
def get_ints():
      return list(map(int,input().split()))

n = int(input())
a = get_ints()
b = get_ints()

cnt = [0]*(n+1)
for x in a+b:
  cnt[x] += 1

q = [set() for i in range(n+1)]
for i in range(1,n+1):
  if cnt[i] > n:
    print('No')
    exit(0)
  q[cnt[i]].add(i)
print('Yes')

def make_cnt(a):
  cnt_ = {}
  for i in range(n):
    if a[i] not in cnt_:
      cnt_[a[i]] = [i]
    else:
      cnt_[a[i]].append(i)
  return cnt_

cnt_a = make_cnt(a)
cnt_b = make_cnt(b)

def get_any(cnt_, x):
  for key in cnt_.keys():
    if key != x:
      return key
  assert False

ans = [-1]*n

for i in range(n,0,-1):
  s = list(q[i])
  x,y = 0,0
  if len(s) == 0:
    x = get_any(cnt_a, -1)
    y = get_any(cnt_b, x)
  elif len(s) == 1:
    x = s[0]
    if x not in cnt_a:
      y = x
      x = get_any(cnt_a, y)
    else:
      y = get_any(cnt_b, x)
  else:
    x,y = s
    if x not in cnt_a:
      x,y = y,x

  ans[cnt_a[x][-1]] = y
  def update_cnt(cnt_, x):
    cnt_[x].pop()
    if len(cnt_[x]) == 0:
      del cnt_[x]
  def use(x):
    q[cnt[x]].remove(x)
    cnt[x] -= 1
    q[cnt[x]].add(x)
  update_cnt(cnt_a, x)
  update_cnt(cnt_b, y)
  use(x)
  use(y)

print(' '.join(map(str,ans)))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split()))
B  =list(map(int,input().split()))
f = True
for i in range(n):
    if A[i]==B[i]:
        f = False
        break
if f:
    print('Yes')
    ans =[str(i) for i in B]
    print(' '.join(ans))
    exit()
if A[-1]<B[0]:
    print('Yes')
    ans =[str(i) for i in B]
    print(' '.join(ans))
    exit()

B=B[::-1]
f = True
for i in range(n-1,-1,-1):
    if A[i]!=B[i]:
        continue
    else:
        p = A[i]
        l = A.count(A[i])
        m = B.count(B[i])
        idx = i
        f = False
        break
l ,m=0,0
for i in range(idx+1):
    if A[i]==p:l+=1
    if B[i]==p:m+=1
if f:
    print('Yes')
    ans =[str(i) for i in B]
    print(' '.join(ans))
    exit()

if idx+1-m==0:
    if n-idx<=l:
        print('No')
        exit()
    else:
        print('Yes')
        tmp = B[:idx-l+1]+B[idx+1:] + B[idx-l+1:idx+1]
        ans =[str(i) for i in tmp]
        print(' '.join(ans))
        exit()

if idx+1-m>=l:
    print('Yes')
    tmp = B[idx+1-m:idx+1]+B[:idx+1-m]+B[idx+1:]
    ans =[str(i) for i in tmp]
    print(' '.join(ans))
    exit()
else:
    print('No')
    exit()
Problem p02762 (python)

Fixed submission:
n,m,k = map(int,input().split())
f = [[] for _ in range(n)]
g = [[] for _ in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    f[a].append(b)
    f[b].append(a)
for _ in range(k):
    c,d = map(int,input().split())
    c,d = c-1,d-1
    g[c].append(d)
    g[d].append(c)
d = {}
parent = [-1]*n
seen = [False]*n
from collections import deque
for i in range(n):
    if seen[i]: continue
    stack = deque()
    d[i] = set([i])
    stack = [i]
    while stack:
        v = stack.pop()
        parent[v] = i #同じ連結成分をまとめる
        seen[v] = True
        for nv in f[v]:
            if seen[nv]: continue
            d[i].add(nv)
            stack.append(nv)
ans = [0]*n
for i in range(n):
    group = d[parent[i]]
    #連結成分-直接の友達関係-ブロックしてるけど連結成分にいる人-自分
    sum = len(group)-len(f[i])-len(set(g[i])&group) -1
    ans[i] = sum
print(*ans)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
f = [[] for _ in range(n)]
g = [[] for _ in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    f[a].append(b)
    f[b].append(a)
for _ in range(k):
    c,d = map(int,input().split())
    c,d = c-1,d-1
    g[c].append(d)
    g[d].append(c)
d = {}
parent = [-1]*n
seen = [False]*n
from collections import deque
for i in range(n):
    if seen[i]: continue
    stack = deque()
    d[i] = set([i])
    stack = [i]
    while stack:
        v = stack.pop()
        seen[v] = True
        parent[v]=i
        for nv in f[v]:
            if seen[nv]: continue
            d[i].add(nv)
            stack.append(nv)
ans = [0]*n
for i in range(n):
    group = d[parent[i]]
    sum = len(d[i]) -len(f[i]) - len(set(g[i])&group) -1
    ans[i]=sum
print(*ans)
Problem p03127 (python)

Fixed submission:
N = int(input())
A = set(map(int,input().split()))
def helper(A):
    v = min(A)
    ans = set()
    for a in A:
        if a%v!=0:
            ans.add(a%v)
    ans.add(v)
    return ans

while len(A)>1:
    A = helper(A)
print(min(A))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
# def helper(A):
#     v = min(A)
#     ans = set()
#     for a in A:
#         if a%v!=0:
#             ans.add(a%v)
#     ans.add(v)
#     return ans

# while len(A)>1:
#     A = helper(A)
# print(min(A))
def gcd(x,y):
    if y==0: return x
    return gcd(y,x%y)
ans = A[0]
for a in A:
    ans = gcd(ans,i)
print(ans)
Problem p02550 (python)

Fixed submission:
n,x,m=map(int,input().split())
l=[-1]*m
s=[0]*m
t=p=0
while l[x]<0:
  t+=1
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
T=t+1-l[x]
S=s[p]+x-s[x]
if n<l[x]:
  print(s[l.index(n)])
else:
  print(S*((n-l[x])//T)+s[l.index(l[x]+(n-l[x])%T)])

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,input().split())
l=[-1]*m
s=[0]*m
t=p=0
while l[x]<0 and t<=10**6:
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
  t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<l[x]:
  print(s[l.index((n-1)%m)])
else:
  print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)])

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,input().split())
l=[-1]*m
s=[0]*m
t=p=0
while l[x]<0:
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
  t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<l[x]:
  print(s[l.index((n-1)%m)])
else:
  print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)])

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,input().split())
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
  t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<l[x]:
  print(s[l.index((n-1)%m)])
else:
  print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)])

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,input().split())
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
  t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<=t:
  print(s[l.index((n-1)%m)])
else:
  print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)])

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,input().split())
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
  t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<t:
  print(s[l.index((n-1)%m)])
else:
  print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)])

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,input().split())
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
  t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<t:
  print(s[l.index(n-1)])
else:
  print(S*((n-l[x])//T)+s[l.index(l[x]+(n-l[x])%T-1)])
Problem p02598 (python)

Fixed submission:
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
a=[i*100 for i in a]
# Binary Search
def ok(x):
    c=0
    for i in a:
      c+=0--i//x
    return c<=n+k
l,r=0,10**11+1
while r-l>1:
  m=l+r>>1
  if ok(m): r=m
  else: l=m
t=0--r//100
print(t-ok(t-1) if t>1 else t)

Buggy submission (verdict: Runtime Error):
from math import *
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
def ok(x):
  c=0
  for i in a:
    c+=ceil(i/x)
  return c<=n+k
l,r=0,10**9+1
while r-l>0.1:
  m=(l+r)/2
  if ok(m): r=m
  else: l=m
t=ceil(r)
print(t-ok(t-1)*(t>1))

Buggy submission (verdict: Runtime Error):
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
a=[i*100 for i in a]
# Binary Search
def ok(x):
    c=0
    for i in a:
      c+=0--i//x
    return c<=n+k
l,r=1,10**11+1
while r-l>1:
  m=l+r>>1
  if ok(m): r=m
  else: l=m
t=0--r//100
print(t-ok(t-1))

Buggy submission (verdict: Runtime Error):
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
a=[i*100 for i in a]
# Binary Search
def ok(x):
    c=0
    for i in a:
      c+=0--i//x
    return c<=n+k
l,r=0,10**11+1
while r-l>1:
  m=l+r>>1
  if ok(m): r=m
  else: l=m
t=0--r//100
print(t-ok(t-1))

Buggy submission (verdict: Runtime Error):
from math import *
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
# Binary Search
def ok(x):
    c=0
    for i in a:
      c+=ceil(i/x)
    return c<=n+k
l,r=0,10**9+1
while r-l>10**-2:
  m=(l+r)/2
  if ok(m): r=m
  else: l=m
t=ceil(r)
print(t-ok(t-1))

Buggy submission (verdict: Runtime Error):
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
# Binary Search
def ok(x):
    c=0
    for i in a:
      c+=0--i//x
    return c<=n+k
l,r=0,10**9+1
while r-l>10**-2:
  m=(l+r)/2
  if ok(m): r=m
  else: l=m
from math import *
t=ceil(r)
print(t-ok(t-1))

Buggy submission (verdict: Runtime Error):
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
# Binary Search
def ok(x):
    c=0
    for i in a:
      c+=0--i//x
    return c<=n+k
l,r=0,10**9+1
while r-l>10**-2:
  m=(l+r)/2
  if ok(m): r=m
  else: l=m
from math import *
t=ceil(r)
print(t-ok(t-1))
Problem p02625 (python)

Fixed submission:
M=10**9+7
n,m=map(int,input().split())
F=[1]
for i in range(1,m+1): F+=[i*F[-1]%M]
a=0
for k in range(n+1):
  a+=(-1)**k*F[m-k]*pow(F[k]*F[n-k],-1,M)%M
print(a*F[n]*F[m]*pow(F[m-n]**2,-1,M)%M)

Buggy submission (verdict: Runtime Error):
M=10**9+7
n,m=map(int,input().split())
import sys, functools as ft
sys.setrecursionlimit(10**18)
@ft.lru_cache(None)
def f(n):
  if n<2: return 1
  return n*f(n-1)%M
a=0
for k in range(n+1):
  a+=(-1)**k*f(m-k)*pow(f(k)*f(n-k),-1,M)%M
print(a*f(n)*f(m)*pow(f(m-n)**2,-1,M)%M)

Buggy submission (verdict: Runtime Error):
M=10**9+7
n,m=map(int,input().split())
import sys, functools as ft
sys.setrecursionlimit(10**9)
@ft.lru_cache(None)
def f(n):
  if n<2: return 1
  return n*f(n-1)%M
a=0
for k in range(n+1):
  a+=(-1)**k*f(m-k)*pow(f(k)*f(n-k),-1,M)%M
print(a*f(n)*f(m)*pow(f(m-n)**2,-1,M)%M)

Buggy submission (verdict: Runtime Error):
M=10**9+7
n,m=map(int,input().split())
import sys, functools as ft
sys.setrecursionlimit(10**6)
@ft.lru_cache(None)
def f(n):
  if n<2: return 1
  return n*f(n-1)%M
a=0
for k in range(n+1):
  a+=(-1)**k*f(m-k)*pow(f(k)*f(n-k),-1,M)%M
print(a*f(n)*f(m)*pow(f(m-n)**2,-1,M)%M)
Problem p02833 (python)

Fixed submission:
n=int(input())
if n%2: print(0); exit()
c=0
n//=2
while n: n//=5; c+=n
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n%2<1:
 a=n=n//10
 while n:n//=5;a+=n
print(a)
Problem p02834 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)
f=lambda:map(int,input().split())
n,st,sa=f()
st-=1
sa-=1
g=[[] for _ in range(n)]
for _ in range(n-1):
  a,b=f()
  g[a-1].append(b-1)
  g[b-1].append(a-1)
def dfs(v,p=-1,d=0):
  l[v]=d
  for c in g[v]:
    if c==p: continue
    dfs(c,v,d+1)
def dist(s):
  global l
  l=[0]*n
  dfs(s)
  return l
lt=dist(st)
la=dist(sa)
m=0
for i in range(n):
  if lt[i]<la[i]: m=max(m,la[i])
print(m-1)

Buggy submission (verdict: Runtime Error):
f=lambda:map(int,input().split())
n,st,sa=f()
st-=1
sa-=1
g=[[] for _ in range(n)]
for _ in range(n-1):
  a,b=f()
  g[a-1].append(b-1)
  g[b-1].append(a-1)
def dfs(v,p=-1,d=0):
  l[v]=d
  for c in g[v]:
    if c==p: continue
    dfs(c,v,d+1)
def dist(s):
  global l
  l=[0]*n
  dfs(s)
  return l
lt=dist(st)
la=dist(sa)
m=0
for i in range(n):
  if lt[i]<la[i]: m=max(m,la[i])
print(m-1)
Problem p03013 (python)

Fixed submission:
mod = 10**9+7
n, m = map(int, input().split())
l = [int(input()) for _ in range(m)]

t2 = 0
t1 = 1

for i in range(1,n+1):
  if l == [] or i != l[0]:
    t0 = (t2+t1)%mod
  else:
    l.pop(0)
    t0 = 0
  t2 = t1
  t1 = t0

print(t0)

Buggy submission (verdict: Runtime Error):
M=10**9+7
f=input
n,m=map(int,f().split())
s,t,u=0,1,int(f())
for i in range(n):
  if i==u-1:
    s,t=t,0
    try: u=int(f())
    except: pass
  else: s,t=t,(s+t)%M
print(t)

Buggy submission (verdict: Runtime Error):
mod = 10**9+7
n, m = map(int, input().split())
l = [int(input()) for _ in range(m)]

t2 = 1
t1 = 0 if 1 in l else 1

for i in range(2,n+1):
  t0 = 0 if i in l else (t2+t1)%mod
  t2 = t1
  t1 = t0

print(t0)
Problem p03042 (python)

Fixed submission:
s = input()

l = 0<int(s[:2])<13
r = 0<int(s[2:])<13

if l == 1:
  print('AMBIGUOUS' if r == 1 else 'MMYY')
else:
  print('YYMM' if r == 1 else 'NA')

Buggy submission (verdict: Runtime Error):
s = input()

l = 0<int(s[:2])<13
r = 0<int(s[2:])<13

if l = 1:
  print('AMBIGUOUS' if r = 1 else 'MMYY')
else:
  print('YYMM' if r = 1 else 'NA')