Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
a,b,c=map(int,input().split())
ar=math.sqrt(a)
br=math.sqrt(b)
cr=math.sqrt(c)
if (a-b)/(cr*(ar-br))<1:
    print("Yes")
else:
    print("No")

Fixed submission:
a,b,c=map(int,input().split())
if 4*a*b<(c-a-b)**2 and c-a-b>0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
c=1
t=[s]
for i in range(q):
    qu=input().split()
    if qu[0]=="1":
        c*=-1
    else:
        if c==1:
            if qu[1]=="1":
                t.append(qu[2]+t[-1])
            else:
                t.append(t[-1]+qu[2])
        else:
            if qu[1]=="1":
                t.append(t[-1]+qu[2])
            else:
                t.append(qu[2]+t[-1])
if c==1:
    print(t[-1])
else:
    print(t[-1][::-1])

Fixed submission:
s=input()
q=int(input())
c=1
u=''
for i in range(q):
    inp=input()
    if inp[0]=="1":
        c*=-1
    else:
        t,f,p=inp.split()
        if (f=="1" and c!=1) or (f=="2" and c==1):
            s+=p
        else:
        	u+=p
if c!=1:
    print("".join(reversed(s))+u)
else:
    print("".join(reversed(u))+"".join(s))

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
c=1
for i in range(q):
    qu=input().split()
    if qu[0]=="1":
        c*=-1
    else:
        if c==1:
            if qu[1]=="1":
                s=qu[2]+s
            else:
                s=s+qu[2]
        else:
            if qu[1]=="1":
                s=s+qu[2]
            else:
                s=qu[2]+s
if c==1:
    print(s)
else:
    print(s[::-1])

Fixed submission:
s=input()
q=int(input())
c=1
u=''
for i in range(q):
    inp=input()
    if inp[0]=="1":
        c*=-1
    else:
        t,f,p=inp.split()
        if (f=="1" and c!=1) or (f=="2" and c==1):
            s+=p
        else:
        	u+=p
if c!=1:
    print("".join(reversed(s))+u)
else:
    print("".join(reversed(u))+"".join(s))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]
for i in range(10**(n-1),10**n):
    stri=str(i+1)
    c=0
    for j in range(m):
        if stri[sc[j][0]-1]==str(sc[j][1]):
            c+=1
        else:
            continue
    if j==m-1 and c==m:
        print(i+1)
        break
    elif j==m-1 and i==10**n-1:
        print(-1)
        break

Fixed submission:
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]

for i in range(10**n):
  i2=str(i)
  if len(i2)==n and all([i2[s-1]==str(c) for s,c in sc]):
      print(i2)
      exit()
print(-1)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[0]*m
c=[0]*m
t=[]
for i in range(m):
    s[i], c[i]=map(int,input().split())
for i in range(n):
    t.append("0")
for i in range(m):
    t[s[i]-1]=str(c[i])
for i in reversed(range(m)):
    if t[s[i]-1]!=str(c[i]):
        print(-1)
        break
    elif ''.join(t)=="000":
        print(-1)
        break
    elif i==0 and t[0]="0":
        t[0]="1"
        print(''.join(t))
        break
    elif i==0:
        print(''.join(t))

Fixed submission:
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]

for i in range(10**n):
  i2=str(i)
  if len(i2)==n and all([i2[s-1]==str(c) for s,c in sc]):
      print(i2)
      exit()
print(-1)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[]*m
c=[]*m
t=[]
for i in range(m):
    s[i], c[i]=map(int,input().split())
for i in range(n):
    t.append("0")
for i in range(m):
    t[s[i]-1]=str(c[i])
for i in reversed(range(m)):
    if t[s[i]-1]!=str(c[i]):
        print(-1)
        break
    elif ''.join(t)=="000" and i!=0:
        print(-1)
        break
    elif i==0:
        print(''.join(t))

Fixed submission:
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]

for i in range(10**n):
  i2=str(i)
  if len(i2)==n and all([i2[s-1]==str(c) for s,c in sc]):
      print(i2)
      exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
n,r=int(input().split())
if n <10:
  print(r-100*(10-2))
else:
  print(r)

Fixed submission:
n,r=map(int, input().split())
if n <10:
  print(r+100*(10-n))
else:
  print(r)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))
c=0
for i in range(n-1):
    for j in range(i+1, n):
        if a[i]==a[j]:
            c+=1
            break

if c==0:
    print("YES")
else:
    print("NO")

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

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))
c=0
for i in range(n-1):
    for j in range(i+1, n):
        if a[i]==a[j]:
            c+=1

if c==0:
    print("YES")
else:
    print("NO")

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
a.sort()
c=0
for i in range(n-1):
    if a[i]==a[i+1]:
        c+=1
        break
if c==0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
def sgm(i):
    sum=0
    for j in range(i+1):
        sum+=j
    return sum

n, k=map(int, input().split())
p=list(map(int, input().split()))
idx=0
sum=0
for i in range(k):
    sum+=p[i]
max=sum
for i in range(k,n):
    sum+=p[i]
    sum-=p[i-k]
    if sum>=max:
        max=sum
        idx=i-k+1

e=0
for i in range(idx,idx+k):
    e+=(sgm(p[i])/p[i])
print(e)

Fixed submission:
n, k=map(int, input().split())
p=list(map(int, input().split()))
idx=0
sum=0
for i in range(k):
    sum+=p[i]
max=sum
for i in range(k,n):
    sum+=p[i]
    sum-=p[i-k]
    if sum>=max:
        max=sum
        idx=i-k+1

e=0
for i in range(idx,idx+k):
    e+=((p[i]+1)/2)
print(e)

Buggy python submission (verdict: Time Limit Exceeded):
def sgm(i):
    sum=0
    for j in range(i+1):
        sum+=j
    return sum

n, k=map(int, input().split())
p=list(map(int, input().split()))
idx=0
max=0
sum=0
for i in range(n-k+1):
    for j in range(k):
        sum+=p[i+j]
    if sum>=max:
        max=sum
        idx=i
    sum=0

e=0
for i in range(idx,idx+k):
    e+=(sgm(p[i])/p[i])
print(e)

Fixed submission:
n, k=map(int, input().split())
p=list(map(int, input().split()))
idx=0
sum=0
for i in range(k):
    sum+=p[i]
max=sum
for i in range(k,n):
    sum+=p[i]
    sum-=p[i-k]
    if sum>=max:
        max=sum
        idx=i-k+1

e=0
for i in range(idx,idx+k):
    e+=((p[i]+1)/2)
print(e)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p=list(map(int, input().split()))
c=0
for i in range(n):
    for j in range(0,i+1):
        if p[i] <= p[j]:
            if i==j:
                c+=1
        else:
            break

print(c)

Fixed submission:
n = int(input())
p=list(map(int, input().split()))
c=0
min=p[0]
for i in range(n):
    if min>=p[i]:
        c+=1
        min=p[i]
print(c)
Buggy python submission (verdict: Runtime Error):
a=input()
b=('abcdefghijklmnopqrstuvwxyz')
for i in range(int(len(b)):
	if b[i]==a:
    	print(b[i+1])
              

Fixed submission:
print(chr(ord(input())+1))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
c=0
for i in range(len(s)):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                c+=1
                i+=2

print(c)

Fixed submission:
n=int(input())
s=input()
c=0
for i in range(len(s)-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                c+=1
                i+=2

print(c)
Buggy python submission (verdict: Time Limit Exceeded):
a,b, k=map(int, input().split())
for i in range(k):
    if a>=1:
        a-=1
    elif b>=1:
        b-=1

print(str(a)+" "+str(b))

Fixed submission:
a,b, k=map(int, input().split())
if k>=a+b:
    print("0 0")
elif k>a:
    print("0"+" "+str(b-(k-a)))
else:
    print(str(a-k)+" "+str(b))

Buggy python submission (verdict: Runtime Error):
a,b, k=map(int, input().split())
for i in range(k):
    if a>=1:
        a-=1
    elif b>=1:
        b-=1

print(str(a)+" "+str(b)

Fixed submission:
a,b, k=map(int, input().split())
if k>=a+b:
    print("0 0")
elif k>a:
    print("0"+" "+str(b-(k-a)))
else:
    print(str(a-k)+" "+str(b))
Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
p=0
while p==0:
    for i in range(2,x):
        if x%i==0:
            x+=1
            break
        if i==x-1 and x%i!=0:
            p=1
print(x)

Fixed submission:
def is_prime(x):
    if x<=1:
        return False
    for i in range(2,x):
        if x%i==0:
            return False
    return True

x=int(input())
p=False
while p==False:
    p=is_prime(x)
    x+=1
print(x-1)

Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
p=0
while p==0:
    for i in range(2,x):
        if x%i==0:
            x+=1
            break
        if i==x-1 and x%i!=0:
            p=1
print(x)

Fixed submission:
def is_prime(x):
    if x<=1:
        return False
    for i in range(2,x):
        if x%i==0:
            return False
    return True

x=int(input())
p=False
while p==False:
    p=is_prime(x)
    x+=1
print(x-1)
Buggy python submission (verdict: Runtime Error):

s=input()
if s=="SUN":
    print(7)
elif s == "MON":
    ptint(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)


Fixed submission:
s=input()
if s=="SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)

Buggy python submission (verdict: Runtime Error):
s=input()
if s=="SUN":
    print(7)
elif s == "MON":
    ptint(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)

Fixed submission:
s=input()
if s=="SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)

Buggy python submission (verdict: Runtime Error):

S=input()
if s='SUN':
    print(7)
elif s = 'MON':
    ptint(6)
elif s = 'TUE':
    print(5)
elif s = 'WED':
    print(4)
elif s = 'THU':
    print(3)
elif s = 'FRI':
    print(2)
elif s = 'SAT':
    print(1)    


Fixed submission:
s=input()
if s=="SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()

l="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
out=""

for i in S:
    out += l[(l.index(i)+n)%26]

print(out)

Fixed submission:
n = int(input())
s = input()
 
l = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
out = ""
 
for c in s:
    out += l[(l.index(c)+n)%26]
 
print(out)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
if n%2==0:
    a = s[0:(n/2-1)]
    b = s[(n/2):]
    if a==b:
        print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())
s = input()
if n%2==0:
    a = s[0:(int(n/2))]
    b = s[(int(n/2)):n]
    if a==b:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())

t=[]
for i in range(n):
    t=list(map(int, input().split(" ")))
    t.append(t)

def dis(t1, t2):
    x1, y1 = t1
    x2, y2 = t2
    return ((x1- x2)**2 + (y1-y2)**2)**0.5

total_dis = 0

for i in range(0, len(t)):
    t1=t[i]
    for j in range(0, len(t)):
        t2 = t[j]
        total_dis += dis(t1, t2)

ans = (1/n)*total_dis
print(ans)

Fixed submission:
n=int(input())
xy=[]
for _ in range(n):
    x,y=map(int,input().split())
    xy.append([x,y])
ans=0
for i in range(n):
    for j in range(n):
        ans +=((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)**0.5
print(ans/n)
Buggy python submission (verdict: Runtime Error):
N = int(input())
lst=[]
for i in range(1,int(N**0.5)+1):
    if n%i==0:
        lst.append(i+n//i-2)
print(min(lst))

Fixed submission:
N = int(input())
lst=[]
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        lst.append(i+N//i-2)
print(min(lst))

Buggy python submission (verdict: Runtime Error):
N = int(input())
lst=[]
for i in range(1,int(N**0.5)+1):
    if n%i==0:
        lst.append(i+n//i-1)
print(min(lst))

Fixed submission:
N = int(input())
lst=[]
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        lst.append(i+N//i-2)
print(min(lst))

Buggy python submission (verdict: Runtime Error):
N = int(input())
min=1000000000000
if N%2==0:
    for i in range(int(N/2),1, -1):
        if N%i==0:
            if min>int(i+N/i-2):
                min=int(i+N/i-2)
    print(min)
else:
    for i in range(int((N-1)/2), 1,-1):
        if N%i==0:
            if min>print(int(i+N/i-2)):
                min=print(int(i+N/i-2))
    print(min)


Fixed submission:
N = int(input())
lst=[]
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        lst.append(i+N//i-2)
print(min(lst))
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = input()

c = 0
for i in range(len(d):
    if d[i] != d[i+1]:
        c += 1

print(c+1)

Fixed submission:
n = int(input())
d = input()

c = 0
for i in range(len(d)-1):
    if d[i] != d[i+1]:
        c += 1

print(c+1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
c=0
for i in range(,n):
  if len(str(i+1))%2!=0:
    c+=1
print(c)

Fixed submission:
n=int(input())
c=0
for i in range(n):
  if len(str(i+1))%2!=0:
    c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int, input().split()))
c=0
if n!=1:
    for i in reversed(range(n-1)):
        if h[i]==h[i+1]+1:
            h[i]-=1
        elif h[i]-h[i+1]>=2:
            c=1
    if c==1:
        print("Yes")
    else:
        prin("No")
else:
    print("Yes")
            

Fixed submission:
n=int(input())
h=list(map(int, input().split()))
c=0
if n!=1:
    for i in reversed(range(n-1)):
        if h[i]==h[i+1]+1:
            h[i]-=1
        elif h[i]-h[i+1]>=2:
            c=1
    if c==0:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
s=input()
s.sort()
if s[0]==s[1] and s[1]!=s[2] and s[2]==s[3]:
  print("Yes")
else:
  print("No")


Fixed submission:
s=input()
t=sorted(s)
u=''.join(t)
if u[0]==u[1] and u[1]!=u[2] and u[2]==u[3]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=list(map(int, input().solilt()))
c=0
for i in range(1,n-1):
    if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i-1]>p[i] and p[i]>p[i+1]):
        c+=1
print(c)
        

Fixed submission:
n=int(input())
p=list(map(int, input().split()))
c=0
for i in range(1,n-1):
    if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i-1]>p[i] and p[i]>p[i+1]):
        c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int,input().split())))
print(d[n/2]-d[n/2-1])

Fixed submission:
n=int(input())
d=sorted(list(map(int,input().split())))
print(d[int(n/2)]-d[int(n/2-1)])
Buggy python submission (verdict: Runtime Error):
a,p=map(int, input())
p+=a*3
print(p//2)

Fixed submission:
a,p=map(int, input().split())
p+=a*3
print(p//2)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input()/split())
if a>=b+2:
  print(2*a-1)
elif b>=a+2:
  print(2*b-1)
else:
  print(a+b)

Fixed submission:
a,b=map(int,input().split())
if a>=b+2:
  print(2*a-1)
elif b>=a+2:
  print(2*b-1)
else:
  print(a+b)
Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
ans = 0
for i in range(N):
for j in range(i, N):
if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
ans = max(ans, j - i + 1)
print(ans)


Fixed submission:
S = input()
N = len(S)
ans = 0
for i in range(N):
    for j in range(i, N):
        if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
            ans = max(ans, j - i + 1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k=map(int,input().split())
ta=0
tb=0
tc=0
for i in range(k):
    ta=b+c
    tb=a+c
    tc=a+b
    a=ta
    b=tb
    c=tc
ans=a-b
if ans>10**18:
    print("Unfair")
else:
    print(ans)

Fixed submission:
a,b,c,k=map(int,input().split())
if k%2==0:
    print(a-b)
else:
    print(b-a)
Buggy python submission (verdict: Time Limit Exceeded):
def kaijo(n):
    fact = 1
    for i in range(1, n+1):
        fact *=i
    return fact
    
n, m=map(int, input().split())
if n-m>=2 or m-n>=2:
    print(0)
elif n!=m:
    print(kaijo(m)*kaijo(n)%(10**9+7))
else:
    print(2*kaijo(m)*kaijo(n)%(10**9+7))

Fixed submission:
import math

n, m=map(int, input().split())
if n-m>=2 or m-n>=2:
    print(0)
elif n!=m:
    print(math.factorial(m)*math.factorial(n)%(10**9+7))
else:
    print(2*math.factorial(m)*math.factorial(n)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
t=input()
d={}
n=0
s=0
w=0
e=0
for i in range(int(len(s))):
    if t[i] =="N":
        n=1
    if t[i] =="S":
        s=1
    if t[i] =="E":
        e=1
    if t[i] =="W":
        w=1
if (w+e)%2==0 and (n+s)%2==0:
    print("Yes")
else:
    print("No") 

Fixed submission:
t=input()
n=0
s=0
w=0
e=0
for i in range(int(len(t))):
    if t[i] =="N":
        n=1
    if t[i] =="S":
        s=1
    if t[i] =="E":
        e=1
    if t[i] =="W":
        w=1
if (w+e)%2==0 and (n+s)%2==0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):


import sys
import math
import itertools
import collections

def solve(N,M,K,A,B):
    accumA = [0,A.pop(0)]
    accumB = [0,B.pop(0)]
    for a in A:
        accumA.append(accumA[-1] + a)
    for b in B:
        accumB.append(accumB[-1] + b)
    ans = 0
    j = M
    for i in range(N + 1):
        if a[i] > K:
            break
        while b[j] > K - a[i]:
            j -= 1
        ans = max(ans,i + j)
    return ans

def main():
    N,M,K = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    # solve()
    print(solve(N,M,K,A,B))

if __name__ == "__main__":
    main()




Fixed submission:


import sys
import math
import itertools
import collections

def solve(N,M,K,A,B):
    accumA = [0,A.pop(0)]
    accumB = [0,B.pop(0)]
    for a in A:
        accumA.append(accumA[-1] + a)
    for b in B:
        accumB.append(accumB[-1] + b)
    ans = 0
    j = M
    for i in range(N + 1):
        if accumA[i] > K:
            break
        while accumB[j] > K - accumA[i]:
            j -= 1
        ans = max(ans,i + j)
    return ans

def main():
    N,M,K = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    # solve()
    print(solve(N,M,K,A,B))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
total = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            total+=math.gcd(math.gcd(a,b),c)
print(total)

Fixed submission:
import math
K = int(input())
total = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            total+=math.gcd(math.gcd(a,b),c)
print(total)
Buggy python submission (verdict: Runtime Error):
import sys

N, K = map(int, input().split())


if(N > K):
    if(N % K == 0):
        print(0)
        sys.exit()
    else:
        tmp=N % K
        print(min(tmp,abs(K - tmp)))
        sys.exit()
else:
    tmp = abs(N - K)
    if(tmp <= N):
        print(tmp)
    else:

Fixed submission:
import sys

N, K = map(int, input().split())


if(N > K):
    if(N % K == 0):
        print(0)
        sys.exit()
    else:
        tmp=N % K
        print(min(tmp,abs(K - tmp)))
        sys.exit()
else:
    tmp = abs(N - K)
    if(tmp <= N):
        print(tmp)
    else:
        print(N)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N, X, Y = map(int, input().split())
dic = {key: 0 for key in range(1, N)}
for i in range(1, N+1):
    for j in range(1, N+1):
        if(i < j):
            key = min(abs(j - i), abs(X - i)+1+abs(j - Y),
                      abs(Y - i) + 1 + abs(j - X))
            dic[key] += 1
for ans in dic.values():
    print(ans)


Fixed submission:

N, X, Y = map(int, input().split())
dic = {key: 0 for key in range(1, N)}
for i in range(1, N+1):
    for j in range(1, N+1):
        if(i < j):
            key = min(abs(j - i), abs(X - i)+1+abs(j - Y),
                      abs(Y - i) + 1 + abs(j - X))
            dic[key] += 1
for ans in dic.values():
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

N, X, Y = map(int, input().split())
dic = {key: 0 for key in range(1, N)}
for i in range(1, N+1):
    for j in range(1, N+1):
        if(i < j):
            key = min(abs(j - i), abs(X - i)+1+abs(j - Y),
                      abs(Y - i) + 1 + abs(j - X))
            dic[key] += 1
for ans in dic.values():
    print(ans)


Fixed submission:

N, X, Y = map(int, input().split())
dic = {key: 0 for key in range(1, N)}
for i in range(1, N+1):
    for j in range(1, N+1):
        if(i < j):
            key = min(abs(j - i), abs(X - i)+1+abs(j - Y),
                      abs(Y - i) + 1 + abs(j - X))
            dic[key] += 1
for ans in dic.values():
    print(ans)
Buggy python submission (verdict: Runtime Error):
S=input()
N=len(S)
S1=list(S[0:(N-1)//2])
S2=list(S[(N+3)//2-1:])
if(len(S1)%2==1):
    S1.pop(len(S1)//2)

if(len(S2)%2==1):
    S2.pop(len(S2)//2)

for i,s in enumerate((S1)):
    if(s!=S1[-1-i]):
        print('No')
        sys.exit()

for i,s in enumerate((S2)):
    if(s!=S2[-1-i]):
        print('No')
        sys.exit()
        
print('Yes')

Fixed submission:
import sys
S=input()
N=len(S)
S1=list(S[0:(N-1)//2])
S2=list(S[(N+3)//2-1:])
S=list(S)
S.pop(N//2)
if(len(S1)%2==1):
    S1.pop(len(S1)//2)

if(len(S2)%2==1):
    S2.pop(len(S2)//2)

for i,s in enumerate(S):
    if(s!=S[-1-i]):
        print('No')
        sys.exit()

for i,s in enumerate(S1):
    if(s!=S1[-1-i]):
        print('No')
        sys.exit()

for i,s in enumerate(S2):
    if(s!=S2[-1-i]):
        print('No')
        sys.exit()
        
print('Yes')
Buggy python submission (verdict: Runtime Error):
import math
def myAnswer(N:int, A:int, B:int) -> int:
   counter = math.ceil(N / (A + B))
   string = ("b"*A + "r"*B)*counter
   return list(string)[:N ].count("b")

def modelAnswer():
   tmp=1
def main():
   N,A,B = map(int,input().split())
   print(myAnswer(N,A,B))

if __name__ == '__main__':
   main()

Fixed submission:
N, A, B = map(int, input().split())

if(N <= (A+B)):
    if(N<=A):
        print(N)
    else:
        print(A)
else:
    ans = (N//(A+B)) * A
    amari=(N % (A+B))
    tmp=A
    if(amari <= tmp):
        ans+=amari
    else:
        ans+=tmp

    print(ans)

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())

ans=""
for i in range(10**100):
    ans+="b"*A
    ans+="r"*B
    if(len(ans)>N):
        break

print(ans[:N].count('b'))


Fixed submission:
N, A, B = map(int, input().split())

if(N <= (A+B)):
    if(N<=A):
        print(N)
    else:
        print(A)
else:
    ans = (N//(A+B)) * A
    amari=(N % (A+B))
    tmp=A
    if(amari <= tmp):
        ans+=amari
    else:
        ans+=tmp

    print(ans)