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


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 0 <= z <= k and x+y+z == s:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
k, s = map(int, input().split())
lst1 = [x for x in range(k+1)]
lst2 = [x for x in range(k+1)]
lst3 = [x for x in range(k+1)]
data = list(itertools.product(lst1, lst2, lst3))
lst4 = [sum(i) for i in (data)]
print(lst4.count(s))


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 0 <= z <= k and x+y+z == s:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
k, s = map(int, input().split())
lst1 = [x for x in range(k+1)]
lst2 = [x for x in range(k+1)]
lst3 = [x for x in range(k+1)]
data = list(itertools.product(lst1, lst2, lst3))
lst4 = [sum(i) for i in (data)]
print(lst4.count(s))


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 0 <= z <= k and x+y+z == s:
            ans += 1
print(ans)

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


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 0 <= z <= k and x+y+z == s:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
k,s=map(int,input().split())
x=(x for x in range(0,k+1))
y=(y for y in range(0,k+1))
z=(z for z in range(0,k+1))
data=list(itertools.product(x,y,z))
ans=[sum(i) for i in (data)]
print(ans.count(s))


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 0 <= z <= k and x+y+z == s:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import sys
input = sys.stdin.readline
k,s=map(int,input().split())
x=[x for x in range(0,k+1)]
y=[y for y in range(0,k+1)]
z=[z for z in range(0,k+1)]
data=list(itertools.product(x,y,z))
ans=[sum(i) for i in (data)]
print(ans.count(s))

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 0 <= z <= k and x+y+z == s:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
k,s=map(int,input().split())
x=[x for x in range(0,k+1)]
y=[y for y in range(0,k+1)]
z=[z for z in range(0,k+1)]
data=list(itertools.product(x,y,z))
ans=[sum(i) for i in (data)]
print(ans.count(s))


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 0 <= z <= k and x+y+z == s:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
k,s=map(int,input().split())
x=[x for x in range(0,k+1)]
y=[y for y in range(0,k+1)]
z=[z for z in range(0,k+1)]
data=list(itertools.product(x,y,z))
ans=[sum(i) for i in (data)]
print(ans.count(s))


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 0 <= z <= k and x+y+z == s:
            ans += 1
print(ans)