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

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

count = S.count('E')

if S[0] == 'E':
	count-=1

countmin = count

for i in range (1, N):
	if S[i] == 'E':
		count-=1
	if S[i-1] == 'W':
		count+=1
	if count < countmin:
		countmin = count

print(countmin)

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

count = S.count('E')

if S[0] == 'E':
	coun-=1

countmin = count

for i in range (1, N):
	if S[i] == 'E':
		count-=1
	if S[i-1] == 'W':
		count+=1
	if count < countmin:
		countmin = count

print(countmin)
Problem p03380 (python)

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

import math
import bisect
max = L[-1]
maxdiv2 = max//2
posleft = bisect.bisect_left(L, maxdiv2)
posright = bisect.bisect_right(L, maxdiv2)

if len(L) == 2:
	print(L[1], L[0])
	exit()

if posleft!= posright:
	print(max, L[posleft])
	exit()

if abs(max/2 - L[posleft]) > abs(max/2 - L[posleft-1]):
	print(max, L[posleft-1])
else:
	print(max, L[posleft])

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

L = sorted(L)

import math

def combination(n, r):
	value = 1
	smaller = min(n-r, r)
	for i in range (0, smaller):
		value = value*(n-i)
	value = value/math.factorial(smaller)
	return value

seikai = 0
Emu = L[-1]
calc = 0

for i in range (0, N-1):
	if combination(Emu, L[i]) > calc:
		calc = combination(Emu, L[i])
		seikai = L[i]

print(L[-1], seikai)
Problem p03486 (python)

Fixed submission:
s= str(input())
t= str(input())

S = ['a']*len(s)
T = ['a']*len(t)

for i in range (0, len(s)):
	S[i]=ord(s[i])

for i in range (0, len(t)):
	T[i]=ord(t[i])

S = sorted(S)
T = sorted(T, reverse=True)

check = 0

for i in range (0, min(len(s), len(t))):
	if S[i] < T[i]:
		print('Yes')
		exit()
	elif S[i] == T[i]:
		check+=1

if check == min(len(S),len(t)) and len(T)>len(S):
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
s= str(input())
t= str(input())

S = ['a']*len(s)
T = ['a']*len(t)

for i in range (0, len(s)):
	S[i]=ord(s[i])

for i in range (0, len(t)):
	T[i]=ord(t[i])

S = sorted(S)
T = sorted(T, reverse=True)

check = 0

for i in range (0, len(s)):
	if S[i] < T[i]:
		print('Yes')
		exit()
	elif S[i] == T[i]:
		check+=1

if check == len(S) and len(T)>len(S):
	print('Yes')
else:
	print('No')
Problem p03559 (python)

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

A = sorted(A)
B = sorted(B)
C = sorted(C)

# for this we will use binary search.
import bisect as bis

BSC = [0]*N
ASB = [0]*N

for i in range (0, N):
	BSC[i] = N-bis.bisect_right(C, B[i])

for i in range (0, N):
	ASB[i] = bis.bisect_right(B, A[i])
    
for i in range (1, N):
	BSC[N-1-i] += BSC[N-i]

count = 0
for i in range (0, N):
	if ASB[i] ==N:
		continue
	else:
		count+=BSC[ASB[i]]

print(count)

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

A = sorted(A)
B = sorted(B)
C = sorted(C)

# for this we will use binary search.
import bisect as bis

for i in range (0, N):
	BSC[i] = N-bis.bisect_right(C, B[i])
Problem p02865 (python)

Fixed submission:
N = int(input())

if N % 2 == 0:
    print(N//2 -1)
else:
    print(N//2)

Buggy submission (verdict: Runtime Error):
import numpy as np

N = int(input())
D = list(map(int, input().split()))
D = np.array(D)
D = np.sort(D)

if D[0] != 0:
    print(0)
elif sum(D == 0) != 1:
    print(0)
elif sum(np.diff(np.array(list(set(D)))) != 1):
    print(0)
else:
    print(np.prod(D[1:]) % 998244353)

Buggy submission (verdict: Runtime Error):
from collections import Counter
import numpy as np


N = int(input())
D = list(map(int, input().split()))
D = np.array(D)
D = np.sort(D)


if D[0] != 0:
    print(0)
elif sum(D == 0) != 1:
    print(0)
else:
    D_counter = Counter(D)
    count = 1
    next = 1
    for i in range(1, max(D)+1):
        if i != next:
            print(0)
            break
        i = int(i)
        count = count * i**list(D_counter.values())[i]
        next += 1

print(count % 998244353)
Problem p02886 (python)

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

point_sum = 0

for n in range(N):
    head = d.pop(0)
    point_sum += sum(list(map(lambda x : x * head, d)))
    
print(point_sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
d = [int(input()) for i in range(N)]

point_sum = 0

for n in range(N):
    head = d.pop(0)
    point_sum += sum(list(map(lambda x : x * head, d)))
    
print(point_sum)

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

d = [int(input()) for i in range(N)]

point_sum = 0

for n in range(N):
    head = d.pop(0)
    point_sum += sum(list(map(lambda x : x * head, d)))
Problem p02606 (python)

Fixed submission:
l,r,d = map(int,input().split())
     
print( r//d -(l-1)//d )

Buggy submission (verdict: Runtime Error):
import numpy
import math
 
L, R, d = input().split()
 
N = R/d
 
n = 0  # 切り捨てしたい桁
y = math.floor(L * 10 ** n) / (10 ** n)
 
print(math.floor(y))

Buggy submission (verdict: Runtime Error):
import numpy
 
L, R, d = input().split()
 
N = R/d

n = 0  # 切り捨てしたい桁
y = math.floor(L * 10 ** n) / (10 ** n)

print(math.floor(y))

Buggy submission (verdict: Runtime Error):
import numpy
 
L, R, d = input().split()
 
N = R/d
 
print(math.floor(N))

Buggy submission (verdict: Runtime Error):
import numpy
 
a = input().split()
L = a(0)
R = a(1)
d = a(2)
 
N = R/d
 
print(math.floor(N))

Buggy submission (verdict: Runtime Error):
import numpy

a = input().split()
L = a[0]
R = a[1]
d = a[2]

N = R/d

print(math.floor(N))
Problem p02612 (python)

Fixed submission:
N = int(input())
a = N//1000
b = ((a+1)*1000)-N
if b%1000 == 0:
	b = 0
    
print(b)

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

ac = 0
wa = 0
tle = 0
re = 0

for i in range(1,N+1):
  S = str(input())
  if S == "AC":
    ac += 1
  elif S == "WA":
    wa += 1
  elif S == "TLE":
    tle += 1
  elif S == "RE":
    re += 1

print("AC ×" + str(ac))
print("WA ×" + str(wa))
print("TLE ×" + str(tle))
print("AC ×" + str(re))
Problem p02548 (python)

Fixed submission:
N = int(input())
count = 0
for i in range(1, N):
    count += (N-1) // i
print(count)

Buggy submission (verdict: Runtime Error):
import sympy
N = int(input())
count = 0
for C in range(1, N):
    AB = N - C
    count = count + len(sympy.divisors(AB))
print(count)
Problem p02536 (python)

Fixed submission:
# Connect Cities
# Union Findデータ構造（素集合データ構造）
 
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
 
#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
 
class UnionFind():
	"""docstring for UnionFind"""
	def __init__(self, n):
		self.parents = [-1]*n
 
	def find(self,x):
		if self.parents[x] < 0: #自分が親である時
			return x
		else: #自分が子供である時
			self.parents[x]=self.find(self.parents[x])
			return self.parents[x]
 
	def union(self,x,y):
		# 各要素の親要素を返す
		x=self.find(x)
		y=self.find(y)
 
		if x==y:
			return
		if self.parents[x] > self.parents[y]:
			x,y=y,x
 

		self.parents[y]=x

n,m=input2()
AB=[input_array() for _ in range(m)]
 
uf = UnionFind(n)
for ab in AB:
	a=ab[0]
	b=ab[1]
	uf.union(a-1,b-1)

ans=0
for i in uf.parents:
	if i < 0:
		ans+=1

print(ans-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
group = []
tf = []
for i in range(M):
  A, B = map(int, input().split())
  if A and B not in tf:
    tf.append(A)
    tf.append(B)
    group.append([A,B])
  else:
    if A not in tf:
      tf.append(A)
      for j in range(len(group)):
        if B in group[j]:
          group[i].append(A)
          break
    else:
      tf.append(B)
      for j in range(len(group)):
        if A in group[j]:
          group[i].append(B)
          break
l = list(range(1,N+1))
for i in tf:
  if i in l:
    l.remove(i)
    
print(len(group)+len(l)-1)
Problem p02606 (python)

Fixed submission:
L, R, d = input().split()
L, R, d = int(L), int(R), int(d)

count = 0
for i in range(L,R+1):
  if i%d==0:
    count += 1
    
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
l = [0]*N

for j in range(1,101):
  for k in range(1,101):
    for l in range(1,101):
      if (j**2+k**2+l**2+j*k+k*l+l*j)<i:
        l[j**2+k**2+l**2+j*k+k*l+l*j-1]+=1
        
for i in range(N):
  print(l[i])
Problem p02536 (python)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def resolve():
    import sys

    input = sys.stdin.readline

    n, m = [int(x) for x in input().rstrip().split(" ")]

    uf = UnionFind(n)

    for i in range(m):
        a, b = [int(x) for x in input().rstrip().split(" ")]
        uf.union(a-1, b-1)

    print(len(uf.roots()) - 1)


if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def resolve():
    import sys

    input = sys.stdin.readline

    n, m = [int(x) for x in input().rstrip().split(" ")]

    uf = UnionFind(n)

    for i in range(m):
        a, b = [int(x) for x in input().rstrip().split(" ")]
        uf.union(a, b)

    print(len(uf.roots()) - 1)



if __name__ == "__main__":
    resolve()
Problem p02615 (python)

Fixed submission:


def resolve():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip())
    a_list = [int(x) for x in input().rstrip().split(" ")]
    a_list.sort(reverse=True)
        
    from heapq import heappush, heappop

    hq = []
    joined = set()
    joined.add(0)
    heappush(hq, (-a_list[0], 0, 0))
    result = 0
            
    for i in range(1, n):

        comfort, left, right = heappop(hq)
        comfort = -comfort

        result += comfort

        heappush(hq, (-(a_list[left] if a_list[left] < a_list[i] else a_list[i]),left, i))
        heappush(hq, (-(a_list[right] if a_list[right] < a_list[i] else a_list[i]),i,right))
    
    print(result)


if __name__ == "__main__":
    resolve()


# を理解する。そうすると、明らかに制限時間内に実行が終わらないソースコードを出さなくなる。ちなみに、競プロでは 108108 ～ 109109 回程度のループが回せるといわれている。

Buggy submission (verdict: Runtime Error):


def resolve():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip())
    a_list = [int(x) for x in input().rstrip().split(" ")]
    a_list.sort(reverse=True)
        
    from heapq import heappush, heappop

    hq = []
    joined = set()
    joined.add(0)
    heappush(hq, (-a_list[0], 0, 0))
    result = 0
            
    for i in range(1, n):
        next_one = a_list[i]
        comfort, left, right = heappop(hq)
        comfort = -comfort

        result += comfort

        heappush(hq, (-(a_list[left] if a_list[left] < a_list[next_one] else a_list[next_one]),left, next_one))
        heappush(hq, (-(a_list[right] if a_list[right] < a_list[next_one] else a_list[next_one]),next_one,right))
    
    print(result)


if __name__ == "__main__":
    resolve()


# を理解する。そうすると、明らかに制限時間内に実行が終わらないソースコードを出さなくなる。ちなみに、競プロでは 108108 ～ 109109 回程度のループが回せるといわれている。
Problem p02641 (python)

Fixed submission:
import numpy as np

def resolve():
    import sys
    input = sys.stdin.readline
    xn = [int(x) for x in input().rstrip().split()]
    x = xn[0]
    n = xn[1]
	
    if n == 0:
      print(x)
      exit()
    
    p = [int(x) for x in input().rstrip().split()]
    num_list = [i for i in range(0, 102) if not i in p]

    idx = np.abs(np.asarray(num_list) - x).argmin()
    print(num_list[idx])



# x = list(map(int, input().split()))

if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
import numpy as np

def resolve():
    import sys
    input = sys.stdin.readline
    xn = [int(x) for x in input().rstrip().split()]
    x = xn[0]
    n = xn[1]
	
    if n == 0:
      print(x)
      exit()
    
    p = [int(x) for x in input().rstrip().split()]
    num_list = [i for i in range(1, 101) if not i in p]

    idx = np.abs(np.asarray(num_list) - x).argmin()
    print(num_list[idx])



# x = list(map(int, input().split()))

if __name__ == "__main__":
    resolve()
Problem p02717 (python)

Fixed submission:

def resolve():
    import sys
    input = sys.stdin.readline
    s = input().rstrip().split()
    print(s[2], s[0], s[1])
   
resolve()

Buggy submission (verdict: Runtime Error):

def resolve():
    import sys
    input = sys.stdin.readline
    k = int(input().rstrip())

    if k <= 9:
        # print(k)
        sys.exit()

    def judge(number_list, index, total):
        if index == len(number_list) - 2:  # 最後から2番目の桁
            num = number_list[index]
            add_num = 2 if num in (0, 9) else 3
            if (total + add_num) < k:
                total += add_num
                return total
            else:
                if num == 0:
                    right_nums = [num, num + 1]
                elif num == 9:
                    right_nums = [num-1,num]
                else:
                    right_nums = [num-1,num,num+1]
                number_list[-1] = right_nums[k-total-1]
                # print("".join(number_list))
                print(*number_list,sep="")
                sys.exit()
        else:  # 最後から２番目の桁じゃない
            num = number_list[index]
            if num == 0:
                right_nums = [num, num + 1]
            elif num == 9:
                right_nums = [num - 1, num]
            else:
                right_nums = [num - 1, num, num + 1]

            for right_num in right_nums:
                number_list[index+1] = right_num
                total = judge(number_list, index+1, total)
            return total

    total = 9
    num_list = [9]
    while True:
        num_list = [0 for _ in range(len(num_list)+1)]
        for left in [1,2,3,4,5,6,7,8,9]:
            num_list[0] = left
            # print(num_list, 0, total)
            total = judge(num_list, 0, total)




if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):

def resolve():
    import sys
    input = sys.stdin.readline
    n, k = [int(x) for x in input().rstrip().split()]
    n_set = set()
    while n not in n_set:

        n_set.add(n)
        if n == 0:
            break

        n = abs(k-n)
        if k < n:
          n = n - k*(abs(k-n)//k)
        # print(n)
        # print(n_set)

    print(min(n_set))

resolve()
Problem p02971 (python)

Fixed submission:
import math


def resolve():
    import sys
    import string
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    n = int(input().rstrip())
    a_list = [int(input().rstrip()) * -1 for i in range(n)]

    import numpy
    indices = numpy.argsort(a_list)
    max_num = a_list[indices[0]] * -1
    second_max_num = a_list[indices[1]] * -1

    for i in range(len(a_list)):
        if i != indices[0]:
            print(max_num)
        else:
            print(second_max_num)


if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
import math


def resolve():
    import sys
    import string
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    n = int(input().rstrip())
    a_list = [int(input().rstrip()) * -1 for i in range(n)]

    import numpy
    indices = numpy.argsort(a_list)
    max_num = a_list[indices[0]] * -1
    second_max_num = a_list[indices[1]] * -1

    for i in range(len(a_list)):
        if i != indices[0]:
            print(max_num)
        else:
            print(second_max_num)


if __name__ == "__main__":
    resolve()
Problem p02537 (python)

Fixed submission:
n, k = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))

root = [1]*n

for i in range(n)[-2::-1]:
    num = 0
    for j in range(i + 1, i + 200):
        if j >= n:
            break
        if abs(l[i] - l[j]) <= k:
            num = max(num, root[j])
    root[i] += num

print(max(root))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))

root = [1]*n

for i in range(n)[-2::-1]:
    num = 0
    for j in l[i + 1: i + 100]:
        if abs(i - j) <= k:
            num = max(num, root[j])
    root[i] += num

print(max(root))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))

root = [1]*n

for i in range(n)[-2::-1]:
    num = 0
    for j in l[i + 1:]:
        if abs(i - j) <= k:
            num = max(num, root[j])
    root[i] += num
    if i < n - 1000:
        del l[-1]

print(max(root))
Problem p02675 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
n = n%10
if n == 3:
    print("bon")
if n == 0 or n == 1 or n == 6 or n == 8):
    print("pon")
else:
    print("hon")
Problem p02677 (python)

Fixed submission:
a, b, h, m = map(int, input().split())
import math

a_ang = (h/12 + (1/12)*(m/60))*2*math.pi
b_ang = (m/60)*2*math.pi
ax = a*math.cos(a_ang)
bx = b*math.cos(b_ang)
ay = a*math.sin(a_ang)
by = b*math.sin(b_ang)

x = ax - bx
y = ay - by
ans = (x**2+y**2)**0.5
print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())
s = list(input())
an_lis = []
if len(s) <= k:
    ans = "".join(s)
    print(ans)
else:
    for i in range(k):
        an_lis.append(s[i])
    an_lis.append("...")
    ans = "".join(an_lis)
    print(ans)
Problem p02687 (python)

Fixed submission:
s = input()

if s == "ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = list(map(int, input().split()))
p = [False] + [True]*n
A = []
B = []
for i in range(m):
    a, b = map(int,input().split())
    A.append(a)
    B.append(b)

for i in range(m):
    if h[A[i] - 1] > h[B[i] - 1]:
        p[B[i]] = False
    if h[A[i] - 1] < h[B[i] - 1]:
        p[A[i]] = False
    else:
        p[A[i]] = False
        p[B[i]] = False

ans = [i for i in range(n + 1) if p[i]]

print(len(ans))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
m = [True]*n

for i in range(k):
    d = int(input())
    a = (list(map(int, input().split())))
    for j in a:
        m[j-1] = False
        
ans = [i for i in range(n) if m[i]]
print(len(ans))
Problem p02756 (python)

Fixed submission:
s = list(input())
q = int(input())
l1 = []
l2 = []
rev = False
for i in range(q):
    inp = input()
    if inp[0] == "1":
        if rev:
            rev = False
        else:
            rev = True
    elif inp[2] == "1":
        a = inp[4]
        if rev:
            l2.append(a)
        else:
            l1.append(a)
    else:
        a = inp[4]
        if rev:
            l1.append(a)
        else:
            l2.append(a)
l1.reverse()
ans = l1 + s + l2
if rev:
    ans.reverse()
print("".join(ans))

Buggy submission (verdict: Runtime Error):
s = list(input())
q = int(input())
rev = False
for i in range(q):
    print(input().split())
    if len(input()) == 1:
        if rev:
            rev = False
        else:
            rev = True
    else:
        if input()[2] == "1":
            a = input()[5]
            if rev:
                s.append(a)
            else:
                s.insert(0, a)
        else:
            a = input()[5]
            if rev:
                s.insert(0, a)
            else:
                s.append(a)
if rev:
    s.reverse()
print("".join(s))
Problem p02900 (python)

Fixed submission:
from math import gcd
a, b = map(int, input().split())

gcd = gcd(a, b)
ans = 1
n = int(gcd**0.5) + 2
for i in range(2, n):
    if gcd%i == 0:
        ans += 1
        while gcd%i == 0:
            gcd //= i
    if gcd < i:
        break
if gcd >= n:
    ans += 1
if ans == 1 and gcd != 1:
    ans = 2
    
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd
a, b = map(int, input().split())

def get_prime(n):
    num = [True]*(n + 1)
    for i in range(2, int(n**0.5) + 1):
        if num[i]:
            for j in range(i*2, n + 1, i):
                num[j] = False
    ans = [i for i in range(1, n + 1) if num[i]]
    return ans

gcd = gcd(a, b)
p = get_prime(gcd)
ans = 0
for i in p:
    if gcd%i == 0:
        ans += 1
print(ans)
Problem p03048 (python)

Fixed submission:
R, G, B, N = map(int, input().split())

ans = 0
for r in range(N//R + 1):
    for g in range((N - r*R)//G + 1):
        if (N - r*R - g*G)%B == 0:
                ans += 1
print(ans)

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

ans = [0]*(N//R + 1)*(N//G + 1)*(N//B + 1)
for r in range(N//R + 1):
    for g in range(N//G + 1):
        for b in range(N//B + 1):
            k = r*R + g*G + b*B
            ans[k] += 1
print(ans)
print(ans[N])

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

ans = [0]*(N//R + 1)*(N//G + 1)*(N//B + 1)
for r in range(N//R + 1):
    for g in range(N//G + 1):
        for b in range(N//B + 1):
            n = r*R + g*G + b*B
            ans[n] += 1
print(ans[n])