Problem: You are given two integers K and S.   Three variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.   How many different assignments of values to X, Y and Z are there such that X + Y + Z = S?

Submission attempts (in order):
import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 15

count = 0
for x in range(k+1):
    if x = s:
        count = count + 1
        break
    for y in range(k+1):
        if s < x + y:
            break
        if x + y = s:
            count = count + 1
            break
        for z in range(k+1):
            if s - x - y < k:
                count = count + 1
                break
print(count)


import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 14

count = 0
for x in range(k+1):
    for y in range(k+1):
        if s-x-y <= k:
            count += 1
print(count)


import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 15

count = 0
for x in range(k+1):
    if x == s:
        count = count + 1
    if x + k < s:
        count = count
    if 2*k + x >= s:
        count = count + 1
    if s <= x + k:
        count = count + (s-x+1)

print(count)


import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 15

count = 0
for x in range(k+1):
    if x == s:
        count = count + 1
        break
    for y in range(k+1):
        if s < x + y:
            break
        if x + y == s:
            count = count + 1
            break
        for z in range(k+1):
            if s - x - y < k:
                count = count + 1
                break
print(count)


import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0]
s = x[1]

#k = 5
#s = 15

count = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                count = count + 1
                break
print(count)


import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 15

count = 0
for x in range(k+1):
    for y in range(k+1):
        if s < x + y:
            break
        for z in range(k+1):
            if s - x - y < k:
                count = count + 1
                break
print(count)


import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 15

count = 0
for x in range(k+1):
    if x == s:
        count = count + 1
        continue
    for y in range(k+1):
        if s == x + y:
            count = count + 1
            break
        for z in range(k+1):
            if s - x - y < k:
                count = count + 1
                break
print(count)


import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 15

count = 0
for x in range(k+1):
    if x = s:
        count = count + 1
        break
    for y in range(k+1):
        if s < x + y:
            break
        if x + y = s:
            count = count + 1
            break
        for z in range(k+1):
            if s - x - y < k:
                count = count + 1
                break
print(count)


import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 15

count = 0
for x in range(k+1):
    if x == s:
        count = count + 1
        break
    if x + k < s:
        count = count
    if 2*k + x >= s:
        count = count + 1
    if s <= x + k:
        count = count + (s-x+1)

print(count)


import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 15

count = 0
for x in range(k+1):
    if x == s:
        count = count + 1
        break
    for y in range(k+1):
        if x + k < s:
            count = count
        if 2*k + x >= s:
            count = count + 1
        if s <= x + k:
            count = count + (s-x+1)
            
print(count)



x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]

#k = 5
#s = 14

count = 0
for x in range(k+1):
    for y in range(k+1):
        if s-x-y <= k:
            count += 1
print(count)


import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 15

count = 0
for x in range(k+1):
    if x == s:
        count = count + 1
        break
    for y in range(k+1):
        if s == x + y:
            count = count + 1
            break
        for z in range(k+1):
            if s - x - y < k:
                count = count + 1
                break
print(count)


import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 14

count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if z <= k and 0 <= z:
            count += 1
print(count)


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted