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

Fixed submission:
A,B,C = list(map(int,input().strip().split()))
s = A - B
a = C - s
if a >= 0:
    print(a)
elif a < 0:
    print(0)

Buggy submission (verdict: Runtime Error):
6 4 3
Problem p02771 (python)

Fixed submission:
a,b,c=map(int,input().split())
if(a==b and b==c):
    print("No")
elif(a==b or b==c or c==a):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if(a==b and b==c):
  print("Yes")
else:
  print("No"
Problem p02682 (python)

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

if K >A+B:
  print(A-1*(K-A-B))
elif A > K :
  print(K)
else :
  print(A)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())

print(A-1*(K-A-B) if K >A+B else A)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())

if K >A+B :
  print(2*A-K+B)
else :
  print(A)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())

if K >A+B :
  print(A-(K-A-B))
else :
  print(A)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())
S = A + B + C

if A >=K or A + B >=K:
  print(A)
else :
  print(A-1*(K-A-B))

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())
S = A + B + C

if A >=K :
  print(1*A)
elif A + B >=K :
  print(1*A + 0*B)
else :
  print(1*A + 0*B -1*(K-A-B))
Problem p02707 (python)

Fixed submission:
N=int(input())
josi = list(map(int,input().split()))
count=[0]*N
n=0
while n<N-1:
  count[josi[n]-1] =count[josi[n]-1]+1
  n=n+1
n=0
while n<N:
  print(count[n])
  n=n+1

Buggy submission (verdict: Runtime Error):
N=int(input())
josi = list(map(int,input().split()))
n=1
m=0
count=0
while n<=N:
  m=n
  while m<N:
    if josi[m]=n:
      count = count+1
    m=m+1
  print(count)
  m=0
  count=0
Problem p02753 (python)

Fixed submission:
s = input()
if s == 'AAA':
  print('No')
elif s == 'BBB':
  print('No')
else: 
  print('Yes')

Buggy submission (verdict: Runtime Error):
s = input()
if s == AAA or BBB:
  print('No')
else:
  print('Yes')
Problem p02754 (python)

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

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
x = n // (a+b)
y = m - (a+b)*x
if a == 0:
  print(0)
elif y < a + 1:
  print (x * a + y)
else:
  print (x*a + a)
Problem p02951 (python)

Fixed submission:
a,b,c=(int(x) for x in input().split())
d=c-a+b
if d<=0:
    print(0)
else:
    print(d)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=0
c=0
list=list(map(int,input().split()))
for i in range(a-1):
    if list[i]-list[i+1]<=0:
        continue
    elif list[i]-list[i+1]==1:
        if i+2<=a-1:
            if list[i+1]-list[i+2]==1:
                c=1
                print("No")
                break
        continue
    elif list[i]-list[i+1]>=2:
        c=1
        print("No")
        break
if c==0:
    print("Yes")
Problem p02685 (python)

Fixed submission:
N, M, K = list(map(int, input().split()))
p = 998244353
comb = 1
res = 0
for n in range(K+1):
    res = (res + comb * M * pow(M-1, N-1-n, p)) % p
    comb = (comb * (N -1 -n) * pow(n + 1, p - 2, p)) % p
print(res)

Buggy submission (verdict: Runtime Error):
# E

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

res = [0] * (K+1)
res[0] = (M * (M-1)**(N-1 - K)) % p
p = 998244353
for n in range(1, K+1):
    res[n] = (res[n-1] * (N-n) * pow(n, p-2, p)) % p

print(sum(res) % p)

Buggy submission (verdict: Runtime Error):
60522 114575 7559
Problem p02689 (python)

Fixed submission:
# C
N, M = map(int, input().split())
H = list(map(int, input().split()))

A = [0] * N
for i in range(M):
    a, b = map(int, input().split())
    A[a-1] = max(A[a-1], H[b-1])
    A[b-1] = max(A[b-1], H[a-1])
    
res = sum([H[i] > A[i] for i in range(N)])
print(res)

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

inp = input().split(' ')
N, M = int(inp[0]), int(inp[1])

inps = input().split(' ')
H = np.array([int(inps[i]) for i in range(len(inps))])
AB = []
for i in range(M):
    inps = input().split(' ')
    AB.append([int(inps[0]), int(inps[1])])
    
import pandas as pd

df_1, df_2 = pd.DataFrame(), pd.DataFrame()
tmp = np.array(AB).T
df_1['1'] = tmp[0]
df_1['2'] = tmp[1]
df_2['1'] = tmp[1]
df_2['2'] = tmp[0]
print(sum([sum(df['2'].apply(lambda t: H[t-1]) <= H[g-1]) - len(df) == 0 for g, df in pd.concat([df_1, df_2]).groupby('1')]))

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

inp = input().split(' ')
N, M = int(inp[0]), int(inp[1])

inps = input().split(' ')
H = np.array([int(inps[i]) for i in range(len(inps))])
AB = []
for i in range(M):
    inps = input().split(' ')
    AB.append(set([int(inps[0]), int(inps[1])]))
    
def get_height(els):
    return H[els[0]-1] > H[els[1]-1]

def get_height_sum(arr):
    if not arr:
        return 1
    return np.prod(list(map(get_height, arr)))

def tmp(arr_arr):
    return (list(map(get_height_sum, arr_arr)))
    return sum(list(map(get_height_sum, arr_arr)))

connected = [[[i+1] + list(ab - {i+1}) for ab in AB if i+1 in ab] for i in range(N)]

print(int(tmp(connected)))

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

inp = input().split(' ')
N, M = int(inp[0]), int(inp[1])

inps = input().split(' ')
H = np.array([int(inp) for inp in range(len(inps))])
AB = []
for i in range(M):
    inps = input().split(' ')
    AB.append(set([int(inps[0]), int(inps[1])]))
    
def get_height(els):
    return H[els[0]-1] >= H[els[1]-1]

def get_height_sum(arr):
    return np.prod(list(map(get_height, arr)))

def tmp(arr_arr):
    return (list(map(get_height_sum, arr_arr)))

connected = [[[i+1] + list(ab - {i+1}) for ab in AB if i+1 in ab] for i in range(N)]

print(int(tmp(connected)))
Problem p02699 (python)

Fixed submission:
inputs = input().split(' ')

s = int(inputs[0])
w = int(inputs[1])

if s <= w:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
import sys
args = sys.argv

s = int(args[0])
w = int(args[1])

if s <= w:
    print('unsafe')
else:
    print('safe')
Problem p02762 (python)

Fixed submission:

def tramp(gen):
    stack = [gen]
    val = None
    while stack:
        try:
            stack.append(stack[-1].send(val))
            val = None
        except StopIteration as e:
            stack.pop()
            val = e.args
    return val
    
N, M, K = map(int, input().split())
adj = [[] for _ in range(N)]
blks = [set() for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    adj[a - 1].append(b - 1)
    adj[b - 1].append(a - 1)
for _ in range(K):
    a, b = map(int, input().split())
    blks[a - 1].add(b - 1)
    blks[b - 1].add(a - 1)
vis = [False] * N
def go(curr):
    if vis[curr]:
        return
    vis[curr] = True
    comp.add(curr)
    for n in adj[curr]:
        yield go(n)
ans = [0] * N
for i in range(N):
    comp = set()
    if vis[i]:
        continue
    tramp(go(i))
    for i in comp:
        x = len(comp) - 1 - len(adj[i])
        for k in blks[i]:
            if k in comp:
                x -= 1
        ans[i] = x
print(*ans)

Buggy submission (verdict: Runtime Error):

def tramp(gen):
    stack = [gen]
    val = None
    while stack:
        try:
            stack.append(stack[-1].send(val))
            val = None
        except StopIteration as e:
            stack.pop()
            val = e.value # e.args
    return val
    
N, M, K = map(int, input().split())
adj = [[] for _ in range(N)]
blks = [set() for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    adj[a - 1].append(b - 1)
    adj[b - 1].append(a - 1)
for _ in range(K):
    a, b = map(int, input().split())
    blks[a - 1].add(b - 1)
    blks[b - 1].add(a - 1)
vis = [False] * N
def go(curr):
    if vis[curr]:
        return
    vis[curr] = True
    comp.add(curr)
    for n in adj[curr]:
        yield go(n)
ans = [0] * N
for i in range(N):
    comp = set()
    if vis[i]:
        continue
    tramp(go(i))
    for i in comp:
        x = len(comp) - 1 - len(adj[i])
        for k in blks[i]:
            if k in comp:
                x -= 1
        ans[i] = x
print(*ans)
Problem p02693 (python)

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

for i in range(b-a+1):
  if a % k != 0:
    a += 1
  else:
    print('OK')
    break
if a == b+1 and b%k != 0:
  print('NG')

Buggy submission (verdict: Runtime Error):
import math
a,b,n = map(int,input().split())
kk = []
for i in range(n):
  kk.append(math.floor(a*n/b)-a*math.floor(n/b))
  n -= 1
print(max(kk))
Problem p02835 (python)

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

if a+b+c > 21:
    print('bust')
else:
    print('win')

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

if a+b+c > 21:
    print('bust')
else:
    print('win')
Problem p02836 (python)

Fixed submission:
s = input()
count = 0
first_half, second_half = s[:len(s)//2], s[(len(s)+1)//2:]
if first_half == reversed(second_half):
    print(count)
else:
    for x in range(len(first_half)):
        if first_half[x] != second_half[len(second_half)-x-1]:
            count += 1
    print(count)

Buggy submission (verdict: Runtime Error):
a = input("Enter word:")
if a == 'redcoder':
  printf("1")
elif a == 'vvvvv':
  print("0")
elif a == "abcdabc":
  print("2")

Buggy submission (verdict: Runtime Error):
a = input("Enter word:")

b = a[::-1]
print(b)
Problem p02729 (python)

Fixed submission:
inputs = input().split(' ')
 
N = int(inputs[0])
M = int(inputs[1])
 
pattern_N = 0
pattern_M = 0
 
if N > 0:
  pattern_N = N * (N - 1) // 2 
  
if M > 0:
  pattern_M = M * (M - 1) // 2 
  
print(pattern_N + pattern_M)

Buggy submission (verdict: Runtime Error):
inputs = input().split(' ')

N = int(inputs[0])
M = int(inputs[1])

pattern_N = 0
paattern_M = 0

if N > 0:
  pattern_N = N * (N - 1) // 2 
  
if M > 0:
  pattern_M = M * (M - 1) // 2 
  
print(pattern_N + pattern_M)
Problem p02831 (python)

Fixed submission:
strings = input().split(' ')
A = int(strings[0])
B = int(strings[1])

i = min(A,B)
m = max(A,B)
n = min(A,B)
while 1:
    mt = n
    n = m % n
    m = mt
    if n == 0:
        break
if m != 0:
    print(A*B//m)
else:
    print(A*B)

Buggy submission (verdict: Runtime Error):
strings = input().split(' ')
A = int(strings[0])
B = int(strings[1])

i = min(A,B)
m = max(A,B)
n = min(A,B)
while m % n != 0:
    mt = m // n
    nt = m % n
    m = mt
    n = nt
    gmc = m // n
if gmc != 0:
    print(A*B//gmc)
else:
    print(A*B)

Buggy submission (verdict: Runtime Error):
strings = input().split(' ')
A = int(strings[0])
B = int(strings[1])

i = min(A,B)
m = A
n = B
while max(m,n) % min(n,m) != 0:
    mt = max(m,n) // min(m,n)
    nt = max(m,n) % min(m,n)
    m = mt
    n = nt
    gmc = max(m,n) // min(n,m)

At = A // gmc
Bt = B // gmc
print(gmc * At * Bt)
Problem p02759 (python)

Fixed submission:
n=int(input())
print(n//2+n%2)

Buggy submission (verdict: Runtime Error):
A1=[int(e) for e in input().split()]
A2=[int(f) for f in input().split()]
A3=[int(g) for g in input().split()]
N=int(input())
for i in range(N):
    b=int(input())
    for j in range(3):
        if b==A1[j]:
            A1[j]= -1
        elif b==A2[j]:
            A2[j]= -1
        elif b==A3[j]:
            A3[j]= -1
if A1[0]==-1 and A2[0]==-1 and A3[0]==-1:
    print('Yes')
elif A1[1]==-1 and A2[1]==-1 and A3[1]==-1:
    print('Yes')
elif A1[2]==-1 and A2[2]==-1 and A3[2]==-1:
    print('Yes')
elif A1[0]==-1 and A1[1]==-1 and A1[2]==-1:
    print('Yes')
elif A2[0]==-1 and A2[1]==-1 and A2[2]==-1:
    print('Yes')
elif A3[0]==-1 and A3[1]==-1 and A3[2]==-1:
    print('Yes')
elif A1[0]==-1 and A2[1]==-1 and A3[2]==-1:
    print('Yes')
elif A3[0]==-1 and A2[1]==-1 and A1[2]==-1:
    print('Yes')
else:
    print('No')
Problem p02771 (python)

Fixed submission:
a=len(set(list(map(int,input().split()))))
if(a==2):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[input() for _ in range(n)]
ans={}
for i in range(len(s)):
    if(s[i] not in ans):
        ans[s[i]] = 1
    else:
        ans[s[i]] += 1
ans=sorted(ans.items(), key = lambda x:x[1], reverse = True)
anss=[]
anss.append(ans[0][0])
for j in range(1,len(ans)):
    if(ans[j][1] == ans[0][1]):
        anss.append(ans[j][0])
    else:
        break
for t in sorted(anss):
    print(t)
Problem p02773 (python)

Fixed submission:
N = int(input())
d = {}
for _ in range(N):
  s = input()
  if(s not in d):
    d[s] = 1
  else:
    d[s] += 1
d2 = sorted(d.items(),key=lambda x:x[1], reverse=True)
s1=[]
s1.append(d2[0][0])
p=d2[0][1]
for t in d2[1:]:
  q=t[1]
  if(q==p):
    s1.append(t[0])
  else:
    break
s1=sorted(s1)
for i in s1:
  print(i)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=sorted([input() for k in range(n)])
s3 = sorted(list(set(s)))
if(len(set(s))==len(s)):
    for u in range(len(s)):
        print(s[u])
    exit()
else:
    s1=s2 = [m for m in s3 if s.count(m)>1]
    i = (len(s)-len(s1))//len(s3)                                                                         while(len(s2)!=0):
        s2 = [m for m in s3 if s.count(m)>i]
        if(len(s2)==0):
               break
        s1 = s2
        i+=1
for j in s1:
    print(j)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
s=[input() for k in range(n)]
if(len(set(s))==len(s)):
    for u in range(len(s)):
        print(s[u])
    exit()
else:
    s1=[q for q in sorted(list(set(s))) if s.count(q) > 1]
c=collections.Counter(s)
p=[]                                                                                                  for i in s1:
    p.append(c[i])
max=max(p)
print(max)
for j, x in enumerate(p):
    if(x == max):
        print(s1[j])
Problem p02916 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
count=-1
acount=0
for i in a:
    ans+=b[i-1]
    if(acount <= len(a)-2):
        if(a[acount+1]==i+1):
            #print('cappned')
            ans+=c[i-1]
    count=i
    acount+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
b=list(map(int,input().split()))
a=[]
ans=b[0]
a.append(ans)
for i in range(1,n-1):
    if(b[i] < ans):
        a.append(b[i])
    else:
        a.append(ans)
    ans=b[i]
a.append(b[i])
print(sum(a))
Problem p03042 (python)

Fixed submission:
s=list(input())
u=[int(s[0]+s[1]),int(s[2]+s[3])]
if(0<u[0]<=12):
    m1=1
    if(0<u[1]<=12):                                                                                                                                                                                                    m2=1
    else:
        m2=0
else:
    m1=0
    if(0<u[1]<=12):
        m2=1
    else:
        m2=0
if(m1==1 and m2==0):
    print('MMYY')
elif(m1==1 and m2==1):
    print('AMBIGUOUS')
elif(m1==0 and m2==0):
    print('NA')
else:
    print('YYMM')

Buggy submission (verdict: Runtime Error):
s=list(input())
u=[int(s[0]+s[1]),int(s[2]+s[3])]
if(u[0]<=12):
    m1=1
    if(u[1]<=12):
        m2=1
    else:
        m2=0
else:
    m1=0
    if(u[1]<=12):                                                                                                                           m2=1                                                                                                                            else:
        m2=0
if(m1==1 and m2==0):
    print('MMYY')                                                                                                                   elif(m1==1 and m2==1):
    print('AMBIGUOUS')
elif(m1==0 and m2==0):
    print('NA')
else:
    print('YYMM')
Problem p03242 (python)

Fixed submission:
n = list(map( int, input()))
 
h = 3
for i in range(h):
  if( n[i] == 1):
    n[i] = 9
    n[i] = str(n[i])   
  else:
    n[i] = 1
    n[i] = str(n[i])
    
a = "".join(n)
 
print(a)

Buggy submission (verdict: Runtime Error):
N = int( input())

n = N // 100

if( N % 100 <= n * 10 + n):
	print(n * 100 + n * 10 + n )
  
else:

Buggy submission (verdict: Runtime Error):
n = list(map( int, sinput()))
 
h = 3
for i in range(h):
  if( n[i] == 1):
    n[i] = 9
    n[i] = str(n[i])   
  else:
    n[i] = 1
    n[i] = str(n[i])
    
a = "".join(n)
 
print(a)

Buggy submission (verdict: Runtime Error):
n = list(map( int, split()))
 
h = 3
for i in range(h):
  if( n[i] == 1):
    n[i] = 9
    n[i] = str(n[i])   
  else:
    n[i] = 1
    n[i] = str(n[i])
    
a = "".join(n)
 
print(a)

Buggy submission (verdict: Runtime Error):
n = list(map( int, split()))

h = 3
for i range(h):
  if( n[i] == 1):
    n[i] = 9
    n[i] = str(n[i])   
  else:
    n[i] = 1
    n[i] = str(n[i])
    
a = "".join(n)

print(a)
Problem p03250 (python)

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

N = sorted(N)

Nmax = int( N[2] * 10 + N[1] + N[0])

print(int(Nmax))

Buggy submission (verdict: Runtime Error):
N, M, X, Y =map( int, input().split())
x = list(map( int, input().split()))
y = list(map( int, input().split()))
 
x = sorted(x)
y = sorted(y)
 
for i in range(X + 1, Y + 1):
  if( x[N-1] < i <= y[0]):
    print('No War')
    exit()
    
print('War')

Buggy submission (verdict: Runtime Error):
N, M, X, Y =map( int, input()split())
x = list(map( int, input().split()))
y = list(map( int, input().split()))
 
x = sorted(x)
y = sorted(y)
 
for i in range(X + 1, Y + 1):
  if( x[N-1] < i <= y[0]):
    print('No War')
    exit()
    
  else:
    print('War')
    break

Buggy submission (verdict: Runtime Error):
N = list(map( int, input().splot()))

N = sorted(N)

Nmax = int(N[2] * 10 + N[1] + N[0])

print(int(Nmax))
Problem p03272 (python)

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

print(N - i + 1)

Buggy submission (verdict: Runtime Error):
H, W = map( int, input().split())

a = []
b = []
c = []

for i in range(H):
  a1 = input()
  if('#' in a1):
     a.append(a1)
        
  else:
      continue

a = list(zip(*a))
l1 = len(a)
         
for j in range(l1):
  b1 = a[j]
   
  if( '#' in b1):
      b.append(b1)
  
  else:
      continue
         
c = list(zip(*b))
l2 = len(c)

for n in range(l2):
         print("".join(c[n]))
Problem p03307 (python)

Fixed submission:
N = int(input())

if( N % 2 == 1):
  print( N * 2)
  
else:
  print(N)

Buggy submission (verdict: Runtime Error):
N = int(input())

t = N //2 
intger = []

for n in range(t):
  intg = N / 2
  intger.append(intg)
  N = intg
  
intgersorted = sorted(intger)

print(intger[0])
Problem p03315 (python)

Fixed submission:
c = list(input())
T = 0
l = 4

for i in range(l):
  if( c[i] == '+'):
    T += 1
    
  else:
    T -= 1
    
print(T)

Buggy submission (verdict: Runtime Error):
T = 0

l = 4

for i in range(l):
  c = input()
  if( c == '+'):
    T += 1
    
  else:
    t -= 1
    
print(T)
Problem p02695 (python)

Fixed submission:
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
# N = list(map(int, input()))[::-1]
# N = int(input())
N, M, Q = map(int, input().split())
big = 0
s = 2**N
l = []

moto = list(range(1, Q+1))

for i in range(Q):
    l.append(list(map(int, input().split())))

A = []
for i in range(N):
    AA = []
    if A:
        for k in A:
            for j in range(1, M+1):
                if k[-1] <= j:
                    AA.append(k+[j])
        A = AA
    else:
        for j in range(1, M+1):
            A.append([j])

for i in A:
    wa = 0
    for j in l:
        if (i[j[1]-1]-i[j[0]-1]) == j[2]:
            wa += j[3]

    if big < wa:
        big = wa
print(big)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
# N = list(map(int, input()))[::-1]
# N = int(input())
N, M, Q = map(int, input().split())
big = 0
s = 2**N
l = []

moto = list(range(1, Q+1))

for i in range(Q):
    l.append(list(map(int, input().split())))

A = []
for i in range(N):
    AA = []
    if A:
        for k in A:
            for j in range(1, M+1):
                if int(k[-1]) <= j:
                    AA.append(k+str(j))
        A = AA
    else:
        for j in range(1, M+1):
            A.append(str(j))

for i in A:
    wa = 0
    for j in l:
        if (int(i[j[1]-1])-int(i[j[0]-1])) == j[2]:
            wa += j[3]

    if big < wa:
        big = wa
print(big)
Problem p02726 (python)

Fixed submission:
from collections import defaultdict
import math
import numpy as np
N, X, Y = map(int, input().split(' '))
d = defaultdict(int)
for i in range(1, N):
    for k in range(i+1, N+1):
        if(k < X):
            ans = k-i
            d[ans] += 1
        else:
            ans = min(k-i, abs(Y-k)+1+abs(i-X))
            d[ans] += 1

for i in range(1, N):
    print(d[i])

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import math
import numpy as np
N, X, Y = map(int, input().split(' '))
d = defaultdict(int)
for i in range(1, N):
    for k in range(i+1, N+1):
        if(k < X):
            ans = k-i
            d[ans] += 1
        else:
            ans = min(k-i, abs(Y-k)+1+abs(i-X))
            d[ans] += 1

for i in range(1, N):
    print(d[i])
Problem p02693 (python)

Fixed submission:
N = int(input())
mi,ma = map(int,input().split())

flag = 0
for i in range(mi,ma+1):
  if(i % N == 0):
    flag = 1
    break
if(flag == 1):
  print('OK')
else:
  print('NG')

Buggy submission (verdict: Runtime Error):
import math
import random

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

def quick(x):
  pri = math.floor(A * x / B)
  lat = A * math.floor(x / B)
  return math.floor(pri - lat)

max = quick(N)
for i in range(1000000):
  ran = math.floor(random.uniform(0, N))
  tem = quick(ran)
  if(max < tem):
    max = tem

print(max)
Problem p02712 (python)

Fixed submission:
a=int(input())

def sum30():
  return (1+2+4+7+8+11+13+14+16+17+19+22+23+26+28+29)

def sumx(x):
  ret = 0
  if(x ==0):
    return ret
  
  for j in range(1,x+1):
    if(j%3 != 0 and j%5 != 0):
      ret+=j
  return ret

def numx(x):
  ret = 0
  if(x ==0):
    return ret
  
  for j in range(1,x+1):
    if(j%3 != 0 and j%5 != 0):
      ret+=1
  return ret
sum=0

i=1
#if()
#sum+=temp*sum30()+sumx(a%30)
while(a > 0):
  if(a >= 30):
    temp=(i-1)*30*16+sum30()
    #print(temp)
    sum+=temp
  else:
    sum+=(i-1)*30*numx(a)+sumx(a)
  i+=1
  a-=30
#while(temp > 0):
#  sum+= temp*sum30()
#  temp-=1

    
print(sum)

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

def sum30:
  return (1+2+4+7+8+11+13+14+16+17+19+22+23+26+28+29)

def sumx(x):
  ret = 0
  for j in range(1,x):
    if(j%3 != 0 and j%5 != 0):
      ret+=j
  return ret

sum=0
i=1
while(a > 30):
  sum+=i*sum30
  i+=1
  a-=30
sum+=sumx(a)
    
print(sum)
Problem p02835 (python)

Fixed submission:
A1, A2, A3 = map(int, input().split())

if (A1+A2+A3) <= 21:
  print('win') 
elif(A1+A2+A3) > 21:
  print('bust')

Buggy submission (verdict: Runtime Error):

####
N = int(input())
A =  list(map(int,input().split()))

ans2 = 0
###
for y in range(N):
  for x in range(y+1,N):
    ans2 += (A[y] ^ A[x]) % 1000000007  
print(ans2%1000000007)
###