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

Fixed submission:
N, x = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
for i in range(N):
  if x < min(A):
    print(cnt)
    break
  elif i == N-1 and x-A[0] > 0:
    print(N-1)
    break
  elif i == N-1 and x-A[0] == 0:
    print(N)
    break
  else:
    x -= min(A)
    A.remove(min(A))
    cnt += 1

Buggy submission (verdict: Runtime Error):
N, x = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
for i in range(N):
  if x < min(A):
    print(cnt)
    break
  elif i == N-1 and A[i]-x > 0:
    print(N-1)
  elif i == N-1 and A[i]-x == 0:
    print(N)
  else:
    x -= min(A)
    A.remove(min(A))
    cnt += 1

Buggy submission (verdict: Runtime Error):
N, x = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
for i in range(N):
  if x < min(A):
    print(cnt)
    break
  elif i == N-1 and A[i]-x > 0:
    print(N-1)
  elif i == N-1 and A[i]-x == 0:
    print(N)
  else:
    x -= min(A)
    A.remove(min(A))
    cnt += 1
Problem p03378 (python)

Fixed submission:
N, M, X = map(int, input().split())
A = list(map(int,input().split()))
for i in range(M-1):
  if A[0] > X or A[M-1] < X:
    print(0)
    break
  elif A[i] < X < A[i+1]:
    print(min(i+1, M-i-1))
    break

Buggy submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
A = list(map(int,input().split()))
A.append(N)
for i in range(M):
  if A[0] > X or A[M-1] < X:
    print(0)
  else A[i] < X < A[i+1]:
    print(min(i+1, M-i-1))

Buggy submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
A = list(map(int,input().split()))
A.append(N)
for i in range(M):
  if A[i] > X or A[M-1] < X:
    print(0)
  else A[i] < X < A[i+1]:
    print(min(i+1, M-i-1))
Problem p03434 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
Alice = 0
Bob = 0
for i in range(N):
  if (i+1)%2 == 1:
    Alice += max(a)
    a.remove(max(a))
  else:
    Bob += max(a)
    a.remove(max(a))
print(Alice - Bob)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
Alice = 0
Bob = 0
for i in range(N):
  if (i+1)%2 == 1:
    Alice += max(a)
    a.remove(max(a))
  else:
    bob += max(a)
    a.remove(ma(a))
print(Alice - Bob)
Problem p03494 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [ ]
c = -1
for i in A:
  B.append(list(bin(i)))
for i in range(10000):  
  for j in range(N):
    if B[j][-i-1] == '0':
      continue
    else:
      c = i
      break
  if c == 0:
    print(0)
    break
  elif c>0:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = [ ]
c = 'non'
for i in A:
  B.append(list(bin(i)))
for i in range(10000):  
  for j in range(N):
    if B[j][-i-1] == '0':
      continue
    else:
      c = i
      break
  if c == 0:
    print(0)
    break
  elif c>0:
    print(i)
    break
Problem p03971 (python)

Fixed submission:
N, A, B = map(int, input().split())
C = input()
D = [C[i:i+1] for i in range(N)]
AA = 0
BB = 0
for i in(D):
  if i == 'c':
    print('No')
  elif i =='a' and A+B > AA+BB:
    print('Yes')
    AA += 1
  elif i =='b' and A+B > AA+BB and BB < B:
    print('Yes')
    BB += 1
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
C = input()
D = [C[i:i+1] for i in range(N)]
AA = 0
BB = 0
for i in(D):
  if D[i] == 'c':
    print('No')
  elif D[i] =='a' and A+B > AA+BB:
    print('Yes')
    AA += 1
  elif D[i] =='a' and A+B > AA+BB and BB < B:
    print('Yes')
    BB += 1
  else:
    print('No')
Problem p02923 (python)

Fixed submission:
N=int(input())
arrH=[int(i) for i in input().split()]

M=''.join(['C' if arrH[i]>=arrH[i+1] else ' ' for i in range(N-1)]).split()
print(0 if len(M)==0 else max([len(i) for i in M]))

Buggy submission (verdict: Runtime Error):
N=int(input())
arrH=[int(i) for i in input().split()]

M=''.join(['C' if arrH[i]>=arrH[i+1] else ' ' for i in range(N-1)]).split()
print(max([len(i) for i in M]))
Problem p03720 (python)

Fixed submission:
N,M=[int(i) for i in input().split()]
arrR=[0]*N
for m in range(M):
    a,b=[int(i) for i in input().split()]
    arrR[a-1]+=1
    arrR[b-1]+=1
[print(arrR[i]) for i in range(N)]

Buggy submission (verdict: Runtime Error):
N,M=[int(i) for i in input().split()]
arrR=[0]*N
for m in range(M):
    a,b=[int(i) for i in input().split()]
    arrR[a-1]+=1
    arrR[b-1]+=1
[print(arrR[i]) for i in range(M)]
Problem p02765 (python)

Fixed submission:
n, r = map(int, input().split())
print(r + 100*max(10-n, 0))

Buggy submission (verdict: Runtime Error):
n, r = map(int, input().split())
print(r + 100*max(10-k, 0))
Problem p02814 (python)

Fixed submission:
from functools import reduce

def gcd_base(x, y):
    if x % y:
        return gcd_base(y, x%y)
    return y

def gcd(numbers):
    return reduce(gcd_base, numbers)

def lcm_base(x, y):
    res = (x * y) // gcd_base(x, y)
    return res if res <= 1000000007 else 0

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

n, m = map(int, input().split())
a = [int(i) for i in input().split()]
k = [0] * n
for i in range(n):
    j = a[i]
    while(j%2==0):
        j //= 2
        k[i] += 1
if any([k[i]!=k[i+1] for i in range(n-1)]):
    print(0)
else:
    l = [i//2 for i in a]
    x = lcm(l)
    if x==0:
        print(0)
    else:
        print((m//x+1)//2)

Buggy submission (verdict: Runtime Error):
import math
def gcd(l):
    if len(l) == 1:
        return l[0]
    elif len(l) == 2:
        return math.gcd(l[0], l[1])
    else:
        return math.gcd(l[0], gcd(l[1:]))

def lcm(l, mx):
    if len(l)==1:
        return l[0] if l[0] <= mx else 0
    if len(l)==2:
        return l[0]*l[1]//gcd(l) if l[0]*l[1]//gcd(l) <= mx else 0
    if lcm(l[0:2], mx) > 0:
        l.append(lcm(l[0:2], mx))
        del l[0:2]
        return lcm(l, mx)
    return 0

n, m = map(int, input().split())
a = [int(i) for i in input().split()]
if any([i%4==0 for i in a]):
    print(0)
else:
    l = [i//2 for i in a]
    x = lcm(l, 1000000007)
    if x==0:
        print(0)
    else:
        print((m//x+1)//2)

Buggy submission (verdict: Runtime Error):
import math
def gcd(l):
    if len(l) == 1:
        return l[0]
    elif len(l) == 2:
        return math.gcd(l[0], l[1])
    else:
        return math.gcd(l[0], gcd(l[1:]))

def lcm(l, mx):
    if len(l)==1:
        return l[0] if l[0] <= mx else 0
    if len(l)==2:
        return l[0]*l[1]//gcd(l) if l[0]*l[1]//gcd(l) <= mx else 0
    if lcm(l[0:2], mx) > 0:
        l.append(lcm(l[0:2], mx))
        del l[0:2]
        return lcm(l, mx)
    return 0

n, m = map(int, input().split())
a = [int(i) for i in input().split()]
if any([i%4==0 for i in a]):
    print(0)
else:
    l = [i//2 for i in a]
    x = lcm(l, m)
    print((m//lcm(l, m)+1)//2)
Problem p02856 (python)

Fixed submission:
m = int(input())
d = [0] * m
c = [0] * m
for i in range(m):
    d[i], c[i] = map(int, input().split())

print(sum(c)-1+(sum([c[i]*d[i] for i in range(m)])-1)//9)

Buggy submission (verdict: Runtime Error):
m = int(input())
d = [0] * m
c = [0] * m
for i in range(m):
    d[i], c[i] = map(int, input().split())

print((sum(c)-1+sum([c[i]*d[i] for i in range(m)]-1)//9) % 1000000007)
Problem p02995 (python)

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

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x%y == 0:
        return y
    else:
        return gcd(y, x%y)

def muri(n):
    return n - n//c - n//d + n//(c*d//gcd(c, d))

print(muri(b)-muri(a-1))

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())
def muri(n):
    return n - n//c - n//d + n//(c*d//math.gcd(c, d))

print(muri(b)-muri(a-1))

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())
def muri(n):
    return n - n//c - n//d + n//(c*d//math.gcd(c, d))

print(muri(b)-muri(a-1))
Problem p03164 (python)

Fixed submission:
n, W = map(int, input().split())
w = [0] * n
v = [0] * n
for i in range(n):
    w[i], v[i] = map(int, input().split())

INF = 10**10

dp = [[INF for i in range(100010)] for j in range(n+1) ]

dp[0][0] = 0

for i in range(n):
    for j in range(100010):
        dp[i+1][j] = min(dp[i][j], dp[i+1][j])
        if j>=v[i]:
            dp[i+1][j] = min(dp[i][j-v[i]]+w[i], dp[i+1][j])

for j in range(100010):
    if dp[n][100009-j] <= W:
        print(100009-j)
        break

Buggy submission (verdict: Runtime Error):
inf = 2**60
'''
def table(size, init): #配列生成
  x = len(size)
  l = [init for i in range(size[x-1])]
  for i in range(x-1):
    l = [l for k in range(size[x-2-i])]
  return l
'''

n, W = map(int, input().split())
w, v = [[0]*n for i in range(2)]
for i in range(n):
  w[i], v[i] = map(int, input().split())

dp = [[-1] * (100011) for i in range(n+1)]
dp[0][0] = 0

for i in range(n):
  for j in range(100010):
    if dp[i][j] != -1:
      dp[i+1][j] = max(dp[i][j], dp[i+1][j])
      if dp[i][j]+w[i] <= W:
        dp[i+1][j+v[i]] = max(dp[i][j] + w[i], dp[i+1][j+w[i]])

for i in range(100010):
  if dp[n][100010-i] != -1:
    print(100010-i)
    break
Problem p03281 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n+1):
    cnt = 0
    if i%2 == 1:
        for j in range(1, i+1):
            if i%j == 0:
                cnt += 1
        if cnt == 8:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1, n+1):
    if n%2 == 1:
        cnt = 0
        for j in range(1, j+1):
            if i%j == 0:
                cnt += 1
        if cnt == 8:
            ans += 1
print(ans)
Problem p04011 (python)

Fixed submission:
var = [int(input()) for i in range(4)]
n = var[0]
k = var[1]
x = var[2]
y = var[3]
if n>k:
    print(k*x+(n-k)*y)
else:
    print(n*x)

Buggy submission (verdict: Runtime Error):
var = [int(e) for e in input().split()]
n = var[0]
k = var[1]
x = var[2]
y = var[3]
if n>k:
    print(k*x+(n-k)*y)
else:
    print(n*x)

Buggy submission (verdict: Runtime Error):
var = [int(e) for e in input().split()]
n = var[0]
k = var[1]
x = var[2]
y = var[3]
if n>k:
    print(k*x+(n-k)*y)
else:
    print(k*x)
Problem p02613 (python)

Fixed submission:
n = int(input())
 
ac_counter = 0
wa_counter = 0
tle_counter = 0
re_counter = 0
 
for i in range(n):
  str = input()
  if str == "AC":
    ac_counter += 1
  elif str == "WA":
    wa_counter += 1
  elif str == "TLE":
    tle_counter += 1
  else :
    re_counter += 1
print("AC x",ac_counter)
print("WA x",wa_counter)
print("TLE x",tle_counter)
print("RE x",re_counter)

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

ac_counter = 0
wa_counter = 0
tle_counter = 0
re_counter = 0

for i in range(n):
  str = input()
  if str == "AC":
    ac_counter += 1
  elif str == "WA":
    wa_counter += 1
  elif str == "TLE":
    tle_counter += 1
  else :
    re_counter += 1
print("AC x "+str(ac_counter))
print("WA x "+str(wa_counter))
print("TLE x "+str(tle_counter))
print("RE x "+str(re_counter))
Problem p02657 (python)

Fixed submission:
a = list(map(int, input().split()))
 
print(a[0]*a[1])

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

print(a*b)
Problem p02660 (python)

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

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

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

    return arr
      
n = int(input())
n_list = factorization(n)
oh = []
for i in range(len(n_list)):
  num = n_list[i][0] #2の
  kata = n_list[i][1] #3乗
  for i in range(1, kata+1):
    oh.append(num ** i)
oh.sort()
ans = 0
z = []
for i in range(len(oh)):
  if oh[i] == 1:
    break
  else:
    if n % oh[i] == 0 and oh[i] not in z:
      z.append(oh[i])
      n = n / oh[i]
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math

#試し割法
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return 'prime number'
    else:
        factor.append(n)
        return factor
      
n = int(input())
n_list = trial_division(n)
ans = 0
z = []
for i in range(len(n_list)):
  if n_list[i] == 1:
    break
  else:
    if n % n_list[i] == 0:
      z.append(n_list[i])
      n = n / n_list[i]
      ans += 1
print(ans)
Problem p02713 (python)

Fixed submission:
import math
 
 
def gcd(a, b, c):
  d = math.gcd(a, b)
  return math.gcd(c, d)
 
K = int(input())
sum = 0
for i in range(1, K+1):
  sum += gcd(i, i, i)
  
for i in range(1, K+1):
  for j in range(i, K+1):
    for k in range(j, K+1):
      if i == j and j == k:
        sum += 0
      elif i == j or j == k or i == k:
        sum += gcd(i , j , k )*3
      elif i != j and j != k :
        sum += gcd(i, j, k)*6

print(sum)

Buggy submission (verdict: Runtime Error):
import math


def gcd(a, b, c):
  d = math.gcd(a, b)
  return math.gcd(c, d)

K = int(input())
sum = 0

for i in range(1, a+1):
  for j in range(1, b+1):
    for k in range(1, c+1):
      sum += gcd(i, j, k)
      
print(sum)
Problem p02714 (python)

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

r = str.count('R')
g = str.count('G')
b = str.count('B')
sum = r * g * b
for i in range(n-2):
  for j in range(i+1, n-1):
    k = 2 * j - i
    if k < n:
      if str[i] != str[j] and str[i] != str[k] and str[j] != str[k] :
        sum -= 1
    
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
 
str = input()
sum = 0
for i in range(n-2):
  for j in range(i+1, n-1):
     if str[i] == str[j]:
        break
    for k in range(j+1, n):
      if str[i] != str[k] and str[j] != str[k] and j - i != k - j:
        sum += 1

print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
 
str = input()
sum = 0
pointer = n
for i in range(n-2):
  if i == poitner:
    break
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if str[i] == str[j]:
        pointer = j
        break
      elif str[i] != str[k] and str[j] != str[k] and j - i != k - j:
        sum += 1
print(sum)
Problem p02760 (python)

Fixed submission:
bingo = [1,1,1,1,1,1,1,1,1]
bingo[0] , bingo[1] , bingo[2] = map(int, input().split())
bingo[3] , bingo[4], bingo[5] = map(int, input().split())
bingo[6], bingo[7], bingo[8] = map(int, input().split())
n = int(input())
ls = []
counter = 0
for i in range(n):
  ls.append(int(input()))
 
for i in range(len(bingo)):
  for j in range(len(ls)):
    if ls[j] == bingo[i]:
      bingo[i] = 0
      break
for i in range(len(bingo)):
  if i == 0:
    if bingo[i] + bingo[i+1] + bingo[i+2] == 0:
      counter += 1
      break
    elif bingo[i] + bingo[i+3] + bingo[i+6] == 0:
      counter += 1
      break
    elif bingo[i] + bingo[i+4] + bingo[i+8] == 0:
      counter += 1
      break
  elif i == 1:
    if bingo[i] + bingo[i+3] + bingo[i+6] == 0:
      counter += 1
      break
  elif i == 2:
    if bingo[i] + bingo[i+3] + bingo[i+6] == 0:
      counter += 1
      break
    elif bingo[i] + bingo[i+2] + bingo[i+4] == 0:
      counter += 1
      break
  elif i == 3:
    if bingo[i] + bingo[i+1] + bingo[i+2] == 0:
      counter += 1
      break
  elif i == 6:
    if bingo[i] + bingo[i+1] + bingo[i+2] == 0:
      counter += 1
      break
if counter > 0:
  print("Yes")
else: 
  print("No")

Buggy submission (verdict: Runtime Error):
bingo = []
bingo[0] , bingo[1] , bingo[2] = map(int, input().split())
bingo[3] , bingo[4], bingo[5] = map(int, input().split())
bingo[6], bingo[7], bingo[8] = map(int, input().split())
n = int(input())
ls = []
counter = 0
for i in range(n):
  ls[i] = int(input())

for i in range(len(bingo)):
  for j in range(len(ls)):
    if ls[j] == bingo[i]:
      bingo[i] = 0
      break
for i in range(len(bingo)):
  if i == 0:
    if bingo[i] + bingo[i+1] + bingo[i+2] == 0:
      counter += 1
      break
    elif bingo[i] + bingo[i+3] + bingo[i+6] == 0:
      counter += 1
      break
    elif bingo[i] + bingo[i+4] + bingo[i+8] == 0:
      counter += 1
      break
  elif i == 1:
    if bingo[i] + bingo[i+3] + bingo[i+6] == 0:
      counter += 1
      break
  elif i == 2:
    if bingo[i] + bingo[i+3] + bingo[i+6] == 0:
      counter += 1
      break
    elif bingo[i] + bingo[i+2] + bingo[i+4] == 0:
      counter += 1
      break
  elif i == 3:
    if bingo[i] + bingo[i+1] + bingo[i+2] == 0:
      counter += 1
      break
  elif i == 6:
    if bingo[i] + bingo[i+1] + bingo[i+2] == 0:
      counter += 1
      break
if counter > 0:
  print("Yes")
else: 
  print("No")
Problem p02767 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
x = []
sum = 0
for i in range(n):
  s = int(input())
  sum += s
  x.append(s)
  
ave = s//n
sum = 0
for i in range(n):
  sum += (x[i] - ave)**2
min = sum
sum = 0
for i in range(n):
  sum += (x[i] - ave - 1)**2
max = sum 

if min > max:
  print(max)
else:
  print(min)
Problem p02801 (python)

Fixed submission:
s = input()
n = ord(s)

print(chr(n+1))

Buggy submission (verdict: Runtime Error):
# AC を 1回以上出した各問題において、初めて AC を出すまでに出した WA の数
n,m = map(int, input().split())
p = []
s = []
wacounter = 0
walist = []
for i in range(0, n):
  walist.append(0)
point = 0
point_to_num = [] #acをとった問題
for i in range(0, m):
  list = input().split()
  p.append(int(list[0]))
  s.append(list[1])
 
for i in range(0, m):
  if s[i] == "AC" and not p[i] in point_to_num: #もし正解で、今までにその問題に正解していなかったら
    point_to_num.append(p[i]) #正解リストにその問題を追加
    #point = point + 1 正解ポイントをあげる
  elif s[i] == "WA" and not p[i] in point_to_num: #不正解かつ今まで正解を出したことがない
      wacounter += 1
      walist[p[i]-1] += 1
for i in range(0, n):
  if not i + 1 in point_to_num:#もし正解してない番号があったら、walistからwacounterをとってきてひく
    wacounter = wacounter - walist[i]
print(len(point_to_num), wacounter)
Problem p02886 (python)

Fixed submission:
n = int(input()) # the number of takoyaki
delicious = list(map(int,input().split()))
ans = 0
for i in range(0, n-1): 
  for j in range(i+1, n):
    ans += delicious[i] * delicious[j]
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(inout()) # the number of takoyaki
delicious = list(map(int,input().split()))
ans = 0
for i in range(0, n-1): 
  for j in range(i, n):
    ans += delicious[i] * delicious[j]
    
print(ans)
Problem p02887 (python)

Fixed submission:
n = int(input())
str =list(input())
count = 1
for i in range(n-1):
  if str[i] != str[i + 1]:
    count += 1
    
    
print(count)

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

for i in range(len(str)-1):
  if str[i] == str[i+1]:
    del str[i]
    
print(len(str))
Problem p02899 (python)

Fixed submission:
n = int(input())
 
ls = list(map(int, input().split()))
ans = []

for i in range(n):
  ans.append(0)
  
for i in range(n):
  ans[ls[i]-1] = i + 1
  
for i in range(n):
  print(ans[i], end = " ")

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

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

queue = []

for i in range(n)
	a = ls[i] - 1
  	queue[a] = i

    
print(queue)
Problem p02900 (python)

Fixed submission:
x, y  = map(int, input().split())
 
def prime_factorize(n):
    a = [1]
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
prime_x = prime_factorize(x)
prime_y = prime_factorize(y)
 
num_x = len(prime_x)
num_y = len(prime_y)
 
num = min(num_x, num_y)
co = list(set(prime_x) & set(prime_y))

ans = 0
for i in range(len(co)):
  if co == [1]:
    ans = 1
    break
  else:
    if len(prime_factorize(co[i])) == 1 or len(prime_factorize(co[i])) == 2:
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
x, y  = map(int, input().split())

def prime_factorize(a):
  ls = [1]
  if a == 1:
    return ls
  else:
  	while(i <= a):
      if(a % i == 0):
        ls.append(i)
      i += 1
    return ls
  
prime_x = prime_factorize(x)
prime_y = prime_factorize(y)

num_x = len(prime_x)
num_y = len(prime_y)

num = min(num_x, num_y)
co = list(set(num_x) & set(num_y))
ans = 0
for i in range(len(co)):
  if co == [1]:
    ans = 1
    break
  else:
    if len(prime_factorize(co[i])) == 1 or len(prime_factorize(co[i])) == 2:
      ans += 1
print(ans)
Problem p02910 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
nocounter = 0
n = len(s)

for i in range(n):
  if (i % 2 == 0):
    if s[i] == "L":
      print("No")
      nocounter = 1
      break
  if (i % 2 == 1):
    if s[i] == "R":
      print("No"):
      nocounter = 1
      break
      
if (nocounter = 0):
  print("Yes")
Problem p02911 (python)

Fixed submission:
n,k,q = map(int, input().split())
 
scores = []
 
for i in range(n):
  scores.append(k-q)
 
for i in range(q):
  a = int(input()) #Ai
  scores[a-1] = scores[a-1]+1
  
for i in range(n):
  if(scores[i] > 0):
    print("Yes")
  else:
    print("No")

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

scores = []

for i in range(n):
  scores.append(n-k)

for i in range(q):
  a = int(input()) #Ai
  scores.insert(a-1, scores[a-1]+1)
  
  
for i in range(n):
  if(scores[i] > 0):
    print("Yes")
  elif:
    print("No")

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

scores = []
def decrease(n):
  return n-1

for i in range(q):
  scores.append(k)

for i in range(n):
  a = int(input()) # Ai
  scores = map(decrease, scores) # -1 to all 
  scores[a-1] += 1

for i in range(n):
  if scores[i] > 0:
    print("Yes")
  else:
    print("No")
Problem p02917 (python)

Fixed submission:
n = int(input())
 
b = list(map(int, input().split()))
a = []
a.append(b[0])
for i in range(0,n-1):
  a.append(b[i])

for i in range(n-1):
  if(a[i] > a[i+1]):
    a[i] = a[i+1]
    
sum = 0
for i in range(n):
  sum += a[i]
  
print(sum)

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

b = list(map(int, input().split()))
a = []
a.append(b[0])
for i in range(0,n):
  a.append(b[i])
  
for i in range(n):
  if(a[i] > a[i+1]):
    a[i] = a[i+1]
    
sum = 0
for i in range(n):
  sum += a[i]
  
print(sum)