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

Fixed submission:
n,q=map(int,input().split())
s=list(input())
li=[0]*n
cnt=0
ans=0

for i in range(n):
  if i==0:
    continue
  if s[i-1]=="A" and s[i]=="C":
    cnt+=1  
  li[i]=cnt
    
for i in range(q):
  l,r=map(int,input().split())
  ans=li[r-1]-li[l-1]
  print(ans)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(input())
li=[0]*n
cnt=0
ans=0

for i in range(n):
  if i==0:
    continue
  if s[i-1]=="A" and s[i]=="C":
    cnt+=1  
  li[i]=cnt
    
for i in range(q):
  l,r=map(int,input().split())
  ans=li[r]-li[l]
  print(ans)

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(input())
li=[0]*n

for i in range(n):
  if i==0:
    continue
  if s[i-1]=="A" and s[i]=="T":
    li[i]=1

for i in range(q):
  l,r=map(int,input())
  tmp=li[l:r]
  print(sum(temp))
Problem p03101 (python)

Fixed submission:
H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w)
Problem p03145 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(a*b//2)

Buggy submission (verdict: Runtime Error):
a,_,b,_,c=int(input())
print(a*b//2)

Buggy submission (verdict: Runtime Error):
a,_,b,_,c=int(input())
print(a*b/2)
Problem p03243 (python)

Fixed submission:
import bisect
n=int(input())
li=[111,222,333,444,555,666,777,888]

a=bisect.bisect_left(li,n)

print((a+1)*111)

Buggy submission (verdict: Runtime Error):
import bisect
n=int(input())
li=[111,222,333,444,555,666,777,888]

print(li[bisect.bisect_left(li,n)])
Problem p03283 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')

#006
import numpy as np

def main():
	n,m,q=MI()
	li=np.zeros((n+1,n+1),dtype=np.int64)
	for _ in range(m):
		l,r=MI()
		li[l][r]+=1
	#print(li)

	li=np.cumsum(li,axis=0)
	li=np.cumsum(li,axis=1)
	#print(li)

	for _ in range(q):
		p,q=MI()
		print(li[q,q]-li[p-1,q]-li[q,p-1]+li[p-1,p-1])

if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')

#006
import numpy as np

def main():
	n,m,q=MI()
	li=np.zeros((n+1,n+1),dtype=np.int64)
	for _ in range(m):
		l,r=MI()
		li[l][r]+=1
	#print(li)

	li=np.cumsum(li,axis=0)
	li=np.cumsum(li,axis=1)
	#print(li)

	for _ in range(q):
		p,q=MI()
		print(li[q,q]-li[p-1,q]-li[q,p-1]+li[p-1,p-1])

if __name__ == "__main__":
	main()
Problem p03408 (python)

Fixed submission:
n=[input() for i in range(int(input()))]
m=[input() for i in range(int(input()))]

l=list(set(n))

print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))

Buggy submission (verdict: Runtime Error):
n=(input() for i in range(int(input())))
m=(input() for i in range(int(input())))

l=list(set(n))

print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))
Problem p03420 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs= sys.stdin.buffer.readlines
#rstrip().decode('utf-8')

#import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#scipy.sparse import csr_matrix
#scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10**7)

#map(int,input().split())

def main():
    N,K=map(int,input().split())
    ans=0
    for i in range(K+1,N+1):
        ans+=(N//i)*(i-K)+max((N%i-max(K,1)+1),0)
    print(ans)



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs= sys.stdin.buffer.readlines
#rstrip().decode('utf-8')

import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#scipy.sparse import csr_matrix
#scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10**7)

#map(int,input().split())

def main():
    N,K=map(int,input().split())
    ans=0
    for i in range(K+1,N+1):
        ans+=(N//i)*(i-K)+max((N%i-max(K,1)+1),0)
    print(ans)



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

Fixed submission:
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs= sys.stdin.buffer.readlines
#rstrip().decode('utf-8')

#import math
#import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10**7)

#map(int,input().split())

def main():
	n,m=map(int,input().split())
	li=[[] for _ in range(n+1)]
	for i in range(m):
		l,r,d=map(int,input().split())
		li[l].append((r,d))
		li[r].append((l,-d))
	
	q=deque()
	a=[None]*(n+1)

	for i in range(1,n+1):
		if a[i]==None:
			q=[i]
			a[i]=0
			while q:
				now=q.pop()
				for r,d in li[now]:
					if a[r]==None:
						a[r] = a[now] + d
						q.append(r)
					else:
						if a[r]-a[now]!=d:
							print("No")
							exit(0)
						else:
							continue
					
	print("Yes")
	
	
if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs= sys.stdin.buffer.readlines
#rstrip().decode('utf-8')

#import math
#import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10**7)

#map(int,input().split())

def main():
	n,m=map(int,input().split())
	li=[]
	li2=[[] for _ in range(n+1)]
	for i in range(m):
		l,r,d=map(int,input().split())
		li.append((l,r,d))
		li.append((r,l,-d))
		li2[l].append((r,d))
		li2[r].append((l,-d))
	
	stack=[]
	check=set()
	a=[]*(n+1)

	for i in li:
		if i[0] in check:
			continue
		else:
			stack.append(i[0])
			a[i[0]]=0
			while stack:
				now=stack.pop()
				check.add(now)
				for j in li2[now]:
					if j[0] in check:
						if a[j[0]]-a[now]!=j[1]:
							print("No")
							exit(0)
						else:
							continue
					if j[0] in stack:
						continue
					a[j[0]] = a[now] + j[1]
					stack.append(j[0])
					
	print("Yes")
	
	
if __name__ == '__main__':
	main()
Problem p03557 (python)

Fixed submission:
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline
def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')
# import numpy as np

import bisect

def main():
	N=II()
	A=LI()
	B=LI()
	C=LI()
	A.sort()
	B.sort()
	C.sort()
	BB=[0]*N
	ans=0
	for i,b in enumerate(B):
		BB[i]=N-bisect.bisect_right(C,b)
	BB.append(0)
	for i in range(N-2,-1,-1):
		BB[i]+=BB[i+1]
	for a in A:
		ans+=BB[bisect.bisect_right(B,a)]
	print(ans)



if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline
def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')
# import numpy as np

import bisect

def main():
	N=II()
	A=LI()
	B=LI()
	C=LI()
	A.sort()
	B.sort()
	C.sort()
	BB=[0]*N
	ans=0
	for i,b in enumerate(B):
		BB[i]=N-bisect.bisect_right(C,b)

	for i in range(N-2,-1,-1):
		BB[i]+=BB[i+1]
		BB.append(0)
	for a in A:
		ans+=BB[bisect.bisect_right(B,a)]
	print(ans)



if __name__ == "__main__":
	main()
Problem p03583 (python)

Fixed submission:
N=int(input())
for h in range(int(N/4),3501):
  for n in range(h,3501):
    a=(4*h*n-N*(n+h))
    if a!=0:
      w=N*h*n/a
      if w==int(w) and 0<w<1000000000000:
        print(h,n,int(w),sep=" ")
        exit(0)

Buggy submission (verdict: Runtime Error):
N=int(input())
for h in range(1,3501):
  for n in range(1,3501):
    w=1/(4/N-1/h-1/n)
    if abs(w-int(w))<10**(-6) and w>0:
      print(h,n,int(w),sep=" ")
      exit(0)
Problem p03627 (python)

Fixed submission:
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np

from collections import defaultdict

def main():
	d=defaultdict(int)
	
	n=int(input())
	A=list(map(int,input().split()))
	for x in A:
		d[x]+=1
	
	li=[]
	li2=[]
	for k,v in d.items():
		if v>=2:
			li.append(k)
		if v>=4:
			li2.append(k)

	li.sort(reverse=True)
	li2.sort(reverse=True)
	
	if len(li)<=1 and len(li2)==0:
		print(0)
	elif len(li)>=2 and len(li2)>=1:
		print(max(li[0]*li[1],li2[0]**2))
	elif len(li)>=2:
		print(li[0] * li[1])
	else:
		print(li2[0]**2)
	

if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np

from collections import defaultdict

def main():
	d=defaultdict(int)
	
	n=int(input())
	A=list(map(int,input().split()))
	for x in A:
		d[x]+=1
	
	li=[]
	li2=[]
	for k,v in d.items():
		if v>=2:
			li.append(k)
		if v>=4:
			li2.append(k)

	li.sort(reverse=True)
	li2.sort(reverse=True)
	
	if len(li)<=1 and len(li2)==0:
		print(0)
	elif len(li)==1:
		print(li2[0]**2)
	else:
		print(max(li[0]*li[1],li2[0]**2))
	

if __name__ == "__main__":
	main()
Problem p03636 (python)

Fixed submission:
s=input()
print(s[0]+str(len(s)-2)+s[len(s)-1])

Buggy submission (verdict: Runtime Error):
s=input()
print(s[0]+str(len(s-2))+s[len(s-1)])
Problem p03752 (python)

Fixed submission:
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline


def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))

# mod=10**9+7
# rstrip().decode('utf-8')

import numpy as np
from itertools import combinations

def main():
	n,k=MI()
	ans=10**18

	A=LI()
	A=[A[0]-1]+A
	A=np.array(A)

	for t in combinations(range(n),k):
		B=A.copy()
		tmp=0
		for i in t:
			i+=1
			B[i]=max(B[:i].max()+1,A[i])
			tmp+=B[i]-A[i]
		ans=min(ans,tmp)
	print(ans)

if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline


def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))

# mod=10**9+7
# rstrip().decode('utf-8')

#import numpy as np
from itertools import combinations

def main():
	n,k=MI()
	ans=10**18

	A=LI()
	A=[A[0]-1]+A

	for t in combinations(range(n),k):
		B=A.copy()
		tmp=0
		for i in t:
			i+=1
			B[i]=max(max(B[:i])+1,A[i])
			tmp+=B[i]-A[i]
		ans=min(ans,tmp)
	print(ans)

if __name__ == "__main__":
	main()
Problem p03760 (python)

Fixed submission:
o=list(input())
e=list(input())+[""]
for x,y in zip(o,e):
  print(x+y,end="")

Buggy submission (verdict: Runtime Error):
o=input()
e=input()
e=e+""
for i in range(len(o)):
  print(o[i]+e[i],end="")
Problem p03860 (python)

Fixed submission:
print("A"+input()[8]+"C")

Buggy submission (verdict: Runtime Error):
print(A+input()[8]+C)

Buggy submission (verdict: Runtime Error):
s=input()
print(A+""+C.join(s[8]))
Problem p03086 (python)

Fixed submission:
import re
pattern = re.compile('[ACGT]+')
S = input()
print(len(max(re.findall(pattern, S), key=len, default='')))

Buggy submission (verdict: Runtime Error):
S = input()
ans = 0
for i in range(len(S)):
  for j in range(i+1, len(S)+1):
	if all('ACTG'.count(c)==1 for c in S[i:j+1]):
      ans = max(ans, j+1-i)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
ans = 0
for i in range(len(S)):
  for j in range(i+1, len(S)+1):
	if all('ACTG'.count(c)==1 for c in S[i:j+1]):
      ans = max(ans, j+1-i)
print(ans)

Buggy submission (verdict: Runtime Error):
import re
pattern = re.compile('[ACGT]+')
S = input()
print(len(max(re.findall(pattern, S), default=0)))

Buggy submission (verdict: Runtime Error):
import re
pattern = re.compile('[ACGT]+')
S = input()
print(len(max(re.findall(pattern, S))))
Problem p03281 (python)

Fixed submission:
N = int(input())
ans = 0
for n in range(1, N+1, 2):
  yaku = 0
  for i in range(1, n+1):
    if n%i == 0:
      yaku += 1
  if yaku == 8:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sympy
def I(): return int(input())
N = I()
ans = 0
if N>=105:
    for i in range(105,N+1,2):
        if len(sympy.divisors(i))==8:
            ans += 1
print(ans)
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
s = input()
print(s.sount('1'))

Buggy submission (verdict: Runtime Error):
print(input().count(1))
Problem p03494 (python)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
ans = 0
while all(a%2 == 0 for a in A):
  A = [a/2 for a in A]
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split())
ans = 0
while all(_%2 == 0 for _ in a):
	a = [_/2 for _ in a]
    ans += 1
print(ans)
Problem p02658 (python)

Fixed submission:
a=input()
x = list(map(int, input().split()))
x.sort(reverse=True)
if x[-1]==0:
  print(0)
else:
  sum=1
  for i in x:
    sum*=i
    if sum>10**18:
      print(-1)
      break
  if sum<=10**18: print(sum)

Buggy submission (verdict: Runtime Error):
a=input()
x = list(map(int, input().split()))
x.sort(reverse=true)
if x[-1]==0:
  print(0)
else:
  sum=1
  for i in x:
    sum*=i
    if sum>10**18:
      print(-1)
      break
  if sum<=10**18: print(sum)
Problem p02574 (python)

Fixed submission:
from collections import Counter
def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a
n = int(input())
input_list = list(map(int,input().split()))
num_count = Counter([prime for num in input_list for prime in prime_factorize(num)])
if len(num_count.values())==0:
    print("pairwise coprime")
    exit()
max_appear = max(num_count.values())
if max_appear == 1:
    print("pairwise coprime")
elif max_appear != n:
    print("setwise coprime")
else:
    print("not coprime")

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
input_list = list(map(int,input().split()))
num_count = Counter([prime for num in input_list for prime in prime_factorize(num)])
if len(num_count.values())==0:
    print("pairwise coprime")
    exit()
max_appear = max(num_count.values())
if max_appear == 1:
    print("pairwise coprime")
elif max_appear != n:
    print("setwise_coprime")
else:
    print("not coprime")
Problem p02618 (python)

Fixed submission:
import numpy as np
D = int(input())
c_list = np.array(list(map(int,input().split())))
s_list = [list(map(int,input().split())) for _ in range(D)]
last_d_list = np.array([0]*26)
for s_row in s_list:
    choice_d = None
    max_reward = -1
    for i,last_d in enumerate(last_d_list):
        reward = s_row[i] + (last_d+1)*c_list[i]# - sum(c_list)
        if reward > max_reward:
            max_reward = reward
            choice_d = i
    last_d_list+=1
    last_d_list[choice_d] = 0
    
    print(choice_d+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
import copy
D = int(input())
c_list = np.array(list(map(int,input().split())))
s_list = [list(map(int,input().split())) for _ in range(D)]
last_d_list = np.array([0]*26)
s_max_list = [np.argmax(s_row) for s_row in s_list]

for day,s_row in enumerate(s_list):
    choice_d = None
    max_reward = -1
    for i,last_d in enumerate(last_d_list):
        reward = s_row[i] + (last_d+1)*c_list[i]# - sum(c_list)
        next_max_reward = -1
        for j,new_last_d in enumerate(last_d_list):
            if j!=i:
                next_reward = s_list[day+1][j] + (new_last_d+2)*c_list[j]
            else:
                next_reward = s_list[day+1][j] + c_list[j]
            if next_reward > next_max_reward:
                next_max_reward = next_reward
        reward += next_max_reward
        if reward > max_reward:
            max_reward = reward
            choice_d = i
    last_d_list+=1
    last_d_list[choice_d] = 0
    
    print(choice_d+1)
Problem p02641 (python)

Fixed submission:
x,y = map(lambda x:int(x),input().split(" "))
if y==0:
    print(x)
else:
    input_list = list(map(lambda x:int(x),input().split(" ")))
    for i in range(y+2):
        if x-i not in input_list:
            print(x-i)
            break
        elif x+i not in input_list:
            print(x+i)
            break

Buggy submission (verdict: Runtime Error):
import numpy as np
input()

def no_Divisible(num,num_list):
    for row in set(num_list):
        if num%row==0:
            return 0
    return 1

input_list = np.array(sorted(list(map(lambda x:int(x),input().split(" "))),reverse=True))
count = 0
prev_num = 0
for i,num in enumerate(input_list):
    if num == prev_num:
        continue
    #print(num)
    #print(input_list[i+1:]%num)
    #if sum(input_list[i+1:]%num==0):
    if no_Divisible(num,input_list[i+1:]):
        count += 1
    prev_num = num
print(count)
Problem p02657 (python)

Fixed submission:
input_num = input()
a,b = list(map(lambda x:int(x),input_num.split(" ")))
print(a*b)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

print(a*b)
Problem p02658 (python)

Fixed submission:
import sys
input_num = input()
input_list = input()
 
total_pow = 1
for num in input_list.split(" "):
    total_pow *= int(num)
    if total_pow > 10**18:
        if "0" in input_list.split(" "):
            print("0")
        else:
            print("-1")
        sys.exit()

print(total_pow)

Buggy submission (verdict: Runtime Error):
import sys
input_num = input()
input_list = input()
 
total_pow = 1
for num in input_list.split(" "):
  total_pow *= int(num)
  if total_pow > 10**18:
  	if "0" in input_list.split(" "):
      print("0")
    else:
      print("-1")
  	sys.exit()

print(total_pow)

Buggy submission (verdict: Runtime Error):
import sys
input_num = input()
input_list = input()
 
total_pow = 1
for num in input_list.split(" "):
  total_pow *= int(num)
  if total_pow > 10**18:
  	if "0" in input_list.split(" "):
      print("0")
    else:
      print("-1")
  	sys.exit()
print(total_pow)

Buggy submission (verdict: Runtime Error):
input_num = input()
input_list = input()

total_pow = 1
[total_pow*=int(num) for num in input_list.split(" ")]

if total_pow > 10**18:
  print("-1")
else:
  print(total_pow)
Problem p02678 (python)

Fixed submission:
from collections import defaultdict
import sys
room_num,root_num = map(int,input().split())
#room_dis_dic = dict(zip(range(1,room_num+1),[0]+[sys.maxsize]*(room_num-1)))
connect_dic = defaultdict(set)
connected_list = [1]
next_connect_dic = {}
for _ in range(root_num):
    a,b = map(int,input().split())
    connect_dic[a].add(b)
    connect_dic[b].add(a)
    
for room_i in connected_list:
    #print(room_i)
    next_room_set = {connect_to for connect_to in connect_dic[room_i] if connect_to not in next_connect_dic.keys()}
    connected_list.extend(list(next_room_set))
    for next_room_i in next_room_set:
        next_connect_dic[next_room_i] = room_i

if len(set(range(2,room_num+1))-next_connect_dic.keys())!=0:
    print("No")
else:
    print("Yes")
    for i in range(2,room_num+1):
        print(next_connect_dic[i])

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import sys
room_num,root_num = map(int,input().split())
#room_dis_dic = dict(zip(range(1,room_num+1),[0]+[sys.maxsize]*(room_num-1)))
connect_dic = defaultdict(set)
connected_list = [1]
next_connect_dic = {}
for _ in range(root_num):
    a,b = map(int,input().split())
    connect_dic[a].add(b)
    connect_dic[b].add(a)
    
for room_i in connected_list:
    #print(room_i)
    next_room_set = {connect_to for connect_to in connect_dic[room_i] if connect_to not in next_connect.keys()}
    connected_list.extend(list(next_room_set))
    for next_room_i in next_room_set:
        next_connect_dic[next_room_i] = room_i

if len(set(range(2,room_num+1))-next_connect_dic.keys())!=0:
    print("No")
else:
    print("Yes")
    for i in range(2,room_num+1):
        print(next_connect_dic[i])
Problem p02681 (python)

Fixed submission:
first_str = input()
second_str = input()


if first_str == second_str[:len(first_str)] and len(first_str)+1 == len(second_str) and second_str[-1].islower():
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
first_str = input()
second_str = input()

if first_str == secofirst_str = input()
second_str = input()


if first_str == second_str[:len(first_str)] and len(first_str)+1 == len(second_str) and second_str[-1].islower():
    print("Yes")
else:
    print("No")
Problem p03501 (python)

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

Buggy submission (verdict: Runtime Error):
x = input()
fxsum = sum(map(int, list(x))) 
if int(x)%fxsum==0:
	print("Yes")
else:
	print("No")