Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
h_l = list(map(int,input().split()))
cnt = 0
for i in range(n):
    h_i = h_l[i]
    cnt += sum([1 for j in range(i,n) if((j-i)==(h_l[j]+h_i))])
            

print(cnt)

Fixed submission:
x = int(input())
sign = ((1,1),(1,-1),(-1,1),(-1,-1))
isloop=True
for a in range(10**3):
    if(isloop==False):
        break
    for b in range(10**3):
        if(isloop==False):
            break
        for s1,s2 in sign:
            if(isloop==False):
                break
            a1 = s1*a
            b1 = s2*b
            if((a1**5)==(x+b1**5)):
                print(a1,b1)
                isloop=False
                break

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
sign = ((1,1),(1,-1),(-1,1),(-1,-1))
isloop=True
for a in range(10**5):
    if(isloop==False):
        break
    for b in range(10**5):
        if(isloop==False):
            break
        for s1,s2 in sign:
            if(isloop==False):
                break
            a1 = s1*a
            b1 = s2*b
            if((a1**5)==(x+b1**5)):
                print(a1,b1)
                isloop=False
                break
            
        

Fixed submission:
x = int(input())
sign = ((1,1),(1,-1),(-1,1),(-1,-1))
isloop=True
for a in range(10**3):
    if(isloop==False):
        break
    for b in range(10**3):
        if(isloop==False):
            break
        for s1,s2 in sign:
            if(isloop==False):
                break
            a1 = s1*a
            b1 = s2*b
            if((a1**5)==(x+b1**5)):
                print(a1,b1)
                isloop=False
                break

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
sign = ((1,1),(1,-1),(-1,1),(1,1))
isloop=True
for a in range(10**5):
    if(isloop==False):
        break
    for b in range(10**5):
        if(isloop==False):
            break
        for s1,s2 in sign:
            if(isloop==False):
                break
            a1 = s1*a
            b1 = s2*b
            if((a1**5)==(x+b1**5)):
                print(a1,b1)
                isloop=False
                break
            
        

Fixed submission:
x = int(input())
sign = ((1,1),(1,-1),(-1,1),(-1,-1))
isloop=True
for a in range(10**3):
    if(isloop==False):
        break
    for b in range(10**3):
        if(isloop==False):
            break
        for s1,s2 in sign:
            if(isloop==False):
                break
            a1 = s1*a
            b1 = s2*b
            if((a1**5)==(x+b1**5)):
                print(a1,b1)
                isloop=False
                break
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
save = [0]*n
#Ai + i
save = [a[i]+i for i in range(n)]
    
#j-Aj
ans = 0
for j in range(n):
    b = j-a[j]
    if(b<0):
        continue
    ans += save[0:j].count(b)

print(ans)

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

#Ai + i 
#j-Aj
ans = 0
cnt = [0]*(n+1)
for i in range(n-1):
    j=i+1
    a = mp[i]+i
    if(a<=n):
        cnt[a] += 1 
    b = j-mp[j]
    if(b<0):
        continue
    ans += cnt[b]
    

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
save = [0]*n
#Ai + i
for i in range(n):
    save[i] = a[i]+i
#j-Aj
ans = 0
for j in range(n):
    b = j-a[j]
    if(b<0):
        continue
    for i in range(j):
        if(b==save[i]):
            ans+=1

print(ans)

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

#Ai + i 
#j-Aj
ans = 0
cnt = [0]*(n+1)
for i in range(n-1):
    j=i+1
    a = mp[i]+i
    if(a<=n):
        cnt[a] += 1 
    b = j-mp[j]
    if(b<0):
        continue
    ans += cnt[b]
    

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h_l = list(map(int,input().split()))
cnt = 0
cnt = sum([sum([1 for j in range(i,n) if((j-i)==(h_l[j]+h_l[i]))]) for i in range(n)])            

print(cnt)

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

#Ai + i 
#j-Aj
ans = 0
cnt = [0]*(n+1)
for i in range(n-1):
    j=i+1
    a = mp[i]+i
    if(a<=n):
        cnt[a] += 1 
    b = j-mp[j]
    if(b<0):
        continue
    ans += cnt[b]
    

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h_l = list(map(int,input().split()))
cnt = 0
for i in range(n):
    h_i = h_l[i]
    cnt += sum([1 for j in range(i,n) if((j-i)==(h_l[j]+h_i))])
            

print(cnt)

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

#Ai + i 
#j-Aj
ans = 0
cnt = [0]*(n+1)
for i in range(n-1):
    j=i+1
    a = mp[i]+i
    if(a<=n):
        cnt[a] += 1 
    b = j-mp[j]
    if(b<0):
        continue
    ans += cnt[b]
    

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h_l = list(map(int,input().split()))
cnt = 0
for i in range(n):
    for j in range(i,n):
        if((j-i)==(h_l[j]+h_l[i])):
            cnt += 1

print(cnt)

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

#Ai + i 
#j-Aj
ans = 0
cnt = [0]*(n+1)
for i in range(n-1):
    j=i+1
    a = mp[i]+i
    if(a<=n):
        cnt[a] += 1 
    b = j-mp[j]
    if(b<0):
        continue
    ans += cnt[b]
    

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())
ma = 0

if(n<b):
    ma = (a*n)//b - (a* (n//b))
else:
    ma = (a*(b-1))//b - (a*((b-1)//b))
    for x in range(b,n+1):
        
        num = (a*x)//b - (a*(x//b))
        if(ma > num):
            break
        ma = num
        

print(ma)

Fixed submission:
a,b,n = map(int,input().split())
ma = 0

if(n<b):
    ma = (a*n)//b - (a* (n//b))
else:
    ma = (a*(b-1))//b - (a*((b-1)//b))
    """
    for x in range(b,n+1):
        
        num = (a*x)//b - (a*(x//b))
        if(ma > num):
            break
        ma = num
    """

print(ma)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())
ma = 0

if(n<b):
    ma = (a*n)//b - (a* (n//b))
else:
    ma = (a*(b-1))//b - (a*((b-1)//b))
    for x in range(b,n+1):
        num = (a*x)//b - (a*(x//b))
        if(ma < num):
            ma = num

print(ma)

Fixed submission:
a,b,n = map(int,input().split())
ma = 0

if(n<b):
    ma = (a*n)//b - (a* (n//b))
else:
    ma = (a*(b-1))//b - (a*((b-1)//b))
    """
    for x in range(b,n+1):
        
        num = (a*x)//b - (a*(x//b))
        if(ma > num):
            break
        ma = num
    """

print(ma)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())
ma = 0
"""
if(n<=b):
    ma = (a*n)//b - (a* (n//b))
else:
    ma = (a*(b-1))//b - (a*((b-1)//b))
    num = max([(a*x)//b - (a*(x//b)) for x in range(b,n+1)])
    print(num)
    if(ma < num):
        ma = num
"""
ma = max([(a*x)//b - (a*(x//b)) for x in range(0,n+1)])
print(ma)

Fixed submission:
a,b,n = map(int,input().split())
ma = 0

if(n<b):
    ma = (a*n)//b - (a* (n//b))
else:
    ma = (a*(b-1))//b - (a*((b-1)//b))
    """
    for x in range(b,n+1):
        
        num = (a*x)//b - (a*(x//b))
        if(ma > num):
            break
        ma = num
    """

print(ma)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

word_list = []

for i in range(n):
    word = input()
    if(word in word_list):
        continue
    word_list.append(word)
    
        

print(len(word_list))

Fixed submission:
n = int(input())

word_list = [input() for i in range(n)]
l = len(set(word_list))
        
print(l)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

word_list = []

for i in range(n):
    word = input()
    if(word in word_list):
        continue
    word_list.append(word)
    
        

print(len(word_list))

Fixed submission:
n = int(input())

word_list = [input() for i in range(n)]
l = len(set(word_list))
        
print(l)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())

def main():
    if(n<4):
        return 0
    ans=0
    for i in range(n):
        for j in range(i+1,n):
            nk = j-i
            for k in range(j+1,n):
                
                if((k-j)==nk):
                    continue
                if(s[i]==s[j] or s[j]==s[k] or s[i]==s[k]):
                    continue
                ans += 1
    return ans
print(main())

Fixed submission:
n = int(input())
s = list(input())
def main():
    ans = s.count('R') * s.count('G') * s.count('B')

    if(n<4):
        return 0
    
    for i in range(n):
        for j in range(i+1,n):
            k= 2*j-i
            if k>=n:
                continue
            if(s[i]==s[j] or s[i]== s[k] or s[j]==s[k]):
                continue
            ans -= 1
    return ans
print(main())
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
from math import gcd

if(n%k==0):
    print(0)
else:
    print(gcd(n,k))

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

def f(a,b):
    s = a//b 
    a = a-s*b
    ans = min(a,abs(a-b))
    return ans


if(n%k==0):
    print(0)
else:
    print(f(n,k))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = [int(x) for x in input().split()]
score = [0]*n
for i in range(n):
    score[i] = (1+p[i])/2

maxans = 0
for i in range(n-k+1):
    sums = sum(score[i:i+k])
    if(maxans < sums):
        maxans = sums
    
    
print(maxans)
    
    

Fixed submission:
n,k = map(int,input().split())
p = [int(x) for x in input().split()]

maxp = sum(p[0:k])
s = maxp
save = 0
pre = p[0]
for i in range(k,n):
    s = s - p[i-k] + p[i]
    if(maxp < s):
        maxp = s
        save = i-k+1

score = 0
for i in range(save,save+k):
    score += (1+p[i])/2 
print(score)
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
import math
m_cm3 = a*b*a
if(x >= (m_cm3/2)):
    s = 2*b - (2*x)/(a**2)
    s /= a
    ans = math.degrees(math.atan(s))
else:
    s = (2*x)/(a*b*b)
    ans = math.degrees(math.acos(s))

print(ans)

Fixed submission:
a,b,x = map(int,input().split())
import math
m_cm3 = a*b*a
if(x >= (m_cm3/2)):
    s = 2*b - (2*x)/(a**2)
    s /= a
    ans = math.degrees(math.atan(s))
else:
    s = (a*b*b)/(2*x)
    ans = math.degrees(math.atan(s))

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

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

from itertools import combinations

def gcd(a,b):
    while(b!=0):
        s = b
        b = a%b
        a = s
    return a

gcd_n = gcd(a,b)

#L = [i for i in range(1,gcd_n+1) if gcd_n%i==0]

def div(num):
    l = [1]
    if(num==1):
        return [1]
    while(num%2==0):
        num //=2
        l.append(2)
    f = 3
    while(f*f<=num):
        if num%f==0:
            num //= f
            l.append(f)
        else:
            f += 2
    
    if num!=1:
        l.append(num)
    return l

l = div(gcd_n)
cnt = 0
pre = 0
for i in range(len(l)):
    if pre==l[i]:
        continue
    pre = l[i]
    cnt += 1
print(cnt)

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

L = [i for i in range(1,gcd_n+1) if gcd_n%i==0]

def div(num):
    l = [1]
    if(num==1):
        return [1]
    while(num%2==0):
        num //=2
        l.append(2)
    f = 3
    while(f*f<=num):
        if num%f==0:
            num //= f
            l.append(f)
        else:
            f += 2
    
    if num!=1:
        l.append(num)
    return l

l = div(gcd_n)
cnt = 0
pre = 0
for i in range(len(l)):
    if pre==l[i]:
        continue
    pre = l[i]
    cnt += 1
print(cnt)


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

from itertools import combinations

def gcd(a,b):
    while(b!=0):
        s = b
        b = a%b
        a = s
    return a

gcd_n = gcd(a,b)

#L = [i for i in range(1,gcd_n+1) if gcd_n%i==0]

def div(num):
    l = [1]
    if(num==1):
        return [1]
    while(num%2==0):
        num //=2
        l.append(2)
    f = 3
    while(f*f<=num):
        if num%f==0:
            num //= f
            l.append(f)
        else:
            f += 2
    
    if num!=1:
        l.append(num)
    return l

l = div(gcd_n)
cnt = 0
pre = 0
for i in range(len(l)):
    if pre==l[i]:
        continue
    pre = l[i]
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
AdivC = (a-1)//c
BdivC = b//c
AdivD = (a-1)//d
BdivD = b//d
gc = math.gcd(c,d)
div = (c*d)//gc
AdivCandD = (a-1)//div
BdivCandD = b//div

divC = BdivC - AdivC
divD = BdivD - AdivD
divCandD = BdivCandD - AdivCandD
ans = b-a+1
ans = ans -(divC+divD-divCandD)
print(ans)

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
AdivC = (a-1)//c
BdivC = b//c
AdivD = (a-1)//d
BdivD = b//d
gc = fractions.gcd(c,d)
div = (c*d)//gc
AdivCandD = (a-1)//div
BdivCandD = b//div

divC = BdivC - AdivC
divD = BdivD - AdivD
divCandD = BdivCandD - AdivCandD
ans = b-a+1
ans = ans -(divC+divD-divCandD)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,s = map(int,input().split())
maxx = s // 10000
maxy = s // 5000 
isloop = True
for x in range(maxx+1):
    
    if(isloop==False):
        break
    xv = x*10000
    for y in range(maxy+1):
        
        if(isloop==False):
            break
        yv = y*5000
        xysum = xv+yv
        if(xysum > s):
            continue
        
        z = (s-(xysum))//1000
        if((x+z+y)==n):
            print(x,y,z)
            isloop=False
            break

if(isloop==True):
    print(-1,-1,-1)

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

isloop = True
for x in range(2001):
    
    if(isloop==False):
        break
    xv = x*10000
    for y in range(2001):
        
        if(isloop==False):
            break
        yv = y*5000
        xysum = xv+yv
        if(xysum > s):
            continue
        
        z = (s-(xysum))//1000
        if((x+z+y)==n):
            print(x,y,z)
            isloop=False
            break

if(isloop==True):
    print(-1,-1,-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,s = map(int,input().split())
maxx = s // 10000
maxy = s // 5000 
isloop = True
for x in range(maxx+1):
    if(isloop==False):
        break
    for y in range(maxy+1):
        if(isloop==False):
            break
        z = (s-10000*x-5000*y)//1000
        if((x+z+y)==n and z >= 0):
            print(x,y,z)
            isloop=False
            break

if(isloop==True):
    print(-1,-1,-1)

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

isloop = True
for x in range(2001):
    
    if(isloop==False):
        break
    xv = x*10000
    for y in range(2001):
        
        if(isloop==False):
            break
        yv = y*5000
        xysum = xv+yv
        if(xysum > s):
            continue
        
        z = (s-(xysum))//1000
        if((x+z+y)==n):
            print(x,y,z)
            isloop=False
            break

if(isloop==True):
    print(-1,-1,-1)
Buggy python submission (verdict: Runtime Error):
from itertools import permutations
n,m = map(int,input().split())
#rel = [list(map(int,input().split())) for i in range(n)]
rel_t = [[False for i in range(n)] for j in range(n)]

for i in range(n):
    a,b = map(int,input().split())
    rel_t[a-1][b-1]=True
    rel_t[b-1][a-1]=True

cnt=0
n_list = [i for i in range(n)]
for l in permutations(n_list,len(n_list)):
    if(l[0]!=1):
        continue
    judge=[rel_t[l[i]][l[i+1]] for i in range(n-1)]
    if all(judge):
        cnt+=1

print(cnt)

Fixed submission:
import sys
sys.setrecursionlimit(10000)
n,m = map(int,input().split())
rel = [[False for i in range(n+1)] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    rel[a][b] = True
    rel[b][a] = True

ans=0
def rec(l):
    global ans
    if(len(l)==n):
        ans+=1
    x = l[-1]
    for i in range(1,n+1):
        if(i in l):
            continue
        if(rel[x][i]):
            rec(l+[i])

rec([1])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
count=0
for x in range(k+1):
    if(x > s):
        break
    for y in range(k+1):
        if((y+x) > s):
            break
        for z in range(k+1):
            nsum = x+y+z
            if(nsum==s):
                count += 1
print(count)

Fixed submission:
k,s = map(int,input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if(z < 0 or z > k):
           continue
        ans += 1 
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
ans = np.triu(np.outer(a, a), k=1).sum()

print(ans % mod)


Fixed submission:
mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
dp = [0]

def calc(A, n, dp):
    dp += [A[0] * A[1]]
    rsum = A[0] + A[1]
    for i in range(2, n):
        dp += [dp[-1] + rsum * A[i]]
        rsum += A[i]

    i = dp.index(max(dp))
    rsum = 0
    for j in range(i + 1):
        rsum += A[j]
    res = max(dp)
    dp2 = max(dp)
    for j in range(0, i):
        rsum -= A[j]
        dp2 -= A[j] * rsum
        res = max(dp2, res)
    return res

ans = calc(a, n, dp) % mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
ans = 0
for i in range(n):
    ans += a[i] * sum(a[(i + 1):])
print(ans % mod)


Fixed submission:
mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
dp = [0]

def calc(A, n, dp):
    dp += [A[0] * A[1]]
    rsum = A[0] + A[1]
    for i in range(2, n):
        dp += [dp[-1] + rsum * A[i]]
        rsum += A[i]

    i = dp.index(max(dp))
    rsum = 0
    for j in range(i + 1):
        rsum += A[j]
    res = max(dp)
    dp2 = max(dp)
    for j in range(0, i):
        rsum -= A[j]
        dp2 -= A[j] * rsum
        res = max(dp2, res)
    return res

ans = calc(a, n, dp) % mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
ans = 0
arr = list(itertools.combinations(a, 2))
for i, j in arr:
    ans += i * j
print(ans % mod)


Fixed submission:
mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
dp = [0]

def calc(A, n, dp):
    dp += [A[0] * A[1]]
    rsum = A[0] + A[1]
    for i in range(2, n):
        dp += [dp[-1] + rsum * A[i]]
        rsum += A[i]

    i = dp.index(max(dp))
    rsum = 0
    for j in range(i + 1):
        rsum += A[j]
    res = max(dp)
    dp2 = max(dp)
    for j in range(0, i):
        rsum -= A[j]
        dp2 -= A[j] * rsum
        res = max(dp2, res)
    return res

ans = calc(a, n, dp) % mod
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n =int(input())
a = list(map(int, input().split()))
s = Counter(a)
for v in s.values():
    print(v)
for i in range(n - len(ans)):
    print(0)



Fixed submission:
from collections import Counter
n =int(input())
a = list(map(int, input().split()))
s = Counter(a)
ans = [0] * n
for k, v in s.items():
    ans[k - 1] = v
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print((a * b) // math.gcd(a, b))


Fixed submission:
import fractions
a, b = map(int, input().split())
print((a * b) // fractions.gcd(a, b))
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
n = int(input())
arr = list(map(int, input().split()))
ans = 0
arr = list(combinations(arr, 2))
for i, j in arr:
    ans += i ^ j
print(ans % (10 ** 9 + 7))


Fixed submission:
arr = list(map(int, input().split()))
ans = 'bust' if sum(arr) >= 22 else 'win'
print(ans)

Buggy python submission (verdict: Runtime Error):
from itertools import combinations
n = int(input())
ans = 0
for i, j in list(combinations(list(map(int, input().split())), 2)):
    ans += i ^ j
print(ans % (10 ** 9 + 7))


Fixed submission:
arr = list(map(int, input().split()))
ans = 'bust' if sum(arr) >= 22 else 'win'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())
ans = []

if l - r < 2019:
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            ans.append((i * j) % 2019)
    print(min(ans))
else:
    print(0)

Fixed submission:
l, r = map(int, input().split())
ans = []

if r - l < 2019:
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            ans.append((i * j) % 2019)
    print(min(ans))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int, input().split()))
ans = 0

for i in range(max(d)):
    low = len([x for x in d if x > i])
    if low == n - low:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
d = list(map(int, input().split()))
ans = 0
d.sort()
low = d[:len(d)//2][-1]
high = d[len(d)//2:][0]

print(high - low)
Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())
arr = [r, g, b]
arr.sort()
ans = 0
for i in range(n // arr[2] + 1):
    if arr[2] * i > n:
        break
    for j in range(n // arr[1] + 1):
        tmp = arr[2] * i + arr[1] * j
        if tmp > n:
            break
        else:
            if tmp == n:
                ans += 1
                break
            elif n - tmp > 0 and (n - tmp) % arr[0] == 0:
                ans += 1

print(ans)


Fixed submission:
R, G, B, n = map(int, input().split())
ans = 0
for r in range(n // R + 1):
    Rr = R * r
    for g in range((n - Rr) // G + 1):
        tmp = Rr + G * g
        if (n - tmp) % B == 0:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())
arr = [r, g, b]
arr.sort()
ans = 0
for i in range(n // arr[2] + 1):
    if arr[2] * i > n:
        break
    for j in range(n // arr[1] + 1):
        tmp = arr[2] * i + arr[1] * j
        if tmp > n:
            break
        else:
            if tmp == n:
                ans += 1
            elif n - tmp > 0 and (n - tmp) % arr[0] == 0:
                ans += 1

print(ans)


Fixed submission:
R, G, B, n = map(int, input().split())
ans = 0
for r in range(n // R + 1):
    Rr = R * r
    for g in range((n - Rr) // G + 1):
        tmp = Rr + G * g
        if (n - tmp) % B == 0:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())
arr = [r, g, b]
arr.sort()
ans = 0
for i in range(n // arr[2] + 1):
    for j in range(n // arr[1] + 1):
        tmp = arr[2] * i + arr[1] * j
        if tmp > n:
            break
        else:
            if tmp == n:
                ans += 1
            elif n - tmp > 0 and (n - tmp) % arr[0] == 0:
                ans += 1

print(ans)


Fixed submission:
R, G, B, n = map(int, input().split())
ans = 0
for r in range(n // R + 1):
    Rr = R * r
    for g in range((n - Rr) // G + 1):
        tmp = Rr + G * g
        if (n - tmp) % B == 0:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())
arr = [r, g, b]
arr.sort()
ans = 0
tmp = 0
for i in range(n // arr[2] + 1):
    for j in range(n // arr[1] + 1):
        tmp = arr[2] * i + arr[1] * j
        if tmp == n:
            ans += 1
        if n - tmp > 0 and (n - tmp) % arr[0] == 0:
            ans += 1

print(ans)


Fixed submission:
R, G, B, n = map(int, input().split())
ans = 0
for r in range(n // R + 1):
    Rr = R * r
    for g in range((n - Rr) // G + 1):
        tmp = Rr + G * g
        if (n - tmp) % B == 0:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = int(input())
ans = 0
ans += max(a, b)*2 - 1
print(ans)

Fixed submission:
a, b = map(int, input().split())
ans = 0
ans += max(a, b)
ans += max(ans-1, min(a, b))
print(ans)