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

Fixed submission:
def grinp(h):
  ret=[]
  for i in range(h):
    ret.append(list(input()))
  return ret
h,w=map(int,input().split())
grid=grinp(h)
fa=False
for i in range(h):
  for j in range(w):
    if grid[i][j]==".":
      continue
    fl=0
    if i!=0 and grid[i-1][j]=="#":
      fl+=1
    if i!=h-1 and grid[i+1][j]=="#":
      fl+=1
    if j!=0 and grid[i][j-1]=="#":
      fl+=1
    if j!=w-1 and grid[i][j+1]=="#":
      fl+=1
    if fl==0:
      fa=True
      break
  if fa:
    break
if fa:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
def grinp(h):
  ret=[]
  for i in range(h):
    ret.append(list(input()))
  return ret
h,w=map(int,input().split())
grid=grinp(h)
fa=False
for i in range(h):
  for j in range(w):
    if grid[i][j]==".":
      continue
    fl=0
    if i!=0 and grid[i-1][j]=="#":
      fl+=1
    if i!=h-1 and grid[i+1][j]=="#":
      fl+=1
    if j!=0 and grid[i][j-1]=="#":
      fl+=1
    if j!=h-1 and grid[i][j+1]=="#":
      fl+=1
    if fl==0:
      fa=True
      break
  if fa:
    break
if fa:
  print("No")
else:
  print("Yes")
Problem p03478 (python)

Fixed submission:
n,a,b=map(int,input().split())
ans=[0]*37
def ssum(n):
  li=list(str(n))
  ret=0
  for i in li:
    ret+=int(i)
  return(ret)
  
while n!=0:
  ans[ssum(n)]+=n
  n-=1

print(sum(ans[a:b+1]))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
ans=[0]*36
def ssum(n):
  li=list(str(n))
  ret=0
  for i in li:
    ret+=int(i)
  return(ret)
  
while n!=0:
  ans[ssum(n)]+=n
  n-=1

print(sum(ans[a:b+1]))
Problem p03481 (python)

Fixed submission:
x,y=map(int,input().split())
i=1
while x*2<=y:
  i+=1
  x*=2
print(i)

Buggy submission (verdict: Runtime Error):
3 20
Problem p03486 (python)

Fixed submission:
x=sorted(list(input()))
y=sorted(list(input()),reverse=True)
a=""
b=""
for p in x:
  a+=p
for q in y:
  b+=q
if a<b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x=sorted(list(input()))
y=sorted(list(input()),reverse=true)
a=""
b=""
for (p,q) in zip x,y:
  a+=p
  b+=q
if a<b:
  print("Yes")
else:
  print("No")
Problem p03606 (python)

Fixed submission:
n=int(input())
out=0
for i in range(n):
  a,m=map(int,input().split())
  out+=m-a+1
print(out)

Buggy submission (verdict: Runtime Error):
n=int(input())
out=0
for i in range(n):
  a,m=map(int,input().split())
  out+=m-a+1
print(out)
n=int(input())
out=0
for i in (n):
  a,m=map(int,input().split())
  out+=m-a+1
print(out)

Buggy submission (verdict: Runtime Error):
n=int(input())
out=0
for i in (n):
  a,m=map(int,input().split())
  out+=m-a+1
print(out)

Buggy submission (verdict: Runtime Error):
n=int(input())
out=0
for i in (n):
  n,m=map(int,input().split())
  out+=m-n+1
print(out)
Problem p03611 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
am=max(a)
num=[0]*(am+1)
for i in a:
  num[i]+=1
#print(num)
mx=0
for i in range(1,am):
  #print(num[i-1:i+2])
  m=sum(num[i-1:i+2])
  if m>mx:
    mx=m
if len(num)<=3:
  mx=sum(num)
print(mx)

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

num=[0]*(max(a))
for i in a:
  num[i-1]+=1
#print(num)
mx=0
for i in range(1,max(a)-1):
  #print(num[i-1:i+2])
  m=sum(num[i-1:i+2])
  if m>mx:
    mx=m

print(mx)
Problem p03627 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=0
b=-1
for i in a:
  if i==b:
    if ans!=0:
      ans*=i
      break
    else:
      ans=i
      b=-1
      continue
  b=i
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
f=0
s=0
mx=max(a)
cnt=[0]*(mx+1)
for i in a:
  cnt[i]+=1
for (j,i) in zip(cnt,range(mx+1)):
  if j>=2:
    if j>=4:
      f=i
      s=i
    else:
      s=f
      f=i
print(f*s)
Problem p03695 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
c=[0]*9

for r in a:
  x=r//400
  if x>8:
    x=8
  c[x]+=1
ans=0
for i in range(9):
  if i==8:
    if ans==0:
      mn=1
      mx=n
    else:
      mn=ans
      mx=ans+c[i]
  if c[i]!=0:
    ans+=1

print("{} {}".format(mn,mx))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
c=[0]*9

for r in a:
  x=r//400
  if x>8:
    x==8
  c[x]+=1
ans=0
for i in range(9):
  if i==8:
    if ans==0:
      mn=1
      mx=n
    else:
      mn=ans
      mx=ans+c[i]
  if c[i]!=0:
    ans+=1

print("{} {}".format(mn,mx))
Problem p03773 (python)

Fixed submission:
x=sum(list(map(int,input().split())))
if x>=24:
  x-=24
print(x)

Buggy submission (verdict: Runtime Error):
x=sum(list(map(int,input.split())))
if x>=24:
  x-=24
print(x)
Problem p03844 (python)

Fixed submission:
a,op,b=input().split()
a=int(a)
b=int(b)
if op=="+":
  print(a+b)
else:
  print(a-b)

Buggy submission (verdict: Runtime Error):
a,op,b=imput().split()
a=int(a)
b=int(b)
if op=="+":
  print(a+b)
else:
  print(a-b)
Problem p03998 (python)

Fixed submission:
lis=[]
ll=["a","b","c"]
for i in range(3):
  lis.append(list(input()))
turn=0
while 1:
  if lis[turn]==[]:
    print(ll[turn].upper())
    break
  turn=ll.index(lis[turn].pop(0))

Buggy submission (verdict: Runtime Error):
lis=[]
ll=["a","b","c"]
for i in range(3):
  lis.append(list(input()))
turn=0
while 1:
  x=ll.index(lis[turn].pop())
  if lis[turn]=[]:
    print(ll[turn].upper())
    break
  turn=x
Problem p02609 (python)

Fixed submission:
N = int(input())
X = list(input())
P = X.count("1")
if P != 1:
    P1 = 0
    P2 = 0
    for i in range(N):
        if X[i] == "1":
            P1 += pow(2,N-i-1,P-1)
            P1 %= P-1
            P2 += pow(2,N-i-1,P+1)
            P2 %= P+1
    for i in range(N):
        count = 1
        if X[i] == "0":
            cur = P2+pow(2,N-i-1,P+1)
            cur %= P+1
        else:
            cur = P1-pow(2,N-1-i,P-1)
            cur %= P-1
        while cur > 0:
            mod = bin(cur).count("1")
            cur %= mod
            count += 1
        print(count)
else:
    P2 = 0
    for i in range(N):
        if X[i] == "1":
            P2 += pow(2,N-i-1,P+1)
    for i in range(N):
        count = 1
        if X[i] =="1":
            print(0)
        else:
            cur = P2+pow(2,N-i-1,P+1)
            cur %= P+1
            while cur > 0:
                mod = bin(cur).count("1")
                cur %= mod
                count += 1
            print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = list(input())
P = X.count("1")
P1 = 0
P2 = 0
for i in range(N):
    if X[i] == "1":
        P1 += pow(2,N-i-1,P-1)
        P1 %= P-1
        P2 += pow(2,N-i-1,P+1)
        P2 %= P+1
for i in range(N):
    count = 1
    if X[i] == "0":
        cur = P2+pow(2,N-i-1,P+1)
        cur %= P+1
    else:
        cur = P1-pow(2,N-1-i,P-1)
        cur %= P-1
    while cur > 0:
        mod = bin(cur).count("1")
        cur %= mod
        count += 1
    print(count)
Problem p02616 (python)

Fixed submission:
mod = 10**9+7
N,K = map(int,input().split())
A = list(map(int,input().split()))
canPositive = 0
Positive = 0
ans = 1
def inv(arg):
    return pow(arg,mod-2,mod)
for i in range(N):
    if A[i] >= 0:
        Positive += 1
if N - K >= 1 and Positive >= 1:
    canPositive = 1
if Positive == 0 and K % 2 == 0:
    canPositive = 1
anslist = []
if canPositive:
    A.sort(key=lambda x:abs(x),reverse=True)
    n = 0
    for a in A[:K]:
        anslist.append(a)
        if a < 0:
           n += 1
    if n % 2 == 1:
        minpos = 0
        minneg = 0
        maxpos = 0
        maxneg = 0
        for i in anslist[::-1]:
            if i > 0:
                minpos = i
                break
        for i in anslist[::-1]:
            if i < 0:
                minneg = i
                break
        for i in A[K:]:
            if i < 0:
                maxneg = i
                break
        for i in A[K:]:
            if i > 0:
                maxpos = i
                break
        if maxneg == 0 or minpos == 0:
            ans *= maxpos*inv(minneg) 
        elif maxpos == 0 or minneg == 0:
            ans *= maxneg*inv(minpos) 
        else:
            if abs(minpos*maxpos) > abs(maxneg*minneg):
                ans *= maxpos*inv(minneg) 
            else:
                ans *= maxneg*inv(minpos) 
else:
    A.sort(key=lambda x:abs(x))
    for a in A[:K]:
        anslist.append(a)
for i in anslist:
    ans *= i
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
mod = 10**9+7
N,K = map(int,input().split())
A = list(map(int,input().split()))
canPositive = 0
Positive = 0
ans = 1
def inv(arg):
    return pow(arg,mod-2,mod)
for i in range(N):
    if A[i] >= 0:
        Positive += 1
if N - K >= 1 and Positive >= 1:
    canPositive = 1
if Positive == 0 and K % 2 == 0:
    canPositive = 1
anslist = []
if canPositive:
    A.sort(key=lambda x:abs(x),reverse=True)
    n = 0
    for a in A[:K]:
        anslist.append(a)
        if a < 0:
           n += 1
    if n % 2 == 1:
        minpos = 0
        minneg = 0
        maxpos = 0
        minneg = 0
        for i in anslist[::-1]:
            if i > 0:
                minpos = i
                break
        for i in anslist[::-1]:
            if i < 0:
                minneg = i
                break
        for i in A[K:]:
            if i < 0:
                maxneg = i
                break
        for i in A[K:]:
            if i > 0:
                maxpos = i
                break
        if abs(minpos*maxpos) > abs(maxneg*minneg):
            ans *= maxpos*inv(minneg)
        else:
            ans *= maxneg*inv(minpos)
else:
    A.sort(key=lambda x:abs(x))
    for a in A[:K]:
        anslist.append(a)
for i in anslist:
    ans *= i
    ans %= mod
print(ans)
Problem p02618 (python)

Fixed submission:
from collections import defaultdict
d = int(input())
c = list(map(int,input().split()))
s = []
for i in range(d):
    s.append(list(map(int,input().split())))
dic = defaultdict(int)
for i in range(1,d+1):
    maxscore = -10000000
    maxcontest = -1
    for k in range(26):
        score = 0
        score += s[i-1][k-1]
        for j in range(26):
            if j != k:
                score -= c[j]*(i-dic[j])
        if score > maxscore:
            maxscore = score
            maxcontest = k
    print(maxcontest+1)
    dic[maxcontest] = i

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import heapq as hq
d = int(input())
c = list(map(int,input().split()))
s = [0]
for i in range(d):
    s.append([0]+list(map(int,input().split())))
dic = defaultdict(int)
contest = [[] for _ in range(27)]
contests = [-1]*(d+1)
for i in range(1,d+1):
    maxscore = 0
    maxcontest = -1
    for k in range(1,27):
        score = 0
        score += s[i][k]
        score += c[k]*(i-dic[k])
        if score > maxscore:
            maxscore = score
            maxcontest = k
    print(maxcontest)
    dic[maxcontest] = i
Problem p02626 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
x = 0
for i in range(2,n):
    x ^= a[i]
s = a[0]+a[1]
if s < x or (s-x) % 2 == 1:
    print(-1)
    exit()
d = (s-x)//2
if d & x != 0 or d > a[0]:
    print(-1)
    exit()
i = 50
ans = d
while i >= 0:
    if x >> i & 1:
        if (1 << i) + ans <= a[0]:
            ans += 1 << i
    i -= 1
if ans == 0:
    print(-1)
    exit()
print(a[0]-ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
x = 0
for i in range(2,n):
    x ^= a[i]
s = a[0]+a[1]
if s < x or (s-x) % 2 == 1:
    print(-1)
    exit()
d = (s-x)//2
if d & x != 0 or d > a[0]:
    print(-1)
    exit()
i = 50
ans = d
while i >= 0:
    if x >> i & 1:
        if 1 << i + ans <= a:
            ans += a << i
    i -= 1
print(a[0]-ans)
Problem p02642 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
ok = [1]*(10**6+1)
ans = 0
for i in range(n):
    if ok[a[i]]:
        if i < n-1:
            if a[i+1] != a[i]:
                ans += 1
        else:
            ans += 1
        for j in range(1,10**6//a[i]+1):
            ok[a[i]*j] = 0
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def make_divisors(n):
    divisors = np.zeros(0,np.int32)
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors = np.append(divisors,i)
            if i != n // i:
                divisors = np.append(divisors,n//i)
    return divisors

@njit
def ok(i,a):
  def make_divisors(n):
    divisors = np.zeros(0,np.int32)
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors = np.append(divisors,i)
            if i != n // i:
                divisors = np.append(divisors,n//i)
    return divisors
    x = a[i]
    for j in make_divisors(x):
        for k in range(n):
            if i != k and j == a[k]:
                break
        else:
            continue
        break
    else:
        return 1
    return 0

n = int(readline())
a = list(map(int,input().split()))
a = np.array(a,np.int32)
ans = 0
for i in range(n):
    ans += ok(i,a)
print(ans)
Problem p02664 (python)

Fixed submission:
t = input()
t = t.replace("?","D")
print(t)

Buggy submission (verdict: Runtime Error):
t = input()
t = t.reprace("?","D")
print(t)
Problem p02686 (python)

Fixed submission:
n = int(input())
brackets_plus = []
brackets_minus = []
right = 0
left = 0
for i in range(n):
    s = input()
    cur = 0
    m = 0
    for j in range(len(s)):
        if s[j] == "(":
            left += 1
            cur += 1
        else:
            right += 1
            cur -= 1
            m = min(m,cur)
    if cur >= 0:
        brackets_plus.append((m,cur))
    else:
        brackets_minus.append((m,cur,m-cur))
if right != left:
    print("No")
    exit()
cur = 0
brackets_plus.sort(reverse = True)
for i in brackets_plus:
    if i[0] + cur < 0:
        print("No")
        exit()
    cur += i[1]
brackets_minus.sort(key = lambda x:x[2])
for i in brackets_minus:
    if i[0] + cur < 0:
        print("No")
        exit()
    cur += i[1]
print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
brackets_plus = []
brackets_minus = []
right = 0
left = 0
for i in range(n):
    s = input()
    cur = 0
    m = 0
    for j in range(len(s)):
        if s[j] == "(":
            left += 1
            cur += 1
        else:
            right += 1
            cur -= 1
            m = min(m,cur)
    if cur >= 0:
        brackets_plus.append((m,cur))
    else:
        brackets_minus.append((m,cur,m-cur))
if right != left:
    print("No")
    exit()
cur = 0
brackets_plus.sort(reverse = True)
for i in brackets_plus:
    if i[0] + cur < 0:
        print("No")
        exit()
    cur += i[1]
brackets_minus.sort(key == lambda x:x[2])
for i in brackets_minus:
    if i[0] + cur < 0:
        print("No")
        exit()
    cur += i[1]
print("Yes")
Problem p02698 (python)

Fixed submission:
import bisect
import sys
sys.setrecursionlimit(1<<30)
def dfs(i,LIS):
    if a[i] > LIS[-1]:
        LIS.append(a[i])
        ans[i] = len(LIS)
        for j in edges[i]:
            if parent[i] != j:
                parent[j] = i
                dfs(j,LIS)
        LIS.pop()
    else:
        index = bisect.bisect_left(LIS, a[i])
        x = LIS[index]
        LIS[index] = a[i]
        ans[i] = len(LIS)
        for j in edges[i]:
            if parent[i] != j:
                parent[j] = i
                dfs(j,LIS)
        LIS[index] = x

N = int(input())
a = [0]+list(map(int,input().split()))
edges = [[] for _  in range(N+1)]
ans = [-1]*(N+1)
parent = [-1]*(N+1)
for i in range(N-1):
    u,v = map(int,input().split())
    edges[u].append(v)
    edges[v].append(u)
LIS = [a[1]]
dfs(1,LIS)
for i in ans[1:]:
    print(i)

Buggy submission (verdict: Runtime Error):
import bisect
def dfs(i,LIS):
    print(i)
    if a[i] > LIS[-1]:
        LIS.append(a[i])
        ans[i] = len(LIS)
        for j in edges[i]:
            if parent[i] != j:
                parent[j] = i
                dfs(j,LIS)
        LIS.pop()
    else:
        index = bisect.bisect_left(LIS, a[i])
        x = LIS[index]
        LIS[index] = a[i]
        ans[i] = len(LIS)
        for j in edges[i]:
            if parent[i] != j:
                parent[j] = i
                dfs(j,LIS)
        LIS[index] = x

N = int(input())
a = [0]+list(map(int,input().split()))
edges = [[] for _  in range(N+1)]
ans = [-1]*(N+1)
parent = [-1]*(N+1)
for i in range(N-1):
    u,v = map(int,input().split())
    edges[u].append(v)
    edges[v].append(u)
LIS = [a[1]]
dfs(1,LIS)
for i in ans[1:]:
    print(i)
Problem p02716 (python)

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
ans = -1000000000000000
dp = [{} for _ in range(n)]
dp[0][1] = s[0]
dp[1][1] = s[1]
if n >= 3:
    dp[2][1] = s[2]
for i in range(n):
    for x in dp[i].keys():
        y = dp[i][x]
        if x == n//2:
            ans = max(ans,y)
        else:
            if (n-(i+2)+1)//2 >= n//2-(x+1) and i+2 <= n-1:
                if x+1 in dp[i+2].keys():
                    dp[i+2][x+1] = max(dp[i+2][x+1],dp[i][x] + s[i+2])
                else:
                    dp[i+2][x+1] = dp[i][x] + s[i+2]
            if (n-(i+3)+1)//2 >= n//2-(x+1) and i+3 <= n-1:
                if x+1 in dp[i+3].keys():
                    dp[i+3][x+1] = max(dp[i+3][x+1],dp[i][x] + s[i+3])
                else:
                    dp[i+3][x+1] = dp[i][x] + s[i+3]
            if (n-(i+4)+1)//2 >= n//2-(x+1) and i+4 <= n-1:
                if x+1 in dp[i+4].keys():
                    dp[i+4][x+1] = max(dp[i+4][x+1],dp[i][x]+s[i+4])
                else:
                    dp[i+4][x+1] = dp[i][x]+s[i+4]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
ans = -1000000000000000
dp = [{} for _ in range(n)]
dp[0][1] = s[0]
dp[1][1] = s[1]
dp[2][1] = s[2]
for i in range(n):
    for x in dp[i].keys():
        y = dp[i][x]
        if x == n//2:
            ans = max(ans,y)
        else:
            if (n-(i+2)+1)//2 >= n//2-(x+1) and i+2 <= n-1:
                if x+1 in dp[i+2].keys():
                    dp[i+2][x+1] = max(dp[i+2][x+1],dp[i][x] + s[i+2])
                else:
                    dp[i+2][x+1] = dp[i][x] + s[i+2]
            if (n-(i+3)+1)//2 >= n//2-(x+1) and i+3 <= n-1:
                if x+1 in dp[i+3].keys():
                    dp[i+3][x+1] = max(dp[i+3][x+1],dp[i][x] + s[i+3])
                else:
                    dp[i+3][x+1] = dp[i][x] + s[i+3]
            if (n-(i+4)+1)//2 >= n//2-(x+1) and i+4 <= n-1:
                if x+1 in dp[i+4].keys():
                    dp[i+4][x+1] = max(dp[i+4][x+1],dp[i][x]+s[i+4])
                else:
                    dp[i+4][x+1] = dp[i][x]+s[i+4]
print(ans)
Problem p02765 (python)

Fixed submission:
n,r = map(int,(input().split()))
if n > 9:
  print(r)
else:
  print(r+100*(10-n))

Buggy submission (verdict: Runtime Error):
n = int(input())
r = int(input())
if n > 9:
  print(r)
else:
  print(r+100*(10-n))
Problem p02767 (python)

Fixed submission:
n = int(input())
x = list(map(int,input().split()))
m_energy = 250000
for i in range(1,101):
  energy = 0
  for k in range(n):
    energy += (x[k]-i)**2
  if energy < m_energy:
    m_energy = energy
print(m_energy)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
m_energy = 250000
for i range(0,101):
  m_energy = 0
  for k range(n):
    m_energy += (x[k]-1)**2
  if energy < m_energy:
    m_energy = energy
print(minenergy)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
min_energy = 250000
for i range(0,101):
  energy = 0
  for k range(n):
    energy += (x[k]-1)**2
  if energy < min_energy:
    min_energy = energy
print(min_energy)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
min_energy = 250000
for i range(100):
  energy = 0
  for k range(n):
    cons = (i+1-x[k])*(i+1-x[k])
    energy += cons
  if energy < min_energy:
    min_energy = energy
print(min_energy)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
min_energy = 250000
for i range(100):
  energy = 0
  for k range(n):
    energy += (i+1-x[k])*(i+1-x[k])
  if energy < min_energy:
    min_energy = energy
print(min_energy)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
min_energy = 250000
for i range(100):
  energy = 0
  for k range(n):
    energy += (i+1-x[k])*(i+1-x[k])
  if energy < min_energy:
    min_energy = energy
print(min_energy)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int,input().split()))
min_energy = 250000
for i range(100):
  energy = 0
  for k range(n):
    energy += (i+1-p[k])(i+1-p[k])
  if energy < min_energy:
    min_energy = energy
print(min_energy)
Problem p02772 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
  if a[i] % 2 == 0:
    if a[i] % 3 != 0 and a[i] % 5 != 0:
      
      print('DENIED')
      exit()
print('APPROVED')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
  if a[i] % 2 == 0 and a[i] % 3 != 0 and [i] % 5 != 0:
    print("DENIED")
    exit()
print("APPROVED")
Problem p02783 (python)

Fixed submission:
h,a = map(int,input().split())
if h % a == 0:
  print(h//a)
else:
  print(h//a+1)

Buggy submission (verdict: Runtime Error):
h,a = map(int,input().cplit())
print(h//a+1)
Problem p02801 (python)

Fixed submission:
l = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
s = input()
for i in range(25):
  if s == l[i]:
    print(l[i+1])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ACcount = 0
WAcount = 0
WA = []
AC = []
for i in range(n):
  WA.append(0)
  AC.append(1)
for i in range(m):
  p,s = input().split()
  p = int(p)
  if s == "WA":
    if WA[p-1] >= 0:
      WA[p-1] += 1
  if s == "AC":
    ACcount += AC[p-1]
    AC[p-1] = 0
    if WA[p-1] >= 0:
       WAcount += WA[p-1]
       WA[p-1] = -1
print(ACcount,WAcount)

Buggy submission (verdict: Runtime Error):
l = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
s = input()
for i in range(25):
  if s == l[i]:
    print(l[i+1])

Buggy submission (verdict: Runtime Error):
l = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
s = input()
for i in range(25):
  if s = l[i]:
    print(l[i+1])
Problem p02814 (python)

Fixed submission:
import fractions
from functools import reduce
def lcm1(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm2(*numbers):
    return reduce(lcm1,numbers,1)
n,m = map(int,input().split())
a = set(map(lambda x: int(x)//2,input().split()))
l = lcm2(*a)
for i in a:
    if l // i % 2 == 0:
        print(0)
        exit()
print(((m // l) + 1) // 2)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm1(x,y):
    return (x*y)//math.gcd(x,y)
def lcm2(*numbers):
    return reduce(lcm1,numbers,1)
n,m = map(int,input().split())
a = set(map(lambda x: int(x)//2,input().split()))
l = lcm2(*a)
for i in a:
    if l // i % 2 == 0:
        print(0)
        exit()
print(((m // l) + 1) // 2)
Problem p02818 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
if　k > a+b:
  print(0,0)
elif k > a:
  print(0,a+b-k)
else:
  print(a-k,b)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
if k > a:
    print(0,a+b-k)
elif　k > a+b:
  print(0,0)
else:
print(a-k,b)