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

Fixed submission:
def main():
    n,m=map(int,input().split())
    ab=[list(map(int,input().split())) for _ in [0]*m]
    if n==1:
        for a,b in ab:
            print(min(a,b))
        return
    for a,b in ab:
        while a!=b:
            a,b=min(a,b),max(a,b)
            b=(b+n-2)//n
        print(a)
    
main()

Buggy submission (verdict: Runtime Error):
def main():
    n,m=map(int,input().split())
    if n==1:
        for a,b in ab:
            print(min(a,b))
    ab=[list(map(int,input().split())) for _ in [0]*m]
    for a,b in ab:
        while a!=b:
            a,b=min(a,b),max(a,b)
            b=(b+n-2)//n
        print(a)
    
main()

Buggy submission (verdict: Runtime Error):
def main():
    n,m=map(int,input().split())
    ab=[list(map(int,input().split())) for _ in [0]*n]
    for a,b in ab:
        while a!=b:
            a,b=min(a,b),max(a,b)
            b=(b+1)//3
        print(a)
    
    
main()
Problem p03526 (python)

Fixed submission:
def main():
    import sys
    input=sys.stdin.readline
    n=int(input())
    hp=sorted([list(map(int,input().split())) for _ in [0]*n],key=lambda x:sum(x))
    dp=[10**10]*(n+1)
    dp[0]=0
    for c,[h,p] in enumerate(hp):
        for k in range(c,-1,-1):
            if dp[k]<=h:
                dp[k+1]=min(dp[k+1],dp[k]+p)
    for i in range(n,-1,-1):
        if dp[i]!=10**10:
            print(i)
            break
if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
     input=sys.stdin.readline
    n = int(input())
    hp = sorted([tuple(map(int, input().split()))
                 for _ in [0]*n], key=lambda x: sum(x))
    dp = [10**10]*(n+1)
    dp[0] = 0
    for c, (h, p) in enumerate(hp):
        for k in range(c, -1, -1):
            if dp[k] <= h:
                dp[k+1] = min(dp[k+1], dp[k]+p)
    for i in range(n, -1, -1):
        if dp[i] != 10**10:
            print(i)
            break


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

Fixed submission:
n,x,y=map(int,input().split())
a=list(map(int,input().split()))
if len(a)==1:a=a+a
print(max(abs(y-a[-1]),abs(a[-1]-a[-2])))

Buggy submission (verdict: Runtime Error):
n=int(input())
p=[list(map(int,input().split())) for _ in [0]*(n-1)]
g=[[] for _ in [0]*n]

[g[a-1].append(b-1) for a,b in p]
[g[b-1].append(a-1) for a,b in p]

memo=[False for _ in [0]*n]
q=[0]
memo[0]=True
last=0
while(q):
	qq=[]
	for i in q:
		for j in g[i]:
			if memo[j]==False:
				memo[j]=True
				last=j
				qq.append(j)
	q=qq

memo=[False for _ in [0]*n]
q=[last]
memo[0]=True
cnt=0
while(q):
	cnt+=1
	qq=[]
	for i in q:
		for j in g[i]:
			if memo[j]==False:
				memo[j]=True
				qq.append(j)
	q=qq
	
if cnt%3==2:
	print('Second')
else:
	print('First')
Problem p03579 (python)

Fixed submission:
def main():
    n,m=map(int,input().split())
    ab=[list(map(int,input().split())) for _ in [0]*m]
    g=[[] for _ in [0]*n]
    [g[a-1].append(b-1) for a,b in ab]
    [g[b-1].append(a-1) for a,b in ab]
    ans=[None]*n
    ans[0]=0
    temp=[0]
    while temp:
        i=temp.pop()
        for j in g[i]:
            if ans[j]==None:
                ans[j]=ans[i]^True
                temp.append(j)
            else:
                if ans[i]^ans[j]==0:
                    print(n*(n-1)//2-m)
                    return 0
    print(ans.count(0)*ans.count(1)-m)
main()

Buggy submission (verdict: Runtime Error):
def main():
    n,m=map(int,input().split())
    ab=[list(map(int,input().split())) for _ in [0]*m]
    g=[[] for _ in [0]*n]
    [g[a-1].append(b-1) for a,b in ab]
    [g[b-1].append(a-1) for a,b in ab]
    ans=[None]*n
    ans[0]=0
    temp=[0]
    while temp:
        i=temp.pop()
        for j in g[i]:
            if ans[j]==None:
                ans[j]=ans[i]^True
                temp.append(j)
            else:
                if ans[i]^ans[j]==0:
                    #print(n*(n-1)//2-m)
                    print(1/0)
                    return 0
    print((ans.count(0)*(ans.count(0)-1)//2)*(ans.count(1)*(ans.count(1)-1)//2)-m)
main()
Problem p03583 (python)

Fixed submission:
n=int(input())
def abc(N,a,b,c):
    return 4*a*b*c-N*(a*b+b*c+c*a)
for i in range(1,3501):
    flag=0
    if (1/i)>=(4/n):
        continue
    for j in range(i,3501):
        if 4*i*j-n*i-n*j>0:
            k=int((n*i*j)/(4*i*j-n*i-n*j))
            if k>0:
                if abc(n,i,j,k)==0:
                    print(i,j,k)
                    flag=1
                    break
    if flag>0:
        break

Buggy submission (verdict: Runtime Error):
n=int(input())
def abc(N,a,b,c):
    return 4*a*b*c-N*(a*b+b*c+c*a)
for i in range(1,3501):
    flag=0
    if (1/i)>=(4/n):
        continue
    for j in range(i,3501):
        k=int((n*i*j)/(4*i*j-n*i-n*j))
        if k>0:
            if abc(n,i,j,k)==0:
                print(i,j,k)
                flag=1
                break
    if flag>0:
        break
Problem p03597 (python)

Fixed submission:
N,A = [int(input()) for _ in range(2)]
print(N**2 - A)

Buggy submission (verdict: Runtime Error):
N,A = [input() for _ in range(2)]
print(N**2 - A)
Problem p03600 (python)

Fixed submission:
def main():
    n=int(input())
    if n==1:
        print(0)
        return 0
    import numpy as np
    p=np.array([np.array(list(map(int,input().split()))) for _ in [0]*n])
    if n==2:
        print(p[0][1])
        return 0
    import scipy.sparse.csgraph as sp
    ans=0
    d=np.full((n,n),0)
    for i in range(n):
        for j in range(i+1,n):
            b=p[i][j]
            if b!=np.sort(p[i]+p[j])[2]:
                d[i][j],d[j][i]=b,b
                ans+=b
    s=sp.shortest_path(d)
    if (s==p).all():
        print(ans)
    else:
        print(-1)
main()

Buggy submission (verdict: Runtime Error):
def main():
    import numpy as np
    import scipy.sparse.csgraph as sp
    n=int(input())
    p=np.array([np.array(list(map(int,input().split()))) for _ in [0]*n])
    ans=0
    d=np.full((n,n),0)
    for i in range(n):
        for j in range(i+1,n):
            b=p[i][j]
            if b!=np.sort(p[i]+p[j])[2]:
                d[i][j],d[j][i]=b,b
                ans+=b
    s=sp.shortest_path(d)
    if (s==p).all():
        print(ans)
    else:
        print(-1)
main()
Problem p03633 (python)

Fixed submission:
from fractions import gcd
N=int(input())
T=[int(input()) for _ in range(N)]
a=0
ans=T[0]
for t in T:
    a=gcd(a,t)
    ans*=t//a
    a=ans
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N=int(input())
T=[int(input()) for _ in range(N)]
for t in T:
    a=gcd(a,t)
ans=a
for t in T:
    ans*=t//a
print(ans)
Problem p03635 (python)

Fixed submission:
m,n=map(int,input().split());print((m-1)*(n-1))

Buggy submission (verdict: Runtime Error):
print((int(input())-1)*(int(input())-1))
Problem p03657 (python)

Fixed submission:
A,B=map(int,input().split());print(("Possible","Impossible")[min([A%3,B%3,(A+B)%3])])

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split());print(("Possible","Impossible")[min([A%3,B%3,(A+B)%3])]
Problem p03814 (python)

Fixed submission:
s=input()
for i in range(len(s)):
  if s[i]=="A":
    a=i
    break
for i in reversed(range(len(s))):
  if s[i]=="Z":
    b=i
    break
print(b-a+1)

Buggy submission (verdict: Runtime Error):
s=input()
for i in range(len(s)):
  if s[i]==`A`:
    a=i
    break
for i in reversed(range(len(s))):
  if s[i]==`Z`:
    b=i
    break
print(b-a)
Problem p03861 (python)

Fixed submission:
a,b,x=map(int,input().split())
print(b//x-(a-1)//x)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(b//x-(a-1)//x)

Buggy submission (verdict: Runtime Error):
print(b//x-(a-1)//x)
Problem p03866 (python)

Fixed submission:
def main():
    import heapq
    from sys import stdin
    input=stdin.readline
    xs,ys,xt,yt=map(int,input().split())
    n=int(input())
    xyr=[[xs,ys,0],[xt,yt,0]]+[list(map(int,input().split())) for _ in [0]*n]
    g=[[] for _ in [0]*(n+2)]
    for i in range(n+1):
        x1,y1,r1=xyr[i]
        for j in range(i+1,n+2):
            x2,y2,r2=xyr[j]
            d_temp=max(0,((x1-x2)**2+(y1-y2)**2)**0.5-r1-r2)
            g[i].append((j,d_temp))
            g[j].append((i,d_temp))
    d=[0]*(n+2)
    visit=[False]*(n+2)
    visit[0]=True
    h=[]
    for i,j in g[0]:
        h.append((j,i))
    heapq.heapify(h)
    while h:
        i,j=heapq.heappop(h)
        if visit[j]==True:
            continue
        visit[j]=True
        d[j]=i
        for k,l in g[j]:
            if visit[k]==False:
                heapq.heappush(h,(l+i,k))
    print(d[1])
main()

Buggy submission (verdict: Runtime Error):
from heapq import *
def main():
    import numpy as np
    xs,ys,xt,yt=map(int,input().split())
    n=int(input())
    xyr=[[xs,ys,0],[xt,yt,0]]+[list(map(int,input().split())) for _ in [0]*n]
    inf=float('inf')
    g=[[] for _ in [0]*(n+2)]
    for i in range(n+1):
        x1,y1,r1=xyr[i]
        xy1=np.array([x1,y1])
        for j in range(i+1,n+2):
            x2,y2,r2=xyr[j]
            xy2=np.array([x2,y2])
            d_temp=max(0,np.linalg.norm(xy1-xy2)-r1-r2)
            g[i].append([j,d_temp])
            g[j].append([i,d_temp])
    d=[10**10]*(n+2)
    visit=[False]*(n+2)
    visit[0]=True
    h=[]
    for i,j in g[0]:
        h.append([j,i])
    heapify(h)
    while h:
        i,j=heappop(h)
        if visit[j]==True:
            continue
        visit[j]=True
        d[j]=i
        for k,l in g[j]:
            if visit[k]==False:
                heappush(h,[l+i,k])
    print(d[1])
main()
Problem p03880 (python)

Fixed submission:
def main():
    n = int(input())
    a = [int(input()) for _ in [0]*n]
    xor = 0
    for i in a:
        xor ^= i
    i = 1
    cnt = 0
    while True:
        if xor >= i:
            i *= 2
            cnt += 1
        else:
            break
    ans = 0
    for i in range(cnt-1, -1, -1):
        j = (xor & 2**i) // (2**i)
        if j == 1:
            for k in a:
                if (k & 2**i) // (2**i) == 1 and k % (2**i) == 0:
                    xor ^= k
                    xor ^= k-1
                    ans += 1
                    a.remove(k)
                    break
            else:
                print(-1)
                return 0
    print(ans)


main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = [int(input()) for _ in [0]*n]
    m = max(a)
    xor = 0
    for i in a:
        xor ^= i
    i = 1
    cnt = 0
    while True:
        if xor >= i:
            i *= 2
            cnt += 1
        else:
            break
    ans = 0
    for i in range(cnt-1, -1, -1):
        j = (xor & 2**i) // (2**i)
        if j == 1:
            for k in a:
                if k % (2**i) == 0:
                    xor ^= k
                    xor ^= k-1
                    ans += 1
                    a.remove(k)
                    break
            else:
                print(-1/0)
                return 0
    print(ans)


main()
Problem p03937 (python)

Fixed submission:
H,W=map(int,input().split())
G=[input()+"." for _ in range(H)]+["."*(W+1)]
G_cnt=sum([g.count("#") for g in G])
p=[0,0]
i=1
while(p!=[H-1,W-1]):
    if G[p[0]+1][p[1]]==G[p[0]][p[1]+1]:
        print("Impossible")
        break
    elif G[p[0]+1][p[1]]=="#":
        p=[p[0]+1,p[1]]
        i+=1
    else:
        p=[p[0],p[1]+1]
        i+=1
else:
    if i==G_cnt:
        print("Possible")
    else:
        print("Impossible")

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
G=[input()+"." for _ in range(4)]+["."*(W+1)]
p=[0,0]
while(p!=[H-1,W-1]):
    if G[p[0]+1][p[1]]==G[p[0]][p[1]+1]:
        print("Impossible")
        break
    elif G[p[0]+1][p[1]]=="#":
        p=[p[0]+1,p[1]]
    else:
        p=[p[0],p[1]+1]
else:
    print("Possible")
Problem p03943 (python)

Fixed submission:
a=list(map(int,input().split()));print("YNeos"[sum(a)!=max(a)*2::2])

Buggy submission (verdict: Runtime Error):
a=list(map(int,input()));print("YNeos"[sum(a)!=max(a)*2])
Problem p03957 (python)

Fixed submission:
s = input()
flag = 0
for i in range(len(s)):
  if s[i]=="C":
    flag=1
  if s[i]=="F" and flag==1:
    flag=2
if flag>1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
flag = 0
for i in len(range(s)):
  if s[i]=="C":
    flag=1
  if s[i]=="F" and flag==1:
    flag=2
if flag>1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
flag = 0
for i in len(range(s)):
  if s[i]=="C":
    flag=1
  if s[i]=="F" and flag=1:
    flag=2
if flag>1:
  print("Yes")
else:
  print("No")
Problem p03960 (python)

Fixed submission:
def main():
    h, w = map(int, input().split())
    grid = [list(input()) for _ in [0]*h]
    grid = [[grid[j][i] for j in range(h)] for i in range(w)]
    ans = 0
    for i in range(w-1):
        same = [[0]*(h+1) for _ in [0]*(h+1)]
        for j in range(h-1, -1, -1):
            for k in range(h-1, -1, -1):
                same[j][k] += same[j+1][k+1]+(grid[i][-j-1] == grid[i+1][-k-1])
        dp = [[10**10]*(h+1) for _ in [0]*(h+1)]
        dp[0][0] = same[0][0]
        for j in range(h+1):
            for k in range(h+1):
                if j != 0:
                    dp[j][k] = min(dp[j][k], dp[j-1][k]+same[j][k])
                if k != 0:
                    dp[j][k] = min(dp[j][k], dp[j][k-1]+same[j][k])
        ans += dp[h][h]
    print(ans)


main()

Buggy submission (verdict: Runtime Error):
def main():
    h, w = map(int, input().split())
    grid = [list(input()) for _ in [0]*h]
    grid = [[grid[j][i] for j in range(h)] for i in range(w)]
    ans = 0
    for i in range(w-1):
        same = [[0]*(h+1) for _ in [0]*(w+1)]
        for j in range(h-1, -1, -1):
            for k in range(h-1, -1, -1):
                same[j][k] += same[j+1][k+1]+(grid[i][-j-1] == grid[i+1][-k-1])
        dp = [[10**10]*(h+1) for _ in [0]*(h+1)]
        dp[0][0] = same[0][0]
        for j in range(h+1):
            for k in range(h+1):
                if j != 0:
                    dp[j][k] = min(dp[j][k], dp[j-1][k]+same[j][k])
                if k != 0:
                    dp[j][k] = min(dp[j][k], dp[j][k-1]+same[j][k])
        ans += dp[h][h]
    print(ans)


main()
Problem p03987 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a=sorted(list(enumerate(a)),key=lambda x:x[1])

l=1
while l<2*(n+2)-1:
	l*=2
l-=1
seg=[True]*l
seg[0]=False

def update(i):
	if seg[i]:
		seg[i]=False
		update((i-1)//2)

update((l-1)//2)
update((l-1)//2+n+1)

def search_left(i,j):
	if j==1:
		if i%2==1:
			return search_left((i-1)//2,1)
		else:
			if seg[i-1]:
				return search_left((i-1)//2,1)
			else:
				return search_left(i-1,0)
	else:
		if i<l//2:
			return search_left(2*i+2-seg[2*i+2],0)
		else:
			return i

def search_right(i,j):
	if j==1:
		if i%2==0:
			return search_right((i-1)//2,1)
		else:
			if seg[i+1]:
				return search_right((i-1)//2,1)
			else:
				return search_right(i+1,0)
	else:
		if i<l//2:
			return search_right(2*i+1+seg[2*i+1],0)
		else:
			return i

ans=0
for i,j in a:
	s=(l//2+1+i)
	p=search_left(s,1)
	q=search_right(s,1)
	ans+=(s-p)*(q-s)*j
	update(s)

print(ans)

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a = sorted(list(enumerate(a)), key=lambda x: -x[1])
    L = [i for i in range(n+2)]  # 連結成分のうち一番左のindex
    R = [i for i in range(n+2)]  # 連結成分のうち一番右のindex
    ans = 0
    for i, j in a:  # 1-indexなので1ずれる
        print(L, R)
        M = R[i+1]  # 連結成分の最大値
        m = L[i+1]  # 連結成分の最小値
        ans += j*(M-i)*(i+2-m)  # 計算
        R[m-1] = M  # 連結成分の左端の更新
        L[M+1] = m  # 連結成分の右端の更新
    print(ans)


main()
Problem p03997 (python)

Fixed submission:
print((int(input())+int(input()))*int(input())//2)

Buggy submission (verdict: Runtime Error):
a,b,h=map(int,input().split());print((a+b)*h/2)
Problem p04006 (python)

Fixed submission:
n,x=map(int,input().split())
a=list(map(int,input().split()))
b=[[None for _ in [0]*n] for _ in [0]*n]

for i in range(n):
	m=a[i]
	for j in range(n):
		k=i-j
		if k<0:
			k+=n
		m=min(m,a[k])
		b[j][i]=m

m=10**15
for i,j in enumerate(b):
	m=min(m,sum(j)+x*i)
print(m)

Buggy submission (verdict: Runtime Error):
from copy import deepcopy as dc
#n,x=map(int,input().split())
x=int(input()) #
a=list(map(int,input().split()))

n=len(a) #
a=[[i,i,0] for i in a]
aa=dc(a)
b=[]

m=0
while(b!=a):
    b=dc(a)
    for _ in range(2):
        for i in range(n):
            j=i-1
            if j==-1:
                j=n-1
            if a[i][1]!=a[j][1]:
                if aa[i][0]>=a[j][1]+x or (aa[i][0]>=a[j][1] and a[j][2]<m):
                    a[i][0]=a[j][1]+x
                    a[i][1]=a[j][1]
                    a[i][2]=a[j][2]+1
    for i in a:
        m=max(i[2],m)
        
s=0
s+=m*x
for i in a:
    s+=i[1]
print(s)
#print(a)

Buggy submission (verdict: Runtime Error):
from copy import deepcopy as dc
#n,x=map(int,input().split())
x=int(input()) #
a=list(map(int,input().split()))
n=len(a) #
a=[[i,i,0] for i in a]
b=[]

m=0
while(b!=a):
    b=dc(a)
    for _ in range(2):
        for i in range(n):
            j=i-1
            if j==-1:
                j=n-1
            if a[i][1]!=a[j][1]:
                if a[i][0]>=a[j][1]+x or (a[i][0]>=a[j][1] and a[j][2]<m):
                    a[i][0]=a[j][1]+x
                    a[i][1]=a[j][1]
                    a[i][2]=a[j][2]+1
    for i in a:
        m=max(i[2],m)
        
s=0
s+=m*x
for i in a:
    s+=i[1]
print(s)
Problem p04011 (python)

Fixed submission:
N,K,X,Y=[int(input()) for _ in range(4)];print(min(N,K)*X+max(N-K,0)*Y)

Buggy submission (verdict: Runtime Error):
N,K,X,Y=[input() for _ in range(4)];print(min([N,K])*X+max([N-K,0])*Y)

Buggy submission (verdict: Runtime Error):
N,K,X,Y=[input() for _ in range(4)];print(K*X+max(N-K,0)*Y)
Problem p04030 (python)

Fixed submission:
S=input()
ans=[]
for i in range(len(S)):
  if S[i] in ["0","1"]:
    ans.append(S[i])
  elif len(ans) > 0:
    ans.pop(-1)
print("".join(ans))

Buggy submission (verdict: Runtime Error):
S=input()
ans=[]
for i in range(len(S)):
  if S[i] in ["0","1"]:
    ans.append(S[i])
  else:
    ans.pop(-1)
print("".join(ans))
Problem p03140 (python)

Fixed submission:
n = int(input())
a = input()
b = input()
c = input()
count = 0 
for i in range(n):
    if a[i] == b[i]:
        if b[i] != c[i]:
            count += 1
    else:
        if a[i] == c[i] or b[i] == c[i]:
            count += 1
        else:
            count += 2
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input()
b = input()
c = input
count = 0

for i in range(n):
    if a[i] != b[i]:
        count += 1
    if b[i] != c[i]:
        count += 1
    if c[i] != a[i]:
        count += 1
print(count)
Problem p03141 (python)

Fixed submission:
n = int(input())
ab = []
bsum = 0
for i in range(n):
    a,b = map(int,input().split(' '))
    ab.append(a + b)
    bsum += b
ab.sort(reverse = True)
print(sum(ab[0::2]) - bsum)

Buggy submission (verdict: Runtime Error):
n = int(input())
ab = []
bsum = 0
for i in range(n):
    a,b = map(int,input().split(' '))
    ab.append(a + b)
    bsum += b
ad.sort(reverse = True)
print(sum(ab[0::2]) - bsum)
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split(‘ ‘))
print((a - 1) * (b - 1))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split(‘ ‘))
print((a - 1) * (b - 1))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split(“ “))
print((a - 1) * (b - 1))
Problem p03302 (python)

Fixed submission:
a,b = map(int,input().split(' '))
if a + b == 15:
    print('+')
elif a * b == 15:
    print('*')
else:
    print('x')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split(' '))
if a + b == 15:
    print('+')
elif a ＊ b == 15:
    print('＊')
else:
    print('x')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split(' ')
if a + b == 15:
    print('+')
elif a ＊ b == 15:
    print('＊')
else:
    print('x')

Buggy submission (verdict: Runtime Error):
a,b =map(int,input().split(' ')
if a + b == 15:
    print('+')
elif a ＊ b == 15:
    print('＊')
else:
    print('x')

Buggy submission (verdict: Runtime Error):
a,b =map(int,input().split(' ')
if a + b == 15:
    print('+')
elsif a ＊ b == 15:
    print('＊')
else:
    print('x')
Problem p03352 (python)

Fixed submission:
n = int(input())
if n == 1:
    print(1)
else:
    ans = 1
    for i in range(2,n):
        temp = i ** 2
        while temp <= n:
            ans = max(ans,temp)
            temp *= i
    print(ans)

Buggy submission (verdict: Runtime Error):
if n == 1:
    print(1)

else:
    for i in range(2,11):
        for j in range(2,11):
            if i ** j <= n:
                Min = min(Min,n - i ** j)
    print(n - Min)
Problem p03486 (python)

Fixed submission:
s = input()
t = input()

s_2 = "".join(sorted(s))
t_2 = "".join(sorted(t,reverse = True))

if s_2 < t_2 :
    print("Yes")
else:
    print("No")

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

s_2 = "".join(sorted(s))
t_2 = "".join(sorted(t,reverse = True)

if s_2 < t_2 :
    print("Yes")
else:
    print("No")

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

s_2 = "".join(sorted(s))
t_2 = "".join(sorted(t,reverse = True)

if(s_2 < t_2):
    print("Yes")
else:
    print("No")

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

s_2 = "".join(sorted(s))
t_2 = "".join(sorted(t,reverse = True)

if(s_2 < t_2):
    print("YES")
else:
    print("NO")
Problem p03549 (python)

Fixed submission:
n,m = map(int,input().split(' '))

print((1900 * m + 100 * (n - m)) * 2 ** m)

Buggy submission (verdict: Runtime Error):
n = int(input())
i = 1;
while(True):
    if((i ** 2 + i) // 2 >= n):
        print(i)
        break
    i += 1
Problem p03588 (python)

Fixed submission:

n = int(input())
temp = 0
ans = 0
for i in range(n):
    a,b = map(int,input().split(' '))
    if a > temp:
        ans = a + b
        temp = a
print(ans)

Buggy submission (verdict: Runtime Error):

n = int(input())
temp = 0
ans = 0
for i in range(n):
    a,b = map(int,input().split(' '))
    if a > temp:
        ans = a + b
print ans
Problem p03993 (python)

Fixed submission:
n = int(input())
nums = list(map(int,input().split(' ')))
count = 0
for i in range(n):
    if i + 1 == nums[nums[i] - 1]:
        count += 1
print(count // 2)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = [int(input()) - 1 for i in range(n)]
count = 0
for i in range(n):
    if i == nums[nums[i]]:
        count += 1
print(count // 2)