Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
c = [int(input()) for i in range(n)]
num,x = 1,[0]*(n+1)
c.append(0)
x[c[0]]+=1
for i in range(1,n):
    x[c[i]]+=num
    if c[i]-c[i+1]: num = x[c[i]]
    else: num = 0
print(num)

Fixed submission:
n = int(input())
c = [int(input()) for i in range(n)]
num,x = 1,[0]*(200001)
c.append(0)
x[c[0]]+=1
for i in range(1,n):
    if c[i]-c[i-1]: x[c[i]] = (x[c[i]]+num)%(10**9+7)
    if c[i]-c[i+1]: num = x[c[i]]
    else: num = 0
print(num)
Buggy python submission (verdict: Runtime Error):
n,m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
x,y,inf = [2,5,5,4,5,6,3,7,6],set(),float("inf")
dp,ans = [0,-inf],[]
def f(i,y):
    num = -inf
    for j in y:
        if i>=j: num = max(num,dp[i-j]+1)
    return num 
for i in a: y.add(x[i-1])
for i in range(2,n+1): dp.append(f(i,y))
a,N = sorted(a)[::-1],n
for i in range(dp[n]):
    for j in a:
        if dp[N-x[j-1]]==dp[N]-1:
            ans.append(str(j))
            N-=x[j-1]
            break
print("".join(ans))

Fixed submission:
n,m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
x,y,inf = [2,5,5,4,5,6,3,7,6],set(),float("inf")
dp,ans = [0,-inf],[]
def f(i,y):
    num = -inf
    for j in y:
        if i>=j: num = max(num,dp[i-j]+1)
    return num 
for i in a: y.add(x[i-1])
for i in range(2,n+1): dp.append(f(i,y))
a,N = sorted(a)[::-1],n
for i in range(dp[n]):
    for j in a:
        if N>=x[j-1] and dp[N-x[j-1]]==dp[N]-1:
            ans.append(str(j))
            N-=x[j-1]
            break
print("".join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = (int(i) for i in input().split())
x,y = [[] for i in range(n+1)],[1]*(n+1)
for i in range(n+m-1):
    a,b = (int(i) for i in input().split())
    x[a].append(b)
    y[b] = 0
for i in range(1,n+1):
    if y[i]: break
r,ans,q = i,[0]*(n+1),[i]
while q:
    p = q.pop()
    for i in x[p]:
        q.append(i)
        ans[i] = p
for i in ans[1:]: print(i)

Fixed submission:
n,m = (int(i) for i in input().split())
x,y = [[] for i in range(n+1)],[0]*(n+1)
y[0] = 1
for i in range(n+m-1):
    a,b = (int(i) for i in input().split())
    x[a].append(b)
    y[b]+=1
ans,q = [0]*(n+1),[y.index(0)]
while q:
    p = q.pop()
    for i in x[p]:
        y[i]-=1
        if not y[i]:
            q.append(i)
            ans[i] = p
for i in ans[1:]: print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
c,h = 0,h+[0]
while sum(h):
	for i in range(n):
		if h[i]!=0:
			l = i
			break
	for i in range(l,n+1):
		if h[i]==0:
			m = min(h[l:i])
			for j in range(l,i): h[j]-=m
			c+=m
			for j in range(l,n+1):
				if h[j]!=0:
					l = j
					break
print(c)

Fixed submission:
n = int(input())
h = [int(i) for i in input().split()]
c,h = 0,h+[0]
while sum(h):
	f = 0
	for i in range(n+1):
		if f and h[i]==0:
			m,f = min(h[l:i]),0
			for j in range(l,i): h[j]-=m
			c+=m
		elif 1-f and h[i]: f,l = 1,i
print(c)
Buggy python submission (verdict: Runtime Error):
n,x = (int(i) for i in input().split())
def pc(n,k):
	if k==1: return 0
	elif k<2**(n+1)-1: return pc(n-1,k-1)
	elif k==2**(n+1)-1: return 2**n
	else: return 2**n+pc(n-1,k-2**(n+1)+1)
print(pc(n,x))

Fixed submission:
n,x = (int(i) for i in input().split())
def pc(n,k):
	if n and k==1: return 0
	elif k==1: return 1
	elif k<2**(n+1)-1: return pc(n-1,k-1)
	elif k==2**(n+1)-1: return 2**n
	elif k<2**(n+2)-3: return 2**n+pc(n-1,k-2**(n+1)+1)
	else: return 2**(n+1)-1
print(pc(n,x))
Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
n,m = (int(i) for i in input().split())
f = 1
for i in range(2,int(sqrt(m))+1):
	if m%i==0:
		f = 0
		break
if f: print(1)
else:
	for i in range(m//n,0,-1):
		if m%i==0: break
	print(i)

Fixed submission:
from math import sqrt
from bisect import bisect
n,m = (int(i) for i in input().split())
x = []
for i in range(1,int(sqrt(m))+1):
	if m%i==0:
		x.append(i)
		x.append(m//i)
x.sort()
print(x[bisect(x,m//n)-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = (int(i) for i in input().split())
for i in range(m//n,0,-1):
	if m%i==0: break
print(i)

Fixed submission:
from math import sqrt
from bisect import bisect
n,m = (int(i) for i in input().split())
x = []
for i in range(1,int(sqrt(m))+1):
	if m%i==0:
		x.append(i)
		x.append(m//i)
x.sort()
print(x[bisect(x,m//n)-1])
Buggy python submission (verdict: Runtime Error):
a,b,c = (int(i) for i in input().split())
print(sum(a,b,c)+max(a,b,c)*9)

Fixed submission:
a,b,c = (int(i) for i in input().split())
print(a+b+c+max(a,b,c)*9)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n<1200: print("ABC")
elif: n<2800: print("ARC")
else: print("AGC")

Fixed submission:
n = int(input())
if n<1200: print("ABC")
elif n<2800: print("ARC")
else: print("AGC")
Buggy python submission (verdict: Runtime Error):
a,b = (int(input()))
if a<9 and b<9: print("Yay!")
else: print(":(")

Fixed submission:
a,b = (int(i) for i in input().split())
if a<9 and b<9: print("Yay!")
else: print(":(")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a<9 and b<9: print("Yey!")
else: print(":(")

Fixed submission:
a,b = (int(i) for i in input().split())
if a<9 and b<9: print("Yay!")
else: print(":(")
Buggy python submission (verdict: Time Limit Exceeded):
def comb(n,k,p):
	from math import factorial
	if n<0 or k<0 or n<k: return 0
	if n==0 or k==0: return 1
	a,b,c = factorial(n)%p,factorial(k)%p,factorial(n-k)%p
	return (a*pf(b,p-2,p)*pf(c,p-2,p))%p
def pf(a,b,p):
	if b==0: return 1
	if b%2==0:
		d = pf(a,b//2,p)
		return d**2%p
	if b%2==1: return (a*pf(a,b-1,p))%p
n,a,b,k = (int(i) for i in input().split())
mod,ans = 998244353,0
for i in range(n+1):
	if (k-a*i)%b==0:
		j = (k-a*i)//b
		ans = (ans+comb(n,i,mod)*comb(n,j,mod))%mod
print(ans)

Fixed submission:
n,a,b,k = (int(i) for i in input().split())
mod,ans = 998244353,0
fn,fk = [1]*n,[1]*n
for i in range(n-1): fn[i+1] = (fn[i]*(i+2))%mod
def power(n,k):
	if k==1: return n
	elif k%2==0: return power((n**2)%mod,k//2)
	else: return (n*power(n,k-1))%mod
def comb(n,k):
	if n==0 or k==0 or n==k: return 1
	else: return (((fn[n-1]*fk[n-k-1])%mod)*fk[k-1])%mod
fk[-1] = power(fn[-1],mod-2)
for i in range(2,n+1): fk[-i] = (fk[-i+1]*(n+2-i))%mod
for i in range(n+1):
	if (k-a*i)%b==0 and k-a*i>=0 and (k-a*i)//b<=n:
		j = (k-a*i)//b
		ans = (ans+(comb(n,i)*comb(n,j))%mod)%mod
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
L,R = [],[]
for num in range(n):
	l,r = (int(i) for i in input().split())
	if l<=0<=r: continue
	L.append(l)
	R.append(r)
L,R,a,b = sorted(L),sorted(R),-1,0
if R and L and R[0]<=0 and L[-1]>=0:
	if abs(R[0])<L[-1]: flag,now,ans,a = True,L[-1],L[-1],-2
	else: flag,now,ans,b = False,R[0],abs(R[0]),1
elif R and L and R[0]<=0 and L[-1]<0: flag,now,ans,b = False,R[0],abs(R[0]),1
elif R and L and R[0]>0 and L[-1]>=0: flag,now,ans,a = True,L[-1],L[-1],-2
else: ans,now = 0,0
while ans!=0 and b-a!=len(L)+1:
	if flag: flag,now,ans,b = False,R[b],ans+abs(now-R[b]),b+1
	else: flag,now,ans,a = True,L[a],ans+abs(now-L[a]),a-1
if print(ans+abs(now))

Fixed submission:
n = int(input())
L,R = [0],[0]
for _ in range(n):
	l,r = (int(i) for i in input().split())
	L.append(l)
	R.append(r)
L,R,ans = sorted(L)[::-1],sorted(R),0
for i in range(n+1):
	if L[i]>R[i]: ans+=L[i]-R[i]
	else: break
print(ans*2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
fn,fk,mod = [1]*n,[1]*n,10**9+7
for i in range(n-1): fn[i+1] = (fn[i]*(i+2))%mod
def power(n,k):
	if k==1: return n
	elif k%2==0: return power((n**2)%mod,k//2)
	else: return (n*power(n,k-1))%mod
def comb(n,k):
	if n<k or k<0: return 0
	elif k==0 or n==k: return 1
	else: return (((fn[n-1]*fk[n-k-1])%mod)*fk[k-1])%mod
fk[-1] = power(fn[-1],mod-2)
for i in range(2,n+1): fk[-i] = (fk[-i+1]*(n+2-i))%mod
fn.append(1)
ans = f[n-2]
for i in range(2,n):
	ans = (ans-comb(i-1,n-i-1)*fn[i-1]*fn[n-i-2])%mod
print(ans)

Fixed submission:
n = int(input())
fn,fk,mod = [1]*n,[1]*n,10**9+7
for i in range(n-1): fn[i+1] = (fn[i]*(i+2))%mod
def power(n,k):
	if k==1: return n
	elif k%2==0: return power((n**2)%mod,k//2)
	else: return (n*power(n,k-1))%mod
def comb(n,k):
	if n<k or k<0: return 0
	elif k==0 or n==k: return 1
	else: return (((fn[n-1]*fk[n-k-1])%mod)*fk[k-1])%mod
fk[-1] = power(fn[-1],mod-2)
for i in range(2,n+1): fk[-i] = (fk[-i+1]*(n+2-i))%mod
fn.append(1)
ans = fn[n-2]*(n-1)
for i in range(n-2,(n-1)//2,-1):
	ans = (ans-comb(i-1,n-i-1)*fn[i-1]*fn[n-i-2])%mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,c = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
a = 0
for i in x: a += i[1]
ans,sub = max(a-x[-1][0],a-(c-x[0][0]),0),0
for i in range(n-1):
	sub += x[i][1]
	sub2,num2 = 0,0
	for j in range(n-1,i,-1):
		sub2 += x[j][1]
		num2 = max(num2,sub2-2*(c-x[j][0]))
	ans = max(sub-x[i][0]+num2,ans)
x,sub = x[::-1],0
for i in range(n-1):
	sub += x[i][1]
	sub2,num2 = 0,0
	for j in range(n-1,i,-1):
		sub2 += x[j][1]
		num2 = max(num2,sub2-2*x[j][0])
	ans = max(sub-(c-x[i][0])+num2,ans)
print(ans)


Fixed submission:
n,c = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
a = 0
for i in x: a += i[1]
y,y2 = [max(0,x[0][1]-2*x[0][0])],x[0][1]
for i in range(1,n-1):
	y2 += x[i][1]
	y.append(max(y2-2*x[i][0],y[-1]))
z,z2 = [max(0,x[-1][1]-2*(c-x[-1][0]))],x[-1][1]
for i in range(n-2,0,-1):
	z2 += x[i][1]
	z.append(max(z2-2*(c-x[i][0]),z[-1]))
ans,sub = max(a-x[-1][0],a-(c-x[0][0]),0),0
z = z[::-1]
for i in range(n-1):
	sub += x[i][1]
	ans = max(sub-x[i][0]+z[i],ans)
sub = 0
for i in range(n-1,0,-1):
	sub += x[i][1]
	ans = max(sub-(c-x[i][0])+y[i-1],ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import sqrt,pi,acos
n = int(input())
p1 = [[int(i) for i in input().split()] for i in range(n)]
p,q,ans = sorted(p1),[],[]
x1,x2,y1,y2,z1,z2 = p[0][0],p[0][1]+1,p[0][0],p[0][1],10**6+1,0
def cos(a,b,c,d,e,f):
	a,b,e,f = a-c,b-d,e-c,f-d
	return (a*e+b*f)/(sqrt(a**2+b**2)*sqrt(e**2+f**2))
while p[0]!=[z1,z2]:
	q.append([y1,y2])
	num = 2
	for i,j in p:
		if y1!=i or y2!=j:
			m = cos(x1,x2,y1,y2,i,j)
			if num>m: num,z1,z2 = m,i,j
	ans.append((pi-acos(num))/(2*pi))
	x1,x2,y1,y2 = y1,y2,z1,z2
ans = [(pi-acos(cos(x1,x2,y1,y2,q[1][0],q[1][1])))/(2*pi)]+ans[1:]
for i in p1:
	if i in q: print(ans[q.index(i)])
	else: print(0)

Fixed submission:
from math import sqrt,pi,acos
n = int(input())
p1 = [[int(i) for i in input().split()] for i in range(n)]
p,q,ans = sorted(p1),[],[]
x1,x2,y1,y2,z1,z2 = p[0][0],p[0][1]+1,p[0][0],p[0][1],10**6+1,0
def cos(a,b,c,d,e,f):
	a,b,e,f = a-c,b-d,e-c,f-d
	return (a*e+b*f)/(sqrt(a**2+b**2)*sqrt(e**2+f**2))
while p[0]!=[z1,z2]:
	q.append([y1,y2])
	num = 2
	for i,j in p:
		if y1!=i or y2!=j:
			m = cos(x1,x2,y1,y2,i,j)
			if num>m: num,z1,z2 = m,i,j
	ans.append((pi-acos(max(-1,num)))/(2*pi))
	x1,x2,y1,y2 = y1,y2,z1,z2
ans = [(pi-acos(cos(x1,x2,y1,y2,q[1][0],q[1][1])))/(2*pi)]+ans[1:]
for i in p1:
	if i in q: print(ans[q.index(i)])
	else: print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(m)]
y,z,ans = [[] for i in range(n+1)],[None for i in range(n+1)],"Yes"
for i,j,k in x:
	y[i].append([j,k])
	y[j].append([i,-k])
for i in range(1,n+1):
	if z[i] == None:
		z[i],q = 0,[i]
		while q:
			p = q.pop()
			for j,k in y[p]:
				if z[j] == None: q,z[j] = q+[j],z[p]+k
for i in range(1,n+1):
	for j,k in y[i]:
		if z[i]+k != z[j]:
			ans = "No"
			break
print(ans)

Fixed submission:
n,m = (int(i) for i in input().split())
y,z,ans = [[] for i in range(n+1)],[None for i in range(n+1)],"Yes"
for num in range(m):
	i,j,k = (int(i) for i in input().split())
	y[i].append([j,k])
	y[j].append([i,-k])
for i in range(1,n+1):
	if z[i] == None:
		z[i],q = 0,[i]
		while q:
			p = q.pop()
			for j,k in y[p]:
				if z[j] == None:
					q.append(j)
					z[j] = z[p]+k
for i in range(1,n+1):
	for j,k in y[i]:
		if z[i]+k != z[j]: ans = "No"
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(m)]
y,z,ans = [[] for i in range(n+1)],[None for i in range(n+1)],"Yes"
for i,j,k in x:
	y[i].append([j,k])
	y[j].append([i,-k])
for i in range(1,n+1):
	if z[i] == None:
		z[i],q = 0,[i]
		while q:
			p = q.pop()
			for j,k in y[p]:
				if z[j] == None: q,z[j] = q+[j],z[p]+k
for i in range(1,n+1):
	for j,k in y[i]:
		if z[i]+k != z[j]: ans = "No"
print(ans)

Fixed submission:
n,m = (int(i) for i in input().split())
y,z,ans = [[] for i in range(n+1)],[None for i in range(n+1)],"Yes"
for num in range(m):
	i,j,k = (int(i) for i in input().split())
	y[i].append([j,k])
	y[j].append([i,-k])
for i in range(1,n+1):
	if z[i] == None:
		z[i],q = 0,[i]
		while q:
			p = q.pop()
			for j,k in y[p]:
				if z[j] == None:
					q.append(j)
					z[j] = z[p]+k
for i in range(1,n+1):
	for j,k in y[i]:
		if z[i]+k != z[j]: ans = "No"
print(ans)
Buggy python submission (verdict: Runtime Error):
n,h = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
a,b = 0,[]
for j in x:
	if a < j[0]: a = j[0]
	b.append(j[1])
num = 0
for j2 in b:
	if j2 >= a:
		h -= j2
		num +=1
if h%a==0: answer = (h-h%a)//a + num
else: answer = (h-h%a)//a + num + 1
print(answer)


Fixed submission:
s = input()
print(s[:3] + "8" + s[4:])
Buggy python submission (verdict: Runtime Error):
n = int(input())
c,s,f = [0]*(n-1)
for i in range(n-1): c[i],s[i],f[i] = map(int,input().split())
for j in range(n-1):
	answer = 0
	for k in range(j,n-1):
		if answer<s[k]: answer = s[k]
		elif answer%f[k]: answer += f[k]-(answer%f[k])
		answer += c[k]
	print(answer)

Fixed submission:
n = int(input())
c,s,f = [0]*(n-1),[0]*(n-1),[0]*(n-1)
for i in range(n-1): c[i],s[i],f[i] = (int(i2) for i2 in input().split())
for j in range(n):
	answer = 0
	for k in range(j,n-1):
		if answer<s[k]: answer = s[k]
		elif answer%f[k]: answer += f[k]-(answer%f[k])
		answer += c[k]
	print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = [[int(i) for i in input().split()] for  i in range(n-1)]
for j in range(n-1):
	answer = x[j][0]+x[j][1]
	for k in range(j+1,n-1):
		num = x[k][1]
		while num<answer: num+=x[k][2]
		answer = num+x[k][0]
	print(answer)
print(0)

Fixed submission:
n = int(input())
c,s,f = [0]*(n-1),[0]*(n-1),[0]*(n-1)
for i in range(n-1): c[i],s[i],f[i] = (int(i2) for i2 in input().split())
for j in range(n):
	answer = 0
	for k in range(j,n-1):
		if answer<s[k]: answer = s[k]
		elif answer%f[k]: answer += f[k]-(answer%f[k])
		answer += c[k]
	print(answer)
Buggy python submission (verdict: Runtime Error):
a,b = int(input())
if (a+b)%2==0: print((a+b)//2)
else: print((a+b+1)//2)

Fixed submission:
a,b = (int(i) for i in input().split())
if (a+b)%2==0: print((a+b)//2)
else: print((a+b+1)//2)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
slist,tlist = [],[]
for i in s:
	slist.append(i)
for i in t:
	tlist.append(i)
slist.sort()
tlist.sort()
tlist = tlist[::-1]
for j in range(min(len(slist),len(tlist))):
	if ord(slist[j]) < ord(tlist[j]):
		print("Yes")
		break
	elif ord(slist[j]) > ord(tlist(j)):
		print("No")
		break
	else:
		if j == min(len(slist),len(tlist))-1:
			if len(slist) < len(tlist): print("Yes")
			else: print("No")

Fixed submission:
s = input()
t = input()
slist,tlist = [],[]
for i in s:
	slist.append(i)
for i in t:
	tlist.append(i)
slist.sort()
tlist.sort()
tlist = tlist[::-1]
for j in range(min(len(slist),len(tlist))):
	if ord(slist[j]) < ord(tlist[j]):
		print("Yes")
		break
	elif ord(slist[j]) > ord(tlist[j]):
		print("No")
		break
	else:
		if j == min(len(slist),len(tlist))-1:
			if len(slist) < len(tlist): print("Yes")
			else: print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = [int(i) for i in input().split()]
x2,answer = set(x),0
for j in x2:
	if x.count(j) < j : answer += x.count(j)
	elif x.count(j) > j: answer += x.count(j)-j
print(answer)

Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
c = collections.Counter(a)
answer = 0
for i in c.most_common():
	if i[0]>i[1]:
		answer += i[1]
	elif i[0]<i[1]:
		answer += i[1]-i[0]
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = [int(i) for i in input().split()]
x.sort()
z,answer = [],0
for j in x:
	if j not in z and x.count(j) < j : answer += x.count(j)
	elif j not in z and x.count(j) > j: answer += x.count(j)-j
	z.append(j)
print(answer)

Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
c = collections.Counter(a)
answer = 0
for i in c.most_common():
	if i[0]>i[1]:
		answer += i[1]
	elif i[0]<i[1]:
		answer += i[1]-i[0]
print(answer)

Buggy python submission (verdict: Runtime Error):
import copy
n = int(input())
x = [int(i) for i in input().split()]
y = copy.deepcopy(x)
z = []
for j in x:
	if j not in z and x.count(j)<j:
		while y.count(j) != 0: y.remove(j)
	elif j not in z and x.count(j)>j:
		while y.count != j: y.remove(j)
	z.append(j)
print(len(x)-len(y))

Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
c = collections.Counter(a)
answer = 0
for i in c.most_common():
	if i[0]>i[1]:
		answer += i[1]
	elif i[0]<i[1]:
		answer += i[1]-i[0]
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
x = [int(i) for i in input().split()]
y = copy.deepcopy(x)
for j in x:
	if x.count(j)<j:
		while y.count(j) != 0: y.remove(j)
	elif x.count(j)>j:
		while y.count(j) != j: y.remove(j)
print(len(x)-len(y))

Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
c = collections.Counter(a)
answer = 0
for i in c.most_common():
	if i[0]>i[1]:
		answer += i[1]
	elif i[0]<i[1]:
		answer += i[1]-i[0]
print(answer)
Buggy python submission (verdict: Runtime Error):
k,a,b = (int(i) for i in input().split())
num = k-a
if num<0: print(1)
elif a<b: print(-1)
else: print(((num-num%(a-b))//(a-b))*2+3)

Fixed submission:
k,a,b = (int(i) for i in input().split())
num = k-a
if num<=0: print(1)
elif a<=b: print(-1)
else: print(((num-num%(a-b))//(a-b))*2+2*(min(1,num%(a-b)))+1)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
s = input()
c,x = Counter(s).most_common(),len(s)
if any(c[i][1]-x//3-1 for i in range(x%3)) or any(c[i][1]-x//3 for i in range(x%3,3)): print("NO")
else: print("YES")

Fixed submission:
from collections import Counter
s = input()
c,x = Counter(s).most_common(),len(s)
if any(c[i][1]-x//3-1 for i in range(x%3)) or any(c[i][1]-x//3 for i in range(x%3,len(c))): print("NO")
else: print("YES")
Buggy python submission (verdict: Runtime Error):
import itertools
n = input()
x, pm, a = [], [1,-1], 7-int(n[0])
for i in range(1,4):
	x.append(int(n[i]))
for j in itertools.product(pm,repeat=3):
	if x[0]*j[0]+x[1]*j[1]+x[2]*j[2]==a:
		y = list(j)
		break
for k in range(3):
	if y[k]==1:
		y[k] = "+"
	else:
		y[k] = "-"
print(n[0]+y[0]+n[1]+y[1]+n[2]+y[2]+n[3]+"=7")

Fixed submission:
n = input()
if n[1]==n[2]:
	if n[0]==n[1] or n[2]==n[3]:
		print("Yes")
	else:
		print("No")
else: print("No")

Buggy python submission (verdict: Runtime Error):
import itertools
n = input()
x, pm, a = [], [1,-1], 7-int(n[0])
for i in range(1,4):
	x.append(int(n[i]))
for j in itertools.product(pm,repeat=3):
	if x[0]*j[0]+x[1]*j[1]+x[2]*j[2]==a:
		y = list(j)
		break
for k in range(3):
	if y[k]==1: y[k] = "+"
	else: y[k] = "-"
print(n[0]+y[0]+n[1]+y[1]+n[2]+y[2]+n[3]+"=7")

Fixed submission:
n = input()
if n[1]==n[2]:
	if n[0]==n[1] or n[2]==n[3]:
		print("Yes")
	else:
		print("No")
else: print("No")
Buggy python submission (verdict: Runtime Error):
import itertools
n = input()
x, pm, a = [], [1,-1], 7-int(n[0])
for i in range(1,4):
	x.append(int(n[i]))
for j in itertools.product(pm,repeat=3):
	if x[0]*j[0]+x[1]*j[1]+x[2]*j[2]==a:
		y = j
		break
for k in range(3):
	if y[k]==1: y[k] = "+"
	else: y[k] = "-"
print(n[0]+y[0]+n[1]+y[1]+n[2]+y[2]+n[3]+"=7")

Fixed submission:
import itertools
n = input()
x, pm, a = [], [1,-1], 7-int(n[0])
for i in range(1,4):
	x.append(int(n[i]))
for j in itertools.product(pm,repeat=3):
	if x[0]*j[0]+x[1]*j[1]+x[2]*j[2]==a:
		y = list(j)
		break
for k in range(3):
	if y[k]==1:
		y[k] = "+"
	else:
		y[k] = "-"
print(n[0]+y[0]+n[1]+y[1]+n[2]+y[2]+n[3]+"=7")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
b.sort()
c.sort()
c = c[::-1]
answer,x,y = 0,0,n-1
for j in b:
	for k in range(x,n):
		if a[k] >= j:
			x = k
			break
		elif k == n-1:
			x = n
	for k2 in range(y+1):
		if c[k2] <= j:
			y = k2
			break
		elif k2 == n-1:
			y = n
	answer += x*y
print(answer)


Fixed submission:
a = input()
b = input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]: print("YES")
else: print("NO")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
b.sort()
c.sort()
c = c[::-1]
answer,x,y = 0,0,n-1
for j in b:
	for k in range(x,n):
		if a[k] >= j:
			x = k
			break
		elif k == n-1:
			x = n
	for k2 in range(y+1):
		if c[k2] <= j:
			y = k2
			break
		elif k2 == n-1:
			y = n
	answer += x*y
print(answer)


Fixed submission:
import bisect
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
c.sort()
answer = 0
for i in b:
	x = bisect.bisect_right(c,i)
	y = bisect.bisect_left(a,i)
	answer += (n-x)*y
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
b.sort()
c.sort()
c = c[::-1]
answer,x,y = 0,0,0
for j in b:
	for k in range(x,n):
		if a[k] >= j:
			x = k
			break
		elif k == n-1:
			x = n
	for k2 in range(n):
		if c[k2] <= j:
			y = k2
			break
		elif k2 == n-1:
			y = n
	answer += x*y
print(answer)


Fixed submission:
import bisect
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
c.sort()
answer = 0
for i in b:
	x = bisect.bisect_right(c,i)
	y = bisect.bisect_left(a,i)
	answer += (n-x)*y
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
c.sort()
c = c[::-1]
answer = 0
for j in b:
	for k in range(n):
		if a[k] >= j:
			x = k
			break
		elif k == n-1:
			x = n
	for k2 in range(n):
		if c[k2] <= j:
			y = k2
			break
		elif k2 == n-1:
			y = n
	answer += x*y
print(answer)

Fixed submission:
import bisect
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
c.sort()
answer = 0
for i in b:
	x = bisect.bisect_right(c,i)
	y = bisect.bisect_left(a,i)
	answer += (n-x)*y
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
c.sort()
c = c[::-1]
x,y,answer = [],[],0
for j in b:
	for k in range(n):
		if a[k] >= j:
			x.append(k)
			break
		elif k == n-1:
			x.append(n)
	for k2 in range(n):
		if c[k2] <= j:
			y.append(k2)
			break
		elif k2 == n-1:
			y.append(n)
for i in range(n):
	 answer += x[i]*y[i]
print(answer)


Fixed submission:
import bisect
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
c.sort()
answer = 0
for i in b:
	x = bisect.bisect_right(c,i)
	y = bisect.bisect_left(a,i)
	answer += (n-x)*y
print(answer)