Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())
 
z = list(range(K+1))
ans = []
 
for i in z:
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      ans.extend(2*K - s_z + 1)
  else:
    ans.extend(s_z + 1)
 
print(sum(ans))

Fixed submission:
K,S=map(int,input().split())

z = list(range(0,K+1))
answer = []

for i in z:
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      answer.append(K + 1 - (s_z - K))
  else:
    answer.append(s_z + 1)

print(sum(answer))

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())
 
z = list(range(K+1))
ans = [None]*(K+1)
 
for i in z:
  s_z = S - i
  if s_z < 0:
    ans[i] = 0
  elif K < s_z:
    if (K + 1) > (s_z - K):
      ans[i] = 2*K - s_z + 1
  else:
    ans[i] = s_z + 1
 
print(sum(ans))

Fixed submission:
K,S=map(int,input().split())

z = list(range(0,K+1))
answer = []

for i in z:
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      answer.append(K + 1 - (s_z - K))
  else:
    answer.append(s_z + 1)

print(sum(answer))

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())
 
z = list(range(K+1))
ans = []
 
for i in z:
  s_z = S - i
  if s_z < 0:
    ans[i] = 0
  elif K < s_z:
    if (K + 1) > (s_z - K):
      ans[i] = 2*K - s_z + 1
  else:
    ans[i] = s_z + 1
 
print(sum(ans))

Fixed submission:
K,S=map(int,input().split())

z = list(range(0,K+1))
answer = []

for i in z:
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      answer.append(K + 1 - (s_z - K))
  else:
    answer.append(s_z + 1)

print(sum(answer))

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

K,S=map(int,input().split())

z = list(range(K+1))
ans = []

for i in z:
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      ans[i] = K + 1 - (s_z - K)
  else:
    ans[i] = s_z + 1

print(sum(ans))

Fixed submission:
K,S=map(int,input().split())

z = list(range(0,K+1))
answer = []

for i in z:
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      answer.append(K + 1 - (s_z - K))
  else:
    answer.append(s_z + 1)

print(sum(answer))

Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())

z = list(range(0,K+1))
answer = []

for i in z:
  s_z = S - i
  if K < s_z:
    for x in list(range(s_z - K,K+1)):
      y = s_z - x
      answer.append([x, y, z])

  else:
    for x in list(range(0,s_z+1)):
      y = s_z - x
      answer.append([x, y, z])

print(len(answer))

Fixed submission:
K,S=map(int,input().split())

z = list(range(0,K+1))
answer = []

for i in z:
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      answer.append(K + 1 - (s_z - K))
  else:
    answer.append(s_z + 1)

print(sum(answer))

Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans=0

z = list(range(0,K+1))
answer = []

for i in z:
  s_z = S - i
  if K < s_z:
    for x in list(range(s_z - K,K+1)):
      y = s_z - x
      answer.append([x, y, z])

  else:
    for x in list(range(0,s_z+1)):
      y = s_z - x
      answer.append([x, y, z])

print(len(answer))

Fixed submission:
K,S=map(int,input().split())

z = list(range(0,K+1))
answer = []

for i in z:
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      answer.append(K + 1 - (s_z - K))
  else:
    answer.append(s_z + 1)

print(sum(answer))