Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 0
flg = "True"

while flg == "True":
    ans = ans + 1
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] / 2
        else:
            flg = "False"

print(ans)


Fixed submission:
a = str(input())
ans = 0
if a[0] == "1":
    ans = ans + 1

if a[1] == "1":
    ans = ans + 1

if a[2] == "1":
    ans = ans + 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 0
flg = "True"

while flg == "True":
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] / 2
        else:
            flg = "False"
    ans = ans + 1

print(ans)


Fixed submission:
a = str(input())
ans = 0
if a[0] == "1":
    ans = ans + 1

if a[1] == "1":
    ans = ans + 1

if a[2] == "1":
    ans = ans + 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 0
flg = "True"

while flg == "True":
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] / 2
        else:
            flg = "False"
    ans += 1

print(ans)


Fixed submission:
a = str(input())
ans = 0
if a[0] == "1":
    ans = ans + 1

if a[1] == "1":
    ans = ans + 1

if a[2] == "1":
    ans = ans + 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 0
flg == "True"

while flg == "True":
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] / 2
        else:
            flg == "False"
    ans += 1

print(ans)


Fixed submission:
a = str(input())
ans = 0
if a[0] == "1":
    ans = ans + 1

if a[1] == "1":
    ans = ans + 1

if a[2] == "1":
    ans = ans + 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 0
while(True):
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] / 2
        else:
            break
    ans += 1

print(ans)


Fixed submission:
a = str(input())
ans = 0
if a[0] == "1":
    ans = ans + 1

if a[1] == "1":
    ans = ans + 1

if a[2] == "1":
    ans = ans + 1

print(ans)

Buggy python submission (verdict: Runtime Error):
a = str(input())
ans = 0
if a[0] == 0:
    ans++

if a[1] == 0:
    ans++

if a[2] == 0:
    ans++

print(ans)


Fixed submission:
a = str(input())
ans = 0
if a[0] == "1":
    ans = ans + 1

if a[1] == "1":
    ans = ans + 1

if a[2] == "1":
    ans = ans + 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
while(True):
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] / 2
        else:
            break
    ans += 1

print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 0
flg = "True"

while flg == "True":
    ans += 1
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] / 2
        else:
            flg = "False"

print(ans - 1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = [int(input()) for _ in range(N)]
ans = [0] * (max(arr)+1)
for i in range(N):
    ans[arr[i]] += 1
a = 0
for i in ans:
    if i % 2 == 1:
        a += 1
print(a)

Fixed submission:
N = int(input())
arr = [int(input()) for _ in range(N)]
dic = {}
for i in arr:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
a = 0
for value in dic.values():
    if value % 2 == 1:
        a += 1
print(a)
Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = list(map(int, input().split()))
arr2 = [0]*(max(arr)+1)
if max(arr) == 1:
    print(len(arr))
    exit()
for i in range(N):
    arr2[arr[i]] += 1
ans = arr2[1] + arr2[2] + arr2[3]
tmp = ans
for i in range(4,len(arr2)):
    tmp = tmp - arr2[i-3] + arr2[i]
    if ans < tmp:
        ans = tmp
print(ans)

Fixed submission:
N = int(input())
arr = list(map(int, input().split()))
arr2 = [0]*(max(arr)+1)
if max(arr) < 4:
    print(len(arr))
    exit()
for i in range(N):
    arr2[arr[i]] += 1
ans = arr2[1] + arr2[2] + arr2[3]
tmp = ans
for i in range(4,len(arr2)):
    tmp = tmp - arr2[i-3] + arr2[i]
    if ans < tmp:
        ans = tmp
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = list(map(int, input().split()))
arr2 = [0]*(max(arr)+1)
if len(arr2) == 3:
    arr2 = [0]*4
for i in range(N):
    arr2[arr[i]] += 1
ans = arr2[1] + arr2[2] + arr2[3]
tmp = ans
for i in range(4,len(arr2)):
    tmp = tmp - arr2[i-3] + arr2[i]
    if ans < tmp:
        ans = tmp
print(ans)

Fixed submission:
N = int(input())
arr = list(map(int, input().split()))
arr2 = [0]*(max(arr)+1)
if max(arr) < 4:
    print(len(arr))
    exit()
for i in range(N):
    arr2[arr[i]] += 1
ans = arr2[1] + arr2[2] + arr2[3]
tmp = ans
for i in range(4,len(arr2)):
    tmp = tmp - arr2[i-3] + arr2[i]
    if ans < tmp:
        ans = tmp
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = list(map(int, input().split()))
arr2 = [0]*(max(arr)+1)
for i in range(N):
    arr2[arr[i]] += 1
ans = arr2[1] + arr2[2] + arr2[3]
tmp = ans
for i in range(4,len(arr2)):
    tmp = tmp - arr2[i-3] + arr2[i]
    if ans < tmp:
        ans = tmp
print(ans)

Fixed submission:
N = int(input())
arr = list(map(int, input().split()))
arr2 = [0]*(max(arr)+1)
if max(arr) < 4:
    print(len(arr))
    exit()
for i in range(N):
    arr2[arr[i]] += 1
ans = arr2[1] + arr2[2] + arr2[3]
tmp = ans
for i in range(4,len(arr2)):
    tmp = tmp - arr2[i-3] + arr2[i]
    if ans < tmp:
        ans = tmp
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
array = list(map(int,input().split()))
array.sort(reverse=True)
array2 = []
tmp = array[0]
for i in range(1,N):
    if tmp == array[i]:
        array2.append(array[i])
    tmp = array[i]
if array2.count(max(array2)) >= 4:
    print(max(array2)**2)
    exit()
array3 = list(set(array2))
array3.sort(reverse=True)
if 2 <= len(array3):
    print(array3[0]*array3[1])
else:
    print(0)

Fixed submission:
N = int(input())
array = list(map(int,input().split()))
array.sort(reverse=True)
array2 = []
tmp = array[0]
for i in range(1,N):
    if tmp == array[i]:
        array2.append(array[i])
    tmp = array[i]
if len(array2) >= 1 and array2.count(max(array2)) >= 4:
    print(max(array2)**2)
    exit()
array3 = list(set(array2))
array3.sort(reverse=True)
if 2 <= len(array3):
    print(array3[0]*array3[1])
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import fractions
N = int(input())
tokei = [int(input()) for _ in range(N)]
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
ans = lcm(tokei[0],tokei[1])
for i in range(2,N):
    ans = lcm(ans,tokei[i])
print(ans)

Fixed submission:
import fractions
N = int(input())
tokei = [int(input()) for _ in range(N)]
if N == 1:
    print(tokei[0])
    exit()
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
ans = lcm(tokei[0],tokei[1])
for i in range(2,N):
    ans = lcm(ans,tokei[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def dijkstra(s,n,w,cost):
    d = [float("inf")] * n
    used = [False] * n
    d[s] = 0
    while True:
        v = -1
        for i in range(n):
            if (not used[i]) and (v == -1):
               v = i
            elif (not used[i]) and d[i] < d[v]:
                v = i
        if v == -1:
               break
        used[v] = True
        for j in range(n):
               d[j] = min(d[j],d[v]+cost[v][j])
    return d

N = int(input())
cost = [[float("inf") for i in range(N)] for i in range(N)]
for _ in range(N-1):
    x,y,z = map(int,input().split())
    cost[x-1][y-1] = z
    cost[y-1][x-1] = z
Q, K = map(int, input().split())
result = dijkstra(K-1,N,N-1,cost)
for i in range(Q):
    x, y = map(int, input().split())
    print(abs(result[x-1]-result[K-1])+abs(result[y-1]+result[K-1]))

Fixed submission:
N = int(input())
import heapq
def dijkstra_heap(s):
    d = [float("inf")] * N
    used = [True] * N
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d


edge = [[] for i in range(N)]
for i in range(N-1):
    x,y,z = map(int,input().split())
    edge[x-1].append([z,y-1])
    edge[y-1].append([z,x-1])
Q, K = map(int, input().split())
result = dijkstra_heap(K-1)
for i in range(Q):
    x, y = map(int, input().split())
    print(abs(result[x-1]-result[K-1])+abs(result[y-1]+result[K-1]))
Buggy python submission (verdict: Runtime Error):
import fractions
N, K = map(int, input().split())
arr = list(map(int, input().split()))
t = fractions.gcd(arr[0],arr[1])
for i in range(1,N):
    t = fractions.gcd(t,arr[i])
if max(arr) < K or K % t != 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

Fixed submission:
import fractions
N, K = map(int, input().split())
arr = list(map(int, input().split()))
t = arr[0]
for i in range(1,N):
    t = fractions.gcd(t,arr[i])
if max(arr) < K or K % t != 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = []
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            b.append(a[i])
        else:
            b.insert(0,a[i])
else:
    for i in range(n):
        if i % 2 != 0:
            b.append(a[i])
        else:
            b.insert(0,a[i])
for i in b:
    print(i, end=" ")

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
left = []
right = []
if n % 2 == 0:
    for i in range(1,n+1):
        if i % 2 == 0:
            left.append(a[i-1])
        else:
            right.append(a[i-1])
else:
    for i in range(1,n+1):
        if i % 2 != 0:
            left.append(a[i-1])
        else:
            right.append(a[i-1])
left.reverse()
for i in left:
    print(i,end=' ')
for i in right:
    print(i,end=' ')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
import sys
input = sys.stdin.readline
a = []
for i in range(1,N+1):
    a.append(int(input()))
ans = 1
check = a[0]
pre_index = 1
while True:
    if check == 2:
        print(ans)
        exit()
    if pre_index == a[check-1]:
        print(-1)
        exit()
    pre_index = check
    check = a[check-1]
    ans += 1

Fixed submission:
N = int(input())
import sys
input = sys.stdin.readline
a = []
for i in range(1,N+1):
    a.append(int(input()))
ans = 1
check = a[0]
pre_index = 1
while True:
    if 10**5 < ans:
        print(-1)
        exit()
    if check == 2:
        print(ans)
        exit()
    if pre_index == a[check-1]:
        print(-1)
        exit()
    pre_index = check
    check = a[check-1]
    ans += 1
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
ans = 0
while True:
    if 1 <= N and 2 <= M:
        N -= 1
        M -= 2
        ans += 1
        continue
    if N == 0 and 4 <= M:
        M -= 4
        ans += 1
    else:
        break
print(ans)

Fixed submission:
N, M = map(int,input().split())
ans = 0
if M - 2*N < 0:
    print(M//2)
else:
    print(N+((M-2*N)//4))
Buggy python submission (verdict: Runtime Error):
import copy
import sys
sys.setrecursionlimit(10**7)
N, M = map(int, input().split())
edges = [[] for _ in range(M)]
for _ in range(M):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)
ans = 0
def dfs(start,path):
    next_path = copy.copy(path)
    global ans
    next_path.append(start)
    if len(next_path) == N:
        ans += 1
        return
    for i in edges[start]:
        if i not in next_path:
            dfs(i,next_path)
dfs(0,[])
print(ans)

Fixed submission:
N, M = map(int, input().split())
G = [list(map(int, input().split())) for _ in range(M)]
edges = [[] for _ in range(N)]
for a, b in G:
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

def dfs(start, edges, path):
    path.append(start)
    if len(path) == N:
        path.pop()
        return 1
    ans = 0
    for u in edges[start]:
        if u in path:
            continue
        ans += dfs(u, edges, path)
    path.pop()
    return ans

print(dfs(0, edges, []))
Buggy python submission (verdict: Runtime Error):
print(input().count('g')-(-((-len(s))//2)))

Fixed submission:
s = input()
print(s.count('g')-(-((-len(s))//2)))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
print(max(n-m-1),0)

Fixed submission:
import sys
sys.setrecursionlimit(2*10**5)#必要に応じて

class UnionFind:#再帰上限に引っかかることがあるので
    def __init__(self,n):
        self.l=list(range(n))
        self.n=n
        self.rank=[0 for i in range(n)]
    def find(self,x):
        if self.l[x]==x:
            return x
        self.l[x]=self.find(self.l[x])
        return self.l[x]
    def union(self,x,y):
        if x==y:return
        if self.rank[x]>self.rank[y]:
            return self.union(y,x)
        a,b=self.find(x),self.find(y)
        self.l[a]=b
        self.rank[a]=max(self.rank[b]+1,self.rank[a])
    def isSame(self,x,y):
        return self.find(x)==self.find(y)
n,m=map(int,input().split())
u=UnionFind(n)
for i in range(m):
    a,b=map(int,input().split())
    u.union(a-1,b-1)
d=set()
for i in range(n):
    d.add(u.find(i))
print(len(d)-1)
Buggy python submission (verdict: Runtime Error):
-1000000000 0 -1000000000 0

Fixed submission:
a,b,c,d=map(int,input().split())
print(max(a*c,a*d,b*c,b*d))
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
n=7
ans=1
if k%2==0:
    print(-1)
    exit()
while n%k!=0:
    n=(n*10+7)%k
    ans+=1
print(ans)

Fixed submission:
k=int(input())
n=7
ans=1
if k%2==0 or k%5==0:
    print(-1)
    exit()
while n%k!=0:
    n=(n*10+7)%k
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
for i in range(1,n+1):
    k=int(i**0.5)+1
    a=0
    for x in range(1,k):
        for y in range(1,k):
            for z in range(1,k):
                if (x+y)**2+(y+z)**2+(z+x)**2==2*i:
                    #print(i,x,y,z,end=' ')
                    a+=1
                if (x+y)**2+(y+z)**2+(z+x)**2>2*i:
                    break
    print(a)

Fixed submission:
n=int(input())
k=int(n**0.5)+1
a=[0 for i in range(n+1)]
for x in range(1,k):
    for y in range(1,k):
        for z in range(1,k):
            g=x*x+y*y+z*z+x*y+y*z+x*z
            if g<=n:
                a[g]+=1
print(*a[1:],sep='\n')
Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ea=[0]
for i in range(n):
    ea.append(ea[i]+a[i])
eb=[0]
for i in range(m):
    eb.append(eb[i]+b[i])
tb=m
p=0
if n<m:
    ea,eb=eb,ea
    n,m=m,n
for i in range(n+1):
    while ea[i]+eb[tb]>k:
        if tb==0:
            break
        tb-=1
    if ea[i]+eb[tb]<=k:
        p=max(i+tb,p)
print(p)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ea=[0]
for i in range(n):
    ea.append(ea[i]+a[i])
eb=[0]
for i in range(m):
    eb.append(eb[i]+b[i])
tb=m
p=0
for i in range(n+1):
    while ea[i]+eb[tb]>k:
        if tb==0:
            break
        tb-=1
    if ea[i]+eb[tb]<=k:
        p=max(i+tb,p)
print(p)

Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
at,bt=0,0
p=0
while p<=k:
    if (n!=at and a[at]<b[bt]) or m==bt:
        p+=a[at]
        at+=1
    else:
        p+=b[bt]
        bt+=1
    if n==at and m==bt:
        print(at+bt)
        break
    #print(p)
else:
    print(at+bt-1)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ea=[0]
for i in range(n):
    ea.append(ea[i]+a[i])
eb=[0]
for i in range(m):
    eb.append(eb[i]+b[i])
tb=m
p=0
for i in range(n+1):
    while ea[i]+eb[tb]>k:
        if tb==0:
            break
        tb-=1
    if ea[i]+eb[tb]<=k:
        p=max(i+tb,p)
print(p)

Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
at,bt=0,0
p=0
while p<k:
    if (n!=at and a[at]<b[bt]) or m==bt:
        p+=a[at]
        at+=1
    else:
        p+=b[bt]
        bt+=1
    if n==at and m==bt:
        print(at+bt)
        break
    #print(p)
else:
    print(at+bt-1)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ea=[0]
for i in range(n):
    ea.append(ea[i]+a[i])
eb=[0]
for i in range(m):
    eb.append(eb[i]+b[i])
tb=m
p=0
for i in range(n+1):
    while ea[i]+eb[tb]>k:
        if tb==0:
            break
        tb-=1
    if ea[i]+eb[tb]<=k:
        p=max(i+tb,p)
print(p)

Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
at,bt=0,0
p=0
while p<k:
    if n!=at and a[at]<b[bt]:
        p+=a[at]
        at+=1
    else:
        p+=b[bt]
        bt+=1
    if n==at and m==bt:
        print(at+bt)
        break
    #print(p)
else:
    print(at+bt-1)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ea=[0]
for i in range(n):
    ea.append(ea[i]+a[i])
eb=[0]
for i in range(m):
    eb.append(eb[i]+b[i])
tb=m
p=0
for i in range(n+1):
    while ea[i]+eb[tb]>k:
        if tb==0:
            break
        tb-=1
    if ea[i]+eb[tb]<=k:
        p=max(i+tb,p)
print(p)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
p=1
for i in a:
    p*=i
print(p if p<=10**18 else -1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
p=1
if 0 in a:
    print(0)
    exit()
for i in a:
    p*=i
    if p>10**18:
        print(-1)
        exit()
print(p)
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
print(int(a)*int(float(b)*100)//100)

Fixed submission:
n=int(input())
al=list()
bl=list()
for i in range(n):
    a,b=map(int,input().split())
    al.append(a)
    bl.append(b)
al.sort()
bl.sort()
l=n//2
if n%2==0:
    print(bl[l-1]+bl[l]-al[l-1]-al[l]+1)
else:
    print(bl[l]-al[l]+1)
Buggy python submission (verdict: Runtime Error):
print(input().reaplce('?','D'))


Fixed submission:
print(input().replace('?','D'))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,m,*inp=map(int,open(0).read().split())
d=[[] for i in range(n)]
for i in range(m):
    j=2*i
    a,b=inp[j:j+2]
    a-=1
    b-=1
    d[a].append(b)
    d[b].append(a)
l=[-1 for i in range(n)]
q=deque([0])
#print(d)
while len(q)>0:
    x=q.popleft()
    for i in d[x]:
        #print(i)
        if i!=0 and l[i]==-1 and x not in q:
            q.append(i)
            #print(i)
            l[i]=str(x+1)
l=l[1:]
#print(l)
print('No' if 0 in l else 'Yes\n'+'\n'.join(l))


Fixed submission:
from collections import deque
n,m,*inp=map(int,open(0).read().split())
d=[[] for i in range(n)]
for i in range(m):
    j=2*i
    a,b=inp[j:j+2]
    a-=1
    b-=1
    d[a].append(b)
    d[b].append(a)
l=[-1 for i in range(n)]
q=deque([0])
#print(d)
while len(q)>0:
    x=q.popleft()
    for i in d[x]:
        #print(i)
        if l[i]==-1:
            q.append(i)
            #print(i)
            l[i]=str(x+1)
l=l[1:]
#print(l)
print('No' if 0 in l else 'Yes\n'+'\n'.join(l))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,m=map(int,input().split())
d=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    d[a].append(b)
    d[b].append(a)
l=[-1 for i in range(n)]
q=deque([0])
#print(d)
while len(q)>0:
    x=q.popleft()
    for i in d[x]:
        #print(i)
        if i!=0 and l[i]==-1 and x not in q:
            q.append(i)
            #print(i)
            l[i]=str(x+1)
l=l[1:]
#print(l)
print('No' if 0 in l else 'Yes\n'+'\n'.join(l))


Fixed submission:
from collections import deque
n,m,*inp=map(int,open(0).read().split())
d=[[] for i in range(n)]
for i in range(m):
    j=2*i
    a,b=inp[j:j+2]
    a-=1
    b-=1
    d[a].append(b)
    d[b].append(a)
l=[-1 for i in range(n)]
q=deque([0])
#print(d)
while len(q)>0:
    x=q.popleft()
    for i in d[x]:
        #print(i)
        if l[i]==-1:
            q.append(i)
            #print(i)
            l[i]=str(x+1)
l=l[1:]
#print(l)
print('No' if 0 in l else 'Yes\n'+'\n'.join(l))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,m=map(int,input().split())
d={i:[] for i in range(1,n+1)}
for i in range(m):
    a,b=map(int,input().split())
    d[a].append(b)
    d[b].append(a)
l=[0 for i in range(n+1)]
q=deque([1])
#print(d)
while len(q)>0:
    x=q.popleft()
    for i in d[x]:
        #print(i)
        if i!=1 and l[i]==0 and x not in q:
            q.append(i)
            #print(i)
            l[i]=str(x)
l=l[2:]
#print(l)
print('No' if 0 in l else 'Yes\n'+'\n'.join(l))


Fixed submission:
from collections import deque
n,m,*inp=map(int,open(0).read().split())
d=[[] for i in range(n)]
for i in range(m):
    j=2*i
    a,b=inp[j:j+2]
    a-=1
    b-=1
    d[a].append(b)
    d[b].append(a)
l=[-1 for i in range(n)]
q=deque([0])
#print(d)
while len(q)>0:
    x=q.popleft()
    for i in d[x]:
        #print(i)
        if l[i]==-1:
            q.append(i)
            #print(i)
            l[i]=str(x+1)
l=l[1:]
#print(l)
print('No' if 0 in l else 'Yes\n'+'\n'.join(l))
Buggy python submission (verdict: Runtime Error):
printt('ARC' if input()=='ABC' else 'ABC')

Fixed submission:
s=input()
print('ABC' if s=='ARC' else 'ARC')

Buggy python submission (verdict: Runtime Error):
mycode

Fixed submission:
s=input()
print('ABC' if s=='ARC' else 'ARC')

Buggy python submission (verdict: Runtime Error):
x = int(input())
for i in range(-102,103):
    for j in range(-102,103):
        if (i**5)-(j**5)==x:
            print(i,j)
            exit()


Fixed submission:
s=input()
print('ABC' if s=='ARC' else 'ARC')
Buggy python submission (verdict: Time Limit Exceeded):
l=list()
for i in range(int(input())):
    s=input()
    if s not in l:
        l.append(s)
print(len(l))

Fixed submission:
n,*l=open(0).read().split()
print(len(set(l)))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,x,y=map(int,input().split())
l=[[1]]
for i in range(1,n-1):
    l.append([i-1,i+1])
l.append([n-2])
x,y=x-1,y-1
l[x].append(y)
l[y].append(x)
#print(l)
p=[0 for i in range(n)]
for j in range(n):
    s=[-1 for i in range(n)]
    s[j]=0
    q=deque([j])
    while len(q)>0:
        a=q.popleft()
        for i in l[a]:
            if s[i]==-1:
                s[i]=s[a]+1
                q.append(i)
    for i in s:
        if i!=0:
            p[i]+=1
print(*map(lambda x:x//2,p[1:]),sep='\n')

Fixed submission:
from collections import deque
n,x,y=map(int,input().split())
l=[[1]]
for i in range(1,n-1):
    l.append([i-1,i+1])
l.append([n-2])
x,y=x-1,y-1
l[x].append(y)
l[y].append(x)
#print(l)
p=[0 for i in range(n)]
for j in range(n):
    s=[-1 for i in range(n)]
    s[j]=0
    q=deque([j])
    while len(q)>0:
        a=q.popleft()
        for i in l[a]:
            if s[i]==-1:
                s[i]=s[a]+1
                q.append(i)
    for i in s:
        if i!=0:
            p[i]+=1
print(*map(lambda x:x//2,p[1:]),sep='\n')