Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())
Q = int(input())

qs = [list(map(str, input().split())) for _ in range(Q)]

def addFirst(base, s):
    return s + base

def addLast(base, s):
    return base + s

def reverse(base):
    return ''.join(list(reversed(base)))

for ls in qs:
    if ls[0] == "1":
        S = reverse(S)
    else:
        if ls[1] == "1":
            S = addFirst(S, ls[2])
        else:
            S = addLast(S, ls[2])

print(S)

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

qs = [list(map(str, input().split())) for _ in range(Q)]

x, y = S, ""
for ls in qs:
    if ls[0] == "1":
        x, y = y, x
    else:
        if ls[1] == "1":
            y += ls[2]
        else:
            x += ls[2]
            
y = ''.join(list(reversed(y)))
print(y+x)

Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())
Q = int(input())

qs = [list(map(str, input().split())) for _ in range(Q)]

def addFirst(base, s):
    return s + base

def addLast(base, s):
    return base + s

def reverse(base):
    return ''.join(list(reversed(base)))

for ls in qs:
    if ls[0] == "1":
        S = reverse(S)
    else:
        if ls[1] == "1":
            S = addFirst(S, ls[2])
        else:
            S = addLast(S, ls[2])

print(S)

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

qs = [list(map(str, input().split())) for _ in range(Q)]

x, y = S, ""
for ls in qs:
    if ls[0] == "1":
        x, y = y, x
    else:
        if ls[1] == "1":
            y += ls[2]
        else:
            x += ls[2]
            
y = ''.join(list(reversed(y)))
print(y+x)
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))

s = [0] * m
c = [0] * m

for i in range(m):
    s[i], c[i] = list(map(int, input().split()))

result = [0] * n

for i in range(m):
    if result[s[i]-1] == 0:
      result[s[i]-1] = c[i]
    elif result[s[i]-1] > c[i]:
      result[s[i]-1] = c[i]

print(result)
if result[0] == 0:
    print(-1)
else:
    if result[1] == 0:
        print(-1)
    
    ans = ""
    for n in result:
        ans += n
    print(ans)


Fixed submission:
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

num = [-1] * n
for s, c in sc:
    if num[s - 1] != -1 and num[s - 1] != c:
        print(-1)
        exit()
    if n > 1 and s == 1 and c == 0:
        print(-1)
        exit()
    num[s - 1] = c

if n > 1 and num[0] == -1:
    num[0] = 1

for i in range(n):
    if num[i] == -1:
        num[i] = 0

print("".join(str(x) for x in num))
Buggy python submission (verdict: Time Limit Exceeded):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

def combination(n,r):
    return factorial(n) // (factorial(n-r) * factorial(r))

MOD = 10**9 + 7

n, a, b = LI()

total = pow(2, n) - 1

ans = total - (combination(n, a) + combination(n,b))

print(ans % MOD)

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

MOD = 10**9 + 7

n, a, b = LI()

def combination(r):
    numerator = reduce(lambda x, y: x * y % MOD, [n - r + i + 1 for i in range(r)])
    denominator = reduce(lambda x, y: x * y % MOD, [i + 1 for i in range(r)])

    return numerator * pow(denominator, MOD-2, MOD) % MOD

ans = pow(2, n, MOD) - 1 - combination(a) - combination(b)

print(ans % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

A = FLI()

flg = False
for a in A:
   if A.count(a) > 1:
      print("NO")
      exit()

print("YES")

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

A = FLI()

flg = len(set(A)) == n

print("YES" if flg else "NO")

Buggy python submission (verdict: Time Limit Exceeded):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

A = FLI()

cnt = Counter(A)
flg = False
for a in A:
   if A.count(a) > 1:
      flg = True

if not flg:
  print("YES")
else:
  print("NO")


Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

A = FLI()

flg = len(set(A)) == n

print("YES" if flg else "NO")
Buggy python submission (verdict: Runtime Error):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n, k = MI()

h = np.array(sorted([int(i) for i in input().split()]))
hmax = h.max()

if k >= len(h):
    print(0)
    exit()

h = np.delete(h, len(h) - k)
print(np.sum(h))

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n, k = MI()

h = FLI()
h.sort(reverse = True)
print(sum(h[k:]))
Buggy python submission (verdict: Time Limit Exceeded):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

P = FLI()

cnt = 0
for i in range(n):
    chk = True
    for j in range(0, i)[::-1]:
        if P[i] > P[j]:
            chk = False
    if chk:
        cnt += 1
        
print(cnt)

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

P = FLI()

min = 10**9
ans = 0
for i in range(n):
    if P[i] < min:
        ans += 1
        min = P[i]
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n,k,q = MI()

A = [k]*n
for i in range(q):
    c = I()
    A = list(map(lambda x: x-1, A))
    A[c-1] += 1

for a in A:
    if a > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n,k,q = MI()

A = [0]*n
for i in range(q):
    c = I()
    A[c-1] += 1

for a in A:
    if q < k + a:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()
v = LI()
vs = sorted(v)

def kati(x,y):
    return (x+y)/2

result = []
for i in range(2, n):
    t = kati(kati(vs[i-2], vs[i-1]), vs[i])
    result.append(t)

ans = max(result)
print(ans)

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()
v = LI()
vs = sorted(v)

def kati(x,y):
    return (x+y)/2

result = vs[0]
cv = 0
for i in range(1, n):
    result = kati(result, vs[i])

print(result)
Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = [int(i) for i in input().split()]

bool = True
for i in range(n, 0, -1):
    t = nums[i] - 1
    if t < nums[i-1]:
        bool = False

if bool:
    print("Yes")
else:
    print("No")


Fixed submission:
a, b, c = map(int, input().split())
ans = b+c-a
if ans < 1:
    print(int(0))
else:
    print(ans)

Buggy python submission (verdict: Runtime Error):
a, b, c = [int(input()) for _ in range(3)]
ans = b+c-a
if ans < 1:
    print(0)
else:
    print(ans)


Fixed submission:
a, b, c = map(int, input().split())
ans = b+c-a
if ans < 1:
    print(int(0))
else:
    print(ans)

Buggy python submission (verdict: Runtime Error):
a, b, c = [int(input()) for _ in range(3)]

if (b + c) - a < 1:
    print(0)
else:
    print(b+c-a)

Fixed submission:
a, b, c = map(int, input().split())
ans = b+c-a
if ans < 1:
    print(int(0))
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = [int(i) for i in input().split()]

bool = True
for i in range(len(nums)):
    if i == len(nums):
        break
    t = nums[i] - 1
    if t > nums[i+1]:
        bool = False

if bool:
    print("Yes")
else:
    print("No")


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

for i in range(1, n, 1):
    if nums[i] < nums[i - 1]:
        print("No")
        exit()

    if nums[i] > nums[i - 1]:
        nums[i] -= 1

print("Yes")

Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = [int(i) for i in input().split()]

bool = True
for i in range(0, len(nums), 1):
    t = nums[i] - 1
    if t > nums[i+1]:
        bool = False

if bool:
    print("Yes")
else:
    print("No")


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

for i in range(1, n, 1):
    if nums[i] < nums[i - 1]:
        print("No")
        exit()

    if nums[i] > nums[i - 1]:
        nums[i] -= 1

print("Yes")

Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = [int(i) for i in input().split()]

bool = True
for i in range(n):
    t = nums[i] - 1
    if t > nums[i+1]:
        bool = False

if bool:
    print("Yes")
else:
    print("No")

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

for i in range(1, n, 1):
    if nums[i] < nums[i - 1]:
        print("No")
        exit()

    if nums[i] > nums[i - 1]:
        nums[i] -= 1

print("Yes")

Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = [int(input()) for _ in range(n)]

bool = True
for i in range(n):
    t = nums[i] - 1
    if t > nums[i+1]:
        bool = False

if bool:
    print("Yes")
else:
    print("No")

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

for i in range(1, n, 1):
    if nums[i] < nums[i - 1]:
        print("No")
        exit()

    if nums[i] > nums[i - 1]:
        nums[i] -= 1

print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n, x = map(int, input().split())


def burger(n):
    if n == 0:
        return "P"
    else:
        return "B" + burger(n-1) + "P" + burger(n-1) + "B"

count = 0
l = list(burger(n))

for c in range(0, len(l) - 1):
  if l[c] == "P":
       count += 1
   
  if c == x-1:
       break

print(count)

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

l = [1]
p = [1]

for i in range(1,n+1):
    l.append(2 * l[i-1] + 3)
    p.append(2 * p[i-1] + 1)

def result(n, x):
    if n == 0:
        if x == 1:
            return 1
        else:
            return 0
    elif x == 1:
        return 0
    
    elif l[n] == x:
        return p[n]
    
    elif l[n]//2 + 1 <= x:
        return p[n-1] + 1 + result(n-1, x - l[n]//2-1)
    else:
        return result(n-1, x-1)

print(result(n, x))
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())

s = [input() for _ in range(h)]

ans = 'Yes'

for i in range(h):
    for j in range(w):
        if s[i][j] == '#' and s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
            ans = 'No'

print(ans)

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

s = [input() for _ in range(h)]

ans = 'Yes'

for i in range(1, h-1):
    for j in range(1, w-1):
        if s[i][j] == '#' and s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
            ans = 'No'

print(ans)

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

s = [input() for _ in range(h)]

ans = 'Yes'

for i in range(1, h):
    for j in range(1, w):
        if s[i][j] == '#' and s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
            ans = 'No'

print(ans)


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

s = [input() for _ in range(h)]

ans = 'Yes'

for i in range(1, h-1):
    for j in range(1, w-1):
        if s[i][j] == '#' and s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
            ans = 'No'

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

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

list = [0] + list + [0]

total = 0

# まずはすべての地点を経由する場合(最大値)にどれくらいコストがかかるのか計算する
for i in range(n+1):
    total += abs(list[i + 1] - list[i])

# 最大値から地点i-1から地点iまでの距離、地点iから地点i+1までの距離を引き、地点i-1から地点i+1までの距離を足してあげる
for i in range(1, n+1):
    print(total - abs(list[i-1] - list[i]) - abs(list[i] - list[i+1]) + abs(list[i-1] + list[i+1]))
    　

Fixed submission:
n = int(input())

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

list = [0] + list + [0]

total = 0

#まずはすべての地点を経由する場合(最大値)にどれくらいコストがかかるのか計算する
for i in range(n+1):
    total += abs(list[i + 1] - list[i])

#最大値から地点i-1から地点iまでの距離、地点iから地点i+1までの距離を引き、地点i-1から地点i+1までの距離を足してあげる
for i in range(1, n+1):
    print(total - abs(list[i] - list[i-1]) - abs(list[i+1] - list[i]) + abs(list[i+1] - list[i-1]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
num = 10**9 + 7

def factorial(n):
    if n == 1:
        return n
    return n * factorial(n-1)
  
print(factorial(n) % num)

Fixed submission:
import math

n = int(input())
num = 10**9 + 7
print(math.factorial(n) % num)

Buggy python submission (verdict: Runtime Error):
n = int(input())
num = 10**9 + 7
print(factorial(n) % numß)

def factorial(n):
    if n == 1:
        return n
    return n * factorial(n-1)

Fixed submission:
import math

n = int(input())
num = 10**9 + 7
print(math.factorial(n) % num)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = min(a) + min(b)
for i in range(m):
	sum = 0
	x,y,c = map(int,input().split())
	sum = a[x] + b[y] - c
	ans = min(ans,sum)
print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = min(a) + min(b)
for i in range(m):
	sum = 0
	x,y,c = map(int,input().split())
	sum = a[x-1] + b[y-1] - c
	ans = min(ans,sum)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
k=list()
sum=0
if n==1: print(0)
else:
	for i in range(n-1):
		if h[i] < h[i+1]:
			k.append(sum)
			sum=0
		else:
			sum+=1
	k=max(k)
	ans=max(k,sum)
	print(ans)


Fixed submission:
n=int(input())
h=list(map(int,input().split()))
k=list()
sum=0
ans=0
if n==1: print(0)
else:
	for i in range(n-1):
		if h[i] < h[i+1]:
			sum=0
		else:
			sum+=1
			ans=max(ans,sum)
	print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=0
for i in range(n):
	ans+=i
print(ans)

Fixed submission:
n=int(input())
ans=(n*n-n)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
n,a,b,c,d=map(int,input().split())
s=input()
if (c<d):
	if not '##' in s[a:d]: print('Yes')
	else: print('No')
elif (d<c):
	if (not '##' in s[a:c])&(s[d+1]!='#'):print('Yes')
	else: print('No')

Fixed submission:
n,a,b,c,d=map(int,input().split())
s=input()
if (c<d):
	if not '##' in s[a-1:d-1]: print('Yes')
	else: print('No')
elif (d<c):
	if (not '##' in s[a-1:c-1])&('...' in s[b-2:d+1]): print('Yes')
	else: print('No')
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
for b in range(N):
	for g in range(N):
		r=(-G*g-B*b+N)/R
		if (r==int(r))&(r>=0): count+=1
print(count)

Fixed submission:
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
for b in range(N+1):
	for g in range(N+1):
		r=-G*g-B*b+N
		if r<0:break
		if (r%R==0): count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
while(b<=N):
	g=0
	while(g<=N):
		r=(-G*g-B*b+N)/R
		if (r==int(r))&(r>=0): count+=1
		g+=1
	b+=1
print(count)

Fixed submission:
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
for b in range(N+1):
	for g in range(N+1):
		r=-G*g-B*b+N
		if r<0:break
		if (r%R==0): count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
while(B*b<=N):
	g=0
	while(G*g<=N-B*b):
		r=(-G*g-B*b+N)/R
		if r==int(r): count+=1
		g+=1
	b+=1
print(count)

Fixed submission:
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
for b in range(N+1):
	for g in range(N+1):
		r=-G*g-B*b+N
		if r<0:break
		if (r%R==0): count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
while(B*b<=N):
	g=0
	while(G*g<=N-B*b):
		r=(-G*g-B*b+N)/R
		if float(r).is_integer():
			count+=1
		g+=1
	b+=1
print(count)

Fixed submission:
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
for b in range(N+1):
	for g in range(N+1):
		r=-G*g-B*b+N
		if r<0:break
		if (r%R==0): count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
while(B*b<=N):
	g=0
	while(G*g<=N-B*b):
		r=(-G*g-B*b+N)/R
		if (float(r).is_integer())&(r>=0):
			count+=1
		g+=1
	b+=1
print(count)

Fixed submission:
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
for b in range(N+1):
	for g in range(N+1):
		r=-G*g-B*b+N
		if r<0:break
		if (r%R==0): count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
while(B*b<=N):
	g=0
	while(G*g<=N):
		r=(-G*g-B*b+N)/R
		if (float(r).is_integer())&(r>=0):
			count+=1
		g+=1
	b+=1
print(count)

Fixed submission:
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
for b in range(N+1):
	for g in range(N+1):
		r=-G*g-B*b+N
		if r<0:break
		if (r%R==0): count+=1
print(count)