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

Fixed submission:
S = input()
li = list(S)
count = 0
re_num = 0
for num in range(3):
    if li[num] == "R" :
        count = count + 1

if count == 0 :
    re_num = 0
elif count == 1 :
    re_num = 1
elif count == 2 and li[1] == "S" :
    re_num = 1
elif count == 2 and li[1] == "R" :
    re_num = 2
else :
    re_num = 3

print(re_num)

Buggy submission (verdict: Runtime Error):
X = int(input())
K = int(input())
D = int(input())
loc = 0
lis = []

def calucu_min(X,K,D):
    for num in range(K) :
        lis.append( abs(abs(2 *D *num -K *D) - abs(X)))
        lis_unique = set(lis)
    print (min(lis_unique))

calucu_min(X,K,D)

Buggy submission (verdict: Runtime Error):
X = int(input())
K = int(input())
D = int(input())
loc = 0
lis = []

def calucu_min(X,K,D):
    for num in range(K) :
        lis.append( abs(abs(2 *D *num -K *D) - abs(X)))
        lis_unique = set(lis)
    print (min(lis_unique))

calucu_min(X,K,D)

Buggy submission (verdict: Runtime Error):
X = int(input())
K = int(input())
D = int(input())
loc = 0
lis = []

def calucu_min(X,K,D):
    for num in range(K) :
        lis.append( abs(abs(2 *D *num -K *D) - abs(X)))
        lis_unique = set(lis)
        print (max(lis_unique))

calucu_min(X,K,D)

Buggy submission (verdict: Runtime Error):
S = input()
li = list(S)
count = 0
re_num = 0
for num in range(2):
    if li[num] = "R" :
        count = count + 1

if count = 0 :
    re_num = 0
elif count = 1 :
    re_num = 1
elif count = 2 and li[2] = "S" :
    re_num = 1
elif count = 2 and li[2] = "R" :
    re_num = 2
else re_num = 3

print(re_num)

Buggy submission (verdict: Runtime Error):
li = list(S)
count = 0
for num in range(1):
    if li[num] == "R" and li[num+1] == "R" :
        count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):

def judge(S):
    li = list(S)
    count = 0
    for num in range(1):
        if li[num] == "R" and li[num+1] == "R" :
            count = count + 1
    print(count)

judge(S)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
number =1

for i in a:
    if i==0:
        print(0)
        exit()
    number *= i
    if number > 10**18:
            print(-1)
            exit()

print(number)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = (int(x) for x in input().split())
number =1

for i in a:
    if i==0:
        print(0)
        exit(0)
    number *= i
    if number>10**18:
            print(-1)
            exit(0)

print(number)
Problem p02923 (python)

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

ans = 0
tmp = 0
for i in range(n - 1):

    if h[i] >= h[i + 1]:
        tmp += 1
    else:
        if ans < tmp:
            ans = tmp
        tmp = 0
    
else:
    if ans < tmp:
        ans = tmp

print(ans)

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

ans = 0
tmp = 0
for i in range(n):

    if h[i] >= h[i + 1]:
        tmp += 1
    elif ans < tmp:
        ans = tmp
        tmp = 0
    
else:
    if ans < tmp:
        ans = tmp

print(ans)
Problem p03087 (python)

Fixed submission:
import sys
from itertools import accumulate

def main():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    S = [str(c) for c in input().strip()]

    dp = [0] * N
    for i in range(1, N):
        s = S[i-1] + S[i]
        if s == 'AC':
            dp[i] += 1
    
    DP = list(accumulate(dp))

    for _ in range(Q):
        l, r = map(int, input().split())
        print(DP[r-1] - DP[l-1])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
N,Q = map(int,input().split())
S = input()
array = [[0 for _ in range(Q)] for _ in range(Q)]
for i in range(Q):
	array[i][0], array[i][1] = map(int,input().split())
for i in range(Q):
	print(S[array[i][0]-1:array[i][1]].count("AC"))
Problem p03337 (python)

Fixed submission:
a, b = (int(i) for i in input().split())
max_ab = max(a+b,a-b,a*b)
print(max_ab)

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

posDevide = 1
maxMatchWordNum = 0

while posDevide <=  N - 1:
        arrayNum = 0
        matchWordNum = 0
        while arrayNum < posDevide:
                if arrayNum  == S.find( S[ arrayNum ], 0, posDevide):
                        matchWordNum = matchWordNum + 1 if  bool( S.count( S[ arrayNum ], posDevide, N )) else matchWordNum

                arrayNum += 1

        maxMatchWordNum = matchWordNum if matchWordNum > maxMatchWordNum else maxMatchWordNum
        posDevide += 1

print(maxMatchWordNum)
Problem p03338 (python)

Fixed submission:
N = int(input())
S = input()

posDevide = 1
maxMatchWordNum = 0

while posDevide <=  N - 1:
        arrayNum = 0
        matchWordNum = 0
        while arrayNum < posDevide:
                if arrayNum  == S.find( S[ arrayNum ], 0, posDevide):
                        matchWordNum = matchWordNum + 1 if  bool( S.count( S[ arrayNum ], posDevide, N )) else matchWordNum

                arrayNum += 1

        maxMatchWordNum = matchWordNum if matchWordNum > maxMatchWordNum else maxMatchWordNum
        posDevide += 1

print(maxMatchWordNum)

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

posDevide = 1
maxMatchWordNum = 0

while posDevide < N:
        arrayNum = 1
        matchWordNum = 0
        while arrayNum <=  posDevide:
                if arrayNum == S.find( S[ arrayNum - 1 ]:
                        matchWordNum = matchWordNum + 1 if  bool( S.count( S[ arrayNum - 1 ], posDevide, N-1 )) else matchWordNum
                arrayNum += 1

        maxMatchWordNum = matchWordNum if matchWordNum > maxMatchWordNum else maxMatchWordNum
        posDevide += 1

print(maxMatchWordNum)

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

posDevide = 1
maxMatchWordNum = 0

while posDevide < N:
        arrayNum = 1
        mutchWordNum = 0
        while arrayNum <=  posDevide:
                matchWordNum = matchWordNum + 1 if  bool( s.count[ arrayNum - 1 ], posDevide, N-1 ) else matchWordNum
                arrayNum + 1
        end
        maxMatchWordNum = matchWordNum if matchWordNum > maxMatchWordNum else maxMatchWordNum
        posDevide + 1
end

print(maxMatchWordNum)
Problem p03353 (python)

Fixed submission:
s = input()
K = int(input())

substr = set()
for i in range(len(s)):
    for j in range(i+1, i+K+1):
        substr.add(s[i:j])

print(sorted(substr)[K-1])

Buggy submission (verdict: Runtime Error):
s,K = input(),int(input())

subList = []
N = len(s)
repNum = 0

while N - repNum >= 1:
        for i in range(repNum+1):
                subList.append(s[i:N-repNum+i])
        repNum += 1
subListUniq = list(set(subList))
subListUniq.sort()
print(subListUniq[K-1])
Problem p03370 (python)

Fixed submission:
N,X = map(int, input().split())
okamotos = [int(input()) for i in range(N)]
print(N + int((X - sum(okamotos))/min(okamotos)))

Buggy submission (verdict: Runtime Error):
N,X = map(int, input().split())
okamotos = [int(input()) for i in range(N)]
print(N + map(int,(X - sum(okamotos))/min(okamotos)))
Problem p03433 (python)

Fixed submission:
n=int(input())
a=int(input())
print(['No','Yes'][n-(n//500)/(1/500)-a<=0])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
print([No,Yes][n-n//a＊500-a<0])
Problem p03434 (python)

Fixed submission:
N=input()
a= sorted([int(j) for j in input().split()],reverse=True)
print(sum(a[::2])-sum(a[1::2]))

Buggy submission (verdict: Runtime Error):
N=int( input())
a=list(set([int(j) for j in range(N)]))
print(a[::2]-a[1::2])
Problem p02582 (python)

Fixed submission:
S = input()
if S =='SSS':
  print('0')
elif S == 'RRR':
  print('3')
elif S == 'RRS' or S == 'SRR':
  print('2')
else :
  print('1')

Buggy submission (verdict: Runtime Error):
S = input()
if S = 'SSS':
  print('0')
elif S = 'RRR':
  print('3')
elif S = 'RRS' or S = 'SRR':
  print('2')
else :
  print('1')
Problem p02639 (python)

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

Buggy submission (verdict: Runtime Error):
x = list(map(int,input().split()))
for i in range(len(x)):
  if x[i] == 0:
    print(i+!)
    break

Buggy submission (verdict: Runtime Error):
x = list(map(int,input().split()))
for i in range(len(x)):
  if x[i] = 0:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
x = list(input())
for i in range(len(x)):
  if x[i] = 0:
    print(x[i])
    break
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
t2 = t[:-1]
if t2 == s:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
if len(s)+1 = len(t):
  print('Yes')
else:
  print('No')
Problem p02718 (python)

Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
B = 0
C = 0

for i in range(len(A)):
  C += A[i]
  
for i in range(len(A)):
  if A[i] >= C/(4*M):
    B += 1

if B >= M:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = list(map(int,input().split()))
B = 0
C = 0

for i in range(list(A)):
  c += A[i]
  
for i in range(list(A)):
  if A[i] >= 1/(4*M):
    B += 1

if B >= M:
  print('Yes')
else:
  print('No')

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

for i in range(list(A)):
  if A[i] >= 1/(4*M):
    B += 1

if B >= M:
  print('Yes')
else B < M:
  print('No')
Problem p02724 (python)

Fixed submission:
x = int(input())
a = x//500
b = (x%500)//5
h = a*1000+b*5
print(h)

Buggy submission (verdict: Runtime Error):
x = input(int())
a = x//500
b = (x%500)//5
h = a*1000+b*5
print(h)
Problem p02784 (python)

Fixed submission:
H, N = map(int,input().split())
A = list(map(int,input().split()))
T = 0
for i in range(N):
  T += A[i]
if H-T <=0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
H, N = map(int,input().split())
A = list(map(int,input().split())
T = 0
for i in range(N):
  T += A[i]
if H - T <=0:
  print('Yes')
else:
  print('No')
Problem p02910 (python)

Fixed submission:
S = input()
for i in range(len(S)+1):
  if i == len(S):
    print('Yes')
    break
  if S[i] =='U' or S[i] =='D':
    pass
  else:
    if i % 2 ==0:
      if S[i] == 'R':
        pass
      else:
        print('No')
        break
    else:
      if S[i]== 'L':
        pass
      else:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
S = input()
for i in range(len(S)+1):
  if i == len(S):
    print('Yes')
    break
  if S[i] =='U' or S[i] =='D':
    pass
  else:
    if S[i] % 2 ==0:
      if S[i] == 'R':
        pass
      else:
        print('No')
        break
    else:
      if S[i]== 'L':
        pass
      else:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
S = input()
for i in range(len(S)+1):
  if i == len(S):
    print('Yes')
    break
  if S[i] =='U' or S[i] =='D':
    pass
  else:
    if S[i] % 2 ==0:
      if S[i] == 'R':
        pass
      else:
        print('No')
        break
    else:
      if S[i]== 'L':
        pass
      else:
        print('No')
        break
Problem p03000 (python)

Fixed submission:
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, x] = li()
    l_list = li()

    bound = 0
    bound_x = 0
    index = 0
    bound = bound + 1
    while bound_x + l_list[index] <= x:
        bound = bound + 1
        bound_x = bound_x + l_list[index]
        index = index + 1
        if index >= len(l_list):
            break

    print(bound)

Buggy submission (verdict: Runtime Error):
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, x] = li()
    l_list = li()

    bound = 0
    bound_x = 0
    index = 0
    while bound_x <= x:
        bound = bound + 1
        bound_x = bound_x + l_list[index]
        index = index + 1
    print(bound)
Problem p02582 (python)

Fixed submission:
i = input()


if i == "SSS":
    print(0)
elif i == "RRR":
    print(3)
elif i == "RSR" or i == "SSR" or i=="RSS" or i=="SRS":
    print(1)
elif i == "RRS" or i=="SRR":
    print(2)

Buggy submission (verdict: Runtime Error):
i = input()


if i == "SSS":
    print(0)
elif i == "RRR":
    print(3)
elif i == "RSR" or "SSR" or "RSS" or "SRS":
    print(1)
elif i = "RRS" or "SRR":
    print(2)
Problem p02660 (python)

Fixed submission:

import math

n = int(input())

#faccs = [0 for i in range(int(n/2) +1)]
faccs = {}


def isPrime(n) : 
  
    if (n <= 1) : 
        return False
    if (n <= 3) :
        return True

    if (n % 2 == 0 or n % 3 == 0) : 
        return False
  
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6
  
    return True

if isPrime(n):
    print(1)
else:
    while n % 2 == 0:
        if 2 in faccs:
            faccs[2] += 1
        else:
            faccs[2] = 1
        n = n / 2

    for i in range(3,int(math.sqrt(n))+1,2): 
          

        while n % i== 0:
            if i in faccs:
                faccs[i] += 1
            else:
                faccs[i] = 1
            n = n / i 

    if n > 2:
        faccs[math.floor(n)] = 1 

    count = 0

    for i in faccs.values():
        if i > 0:
            temp = 1
            while (i-temp)>=0:
                i -= temp
                temp +=1
                count += 1
    print(count)

Buggy submission (verdict: Runtime Error):

import math

n = int(input())

faccs = [0 for i in range(int(n**0.5))]


def isPrime(n) : 
  
    # Corner cases 
    if (n <= 1) : 
        return False
    if (n <= 3) : 
        return True

    if (n % 2 == 0 or n % 3 == 0) : 
        return False
  
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6
  
    return True

if isPrime(n):
    print(1)
else:

    while n % 2 == 0: 
        faccs[2] += 1
        n = n / 2

    for i in range(3,int(math.sqrt(n))+1,2): 
          

        while n % i== 0: 
            faccs[i] += 1 
            n = n / i 

    if n > 2: 
        faccs[int(n)] += 1 

    count = 0

    for i in faccs:
        if i > 0:
            temp = 1
            while (i-temp)>=0:
                i -= temp
                temp +=1
                count += 1
    print(count)

Buggy submission (verdict: Runtime Error):

import math

n = int(input())

faccs = [0 for i in range(int(n**0.5))]

while n % 2 == 0: 
    faccs[2] += 1
    n = n / 2

for i in range(3,int(math.sqrt(n))+1,2): 

    while n % i== 0: 
        faccs[i] += 1 
        n = n / i 

if n > 2: 
    faccs[int(n)] += 1 

count = 0

for i in faccs:
    if i > 0:
        temp = 1
        while (i-temp)>=0:
            i -= temp
            temp +=1
            count += 1
print(count)
Problem p02713 (python)

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
K = int(input())
total = K*K
for i in range(2,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      total += gcd(i,j,k)
print(total)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
K = int(input())
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      total += gcd(i,j,k)
print(total)
Problem p02741 (python)

Fixed submission:
k = int(input())
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k-1])

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
num = c**2+a**2+b**2-2*a*c+2*a*b-2*b*c
if bin(num) <= bin(4*a*b):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if (c-a-b)**2 > 4*a*b:
  print("Yes")
else:
  print("No")
Problem p02761 (python)

Fixed submission:
N, M = map(int,input().split())
num = ["9"]*N
if M == 0:
  if N == 1:
    print(0)
    exit()
  for i in range(N):
    if i == 0:
      num[i] = 1
    else:
      num[i] = 0
  print("".join(map(str,num)))
  exit()
l = [list(map(int,input().split())) for i in range(M)]
l = sorted(l)
if N == 1 and l[0][0]==1 and l[0][1] == 0:
  print(0)
  exit()
for i in range(M):
  if l[i][0] == 1 and l[i][1] == 0:
    print(-1)
    exit()
  if i < M-1 and l[i][0] == l[i+1][0] and l[i][1] != l[i+1][1]:
    print(-1)
    exit()
  num[l[i][0]-1] = l[i][1]
for i in range(N):
  if num[i] == "9" and i != 0:
    num[i] = 0
  elif num[i] == "9" and i == 0:
    num[i] = 1
print("".join(map(str,num)))

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
num = ["9"]*N
l = [list(map(int,input().split())) for i in range(M)]
l = sorted(l)
if N == 1 and l[0][0]==1 and l[0][1] == 0:
  print(0)
  exit()
for i in range(M):
  if l[i][0] == 1 and l[i][1] == 0:
    print(-1)
    exit()
  if i < M-1 and l[i][0] == l[i+1][0] and l[i][1] != l[i+1][1]:
    print(-1)
    exit()
  num[l[i][0]-1] = l[i][1]
for i in range(N):
  if num[i] == "9" and i != 0:
    num[i] = 0
  elif num[i] == "9" and i == 0:
    num[i] = 1
print("".join(map(str,num)))
Problem p02795 (python)

Fixed submission:
H = int(input())
W = int(input())
N = int(input())
if N%max(H,W)==0:
  print(N//max(H,W))
else:
  print(N//max(H,W)+1)

Buggy submission (verdict: Runtime Error):
n, k, s = map(int, input().split())
A = [0]*n
for i in range(1, n+1):
    if i <= k:
        A[i] = s
    else:
        if s == 10**9:
          A[i] = 1
        else:
          A[i] = 10**9
print(*A)
Problem p02797 (python)

Fixed submission:
n, k, s = map(int, input().split())

for i in range(1, n+1):
    if i <= k:
        print(s)
    else:
        if s == 10**9:
            print(1)
        else:
            print(10**9)

Buggy submission (verdict: Runtime Error):
n, k, s = map(int, input().split())
A = [0]*n
for i in range(1, n+1):
    if i <= k:
        A[i] = s
    else:
        if s == 10**9:
          A[i] = 1
        else:
          A[i] = 10**9
print(*A)
Problem p02801 (python)

Fixed submission:
c=input()
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"]
for i in range(len(l)):
  if l[i] == c:
    print(l[i+1])

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
N, M = map(int, input().split())
P = []
S = []
for i in range(M):
  p, s = input().split()
  P.append(int(p))
  S.append(s)
d = defaultdict(int)
d1 = defaultdict(int)
for i in range(M):
  if S[i] == "WA":
    if d[P[i]] != 1:
      d1[P[i]] += 1
  elif S[i] == "AC":
    d[P[i]] = 1
for i in range(M):
  if d[P[i]] == 0 and d1[P[i]] > 0:
    d1[P[i]] = 0
print(sum(d.values()), sum(d1.values()))
Problem p02844 (python)

Fixed submission:
input()
S = [int(i) for i in input()]
cnt = 0
for i in range(0, 1000):
  c = (i//100, (i//10)%10, i%10)
  f = 0
  for s in S:
    if s == c[f]:
      f += 1 
      if f==3:break 
  if f==3:cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
input()
S = input()
cnt = 0
for i in range(0, 1000):
  c = (i//100, (i//10)%10, i%10)
  f = 0
  for s in S:
    if int(s) == c[f]:
      f += 1 
      if f==3:break 
  if f==3:cnt += 1
print(cnt)
Problem p02900 (python)

Fixed submission:
A, B = map(int,input().split())
def factorization(n):
    if n == 1:
      return [1]
    elif n == 2:
      return [1, 2]
    arr = [1]
    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)
    if temp!=1:
        arr.append(temp)
    if arr==[]:
        arr.append(n)
    return arr
print(len(set(factorization(A))&set(factorization(B))))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from fractions import gcd
A, B = map(int,input().split())
def Eratosthenes(n):
    if n == 1:
      return [1]
    if n == 2:
      return [1, 2]
    dp = [False]*n
    dp[0] = dp[1] = True
    prime = []
    l = [1]
    for i in range(2, n):
        if dp[i]:
            continue
        prime.append(i)
        if n%i==0:
          l.append(i)
        for j in range(i*2, n, i):
            dp[j] = True
            i += 1
    return l
print(len(Eratosthenes(reduce(gcd,[A,B]))))

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

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)
  
def Eratosthenes(n):
    if n == 1:
      return [1]
    if n == 2:
      return [1, 2]
    dp = [False]*n
    dp[0] = dp[1] = True
    prime = []
    l = [1]
    for i in range(2, n):
        if dp[i]:
            continue
        prime.append(i)
        if n%i==0:
          l.append(i)
        for j in range(i*2, n, i):
            dp[j] = True
            i += 1
    return l
  
print(len(Eratosthenes(gcd(A,B))))

Buggy submission (verdict: Runtime Error):
A, B = map(int,input().split())
def Eratosthenes(n):
    if n == 1:
      return [1]
    if n == 2:
      return [1, 2]
    dp = [False]*n
    dp[0] = dp[1] = True
    prime = []
    l = [1]
    for i in range(2, n):
        if dp[i]:
            continue
        prime.append(i)
        if n%i == 0:
          l.append(i)
        for j in range(i*2, n, i):
            dp[j] = True
            i += 1
    return l
print(len(set(Eratosthenes(A))&set(Eratosthenes(B))))

Buggy submission (verdict: Runtime Error):
A, B = map(int,input().split())
def Eratosthenes(n):
    if n == 1:
      return [1]
    if n == 2:
      return [1, 2]
    dp = [False]*n
    dp[0] = dp[1] = True
    prime = []
    l = []
    for i in range(2, n):
        if dp[i]:
            continue
        prime.append(i)
        if n%i == 0:
          l.append(i)
        for j in range(i*2, n, i):
            dp[j] = True
            i += 1
    return l
print(len(set(Eratosthenes(A))&set(Eratosthenes(B)))+1)
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
cnt = 0
for i in range(3):
  if s[i] == t[i]:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(int(n*(n-1)/2))
Problem p02924 (python)

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

Buggy submission (verdict: Runtime Error):
print(sum(range(1,int(input())))

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
P = list(range(1,n+1))
for i in range(1, n+1):
  if i == n:
    break
  ans += i%(P[i])
print(ans)
Problem p02953 (python)

Fixed submission:
n=int(input())
arr=list(map(int,input().split()))
for i in range(n-2,-1,-1):
  if arr[i]>arr[i+1]:
    arr[i]-=1
    if arr[i]>arr[i+1]:
      print('No')
      break
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
l = [False]*(sum(range(1, n)))
a = 0
for j in range(n):
  for i in range(j+1,n):
    if h[j] <= h[i]:
      l[a] = True
    else:
      if h[j]-1-h[i] < 1:
        l[a] = True
    a += 1
print("Yes" if l.count(False)==0 else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
l = [False]*(sum(range(1, n)))
a = 0
for j in range(n):
  for i in range(j+1,n):
    if h[j] <= h[i]:
      l[a] = True
    else:
      if h[j]-1-h[i] < 1:
        l[a] = True
      else:
        continue
    a += 1
if l.count(False) == 0:
  print("Yes")
else:
  print("No")
Problem p02957 (python)

Fixed submission:
a,b = map(int, input().split())
if (a+b) % 2 == 0:
  print(int((a+b)/2))
else:
  print("IMPOSSIBLE")

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

ans, surplus = 0, 0
for i in range(N):
    tmp = min(A[i], surplus)
    ans += tmp
    A[i] -= tmp
    if B[i] > A[i]:
        ans += A[i]
        surplus = B[i] - A[i]
    else:
        ans += B[i]
        surplus = 0
tmp = min(A[N], surplus)
ans += tmp
print(ans)