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

Fixed submission:
a,b,c,d,e,f=map(int,input().split())
w=set([])
for i in range(31):
    for j in range(31):
        x=a*i*100+b*j*100
        if 0<x<=f:
            w.add(x)
s=set([])
for i in range(3001):
    for j in range(3001):
        y=c*i+d*j
        if y<=f:
            s.add(y)
tmpn=-1
ans=[0,0]
for i in w:
    for j in s:
        if i+j<=f and i//100*e>=j:
            if tmpn<j/(1.0*(i+j)):
                tmpn=j/(1.0*(i+j))
                ans=[i+j,j]
print(*ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
w=set([])
for i in range(31):
    for j in range(31):
        x=a*i*100+b*j*100
        if 0<x<=f:
            w.add(x)
s=set([])
for i in range(3001):
    for j in range(3001):
        y=c*i+d*j
        if y<=f:
            s.add(y)
tmpn=0
for i in w:
    for j in s:
        if i+j<=f and i//100*e>=j:
            if tmpn<j/(1.0*(i+j)):
                tmpn=j/(1.0*(i+j))
                ans=[i,j]
print(*ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
w=set([])
for i in range(31):
    for j in range(31):
        x=a*i*100+b*j*100
        if x<=f:
            w.add(x)
s=set([])
for i in range(3001):
    for j in range(3001):
        y=c*i+d*j
        if y<=f:
            s.add(y)
tmpn=0
for i in w:
    for j in s:
        if i+j<=f and i//100*e>=j:
            if tmpn<j/(1.0*(i+j)):
                tmpn=j/(1.0*(i+j))
                ans=[i,j]
print(*ans)
Problem p03607 (python)

Fixed submission:
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
l.sort()
l.append(10000000000000000000000)
f=1
ans=0
for i in range(n):
    if l[i]==l[i+1]:
        f+=1
    else:
        ans+=f%2
        f=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
l.sort()

ans=0
c=0
for i in range(n-1):
    if len(l)>0 and l[c]==l[c+1]:
        l.pop(c)
        l.pop(c)
    else:
        c+=1
if len(l)==n:
    print(n)
else:
    print(len(l))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
l.sort()

ans=0
c=0
for i in range(n-1):
    if len(a)>0 and a[c]==a[c+1]:
        a.pop(0)
        a.pop(0)
    else:
        c+=1
print(len(a))
Problem p03608 (python)

Fixed submission:
import itertools
n,m,r=map(int,input().split())
rr=list(map(int,input().split()))
inf=10000000000
g=[[inf for i in range(n)] for j in range(n)]
for i in range(m):
    a,b,c=map(int,input().split())
    g[a-1][b-1]=c
    g[b-1][a-1]=c
for k in range(n):
    for i in range(n):
        for j in range(n):
            g[i][j]=min(g[i][j],g[i][k]+g[k][j])


ans=10**10
for i in itertools.permutations(range(0,r),r):
    kai=0
    for j in range(r-1):
        kai+=g[rr[i[j]]-1][rr[i[j+1]]-1]
    ans=min(ans,kai)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import permutations
n,m,r=map(int,input().split())
rr=list(map(int,input().split()))
inf=10000000000
g=[[inf for i in range(n)] for j in range(n)]
for i in range(m):
    a,b,c=map(int,input().split())
    g[a-1][b-1]=c
    g[b-1][a-1]=c
for k in range(n):
    for i in range(n):
        for j in range(n):
            g[i][j]=min(g[i][j],g[i][k]+g[k][j])


ans=10**10
for i in permutations(range(0,n),n):
    kai=0
    for j in range(n-1):
        kai+=g[rr[i[j]]][rr[i[j+1]]]
    ans=min(ans,kai)
print(ans)
Problem p03626 (python)

Fixed submission:
n=int(input())
a=list(input())
b=list(input())
ans=1
i=0
f=0
mod=1000000007
while i!=n:
    if i==0:
        if a[i]==b[i]:
            i+=1
            ans*=3
            ans%=mod
            f=1
        else:
            i+=2
            ans*=6
            ans%=mod
            f=2
    else:
        if a[i]==b[i] and f==1:
            i+=1
            ans*=2
            ans%=mod
            f=1
        elif a[i]==b[i] and f==2:
            i+=1
            f=1
        elif a[i]!=b[i] and f==1:
            i+=2
            ans*=2
            ans%=mod
            f=2
        else:
            i+=2
            ans*=3
            ans%=mod
            f=2
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(input())
b=list(input())
ans=1
i=0
f=0
mod=1000000007
while k!=n:
    if i==0:
        if a[i]==b[i]:
            i+=1
            ans*=3
            ans%=mod
            f=1
        else:
            i+=2
            ans*=6
            ans%=mod
            f=2
    else:
        if a[i]==b[i] and f==1:
            i+=1
            ans*=2
            ans%=mod
            f=1
        elif a[i]==b[i] and f==2:
            i+=1
            f=1
        elif a[i]!=b[i] and f==1:
            i+=2
            ans*=2
            ans%=mod
            f=2
        else:
            i+=2
            ans*=2
            ans%=mod
            f=2
print(ans%mod)
Problem p03662 (python)

Fixed submission:
import math
import sys
sys.setrecursionlimit(1000000)
N = int(input())
graph = {}
SCORE = 0
def dfs(visited,v,depth):
    visited[v] = depth
    for next_v in graph[v]:
        if  visited[next_v]  == -1 :
            dfs(visited,next_v,depth + 1)




for _ in range(N-1):
    a,b = map(int,input().split())
    if a not in graph:
        graph[a] = [b]
    else:
        graph[a].append(b)

    if b not in graph:
        graph[b] = [a]
    else:
        graph[b].append(a)

vF = [-1] * (N + 1)
vF[1] = 0
dfs(vF,1,0)
# print(vF)

vS = [-1] * (N + 1)
vS[N] = 0

dfs(vS,N,0)
# print(vS)

fc = 0
sc = 0

for f,s in zip(vF[1:N + 1],vS[1:N + 1]):
    if f <= s:
        fc += 1
    else:
        sc += 1

# print(fc,sc)
if fc > sc:
    print("Fennec")
else:
    print("Snuke")

Buggy submission (verdict: Runtime Error):
n=int(input())
g=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)
q=[[0,[0]]]
v=[0]*n
v[0]=1
f=0
while True:
    p=q.pop(0)
    #if p[1][-1]==n-1:
        #break
    v[p[0]]=1
    for i in g[p[0]]:
        if v[i]==0:
            v[i]=1
            if i==n-1:
                r=p[1]+[i]
                f=1
                break
                q.append([i,p[1]+[i]])
    if f==1:
        break
fe=r[:(-(-len(r)//2))]
v=[0]*n
v[(-(-len(r)//2))]=1
v[0]=1
while fe:
    s=fe.pop(0)
    for i in g[s]:
        if v[i]==0:
            fe.append(i)
            v[i]=1
x=sum(v)-1
y=n-x
if x>y:
    print('Fennec')
else:
    print('Snuke')
Problem p03680 (python)

Fixed submission:
n=int(input())
l=[0]*n
for i in range(n):
    l[i]=int(input())

vi=[0]*n
vi[0]=1
ans=0
st=l[0]
f=0
while vi[1]==0:
    vi[st-1]+=1
    if vi[st-1]>1:
        f=1
        break
    st=l[st-1]
    ans+=1
if f==0:
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[0]*n
for i in range(n):
    l[i]=int(input())

vi=[0]*n
vi[0]=1
ans=1
st=l[0]
f=0
while vi[1]==0:
    vi[st]+=1
    if vi[st]>1:
        f=1
        break
    st=l[st-1]
    ans+=1
if f==0:
    print(ans)
else:
    print(-1)
Problem p03693 (python)

Fixed submission:
a,b,c=map(int,input().split())
if (100*a+10*b+c)%4==0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input())
if 100*a+10*b+c%4==0:
    print('YES')
else:
    print('NO')
Problem p03697 (python)

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

if a+b<10:
    print(a+b)
else:
    print('error')

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

if a+b<10:
    print(a+b)
else:
    print('error')
Problem p03714 (python)

Fixed submission:
import heapq
n=int(input())
l=list(map(int,input().split()))
q=[]
for i in range(n):
    heapq.heappush(q,l[i])
a1=[0]*(n+1)
a1[0]=sum(l[:n])
for i in range(n):
    p=heapq.heappop(q)
    a1[i+1]=a1[i]-p+max(p,l[i+n])
    heapq.heappush(q,max(p,l[i+n]))
#print(a1)
q=[]
l.reverse()
for i in range(n):
    heapq.heappush(q,-l[i])
a1.reverse()
a1[0]-=sum(l[:n])
z=sum(l[:n])
for i in range(n):
    p=heapq.heappop(q)
    z=z+p+min(-p,l[i+n])
    a1[i+1]-=z
    heapq.heappush(q,max(p,-l[i+n]))
print(max(a1))

Buggy submission (verdict: Runtime Error):
import heapq
n=int(input())
l=list(map(int,input().split()))
q=[]
for i in range(n):
    heapq.heappush(q,l[i])
a1=[0]*(n+1)
a1[0]=sum(l[:n])
for i in range(n):
    p=heapq.heappop(q)
    a1[i+1]=a1[i]-p+max(p,l[i+n])
    heapq.heappush(q,max(p,l[i+n]))
q=[]
l.reverse()
for i in range(n):
    heapq.heappush(q,-l[i])
a1.reverse()
a1[0]-=sum(l[:n])
z=sum(l[:n])
for i in range(n):
    p=heapq.heappop(q)
    z=z-min(-p,l[i+n])
    a1[i+1]-=z
    heapq.heappush(q,max(p,-l[i+n])
print(max(a1))
Problem p03732 (python)

Fixed submission:
n,w=map(int,input().split())
wv=[]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    wv.append([a,b])
    v.append(b)
v.sort(reverse=True)
ans=0
w0=wv[0][0]
wp=3*n+1
dp=[[-1 for jjj in range(n+1)] for iii in range(3*n+1)]
dp[0][0]=0
for i in range(n):
    for jj in range(n-1,-1,-1):
        for k in range(wp-1,-1,-1):
            if dp[k][jj]>=0 and k+wv[i][0]-w0<=wp-1:
                dp[k+wv[i][0]-w0][jj+1]=max(dp[k][jj]+wv[i][1],dp[k+wv[i][0]-w0][jj+1])
for i in range(1,n+1):
    wp=w-w0*i
    if wp<0:
        continue
    elif wp>=3*i:
        ans=max(ans,sum(v[:i]))
    else:
        for j in range(i+1):
            for k in range(wp+1):
                ans=max(dp[k][j],ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n,w=map(int,input().split())
wv=[]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    wv.append([a,b])
    v.append(b)
v.sort(reverse=True)
ans=0
w0=wv[0][0]
for i in range(1,n+1):
    wp=w-w0*i
    if wp<0:
        continue
    elif wp>=3*i:
        ans=max(ans,sum(v[:i]))
    else:
        dp=[-1 for iii in range(wp+1)]
        dp[0]=0
        for j in range(n):
            for k in range(wp,-1,-1):
                if dp[k]>=0 and k+wv[i][0]-w0<=wp:
                    dp[k+wv[i][0]-w0]=max(dp[k]+wv[i][1],dp[k+wv[i][0]-w0])
        ans=max(max(dp),ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n,w=map(int,input().split())
wv=[]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    wv.append([a,b])
    v.append(b)
v.sort(reverse=True)
ans=0
w0=wv[0][0]
for i in range(1,n+1):
    wp=w-w0*i
    if wp<0:
        continue
    elif wp>=3*i:
        ans=max(ans,sum(v[:i]))
    else:
        dp=[-1 for iii in range(wp+1)]
        dp[0]=0
        for j in range(n):
            for k in range(wp,-1,-1):
                if dp[k]>=0:
                    dp[k+wv[i][0]-w0]=max(dp[k]+wv[i][1],dp[k+wv[i][0]-w0])
        ans=max(max(dp),ans)
print(ans)
Problem p03739 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
S1 = 0
S2 = 0
for n in range(N):
    S1 += a[n]
    S2 += a[n]
    if n%2 == 0:
        if S1 >= -1:
            ans1 += S1 + 1
            S1 = -1
        if S2 <= 1:
            ans2 += 1 - S2
            S2 = 1
    if n%2 == 1:
        if S1 <= 1:
            ans1 += 1 - S1
            S1 = 1
        if S2 >= -1:
            ans2 += S2 + 1
            S2 = -1
print(min(ans1,ans2))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
l.append(0)
a1=0
b1=0
a2=0
b2=0
for i in range(n):
    b1+=l[i]
    b2+=l[i]
    if i%2==0:
        if b1>=0:
            a1+=abs(-1-b1)
            b1=-1-l[i+1]
        if b2=<0:
            a2+=abs(1-b2)
            b2=1-l[i+1]
    else:
        if b1<=0:
            a1+=abs(1-b1)
            b1=1-l[i+1]
        if b2>=0:
            a2+=abs(-1-b2)
            b2=-1-l[i+1]
print(min(a1,a2))
Problem p03773 (python)

Fixed submission:
a,b=map(int,input().split())
if a+b>=24:
    print(a+b-24)
else:
    print(a+b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
if a+b>=24:
    print(a+b-24)
else:
    print(a+b)
Problem p03814 (python)

Fixed submission:
s=list(input())

a=0
for i in range(len(s)):
    if s[i]=='A':
        a=i
        break
b=0
for i in range(len(s)):
    if s[len(s)-i-1]=='Z':
        b=len(s)-i-1
        break
print(b-a+1)

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

a=0
for i in range(len(s)):
    if s[i]=='A':
        a=i
        break
b=0
for i in range(len(s)):
    if s[n-i-1]=='Z':
        b=n-i-1
        break
print(a-b+1)
Problem p03828 (python)

Fixed submission:
n=int(input())
if n==1:
    print(1)
    exit()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr
so=[]
ka=[]
for i in range(2,n+1):
    a=factorization(i)
    for j in a:
        if not j[0] in so:
            so.append(j[0])
            ka.append(j[1])
        else:
            ka[so.index(j[0])]+=j[1]
ans=1
for i in ka:
    ans*=(i+1)%1000000007
print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==1:
    print(1)
    exit()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr
so=[]
ka=[]
for i in range(2,n+1):
    a=factorization(i)
    for j in a:
        if not j[0] in so:
            so.append(j[0])
            ka.append(j[1])
        else:
            ka[so.index(j[0])]+=j[1]
ans=1
for i in ka:
    ans*=(ka+1)
print(ans)
Problem p03837 (python)

Fixed submission:
import heapq
def dijkstra_heap(s,g):
    used = [True] * n #True:未確定
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,[e[0],e[1]])
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        if v==g:
            return minedge[0]
        kai=minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+kai,e[1]])                   
    return -1

################################
n,m = map(int,input().split()) #n:頂点数　w:辺の数

edge = [[] for i in range(n)]
#edge[i] : iから出る道の[重み,行先]の配列
pp=[]
for i in range(m):
    x,y,z = map(int,input().split())
    edge[x-1].append([z,y-1])
    edge[y-1].append([z,x-1])
    pp.append([x-1,y-1,z])
ans=0
for i in range(m):
    if pp[i][2]>dijkstra_heap(pp[i][0],pp[i][1]):
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
n,m=map(int,input().split())
g=[[] for i in range(n)]
p=[]
for i in range(m):
    a,b,c=map(int,input().split())
    a-=1
    b-=1
    p.append([a,b,c])
    g[a].append([c,b])
    g[b].append([c,a])
ans=0
for i in range(m):
    s=p[i][0]
    goal=p[i][1]
    c=p[i][2]
    q=[]
    heapq.heappush(q,[0,s])
    v=[-1]*n
    v[s]=0
    while q:
        p=heapq.heappop(q)
        if p[1]==goal:
            break
        for i in g[p[1]]:
            if v[i[1]]==-1:
                v[i[1]]=i[0]+v[p[1]]
                heapq.heappush(q,[v[i[1]],i[1]])
    if p[0]<c:
        ans+=1
print(ans)
Problem p03911 (python)

Fixed submission:
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def ans(self):
        return (len(set(self.par))-1)

n,m=map(int,input().split())
uf=UnionFind(n)
l=[[] for i in range(m)]
for i in range(n):
    k=list(map(int,input().split()))
    k=k[1:]
    for j in k:
        l[j-1].append(1+i)
    
for i in range(m):
    if len(l[i])>0:
        ll=l[i][0]
        for j in range(len(l[i])-1):
            uf.union(ll,l[i][j+1])

for i in range(1,n+1):
    uf.find(i)

if uf.ans()==1:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def ans(self):
        print(len(set(self.par))-1)

n,m=map(int,input().split())
uf=UnionFind(n)
l=[[] for i in range(m)]
for i in range(n):
    k=list(map(int,input.split()))
    k=[1:]
    for j in k:
        l[j-1].append(i)
    
for i in range(m):
    if len(l[i])>0:
        ll=l[i][0]
        for j in range(len(l[i])-1):
            uf.union(ll,l[i][j+1])

for i in range(1,n+1):
    uf.find(i)

if uf.ans()==1:
    print('YES')
else:
    print('NO')
Problem p03937 (python)

Fixed submission:
h,w=map(int,input().split())
r=[]
for i in range(h):
    r.append(list(input()))
t=[]
for i in range(h):
    for j in range(w):
        if r[i][j]=='#':
            t.append([i,j])
op=[[[0,0]]]
for i in range(h+w-2):
    tmp=[]
    for j in op:
        tmp.append(j+[[j[-1][0]+1,j[-1][1]]])
        tmp.append(j+[[j[-1][0],j[-1][1]+1]])
    op=tmp
for i in op:
    if sorted(i)==sorted(t):
        print('Possible')
        exit()
print('Impossible')

Buggy submission (verdict: Runtime Error):
h,w=map(int,input())
r=[]
for i in range(h):
    r.append(list(input()))
t=[]
for i in range(h):
    for j in range(w):
        if r[i][j]=='#':
            t.append([i,j])
op=[[[0,0]]]
for i in range(h+w-2):
    tmp=[]
    for j in op:
        tmp.append(j+[[j[-1][0]+1,j[-1][1]]])
        tmp.append(j+[[j[-1][0],j[-1][1]+1]])
    op=tmp
for i in op:
    if sorted(i)==sorted(t):
        print('Possible')
        exit()
print('Impossible')
Problem p03943 (python)

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

if a==b+c or b==a+c or c==a+b:
    print('Yes')
else:
    print('No')

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

if a==b+c or b==a+c or c=a+b:
    print('YES')
else:
    print('NO')
Problem p03975 (python)

Fixed submission:
import bisect
n,a,b=map(int,input().split())
t=set([])
for i in range(n):
    t.add(int(input()))
t=list(t)
t.sort()
ai=bisect.bisect_left(t,a)
bi=bisect.bisect_left(t,b)
print(len(t)-(bi-ai))

Buggy submission (verdict: Runtime Error):
import bisect
n,a,b=map(int,input().split())
t=set([])
for i in range(n):
    t.add(int(input()))
t=list(t)
t.sort()
ai=bisect.bisect_left(t,a)
bi=bisect.bisect_left(t,b)
print(ans-(bi-ai))
Problem p03992 (python)

Fixed submission:
s=list(input())

print(''.join(s[0:4])+' '+''.join(s[4:]))

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

print(''.join(s[0:4]+' '+''.join(s[4:])
Problem p03994 (python)

Fixed submission:
s=list(input())
k=int(input())

al=list('bcdefghijklmnopqrstuvwxyza')

ans=''
for i in range(len(s)):
    d=25-al.index(s[i])
    if d<=k or s[i]=='a':
        ans+='a'
        k-=d
    else:
        ans+=s[i]
k=k%26
f=al.index(ans[-1])
kai=list(ans)
kai.pop(-1)
ans=''.join(kai)
ans+=al[min(f+k,f+k-26)]
print(ans)

Buggy submission (verdict: Runtime Error):
s=list(input())
k=int(input())

al=list('bcdefghijklmnopqrstuvwxyza')

ans=''
for i in range(len(s)):
    d=25-al.index(s[i])
    if d<=k or s[i]=='a':
        ans+='a'
        k-=d
    else:
        ans+=s[i]
k=k%26
f=al.index(ans[-1])
ans[-1]=al[min(f+k,f+k-26)]
print(ans)
Problem p03998 (python)

Fixed submission:
a=list(input())
b=list(input())
c=list(input())
cur='a'
ai=-1
bi=-1
ci=-1
while ai<len(a) and bi<len(b) and ci<len(c):
    if cur=='a':
        ai+=1
        if ai<len(a):
            cur=a[ai]
    elif cur=='b':
        bi+=1
        if bi<len(b):
            cur=b[bi]
    else:
        ci+=1
        if ci<len(c):
            cur=c[ci]
if ai==len(a):
    print('A')
elif bi==len(b):
    print('B')
else:
    print('C')

Buggy submission (verdict: Runtime Error):
a=list(input())
b=list(input())
c=list(input())
cur='a'
while True:
    if cur=='a':
        if len(a)==0:
            print('a')
            break
        else:
            cur=a.pop()
    elif cur=='b':
        if len(b)==:
            print('b')
            break
        else:
            cur=b.pop()
    else:
        if len(c)==0:
            print('c')
            break
        else:
            cur=c.pop()
Problem p04006 (python)

Fixed submission:
n,x=map(int,input().split())
a=list(map(int,input().split()))
b=a[:]
ans=10**20
for i in range(n):
    for j in range(n):
        b[j]=min(b[j],a[j-i])
    ans=min(ans,sum(b)+x*i)
print(ans)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
li=list(map(int,input().split()))
mi=min(li)
ind=-1
for i in range(n):
    if mi==li[i]:
        ind=i
ans=[0]*n
ans[0]=li[ind]
k=0
for i in range(1,n):
    if ind+i>=n:
        k=ind+i-n
    else:
        k=ind+i
    ans[i]=min(li[k],ans[i-1]+x)
print(sun(ans))
Problem p04032 (python)

Fixed submission:
l=list(input())
if len(l)==2:
    if l[0]==l[1]:
        print('1 2')
    else:
        print('-1 -1')
    exit()
for i in range(len(l)-1):
    if l[i]==l[i+1]:
        print(*[i+1,i+2])
        exit()
for i in range(len(l)-2):
    if l[i]==l[i+2]:
        print(*[i+1,i+3])
        exit()
print('-1 -1')

Buggy submission (verdict: Runtime Error):
s=list(input())
if len(s)==2:
    if s[0]==s[1]:
        print('1 2')
    else:
        print('-1 -1')
    exit()
for i in range(len(s)-1):
    if l[i]==l[i+1]:
        print(*[i+1,i+2])
        exit()
for i in range(len(s)-2):
    if l[i]==l[i+2]:
        print(*[i+1,i+3])
        exit()
print('-1 -1')
Problem p02696 (python)

Fixed submission:
a,b,n=map(int,input().split())
x=0
if n>b-1:
    x=b-1
else:
  x=n
ans=int(a*x/b)-a*int(x/b)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
x=0
if n>b:
    x=b
else:
  x=n
ans1=int(a*x/b)-a*int(x/b)
print(ans2)
Problem p02730 (python)

Fixed submission:
s=input()
n=len(s)
ans=1
for i in range(n):
    if s[i]!=s[n-1-i]:
        ans=0
harf=int((n-1)/2)
for i in range(harf):
    if s[i]!=s[harf-1-i]:
        ans=0
for i in range(harf+1,n):
    if s[i]!=s[n-1-(i-harf-1)]:
        ans=0
if ans==1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
for i in range(n):
    if s[i]!=s[n-1-i]:
        print("No")
        exit()
harf=int((n-1)/2
for i in range(harf):
    if s[i]!=s[harf-1-i]:
        print("No")
        exit()
for i in range(harf+1,n):
    if s[i]!=s[n-1-(i-harf-1)]:
        print("No")
        exit()
print("Yes")
Problem p02743 (python)

Fixed submission:
import math
a,b,c=map(int,input().split())
if c-a-b<0:
    print("No")
    exit()
if (c-a-b)*(c-a-b)>4*a*b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if c-a-b<0:
	print("No")
    exit()
if (c-a-b)*(c-a-b)>4*a*b:
    print("Yes")
else:
    print("No")
Problem p02747 (python)

Fixed submission:
s=str(input())
n=len(s)
ans=1
if n%2==1:
    ans=0

for i in range(n):
    if i%2==0 and s[i]!='h':
        ans=0
    if i%2==1 and s[i]!='i':
        ans=0
if ans==1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=str(input())
n=len(s)
ans=1
for i in range(n):
    if s[i]!='h' or s[i+1]!='i':
        a=0
    i+=1

if ans==1:
    print("Yes")
else:
    print("No")