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

Fixed submission:
import sys
sys.setrecursionlimit(10**5*5)
n=int(input())
ab=[[]for _ in range(n)]
for _ in range(n-1):
	a,b=map(int,input().split())
	ab[a-1].append(b-1)
	ab[b-1].append(a-1)
c=list(map(int,input().split()))
c.sort()
print(sum(c)-c[-1])
ans=[-1]*n
cnt=0
node=[]
visited=[0]*n
ans=[-1]*n
def dfs(x):
	global cnt
	ans[x]=c[-cnt-1]
	visited[x]=1
	for next in ab[x]:
		if visited[next]==0:
			cnt+=1
			dfs(next)
dfs(0)
print(*ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ab=[[]for _ in range(n)]
for _ in range(n-1):
	a,b=map(int,input().split())
	ab[a-1].append(b-1)
	ab[b-1].append(a-1)
c=list(map(int,input().split()))
c.sort()
print(sum(c)-c[-1])
ans=[-1]*n
cnt=0
node=[]
visited=[0]*n
ans=[-1]*n
def dfs(x):
	global cnt
	ans[x]=c[-cnt-1]
	visited[x]=1
	for next in ab[x]:
		if visited[next]==0:
			cnt+=1
			dfs(next)
dfs(0)
print(*ans)
Problem p03044 (python)

Fixed submission:
n=int(input())
dis=[10**15]*n
dis[0]=0
pair=[[]for _ in range(n)]
for i in range(n-1):
	a,b,c=map(int,input().split())
	pair[a-1].append([b-1,c])
	pair[b-1].append([a-1,c])
now=0
stack=set()
cnt=n-1
while cnt!=0:
	for i in range(len(pair[now])):
		if dis[pair[now][i][0]]==10**15:
			dis[pair[now][i][0]]=dis[now]+pair[now][i][1]
			stack.add(pair[now][i][0])
	now=stack.pop()
	cnt-=1
for i in range(n):
	if dis[i]%2==0:
		print(0)
	else:
		print(1)

Buggy submission (verdict: Runtime Error):
n=int(input())
dis=[10**15]*n
dis[0]=0
pair=[[]for _ in range(n)]
for i in range(n-1):
	a,b,c=map(int,input().split())
	pair[a-1].append([b-1,c])
	pair[b-1].append([a-1,c])
now=0
stack=set()
cnt=n-1
while cnt!=0:
	for i in range(len(pair[now])):
		if dis[pair[now][i][0]]==10**15:
			dis[pair[now][i][0]]=dis[now]+pair[now][i][1]
			stack.add(pair[now][i][0])
			new_now=pair[now][i][0]
	now=new_now
	stack.remove(now)
	cnt-=1
for i in range(n):
	if dis[i]%2==0:
		print(0)
	else:
		print(1)
Problem p03061 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
import fractions
gcd=a[0]
l=[]
r=[]
for i in range(n):
	gcd=fractions.gcd(gcd,a[i])
	l.append(gcd)
gcd=a[-1]
for i in range(n):
	gcd=fractions.gcd(gcd,a[-i-1])
	r.append(gcd)
x=list()
x.append((r[n-2]))
for i in range(n-2):
	x.append(fractions.gcd(l[i],r[n-i-3]))
x.append((l[n-2]))
print(max(x))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
import math
gcd=a[0]
l=[]
r=[]
for i in range(n):
	gcd=math.gcd(gcd,a[i])
	l.append(gcd)
gcd=a[-1]
for i in range(n):
	gcd=math.gcd(gcd,a[-i-1])
	r.append(gcd)
x=list()
x.append((r[n-2]))
for i in range(n-2):
	x.append(math.gcd(l[i],r[n-i-3]))
x.append((l[n-2]))
print(max(x))
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(2*a-1,2*b-1,a+b))

Buggy submission (verdict: Runtime Error):
m=int(input())
a=list(map(int,input().split()))
D=1
n=1

while n < m:
 if a[n] < max(a[0:n]):
  D=D 
  n=n+1
 else:
  D=D+1 
  n=n+1

print(D)
Problem p03074 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
cnt=[]
now=s[0]
p=0
for i in range(n):
	if s[i]==now:
		p+=1
	else:
		cnt.append(p)
		now=s[i]
		p=1
cnt.append(p)
ans=0
r=[]
cum_sum=0
for i in range(len(cnt)):
	cum_sum+=cnt[i]
	r.append((cnt[i],cum_sum))
for i in range(len(r)):
	if s[r[i][1]-r[i][0]]=="1":
		e=r[min(i+2*k,len(r)-1)][1]-r[i][1]+r[i][0]
	else:
		e=r[min(i+2*k-1,len(r)-1)][1]-r[i][1]+r[i][0]
	ans=max(ans,e)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
if "0" not in s:
	print(len(s))
	exit()
p=s[0]
a=[]
d=[]
b=[]
cnt_1=0
cnt_0=0
p=s[0]
for i in range(len(s)):
	if p!=s[i]:
		if p=="0":
			a.append(cnt_0)
			cnt_0=0
			p="1"
		else:
			b.append(cnt_1)
			cnt_1=0
			p="0"
	if s[i]=="0":
		cnt_0+=1
	else:
		cnt_1+=1
if cnt_0>0:
	a.append(cnt_0)
else:
	b.append(cnt_1)
if len(a)<=len(b):
	k+=1
	if len(a)==len(b):
		if s[0]=="0":
			b.insert(0,0)
		else:
			b.insert(-1,0)
	for i in range(len(b)-k+1):
		d.append(sum(b[i:i+k])+sum(a[i:i+k-1]))
else:
	b.insert(0,0)
	b.insert(len(b),0)
	for i in range(len(b)-k+1):
		k+=1
		d.append(sum(b[i:i+k])+sum(a[i:i+k-1]))
print(max(d))
Problem p03081 (python)

Fixed submission:
import sys
input=sys.stdin.readline
n,q=map(int,input().split())
s=input().rstrip()
td=[]
for _ in range(q):
	t,d=input().split()
	td.append((t,d))
l=-1;r=n+1
while r-l>1:#l以上r未満
	mid=(l+r)//2
	now=mid
	if not 0<=now<n:
		if now==-1:
			l=mid
		else:
			r=mid
		continue
	for i in range(q):
		if s[now]==td[i][0]:
			if td[i][1]=="L":
				now-=1
			else:
				now+=1
		if not 0<=now<n:
			f=0
			break
	if now==-1:
		l=mid
	else:
		r=mid
Left=l
l=-2;r=n
while r-l>1:#l over r以下
	mid=(l+r)//2
	now=mid
	if not 0<=now<n:
		if now==n:
			r=mid
		else:
			l=mid
		continue
	for i in range(q):
		if s[now]==td[i][0]:
			if td[i][1]=="L":
				now-=1
			else:
				now+=1
		if not 0<=now<n:
			f=0
			break
	if now==n:
		r=mid
	else:
		l=mid
Right=r#Right,Leftはどこまで排除されるか
print(Right-Left-1)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
n,q=map(int,input().split())
s=input().rstrip()
td=[]
for _ in range(q):
	t,d=input().split()
	td.append((t,d))
l=-1;r=n+1
while r-l>1:#l以上r未満
	mid=(l+r)//2
	now=mid
	for i in range(q):
		if s[now]==td[i][0]:
			if td[i][1]=="L":
				now-=1
			else:
				now+=1
		if not 0<=now<n:
			f=0
			break
	if now==-1:
		l=mid
	else:
		r=mid
Left=l
l=-1;r=n
while r-l>1:#l over r以下
	mid=(l+r)//2
	now=mid
	for i in range(q):
		if s[now]==td[i][0]:
			if td[i][1]=="L":
				now-=1
			else:
				now+=1
		if not 0<=now<n:
			f=0
			break
	if now==n:
		r=mid
	else:
		l=mid
Right=r
print(Right-Left-1)
Problem p03085 (python)

Fixed submission:
a=input()
if a=="A":
 print("T")
elif a=="T":
 print("A")
elif a=="C":
 print("G") 
else:
 print("C")

Buggy submission (verdict: Runtime Error):
a=input()
if a=A:
 print(T)
elif a=T:
 print(A)
elif a=C:
 print(G) 
else:
 print(C)
Problem p03087 (python)

Fixed submission:
n,q=map(int,input().split())
s=input()
i=0
d=""
while i<n-1:
	if s[i]=="A" and s[i+1]=="C":
		d+="0"*2
		i+=2
	else:
		d+=s[i]
		i+=1
d+=s[-1]
num=[0]*n
cnt=0
for i in range(n):
	if d[i]=="0":
		cnt+=1
	num[i]=cnt//2
for i in range(q):
	x,y=map(int,input().split())
	print(num[y-1]-num[x-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
i=0
d=""
while i<n:
	if s[i]=="A" and s[i+1]=="C":
		d+="0"*2
		i+=2
	else:
		d+=s[i]
		i+=1
num=[0]*n
cnt=0
for i in range(n):
	if d[i]=="0":
		cnt+=1
	num[i]=cnt//2
for i in range(q):
	x,y=map(int,input().split())
	print(num[y-1]-num[x-1])
Problem p03141 (python)

Fixed submission:
n=int(input())
ans=0
c=[]
for i in range(n):
	x,y=map(int,input().split())
	ans+=x
	c.append(x+y)
c.sort()
c.reverse()
for i in range(n):
	if i%2!=0:
		ans-=c[i]
print(ans)

Buggy submission (verdict: Runtime Error):
=int(input())
c=[]
a=[]
b=[]
for i in range(n):
	x,y=map(int,input().split())
	a.append(x)
	b.append(y)
	c.append([x-y,i])
c.sort()
c.reverse()
q=[]
qq=[]
for i in range(n):
	if i%2==0:
		q.append(c[i][1])
	else:
		qq.append(c[i][1])
ans=0
for i in range(len(q)):
	ans+=a[q[i]]
for i in range(len(qq)):
	ans-=b[qq[i]]
print(ans)
Problem p03196 (python)

Fixed submission:

n,p=map(int,input().split())
ans=[]
for i in range(2,int(p**0.5)+1):
	cnt=0
	while p%i==0:
		p//=i
		cnt+=1
	if cnt>0:
		ans.append([i,cnt])
ans.append([p,1])
ret=1
for i in range(len(ans)):
	ret*=pow(ans[i][0],(ans[i][1]//n))
print(ret)

Buggy submission (verdict: Runtime Error):
n,p=map(int,input().split())
if n==1:
	print(p)
	exit()
ans=1
for i in range(2,int(p**0.5)+2):
	if p<pow(i,n):
		break
	while p%(pow(i,n))==0:
		if p%(pow(i,n))==0:
			ans*=i
			p//=(pow(i,n))
print(ans)

Buggy submission (verdict: Runtime Error):
n,p=map(int,input().split())
if n==1:
	print(p)
	exit()
ans=1
for i in range(2,int(p**(1/n))+2):
	while p%(i**n)==0:
		if p%(i**n)==0:
			ans*=i
			p//=(i**n)
print(ans)
Problem p03231 (python)

Fixed submission:
from fractions import gcd
n,m=map(int,input().split())
s=input()
t=input()
p=gcd(n,m)
ans=n*m//p 
for i in range(n):
	if abs((i*(ans//n)/(ans//m))-int(i*(ans//n)/(ans//m)))<=10**(-7):
		if s[i]==t[(i*(ans//n)//(ans//m))]:
			continue
		else:
			print(-1)
			exit()
print(ans)

Buggy submission (verdict: Runtime Error):
rom fractions import gcd
n,m=map(int,input().split())
s=input()
t=input()
p=gcd(n,m)
ans=n*m//p #20ms
tt=[0 for _ in range(ans)]
# for i in range(n):
# 	tt[i*(ans//n)]=ord(s[i])
# for i in range(m):
# 	if tt[i*(ans//m)]!=ord(t[i]) and tt[i*(ans//m)]!=0:
# 		print(-1)
# 		exit()
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n,m=map(int,input().split())
s=input()
t=input()
p=gcd(n,m)
# ans=n*m//p
# tt=[0 for _ in range(ans)]
# for i in range(n):
# 	tt[i*(ans//n)]=ord(s[i])
# for i in range(m):
# 	if tt[i*(ans//m)]!=ord(t[i]) and tt[i*(ans//m)]!=0:
# 		print(-1)
# 		exit()
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
s=input()
t=input()
p=math.gcd(n,m)
ans=n*m//p
tt=[0 for _ in range(ans)]
for i in range(n):
	tt[i*(ans//n)]=s[i]
for i in range(m):
	if tt[i*(ans//m)]!=t[i] and tt[i*(ans//m)]!="":
		print(-1)
		exit()
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
n,m=map(int,input().split())
s=input()
t=input()
p=fractions.gcd(n,m)
ans=n*m//p
tt=[""]*ans
for i in range(n):
	tt[i*(ans//n)]=s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
n,m=map(int,input().split())
s=input()
t=input()
p=fractions.gcd(n,m)
ans=n*m//p
tt=[""]*ans
for i in range(n):
	tt[i*(ans//n)]=s[i]
for i in range(m):
	if tt[i*(ans//m)]!=t[i] and tt[i*(ans//m)]!="":
		print(-1)
		exit()
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
n,m=map(int,input().split())
s=input()
t=input()
p=fractions.gcd(n,m)
ans=n*m//p
tt=[""]*ans
for i in range(n):
	tt[i*(ans//n)]=s[i]
for i in range(m):
	if tt[i*(ans//m)]!=t[i] and tt[i*(ans//m)]!="":
		print(-1)
		exit()
print(ans)
Problem p03244 (python)

Fixed submission:
x=[]
y=[]
n=int(input())
a=list(map(int,input().split()))
for i in range(10**5+1):
	x.append([i,0])
	y.append([i,0])
for i in range(n//2):
	x[a[i*2]][1]+=1
	y[a[i*2+1]][1]+=1
x.sort(key=lambda x:-x[1])
y.sort(key=lambda x:-x[1])
if x[0][0]!=y[0][0]:
	print(n-x[0][1]-y[0][1])
else:
	print(n-max(x[0][1]+y[1][1],
		x[1][1]+y[0][1]))

Buggy submission (verdict: Runtime Error):
x=[]
y=[]
for i in range(10**5//2+1):
	x.append([i,0])
	y.append([i,0])
n=int(input())
a=list(map(int,input().split()))
for i in range(n//2):
	x[a[i*2]][1]+=1
	y[a[i*2+1]][1]+=1
x.sort(key=lambda x:-x[1])
y.sort(key=lambda x:-x[1])
# if x[0][0]!=y[0][0]:
# 	print(n-x[0][1]-y[0][1])
# else:
# 	print(n-max(x[0][1]+y[1][1],
# 		x[1][1]+y[0][1]))
print(1)

Buggy submission (verdict: Runtime Error):
x=[]
y=[]
for i in range(10**5//2+1):
	x.append([i,0])
	y.append([i,0])
n=int(input())
a=list(map(int,input().split()))
for i in range(n//2):
	x[a[i*2]][1]+=1
	y[a[i*2+1]][1]+=1
x.sort(key=lambda x:-x[1])
y.sort(key=lambda x:-x[1])
if x[0][0]!=y[0][0]:
	print(n-x[0][1]-y[0][1])
else:
	print(n-max(x[0][1]+y[1][1],
		x[1][1]+y[0][1]))
Problem p03260 (python)

Fixed submission:
a,b=map(int,input().split())

if a % 2==1 and b % 2==1:
 print("Yes")
else: 
 print("No")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())

if a % 2==1 and b % 2==1:
 print("Yes")
else: 
 print("No")​
Problem p03267 (python)

Fixed submission:
l=int(input())
for i in range(1,21):
	if 2**i>l:
		r=i-1
		break
ans=[]
for i in range(r):
	ans.append((i+1,i+2,0))
	ans.append((i+1,i+2,2**i))
now=2**r-1
for i in range(r,0,-1):
	if 2**(i-1)+now<=l-1:
		ans.append((i,r+1,now+1))
		now+=2**(i-1)
print(r+1,len(ans))
for x in ans:
	print(*x)

Buggy submission (verdict: Runtime Error):
l=int(input())
for i in range(1,20):
	if 2**i>l:
		r=i-1
		break
ans=[]
for i in range(r):
	ans.append((i+1,i+2,0))
	ans.append((i+1,i+2,2**i))
now=2**r-1
for i in range(r,0,-1):
	if 2**(i-1)+now<=l-1:
		ans.append((i,r+1,now+1))
		now+=2**(i-1)
print(r+1,len(ans))
for x in ans:
	print(*x)
Problem p03273 (python)

Fixed submission:
A=[]
h,w=map(int,input().split())
for i in range(h):
	s=input()
	if s.count("#")!=0:
		A.append(s)
B=[]
C=[]
for i in range(w):
	cnt=0
	for j in range(len(A)):
		if A[j][i]==".":
			cnt+=1
	if cnt==len(A):
		B.append(i)
for i in range(w):
	c=""
	for j in range(len(A)):
		if i not in B:
			c+=A[j][i]
	if len(c)>0:
		C.append(c)
for j in range(len(C[0])):
	p=""
	for i in range(len(C)):
		p+=C[i][j]
	print(p)

Buggy submission (verdict: Runtime Error):

h,w=map(int,input().split())
a=[]
for i in range(h):
	d=input()
	if d.count("#")!=0:
		a.append(d)
ss=0
for i in range(w-ss-1):
	cnt=0
	for j in range(len(a)):
		if a[j][i]=="#":
			cnt+=1
	if cnt==0:
		for jj in range(len(a)):
			a[jj]=a[jj][:i]+a[jj][i+1:]
			ss+=1
for i in range(len(a)):
	print(a[i])
Problem p03331 (python)

Fixed submission:
n=int(input())
import math
ans=10**40
for i in range(1,n//2+1):
	x=i
	y=n-i
	p=0
	for j in range((int(math.log(x,10)+10**-7)+1)):
		p+=x%10
		x=x//10
	for j in range((int(math.log(y,10)+10**-7)+1)):
		p+=y%10
		y=y//10
	ans=min(ans,p)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
import math
ans=10**40
for i in range(1,n//2+2):
	x=i
	y=n-i
	p=0
	for j in range((int(math.log(x,10)+10**-7)+1)):
		p+=x%10
		x=x//10
	for j in range((int(math.log(y,10)+10**-7)+1)):
		p+=y%10
		y=y//10
	ans=min(ans,p)
print(ans)
Problem p03361 (python)

Fixed submission:
h,w=map(int,input().split())
a=["."*(w+2)]
for i in range(h):
	x=input()
	a.append("."+x+".")
a.append("."*(w+2))
for i in range(h):
	for j in range(w):
		if a[i+1][j+1]=="#":
			if a[i][j+1]=="#" or \
a[i+2][j+1]=="#" or a[i+1][j+2]=="#" or\
a[i+1][j]=="#":
				continue
			else:
				print("No")
				exit()
print("Yes")

Buggy submission (verdict: Runtime Error):

h,w=map(int,input().split())
a=["."*(w+2)]
for i in range(h):
	x=input()
	a.append("."+x+".")
a.append("."*(w+2)
for i in range(h):
	for j in range(w):
		if a[i+1][j+1]=="#":
			if a[i][j+1]=="#" or \
a[i+2][j+1]=="#" or a[i+1][j+2]=="#" or\
a[i+1][j]=="#":
				continue
			else:
				print("No")
				exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=["."*w]
for i in range(h):
	x=input()
	a.append("."+x+".")
a.append("."*w)
for i in range(h):
	for j in range(w):
		if a[i+1][j+1]=="#":
			if a[i][j+1]=="#" or \
a[i+2][j+1]=="#" or a[i+1][j+2]=="#" or\
a[i+1][j]=="#":
				continue
			else:
				print("No")
				exit()
print("Yes")
Problem p03393 (python)

Fixed submission:
s=input()
if len(s)==26:
	d=[]
	for i in range(26):
		if list(s[-i-1:][::-1])!=sorted(s[-i-1:]):
			for j in range(i+1):
				d.append(s[-j-1])
			d.sort()
			if d[0]==s[-i-1]:
				k=d[1]
			else:
				for j in range(len(d)):
					if d[j]>s[-i-1]:
						k=d[j]
						break
			print(s[:-i-1]+k)
			exit()
	print(-1)
	exit()
d=[0]*26
for i in range(len(s)):
	d[ord(s[i])-ord("a")]+=1
for i in range(26):
	if d[i]==0:
		x=chr(ord("a")+i)
		break
print(s+x)

Buggy submission (verdict: Runtime Error):
s=input()
if len(s)==26:
	d=[]
	for i in range(26):
		if list(s[-i-1:][::-1])!=sorted(s[-i-1:]):
			for j in range(i+1):
				d.append(s[-j-1])
			d.sort()
			if d[0]==s[-i-1]:
				k=d[1]
			else:
				k=d[0]
				print(2/0)
			print(s[:-i-1]+k)
			exit()
	print(-1)
	exit()
d=[0]*26
for i in range(len(s)):
	d[ord(s[i])-ord("a")]+=1
for i in range(26):
	if d[i]==0:
		x=chr(ord("a")+i)
		break
print(s+x)

Buggy submission (verdict: Runtime Error):
s=input()
if len(s)==26:
	d=[]
	for i in range(26):
		if list(s[-i-1:][::-1])!=sorted(s[-i-1:]):
			for j in range(i+1):
				d.append(s[-j-1])
			d.sort()
			if d[0]==s[-i-1]:
				k=d[1]
				print(2/0)
			else:
				k=d[0]
			print(s[:-i-1]+k)
			exit()
	print(-1)
	exit()
d=[0]*26
for i in range(len(s)):
	d[ord(s[i])-ord("a")]+=1
for i in range(26):
	if d[i]==0:
		x=chr(ord("a")+i)
		break
print(s+x)

Buggy submission (verdict: Runtime Error):
s=input()
if len(s)==26:
	d=[]
	for i in range(26):
		if list(s[-i-1:][::-1])!=sorted(s[-i-1:]):
			for j in range(i+1):
				d.append(s[-j-1])
			d.sort()
			k=d[1]
			print(s[:-i-1]+k)
			print(2/0)
			exit()
	print(-1)
	exit()
d=[0]*26
for i in range(len(s)):
	d[ord(s[i])-ord("a")]+=1
for i in range(26):
	if d[i]==0:
		x=chr(ord("a")+i)
		break
print(s+x)
Problem p03437 (python)

Fixed submission:
x,y=map(int,input().split())
if x%y==0:
	print(-1)
else:
	print(x*(y-1))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
need=sum(b)-sum(a)
import math
x=0
a.sort()
b.sort()
for i in range(n):
	if a[i]>b[i]:
		x+=a[i]-b[i]
	else:
		x+=math.ceil((b[i]-a[i])/2)
if x<=need:
	print("Yes")
else:
	print("No")
Problem p03477 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
if a+b>c+d:
 print("Left")
elif a+b==c+d:
 print("Balanced")
else:
 print("Right")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a+b>c+d:
 print(“Left”)
elif a+b=c+d:
 print(“Balanced”)
else:
 print(“Right”)
Problem p03481 (python)

Fixed submission:
x,y=map(int,input().split())
ans=1
for i in range(1000):
	if x*2>y:
		print(ans)
		exit()
	else:
		ans+=1
		x*=2

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
import math
p=math.log(y/x,2)+10**(-18)
print(int(p)+1
Problem p03487 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
cnt=1
for i in range(n-1):
	if a[i]==a[i+1]:
		cnt+=1
	else:
		if cnt>=a[i]:
			x=cnt-a[i]
		else:
			x=10**10
		ans+=min(cnt,x)
		cnt=1
if cnt>=a[-1]:
	x=cnt-a[-1]
else:
	x=10**10
ans+=min(cnt,x)
print(ans)

Buggy submission (verdict: Runtime Error):
k=[0]*(10**9+1)
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
	k[a[i]-1]+=1
	if k[a[i]-1]>a[i]:
		ans+=1
b=set()
for i in range(n):
	if k[a[i]-1]<a[i]-1 and a[i] not in b:
		ans+=k[a[i]-1]
	b.add(a[i])
print(ans)

Buggy submission (verdict: Runtime Error):
k=[0]*(10**9+1)
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
	k[a[i]]+=1
	if k[a[i]]>a[i]:
		ans+=1
print(ans)
Problem p03495 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
b=a[0]
cnt=1
x=[]
for i in range(1,n):
	if b==a[i]:
		cnt+=1
	else:
		x.append([a[i-1],cnt])
		cnt=1
		b=a[i]
x.append([a[-1],cnt])
x.sort(key=lambda x:-x[1])
y=0
for i in range(min(k,len(x))):
	y+=x[i][1]
print(n-y)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
b=a[0]
cnt=1
x=[]
for i in range(1,n):
	if b==a[i]:
		cnt+=1
	else:
		x.append([a[i-1],cnt])
		cnt=1
		b=a[i]
x.append([a[-1],cnt])
x.sort(key=lambda x:-x[1])
y=0
for i in range(k):
	y+=x[i][1]
print(n-y)
Problem p03501 (python)

Fixed submission:

n,a,b=map(int,input().split())
print(min(a*n,b))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
print(min(a*t,b))
Problem p03504 (python)

Fixed submission:
from itertools import accumulate
n,c=map(int,input().split())
time=[0]*(10**5+2)
stc=[]
for i in range(n):
	s,t,c=map(int,input().split())
	stc.append([s,t,c])
stc.sort(key=lambda x:(x[2],x[0]))
for i in range(n-1):
	if stc[i][2]==stc[i+1][2]:
		if stc[i][1]==stc[i+1][0]:
			stc[i+1][0]=stc[i][0]
			stc[i]=[-1]
lis=[]
for i in range(n):
	if stc[i]!=[-1]:
		lis.append(stc[i])
for i in range(len(lis)):
	time[lis[i][0]-1]+=1
	time[lis[i][1]]-=1
print(max(accumulate(time)))

Buggy submission (verdict: Runtime Error):
n,c=map(int,input().split())
time=[0]*(10**5)
for i in range(n):
	s,t,c=map(int,input().split())
	time[s-1]+=1
	time[t]-=1
for i in range(10**5-1):
	time[i+1]+=time[i]
print(max(time))
Problem p03523 (python)

Fixed submission:
s=input()
ans=set()
def two(k):
	 qq="0"*(9-len(bin(k)[2:]))+bin(k)[2:]
	 return qq

for i in range(1,2**9):
	p=""
	for j in range(9):
		if two(i)[j]=="1":
			p+="AKIHABARA"[j]
		if "KI" in p and "H" in p and "B" in p and "R" in p:
			ans.add(p)
if s in ans:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
s=input()
ans=[]
def two(k):
	 qq="0"*(9-len(bin(k)[2:]))+bin(k)[2:]
	 return qq

for i in range(1,2**9):
	p=""
	for j in range(9):
		if two(i)[j]=="1":
			p+="AKIHABARA"[j]
	ans.append(p)
if s in ans:
	print("YES")
else:
	print("NO")
	print(2/0)

Buggy submission (verdict: Runtime Error):
s=input()
p="KIHBR"
j=0
c=0
for i in range(len(s)):
	if s[i]==p[j]:
		j+=1
		c=0
	elif s[i]=="A" and j!=1 and c==0:
		c+=1
		continue
	else:
		print("NO")
		exit()
if j==5:
	print("YES")
else:
	print("NO")
Problem p03547 (python)

Fixed submission:
a,b=input().split()
x,y=ord(a),ord(b)

if x > y:
    print(">")
elif x==y:
  print("=")
else:
  print("<")

Buggy submission (verdict: Runtime Error):
x,y = input().split()
a,b = ord(x), ord(y)
 
if a < b:
    print('<')
elif a > b:
    print('>')
else if a = b:
    print('=')

Buggy submission (verdict: Runtime Error):
x,y = input().split()
a,b = ord(x), ord(y)
 
if a < b:
    print('<')
elif a > b:
    print('>')
else if a == b:
    print('=')

Buggy submission (verdict: Runtime Error):
x,y = input().split()
a,b = ord(x), ord(y)
 
if a < b:
    print('<')
elif a > b:
    print('>')
else if a==b:
    print('=')

Buggy submission (verdict: Runtime Error):
x,y = input().split()
a,b = ord(x), ord(y)
 
if a < b:
    print('<')
elif a > b:
    print('>')
else if a=b:
    print('=')

Buggy submission (verdict: Runtime Error):

>>>  A,B=input().strip().split()
if A>B:print(">") if A=B:print("=") if A<B:print("<")
Problem p03578 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
m=int(input())
b=list(map(int,input().split()))
a.sort()
b.sort()
j=0
for i in range(n):
	if a[i]==b[j]:
		j+=1
	if j==m:
		break
if j==m:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
m=int(input())
b=list(map(int,input().split()))
a.sort()
b.sort()
j=0
for i in range(n):
	if a[i]==b[j]:
		j+=1
if j==m:
	print("YES")
else:
	print("NO")
Problem p03592 (python)

Fixed submission:
n,m,k=map(int,input().split())
for nn in range(n+1):
	for mm in range(m+1):
		if nn*m+mm*n-2*mm*nn==k:
			print("Yes")
			exit()
print("No")

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
if n%k==0 or m%k==0:
	print("Yes")
else:
	print("No")