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

Fixed submission:
# Enter your code here. Read input from STDIN. Print output to STDOUT

def find(x):
    dic={}
    
    def fact(t):
        T=int(t**0.5)+1
        for i in range(2,T):
            if t%i==0:
                if i in dic:
                    dic[i]+=1
                else:
                    dic[i]=1
                return i
        if t in dic:
            dic[t]+=1
        else:
            dic[t]=1            
        return t

    while x>1:
        #print(x)
        x=int(x/fact(x))
        #print(x)
    return dic

def find_ans(N,P):
    dic=find(P)
    ans=1
    for x in dic:
        ans*=pow(x,dic[x]//N)
    return ans    

N,P=list(map(int,input().split(" ")))
print(find_ans(N,P))

Buggy submission (verdict: Runtime Error):
N=input()
count=0
for i in range(N):
    count+=int(input())%2
if count>0:
    print("first")
else:
    print("second")
Problem p03197 (python)

Fixed submission:
N=int(input())
count=0
for i in range(N):
    count+=int(input())%2
if count>0:
    print("first")
else:
    print("second")

Buggy submission (verdict: Runtime Error):
N=input()
count=0
for i in range(N):
  	count+=input()%2
if count>0:
	print("first")
else:
  	print("second")
Problem p02602 (python)

Fixed submission:
import math
n, k = [int(x) for x in input().strip().split()]
arr = [int(x) for x in input().strip().split()]
arr = [math.log10(x) for x in arr]


last = 0
for i in range(k):
    last += arr[i]

for i in range(k, len(arr)):
    curr = (last + arr[i]) - arr[i-k]
    if curr>last:
        print('Yes')
    else:
        print('No')
    last= curr

Buggy submission (verdict: Runtime Error):

n, k = [int(x) for x in input().strip().split()]
arr = [int(x) for x in input().strip().split()]
arr = [math.log(x) for x in arr]


last = 0
for i in range(k):
    last += arr[i]

for i in range(k, len(arr)):
    curr = (last + arr[i]) - arr[i-k]
    if curr>last:
        print('Yes')
    else:
        print('No')
    last= curr

Buggy submission (verdict: Runtime Error):

n, k = [int(x) for x in input().strip().split()]
arr = [int(x) for x in input().strip().split()]
arr = [math.log(x) for x in arr]


last = 0
for i in range(k):
    last += arr[i]

for i in range(k, len(arr)):
    curr = (last + arr[i]) - arr[i-k]
    if curr>last:
        print('Yes')
    else:
        print('No')
    last= curr
Problem p02603 (python)

Fixed submission:
n= int(input())
arr = [int(x) for x in input().strip().split()]


def Greedy(arr):
    
    curr = 1000
    for i in range(len(arr)-1):
        if arr[i+1]>arr[i]:
            stocks = curr // arr[i]
            curr += (arr[i+1] - arr[i])*stocks
    return curr

print(Greedy(arr))

        
# mem = {}
# def helper(i, mon, stk):
#     key = (i, mon, stk)
#     if key in mem:
#         return mem[key]
    
#     if i==len(arr):
#         return mon
    
#     ans = helper(i+1, mon, stk)
#     buy = 1
#     while True:
#         if arr[i]*buy<=mon:
#             ans = max(ans, helper(i+1, mon - arr[i]*buy, stk+buy))
#         else:
#             break
        
#         buy += 1
    
#     for s in range(1, stk+1):
#         ans = max(ans, helper(i+1, mon+arr[i]*s, stk-s))
    
#     mem[key] = ans
#     return ans

    
# print(helper(0, 1000, 0))

Buggy submission (verdict: Runtime Error):

n= int(input())
arr = [int(x) for x in input().strip().split()]

mem = {}
def helper(i, mon, stk):
  	key = (i, mon, stk)
    if key in mem:
      	return mem[key]
      
    if i==len(arr):
        return mon
    
    ans = helper(i+1, mon, stk)
    buy = 1
    while True:
        if arr[i]*buy<=mon:
            ans = max(ans, helper(i+1, mon - arr[i]*buy, stk+buy))
        else:
            break
        
        buy += 1
    
    for s in range(1, stk+1):
        ans = max(ans, helper(i+1, mon+arr[i]*s, stk-s))
    
    mem[key] = ans
    return ans

    
print(helper(0, 1000, 0))
Problem p02600 (python)

Fixed submission:
import numpy as np
a = int(input())
print(int( np.ceil((2000-a)/200)))

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

Stock = 0
Money = 1000
 
for i in range(N-1):
    if A[i] < A[i + 1]:

        Stock = Money // A[i]
        Money %= A[i]
        Money += Stock * A[i+1]
print(Money)
Problem p02601 (python)

Fixed submission:
# cook your dish here
a,b,c = map(int, input().split())
k = int(input())
c1, c2 = 0, 0
while b<=a:
    b=b*2
    c1 = c1 + 1
while c <= b:
    c=c*2
    c2 = c2 +1
if c1 + c2 <= k:
    print('Yes')
else:
    print('No')

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

for i in range(n-k):
    if a[i+k] > a[i]:
        print('Yes')
    else:
        print('No')
Problem p02603 (python)

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

Stock = 0
Money = 1000
 
for i in range(N-1):
    if A[i] < A[i + 1]:

        Stock = Money // A[i]
        Money %= A[i]
        Money += Stock * A[i+1]
print(Money)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
pro = 0
b = a[0]
for i in range(n):
    if a[i]>b:
        pro = 1
        break
if pro==0:
    print('1000')
else:
    sum = 1000
    t = 0
    if n>3 :
        while sum > 0 and t< n-3:
            if a[t]>a[t+1]:
                continue
            else:
                if a[t+1]>a[t+2]:
                    num = sum // a[t]
                    sum = sum + a[t+1]*num - a[t]*num
                    t=t+1
                
                else :
                    num = sum // a[t]
                    sum = sum + a[t+2]*num - a[t]*num
                    a.pop(t+2)
            t = t+1
    elif n == 3:
        if a[1]>a[2]:
            num = sum // a[0]
            sum = sum + a[1]*num - a[0]*num
                
        else :
            num = sum // a[0]
            sum = sum + a[2]*num - a[0]*num
    else:
        num = sum // a[0]
        sum = sum + a[1]*num - a[0]*num
    print(sum)
Problem p02600 (python)

Fixed submission:
n = int(input())
 
a = 8 - ( (n -400) // 200)
 
print (a)

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

a = 8 - ( (n -400) // 200)

print a
Problem p02603 (python)

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

money = 1000
stock = 0

for i in range(n-1):
  if a[i+1] > a[i]:
    stock = money // a[i]
    money = money - stock * a[i] + stock * a[i+1]
    
print(money)

Buggy submission (verdict: Runtime Error):
N = int(input()) #1行目のNを取得する
Input = [int(input()) for i in range(N)] #複数行の数値の入力を取得
 
for i in range(N):
  j = i + 1
  
  Stock = 0
  Money = 1000
  
  if j = 1:
    if Input[i] < Input[i+1]:
      Stock = Money // Input[i]
      Money = Money % Input[i]
     
    continue
   
  if j = N:
    if Stock != 0:
      money = money + Stock * Input[i]
    continue
  
  if Input[i - 1] < Input[i]:
    money = money + Stock * Input[i]
  
  if Input[i + 1] > Input[i]:
    Stock = Money // Input[i]
    Money = Money % Input[i]

    
print(money)

Buggy submission (verdict: Runtime Error):
N = int(input()) #1行目のNを取得する
Input = [int(input()) for i in range(N)] #複数行の数値の入力を取得

for i in range(N):
  j = i + 1
  
  Stock = 0
  Money = 1000
  
  if j = 1:
    if Input[i] < Input[i+1]:
      Stock = Money // Input[i]
      Money = Money % Input[i]
     
    break
   
  if j = N:
    if Stock != 0:
      money = money + Stock * Input[i]
    break
  
  if Input[i - 1] < Input[i]:
    money = money + Stock * Input[i]
  
  if Input[i + 1] > Input[i]:
    Stock = Money // Input[i]
    Money = Money % Input[i]
Problem p02687 (python)

Fixed submission:
s = input()
if s == 'ABC':
  print('ARC')
else:
  print('ABC')

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'ABC':
  print('ARC')
else:
  pritn('ABC')
Problem p02713 (python)

Fixed submission:
from math import gcd
n=int(input())
ans=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            ans+=gcd(gcd(i,j),k)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

K = int(input())
res = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            tmp = math.gcd(i, j)s
            res += math.gcd(tmp, k)

print(res)
Problem p02909 (python)

Fixed submission:
weather = ['Sunny','Cloudy','Rainy']
N = input()
if N == weather[0]:
  print(weather[1])
elif N == weather[1]:
  print(weather[2])
else:
  print(weather[0])

Buggy submission (verdict: Runtime Error):
import heapq
N, M = [int(_) for _ in input().split()]
H = [-int(_) for _ in input().split()]
heapq.heapify(H)
ans = 0
for _ in range(M):
    a = heapq.heappop(H)
    heapq.heappush(H, a / 2)
print(-sum(int(a) for a in H))
Problem p02923 (python)

Fixed submission:
n=int(input())
h=[int(x) for x in input().split()]
cur=[0]*n
for i in range(1,n):
    if h[i]<=h[i-1]:
        cur[i]=cur[i-1]+1
print(max(cur))

Buggy submission (verdict: Runtime Error):
n=int(input())
h=map(int, input().split())
cur=[0]*n
for i in range(1,n):
    if h[i]<=h[i-1]:
        cur[i]=cur[i-1]+1
print(max(cur))
Problem p02982 (python)

Fixed submission:
import math
N, D = map(int, input().split())
a = []
for i in range(N):
  b = map(int, input().split())
  a += b
res = 0
for i in range(N-1):
  j = i + 1
  while(j < N):
    x = []
    y = []
    for k in range(D):
      x.append(a[i * D + k])
      y.append(a[j * D + k])
    tmp = 0
    for k in range(D):
      tmp += (x[k] - y[k]) ** 2
    if tmp == int(tmp ** 0.5) * int(tmp ** 0.5):
      res += 1
    j += 1
print(res)

Buggy submission (verdict: Runtime Error):
import math
N, D = map(int, input().split())
a = []
for i in range(N):
  b = map(int, input().split())
  a += b
print(a)
res = 0
for i in range(N-1):
  j = i + 1
  while(j < N):
    x = []
    y = []
    for k in range(D):
      x.append(a[i * D + k])
      y.append(a[j * D + k])
    tmp = 0
    for k in range(D):
      tmp += (x[k] - y[k]) ** 2
    if tmp = int(tmp ** 0.5) * int(tmp ** 0.5):
      res += 1
    j += 1
print(res)
Problem p02994 (python)

Fixed submission:
N, L = map(int, input().split())
taste_all = 0
for i in range(N):
    taste_all += L + i
if abs(L) < N and L < 0:
    print(taste_all)
elif L == 0:
    print(taste_all)
elif L < 0:
    print(taste_all - (L + N - 1))
elif L > 0:
    print(taste_all - L)

Buggy submission (verdict: Runtime Error):
N, L = map(int, input().split())
taste_all = 0
for i in range(N):
    taste_all += L + i
if abs(L) < N and L < 0:
    print(taste_all)
elif L = 0:
    print(taste_all)
elif L < 0:
    print(taste_all - (L + N - 1))
elif L > 0:
    print(taste_all - L)
Problem p02995 (python)

Fixed submission:
import fractions
A, B, C, D = map(int, input().split())
Cdiv = B // C - (A - 1) // C
Ddiv = B // D - (A - 1) // D
gcd_CD = int(C * D / fractions.gcd(C, D))
CDdiv = B // gcd_CD - (A - 1) // gcd_CD
result = int(B - (A - 1) - Cdiv - Ddiv + CDdiv)
print(result)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
result = 0
size = B - A + 1
for i in range(size):
    if((A + i)%C == 0):
        pass
    elif((A + i)%D ==0):
        pass
    else
        result += 1

print(result)
Problem p03060 (python)

Fixed submission:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
G = [0] * N
for i in range(N):
    dif = V[i] - C[i]
    if(dif > 0):
        G[i] = dif
print(sum(G))

Buggy submission (verdict: Runtime Error):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
G = [0] * N
for i in range(N):
    dif = V[i] - C[i]
    if(dif > 0):
        G[i] = dif
print(sum(G[i]))
Problem p03106 (python)

Fixed submission:
A, B, K = map(int, input().split())
index = 0
for i in range(100, 0, -1):
  if A % i == 0 and B % i == 0:
    index += 1
    if(K == index):
      print(i)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
index = 0
for i in range(100, 0, -1):
  if int(A / i) == 0 and int(B / i) == 0:
    index += 1
    if(K == i):
      res = i
print(res)
Problem p02608 (python)

Fixed submission:
N = int(input())

ans = [0]*N

for i in range(1,101,1):
  for j in range(1,101,1):
    for k in range(1,101,1):
      n = i**2+j**2+k**2+i*j+j*k+k*i
      if n > N:
        continue
      else:
        ans[n-1]+=1
      
for i in range(N):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[0]*N
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            n=i*i+j*j+k*k+i*j+i*k+j*k
            if(n>N):
               continue
            a[n-1]+=1
for i in range(1,N+1):
    print(a[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[0]*10000
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            if(i*i+j*j+k*k+i*j+i*k+j*k==n):
                  a[n-1]+=1
            else:
                continue
for i in range(1,n+1):
    print(a[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
c=0
from itertools import combinations 
def rSubset(arr, r): 
  
    # return list of all subsets of length r 
    # to deal with duplicate subsets use  
    # set(list(combinations(arr, r))) 
    return list(combinations(arr, r)) 
for y in range(1,n+1):
    for i in range(1,int(y**0.5)):
        for j in range(1,int(y**0.5)):
            if(3*i*i+j*j+2*i*j==y):
                if(i==j):
                  c=c+1
                else:
                   c=c+3
    print(c)
if(c==0): 
  for i in range(1,int(y**0.5)):
        t.append(y)
  x=rSubset(t,3)
  for i in range(len(x)):
        if(x[i][0]**2+x[i][1]**2+x[i][2]**2+x[i][0]*x[i][1]+x[i][0]*x[i][2]+x[i][1]*x[i][2]==n):
           c=c+6
  print(c)
Problem p02639 (python)

Fixed submission:
a,b,c,d,e=map(int,input().split())
if(a==0):
    print(1)
if(b==0):
    print(2)
if(c==0):
    print(3)
if(d==0):
    print(4)
if(e==0):
    print(5)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
a=[0]*(10**6+1)
for i in range(n):
    if(a[l[i]]==0):
       for j in range(2*l[i],10**6+1,l[i]):
           a[j]=2
    a[l[i]]+=1
print(a.count(1))

Buggy submission (verdict: Runtime Error):
a,b,c,d,e=map(int,input().split()))
if(a==0):
    print(1)
if(b==0):
    print(2)
if(c==0):
    print(3)
if(d==0):
    print(4)
if(e==0):
    print(5)
Problem p02640 (python)

Fixed submission:
a,b=map(int,input().split())
k=[]
j=a
for i in range(a+1):
    k.append(2*j)
    j=j+1
#print(k)
if(b in k):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split()))
if(b%(2*a)==0 or b%(4*a)==0):
    print('No')
else:
    print('Yes')
Problem p02641 (python)

Fixed submission:
k,n=map(int,input().split())
if(n==0):
    print(k)
else:
  l=list(map(int,input().split()))
  c=1
  d=0
  if(k not in l):
      print(k)
  else:  
      while(d==0):
        if(k-c not in l):
           print(k-c)
           break
        if(k+c not in l):
           print(k+c)
           break
        c=c+1

Buggy submission (verdict: Runtime Error):
k,n=map(int,input().split())
if(n==0):
    print(k)
else:
  l=sorted(list(map(int,input().split())))
  a=[]
  a.append(k)
  for i in range(1,n-1):
    a.append(k-i)
    a.append(k+i)
  if(n%2==0):
    a.pop(-1)
  for i in range(n):
    if(l[i] in a):
        continue
    else:
         if(i!=n-1):
             print(min(a[i],a[i+1]))
             break
         else:
             print(a[i])
             break
Problem p02791 (python)

Fixed submission:
N=int(input())
p=list(map(int,input().split()))
a=[]
k=p[0]
for i in range(1,N):
    if k>p[i]:
     a.append(p[i])
     k=p[i] 
print(len(a)+1)

Buggy submission (verdict: Runtime Error):
N=int(input())
p=list(map(int,input().split()))
a=[]
for i in range(N):
  for k in range(i):
    if p[i]>=p[k]:
     a.append(p[i])

print(N-len(c))
Problem p03060 (python)

Fixed submission:
N = int(input())
V=list(map(int,input().split()))
C= list(map(int,input().split()))
a=[]
for i in range(0,N):
  if V[i]>=C[i]:
    a.append(V[i]-C[i])
  else:
    continue
print(sum(a))

Buggy submission (verdict: Runtime Error):
import heapq
N = int(input()) 
V=list(map(int,input().split())) 
C= list(map(int,input().split())) 
a=[] 
for i in range(0,N): 
  if V[i]>=C[i]: 
    heapq.heappush(a,(V[i]-C[i])) 
 　else: 
    continue 
print(sum(a))
Problem p03352 (python)

Fixed submission:
X=int(input())
c=[]
for i in range(0,X):
  for k in range(2,10):
    if (i+1)**k<=X:
      c.append((i+1)**k)
print(max(c))

Buggy submission (verdict: Runtime Error):
X=int(input())
c=[]
for i in range(0,X):
  for k in range(2,X):
    if (i+1)**k<=X:
      c.append((i+1)**k)
print(max(c))
Problem p02727 (python)

Fixed submission:
from collections import deque
X,Y,A,B,C = (int(i) for i in input().split())

P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
P_deque = deque(P)
Q_deque = deque(Q)
R_deque = deque(R)

red_counter = 0
green_counter = 0

ans = 0

for i in range(X+Y):
  if red_counter == X:
    P_deque = [-1]
  elif green_counter == Y:
    Q_deque = [-1]

  if len(R_deque) != 0:
    if P_deque[0] >= Q_deque[0] and P_deque[0] >= R_deque[0]:
      ans += P_deque.popleft()
      red_counter += 1
    elif Q_deque[0] >= P_deque[0] and Q_deque[0] >= R_deque[0]:
      ans += Q_deque.popleft()
      green_counter +=1
    else:
      ans += R_deque.popleft()
  else:
    if P_deque[0] >= Q_deque[0]:
      ans += P_deque.popleft()
      red_counter += 1
    elif Q_deque[0] >= P_deque[0]:
      ans += Q_deque.popleft()
      green_counter +=1

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
X,Y,A,B,C = (int(i) for i in input().split())

P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
P_deque = deque(P)
Q_deque = deque(Q)
R_deque = deque(R)

red_counter = 0
green_counter = 0

ans = 0

for i in range(X+Y):
  if red_counter == X:
    P_deque = [-1]
  elif green_counter == Y:
    Q_deque = [-1]

  if len(R) != 0:
    if P_deque[0] >= Q_deque[0] and P_deque[0] >= R_deque[0]:
      ans += P_deque.popleft()
      red_counter += 1
    elif Q_deque[0] >= P_deque[0] and Q_deque[0] >= R_deque[0]:
      ans += Q_deque.popleft()
      green_counter +=1
    else:
      ans += R_deque.popleft()
  else:
    if P_deque[0] >= Q_deque[0]:
      ans += P_deque.popleft()
      red_counter += 1
    elif Q_deque[0] >= P_deque[0]:
      ans += Q_deque.popleft()
      green_counter +=1

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
X,Y,A,B,C = (int(i) for i in input().split())

P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
P_deque = deque(P)
Q_deque = deque(Q)
R_deque = deque(R)

red_counter = 0
green_counter = 0

ans = 0

for i in range(X+Y):
  if red_counter == X:
    P_deque = [-1]
  elif green_counter == Y:
    Q_deque = [-1]

  if len(R) != 0:
    if P_deque[0] >= Q_deque[0] and P_deque[0] >= R_deque[0]:
      ans += P_deque.popleft()
      red_counter += 1
    elif Q_deque[0] >= P_deque[0] and Q_deque[0] >= R_deque[0]:
      ans += Q_deque.popleft()
      green_counter +=1
    else:
      ans += R_deque.popleft()

print(ans)
Problem p02761 (python)

Fixed submission:
N,M = (int(i) for i in input().split())

SC = []
max_digits = 0
for i in range(M):
  S,C = (int(i) for i in input().split())
  SC.append([S,C])

ans = -1
if M != 0:
  ans = -1
  range_min = 10**(N-1)
  if N == 1:
    range_min = 0
  for i in range(range_min,10**(N)):
    check_flag = True
    for sc in SC:
      s = sc[0]
      c = sc[1]
      if str(i)[s-1] != str(c):
        check_flag = False
        break
    if check_flag is True:
      ans = i
      break
else:
  if N == 1:
    ans = 0
  elif N ==2:
    ans = 10
  elif N == 3:
    ans = 100

print(ans)

Buggy submission (verdict: Runtime Error):
N,M = (int(i) for i in input().split())

SC = []
max_digits = 0
for i in range(M):
  S,C = (int(i) for i in input().split())
  SC.append([S,C])
  max_digits = max(max_digits,S)

ans = -1
for i in range(10**(max_digits-1),10**(max_digits)):
  check_flag = True
  for sc in SC:
    s = sc[0]
    c = sc[1]
    if str(i)[s-1] != str(c):
      check_flag = False
      break
  if check_flag is True:
    ans = i
    break

print(ans)
Problem p02900 (python)

Fixed submission:
import math
from fractions import gcd
A,B = (int(i) for i in input().split())

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

    divisors.sort()
    return divisors

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = gcd(A,B)
N_divisors = make_divisors(N)
prime_nums = []
for i in range(1,len(N_divisors)):
  if i == 1:
    prime_nums.append(N_divisors[i])
  else:
    for j in range(1,i):
      if N_divisors[i]%N_divisors[j] == 0:
        break
      if j == i-1:
        prime_nums.append(N_divisors[i])

ans = 1 + len(prime_nums)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
A,B = (int(i) for i in input().split())

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

    divisors.sort()
    return divisors

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = math.gcd(A,B)
N_divisors = make_divisors(N)
prime_nums = []
for i in range(1,len(N_divisors)):
  if i == 1:
    prime_nums.append(N_divisors[i])
  else:
    for j in range(1,i):
      if N_divisors[i]%N_divisors[j] == 0:
        break
      if j == i-1:
        prime_nums.append(N_divisors[i])

ans = 1 + len(prime_nums)
print(ans)
Problem p02911 (python)

Fixed submission:
N,K,Q = (int(i) for i in input().split())

points = [K-Q for i in range(N)]
for i in range(Q):
  A = int(input()) - 1
  points[A] += 1

for i in range(N):
  if points[i] <= 0:
    print("No")
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N,K,Q = (int(i) for i in input().split())

points = [K-Q for i in range(N)]
for i in range(Q):
  A = int(input()) - 1
  points(A) += 1

for i in range(Q):
  if points[i] <= 0:
    print("No")
  else:
    print("Yes")
Problem p02952 (python)

Fixed submission:
N = int(input())

N_length = len(str(N))
ans = 0

for i in range(1,N+1):
  if len(str(i))%2 == 1:
    ans += 1

print(ans)

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

N_str = str(N)

N_length = len(N_str)
tmp_str = ""
ans = 0

if N_length%2 == 1:
  for i in range(len(N_str)-1):
    if i%2 == 0:
      tmp_str+="0"
    else:
      tmp_str+="9"
  if N_length-1 != 0:
    ans += N - (10 ** (N_length-1))
  else:
    ans += N
else:
  for i in range(len(N_str)-1):
    if i%2 == 0:
      tmp_str+="9"
    else:
      tmp_str+="0"

print(ans + int(tmp_str))
Problem p03030 (python)

Fixed submission:
N = int(input())
SP = [list(map(str, input().split())) for _ in range(N)]

for i in range(N):
  SP[i].append(i+1)
  SP[i][1] = int(SP[i][1])*(-1)

ans = sorted(SP, key=lambda x:(x[0],x[1]))

for i in range(N):
  print(ans[i][2])

Buggy submission (verdict: Runtime Error):
 N = int(input())
 SP = [list(map(str, input().split())) for _ in range(N)]

 for i in range(N):
   SP[i].append(i+1)
   SP[i][1] = int(SP[i][1])*(-1)

 ans = sorted(SP, key=lambda x:(x[0],x[1]))

 for i in range(N):
   print(ans[i][2])
Problem p03037 (python)

Fixed submission:
N, M= (int(i) for i in input().split())

L_max = 1
R_min = N

for i in range(M):
    L, R = map(int, input().split())
    L_max = max(L_max,L)
    R_min = min(R_min,R)

ans = set(range(L_max,R_min+1))

print(len(ans))

Buggy submission (verdict: Runtime Error):
 N, M= (int(i) for i in input().split())

 ans = set(range(1,N+1))

 for i in range(M):
     L_tmp, R_tmp = map(int, input().split())
     ans = ans & set(range(L_tmp,R_tmp+1))

 print(len(ans))