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

Fixed submission:
A=input()
B=input()
C=input()
t=[0,0,0]
flag="a"
while True:
  if flag=="a":
    if len(A)==t[0]:
      print("A")
      break
    else:
      flag=A[t[0]]
      t[0]+=1
  elif flag=="b":
    if len(B)==t[1]:
      print("B")
      break
    else:
      flag=B[t[1]]
      t[1]+=1
  elif flag=="c":
    if len(C)==t[2]:
      print("C")
      break
    else:
      flag=C[t[2]]
      t[2]+=1

Buggy submission (verdict: Runtime Error):
A=input()
B=input()
C=input()
t=[0,0,0]
flag="a"
while True:
  if flag=="a":
    if len(A)==t[0]+1:
      print("A")
      break
    else:
      flag=A[t[0]]
      t[0]+=1
  elif flag=="b":
    if len(B)==t[1]+1:
      print("B")
      break
    else:
      flag=B[t[1]]
      t[1]+=1
  elif flag=="c":
    if len(C)==0:
      print("C")
      break
    else:
      flag=C[t[2]]
      t[2]+=1

Buggy submission (verdict: Runtime Error):
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
flag="a"
while True:
  if flag=="a":
    if len(A)==0:
      print("A")
      break
    else:
      flag=A.pop(0)
  elif flag=="b":
    if len(B)==0:
      print("B")
      break
    else:
      flag=B.pop(0)
  elif flag=="c":
    if len(C)==0:
      print("C")
      break
    else:
      flag=C.pop(0)
Problem p04030 (python)

Fixed submission:
a=input()
ans=""
while len(a)>0:
  if a[0]=="0":
    ans+="0"
  elif a[0]=="1":
    ans+="1"
  elif len(ans)>0:
    ans=ans[:-1]
  a=a[1:]
print(ans)

Buggy submission (verdict: Runtime Error):
a=input()
ans=""
while len(a)>0:
  if a[0]=="0":
    ans+="0"
  elif a[0]=="1":
    ans+="1"
  elif len(ans)>0:
    ans=ans[,-1]
print(ans)
Problem p04031 (python)

Fixed submission:
n=int(input())
a=[]
a=list(map(int,input().split()))
ave=sum(a)/n
if ave<int(ave)+0.5:
  ave=int(ave)
else:
  ave=int(ave)+1
ans=0
for i in range(n):
  ans+=(a[i]-ave)**2
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=input()
b=[]
for i in range(n):
  b.append(int(a[i*2]))
ave=sum(b)/n
if ave<int(ave)+0.5:
  ave=int(ave)
else:
  ave=int(ave)+1
ans=0
for i in range(n):
  ans+=(b[i]-ave)**2
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=input()
b=[]
for i in range(n):
  b.append(a[i*2])
ave=sum(b)/n
if ave<int(ave)+0.5:
  ave=int(ave)
else:
  ave=int(ave)+1
ans=0
for i in range(n):
  ans+=(b[i]-ave)**2
print(ans)
Problem p04032 (python)

Fixed submission:
a=input()
t=-1
flag="False"
for i in range(len(a)-1):
  if a[i]==a[i+1]:
    flag="True1"
    t=i
    break
  if i!=len(a)-2:
    if a[i]==a[i+2]:
      flag="True2"
      t=i
      break
if flag=="False":
  print("{} {}".format(-1,-1))
elif flag=="True1":
  print("{} {}".format(t+1,t+2))
else:
  print("{} {}".format(t+1,t+3))

Buggy submission (verdict: Runtime Error):
a=input()
t=-1
flag="False"
for i in range(n-1):
  if a[i]==a[i+1]:
    flag="True1"
    t=i
    break
  if i!=n-2:
    if a[i]==a[i+2]:
      flag="True2"
      t=i
      break
if flag=="False":
  print("{} {}".format(-1,-1))
elif flag=="True1":
  print("{} {}".format(t+1,t+2))
else flag=="True2":
  print("{} {}".format(t+1,t+2))

Buggy submission (verdict: Runtime Error):
a=input()
t=-1
flag="False"
for i in range(n-1):
  if a[i]==a[i+1]:
    flag="True1"
    t=i
    break
  if i!=n-2 and a[i]==a[i+2]:
    flag="True2"
    t=i
    break
if flag=="False":
  print("{} {}".format(-1,-1))
elif flag=="True1":
  print("{} {}".format(t+1,t+2))
else flag=="True2":
  print("{} {}".format(t+1,t+2))
Problem p04045 (python)

Fixed submission:
a,n=map(int,input().split())
b=input()
c=[]
for i in range(n):
  c.append(int(b[2*i]))
flag="F"
while flag=="F":
  k=a
  fflag="T"
  while k>=1:
    l=int(k%10)
    for i in range(n):
      if c[i]==l:
        fflag="F"
        break
    k=int(k/10)
    if fflag=="F":
      break
  if fflag=="T":
    flag="T"
  else:
    a+=1
print(a)

Buggy submission (verdict: Runtime Error):
a,n=map(int,input())
b=[]
for i in range(n):
  b.append(int(input())
flag="F"
which flag=="F":
  k=a
  fflag="T"
  which k>=1 and fflag=="T":
    l=int(k%10)
    for i in range(n):
      if a[i]==l:
        fflag="F"
    break
  if fflag=="T":
    flag="T"
  else:
    a+=1
print(a)
Problem p02946 (python)

Fixed submission:
k, x = [int(v) for v in input().split()]

min_b = max(-1000000, x - (k - 1) )
max_b = min(1000000, x + (k - 1) )
ans = []
for i in range(min_b, max_b + 1):
  ans.append(str(i))
print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
min_b = max(-1000000, x - (k - 1) )
max_b = min(1000000, x + (k - 1) )
ans = []
for i in range(min_b, max_b + 1):
  ans.append(str(i))
print(" ".join(ans))
Problem p02997 (python)

Fixed submission:
n, k = [int(v) for v in input().split()]

c = (n - 1) * (n - 2) // 2
#print("c=", c)
m = 0
if k > c:
  print(-1)
else:
  m_max = n - 1 + (c - k)
  print(m_max)
  for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
      if m < m_max:
        print(i, j)
        m += 1
      else:
        break

Buggy submission (verdict: Runtime Error):
​
n, k = [int(v) for v in input().split()]
​
c = (n - 1) * (n - 2) // 2
#print("c=", c)
m = 0
if k > c:
  print(-1)
else:
  m_max = n - 1 + (c - k)
  print(m_max)
  for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
      if m < m_max:
        print(i, j)
        m += 1
      else:
        break
Problem p03006 (python)

Fixed submission:
n = int(input())

if n == 1:
  print(1)
else:
  #print("n=",n)
  xy_s = [[int(v) for v in input().split()] for _ in range(n)]
  v = {}
  for i in range(n):
    for j in range(n):
      if i == j:
        continue
      dx = xy_s[i][0] - xy_s[j][0]
      dy = xy_s[i][1] - xy_s[j][1]
      pq = (dx, dy)
      if pq in v:
        v[pq] += 1
      else:
        v[pq] = 1
    
      #v.append([xy_s[i][0] - xy_s[j][0] , xy_s[i][1] - xy_s[j][1]])
  #print(v)
  counts = v.values()
  m = max(counts)
  ans = n - m
  #print("n={}, m={}, ans={}".format(n, m, ans))
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
#print("n=",n)
xy_s = [[int(v) for v in input().split()] for _ in range(n)]
v = {}
for i in range(n):
  for j in range(n):
    if i == j:
      continue
    dx = xy_s[i][0] - xy_s[j][0]
    dy = xy_s[i][1] - xy_s[j][1]
    pq = (dx, dy)
    if pq in v:
      v[pq] += 1
    else:
      v[pq] = 1
    
    #v.append([xy_s[i][0] - xy_s[j][0] , xy_s[i][1] - xy_s[j][1]])
#print(v)
counts = v.values()
m = max(counts)
ans = n - m
#print("n={}, m={}, ans={}".format(n, m, ans))
print(ans)
Problem p04043 (python)

Fixed submission:
s = sorted([int(v) for v in input().split()])
if s == [5, 5, 7]:
  ans = "YES"
else: 
  ans = "NO"
print(ans)

Buggy submission (verdict: Runtime Error):
def equal(n, available):
  return n in available 

def less(n, available):
  return n < sorted(available)[0]

def greater(n, available):
  return n > sorted(available, reverse=True)[0]
  

#less(n, available) == True であること
def upper_next(n, available):  
  for v in sorted(available):
    if n < v:
      return v
  return 1/0

  
n_str, _ = [v for v in input().split()]
n_s = [0]
n_s.extend([int(n_str[i:i+1]) for i in range(len(n_str))])

d_s = [int(v) for v in input().split()]

available = set(list(range(10))) - set(d_s)

#print("n", n_s, "d", d_s, "u", available)

min_available = sorted(available)[0]
max_available = sorted(available, reverse=True)[0]

ans = [0]
ans.extend([min_available] * (len(n_s) - 1))

eq = True
for i in range(1, len(n_s)):
  if eq:
    if equal(n_s[i], available):
      ans[i] = n_s[i]
      continue
    else:
      eq = False
      if less(n_s[i], available):
        ans[i] = upper_next(n_s[i], available)
        #残りは最小値詰め
        break
      else:
        for j in range(i - 1, -1, -1):
          if ans[j] == max_available:
            ans[j] = min_available
          else:
            ans[j] = upper_next(ans[j], available)
            break
        break

begin = 0
if ans[0] == 0:
  begin = 1
ans_val = "".join(map(lambda x:str(x), ans[begin:]))

print(ans_val)
Problem p04045 (python)

Fixed submission:
def equal(n, available):
  return n in available 

def less(n, available):
  return n < sorted(available, reverse=True)[0]

def greater(n, available):
  return n > sorted(available, reverse=True)[0]
  

#less(n, available) == True であること
def upper_next(n, available):  
  for v in sorted(available):
    if n < v:
      return v
  return 1/0

  
n_str, _ = [v for v in input().split()]
n_s = [0]
n_s.extend([int(n_str[i:i+1]) for i in range(len(n_str))])
#print(n_s)
d_s = [int(v) for v in input().split()]

available = set(list(range(10))) - set(d_s)

#print("n", n_s, "d", d_s, "u", available)

min_available = sorted(available)[0]
max_available = sorted(available, reverse=True)[0]
#print(min_available, max_available)
ans = [0]
ans.extend([min_available] * (len(n_s) - 1))

eq = True
for i in range(1, len(n_s)):
  #print(ans)
  if eq:
    if equal(n_s[i], available):
      ans[i] = n_s[i]
      continue
    else:
      eq = False
      #print(n_s[i], available)
      if less(n_s[i], available):
        ans[i] = upper_next(n_s[i], available)
        #残りは最小値詰め
        break
      else:
        for j in range(i - 1, -1, -1):
          #print(ans)
          if ans[j] == max_available:
            ans[j] = min_available
          else:
            #print(ans)
            ans[j] = upper_next(ans[j], available)
            #print(ans)
            break
        break

#print(ans)
begin = 0
if ans[0] == 0:
  begin = 1
ans_val = "".join(map(lambda x:str(x), ans[begin:]))

print(ans_val)

Buggy submission (verdict: Runtime Error):
def equal(n, available):
  return n in available 

def less(n, available):
  return n < sorted(available)[0]

def greater(n, available):
  return n > sorted(available, reverse=True)[0]
  

#less(n, available) == True であること
def upper_next(n, available):  
  for v in sorted(available):
    if n < v:
      return v
  return 1/0

  
n_str, _ = [v for v in input().split()]
n_s = [0]
n_s.extend([int(n_str[i:i+1]) for i in range(len(n_str))])

d_s = [int(v) for v in input().split()]

available = set(list(range(10))) - set(d_s)

#print("n", n_s, "d", d_s, "u", available)

min_available = sorted(available)[0]

ans = [0]
ans.extend([min_available] * (len(n_s) - 1))

eq = True
for i in range(1, len(n_s)):
  if eq:
    if equal(n_s[i], available):
      ans[i] = n_s[i]
      continue
    else:
      eq = False
      if less(n_s[i], available):
        ans[i] = upper_next(n_s[i], available)
        #残りは最小値詰め
        break
      else:
        for j in range(i - 1, -1, -1):
          if greater(ans[j], available):
            ans[j] = min_available
          else:
            ans[j] = upper_next(ans[j], available)
            break
        break

begin = 0
if ans[0] == 0:
  begin = 1
ans_val = "".join(map(lambda x:str(x), ans[begin:]))

print(ans_val)
Problem p02675 (python)

Fixed submission:
N = int(input())
if (N%100)%10 == 3:
    print('bon')
elif (N%100)%10 == 0 or (N%100)%10 ==1 or (N%100)%10 ==6 or (N%100)%10 ==8:
    print('pon')
else:
    print('hon')

Buggy submission (verdict: Runtime Error):
N = input(int())
if (N%100)%10 == 3:
    print('bon')
elif (N%100)%10 == 0 or (N%100)%10 ==1 or (N%100)%10 ==6 or (N%100)%10 ==8:
    print('pon')
else:
    print('hon')
Problem p02924 (python)

Fixed submission:
N = int(input())
print((N * (N - 1)) // 2)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(range(1, N + 1))
M = list(range(2, N + 1))
n = 0
for a in range(0, N - 1):
    n = n + (S[a] % M[a])
print(n)
Problem p03035 (python)

Fixed submission:
A,B= [int(x) for x in input().split()]

if A <= 5:
    print(0)
elif 6<= A <= 12:
    print(int(B/2))
else:
    print(B)

Buggy submission (verdict: Runtime Error):
A,B= [int(x) for x in input().split()]

if A <= 5:
    print(0)
elif 6<= a <= 12:
    print(int(B/2))
else:
    print(B)

Buggy submission (verdict: Runtime Error):
A,B= [int(x) for x in input()]

if A <= 5:
    print(0)
elif 6<= a <= 12:
    print(int(B/2))
else:
    print(B)
Problem p03068 (python)

Fixed submission:
N = int(input())
S = [str(x) for x in input()]
K = int(input())
for a in range(N):
    if not S[a] == S[K - 1]:
        S[a] = '*'
print(''.join(S))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [str(x) for x in input().split()]
K = int(input())
for a in range(N):
    if not S[a] == S[K - 1]:
        S[a] = '*'
print(''.join(S))
Problem p02718 (python)

Fixed submission:
n,m = map(int,input().split())
a = list(map(int, input().split()))
popular = list(filter(lambda e: e>=(1/(4*m))*sum(a),a))
print("Yes" if len(popular) >= m else "No")

Buggy submission (verdict: Runtime Error):
 n,m = map(int,input().split())
a = list(map(int, input().split()))
popular = list(filter(lambda e: e>=(1/(4*m))*sum(a),a))
print("Yes" if len(popular) >= m else "No")
Problem p02621 (python)

Fixed submission:
a = int(input())
print (a + a **2 + a **3)

Buggy submission (verdict: Runtime Error):
a = n
print(a + a ** 2 + a ** 3)
Problem p02630 (python)

Fixed submission:
import collections

n=int(input())
arr=list(map(int,input().split()))
cnt=collections.defaultdict(int)
for val in arr: #あらかじめ各Aiの個数を数えておく
 cnt[val]+=1
sums=sum(arr) #あらかじめAiの総和を求めておく
q=int(input())
for _ in range(q):
 b,c=map(int,input().split())
 diff=(c-b)*(cnt[b]) #各クエリにおいて数列Aの総和は(値がBiである要素の個数)*(Ci-Bi)だけ変化する
 sums+=diff
 print(sums) 
 cnt[c]+=cnt[b] #値がCi,Biである要素の個数を更新する
 cnt[b]=0

Buggy submission (verdict: Runtime Error):
#from collections import defaultdict

n = int(input())
cnt =[0]*10**5

l = list(map(int, input().split()))

for i in l:
    cnt[i] += 1
    
sums = sum(l)
    
m = int(input())

for i in range(m):
    a,b = map(int, input().split())
    
    diff = (b-a)*cnt[a]
    sums += diff
    print(sums)
    
    cnt[b] += cnt[a]
    cnt[a] = 0

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

l = list(map(int, input().split()))

sort(l)

m = int(input())

for i in range(m):
    a,b = map(int, input().split())
    
    l = [b if j == a else j for j in l]

    print(sum(l))
Problem p02658 (python)

Fixed submission:
n =int(input())
limit = 10**18
re =1
 
l = list(map(int, input().split()))
 
l.sort()
#print(l)
if(l[0] == 0):
    re = 0
else:
  for i in l:
    re *= i
    #print(re)
    if(re > limit):
      re = -1
      break
print(re)

Buggy submission (verdict: Runtime Error):
n =int(input())
limit = 10**18
re =0

l = list(map(int, input().split()))

l.sort()

if(l[0]) != 0):
  for i in l:
    re *= i
    if(re > limit):
      print(-1)
      exit()

print(re)

Buggy submission (verdict: Runtime Error):
n = int(input())
re = 1

for i in range(n):
    m= int(input())
    re *= m
    
if(re > 1000000000000000000):
    print("-1")
else:
    print(re)

Buggy submission (verdict: Runtime Error):
n = int(input())
re = 1

for i in range(n):
  m = int(input())
  
  re *= m
if(re >= 1000000000000000000):
    print("-1")
else:
    print(re)
Problem p02713 (python)

Fixed submission:

import math

n = int(input())
count = 0

for i in range(1,n+1):
    for j in range(1,n+1):
        t = math.gcd(i,j)
        for k in range(1,n+1):
            m = math.gcd(t,k)
            count += m
print(count)

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

def gcd(*numbers):
    return reduce(math.gcd, numbers)

for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            m = gcd(i,j,k)
            count += m
print(count)
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
lst = list(map(int, input().split()))
lst.sort()
if len(lst) == 0:
    print(X)
    exit()
A = X
while A in lst:
    A -= 1
B = X
while B in lst:
    B += 1
if X-A > B-X:
    print(B)
else:
    print(A)

Buggy submission (verdict: Runtime Error):
X,N = map(int,input().split())
lst = list(map(int,input().split()))
lst.sort()
if len(lst) == 0 :
    print(x)
    exit()
a = X
while a in lst :
    a += 1
b = X
while b in lst:
    b -= 1
if X-b > X-a :
    print(a)
else :
    print(b)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
ls = list(map(int, input().split()))
res = 1
if 0 in ls:
    print(0)
    quit()
for x in ls:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)
Problem p02658 (python)

Fixed submission:
n = int(input())
ls = list(map(int, input().split()))
res = 1
if 0 in ls:
    print(0)
    quit()
for x in ls:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)

Buggy submission (verdict: Runtime Error):
a, b = map(float, input().split())
print(int(a * b))
n = int(input())
ls = list(map(int, input().split()))
res = 1
if 0 in ls:
    res = 0
for x in ls:
    res *= x
    if res > 10**18:
        res = -1
print(res)

Buggy submission (verdict: Runtime Error):
a, b = map(float, input().split())
print(int(a * b))
n = int(input())
ls = list(map(int, input().split()))
res = 1
if 0 in ls:
    res = 0
for x in ls:
    res *= x
    if res > 10**18:
        res = -1
print(res)

Buggy submission (verdict: Runtime Error):
A,B  = map(float, input().split())
print(int(A * B))
N = int(input())
lst = list(map(int, input().split()))
res = 1
if 0 in lst:
    res = 0
for x in lst:
    res *= x
    if res > 10**18:
        res = -1
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst = list(map(int,input().split())
output = 1
if 0 in lst :
	print(0)
    quit()
for x in lst :
	output = output * x           
    if output > 10**8 :
    	print(-1)
        quit()
print(output)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst = list(map(int, input().split()))
lst = sorted(A,reverse=True)
output = 1
if 0 in lst:
    print(0)
    quit()
else:
    for i in range(N):
        output = output*A[i]
        if output>= 10**18:
            print(-1)
            quit()
print(output)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = list(map(int, input().split()))
output = 1
if 0 in lst:
    print(0)
    quit()
for x in lst:
    output = output * x
    if res > 10**18:
        print(-1)
        quit()
print(output)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst = list(map(int, input().split()))
output = 1
if 0 in lst:
    print(0)
    quit()
for i in ls:
    output *= i
    if output > 10**18:
        print(-1)
        quit()
print(output)
Problem p02732 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n+1)
nsum=0
for i in range(n):
    b[a[i]]+=1
for k in range(n+1):
    nsum+=max(b[k]*(b[k]-1)//2,0)

for j in range(n):
    print((nsum+1-b[a[j]]))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
nsum=0
for i in range(n):
    b[a[i]]+=1
for k in range(n):
    nsum+=max(b[k]*(b[k]-1)//2,0)


for j in range(n):
    print((nsum+1-b[a[j]]))
Problem p02885 (python)

Fixed submission:
A,B=map(int,input().split())
print(max(A-2*B,0))

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
print(min(A-2*B),0)
Problem p03597 (python)

Fixed submission:
N=int(input())
A=int(input())
print(N*N-A)

Buggy submission (verdict: Runtime Error):
A,B,C,D,E,F=map(int,input().split())
maxx=0
s=1
t=0
for i in range(F//(100*B)+1):
    for j in range((F-i*100*B)//(100*A)+1):
        for k in range(((i*B+j*A)*E)//D+1):
            for l in range (((i*B+j*A)*E-k*D)//C+1):
                if i==0 and j==0 and k==0 and l==0:
                    continue
                if (100*(i*B+j*A)+k*D+l*C)>F:
                    break
                elif (k*D+l*C)/(k*D+l*C+100*(i*B+j*A))>maxx:
                    maxx=(k*D+l*C)/(k*D+l*C+100*(i*B+j*A))
                    s=(k*D+l*C+100*(i*B+j*A))
                    t=k*D+l*C

print(s,t)
Problem p02621 (python)

Fixed submission:
a = int(input())
n = a + a**2 + a**3
print(n)

Buggy submission (verdict: Runtime Error):
a = str(input())
s = a + a**2 + a**3
print(s)
Problem p02639 (python)

Fixed submission:
x = list(map(int,input().split()))
for i in range(5):
  if x[i] == 0:
    print(i+1)

Buggy submission (verdict: Runtime Error):
x = list(map(int,input().stlip()))
for i in range(5):
  if x[i] == 0:
    print(i+1)
Problem p02641 (python)

Fixed submission:
X,N = list(map(int,input().split()))
if N != 0:
  p = list(map(int,input().split()))
else:
  p = [X+1]
def f(p):
  global X
  return p - X

p2 = list(map(f,p))

p3 = list(map(abs,p2))

OK = 2
j = 0


if min(p3) ==0:
  while(OK==2):
    j+=1
    OK = p3.count(min(p3)+j)
  if OK == 1:
    print(X-p2[p3.index(min(p3)+j)])
  else:
    print(X-j)
else:
  print(X)

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

def f(p):
  global X
  return p - X

p2 = list(map(f,p))

p3 = list(map(abs,p2))

OK = 2
j = 0


if min(p3) ==0:
  while(OK==2):
    j+=1
    OK = p3.count(min(p3)+j)
  if OK == 1:
    print(X-p2[p3.index(min(p3)+j)])
  else:
    print(X-j)
else:
  print(X)

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

def f(p):
  global X
  return p - X

p2 = list(map(f,p))

p3 = list(map(abs,p2))

OK = 2
j = 0
print(p2,p3)

if min(p3) ==0:
  while(OK==2):
    j+=1
    
    OK = p3.count(min(p3)+j)

  print(X-p2[p3.index(min(p3)+j)])
      
else:
  print(X)
Problem p02657 (python)

Fixed submission:
A,B = input().split()
print(int(A)*int(B))

Buggy submission (verdict: Runtime Error):
A,B = int(input().split())
print(A*B)
Problem p02675 (python)

Fixed submission:
N = int(input())
N1 = N % 10
if N1 ==3:
  print('bon')
elif N1 == 0 or N1==1 or N1== 6 or N1 == 8:
  print('pon')
else:
  print('hon')

Buggy submission (verdict: Runtime Error):
N = int(input())
N1 = N % 10
if N1 ==3:
  print('bon')
elif N1 == 0||N1==1||N1== 6||N1 == 8:
  print('pon')
else:
  print('hon')

Buggy submission (verdict: Runtime Error):
N = int(input())
N1 = N % 10
if N1 ==3:
  print('bon')
elif N1 == 0,1,6,8:
  print('pon')
else:
  print('hon')
Problem p02705 (python)

Fixed submission:
import math

R = int(input())
R = 2*R*math.pi

print(R)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input()
S = A.replace(' ','a')
S = S + 'a'

for i in range(N):
  j = str(i+1) + 'a'
  k = S.count(j)
  print(k)
Problem p02772 (python)

Fixed submission:
N = int(input())
list = input().split()
on = 0
for i in range(N):
  k = int(list[i])
  if k % 2 == 0:
    if k % 3 == 0 or k % 5 == 0:
      on = 1 
    else:
      print("DENIED")
      break
  if i == N-1:
  	print("APPROVED")

Buggy submission (verdict: Runtime Error):
N = int(input())
list = input().split()
for i in range(N):
  k = int(list[i])
  if k % 2 == 0:
    if k % 3 == 0 or k % 5 == 0:
        if k == int(list[N]):
          print("APPROVED")
    else:
      print("DENIED")
      break
Problem p02910 (python)

Fixed submission:
s = input()
n = len(s)
for i in range(0, n, 2):
    if s[i] == 'L':
        print("No")
        exit()
for i in range(1, n, 2):
    if s[i] == 'R':
        print("No")
        exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
count = 0
for i in range(0, n, 2):
    if s[i] == 'R':
        count += 1
for i in range(1, n, 2):
    if s[i] == 'L':
        count += 1
if count == n:
    print("Yes")
else print("No")
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
c_max = 0
count = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        count += 1
    else:
        c_max = max(count, c_max)
        count = 0
print(max(c_max, count))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
a = []
for i in range(n-1):
    count = 0
    for j in range(i, n-1):
        if h[j] >= h[j+1]:
            count += 1
        else:
            break
    a.append(count)
print(max(a))
Problem p02995 (python)

Fixed submission:
from fractions import gcd

a, b, c, d = map(int, input().split())
x = b-a+1
l = c//gcd(c, d)*d
ans = (b//c - (a-1)//c) + (b//d - (a-1)//d) - (b//l - (a-1)//l)
print(x-ans)

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d = map(int, input().split())
x = b-a+1
l = c//math.gcd(c, d)*d
ans = (b//c - (a-1)//c) + (b//d - (a-1)//d) - (b//l - (a-1)//l)
print(x-ans)